botframework-webchat-fluent-theme 4.17.0-main.20240416.4ff01ae → 4.17.0-main.20240419.2240f2a

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.
Files changed (28) hide show
  1. package/dist/botframework-webchat-fluent-theme.development.css.map +1 -1
  2. package/dist/botframework-webchat-fluent-theme.development.js +278 -237
  3. package/dist/botframework-webchat-fluent-theme.development.js.map +1 -1
  4. package/dist/botframework-webchat-fluent-theme.production.min.css.map +1 -1
  5. package/dist/botframework-webchat-fluent-theme.production.min.js +1 -1
  6. package/dist/botframework-webchat-fluent-theme.production.min.js.map +1 -1
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.js +216 -177
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +160 -121
  11. package/dist/index.mjs.map +1 -1
  12. package/package.json +4 -4
  13. package/src/components/Theme.module.css +11 -6
  14. package/src/components/sendbox/Attachments.tsx +5 -2
  15. package/src/components/sendbox/TelephoneKeypadToolbarButton.tsx +2 -1
  16. package/src/components/sendbox/TextArea.module.css +3 -1
  17. package/src/components/sendbox/Toolbar.module.css +6 -4
  18. package/src/components/sendbox/Toolbar.tsx +4 -1
  19. package/src/components/sendbox/index.module.css +28 -0
  20. package/src/components/sendbox/index.tsx +11 -10
  21. package/src/components/suggestedActions/SuggestedAction.module.css +1 -0
  22. package/src/components/telephoneKeypad/private/TelephoneKeypad.module.css +29 -0
  23. package/src/components/telephoneKeypad/private/TelephoneKeypad.tsx +15 -2
  24. package/src/icons/AddDocumentIcon.tsx +0 -1
  25. package/src/icons/AttachmentIcon.tsx +0 -1
  26. package/src/icons/InfoSmallIcon.tsx +17 -0
  27. package/src/icons/SendIcon.tsx +0 -1
  28. package/src/icons/TelephoneKeypad.tsx +0 -1
@@ -11,6 +11,7 @@
11
11
  background: transparent;
12
12
  border-radius: var(--webchat-borderRadiusSmall);
13
13
  border: none;
14
+ color: currentColor;
14
15
  cursor: pointer;
15
16
  display: flex;
16
17
  justify-content: center;
@@ -22,15 +23,16 @@
22
23
  pointer-events: none;
23
24
  }
24
25
 
26
+ &.sendbox__toolbar-button--selected {
27
+ color: var(--webchat-colorNeutralForeground2BrandSelected);
28
+ }
25
29
  @media (hover: hover) {
26
30
  &:not([aria-disabled="true"]):hover {
27
- background-color: var(--webchat-colorSubtleBackgroundHover);
28
- color: var(--webchat-colorCompoundBrandForeground1Hover);
31
+ color: var(--webchat-colorNeutralForeground2BrandHover);
29
32
  }
30
33
  }
31
34
  &:not([aria-disabled="true"]):active {
32
- background-color: var(--webchat-colorSubtleBackgroundPressed);
33
- color: var(--webchat-colorCompoundBrandForeground1Pressed);
35
+ color: var(--webchat-colorNeutralForeground2BrandPressed);
34
36
  }
35
37
  &[aria-disabled="true"] {
36
38
  color: var(--webchat-colorNeutralForegroundDisabled);
@@ -14,6 +14,7 @@ export const ToolbarButton = memo(
14
14
  'data-testid'?: string | undefined;
15
15
  disabled?: boolean | undefined;
16
16
  onClick?: MouseEventHandler<HTMLButtonElement> | undefined;
17
+ selected?: boolean | undefined;
17
18
  type?: 'button' | 'submit' | undefined;
18
19
  }>
19
20
  ) => {
@@ -22,7 +23,9 @@ export const ToolbarButton = memo(
22
23
  return (
23
24
  <button
24
25
  aria-label={props['aria-label']}
25
- className={cx(classNames['sendbox__toolbar-button'], props.className)}
26
+ className={cx(classNames['sendbox__toolbar-button'], props.className, {
27
+ [classNames['sendbox__toolbar-button--selected']]: props.selected
28
+ })}
26
29
  data-testid={props['data-testid']}
27
30
  onClick={props.disabled ? preventDefaultHandler : props.onClick}
28
31
  type={props.type === 'submit' ? 'submit' : 'button'}
@@ -3,6 +3,8 @@
3
3
  font-family: var(--webchat-fontFamilyBase);
4
4
  padding: 0 10px 10px;
5
5
  text-rendering: optimizeLegibility;
6
+
7
+ --webchat-sendbox-attachment-area-active: ;
6
8
  }
7
9
 
8
10
  :global(.webchat-fluent) .sendbox__sendbox {
@@ -13,10 +15,19 @@
13
15
  font-family: var(--webchat-fontFamilyBase);
14
16
  font-size: 14px;
15
17
  gap: 6px;
18
+ grid-template:
19
+ [telephone-keypad-start] 'text-area' [telephone-keypad-end]
20
+ var(--webchat-sendbox-attachment-area-active)
21
+ 'controls' / [telephone-keypad] 1fr
22
+ ;
16
23
  line-height: 20px;
17
24
  padding: 8px;
18
25
  position: relative;
19
26
 
27
+ &:has(.sendbox__attachment--in-grid) {
28
+ --webchat-sendbox-attachment-area-active: 'attachment'
29
+ }
30
+
20
31
  &:focus-within {
21
32
  border-color: var(--webchat-colorNeutralStroke1Selected);
22
33
  /* TODO clarify with design the color:
@@ -25,6 +36,22 @@
25
36
  - we are using colorCompoundBrandForeground1Hover */
26
37
  box-shadow: inset 0 -6px 0 -3px var(--webchat-colorCompoundBrandForeground1Hover);
27
38
  }
39
+
40
+ > .sendbox__text-area--in-grid {
41
+ grid-area: text-area;
42
+ }
43
+
44
+ > .sendbox__attachment--in-grid {
45
+ grid-area: attachment;
46
+ }
47
+
48
+ > .sendbox__sendbox-controls--in-grid {
49
+ grid-area: controls;
50
+ }
51
+
52
+ > .sendbox__telephone-keypad--in-grid {
53
+ grid-area: telephone-keypad;
54
+ }
28
55
  }
29
56
 
30
57
  :global(.webchat-fluent) .sendbox__sendbox-text {
@@ -51,6 +78,7 @@
51
78
  font-family: var(--webchat-fontFamilyNumeric);
52
79
  font-size: 10px;
53
80
  line-height: 14px;
81
+ margin-inline-end: 4px;
54
82
  }
55
83
 
56
84
  :global(.webchat-fluent) .sendbox__text-counter--error {
@@ -119,14 +119,9 @@ function SendBox(
119
119
  <form {...aria} className={cx(classNames['sendbox'], props.className)} onSubmit={handleFormSubmit}>
120
120
  <SuggestedActions />
121
121
  <div className={cx(classNames['sendbox__sendbox'])} onClickCapture={handleSendBoxClick}>
122
- <TelephoneKeypadSurrogate
123
- autoFocus={true}
124
- isHorizontal={false}
125
- onButtonClick={handleTelephoneKeypadButtonClick}
126
- />
127
122
  <TextArea
128
123
  aria-label={isMessageLengthExceeded ? localize('TEXT_INPUT_LENGTH_EXCEEDED_ALT') : localize('TEXT_INPUT_ALT')}
129
- className={classNames['sendbox__sendbox-text']}
124
+ className={cx(classNames['sendbox__sendbox-text'], classNames['sendbox__text-area--in-grid'])}
130
125
  data-testid={testIds.sendBoxTextBox}
131
126
  hidden={telephoneKeypadShown}
132
127
  onInput={handleMessageChange}
@@ -134,9 +129,15 @@ function SendBox(
134
129
  ref={inputRef}
135
130
  value={message}
136
131
  />
137
- <Attachments attachments={attachments} />
138
- <div className={cx(classNames['sendbox__sendbox-controls'])}>
139
- {maxMessageLength && (
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 && (
140
141
  <div
141
142
  className={cx(classNames['sendbox__text-counter'], {
142
143
  [classNames['sendbox__text-counter--error']]: isMessageLengthExceeded
@@ -152,7 +153,7 @@ function SendBox(
152
153
  <ToolbarButton
153
154
  aria-label={localize('TEXT_INPUT_SEND_BUTTON_ALT')}
154
155
  data-testid={testIds.sendBoxSendButton}
155
- disabled={isMessageLengthExceeded}
156
+ disabled={isMessageLengthExceeded || telephoneKeypadShown}
156
157
  type="submit"
157
158
  >
158
159
  <SendIcon />
@@ -3,6 +3,7 @@
3
3
  background: transparent;
4
4
  border-radius: 8px;
5
5
  border: 1px solid var(--webchat-colorBrandStroke2);
6
+ color: currentColor;
6
7
  cursor: pointer;
7
8
  display: flex;
8
9
  font-size: 12px;
@@ -28,3 +28,32 @@
28
28
  padding: 16px;
29
29
  width: 100%;
30
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
+ }
@@ -1,5 +1,7 @@
1
1
  import React, { KeyboardEventHandler, memo, useCallback, useEffect, useRef, type ReactNode } from 'react';
2
+ import cx from 'classnames';
2
3
  import { useRefFrom } from 'use-ref-from';
4
+ import { Components } from 'botframework-webchat-component';
3
5
 
4
6
  import Button from './Button';
5
7
  // import HorizontalDialPadController from './HorizontalDialPadController';
@@ -8,9 +10,13 @@ import { type DTMF } from '../types';
8
10
  import useShown from '../useShown';
9
11
  import styles from './TelephoneKeypad.module.css';
10
12
  import { useStyles } from '../../../styles';
13
+ import InfoSmallIcon from '../../../icons/InfoSmallIcon';
14
+
15
+ const { LocalizedString } = Components;
11
16
 
12
17
  type Props = Readonly<{
13
18
  autoFocus?: boolean | undefined;
19
+ className?: string | undefined;
14
20
  isHorizontal: boolean;
15
21
  onButtonClick: (button: DTMF) => void;
16
22
  }>;
@@ -30,7 +36,7 @@ const Orientation = memo(
30
36
 
31
37
  Orientation.displayName = 'TelephoneKeypad:Orientation';
32
38
 
33
- const TelephoneKeypad = memo(({ autoFocus, onButtonClick, isHorizontal }: Props) => {
39
+ const TelephoneKeypad = memo(({ autoFocus, className, onButtonClick, isHorizontal }: Props) => {
34
40
  const autoFocusRef = useRefFrom(autoFocus);
35
41
  const classNames = useStyles(styles);
36
42
  const firstButtonRef = useRef<HTMLButtonElement>(null);
@@ -64,7 +70,7 @@ const TelephoneKeypad = memo(({ autoFocus, onButtonClick, isHorizontal }: Props)
64
70
  }, [autoFocusRef, firstButtonRef]);
65
71
 
66
72
  return (
67
- <div className={classNames['telephone-keypad']} onKeyDown={handleKeyDown}>
73
+ <div className={cx(classNames['telephone-keypad'], className)} onKeyDown={handleKeyDown}>
68
74
  <Orientation isHorizontal={isHorizontal}>
69
75
  <Button
70
76
  button="1"
@@ -128,6 +134,13 @@ const TelephoneKeypad = memo(({ autoFocus, onButtonClick, isHorizontal }: Props)
128
134
  onClick={handleButtonPoundClick}
129
135
  />
130
136
  </Orientation>
137
+ <div className={classNames['telephone-keypad__info-message']}>
138
+ <InfoSmallIcon />
139
+ <LocalizedString
140
+ linkClassName={classNames['telephone-keypad__info-message-link']}
141
+ stringIds="TELEPHONE_KEYPAD_INPUT_MESSAGE"
142
+ />
143
+ </div>
131
144
  </div>
132
145
  );
133
146
  });
@@ -5,7 +5,6 @@ export function AddDocumentIcon(props: Readonly<{ readonly className?: string }>
5
5
  <svg
6
6
  aria-hidden="true"
7
7
  className={props.className}
8
- fill="currentColor"
9
8
  height="1em"
10
9
  viewBox="0 0 20 20"
11
10
  width="1em"
@@ -5,7 +5,6 @@ export function AttachmentIcon(props: Readonly<{ readonly className?: string }>)
5
5
  <svg
6
6
  aria-hidden="true"
7
7
  className={props.className}
8
- fill="currentColor"
9
8
  height="1em"
10
9
  viewBox="0 0 20 20"
11
10
  width="1em"
@@ -0,0 +1,17 @@
1
+ import React, { memo } from 'react';
2
+
3
+ export default memo((props: Readonly<{ readonly className?: string }>) => (
4
+ <svg
5
+ aria-hidden="true"
6
+ className={props.className}
7
+ height="1em"
8
+ viewBox="0 0 16 16"
9
+ width="1em"
10
+ xmlns="http://www.w3.org/2000/svg"
11
+ >
12
+ <path
13
+ d="M8.5 7.5a.5.5 0 1 0-1 0v3a.5.5 0 0 0 1 0v-3Zm.25-2a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1ZM2 8a6 6 0 1 1 12 0A6 6 0 0 1 2 8Z"
14
+ fill="currentColor"
15
+ />
16
+ </svg>
17
+ ));
@@ -5,7 +5,6 @@ export function SendIcon(props: Readonly<{ readonly className?: string }>) {
5
5
  <svg
6
6
  aria-hidden="true"
7
7
  className={props.className}
8
- fill="currentColor"
9
8
  height="1em"
10
9
  viewBox="0 0 20 20"
11
10
  width="1em"
@@ -5,7 +5,6 @@ export function TelephoneKeypadIcon(props: Readonly<{ readonly className?: strin
5
5
  <svg
6
6
  aria-hidden="true"
7
7
  className={props.className}
8
- fill="currentColor"
9
8
  height="1em"
10
9
  viewBox="0 0 20 20"
11
10
  width="1em"