botframework-webchat-fluent-theme 4.17.0-main.20240411.ff34969 → 4.17.0-main.20240416.4ff01ae

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 (47) hide show
  1. package/dist/botframework-webchat-fluent-theme.development.css.map +1 -0
  2. package/dist/botframework-webchat-fluent-theme.development.js +384 -2081
  3. package/dist/botframework-webchat-fluent-theme.development.js.map +1 -1
  4. package/dist/botframework-webchat-fluent-theme.production.min.css.map +1 -0
  5. package/dist/botframework-webchat-fluent-theme.production.min.js +1 -3
  6. package/dist/botframework-webchat-fluent-theme.production.min.js.map +1 -1
  7. package/dist/index.css.map +1 -0
  8. package/dist/index.d.mts +27 -0
  9. package/dist/index.d.ts +27 -0
  10. package/dist/index.js +360 -648
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.mjs +1076 -0
  13. package/dist/index.mjs.map +1 -1
  14. package/package.json +9 -8
  15. package/src/components/Theme.module.css +60 -0
  16. package/src/components/Theme.tsx +4 -64
  17. package/src/components/dropZone/index.module.css +23 -0
  18. package/src/components/dropZone/index.tsx +6 -31
  19. package/src/components/sendbox/AddAttachmentButton.module.css +10 -0
  20. package/src/components/sendbox/AddAttachmentButton.tsx +5 -17
  21. package/src/components/sendbox/Attachments.module.css +7 -0
  22. package/src/components/sendbox/Attachments.tsx +3 -12
  23. package/src/components/sendbox/ErrorMessage.module.css +9 -0
  24. package/src/components/sendbox/ErrorMessage.tsx +2 -13
  25. package/src/components/sendbox/TelephoneKeypadToolbarButton.tsx +1 -1
  26. package/src/components/sendbox/TextArea.module.css +61 -0
  27. package/src/components/sendbox/TextArea.tsx +9 -70
  28. package/src/components/sendbox/Toolbar.module.css +49 -0
  29. package/src/components/sendbox/Toolbar.tsx +4 -55
  30. package/src/components/sendbox/index.module.css +58 -0
  31. package/src/components/sendbox/index.tsx +16 -81
  32. package/src/components/suggestedActions/SuggestedAction.module.css +34 -0
  33. package/src/components/suggestedActions/SuggestedAction.tsx +5 -47
  34. package/src/components/suggestedActions/index.module.css +23 -0
  35. package/src/components/suggestedActions/index.tsx +18 -23
  36. package/src/components/telephoneKeypad/private/Button.module.css +62 -0
  37. package/src/components/telephoneKeypad/private/Button.tsx +5 -67
  38. package/src/components/telephoneKeypad/private/TelephoneKeypad.module.css +30 -0
  39. package/src/components/telephoneKeypad/private/TelephoneKeypad.tsx +4 -35
  40. package/src/env.d.ts +7 -0
  41. package/src/index.ts +3 -0
  42. package/src/styles/injectStyle.ts +9 -0
  43. package/src/styles/useStyles.ts +19 -0
  44. package/src/styles.ts +4 -0
  45. package/src/tsconfig.json +2 -1
  46. package/src/private/useStyleToEmotionObject.ts +0 -32
  47. package/src/styles/index.ts +0 -15
@@ -1,71 +1,11 @@
1
1
  import React, { type ReactNode } from 'react';
2
+ import cx from 'classnames';
3
+ import styles from './Theme.module.css';
2
4
  import { useStyles } from '../styles';
3
5
 
4
- const styles = {
5
- 'webchat-fluent__theme': {
6
- display: 'contents',
7
-
8
- '--webchat-colorNeutralForeground1': 'var(--colorNeutralForeground1, #242424)',
9
- '--webchat-colorNeutralForeground2': 'var(--colorNeutralForeground2, #424242)',
10
- '--webchat-colorNeutralForeground4': 'var(--colorNeutralForeground4, #707070)',
11
-
12
- '--webchat-colorNeutralForegroundDisabled': 'var(--colorNeutralForegroundDisabled, #bdbdbd)',
13
-
14
- '--webchat-colorNeutralBackground1': 'var(--colorNeutralBackground1, #ffffff)',
15
- '--webchat-colorNeutralBackground4': 'var(--colorNeutralBackground4, #f0f0f0)',
16
- '--webchat-colorNeutralBackground5': 'var(--colorNeutralBackground5, #ebebeb)',
17
-
18
- '--webchat-colorSubtleBackgroundHover': 'var(--colorSubtleBackgroundHover, #f5f5f5)',
19
- '--webchat-colorSubtleBackgroundPressed': 'var(--colorSubtleBackgroundPressed, #e0e0e0)',
20
-
21
- '--webchat-colorNeutralStroke1': 'var(--colorNeutralStroke1, #d1d1d1)',
22
- '--webchat-colorNeutralStroke2': 'var(--colorNeutralStroke2, #e0e0e0)',
23
- '--webchat-colorNeutralStroke1Selected': 'var(--colorNeutralStroke1Selected, #bdbdbd)',
24
-
25
- '--webchat-colorBrandStroke2': 'var(--colorBrandStroke2, #9edcf7)',
26
-
27
- '--webchat-colorBrandForeground2Hover': 'var(--colorBrandForeground2Hover, #015a7a)',
28
- '--webchat-colorBrandForeground2Pressed': 'var(--colorBrandForeground2Pressed, #01384d)',
29
-
30
- '--webchat-colorBrandBackground2Hover': 'var(--colorBrandBackground2Hover, #bee7fa)',
31
- '--webchat-colorBrandBackground2Pressed': 'var(--colorBrandBackground2Pressed, #7fd2f5)',
32
-
33
- '--webchat-colorCompoundBrandForeground1': 'var(--colorCompoundBrandForeground1, #077fab)',
34
-
35
- '--webchat-colorCompoundBrandForeground1Hover': 'var(--colorCompoundBrandForeground1Hover, #02729c)',
36
- '--webchat-colorCompoundBrandForeground1Pressed': 'var(--colorCompoundBrandForeground1Pressed, #01678c)',
37
-
38
- '--webchat-colorStatusDangerForeground1': 'var(--colorStatusDangerForeground1, #b10e1c)',
39
-
40
- // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/colors.ts
41
- '--webchat-colorGray30': 'var(--colorGray30, #edebe9)',
42
- '--webchat-colorGray160': 'var(--colorGray160, #323130)',
43
- '--webchat-colorGray200': 'var(--colorGray200, #1b1a19)',
44
-
45
- // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/borderRadius.ts
46
- '--webchat-borderRadiusSmall': 'var(--borderRadiusSmall, 2px)',
47
- '--webchat-borderRadiusLarge': 'var(--borderRadiusLarge, 6px)',
48
- '--webchat-borderRadiusXLarge': 'var(--borderRadiusXLarge, 8px)',
49
-
50
- // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/utils/shadows.ts
51
- '--webchat-shadow16':
52
- '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))',
53
-
54
- // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/spacings.ts
55
- '--webchat-spacingHorizontalMNudge': 'var(--spacingHorizontalMNudge, 10px)',
56
-
57
- // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/fonts.ts
58
- '--webchat-fontFamilyBase': `var(--fontFamilyBase, 'Segoe UI)', 'Segoe UI Web (West European))', -apple-system,
59
- BlinkMacSystemFont, Roboto, 'Helvetica Neue)', sans-serif)`,
60
- '--webchat-fontFamilyNumeric': `var(--fontFamilyNumeric, Bahnschrift, 'Segoe UI)', 'Segoe UI Web (West European))',
61
- -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue)', sans-serif)`,
62
-
63
- // https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/fonts.ts
64
- '--webchat-fontWeightSemibold': 'var(--fontWeightSemibold, 600)'
65
- }
66
- };
6
+ export const rootClassName = 'webchat-fluent';
67
7
 
68
8
  export default function WebchatTheme(props: Readonly<{ readonly children: ReactNode | undefined }>) {
69
9
  const classNames = useStyles(styles);
70
- return <div className={classNames['webchat-fluent__theme']}>{props.children}</div>;
10
+ return <div className={cx(rootClassName, classNames['theme'])}>{props.children}</div>;
71
11
  }
@@ -0,0 +1,23 @@
1
+ :global(.webchat-fluent) .sendbox__attachment-drop-zone {
2
+ background-color: var(--webchat-colorNeutralBackground4);
3
+ border-radius: inherit;
4
+ cursor: copy;
5
+ display: grid;
6
+ gap: 8px;
7
+ inset: 0;
8
+ place-content: center;
9
+ place-items: center;
10
+ position: absolute;
11
+ }
12
+
13
+ :global(.webchat-fluent) .sendbox__attachment-drop-zone--droppable {
14
+ background-color: #e00;
15
+ color: White
16
+ }
17
+
18
+ :global(.webchat-fluent) .sendbox__attachment-drop-zone-icon {
19
+ height: 36px;
20
+ /* Set "pointer-events: none" to ignore dragging over the icon. Otherwise, when dragging over the icon; it would disable the "--droppable" modifier.*/
21
+ pointer-events: none;
22
+ width: 36px
23
+ }
@@ -1,40 +1,15 @@
1
- import { hooks } from 'botframework-webchat-api';
1
+ import { hooks } from 'botframework-webchat-component';
2
2
  import cx from 'classnames';
3
3
  import React, { memo, useCallback, useEffect, useRef, useState, type DragEventHandler } from 'react';
4
4
  import { useRefFrom } from 'use-ref-from';
5
5
 
6
6
  import { AddDocumentIcon } from '../../icons/AddDocumentIcon';
7
- import { useStyles } from '../../styles';
8
7
  import testIds from '../../testIds';
8
+ import styles from './index.module.css';
9
+ import { useStyles } from '../../styles';
9
10
 
10
11
  const { useLocalizer } = hooks;
11
12
 
12
- const styles = {
13
- 'webchat-fluent__sendbox__attachment-drop-zone': {
14
- backgroundColor: 'var(--webchat-colorNeutralBackground4)',
15
- borderRadius: 'inherit',
16
- cursor: 'copy',
17
- display: 'grid',
18
- gap: '8px',
19
- inset: '0',
20
- placeContent: 'center',
21
- placeItems: 'center',
22
- position: 'absolute'
23
- },
24
-
25
- 'webchat-fluent__sendbox__attachment-drop-zone--droppable': {
26
- backgroundColor: '#e00',
27
- color: 'White'
28
- },
29
-
30
- 'webchat-fluent__sendbox__attachment-drop-zone-icon': {
31
- height: '36px',
32
- // Set "pointer-events: none" to ignore dragging over the icon. Otherwise, when dragging over the icon, it would disable the "--droppable" modifier.
33
- pointerEvents: 'none',
34
- width: '36px'
35
- }
36
- };
37
-
38
13
  const handleDragOver: DragEventHandler<HTMLDivElement> = event => {
39
14
  // This is for preventing the browser from opening the dropped file in a new tab.
40
15
  event.preventDefault();
@@ -113,15 +88,15 @@ const DropZone = (props: { readonly onFilesAdded: (files: File[]) => void }) =>
113
88
 
114
89
  return dropZoneState ? (
115
90
  <div
116
- className={cx(classNames['webchat-fluent__sendbox__attachment-drop-zone'], {
117
- [classNames['webchat-fluent__sendbox__attachment-drop-zone--droppable']]: dropZoneState === 'droppable'
91
+ className={cx(classNames['sendbox__attachment-drop-zone'], {
92
+ [classNames['sendbox__attachment-drop-zone--droppable']]: dropZoneState === 'droppable'
118
93
  })}
119
94
  data-testid={testIds.sendBoxDropZone}
120
95
  onDragOver={handleDragOver}
121
96
  onDrop={handleDrop}
122
97
  ref={dropZoneRef}
123
98
  >
124
- <AddDocumentIcon className={classNames['webchat-fluent__sendbox__attachment-drop-zone-icon']} />
99
+ <AddDocumentIcon className={classNames['sendbox__attachment-drop-zone-icon']} />
125
100
  {localize('TEXT_INPUT_DROP_ZONE')}
126
101
  </div>
127
102
  ) : null;
@@ -0,0 +1,10 @@
1
+ :global(.webchat-fluent) .sendbox__add-attachment {
2
+ display: grid
3
+ }
4
+
5
+ :global(.webchat-fluent) .sendbox__add-attachment-input {
6
+ font-size: 0;
7
+ height: 0;
8
+ opacity: 0;
9
+ width: 0;
10
+ }
@@ -1,26 +1,14 @@
1
- import { hooks } from 'botframework-webchat-api';
1
+ import { hooks } from 'botframework-webchat-component';
2
2
  import React, { useCallback, useRef, type ChangeEventHandler, memo } from 'react';
3
3
  import { useRefFrom } from 'use-ref-from';
4
4
  import { AttachmentIcon } from '../../icons/AttachmentIcon';
5
- import { useStyles } from '../../styles';
6
5
  import testIds from '../../testIds';
7
6
  import { ToolbarButton } from './Toolbar';
7
+ import styles from './AddAttachmentButton.module.css';
8
+ import { useStyles } from '../../styles';
8
9
 
9
10
  const { useLocalizer, useStyleOptions } = hooks;
10
11
 
11
- const styles = {
12
- 'webchat-fluent__sendbox__add-attachment': {
13
- display: 'grid'
14
- },
15
-
16
- 'webchat-fluent__sendbox__add-attachment-input': {
17
- fontSize: 0,
18
- height: 0,
19
- opacity: 0,
20
- width: 0
21
- }
22
- };
23
-
24
12
  function AddAttachmentButton(
25
13
  props: Readonly<{
26
14
  disabled?: boolean | undefined;
@@ -49,12 +37,12 @@ function AddAttachmentButton(
49
37
  );
50
38
 
51
39
  return (
52
- <div className={classNames['webchat-fluent__sendbox__add-attachment']}>
40
+ <div className={classNames['sendbox__add-attachment']}>
53
41
  <input
54
42
  accept={uploadAccept}
55
43
  aria-disabled={props.disabled}
56
44
  aria-hidden="true"
57
- className={classNames['webchat-fluent__sendbox__add-attachment-input']}
45
+ className={classNames['sendbox__add-attachment-input']}
58
46
  multiple={uploadMultiple}
59
47
  onInput={props.disabled ? undefined : handleFileChange}
60
48
  readOnly={props.disabled}
@@ -0,0 +1,7 @@
1
+ :global(.webchat-fluent) .sendbox__attachment {
2
+ border-radius: var(--webchat-borderRadiusLarge);
3
+ border: 1px solid var(--webchat-colorNeutralStroke1);
4
+ cursor: default;
5
+ padding: 6px 8px;
6
+ width: fit-content
7
+ }
@@ -1,19 +1,10 @@
1
- import { hooks } from 'botframework-webchat-api';
1
+ import { hooks } from 'botframework-webchat-component';
2
2
  import React, { memo } from 'react';
3
+ import styles from './Attachments.module.css';
3
4
  import { useStyles } from '../../styles';
4
5
 
5
6
  const { useLocalizer } = hooks;
6
7
 
7
- const styles = {
8
- 'webchat-fluent__sendbox__attachment': {
9
- border: '1px solid var(--webchat-colorNeutralStroke1)',
10
- borderRadius: 'var(--webchat-borderRadiusLarge)',
11
- cursor: 'default',
12
- padding: '6px 8px',
13
- width: 'fit-content'
14
- }
15
- };
16
-
17
8
  const attachmentsPluralStringIds = {
18
9
  one: 'TEXT_INPUT_ATTACHMENTS_ONE',
19
10
  two: 'TEXT_INPUT_ATTACHMENTS_TWO',
@@ -31,7 +22,7 @@ function Attachments({
31
22
  const localizeWithPlural = useLocalizer({ plural: true });
32
23
 
33
24
  return attachments.length ? (
34
- <div className={classNames['webchat-fluent__sendbox__attachment']}>
25
+ <div className={classNames['sendbox__attachment']}>
35
26
  {localizeWithPlural(attachmentsPluralStringIds, attachments.length)}
36
27
  </div>
37
28
  ) : null;
@@ -0,0 +1,9 @@
1
+ :global(.webchat-fluent) .sendbox__error-message {
2
+ color: transparent;
3
+ font-size: 0;
4
+ height: 0;
5
+ left: 0;
6
+ position: absolute;
7
+ top: 0;
8
+ width: 0;
9
+ }
@@ -1,23 +1,12 @@
1
1
  import React, { memo } from 'react';
2
+ import styles from './ErrorMessage.module.css';
2
3
  import { useStyles } from '../../styles';
3
4
 
4
- const styles = {
5
- 'webchat-fluent___sendbox__error-message': {
6
- fontSize: 0,
7
- height: 0,
8
- width: 0,
9
- position: 'absolute',
10
- top: 0,
11
- left: 0,
12
- color: 'transparent'
13
- }
14
- };
15
-
16
5
  function ErrorMessage(props: Readonly<{ id: string; error?: string | undefined }>) {
17
6
  const classNames = useStyles(styles);
18
7
  return (
19
8
  // eslint-disable-next-line react/forbid-dom-props
20
- <span className={classNames['webchat-fluent___sendbox__error-message']} id={props.id} role="alert">
9
+ <span className={classNames['sendbox__error-message']} id={props.id} role="alert">
21
10
  {props.error}
22
11
  </span>
23
12
  );
@@ -1,6 +1,6 @@
1
1
  import React, { memo, useCallback } from 'react';
2
2
 
3
- import { hooks } from 'botframework-webchat-api';
3
+ import { hooks } from 'botframework-webchat-component';
4
4
  import { TelephoneKeypadIcon } from '../../icons/TelephoneKeypad';
5
5
  import testIds from '../../testIds';
6
6
  import { useTelephoneKeypadShown } from '../TelephoneKeypad';
@@ -0,0 +1,61 @@
1
+ :global(.webchat-fluent) .sendbox__text-area {
2
+ display: grid;
3
+ grid-template-areas: 'main';
4
+ max-height: 200px;
5
+ overflow: hidden;
6
+ }
7
+
8
+ :global(.webchat-fluent) .sendbox__text-area--hidden {
9
+ /* TODO: Not perfect way of hiding the text box. */
10
+ height: 0;
11
+ visibility: collapse;
12
+ }
13
+
14
+ :global(.webchat-fluent) .sendbox__text-area-shared {
15
+ border: none;
16
+ font: inherit;
17
+ grid-area: main;
18
+ outline: inherit;
19
+ overflow-wrap: anywhere;
20
+ resize: inherit;
21
+ scrollbar-gutter: stable;
22
+ }
23
+
24
+ :global(.webchat-fluent) .sendbox__text-area-doppelganger {
25
+ overflow: hidden;
26
+ visibility: hidden;
27
+ white-space: pre-wrap;
28
+ }
29
+
30
+ :global(.webchat-fluent) .sendbox__text-area-input {
31
+ height: 100%;
32
+ padding: 0
33
+ }
34
+
35
+ :global(.webchat-fluent) .sendbox__text-area-input--scroll {
36
+ /* Edge uses -webkit-scrollbar if scrollbar-* is not set */
37
+ scrollbar-color: unset;
38
+ scrollbar-width: unset;
39
+ /* Firefox */
40
+ -moz-scrollbar-color: var(--webchat-colorNeutralBackground5) var(--webchat-colorNeutralForeground2);
41
+ -moz-scrollbar-width: thin;
42
+
43
+ /* Chrome, Edge, and Safari */
44
+ &::-webkit-scrollbar {
45
+ width: 8px
46
+ }
47
+
48
+ &::-webkit-scrollbar-track {
49
+ background-color: var(--webchat-colorNeutralBackground5);
50
+ border-radius: 16px
51
+ }
52
+
53
+ &::-webkit-scrollbar-thumb {
54
+ background-color: var(--webchat-colorNeutralForeground2);
55
+ border-radius: 16px
56
+ }
57
+
58
+ &::-webkit-scrollbar-corner {
59
+ background-color: var(--webchat-colorNeutralBackground5);
60
+ }
61
+ }
@@ -1,68 +1,7 @@
1
1
  import cx from 'classnames';
2
2
  import React, { forwardRef, useCallback, type FormEventHandler, type KeyboardEventHandler } from 'react';
3
-
4
3
  import { useStyles } from '../../styles';
5
-
6
- const styles = {
7
- 'webchat-fluent__sendbox__text-area': {
8
- display: 'grid',
9
- gridTemplateAreas: `'main'`,
10
- maxHeight: '200px',
11
- overflow: 'hidden'
12
- },
13
-
14
- 'webchat-fluent__sendbox__text-area--hidden': {
15
- // TODO: Not perfect way of hiding the text box.
16
- height: 0,
17
- visibility: 'collapse'
18
- },
19
-
20
- 'webchat-fluent__sendbox__text-area-shared': {
21
- border: 'none',
22
- font: 'inherit',
23
- gridArea: 'main',
24
- outline: 'inherit',
25
- overflowWrap: 'anywhere',
26
- resize: 'inherit',
27
- scrollbarGutter: 'stable'
28
- },
29
-
30
- 'webchat-fluent__sendbox__text-area-doppelganger': {
31
- overflow: 'hidden',
32
- visibility: 'hidden',
33
- whiteSpace: 'pre-wrap'
34
- },
35
-
36
- 'webchat-fluent__sendbox__text-area-input': {
37
- height: '100%',
38
- padding: 0
39
- },
40
-
41
- 'webchat-fluent__sendbox__text-area-input--scroll': {
42
- /* Firefox */
43
- MozScrollbarColor: 'var(--webchat-colorNeutralBackground5) var(--webchat-colorNeutralForeground2)',
44
- MozScrollbarWidth: 'thin',
45
-
46
- /* Chrome, Edge, and Safari */
47
- '&::-webkit-scrollbar': {
48
- width: '8px'
49
- },
50
-
51
- '&::-webkit-scrollbar-track': {
52
- backgroundColor: ' var(--webchat-colorNeutralBackground5)',
53
- borderRadius: '16px'
54
- },
55
-
56
- '&::-webkit-scrollbar-thumb': {
57
- backgroundColor: 'var(--webchat-colorNeutralForeground2)',
58
- borderRadius: '16px'
59
- },
60
-
61
- '&::-webkit-scrollbar-corner': {
62
- backgroundColor: 'var(--webchat-colorNeutralBackground5)'
63
- }
64
- }
65
- };
4
+ import styles from './TextArea.module.css';
66
5
 
67
6
  const TextArea = forwardRef<
68
7
  HTMLTextAreaElement,
@@ -103,9 +42,9 @@ const TextArea = forwardRef<
103
42
  return (
104
43
  <div
105
44
  className={cx(
106
- classNames['webchat-fluent__sendbox__text-area'],
45
+ classNames['sendbox__text-area'],
107
46
  {
108
- [classNames['webchat-fluent__sendbox__text-area--hidden']]: props.hidden
47
+ [classNames['sendbox__text-area--hidden']]: props.hidden
109
48
  },
110
49
  props.className
111
50
  )}
@@ -113,9 +52,9 @@ const TextArea = forwardRef<
113
52
  >
114
53
  <div
115
54
  className={cx(
116
- classNames['webchat-fluent__sendbox__text-area-doppelganger'],
117
- classNames['webchat-fluent__sendbox__text-area-shared'],
118
- classNames['webchat-fluent__sendbox__text-area-input--scroll']
55
+ classNames['sendbox__text-area-doppelganger'],
56
+ classNames['sendbox__text-area-shared'],
57
+ classNames['sendbox__text-area-input--scroll']
119
58
  )}
120
59
  >
121
60
  {props.value || props.placeholder}{' '}
@@ -123,9 +62,9 @@ const TextArea = forwardRef<
123
62
  <textarea
124
63
  aria-label={props['aria-label']}
125
64
  className={cx(
126
- classNames['webchat-fluent__sendbox__text-area-input'],
127
- classNames['webchat-fluent__sendbox__text-area-shared'],
128
- classNames['webchat-fluent__sendbox__text-area-input--scroll']
65
+ classNames['sendbox__text-area-input'],
66
+ classNames['sendbox__text-area-shared'],
67
+ classNames['sendbox__text-area-input--scroll']
129
68
  )}
130
69
  data-testid={props['data-testid']}
131
70
  onInput={props.onInput}
@@ -0,0 +1,49 @@
1
+ :global(.webchat-fluent) .sendbox__toolbar {
2
+ display: flex;
3
+ gap: 4px;
4
+ margin-inline-start: auto;
5
+ }
6
+
7
+ :global(.webchat-fluent) .sendbox__toolbar-button {
8
+ align-items: center;
9
+ appearance: none;
10
+ aspect-ratio: 1;
11
+ background: transparent;
12
+ border-radius: var(--webchat-borderRadiusSmall);
13
+ border: none;
14
+ cursor: pointer;
15
+ display: flex;
16
+ justify-content: center;
17
+ padding: 3px;
18
+ width: 32px;
19
+
20
+ > svg {
21
+ font-size: 20px;
22
+ pointer-events: none;
23
+ }
24
+
25
+ @media (hover: hover) {
26
+ &:not([aria-disabled="true"]):hover {
27
+ background-color: var(--webchat-colorSubtleBackgroundHover);
28
+ color: var(--webchat-colorCompoundBrandForeground1Hover);
29
+ }
30
+ }
31
+ &:not([aria-disabled="true"]):active {
32
+ background-color: var(--webchat-colorSubtleBackgroundPressed);
33
+ color: var(--webchat-colorCompoundBrandForeground1Pressed);
34
+ }
35
+ &[aria-disabled="true"] {
36
+ color: var(--webchat-colorNeutralForegroundDisabled);
37
+ cursor: not-allowed;
38
+ }
39
+ }
40
+
41
+ :global(.webchat-fluent) .sendbox__toolbar-separator {
42
+ align-self: center;
43
+ border-inline-end: 1px solid var(--webchat-colorNeutralStroke2);
44
+ height: 28px;
45
+
46
+ &:first-child, &:last-child, &:only-child {
47
+ display: none
48
+ }
49
+ }
@@ -1,59 +1,8 @@
1
1
  import cx from 'classnames';
2
2
  import React, { memo, type MouseEventHandler, type ReactNode } from 'react';
3
+ import styles from './Toolbar.module.css';
3
4
  import { useStyles } from '../../styles';
4
5
 
5
- const styles = {
6
- 'webchat-fluent__sendbox__toolbar': {
7
- display: 'flex',
8
- gap: '4px',
9
- marginInlineStart: 'auto'
10
- },
11
-
12
- 'webchat-fluent__sendbox__toolbar-button': {
13
- alignItems: 'center',
14
- appearance: 'none',
15
- aspectRatio: '1',
16
- background: 'transparent',
17
- border: 'none',
18
- borderRadius: 'var(--webchat-borderRadiusSmall)',
19
- cursor: 'pointer',
20
- display: 'flex',
21
- justifyContent: 'center',
22
- padding: '3px',
23
- width: '32px',
24
-
25
- '> svg': {
26
- fontSize: '20px',
27
- pointerEvents: 'none'
28
- },
29
-
30
- '@media (hover: hover)': {
31
- '&:not([aria-disabled="true"]):hover': {
32
- backgroundColor: 'var(--webchat-colorSubtleBackgroundHover)',
33
- color: 'var(--webchat-colorCompoundBrandForeground1Hover)'
34
- }
35
- },
36
- '&:not([aria-disabled="true"]):active': {
37
- backgroundColor: 'var(--webchat-colorSubtleBackgroundPressed)',
38
- color: 'var(--webchat-colorCompoundBrandForeground1Pressed)'
39
- },
40
- '&[aria-disabled="true"]': {
41
- color: ' var(--webchat-colorNeutralForegroundDisabled)',
42
- cursor: 'not-allowed'
43
- }
44
- },
45
-
46
- 'webchat-fluent__sendbox__toolbar-separator': {
47
- alignSelf: 'center',
48
- borderInlineEnd: '1px solid var(--webchat-colorNeutralStroke2)',
49
- height: '28px',
50
-
51
- '&:first-child, &:last-child, &:only-child': {
52
- display: 'none'
53
- }
54
- }
55
- };
56
-
57
6
  const preventDefaultHandler: MouseEventHandler<HTMLButtonElement> = event => event.preventDefault();
58
7
 
59
8
  export const ToolbarButton = memo(
@@ -73,7 +22,7 @@ export const ToolbarButton = memo(
73
22
  return (
74
23
  <button
75
24
  aria-label={props['aria-label']}
76
- className={cx(classNames['webchat-fluent__sendbox__toolbar-button'], props.className)}
25
+ className={cx(classNames['sendbox__toolbar-button'], props.className)}
77
26
  data-testid={props['data-testid']}
78
27
  onClick={props.disabled ? preventDefaultHandler : props.onClick}
79
28
  type={props.type === 'submit' ? 'submit' : 'button'}
@@ -93,7 +42,7 @@ ToolbarButton.displayName = 'ToolbarButton';
93
42
  export const Toolbar = memo((props: Readonly<{ children?: ReactNode | undefined; className?: string | undefined }>) => {
94
43
  const classNames = useStyles(styles);
95
44
 
96
- return <div className={cx(classNames['webchat-fluent__sendbox__toolbar'], props.className)}>{props.children}</div>;
45
+ return <div className={cx(classNames['sendbox__toolbar'], props.className)}>{props.children}</div>;
97
46
  });
98
47
 
99
48
  Toolbar.displayName = 'Toolbar';
@@ -105,7 +54,7 @@ export const ToolbarSeparator = memo(
105
54
  return (
106
55
  <div
107
56
  aria-orientation="vertical"
108
- className={cx(classNames['webchat-fluent__sendbox__toolbar-separator'], props.className)}
57
+ className={cx(classNames['sendbox__toolbar-separator'], props.className)}
109
58
  role="separator"
110
59
  />
111
60
  );
@@ -0,0 +1,58 @@
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
+
8
+ :global(.webchat-fluent) .sendbox__sendbox {
9
+ background-color: var(--webchat-colorNeutralBackground1);
10
+ border-radius: var(--webchat-borderRadiusLarge);
11
+ border: 1px solid var(--webchat-colorNeutralStroke1);
12
+ display: grid;
13
+ font-family: var(--webchat-fontFamilyBase);
14
+ font-size: 14px;
15
+ gap: 6px;
16
+ line-height: 20px;
17
+ padding: 8px;
18
+ position: relative;
19
+
20
+ &:focus-within {
21
+ border-color: var(--webchat-colorNeutralStroke1Selected);
22
+ /* TODO clarify with design the color:
23
+ - Teams is using colorCompoundBrandForeground1
24
+ - Fluent is using colorCompoundBrandStroke
25
+ - we are using colorCompoundBrandForeground1Hover */
26
+ box-shadow: inset 0 -6px 0 -3px var(--webchat-colorCompoundBrandForeground1Hover);
27
+ }
28
+ }
29
+
30
+ :global(.webchat-fluent) .sendbox__sendbox-text {
31
+ background-color: transparent;
32
+ border: none;
33
+ flex: auto;
34
+ font-family: var(--webchat-fontFamilyBase);
35
+ font-size: 14px;
36
+ line-height: 20px;
37
+ outline: none;
38
+ padding: 4px 4px 0;
39
+ resize: none;
40
+ }
41
+
42
+ :global(.webchat-fluent) .sendbox__sendbox-controls {
43
+ align-items: center;
44
+ display: flex;
45
+ padding-inline-start: 4px;
46
+ }
47
+
48
+ :global(.webchat-fluent) .sendbox__text-counter {
49
+ color: var(--webchat-colorNeutralForeground4);
50
+ cursor: default;
51
+ font-family: var(--webchat-fontFamilyNumeric);
52
+ font-size: 10px;
53
+ line-height: 14px;
54
+ }
55
+
56
+ :global(.webchat-fluent) .sendbox__text-counter--error {
57
+ color: var(--webchat-colorStatusDangerForeground1);
58
+ }