botframework-webchat-fluent-theme 4.18.1-main.20250515.4c7400a → 4.18.1-main.20250701.b63791f
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/botframework-webchat-fluent-theme.css.map +1 -1
- package/dist/botframework-webchat-fluent-theme.development.css.map +1 -1
- package/dist/botframework-webchat-fluent-theme.development.js +8 -8
- package/dist/botframework-webchat-fluent-theme.development.js.map +1 -1
- package/dist/botframework-webchat-fluent-theme.js +1 -1
- package/dist/botframework-webchat-fluent-theme.js.map +1 -1
- package/dist/botframework-webchat-fluent-theme.mjs +1 -1
- package/dist/botframework-webchat-fluent-theme.mjs.map +1 -1
- package/dist/botframework-webchat-fluent-theme.production.min.css.map +1 -1
- package/dist/botframework-webchat-fluent-theme.production.min.js +8 -8
- package/dist/botframework-webchat-fluent-theme.production.min.js.map +1 -1
- package/package.json +6 -6
- package/src/components/activity/ActivityDecorator.module.css +12 -2
- package/src/components/dropZone/DropZone.tsx +2 -2
- package/src/components/icon/FluentIcon.module.css +53 -0
- package/src/components/icon/FluentIcon.tsx +51 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/preChatActivity/PreChatMessageActivity.module.css +1 -0
- package/src/components/preChatActivity/StarterPromptsCardAction.module.css +1 -1
- package/src/components/preChatActivity/StarterPromptsCardAction.tsx +7 -4
- package/src/components/sendBox/AddAttachmentButton.tsx +3 -2
- package/src/components/sendBox/SendBox.module.css +69 -5
- package/src/components/sendBox/SendBox.tsx +18 -14
- package/src/components/sendBox/TelephoneKeypadToolbarButton.tsx +2 -2
- package/src/components/sendBox/Toolbar.module.css +2 -0
- package/src/components/suggestedActions/SuggestedAction.tsx +2 -2
- package/src/components/suggestedActions/SuggestedActions.tsx +2 -2
- package/src/components/telephoneKeypad/private/TelephoneKeypad.tsx +4 -4
- package/src/components/theme/Theme.module.css +45 -45
- package/src/components/typingIndicator/SlidingDotsTypingIndicator.module.css +1 -1
- package/src/private/FluentThemeProvider.tsx +6 -10
- package/src/components/sendBox/Attachments.module.css +0 -7
- package/src/components/sendBox/Attachments.tsx +0 -35
- package/src/components/sendBox/TextArea.module.css +0 -82
- package/src/components/sendBox/TextArea.tsx +0 -111
- package/src/icons/AddDocumentIcon.tsx +0 -13
- package/src/icons/AttachmentIcon.tsx +0 -13
- package/src/icons/InfoSmallIcon.tsx +0 -13
- package/src/icons/SendIcon.tsx +0 -13
- package/src/icons/TelephoneKeypadIcon.tsx +0 -13
- package/src/icons/index.ts +0 -5
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
:global {
|
|
2
|
-
/* biome-ignore format: do not print each class on the new line */
|
|
3
|
-
.a, .b, .c, .d, .e, .f, .g, .h, .i, .j, .k, .l, .m, .n, .o, .p, .q, .r, .s, .t, .v, .w, .u, .x, .y, .z,
|
|
4
|
-
.A, .B, .C, .D, .E, .F, .G, .H, .I, .J, .K, .L, .M, .N, .O, .P, .Q, .R, .S, .T, .V, .W, .U, .X, .Y, .Z {
|
|
5
|
-
/* esbuild considers empty global classes as used and removes them due to lack of rules */
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
1
|
:global(.webchat-fluent).theme {
|
|
10
2
|
display: contents;
|
|
11
3
|
|
|
@@ -180,7 +172,7 @@
|
|
|
180
172
|
--webchat-strokeWidthThicker: var(--strokeWidthThicker, 3px);
|
|
181
173
|
|
|
182
174
|
/* https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/durations.ts */
|
|
183
|
-
--webchat-durationUltraFast: var(--durationUltraFast,
|
|
175
|
+
--webchat-durationUltraFast: var(--durationUltraFast, 50ms);
|
|
184
176
|
--webchat-durationNormal: var(--durationNormal, 200ms);
|
|
185
177
|
--webchat-durationUltraSlow: var(--durationUltraSlow, 500ms);
|
|
186
178
|
|
|
@@ -232,11 +224,12 @@
|
|
|
232
224
|
}
|
|
233
225
|
|
|
234
226
|
/* Scrollbars */
|
|
227
|
+
:global(.webchat-fluent).theme :global(.send-box-attachment-bar.send-box-attachment-bar--as-list-item),
|
|
228
|
+
:global(.webchat-fluent).theme :global(.text-area.text-area--scroll),
|
|
235
229
|
:global(.webchat-fluent).theme :global(.webchat__basic-transcript .webchat__basic-transcript__scrollable),
|
|
236
|
-
:global(.webchat-fluent).theme :global(.webchat__view-code-dialog__code-body),
|
|
237
230
|
:global(.webchat-fluent).theme :global(.webchat__render-markdown [data-math-type='block']),
|
|
238
|
-
:global(.webchat-fluent).theme :global(.
|
|
239
|
-
:global(.webchat-fluent).theme :global(.webchat__view-code-
|
|
231
|
+
:global(.webchat-fluent).theme :global(.webchat__view-code-dialog__body),
|
|
232
|
+
:global(.webchat-fluent).theme :global(.webchat__view-code-dialog__code-body) {
|
|
240
233
|
/* Edge uses -webkit-scrollbar if scrollbar-* is not set */
|
|
241
234
|
scrollbar-color: unset;
|
|
242
235
|
scrollbar-width: unset;
|
|
@@ -259,7 +252,12 @@
|
|
|
259
252
|
width: var(--webchat-spacingVerticalMNudge);
|
|
260
253
|
}
|
|
261
254
|
|
|
262
|
-
|
|
255
|
+
&::-webkit-scrollbar-thumb {
|
|
256
|
+
background-color: transparent;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
&:hover::-webkit-scrollbar-thumb,
|
|
260
|
+
&:has(> :global(.text-area-input:focus))::-webkit-scrollbar-thumb {
|
|
263
261
|
background-clip: padding-box;
|
|
264
262
|
background-color: var(--webchat-colorNeutralForeground5);
|
|
265
263
|
border-radius: 10px;
|
|
@@ -397,8 +395,8 @@
|
|
|
397
395
|
border-color: var(--webchat-colorStrokeFocus2);
|
|
398
396
|
}
|
|
399
397
|
|
|
400
|
-
:global(.webchat__modal-dialog__close-button-
|
|
401
|
-
|
|
398
|
+
:global(.webchat__modal-dialog__close-button-icon) {
|
|
399
|
+
color: currentColor;
|
|
402
400
|
}
|
|
403
401
|
}
|
|
404
402
|
|
|
@@ -422,7 +420,7 @@
|
|
|
422
420
|
transition: background-color var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);
|
|
423
421
|
|
|
424
422
|
:global(.webchat__code-block-copy-button__icon) {
|
|
425
|
-
|
|
423
|
+
--webchat__component-icon--color: currentColor;
|
|
426
424
|
}
|
|
427
425
|
|
|
428
426
|
&:hover {
|
|
@@ -580,6 +578,8 @@
|
|
|
580
578
|
:global(.webchat__activity-button__icon) {
|
|
581
579
|
height: 20px;
|
|
582
580
|
width: 20px;
|
|
581
|
+
|
|
582
|
+
--webchat__component-icon--color: var(--webchat-colorNeutralForeground2);
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
|
|
@@ -603,13 +603,15 @@
|
|
|
603
603
|
|
|
604
604
|
/* Feedback button */
|
|
605
605
|
:global(.webchat-fluent).theme :global(.webchat__thumb-button) {
|
|
606
|
-
|
|
606
|
+
:global(.webchat__thumb-button__image) {
|
|
607
|
+
color: var(--webchat-colorNeutralForeground1);
|
|
608
|
+
}
|
|
607
609
|
|
|
608
|
-
&:focus-visible {
|
|
610
|
+
&:has(:global(.webchat__thumb-button__input):focus-visible) {
|
|
609
611
|
outline: var(--webchat-strokeWidthThick) solid var(--webchat-colorStrokeFocus2);
|
|
610
612
|
}
|
|
611
613
|
|
|
612
|
-
|
|
614
|
+
&:has(:global(.webchat__thumb-button__input)[aria-disabled='true']) :global(.webchat__thumb-button__image) {
|
|
613
615
|
color: var(--webchat-colorNeutralForegroundDisabled);
|
|
614
616
|
}
|
|
615
617
|
}
|
|
@@ -630,94 +632,92 @@
|
|
|
630
632
|
}
|
|
631
633
|
|
|
632
634
|
/* Feedback Form */
|
|
633
|
-
:global(.webchat-fluent).theme :global(.
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
:global(.webchat__feedback-form__body) {
|
|
637
|
-
font-family: var(--webchat-fontFamilyBase);
|
|
635
|
+
:global(.webchat-fluent).theme :global(.feedback-form) {
|
|
636
|
+
:global(.feedback-form__form-header) {
|
|
638
637
|
color: var(--webchat-colorNeutralForeground1);
|
|
639
638
|
font-size: var(--webchat-fontSizeBase300);
|
|
640
639
|
font-weight: var(--webchat-fontWeightRegular);
|
|
641
640
|
line-height: var(--webchat-lineHeightBase300);
|
|
642
641
|
}
|
|
643
|
-
|
|
644
|
-
:global(.
|
|
645
|
-
|
|
642
|
+
|
|
643
|
+
:global(.feedback-form__form) {
|
|
644
|
+
gap: var(--webchat-spacingVerticalXS);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
:global(.feedback-form__form-footer) {
|
|
646
648
|
color: var(--webchat-colorNeutralForeground1);
|
|
647
649
|
font-size: var(--webchat-fontSizeBase100);
|
|
648
650
|
font-weight: var(--webchat-fontWeightRegular);
|
|
649
651
|
line-height: var(--webchat-lineHeightBase200);
|
|
650
652
|
}
|
|
651
|
-
|
|
652
|
-
:global(.
|
|
653
|
+
|
|
654
|
+
:global(.feedback-form__submit-button) {
|
|
653
655
|
background-color: var(--webchat-colorBrandBackground);
|
|
654
656
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorBrandBackground);
|
|
655
657
|
border-radius: var(--webchat-borderRadiusMedium);
|
|
656
658
|
color: var(--webchat-colorNeutralForegroundOnBrand);
|
|
657
659
|
cursor: pointer;
|
|
658
|
-
font-family: var(--webchat-fontFamilyBase);
|
|
659
660
|
font-size: var(--webchat-fontSizeBase300);
|
|
660
661
|
padding: var(--webchat-spacingVerticalNone) var(--webchat-spacingHorizontalS);
|
|
661
662
|
transition: background-color var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);
|
|
662
|
-
|
|
663
|
+
|
|
663
664
|
&:hover {
|
|
664
665
|
background-color: var(--webchat-colorBrandBackgroundHover);
|
|
665
666
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorBrandBackgroundHover);
|
|
666
667
|
}
|
|
667
|
-
|
|
668
|
+
|
|
668
669
|
&:focus-visible {
|
|
669
670
|
outline: var(--webchat-strokeWidthThick) solid var(--webchat-colorStrokeFocus2);
|
|
670
671
|
outline-offset: calc(var(--webchat-strokeWidthThin) * -1);
|
|
671
672
|
}
|
|
672
|
-
|
|
673
|
+
|
|
673
674
|
&:active {
|
|
674
675
|
background-color: var(--webchat-colorBrandBackgroundPressed);
|
|
675
676
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorBrandBackgroundPressed);
|
|
676
677
|
}
|
|
677
678
|
}
|
|
678
|
-
|
|
679
|
-
:global(.
|
|
679
|
+
|
|
680
|
+
:global(.feedback-form__cancel-button) {
|
|
680
681
|
background-color: var(--webchat-colorNeutralBackground1);
|
|
681
682
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke1);
|
|
682
683
|
border-radius: var(--webchat-borderRadiusMedium);
|
|
683
684
|
color: var(--webchat-colorNeutralForeground1);
|
|
684
685
|
cursor: pointer;
|
|
685
|
-
font-family: var(--webchat-fontFamilyBase);
|
|
686
686
|
font-size: var(--webchat-fontSizeBase300);
|
|
687
687
|
padding: var(--webchat-spacingVerticalNone) var(--webchat-spacingHorizontalS);
|
|
688
688
|
transition: background-color var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);
|
|
689
|
-
|
|
689
|
+
|
|
690
690
|
&:hover {
|
|
691
691
|
background-color: var(--webchat-colorNeutralBackground1Hover);
|
|
692
692
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke1Hover);
|
|
693
|
+
color: currentColor;
|
|
693
694
|
}
|
|
694
|
-
|
|
695
|
+
|
|
695
696
|
&:focus-visible {
|
|
696
697
|
outline: var(--webchat-strokeWidthThick) solid var(--webchat-colorStrokeFocus2);
|
|
697
698
|
outline-offset: calc(var(--webchat-strokeWidthThin) * -1);
|
|
698
699
|
}
|
|
699
|
-
|
|
700
|
+
|
|
700
701
|
&:active {
|
|
701
702
|
background-color: var(--webchat-colorNeutralBackground1Pressed);
|
|
702
703
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke1Pressed);
|
|
703
704
|
}
|
|
704
705
|
}
|
|
705
|
-
|
|
706
|
-
:global(.
|
|
706
|
+
|
|
707
|
+
:global(.feedback-form__text-box) {
|
|
707
708
|
background-color: var(--webchat-colorNeutralBackground1);
|
|
708
709
|
border-radius: var(--webchat-borderRadiusMedium);
|
|
709
710
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke1);
|
|
710
|
-
font-family: var(--webchat-fontFamilyBase);
|
|
711
711
|
font-size: var(--webchat-fontSizeBase300);
|
|
712
712
|
line-height: var(--webchat-lineHeightBase300);
|
|
713
713
|
gap: var(--webchat-spacingVerticalSNudge);
|
|
714
714
|
padding: var(--webchat-spacingVerticalS) var(--webchat-spacingHorizontalM);
|
|
715
|
+
|
|
715
716
|
&::after {
|
|
716
717
|
border-bottom-left-radius: var(--webchat-borderRadiusMedium);
|
|
717
718
|
border-bottom-right-radius: var(--webchat-borderRadiusMedium);
|
|
718
719
|
border-bottom: var(--webchat-strokeWidthThicker) solid var(--webchat-colorBrandForeground1);
|
|
719
720
|
clip-path: inset(calc(100% - var(--webchat-strokeWidthThicker)) 50% 0 50%);
|
|
720
|
-
transition: clip-path var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);
|
|
721
721
|
}
|
|
722
722
|
&:focus-within {
|
|
723
723
|
border: var(--webchat-strokeWidthThin) solid var(--webchat-colorNeutralStroke1);
|
|
@@ -726,5 +726,5 @@
|
|
|
726
726
|
clip-path: inset(calc(100% - var(--webchat-strokeWidthThicker)) 0 0 0);
|
|
727
727
|
transition: clip-path var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);
|
|
728
728
|
}
|
|
729
|
-
}
|
|
730
|
-
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { type ActivityMiddleware, type StyleOptions, type TypingIndicatorMiddleware } from 'botframework-webchat-api';
|
|
2
2
|
import {
|
|
3
|
+
createActivityBorderMiddleware,
|
|
3
4
|
DecoratorComposer,
|
|
4
|
-
DecoratorMiddleware
|
|
5
|
-
type DecoratorMiddlewareInit,
|
|
6
|
-
type DecoratorMiddlewareTypes
|
|
5
|
+
type DecoratorMiddleware
|
|
7
6
|
} from 'botframework-webchat-api/decorator';
|
|
8
7
|
import { Components } from 'botframework-webchat-component';
|
|
9
8
|
import { WebChatDecorator } from 'botframework-webchat-component/decorator';
|
|
@@ -54,15 +53,12 @@ const activityMiddleware: readonly ActivityMiddleware[] = Object.freeze([
|
|
|
54
53
|
const sendBoxMiddleware = [() => () => () => PrimarySendBox];
|
|
55
54
|
|
|
56
55
|
const decoratorMiddleware: readonly DecoratorMiddleware[] = Object.freeze([
|
|
57
|
-
(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
request.livestreamingState === 'preparing'
|
|
61
|
-
? ActivityLoader
|
|
62
|
-
: next(request)) satisfies DecoratorMiddlewareTypes['activity border'])
|
|
56
|
+
createActivityBorderMiddleware(
|
|
57
|
+
next => request => (request.livestreamingState === 'preparing' ? ActivityLoader : next(request))
|
|
58
|
+
)
|
|
63
59
|
]);
|
|
64
60
|
|
|
65
|
-
const styles = createStyles();
|
|
61
|
+
const styles = createStyles('fluent-theme');
|
|
66
62
|
|
|
67
63
|
const fluentStyleOptions: StyleOptions = Object.freeze({
|
|
68
64
|
feedbackActionsPlacement: 'activity-actions'
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { hooks } from 'botframework-webchat-component';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import React, { memo } from 'react';
|
|
4
|
-
import { useStyles } from '../../styles';
|
|
5
|
-
import styles from './Attachments.module.css';
|
|
6
|
-
|
|
7
|
-
const { useLocalizer, useUIState } = hooks;
|
|
8
|
-
|
|
9
|
-
const attachmentsPluralStringIds = {
|
|
10
|
-
one: 'TEXT_INPUT_ATTACHMENTS_ONE',
|
|
11
|
-
two: 'TEXT_INPUT_ATTACHMENTS_TWO',
|
|
12
|
-
few: 'TEXT_INPUT_ATTACHMENTS_FEW',
|
|
13
|
-
many: 'TEXT_INPUT_ATTACHMENTS_MANY',
|
|
14
|
-
other: 'TEXT_INPUT_ATTACHMENTS_OTHER'
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
function Attachments({
|
|
18
|
-
attachments,
|
|
19
|
-
className
|
|
20
|
-
}: Readonly<{
|
|
21
|
-
readonly attachments: readonly Readonly<{ blob: Blob | File; thumbnailURL?: URL | undefined }>[];
|
|
22
|
-
readonly className?: string | undefined;
|
|
23
|
-
}>) {
|
|
24
|
-
const [uiState] = useUIState();
|
|
25
|
-
const classNames = useStyles(styles);
|
|
26
|
-
const localizeWithPlural = useLocalizer({ plural: true });
|
|
27
|
-
|
|
28
|
-
return uiState !== 'blueprint' && attachments.length ? (
|
|
29
|
-
<div className={cx(classNames['sendbox__attachment'], className)}>
|
|
30
|
-
{localizeWithPlural(attachmentsPluralStringIds, attachments.length)}
|
|
31
|
-
</div>
|
|
32
|
-
) : null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default memo(Attachments);
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
:global(.webchat-fluent) .sendbox__text-area {
|
|
2
|
-
display: grid;
|
|
3
|
-
grid-template-areas: 'main';
|
|
4
|
-
max-height: 200px;
|
|
5
|
-
overflow: auto;
|
|
6
|
-
scrollbar-gutter: stable;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
:global(.webchat-fluent) .sendbox__text-area--hidden {
|
|
10
|
-
/* TODO: Not perfect way of hiding the text box. */
|
|
11
|
-
height: 0;
|
|
12
|
-
visibility: collapse;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
:global(.webchat-fluent) .sendbox__text-area--in-completion {
|
|
16
|
-
.sendbox__text-area-doppelganger {
|
|
17
|
-
visibility: unset;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.sendbox__text-area-input {
|
|
21
|
-
background-color: transparent;
|
|
22
|
-
caret-color: var(--webchat-colorNeutralForeground1);
|
|
23
|
-
color: transparent;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
textarea::placeholder {
|
|
27
|
-
color: transparent;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
:global(.webchat-fluent) .sendbox__text-area-shared {
|
|
32
|
-
border: none;
|
|
33
|
-
font: inherit;
|
|
34
|
-
grid-area: main;
|
|
35
|
-
outline: inherit;
|
|
36
|
-
overflow-wrap: anywhere;
|
|
37
|
-
resize: inherit;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:global(.webchat-fluent) .sendbox__text-area-doppelganger {
|
|
41
|
-
overflow: visible;
|
|
42
|
-
pointer-events: none;
|
|
43
|
-
user-select: none;
|
|
44
|
-
visibility: hidden;
|
|
45
|
-
white-space: pre-wrap;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:global(.webchat-fluent) .sendbox__text-area-input {
|
|
49
|
-
background-color: inherit;
|
|
50
|
-
color: currentColor;
|
|
51
|
-
contain: size;
|
|
52
|
-
overflow: hidden;
|
|
53
|
-
padding: 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
:global(.webchat-fluent) .sendbox__text-area--scroll {
|
|
57
|
-
/* Edge uses -webkit-scrollbar if scrollbar-* is not set */
|
|
58
|
-
scrollbar-color: unset;
|
|
59
|
-
scrollbar-width: unset;
|
|
60
|
-
/* Firefox */
|
|
61
|
-
-moz-scrollbar-color: var(--webchat-colorNeutralBackground5) var(--webchat-colorNeutralForeground2);
|
|
62
|
-
-moz-scrollbar-width: thin;
|
|
63
|
-
|
|
64
|
-
/* Chrome, Edge, and Safari */
|
|
65
|
-
&::-webkit-scrollbar {
|
|
66
|
-
width: 8px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&::-webkit-scrollbar-track {
|
|
70
|
-
background-color: var(--webchat-colorNeutralBackground5);
|
|
71
|
-
border-radius: 16px;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&::-webkit-scrollbar-thumb {
|
|
75
|
-
background-color: var(--webchat-colorNeutralForeground2);
|
|
76
|
-
border-radius: 16px;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&::-webkit-scrollbar-corner {
|
|
80
|
-
background-color: var(--webchat-colorNeutralBackground5);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { hooks } from 'botframework-webchat-api';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import React, {
|
|
4
|
-
forwardRef,
|
|
5
|
-
Fragment,
|
|
6
|
-
useCallback,
|
|
7
|
-
useRef,
|
|
8
|
-
type FormEventHandler,
|
|
9
|
-
type KeyboardEventHandler,
|
|
10
|
-
type ReactNode
|
|
11
|
-
} from 'react';
|
|
12
|
-
import { useStyles } from '../../styles';
|
|
13
|
-
import styles from './TextArea.module.css';
|
|
14
|
-
|
|
15
|
-
const { useUIState } = hooks;
|
|
16
|
-
|
|
17
|
-
const TextArea = forwardRef<
|
|
18
|
-
HTMLTextAreaElement,
|
|
19
|
-
Readonly<{
|
|
20
|
-
'aria-label'?: string | undefined;
|
|
21
|
-
className?: string | undefined;
|
|
22
|
-
completion?: ReactNode | undefined;
|
|
23
|
-
'data-testid'?: string | undefined;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* `true`, if the text area should be hidden but stay in the DOM, otherwise, `false`.
|
|
27
|
-
*
|
|
28
|
-
* Keeping the element in the DOM while making it invisible to users and PWDs is useful in these scenarios:
|
|
29
|
-
*
|
|
30
|
-
* - When the DTMF keypad is going away, we need to send focus to the text area before we unmount DTMF keypad,
|
|
31
|
-
* This ensures the flow of focus did not sent to document body
|
|
32
|
-
*/
|
|
33
|
-
hidden?: boolean | undefined;
|
|
34
|
-
onInput?: FormEventHandler<HTMLTextAreaElement> | undefined;
|
|
35
|
-
placeholder?: string | undefined;
|
|
36
|
-
startRows?: number | undefined;
|
|
37
|
-
value?: string | undefined;
|
|
38
|
-
}>
|
|
39
|
-
>((props, ref) => {
|
|
40
|
-
const [uiState] = useUIState();
|
|
41
|
-
const classNames = useStyles(styles);
|
|
42
|
-
const isInCompositionRef = useRef<boolean>(false);
|
|
43
|
-
|
|
44
|
-
const disabled = uiState === 'disabled';
|
|
45
|
-
|
|
46
|
-
const handleCompositionEnd = useCallback(() => {
|
|
47
|
-
isInCompositionRef.current = false;
|
|
48
|
-
}, [isInCompositionRef]);
|
|
49
|
-
|
|
50
|
-
const handleCompositionStart = useCallback(() => {
|
|
51
|
-
isInCompositionRef.current = true;
|
|
52
|
-
}, [isInCompositionRef]);
|
|
53
|
-
|
|
54
|
-
const handleKeyDown = useCallback<KeyboardEventHandler<HTMLTextAreaElement>>(event => {
|
|
55
|
-
// Shift+Enter adds a new line
|
|
56
|
-
// Enter requests related form submission
|
|
57
|
-
if (!event.shiftKey && event.key === 'Enter' && !isInCompositionRef.current) {
|
|
58
|
-
event.preventDefault();
|
|
59
|
-
|
|
60
|
-
if ('form' in event.target && event.target.form instanceof HTMLFormElement) {
|
|
61
|
-
event.target?.form?.requestSubmit();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}, []);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<div
|
|
68
|
-
className={cx(
|
|
69
|
-
classNames['sendbox__text-area'],
|
|
70
|
-
classNames['sendbox__text-area--scroll'],
|
|
71
|
-
{ [classNames['sendbox__text-area--hidden']]: props.hidden },
|
|
72
|
-
{ [classNames['sendbox__text-area--in-completion']]: props.completion },
|
|
73
|
-
props.className
|
|
74
|
-
)}
|
|
75
|
-
role={props.hidden ? 'hidden' : undefined}
|
|
76
|
-
>
|
|
77
|
-
{uiState === 'blueprint' ? (
|
|
78
|
-
<div className={cx(classNames['sendbox__text-area-doppelganger'], classNames['sendbox__text-area-shared'])}>
|
|
79
|
-
{' '}
|
|
80
|
-
</div>
|
|
81
|
-
) : (
|
|
82
|
-
<Fragment>
|
|
83
|
-
<div className={cx(classNames['sendbox__text-area-doppelganger'], classNames['sendbox__text-area-shared'])}>
|
|
84
|
-
{props.completion ? props.completion : props.value || props.placeholder}{' '}
|
|
85
|
-
</div>
|
|
86
|
-
<textarea
|
|
87
|
-
aria-disabled={disabled}
|
|
88
|
-
aria-label={props['aria-label']}
|
|
89
|
-
className={cx(classNames['sendbox__text-area-input'], classNames['sendbox__text-area-shared'])}
|
|
90
|
-
data-testid={props['data-testid']}
|
|
91
|
-
onCompositionEnd={handleCompositionEnd}
|
|
92
|
-
onCompositionStart={handleCompositionStart}
|
|
93
|
-
onInput={props.onInput}
|
|
94
|
-
onKeyDown={handleKeyDown}
|
|
95
|
-
placeholder={props.placeholder}
|
|
96
|
-
readOnly={disabled}
|
|
97
|
-
ref={ref}
|
|
98
|
-
rows={props.startRows ?? 1}
|
|
99
|
-
// eslint-disable-next-line no-magic-numbers
|
|
100
|
-
tabIndex={props.hidden ? -1 : undefined}
|
|
101
|
-
value={props.value}
|
|
102
|
-
/>
|
|
103
|
-
</Fragment>
|
|
104
|
-
)}
|
|
105
|
-
</div>
|
|
106
|
-
);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
TextArea.displayName = 'TextArea';
|
|
110
|
-
|
|
111
|
-
export default TextArea;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Components } from 'botframework-webchat-component';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import React, { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
const { MonochromeImageMasker } = Components;
|
|
6
|
-
|
|
7
|
-
const addDocumentIcon = `data:image/svg+xml;utf8,${encodeURIComponent('<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path 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"/></svg>')}`;
|
|
8
|
-
|
|
9
|
-
function AddDocumentIcon(props: Readonly<{ className?: string }>) {
|
|
10
|
-
return <MonochromeImageMasker className={cx('icon__add-document', props.className)} src={addDocumentIcon} />;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default memo(AddDocumentIcon);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Components } from 'botframework-webchat-component';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import React, { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
const { MonochromeImageMasker } = Components;
|
|
6
|
-
|
|
7
|
-
const attachmentIcon = `data:image/svg+xml;utf8,${encodeURIComponent('<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path 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"/></svg>')}`;
|
|
8
|
-
|
|
9
|
-
function AttachmentIcon(props: Readonly<{ className?: string }>) {
|
|
10
|
-
return <MonochromeImageMasker className={cx('icon__attachment', props.className)} src={attachmentIcon} />;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default memo(AttachmentIcon);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Components } from 'botframework-webchat-component';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import React, { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
const { MonochromeImageMasker } = Components;
|
|
6
|
-
|
|
7
|
-
const infoSmallIcon = `data:image/svg+xml;utf8,${encodeURIComponent('<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8.5 7.5a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3Zm.25-2a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1ZM2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Z"/></svg>')}`;
|
|
8
|
-
|
|
9
|
-
function InfoSmallIcon(props: Readonly<{ readonly className?: string }>) {
|
|
10
|
-
return <MonochromeImageMasker className={cx('icon__info--small', props.className)} src={infoSmallIcon} />;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default memo(InfoSmallIcon);
|
package/src/icons/SendIcon.tsx
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Components } from 'botframework-webchat-component';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import React, { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
const { MonochromeImageMasker } = Components;
|
|
6
|
-
|
|
7
|
-
const sendIcon = `data:image/svg+xml;utf8,${encodeURIComponent('<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path 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"/></svg>')}`;
|
|
8
|
-
|
|
9
|
-
function SendIcon(props: Readonly<{ readonly className?: string }>) {
|
|
10
|
-
return <MonochromeImageMasker className={cx('icon__send', props.className)} src={sendIcon} />;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default memo(SendIcon);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Components } from 'botframework-webchat-component';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import React, { memo } from 'react';
|
|
4
|
-
|
|
5
|
-
const { MonochromeImageMasker } = Components;
|
|
6
|
-
|
|
7
|
-
const telephoneKeypadIcon = `data:image/svg+xml;utf8,${encodeURIComponent('<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path 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"/></svg>')}`;
|
|
8
|
-
|
|
9
|
-
function TelephoneKeypadIcon(props: Readonly<{ readonly className?: string }>) {
|
|
10
|
-
return <MonochromeImageMasker className={cx('icon__telephone-keypad', props.className)} src={telephoneKeypadIcon} />;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default memo(TelephoneKeypadIcon);
|
package/src/icons/index.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { default as AddDocumentIcon } from './AddDocumentIcon';
|
|
2
|
-
export { default as AttachmentIcon } from './AttachmentIcon';
|
|
3
|
-
export { default as InfoSmallIcon } from './InfoSmallIcon';
|
|
4
|
-
export { default as SendIcon } from './SendIcon';
|
|
5
|
-
export { default as TelephoneKeypadIcon } from './TelephoneKeypadIcon';
|