@react-ui-org/react-ui 0.48.0 → 0.50.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.
- package/dist/lib.development.js +162 -66
- package/dist/lib.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/Alert/Alert.jsx +3 -0
- package/src/lib/components/Alert/Alert.scss +10 -10
- package/src/lib/components/Alert/README.mdx +14 -0
- package/src/lib/components/Badge/Badge.jsx +4 -8
- package/src/lib/components/Badge/Badge.scss +21 -21
- package/src/lib/components/Badge/README.mdx +14 -0
- package/src/lib/components/Button/Button.jsx +2 -13
- package/src/lib/components/Button/README.mdx +17 -5
- package/src/lib/components/Button/_base.scss +20 -20
- package/src/lib/components/Button/_priorities.scss +35 -35
- package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +7 -7
- package/src/lib/components/Button/helpers/getRootPriorityClassName.js +3 -3
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +0 -7
- package/src/lib/components/ButtonGroup/README.mdx +14 -0
- package/src/lib/components/Card/Card.jsx +6 -10
- package/src/lib/components/Card/Card.scss +13 -13
- package/src/lib/components/Card/CardBody.jsx +6 -10
- package/src/lib/components/Card/CardFooter.jsx +6 -7
- package/src/lib/components/Card/README.mdx +14 -0
- package/src/lib/components/CheckboxField/CheckboxField.jsx +1 -27
- package/src/lib/components/CheckboxField/README.mdx +17 -5
- package/src/lib/components/FileInputField/FileInputField.jsx +2 -12
- package/src/lib/components/FileInputField/FileInputField.scss +3 -7
- package/src/lib/components/FileInputField/README.mdx +29 -27
- package/src/lib/components/FormLayout/FormLayout.jsx +5 -9
- package/src/lib/components/FormLayout/FormLayout.scss +3 -3
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +4 -1
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +8 -8
- package/src/lib/components/FormLayout/README.mdx +13 -0
- package/src/lib/components/Grid/Grid.jsx +0 -7
- package/src/lib/components/Grid/GridSpan.jsx +0 -7
- package/src/lib/components/Grid/README.mdx +14 -0
- package/src/lib/components/Modal/Modal.jsx +7 -11
- package/src/lib/components/Modal/ModalBody.jsx +3 -7
- package/src/lib/components/Modal/ModalCloseButton.jsx +0 -16
- package/src/lib/components/Modal/ModalContent.jsx +3 -7
- package/src/lib/components/Modal/ModalFooter.jsx +3 -7
- package/src/lib/components/Modal/ModalFooter.scss +5 -5
- package/src/lib/components/Modal/ModalHeader.jsx +3 -7
- package/src/lib/components/Modal/ModalHeader.scss +5 -5
- package/src/lib/components/Modal/ModalTitle.jsx +6 -7
- package/src/lib/components/Modal/README.mdx +32 -6
- package/src/lib/components/Modal/_helpers/getJustifyClassName.js +5 -5
- package/src/lib/components/Paper/Paper.jsx +5 -9
- package/src/lib/components/Paper/Paper.scss +2 -2
- package/src/lib/components/Paper/README.mdx +14 -0
- package/src/lib/components/Popover/Popover.jsx +0 -16
- package/src/lib/components/Popover/PopoverWrapper.jsx +0 -7
- package/src/lib/components/Popover/README.mdx +19 -0
- package/src/lib/components/Radio/README.mdx +12 -5
- package/src/lib/components/Radio/Radio.jsx +2 -2
- package/src/lib/components/Radio/Radio.scss +3 -3
- package/src/lib/components/ScrollView/README.mdx +19 -0
- package/src/lib/components/ScrollView/ScrollView.jsx +11 -4
- package/src/lib/components/SelectField/README.mdx +17 -5
- package/src/lib/components/SelectField/SelectField.jsx +3 -22
- package/src/lib/components/SelectField/SelectField.scss +8 -8
- package/src/lib/components/Table/README.mdx +21 -7
- package/src/lib/components/Table/Table.jsx +43 -101
- package/src/lib/components/Table/Table.scss +0 -24
- package/src/lib/components/Table/_components/TableBodyCell/TableBodyCell.jsx +46 -0
- package/src/lib/components/Table/_components/TableBodyCell/index.js +1 -0
- package/src/lib/components/Table/_components/TableCell.scss +25 -0
- package/src/lib/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +71 -0
- package/src/lib/components/Table/_components/TableHeaderCell/index.js +1 -0
- package/src/lib/components/Tabs/README.mdx +16 -0
- package/src/lib/components/Tabs/Tabs.jsx +6 -1
- package/src/lib/components/Tabs/TabsItem.jsx +3 -0
- package/src/lib/components/Text/README.mdx +16 -0
- package/src/lib/components/Text/Text.jsx +3 -7
- package/src/lib/components/Text/Text.scss +6 -6
- package/src/lib/components/Text/_helpers/getRootClampClassName.js +2 -2
- package/src/lib/components/Text/_helpers/getRootHyphensClassName.js +2 -2
- package/src/lib/components/Text/_helpers/getRootWordWrappingClassName.js +2 -2
- package/src/lib/components/TextArea/README.mdx +33 -30
- package/src/lib/components/TextArea/TextArea.jsx +3 -43
- package/src/lib/components/TextArea/TextArea.scss +8 -8
- package/src/lib/components/TextField/README.mdx +53 -51
- package/src/lib/components/TextField/TextField.jsx +3 -29
- package/src/lib/components/TextField/TextField.scss +9 -9
- package/src/lib/components/TextLink/README.mdx +12 -5
- package/src/lib/components/TextLink/TextLink.jsx +0 -10
- package/src/lib/components/Toggle/README.mdx +17 -5
- package/src/lib/components/Toggle/Toggle.jsx +1 -27
- package/src/lib/components/Toolbar/README.mdx +13 -0
- package/src/lib/components/Toolbar/Toolbar.jsx +9 -43
- package/src/lib/components/Toolbar/Toolbar.scss +24 -12
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +7 -26
- package/src/lib/components/Toolbar/ToolbarItem.jsx +3 -7
- package/src/lib/components/Toolbar/_helpers/getAlignClassName.js +19 -0
- package/src/lib/components/Toolbar/_helpers/getJustifyClassName.js +16 -0
- package/src/lib/components/_helpers/getRootColorClassName.js +10 -10
- package/src/lib/components/_helpers/getRootSizeClassName.js +3 -3
- package/src/lib/styles/generic/_forms.scss +10 -6
- package/src/lib/styles/theme/_accessibility.scss +2 -0
- package/src/lib/styles/theme/_form-fields.scss +1 -0
- package/src/lib/styles/tools/_accessibility.scss +2 -0
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +15 -15
- package/src/lib/styles/tools/form-fields/_foundation.scss +2 -0
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +1 -1
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +9 -9
- package/src/lib/theme.scss +4 -1
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
RUIContext,
|
|
5
5
|
withGlobalProps,
|
|
6
6
|
} from '../../provider';
|
|
7
|
+
import { transferProps } from '../_helpers/transferProps';
|
|
7
8
|
import { classNames } from '../../utils/classNames';
|
|
8
9
|
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
9
10
|
import styles from './Alert.scss';
|
|
@@ -14,11 +15,13 @@ export const Alert = ({
|
|
|
14
15
|
icon,
|
|
15
16
|
id,
|
|
16
17
|
onClose,
|
|
18
|
+
...restProps
|
|
17
19
|
}) => {
|
|
18
20
|
const { translations } = useContext(RUIContext);
|
|
19
21
|
|
|
20
22
|
return (
|
|
21
23
|
<div
|
|
24
|
+
{...transferProps(restProps)}
|
|
22
25
|
className={classNames(
|
|
23
26
|
styles.root,
|
|
24
27
|
getRootColorClassName(color, styles),
|
|
@@ -65,42 +65,42 @@
|
|
|
65
65
|
top: -0.1em;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.
|
|
68
|
+
.isRootColorPrimary {
|
|
69
69
|
@include tools.color(primary);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.
|
|
72
|
+
.isRootColorSecondary {
|
|
73
73
|
@include tools.color(secondary);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.
|
|
76
|
+
.isRootColorSuccess {
|
|
77
77
|
@include tools.color(success);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.
|
|
80
|
+
.isRootColorWarning {
|
|
81
81
|
@include tools.color(warning);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
.
|
|
84
|
+
.isRootColorDanger {
|
|
85
85
|
@include tools.color(danger);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
.
|
|
88
|
+
.isRootColorHelp {
|
|
89
89
|
@include tools.color(help);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
.
|
|
92
|
+
.isRootColorInfo {
|
|
93
93
|
@include tools.color(info);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.
|
|
96
|
+
.isRootColorNote {
|
|
97
97
|
@include tools.color(note);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.
|
|
100
|
+
.isRootColorLight {
|
|
101
101
|
@include tools.color(light);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.
|
|
104
|
+
.isRootColorDark {
|
|
105
105
|
@include tools.color(dark);
|
|
106
106
|
}
|
|
@@ -204,6 +204,17 @@ click on the close button:
|
|
|
204
204
|
}}
|
|
205
205
|
</Playground>
|
|
206
206
|
|
|
207
|
+
## Forwarding HTML Attributes
|
|
208
|
+
|
|
209
|
+
In addition to the options below in the [component's API](#api) section, you
|
|
210
|
+
can specify [React synthetic events] or **any HTML attribute you like.** All
|
|
211
|
+
attributes that don't interfere with the API are forwarded to the root `<div>`
|
|
212
|
+
HTML element. This enables making the component interactive and helps to improve
|
|
213
|
+
its accessibility.
|
|
214
|
+
|
|
215
|
+
👉 Refer to the MDN reference for the full list of supported attributes of the
|
|
216
|
+
[div] element.
|
|
217
|
+
|
|
207
218
|
## API
|
|
208
219
|
|
|
209
220
|
<Props table of={Alert} />
|
|
@@ -235,3 +246,6 @@ Where:
|
|
|
235
246
|
(see alert [color variants](#color-variants) and [API](#api)),
|
|
236
247
|
- `<PROPERTY>` is one of `color` (color of text), `foreground-color` (color of
|
|
237
248
|
border, icon, links, and emphasis), or `background-color`.
|
|
249
|
+
|
|
250
|
+
[React synthetic events]: https://reactjs.org/docs/events.html
|
|
251
|
+
[div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|
|
@@ -1,23 +1,24 @@
|
|
|
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
5
|
import { classNames } from '../../utils/classNames';
|
|
5
6
|
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
6
7
|
import styles from './Badge.scss';
|
|
7
8
|
|
|
8
9
|
export const Badge = ({
|
|
9
10
|
color,
|
|
10
|
-
id,
|
|
11
11
|
label,
|
|
12
12
|
priority,
|
|
13
|
+
...restProps
|
|
13
14
|
}) => (
|
|
14
15
|
<div
|
|
16
|
+
{...transferProps(restProps)}
|
|
15
17
|
className={classNames(
|
|
16
18
|
styles.root,
|
|
17
|
-
priority === 'outline' && styles.
|
|
19
|
+
priority === 'outline' && styles.isRootPriorityOutline,
|
|
18
20
|
getRootColorClassName(color, styles),
|
|
19
21
|
)}
|
|
20
|
-
id={id}
|
|
21
22
|
>
|
|
22
23
|
{label}
|
|
23
24
|
</div>
|
|
@@ -25,7 +26,6 @@ export const Badge = ({
|
|
|
25
26
|
|
|
26
27
|
Badge.defaultProps = {
|
|
27
28
|
color: 'note',
|
|
28
|
-
id: undefined,
|
|
29
29
|
priority: 'filled',
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -36,10 +36,6 @@ Badge.propTypes = {
|
|
|
36
36
|
color: PropTypes.oneOf(
|
|
37
37
|
['primary', 'secondary', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark'],
|
|
38
38
|
),
|
|
39
|
-
/**
|
|
40
|
-
* ID of the root HTML element.
|
|
41
|
-
*/
|
|
42
|
-
id: PropTypes.string,
|
|
43
39
|
/**
|
|
44
40
|
* Text to be displayed.
|
|
45
41
|
*/
|
|
@@ -24,59 +24,59 @@ $_badge-size: 1.25rem;
|
|
|
24
24
|
box-shadow: var(--rui-local-box-shadow, #{0 0 0 2px rgb(255 255 255 / 80%)});
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
.
|
|
27
|
+
.isRootColorPrimary {
|
|
28
28
|
--rui-local-color: #{map.get(colors.$brand, on-primary)};
|
|
29
29
|
--rui-local-background-color: #{map.get(colors.$brand, primary)};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.
|
|
32
|
+
.isRootColorSecondary {
|
|
33
33
|
--rui-local-color: #{map.get(colors.$brand, on-secondary)};
|
|
34
34
|
--rui-local-background-color: #{map.get(colors.$brand, secondary)};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
.
|
|
37
|
+
.isRootColorSuccess {
|
|
38
38
|
--rui-local-color: #{map.get(colors.$ui, on-success)};
|
|
39
39
|
--rui-local-background-color: #{map.get(colors.$ui, success)};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.isRootColorWarning {
|
|
43
43
|
--rui-local-color: #{map.get(colors.$ui, on-warning)};
|
|
44
44
|
--rui-local-background-color: #{map.get(colors.$ui, warning)};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.
|
|
47
|
+
.isRootColorDanger {
|
|
48
48
|
--rui-local-color: #{map.get(colors.$ui, on-danger)};
|
|
49
49
|
--rui-local-background-color: #{map.get(colors.$ui, danger)};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.
|
|
52
|
+
.isRootColorHelp {
|
|
53
53
|
--rui-local-color: #{map.get(colors.$ui, on-help)};
|
|
54
54
|
--rui-local-background-color: #{map.get(colors.$ui, help)};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
.
|
|
57
|
+
.isRootColorInfo {
|
|
58
58
|
--rui-local-color: #{map.get(colors.$ui, on-info)};
|
|
59
59
|
--rui-local-background-color: #{map.get(colors.$ui, info)};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.
|
|
62
|
+
.isRootColorNote {
|
|
63
63
|
--rui-local-color: #{map.get(colors.$ui, on-note)};
|
|
64
64
|
--rui-local-background-color: #{map.get(colors.$ui, note)};
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.
|
|
67
|
+
.isRootColorLight {
|
|
68
68
|
--rui-local-color: #{colors.$dark};
|
|
69
69
|
--rui-local-background-color: #{colors.$light};
|
|
70
70
|
--rui-local-box-shadow: none;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
.
|
|
73
|
+
.isRootColorDark {
|
|
74
74
|
--rui-local-color: #{colors.$light};
|
|
75
75
|
--rui-local-background-color: #{colors.$dark};
|
|
76
76
|
--rui-local-box-shadow: none;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.
|
|
79
|
+
.isRootPriorityOutline {
|
|
80
80
|
--rui-local-background-color: transparent;
|
|
81
81
|
--rui-local-box-shadow: none;
|
|
82
82
|
|
|
@@ -85,42 +85,42 @@ $_badge-size: 1.25rem;
|
|
|
85
85
|
border: borders.$width solid currentColor;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
.
|
|
88
|
+
.isRootPriorityOutline.isRootColorPrimary {
|
|
89
89
|
--rui-local-color: #{map.get(colors.$brand, primary)};
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
.
|
|
92
|
+
.isRootPriorityOutline.isRootColorSecondary {
|
|
93
93
|
--rui-local-color: #{map.get(colors.$brand, secondary)};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.
|
|
96
|
+
.isRootPriorityOutline.isRootColorSuccess {
|
|
97
97
|
--rui-local-color: #{map.get(colors.$ui, success)};
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
.
|
|
100
|
+
.isRootPriorityOutline.isRootColorWarning {
|
|
101
101
|
--rui-local-color: #{map.get(colors.$ui, warning)};
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.
|
|
104
|
+
.isRootPriorityOutline.isRootColorDanger {
|
|
105
105
|
--rui-local-color: #{map.get(colors.$ui, danger)};
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
.
|
|
108
|
+
.isRootPriorityOutline.isRootColorHelp {
|
|
109
109
|
--rui-local-color: #{map.get(colors.$ui, help)};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
.
|
|
112
|
+
.isRootPriorityOutline.isRootColorInfo {
|
|
113
113
|
--rui-local-color: #{map.get(colors.$ui, info)};
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
.
|
|
116
|
+
.isRootPriorityOutline.isRootColorNote {
|
|
117
117
|
--rui-local-color: #{map.get(colors.$ui, note)};
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
.
|
|
120
|
+
.isRootPriorityOutline.isRootColorLight {
|
|
121
121
|
--rui-local-color: #{colors.$light};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
.
|
|
124
|
+
.isRootPriorityOutline.isRootColorDark {
|
|
125
125
|
--rui-local-color: #{colors.$dark};
|
|
126
126
|
}
|
|
@@ -115,6 +115,20 @@ Medium-emphasis priority to provide additional context in an unobtrusive way.
|
|
|
115
115
|
<Badge priority="outline" label="Dark" color="dark" />
|
|
116
116
|
</Playground>
|
|
117
117
|
|
|
118
|
+
## Forwarding HTML Attributes
|
|
119
|
+
|
|
120
|
+
In addition to the options below in the [component's API](#api) section, you
|
|
121
|
+
can specify [React synthetic events] or **any HTML attribute you like.** All
|
|
122
|
+
attributes that don't interfere with the API are forwarded to the root `<div>`
|
|
123
|
+
HTML element. This enables making the component interactive and helps to improve
|
|
124
|
+
its accessibility.
|
|
125
|
+
|
|
126
|
+
👉 Refer to the MDN reference for the full list of supported attributes of the
|
|
127
|
+
[div] element.
|
|
128
|
+
|
|
118
129
|
## API
|
|
119
130
|
|
|
120
131
|
<Props table of={Badge} />
|
|
132
|
+
|
|
133
|
+
[React synthetic events]: https://reactjs.org/docs/events.html
|
|
134
|
+
[div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|
|
@@ -25,7 +25,6 @@ export const Button = React.forwardRef((props, ref) => {
|
|
|
25
25
|
priority,
|
|
26
26
|
size,
|
|
27
27
|
startCorner,
|
|
28
|
-
type,
|
|
29
28
|
color,
|
|
30
29
|
...restProps
|
|
31
30
|
} = props;
|
|
@@ -49,14 +48,13 @@ export const Button = React.forwardRef((props, ref) => {
|
|
|
49
48
|
styles,
|
|
50
49
|
),
|
|
51
50
|
getRootLabelVisibilityClassName(labelVisibility, styles),
|
|
52
|
-
resolveContextOrProp(context && context.block, block) && styles.
|
|
53
|
-
context && styles.
|
|
51
|
+
resolveContextOrProp(context && context.block, block) && styles.isRootBlock,
|
|
52
|
+
context && styles.isRootGrouped,
|
|
54
53
|
feedbackIcon && styles.hasRootFeedback,
|
|
55
54
|
)}
|
|
56
55
|
disabled={resolveContextOrProp(context && context.disabled, disabled) || !!feedbackIcon}
|
|
57
56
|
id={id}
|
|
58
57
|
ref={ref}
|
|
59
|
-
type={type}
|
|
60
58
|
>
|
|
61
59
|
{startCorner && (
|
|
62
60
|
<span className={styles.startCorner}>
|
|
@@ -105,7 +103,6 @@ Button.defaultProps = {
|
|
|
105
103
|
id: undefined,
|
|
106
104
|
labelVisibility: 'xs',
|
|
107
105
|
priority: 'filled',
|
|
108
|
-
ref: undefined,
|
|
109
106
|
size: 'medium',
|
|
110
107
|
startCorner: null,
|
|
111
108
|
type: 'button',
|
|
@@ -169,14 +166,6 @@ Button.propTypes = {
|
|
|
169
166
|
* as the value is inherited in such case.
|
|
170
167
|
*/
|
|
171
168
|
priority: PropTypes.oneOf(['filled', 'outline', 'flat']),
|
|
172
|
-
/**
|
|
173
|
-
* Reference forwarded to the `button` element.
|
|
174
|
-
*/
|
|
175
|
-
ref: PropTypes.oneOfType([
|
|
176
|
-
PropTypes.func,
|
|
177
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
178
|
-
PropTypes.shape({ current: PropTypes.any }),
|
|
179
|
-
]),
|
|
180
169
|
/**
|
|
181
170
|
* Size of the button.
|
|
182
171
|
*
|
|
@@ -397,12 +397,22 @@ Flat buttons in feedback state:
|
|
|
397
397
|
👉 Visit the [CSS Helpers](/css-helpers/animation) section to see how the icon
|
|
398
398
|
animation is made.
|
|
399
399
|
|
|
400
|
-
##
|
|
400
|
+
## Forwarding HTML Attributes
|
|
401
|
+
|
|
402
|
+
In addition to the options below in the [component's API](#api) section, you
|
|
403
|
+
can specify [React synthetic events] or **any HTML attribute you like.** All
|
|
404
|
+
attributes that don't interfere with the API are forwarded to the native HTML
|
|
405
|
+
`<button>`. This enables making the component interactive and helps to improve
|
|
406
|
+
its accessibility.
|
|
407
|
+
|
|
408
|
+
👉 Refer to the MDN reference for the full list of supported attributes of the
|
|
409
|
+
[button] element.
|
|
401
410
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
411
|
+
## Forwarding ref
|
|
412
|
+
|
|
413
|
+
If you provide [ref], it is forwarded to the native HTML `<button>` element.
|
|
414
|
+
|
|
415
|
+
## API
|
|
406
416
|
|
|
407
417
|
<Props table of={Button} />
|
|
408
418
|
|
|
@@ -562,3 +572,5 @@ feedback state.
|
|
|
562
572
|
| `--rui-Button--feedback__cursor` | Cursor to show on hovering buttons in feedback state |
|
|
563
573
|
|
|
564
574
|
[React synthetic events]: https://reactjs.org/docs/events.html
|
|
575
|
+
[button]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
|
|
576
|
+
[ref]: https://reactjs.org/docs/refs-and-the-dom.html
|
|
@@ -49,19 +49,19 @@
|
|
|
49
49
|
align-items: center;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.
|
|
52
|
+
.isRootSizeSmall {
|
|
53
53
|
@include tools.button-size(small);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.
|
|
56
|
+
.isRootSizeMedium {
|
|
57
57
|
@include tools.button-size(medium);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.
|
|
60
|
+
.isRootSizeLarge {
|
|
61
61
|
@include tools.button-size(large);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.
|
|
64
|
+
.isRootBlock {
|
|
65
65
|
width: 100%;
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
color: transparent;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.
|
|
79
|
+
.isRootGrouped {
|
|
80
80
|
z-index: map.get(settings.$group-z-indexes, button);
|
|
81
81
|
|
|
82
82
|
&:not(:first-child) {
|
|
@@ -96,52 +96,52 @@
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
.
|
|
100
|
-
.
|
|
99
|
+
.isRootGrouped .startCorner,
|
|
100
|
+
.isRootGrouped .endCorner {
|
|
101
101
|
z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
.
|
|
105
|
-
.
|
|
106
|
-
.
|
|
107
|
-
.
|
|
108
|
-
.
|
|
109
|
-
.
|
|
110
|
-
.
|
|
104
|
+
.hasLabelHidden,
|
|
105
|
+
.hasLabelVisibleSm,
|
|
106
|
+
.hasLabelVisibleMd,
|
|
107
|
+
.hasLabelVisibleLg,
|
|
108
|
+
.hasLabelVisibleXl,
|
|
109
|
+
.hasLabelVisibleX2l,
|
|
110
|
+
.hasLabelVisibleX3l {
|
|
111
111
|
@include tools.hide-label();
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.
|
|
114
|
+
.hasLabelVisibleSm {
|
|
115
115
|
@include breakpoint.up(sm) {
|
|
116
116
|
@include tools.show-label();
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
.
|
|
120
|
+
.hasLabelVisibleMd {
|
|
121
121
|
@include breakpoint.up(md) {
|
|
122
122
|
@include tools.show-label();
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.
|
|
126
|
+
.hasLabelVisibleLg {
|
|
127
127
|
@include breakpoint.up(lg) {
|
|
128
128
|
@include tools.show-label();
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.
|
|
132
|
+
.hasLabelVisibleXl {
|
|
133
133
|
@include breakpoint.up(xl) {
|
|
134
134
|
@include tools.show-label();
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.
|
|
138
|
+
.hasLabelVisibleX2l {
|
|
139
139
|
@include breakpoint.up(x2l) {
|
|
140
140
|
@include tools.show-label();
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
.
|
|
144
|
+
.hasLabelVisibleX3l {
|
|
145
145
|
@include breakpoint.up(x3l) {
|
|
146
146
|
@include tools.show-label();
|
|
147
147
|
}
|
|
@@ -3,128 +3,128 @@
|
|
|
3
3
|
@use "theme";
|
|
4
4
|
@use "tools";
|
|
5
5
|
|
|
6
|
-
.
|
|
6
|
+
.isRootPriorityFilled.isRootColorPrimary {
|
|
7
7
|
@include tools.button-color(filled, primary);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.
|
|
10
|
+
.isRootPriorityFilled.isRootColorSecondary {
|
|
11
11
|
@include tools.button-color(filled, secondary);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
.
|
|
14
|
+
.isRootPriorityFilled.isRootColorSuccess {
|
|
15
15
|
@include tools.button-color(filled, success);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.
|
|
18
|
+
.isRootPriorityFilled.isRootColorWarning {
|
|
19
19
|
@include tools.button-color(filled, warning);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
.
|
|
22
|
+
.isRootPriorityFilled.isRootColorDanger {
|
|
23
23
|
@include tools.button-color(filled, danger);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
.
|
|
26
|
+
.isRootPriorityFilled.isRootColorHelp {
|
|
27
27
|
@include tools.button-color(filled, help);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.
|
|
30
|
+
.isRootPriorityFilled.isRootColorInfo {
|
|
31
31
|
@include tools.button-color(filled, info);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.
|
|
34
|
+
.isRootPriorityFilled.isRootColorNote {
|
|
35
35
|
@include tools.button-color(filled, note);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
.
|
|
38
|
+
.isRootPriorityFilled.isRootColorLight {
|
|
39
39
|
@include tools.button-color(filled, light);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
.
|
|
42
|
+
.isRootPriorityFilled.isRootColorDark {
|
|
43
43
|
@include tools.button-color(filled, dark);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
.
|
|
46
|
+
.isRootPriorityOutline.isRootColorPrimary {
|
|
47
47
|
@include tools.button-color(outline, primary);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.
|
|
50
|
+
.isRootPriorityOutline.isRootColorSecondary {
|
|
51
51
|
@include tools.button-color(outline, secondary);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.
|
|
54
|
+
.isRootPriorityOutline.isRootColorSuccess {
|
|
55
55
|
@include tools.button-color(outline, success);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
.
|
|
58
|
+
.isRootPriorityOutline.isRootColorWarning {
|
|
59
59
|
@include tools.button-color(outline, warning);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
.
|
|
62
|
+
.isRootPriorityOutline.isRootColorDanger {
|
|
63
63
|
@include tools.button-color(outline, danger);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
.
|
|
66
|
+
.isRootPriorityOutline.isRootColorHelp {
|
|
67
67
|
@include tools.button-color(outline, help);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
.
|
|
70
|
+
.isRootPriorityOutline.isRootColorInfo {
|
|
71
71
|
@include tools.button-color(outline, info);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
.
|
|
74
|
+
.isRootPriorityOutline.isRootColorNote {
|
|
75
75
|
@include tools.button-color(outline, note);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
.
|
|
78
|
+
.isRootPriorityOutline.isRootColorLight {
|
|
79
79
|
@include tools.button-color(outline, light);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.
|
|
82
|
+
.isRootPriorityOutline.isRootColorDark {
|
|
83
83
|
@include tools.button-color(outline, dark);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
.
|
|
86
|
+
.isRootPriorityFlat.isRootColorPrimary {
|
|
87
87
|
@include tools.button-color(flat, primary);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
.
|
|
90
|
+
.isRootPriorityFlat.isRootColorSecondary {
|
|
91
91
|
@include tools.button-color(flat, secondary);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.
|
|
94
|
+
.isRootPriorityFlat.isRootColorSuccess {
|
|
95
95
|
@include tools.button-color(flat, success);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
.
|
|
98
|
+
.isRootPriorityFlat.isRootColorWarning {
|
|
99
99
|
@include tools.button-color(flat, warning);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
.
|
|
102
|
+
.isRootPriorityFlat.isRootColorDanger {
|
|
103
103
|
@include tools.button-color(flat, danger);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
.
|
|
106
|
+
.isRootPriorityFlat.isRootColorHelp {
|
|
107
107
|
@include tools.button-color(flat, help);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
.
|
|
110
|
+
.isRootPriorityFlat.isRootColorInfo {
|
|
111
111
|
@include tools.button-color(flat, info);
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
.
|
|
114
|
+
.isRootPriorityFlat.isRootColorNote {
|
|
115
115
|
@include tools.button-color(flat, note);
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
.
|
|
118
|
+
.isRootPriorityFlat.isRootColorLight {
|
|
119
119
|
@include tools.button-color(flat, light);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
.
|
|
122
|
+
.isRootPriorityFlat.isRootColorDark {
|
|
123
123
|
@include tools.button-color(flat, dark);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.
|
|
127
|
-
.
|
|
126
|
+
.isRootPriorityFilled.isRootGrouped:not(:first-child)::before,
|
|
127
|
+
.isRootPriorityFlat.isRootGrouped:not(:first-child)::before {
|
|
128
128
|
content: "";
|
|
129
129
|
position: absolute;
|
|
130
130
|
top: calc(-1 * #{theme.$border-width});
|
|
@@ -135,18 +135,18 @@
|
|
|
135
135
|
transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
.
|
|
138
|
+
.isRootPriorityFilled.isRootGrouped:not(:first-child) {
|
|
139
139
|
--rui-local-gap: #{theme.$group-filled-gap};
|
|
140
140
|
--rui-local-separator-width: #{theme.$group-filled-separator-width};
|
|
141
141
|
--rui-local-separator-color: #{theme.$group-filled-separator-color};
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
.
|
|
144
|
+
.isRootPriorityFlat.isRootGrouped:not(:first-child) {
|
|
145
145
|
--rui-local-gap: #{theme.$group-flat-gap};
|
|
146
146
|
--rui-local-separator-width: #{theme.$group-flat-separator-width};
|
|
147
147
|
--rui-local-separator-color: #{theme.$group-flat-separator-color};
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.
|
|
150
|
+
.isRootPriorityOutline.isRootGrouped:not(:first-child) {
|
|
151
151
|
--rui-local-gap: #{theme.$group-outline-gap};
|
|
152
152
|
}
|