@react-ui-org/react-ui 0.47.0 → 0.49.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 +465 -93
- 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 +18 -2
- package/src/lib/components/Alert/index.js +1 -1
- 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 +15 -1
- package/src/lib/components/Badge/index.js +1 -1
- package/src/lib/components/Button/Button.jsx +23 -34
- package/src/lib/components/Button/README.mdx +21 -7
- 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/Button/index.js +1 -1
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +2 -8
- package/src/lib/components/ButtonGroup/README.mdx +18 -2
- 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 +21 -5
- package/src/lib/components/CheckboxField/CheckboxField.jsx +17 -44
- package/src/lib/components/CheckboxField/README.mdx +18 -6
- package/src/lib/components/CheckboxField/index.js +1 -1
- package/src/lib/components/FileInputField/FileInputField.jsx +20 -29
- package/src/lib/components/FileInputField/FileInputField.scss +3 -3
- package/src/lib/components/FileInputField/README.mdx +30 -28
- package/src/lib/components/FileInputField/index.js +1 -1
- 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 +28 -13
- package/src/lib/components/Grid/Grid.jsx +31 -35
- package/src/lib/components/Grid/Grid.scss +10 -15
- package/src/lib/components/Grid/GridSpan.jsx +5 -11
- package/src/lib/components/Grid/README.mdx +48 -36
- package/src/lib/components/Grid/_helpers/generateResponsiveCustomProperties.js +11 -3
- package/src/lib/components/Grid/_settings.scss +18 -0
- package/src/lib/components/Grid/_tools.scss +5 -5
- package/src/lib/components/Modal/Modal.jsx +147 -254
- package/src/lib/components/Modal/Modal.scss +7 -55
- package/src/lib/components/Modal/ModalBody.jsx +60 -0
- package/src/lib/components/Modal/ModalBody.scss +18 -0
- package/src/lib/components/Modal/ModalCloseButton.jsx +45 -0
- package/src/lib/components/Modal/ModalCloseButton.scss +18 -0
- package/src/lib/components/Modal/ModalContent.jsx +39 -0
- package/src/lib/components/Modal/ModalContent.scss +5 -0
- package/src/lib/components/Modal/ModalFooter.jsx +42 -0
- package/src/lib/components/Modal/ModalFooter.scss +35 -0
- package/src/lib/components/Modal/ModalHeader.jsx +44 -0
- package/src/lib/components/Modal/ModalHeader.scss +30 -0
- package/src/lib/components/Modal/ModalTitle.jsx +44 -0
- package/src/lib/components/Modal/ModalTitle.scss +10 -0
- package/src/lib/components/Modal/README.mdx +865 -195
- package/src/lib/components/Modal/_helpers/getJustifyClassName.js +19 -0
- package/src/lib/components/Modal/_helpers/getScrollingClassName.js +11 -0
- package/src/lib/components/Modal/_settings.scss +1 -5
- package/src/lib/components/Modal/_theme.scss +6 -0
- package/src/lib/components/Modal/index.js +7 -1
- 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 +15 -1
- package/src/lib/components/Paper/index.js +1 -1
- package/src/lib/components/Popover/Popover.jsx +14 -30
- package/src/lib/components/Popover/Popover.scss +7 -6
- package/src/lib/components/Popover/PopoverWrapper.jsx +5 -12
- package/src/lib/components/Popover/PopoverWrapper.scss +3 -0
- package/src/lib/components/Popover/README.mdx +32 -11
- package/src/lib/components/Popover/_theme.scss +1 -1
- package/src/lib/components/Radio/README.mdx +13 -6
- package/src/lib/components/Radio/Radio.jsx +39 -29
- package/src/lib/components/Radio/Radio.scss +3 -3
- package/src/lib/components/Radio/index.js +1 -1
- package/src/lib/components/ScrollView/README.mdx +165 -84
- package/src/lib/components/ScrollView/ScrollView.jsx +115 -117
- package/src/lib/components/ScrollView/ScrollView.scss +18 -16
- package/src/lib/components/ScrollView/index.js +1 -1
- package/src/lib/components/SelectField/README.mdx +83 -7
- package/src/lib/components/SelectField/SelectField.jsx +86 -61
- package/src/lib/components/SelectField/SelectField.scss +8 -8
- package/src/lib/components/SelectField/_components/Option/Option.jsx +46 -0
- package/src/lib/components/SelectField/_components/Option/index.js +1 -0
- package/src/lib/components/SelectField/index.js +1 -1
- package/src/lib/components/Table/README.mdx +25 -9
- 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/Table/index.js +1 -1
- package/src/lib/components/Tabs/README.mdx +21 -3
- package/src/lib/components/Tabs/Tabs.jsx +6 -1
- package/src/lib/components/Tabs/TabsItem.jsx +3 -0
- package/src/lib/components/Tabs/TabsItem.scss +1 -2
- package/src/lib/components/Text/README.mdx +25 -7
- 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/Text/index.js +1 -1
- package/src/lib/components/TextArea/README.mdx +34 -31
- package/src/lib/components/TextArea/TextArea.jsx +23 -63
- package/src/lib/components/TextArea/TextArea.scss +8 -8
- package/src/lib/components/TextArea/index.js +1 -1
- package/src/lib/components/TextField/README.mdx +56 -54
- package/src/lib/components/TextField/TextField.jsx +25 -52
- package/src/lib/components/TextField/TextField.scss +9 -9
- package/src/lib/components/TextField/index.js +1 -1
- package/src/lib/components/TextLink/README.mdx +13 -6
- package/src/lib/components/TextLink/TextLink.jsx +0 -10
- package/src/lib/components/TextLink/index.js +1 -1
- package/src/lib/components/Toggle/README.mdx +18 -6
- package/src/lib/components/Toggle/Toggle.jsx +18 -44
- package/src/lib/components/Toggle/index.js +1 -1
- package/src/lib/components/Toolbar/README.mdx +21 -6
- 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/components/_helpers/transferProps.js +1 -1
- package/src/lib/index.js +24 -16
- package/src/lib/provider/withGlobalProps.jsx +20 -3
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +15 -15
- 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 +18 -26
- package/src/lib/translations/en.js +1 -1
- package/src/lib/components/Grid/_theme.scss +0 -11
- package/src/lib/components/ScrollView/_theme.scss +0 -2
- package/src/lib/components/withForwardedRef.jsx +0 -11
|
@@ -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
|
}
|
|
@@ -2,31 +2,31 @@ export default (labelVisibility, styles) => {
|
|
|
2
2
|
// Intentionally omitting `xs` which means label is visible on all screen sizes.
|
|
3
3
|
|
|
4
4
|
if (labelVisibility === 'sm') {
|
|
5
|
-
return styles.
|
|
5
|
+
return styles.hasLabelVisibleSm;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
if (labelVisibility === 'md') {
|
|
9
|
-
return styles.
|
|
9
|
+
return styles.hasLabelVisibleMd;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
if (labelVisibility === 'lg') {
|
|
13
|
-
return styles.
|
|
13
|
+
return styles.hasLabelVisibleLg;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
if (labelVisibility === 'xl') {
|
|
17
|
-
return styles.
|
|
17
|
+
return styles.hasLabelVisibleXl;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
if (labelVisibility === 'x2l') {
|
|
21
|
-
return styles.
|
|
21
|
+
return styles.hasLabelVisibleX2l;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (labelVisibility === 'x3l') {
|
|
25
|
-
return styles.
|
|
25
|
+
return styles.hasLabelVisibleX3l;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
if (labelVisibility === 'none') {
|
|
29
|
-
return styles.
|
|
29
|
+
return styles.hasLabelHidden;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
return null;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default (priority, styles) => {
|
|
2
2
|
if (priority === 'filled') {
|
|
3
|
-
return styles.
|
|
3
|
+
return styles.isRootPriorityFilled;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
if (priority === 'outline') {
|
|
7
|
-
return styles.
|
|
7
|
+
return styles.isRootPriorityOutline;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
if (priority === 'flat') {
|
|
11
|
-
return styles.
|
|
11
|
+
return styles.isRootPriorityFlat;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from './Button';
|
|
1
|
+
export { default as Button } from './Button';
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { withGlobalProps } from '../../provider';
|
|
4
4
|
import { classNames } from '../../utils/classNames';
|
|
5
5
|
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
|
6
|
+
import { transferProps } from '../_helpers/transferProps';
|
|
6
7
|
import styles from './ButtonGroup.scss';
|
|
7
8
|
import { ButtonGroupContext } from './ButtonGroupContext';
|
|
8
9
|
|
|
@@ -10,7 +11,6 @@ export const ButtonGroup = ({
|
|
|
10
11
|
block,
|
|
11
12
|
disabled,
|
|
12
13
|
children,
|
|
13
|
-
id,
|
|
14
14
|
priority,
|
|
15
15
|
size,
|
|
16
16
|
...restProps
|
|
@@ -21,13 +21,12 @@ export const ButtonGroup = ({
|
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<div
|
|
24
|
+
{...transferProps(restProps)}
|
|
24
25
|
className={classNames(
|
|
25
26
|
styles.root,
|
|
26
27
|
block && styles.isRootBlock,
|
|
27
28
|
)}
|
|
28
|
-
id={id}
|
|
29
29
|
role="group"
|
|
30
|
-
{...restProps}
|
|
31
30
|
>
|
|
32
31
|
<ButtonGroupContext.Provider
|
|
33
32
|
value={{
|
|
@@ -47,7 +46,6 @@ ButtonGroup.defaultProps = {
|
|
|
47
46
|
block: false,
|
|
48
47
|
children: null,
|
|
49
48
|
disabled: false,
|
|
50
|
-
id: undefined,
|
|
51
49
|
priority: 'filled',
|
|
52
50
|
size: 'medium',
|
|
53
51
|
};
|
|
@@ -65,10 +63,6 @@ ButtonGroup.propTypes = {
|
|
|
65
63
|
* If `true`, all buttons inside the group will be disabled.
|
|
66
64
|
*/
|
|
67
65
|
disabled: PropTypes.bool,
|
|
68
|
-
/**
|
|
69
|
-
* ID of the root HTML element.
|
|
70
|
-
*/
|
|
71
|
-
id: PropTypes.string,
|
|
72
66
|
/**
|
|
73
67
|
* Visual priority to highlight or suppress the buttons.
|
|
74
68
|
*/
|
|
@@ -13,8 +13,10 @@ import {
|
|
|
13
13
|
Props,
|
|
14
14
|
} from 'docz'
|
|
15
15
|
import Icon from '../../../docs/_components/Icon'
|
|
16
|
-
import
|
|
17
|
-
|
|
16
|
+
import {
|
|
17
|
+
Button,
|
|
18
|
+
ButtonGroup,
|
|
19
|
+
} from '../..'
|
|
18
20
|
|
|
19
21
|
## Basic Usage
|
|
20
22
|
|
|
@@ -229,6 +231,17 @@ and communicating the state of individual options.
|
|
|
229
231
|
</>
|
|
230
232
|
</Playground>
|
|
231
233
|
|
|
234
|
+
## Forwarding HTML Attributes
|
|
235
|
+
|
|
236
|
+
In addition to the options below in the [component's API](#api) section, you
|
|
237
|
+
can specify [React synthetic events] or **any HTML attribute you like.** All
|
|
238
|
+
attributes that don't interfere with the API are forwarded to the root `<div>`
|
|
239
|
+
HTML element. This enables making the component interactive and helps to improve
|
|
240
|
+
its accessibility.
|
|
241
|
+
|
|
242
|
+
👉 Refer to the MDN reference for the full list of supported attributes of the
|
|
243
|
+
[div] element.
|
|
244
|
+
|
|
232
245
|
## API
|
|
233
246
|
|
|
234
247
|
<Props table of={ButtonGroup} />
|
|
@@ -244,3 +257,6 @@ and communicating the state of individual options.
|
|
|
244
257
|
| `--rui-ButtonGroup--flat__separator__width` | Separator width for `flat` buttons |
|
|
245
258
|
| `--rui-ButtonGroup--flat__separator__color` | Separator color for `flat` buttons |
|
|
246
259
|
| `--rui-ButtonGroup--outline__gap` | Gap between `outline` buttons |
|
|
260
|
+
|
|
261
|
+
[React synthetic events]: https://reactjs.org/docs/events.html
|
|
262
|
+
[div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|
|
@@ -1,6 +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
5
|
import { classNames } from '../../utils/classNames';
|
|
5
6
|
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
6
7
|
import styles from './Card.scss';
|
|
@@ -9,19 +10,19 @@ export const Card = ({
|
|
|
9
10
|
children,
|
|
10
11
|
dense,
|
|
11
12
|
disabled,
|
|
12
|
-
id,
|
|
13
13
|
raised,
|
|
14
14
|
color,
|
|
15
|
+
...restProps
|
|
15
16
|
}) => (
|
|
16
17
|
<div
|
|
18
|
+
{...transferProps(restProps)}
|
|
17
19
|
className={classNames(
|
|
18
20
|
styles.root,
|
|
19
21
|
getRootColorClassName(color, styles),
|
|
20
|
-
dense && styles.
|
|
21
|
-
raised && styles.
|
|
22
|
-
disabled && styles.
|
|
22
|
+
dense && styles.isRootDense,
|
|
23
|
+
raised && styles.isRootRaised,
|
|
24
|
+
disabled && styles.isRootDisabled,
|
|
23
25
|
)}
|
|
24
|
-
id={id}
|
|
25
26
|
>
|
|
26
27
|
{children}
|
|
27
28
|
</div>
|
|
@@ -31,7 +32,6 @@ Card.defaultProps = {
|
|
|
31
32
|
color: 'light',
|
|
32
33
|
dense: false,
|
|
33
34
|
disabled: false,
|
|
34
|
-
id: undefined,
|
|
35
35
|
raised: false,
|
|
36
36
|
};
|
|
37
37
|
|
|
@@ -57,10 +57,6 @@ Card.propTypes = {
|
|
|
57
57
|
* If `true`, the card will be disabled.
|
|
58
58
|
*/
|
|
59
59
|
disabled: PropTypes.bool,
|
|
60
|
-
/**
|
|
61
|
-
* ID of the root HTML element.
|
|
62
|
-
*/
|
|
63
|
-
id: PropTypes.string,
|
|
64
60
|
/**
|
|
65
61
|
* Add shadow to pull the card above surface.
|
|
66
62
|
*/
|
|
@@ -25,55 +25,55 @@
|
|
|
25
25
|
padding: var(--rui-local-padding);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.
|
|
28
|
+
.isRootDense {
|
|
29
29
|
--rui-local-padding: #{theme.$dense-padding};
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.
|
|
32
|
+
.isRootRaised {
|
|
33
33
|
box-shadow: theme.$raised-box-shadow;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.
|
|
36
|
+
.isRootColorPrimary {
|
|
37
37
|
@include tools.color(primary);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
.
|
|
40
|
+
.isRootColorSecondary {
|
|
41
41
|
@include tools.color(secondary);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.
|
|
44
|
+
.isRootColorSuccess {
|
|
45
45
|
@include tools.color(success);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
.
|
|
48
|
+
.isRootColorWarning {
|
|
49
49
|
@include tools.color(warning);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
.
|
|
52
|
+
.isRootColorDanger {
|
|
53
53
|
@include tools.color(danger);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
.
|
|
56
|
+
.isRootColorHelp {
|
|
57
57
|
@include tools.color(help);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
.
|
|
60
|
+
.isRootColorInfo {
|
|
61
61
|
@include tools.color(info);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
.
|
|
64
|
+
.isRootColorNote {
|
|
65
65
|
@include tools.color(note);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
.
|
|
68
|
+
.isRootColorLight {
|
|
69
69
|
@include tools.color(light);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
.
|
|
72
|
+
.isRootColorDark {
|
|
73
73
|
@include tools.color(dark);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
.
|
|
76
|
+
.isRootDisabled {
|
|
77
77
|
background-color: theme.$disabled-background-color;
|
|
78
78
|
opacity: theme.$disabled-opacity;
|
|
79
79
|
}
|
|
@@ -1,30 +1,26 @@
|
|
|
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 styles from './Card.scss';
|
|
5
6
|
|
|
6
7
|
export const CardBody = ({
|
|
7
8
|
children,
|
|
8
|
-
|
|
9
|
+
...restProps
|
|
9
10
|
}) => (
|
|
10
|
-
<div
|
|
11
|
+
<div
|
|
12
|
+
{...transferProps(restProps)}
|
|
13
|
+
className={styles.body}
|
|
14
|
+
>
|
|
11
15
|
{children}
|
|
12
16
|
</div>
|
|
13
17
|
);
|
|
14
18
|
|
|
15
|
-
CardBody.defaultProps = {
|
|
16
|
-
id: undefined,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
19
|
CardBody.propTypes = {
|
|
20
20
|
/**
|
|
21
21
|
* Content of the card.
|
|
22
22
|
*/
|
|
23
23
|
children: PropTypes.node.isRequired,
|
|
24
|
-
/**
|
|
25
|
-
* ID of the root HTML element.
|
|
26
|
-
*/
|
|
27
|
-
id: PropTypes.string,
|
|
28
24
|
};
|
|
29
25
|
|
|
30
26
|
export const CardBodyWithGlobalProps = withGlobalProps(CardBody, 'CardBody');
|
|
@@ -2,18 +2,22 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { withGlobalProps } from '../../provider';
|
|
4
4
|
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
|
5
|
+
import { transferProps } from '../_helpers/transferProps';
|
|
5
6
|
import styles from './Card.scss';
|
|
6
7
|
|
|
7
8
|
export const CardFooter = ({
|
|
8
9
|
children,
|
|
9
|
-
|
|
10
|
+
...restProps
|
|
10
11
|
}) => {
|
|
11
12
|
if (isChildrenEmpty(children)) {
|
|
12
13
|
return null;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
return (
|
|
16
|
-
<div
|
|
17
|
+
<div
|
|
18
|
+
{...transferProps(restProps)}
|
|
19
|
+
className={styles.footer}
|
|
20
|
+
>
|
|
17
21
|
{children}
|
|
18
22
|
</div>
|
|
19
23
|
);
|
|
@@ -21,7 +25,6 @@ export const CardFooter = ({
|
|
|
21
25
|
|
|
22
26
|
CardFooter.defaultProps = {
|
|
23
27
|
children: null,
|
|
24
|
-
id: undefined,
|
|
25
28
|
};
|
|
26
29
|
|
|
27
30
|
CardFooter.propTypes = {
|
|
@@ -29,10 +32,6 @@ CardFooter.propTypes = {
|
|
|
29
32
|
* Card actions, usually buttons.
|
|
30
33
|
*/
|
|
31
34
|
children: PropTypes.node,
|
|
32
|
-
/**
|
|
33
|
-
* ID of the root HTML element.
|
|
34
|
-
*/
|
|
35
|
-
id: PropTypes.string,
|
|
36
35
|
};
|
|
37
36
|
|
|
38
37
|
export const CardFooterWithGlobalProps = withGlobalProps(CardFooter, 'CardFooter');
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
Playground,
|
|
11
11
|
Props,
|
|
12
12
|
} from 'docz'
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
import {
|
|
14
|
+
Button,
|
|
15
|
+
ScrollView,
|
|
16
|
+
Card,
|
|
17
|
+
CardBody,
|
|
18
|
+
CardFooter,
|
|
19
|
+
} from '../..'
|
|
18
20
|
|
|
19
21
|
Cards contain content and actions about a single subject.
|
|
20
22
|
|
|
@@ -278,6 +280,17 @@ its interactive elements to disallow user's interaction.
|
|
|
278
280
|
</Card>
|
|
279
281
|
</Playground>
|
|
280
282
|
|
|
283
|
+
## Forwarding HTML Attributes
|
|
284
|
+
|
|
285
|
+
In addition to the options below in the [component's API](#api) section, you
|
|
286
|
+
can specify [React synthetic events] or **any HTML attribute you like.** All
|
|
287
|
+
attributes that don't interfere with the API are forwarded to the root `<div>`
|
|
288
|
+
HTML element. This enables making the component interactive and helps to improve
|
|
289
|
+
its accessibility.
|
|
290
|
+
|
|
291
|
+
👉 Refer to the MDN reference for the full list of supported attributes of the
|
|
292
|
+
[div] element.
|
|
293
|
+
|
|
281
294
|
## API
|
|
282
295
|
|
|
283
296
|
<Props table of={Card} />
|
|
@@ -324,3 +337,6 @@ Where:
|
|
|
324
337
|
(see [color variants](#color-variants) and [API](#api)),
|
|
325
338
|
- `<PROPERTY>` is one of `color` (color of text), `border-color`, or
|
|
326
339
|
`background-color`.
|
|
340
|
+
|
|
341
|
+
[React synthetic events]: https://reactjs.org/docs/events.html
|
|
342
|
+
[div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
|