@react-ui-org/react-ui 0.50.2 → 0.52.0

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 (82) hide show
  1. package/dist/lib.development.js +157 -49
  2. package/dist/lib.js +1 -1
  3. package/package.json +1 -1
  4. package/src/lib/components/Alert/Alert.jsx +1 -3
  5. package/src/lib/components/Alert/Alert.scss +1 -9
  6. package/src/lib/components/Alert/README.mdx +0 -20
  7. package/src/lib/components/Alert/_settings.scss +1 -1
  8. package/src/lib/components/Alert/_theme.scss +0 -10
  9. package/src/lib/components/Badge/Badge.jsx +1 -3
  10. package/src/lib/components/Badge/Badge.scss +25 -44
  11. package/src/lib/components/Badge/README.mdx +6 -14
  12. package/src/lib/components/Button/Button.jsx +20 -10
  13. package/src/lib/components/Button/README.mdx +8 -3
  14. package/src/lib/components/Button/_base.scss +21 -12
  15. package/src/lib/components/Button/_priorities.scss +13 -18
  16. package/src/lib/components/Button/_settings.scss +1 -1
  17. package/src/lib/components/Button/_theme.scss +0 -10
  18. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +5 -3
  19. package/src/lib/components/ButtonGroup/ButtonGroup.scss +26 -1
  20. package/src/lib/components/ButtonGroup/README.mdx +85 -59
  21. package/src/lib/components/ButtonGroup/_theme.scss +13 -0
  22. package/src/lib/components/Card/Card.jsx +1 -3
  23. package/src/lib/components/Card/Card.scss +0 -9
  24. package/src/lib/components/Card/README.mdx +0 -16
  25. package/src/lib/components/Card/_theme.scss +0 -10
  26. package/src/lib/components/FormLayout/README.mdx +22 -8
  27. package/src/lib/components/Grid/_helpers/generateResponsiveCustomProperties.js +1 -1
  28. package/src/lib/components/InputGroup/InputGroup.jsx +170 -0
  29. package/src/lib/components/InputGroup/InputGroup.scss +92 -0
  30. package/src/lib/components/InputGroup/InputGroupContext.js +3 -0
  31. package/src/lib/components/InputGroup/README.mdx +278 -0
  32. package/src/lib/components/InputGroup/_theme.scss +2 -0
  33. package/src/lib/components/InputGroup/index.js +2 -0
  34. package/src/lib/components/Modal/Modal.jsx +58 -97
  35. package/src/lib/components/Modal/ModalCloseButton.scss +2 -2
  36. package/src/lib/components/Modal/README.mdx +392 -128
  37. package/src/lib/components/Modal/_helpers/getPositionClassName.js +7 -0
  38. package/src/lib/components/Modal/_helpers/getSizeClassName.js +19 -0
  39. package/src/lib/components/Modal/_hooks/useModalFocus.js +126 -0
  40. package/src/lib/components/Modal/_hooks/useModalScrollPrevention.js +35 -0
  41. package/src/lib/components/Modal/_settings.scss +2 -2
  42. package/src/lib/components/Popover/README.mdx +7 -4
  43. package/src/lib/components/Radio/README.mdx +9 -1
  44. package/src/lib/components/Radio/Radio.jsx +39 -31
  45. package/src/lib/components/Radio/Radio.scss +11 -1
  46. package/src/lib/components/ScrollView/README.mdx +2 -2
  47. package/src/lib/components/SelectField/SelectField.jsx +21 -8
  48. package/src/lib/components/SelectField/SelectField.scss +5 -0
  49. package/src/lib/components/Table/_components/TableCell.scss +6 -5
  50. package/src/lib/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +8 -5
  51. package/src/lib/components/Table/_settings.scss +5 -6
  52. package/src/lib/components/Text/README.mdx +14 -8
  53. package/src/lib/components/TextField/TextField.jsx +21 -8
  54. package/src/lib/components/TextField/TextField.scss +5 -0
  55. package/src/lib/components/TextLink/README.mdx +8 -6
  56. package/src/lib/components/TextLink/TextLink.scss +5 -0
  57. package/src/lib/components/TextLink/_theme.scss +2 -0
  58. package/src/lib/components/Toolbar/README.mdx +19 -11
  59. package/src/lib/components/_helpers/getRootColorClassName.js +4 -0
  60. package/src/lib/index.js +1 -0
  61. package/src/lib/styles/elements/_code.scss +1 -3
  62. package/src/lib/styles/elements/_page.scss +1 -0
  63. package/src/lib/styles/elements/_rulers.scss +1 -3
  64. package/src/lib/styles/elements/_small.scss +1 -1
  65. package/src/lib/styles/settings/_form-fields.scss +1 -1
  66. package/src/lib/styles/settings/_utilities.scss +46 -14
  67. package/src/lib/styles/theme/_accessibility.scss +4 -4
  68. package/src/lib/styles/theme/_borders.scss +3 -2
  69. package/src/lib/styles/theme/_code.scss +2 -2
  70. package/src/lib/styles/theme/_links.scss +6 -4
  71. package/src/lib/styles/theme/_lists.scss +1 -1
  72. package/src/lib/styles/theme/_page.scss +2 -2
  73. package/src/lib/styles/theme/_spacing.scss +11 -11
  74. package/src/lib/styles/theme/_typography.scss +19 -18
  75. package/src/lib/styles/theme-constants/_colors.scss +23 -23
  76. package/src/lib/styles/tools/_spacing.scss +1 -1
  77. package/src/lib/styles/tools/form-fields/_box-field-elements.scss +19 -2
  78. package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +11 -8
  79. package/src/lib/styles/tools/form-fields/_foundation.scss +7 -0
  80. package/src/lib/theme.scss +650 -567
  81. package/src/lib/styles/theme/_colors.scss +0 -65
  82. /package/src/lib/components/{Button/helpers → _helpers}/getRootPriorityClassName.js +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-ui-org/react-ui",
3
3
  "description": "React UI is a themeable UI library for React apps.",
4
- "version": "0.50.2",
4
+ "version": "0.52.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -72,9 +72,7 @@ Alert.propTypes = {
72
72
  /**
73
73
  * [Color variant](/foundation/colors#component-colors) to clarify importance and meaning of the alert.
74
74
  */
75
- color: PropTypes.oneOf(
76
- ['primary', 'secondary', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark'],
77
- ),
75
+ color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
78
76
  /**
79
77
  * Optional element to be displayed next to the alert body.
80
78
  */
@@ -56,7 +56,7 @@
56
56
  @include accessibility.min-tap-target();
57
57
 
58
58
  padding: theme.$padding;
59
- font-size: map.get(typography.$size-values, 3);
59
+ font-size: map.get(typography.$font-size-values, 4);
60
60
  line-height: 1;
61
61
  }
62
62
 
@@ -65,14 +65,6 @@
65
65
  top: -0.1em;
66
66
  }
67
67
 
68
- .isRootColorPrimary {
69
- @include tools.color(primary);
70
- }
71
-
72
- .isRootColorSecondary {
73
- @include tools.color(secondary);
74
- }
75
-
76
68
  .isRootColorSuccess {
77
69
  @include tools.color(success);
78
70
  }
@@ -51,26 +51,6 @@ See [API](#api) for all available options.
51
51
  All [component colors](/foundation/colors#component-colors) are supported by
52
52
  alert to cover all possible needs of your project.
53
53
 
54
- ### Primary
55
-
56
- Primary alert uses brand primary color.
57
-
58
- <Playground>
59
- <Alert color="primary">
60
- <strong>Primary:</strong> This is a primary alert.
61
- </Alert>
62
- </Playground>
63
-
64
- ### Secondary
65
-
66
- Secondary alert uses brand secondary color.
67
-
68
- <Playground>
69
- <Alert color="secondary">
70
- <strong>Secondary:</strong> This is a secondary alert.
71
- </Alert>
72
- </Playground>
73
-
74
54
  ### Success
75
55
 
76
56
  Success alerts confirm that an operation has been processed successfully.
@@ -2,6 +2,6 @@
2
2
  @use "../../styles/theme/typography";
3
3
  @use "theme";
4
4
 
5
- $font-size: map.get(typography.$size-values, 0);
5
+ $font-size: map.get(typography.$font-size-values, 1);
6
6
  $line-height: typography.$line-height-base;
7
7
  $min-height: calc(#{$font-size} * #{$line-height} + 2 * #{theme.$padding});
@@ -6,16 +6,6 @@ $emphasis-font-weight: var(--rui-Alert__emphasis__font-weight);
6
6
  $stripe-width: var(--rui-Alert__stripe__width);
7
7
 
8
8
  $colors: (
9
- primary: (
10
- color: var(--rui-Alert--primary__color),
11
- foreground-color: var(--rui-Alert--primary__foreground-color),
12
- background-color: var(--rui-Alert--primary__background-color),
13
- ),
14
- secondary: (
15
- color: var(--rui-Alert--secondary__color),
16
- foreground-color: var(--rui-Alert--secondary__foreground-color),
17
- background-color: var(--rui-Alert--secondary__background-color),
18
- ),
19
9
  success: (
20
10
  color: var(--rui-Alert--success__color),
21
11
  foreground-color: var(--rui-Alert--success__foreground-color),
@@ -33,9 +33,7 @@ Badge.propTypes = {
33
33
  /**
34
34
  * [Color variant](/foundation/colors#component-colors) to clarify importance and meaning of the badge.
35
35
  */
36
- color: PropTypes.oneOf(
37
- ['primary', 'secondary', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark'],
38
- ),
36
+ color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
39
37
  /**
40
38
  * Text to be displayed.
41
39
  */
@@ -1,7 +1,6 @@
1
1
  @use "sass:map";
2
2
  @use "sass:math";
3
3
  @use "../../styles/theme/borders";
4
- @use "../../styles/theme/colors";
5
4
  @use "../../styles/theme/typography";
6
5
 
7
6
  $_badge-size: 1.25rem;
@@ -13,7 +12,7 @@ $_badge-size: 1.25rem;
13
12
  padding: 0.25rem 0.35rem;
14
13
  overflow: hidden;
15
14
  font-weight: map.get(typography.$font-weight-values, bold);
16
- font-size: typography.$size-smaller;
15
+ font-size: typography.$font-size-smaller;
17
16
  line-height: 1;
18
17
  text-align: center;
19
18
  white-space: nowrap;
@@ -24,55 +23,45 @@ $_badge-size: 1.25rem;
24
23
  box-shadow: var(--rui-local-box-shadow, #{0 0 0 2px rgb(255 255 255 / 80%)});
25
24
  }
26
25
 
27
- .isRootColorPrimary {
28
- --rui-local-color: #{map.get(colors.$brand, on-primary)};
29
- --rui-local-background-color: #{map.get(colors.$brand, primary)};
30
- }
31
-
32
- .isRootColorSecondary {
33
- --rui-local-color: #{map.get(colors.$brand, on-secondary)};
34
- --rui-local-background-color: #{map.get(colors.$brand, secondary)};
35
- }
36
-
37
26
  .isRootColorSuccess {
38
- --rui-local-color: #{map.get(colors.$ui, on-success)};
39
- --rui-local-background-color: #{map.get(colors.$ui, success)};
27
+ --rui-local-color: var(--rui-color-feedback-on-success);
28
+ --rui-local-background-color: var(--rui-color-feedback-success);
40
29
  }
41
30
 
42
31
  .isRootColorWarning {
43
- --rui-local-color: #{map.get(colors.$ui, on-warning)};
44
- --rui-local-background-color: #{map.get(colors.$ui, warning)};
32
+ --rui-local-color: var(--rui-color-feedback-on-warning);
33
+ --rui-local-background-color: var(--rui-color-feedback-warning);
45
34
  }
46
35
 
47
36
  .isRootColorDanger {
48
- --rui-local-color: #{map.get(colors.$ui, on-danger)};
49
- --rui-local-background-color: #{map.get(colors.$ui, danger)};
37
+ --rui-local-color: var(--rui-color-feedback-on-danger);
38
+ --rui-local-background-color: var(--rui-color-feedback-danger);
50
39
  }
51
40
 
52
41
  .isRootColorHelp {
53
- --rui-local-color: #{map.get(colors.$ui, on-help)};
54
- --rui-local-background-color: #{map.get(colors.$ui, help)};
42
+ --rui-local-color: var(--rui-color-feedback-on-help);
43
+ --rui-local-background-color: var(--rui-color-feedback-help);
55
44
  }
56
45
 
57
46
  .isRootColorInfo {
58
- --rui-local-color: #{map.get(colors.$ui, on-info)};
59
- --rui-local-background-color: #{map.get(colors.$ui, info)};
47
+ --rui-local-color: var(--rui-color-feedback-on-info);
48
+ --rui-local-background-color: var(--rui-color-feedback-info);
60
49
  }
61
50
 
62
51
  .isRootColorNote {
63
- --rui-local-color: #{map.get(colors.$ui, on-note)};
64
- --rui-local-background-color: #{map.get(colors.$ui, note)};
52
+ --rui-local-color: var(--rui-color-feedback-on-note);
53
+ --rui-local-background-color: var(--rui-color-feedback-note);
65
54
  }
66
55
 
67
56
  .isRootColorLight {
68
- --rui-local-color: #{colors.$dark};
69
- --rui-local-background-color: #{colors.$light};
57
+ --rui-local-color: var(--rui-color-neutral-on-light);
58
+ --rui-local-background-color: var(--rui-color-neutral-light);
70
59
  --rui-local-box-shadow: none;
71
60
  }
72
61
 
73
62
  .isRootColorDark {
74
- --rui-local-color: #{colors.$light};
75
- --rui-local-background-color: #{colors.$dark};
63
+ --rui-local-color: var(--rui-color-neutral-on-dark);
64
+ --rui-local-background-color: var(--rui-color-neutral-dark);
76
65
  --rui-local-box-shadow: none;
77
66
  }
78
67
 
@@ -85,42 +74,34 @@ $_badge-size: 1.25rem;
85
74
  border: borders.$width solid currentColor;
86
75
  }
87
76
 
88
- .isRootPriorityOutline.isRootColorPrimary {
89
- --rui-local-color: #{map.get(colors.$brand, primary)};
90
- }
91
-
92
- .isRootPriorityOutline.isRootColorSecondary {
93
- --rui-local-color: #{map.get(colors.$brand, secondary)};
94
- }
95
-
96
77
  .isRootPriorityOutline.isRootColorSuccess {
97
- --rui-local-color: #{map.get(colors.$ui, success)};
78
+ --rui-local-color: var(--rui-color-feedback-success);
98
79
  }
99
80
 
100
81
  .isRootPriorityOutline.isRootColorWarning {
101
- --rui-local-color: #{map.get(colors.$ui, warning)};
82
+ --rui-local-color: var(--rui-color-feedback-warning);
102
83
  }
103
84
 
104
85
  .isRootPriorityOutline.isRootColorDanger {
105
- --rui-local-color: #{map.get(colors.$ui, danger)};
86
+ --rui-local-color: var(--rui-color-feedback-danger);
106
87
  }
107
88
 
108
89
  .isRootPriorityOutline.isRootColorHelp {
109
- --rui-local-color: #{map.get(colors.$ui, help)};
90
+ --rui-local-color: var(--rui-color-feedback-help);
110
91
  }
111
92
 
112
93
  .isRootPriorityOutline.isRootColorInfo {
113
- --rui-local-color: #{map.get(colors.$ui, info)};
94
+ --rui-local-color: var(--rui-color-feedback-info);
114
95
  }
115
96
 
116
97
  .isRootPriorityOutline.isRootColorNote {
117
- --rui-local-color: #{map.get(colors.$ui, note)};
98
+ --rui-local-color: var(--rui-color-feedback-note);
118
99
  }
119
100
 
120
101
  .isRootPriorityOutline.isRootColorLight {
121
- --rui-local-color: #{colors.$light};
102
+ --rui-local-color: var(--rui-color-neutral-light);
122
103
  }
123
104
 
124
105
  .isRootPriorityOutline.isRootColorDark {
125
- --rui-local-color: #{colors.$dark};
106
+ --rui-local-color: var(--rui-color-neutral-dark);
126
107
  }
@@ -52,11 +52,9 @@ All priorities come in supported
52
52
  High-emphasis priority to draw user's attention.
53
53
 
54
54
  <Playground>
55
- <Badge label="1" color="primary" />
56
- <Badge label="2" color="secondary" />
57
- <Badge label="3" color="success" />
58
- <Badge label="4" color="warning" />
59
- <Badge label="5" color="danger" />
55
+ <Badge label="1" color="success" />
56
+ <Badge label="2" color="warning" />
57
+ <Badge label="3" color="danger" />
60
58
  <Badge label="10" color="help" />
61
59
  <Badge label="34" color="info" />
62
60
  <Badge label="99+" />
@@ -67,8 +65,6 @@ High-emphasis priority to draw user's attention.
67
65
  </Playground>
68
66
 
69
67
  <Playground>
70
- <Badge label="Primary" color="primary" />
71
- <Badge label="Secondary" color="secondary" />
72
68
  <Badge label="Success" color="success" />
73
69
  <Badge label="Warning" color="warning" />
74
70
  <Badge label="Danger" color="danger" />
@@ -86,11 +82,9 @@ High-emphasis priority to draw user's attention.
86
82
  Medium-emphasis priority to provide additional context in an unobtrusive way.
87
83
 
88
84
  <Playground>
89
- <Badge priority="outline" label="1" color="primary" />
90
- <Badge priority="outline" label="2" color="secondary" />
91
- <Badge priority="outline" label="3" color="success" />
92
- <Badge priority="outline" label="4" color="warning" />
93
- <Badge priority="outline" label="5" color="danger" />
85
+ <Badge priority="outline" label="1" color="success" />
86
+ <Badge priority="outline" label="2" color="warning" />
87
+ <Badge priority="outline" label="3" color="danger" />
94
88
  <Badge priority="outline" label="10" color="help" />
95
89
  <Badge priority="outline" label="34" color="info" />
96
90
  <Badge priority="outline" label="99+" />
@@ -101,8 +95,6 @@ Medium-emphasis priority to provide additional context in an unobtrusive way.
101
95
  </Playground>
102
96
 
103
97
  <Playground>
104
- <Badge priority="outline" label="Primary" color="primary" />
105
- <Badge priority="outline" label="Secondary" color="secondary" />
106
98
  <Badge priority="outline" label="Success" color="success" />
107
99
  <Badge priority="outline" label="Warning" color="warning" />
108
100
  <Badge priority="outline" label="Danger" color="danger" />
@@ -7,8 +7,9 @@ import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
7
7
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
8
8
  import { transferProps } from '../_helpers/transferProps';
9
9
  import { ButtonGroupContext } from '../ButtonGroup';
10
+ import { InputGroupContext } from '../InputGroup/InputGroupContext';
11
+ import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
10
12
  import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
11
- import getRootPriorityClassName from './helpers/getRootPriorityClassName';
12
13
  import styles from './Button.scss';
13
14
 
14
15
  export const Button = React.forwardRef((props, ref) => {
@@ -28,8 +29,14 @@ export const Button = React.forwardRef((props, ref) => {
28
29
  color,
29
30
  ...restProps
30
31
  } = props;
32
+ const buttonGroupContext = useContext(ButtonGroupContext);
33
+ const inputGroupContext = useContext(InputGroupContext);
31
34
 
32
- const context = useContext(ButtonGroupContext);
35
+ if (buttonGroupContext && inputGroupContext) {
36
+ throw new Error('Button cannot be placed both in `ButtonGroup` and `InputGroup`.');
37
+ }
38
+
39
+ const primaryContext = buttonGroupContext ?? inputGroupContext;
33
40
 
34
41
  return (
35
42
  /* No worries, `type` is always assigned correctly through props. */
@@ -39,20 +46,21 @@ export const Button = React.forwardRef((props, ref) => {
39
46
  className={classNames(
40
47
  styles.root,
41
48
  getRootPriorityClassName(
42
- resolveContextOrProp(context && context.priority, priority),
49
+ resolveContextOrProp(buttonGroupContext && buttonGroupContext.priority, priority),
43
50
  styles,
44
51
  ),
45
52
  getRootColorClassName(color, styles),
46
53
  getRootSizeClassName(
47
- resolveContextOrProp(context && context.size, size),
54
+ resolveContextOrProp(primaryContext && primaryContext.size, size),
48
55
  styles,
49
56
  ),
50
57
  getRootLabelVisibilityClassName(labelVisibility, styles),
51
- resolveContextOrProp(context && context.block, block) && styles.isRootBlock,
52
- context && styles.isRootGrouped,
58
+ resolveContextOrProp(buttonGroupContext && buttonGroupContext.block, block) && styles.isRootBlock,
59
+ buttonGroupContext && styles.isRootInButtonGroup,
60
+ inputGroupContext && styles.isRootInInputGroup,
53
61
  feedbackIcon && styles.hasRootFeedback,
54
62
  )}
55
- disabled={resolveContextOrProp(context && context.disabled, disabled) || !!feedbackIcon}
63
+ disabled={resolveContextOrProp(primaryContext && primaryContext.disabled, disabled) || !!feedbackIcon}
56
64
  id={id}
57
65
  ref={ref}
58
66
  >
@@ -127,7 +135,9 @@ Button.propTypes = {
127
135
  /**
128
136
  * [Color variant](/foundation/colors#component-colors) to clarify importance and meaning of the button.
129
137
  */
130
- color: PropTypes.oneOf(['primary', 'secondary', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
138
+ color: PropTypes.oneOf(
139
+ ['primary', 'secondary', 'selected', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark'],
140
+ ),
131
141
  /**
132
142
  * If `true`, the button will be disabled.
133
143
  *
@@ -169,8 +179,8 @@ Button.propTypes = {
169
179
  /**
170
180
  * Size of the button.
171
181
  *
172
- * Ignored if the component is rendered within `ButtonGroup` component
173
- * as the value is inherited in such case.
182
+ * Ignored if the component is rendered within `ButtonGroup` or `InputGroup` component as the value is inherited in
183
+ * such case.
174
184
  */
175
185
  size: PropTypes.oneOf(['small', 'medium', 'large']),
176
186
  /**
@@ -65,6 +65,7 @@ app. Use it sparingly but remember there should always be one on a screen.
65
65
  <Playground>
66
66
  <Button label="Primary" />
67
67
  <Button label="Secondary" color="secondary" />
68
+ <Button label="Selected" color="selected" />
68
69
  <Button label="Success" color="success" />
69
70
  <Button label="Warning" color="warning" />
70
71
  <Button label="Danger" color="danger" />
@@ -88,6 +89,7 @@ important but not primary in your app.
88
89
  <Playground>
89
90
  <Button priority="outline" label="Primary" />
90
91
  <Button priority="outline" label="Secondary" color="secondary" />
92
+ <Button priority="outline" label="Selected" color="selected" />
91
93
  <Button priority="outline" label="Success" color="success" />
92
94
  <Button priority="outline" label="Warning" color="warning" />
93
95
  <Button priority="outline" label="Danger" color="danger" />
@@ -108,6 +110,7 @@ the content.
108
110
  <Playground>
109
111
  <Button priority="flat" label="Primary" />
110
112
  <Button priority="flat" label="Secondary" color="secondary" />
113
+ <Button priority="flat" label="Selected" color="selected" />
111
114
  <Button priority="flat" label="Success" color="success" />
112
115
  <Button priority="flat" label="Warning" color="warning" />
113
116
  <Button priority="flat" label="Danger" color="danger" />
@@ -269,9 +272,11 @@ Disabled state makes the action unavailable.
269
272
  ### Feedback State
270
273
 
271
274
  When user's action triggers an asynchronous process on background, the button's
272
- feedback state can be indicated by showing an icon. The icon replaces button's
273
- label while retaining original dimensions of the button. Buttons in feedback
274
- state are automatically disabled to prevent unwanted interaction.
275
+ feedback state (not to be mistaken with
276
+ [feedback colors](/foundation/colors#component-colors)) can be indicated by
277
+ showing an icon. The icon replaces button's label while retaining original
278
+ dimensions of the button. Buttons in feedback state are automatically disabled
279
+ to prevent unwanted interaction.
275
280
 
276
281
  Filled buttons in feedback state:
277
282
 
@@ -1,3 +1,6 @@
1
+ // 1. ButtonGroup gap is implemented using the `margin` property so the buttons can overlap and reduce duplicate
2
+ // borders.
3
+
1
4
  @use "sass:map";
2
5
  @use "../../styles/tools/breakpoint";
3
6
  @use "settings";
@@ -76,28 +79,34 @@
76
79
  color: transparent;
77
80
  }
78
81
 
79
- .isRootGrouped {
82
+ .isRootInButtonGroup,
83
+ .isRootInInputGroup {
80
84
  z-index: map.get(settings.$group-z-indexes, button);
81
85
 
82
86
  &:not(:first-child) {
83
- margin-left: var(--rui-local-gap);
84
- border-top-left-radius: 0;
85
- border-bottom-left-radius: 0;
87
+ border-start-start-radius: var(--rui-local-inner-border-radius);
88
+ border-end-start-radius: var(--rui-local-inner-border-radius);
86
89
  }
87
90
 
88
91
  &:not(:last-child) {
89
- border-top-right-radius: 0;
90
- border-bottom-right-radius: 0;
92
+ border-start-end-radius: var(--rui-local-inner-border-radius);
93
+ border-end-end-radius: var(--rui-local-inner-border-radius);
91
94
  }
95
+ }
92
96
 
93
- &:focus,
94
- &:not(:disabled):hover {
95
- z-index: map.get(settings.$group-z-indexes, button-hover);
96
- }
97
+ .isRootInButtonGroup:not(:first-child) {
98
+ margin-inline-start: var(--rui-local-gap); // 1.
99
+ }
100
+
101
+ .isRootInButtonGroup:focus,
102
+ .isRootInButtonGroup:not(:disabled):hover {
103
+ z-index: map.get(settings.$group-z-indexes, button-hover);
97
104
  }
98
105
 
99
- .isRootGrouped .startCorner,
100
- .isRootGrouped .endCorner {
106
+ .isRootInButtonGroup .startCorner,
107
+ .isRootInInputGroup .startCorner,
108
+ .isRootInButtonGroup .endCorner,
109
+ .isRootInInputGroup .endCorner {
101
110
  z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
102
111
  }
103
112
 
@@ -11,6 +11,10 @@
11
11
  @include tools.button-color(filled, secondary);
12
12
  }
13
13
 
14
+ .isRootPriorityFilled.isRootColorSelected {
15
+ @include tools.button-color(filled, selected);
16
+ }
17
+
14
18
  .isRootPriorityFilled.isRootColorSuccess {
15
19
  @include tools.button-color(filled, success);
16
20
  }
@@ -51,6 +55,10 @@
51
55
  @include tools.button-color(outline, secondary);
52
56
  }
53
57
 
58
+ .isRootPriorityOutline.isRootColorSelected {
59
+ @include tools.button-color(outline, selected);
60
+ }
61
+
54
62
  .isRootPriorityOutline.isRootColorSuccess {
55
63
  @include tools.button-color(outline, success);
56
64
  }
@@ -91,6 +99,10 @@
91
99
  @include tools.button-color(flat, secondary);
92
100
  }
93
101
 
102
+ .isRootPriorityFlat.isRootColorSelected {
103
+ @include tools.button-color(flat, selected);
104
+ }
105
+
94
106
  .isRootPriorityFlat.isRootColorSuccess {
95
107
  @include tools.button-color(flat, success);
96
108
  }
@@ -123,8 +135,7 @@
123
135
  @include tools.button-color(flat, dark);
124
136
  }
125
137
 
126
- .isRootPriorityFilled.isRootGrouped:not(:first-child)::before,
127
- .isRootPriorityFlat.isRootGrouped:not(:first-child)::before {
138
+ .isRootInButtonGroup:not(:first-child)::before {
128
139
  content: "";
129
140
  position: absolute;
130
141
  top: calc(-1 * #{theme.$border-width});
@@ -134,19 +145,3 @@
134
145
  border-left: var(--rui-local-separator-width) solid var(--rui-local-separator-color);
135
146
  transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
136
147
  }
137
-
138
- .isRootPriorityFilled.isRootGrouped:not(:first-child) {
139
- --rui-local-gap: #{theme.$group-filled-gap};
140
- --rui-local-separator-width: #{theme.$group-filled-separator-width};
141
- --rui-local-separator-color: #{theme.$group-filled-separator-color};
142
- }
143
-
144
- .isRootPriorityFlat.isRootGrouped:not(:first-child) {
145
- --rui-local-gap: #{theme.$group-flat-gap};
146
- --rui-local-separator-width: #{theme.$group-flat-separator-width};
147
- --rui-local-separator-color: #{theme.$group-flat-separator-color};
148
- }
149
-
150
- .isRootPriorityOutline.isRootGrouped:not(:first-child) {
151
- --rui-local-gap: #{theme.$group-outline-gap};
152
- }
@@ -12,7 +12,7 @@ $group-z-indexes: (
12
12
  button-overflowing-elements: 3,
13
13
  );
14
14
 
15
- $themeable-variants: (primary, secondary, success, warning, danger, help, info, note, light, dark);
15
+ $themeable-variants: (primary, secondary, selected, success, warning, danger, help, info, note, light, dark);
16
16
  $themeable-states: (default, hover, active, disabled);
17
17
  $themeable-priority-properties: (
18
18
  filled: (color, border-color, background, box-shadow),
@@ -12,16 +12,6 @@ $disabled-cursor: var(--rui-Button--disabled__cursor);
12
12
  $feedback-opacity: var(--rui-Button--feedback__opacity);
13
13
  $feedback-cursor: var(--rui-Button--feedback__cursor);
14
14
 
15
- $group-filled-gap: var(--rui-ButtonGroup--filled__gap);
16
- $group-filled-separator-width: var(--rui-ButtonGroup--filled__separator__width);
17
- $group-filled-separator-color: var(--rui-ButtonGroup--filled__separator__color);
18
-
19
- $group-flat-gap: var(--rui-ButtonGroup--flat__gap);
20
- $group-flat-separator-width: var(--rui-ButtonGroup--flat__separator__width);
21
- $group-flat-separator-color: var(--rui-ButtonGroup--flat__separator__color);
22
-
23
- $group-outline-gap: var(--rui-ButtonGroup--outline__gap);
24
-
25
15
  $sizes: (
26
16
  small: (
27
17
  height: var(--rui-Button--small__height),
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { classNames } from '../../utils/classNames';
5
+ import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
5
6
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
6
7
  import { transferProps } from '../_helpers/transferProps';
7
8
  import styles from './ButtonGroup.scss';
@@ -20,13 +21,14 @@ export const ButtonGroup = ({
20
21
  }
21
22
 
22
23
  return (
23
- <div
24
+ <fieldset
24
25
  {...transferProps(restProps)}
25
26
  className={classNames(
26
27
  styles.root,
27
28
  block && styles.isRootBlock,
29
+ getRootPriorityClassName(priority, styles),
28
30
  )}
29
- role="group"
31
+ disabled={disabled}
30
32
  >
31
33
  <ButtonGroupContext.Provider
32
34
  value={{
@@ -38,7 +40,7 @@ export const ButtonGroup = ({
38
40
  >
39
41
  {children}
40
42
  </ButtonGroupContext.Provider>
41
- </div>
43
+ </fieldset>
42
44
  );
43
45
  };
44
46
 
@@ -1,5 +1,30 @@
1
+ // 1. ButtonGroup gap is implemented using the `margin` property on buttons so the buttons can overlap and reduce
2
+ // duplicate borders.
3
+
4
+ @use "theme";
5
+
1
6
  .root {
2
- display: inline-flex;
7
+ --rui-local-inner-border-radius: #{theme.$inner-border-radius};
8
+
9
+ display: inline-flex; // 1.
10
+ }
11
+
12
+ .isRootPriorityFilled {
13
+ --rui-local-gap: #{theme.$filled-gap};
14
+ --rui-local-separator-width: #{theme.$filled-separator-width};
15
+ --rui-local-separator-color: #{theme.$filled-separator-color};
16
+ }
17
+
18
+ .isRootPriorityOutline {
19
+ --rui-local-gap: #{theme.$outline-gap};
20
+ --rui-local-separator-width: #{theme.$outline-separator-width};
21
+ --rui-local-separator-color: #{theme.$outline-separator-color};
22
+ }
23
+
24
+ .isRootPriorityFlat {
25
+ --rui-local-gap: #{theme.$flat-gap};
26
+ --rui-local-separator-width: #{theme.$flat-separator-width};
27
+ --rui-local-separator-color: #{theme.$flat-separator-color};
3
28
  }
4
29
 
5
30
  .isRootBlock {