@progress/kendo-react-conversational-ui 13.4.0-develop.2 → 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.
- package/api/message.interface.d.ts +87 -9
- package/chat/ChatPropsAndState.d.ts +108 -9
- package/chat/Events.d.ts +9 -0
- package/chat/components/ActionGroup.js +1 -1
- package/chat/components/ActionGroup.mjs +58 -48
- package/chat/components/Chat.d.ts +1 -1
- package/chat/components/Chat.js +1 -1
- package/chat/components/Chat.mjs +318 -269
- package/chat/components/ChatContext.d.ts +6 -3
- package/chat/components/ChatMessage.js +1 -1
- package/chat/components/ChatMessage.mjs +237 -177
- package/chat/components/Header.js +1 -1
- package/chat/components/Header.mjs +3 -3
- package/chat/components/NewMessage.d.ts +5 -3
- package/chat/components/NewMessage.js +1 -1
- package/chat/components/NewMessage.mjs +174 -226
- package/chat/components/ScrollButtonsWrapper.js +1 -1
- package/chat/components/ScrollButtonsWrapper.mjs +34 -40
- package/chat/components/SuggestionsGroup.js +1 -1
- package/chat/components/SuggestionsGroup.mjs +40 -39
- package/chat/components/elements/FileBox.js +1 -1
- package/chat/components/elements/FileBox.mjs +33 -41
- package/chat/components/elements/PinnedMessage.js +1 -1
- package/chat/components/elements/PinnedMessage.mjs +24 -22
- package/chat/hooks/useScrollWithButtons.d.ts +4 -0
- package/chat/hooks/useScrollWithButtons.js +1 -1
- package/chat/hooks/useScrollWithButtons.mjs +25 -23
- package/chat/utils/fieldMapping.d.ts +1 -1
- package/chat/utils/fieldMapping.js +1 -1
- package/chat/utils/fieldMapping.mjs +37 -34
- package/chat/utils/scroll.d.ts +15 -1
- package/chat/utils/scroll.js +3 -3
- package/chat/utils/scroll.mjs +92 -65
- package/chat/utils.d.ts +4 -1
- package/chat/utils.js +1 -1
- package/chat/utils.mjs +37 -37
- package/dist/cdn/js/kendo-react-conversational-ui.js +1 -1
- package/index.d.mts +6 -0
- package/index.d.ts +6 -0
- package/index.js +1 -1
- package/index.mjs +39 -31
- package/messages/index.d.ts +50 -0
- package/messages/index.js +1 -1
- package/messages/index.mjs +60 -40
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +11 -11
- package/prompt-box/Events.d.ts +66 -0
- package/prompt-box/FileBox.d.ts +22 -0
- package/prompt-box/FileBox.js +8 -0
- package/prompt-box/FileBox.mjs +72 -0
- package/prompt-box/PromptBox.d.ts +35 -0
- package/prompt-box/PromptBox.js +8 -0
- package/prompt-box/PromptBox.mjs +424 -0
- package/prompt-box/PromptBoxActionButton.d.ts +32 -0
- package/prompt-box/PromptBoxActionButton.js +8 -0
- package/prompt-box/PromptBoxActionButton.mjs +14 -0
- package/prompt-box/PromptBoxSpeechToTextButton.d.ts +32 -0
- package/prompt-box/PromptBoxSpeechToTextButton.js +8 -0
- package/prompt-box/PromptBoxSpeechToTextButton.mjs +14 -0
- package/prompt-box/PromptBoxUploadButton.d.ts +108 -0
- package/prompt-box/PromptBoxUploadButton.js +8 -0
- package/prompt-box/PromptBoxUploadButton.mjs +54 -0
- package/prompt-box/interfaces/PromptBoxProps.d.ts +390 -0
|
@@ -0,0 +1,424 @@
|
|
|
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 t from "react";
|
|
9
|
+
import o from "prop-types";
|
|
10
|
+
import { validatePackage as Qe, getLicenseMessage as Ye, dispatchEvent as L, classNames as oe, WatermarkOverlay as et } from "@progress/kendo-react-common";
|
|
11
|
+
import { stopSmIcon as tt, arrowUpOutlineIcon as nt, paperclipOutlineAltRightIcon as ot } from "@progress/kendo-svg-icons";
|
|
12
|
+
import { PromptBoxActionButton as st } from "./PromptBoxActionButton.mjs";
|
|
13
|
+
import { PromptBoxSpeechToTextButton as lt } from "./PromptBoxSpeechToTextButton.mjs";
|
|
14
|
+
import { PromptBoxUploadButton as rt } from "./PromptBoxUploadButton.mjs";
|
|
15
|
+
import { FileBox as it } from "./FileBox.mjs";
|
|
16
|
+
import { packageMetadata as ke } from "../package-metadata.mjs";
|
|
17
|
+
import { useLocalization as at } from "@progress/kendo-react-intl";
|
|
18
|
+
import { promptBoxInput as Ee, messages as k, promptBoxStopGenerating as K, promptBoxSendButton as q, promptBoxAttachFile as G, promptBoxAriaLabel as xe } from "../messages/index.mjs";
|
|
19
|
+
const p = "k-prompt-box", ct = 20, ut = 50, b = {
|
|
20
|
+
mode: "auto",
|
|
21
|
+
rows: 1,
|
|
22
|
+
defaultValue: "",
|
|
23
|
+
disabled: !1,
|
|
24
|
+
readOnly: !1,
|
|
25
|
+
loading: !1,
|
|
26
|
+
uploadButtonConfig: !1,
|
|
27
|
+
speechToTextButtonConfig: !0,
|
|
28
|
+
actionButtonConfig: !0
|
|
29
|
+
}, Te = t.forwardRef((Ae, Re) => {
|
|
30
|
+
const we = !Qe(ke, { component: "PromptBox" }), Se = Ye(ke), y = at(), Fe = { ...b, ...Ae }, {
|
|
31
|
+
mode: s = b.mode,
|
|
32
|
+
fillMode: se,
|
|
33
|
+
rows: F = b.rows,
|
|
34
|
+
maxTextAreaHeight: c,
|
|
35
|
+
value: le,
|
|
36
|
+
defaultValue: Pe = b.defaultValue,
|
|
37
|
+
disabled: f = b.disabled,
|
|
38
|
+
readOnly: Ne = b.readOnly,
|
|
39
|
+
placeholder: He,
|
|
40
|
+
title: Oe,
|
|
41
|
+
maxLength: Le,
|
|
42
|
+
inputAttributes: Me,
|
|
43
|
+
topAffix: re,
|
|
44
|
+
startAffix: C,
|
|
45
|
+
endAffix: v,
|
|
46
|
+
header: Ie,
|
|
47
|
+
onChange: R,
|
|
48
|
+
onFocus: X,
|
|
49
|
+
onBlur: Z,
|
|
50
|
+
onPromptAction: J,
|
|
51
|
+
attachments: ie,
|
|
52
|
+
loading: B = b.loading,
|
|
53
|
+
uploadButtonConfig: d = b.uploadButtonConfig,
|
|
54
|
+
speechToTextButtonConfig: M = b.speechToTextButtonConfig,
|
|
55
|
+
actionButtonConfig: I = b.actionButtonConfig,
|
|
56
|
+
className: $e,
|
|
57
|
+
style: ze,
|
|
58
|
+
...je
|
|
59
|
+
} = Fe, l = t.useRef(null), [De, $] = t.useState(Pe), [_e, Q] = t.useState([]), [a, ae] = t.useState(!1), ce = t.useRef(null), z = t.useRef(null), P = t.useRef(0), ue = t.useRef(0), N = t.useRef(!1), fe = t.useRef(0), j = t.useRef(0), E = t.useCallback(
|
|
60
|
+
(e, n) => e ? typeof e == "function" ? e(n) : e : null,
|
|
61
|
+
[]
|
|
62
|
+
), x = le !== void 0, u = x ? le : De, T = ie !== void 0, A = T ? ie : _e, H = t.useMemo(
|
|
63
|
+
() => !!(u != null && u.trim() || A.length > 0),
|
|
64
|
+
[u, A.length]
|
|
65
|
+
), w = t.useCallback(() => {
|
|
66
|
+
if (!l.current || s === "single")
|
|
67
|
+
return;
|
|
68
|
+
const e = l.current, n = globalThis.getComputedStyle(e), r = Number.parseFloat(n.lineHeight) || ct, i = Number.parseFloat(n.paddingTop) || 0, h = Number.parseFloat(n.paddingBottom) || 0;
|
|
69
|
+
P.current = e.offsetHeight || r + i + h, ue.current = r * F + i + h, s === "auto" && !a && (j.current = e.offsetWidth);
|
|
70
|
+
}, [s, F, a]), We = t.useCallback(() => s === "auto" ? 1 : F, [s, F]), me = t.useCallback(
|
|
71
|
+
(e) => {
|
|
72
|
+
if (c) {
|
|
73
|
+
const n = Number.parseInt(c, 10);
|
|
74
|
+
if (e > n)
|
|
75
|
+
return n;
|
|
76
|
+
}
|
|
77
|
+
return Math.max(ue.current, e);
|
|
78
|
+
},
|
|
79
|
+
[c]
|
|
80
|
+
), D = t.useCallback(
|
|
81
|
+
(e) => {
|
|
82
|
+
e.style.overflow = "hidden", e.style.height = `${P.current}px`;
|
|
83
|
+
const n = e.scrollHeight, r = me(n);
|
|
84
|
+
e.style.height = `${r}px`, c && n > Number.parseInt(c, 10) && (e.style.overflow = "");
|
|
85
|
+
},
|
|
86
|
+
[me, c]
|
|
87
|
+
), _ = t.useCallback(
|
|
88
|
+
(e) => {
|
|
89
|
+
e.style.overflow = "hidden", e.style.height = `${P.current}px`;
|
|
90
|
+
const n = e.scrollHeight, r = c ? Math.min(n, Number.parseInt(c, 10)) : n;
|
|
91
|
+
e.style.height = `${r}px`, c && n > Number.parseInt(c, 10) && (e.style.overflow = "");
|
|
92
|
+
},
|
|
93
|
+
[c]
|
|
94
|
+
), pe = t.useCallback((e) => {
|
|
95
|
+
if (j.current <= 0)
|
|
96
|
+
return !1;
|
|
97
|
+
const n = e.style.height, r = e.style.width;
|
|
98
|
+
e.style.overflow = "hidden", e.style.width = `${j.current}px`, e.style.height = `${P.current}px`;
|
|
99
|
+
const i = e.scrollWidth <= j.current && e.scrollHeight <= P.current;
|
|
100
|
+
return e.style.overflow = "", r ? e.style.width = r : e.style.width = "", n ? e.style.height = n : e.style.height = "", i;
|
|
101
|
+
}, []), W = t.useCallback(
|
|
102
|
+
(e, n) => {
|
|
103
|
+
if (N.current)
|
|
104
|
+
return;
|
|
105
|
+
if ((e.scrollWidth > e.clientWidth || e.scrollHeight > e.clientHeight) && !a) {
|
|
106
|
+
N.current = !0, ae(!0);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (a) {
|
|
110
|
+
_(e);
|
|
111
|
+
const i = fe.current;
|
|
112
|
+
n < i && pe(e) && (e.style.height = "", N.current = !0, ae(!1));
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
[a, _, pe]
|
|
116
|
+
), S = t.useCallback(() => {
|
|
117
|
+
var r;
|
|
118
|
+
if (s === "single" || !l.current)
|
|
119
|
+
return;
|
|
120
|
+
const e = l.current, n = ((r = e.value) == null ? void 0 : r.length) || 0;
|
|
121
|
+
s === "multi" ? D(e) : s === "auto" && W(e, n);
|
|
122
|
+
}, [s, D, W]);
|
|
123
|
+
t.useEffect(() => {
|
|
124
|
+
s !== "single" && l.current && w();
|
|
125
|
+
}, [s, w]), t.useEffect(() => {
|
|
126
|
+
s !== "single" && l.current && (w(), S());
|
|
127
|
+
}, [F, s, w, S]), t.useEffect(() => {
|
|
128
|
+
if (s !== "single" && l.current) {
|
|
129
|
+
const e = (u == null ? void 0 : u.length) || 0;
|
|
130
|
+
requestAnimationFrame(() => {
|
|
131
|
+
if (l.current) {
|
|
132
|
+
const n = l.current;
|
|
133
|
+
s === "multi" ? D(n) : s === "auto" && W(n, e), fe.current = e;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}, [u, s, D, W]), t.useEffect(() => {
|
|
138
|
+
s === "auto" && a && l.current && requestAnimationFrame(() => {
|
|
139
|
+
if (l.current) {
|
|
140
|
+
const e = l.current;
|
|
141
|
+
_(e), N.current = !1;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}, [a, s, _]), t.useEffect(() => {
|
|
145
|
+
if (s === "auto" && l.current) {
|
|
146
|
+
const e = l.current;
|
|
147
|
+
a || (e.style.height = "", e.style.overflow = "", N.current = !1);
|
|
148
|
+
}
|
|
149
|
+
}, [s, a]), t.useEffect(() => {
|
|
150
|
+
if (s === "single" || !l.current)
|
|
151
|
+
return;
|
|
152
|
+
const e = l.current;
|
|
153
|
+
let n;
|
|
154
|
+
const r = () => {
|
|
155
|
+
clearTimeout(n), n = setTimeout(() => {
|
|
156
|
+
l.current && (s === "auto" && !a && w(), S());
|
|
157
|
+
}, ut);
|
|
158
|
+
}, i = new ResizeObserver(r);
|
|
159
|
+
return i.observe(e), () => {
|
|
160
|
+
i.disconnect(), clearTimeout(n);
|
|
161
|
+
};
|
|
162
|
+
}, [s, a, w, S]);
|
|
163
|
+
const m = t.useCallback(() => ({
|
|
164
|
+
focus: () => {
|
|
165
|
+
var e;
|
|
166
|
+
return (e = l.current) == null ? void 0 : e.focus();
|
|
167
|
+
},
|
|
168
|
+
blur: () => {
|
|
169
|
+
var e;
|
|
170
|
+
return (e = l.current) == null ? void 0 : e.blur();
|
|
171
|
+
},
|
|
172
|
+
element: l.current,
|
|
173
|
+
get value() {
|
|
174
|
+
return u;
|
|
175
|
+
}
|
|
176
|
+
}), [u]);
|
|
177
|
+
t.useImperativeHandle(Re, m);
|
|
178
|
+
const Ue = t.useCallback(
|
|
179
|
+
(e) => {
|
|
180
|
+
const n = e.target.value;
|
|
181
|
+
!x && !f && $(n), R && !f && L(
|
|
182
|
+
R,
|
|
183
|
+
e,
|
|
184
|
+
{
|
|
185
|
+
...m(),
|
|
186
|
+
value: n
|
|
187
|
+
},
|
|
188
|
+
{ value: n }
|
|
189
|
+
), s !== "single" && S();
|
|
190
|
+
},
|
|
191
|
+
[$, R, f, x, m, s, S]
|
|
192
|
+
), Ve = t.useCallback(
|
|
193
|
+
(e) => {
|
|
194
|
+
X && !f && L(X, e, m(), void 0);
|
|
195
|
+
},
|
|
196
|
+
[X, f, m]
|
|
197
|
+
), Ke = t.useCallback(
|
|
198
|
+
(e) => {
|
|
199
|
+
Z && !f && L(Z, e, m(), void 0);
|
|
200
|
+
},
|
|
201
|
+
[Z, f, m]
|
|
202
|
+
), de = t.useCallback((e) => {
|
|
203
|
+
e.preventDefault();
|
|
204
|
+
}, []), U = t.useCallback(
|
|
205
|
+
(e) => {
|
|
206
|
+
J && L(
|
|
207
|
+
J,
|
|
208
|
+
e,
|
|
209
|
+
m(),
|
|
210
|
+
{
|
|
211
|
+
value: u,
|
|
212
|
+
attachments: A
|
|
213
|
+
}
|
|
214
|
+
), x || $(""), T || Q([]);
|
|
215
|
+
},
|
|
216
|
+
[J, m, u, A, x, T]
|
|
217
|
+
), qe = t.useCallback(
|
|
218
|
+
(e) => {
|
|
219
|
+
if (!(e.key === "Enter" && e.shiftKey)) {
|
|
220
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
221
|
+
e.stopPropagation();
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (e.key === "Enter") {
|
|
225
|
+
if (e.preventDefault(), B)
|
|
226
|
+
return;
|
|
227
|
+
H && U(e);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
[U, B, H]
|
|
232
|
+
), ge = {
|
|
233
|
+
disabled: f,
|
|
234
|
+
readOnly: Ne,
|
|
235
|
+
placeholder: He,
|
|
236
|
+
title: Oe,
|
|
237
|
+
maxLength: Le,
|
|
238
|
+
"aria-label": y.toLanguageString(Ee, k[Ee]),
|
|
239
|
+
value: u,
|
|
240
|
+
// let them rewrite kb navigation if needed
|
|
241
|
+
onKeyDown: qe,
|
|
242
|
+
...Me,
|
|
243
|
+
onChange: Ue,
|
|
244
|
+
onFocus: Ve,
|
|
245
|
+
onBlur: Ke,
|
|
246
|
+
ref: l
|
|
247
|
+
}, he = t.useCallback(
|
|
248
|
+
(e) => {
|
|
249
|
+
var i, h;
|
|
250
|
+
const { isFinal: n, alternatives: r } = e;
|
|
251
|
+
if (r.length > 0) {
|
|
252
|
+
const te = r[0];
|
|
253
|
+
if (n) {
|
|
254
|
+
const V = ((i = l.current) == null ? void 0 : i.value) || "", O = (V ? `${V} ` : "") + te.transcript;
|
|
255
|
+
if (x || $(O), R && !f) {
|
|
256
|
+
const Ce = {
|
|
257
|
+
target: l.current,
|
|
258
|
+
currentTarget: l.current
|
|
259
|
+
};
|
|
260
|
+
L(
|
|
261
|
+
R,
|
|
262
|
+
Ce,
|
|
263
|
+
{
|
|
264
|
+
...m(),
|
|
265
|
+
value: O
|
|
266
|
+
},
|
|
267
|
+
{ value: O }
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
(h = l.current) == null || h.focus();
|
|
273
|
+
},
|
|
274
|
+
[x, R, f, m]
|
|
275
|
+
), be = t.useCallback(() => {
|
|
276
|
+
var e, n;
|
|
277
|
+
(n = (e = ce.current) == null ? void 0 : e.actionElement) == null || n.click();
|
|
278
|
+
}, []), ye = t.useCallback(
|
|
279
|
+
(e) => {
|
|
280
|
+
var i;
|
|
281
|
+
const n = Array.from(e.affectedFiles), r = typeof d == "object" && d.onSelectAttachments;
|
|
282
|
+
T || Q((h) => [...h, ...n]), r && r({
|
|
283
|
+
selectedFiles: e.affectedFiles,
|
|
284
|
+
allFiles: e.newState
|
|
285
|
+
}), (i = l.current) == null || i.focus();
|
|
286
|
+
},
|
|
287
|
+
[d, T]
|
|
288
|
+
), g = t.useMemo(() => ({
|
|
289
|
+
uploadButtonProps: {
|
|
290
|
+
fillMode: "flat",
|
|
291
|
+
svgIcon: ot,
|
|
292
|
+
size: "small",
|
|
293
|
+
onClick: be,
|
|
294
|
+
onFilesAdd: ye,
|
|
295
|
+
files: A,
|
|
296
|
+
uploadRef: ce,
|
|
297
|
+
"aria-label": y.toLanguageString(G, k[G]),
|
|
298
|
+
title: y.toLanguageString(G, k[G]),
|
|
299
|
+
// Hidden prop to register callback overrides
|
|
300
|
+
_registerRemoveCallback: (e) => {
|
|
301
|
+
z.current = e;
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
speechToTextButtonProps: {
|
|
305
|
+
fillMode: "flat",
|
|
306
|
+
size: "small",
|
|
307
|
+
onResult: he
|
|
308
|
+
},
|
|
309
|
+
actionButtonProps: {
|
|
310
|
+
rounded: "full",
|
|
311
|
+
size: "small",
|
|
312
|
+
svgIcon: B ? tt : nt,
|
|
313
|
+
className: B ? "k-generating" : "",
|
|
314
|
+
onClick: U,
|
|
315
|
+
onMouseDown: de,
|
|
316
|
+
disabled: !B && !H,
|
|
317
|
+
"aria-disabled": !B && !H,
|
|
318
|
+
"aria-label": B ? y.toLanguageString(K, k[K]) : y.toLanguageString(q, k[q]),
|
|
319
|
+
title: B ? y.toLanguageString(K, k[K]) : y.toLanguageString(q, k[q]),
|
|
320
|
+
"aria-live": "polite"
|
|
321
|
+
}
|
|
322
|
+
}), [
|
|
323
|
+
he,
|
|
324
|
+
ye,
|
|
325
|
+
A,
|
|
326
|
+
U,
|
|
327
|
+
de,
|
|
328
|
+
B,
|
|
329
|
+
be,
|
|
330
|
+
y,
|
|
331
|
+
H
|
|
332
|
+
]), Ge = t.useCallback(
|
|
333
|
+
(e) => {
|
|
334
|
+
T || Q((r) => r.filter((i) => i.name !== e));
|
|
335
|
+
const n = typeof d == "object" && d.onRemoveAttachment;
|
|
336
|
+
n && (z.current = n), z.current && z.current(e);
|
|
337
|
+
},
|
|
338
|
+
[d, T]
|
|
339
|
+
), Y = () => {
|
|
340
|
+
const e = M !== !1, n = I !== !1, r = d !== !1, i = typeof M == "object" ? M : void 0, h = typeof d == "object" ? d : {}, {
|
|
341
|
+
restrictions: te,
|
|
342
|
+
multiple: V = !0,
|
|
343
|
+
accept: O,
|
|
344
|
+
onSelectAttachments: Ce,
|
|
345
|
+
onRemoveAttachment: ft,
|
|
346
|
+
...Ze
|
|
347
|
+
} = h, ne = { restrictions: te, multiple: V, accept: O }, Je = typeof I == "object" ? I : void 0;
|
|
348
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, r && /* @__PURE__ */ t.createElement(
|
|
349
|
+
rt,
|
|
350
|
+
{
|
|
351
|
+
...g.uploadButtonProps,
|
|
352
|
+
restrictions: ne.restrictions,
|
|
353
|
+
multiple: ne.multiple,
|
|
354
|
+
accept: ne.accept,
|
|
355
|
+
...Ze
|
|
356
|
+
}
|
|
357
|
+
), e && /* @__PURE__ */ t.createElement(
|
|
358
|
+
lt,
|
|
359
|
+
{
|
|
360
|
+
...g.speechToTextButtonProps,
|
|
361
|
+
...i
|
|
362
|
+
}
|
|
363
|
+
), n && /* @__PURE__ */ t.createElement(st, { ...g.actionButtonProps, ...Je }));
|
|
364
|
+
}, ee = s === "multi" || s === "auto" && a, ve = d !== !1 || M !== !1 || I !== !1, Be = v || ve, Xe = C || v || ve;
|
|
365
|
+
return /* @__PURE__ */ t.createElement(
|
|
366
|
+
"div",
|
|
367
|
+
{
|
|
368
|
+
"aria-label": y.toLanguageString(xe, k[xe]),
|
|
369
|
+
...je,
|
|
370
|
+
className: oe($e, "k-input", p, {
|
|
371
|
+
[`k-input-${se}`]: se,
|
|
372
|
+
"k-disabled": f,
|
|
373
|
+
"k-prompt-box-singleline": s === "single",
|
|
374
|
+
"k-prompt-box-multiline": ee
|
|
375
|
+
}),
|
|
376
|
+
style: ze
|
|
377
|
+
},
|
|
378
|
+
/* @__PURE__ */ t.createElement(it, { files: A, onRemoveFile: Ge, header: Ie }),
|
|
379
|
+
s === "single" ? /* @__PURE__ */ t.createElement("div", { className: `${p}-content` }, C && /* @__PURE__ */ t.createElement("div", { className: `${p}-affix` }, E(C, g)), /* @__PURE__ */ t.createElement("input", { ...ge, className: oe("k-input-inner", `${p}-input`) }), Be ? /* @__PURE__ */ t.createElement("div", { className: `${p}-affix` }, v && E(v, g), Y()) : null) : /* @__PURE__ */ t.createElement("div", { className: `${p}-content` }, s === "multi" && re && /* @__PURE__ */ t.createElement("div", { className: `${p}-affix` }, E(re, g)), s === "auto" && !a && C && /* @__PURE__ */ t.createElement("div", { className: `${p}-affix` }, E(C, g)), /* @__PURE__ */ t.createElement(
|
|
380
|
+
"textarea",
|
|
381
|
+
{
|
|
382
|
+
...ge,
|
|
383
|
+
className: oe("k-input-inner", `${p}-textarea`),
|
|
384
|
+
rows: We(),
|
|
385
|
+
style: c ? { maxHeight: c } : {},
|
|
386
|
+
...ee && { "aria-multiline": "true" }
|
|
387
|
+
}
|
|
388
|
+
), s === "auto" && !a && Be ? /* @__PURE__ */ t.createElement("div", { className: `${p}-affix` }, v && E(v, g), Y()) : null, ee && Xe ? /* @__PURE__ */ t.createElement("div", { className: `${p}-affix` }, C && E(C, g), (C || v) && /* @__PURE__ */ t.createElement("div", { className: "k-spacer" }), v && E(v, g), Y()) : null),
|
|
389
|
+
we && /* @__PURE__ */ t.createElement(et, { message: Se })
|
|
390
|
+
);
|
|
391
|
+
});
|
|
392
|
+
Te.propTypes = {
|
|
393
|
+
value: o.string,
|
|
394
|
+
defaultValue: o.string,
|
|
395
|
+
mode: o.oneOf(["single", "multi", "auto"]),
|
|
396
|
+
rows: o.number,
|
|
397
|
+
maxTextAreaHeight: o.string,
|
|
398
|
+
title: o.string,
|
|
399
|
+
disabled: o.bool,
|
|
400
|
+
readOnly: o.bool,
|
|
401
|
+
placeholder: o.string,
|
|
402
|
+
maxLength: o.number,
|
|
403
|
+
inputAttributes: o.object,
|
|
404
|
+
fillMode: o.oneOf(["solid", "flat", "outline"]),
|
|
405
|
+
topAffix: o.oneOfType([o.func, o.element, o.string]),
|
|
406
|
+
startAffix: o.oneOfType([o.func, o.element, o.string]),
|
|
407
|
+
endAffix: o.oneOfType([o.func, o.element, o.string]),
|
|
408
|
+
header: o.oneOfType([o.func, o.element, o.string]),
|
|
409
|
+
onChange: o.func,
|
|
410
|
+
onFocus: o.func,
|
|
411
|
+
onBlur: o.func,
|
|
412
|
+
loading: o.bool,
|
|
413
|
+
uploadButtonConfig: o.oneOfType([o.bool, o.object]),
|
|
414
|
+
speechToTextButtonConfig: o.oneOfType([o.bool, o.object]),
|
|
415
|
+
actionButtonConfig: o.oneOfType([o.bool, o.object]),
|
|
416
|
+
attachments: o.array,
|
|
417
|
+
onPromptAction: o.func,
|
|
418
|
+
className: o.string,
|
|
419
|
+
style: o.object
|
|
420
|
+
};
|
|
421
|
+
Te.displayName = "KendoPromptBox";
|
|
422
|
+
export {
|
|
423
|
+
Te as PromptBox
|
|
424
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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, ButtonHandle } from '@progress/kendo-react-buttons';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Represents the props of the PromptBoxActionButton component.
|
|
12
|
+
*/
|
|
13
|
+
export interface PromptBoxActionButtonProps extends ButtonProps {
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents the PromptBox Action Button component.
|
|
17
|
+
* Receives default props from the parent PromptBox component.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <PromptBox
|
|
22
|
+
* actionButtonConfig={false}
|
|
23
|
+
* endAffix={(props) => (
|
|
24
|
+
* <>
|
|
25
|
+
* <PromptBoxActionButton {...props.actionButtonProps} />
|
|
26
|
+
* <span>Custom content</span>
|
|
27
|
+
* </>
|
|
28
|
+
* )}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const PromptBoxActionButton: React.ForwardRefExoticComponent<PromptBoxActionButtonProps & React.RefAttributes<ButtonHandle>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("@progress/kendo-react-buttons");function i(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const r=i(u),c=r.forwardRef((t,e)=>r.createElement(a.Button,{ref:e,...t}));c.displayName="PromptBoxActionButton";exports.PromptBoxActionButton=c;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 t from "react";
|
|
9
|
+
import { Button as e } from "@progress/kendo-react-buttons";
|
|
10
|
+
const m = t.forwardRef((o, r) => /* @__PURE__ */ t.createElement(e, { ref: r, ...o }));
|
|
11
|
+
m.displayName = "PromptBoxActionButton";
|
|
12
|
+
export {
|
|
13
|
+
m as PromptBoxActionButton
|
|
14
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { SpeechToTextButtonProps } from '@progress/kendo-react-buttons';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Represents the props of the PromptBoxSpeechToTextButton component.
|
|
12
|
+
*/
|
|
13
|
+
export interface PromptBoxSpeechToTextButtonProps extends SpeechToTextButtonProps {
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents the PromptBox Speech-to-Text Button component.
|
|
17
|
+
* Receives default props from the parent PromptBox component.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <PromptBox
|
|
22
|
+
* speechToTextButtonConfig={false}
|
|
23
|
+
* endAffix={(props) => (
|
|
24
|
+
* <>
|
|
25
|
+
* <PromptBoxSpeechToTextButton {...props.speechToTextButtonProps} />
|
|
26
|
+
* <span>Custom content</span>
|
|
27
|
+
* </>
|
|
28
|
+
* )}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare const PromptBoxSpeechToTextButton: React.ForwardRefExoticComponent<PromptBoxSpeechToTextButtonProps & React.RefAttributes<any>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("@progress/kendo-react-buttons");function p(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const n=p(u),c=n.forwardRef((e,t)=>n.createElement(a.SpeechToTextButton,{ref:t,...e}));c.displayName="PromptBoxSpeechToTextButton";exports.PromptBoxSpeechToTextButton=c;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 t from "react";
|
|
9
|
+
import { SpeechToTextButton as r } from "@progress/kendo-react-buttons";
|
|
10
|
+
const p = t.forwardRef((e, o) => /* @__PURE__ */ t.createElement(r, { ref: o, ...e }));
|
|
11
|
+
p.displayName = "PromptBoxSpeechToTextButton";
|
|
12
|
+
export {
|
|
13
|
+
p as PromptBoxSpeechToTextButton
|
|
14
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
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, ButtonHandle } from '@progress/kendo-react-buttons';
|
|
9
|
+
import { UploadOnAddEvent, UploadFileInfo } from '@progress/kendo-react-upload';
|
|
10
|
+
import { PromptBoxSelectAttachmentsEvent } from './Events.js';
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
/**
|
|
13
|
+
* Represents the props of the PromptBoxUploadButton component.
|
|
14
|
+
*/
|
|
15
|
+
export interface PromptBoxUploadButtonProps extends ButtonProps {
|
|
16
|
+
/**
|
|
17
|
+
* Callback fired when files are selected.
|
|
18
|
+
*
|
|
19
|
+
* @hidden
|
|
20
|
+
*/
|
|
21
|
+
onFilesAdd?: (event: UploadOnAddEvent) => void;
|
|
22
|
+
/**
|
|
23
|
+
* The currently selected files.
|
|
24
|
+
*
|
|
25
|
+
* @hidden
|
|
26
|
+
*/
|
|
27
|
+
files?: UploadFileInfo[];
|
|
28
|
+
/**
|
|
29
|
+
* Restrictions on the files that can be uploaded.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
restrictions?: any;
|
|
33
|
+
/**
|
|
34
|
+
* Whether multiple files can be selected.
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
multiple?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The file types that can be selected.
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
accept?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The upload ref to trigger file selection.
|
|
45
|
+
*
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
uploadRef?: React.RefObject<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Fires when the user selects files via the upload button.
|
|
51
|
+
* Used for controlled attachment management in custom placement scenarios.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* <PromptBox
|
|
56
|
+
* uploadButtonConfig={false}
|
|
57
|
+
* startAffix={(props) => (
|
|
58
|
+
* <PromptBoxUploadButton
|
|
59
|
+
* {...props.uploadButtonProps}
|
|
60
|
+
* onSelectAttachments={(e) => setAttachments(e.allFiles)}
|
|
61
|
+
* />
|
|
62
|
+
* )}
|
|
63
|
+
* />
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
onSelectAttachments?: (event: PromptBoxSelectAttachmentsEvent) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Fires when the user removes an attachment by clicking the remove button.
|
|
69
|
+
* Used for controlled attachment management in custom placement scenarios.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <PromptBox
|
|
74
|
+
* uploadButtonConfig={false}
|
|
75
|
+
* startAffix={(props) => (
|
|
76
|
+
* <PromptBoxUploadButton
|
|
77
|
+
* {...props.uploadButtonProps}
|
|
78
|
+
* onRemoveAttachment={(fileName) => setAttachments(prev => prev.filter(f => f.name !== fileName))}
|
|
79
|
+
* />
|
|
80
|
+
* )}
|
|
81
|
+
* />
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
onRemoveAttachment?: (fileName: string) => void;
|
|
85
|
+
/**
|
|
86
|
+
* @hidden
|
|
87
|
+
* Internal callback registration for parent component
|
|
88
|
+
*/
|
|
89
|
+
_registerRemoveCallback?: (callback: ((fileName: string) => void) | undefined) => void;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Represents the PromptBox Upload Button component.
|
|
93
|
+
* Receives default props from the parent PromptBox component.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* <PromptBox
|
|
98
|
+
* uploadButtonConfig={false}
|
|
99
|
+
* endAffix={(props) => (
|
|
100
|
+
* <>
|
|
101
|
+
* <PromptBoxUploadButton {...props.uploadButtonProps} />
|
|
102
|
+
* <span>Custom content</span>
|
|
103
|
+
* </>
|
|
104
|
+
* )}
|
|
105
|
+
* />
|
|
106
|
+
* ```
|
|
107
|
+
*/
|
|
108
|
+
export declare const PromptBoxUploadButton: React.ForwardRefExoticComponent<PromptBoxUploadButtonProps & React.RefAttributes<ButtonHandle>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
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
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react"),O=require("@progress/kendo-react-buttons"),P=require("@progress/kendo-react-upload");function U(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const t=U(y),f=t.forwardRef(({onFilesAdd:e,files:o=[],restrictions:r,multiple:a=!0,accept:c,uploadRef:i,onSelectAttachments:l,onRemoveAttachment:n,_registerRemoveCallback:u,...s},p)=>{t.useEffect(()=>(u&&n&&u(n),()=>{u&&n&&u(void 0)}),[n,u]);const B=t.useCallback(d=>{e&&e(d),l&&l({selectedFiles:d.affectedFiles,allFiles:d.newState})},[e,l]);return t.createElement(t.Fragment,null,t.createElement(O.Button,{ref:p,...s}),t.createElement(P.Upload,{ref:i,files:o,onAdd:B,autoUpload:!1,restrictions:r,multiple:a,accept:c,className:"k-hidden"}))});f.displayName="PromptBoxUploadButton";exports.PromptBoxUploadButton=f;
|