botframework-webchat-fluent-theme 4.17.0-main.20240416.e3f5401 → 4.17.0-main.20240423.d9e4f4d
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.css.map +1 -0
- package/dist/botframework-webchat-fluent-theme.development.js +418 -2085
- package/dist/botframework-webchat-fluent-theme.development.js.map +1 -1
- package/dist/botframework-webchat-fluent-theme.production.min.css.map +1 -0
- package/dist/botframework-webchat-fluent-theme.production.min.js +1 -3
- package/dist/botframework-webchat-fluent-theme.production.min.js.map +1 -1
- package/dist/index.css.map +1 -0
- package/dist/index.js +285 -545
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +335 -595
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
- package/src/components/Theme.module.css +80 -0
- package/src/components/Theme.tsx +4 -65
- package/src/components/dropZone/index.module.css +23 -0
- package/src/components/dropZone/index.tsx +6 -31
- package/src/components/sendbox/AddAttachmentButton.module.css +10 -0
- package/src/components/sendbox/AddAttachmentButton.tsx +5 -17
- package/src/components/sendbox/Attachments.module.css +7 -0
- package/src/components/sendbox/Attachments.tsx +7 -13
- package/src/components/sendbox/ErrorMessage.module.css +9 -0
- package/src/components/sendbox/ErrorMessage.tsx +2 -13
- package/src/components/sendbox/TelephoneKeypadToolbarButton.tsx +3 -2
- package/src/components/sendbox/TextArea.module.css +63 -0
- package/src/components/sendbox/TextArea.tsx +9 -70
- package/src/components/sendbox/Toolbar.module.css +51 -0
- package/src/components/sendbox/Toolbar.tsx +7 -55
- package/src/components/sendbox/index.module.css +101 -0
- package/src/components/sendbox/index.tsx +18 -77
- package/src/components/suggestedActions/SuggestedAction.module.css +35 -0
- package/src/components/suggestedActions/SuggestedAction.tsx +3 -43
- package/src/components/suggestedActions/index.module.css +23 -0
- package/src/components/suggestedActions/index.tsx +6 -29
- package/src/components/telephoneKeypad/private/Button.module.css +62 -0
- package/src/components/telephoneKeypad/private/Button.tsx +5 -67
- package/src/components/telephoneKeypad/private/TelephoneKeypad.module.css +59 -0
- package/src/components/telephoneKeypad/private/TelephoneKeypad.tsx +17 -35
- package/src/env.d.ts +7 -0
- package/src/icons/AddDocumentIcon.tsx +0 -1
- package/src/icons/AttachmentIcon.tsx +0 -1
- package/src/icons/InfoSmallIcon.tsx +17 -0
- package/src/icons/SendIcon.tsx +0 -1
- package/src/icons/TelephoneKeypad.tsx +0 -1
- package/src/index.ts +3 -0
- package/src/styles/injectStyle.ts +9 -0
- package/src/styles/useStyles.ts +19 -0
- package/src/styles.ts +4 -0
- package/src/tsconfig.json +2 -1
- package/src/private/useStyleToEmotionObject.ts +0 -32
- package/src/styles/index.ts +0 -15
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
:global(.webchat-fluent) .sendbox {
|
|
2
|
+
color: var(--webchat-colorNeutralForeground1);
|
|
3
|
+
font-family: var(--webchat-fontFamilyBase);
|
|
4
|
+
padding: 0 10px 10px;
|
|
5
|
+
text-rendering: optimizeLegibility;
|
|
6
|
+
|
|
7
|
+
--webchat-sendbox-attachment-area-active: ;
|
|
8
|
+
--webchat-sendbox-border-radius: var(--webchat-borderRadiusLarge);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:global(.webchat-fluent) .sendbox__sendbox {
|
|
12
|
+
background-color: var(--webchat-colorNeutralBackground1);
|
|
13
|
+
border-radius: var(--webchat-sendbox-border-radius);
|
|
14
|
+
border: 1px solid var(--webchat-colorNeutralStroke1);
|
|
15
|
+
display: grid;
|
|
16
|
+
font-family: var(--webchat-fontFamilyBase);
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
gap: 6px;
|
|
19
|
+
grid-template:
|
|
20
|
+
[telephone-keypad-start] 'text-area' [telephone-keypad-end]
|
|
21
|
+
var(--webchat-sendbox-attachment-area-active)
|
|
22
|
+
'controls' / [telephone-keypad] 1fr
|
|
23
|
+
;
|
|
24
|
+
line-height: 20px;
|
|
25
|
+
padding: 8px;
|
|
26
|
+
position: relative;
|
|
27
|
+
|
|
28
|
+
&:has(.sendbox__attachment--in-grid) {
|
|
29
|
+
--webchat-sendbox-attachment-area-active: 'attachment'
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:focus-within {
|
|
33
|
+
border-color: var(--webchat-colorNeutralStroke1Selected);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&::after {
|
|
37
|
+
border-bottom-left-radius: var(--webchat-sendbox-border-radius);
|
|
38
|
+
border-bottom-right-radius: var(--webchat-sendbox-border-radius);
|
|
39
|
+
border-bottom: var(--webchat-strokeWidthThicker) solid var(--webchat-colorCompoundBrandForeground1Hover);
|
|
40
|
+
bottom: -1px;
|
|
41
|
+
clip-path: inset(calc(100% - var(--webchat-strokeWidthThicker)) 50% 0 50%);
|
|
42
|
+
content: "";
|
|
43
|
+
height: var(--webchat-sendbox-border-radius);
|
|
44
|
+
left: -1px;
|
|
45
|
+
position: absolute;
|
|
46
|
+
right: -1px;
|
|
47
|
+
transition: clip-path var(--webchat-durationUltraFast) var(--webchat-curveAccelerateMid);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:focus-within::after {
|
|
51
|
+
clip-path: inset(calc(100% - var(--webchat-strokeWidthThicker)) 0 0 0);
|
|
52
|
+
transition: clip-path var(--webchat-durationNormal) var(--webchat-curveDecelerateMid);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
> .sendbox__text-area--in-grid {
|
|
56
|
+
grid-area: text-area;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
> .sendbox__attachment--in-grid {
|
|
60
|
+
grid-area: attachment;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
> .sendbox__sendbox-controls--in-grid {
|
|
64
|
+
grid-area: controls;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
> .sendbox__telephone-keypad--in-grid {
|
|
68
|
+
grid-area: telephone-keypad;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:global(.webchat-fluent) .sendbox__sendbox-text {
|
|
73
|
+
background-color: transparent;
|
|
74
|
+
border: none;
|
|
75
|
+
flex: auto;
|
|
76
|
+
font-family: var(--webchat-fontFamilyBase);
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
line-height: 20px;
|
|
79
|
+
outline: none;
|
|
80
|
+
padding: 4px 4px 0;
|
|
81
|
+
resize: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:global(.webchat-fluent) .sendbox__sendbox-controls {
|
|
85
|
+
align-items: center;
|
|
86
|
+
display: flex;
|
|
87
|
+
padding-inline-start: 4px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
:global(.webchat-fluent) .sendbox__text-counter {
|
|
91
|
+
color: var(--webchat-colorNeutralForeground4);
|
|
92
|
+
cursor: default;
|
|
93
|
+
font-family: var(--webchat-fontFamilyNumeric);
|
|
94
|
+
font-size: 10px;
|
|
95
|
+
line-height: 14px;
|
|
96
|
+
margin-inline-end: 4px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:global(.webchat-fluent) .sendbox__text-counter--error {
|
|
100
|
+
color: var(--webchat-colorStatusDangerForeground1);
|
|
101
|
+
}
|
|
@@ -3,7 +3,6 @@ import cx from 'classnames';
|
|
|
3
3
|
import React, { memo, useCallback, useRef, useState, type FormEventHandler, type MouseEventHandler } from 'react';
|
|
4
4
|
import { useRefFrom } from 'use-ref-from';
|
|
5
5
|
import { SendIcon } from '../../icons/SendIcon';
|
|
6
|
-
import { useStyles } from '../../styles';
|
|
7
6
|
import testIds from '../../testIds';
|
|
8
7
|
import DropZone from '../DropZone';
|
|
9
8
|
import SuggestedActions from '../SuggestedActions';
|
|
@@ -16,70 +15,11 @@ import TextArea from './TextArea';
|
|
|
16
15
|
import { Toolbar, ToolbarButton, ToolbarSeparator } from './Toolbar';
|
|
17
16
|
import useSubmitError from './private/useSubmitError';
|
|
18
17
|
import useUniqueId from './private/useUniqueId';
|
|
18
|
+
import styles from './index.module.css';
|
|
19
|
+
import { useStyles } from '../../styles';
|
|
19
20
|
|
|
20
21
|
const { useStyleOptions, useMakeThumbnail, useLocalizer, useSendBoxAttachments, useSendMessage } = hooks;
|
|
21
22
|
|
|
22
|
-
const styles = {
|
|
23
|
-
'webchat-fluent__sendbox': {
|
|
24
|
-
color: 'var(--webchat-colorNeutralForeground1)',
|
|
25
|
-
fontFamily: 'var(--webchat-fontFamilyBase)',
|
|
26
|
-
padding: '0 10px 10px',
|
|
27
|
-
textRendering: 'optimizeLegibility'
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
'webchat-fluent__sendbox__sendbox': {
|
|
31
|
-
backgroundColor: 'var(--webchat-colorNeutralBackground1)',
|
|
32
|
-
border: '1px solid var(--webchat-colorNeutralStroke1)',
|
|
33
|
-
borderRadius: 'var(--webchat-borderRadiusLarge)',
|
|
34
|
-
display: 'grid',
|
|
35
|
-
fontFamily: 'var(--webchat-fontFamilyBase)',
|
|
36
|
-
fontSize: '14px',
|
|
37
|
-
gap: '6px',
|
|
38
|
-
lineHeight: '20px',
|
|
39
|
-
padding: '8px',
|
|
40
|
-
position: 'relative',
|
|
41
|
-
|
|
42
|
-
'&:focus-within': {
|
|
43
|
-
borderColor: 'var(--webchat-colorNeutralStroke1Selected)',
|
|
44
|
-
// TODO clarify with design the color:
|
|
45
|
-
// - Teams is using colorCompoundBrandForeground1
|
|
46
|
-
// - Fluent is using colorCompoundBrandStroke
|
|
47
|
-
// - we are using colorCompoundBrandForeground1Hover
|
|
48
|
-
boxShadow: 'inset 0 -6px 0 -3px var(--webchat-colorCompoundBrandForeground1Hover)'
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
'webchat-fluent__sendbox__sendbox-text': {
|
|
53
|
-
backgroundColor: 'transparent',
|
|
54
|
-
border: 'none',
|
|
55
|
-
flex: 'auto',
|
|
56
|
-
fontFamily: 'var(--webchat-fontFamilyBase)',
|
|
57
|
-
fontSize: '14px',
|
|
58
|
-
lineHeight: '20px',
|
|
59
|
-
outline: 'none',
|
|
60
|
-
padding: '4px 4px 0',
|
|
61
|
-
resize: 'none'
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
'webchat-fluent__sendbox__sendbox-controls': {
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
display: 'flex',
|
|
67
|
-
paddingInlineStart: '4px'
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
'webchat-fluent__sendbox__text-counter': {
|
|
71
|
-
color: 'var(--webchat-colorNeutralForeground4)',
|
|
72
|
-
cursor: 'default',
|
|
73
|
-
fontFamily: 'var(--webchat-fontFamilyNumeric)',
|
|
74
|
-
fontSize: '10px',
|
|
75
|
-
lineHeight: '14px'
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
'webchat-fluent__sendbox__text-counter--error': {
|
|
79
|
-
color: 'var(--webchat-colorStatusDangerForeground1)'
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
23
|
function SendBox(
|
|
84
24
|
props: Readonly<{
|
|
85
25
|
className?: string | undefined;
|
|
@@ -95,7 +35,7 @@ function SendBox(
|
|
|
95
35
|
const localize = useLocalizer();
|
|
96
36
|
const sendMessage = useSendMessage();
|
|
97
37
|
const makeThumbnail = useMakeThumbnail();
|
|
98
|
-
const errorMessageId = useUniqueId('
|
|
38
|
+
const errorMessageId = useUniqueId('sendbox__error-message-id');
|
|
99
39
|
const [errorRef, errorMessage] = useSubmitError({ message, attachments });
|
|
100
40
|
const [telephoneKeypadShown] = useTelephoneKeypadShown();
|
|
101
41
|
|
|
@@ -176,17 +116,12 @@ function SendBox(
|
|
|
176
116
|
};
|
|
177
117
|
|
|
178
118
|
return (
|
|
179
|
-
<form {...aria} className={cx(classNames['
|
|
119
|
+
<form {...aria} className={cx(classNames['sendbox'], props.className)} onSubmit={handleFormSubmit}>
|
|
180
120
|
<SuggestedActions />
|
|
181
|
-
<div className={cx(classNames['
|
|
182
|
-
<TelephoneKeypadSurrogate
|
|
183
|
-
autoFocus={true}
|
|
184
|
-
isHorizontal={false}
|
|
185
|
-
onButtonClick={handleTelephoneKeypadButtonClick}
|
|
186
|
-
/>
|
|
121
|
+
<div className={cx(classNames['sendbox__sendbox'])} onClickCapture={handleSendBoxClick}>
|
|
187
122
|
<TextArea
|
|
188
123
|
aria-label={isMessageLengthExceeded ? localize('TEXT_INPUT_LENGTH_EXCEEDED_ALT') : localize('TEXT_INPUT_ALT')}
|
|
189
|
-
className={classNames['
|
|
124
|
+
className={cx(classNames['sendbox__sendbox-text'], classNames['sendbox__text-area--in-grid'])}
|
|
190
125
|
data-testid={testIds.sendBoxTextBox}
|
|
191
126
|
hidden={telephoneKeypadShown}
|
|
192
127
|
onInput={handleMessageChange}
|
|
@@ -194,12 +129,18 @@ function SendBox(
|
|
|
194
129
|
ref={inputRef}
|
|
195
130
|
value={message}
|
|
196
131
|
/>
|
|
197
|
-
<
|
|
198
|
-
|
|
199
|
-
{
|
|
132
|
+
<TelephoneKeypadSurrogate
|
|
133
|
+
autoFocus={true}
|
|
134
|
+
className={classNames['sendbox__telephone-keypad--in-grid']}
|
|
135
|
+
isHorizontal={false}
|
|
136
|
+
onButtonClick={handleTelephoneKeypadButtonClick}
|
|
137
|
+
/>
|
|
138
|
+
<Attachments attachments={attachments} className={classNames['sendbox__attachment--in-grid']} />
|
|
139
|
+
<div className={cx(classNames['sendbox__sendbox-controls'], classNames['sendbox__sendbox-controls--in-grid'])}>
|
|
140
|
+
{!telephoneKeypadShown && maxMessageLength && (
|
|
200
141
|
<div
|
|
201
|
-
className={cx(classNames['
|
|
202
|
-
[classNames['
|
|
142
|
+
className={cx(classNames['sendbox__text-counter'], {
|
|
143
|
+
[classNames['sendbox__text-counter--error']]: isMessageLengthExceeded
|
|
203
144
|
})}
|
|
204
145
|
>
|
|
205
146
|
{`${message.length}/${maxMessageLength}`}
|
|
@@ -212,7 +153,7 @@ function SendBox(
|
|
|
212
153
|
<ToolbarButton
|
|
213
154
|
aria-label={localize('TEXT_INPUT_SEND_BUTTON_ALT')}
|
|
214
155
|
data-testid={testIds.sendBoxSendButton}
|
|
215
|
-
disabled={isMessageLengthExceeded}
|
|
156
|
+
disabled={isMessageLengthExceeded || telephoneKeypadShown}
|
|
216
157
|
type="submit"
|
|
217
158
|
>
|
|
218
159
|
<SendIcon />
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
:global(.webchat-fluent) .suggested-action {
|
|
2
|
+
align-items: center;
|
|
3
|
+
background: transparent;
|
|
4
|
+
border-radius: 8px;
|
|
5
|
+
border: 1px solid var(--webchat-colorBrandStroke2);
|
|
6
|
+
color: currentColor;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
display: flex;
|
|
9
|
+
font-size: 12px;
|
|
10
|
+
gap: 4px;
|
|
11
|
+
padding: 4px 8px 4px;
|
|
12
|
+
text-align: start;
|
|
13
|
+
transition: all .15s ease-out;
|
|
14
|
+
|
|
15
|
+
@media (hover: hover) {
|
|
16
|
+
&:not([aria-disabled="true"]):hover {
|
|
17
|
+
background-color: var(--webchat-colorBrandBackground2Hover);
|
|
18
|
+
color: var(--webchat-colorBrandForeground2Hover)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
&:not([aria-disabled="true"]):active {
|
|
22
|
+
background-color: var(--webchat-colorBrandBackground2Pressed);
|
|
23
|
+
color: var(--webchat-colorBrandForeground2Pressed)
|
|
24
|
+
}
|
|
25
|
+
&[aria-disabled="true"] {
|
|
26
|
+
color: var(--webchat-colorNeutralForegroundDisabled);
|
|
27
|
+
cursor: not-allowed
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:global(.webchat-fluent) .suggested-action__image {
|
|
32
|
+
font-size: 12px;
|
|
33
|
+
height: 1em;
|
|
34
|
+
width: 1em;
|
|
35
|
+
}
|
|
@@ -2,6 +2,7 @@ import { hooks } from 'botframework-webchat-component';
|
|
|
2
2
|
import { type DirectLineCardAction } from 'botframework-webchat-core';
|
|
3
3
|
import cx from 'classnames';
|
|
4
4
|
import React, { MouseEventHandler, memo, useCallback, useRef } from 'react';
|
|
5
|
+
import styles from './SuggestedAction.module.css';
|
|
5
6
|
import { useStyles } from '../../styles';
|
|
6
7
|
import AccessibleButton from './AccessibleButton';
|
|
7
8
|
|
|
@@ -29,43 +30,6 @@ type SuggestedActionProps = Readonly<{
|
|
|
29
30
|
value?: any;
|
|
30
31
|
}>;
|
|
31
32
|
|
|
32
|
-
const styles = {
|
|
33
|
-
'webchat-fluent__suggested-action': {
|
|
34
|
-
alignItems: 'center',
|
|
35
|
-
background: 'transparent',
|
|
36
|
-
border: '1px solid var(--webchat-colorBrandStroke2)',
|
|
37
|
-
borderRadius: '8px',
|
|
38
|
-
cursor: 'pointer',
|
|
39
|
-
display: 'flex',
|
|
40
|
-
fontSize: '12px',
|
|
41
|
-
gap: '4px',
|
|
42
|
-
padding: '4px 8px 4px',
|
|
43
|
-
textAlign: 'start',
|
|
44
|
-
transition: 'all .15s ease-out',
|
|
45
|
-
|
|
46
|
-
'@media (hover: hover)': {
|
|
47
|
-
'&:not([aria-disabled="true"]):hover': {
|
|
48
|
-
backgroundColor: 'var(--webchat-colorBrandBackground2Hover)',
|
|
49
|
-
color: 'var(--webchat-colorBrandForeground2Hover)'
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
'&:not([aria-disabled="true"]):active': {
|
|
54
|
-
backgroundColor: 'var(--webchat-colorBrandBackground2Pressed)',
|
|
55
|
-
color: 'var(--webchat-colorBrandForeground2Pressed)'
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
'&[aria-disabled="true"]': {
|
|
59
|
-
color: 'var(--webchat-colorNeutralForegroundDisabled)',
|
|
60
|
-
cursor: 'not-allowed'
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
|
|
64
|
-
'webchat-fluent__suggested-action__image': {
|
|
65
|
-
height: '12px'
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
33
|
function SuggestedAction({
|
|
70
34
|
buttonText,
|
|
71
35
|
className,
|
|
@@ -108,17 +72,13 @@ function SuggestedAction({
|
|
|
108
72
|
|
|
109
73
|
return (
|
|
110
74
|
<AccessibleButton
|
|
111
|
-
className={cx(
|
|
112
|
-
classNames['webchat-fluent__suggested-action'],
|
|
113
|
-
suggestedActionStyleSet + '',
|
|
114
|
-
(className || '') + ''
|
|
115
|
-
)}
|
|
75
|
+
className={cx(classNames['suggested-action'], suggestedActionStyleSet + '', (className || '') + '')}
|
|
116
76
|
disabled={disabled}
|
|
117
77
|
onClick={handleClick}
|
|
118
78
|
ref={focusRef}
|
|
119
79
|
type="button"
|
|
120
80
|
>
|
|
121
|
-
{image && <img alt={imageAlt} className={classNames['
|
|
81
|
+
{image && <img alt={imageAlt} className={classNames['suggested-action__image']} src={image} />}
|
|
122
82
|
<span>{buttonText}</span>
|
|
123
83
|
</AccessibleButton>
|
|
124
84
|
);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
:global(.webchat-fluent) .suggested-actions {
|
|
3
|
+
align-items: flex-end;
|
|
4
|
+
align-self: flex-end;
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 8px;
|
|
8
|
+
|
|
9
|
+
&:not(:empty) {
|
|
10
|
+
padding-block-end: 8px;
|
|
11
|
+
padding-inline-start: 4px
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&.suggested-actions--flow {
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
flex-wrap: wrap;
|
|
17
|
+
justify-content: flex-end;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&.suggested-actions--stacked {
|
|
21
|
+
flex-direction: column
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,36 +1,13 @@
|
|
|
1
1
|
import { hooks } from 'botframework-webchat-component';
|
|
2
2
|
import cx from 'classnames';
|
|
3
3
|
import React, { memo, type ReactNode } from 'react';
|
|
4
|
-
import { useStyles } from '../../styles';
|
|
5
4
|
import SuggestedAction from './SuggestedAction';
|
|
6
5
|
import computeSuggestedActionText from './private/computeSuggestedActionText';
|
|
6
|
+
import styles from './index.module.css';
|
|
7
|
+
import { useStyles } from '../../styles';
|
|
7
8
|
|
|
8
9
|
const { useLocalizer, useStyleOptions, useStyleSet, useSuggestedActions } = hooks;
|
|
9
10
|
|
|
10
|
-
const styles = {
|
|
11
|
-
'webchat-fluent__suggested-actions': {
|
|
12
|
-
alignItems: 'flex-end',
|
|
13
|
-
alignSelf: 'flex-end',
|
|
14
|
-
display: 'flex',
|
|
15
|
-
gap: '8px',
|
|
16
|
-
|
|
17
|
-
'&:not(:empty)': {
|
|
18
|
-
paddingBlockEnd: '8px',
|
|
19
|
-
paddingInlineStart: '4px'
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
'&.webchat-fluent__suggested-actions--flow': {
|
|
23
|
-
flexDirection: 'row',
|
|
24
|
-
flexWrap: 'wrap',
|
|
25
|
-
justifyContent: 'flex-end'
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
'&.webchat-fluent__suggested-actions--stacked': {
|
|
29
|
-
flexDirection: 'column'
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
11
|
function SuggestedActionStackedOrFlowContainer(
|
|
35
12
|
props: Readonly<{
|
|
36
13
|
'aria-label'?: string | undefined;
|
|
@@ -48,11 +25,11 @@ function SuggestedActionStackedOrFlowContainer(
|
|
|
48
25
|
aria-live="polite"
|
|
49
26
|
aria-orientation="vertical"
|
|
50
27
|
className={cx(
|
|
51
|
-
classNames['
|
|
28
|
+
classNames['suggested-actions'],
|
|
52
29
|
suggestedActionsStyleSet + '',
|
|
53
30
|
{
|
|
54
|
-
'
|
|
55
|
-
'
|
|
31
|
+
[classNames['suggested-actions--flow']]: suggestedActionLayout === 'flow',
|
|
32
|
+
[classNames['suggested-actions--stacked']]: suggestedActionLayout !== 'flow'
|
|
56
33
|
},
|
|
57
34
|
props.className
|
|
58
35
|
)}
|
|
@@ -111,7 +88,7 @@ function SuggestedActions() {
|
|
|
111
88
|
return (
|
|
112
89
|
<SuggestedActionStackedOrFlowContainer
|
|
113
90
|
aria-label={localize('SUGGESTED_ACTIONS_LABEL_ALT')}
|
|
114
|
-
className={classNames['
|
|
91
|
+
className={classNames['suggested-actions']}
|
|
115
92
|
>
|
|
116
93
|
{children}
|
|
117
94
|
</SuggestedActionStackedOrFlowContainer>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
:global(.webchat-fluent) .telephone-keypad__button {
|
|
3
|
+
-webkit-user-select: none;
|
|
4
|
+
align-items: center;
|
|
5
|
+
appearance: none;
|
|
6
|
+
/* backgroundColor: isDarkTheme() || isHighContrastTheme() ? black : white, */
|
|
7
|
+
background-color: White;
|
|
8
|
+
border-radius: 100%;
|
|
9
|
+
|
|
10
|
+
/* Whitelabel styles */
|
|
11
|
+
/* border: `solid 1px ${isHighContrastTheme() ? white : isDarkTheme() ? gray160 : gray40}`, */
|
|
12
|
+
/* color: inherit; */
|
|
13
|
+
|
|
14
|
+
border: solid 1px var(--webchat-colorNeutralStroke1);
|
|
15
|
+
color: var(--webchat-colorGray200);
|
|
16
|
+
font-weight: var(--webchat-fontWeightSemibold);
|
|
17
|
+
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
height: 60px;
|
|
22
|
+
opacity: 0.7;
|
|
23
|
+
padding: 0;
|
|
24
|
+
position: relative;
|
|
25
|
+
touch-action: none;
|
|
26
|
+
user-select: none;
|
|
27
|
+
width: 60px;
|
|
28
|
+
|
|
29
|
+
&:hover {
|
|
30
|
+
/* backgroundColor: isHighContrastTheme() ? gray210 : isDarkTheme() ? gray150 : gray30 */
|
|
31
|
+
background-color: var(--webchat-colorGray30)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:global(.webchat-fluent) .telephone-keypad__button__ruby {
|
|
36
|
+
/* color: isHighContrastTheme() ? white : isDarkTheme() ? gray40 : gray160, */
|
|
37
|
+
color: var(--webchat-colorGray190);
|
|
38
|
+
font-size: 10px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:global(.webchat-fluent) .telephone-keypad__button__text {
|
|
42
|
+
font-size: 24px;
|
|
43
|
+
margin-top: 8px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
:global(.webchat-fluent) .telephone-keypad--horizontal {
|
|
47
|
+
& .telephone-keypad__button {
|
|
48
|
+
height: 32px;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
margin: 8px 4px;
|
|
51
|
+
width: 32px;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
.telephone-keypad__button__ruby {
|
|
55
|
+
display: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
& .telephone-keypad__button__text {
|
|
59
|
+
font-size: 20px;
|
|
60
|
+
margin-top: 0;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -2,72 +2,10 @@ import React, { forwardRef, memo, useCallback, type Ref } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { useRefFrom } from 'use-ref-from';
|
|
4
4
|
|
|
5
|
-
import { useStyles } from '../../../styles';
|
|
6
5
|
import { type DTMF } from '../types';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'-webkit-user-select': 'none',
|
|
11
|
-
alignItems: 'center',
|
|
12
|
-
appearance: 'none',
|
|
13
|
-
// backgroundColor: isDarkTheme() || isHighContrastTheme() ? black : white,
|
|
14
|
-
backgroundColor: 'White',
|
|
15
|
-
borderRadius: '100%',
|
|
16
|
-
|
|
17
|
-
// Whitelabel styles
|
|
18
|
-
// border: `solid 1px ${isHighContrastTheme() ? white : isDarkTheme() ? gray160 : gray40}`,
|
|
19
|
-
// color: 'inherit',
|
|
20
|
-
|
|
21
|
-
border: 'solid 1px var(--webchat-colorNeutralStroke1)',
|
|
22
|
-
color: 'var(--webchat-colorGray200)',
|
|
23
|
-
fontWeight: 'var(--webchat-fontWeightSemibold)',
|
|
24
|
-
|
|
25
|
-
cursor: 'pointer',
|
|
26
|
-
display: 'flex',
|
|
27
|
-
flexDirection: 'column',
|
|
28
|
-
height: 60,
|
|
29
|
-
opacity: 0.7,
|
|
30
|
-
padding: 0,
|
|
31
|
-
position: 'relative',
|
|
32
|
-
touchAction: 'none',
|
|
33
|
-
userSelect: 'none',
|
|
34
|
-
width: 60,
|
|
35
|
-
|
|
36
|
-
'&:hover': {
|
|
37
|
-
// backgroundColor: isHighContrastTheme() ? gray210 : isDarkTheme() ? gray150 : gray30
|
|
38
|
-
backgroundColor: 'var(--webchat-colorGray30)'
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
'webchat__telephone-keypad__button__ruby': {
|
|
43
|
-
// color: isHighContrastTheme() ? white : isDarkTheme() ? gray40 : gray160,
|
|
44
|
-
color: 'var(--webchat-colorGray190)',
|
|
45
|
-
fontSize: 10
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
'webchat__telephone-keypad__button__text': {
|
|
49
|
-
fontSize: 24,
|
|
50
|
-
marginTop: 8
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
'webchat__telephone-keypad--horizontal': {
|
|
54
|
-
'& .webchat__telephone-keypad__button': {
|
|
55
|
-
height: 32,
|
|
56
|
-
width: 32,
|
|
57
|
-
margin: '8px 4px',
|
|
58
|
-
justifyContent: 'center'
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
'webchat__telephone-keypad__button__ruby': {
|
|
62
|
-
display: 'none'
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
'& .webchat__telephone-keypad__button__text': {
|
|
66
|
-
fontSize: 20,
|
|
67
|
-
marginTop: 0
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
7
|
+
import styles from './Button.module.css';
|
|
8
|
+
import { useStyles } from '../../../styles';
|
|
71
9
|
|
|
72
10
|
type Props = Readonly<{
|
|
73
11
|
button: DTMF;
|
|
@@ -87,16 +25,16 @@ const Button = memo(
|
|
|
87
25
|
|
|
88
26
|
return (
|
|
89
27
|
<button
|
|
90
|
-
className={classNames['
|
|
28
|
+
className={classNames['telephone-keypad__button']}
|
|
91
29
|
data-testid={dataTestId}
|
|
92
30
|
onClick={handleClick}
|
|
93
31
|
ref={ref}
|
|
94
32
|
type="button"
|
|
95
33
|
>
|
|
96
|
-
<span className={classNames['
|
|
34
|
+
<span className={classNames['telephone-keypad__button__text']}>
|
|
97
35
|
{button === 'star' ? '\u2217' : button === 'pound' ? '#' : button}
|
|
98
36
|
</span>
|
|
99
|
-
{!!ruby && <ruby className={classNames['
|
|
37
|
+
{!!ruby && <ruby className={classNames['telephone-keypad__button__ruby']}>{ruby}</ruby>}
|
|
100
38
|
</button>
|
|
101
39
|
);
|
|
102
40
|
})
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
:global(.webchat-fluent) .telephone-keypad {
|
|
3
|
+
/* Commented out whitelabel styles for now. */
|
|
4
|
+
/* background: getHighContrastDarkThemeColor(highContrastColor: black, darkThemeColor: gray190, string, defaultColor: gray10), */
|
|
5
|
+
/* borderRadius: '8px 8px 0px 0px; */
|
|
6
|
+
/* boxShadow: '-3px 0px 7px 0px rgba(0, 0, 0, 0.13), -0.6px 0px 1.8px 0px rgba(0, 0, 0, 0.10)', */
|
|
7
|
+
|
|
8
|
+
align-items: center;
|
|
9
|
+
background: var(--webchat-colorNeutralBackground1);
|
|
10
|
+
/* border: isHighContrastTheme() ? `1px solid ${white}` : none; */
|
|
11
|
+
border: none;
|
|
12
|
+
border-radius: var(--webchat-borderRadiusXLarge);
|
|
13
|
+
/* boxShadow: var(--shadow16); */
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
font-family: var(--webchat-fontFamilyBase);
|
|
17
|
+
justify-content: center;
|
|
18
|
+
/* margin: var(--spacingHorizontalMNudge)' */
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:global(.webchat-fluent) .telephone-keypad__box {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
display: grid;
|
|
24
|
+
gap: 16px;
|
|
25
|
+
grid-template-columns: repeat(3, 1fr);
|
|
26
|
+
grid-template-rows: repeat(4, 1fr);
|
|
27
|
+
justify-items: center;
|
|
28
|
+
padding: 16px;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:global(.webchat-fluent) .telephone-keypad__info-message {
|
|
33
|
+
align-items: center;
|
|
34
|
+
color: var(--webchat-colorNeutralForeground4);
|
|
35
|
+
display: flex;
|
|
36
|
+
font-size: 12px;
|
|
37
|
+
gap: 6px;
|
|
38
|
+
margin-block-end: 6px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:global(.webchat-fluent) .telephone-keypad__info-message-link {
|
|
42
|
+
color: var(--webchat-colorBrandForegroundLink);
|
|
43
|
+
text-decoration-color: transparent;
|
|
44
|
+
|
|
45
|
+
&:target {
|
|
46
|
+
color: var(--webchat-colorBrandForegroundLinkSelected);
|
|
47
|
+
}
|
|
48
|
+
&:hover {
|
|
49
|
+
color: var(--webchat-colorBrandForegroundLinkHover);
|
|
50
|
+
text-decoration: underline 1px currentColor;
|
|
51
|
+
}
|
|
52
|
+
&:active {
|
|
53
|
+
color: var(--webchat-colorBrandForegroundLinkPressed);
|
|
54
|
+
}
|
|
55
|
+
&:focus-visible {
|
|
56
|
+
outline: none;
|
|
57
|
+
text-decoration: underline 1px double var(--webchat-colorStrokeFocus2);
|
|
58
|
+
}
|
|
59
|
+
}
|