botframework-webchat-fluent-theme 4.17.0-main.20240411.ff34969 → 4.17.0-main.20240416.e3f5401

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/dist/index.mjs ADDED
@@ -0,0 +1,1375 @@
1
+ // src/index.ts
2
+ import { injectMetaTag } from "inject-meta-tag";
3
+
4
+ // src/private/FluentThemeProvider.tsx
5
+ import { Components } from "botframework-webchat-component";
6
+ import React21, { memo as memo15 } from "react";
7
+
8
+ // src/components/telephoneKeypad/Provider.tsx
9
+ import React, { memo, useMemo, useState } from "react";
10
+
11
+ // src/components/telephoneKeypad/private/Context.ts
12
+ import { createContext } from "react";
13
+ var Context = createContext(
14
+ new Proxy({}, {
15
+ get() {
16
+ throw new Error("botframework-webchat: This hook can only used under its corresponding <Provider>.");
17
+ }
18
+ })
19
+ );
20
+ Context.displayName = "TelephoneKeypad.Context";
21
+ var Context_default = Context;
22
+
23
+ // src/components/telephoneKeypad/Provider.tsx
24
+ var Provider = memo(({ children }) => {
25
+ const [shown, setShown] = useState(false);
26
+ const context = useMemo(
27
+ () => Object.freeze({
28
+ setShown,
29
+ shown
30
+ }),
31
+ [setShown, shown]
32
+ );
33
+ return /* @__PURE__ */ React.createElement(Context_default.Provider, { value: context }, children);
34
+ });
35
+ var Provider_default = Provider;
36
+
37
+ // src/components/telephoneKeypad/Surrogate.tsx
38
+ import React4, { memo as memo4 } from "react";
39
+
40
+ // src/components/telephoneKeypad/private/TelephoneKeypad.tsx
41
+ import React3, { memo as memo3, useCallback as useCallback2, useEffect, useRef } from "react";
42
+ import { useRefFrom as useRefFrom2 } from "use-ref-from";
43
+
44
+ // src/styles/index.ts
45
+ import { useMemo as useMemo3 } from "react";
46
+
47
+ // src/private/useStyleToEmotionObject.ts
48
+ import createEmotion from "@emotion/css/create-instance";
49
+ import { useMemo as useMemo2 } from "react";
50
+ var { random } = Math;
51
+ var emotionPool = {};
52
+ var nonce = "";
53
+ function createCSSKey() {
54
+ return random().toString(26).substr(2, 5).replace(/\d/gu, (value) => String.fromCharCode(value.charCodeAt(0) + 65));
55
+ }
56
+ function useStyleToEmotionObject() {
57
+ return useMemo2(() => {
58
+ const emotion = (
59
+ // Prefix "id-" to prevent object injection attack.
60
+ emotionPool[`id-${nonce}`] || (emotionPool[`id-${nonce}`] = createEmotion({ key: `webchat--css-${createCSSKey()}`, nonce }))
61
+ );
62
+ return (style) => emotion.css(style);
63
+ }, []);
64
+ }
65
+
66
+ // src/styles/index.ts
67
+ function useStyles(styles13) {
68
+ const getClassName = useStyleToEmotionObject();
69
+ return useMemo3(
70
+ () => Object.freeze(
71
+ Object.fromEntries(Object.entries(styles13).map(([cls, style]) => [cls, `${cls} ${getClassName(style)}`]))
72
+ ),
73
+ [styles13, getClassName]
74
+ );
75
+ }
76
+
77
+ // src/components/telephoneKeypad/private/Button.tsx
78
+ import React2, { forwardRef, memo as memo2, useCallback } from "react";
79
+ import { useRefFrom } from "use-ref-from";
80
+ var styles = {
81
+ "webchat__telephone-keypad__button": {
82
+ "-webkit-user-select": "none",
83
+ alignItems: "center",
84
+ appearance: "none",
85
+ // backgroundColor: isDarkTheme() || isHighContrastTheme() ? black : white,
86
+ backgroundColor: "White",
87
+ borderRadius: "100%",
88
+ // Whitelabel styles
89
+ // border: `solid 1px ${isHighContrastTheme() ? white : isDarkTheme() ? gray160 : gray40}`,
90
+ // color: 'inherit',
91
+ border: "solid 1px var(--webchat-colorNeutralStroke1)",
92
+ color: "var(--webchat-colorGray200)",
93
+ fontWeight: "var(--webchat-fontWeightSemibold)",
94
+ cursor: "pointer",
95
+ display: "flex",
96
+ flexDirection: "column",
97
+ height: 60,
98
+ opacity: 0.7,
99
+ padding: 0,
100
+ position: "relative",
101
+ touchAction: "none",
102
+ userSelect: "none",
103
+ width: 60,
104
+ "&:hover": {
105
+ // backgroundColor: isHighContrastTheme() ? gray210 : isDarkTheme() ? gray150 : gray30
106
+ backgroundColor: "var(--webchat-colorGray30)"
107
+ }
108
+ },
109
+ "webchat__telephone-keypad__button__ruby": {
110
+ // color: isHighContrastTheme() ? white : isDarkTheme() ? gray40 : gray160,
111
+ color: "var(--webchat-colorGray190)",
112
+ fontSize: 10
113
+ },
114
+ "webchat__telephone-keypad__button__text": {
115
+ fontSize: 24,
116
+ marginTop: 8
117
+ },
118
+ "webchat__telephone-keypad--horizontal": {
119
+ "& .webchat__telephone-keypad__button": {
120
+ height: 32,
121
+ width: 32,
122
+ margin: "8px 4px",
123
+ justifyContent: "center"
124
+ },
125
+ "webchat__telephone-keypad__button__ruby": {
126
+ display: "none"
127
+ },
128
+ "& .webchat__telephone-keypad__button__text": {
129
+ fontSize: 20,
130
+ marginTop: 0
131
+ }
132
+ }
133
+ };
134
+ var Button = memo2(
135
+ // As we are all TypeScript, internal components do not need propTypes.
136
+ // eslint-disable-next-line react/prop-types
137
+ forwardRef(({ button, "data-testid": dataTestId, onClick, ruby }, ref) => {
138
+ const classNames = useStyles(styles);
139
+ const onClickRef = useRefFrom(onClick);
140
+ const handleClick = useCallback(() => onClickRef.current?.(), [onClickRef]);
141
+ return /* @__PURE__ */ React2.createElement(
142
+ "button",
143
+ {
144
+ className: classNames["webchat__telephone-keypad__button"],
145
+ "data-testid": dataTestId,
146
+ onClick: handleClick,
147
+ ref,
148
+ type: "button"
149
+ },
150
+ /* @__PURE__ */ React2.createElement("span", { className: classNames["webchat__telephone-keypad__button__text"] }, button === "star" ? "\u2217" : button === "pound" ? "#" : button),
151
+ !!ruby && /* @__PURE__ */ React2.createElement("ruby", { className: classNames["webchat__telephone-keypad__button__ruby"] }, ruby)
152
+ );
153
+ })
154
+ );
155
+ Button.displayName = "TelephoneKeypad.Button";
156
+ var Button_default = Button;
157
+
158
+ // src/testIds.ts
159
+ var testIds = {
160
+ sendBoxDropZone: "send box drop zone",
161
+ sendBoxSendButton: "send box send button",
162
+ sendBoxTextBox: "send box text area",
163
+ sendBoxTelephoneKeypadButton1: `send box telephone keypad button 1`,
164
+ sendBoxTelephoneKeypadButton2: `send box telephone keypad button 2`,
165
+ sendBoxTelephoneKeypadButton3: `send box telephone keypad button 3`,
166
+ sendBoxTelephoneKeypadButton4: `send box telephone keypad button 4`,
167
+ sendBoxTelephoneKeypadButton5: `send box telephone keypad button 5`,
168
+ sendBoxTelephoneKeypadButton6: `send box telephone keypad button 6`,
169
+ sendBoxTelephoneKeypadButton7: `send box telephone keypad button 7`,
170
+ sendBoxTelephoneKeypadButton8: `send box telephone keypad button 8`,
171
+ sendBoxTelephoneKeypadButton9: `send box telephone keypad button 9`,
172
+ sendBoxTelephoneKeypadButton0: `send box telephone keypad button 0`,
173
+ sendBoxTelephoneKeypadButtonStar: `send box telephone keypad button star`,
174
+ sendBoxTelephoneKeypadButtonPound: `send box telephone keypad button pound`,
175
+ sendBoxTelephoneKeypadToolbarButton: "send box telephone keypad toolbar button",
176
+ sendBoxUploadButton: "send box upload button"
177
+ };
178
+ var testIds_default = testIds;
179
+
180
+ // src/components/telephoneKeypad/useShown.ts
181
+ import { useContext, useMemo as useMemo4 } from "react";
182
+ function useShown() {
183
+ const { setShown, shown } = useContext(Context_default);
184
+ return useMemo4(() => Object.freeze([shown, setShown]), [shown, setShown]);
185
+ }
186
+
187
+ // src/components/telephoneKeypad/private/TelephoneKeypad.tsx
188
+ var styles2 = {
189
+ "webchat__telephone-keypad": {
190
+ /* Commented out whitelabel styles for now. */
191
+ // background: getHighContrastDarkThemeColor(highContrastColor: black, darkThemeColor: gray190, string, defaultColor: gray10),
192
+ // borderRadius: '8px 8px 0px 0px',
193
+ // boxShadow: '-3px 0px 7px 0px rgba(0, 0, 0, 0.13), -0.6px 0px 1.8px 0px rgba(0, 0, 0, 0.10)',
194
+ alignItems: "center",
195
+ background: "var(--webchat-colorNeutralBackground1)",
196
+ // border: isHighContrastTheme() ? `1px solid ${white}` : 'none',
197
+ border: "none",
198
+ borderRadius: "var(--webchat-borderRadiusXLarge)",
199
+ // boxShadow: 'var(--shadow16)',
200
+ display: "flex",
201
+ flexDirection: "column",
202
+ fontFamily: "var(--webchat-fontFamilyBase)",
203
+ justifyContent: "center"
204
+ // margin: 'var(--spacingHorizontalMNudge)'
205
+ },
206
+ "webchat__telephone-keypad__box": {
207
+ boxSizing: "border-box",
208
+ display: "grid",
209
+ gap: "16px",
210
+ gridTemplateColumns: "repeat(3, 1fr)",
211
+ gridTemplateRows: "repeat(4, 1fr)",
212
+ justifyItems: "center",
213
+ padding: "16px",
214
+ width: "100%"
215
+ }
216
+ };
217
+ var Orientation = memo3(
218
+ ({ children, isHorizontal }) => {
219
+ const classNames = useStyles(styles2);
220
+ return isHorizontal ? (
221
+ // <HorizontalDialPadController>{children}</HorizontalDialPadController>
222
+ false
223
+ ) : /* @__PURE__ */ React3.createElement("div", { className: classNames["webchat__telephone-keypad__box"] }, children);
224
+ }
225
+ );
226
+ Orientation.displayName = "TelephoneKeypad:Orientation";
227
+ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
228
+ const autoFocusRef = useRefFrom2(autoFocus);
229
+ const classNames = useStyles(styles2);
230
+ const firstButtonRef = useRef(null);
231
+ const onButtonClickRef = useRefFrom2(onButtonClick);
232
+ const [, setShown] = useShown();
233
+ const handleButton1Click = useCallback2(() => onButtonClickRef.current?.("1"), [onButtonClickRef]);
234
+ const handleButton2Click = useCallback2(() => onButtonClickRef.current?.("2"), [onButtonClickRef]);
235
+ const handleButton3Click = useCallback2(() => onButtonClickRef.current?.("3"), [onButtonClickRef]);
236
+ const handleButton4Click = useCallback2(() => onButtonClickRef.current?.("4"), [onButtonClickRef]);
237
+ const handleButton5Click = useCallback2(() => onButtonClickRef.current?.("5"), [onButtonClickRef]);
238
+ const handleButton6Click = useCallback2(() => onButtonClickRef.current?.("6"), [onButtonClickRef]);
239
+ const handleButton7Click = useCallback2(() => onButtonClickRef.current?.("7"), [onButtonClickRef]);
240
+ const handleButton8Click = useCallback2(() => onButtonClickRef.current?.("8"), [onButtonClickRef]);
241
+ const handleButton9Click = useCallback2(() => onButtonClickRef.current?.("9"), [onButtonClickRef]);
242
+ const handleButton0Click = useCallback2(() => onButtonClickRef.current?.("0"), [onButtonClickRef]);
243
+ const handleButtonStarClick = useCallback2(() => onButtonClickRef.current?.("star"), [onButtonClickRef]);
244
+ const handleButtonPoundClick = useCallback2(() => onButtonClickRef.current?.("pound"), [onButtonClickRef]);
245
+ const handleKeyDown = useCallback2(
246
+ (event) => {
247
+ if (event.key === "Escape") {
248
+ setShown(false);
249
+ }
250
+ },
251
+ [setShown]
252
+ );
253
+ useEffect(() => {
254
+ autoFocusRef.current && firstButtonRef.current?.focus();
255
+ }, [autoFocusRef, firstButtonRef]);
256
+ return /* @__PURE__ */ React3.createElement("div", { className: classNames["webchat__telephone-keypad"], onKeyDown: handleKeyDown }, /* @__PURE__ */ React3.createElement(Orientation, { isHorizontal }, /* @__PURE__ */ React3.createElement(
257
+ Button_default,
258
+ {
259
+ button: "1",
260
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton1,
261
+ onClick: handleButton1Click,
262
+ ref: firstButtonRef
263
+ }
264
+ ), /* @__PURE__ */ React3.createElement(
265
+ Button_default,
266
+ {
267
+ button: "2",
268
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton2,
269
+ onClick: handleButton2Click,
270
+ ruby: "ABC"
271
+ }
272
+ ), /* @__PURE__ */ React3.createElement(
273
+ Button_default,
274
+ {
275
+ button: "3",
276
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton3,
277
+ onClick: handleButton3Click,
278
+ ruby: "DEF"
279
+ }
280
+ ), /* @__PURE__ */ React3.createElement(
281
+ Button_default,
282
+ {
283
+ button: "4",
284
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton4,
285
+ onClick: handleButton4Click,
286
+ ruby: "GHI"
287
+ }
288
+ ), /* @__PURE__ */ React3.createElement(
289
+ Button_default,
290
+ {
291
+ button: "5",
292
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton5,
293
+ onClick: handleButton5Click,
294
+ ruby: "JKL"
295
+ }
296
+ ), /* @__PURE__ */ React3.createElement(
297
+ Button_default,
298
+ {
299
+ button: "6",
300
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton6,
301
+ onClick: handleButton6Click,
302
+ ruby: "MNO"
303
+ }
304
+ ), /* @__PURE__ */ React3.createElement(
305
+ Button_default,
306
+ {
307
+ button: "7",
308
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton7,
309
+ onClick: handleButton7Click,
310
+ ruby: "PQRS"
311
+ }
312
+ ), /* @__PURE__ */ React3.createElement(
313
+ Button_default,
314
+ {
315
+ button: "8",
316
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton8,
317
+ onClick: handleButton8Click,
318
+ ruby: "TUV"
319
+ }
320
+ ), /* @__PURE__ */ React3.createElement(
321
+ Button_default,
322
+ {
323
+ button: "9",
324
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButton9,
325
+ onClick: handleButton9Click,
326
+ ruby: "WXYZ"
327
+ }
328
+ ), /* @__PURE__ */ React3.createElement(Button_default, { button: "star", "data-testid": testIds_default.sendBoxTelephoneKeypadButtonStar, onClick: handleButtonStarClick }), /* @__PURE__ */ React3.createElement(Button_default, { button: "0", "data-testid": testIds_default.sendBoxTelephoneKeypadButton0, onClick: handleButton0Click, ruby: "+" }), /* @__PURE__ */ React3.createElement(
329
+ Button_default,
330
+ {
331
+ button: "pound",
332
+ "data-testid": testIds_default.sendBoxTelephoneKeypadButtonPound,
333
+ onClick: handleButtonPoundClick
334
+ }
335
+ )));
336
+ });
337
+ TelephoneKeypad.displayName = "TelephoneKeypad";
338
+ var TelephoneKeypad_default = TelephoneKeypad;
339
+
340
+ // src/components/telephoneKeypad/Surrogate.tsx
341
+ var TelephoneKeypadSurrogate = memo4((props) => useShown()[0] ? /* @__PURE__ */ React4.createElement(TelephoneKeypad_default, { ...props }) : false);
342
+ TelephoneKeypadSurrogate.displayName = "TelephoneKeypad.Surrogate";
343
+ var Surrogate_default = TelephoneKeypadSurrogate;
344
+
345
+ // src/components/Theme.tsx
346
+ import React5 from "react";
347
+ var styles3 = {
348
+ "webchat-fluent__theme": {
349
+ display: "contents",
350
+ "--webchat-colorNeutralForeground1": "var(--colorNeutralForeground1, #242424)",
351
+ "--webchat-colorNeutralForeground2": "var(--colorNeutralForeground2, #424242)",
352
+ "--webchat-colorNeutralForeground4": "var(--colorNeutralForeground4, #707070)",
353
+ "--webchat-colorNeutralForegroundDisabled": "var(--colorNeutralForegroundDisabled, #bdbdbd)",
354
+ "--webchat-colorNeutralBackground1": "var(--colorNeutralBackground1, #ffffff)",
355
+ "--webchat-colorNeutralBackground4": "var(--colorNeutralBackground4, #f0f0f0)",
356
+ "--webchat-colorNeutralBackground5": "var(--colorNeutralBackground5, #ebebeb)",
357
+ "--webchat-colorSubtleBackgroundHover": "var(--colorSubtleBackgroundHover, #f5f5f5)",
358
+ "--webchat-colorSubtleBackgroundPressed": "var(--colorSubtleBackgroundPressed, #e0e0e0)",
359
+ "--webchat-colorNeutralStroke1": "var(--colorNeutralStroke1, #d1d1d1)",
360
+ "--webchat-colorNeutralStroke2": "var(--colorNeutralStroke2, #e0e0e0)",
361
+ "--webchat-colorNeutralStroke1Selected": "var(--colorNeutralStroke1Selected, #bdbdbd)",
362
+ "--webchat-colorBrandStroke2": "var(--colorBrandStroke2, #9edcf7)",
363
+ "--webchat-colorBrandForeground2Hover": "var(--colorBrandForeground2Hover, #015a7a)",
364
+ "--webchat-colorBrandForeground2Pressed": "var(--colorBrandForeground2Pressed, #01384d)",
365
+ "--webchat-colorBrandBackground2Hover": "var(--colorBrandBackground2Hover, #bee7fa)",
366
+ "--webchat-colorBrandBackground2Pressed": "var(--colorBrandBackground2Pressed, #7fd2f5)",
367
+ "--webchat-colorCompoundBrandForeground1": "var(--colorCompoundBrandForeground1, #077fab)",
368
+ "--webchat-colorCompoundBrandForeground1Hover": "var(--colorCompoundBrandForeground1Hover, #02729c)",
369
+ "--webchat-colorCompoundBrandForeground1Pressed": "var(--colorCompoundBrandForeground1Pressed, #01678c)",
370
+ "--webchat-colorStatusDangerForeground1": "var(--colorStatusDangerForeground1, #b10e1c)",
371
+ // https://github.com/microsoft/fluentui/blob/master/packages/theme/src/colors/FluentColors.ts
372
+ "--webchat-colorGray30": "var(--colorGray30, #edebe9)",
373
+ "--webchat-colorGray160": "var(--colorGray160, #323130)",
374
+ "--webchat-colorGray190": "var(--colorGray190, #201f1e)",
375
+ "--webchat-colorGray200": "var(--colorGray200, #1b1a19)",
376
+ // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/borderRadius.ts
377
+ "--webchat-borderRadiusSmall": "var(--borderRadiusSmall, 2px)",
378
+ "--webchat-borderRadiusLarge": "var(--borderRadiusLarge, 6px)",
379
+ "--webchat-borderRadiusXLarge": "var(--borderRadiusXLarge, 8px)",
380
+ // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/utils/shadows.ts
381
+ "--webchat-shadow16": "var(--shadow16, 0 6.4px 14.4px 0 rgba(0, 0, 0, 0.132), 0 1.2px 3.6px 0 rgba(0, 0, 0, 0.108))",
382
+ // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/spacings.ts
383
+ "--webchat-spacingHorizontalMNudge": "var(--spacingHorizontalMNudge, 10px)",
384
+ // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/fonts.ts
385
+ "--webchat-fontFamilyBase": `var(--fontFamilyBase, 'Segoe UI)', 'Segoe UI Web (West European))', -apple-system,
386
+ BlinkMacSystemFont, Roboto, 'Helvetica Neue)', sans-serif)`,
387
+ "--webchat-fontFamilyNumeric": `var(--fontFamilyNumeric, Bahnschrift, 'Segoe UI)', 'Segoe UI Web (West European))',
388
+ -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue)', sans-serif)`,
389
+ // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/fonts.ts
390
+ "--webchat-fontWeightSemibold": "var(--fontWeightSemibold, 600)"
391
+ }
392
+ };
393
+ function WebchatTheme(props) {
394
+ const classNames = useStyles(styles3);
395
+ return /* @__PURE__ */ React5.createElement("div", { className: classNames["webchat-fluent__theme"] }, props.children);
396
+ }
397
+
398
+ // src/components/sendbox/index.tsx
399
+ import { hooks as hooks8 } from "botframework-webchat-component";
400
+ import cx6 from "classnames";
401
+ import React20, { memo as memo14, useCallback as useCallback8, useRef as useRef6, useState as useState3 } from "react";
402
+ import { useRefFrom as useRefFrom6 } from "use-ref-from";
403
+
404
+ // src/icons/SendIcon.tsx
405
+ import React6 from "react";
406
+ function SendIcon(props) {
407
+ return /* @__PURE__ */ React6.createElement(
408
+ "svg",
409
+ {
410
+ "aria-hidden": "true",
411
+ className: props.className,
412
+ fill: "currentColor",
413
+ height: "1em",
414
+ viewBox: "0 0 20 20",
415
+ width: "1em",
416
+ xmlns: "http://www.w3.org/2000/svg"
417
+ },
418
+ /* @__PURE__ */ React6.createElement(
419
+ "path",
420
+ {
421
+ d: "M2.18 2.11a.5.5 0 0 1 .54-.06l15 7.5a.5.5 0 0 1 0 .9l-15 7.5a.5.5 0 0 1-.7-.58L3.98 10 2.02 2.63a.5.5 0 0 1 .16-.52Zm2.7 8.39-1.61 6.06L16.38 10 3.27 3.44 4.88 9.5h6.62a.5.5 0 1 1 0 1H4.88Z",
422
+ fill: "currentColor"
423
+ }
424
+ )
425
+ );
426
+ }
427
+
428
+ // src/components/dropZone/index.tsx
429
+ import { hooks } from "botframework-webchat-api";
430
+ import cx from "classnames";
431
+ import React8, { memo as memo5, useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
432
+ import { useRefFrom as useRefFrom3 } from "use-ref-from";
433
+
434
+ // src/icons/AddDocumentIcon.tsx
435
+ import React7 from "react";
436
+ function AddDocumentIcon(props) {
437
+ return /* @__PURE__ */ React7.createElement(
438
+ "svg",
439
+ {
440
+ "aria-hidden": "true",
441
+ className: props.className,
442
+ fill: "currentColor",
443
+ height: "1em",
444
+ viewBox: "0 0 20 20",
445
+ width: "1em",
446
+ xmlns: "http://www.w3.org/2000/svg"
447
+ },
448
+ /* @__PURE__ */ React7.createElement(
449
+ "path",
450
+ {
451
+ d: "M6 2a2 2 0 0 0-2 2v5.2c.32-.08.66-.15 1-.18V4a1 1 0 0 1 1-1h4v3.5c0 .83.67 1.5 1.5 1.5H15v8a1 1 0 0 1-1 1h-3.6c-.18.36-.4.7-.66 1H14a2 2 0 0 0 2-2V7.41c0-.4-.16-.78-.44-1.06l-3.91-3.91A1.5 1.5 0 0 0 10.59 2H6Zm8.8 5h-3.3a.5.5 0 0 1-.5-.5V3.2L14.8 7ZM10 14.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Zm-4-2a.5.5 0 0 0-1 0V14H3.5a.5.5 0 0 0 0 1H5v1.5a.5.5 0 0 0 1 0V15h1.5a.5.5 0 0 0 0-1H6v-1.5Z",
452
+ fill: "currentColor"
453
+ }
454
+ )
455
+ );
456
+ }
457
+
458
+ // src/components/dropZone/index.tsx
459
+ var { useLocalizer } = hooks;
460
+ var styles4 = {
461
+ "webchat-fluent__sendbox__attachment-drop-zone": {
462
+ backgroundColor: "var(--webchat-colorNeutralBackground4)",
463
+ borderRadius: "inherit",
464
+ cursor: "copy",
465
+ display: "grid",
466
+ gap: "8px",
467
+ inset: "0",
468
+ placeContent: "center",
469
+ placeItems: "center",
470
+ position: "absolute"
471
+ },
472
+ "webchat-fluent__sendbox__attachment-drop-zone--droppable": {
473
+ backgroundColor: "#e00",
474
+ color: "White"
475
+ },
476
+ "webchat-fluent__sendbox__attachment-drop-zone-icon": {
477
+ height: "36px",
478
+ // Set "pointer-events: none" to ignore dragging over the icon. Otherwise, when dragging over the icon, it would disable the "--droppable" modifier.
479
+ pointerEvents: "none",
480
+ width: "36px"
481
+ }
482
+ };
483
+ var handleDragOver = (event) => {
484
+ event.preventDefault();
485
+ };
486
+ var isFilesTransferEvent = (event) => !!event.dataTransfer?.types?.some((type) => type.toLowerCase() === "files");
487
+ function isDescendantOf(target, ancestor) {
488
+ let current = target.parentNode;
489
+ while (current) {
490
+ if (current === ancestor) {
491
+ return true;
492
+ }
493
+ current = current.parentNode;
494
+ }
495
+ return false;
496
+ }
497
+ var DropZone = (props) => {
498
+ const [dropZoneState, setDropZoneState] = useState2(false);
499
+ const classNames = useStyles(styles4);
500
+ const dropZoneRef = useRef2(null);
501
+ const localize = useLocalizer();
502
+ const onFilesAddedRef = useRefFrom3(props.onFilesAdded);
503
+ useEffect2(() => {
504
+ let entranceCounter = 0;
505
+ const handleDragEnter = (event) => {
506
+ entranceCounter++;
507
+ if (isFilesTransferEvent(event)) {
508
+ setDropZoneState(
509
+ dropZoneRef.current && (event.target === dropZoneRef.current || event.target instanceof HTMLElement && isDescendantOf(event.target, dropZoneRef.current)) ? "droppable" : "visible"
510
+ );
511
+ }
512
+ };
513
+ const handleDragLeave = () => --entranceCounter <= 0 && setDropZoneState(false);
514
+ document.addEventListener("dragenter", handleDragEnter, false);
515
+ document.addEventListener("dragleave", handleDragLeave, false);
516
+ return () => {
517
+ document.removeEventListener("dragenter", handleDragEnter);
518
+ document.removeEventListener("dragleave", handleDragLeave);
519
+ };
520
+ }, [setDropZoneState]);
521
+ const handleDrop = useCallback3(
522
+ (event) => {
523
+ event.preventDefault();
524
+ setDropZoneState(false);
525
+ if (!isFilesTransferEvent(event.nativeEvent)) {
526
+ return;
527
+ }
528
+ onFilesAddedRef.current([...event.dataTransfer.files]);
529
+ },
530
+ [onFilesAddedRef, setDropZoneState]
531
+ );
532
+ return dropZoneState ? /* @__PURE__ */ React8.createElement(
533
+ "div",
534
+ {
535
+ className: cx(classNames["webchat-fluent__sendbox__attachment-drop-zone"], {
536
+ [classNames["webchat-fluent__sendbox__attachment-drop-zone--droppable"]]: dropZoneState === "droppable"
537
+ }),
538
+ "data-testid": testIds_default.sendBoxDropZone,
539
+ onDragOver: handleDragOver,
540
+ onDrop: handleDrop,
541
+ ref: dropZoneRef
542
+ },
543
+ /* @__PURE__ */ React8.createElement(AddDocumentIcon, { className: classNames["webchat-fluent__sendbox__attachment-drop-zone-icon"] }),
544
+ localize("TEXT_INPUT_DROP_ZONE")
545
+ ) : null;
546
+ };
547
+ DropZone.displayName = "DropZone";
548
+ var dropZone_default = memo5(DropZone);
549
+
550
+ // src/components/DropZone.tsx
551
+ var DropZone_default = dropZone_default;
552
+
553
+ // src/components/suggestedActions/index.tsx
554
+ import { hooks as hooks3 } from "botframework-webchat-component";
555
+ import cx3 from "classnames";
556
+ import React11, { memo as memo8 } from "react";
557
+
558
+ // src/components/suggestedActions/SuggestedAction.tsx
559
+ import { hooks as hooks2 } from "botframework-webchat-component";
560
+ import cx2 from "classnames";
561
+ import React10, { memo as memo7, useCallback as useCallback4, useRef as useRef4 } from "react";
562
+
563
+ // src/components/suggestedActions/AccessibleButton.tsx
564
+ import React9, { forwardRef as forwardRef2, memo as memo6, useRef as useRef3 } from "react";
565
+ var preventDefaultHandler = (event) => event.preventDefault();
566
+ var AccessibleButton = forwardRef2(
567
+ ({ "aria-hidden": ariaHidden, children, disabled, onClick, tabIndex, ...props }, forwardedRef) => {
568
+ const targetRef = useRef3(null);
569
+ const ref = forwardedRef || targetRef;
570
+ return /* @__PURE__ */ React9.createElement(
571
+ "button",
572
+ {
573
+ "aria-disabled": disabled ? "true" : "false",
574
+ "aria-hidden": ariaHidden,
575
+ onClick: disabled ? preventDefaultHandler : onClick,
576
+ ref,
577
+ tabIndex,
578
+ ...disabled && {
579
+ "aria-disabled": "true",
580
+ tabIndex: -1
581
+ },
582
+ ...props,
583
+ type: "button"
584
+ },
585
+ children
586
+ );
587
+ }
588
+ );
589
+ var AccessibleButton_default = memo6(AccessibleButton);
590
+
591
+ // src/components/suggestedActions/SuggestedAction.tsx
592
+ var { useDisabled, useFocus, usePerformCardAction, useScrollToEnd, useStyleSet, useSuggestedActions } = hooks2;
593
+ var styles5 = {
594
+ "webchat-fluent__suggested-action": {
595
+ alignItems: "center",
596
+ background: "transparent",
597
+ border: "1px solid var(--webchat-colorBrandStroke2)",
598
+ borderRadius: "8px",
599
+ cursor: "pointer",
600
+ display: "flex",
601
+ fontSize: "12px",
602
+ gap: "4px",
603
+ padding: "4px 8px 4px",
604
+ textAlign: "start",
605
+ transition: "all .15s ease-out",
606
+ "@media (hover: hover)": {
607
+ '&:not([aria-disabled="true"]):hover': {
608
+ backgroundColor: "var(--webchat-colorBrandBackground2Hover)",
609
+ color: "var(--webchat-colorBrandForeground2Hover)"
610
+ }
611
+ },
612
+ '&:not([aria-disabled="true"]):active': {
613
+ backgroundColor: "var(--webchat-colorBrandBackground2Pressed)",
614
+ color: "var(--webchat-colorBrandForeground2Pressed)"
615
+ },
616
+ '&[aria-disabled="true"]': {
617
+ color: "var(--webchat-colorNeutralForegroundDisabled)",
618
+ cursor: "not-allowed"
619
+ }
620
+ },
621
+ "webchat-fluent__suggested-action__image": {
622
+ height: "12px"
623
+ }
624
+ };
625
+ function SuggestedAction({
626
+ buttonText,
627
+ className,
628
+ displayText,
629
+ image,
630
+ imageAlt,
631
+ text,
632
+ type,
633
+ value
634
+ }) {
635
+ const [_, setSuggestedActions] = useSuggestedActions();
636
+ const [{ suggestedAction: suggestedActionStyleSet }] = useStyleSet();
637
+ const [disabled] = useDisabled();
638
+ const focus = useFocus();
639
+ const focusRef = useRef4(null);
640
+ const performCardAction = usePerformCardAction();
641
+ const classNames = useStyles(styles5);
642
+ const scrollToEnd = useScrollToEnd();
643
+ const handleClick = useCallback4(
644
+ ({ target }) => {
645
+ (async function() {
646
+ await focus("sendBoxWithoutKeyboard");
647
+ performCardAction({ displayText, text, type, value }, { target });
648
+ type === "openUrl" && setSuggestedActions([]);
649
+ scrollToEnd();
650
+ })();
651
+ },
652
+ [displayText, focus, performCardAction, scrollToEnd, setSuggestedActions, text, type, value]
653
+ );
654
+ return /* @__PURE__ */ React10.createElement(
655
+ AccessibleButton_default,
656
+ {
657
+ className: cx2(
658
+ classNames["webchat-fluent__suggested-action"],
659
+ suggestedActionStyleSet + "",
660
+ (className || "") + ""
661
+ ),
662
+ disabled,
663
+ onClick: handleClick,
664
+ ref: focusRef,
665
+ type: "button"
666
+ },
667
+ image && /* @__PURE__ */ React10.createElement("img", { alt: imageAlt, className: classNames["webchat-fluent__suggested-action__image"], src: image }),
668
+ /* @__PURE__ */ React10.createElement("span", null, buttonText)
669
+ );
670
+ }
671
+ var SuggestedAction_default = memo7(SuggestedAction);
672
+
673
+ // src/components/suggestedActions/private/computeSuggestedActionText.ts
674
+ function computeSuggestedActionText(cardAction) {
675
+ const { title } = cardAction;
676
+ const { type, value } = cardAction;
677
+ if (type === "messageBack") {
678
+ return title || cardAction.displayText;
679
+ } else if (title) {
680
+ return title;
681
+ } else if (typeof value === "string") {
682
+ return value;
683
+ }
684
+ return JSON.stringify(value);
685
+ }
686
+
687
+ // src/components/suggestedActions/index.tsx
688
+ var { useLocalizer: useLocalizer2, useStyleOptions, useStyleSet: useStyleSet2, useSuggestedActions: useSuggestedActions2 } = hooks3;
689
+ var styles6 = {
690
+ "webchat-fluent__suggested-actions": {
691
+ alignItems: "flex-end",
692
+ alignSelf: "flex-end",
693
+ display: "flex",
694
+ gap: "8px",
695
+ "&:not(:empty)": {
696
+ paddingBlockEnd: "8px",
697
+ paddingInlineStart: "4px"
698
+ },
699
+ "&.webchat-fluent__suggested-actions--flow": {
700
+ flexDirection: "row",
701
+ flexWrap: "wrap",
702
+ justifyContent: "flex-end"
703
+ },
704
+ "&.webchat-fluent__suggested-actions--stacked": {
705
+ flexDirection: "column"
706
+ }
707
+ }
708
+ };
709
+ function SuggestedActionStackedOrFlowContainer(props) {
710
+ const [{ suggestedActionLayout }] = useStyleOptions();
711
+ const [{ suggestedActions: suggestedActionsStyleSet }] = useStyleSet2();
712
+ const classNames = useStyles(styles6);
713
+ return /* @__PURE__ */ React11.createElement(
714
+ "div",
715
+ {
716
+ "aria-label": props["aria-label"],
717
+ "aria-live": "polite",
718
+ "aria-orientation": "vertical",
719
+ className: cx3(
720
+ classNames["webchat-fluent__suggested-actions"],
721
+ suggestedActionsStyleSet + "",
722
+ {
723
+ "webchat-fluent__suggested-actions--flow": suggestedActionLayout === "flow",
724
+ "webchat-fluent__suggested-actions--stacked": suggestedActionLayout !== "flow"
725
+ },
726
+ props.className
727
+ ),
728
+ role: "toolbar"
729
+ },
730
+ !!props.children && !!React11.Children.count(props.children) && props.children
731
+ );
732
+ }
733
+ function SuggestedActions() {
734
+ const classNames = useStyles(styles6);
735
+ const localize = useLocalizer2();
736
+ const [suggestedActions] = useSuggestedActions2();
737
+ const children = suggestedActions.map((cardAction, index) => {
738
+ const { displayText, image, imageAltText, text, type, value } = cardAction;
739
+ if (!suggestedActions?.length) {
740
+ return null;
741
+ }
742
+ return /* @__PURE__ */ React11.createElement(
743
+ SuggestedAction_default,
744
+ {
745
+ buttonText: computeSuggestedActionText(cardAction),
746
+ displayText,
747
+ image,
748
+ imageAlt: image && (imageAltText || text),
749
+ itemIndex: index,
750
+ key: index,
751
+ text,
752
+ type,
753
+ value
754
+ }
755
+ );
756
+ });
757
+ return /* @__PURE__ */ React11.createElement(
758
+ SuggestedActionStackedOrFlowContainer,
759
+ {
760
+ "aria-label": localize("SUGGESTED_ACTIONS_LABEL_ALT"),
761
+ className: classNames["webchat-fluent__suggested-actions"]
762
+ },
763
+ children
764
+ );
765
+ }
766
+ var suggestedActions_default = memo8(SuggestedActions);
767
+
768
+ // src/components/SuggestedActions.tsx
769
+ var SuggestedActions_default = suggestedActions_default;
770
+
771
+ // src/components/sendbox/AddAttachmentButton.tsx
772
+ import { hooks as hooks4 } from "botframework-webchat-api";
773
+ import React14, { useCallback as useCallback5, useRef as useRef5, memo as memo10 } from "react";
774
+ import { useRefFrom as useRefFrom4 } from "use-ref-from";
775
+
776
+ // src/icons/AttachmentIcon.tsx
777
+ import React12 from "react";
778
+ function AttachmentIcon(props) {
779
+ return /* @__PURE__ */ React12.createElement(
780
+ "svg",
781
+ {
782
+ "aria-hidden": "true",
783
+ className: props.className,
784
+ fill: "currentColor",
785
+ height: "1em",
786
+ viewBox: "0 0 20 20",
787
+ width: "1em",
788
+ xmlns: "http://www.w3.org/2000/svg"
789
+ },
790
+ /* @__PURE__ */ React12.createElement(
791
+ "path",
792
+ {
793
+ d: "m4.83 10.48 5.65-5.65a3 3 0 0 1 4.25 4.24L8 15.8a1.5 1.5 0 0 1-2.12-2.12l6-6.01a.5.5 0 1 0-.7-.71l-6 6.01a2.5 2.5 0 0 0 3.53 3.54l6.71-6.72a4 4 0 1 0-5.65-5.66L4.12 9.78a.5.5 0 0 0 .7.7Z",
794
+ fill: "currentColor"
795
+ }
796
+ )
797
+ );
798
+ }
799
+
800
+ // src/components/sendbox/Toolbar.tsx
801
+ import cx4 from "classnames";
802
+ import React13, { memo as memo9 } from "react";
803
+ var styles7 = {
804
+ "webchat-fluent__sendbox__toolbar": {
805
+ display: "flex",
806
+ gap: "4px",
807
+ marginInlineStart: "auto"
808
+ },
809
+ "webchat-fluent__sendbox__toolbar-button": {
810
+ alignItems: "center",
811
+ appearance: "none",
812
+ aspectRatio: "1",
813
+ background: "transparent",
814
+ border: "none",
815
+ borderRadius: "var(--webchat-borderRadiusSmall)",
816
+ cursor: "pointer",
817
+ display: "flex",
818
+ justifyContent: "center",
819
+ padding: "3px",
820
+ width: "32px",
821
+ "> svg": {
822
+ fontSize: "20px",
823
+ pointerEvents: "none"
824
+ },
825
+ "@media (hover: hover)": {
826
+ '&:not([aria-disabled="true"]):hover': {
827
+ backgroundColor: "var(--webchat-colorSubtleBackgroundHover)",
828
+ color: "var(--webchat-colorCompoundBrandForeground1Hover)"
829
+ }
830
+ },
831
+ '&:not([aria-disabled="true"]):active': {
832
+ backgroundColor: "var(--webchat-colorSubtleBackgroundPressed)",
833
+ color: "var(--webchat-colorCompoundBrandForeground1Pressed)"
834
+ },
835
+ '&[aria-disabled="true"]': {
836
+ color: "var(--webchat-colorNeutralForegroundDisabled)",
837
+ cursor: "not-allowed"
838
+ }
839
+ },
840
+ "webchat-fluent__sendbox__toolbar-separator": {
841
+ alignSelf: "center",
842
+ borderInlineEnd: "1px solid var(--webchat-colorNeutralStroke2)",
843
+ height: "28px",
844
+ "&:first-child, &:last-child, &:only-child": {
845
+ display: "none"
846
+ }
847
+ }
848
+ };
849
+ var preventDefaultHandler2 = (event) => event.preventDefault();
850
+ var ToolbarButton = memo9(
851
+ (props) => {
852
+ const classNames = useStyles(styles7);
853
+ return /* @__PURE__ */ React13.createElement(
854
+ "button",
855
+ {
856
+ "aria-label": props["aria-label"],
857
+ className: cx4(classNames["webchat-fluent__sendbox__toolbar-button"], props.className),
858
+ "data-testid": props["data-testid"],
859
+ onClick: props.disabled ? preventDefaultHandler2 : props.onClick,
860
+ type: props.type === "submit" ? "submit" : "button",
861
+ ...props.disabled && {
862
+ "aria-disabled": "true",
863
+ tabIndex: -1
864
+ }
865
+ },
866
+ props.children
867
+ );
868
+ }
869
+ );
870
+ ToolbarButton.displayName = "ToolbarButton";
871
+ var Toolbar = memo9((props) => {
872
+ const classNames = useStyles(styles7);
873
+ return /* @__PURE__ */ React13.createElement("div", { className: cx4(classNames["webchat-fluent__sendbox__toolbar"], props.className) }, props.children);
874
+ });
875
+ Toolbar.displayName = "Toolbar";
876
+ var ToolbarSeparator = memo9(
877
+ (props) => {
878
+ const classNames = useStyles(styles7);
879
+ return /* @__PURE__ */ React13.createElement(
880
+ "div",
881
+ {
882
+ "aria-orientation": "vertical",
883
+ className: cx4(classNames["webchat-fluent__sendbox__toolbar-separator"], props.className),
884
+ role: "separator"
885
+ }
886
+ );
887
+ }
888
+ );
889
+ ToolbarSeparator.displayName = "ToolbarSeparator";
890
+
891
+ // src/components/sendbox/AddAttachmentButton.tsx
892
+ var { useLocalizer: useLocalizer3, useStyleOptions: useStyleOptions2 } = hooks4;
893
+ var styles8 = {
894
+ "webchat-fluent__sendbox__add-attachment": {
895
+ display: "grid"
896
+ },
897
+ "webchat-fluent__sendbox__add-attachment-input": {
898
+ fontSize: 0,
899
+ height: 0,
900
+ opacity: 0,
901
+ width: 0
902
+ }
903
+ };
904
+ function AddAttachmentButton(props) {
905
+ const inputRef = useRef5(null);
906
+ const classNames = useStyles(styles8);
907
+ const localize = useLocalizer3();
908
+ const [{ uploadAccept, uploadMultiple }] = useStyleOptions2();
909
+ const onFilesAddedRef = useRefFrom4(props.onFilesAdded);
910
+ const handleClick = useCallback5(() => inputRef.current?.click(), [inputRef]);
911
+ const handleFileChange = useCallback5(
912
+ ({ target: { files } }) => {
913
+ if (files) {
914
+ onFilesAddedRef.current?.([...files]);
915
+ if (inputRef.current) {
916
+ inputRef.current.value = "";
917
+ }
918
+ }
919
+ },
920
+ [inputRef, onFilesAddedRef]
921
+ );
922
+ return /* @__PURE__ */ React14.createElement("div", { className: classNames["webchat-fluent__sendbox__add-attachment"] }, /* @__PURE__ */ React14.createElement(
923
+ "input",
924
+ {
925
+ accept: uploadAccept,
926
+ "aria-disabled": props.disabled,
927
+ "aria-hidden": "true",
928
+ className: classNames["webchat-fluent__sendbox__add-attachment-input"],
929
+ multiple: uploadMultiple,
930
+ onInput: props.disabled ? void 0 : handleFileChange,
931
+ readOnly: props.disabled,
932
+ ref: inputRef,
933
+ role: "button",
934
+ tabIndex: -1,
935
+ type: "file"
936
+ }
937
+ ), /* @__PURE__ */ React14.createElement(
938
+ ToolbarButton,
939
+ {
940
+ "aria-label": localize("TEXT_INPUT_UPLOAD_BUTTON_ALT"),
941
+ "data-testid": testIds_default.sendBoxUploadButton,
942
+ onClick: handleClick
943
+ },
944
+ /* @__PURE__ */ React14.createElement(AttachmentIcon, null)
945
+ ));
946
+ }
947
+ var AddAttachmentButton_default = memo10(AddAttachmentButton);
948
+
949
+ // src/components/sendbox/Attachments.tsx
950
+ import { hooks as hooks5 } from "botframework-webchat-api";
951
+ import React15, { memo as memo11 } from "react";
952
+ var { useLocalizer: useLocalizer4 } = hooks5;
953
+ var styles9 = {
954
+ "webchat-fluent__sendbox__attachment": {
955
+ border: "1px solid var(--webchat-colorNeutralStroke1)",
956
+ borderRadius: "var(--webchat-borderRadiusLarge)",
957
+ cursor: "default",
958
+ padding: "6px 8px",
959
+ width: "fit-content"
960
+ }
961
+ };
962
+ var attachmentsPluralStringIds = {
963
+ one: "TEXT_INPUT_ATTACHMENTS_ONE",
964
+ two: "TEXT_INPUT_ATTACHMENTS_TWO",
965
+ few: "TEXT_INPUT_ATTACHMENTS_FEW",
966
+ many: "TEXT_INPUT_ATTACHMENTS_MANY",
967
+ other: "TEXT_INPUT_ATTACHMENTS_OTHER"
968
+ };
969
+ function Attachments({
970
+ attachments
971
+ }) {
972
+ const classNames = useStyles(styles9);
973
+ const localizeWithPlural = useLocalizer4({ plural: true });
974
+ return attachments.length ? /* @__PURE__ */ React15.createElement("div", { className: classNames["webchat-fluent__sendbox__attachment"] }, localizeWithPlural(attachmentsPluralStringIds, attachments.length)) : null;
975
+ }
976
+ var Attachments_default = memo11(Attachments);
977
+
978
+ // src/components/sendbox/ErrorMessage.tsx
979
+ import React16, { memo as memo12 } from "react";
980
+ var styles10 = {
981
+ "webchat-fluent___sendbox__error-message": {
982
+ fontSize: 0,
983
+ height: 0,
984
+ width: 0,
985
+ position: "absolute",
986
+ top: 0,
987
+ left: 0,
988
+ color: "transparent"
989
+ }
990
+ };
991
+ function ErrorMessage(props) {
992
+ const classNames = useStyles(styles10);
993
+ return (
994
+ // eslint-disable-next-line react/forbid-dom-props
995
+ /* @__PURE__ */ React16.createElement("span", { className: classNames["webchat-fluent___sendbox__error-message"], id: props.id, role: "alert" }, props.error)
996
+ );
997
+ }
998
+ var ErrorMessage_default = memo12(ErrorMessage);
999
+
1000
+ // src/components/sendbox/TelephoneKeypadToolbarButton.tsx
1001
+ import React18, { memo as memo13, useCallback as useCallback6 } from "react";
1002
+ import { hooks as hooks6 } from "botframework-webchat-api";
1003
+
1004
+ // src/icons/TelephoneKeypad.tsx
1005
+ import React17 from "react";
1006
+ function TelephoneKeypadIcon(props) {
1007
+ return /* @__PURE__ */ React17.createElement(
1008
+ "svg",
1009
+ {
1010
+ "aria-hidden": "true",
1011
+ className: props.className,
1012
+ fill: "currentColor",
1013
+ height: "1em",
1014
+ viewBox: "0 0 20 20",
1015
+ width: "1em",
1016
+ xmlns: "http://www.w3.org/2000/svg"
1017
+ },
1018
+ /* @__PURE__ */ React17.createElement(
1019
+ "path",
1020
+ {
1021
+ d: "M6 5.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm0 4a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM7.25 12a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM10 5.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM11.25 8a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM10 13.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM11.25 16a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM14 5.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5ZM15.25 8a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0ZM14 13.25a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z",
1022
+ fill: "currentColor"
1023
+ }
1024
+ )
1025
+ );
1026
+ }
1027
+
1028
+ // src/components/sendbox/TelephoneKeypadToolbarButton.tsx
1029
+ var { useLocalizer: useLocalizer5 } = hooks6;
1030
+ var TelephoneKeypadToolbarButton = memo13(() => {
1031
+ const [, setTelephoneKeypadShown] = useShown();
1032
+ const localize = useLocalizer5();
1033
+ const handleClick = useCallback6(() => setTelephoneKeypadShown((shown) => !shown), [setTelephoneKeypadShown]);
1034
+ return /* @__PURE__ */ React18.createElement(
1035
+ ToolbarButton,
1036
+ {
1037
+ "aria-label": localize("TEXT_INPUT_TELEPHONE_KEYPAD_BUTTON_ALT"),
1038
+ "data-testid": testIds_default.sendBoxTelephoneKeypadToolbarButton,
1039
+ onClick: handleClick
1040
+ },
1041
+ /* @__PURE__ */ React18.createElement(TelephoneKeypadIcon, null)
1042
+ );
1043
+ });
1044
+ TelephoneKeypadToolbarButton.displayName = "SendBox.TelephoneKeypadToolbarButton";
1045
+ var TelephoneKeypadToolbarButton_default = TelephoneKeypadToolbarButton;
1046
+
1047
+ // src/components/sendbox/TextArea.tsx
1048
+ import cx5 from "classnames";
1049
+ import React19, { forwardRef as forwardRef3, useCallback as useCallback7 } from "react";
1050
+ var styles11 = {
1051
+ "webchat-fluent__sendbox__text-area": {
1052
+ display: "grid",
1053
+ gridTemplateAreas: `'main'`,
1054
+ maxHeight: "200px",
1055
+ overflow: "hidden"
1056
+ },
1057
+ "webchat-fluent__sendbox__text-area--hidden": {
1058
+ // TODO: Not perfect way of hiding the text box.
1059
+ height: 0,
1060
+ visibility: "collapse"
1061
+ },
1062
+ "webchat-fluent__sendbox__text-area-shared": {
1063
+ border: "none",
1064
+ font: "inherit",
1065
+ gridArea: "main",
1066
+ outline: "inherit",
1067
+ overflowWrap: "anywhere",
1068
+ resize: "inherit",
1069
+ scrollbarGutter: "stable"
1070
+ },
1071
+ "webchat-fluent__sendbox__text-area-doppelganger": {
1072
+ overflow: "hidden",
1073
+ visibility: "hidden",
1074
+ whiteSpace: "pre-wrap"
1075
+ },
1076
+ "webchat-fluent__sendbox__text-area-input": {
1077
+ height: "100%",
1078
+ padding: 0
1079
+ },
1080
+ "webchat-fluent__sendbox__text-area-input--scroll": {
1081
+ /* Firefox */
1082
+ MozScrollbarColor: "var(--webchat-colorNeutralBackground5) var(--webchat-colorNeutralForeground2)",
1083
+ MozScrollbarWidth: "thin",
1084
+ /* Chrome, Edge, and Safari */
1085
+ "&::-webkit-scrollbar": {
1086
+ width: "8px"
1087
+ },
1088
+ "&::-webkit-scrollbar-track": {
1089
+ backgroundColor: "var(--webchat-colorNeutralBackground5)",
1090
+ borderRadius: "16px"
1091
+ },
1092
+ "&::-webkit-scrollbar-thumb": {
1093
+ backgroundColor: "var(--webchat-colorNeutralForeground2)",
1094
+ borderRadius: "16px"
1095
+ },
1096
+ "&::-webkit-scrollbar-corner": {
1097
+ backgroundColor: "var(--webchat-colorNeutralBackground5)"
1098
+ }
1099
+ }
1100
+ };
1101
+ var TextArea = forwardRef3((props, ref) => {
1102
+ const classNames = useStyles(styles11);
1103
+ const handleKeyDown = useCallback7((event) => {
1104
+ if (!event.shiftKey && event.key === "Enter") {
1105
+ event.preventDefault();
1106
+ if ("form" in event.target && event.target.form instanceof HTMLFormElement) {
1107
+ event.target?.form?.requestSubmit();
1108
+ }
1109
+ }
1110
+ }, []);
1111
+ return /* @__PURE__ */ React19.createElement(
1112
+ "div",
1113
+ {
1114
+ className: cx5(
1115
+ classNames["webchat-fluent__sendbox__text-area"],
1116
+ {
1117
+ [classNames["webchat-fluent__sendbox__text-area--hidden"]]: props.hidden
1118
+ },
1119
+ props.className
1120
+ ),
1121
+ role: props.hidden ? "hidden" : void 0
1122
+ },
1123
+ /* @__PURE__ */ React19.createElement(
1124
+ "div",
1125
+ {
1126
+ className: cx5(
1127
+ classNames["webchat-fluent__sendbox__text-area-doppelganger"],
1128
+ classNames["webchat-fluent__sendbox__text-area-shared"],
1129
+ classNames["webchat-fluent__sendbox__text-area-input--scroll"]
1130
+ )
1131
+ },
1132
+ props.value || props.placeholder,
1133
+ " "
1134
+ ),
1135
+ /* @__PURE__ */ React19.createElement(
1136
+ "textarea",
1137
+ {
1138
+ "aria-label": props["aria-label"],
1139
+ className: cx5(
1140
+ classNames["webchat-fluent__sendbox__text-area-input"],
1141
+ classNames["webchat-fluent__sendbox__text-area-shared"],
1142
+ classNames["webchat-fluent__sendbox__text-area-input--scroll"]
1143
+ ),
1144
+ "data-testid": props["data-testid"],
1145
+ onInput: props.onInput,
1146
+ onKeyDown: handleKeyDown,
1147
+ placeholder: props.placeholder,
1148
+ ref,
1149
+ rows: props.startRows ?? 1,
1150
+ tabIndex: props.hidden ? -1 : void 0,
1151
+ value: props.value
1152
+ }
1153
+ )
1154
+ );
1155
+ });
1156
+ TextArea.displayName = "TextArea";
1157
+ var TextArea_default = TextArea;
1158
+
1159
+ // src/components/sendbox/private/useSubmitError.ts
1160
+ import { hooks as hooks7 } from "botframework-webchat-component";
1161
+ import { useMemo as useMemo5 } from "react";
1162
+ import { useRefFrom as useRefFrom5 } from "use-ref-from";
1163
+ var { useConnectivityStatus, useLocalizer: useLocalizer6 } = hooks7;
1164
+ var useSubmitError = ({
1165
+ attachments,
1166
+ message
1167
+ }) => {
1168
+ const [connectivityStatus] = useConnectivityStatus();
1169
+ const localize = useLocalizer6();
1170
+ const submitErrorRef = useRefFrom5(
1171
+ connectivityStatus !== "connected" && connectivityStatus !== "reconnected" ? "offline" : !message && !attachments.length ? "empty" : void 0
1172
+ );
1173
+ const errorMessageStringMap = useMemo5(
1174
+ () => Object.freeze(
1175
+ (/* @__PURE__ */ new Map()).set("empty", localize("SEND_BOX_IS_EMPTY_TOOLTIP_ALT")).set("offline", localize("CONNECTIVITY_STATUS_ALT_FATAL"))
1176
+ ),
1177
+ [localize]
1178
+ );
1179
+ return useMemo5(
1180
+ () => Object.freeze([submitErrorRef, submitErrorRef.current && errorMessageStringMap.get(submitErrorRef.current)]),
1181
+ [errorMessageStringMap, submitErrorRef]
1182
+ );
1183
+ };
1184
+ var useSubmitError_default = useSubmitError;
1185
+
1186
+ // src/components/sendbox/private/useUniqueId.ts
1187
+ import { useMemo as useMemo6 } from "react";
1188
+ function useUniqueId(prefix) {
1189
+ const id = useMemo6(() => Math.random().toString(36).substr(2, 5), []);
1190
+ prefix = prefix ? `${prefix}--` : "";
1191
+ return `${prefix}${id}`;
1192
+ }
1193
+
1194
+ // src/components/sendbox/index.tsx
1195
+ var { useStyleOptions: useStyleOptions3, useMakeThumbnail, useLocalizer: useLocalizer7, useSendBoxAttachments, useSendMessage } = hooks8;
1196
+ var styles12 = {
1197
+ "webchat-fluent__sendbox": {
1198
+ color: "var(--webchat-colorNeutralForeground1)",
1199
+ fontFamily: "var(--webchat-fontFamilyBase)",
1200
+ padding: "0 10px 10px",
1201
+ textRendering: "optimizeLegibility"
1202
+ },
1203
+ "webchat-fluent__sendbox__sendbox": {
1204
+ backgroundColor: "var(--webchat-colorNeutralBackground1)",
1205
+ border: "1px solid var(--webchat-colorNeutralStroke1)",
1206
+ borderRadius: "var(--webchat-borderRadiusLarge)",
1207
+ display: "grid",
1208
+ fontFamily: "var(--webchat-fontFamilyBase)",
1209
+ fontSize: "14px",
1210
+ gap: "6px",
1211
+ lineHeight: "20px",
1212
+ padding: "8px",
1213
+ position: "relative",
1214
+ "&:focus-within": {
1215
+ borderColor: "var(--webchat-colorNeutralStroke1Selected)",
1216
+ // TODO clarify with design the color:
1217
+ // - Teams is using colorCompoundBrandForeground1
1218
+ // - Fluent is using colorCompoundBrandStroke
1219
+ // - we are using colorCompoundBrandForeground1Hover
1220
+ boxShadow: "inset 0 -6px 0 -3px var(--webchat-colorCompoundBrandForeground1Hover)"
1221
+ }
1222
+ },
1223
+ "webchat-fluent__sendbox__sendbox-text": {
1224
+ backgroundColor: "transparent",
1225
+ border: "none",
1226
+ flex: "auto",
1227
+ fontFamily: "var(--webchat-fontFamilyBase)",
1228
+ fontSize: "14px",
1229
+ lineHeight: "20px",
1230
+ outline: "none",
1231
+ padding: "4px 4px 0",
1232
+ resize: "none"
1233
+ },
1234
+ "webchat-fluent__sendbox__sendbox-controls": {
1235
+ alignItems: "center",
1236
+ display: "flex",
1237
+ paddingInlineStart: "4px"
1238
+ },
1239
+ "webchat-fluent__sendbox__text-counter": {
1240
+ color: "var(--webchat-colorNeutralForeground4)",
1241
+ cursor: "default",
1242
+ fontFamily: "var(--webchat-fontFamilyNumeric)",
1243
+ fontSize: "10px",
1244
+ lineHeight: "14px"
1245
+ },
1246
+ "webchat-fluent__sendbox__text-counter--error": {
1247
+ color: "var(--webchat-colorStatusDangerForeground1)"
1248
+ }
1249
+ };
1250
+ function SendBox(props) {
1251
+ const inputRef = useRef6(null);
1252
+ const [message, setMessage] = useState3("");
1253
+ const [attachments, setAttachments] = useSendBoxAttachments();
1254
+ const [{ hideTelephoneKeypadButton, hideUploadButton, maxMessageLength }] = useStyleOptions3();
1255
+ const isMessageLengthExceeded = !!maxMessageLength && message.length > maxMessageLength;
1256
+ const classNames = useStyles(styles12);
1257
+ const localize = useLocalizer7();
1258
+ const sendMessage = useSendMessage();
1259
+ const makeThumbnail = useMakeThumbnail();
1260
+ const errorMessageId = useUniqueId("webchat-fluent__sendbox__error-message-id");
1261
+ const [errorRef, errorMessage] = useSubmitError_default({ message, attachments });
1262
+ const [telephoneKeypadShown] = useShown();
1263
+ const attachmentsRef = useRefFrom6(attachments);
1264
+ const messageRef = useRefFrom6(message);
1265
+ const handleSendBoxClick = useCallback8(
1266
+ (event) => {
1267
+ if ("tabIndex" in event.target && typeof event.target.tabIndex === "number" && event.target.tabIndex >= 0) {
1268
+ return;
1269
+ }
1270
+ inputRef.current?.focus();
1271
+ },
1272
+ [inputRef]
1273
+ );
1274
+ const handleMessageChange = useCallback8(
1275
+ (event) => setMessage(event.currentTarget.value),
1276
+ [setMessage]
1277
+ );
1278
+ const handleAddFiles = useCallback8(
1279
+ async (inputFiles) => {
1280
+ const newAttachments = Object.freeze(
1281
+ await Promise.all(
1282
+ inputFiles.map(
1283
+ (file) => makeThumbnail(file).then(
1284
+ (thumbnailURL) => Object.freeze({
1285
+ blob: file,
1286
+ ...thumbnailURL && { thumbnailURL }
1287
+ })
1288
+ )
1289
+ )
1290
+ )
1291
+ );
1292
+ setAttachments(newAttachments);
1293
+ },
1294
+ [makeThumbnail, setAttachments]
1295
+ );
1296
+ const handleFormSubmit = useCallback8(
1297
+ (event) => {
1298
+ event.preventDefault();
1299
+ if (errorRef.current !== "empty" && !isMessageLengthExceeded) {
1300
+ sendMessage(messageRef.current, void 0, { attachments: attachmentsRef.current });
1301
+ setMessage("");
1302
+ setAttachments([]);
1303
+ }
1304
+ inputRef.current?.focus();
1305
+ },
1306
+ [attachmentsRef, messageRef, sendMessage, setAttachments, setMessage, isMessageLengthExceeded, errorRef, inputRef]
1307
+ );
1308
+ const handleTelephoneKeypadButtonClick = useCallback8(
1309
+ // TODO: We need more official way of sending DTMF.
1310
+ (dtmf) => sendMessage(`/DTMF ${dtmf}`),
1311
+ [sendMessage]
1312
+ );
1313
+ const aria = {
1314
+ "aria-invalid": "false",
1315
+ ...errorMessage && {
1316
+ "aria-invalid": "true",
1317
+ "aria-errormessage": errorMessageId
1318
+ }
1319
+ };
1320
+ return /* @__PURE__ */ React20.createElement("form", { ...aria, className: cx6(classNames["webchat-fluent__sendbox"], props.className), onSubmit: handleFormSubmit }, /* @__PURE__ */ React20.createElement(SuggestedActions_default, null), /* @__PURE__ */ React20.createElement("div", { className: cx6(classNames["webchat-fluent__sendbox__sendbox"]), onClickCapture: handleSendBoxClick }, /* @__PURE__ */ React20.createElement(
1321
+ Surrogate_default,
1322
+ {
1323
+ autoFocus: true,
1324
+ isHorizontal: false,
1325
+ onButtonClick: handleTelephoneKeypadButtonClick
1326
+ }
1327
+ ), /* @__PURE__ */ React20.createElement(
1328
+ TextArea_default,
1329
+ {
1330
+ "aria-label": isMessageLengthExceeded ? localize("TEXT_INPUT_LENGTH_EXCEEDED_ALT") : localize("TEXT_INPUT_ALT"),
1331
+ className: classNames["webchat-fluent__sendbox__sendbox-text"],
1332
+ "data-testid": testIds_default.sendBoxTextBox,
1333
+ hidden: telephoneKeypadShown,
1334
+ onInput: handleMessageChange,
1335
+ placeholder: props.placeholder ?? localize("TEXT_INPUT_PLACEHOLDER"),
1336
+ ref: inputRef,
1337
+ value: message
1338
+ }
1339
+ ), /* @__PURE__ */ React20.createElement(Attachments_default, { attachments }), /* @__PURE__ */ React20.createElement("div", { className: cx6(classNames["webchat-fluent__sendbox__sendbox-controls"]) }, maxMessageLength && /* @__PURE__ */ React20.createElement(
1340
+ "div",
1341
+ {
1342
+ className: cx6(classNames["webchat-fluent__sendbox__text-counter"], {
1343
+ [classNames["webchat-fluent__sendbox__text-counter--error"]]: isMessageLengthExceeded
1344
+ })
1345
+ },
1346
+ `${message.length}/${maxMessageLength}`
1347
+ ), /* @__PURE__ */ React20.createElement(Toolbar, null, !hideTelephoneKeypadButton && /* @__PURE__ */ React20.createElement(TelephoneKeypadToolbarButton_default, null), !hideUploadButton && /* @__PURE__ */ React20.createElement(AddAttachmentButton_default, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ React20.createElement(ToolbarSeparator, null), /* @__PURE__ */ React20.createElement(
1348
+ ToolbarButton,
1349
+ {
1350
+ "aria-label": localize("TEXT_INPUT_SEND_BUTTON_ALT"),
1351
+ "data-testid": testIds_default.sendBoxSendButton,
1352
+ disabled: isMessageLengthExceeded,
1353
+ type: "submit"
1354
+ },
1355
+ /* @__PURE__ */ React20.createElement(SendIcon, null)
1356
+ ))), /* @__PURE__ */ React20.createElement(DropZone_default, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ React20.createElement(ErrorMessage_default, { error: errorMessage, id: errorMessageId })));
1357
+ }
1358
+ var sendbox_default = memo14(SendBox);
1359
+
1360
+ // src/components/SendBox.tsx
1361
+ var SendBox_default = sendbox_default;
1362
+
1363
+ // src/private/FluentThemeProvider.tsx
1364
+ var { ThemeProvider } = Components;
1365
+ var sendBoxMiddleware = [() => () => () => SendBox_default];
1366
+ var FluentThemeProvider = ({ children }) => /* @__PURE__ */ React21.createElement(WebchatTheme, null, /* @__PURE__ */ React21.createElement(Provider_default, null, /* @__PURE__ */ React21.createElement(ThemeProvider, { sendBoxMiddleware }, children)));
1367
+ var FluentThemeProvider_default = memo15(FluentThemeProvider);
1368
+
1369
+ // src/index.ts
1370
+ injectMetaTag("botframework-webchat-fluent-theme:version", "4.17.0-main.20240416.e3f5401");
1371
+ export {
1372
+ FluentThemeProvider_default as FluentThemeProvider,
1373
+ testIds_default as testIds
1374
+ };
1375
+ //# sourceMappingURL=index.mjs.map