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