@react-ui-org/react-ui 0.55.1 → 0.57.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 (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
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.55.1",
4
+ "version": "0.57.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -29,8 +29,7 @@
29
29
  "url": "https://github.com/react-ui-org/react-ui"
30
30
  },
31
31
  "engines": {
32
- "node": ">=18",
33
- "npm": ">=9"
32
+ "node": ">=20"
34
33
  },
35
34
  "scripts": {
36
35
  "build": "webpack --mode=production && webpack --mode=development",
@@ -54,54 +53,57 @@
54
53
  },
55
54
  "peerDependencies": {
56
55
  "prop-types": "^15.8.0",
57
- "react": "^18.0.0",
58
- "react-dom": "^18.0.0"
56
+ "react": "~18.2.0",
57
+ "react-dom": "~18.2.0"
59
58
  },
60
59
  "devDependencies": {
61
- "@babel/cli": "^7.22.10",
62
- "@babel/core": "^7.22.11",
63
- "@babel/eslint-parser": "^7.22.11",
60
+ "@babel/cli": "^7.24.7",
61
+ "@babel/core": "^7.24.7",
62
+ "@babel/eslint-parser": "^7.24.7",
64
63
  "@babel/plugin-proposal-class-properties": "^7.18.6",
65
- "@babel/plugin-transform-spread": "^7.22.5",
66
- "@babel/preset-env": "^7.22.14",
67
- "@babel/preset-react": "^7.22.5",
68
- "@babel/register": "^7.22.5",
64
+ "@babel/plugin-transform-spread": "^7.24.7",
65
+ "@babel/preset-env": "^7.24.7",
66
+ "@babel/preset-react": "^7.24.7",
67
+ "@babel/register": "^7.24.6",
68
+ "@stylistic/stylelint-config": "^1.0.1",
69
69
  "@svgr/webpack": "^8.1.0",
70
- "@testing-library/jest-dom": "^6.1.2",
71
- "@testing-library/react": "^14.0.0",
72
- "@testing-library/user-event": "^14.4.3",
70
+ "@testing-library/jest-dom": "^6.4.6",
71
+ "@testing-library/react": "^16.0.0",
72
+ "@testing-library/user-event": "^14.5.2",
73
73
  "@visionappscz/eslint-config-visionapps": "^1.7.0",
74
- "@visionappscz/stylelint-config": "^3.0.0",
75
- "autoprefixer": "^10.4.15",
76
- "babel-jest": "^29.6.4",
74
+ "@visionappscz/stylelint-config": "^4.0.0",
75
+ "autoprefixer": "^10.4.19",
76
+ "babel-jest": "^29.7.0",
77
77
  "babel-loader": "^9.1.3",
78
- "core-js": "^3.32.1",
79
- "css-loader": "^6.10.0",
80
- "eslint": "^8.48.0",
78
+ "core-js": "^3.37.1",
79
+ "css-loader": "^7.1.2",
80
+ "eslint": "^8.57.0",
81
81
  "eslint-config-airbnb": "^19.0.4",
82
- "eslint-plugin-import": "^2.28.1",
83
- "eslint-plugin-jsx-a11y": "^6.7.1",
82
+ "eslint-plugin-import": "^2.29.1",
83
+ "eslint-plugin-jsx-a11y": "^6.9.0",
84
84
  "eslint-plugin-markdown": "^3.0.1",
85
- "eslint-plugin-react": "^7.33.2",
86
- "eslint-plugin-react-hooks": "^4.6.0",
85
+ "eslint-plugin-react": "^7.34.3",
86
+ "eslint-plugin-react-hooks": "^4.6.2",
87
87
  "identity-obj-proxy": "^3.0.0",
88
- "jest": "^29.6.4",
89
- "jest-environment-jsdom": "^29.6.4",
90
- "markdownlint-cli2": "~0.9.2",
91
- "mini-css-extract-plugin": "^2.7.6",
92
- "postcss": "^8.4.29",
93
- "postcss-loader": "^7.3.3",
88
+ "jest": "^29.7.0",
89
+ "jest-environment-jsdom": "^29.7.0",
90
+ "markdownlint-cli2": "^0.13.0",
91
+ "mini-css-extract-plugin": "^2.9.0",
92
+ "postcss": "^8.4.39",
93
+ "postcss-loader": "^8.1.1",
94
94
  "prop-types": "^15.8.1",
95
- "sass": "^1.66.1",
96
- "sass-loader": "^13.3.2",
97
- "stylelint": "^14.16.1",
98
- "stylelint-webpack-plugin": "^4.1.1",
99
- "terser-webpack-plugin": "^5.3.9",
100
- "webpack": "^5.69.1",
95
+ "react": "~18.2.0",
96
+ "react-dom": "~18.2.0",
97
+ "sass": "^1.77.6",
98
+ "sass-loader": "^14.2.1",
99
+ "stylelint": "^16.7.0",
100
+ "stylelint-webpack-plugin": "^5.0.1",
101
+ "terser-webpack-plugin": "^5.3.10",
102
+ "webpack": "^5.92.1",
101
103
  "webpack-cli": "^5.1.4",
102
- "webpack-visualizer-plugin2": "^1.0.0"
104
+ "webpack-visualizer-plugin2": "^1.1.0"
103
105
  },
104
106
  "resolutions": {
105
- "@babel/plugin-transform-spread": "7.12.1"
107
+ "@babel/plugin-transform-spread": "7.24.7"
106
108
  }
107
109
  }
package/src/CNAME ADDED
@@ -0,0 +1 @@
1
+ react-ui.io
@@ -4,8 +4,8 @@ import {
4
4
  RUIContext,
5
5
  withGlobalProps,
6
6
  } from '../../provider';
7
- import { transferProps } from '../_helpers/transferProps';
8
7
  import { classNames } from '../../utils/classNames';
8
+ import { transferProps } from '../../utils/transferProps';
9
9
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
10
10
  import styles from './Alert.module.scss';
11
11
 
@@ -70,7 +70,8 @@ Alert.propTypes = {
70
70
  */
71
71
  children: PropTypes.node.isRequired,
72
72
  /**
73
- * [Color variant](/docs/foundation/colors#component-colors) to clarify importance and meaning of the alert.
73
+ * Color variant to clarify importance and meaning of the alert. Implements
74
+ * [Feedback and Neutral color collections](/docs/foundation/collections#colors).
74
75
  */
75
76
  color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
76
77
  /**
@@ -1,10 +1,10 @@
1
1
  @use "sass:map";
2
2
  @use "../../styles/theme/typography";
3
3
  @use "../../styles/tools/accessibility";
4
+ @use "../../styles/tools/collections";
4
5
  @use "../../styles/tools/reset";
5
6
  @use "settings";
6
7
  @use "theme";
7
- @use "tools";
8
8
 
9
9
  @layer components.alert {
10
10
  .root {
@@ -66,35 +66,13 @@
66
66
  top: -0.1em;
67
67
  }
68
68
 
69
- .isRootColorSuccess {
70
- @include tools.color(success);
71
- }
72
-
73
- .isRootColorWarning {
74
- @include tools.color(warning);
75
- }
76
-
77
- .isRootColorDanger {
78
- @include tools.color(danger);
79
- }
80
-
81
- .isRootColorHelp {
82
- @include tools.color(help);
83
- }
84
-
85
- .isRootColorInfo {
86
- @include tools.color(info);
87
- }
88
-
89
- .isRootColorNote {
90
- @include tools.color(note);
91
- }
92
-
93
- .isRootColorLight {
94
- @include tools.color(light);
95
- }
96
-
97
- .isRootColorDark {
98
- @include tools.color(dark);
69
+ @each $color in settings.$colors {
70
+ @include collections.generate-class(
71
+ $prefix: "rui-",
72
+ $component-name: "Alert",
73
+ $variant-name: "color",
74
+ $variant-value: $color,
75
+ $properties: settings.$themeable-properties,
76
+ );
99
77
  }
100
78
  }
@@ -31,8 +31,8 @@ See [API](#api) for all available options.
31
31
 
32
32
  ## Color Variants
33
33
 
34
- All [component colors](/docs/foundation/colors#component-colors) are supported by
35
- alert to cover all possible needs of your project.
34
+ To cover all possible needs of your project, Alert is available in colors from
35
+ [Feedback and Neutral color collections](/docs/foundation/collections#colors).
36
36
 
37
37
  ### Success
38
38
 
@@ -171,10 +171,11 @@ React.createElement(() => {
171
171
  ## Forwarding HTML Attributes
172
172
 
173
173
  In addition to the options below in the [component's API](#api) section, you
174
- can specify **any HTML attribute you like.** All attributes that don't interfere
175
- with the API of the React component are forwarded to the root `<div>` HTML
176
- element. This enables making the component interactive and helps to improve
177
- its accessibility.
174
+ can specify **any HTML attribute you like.** All attributes that don't
175
+ interfere with the API of the React component and that aren't filtered out by
176
+ [`transferProps`](/docs/js-helpers/transferProps) helper are forwarded to the
177
+ root `<div>` HTML element. This enables making the component interactive and
178
+ helps to improve its accessibility.
178
179
 
179
180
  👉 For the full list of supported attributes refer to:
180
181
 
@@ -207,9 +208,10 @@ convention looks as follows:
207
208
 
208
209
  Where:
209
210
 
210
- - `<COLOR>` is one of supported
211
- [component colors](/docs/foundation/colors#component-colors)
212
- (see alert [color variants](#color-variants) and [API](#api)),
211
+ - `<COLOR>` is a value from supported
212
+ [color collections](/docs/foundation/collections#colors)
213
+ (check [color variants](#color-variants) and [API](#api) to see which
214
+ collections are supported),
213
215
  - `<PROPERTY>` is one of `color` (color of text), `foreground-color` (color of
214
216
  border, icon, links, and emphasis), or `background-color`.
215
217
 
@@ -1,7 +1,12 @@
1
+ @use "sass:list";
1
2
  @use "sass:map";
3
+ @use "../../styles/settings/collections";
2
4
  @use "../../styles/theme/typography";
3
5
  @use "theme";
4
6
 
5
7
  $font-size: map.get(typography.$font-size-values, 1);
6
8
  $line-height: typography.$line-height-base;
7
9
  $min-height: calc(#{$font-size} * #{$line-height} + 2 * #{theme.$padding});
10
+
11
+ $colors: list.join(collections.$feedback-colors, collections.$neutral-colors);
12
+ $themeable-properties: color, foreground-color, background-color;
@@ -4,46 +4,3 @@ $border-width: var(--rui-Alert__border-width);
4
4
  $border-radius: var(--rui-Alert__border-radius);
5
5
  $emphasis-font-weight: var(--rui-Alert__emphasis__font-weight);
6
6
  $stripe-width: var(--rui-Alert__stripe__width);
7
-
8
- $colors: (
9
- success: (
10
- color: var(--rui-Alert--success__color),
11
- foreground-color: var(--rui-Alert--success__foreground-color),
12
- background-color: var(--rui-Alert--success__background-color),
13
- ),
14
- warning: (
15
- color: var(--rui-Alert--warning__color),
16
- foreground-color: var(--rui-Alert--warning__foreground-color),
17
- background-color: var(--rui-Alert--warning__background-color),
18
- ),
19
- danger: (
20
- color: var(--rui-Alert--danger__color),
21
- foreground-color: var(--rui-Alert--danger__foreground-color),
22
- background-color: var(--rui-Alert--danger__background-color),
23
- ),
24
- info: (
25
- color: var(--rui-Alert--info__color),
26
- foreground-color: var(--rui-Alert--info__foreground-color),
27
- background-color: var(--rui-Alert--info__background-color),
28
- ),
29
- help: (
30
- color: var(--rui-Alert--help__color),
31
- foreground-color: var(--rui-Alert--help__foreground-color),
32
- background-color: var(--rui-Alert--help__background-color),
33
- ),
34
- note: (
35
- color: var(--rui-Alert--note__color),
36
- foreground-color: var(--rui-Alert--note__foreground-color),
37
- background-color: var(--rui-Alert--note__background-color),
38
- ),
39
- light: (
40
- color: var(--rui-Alert--light__color),
41
- foreground-color: var(--rui-Alert--light__foreground-color),
42
- background-color: var(--rui-Alert--light__background-color),
43
- ),
44
- dark: (
45
- color: var(--rui-Alert--dark__color),
46
- foreground-color: var(--rui-Alert--dark__foreground-color),
47
- background-color: var(--rui-Alert--dark__background-color),
48
- ),
49
- );
@@ -1,9 +1,10 @@
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
+ import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
7
8
  import styles from './Badge.module.scss';
8
9
 
9
10
  export const Badge = ({
@@ -16,7 +17,7 @@ export const Badge = ({
16
17
  {...transferProps(restProps)}
17
18
  className={classNames(
18
19
  styles.root,
19
- priority === 'outline' && styles.isRootPriorityOutline,
20
+ getRootPriorityClassName(priority, styles),
20
21
  getRootColorClassName(color, styles),
21
22
  )}
22
23
  >
@@ -31,7 +32,8 @@ Badge.defaultProps = {
31
32
 
32
33
  Badge.propTypes = {
33
34
  /**
34
- * [Color variant](/docs/foundation/colors#component-colors) to clarify importance and meaning of the badge.
35
+ * Color to clarify importance and meaning of the badge. Implements
36
+ * [Feedback and Neutral color collections](/docs/foundation/collections#colors).
35
37
  */
36
38
  color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
37
39
  /**
@@ -2,14 +2,14 @@
2
2
  @use "sass:math";
3
3
  @use "../../styles/theme/borders";
4
4
  @use "../../styles/theme/typography";
5
-
6
- $_badge-size: 1.25rem;
5
+ @use "../../styles/tools/collections";
6
+ @use "settings";
7
7
 
8
8
  @layer components.badge {
9
9
  .root {
10
10
  display: inline-block;
11
- min-width: $_badge-size;
12
- height: $_badge-size;
11
+ min-width: settings.$badge-size;
12
+ height: settings.$badge-size;
13
13
  padding: 0.25rem 0.35rem;
14
14
  overflow: hidden;
15
15
  font-weight: map.get(typography.$font-weight-values, bold);
@@ -19,91 +19,46 @@ $_badge-size: 1.25rem;
19
19
  white-space: nowrap;
20
20
  vertical-align: baseline;
21
21
  color: var(--rui-local-color);
22
- border-radius: math.div($_badge-size, 2);
23
- background-color: var(--rui-local-background-color);
24
- box-shadow: var(--rui-local-box-shadow, #{0 0 0 2px rgb(255 255 255 / 80%)});
25
- }
26
-
27
- .isRootColorSuccess {
28
- --rui-local-color: var(--rui-color-feedback-on-success);
29
- --rui-local-background-color: var(--rui-color-feedback-success);
30
- }
31
-
32
- .isRootColorWarning {
33
- --rui-local-color: var(--rui-color-feedback-on-warning);
34
- --rui-local-background-color: var(--rui-color-feedback-warning);
35
- }
36
-
37
- .isRootColorDanger {
38
- --rui-local-color: var(--rui-color-feedback-on-danger);
39
- --rui-local-background-color: var(--rui-color-feedback-danger);
40
- }
41
-
42
- .isRootColorHelp {
43
- --rui-local-color: var(--rui-color-feedback-on-help);
44
- --rui-local-background-color: var(--rui-color-feedback-help);
45
- }
46
-
47
- .isRootColorInfo {
48
- --rui-local-color: var(--rui-color-feedback-on-info);
49
- --rui-local-background-color: var(--rui-color-feedback-info);
22
+ border-radius: math.div(settings.$badge-size, 2);
50
23
  }
51
24
 
52
- .isRootColorNote {
53
- --rui-local-color: var(--rui-color-feedback-on-note);
54
- --rui-local-background-color: var(--rui-color-feedback-note);
25
+ .isRootPriorityFilled {
26
+ background-color: var(--rui-local-background-color);
27
+ box-shadow: var(--rui-local-box-shadow, #{0 0 0 2px rgb(255 255 255 / 80%)});
55
28
  }
56
29
 
57
- .isRootColorLight {
58
- --rui-local-color: var(--rui-color-neutral-on-light);
59
- --rui-local-background-color: var(--rui-color-neutral-light);
60
- --rui-local-box-shadow: none;
30
+ @each $color in settings.$colors {
31
+ @include collections.generate-class(
32
+ $prefix: "rui-",
33
+ $component-name: "Badge",
34
+ $modifier-name: "priority",
35
+ $modifier-value: "filled",
36
+ $variant-name: "color",
37
+ $variant-value: $color,
38
+ $properties: settings.$themeable-properties-filled,
39
+ );
61
40
  }
62
41
 
42
+ .isRootColorLight,
63
43
  .isRootColorDark {
64
- --rui-local-color: var(--rui-color-neutral-on-dark);
65
- --rui-local-background-color: var(--rui-color-neutral-dark);
66
44
  --rui-local-box-shadow: none;
67
45
  }
68
46
 
69
47
  .isRootPriorityOutline {
70
- --rui-local-background-color: transparent;
71
- --rui-local-box-shadow: none;
72
-
73
48
  padding-top: 0.1875rem;
74
49
  padding-bottom: 0.1875rem;
75
50
  border: borders.$width solid currentcolor;
76
51
  }
77
52
 
78
- .isRootPriorityOutline.isRootColorSuccess {
79
- --rui-local-color: var(--rui-color-feedback-success);
80
- }
81
-
82
- .isRootPriorityOutline.isRootColorWarning {
83
- --rui-local-color: var(--rui-color-feedback-warning);
84
- }
85
-
86
- .isRootPriorityOutline.isRootColorDanger {
87
- --rui-local-color: var(--rui-color-feedback-danger);
88
- }
89
-
90
- .isRootPriorityOutline.isRootColorHelp {
91
- --rui-local-color: var(--rui-color-feedback-help);
92
- }
93
-
94
- .isRootPriorityOutline.isRootColorInfo {
95
- --rui-local-color: var(--rui-color-feedback-info);
96
- }
97
-
98
- .isRootPriorityOutline.isRootColorNote {
99
- --rui-local-color: var(--rui-color-feedback-note);
100
- }
101
-
102
- .isRootPriorityOutline.isRootColorLight {
103
- --rui-local-color: var(--rui-color-neutral-light);
104
- }
105
-
106
- .isRootPriorityOutline.isRootColorDark {
107
- --rui-local-color: var(--rui-color-neutral-dark);
53
+ @each $color in settings.$colors {
54
+ @include collections.generate-class(
55
+ $prefix: "rui-",
56
+ $component-name: "Badge",
57
+ $modifier-name: "priority",
58
+ $modifier-value: "outline",
59
+ $variant-name: "color",
60
+ $variant-value: $color,
61
+ $properties: settings.$themeable-properties-outline,
62
+ );
108
63
  }
109
64
  }
@@ -29,8 +29,9 @@ lowest:
29
29
  1. filled
30
30
  2. outline
31
31
 
32
- All priorities come in supported
33
- [component colors](/docs/foundation/colors#component-colors).
32
+ All priorities are available in colors from supported
33
+ [color collections](/docs/foundation/collections#colors).
34
+ Check [API](#api) to see which collections are supported.
34
35
 
35
36
  ### Filled
36
37
 
@@ -87,10 +88,11 @@ Medium-emphasis priority to provide additional context in an unobtrusive way.
87
88
  ## Forwarding HTML Attributes
88
89
 
89
90
  In addition to the options below in the [component's API](#api) section, you
90
- can specify **any HTML attribute you like.** All attributes that don't interfere
91
- with the API of the React component are forwarded to the root `<div>` HTML
92
- element. This enables making the component interactive and helps to improve
93
- its accessibility.
91
+ can specify **any HTML attribute you like.** All attributes that don't
92
+ interfere with the API of the React component and that aren't filtered out by
93
+ [`transferProps`](/docs/js-helpers/transferProps) helper are forwarded to the
94
+ root `<div>` HTML element. This enables making the component interactive and
95
+ helps to improve its accessibility.
94
96
 
95
97
  👉 For the full list of supported attributes refer to:
96
98
 
@@ -101,5 +103,21 @@ its accessibility.
101
103
 
102
104
  <docoff-react-props src="/components/Badge/Badge.jsx" />
103
105
 
106
+ ## Theming
107
+
108
+ It's possible to adjust the theme of specific badge color variant. Naming
109
+ convention looks as follows:
110
+
111
+ `--rui-Badge--<PRIORITY>--<COLOR>__<PROPERTY>`
112
+
113
+ Where:
114
+
115
+ - `<PRIORITY>` is one of `filled` or `outline`,
116
+ - `<COLOR>` is a value from supported
117
+ [color collections](/docs/foundation/collections#colors)
118
+ (check [API](#api) to see which collections are supported),
119
+ - `<PROPERTY>` is one of `color` (color of text) or `background-color` for the
120
+ filled priority, or just `color` for the outline priority.
121
+
104
122
  [div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
105
123
  [React common props]: https://react.dev/reference/react-dom/components/common#common-props
@@ -0,0 +1,8 @@
1
+ @use "sass:list";
2
+ @use "../../styles/settings/collections";
3
+
4
+ $badge-size: 1.25rem;
5
+
6
+ $colors: list.join(collections.$feedback-colors, collections.$neutral-colors);
7
+ $themeable-properties-filled: color, background-color;
8
+ $themeable-properties-outline: color;
@@ -2,13 +2,13 @@ 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 { getRootColorClassName } from '../_helpers/getRootColorClassName';
7
+ import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
6
8
  import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
7
9
  import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
8
- import { transferProps } from '../_helpers/transferProps';
9
10
  import { ButtonGroupContext } from '../ButtonGroup';
10
11
  import { InputGroupContext } from '../InputGroup/InputGroupContext';
11
- import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
12
12
  import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
13
13
  import styles from './Button.module.scss';
14
14
 
@@ -133,7 +133,8 @@ Button.propTypes = {
133
133
  */
134
134
  block: PropTypes.bool,
135
135
  /**
136
- * [Color variant](/docs/foundation/colors#component-colors) to clarify importance and meaning of the button.
136
+ * Color variant to clarify importance and meaning of the alert. Implements
137
+ * [Action, Feedback and Neutral color collections](/docs/foundation/collections#colors).
137
138
  */
138
139
  color: PropTypes.oneOf(
139
140
  ['primary', 'secondary', 'selected', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark'],