@progress/kendo-react-conversational-ui 13.4.0-develop.1 → 13.4.0-develop.3

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 (64) hide show
  1. package/api/message.interface.d.ts +87 -9
  2. package/chat/ChatPropsAndState.d.ts +108 -9
  3. package/chat/Events.d.ts +9 -0
  4. package/chat/components/ActionGroup.js +1 -1
  5. package/chat/components/ActionGroup.mjs +58 -48
  6. package/chat/components/Chat.d.ts +1 -1
  7. package/chat/components/Chat.js +1 -1
  8. package/chat/components/Chat.mjs +318 -269
  9. package/chat/components/ChatContext.d.ts +6 -3
  10. package/chat/components/ChatMessage.js +1 -1
  11. package/chat/components/ChatMessage.mjs +237 -177
  12. package/chat/components/Header.js +1 -1
  13. package/chat/components/Header.mjs +3 -3
  14. package/chat/components/NewMessage.d.ts +5 -3
  15. package/chat/components/NewMessage.js +1 -1
  16. package/chat/components/NewMessage.mjs +174 -226
  17. package/chat/components/ScrollButtonsWrapper.js +1 -1
  18. package/chat/components/ScrollButtonsWrapper.mjs +34 -40
  19. package/chat/components/SuggestionsGroup.js +1 -1
  20. package/chat/components/SuggestionsGroup.mjs +40 -39
  21. package/chat/components/elements/FileBox.js +1 -1
  22. package/chat/components/elements/FileBox.mjs +33 -41
  23. package/chat/components/elements/PinnedMessage.js +1 -1
  24. package/chat/components/elements/PinnedMessage.mjs +24 -22
  25. package/chat/hooks/useScrollWithButtons.d.ts +4 -0
  26. package/chat/hooks/useScrollWithButtons.js +1 -1
  27. package/chat/hooks/useScrollWithButtons.mjs +25 -23
  28. package/chat/utils/fieldMapping.d.ts +1 -1
  29. package/chat/utils/fieldMapping.js +1 -1
  30. package/chat/utils/fieldMapping.mjs +37 -34
  31. package/chat/utils/scroll.d.ts +15 -1
  32. package/chat/utils/scroll.js +3 -3
  33. package/chat/utils/scroll.mjs +92 -65
  34. package/chat/utils.d.ts +4 -1
  35. package/chat/utils.js +1 -1
  36. package/chat/utils.mjs +37 -37
  37. package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
  38. package/index.d.mts +6 -0
  39. package/index.d.ts +6 -0
  40. package/index.js +1 -1
  41. package/index.mjs +39 -31
  42. package/messages/index.d.ts +50 -0
  43. package/messages/index.js +1 -1
  44. package/messages/index.mjs +60 -40
  45. package/package-metadata.js +1 -1
  46. package/package-metadata.mjs +1 -1
  47. package/package.json +11 -11
  48. package/prompt-box/Events.d.ts +66 -0
  49. package/prompt-box/FileBox.d.ts +22 -0
  50. package/prompt-box/FileBox.js +8 -0
  51. package/prompt-box/FileBox.mjs +72 -0
  52. package/prompt-box/PromptBox.d.ts +35 -0
  53. package/prompt-box/PromptBox.js +8 -0
  54. package/prompt-box/PromptBox.mjs +424 -0
  55. package/prompt-box/PromptBoxActionButton.d.ts +32 -0
  56. package/prompt-box/PromptBoxActionButton.js +8 -0
  57. package/prompt-box/PromptBoxActionButton.mjs +14 -0
  58. package/prompt-box/PromptBoxSpeechToTextButton.d.ts +32 -0
  59. package/prompt-box/PromptBoxSpeechToTextButton.js +8 -0
  60. package/prompt-box/PromptBoxSpeechToTextButton.mjs +14 -0
  61. package/prompt-box/PromptBoxUploadButton.d.ts +108 -0
  62. package/prompt-box/PromptBoxUploadButton.js +8 -0
  63. package/prompt-box/PromptBoxUploadButton.mjs +54 -0
  64. package/prompt-box/interfaces/PromptBoxProps.d.ts +390 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import * as f from "react";
9
+ import { Button as x } from "@progress/kendo-react-buttons";
10
+ import { Upload as F } from "@progress/kendo-react-upload";
11
+ const e = f.forwardRef(
12
+ ({
13
+ onFilesAdd: p,
14
+ files: o = [],
15
+ restrictions: u,
16
+ multiple: i = !0,
17
+ accept: t,
18
+ uploadRef: s,
19
+ onSelectAttachments: a,
20
+ onRemoveAttachment: d,
21
+ _registerRemoveCallback: r,
22
+ ...B
23
+ }, E) => {
24
+ f.useEffect(() => (r && d && r(d), () => {
25
+ r && d && r(void 0);
26
+ }), [d, r]);
27
+ const U = f.useCallback(
28
+ (l) => {
29
+ p && p(l), a && a({
30
+ selectedFiles: l.affectedFiles,
31
+ allFiles: l.newState
32
+ });
33
+ },
34
+ [p, a]
35
+ );
36
+ return /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(x, { ref: E, ...B }), /* @__PURE__ */ f.createElement(
37
+ F,
38
+ {
39
+ ref: s,
40
+ files: o,
41
+ onAdd: U,
42
+ autoUpload: !1,
43
+ restrictions: u,
44
+ multiple: i,
45
+ accept: t,
46
+ className: "k-hidden"
47
+ }
48
+ ));
49
+ }
50
+ );
51
+ e.displayName = "PromptBoxUploadButton";
52
+ export {
53
+ e as PromptBoxUploadButton
54
+ };
@@ -0,0 +1,390 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2026 Progress Software Corporation. All rights reserved.
5
+ * Licensed under commercial license. See LICENSE.md in the package root for more information
6
+ *-------------------------------------------------------------------------------------------
7
+ */
8
+ import { ButtonProps, SpeechToTextButtonProps } from '@progress/kendo-react-buttons';
9
+ import { UploadProps, UploadFileInfo } from '@progress/kendo-react-upload';
10
+ import { PromptBoxBlurEvent, PromptBoxChangeEvent, PromptBoxFocusEvent, PromptBoxPromptActionEvent, PromptBoxSelectAttachmentsEvent } from '../Events.js';
11
+ import * as React from 'react';
12
+ /**
13
+ * Props passed to affix render functions.
14
+ *
15
+ * @hidden
16
+ */
17
+ export interface AffixTemplateProps {
18
+ /**
19
+ * Props for the upload button component.
20
+ */
21
+ uploadButtonProps: any;
22
+ /**
23
+ * Props for the speech-to-text button component.
24
+ */
25
+ speechToTextButtonProps: any;
26
+ /**
27
+ * Props for the action button component.
28
+ */
29
+ actionButtonProps: any;
30
+ }
31
+ /**
32
+ * Defines the line mode for the PromptBox component.
33
+ */
34
+ export type PromptBoxMode = 'single' | 'multi' | 'auto';
35
+ /**
36
+ * Represents the configuration options for the Upload button.
37
+ * Combines button styling props, upload behavior props, and event callbacks.
38
+ */
39
+ export interface UploadButtonProps extends Pick<ButtonProps, 'disabled' | 'fillMode' | 'icon' | 'iconClass' | 'rounded' | 'size' | 'svgIcon' | 'themeColor'>, Pick<UploadProps, 'restrictions' | 'multiple' | 'accept'> {
40
+ /**
41
+ * Fires when the user selects files via the upload button.
42
+ * Provides both the newly selected files and the complete file state.
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * <PromptBox
47
+ * uploadButtonConfig={{
48
+ * onSelectAttachments: (e) => {
49
+ * console.log('Selected:', e.selectedFiles);
50
+ * console.log('All files:', e.allFiles);
51
+ * }
52
+ * }}
53
+ * />
54
+ * ```
55
+ */
56
+ onSelectAttachments?: (event: PromptBoxSelectAttachmentsEvent) => void;
57
+ /**
58
+ * Fires when the user removes an attachment by clicking the remove button.
59
+ * In controlled mode (when `attachments` prop is provided), use this to update your state.
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * <PromptBox
64
+ * attachments={attachments}
65
+ * uploadButtonConfig={{
66
+ * onRemoveAttachment: (fileName) => {
67
+ * setAttachments(prev => prev.filter(file => file.name !== fileName));
68
+ * }
69
+ * }}
70
+ * />
71
+ * ```
72
+ */
73
+ onRemoveAttachment?: (fileName: string) => void;
74
+ }
75
+ /**
76
+ * Represents the props of the PromptBox component.
77
+ */
78
+ export interface PromptBoxProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'onFocus' | 'onBlur'> {
79
+ /**
80
+ * Sets the value for the internal input/textarea of the PromptBox.
81
+ *
82
+ * @default ''
83
+ *
84
+ * @example
85
+ * ```tsx
86
+ * <PromptBox value="Hello, how can I help you?" />
87
+ * ```
88
+ */
89
+ value?: string;
90
+ /**
91
+ * The default value of the PromptBox (uncontrolled mode).
92
+ *
93
+ * @example
94
+ * ```tsx
95
+ * <PromptBox defaultValue="Type your message..." />
96
+ * ```
97
+ */
98
+ defaultValue?: string;
99
+ /**
100
+ * Sets the line mode for the PromptBox component.
101
+ *
102
+ * The available options are:
103
+ * - `single` - Sets one line for the text input
104
+ * - `multi` - Multi-line textarea
105
+ * - `auto` - Transforms the PromptBox from single to multi line mode based on content
106
+ *
107
+ * @default 'auto'
108
+ *
109
+ * @example
110
+ * ```tsx
111
+ * <PromptBox mode="multi" />
112
+ * ```
113
+ */
114
+ mode?: PromptBoxMode;
115
+ /**
116
+ * Sets the visible height of the internal textarea in lines.
117
+ * Only applicable when mode is 'multi'.
118
+ * This sets the minimum number of rows.
119
+ *
120
+ * @default 1
121
+ *
122
+ * @example
123
+ * ```tsx
124
+ * <PromptBox mode="multi" rows={5} />
125
+ * ```
126
+ */
127
+ rows?: number;
128
+ /**
129
+ * Sets the maximum height of the native textarea in px.
130
+ * When the text height exceeds this value, a scrollbar appears.
131
+ * Applicable for `multi` and `auto` modes.
132
+ *
133
+ * @example
134
+ * ```tsx
135
+ * <PromptBox mode="auto" maxTextAreaHeight="300" />
136
+ * ```
137
+ */
138
+ maxTextAreaHeight?: string;
139
+ /**
140
+ * Sets the title attribute of the internal text input element of the component.
141
+ *
142
+ * @default ''
143
+ *
144
+ * @example
145
+ * ```tsx
146
+ * <PromptBox title="Enter your prompt" />
147
+ * ```
148
+ */
149
+ title?: string;
150
+ /**
151
+ * Sets the disabled state of the PromptBox component.
152
+ *
153
+ * @default false
154
+ *
155
+ * @example
156
+ * ```tsx
157
+ * <PromptBox disabled={true} />
158
+ * ```
159
+ */
160
+ disabled?: boolean;
161
+ /**
162
+ * Sets the read-only state of the PromptBox component.
163
+ *
164
+ * @default false
165
+ *
166
+ * @example
167
+ * ```tsx
168
+ * <PromptBox readOnly={true} />
169
+ * ```
170
+ */
171
+ readOnly?: boolean;
172
+ /**
173
+ * The hint, which is displayed when the text input element is empty.
174
+ *
175
+ * @default ''
176
+ *
177
+ * @example
178
+ * ```tsx
179
+ * <PromptBox placeholder="Type your message here..." />
180
+ * ```
181
+ */
182
+ placeholder?: string;
183
+ /**
184
+ * Sets the maximum number of characters allowed in the text input element.
185
+ *
186
+ * @example
187
+ * ```tsx
188
+ * <PromptBox maxLength={500} />
189
+ * ```
190
+ */
191
+ maxLength?: number;
192
+ /**
193
+ * Sets the HTML attributes of the inner focusable input element.
194
+ * Attributes which are essential for certain component functionalities cannot be changed.
195
+ *
196
+ * @example
197
+ * ```tsx
198
+ * <PromptBox inputAttributes={{ 'aria-label': 'Prompt input' }} />
199
+ * ```
200
+ */
201
+ inputAttributes?: React.InputHTMLAttributes<HTMLInputElement | HTMLTextAreaElement>;
202
+ /**
203
+ * Configures the `fillMode` of the PromptBox.
204
+ *
205
+ * The available options are:
206
+ * - solid
207
+ * - outline
208
+ * - flat
209
+ *
210
+ * @default undefined (theme-controlled)
211
+ *
212
+ * @example
213
+ * ```tsx
214
+ * <PromptBox fillMode="outline" />
215
+ * ```
216
+ */
217
+ fillMode?: 'solid' | 'flat' | 'outline';
218
+ /**
219
+ * Custom content rendered at the top of the PromptBox.
220
+ * Only rendered when mode is 'multi' or when 'auto' mode has more than 1 row.
221
+ *
222
+ * @example
223
+ * ```tsx
224
+ * <PromptBox topAffix={(props) => <div>Custom content</div>} />
225
+ * ```
226
+ */
227
+ topAffix?: React.ReactNode | ((props: AffixTemplateProps) => React.ReactNode);
228
+ /**
229
+ * Custom content rendered at the start of the input element in single line mode.
230
+ * In 'multi' and 'auto' with more than one row, it is rendered at the bottom left of the textarea.
231
+ *
232
+ * @example
233
+ * ```tsx
234
+ * <PromptBox startAffix={(props) => <Button icon="custom" />} />
235
+ * ```
236
+ */
237
+ startAffix?: React.ReactNode | ((props: AffixTemplateProps) => React.ReactNode);
238
+ /**
239
+ * Custom content rendered at the end of the input element.
240
+ * In 'multi' and 'auto' with more than one row, it is rendered at the bottom right of the textarea.
241
+ * Custom content appears BEFORE built-in buttons.
242
+ *
243
+ * @example
244
+ * ```tsx
245
+ * <PromptBox
246
+ * uploadButtonConfig={false}
247
+ * speechToTextButtonConfig={false}
248
+ * actionButtonConfig={false}
249
+ * endAffix={(props) => (
250
+ * <>
251
+ * <PromptBoxActionButton {...props.actionButtonProps} />
252
+ * <PromptBoxUploadButton {...props.uploadButtonProps} />
253
+ * <PromptBoxSpeechToTextButton {...props.speechToTextButtonProps} />
254
+ * </>
255
+ * )}
256
+ * />
257
+ * ```
258
+ */
259
+ endAffix?: React.ReactNode | ((props: AffixTemplateProps) => React.ReactNode);
260
+ /**
261
+ * The event handler that will be fired when the value changes.
262
+ *
263
+ * @example
264
+ * ```tsx
265
+ * <PromptBox onChange={(event) => console.log(event.value)} />
266
+ * ```
267
+ */
268
+ onChange?: (event: PromptBoxChangeEvent) => void;
269
+ /**
270
+ * The event handler that will be fired when the PromptBox is focused.
271
+ *
272
+ * @example
273
+ * ```tsx
274
+ * <PromptBox onFocus={(event) => console.log('Focused')} />
275
+ * ```
276
+ */
277
+ onFocus?: (event: PromptBoxFocusEvent) => void;
278
+ /**
279
+ * The event handler that will be fired when the PromptBox is blurred.
280
+ *
281
+ * @example
282
+ * ```tsx
283
+ * <PromptBox onBlur={(event) => console.log('Blurred')} />
284
+ * ```
285
+ */
286
+ onBlur?: (event: PromptBoxBlurEvent) => void;
287
+ /**
288
+ * Specifies whether the Send button is transformed to a stop generation button.
289
+ *
290
+ * @default false
291
+ *
292
+ * @example
293
+ * ```tsx
294
+ * <PromptBox loading={true} />
295
+ * ```
296
+ */
297
+ loading?: boolean;
298
+ /**
299
+ * Sets the File Attachments button visibility and/or settings.
300
+ *
301
+ * @default false
302
+ *
303
+ * @example
304
+ * ```tsx
305
+ * <PromptBox
306
+ * attachments={attachments}
307
+ * uploadButtonConfig={false}
308
+ * startAffix={(props) => (
309
+ * <PromptBoxUploadButton
310
+ * {...props.uploadButtonProps}
311
+ * onSelectAttachments={(e) => setAttachments(e.allFiles)}
312
+ * onRemoveAttachment={(fileName) => setAttachments(prev => prev.filter(f => f.name !== fileName))}
313
+ * />
314
+ * )}
315
+ * />
316
+ * ```
317
+ */
318
+ uploadButtonConfig?: boolean | UploadButtonProps;
319
+ /**
320
+ * Sets the SpeechToText button visibility and/or settings.
321
+ *
322
+ * @default true
323
+ *
324
+ * @example
325
+ * ```tsx
326
+ * <PromptBox speechToTextButtonConfig={true} />
327
+ * ```
328
+ */
329
+ speechToTextButtonConfig?: boolean | SpeechToTextButtonProps;
330
+ /**
331
+ * Sets the send button visibility and/or settings.
332
+ *
333
+ * @default true
334
+ *
335
+ * @example
336
+ * ```tsx
337
+ * <PromptBox
338
+ * actionButtonConfig={{
339
+ * themeColor: 'primary',
340
+ * rounded: 'full'
341
+ * }}
342
+ * />
343
+ * ```
344
+ */
345
+ actionButtonConfig?: boolean | ButtonProps;
346
+ /**
347
+ * Fires when the user clicks the Action button.
348
+ * The event provides the current value and attachments, allowing simple uncontrolled usage.
349
+ *
350
+ * @example
351
+ * ```tsx
352
+ * // Uncontrolled - access value and attachments from event
353
+ * <PromptBox
354
+ * onPromptAction={(e) => {
355
+ * console.log('Message:', e.value);
356
+ * console.log('Attachments:', e.attachments);
357
+ * sendMessage(e.value, e.attachments);
358
+ * }}
359
+ * />
360
+ *
361
+ * // Controlled - use your own state
362
+ * <PromptBox
363
+ * value={value}
364
+ * attachments={attachments}
365
+ * onPromptAction={(e) => {
366
+ * sendMessage(value, attachments);
367
+ * }}
368
+ * />
369
+ * ```
370
+ */
371
+ onPromptAction?: (event: PromptBoxPromptActionEvent) => void;
372
+ /**
373
+ * Sets the attachments for controlled file management.
374
+ * When provided, the component operates in controlled mode and the developer must manage attachments via onSelectAttachments and onRemoveAttachment.
375
+ * When not provided, the component manages attachments internally (uncontrolled mode).
376
+ */
377
+ attachments?: UploadFileInfo[];
378
+ /**
379
+ * Custom content rendered before the file attachments list in the FileBox.
380
+ * This content is displayed above the attachments when files are selected.
381
+ *
382
+ * @hidden
383
+ *
384
+ * @example
385
+ * ```tsx
386
+ * <PromptBox header={<div>Attachments:</div>} />
387
+ * ```
388
+ */
389
+ header?: React.ReactNode | (() => React.ReactNode);
390
+ }