@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.
- package/.nvmrc +1 -1
- package/dist/react-ui.css +15 -20
- package/dist/react-ui.development.css +2336 -846
- package/dist/react-ui.development.js +106 -96
- package/dist/react-ui.js +1 -1
- package/package.json +41 -39
- package/src/CNAME +1 -0
- package/src/components/Alert/Alert.jsx +3 -2
- package/src/components/Alert/Alert.module.scss +9 -31
- package/src/components/Alert/README.md +11 -9
- package/src/components/Alert/_settings.scss +5 -0
- package/src/components/Alert/_theme.scss +0 -43
- package/src/components/Badge/Badge.jsx +5 -3
- package/src/components/Badge/Badge.module.scss +29 -74
- package/src/components/Badge/README.md +24 -6
- package/src/components/Badge/_settings.scss +8 -0
- package/src/components/Button/Button.jsx +4 -3
- package/src/components/Button/Button.module.scss +183 -2
- package/src/components/Button/README.md +28 -24
- package/src/components/Button/_settings.scss +8 -3
- package/src/components/Button/_theme.scss +0 -3
- package/src/components/Button/_tools.scss +7 -71
- package/src/components/ButtonGroup/ButtonGroup.jsx +2 -2
- package/src/components/ButtonGroup/README.md +5 -4
- package/src/components/Card/Card.jsx +3 -2
- package/src/components/Card/Card.module.scss +10 -31
- package/src/components/Card/CardBody.jsx +1 -1
- package/src/components/Card/CardFooter.jsx +1 -1
- package/src/components/Card/README.md +11 -10
- package/src/components/Card/_settings.scss +5 -0
- package/src/components/Card/_theme.scss +0 -43
- package/src/components/CheckboxField/CheckboxField.jsx +2 -2
- package/src/components/CheckboxField/README.md +8 -4
- package/src/components/FileInputField/FileInputField.jsx +3 -3
- package/src/components/FileInputField/README.md +8 -4
- package/src/components/FormLayout/FormLayout.jsx +1 -1
- package/src/components/FormLayout/FormLayoutCustomField.jsx +1 -1
- package/src/components/FormLayout/README.md +5 -4
- package/src/components/Grid/Grid.jsx +1 -1
- package/src/components/Grid/Grid.module.scss +5 -0
- package/src/components/Grid/GridSpan.jsx +1 -1
- package/src/components/Grid/README.md +6 -4
- package/src/components/Grid/_settings.scss +2 -2
- package/src/components/InputGroup/InputGroup.jsx +2 -2
- package/src/components/InputGroup/README.md +5 -4
- package/src/components/Modal/Modal.jsx +1 -1
- package/src/components/Modal/Modal.module.scss +1 -1
- package/src/components/Modal/ModalBody.jsx +1 -1
- package/src/components/Modal/ModalCloseButton.jsx +1 -1
- package/src/components/Modal/ModalContent.jsx +1 -1
- package/src/components/Modal/ModalFooter.jsx +1 -1
- package/src/components/Modal/ModalHeader.jsx +2 -4
- package/src/components/Modal/ModalTitle.jsx +2 -4
- package/src/components/Modal/README.md +3 -2
- package/src/components/Paper/Paper.jsx +1 -1
- package/src/components/Paper/README.md +5 -4
- package/src/components/Popover/Popover.jsx +1 -1
- package/src/components/Popover/Popover.module.scss +16 -16
- package/src/components/Popover/PopoverWrapper.jsx +1 -1
- package/src/components/Popover/README.md +5 -4
- package/src/components/Popover/_theme.scss +4 -2
- package/src/components/Radio/README.md +8 -4
- package/src/components/Radio/Radio.jsx +2 -2
- package/src/components/ScrollView/README.md +5 -4
- package/src/components/ScrollView/ScrollView.jsx +1 -1
- package/src/components/ScrollView/ScrollView.module.scss +2 -4
- package/src/components/SelectField/README.md +8 -4
- package/src/components/SelectField/SelectField.jsx +2 -2
- package/src/components/Table/README.md +5 -4
- package/src/components/Table/Table.jsx +1 -1
- package/src/components/Tabs/README.md +3 -2
- package/src/components/Tabs/Tabs.jsx +1 -1
- package/src/components/Tabs/TabsItem.jsx +1 -1
- package/src/components/Text/README.md +3 -2
- package/src/components/Text/Text.jsx +1 -1
- package/src/components/TextArea/README.md +8 -4
- package/src/components/TextArea/TextArea.jsx +2 -2
- package/src/components/TextField/README.md +8 -4
- package/src/components/TextField/TextField.jsx +2 -2
- package/src/components/TextLink/README.md +5 -4
- package/src/components/TextLink/TextLink.jsx +1 -1
- package/src/components/Toggle/README.md +8 -4
- package/src/components/Toggle/Toggle.jsx +2 -2
- package/src/components/Toolbar/README.md +5 -4
- package/src/components/Toolbar/Toolbar.jsx +1 -1
- package/src/components/Toolbar/ToolbarGroup.jsx +1 -1
- package/src/components/Toolbar/ToolbarItem.jsx +1 -1
- package/src/components/_helpers/getRootPriorityClassName.js +1 -1
- package/src/index.js +1 -0
- package/src/provider/RUIProvider.jsx +6 -3
- package/src/styles/settings/_collections.scss +9 -0
- package/src/styles/tools/_collections.scss +191 -0
- package/src/styles/tools/_string.scss +5 -2
- package/src/styles/tools/form-fields/_box-field-layout.scss +5 -0
- package/src/styles/tools/form-fields/_inline-field-layout.scss +1 -0
- package/src/theme.scss +64 -0
- package/src/utils/mergeDeep.js +28 -0
- package/src/{components/_helpers → utils}/transferProps.js +0 -8
- package/src/components/Alert/_tools.scss +0 -10
- package/src/components/Button/_base.scss +0 -159
- package/src/components/Button/_priorities.scss +0 -149
- 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.
|
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": ">=
|
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": "
|
58
|
-
"react-dom": "
|
56
|
+
"react": "~18.2.0",
|
57
|
+
"react-dom": "~18.2.0"
|
59
58
|
},
|
60
59
|
"devDependencies": {
|
61
|
-
"@babel/cli": "^7.
|
62
|
-
"@babel/core": "^7.
|
63
|
-
"@babel/eslint-parser": "^7.
|
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.
|
66
|
-
"@babel/preset-env": "^7.
|
67
|
-
"@babel/preset-react": "^7.
|
68
|
-
"@babel/register": "^7.
|
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.
|
71
|
-
"@testing-library/react": "^
|
72
|
-
"@testing-library/user-event": "^14.
|
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": "^
|
75
|
-
"autoprefixer": "^10.4.
|
76
|
-
"babel-jest": "^29.
|
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.
|
79
|
-
"css-loader": "^
|
80
|
-
"eslint": "^8.
|
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.
|
83
|
-
"eslint-plugin-jsx-a11y": "^6.
|
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.
|
86
|
-
"eslint-plugin-react-hooks": "^4.6.
|
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.
|
89
|
-
"jest-environment-jsdom": "^29.
|
90
|
-
"markdownlint-cli2": "
|
91
|
-
"mini-css-extract-plugin": "^2.
|
92
|
-
"postcss": "^8.4.
|
93
|
-
"postcss-loader": "^
|
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
|
-
"
|
96
|
-
"
|
97
|
-
"
|
98
|
-
"
|
99
|
-
"
|
100
|
-
"webpack": "^5.
|
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.
|
104
|
+
"webpack-visualizer-plugin2": "^1.1.0"
|
103
105
|
},
|
104
106
|
"resolutions": {
|
105
|
-
"@babel/plugin-transform-spread": "7.
|
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
|
-
*
|
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
|
-
|
70
|
-
@include
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
35
|
-
|
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
|
175
|
-
with the API of the React component
|
176
|
-
|
177
|
-
|
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
|
211
|
-
[
|
212
|
-
(
|
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
|
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
|
-
*
|
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
|
-
|
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:
|
12
|
-
height:
|
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(
|
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
|
-
.
|
53
|
-
|
54
|
-
|
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
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
33
|
-
[
|
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
|
91
|
-
with the API of the React component
|
92
|
-
|
93
|
-
|
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
|
-
*
|
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'],
|