@react-ui-org/react-ui 0.44.0 → 0.46.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CONTRIBUTING.md +7 -0
- package/dist/lib.development.js +209 -305
- package/dist/lib.js +1 -1
- package/package.json +10 -13
- package/src/lib/components/Alert/Alert.jsx +4 -3
- package/src/lib/components/Alert/Alert.scss +48 -48
- package/src/lib/components/Alert/_settings.scss +4 -4
- package/src/lib/components/Alert/_theme.scss +50 -50
- package/src/lib/components/Alert/_tools.scss +6 -6
- package/src/lib/components/Badge/Badge.jsx +6 -8
- package/src/lib/components/Badge/Badge.scss +57 -57
- package/src/lib/components/Button/Button.jsx +10 -9
- package/src/lib/components/Button/Button.scss +2 -2
- package/src/lib/components/Button/README.mdx +8 -3
- package/src/lib/components/Button/_base.scss +65 -65
- package/src/lib/components/Button/_priorities.scss +49 -49
- package/src/lib/components/Button/_settings.scss +10 -10
- package/src/lib/components/Button/_theme.scss +18 -15
- package/src/lib/components/Button/_tools.scss +98 -100
- package/src/lib/components/ButtonGroup/ButtonGroup.jsx +31 -22
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/ButtonGroup/README.mdx +4 -4
- package/src/lib/components/Card/Card.jsx +7 -6
- package/src/lib/components/Card/Card.scss +28 -28
- package/src/lib/components/Card/CardBody.jsx +5 -11
- package/src/lib/components/Card/CardFooter.jsx +10 -5
- package/src/lib/components/Card/README.mdx +2 -2
- package/src/lib/components/Card/_theme.scss +50 -50
- package/src/lib/components/Card/_tools.scss +6 -6
- package/src/lib/components/CheckboxField/CheckboxField.jsx +18 -17
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/CheckboxField/README.mdx +3 -3
- package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FileInputField/README.mdx +1 -1
- package/src/lib/components/FormLayout/FormLayout.jsx +16 -14
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +15 -9
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +27 -49
- package/src/lib/components/Grid/Grid.jsx +4 -3
- package/src/lib/components/Grid/Grid.scss +32 -23
- package/src/lib/components/Grid/GridSpan.jsx +4 -3
- package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
- package/src/lib/components/Grid/_theme.scss +9 -9
- package/src/lib/components/Grid/_tools.scss +20 -20
- package/src/lib/components/List/List.jsx +14 -12
- package/src/lib/components/List/List.scss +21 -21
- package/src/lib/components/List/ListItem.jsx +3 -2
- package/src/lib/components/List/README.mdx +1 -1
- package/src/lib/components/Media/Media.jsx +12 -5
- package/src/lib/components/Media/Media.scss +6 -6
- package/src/lib/components/Media/MediaBody.jsx +18 -7
- package/src/lib/components/Media/MediaObject.jsx +18 -7
- package/src/lib/components/Modal/Modal.jsx +8 -6
- package/src/lib/components/Modal/Modal.scss +73 -73
- package/src/lib/components/Modal/README.mdx +2 -2
- package/src/lib/components/Modal/_settings.scss +5 -5
- package/src/lib/components/Modal/_theme.scss +17 -17
- package/src/lib/components/Paper/Paper.jsx +6 -6
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Paper/README.mdx +1 -1
- package/src/lib/components/Radio/README.mdx +4 -4
- package/src/lib/components/Radio/Radio.jsx +12 -11
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/README.mdx +4 -1
- package/src/lib/components/ScrollView/ScrollView.jsx +11 -9
- package/src/lib/components/ScrollView/ScrollView.scss +113 -113
- package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
- package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
- package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
- package/src/lib/components/SelectField/README.mdx +4 -4
- package/src/lib/components/SelectField/SelectField.jsx +14 -13
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/README.mdx +3 -3
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- package/src/lib/components/Tabs/README.mdx +1 -1
- package/src/lib/components/Tabs/Tabs.jsx +1 -2
- package/src/lib/components/Tabs/Tabs.scss +21 -21
- package/src/lib/components/Tabs/TabsItem.jsx +4 -3
- package/src/lib/components/Tabs/TabsItem.scss +78 -78
- package/src/lib/components/Text/README.mdx +1 -1
- package/src/lib/components/Text/Text.jsx +13 -6
- package/src/lib/components/Text/Text.scss +23 -13
- package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
- package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
- package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
- package/src/lib/components/TextArea/README.mdx +1 -1
- package/src/lib/components/TextArea/TextArea.jsx +18 -14
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/README.mdx +1 -1
- package/src/lib/components/TextField/TextField.jsx +16 -14
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/TextLink/README.mdx +77 -0
- package/src/lib/components/{Link/Link.jsx → TextLink/TextLink.jsx} +12 -13
- package/src/lib/components/TextLink/TextLink.scss +11 -0
- package/src/lib/components/TextLink/_theme.scss +4 -0
- package/src/lib/components/TextLink/index.js +1 -0
- package/src/lib/components/Toggle/README.mdx +3 -3
- package/src/lib/components/Toggle/Toggle.jsx +18 -17
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/README.mdx +19 -3
- package/src/lib/components/Toolbar/Toolbar.jsx +23 -14
- package/src/lib/components/Toolbar/Toolbar.scss +35 -30
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +18 -13
- package/src/lib/components/Toolbar/ToolbarItem.jsx +26 -7
- package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
- package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
- package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
- package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
- package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
- package/src/lib/foundation.scss +11 -11
- package/src/lib/helpers.scss +2 -2
- package/src/lib/index.js +4 -8
- package/src/lib/styles/_utilities.scss +13 -13
- package/src/lib/styles/elements/_code.scss +7 -7
- package/src/lib/styles/elements/_links.scss +8 -8
- package/src/lib/styles/elements/_lists.scss +3 -3
- package/src/lib/styles/elements/_page.scss +14 -14
- package/src/lib/styles/elements/_rulers.scss +6 -6
- package/src/lib/styles/elements/_small.scss +2 -2
- package/src/lib/styles/generic/_box-sizing.scss +3 -2
- package/src/lib/styles/generic/_forms.scss +3 -3
- package/src/lib/styles/generic/_reset.scss +6 -6
- package/src/lib/styles/generic/_shared.scss +3 -3
- package/src/lib/styles/helpers/_animation.scss +8 -8
- package/src/lib/styles/settings/_breakpoints.scss +7 -7
- package/src/lib/styles/settings/_escaped-characters.scss +5 -5
- package/src/lib/styles/settings/_form-fields.scss +24 -24
- package/src/lib/styles/settings/_utilities.scss +112 -100
- package/src/lib/styles/theme/_colors.scss +50 -50
- package/src/lib/styles/theme/_form-fields.scss +32 -32
- package/src/lib/styles/theme/_spacing.scss +11 -11
- package/src/lib/styles/theme/_typography.scss +12 -11
- package/src/lib/styles/theme-constants/_breakpoints.scss +2 -2
- package/src/lib/styles/theme-constants/_colors.scss +2 -2
- package/src/lib/styles/theme-constants/_svg.scss +1 -2
- package/src/lib/styles/tools/_accessibility.scss +29 -29
- package/src/lib/styles/tools/_breakpoint.scss +11 -14
- package/src/lib/styles/tools/_caret.scss +8 -8
- package/src/lib/styles/tools/_colors.scss +3 -3
- package/src/lib/styles/tools/_reset.scss +24 -21
- package/src/lib/styles/tools/_scrollbar.scss +4 -4
- package/src/lib/styles/tools/_spacing.scss +17 -21
- package/src/lib/styles/tools/_string.scss +9 -9
- package/src/lib/styles/tools/_svg.scss +13 -16
- package/src/lib/styles/tools/_transition.scss +42 -44
- package/src/lib/styles/tools/_utilities.scss +19 -19
- package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
- package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
- package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
- package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
- package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
- package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
- package/src/lib/theme.scss +958 -954
- package/src/lib/utils/classNames.js +8 -0
- package/src/lib/components/CTA/CTA.jsx +0 -60
- package/src/lib/components/CTA/CTA.scss +0 -71
- package/src/lib/components/CTA/CTACenter.jsx +0 -27
- package/src/lib/components/CTA/CTAEnd.jsx +0 -27
- package/src/lib/components/CTA/CTAStart.jsx +0 -27
- package/src/lib/components/CTA/README.mdx +0 -119
- package/src/lib/components/CTA/index.js +0 -4
- package/src/lib/components/Center/Center.jsx +0 -27
- package/src/lib/components/Center/Center.scss +0 -7
- package/src/lib/components/Center/README.mdx +0 -52
- package/src/lib/components/Center/index.js +0 -1
- package/src/lib/components/Link/Link.scss +0 -11
- package/src/lib/components/Link/README.mdx +0 -85
- package/src/lib/components/Link/_theme.scss +0 -4
- package/src/lib/components/Link/index.js +0 -1
@@ -15,142 +15,140 @@
|
|
15
15
|
//
|
16
16
|
// 5. Use original padding to restore square buttons back to their size.
|
17
17
|
|
18
|
-
@use
|
19
|
-
@use
|
20
|
-
@use
|
21
|
-
@use
|
22
|
-
@use
|
23
|
-
@use
|
24
|
-
@use
|
25
|
-
@use
|
18
|
+
@use "sass:list";
|
19
|
+
@use "sass:map";
|
20
|
+
@use "sass:math";
|
21
|
+
@use "../../styles/tools/accessibility";
|
22
|
+
@use "../../styles/tools/breakpoint";
|
23
|
+
@use "../../styles/tools/transition";
|
24
|
+
@use "settings";
|
25
|
+
@use "theme";
|
26
26
|
|
27
27
|
// 1.
|
28
28
|
@mixin _get-themeable-properties($priority, $color, $state) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
}
|
33
|
-
|
34
|
-
@if (not list.index(settings.$themeable-variants, $color)) {
|
35
|
-
@error "Invalid variant specified! #{$color} doesn't exist. "
|
36
|
-
+ "Choose one of #{settings.$themeable-variants}.";
|
37
|
-
}
|
38
|
-
|
39
|
-
@if (not list.index(settings.$themeable-states, $state)) {
|
40
|
-
@error "Invalid state specified! #{$state} doesn't exist. "
|
41
|
-
+ "Choose one of #{settings.$themeable-states}.";
|
42
|
-
}
|
43
|
-
|
44
|
-
$properties: map.get(settings.$themeable-priority-properties, $priority);
|
45
|
-
|
46
|
-
// 2.
|
47
|
-
@if ($state == 'disabled') {
|
48
|
-
@each $property in $properties {
|
49
|
-
--rui-local-#{$property}:
|
50
|
-
var(
|
51
|
-
--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property},
|
52
|
-
var(--rui-Button--#{$priority}--#{$color}--default__#{$property})
|
53
|
-
);
|
29
|
+
@if not list.index(map.keys(settings.$themeable-priority-properties), $priority) {
|
30
|
+
@error "Invalid priority specified! #{$priority} doesn't exist. "
|
31
|
+
+ "Choose one of #{settings.$themeable-priority-properties}.";
|
54
32
|
}
|
55
|
-
}
|
56
33
|
|
57
|
-
|
58
|
-
|
59
|
-
|
34
|
+
@if not list.index(settings.$themeable-variants, $color) {
|
35
|
+
@error "Invalid variant specified! #{$color} doesn't exist. "
|
36
|
+
+ "Choose one of #{settings.$themeable-variants}.";
|
37
|
+
}
|
38
|
+
|
39
|
+
@if not list.index(settings.$themeable-states, $state) {
|
40
|
+
@error "Invalid state specified! #{$state} doesn't exist. "
|
41
|
+
+ "Choose one of #{settings.$themeable-states}.";
|
42
|
+
}
|
43
|
+
|
44
|
+
$properties: map.get(settings.$themeable-priority-properties, $priority);
|
45
|
+
|
46
|
+
// 2.
|
47
|
+
@if $state == "disabled" {
|
48
|
+
@each $property in $properties {
|
49
|
+
--rui-local-#{$property}:
|
50
|
+
var(
|
51
|
+
--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property},
|
52
|
+
var(--rui-Button--#{$priority}--#{$color}--default__#{$property})
|
53
|
+
);
|
54
|
+
}
|
55
|
+
} @else {
|
56
|
+
@each $property in $properties {
|
57
|
+
--rui-local-#{$property}: var(--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property});
|
58
|
+
}
|
60
59
|
}
|
61
|
-
}
|
62
60
|
}
|
63
61
|
|
64
62
|
// 4.
|
65
63
|
@mixin _button-square() {
|
66
|
-
|
67
|
-
|
64
|
+
--rui-local-padding: 0;
|
65
|
+
--rui-local-width: var(--rui-local-height);
|
68
66
|
}
|
69
67
|
|
70
68
|
// 5.
|
71
69
|
@mixin _button-size-restore() {
|
72
|
-
|
73
|
-
|
70
|
+
--rui-local-padding: var(--rui-local-padding-original);
|
71
|
+
--rui-local-width: unset;
|
74
72
|
}
|
75
73
|
|
76
74
|
@mixin button() {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
text-decoration: none;
|
91
|
-
text-transform: theme.$text-transform;
|
92
|
-
vertical-align: middle;
|
93
|
-
color: var(--rui-local-color);
|
94
|
-
border: theme.$border-width solid var(--rui-local-border-color, transparent);
|
95
|
-
border-radius: theme.$border-radius;
|
96
|
-
background: var(--rui-local-background, transparent);
|
97
|
-
box-shadow: var(--rui-local-box-shadow, none);
|
98
|
-
user-select: none;
|
99
|
-
cursor: pointer;
|
100
|
-
|
101
|
-
&:hover,
|
102
|
-
&:focus {
|
75
|
+
@include transition.add((opacity, color, border-color, background-color, box-shadow));
|
76
|
+
|
77
|
+
position: relative; // 3.
|
78
|
+
display: inline-flex;
|
79
|
+
column-gap: settings.$icon-spacing;
|
80
|
+
align-items: center;
|
81
|
+
justify-content: center;
|
82
|
+
width: var(--rui-local-width, auto);
|
83
|
+
min-height: var(--rui-local-height, auto);
|
84
|
+
padding: var(--rui-local-padding);
|
85
|
+
font: theme.$font-weight list.slash(var(--rui-local-font-size), settings.$line-height) settings.$font-family;
|
86
|
+
letter-spacing: theme.$letter-spacing;
|
87
|
+
text-align: center;
|
103
88
|
text-decoration: none;
|
104
|
-
|
89
|
+
text-transform: theme.$text-transform;
|
90
|
+
vertical-align: middle;
|
91
|
+
color: var(--rui-local-color);
|
92
|
+
border: theme.$border-width solid var(--rui-local-border-color, transparent);
|
93
|
+
border-radius: theme.$border-radius;
|
94
|
+
background: var(--rui-local-background, transparent);
|
95
|
+
box-shadow: var(--rui-local-box-shadow, none);
|
96
|
+
user-select: none;
|
97
|
+
cursor: pointer;
|
98
|
+
|
99
|
+
&:hover,
|
100
|
+
&:focus {
|
101
|
+
text-decoration: none;
|
102
|
+
}
|
105
103
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
104
|
+
&:disabled {
|
105
|
+
opacity: theme.$disabled-opacity;
|
106
|
+
cursor: theme.$disabled-cursor;
|
107
|
+
}
|
110
108
|
|
111
|
-
|
112
|
-
|
113
|
-
|
109
|
+
&:-moz-focusring {
|
110
|
+
outline: 0;
|
111
|
+
}
|
114
112
|
}
|
115
113
|
|
116
114
|
@mixin button-size($size) {
|
117
|
-
|
115
|
+
$properties: map.get(theme.$sizes, $size);
|
118
116
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
117
|
+
--rui-local-height: #{map.get($properties, height)};
|
118
|
+
--rui-local-padding: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)};
|
119
|
+
--rui-local-padding-original: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)}; // 5.
|
120
|
+
--rui-local-font-size: #{map.get($properties, font-size)};
|
123
121
|
}
|
124
122
|
|
125
123
|
@mixin button-color($priority, $color) {
|
126
|
-
|
124
|
+
@include _get-themeable-properties($priority, $color, default);
|
127
125
|
|
128
|
-
|
129
|
-
|
130
|
-
|
126
|
+
&:disabled {
|
127
|
+
@include _get-themeable-properties($priority, $color, disabled);
|
128
|
+
}
|
131
129
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
130
|
+
&:not(:disabled):hover,
|
131
|
+
&:not(:disabled):focus {
|
132
|
+
@include _get-themeable-properties($priority, $color, hover);
|
133
|
+
}
|
136
134
|
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
&:not(:disabled):active {
|
136
|
+
@include _get-themeable-properties($priority, $color, active);
|
137
|
+
}
|
140
138
|
}
|
141
139
|
|
142
140
|
@mixin hide-label() {
|
143
|
-
|
141
|
+
@include _button-square();
|
144
142
|
|
145
|
-
|
146
|
-
|
147
|
-
|
143
|
+
.label {
|
144
|
+
@include accessibility.hide-text();
|
145
|
+
}
|
148
146
|
}
|
149
147
|
|
150
148
|
@mixin show-label() {
|
151
|
-
|
149
|
+
@include _button-size-restore();
|
152
150
|
|
153
|
-
|
154
|
-
|
155
|
-
|
151
|
+
.label {
|
152
|
+
@include accessibility.unhide-text();
|
153
|
+
}
|
156
154
|
}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
6
|
import styles from './ButtonGroup.scss';
|
5
7
|
import { ButtonGroupContext } from './ButtonGroupContext';
|
6
8
|
|
@@ -11,30 +13,37 @@ export const ButtonGroup = ({
|
|
11
13
|
priority,
|
12
14
|
size,
|
13
15
|
...restProps
|
14
|
-
}) =>
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
priority,
|
28
|
-
size,
|
29
|
-
}}
|
16
|
+
}) => {
|
17
|
+
if (isChildrenEmpty(children)) {
|
18
|
+
return null;
|
19
|
+
}
|
20
|
+
|
21
|
+
return (
|
22
|
+
<div
|
23
|
+
className={classNames(
|
24
|
+
styles.root,
|
25
|
+
block && styles.isRootBlock,
|
26
|
+
)}
|
27
|
+
role="group"
|
28
|
+
{...restProps}
|
30
29
|
>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
<ButtonGroupContext.Provider
|
31
|
+
value={{
|
32
|
+
block,
|
33
|
+
disabled,
|
34
|
+
priority,
|
35
|
+
size,
|
36
|
+
}}
|
37
|
+
>
|
38
|
+
{children}
|
39
|
+
</ButtonGroupContext.Provider>
|
40
|
+
</div>
|
41
|
+
);
|
42
|
+
};
|
35
43
|
|
36
44
|
ButtonGroup.defaultProps = {
|
37
45
|
block: false,
|
46
|
+
children: null,
|
38
47
|
disabled: false,
|
39
48
|
priority: 'filled',
|
40
49
|
size: 'medium',
|
@@ -46,9 +55,9 @@ ButtonGroup.propTypes = {
|
|
46
55
|
*/
|
47
56
|
block: PropTypes.bool,
|
48
57
|
/**
|
49
|
-
* Buttons to be grouped.
|
58
|
+
* Buttons to be grouped. If none are provided nothing is rendered.
|
50
59
|
*/
|
51
|
-
children: PropTypes.node
|
60
|
+
children: PropTypes.node,
|
52
61
|
/**
|
53
62
|
* If `true`, all buttons inside the group will be disabled.
|
54
63
|
*/
|
@@ -44,11 +44,11 @@ See [API](#api) for all available options.
|
|
44
44
|
- Use **short labels or icons** so the buttons can fit small screens.
|
45
45
|
|
46
46
|
- For toggling between on/off states, use rather the
|
47
|
-
[Toggle](/components/
|
47
|
+
[Toggle](/components/toggle) component.
|
48
48
|
|
49
49
|
- For switching between options in a form that needs to be submitted, use rather
|
50
|
-
the [SelectField](/components/
|
51
|
-
[Radio](/components/
|
50
|
+
the [SelectField](/components/select-field) or
|
51
|
+
[Radio](/components/radio) components.
|
52
52
|
|
53
53
|
- Be careful with using `startCorner` and `endCorner` options for grouped
|
54
54
|
buttons. Overflowing elements may cause undesired interaction problems.
|
@@ -65,7 +65,7 @@ different types or sizes.
|
|
65
65
|
## Priorities
|
66
66
|
|
67
67
|
There are three **visual priorities** of buttons which exactly copy the
|
68
|
-
priorities of the [Button](/components/
|
68
|
+
priorities of the [Button](/components/button) component:
|
69
69
|
|
70
70
|
1. filled
|
71
71
|
2. outline
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import getRootColorClassName from '../../helpers/getRootColorClassName';
|
4
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
5
6
|
import styles from './Card.scss';
|
6
7
|
|
7
8
|
export const Card = ({
|
@@ -13,13 +14,13 @@ export const Card = ({
|
|
13
14
|
color,
|
14
15
|
}) => (
|
15
16
|
<div
|
16
|
-
className={
|
17
|
+
className={classNames(
|
17
18
|
styles.root,
|
18
19
|
getRootColorClassName(color, styles),
|
19
|
-
dense
|
20
|
-
raised
|
21
|
-
disabled
|
22
|
-
|
20
|
+
dense && styles.rootDense,
|
21
|
+
raised && styles.rootRaised,
|
22
|
+
disabled && styles.isDisabled,
|
23
|
+
)}
|
23
24
|
id={id}
|
24
25
|
>
|
25
26
|
{children}
|
@@ -1,79 +1,79 @@
|
|
1
1
|
// 1. Retain equal card widths in flex and grid layouts independently on their content.
|
2
2
|
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
3
|
+
@use "../../styles/theme/colors";
|
4
|
+
@use "theme";
|
5
|
+
@use "tools";
|
6
6
|
|
7
7
|
.root {
|
8
|
-
|
8
|
+
--rui-local-padding: #{theme.$padding};
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
display: flex;
|
11
|
+
flex-direction: column;
|
12
|
+
min-width: 0; // 1.
|
13
|
+
color: var(--rui-local-color);
|
14
|
+
border: theme.$border-width solid var(--rui-local-border-color);
|
15
|
+
border-radius: theme.$border-radius;
|
16
|
+
background-color: var(--rui-local-background-color);
|
17
17
|
}
|
18
18
|
|
19
19
|
.body {
|
20
|
-
|
21
|
-
|
20
|
+
flex: 1 0 auto;
|
21
|
+
padding: var(--rui-local-padding);
|
22
22
|
}
|
23
23
|
|
24
24
|
.footer {
|
25
|
-
|
25
|
+
padding: var(--rui-local-padding);
|
26
26
|
}
|
27
27
|
|
28
28
|
.rootDense {
|
29
|
-
|
29
|
+
--rui-local-padding: #{theme.$dense-padding};
|
30
30
|
}
|
31
31
|
|
32
32
|
.rootRaised {
|
33
|
-
|
33
|
+
box-shadow: theme.$raised-box-shadow;
|
34
34
|
}
|
35
35
|
|
36
36
|
.rootColorPrimary {
|
37
|
-
|
37
|
+
@include tools.color(primary);
|
38
38
|
}
|
39
39
|
|
40
40
|
.rootColorSecondary {
|
41
|
-
|
41
|
+
@include tools.color(secondary);
|
42
42
|
}
|
43
43
|
|
44
44
|
.rootColorSuccess {
|
45
|
-
|
45
|
+
@include tools.color(success);
|
46
46
|
}
|
47
47
|
|
48
48
|
.rootColorWarning {
|
49
|
-
|
49
|
+
@include tools.color(warning);
|
50
50
|
}
|
51
51
|
|
52
52
|
.rootColorDanger {
|
53
|
-
|
53
|
+
@include tools.color(danger);
|
54
54
|
}
|
55
55
|
|
56
56
|
.rootColorHelp {
|
57
|
-
|
57
|
+
@include tools.color(help);
|
58
58
|
}
|
59
59
|
|
60
60
|
.rootColorInfo {
|
61
|
-
|
61
|
+
@include tools.color(info);
|
62
62
|
}
|
63
63
|
|
64
64
|
.rootColorNote {
|
65
|
-
|
65
|
+
@include tools.color(note);
|
66
66
|
}
|
67
67
|
|
68
68
|
.rootColorLight {
|
69
|
-
|
69
|
+
@include tools.color(light);
|
70
70
|
}
|
71
71
|
|
72
72
|
.rootColorDark {
|
73
|
-
|
73
|
+
@include tools.color(dark);
|
74
74
|
}
|
75
75
|
|
76
76
|
.isDisabled {
|
77
|
-
|
78
|
-
|
77
|
+
background-color: theme.$disabled-background-color;
|
78
|
+
opacity: theme.$disabled-opacity;
|
79
79
|
}
|
@@ -3,17 +3,11 @@ import React from 'react';
|
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
4
|
import styles from './Card.scss';
|
5
5
|
|
6
|
-
export const CardBody = (
|
7
|
-
|
8
|
-
children
|
9
|
-
|
10
|
-
|
11
|
-
return (
|
12
|
-
<div className={styles.body}>
|
13
|
-
{children}
|
14
|
-
</div>
|
15
|
-
);
|
16
|
-
};
|
6
|
+
export const CardBody = ({ children }) => (
|
7
|
+
<div className={styles.body}>
|
8
|
+
{children}
|
9
|
+
</div>
|
10
|
+
);
|
17
11
|
|
18
12
|
CardBody.propTypes = {
|
19
13
|
/**
|
@@ -1,12 +1,13 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
+
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
4
5
|
import styles from './Card.scss';
|
5
6
|
|
6
|
-
export const CardFooter = (
|
7
|
-
|
8
|
-
|
9
|
-
}
|
7
|
+
export const CardFooter = ({ children }) => {
|
8
|
+
if (isChildrenEmpty(children)) {
|
9
|
+
return null;
|
10
|
+
}
|
10
11
|
|
11
12
|
return (
|
12
13
|
<div className={styles.footer}>
|
@@ -15,11 +16,15 @@ export const CardFooter = (props) => {
|
|
15
16
|
);
|
16
17
|
};
|
17
18
|
|
19
|
+
CardFooter.defaultProps = {
|
20
|
+
children: null,
|
21
|
+
};
|
22
|
+
|
18
23
|
CardFooter.propTypes = {
|
19
24
|
/**
|
20
25
|
* Card actions, usually buttons.
|
21
26
|
*/
|
22
|
-
children: PropTypes.node
|
27
|
+
children: PropTypes.node,
|
23
28
|
};
|
24
29
|
|
25
30
|
export const CardFooterWithContext = withProviderContext(CardFooter, 'CardFooter');
|
@@ -53,7 +53,7 @@ See [API](#api) for all available options.
|
|
53
53
|
grid. It will help you keep the UI clean and easy to scan.
|
54
54
|
|
55
55
|
- **Card, or Paper?** Card is a versatile surface for displaying content.
|
56
|
-
However, there is also the [Paper](/components/
|
56
|
+
However, there is also the [Paper](/components/paper) component. While Card
|
57
57
|
is designed for displaying items (and also supports more visual options),
|
58
58
|
Paper is usually used to hold larger content areas like lists, grids, or
|
59
59
|
forms.
|
@@ -119,7 +119,7 @@ card should be also smaller to keep the card contained and easy to scan.
|
|
119
119
|
|
120
120
|
## Scrollable Card
|
121
121
|
|
122
|
-
Combine Card with [ScrollView](/components/
|
122
|
+
Combine Card with [ScrollView](/components/scroll-view) to enable scrolling
|
123
123
|
for card content.
|
124
124
|
|
125
125
|
<Playground>
|