botframework-webchat-fluent-theme 4.17.0-main.20240416.4ff01ae → 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/botframework-webchat-fluent-theme.development.js +2065 -357
- package/dist/botframework-webchat-fluent-theme.development.js.map +1 -1
- package/dist/botframework-webchat-fluent-theme.production.min.js +3 -1
- package/dist/botframework-webchat-fluent-theme.production.min.js.map +1 -1
- package/dist/index.js +632 -333
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +516 -217
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
- package/src/components/Theme.tsx +65 -4
- package/src/components/dropZone/index.tsx +31 -6
- package/src/components/sendbox/AddAttachmentButton.tsx +17 -5
- package/src/components/sendbox/Attachments.tsx +12 -3
- package/src/components/sendbox/ErrorMessage.tsx +13 -2
- package/src/components/sendbox/TelephoneKeypadToolbarButton.tsx +1 -1
- package/src/components/sendbox/TextArea.tsx +70 -9
- package/src/components/sendbox/Toolbar.tsx +55 -4
- package/src/components/sendbox/index.tsx +69 -9
- package/src/components/suggestedActions/SuggestedAction.tsx +43 -3
- package/src/components/suggestedActions/index.tsx +29 -6
- package/src/components/telephoneKeypad/private/Button.tsx +67 -5
- package/src/components/telephoneKeypad/private/TelephoneKeypad.tsx +35 -4
- package/src/index.ts +0 -3
- package/src/private/useStyleToEmotionObject.ts +32 -0
- package/src/styles/index.ts +15 -0
- package/src/tsconfig.json +1 -2
- package/dist/botframework-webchat-fluent-theme.development.css.map +0 -1
- package/dist/botframework-webchat-fluent-theme.production.min.css.map +0 -1
- package/dist/index.css.map +0 -1
- package/src/components/Theme.module.css +0 -60
- package/src/components/dropZone/index.module.css +0 -23
- package/src/components/sendbox/AddAttachmentButton.module.css +0 -10
- package/src/components/sendbox/Attachments.module.css +0 -7
- package/src/components/sendbox/ErrorMessage.module.css +0 -9
- package/src/components/sendbox/TextArea.module.css +0 -61
- package/src/components/sendbox/Toolbar.module.css +0 -49
- package/src/components/sendbox/index.module.css +0 -58
- package/src/components/suggestedActions/SuggestedAction.module.css +0 -34
- package/src/components/suggestedActions/index.module.css +0 -23
- package/src/components/telephoneKeypad/private/Button.module.css +0 -62
- package/src/components/telephoneKeypad/private/TelephoneKeypad.module.css +0 -30
- package/src/env.d.ts +0 -7
- package/src/styles/injectStyle.ts +0 -9
- package/src/styles/useStyles.ts +0 -19
- package/src/styles.ts +0 -4
package/dist/index.mjs
CHANGED
|
@@ -41,69 +41,119 @@ import React4, { memo as memo4 } from "react";
|
|
|
41
41
|
import React3, { memo as memo3, useCallback as useCallback2, useEffect, useRef } from "react";
|
|
42
42
|
import { useRefFrom as useRefFrom2 } from "use-ref-from";
|
|
43
43
|
|
|
44
|
-
// src/
|
|
45
|
-
import
|
|
46
|
-
import { useRefFrom } from "use-ref-from";
|
|
44
|
+
// src/styles/index.ts
|
|
45
|
+
import { useMemo as useMemo3 } from "react";
|
|
47
46
|
|
|
48
|
-
// src/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var injectedStyles = "/* src/components/telephoneKeypad/private/Button.module.css */\n.webchat-fluent .Button_telephone-keypad__button {\n -webkit-user-select: none;\n align-items: center;\n appearance: none;\n background-color: White;\n border-radius: 100%;\n border: solid 1px var(--webchat-colorNeutralStroke1);\n color: var(--webchat-colorGray200);\n font-weight: var(--webchat-fontWeightSemibold);\n cursor: pointer;\n display: flex;\n flex-direction: column;\n height: 60px;\n opacity: 0.7;\n padding: 0;\n position: relative;\n touch-action: none;\n user-select: none;\n width: 60px;\n}\n.webchat-fluent .Button_telephone-keypad__button:hover {\n background-color: var(--webchat-colorGray30);\n}\n.webchat-fluent .Button_telephone-keypad__button__ruby {\n color: var(--webchat-colorGray190);\n font-size: 10px;\n}\n.webchat-fluent .Button_telephone-keypad__button__text {\n font-size: 24px;\n margin-top: 8px;\n}\n.webchat-fluent .Button_telephone-keypad--horizontal .Button_telephone-keypad__button {\n height: 32px;\n justify-content: center;\n margin: 8px 4px;\n width: 32px;\n}\n.webchat-fluent .Button_telephone-keypad--horizontal .Button_telephone-keypad__button__ruby {\n display: none;\n}\n.webchat-fluent .Button_telephone-keypad--horizontal .Button_telephone-keypad__button__text {\n font-size: 20px;\n margin-top: 0;\n}\n\n/* src/components/telephoneKeypad/private/TelephoneKeypad.module.css */\n.webchat-fluent .TelephoneKeypad_telephone-keypad {\n align-items: center;\n background: var(--webchat-colorNeutralBackground1);\n border: none;\n border-radius: var(--webchat-borderRadiusXLarge);\n display: flex;\n flex-direction: column;\n font-family: var(--webchat-fontFamilyBase);\n justify-content: center;\n}\n.webchat-fluent .TelephoneKeypad_telephone-keypad__box {\n box-sizing: border-box;\n display: grid;\n gap: 16px;\n grid-template-columns: repeat(3, 1fr);\n grid-template-rows: repeat(4, 1fr);\n justify-items: center;\n padding: 16px;\n width: 100%;\n}\n\n/* src/components/Theme.module.css */\n.webchat-fluent.Theme_theme {\n display: contents;\n --webchat-colorNeutralForeground1: var(--colorNeutralForeground1, #242424);\n --webchat-colorNeutralForeground2: var(--colorNeutralForeground2, #424242);\n --webchat-colorNeutralForeground4: var(--colorNeutralForeground4, #707070);\n --webchat-colorNeutralForegroundDisabled: var(--colorNeutralForegroundDisabled, #bdbdbd);\n --webchat-colorNeutralBackground1: var(--colorNeutralBackground1, #ffffff);\n --webchat-colorNeutralBackground4: var(--colorNeutralBackground4, #f0f0f0);\n --webchat-colorNeutralBackground5: var(--colorNeutralBackground5, #ebebeb);\n --webchat-colorSubtleBackgroundHover: var(--colorSubtleBackgroundHover, #f5f5f5);\n --webchat-colorSubtleBackgroundPressed: var(--colorSubtleBackgroundPressed, #e0e0e0);\n --webchat-colorNeutralStroke1: var(--colorNeutralStroke1, #d1d1d1);\n --webchat-colorNeutralStroke2: var(--colorNeutralStroke2, #e0e0e0);\n --webchat-colorNeutralStroke1Selected: var(--colorNeutralStroke1Selected, #bdbdbd);\n --webchat-colorBrandStroke2: var(--colorBrandStroke2, #9edcf7);\n --webchat-colorBrandForeground2Hover: var(--colorBrandForeground2Hover, #015a7a);\n --webchat-colorBrandForeground2Pressed: var(--colorBrandForeground2Pressed, #01384d);\n --webchat-colorBrandBackground2Hover: var(--colorBrandBackground2Hover, #bee7fa);\n --webchat-colorBrandBackground2Pressed: var(--colorBrandBackground2Pressed, #7fd2f5);\n --webchat-colorCompoundBrandForeground1: var(--colorCompoundBrandForeground1, #077fab);\n --webchat-colorCompoundBrandForeground1Hover: var(--colorCompoundBrandForeground1Hover, #02729c);\n --webchat-colorCompoundBrandForeground1Pressed: var(--colorCompoundBrandForeground1Pressed, #01678c);\n --webchat-colorStatusDangerForeground1: var(--colorStatusDangerForeground1, #b10e1c);\n --webchat-colorGray30: var(--colorGray30, #edebe9);\n --webchat-colorGray160: var(--colorGray160, #323130);\n --webchat-colorGray190: var(--colorGray190, #201f1e);\n --webchat-colorGray200: var(--colorGray200, #1b1a19);\n --webchat-borderRadiusSmall: var(--borderRadiusSmall, 2px);\n --webchat-borderRadiusLarge: var(--borderRadiusLarge, 6px);\n --webchat-borderRadiusXLarge: var(--borderRadiusXLarge, 8px);\n --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));\n --webchat-spacingHorizontalMNudge: var(--spacingHorizontalMNudge, 10px);\n --webchat-fontFamilyBase: var(--fontFamilyBase, \"Segoe UI\", \"Segoe UI Web (West European)\", -apple-system, BlinkMacSystemFont, Roboto, \"Helvetica Neue\", sans-serif);\n --webchat-fontFamilyNumeric: var(--fontFamilyNumeric, Bahnschrift, \"Segoe UI\", \"Segoe UI Web (West European)\", -apple-system, BlinkMacSystemFont, Roboto, \"Helvetica Neue\", sans-serif);\n --webchat-fontWeightSemibold: var(--fontWeightSemibold, 600);\n}\n\n/* src/components/dropZone/index.module.css */\n.webchat-fluent .dropZone_sendbox__attachment-drop-zone {\n background-color: var(--webchat-colorNeutralBackground4);\n border-radius: inherit;\n cursor: copy;\n display: grid;\n gap: 8px;\n inset: 0;\n place-content: center;\n place-items: center;\n position: absolute;\n}\n.webchat-fluent .dropZone_sendbox__attachment-drop-zone--droppable {\n background-color: #e00;\n color: White;\n}\n.webchat-fluent .dropZone_sendbox__attachment-drop-zone-icon {\n height: 36px;\n pointer-events: none;\n width: 36px;\n}\n\n/* src/components/suggestedActions/SuggestedAction.module.css */\n.webchat-fluent .SuggestedAction_suggested-action {\n align-items: center;\n background: transparent;\n border-radius: 8px;\n border: 1px solid var(--webchat-colorBrandStroke2);\n cursor: pointer;\n display: flex;\n font-size: 12px;\n gap: 4px;\n padding: 4px 8px 4px;\n text-align: start;\n transition: all .15s ease-out;\n}\n@media (hover: hover) {\n .webchat-fluent .SuggestedAction_suggested-action:not([aria-disabled=true]):hover {\n background-color: var(--webchat-colorBrandBackground2Hover);\n color: var(--webchat-colorBrandForeground2Hover);\n }\n}\n.webchat-fluent .SuggestedAction_suggested-action:not([aria-disabled=true]):active {\n background-color: var(--webchat-colorBrandBackground2Pressed);\n color: var(--webchat-colorBrandForeground2Pressed);\n}\n.webchat-fluent .SuggestedAction_suggested-action[aria-disabled=true] {\n color: var(--webchat-colorNeutralForegroundDisabled);\n cursor: not-allowed;\n}\n.webchat-fluent .SuggestedAction_suggested-action__image {\n font-size: 12px;\n height: 1em;\n width: 1em;\n}\n\n/* src/components/suggestedActions/index.module.css */\n.webchat-fluent .suggestedActions_suggested-actions {\n align-items: flex-end;\n align-self: flex-end;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.webchat-fluent .suggestedActions_suggested-actions:not(:empty) {\n padding-block-end: 8px;\n padding-inline-start: 4px;\n}\n.webchat-fluent .suggestedActions_suggested-actions.suggestedActions_suggested-actions--flow {\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-end;\n}\n.webchat-fluent .suggestedActions_suggested-actions.suggestedActions_suggested-actions--stacked {\n flex-direction: column;\n}\n\n/* src/components/sendbox/Toolbar.module.css */\n.webchat-fluent .Toolbar_sendbox__toolbar {\n display: flex;\n gap: 4px;\n margin-inline-start: auto;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button {\n align-items: center;\n appearance: none;\n aspect-ratio: 1;\n background: transparent;\n border-radius: var(--webchat-borderRadiusSmall);\n border: none;\n cursor: pointer;\n display: flex;\n justify-content: center;\n padding: 3px;\n width: 32px;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button > svg {\n font-size: 20px;\n pointer-events: none;\n}\n@media (hover: hover) {\n .webchat-fluent .Toolbar_sendbox__toolbar-button:not([aria-disabled=true]):hover {\n background-color: var(--webchat-colorSubtleBackgroundHover);\n color: var(--webchat-colorCompoundBrandForeground1Hover);\n }\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button:not([aria-disabled=true]):active {\n background-color: var(--webchat-colorSubtleBackgroundPressed);\n color: var(--webchat-colorCompoundBrandForeground1Pressed);\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-button[aria-disabled=true] {\n color: var(--webchat-colorNeutralForegroundDisabled);\n cursor: not-allowed;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-separator {\n align-self: center;\n border-inline-end: 1px solid var(--webchat-colorNeutralStroke2);\n height: 28px;\n}\n.webchat-fluent .Toolbar_sendbox__toolbar-separator:is(:first-child, :last-child, :only-child) {\n display: none;\n}\n\n/* src/components/sendbox/AddAttachmentButton.module.css */\n.webchat-fluent .AddAttachmentButton_sendbox__add-attachment {\n display: grid;\n}\n.webchat-fluent .AddAttachmentButton_sendbox__add-attachment-input {\n font-size: 0;\n height: 0;\n opacity: 0;\n width: 0;\n}\n\n/* src/components/sendbox/Attachments.module.css */\n.webchat-fluent .Attachments_sendbox__attachment {\n border-radius: var(--webchat-borderRadiusLarge);\n border: 1px solid var(--webchat-colorNeutralStroke1);\n cursor: default;\n padding: 6px 8px;\n width: fit-content;\n}\n\n/* src/components/sendbox/ErrorMessage.module.css */\n.webchat-fluent .ErrorMessage_sendbox__error-message {\n color: transparent;\n font-size: 0;\n height: 0;\n left: 0;\n position: absolute;\n top: 0;\n width: 0;\n}\n\n/* src/components/sendbox/TextArea.module.css */\n.webchat-fluent .TextArea_sendbox__text-area {\n display: grid;\n grid-template-areas: \"main\";\n max-height: 200px;\n overflow: hidden;\n}\n.webchat-fluent .TextArea_sendbox__text-area--hidden {\n height: 0;\n visibility: collapse;\n}\n.webchat-fluent .TextArea_sendbox__text-area-shared {\n border: none;\n font: inherit;\n grid-area: main;\n outline: inherit;\n overflow-wrap: anywhere;\n resize: inherit;\n scrollbar-gutter: stable;\n}\n.webchat-fluent .TextArea_sendbox__text-area-doppelganger {\n overflow: hidden;\n visibility: hidden;\n white-space: pre-wrap;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input {\n height: 100%;\n padding: 0;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll {\n scrollbar-color: unset;\n scrollbar-width: unset;\n -moz-scrollbar-color: var(--webchat-colorNeutralBackground5) var(--webchat-colorNeutralForeground2);\n -moz-scrollbar-width: thin;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar {\n width: 8px;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar-track {\n background-color: var(--webchat-colorNeutralBackground5);\n border-radius: 16px;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar-thumb {\n background-color: var(--webchat-colorNeutralForeground2);\n border-radius: 16px;\n}\n.webchat-fluent .TextArea_sendbox__text-area-input--scroll::-webkit-scrollbar-corner {\n background-color: var(--webchat-colorNeutralBackground5);\n}\n\n/* src/components/sendbox/index.module.css */\n.webchat-fluent .sendbox_sendbox {\n color: var(--webchat-colorNeutralForeground1);\n font-family: var(--webchat-fontFamilyBase);\n padding: 0 10px 10px;\n text-rendering: optimizeLegibility;\n}\n.webchat-fluent .sendbox_sendbox__sendbox {\n background-color: var(--webchat-colorNeutralBackground1);\n border-radius: var(--webchat-borderRadiusLarge);\n border: 1px solid var(--webchat-colorNeutralStroke1);\n display: grid;\n font-family: var(--webchat-fontFamilyBase);\n font-size: 14px;\n gap: 6px;\n line-height: 20px;\n padding: 8px;\n position: relative;\n}\n.webchat-fluent .sendbox_sendbox__sendbox:focus-within {\n border-color: var(--webchat-colorNeutralStroke1Selected);\n box-shadow: inset 0 -6px 0 -3px var(--webchat-colorCompoundBrandForeground1Hover);\n}\n.webchat-fluent .sendbox_sendbox__sendbox-text {\n background-color: transparent;\n border: none;\n flex: auto;\n font-family: var(--webchat-fontFamilyBase);\n font-size: 14px;\n line-height: 20px;\n outline: none;\n padding: 4px 4px 0;\n resize: none;\n}\n.webchat-fluent .sendbox_sendbox__sendbox-controls {\n align-items: center;\n display: flex;\n padding-inline-start: 4px;\n}\n.webchat-fluent .sendbox_sendbox__text-counter {\n color: var(--webchat-colorNeutralForeground4);\n cursor: default;\n font-family: var(--webchat-fontFamilyNumeric);\n font-size: 10px;\n line-height: 14px;\n}\n.webchat-fluent .sendbox_sendbox__text-counter--error {\n color: var(--webchat-colorStatusDangerForeground1);\n}\n";
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
64
|
}
|
|
65
65
|
|
|
66
|
-
// src/styles/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return
|
|
66
|
+
// src/styles/index.ts
|
|
67
|
+
function useStyles(styles13) {
|
|
68
|
+
const getClassName = useStyleToEmotionObject();
|
|
69
|
+
return useMemo3(
|
|
70
70
|
() => Object.freeze(
|
|
71
|
-
Object.fromEntries(
|
|
72
|
-
Object.entries(styles).map(([baseClassName, resultClassName]) => [
|
|
73
|
-
baseClassName,
|
|
74
|
-
`${baseClassName} ${resultClassName}`
|
|
75
|
-
])
|
|
76
|
-
)
|
|
71
|
+
Object.fromEntries(Object.entries(styles13).map(([cls, style]) => [cls, `${cls} ${getClassName(style)}`]))
|
|
77
72
|
),
|
|
78
|
-
[
|
|
73
|
+
[styles13, getClassName]
|
|
79
74
|
);
|
|
80
75
|
}
|
|
81
|
-
var useStyles_default = useStyles;
|
|
82
76
|
|
|
83
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
|
+
};
|
|
84
134
|
var Button = memo2(
|
|
85
135
|
// As we are all TypeScript, internal components do not need propTypes.
|
|
86
136
|
// eslint-disable-next-line react/prop-types
|
|
87
137
|
forwardRef(({ button, "data-testid": dataTestId, onClick, ruby }, ref) => {
|
|
88
|
-
const classNames =
|
|
138
|
+
const classNames = useStyles(styles);
|
|
89
139
|
const onClickRef = useRefFrom(onClick);
|
|
90
140
|
const handleClick = useCallback(() => onClickRef.current?.(), [onClickRef]);
|
|
91
141
|
return /* @__PURE__ */ React2.createElement(
|
|
92
142
|
"button",
|
|
93
143
|
{
|
|
94
|
-
className: classNames["
|
|
144
|
+
className: classNames["webchat__telephone-keypad__button"],
|
|
95
145
|
"data-testid": dataTestId,
|
|
96
146
|
onClick: handleClick,
|
|
97
147
|
ref,
|
|
98
148
|
type: "button"
|
|
99
149
|
},
|
|
100
|
-
/* @__PURE__ */ React2.createElement("span", { className: classNames["
|
|
101
|
-
!!ruby && /* @__PURE__ */ React2.createElement("ruby", { className: classNames["
|
|
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)
|
|
102
152
|
);
|
|
103
153
|
})
|
|
104
154
|
);
|
|
105
155
|
Button.displayName = "TelephoneKeypad.Button";
|
|
106
|
-
var
|
|
156
|
+
var Button_default = Button;
|
|
107
157
|
|
|
108
158
|
// src/testIds.ts
|
|
109
159
|
var testIds = {
|
|
@@ -128,32 +178,55 @@ var testIds = {
|
|
|
128
178
|
var testIds_default = testIds;
|
|
129
179
|
|
|
130
180
|
// src/components/telephoneKeypad/useShown.ts
|
|
131
|
-
import { useContext, useMemo as
|
|
181
|
+
import { useContext, useMemo as useMemo4 } from "react";
|
|
132
182
|
function useShown() {
|
|
133
183
|
const { setShown, shown } = useContext(Context_default);
|
|
134
|
-
return
|
|
184
|
+
return useMemo4(() => Object.freeze([shown, setShown]), [shown, setShown]);
|
|
135
185
|
}
|
|
136
186
|
|
|
137
|
-
// src/components/telephoneKeypad/private/TelephoneKeypad.module.css
|
|
138
|
-
var TelephoneKeypad_default = {
|
|
139
|
-
"telephone-keypad": "TelephoneKeypad_telephone-keypad",
|
|
140
|
-
"telephone-keypad__box": "TelephoneKeypad_telephone-keypad__box"
|
|
141
|
-
};
|
|
142
|
-
|
|
143
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
|
+
};
|
|
144
217
|
var Orientation = memo3(
|
|
145
218
|
({ children, isHorizontal }) => {
|
|
146
|
-
const classNames =
|
|
219
|
+
const classNames = useStyles(styles2);
|
|
147
220
|
return isHorizontal ? (
|
|
148
221
|
// <HorizontalDialPadController>{children}</HorizontalDialPadController>
|
|
149
222
|
false
|
|
150
|
-
) : /* @__PURE__ */ React3.createElement("div", { className: classNames["
|
|
223
|
+
) : /* @__PURE__ */ React3.createElement("div", { className: classNames["webchat__telephone-keypad__box"] }, children);
|
|
151
224
|
}
|
|
152
225
|
);
|
|
153
226
|
Orientation.displayName = "TelephoneKeypad:Orientation";
|
|
154
227
|
var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
155
228
|
const autoFocusRef = useRefFrom2(autoFocus);
|
|
156
|
-
const classNames =
|
|
229
|
+
const classNames = useStyles(styles2);
|
|
157
230
|
const firstButtonRef = useRef(null);
|
|
158
231
|
const onButtonClickRef = useRefFrom2(onButtonClick);
|
|
159
232
|
const [, setShown] = useShown();
|
|
@@ -180,8 +253,8 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
180
253
|
useEffect(() => {
|
|
181
254
|
autoFocusRef.current && firstButtonRef.current?.focus();
|
|
182
255
|
}, [autoFocusRef, firstButtonRef]);
|
|
183
|
-
return /* @__PURE__ */ React3.createElement("div", { className: classNames["
|
|
184
|
-
|
|
256
|
+
return /* @__PURE__ */ React3.createElement("div", { className: classNames["webchat__telephone-keypad"], onKeyDown: handleKeyDown }, /* @__PURE__ */ React3.createElement(Orientation, { isHorizontal }, /* @__PURE__ */ React3.createElement(
|
|
257
|
+
Button_default,
|
|
185
258
|
{
|
|
186
259
|
button: "1",
|
|
187
260
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton1,
|
|
@@ -189,7 +262,7 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
189
262
|
ref: firstButtonRef
|
|
190
263
|
}
|
|
191
264
|
), /* @__PURE__ */ React3.createElement(
|
|
192
|
-
|
|
265
|
+
Button_default,
|
|
193
266
|
{
|
|
194
267
|
button: "2",
|
|
195
268
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton2,
|
|
@@ -197,7 +270,7 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
197
270
|
ruby: "ABC"
|
|
198
271
|
}
|
|
199
272
|
), /* @__PURE__ */ React3.createElement(
|
|
200
|
-
|
|
273
|
+
Button_default,
|
|
201
274
|
{
|
|
202
275
|
button: "3",
|
|
203
276
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton3,
|
|
@@ -205,7 +278,7 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
205
278
|
ruby: "DEF"
|
|
206
279
|
}
|
|
207
280
|
), /* @__PURE__ */ React3.createElement(
|
|
208
|
-
|
|
281
|
+
Button_default,
|
|
209
282
|
{
|
|
210
283
|
button: "4",
|
|
211
284
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton4,
|
|
@@ -213,7 +286,7 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
213
286
|
ruby: "GHI"
|
|
214
287
|
}
|
|
215
288
|
), /* @__PURE__ */ React3.createElement(
|
|
216
|
-
|
|
289
|
+
Button_default,
|
|
217
290
|
{
|
|
218
291
|
button: "5",
|
|
219
292
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton5,
|
|
@@ -221,7 +294,7 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
221
294
|
ruby: "JKL"
|
|
222
295
|
}
|
|
223
296
|
), /* @__PURE__ */ React3.createElement(
|
|
224
|
-
|
|
297
|
+
Button_default,
|
|
225
298
|
{
|
|
226
299
|
button: "6",
|
|
227
300
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton6,
|
|
@@ -229,7 +302,7 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
229
302
|
ruby: "MNO"
|
|
230
303
|
}
|
|
231
304
|
), /* @__PURE__ */ React3.createElement(
|
|
232
|
-
|
|
305
|
+
Button_default,
|
|
233
306
|
{
|
|
234
307
|
button: "7",
|
|
235
308
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton7,
|
|
@@ -237,7 +310,7 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
237
310
|
ruby: "PQRS"
|
|
238
311
|
}
|
|
239
312
|
), /* @__PURE__ */ React3.createElement(
|
|
240
|
-
|
|
313
|
+
Button_default,
|
|
241
314
|
{
|
|
242
315
|
button: "8",
|
|
243
316
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton8,
|
|
@@ -245,15 +318,15 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
245
318
|
ruby: "TUV"
|
|
246
319
|
}
|
|
247
320
|
), /* @__PURE__ */ React3.createElement(
|
|
248
|
-
|
|
321
|
+
Button_default,
|
|
249
322
|
{
|
|
250
323
|
button: "9",
|
|
251
324
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButton9,
|
|
252
325
|
onClick: handleButton9Click,
|
|
253
326
|
ruby: "WXYZ"
|
|
254
327
|
}
|
|
255
|
-
), /* @__PURE__ */ React3.createElement(
|
|
256
|
-
|
|
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,
|
|
257
330
|
{
|
|
258
331
|
button: "pound",
|
|
259
332
|
"data-testid": testIds_default.sendBoxTelephoneKeypadButtonPound,
|
|
@@ -262,32 +335,69 @@ var TelephoneKeypad = memo3(({ autoFocus, onButtonClick, isHorizontal }) => {
|
|
|
262
335
|
)));
|
|
263
336
|
});
|
|
264
337
|
TelephoneKeypad.displayName = "TelephoneKeypad";
|
|
265
|
-
var
|
|
338
|
+
var TelephoneKeypad_default = TelephoneKeypad;
|
|
266
339
|
|
|
267
340
|
// src/components/telephoneKeypad/Surrogate.tsx
|
|
268
|
-
var TelephoneKeypadSurrogate = memo4((props) => useShown()[0] ? /* @__PURE__ */ React4.createElement(
|
|
341
|
+
var TelephoneKeypadSurrogate = memo4((props) => useShown()[0] ? /* @__PURE__ */ React4.createElement(TelephoneKeypad_default, { ...props }) : false);
|
|
269
342
|
TelephoneKeypadSurrogate.displayName = "TelephoneKeypad.Surrogate";
|
|
270
343
|
var Surrogate_default = TelephoneKeypadSurrogate;
|
|
271
344
|
|
|
272
345
|
// src/components/Theme.tsx
|
|
273
346
|
import React5 from "react";
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
var
|
|
278
|
-
|
|
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
|
+
}
|
|
279
392
|
};
|
|
280
|
-
|
|
281
|
-
// src/components/Theme.tsx
|
|
282
|
-
var rootClassName = "webchat-fluent";
|
|
283
393
|
function WebchatTheme(props) {
|
|
284
|
-
const classNames =
|
|
285
|
-
return /* @__PURE__ */ React5.createElement("div", { className:
|
|
394
|
+
const classNames = useStyles(styles3);
|
|
395
|
+
return /* @__PURE__ */ React5.createElement("div", { className: classNames["webchat-fluent__theme"] }, props.children);
|
|
286
396
|
}
|
|
287
397
|
|
|
288
398
|
// src/components/sendbox/index.tsx
|
|
289
399
|
import { hooks as hooks8 } from "botframework-webchat-component";
|
|
290
|
-
import
|
|
400
|
+
import cx6 from "classnames";
|
|
291
401
|
import React20, { memo as memo14, useCallback as useCallback8, useRef as useRef6, useState as useState3 } from "react";
|
|
292
402
|
import { useRefFrom as useRefFrom6 } from "use-ref-from";
|
|
293
403
|
|
|
@@ -316,8 +426,8 @@ function SendIcon(props) {
|
|
|
316
426
|
}
|
|
317
427
|
|
|
318
428
|
// src/components/dropZone/index.tsx
|
|
319
|
-
import { hooks } from "botframework-webchat-
|
|
320
|
-
import
|
|
429
|
+
import { hooks } from "botframework-webchat-api";
|
|
430
|
+
import cx from "classnames";
|
|
321
431
|
import React8, { memo as memo5, useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
322
432
|
import { useRefFrom as useRefFrom3 } from "use-ref-from";
|
|
323
433
|
|
|
@@ -345,15 +455,31 @@ function AddDocumentIcon(props) {
|
|
|
345
455
|
);
|
|
346
456
|
}
|
|
347
457
|
|
|
348
|
-
// src/components/dropZone/index.module.css
|
|
349
|
-
var dropZone_default = {
|
|
350
|
-
"sendbox__attachment-drop-zone": "dropZone_sendbox__attachment-drop-zone",
|
|
351
|
-
"sendbox__attachment-drop-zone--droppable": "dropZone_sendbox__attachment-drop-zone--droppable",
|
|
352
|
-
"sendbox__attachment-drop-zone-icon": "dropZone_sendbox__attachment-drop-zone-icon"
|
|
353
|
-
};
|
|
354
|
-
|
|
355
458
|
// src/components/dropZone/index.tsx
|
|
356
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
|
+
};
|
|
357
483
|
var handleDragOver = (event) => {
|
|
358
484
|
event.preventDefault();
|
|
359
485
|
};
|
|
@@ -370,7 +496,7 @@ function isDescendantOf(target, ancestor) {
|
|
|
370
496
|
}
|
|
371
497
|
var DropZone = (props) => {
|
|
372
498
|
const [dropZoneState, setDropZoneState] = useState2(false);
|
|
373
|
-
const classNames =
|
|
499
|
+
const classNames = useStyles(styles4);
|
|
374
500
|
const dropZoneRef = useRef2(null);
|
|
375
501
|
const localize = useLocalizer();
|
|
376
502
|
const onFilesAddedRef = useRefFrom3(props.onFilesAdded);
|
|
@@ -406,40 +532,34 @@ var DropZone = (props) => {
|
|
|
406
532
|
return dropZoneState ? /* @__PURE__ */ React8.createElement(
|
|
407
533
|
"div",
|
|
408
534
|
{
|
|
409
|
-
className:
|
|
410
|
-
[classNames["
|
|
535
|
+
className: cx(classNames["webchat-fluent__sendbox__attachment-drop-zone"], {
|
|
536
|
+
[classNames["webchat-fluent__sendbox__attachment-drop-zone--droppable"]]: dropZoneState === "droppable"
|
|
411
537
|
}),
|
|
412
538
|
"data-testid": testIds_default.sendBoxDropZone,
|
|
413
539
|
onDragOver: handleDragOver,
|
|
414
540
|
onDrop: handleDrop,
|
|
415
541
|
ref: dropZoneRef
|
|
416
542
|
},
|
|
417
|
-
/* @__PURE__ */ React8.createElement(AddDocumentIcon, { className: classNames["
|
|
543
|
+
/* @__PURE__ */ React8.createElement(AddDocumentIcon, { className: classNames["webchat-fluent__sendbox__attachment-drop-zone-icon"] }),
|
|
418
544
|
localize("TEXT_INPUT_DROP_ZONE")
|
|
419
545
|
) : null;
|
|
420
546
|
};
|
|
421
547
|
DropZone.displayName = "DropZone";
|
|
422
|
-
var
|
|
548
|
+
var dropZone_default = memo5(DropZone);
|
|
423
549
|
|
|
424
550
|
// src/components/DropZone.tsx
|
|
425
|
-
var DropZone_default =
|
|
551
|
+
var DropZone_default = dropZone_default;
|
|
426
552
|
|
|
427
553
|
// src/components/suggestedActions/index.tsx
|
|
428
554
|
import { hooks as hooks3 } from "botframework-webchat-component";
|
|
429
|
-
import
|
|
555
|
+
import cx3 from "classnames";
|
|
430
556
|
import React11, { memo as memo8 } from "react";
|
|
431
557
|
|
|
432
558
|
// src/components/suggestedActions/SuggestedAction.tsx
|
|
433
559
|
import { hooks as hooks2 } from "botframework-webchat-component";
|
|
434
|
-
import
|
|
560
|
+
import cx2 from "classnames";
|
|
435
561
|
import React10, { memo as memo7, useCallback as useCallback4, useRef as useRef4 } from "react";
|
|
436
562
|
|
|
437
|
-
// src/components/suggestedActions/SuggestedAction.module.css
|
|
438
|
-
var SuggestedAction_default = {
|
|
439
|
-
"suggested-action": "SuggestedAction_suggested-action",
|
|
440
|
-
"suggested-action__image": "SuggestedAction_suggested-action__image"
|
|
441
|
-
};
|
|
442
|
-
|
|
443
563
|
// src/components/suggestedActions/AccessibleButton.tsx
|
|
444
564
|
import React9, { forwardRef as forwardRef2, memo as memo6, useRef as useRef3 } from "react";
|
|
445
565
|
var preventDefaultHandler = (event) => event.preventDefault();
|
|
@@ -470,6 +590,38 @@ var AccessibleButton_default = memo6(AccessibleButton);
|
|
|
470
590
|
|
|
471
591
|
// src/components/suggestedActions/SuggestedAction.tsx
|
|
472
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
|
+
};
|
|
473
625
|
function SuggestedAction({
|
|
474
626
|
buttonText,
|
|
475
627
|
className,
|
|
@@ -486,7 +638,7 @@ function SuggestedAction({
|
|
|
486
638
|
const focus = useFocus();
|
|
487
639
|
const focusRef = useRef4(null);
|
|
488
640
|
const performCardAction = usePerformCardAction();
|
|
489
|
-
const classNames =
|
|
641
|
+
const classNames = useStyles(styles5);
|
|
490
642
|
const scrollToEnd = useScrollToEnd();
|
|
491
643
|
const handleClick = useCallback4(
|
|
492
644
|
({ target }) => {
|
|
@@ -502,17 +654,21 @@ function SuggestedAction({
|
|
|
502
654
|
return /* @__PURE__ */ React10.createElement(
|
|
503
655
|
AccessibleButton_default,
|
|
504
656
|
{
|
|
505
|
-
className:
|
|
657
|
+
className: cx2(
|
|
658
|
+
classNames["webchat-fluent__suggested-action"],
|
|
659
|
+
suggestedActionStyleSet + "",
|
|
660
|
+
(className || "") + ""
|
|
661
|
+
),
|
|
506
662
|
disabled,
|
|
507
663
|
onClick: handleClick,
|
|
508
664
|
ref: focusRef,
|
|
509
665
|
type: "button"
|
|
510
666
|
},
|
|
511
|
-
image && /* @__PURE__ */ React10.createElement("img", { alt: imageAlt, className: classNames["
|
|
667
|
+
image && /* @__PURE__ */ React10.createElement("img", { alt: imageAlt, className: classNames["webchat-fluent__suggested-action__image"], src: image }),
|
|
512
668
|
/* @__PURE__ */ React10.createElement("span", null, buttonText)
|
|
513
669
|
);
|
|
514
670
|
}
|
|
515
|
-
var
|
|
671
|
+
var SuggestedAction_default = memo7(SuggestedAction);
|
|
516
672
|
|
|
517
673
|
// src/components/suggestedActions/private/computeSuggestedActionText.ts
|
|
518
674
|
function computeSuggestedActionText(cardAction) {
|
|
@@ -528,31 +684,44 @@ function computeSuggestedActionText(cardAction) {
|
|
|
528
684
|
return JSON.stringify(value);
|
|
529
685
|
}
|
|
530
686
|
|
|
531
|
-
// src/components/suggestedActions/index.module.css
|
|
532
|
-
var suggestedActions_default = {
|
|
533
|
-
"suggested-actions": "suggestedActions_suggested-actions",
|
|
534
|
-
"suggested-actions--flow": "suggestedActions_suggested-actions--flow",
|
|
535
|
-
"suggested-actions--stacked": "suggestedActions_suggested-actions--stacked"
|
|
536
|
-
};
|
|
537
|
-
|
|
538
687
|
// src/components/suggestedActions/index.tsx
|
|
539
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
|
+
};
|
|
540
709
|
function SuggestedActionStackedOrFlowContainer(props) {
|
|
541
710
|
const [{ suggestedActionLayout }] = useStyleOptions();
|
|
542
711
|
const [{ suggestedActions: suggestedActionsStyleSet }] = useStyleSet2();
|
|
543
|
-
const classNames =
|
|
712
|
+
const classNames = useStyles(styles6);
|
|
544
713
|
return /* @__PURE__ */ React11.createElement(
|
|
545
714
|
"div",
|
|
546
715
|
{
|
|
547
716
|
"aria-label": props["aria-label"],
|
|
548
717
|
"aria-live": "polite",
|
|
549
718
|
"aria-orientation": "vertical",
|
|
550
|
-
className:
|
|
551
|
-
classNames["
|
|
719
|
+
className: cx3(
|
|
720
|
+
classNames["webchat-fluent__suggested-actions"],
|
|
552
721
|
suggestedActionsStyleSet + "",
|
|
553
722
|
{
|
|
554
|
-
|
|
555
|
-
|
|
723
|
+
"webchat-fluent__suggested-actions--flow": suggestedActionLayout === "flow",
|
|
724
|
+
"webchat-fluent__suggested-actions--stacked": suggestedActionLayout !== "flow"
|
|
556
725
|
},
|
|
557
726
|
props.className
|
|
558
727
|
),
|
|
@@ -562,7 +731,7 @@ function SuggestedActionStackedOrFlowContainer(props) {
|
|
|
562
731
|
);
|
|
563
732
|
}
|
|
564
733
|
function SuggestedActions() {
|
|
565
|
-
const classNames =
|
|
734
|
+
const classNames = useStyles(styles6);
|
|
566
735
|
const localize = useLocalizer2();
|
|
567
736
|
const [suggestedActions] = useSuggestedActions2();
|
|
568
737
|
const children = suggestedActions.map((cardAction, index) => {
|
|
@@ -571,7 +740,7 @@ function SuggestedActions() {
|
|
|
571
740
|
return null;
|
|
572
741
|
}
|
|
573
742
|
return /* @__PURE__ */ React11.createElement(
|
|
574
|
-
|
|
743
|
+
SuggestedAction_default,
|
|
575
744
|
{
|
|
576
745
|
buttonText: computeSuggestedActionText(cardAction),
|
|
577
746
|
displayText,
|
|
@@ -589,18 +758,18 @@ function SuggestedActions() {
|
|
|
589
758
|
SuggestedActionStackedOrFlowContainer,
|
|
590
759
|
{
|
|
591
760
|
"aria-label": localize("SUGGESTED_ACTIONS_LABEL_ALT"),
|
|
592
|
-
className: classNames["
|
|
761
|
+
className: classNames["webchat-fluent__suggested-actions"]
|
|
593
762
|
},
|
|
594
763
|
children
|
|
595
764
|
);
|
|
596
765
|
}
|
|
597
|
-
var
|
|
766
|
+
var suggestedActions_default = memo8(SuggestedActions);
|
|
598
767
|
|
|
599
768
|
// src/components/SuggestedActions.tsx
|
|
600
|
-
var SuggestedActions_default =
|
|
769
|
+
var SuggestedActions_default = suggestedActions_default;
|
|
601
770
|
|
|
602
771
|
// src/components/sendbox/AddAttachmentButton.tsx
|
|
603
|
-
import { hooks as hooks4 } from "botframework-webchat-
|
|
772
|
+
import { hooks as hooks4 } from "botframework-webchat-api";
|
|
604
773
|
import React14, { useCallback as useCallback5, useRef as useRef5, memo as memo10 } from "react";
|
|
605
774
|
import { useRefFrom as useRefFrom4 } from "use-ref-from";
|
|
606
775
|
|
|
@@ -629,26 +798,63 @@ function AttachmentIcon(props) {
|
|
|
629
798
|
}
|
|
630
799
|
|
|
631
800
|
// src/components/sendbox/Toolbar.tsx
|
|
632
|
-
import
|
|
801
|
+
import cx4 from "classnames";
|
|
633
802
|
import React13, { memo as memo9 } from "react";
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
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
|
+
}
|
|
640
848
|
};
|
|
641
|
-
|
|
642
|
-
// src/components/sendbox/Toolbar.tsx
|
|
643
849
|
var preventDefaultHandler2 = (event) => event.preventDefault();
|
|
644
850
|
var ToolbarButton = memo9(
|
|
645
851
|
(props) => {
|
|
646
|
-
const classNames =
|
|
852
|
+
const classNames = useStyles(styles7);
|
|
647
853
|
return /* @__PURE__ */ React13.createElement(
|
|
648
854
|
"button",
|
|
649
855
|
{
|
|
650
856
|
"aria-label": props["aria-label"],
|
|
651
|
-
className:
|
|
857
|
+
className: cx4(classNames["webchat-fluent__sendbox__toolbar-button"], props.className),
|
|
652
858
|
"data-testid": props["data-testid"],
|
|
653
859
|
onClick: props.disabled ? preventDefaultHandler2 : props.onClick,
|
|
654
860
|
type: props.type === "submit" ? "submit" : "button",
|
|
@@ -663,18 +869,18 @@ var ToolbarButton = memo9(
|
|
|
663
869
|
);
|
|
664
870
|
ToolbarButton.displayName = "ToolbarButton";
|
|
665
871
|
var Toolbar = memo9((props) => {
|
|
666
|
-
const classNames =
|
|
667
|
-
return /* @__PURE__ */ React13.createElement("div", { className:
|
|
872
|
+
const classNames = useStyles(styles7);
|
|
873
|
+
return /* @__PURE__ */ React13.createElement("div", { className: cx4(classNames["webchat-fluent__sendbox__toolbar"], props.className) }, props.children);
|
|
668
874
|
});
|
|
669
875
|
Toolbar.displayName = "Toolbar";
|
|
670
876
|
var ToolbarSeparator = memo9(
|
|
671
877
|
(props) => {
|
|
672
|
-
const classNames =
|
|
878
|
+
const classNames = useStyles(styles7);
|
|
673
879
|
return /* @__PURE__ */ React13.createElement(
|
|
674
880
|
"div",
|
|
675
881
|
{
|
|
676
882
|
"aria-orientation": "vertical",
|
|
677
|
-
className:
|
|
883
|
+
className: cx4(classNames["webchat-fluent__sendbox__toolbar-separator"], props.className),
|
|
678
884
|
role: "separator"
|
|
679
885
|
}
|
|
680
886
|
);
|
|
@@ -682,17 +888,22 @@ var ToolbarSeparator = memo9(
|
|
|
682
888
|
);
|
|
683
889
|
ToolbarSeparator.displayName = "ToolbarSeparator";
|
|
684
890
|
|
|
685
|
-
// src/components/sendbox/AddAttachmentButton.module.css
|
|
686
|
-
var AddAttachmentButton_default = {
|
|
687
|
-
"sendbox__add-attachment": "AddAttachmentButton_sendbox__add-attachment",
|
|
688
|
-
"sendbox__add-attachment-input": "AddAttachmentButton_sendbox__add-attachment-input"
|
|
689
|
-
};
|
|
690
|
-
|
|
691
891
|
// src/components/sendbox/AddAttachmentButton.tsx
|
|
692
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
|
+
};
|
|
693
904
|
function AddAttachmentButton(props) {
|
|
694
905
|
const inputRef = useRef5(null);
|
|
695
|
-
const classNames =
|
|
906
|
+
const classNames = useStyles(styles8);
|
|
696
907
|
const localize = useLocalizer3();
|
|
697
908
|
const [{ uploadAccept, uploadMultiple }] = useStyleOptions2();
|
|
698
909
|
const onFilesAddedRef = useRefFrom4(props.onFilesAdded);
|
|
@@ -708,13 +919,13 @@ function AddAttachmentButton(props) {
|
|
|
708
919
|
},
|
|
709
920
|
[inputRef, onFilesAddedRef]
|
|
710
921
|
);
|
|
711
|
-
return /* @__PURE__ */ React14.createElement("div", { className: classNames["
|
|
922
|
+
return /* @__PURE__ */ React14.createElement("div", { className: classNames["webchat-fluent__sendbox__add-attachment"] }, /* @__PURE__ */ React14.createElement(
|
|
712
923
|
"input",
|
|
713
924
|
{
|
|
714
925
|
accept: uploadAccept,
|
|
715
926
|
"aria-disabled": props.disabled,
|
|
716
927
|
"aria-hidden": "true",
|
|
717
|
-
className: classNames["
|
|
928
|
+
className: classNames["webchat-fluent__sendbox__add-attachment-input"],
|
|
718
929
|
multiple: uploadMultiple,
|
|
719
930
|
onInput: props.disabled ? void 0 : handleFileChange,
|
|
720
931
|
readOnly: props.disabled,
|
|
@@ -733,19 +944,21 @@ function AddAttachmentButton(props) {
|
|
|
733
944
|
/* @__PURE__ */ React14.createElement(AttachmentIcon, null)
|
|
734
945
|
));
|
|
735
946
|
}
|
|
736
|
-
var
|
|
947
|
+
var AddAttachmentButton_default = memo10(AddAttachmentButton);
|
|
737
948
|
|
|
738
949
|
// src/components/sendbox/Attachments.tsx
|
|
739
|
-
import { hooks as hooks5 } from "botframework-webchat-
|
|
950
|
+
import { hooks as hooks5 } from "botframework-webchat-api";
|
|
740
951
|
import React15, { memo as memo11 } from "react";
|
|
741
|
-
|
|
742
|
-
// src/components/sendbox/Attachments.module.css
|
|
743
|
-
var Attachments_default = {
|
|
744
|
-
sendbox__attachment: "Attachments_sendbox__attachment"
|
|
745
|
-
};
|
|
746
|
-
|
|
747
|
-
// src/components/sendbox/Attachments.tsx
|
|
748
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
|
+
};
|
|
749
962
|
var attachmentsPluralStringIds = {
|
|
750
963
|
one: "TEXT_INPUT_ATTACHMENTS_ONE",
|
|
751
964
|
two: "TEXT_INPUT_ATTACHMENTS_TWO",
|
|
@@ -756,33 +969,37 @@ var attachmentsPluralStringIds = {
|
|
|
756
969
|
function Attachments({
|
|
757
970
|
attachments
|
|
758
971
|
}) {
|
|
759
|
-
const classNames =
|
|
972
|
+
const classNames = useStyles(styles9);
|
|
760
973
|
const localizeWithPlural = useLocalizer4({ plural: true });
|
|
761
|
-
return attachments.length ? /* @__PURE__ */ React15.createElement("div", { className: classNames["
|
|
974
|
+
return attachments.length ? /* @__PURE__ */ React15.createElement("div", { className: classNames["webchat-fluent__sendbox__attachment"] }, localizeWithPlural(attachmentsPluralStringIds, attachments.length)) : null;
|
|
762
975
|
}
|
|
763
|
-
var
|
|
976
|
+
var Attachments_default = memo11(Attachments);
|
|
764
977
|
|
|
765
978
|
// src/components/sendbox/ErrorMessage.tsx
|
|
766
979
|
import React16, { memo as memo12 } from "react";
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
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
|
+
}
|
|
771
990
|
};
|
|
772
|
-
|
|
773
|
-
// src/components/sendbox/ErrorMessage.tsx
|
|
774
991
|
function ErrorMessage(props) {
|
|
775
|
-
const classNames =
|
|
992
|
+
const classNames = useStyles(styles10);
|
|
776
993
|
return (
|
|
777
994
|
// eslint-disable-next-line react/forbid-dom-props
|
|
778
|
-
/* @__PURE__ */ React16.createElement("span", { className: classNames["
|
|
995
|
+
/* @__PURE__ */ React16.createElement("span", { className: classNames["webchat-fluent___sendbox__error-message"], id: props.id, role: "alert" }, props.error)
|
|
779
996
|
);
|
|
780
997
|
}
|
|
781
|
-
var
|
|
998
|
+
var ErrorMessage_default = memo12(ErrorMessage);
|
|
782
999
|
|
|
783
1000
|
// src/components/sendbox/TelephoneKeypadToolbarButton.tsx
|
|
784
1001
|
import React18, { memo as memo13, useCallback as useCallback6 } from "react";
|
|
785
|
-
import { hooks as hooks6 } from "botframework-webchat-
|
|
1002
|
+
import { hooks as hooks6 } from "botframework-webchat-api";
|
|
786
1003
|
|
|
787
1004
|
// src/icons/TelephoneKeypad.tsx
|
|
788
1005
|
import React17 from "react";
|
|
@@ -828,22 +1045,61 @@ TelephoneKeypadToolbarButton.displayName = "SendBox.TelephoneKeypadToolbarButton
|
|
|
828
1045
|
var TelephoneKeypadToolbarButton_default = TelephoneKeypadToolbarButton;
|
|
829
1046
|
|
|
830
1047
|
// src/components/sendbox/TextArea.tsx
|
|
831
|
-
import
|
|
1048
|
+
import cx5 from "classnames";
|
|
832
1049
|
import React19, { forwardRef as forwardRef3, useCallback as useCallback7 } from "react";
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
"
|
|
841
|
-
|
|
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
|
+
}
|
|
842
1100
|
};
|
|
843
|
-
|
|
844
|
-
// src/components/sendbox/TextArea.tsx
|
|
845
1101
|
var TextArea = forwardRef3((props, ref) => {
|
|
846
|
-
const classNames =
|
|
1102
|
+
const classNames = useStyles(styles11);
|
|
847
1103
|
const handleKeyDown = useCallback7((event) => {
|
|
848
1104
|
if (!event.shiftKey && event.key === "Enter") {
|
|
849
1105
|
event.preventDefault();
|
|
@@ -855,10 +1111,10 @@ var TextArea = forwardRef3((props, ref) => {
|
|
|
855
1111
|
return /* @__PURE__ */ React19.createElement(
|
|
856
1112
|
"div",
|
|
857
1113
|
{
|
|
858
|
-
className:
|
|
859
|
-
classNames["
|
|
1114
|
+
className: cx5(
|
|
1115
|
+
classNames["webchat-fluent__sendbox__text-area"],
|
|
860
1116
|
{
|
|
861
|
-
[classNames["
|
|
1117
|
+
[classNames["webchat-fluent__sendbox__text-area--hidden"]]: props.hidden
|
|
862
1118
|
},
|
|
863
1119
|
props.className
|
|
864
1120
|
),
|
|
@@ -867,10 +1123,10 @@ var TextArea = forwardRef3((props, ref) => {
|
|
|
867
1123
|
/* @__PURE__ */ React19.createElement(
|
|
868
1124
|
"div",
|
|
869
1125
|
{
|
|
870
|
-
className:
|
|
871
|
-
classNames["
|
|
872
|
-
classNames["
|
|
873
|
-
classNames["
|
|
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"]
|
|
874
1130
|
)
|
|
875
1131
|
},
|
|
876
1132
|
props.value || props.placeholder,
|
|
@@ -880,10 +1136,10 @@ var TextArea = forwardRef3((props, ref) => {
|
|
|
880
1136
|
"textarea",
|
|
881
1137
|
{
|
|
882
1138
|
"aria-label": props["aria-label"],
|
|
883
|
-
className:
|
|
884
|
-
classNames["
|
|
885
|
-
classNames["
|
|
886
|
-
classNames["
|
|
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"]
|
|
887
1143
|
),
|
|
888
1144
|
"data-testid": props["data-testid"],
|
|
889
1145
|
onInput: props.onInput,
|
|
@@ -898,11 +1154,11 @@ var TextArea = forwardRef3((props, ref) => {
|
|
|
898
1154
|
);
|
|
899
1155
|
});
|
|
900
1156
|
TextArea.displayName = "TextArea";
|
|
901
|
-
var
|
|
1157
|
+
var TextArea_default = TextArea;
|
|
902
1158
|
|
|
903
1159
|
// src/components/sendbox/private/useSubmitError.ts
|
|
904
1160
|
import { hooks as hooks7 } from "botframework-webchat-component";
|
|
905
|
-
import { useMemo as
|
|
1161
|
+
import { useMemo as useMemo5 } from "react";
|
|
906
1162
|
import { useRefFrom as useRefFrom5 } from "use-ref-from";
|
|
907
1163
|
var { useConnectivityStatus, useLocalizer: useLocalizer6 } = hooks7;
|
|
908
1164
|
var useSubmitError = ({
|
|
@@ -914,13 +1170,13 @@ var useSubmitError = ({
|
|
|
914
1170
|
const submitErrorRef = useRefFrom5(
|
|
915
1171
|
connectivityStatus !== "connected" && connectivityStatus !== "reconnected" ? "offline" : !message && !attachments.length ? "empty" : void 0
|
|
916
1172
|
);
|
|
917
|
-
const errorMessageStringMap =
|
|
1173
|
+
const errorMessageStringMap = useMemo5(
|
|
918
1174
|
() => Object.freeze(
|
|
919
1175
|
(/* @__PURE__ */ new Map()).set("empty", localize("SEND_BOX_IS_EMPTY_TOOLTIP_ALT")).set("offline", localize("CONNECTIVITY_STATUS_ALT_FATAL"))
|
|
920
1176
|
),
|
|
921
1177
|
[localize]
|
|
922
1178
|
);
|
|
923
|
-
return
|
|
1179
|
+
return useMemo5(
|
|
924
1180
|
() => Object.freeze([submitErrorRef, submitErrorRef.current && errorMessageStringMap.get(submitErrorRef.current)]),
|
|
925
1181
|
[errorMessageStringMap, submitErrorRef]
|
|
926
1182
|
);
|
|
@@ -928,36 +1184,80 @@ var useSubmitError = ({
|
|
|
928
1184
|
var useSubmitError_default = useSubmitError;
|
|
929
1185
|
|
|
930
1186
|
// src/components/sendbox/private/useUniqueId.ts
|
|
931
|
-
import { useMemo as
|
|
1187
|
+
import { useMemo as useMemo6 } from "react";
|
|
932
1188
|
function useUniqueId(prefix) {
|
|
933
|
-
const id =
|
|
1189
|
+
const id = useMemo6(() => Math.random().toString(36).substr(2, 5), []);
|
|
934
1190
|
prefix = prefix ? `${prefix}--` : "";
|
|
935
1191
|
return `${prefix}${id}`;
|
|
936
1192
|
}
|
|
937
1193
|
|
|
938
|
-
// src/components/sendbox/index.module.css
|
|
939
|
-
var sendbox_default = {
|
|
940
|
-
sendbox: "sendbox_sendbox",
|
|
941
|
-
sendbox__sendbox: "sendbox_sendbox__sendbox",
|
|
942
|
-
"sendbox__sendbox-text": "sendbox_sendbox__sendbox-text",
|
|
943
|
-
"sendbox__sendbox-controls": "sendbox_sendbox__sendbox-controls",
|
|
944
|
-
"sendbox__text-counter": "sendbox_sendbox__text-counter",
|
|
945
|
-
"sendbox__text-counter--error": "sendbox_sendbox__text-counter--error"
|
|
946
|
-
};
|
|
947
|
-
|
|
948
1194
|
// src/components/sendbox/index.tsx
|
|
949
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
|
+
};
|
|
950
1250
|
function SendBox(props) {
|
|
951
1251
|
const inputRef = useRef6(null);
|
|
952
1252
|
const [message, setMessage] = useState3("");
|
|
953
1253
|
const [attachments, setAttachments] = useSendBoxAttachments();
|
|
954
1254
|
const [{ hideTelephoneKeypadButton, hideUploadButton, maxMessageLength }] = useStyleOptions3();
|
|
955
1255
|
const isMessageLengthExceeded = !!maxMessageLength && message.length > maxMessageLength;
|
|
956
|
-
const classNames =
|
|
1256
|
+
const classNames = useStyles(styles12);
|
|
957
1257
|
const localize = useLocalizer7();
|
|
958
1258
|
const sendMessage = useSendMessage();
|
|
959
1259
|
const makeThumbnail = useMakeThumbnail();
|
|
960
|
-
const errorMessageId = useUniqueId("
|
|
1260
|
+
const errorMessageId = useUniqueId("webchat-fluent__sendbox__error-message-id");
|
|
961
1261
|
const [errorRef, errorMessage] = useSubmitError_default({ message, attachments });
|
|
962
1262
|
const [telephoneKeypadShown] = useShown();
|
|
963
1263
|
const attachmentsRef = useRefFrom6(attachments);
|
|
@@ -1017,7 +1317,7 @@ function SendBox(props) {
|
|
|
1017
1317
|
"aria-errormessage": errorMessageId
|
|
1018
1318
|
}
|
|
1019
1319
|
};
|
|
1020
|
-
return /* @__PURE__ */ React20.createElement("form", { ...aria, className:
|
|
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(
|
|
1021
1321
|
Surrogate_default,
|
|
1022
1322
|
{
|
|
1023
1323
|
autoFocus: true,
|
|
@@ -1025,10 +1325,10 @@ function SendBox(props) {
|
|
|
1025
1325
|
onButtonClick: handleTelephoneKeypadButtonClick
|
|
1026
1326
|
}
|
|
1027
1327
|
), /* @__PURE__ */ React20.createElement(
|
|
1028
|
-
|
|
1328
|
+
TextArea_default,
|
|
1029
1329
|
{
|
|
1030
1330
|
"aria-label": isMessageLengthExceeded ? localize("TEXT_INPUT_LENGTH_EXCEEDED_ALT") : localize("TEXT_INPUT_ALT"),
|
|
1031
|
-
className: classNames["
|
|
1331
|
+
className: classNames["webchat-fluent__sendbox__sendbox-text"],
|
|
1032
1332
|
"data-testid": testIds_default.sendBoxTextBox,
|
|
1033
1333
|
hidden: telephoneKeypadShown,
|
|
1034
1334
|
onInput: handleMessageChange,
|
|
@@ -1036,15 +1336,15 @@ function SendBox(props) {
|
|
|
1036
1336
|
ref: inputRef,
|
|
1037
1337
|
value: message
|
|
1038
1338
|
}
|
|
1039
|
-
), /* @__PURE__ */ React20.createElement(
|
|
1339
|
+
), /* @__PURE__ */ React20.createElement(Attachments_default, { attachments }), /* @__PURE__ */ React20.createElement("div", { className: cx6(classNames["webchat-fluent__sendbox__sendbox-controls"]) }, maxMessageLength && /* @__PURE__ */ React20.createElement(
|
|
1040
1340
|
"div",
|
|
1041
1341
|
{
|
|
1042
|
-
className:
|
|
1043
|
-
[classNames["
|
|
1342
|
+
className: cx6(classNames["webchat-fluent__sendbox__text-counter"], {
|
|
1343
|
+
[classNames["webchat-fluent__sendbox__text-counter--error"]]: isMessageLengthExceeded
|
|
1044
1344
|
})
|
|
1045
1345
|
},
|
|
1046
1346
|
`${message.length}/${maxMessageLength}`
|
|
1047
|
-
), /* @__PURE__ */ React20.createElement(Toolbar, null, !hideTelephoneKeypadButton && /* @__PURE__ */ React20.createElement(TelephoneKeypadToolbarButton_default, null), !hideUploadButton && /* @__PURE__ */ React20.createElement(
|
|
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(
|
|
1048
1348
|
ToolbarButton,
|
|
1049
1349
|
{
|
|
1050
1350
|
"aria-label": localize("TEXT_INPUT_SEND_BUTTON_ALT"),
|
|
@@ -1053,12 +1353,12 @@ function SendBox(props) {
|
|
|
1053
1353
|
type: "submit"
|
|
1054
1354
|
},
|
|
1055
1355
|
/* @__PURE__ */ React20.createElement(SendIcon, null)
|
|
1056
|
-
))), /* @__PURE__ */ React20.createElement(DropZone_default, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ React20.createElement(
|
|
1356
|
+
))), /* @__PURE__ */ React20.createElement(DropZone_default, { onFilesAdded: handleAddFiles }), /* @__PURE__ */ React20.createElement(ErrorMessage_default, { error: errorMessage, id: errorMessageId })));
|
|
1057
1357
|
}
|
|
1058
|
-
var
|
|
1358
|
+
var sendbox_default = memo14(SendBox);
|
|
1059
1359
|
|
|
1060
1360
|
// src/components/SendBox.tsx
|
|
1061
|
-
var SendBox_default =
|
|
1361
|
+
var SendBox_default = sendbox_default;
|
|
1062
1362
|
|
|
1063
1363
|
// src/private/FluentThemeProvider.tsx
|
|
1064
1364
|
var { ThemeProvider } = Components;
|
|
@@ -1067,8 +1367,7 @@ var FluentThemeProvider = ({ children }) => /* @__PURE__ */ React21.createElemen
|
|
|
1067
1367
|
var FluentThemeProvider_default = memo15(FluentThemeProvider);
|
|
1068
1368
|
|
|
1069
1369
|
// src/index.ts
|
|
1070
|
-
injectMetaTag("botframework-webchat-fluent-theme:version", "4.17.0-main.20240416.
|
|
1071
|
-
injectStyles();
|
|
1370
|
+
injectMetaTag("botframework-webchat-fluent-theme:version", "4.17.0-main.20240416.e3f5401");
|
|
1072
1371
|
export {
|
|
1073
1372
|
FluentThemeProvider_default as FluentThemeProvider,
|
|
1074
1373
|
testIds_default as testIds
|