botframework-webchat-fluent-theme 4.17.0-main.20240411.ff34969 → 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.
@@ -2,10 +2,10 @@ 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 AccessibleButton from './AccessibleButton';
6
5
  import { useStyles } from '../../styles';
6
+ import AccessibleButton from './AccessibleButton';
7
7
 
8
- const { useScrollToEnd, useStyleSet, usePerformCardAction, useFocus, useSuggestedActions, useDisabled } = hooks;
8
+ const { useDisabled, useFocus, usePerformCardAction, useScrollToEnd, useStyleSet, useSuggestedActions } = hooks;
9
9
 
10
10
  type SuggestedActionProps = Readonly<{
11
11
  buttonText: string | undefined;
@@ -31,17 +31,16 @@ type SuggestedActionProps = Readonly<{
31
31
 
32
32
  const styles = {
33
33
  'webchat-fluent__suggested-action': {
34
+ alignItems: 'center',
34
35
  background: 'transparent',
35
36
  border: '1px solid var(--webchat-colorBrandStroke2)',
36
37
  borderRadius: '8px',
37
38
  cursor: 'pointer',
38
- fontSize: '12px',
39
- lineHeight: '14px',
40
- padding: '6px 8px 4px',
41
- textAlign: 'start',
42
39
  display: 'flex',
40
+ fontSize: '12px',
43
41
  gap: '4px',
44
- alignItems: 'center',
42
+ padding: '4px 8px 4px',
43
+ textAlign: 'start',
45
44
  transition: 'all .15s ease-out',
46
45
 
47
46
  '@media (hover: hover)': {
@@ -50,21 +49,20 @@ const styles = {
50
49
  color: 'var(--webchat-colorBrandForeground2Hover)'
51
50
  }
52
51
  },
52
+
53
53
  '&:not([aria-disabled="true"]):active': {
54
54
  backgroundColor: 'var(--webchat-colorBrandBackground2Pressed)',
55
55
  color: 'var(--webchat-colorBrandForeground2Pressed)'
56
56
  },
57
+
57
58
  '&[aria-disabled="true"]': {
58
- color: ' var(--webchat-colorNeutralForegroundDisabled)',
59
+ color: 'var(--webchat-colorNeutralForegroundDisabled)',
59
60
  cursor: 'not-allowed'
60
61
  }
61
62
  },
62
63
 
63
64
  'webchat-fluent__suggested-action__image': {
64
- width: '1em',
65
- height: '1em',
66
- fontSize: '20px',
67
- translate: '0 -1px'
65
+ height: '12px'
68
66
  }
69
67
  };
70
68
 
@@ -2,33 +2,43 @@ import { hooks } from 'botframework-webchat-component';
2
2
  import cx from 'classnames';
3
3
  import React, { memo, type ReactNode } from 'react';
4
4
  import { useStyles } from '../../styles';
5
- import computeSuggestedActionText from './private/computeSuggestedActionText';
6
5
  import SuggestedAction from './SuggestedAction';
6
+ import computeSuggestedActionText from './private/computeSuggestedActionText';
7
7
 
8
- const { useLocalizer, useStyleSet, useSuggestedActions } = hooks;
8
+ const { useLocalizer, useStyleOptions, useStyleSet, useSuggestedActions } = hooks;
9
9
 
10
10
  const styles = {
11
11
  'webchat-fluent__suggested-actions': {
12
12
  alignItems: 'flex-end',
13
13
  alignSelf: 'flex-end',
14
14
  display: 'flex',
15
- flexDirection: 'column',
16
15
  gap: '8px',
17
16
 
18
17
  '&:not(:empty)': {
19
18
  paddingBlockEnd: '8px',
20
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'
21
30
  }
22
31
  }
23
32
  };
24
33
 
25
- function SuggestedActionStackedContainer(
34
+ function SuggestedActionStackedOrFlowContainer(
26
35
  props: Readonly<{
27
36
  'aria-label'?: string | undefined;
28
37
  children?: ReactNode | undefined;
29
38
  className?: string | undefined;
30
39
  }>
31
40
  ) {
41
+ const [{ suggestedActionLayout }] = useStyleOptions();
32
42
  const [{ suggestedActions: suggestedActionsStyleSet }] = useStyleSet();
33
43
  const classNames = useStyles(styles);
34
44
 
@@ -37,7 +47,15 @@ function SuggestedActionStackedContainer(
37
47
  aria-label={props['aria-label']}
38
48
  aria-live="polite"
39
49
  aria-orientation="vertical"
40
- className={cx(classNames['webchat-fluent__suggested-actions'], suggestedActionsStyleSet + '', props.className)}
50
+ className={cx(
51
+ classNames['webchat-fluent__suggested-actions'],
52
+ suggestedActionsStyleSet + '',
53
+ {
54
+ 'webchat-fluent__suggested-actions--flow': suggestedActionLayout === 'flow',
55
+ 'webchat-fluent__suggested-actions--stacked': suggestedActionLayout !== 'flow'
56
+ },
57
+ props.className
58
+ )}
41
59
  role="toolbar"
42
60
  >
43
61
  {!!props.children && !!React.Children.count(props.children) && props.children}
@@ -91,12 +109,12 @@ function SuggestedActions() {
91
109
  );
92
110
  });
93
111
  return (
94
- <SuggestedActionStackedContainer
112
+ <SuggestedActionStackedOrFlowContainer
95
113
  aria-label={localize('SUGGESTED_ACTIONS_LABEL_ALT')}
96
114
  className={classNames['webchat-fluent__suggested-actions']}
97
115
  >
98
116
  {children}
99
- </SuggestedActionStackedContainer>
117
+ </SuggestedActionStackedOrFlowContainer>
100
118
  );
101
119
  }
102
120
 
@@ -19,7 +19,7 @@ const styles = {
19
19
  // color: 'inherit',
20
20
 
21
21
  border: 'solid 1px var(--webchat-colorNeutralStroke1)',
22
- color: 'var(--webchat-colorNeutralForeground1)',
22
+ color: 'var(--webchat-colorGray200)',
23
23
  fontWeight: 'var(--webchat-fontWeightSemibold)',
24
24
 
25
25
  cursor: 'pointer',
@@ -41,7 +41,7 @@ const styles = {
41
41
 
42
42
  'webchat__telephone-keypad__button__ruby': {
43
43
  // color: isHighContrastTheme() ? white : isDarkTheme() ? gray40 : gray160,
44
- color: 'var(--webchat-colorGray160)',
44
+ color: 'var(--webchat-colorGray190)',
45
45
  fontSize: 10
46
46
  },
47
47