@react-ui-org/react-ui 0.55.1 → 0.57.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/.nvmrc +1 -1
  2. package/dist/react-ui.css +15 -20
  3. package/dist/react-ui.development.css +2336 -846
  4. package/dist/react-ui.development.js +106 -96
  5. package/dist/react-ui.js +1 -1
  6. package/package.json +41 -39
  7. package/src/CNAME +1 -0
  8. package/src/components/Alert/Alert.jsx +3 -2
  9. package/src/components/Alert/Alert.module.scss +9 -31
  10. package/src/components/Alert/README.md +11 -9
  11. package/src/components/Alert/_settings.scss +5 -0
  12. package/src/components/Alert/_theme.scss +0 -43
  13. package/src/components/Badge/Badge.jsx +5 -3
  14. package/src/components/Badge/Badge.module.scss +29 -74
  15. package/src/components/Badge/README.md +24 -6
  16. package/src/components/Badge/_settings.scss +8 -0
  17. package/src/components/Button/Button.jsx +4 -3
  18. package/src/components/Button/Button.module.scss +183 -2
  19. package/src/components/Button/README.md +28 -24
  20. package/src/components/Button/_settings.scss +8 -3
  21. package/src/components/Button/_theme.scss +0 -3
  22. package/src/components/Button/_tools.scss +7 -71
  23. package/src/components/ButtonGroup/ButtonGroup.jsx +2 -2
  24. package/src/components/ButtonGroup/README.md +5 -4
  25. package/src/components/Card/Card.jsx +3 -2
  26. package/src/components/Card/Card.module.scss +10 -31
  27. package/src/components/Card/CardBody.jsx +1 -1
  28. package/src/components/Card/CardFooter.jsx +1 -1
  29. package/src/components/Card/README.md +11 -10
  30. package/src/components/Card/_settings.scss +5 -0
  31. package/src/components/Card/_theme.scss +0 -43
  32. package/src/components/CheckboxField/CheckboxField.jsx +2 -2
  33. package/src/components/CheckboxField/README.md +8 -4
  34. package/src/components/FileInputField/FileInputField.jsx +3 -3
  35. package/src/components/FileInputField/README.md +8 -4
  36. package/src/components/FormLayout/FormLayout.jsx +1 -1
  37. package/src/components/FormLayout/FormLayoutCustomField.jsx +1 -1
  38. package/src/components/FormLayout/README.md +5 -4
  39. package/src/components/Grid/Grid.jsx +1 -1
  40. package/src/components/Grid/Grid.module.scss +5 -0
  41. package/src/components/Grid/GridSpan.jsx +1 -1
  42. package/src/components/Grid/README.md +6 -4
  43. package/src/components/Grid/_settings.scss +2 -2
  44. package/src/components/InputGroup/InputGroup.jsx +2 -2
  45. package/src/components/InputGroup/README.md +5 -4
  46. package/src/components/Modal/Modal.jsx +1 -1
  47. package/src/components/Modal/Modal.module.scss +1 -1
  48. package/src/components/Modal/ModalBody.jsx +1 -1
  49. package/src/components/Modal/ModalCloseButton.jsx +1 -1
  50. package/src/components/Modal/ModalContent.jsx +1 -1
  51. package/src/components/Modal/ModalFooter.jsx +1 -1
  52. package/src/components/Modal/ModalHeader.jsx +2 -4
  53. package/src/components/Modal/ModalTitle.jsx +2 -4
  54. package/src/components/Modal/README.md +3 -2
  55. package/src/components/Paper/Paper.jsx +1 -1
  56. package/src/components/Paper/README.md +5 -4
  57. package/src/components/Popover/Popover.jsx +1 -1
  58. package/src/components/Popover/Popover.module.scss +16 -16
  59. package/src/components/Popover/PopoverWrapper.jsx +1 -1
  60. package/src/components/Popover/README.md +5 -4
  61. package/src/components/Popover/_theme.scss +4 -2
  62. package/src/components/Radio/README.md +8 -4
  63. package/src/components/Radio/Radio.jsx +2 -2
  64. package/src/components/ScrollView/README.md +5 -4
  65. package/src/components/ScrollView/ScrollView.jsx +1 -1
  66. package/src/components/ScrollView/ScrollView.module.scss +2 -4
  67. package/src/components/SelectField/README.md +8 -4
  68. package/src/components/SelectField/SelectField.jsx +2 -2
  69. package/src/components/Table/README.md +5 -4
  70. package/src/components/Table/Table.jsx +1 -1
  71. package/src/components/Tabs/README.md +3 -2
  72. package/src/components/Tabs/Tabs.jsx +1 -1
  73. package/src/components/Tabs/TabsItem.jsx +1 -1
  74. package/src/components/Text/README.md +3 -2
  75. package/src/components/Text/Text.jsx +1 -1
  76. package/src/components/TextArea/README.md +8 -4
  77. package/src/components/TextArea/TextArea.jsx +2 -2
  78. package/src/components/TextField/README.md +8 -4
  79. package/src/components/TextField/TextField.jsx +2 -2
  80. package/src/components/TextLink/README.md +5 -4
  81. package/src/components/TextLink/TextLink.jsx +1 -1
  82. package/src/components/Toggle/README.md +8 -4
  83. package/src/components/Toggle/Toggle.jsx +2 -2
  84. package/src/components/Toolbar/README.md +5 -4
  85. package/src/components/Toolbar/Toolbar.jsx +1 -1
  86. package/src/components/Toolbar/ToolbarGroup.jsx +1 -1
  87. package/src/components/Toolbar/ToolbarItem.jsx +1 -1
  88. package/src/components/_helpers/getRootPriorityClassName.js +1 -1
  89. package/src/index.js +1 -0
  90. package/src/provider/RUIProvider.jsx +6 -3
  91. package/src/styles/settings/_collections.scss +9 -0
  92. package/src/styles/tools/_collections.scss +191 -0
  93. package/src/styles/tools/_string.scss +5 -2
  94. package/src/styles/tools/form-fields/_box-field-layout.scss +5 -0
  95. package/src/styles/tools/form-fields/_inline-field-layout.scss +1 -0
  96. package/src/theme.scss +64 -0
  97. package/src/utils/mergeDeep.js +28 -0
  98. package/src/{components/_helpers → utils}/transferProps.js +0 -8
  99. package/src/components/Alert/_tools.scss +0 -10
  100. package/src/components/Button/_base.scss +0 -159
  101. package/src/components/Button/_priorities.scss +0 -149
  102. package/src/components/Card/_tools.scss +0 -10
@@ -1,2 +1,183 @@
1
- @use "base";
2
- @use "priorities";
1
+ // 1. ButtonGroup gap is implemented using the `margin` property so the buttons can overlap and reduce duplicate
2
+ // borders.
3
+
4
+ @use "sass:map";
5
+ @use "../../styles/tools/breakpoint";
6
+ @use "../../styles/tools/collections";
7
+ @use "settings";
8
+ @use "theme";
9
+ @use "tools";
10
+
11
+ @layer components.button {
12
+ .root {
13
+ @include tools.button();
14
+ }
15
+
16
+ .label {
17
+ display: block;
18
+ }
19
+
20
+ .beforeLabel,
21
+ .afterLabel,
22
+ .startCorner,
23
+ .endCorner,
24
+ .feedbackIcon {
25
+ display: flex;
26
+ align-items: baseline;
27
+ justify-content: center;
28
+ }
29
+
30
+ .startCorner,
31
+ .endCorner {
32
+ position: absolute;
33
+ top: -0.35rem;
34
+ z-index: 2;
35
+ }
36
+
37
+ .startCorner {
38
+ left: 0;
39
+ margin-left: -0.35rem;
40
+ }
41
+
42
+ .endCorner {
43
+ right: 0;
44
+ margin-right: -0.35rem;
45
+ }
46
+
47
+ .feedbackIcon {
48
+ position: absolute;
49
+ inset: 0;
50
+ z-index: 1;
51
+ align-items: center;
52
+ }
53
+
54
+ .isRootSizeSmall {
55
+ @include tools.button-size(small);
56
+ }
57
+
58
+ .isRootSizeMedium {
59
+ @include tools.button-size(medium);
60
+ }
61
+
62
+ .isRootSizeLarge {
63
+ @include tools.button-size(large);
64
+ }
65
+
66
+ .isRootBlock {
67
+ width: 100%;
68
+ }
69
+
70
+ .hasRootFeedback:disabled {
71
+ opacity: theme.$feedback-opacity;
72
+ cursor: theme.$feedback-cursor;
73
+ }
74
+
75
+ .hasRootFeedback .label,
76
+ .hasRootFeedback .beforeLabel,
77
+ .hasRootFeedback .afterLabel {
78
+ color: transparent;
79
+ }
80
+
81
+ .isRootInButtonGroup,
82
+ .isRootInInputGroup {
83
+ z-index: map.get(settings.$group-z-indexes, button);
84
+
85
+ &:not(:first-child) {
86
+ border-start-start-radius: var(--rui-local-inner-border-radius);
87
+ border-end-start-radius: var(--rui-local-inner-border-radius);
88
+ }
89
+
90
+ &:not(:last-child) {
91
+ border-start-end-radius: var(--rui-local-inner-border-radius);
92
+ border-end-end-radius: var(--rui-local-inner-border-radius);
93
+ }
94
+ }
95
+
96
+ .isRootInButtonGroup:not(:first-child) {
97
+ margin-inline-start: var(--rui-local-gap); // 1.
98
+
99
+ &::before {
100
+ content: "";
101
+ position: absolute;
102
+ top: calc(-1 * #{theme.$border-width});
103
+ bottom: calc(-1 * #{theme.$border-width});
104
+ left: calc(-1 * #{theme.$border-width});
105
+ z-index: map.get(settings.$group-z-indexes, separator);
106
+ border-left: var(--rui-local-separator-width) solid var(--rui-local-separator-color);
107
+ transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
108
+ }
109
+ }
110
+
111
+ .isRootInButtonGroup:focus,
112
+ .isRootInButtonGroup:not(:disabled):hover {
113
+ z-index: map.get(settings.$group-z-indexes, button-hover);
114
+ }
115
+
116
+ .isRootInButtonGroup .startCorner,
117
+ .isRootInInputGroup .startCorner,
118
+ .isRootInButtonGroup .endCorner,
119
+ .isRootInInputGroup .endCorner {
120
+ z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
121
+ }
122
+
123
+ .hasLabelHidden,
124
+ .hasLabelVisibleSm,
125
+ .hasLabelVisibleMd,
126
+ .hasLabelVisibleLg,
127
+ .hasLabelVisibleXl,
128
+ .hasLabelVisibleX2l,
129
+ .hasLabelVisibleX3l {
130
+ @include tools.hide-label();
131
+ }
132
+
133
+ .hasLabelVisibleSm {
134
+ @include breakpoint.up(sm) {
135
+ @include tools.show-label();
136
+ }
137
+ }
138
+
139
+ .hasLabelVisibleMd {
140
+ @include breakpoint.up(md) {
141
+ @include tools.show-label();
142
+ }
143
+ }
144
+
145
+ .hasLabelVisibleLg {
146
+ @include breakpoint.up(lg) {
147
+ @include tools.show-label();
148
+ }
149
+ }
150
+
151
+ .hasLabelVisibleXl {
152
+ @include breakpoint.up(xl) {
153
+ @include tools.show-label();
154
+ }
155
+ }
156
+
157
+ .hasLabelVisibleX2l {
158
+ @include breakpoint.up(x2l) {
159
+ @include tools.show-label();
160
+ }
161
+ }
162
+
163
+ .hasLabelVisibleX3l {
164
+ @include breakpoint.up(x3l) {
165
+ @include tools.show-label();
166
+ }
167
+ }
168
+
169
+ @each $priority in map.keys(settings.$themeable-properties) {
170
+ @each $color in settings.$colors {
171
+ @include collections.generate-class(
172
+ $prefix: "rui-",
173
+ $component-name: "Button",
174
+ $modifier-name: "priority",
175
+ $modifier-value: $priority,
176
+ $variant-name: "color",
177
+ $variant-value: $color,
178
+ $generate-interaction-states: true,
179
+ $properties: map.get(settings.$themeable-properties, $priority),
180
+ );
181
+ }
182
+ }
183
+ }
@@ -23,10 +23,13 @@ See [API](#api) for all available options.
23
23
  - Use **short yet comprehensible labels** to make buttons fit small screens.
24
24
 
25
25
  - Since buttons are there to take actions, **use a verb** to make it obvious
26
- what your buttons do.
26
+ what your buttons do.
27
27
 
28
28
  - **Don't overwhelm your UI** with too many high-emphasis actions. There should
29
- always be one but chances are that having more of them is not necessary.
29
+ always be one but chances are that having more of them is not necessary.
30
+
31
+ - Ensure the **button action is well recognazible** across your target audience.
32
+ This is especially important when using the button [with an icon only](#icon-buttons).
30
33
 
31
34
  ## Priorities
32
35
 
@@ -37,8 +40,9 @@ lowest:
37
40
  2. outline
38
41
  3. flat
39
42
 
40
- All priorities come in supported
41
- [component colors](/docs/foundation/colors#component-colors).
43
+ All priorities are available in colors from supported
44
+ [color collections](/docs/foundation/collections#colors).
45
+ Check [API](#api) to see which collections are supported.
42
46
 
43
47
  ### Filled
44
48
 
@@ -144,8 +148,11 @@ before or after the button's label.
144
148
 
145
149
  ### Icon Buttons
146
150
 
147
- For clear and simple actions, buttons can visually consist just of an icon.
148
- Label remains mandatory to keep the button accessible.
151
+ With a common and well-known icon, buttons can visually consist just of an icon.
152
+ Label remains mandatory to keep the button accessible when using assistive
153
+ technologies.
154
+
155
+ 👉 Use `labelVisibility="xs"` to make label always visible.
149
156
 
150
157
  ```docoff-react-preview
151
158
  <Button
@@ -161,6 +168,11 @@ of your choice and display label once you know there is enough room for it.
161
168
  📐 Try resizing your browser to see how label visibility changes.
162
169
 
163
170
  ```docoff-react-preview
171
+ <Button
172
+ label="Label always visible"
173
+ labelVisibility="xs"
174
+ beforeLabel={<rui-icon icon="pencil" />}
175
+ />
164
176
  <Button
165
177
  label="Label visible from sm up"
166
178
  labelVisibility="sm"
@@ -181,16 +193,6 @@ of your choice and display label once you know there is enough room for it.
181
193
  labelVisibility="xl"
182
194
  beforeLabel={<rui-icon icon="pencil" />}
183
195
  />
184
- <Button
185
- label="Label visible from x2l up"
186
- labelVisibility="x2l"
187
- beforeLabel={<rui-icon icon="pencil" />}
188
- />
189
- <Button
190
- label="Label visible from x3l up"
191
- labelVisibility="x3l"
192
- beforeLabel={<rui-icon icon="pencil" />}
193
- />
194
196
  ```
195
197
 
196
198
  ## Buttons with Badges
@@ -256,7 +258,7 @@ Disabled state makes the action unavailable.
256
258
 
257
259
  When user's action triggers an asynchronous process on background, the button's
258
260
  feedback state (not to be mistaken with
259
- [feedback colors](/docs/foundation/colors#component-colors)) can be indicated by
261
+ [feedback colors](/docs/foundation/colors#feedback-colors)) can be indicated by
260
262
  showing an icon. The icon replaces button's label while retaining original
261
263
  dimensions of the button. Buttons in feedback state are automatically disabled
262
264
  to prevent unwanted interaction.
@@ -388,10 +390,11 @@ animation is made.
388
390
  ## Forwarding HTML Attributes
389
391
 
390
392
  In addition to the options below in the [component's API](#api) section, you
391
- can specify **any HTML attribute you like.** All attributes that don't interfere
392
- with the API of the React component are forwarded to the root `<button>` HTML
393
- element. This enables making the component interactive and helps to improve
394
- its accessibility.
393
+ can specify **any HTML attribute you like.** All attributes that don't
394
+ interfere with the API of the React component and that aren't filtered out by
395
+ [`transferProps`](/docs/js-helpers/transferProps) helper are forwarded to the
396
+ root `<button>` HTML element. This enables making the component interactive and
397
+ helps to improve its accessibility.
395
398
 
396
399
  👉 For the full list of supported attributes refer to:
397
400
 
@@ -429,9 +432,10 @@ Where:
429
432
 
430
433
  - `<PRIORITY>` is one of `filled`, `outline`, or `flat` (see
431
434
  [Priorities](#priorities) and [API](#api)),
432
- - `<COLOR>` is one of supported
433
- [component colors](/docs/foundation/colors#component-colors)
434
- (see color variants of [each priority](#priorities) and [API](#api)),
435
+ - `<COLOR>` is a value from supported
436
+ [color collections](/docs/foundation/collections#colors)
437
+ (check color variants of [each priority](#priorities) and [API](#api) to see
438
+ which collections are supported),
435
439
  - `<INTERACTION STATE>` is one of `default`, `hover`, `active`, or `disabled`
436
440
  (the last one being optional),
437
441
  - `<PROPERTY>` is one of:
@@ -1,3 +1,5 @@
1
+ @use "sass:list";
2
+ @use "../../styles/settings/collections";
1
3
  @use "../../styles/theme/typography";
2
4
  @use "../../styles/tools/spacing";
3
5
 
@@ -12,9 +14,12 @@ $group-z-indexes: (
12
14
  button-overflowing-elements: 3,
13
15
  );
14
16
 
15
- $themeable-variants: (primary, secondary, selected, success, warning, danger, help, info, note, light, dark);
16
- $themeable-states: (default, hover, active, disabled);
17
- $themeable-priority-properties: (
17
+ $colors:
18
+ list.join(
19
+ list.join(collections.$action-colors, collections.$feedback-colors),
20
+ collections.$neutral-colors
21
+ );
22
+ $themeable-properties: (
18
23
  filled: (color, border-color, background, box-shadow),
19
24
  outline: (color, border-color, background),
20
25
  flat: (color, background),
@@ -1,6 +1,3 @@
1
- // Priority and variant specific theme options are obtained dynamically because there is way too
2
- // many of them to maintain manually. See `_tools.scss` for details.
3
-
4
1
  $font-weight: var(--rui-Button__font-weight);
5
2
  $letter-spacing: var(--rui-Button__letter-spacing);
6
3
  $text-transform: var(--rui-Button__text-transform);
@@ -1,71 +1,23 @@
1
- // 1. Due to complexity, it's easier and safer to resolve variant custom properties dynamically with
2
- // a mixin. This way it's also easier to make theming adjustments to all supported modifications
3
- // in one place. This applies to the following button priorities:
1
+ // 1. Get ready for position of corner elements and group separator.
4
2
  //
5
- // - filled
6
- // - outline
7
- // - flat
3
+ // 2. Icon buttons should appear as squares, that's why width and height is equal here.
8
4
  //
9
- // 2. Disabled state theming is optional so `default` theme options are used if no `disabled`
10
- // styling is provided for specific variant.
11
- //
12
- // 3. Get ready for position of corner elements and group separator.
13
- //
14
- // 4. Icon buttons should appear as squares, that's why width and height is equal here.
15
- //
16
- // 5. Use original padding to restore square buttons back to their size.
5
+ // 3. Use original padding to restore square buttons back to their size.
17
6
 
18
7
  @use "sass:list";
19
8
  @use "sass:map";
20
- @use "sass:math";
21
9
  @use "../../styles/tools/accessibility";
22
- @use "../../styles/tools/breakpoint";
23
10
  @use "../../styles/tools/transition";
24
11
  @use "settings";
25
12
  @use "theme";
26
13
 
27
- // 1.
28
- @mixin _get-themeable-properties($priority, $color, $state) {
29
- @if not list.index(map.keys(settings.$themeable-priority-properties), $priority) {
30
- @error "Invalid priority specified! #{$priority} doesn't exist. "
31
- + "Choose one of #{settings.$themeable-priority-properties}.";
32
- }
33
-
34
- @if not list.index(settings.$themeable-variants, $color) {
35
- @error "Invalid variant specified! #{$color} doesn't exist. "
36
- + "Choose one of #{settings.$themeable-variants}.";
37
- }
38
-
39
- @if not list.index(settings.$themeable-states, $state) {
40
- @error "Invalid state specified! #{$state} doesn't exist. "
41
- + "Choose one of #{settings.$themeable-states}.";
42
- }
43
-
44
- $properties: map.get(settings.$themeable-priority-properties, $priority);
45
-
46
- // 2.
47
- @if $state == "disabled" {
48
- @each $property in $properties {
49
- --rui-local-#{$property}:
50
- var(
51
- --rui-Button--#{$priority}--#{$color}--#{$state}__#{$property},
52
- var(--rui-Button--#{$priority}--#{$color}--default__#{$property})
53
- );
54
- }
55
- } @else {
56
- @each $property in $properties {
57
- --rui-local-#{$property}: var(--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property});
58
- }
59
- }
60
- }
61
-
62
- // 4.
14
+ // 2.
63
15
  @mixin _button-square() {
64
16
  --rui-local-padding: 0;
65
17
  --rui-local-width: var(--rui-local-height);
66
18
  }
67
19
 
68
- // 5.
20
+ // 3.
69
21
  @mixin _button-size-restore() {
70
22
  --rui-local-padding: var(--rui-local-padding-original);
71
23
  --rui-local-width: unset;
@@ -74,7 +26,7 @@
74
26
  @mixin button() {
75
27
  @include transition.add((opacity, color, border-color, background-color, box-shadow));
76
28
 
77
- position: relative; // 3.
29
+ position: relative; // 1.
78
30
  display: inline-flex;
79
31
  column-gap: settings.$icon-spacing;
80
32
  align-items: center;
@@ -112,26 +64,10 @@
112
64
 
113
65
  --rui-local-height: #{map.get($properties, height)};
114
66
  --rui-local-padding: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)};
115
- --rui-local-padding-original: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)}; // 5.
67
+ --rui-local-padding-original: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)}; // 3.
116
68
  --rui-local-font-size: #{map.get($properties, font-size)};
117
69
  }
118
70
 
119
- @mixin button-color($priority, $color) {
120
- @include _get-themeable-properties($priority, $color, default);
121
-
122
- &:disabled {
123
- @include _get-themeable-properties($priority, $color, disabled);
124
- }
125
-
126
- &:not(:disabled):hover {
127
- @include _get-themeable-properties($priority, $color, hover);
128
- }
129
-
130
- &:not(:disabled):active {
131
- @include _get-themeable-properties($priority, $color, active);
132
- }
133
- }
134
-
135
71
  @mixin hide-label() {
136
72
  @include _button-square();
137
73
 
@@ -4,9 +4,9 @@ import React, {
4
4
  } from 'react';
5
5
  import { withGlobalProps } from '../../provider';
6
6
  import { classNames } from '../../utils/classNames';
7
- import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
7
+ import { transferProps } from '../../utils/transferProps';
8
+ import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
8
9
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
9
- import { transferProps } from '../_helpers/transferProps';
10
10
  import styles from './ButtonGroup.module.scss';
11
11
  import { ButtonGroupContext } from './ButtonGroupContext';
12
12
 
@@ -249,10 +249,11 @@ and communicating the state of individual options.
249
249
  ## Forwarding HTML Attributes
250
250
 
251
251
  In addition to the options below in the [component's API](#api) section, you
252
- can specify **any HTML attribute you like.** All attributes that don't interfere
253
- with the API of the React component are forwarded to the root `<div>` HTML
254
- element. This enables making the component interactive and helps to improve
255
- its accessibility.
252
+ can specify **any HTML attribute you like.** All attributes that don't
253
+ interfere with the API of the React component and that aren't filtered out by
254
+ [`transferProps`](/docs/js-helpers/transferProps) helper are forwarded to the
255
+ root `<div>` HTML element. This enables making the component interactive and
256
+ helps to improve its accessibility.
256
257
 
257
258
  👉 For the full list of supported attributes refer to:
258
259
 
@@ -1,8 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
- import { transferProps } from '../_helpers/transferProps';
5
4
  import { classNames } from '../../utils/classNames';
5
+ import { transferProps } from '../../utils/transferProps';
6
6
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
7
7
  import styles from './Card.module.scss';
8
8
 
@@ -44,7 +44,8 @@ Card.propTypes = {
44
44
  */
45
45
  children: PropTypes.node.isRequired,
46
46
  /**
47
- * [Color variant](/docs/foundation/colors#component-colors) to clarify importance and meaning of the card.
47
+ * Color to clarify importance and meaning of the card. Implements
48
+ * [Feedback and Neutral color collections](/docs/foundation/collections#colors).
48
49
  */
49
50
  color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
50
51
  /**
@@ -1,7 +1,8 @@
1
1
  // 1. Retain equal card widths in flex and grid layouts independently on their content.
2
2
 
3
+ @use "../../styles/tools/collections";
4
+ @use "settings";
3
5
  @use "theme";
4
- @use "tools";
5
6
 
6
7
  @layer components.card {
7
8
  .root {
@@ -33,36 +34,14 @@
33
34
  box-shadow: theme.$raised-box-shadow;
34
35
  }
35
36
 
36
- .isRootColorSuccess {
37
- @include tools.color(success);
38
- }
39
-
40
- .isRootColorWarning {
41
- @include tools.color(warning);
42
- }
43
-
44
- .isRootColorDanger {
45
- @include tools.color(danger);
46
- }
47
-
48
- .isRootColorHelp {
49
- @include tools.color(help);
50
- }
51
-
52
- .isRootColorInfo {
53
- @include tools.color(info);
54
- }
55
-
56
- .isRootColorNote {
57
- @include tools.color(note);
58
- }
59
-
60
- .isRootColorLight {
61
- @include tools.color(light);
62
- }
63
-
64
- .isRootColorDark {
65
- @include tools.color(dark);
37
+ @each $color in settings.$colors {
38
+ @include collections.generate-class(
39
+ $prefix: "rui-",
40
+ $component-name: "Card",
41
+ $variant-name: "color",
42
+ $variant-value: $color,
43
+ $properties: settings.$themeable-properties,
44
+ );
66
45
  }
67
46
 
68
47
  .isRootDisabled {
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
- import { transferProps } from '../_helpers/transferProps';
4
+ import { transferProps } from '../../utils/transferProps';
5
5
  import styles from './Card.module.scss';
6
6
 
7
7
  export const CardBody = ({
@@ -1,8 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
+ import { transferProps } from '../../utils/transferProps';
4
5
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
5
- import { transferProps } from '../_helpers/transferProps';
6
6
  import styles from './Card.module.scss';
7
7
 
8
8
  export const CardFooter = ({
@@ -147,9 +147,8 @@ for card content.
147
147
 
148
148
  ## Color Variants
149
149
 
150
- Card supports all
151
- [component colors](/docs/foundation/colors#component-colors) to cover different needs
152
- of your app.
150
+ To cover all possible needs of your project, Card is available in colors from
151
+ [Feedback and Neutral color collections](/docs/foundation/collections#colors).
153
152
 
154
153
  ```docoff-react-preview
155
154
  <Card color="success">
@@ -255,10 +254,11 @@ its interactive elements to disallow user's interaction.
255
254
  ## Forwarding HTML Attributes
256
255
 
257
256
  In addition to the options below in the [component's API](#api) section, you
258
- can specify **any HTML attribute you like.** All attributes that don't interfere
259
- with the API of the React component are forwarded to the root `<div>` HTML
260
- element. This enables making the component interactive and helps to improve
261
- its accessibility.
257
+ can specify **any HTML attribute you like.** All attributes that don't
258
+ interfere with the API of the React component and that aren't filtered out by
259
+ [`transferProps`](/docs/js-helpers/transferProps) helper are forwarded to the
260
+ root `<div>` HTML element. This enables making the component interactive and
261
+ helps to improve its accessibility.
262
262
 
263
263
  👉 For the full list of supported attributes refer to:
264
264
 
@@ -306,9 +306,10 @@ looks as follows:
306
306
 
307
307
  Where:
308
308
 
309
- - `<COLOR>` is one of supported
310
- [component colors](/docs/foundation/colors#component-colors)
311
- (see [color variants](#color-variants) and [API](#api)),
309
+ - `<COLOR>` is a value from supported
310
+ [color collections](/docs/foundation/collections#colors)
311
+ (check [color variants](#color-variants) and [API](#api) to see which
312
+ collections are supported),
312
313
  - `<PROPERTY>` is one of `color` (color of text), `border-color`, or
313
314
  `background-color`.
314
315
 
@@ -0,0 +1,5 @@
1
+ @use "sass:list";
2
+ @use "../../styles/settings/collections";
3
+
4
+ $colors: list.join(collections.$feedback-colors, collections.$neutral-colors);
5
+ $themeable-properties: color, border-color, background-color;
@@ -7,46 +7,3 @@ $raised-box-shadow: var(--rui-Card--raised__box-shadow);
7
7
 
8
8
  $disabled-background-color: var(--rui-Card--disabled__background-color);
9
9
  $disabled-opacity: var(--rui-Card--disabled__opacity);
10
-
11
- $colors: (
12
- success: (
13
- color: var(--rui-Card--success__color),
14
- border-color: var(--rui-Card--success__border-color),
15
- background-color: var(--rui-Card--success__background-color),
16
- ),
17
- warning: (
18
- color: var(--rui-Card--warning__color),
19
- border-color: var(--rui-Card--warning__border-color),
20
- background-color: var(--rui-Card--warning__background-color),
21
- ),
22
- danger: (
23
- color: var(--rui-Card--danger__color),
24
- border-color: var(--rui-Card--danger__border-color),
25
- background-color: var(--rui-Card--danger__background-color),
26
- ),
27
- info: (
28
- color: var(--rui-Card--info__color),
29
- border-color: var(--rui-Card--info__border-color),
30
- background-color: var(--rui-Card--info__background-color),
31
- ),
32
- help: (
33
- color: var(--rui-Card--help__color),
34
- border-color: var(--rui-Card--help__border-color),
35
- background-color: var(--rui-Card--help__background-color),
36
- ),
37
- note: (
38
- color: var(--rui-Card--note__color),
39
- border-color: var(--rui-Card--note__border-color),
40
- background-color: var(--rui-Card--note__background-color),
41
- ),
42
- light: (
43
- color: var(--rui-Card--light__color),
44
- border-color: var(--rui-Card--light__border-color),
45
- background-color: var(--rui-Card--light__background-color),
46
- ),
47
- dark: (
48
- color: var(--rui-Card--dark__color),
49
- border-color: var(--rui-Card--dark__border-color),
50
- background-color: var(--rui-Card--dark__background-color),
51
- ),
52
- );
@@ -2,8 +2,8 @@ import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { classNames } from '../../utils/classNames';
5
+ import { transferProps } from '../../utils/transferProps';
5
6
  import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
6
- import { transferProps } from '../_helpers/transferProps';
7
7
  import { FormLayoutContext } from '../FormLayout';
8
8
  import styles from './CheckboxField.module.scss';
9
9
 
@@ -114,7 +114,7 @@ CheckboxField.propTypes = {
114
114
  /**
115
115
  * Checkbox field label.
116
116
  */
117
- label: PropTypes.string.isRequired,
117
+ label: PropTypes.node.isRequired,
118
118
  /**
119
119
  * Placement of the label relative to the input.
120
120
  */