@react-ui-org/react-ui 0.56.0 → 0.58.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 +17 -17
- package/dist/react-ui.development.css +2551 -831
- package/dist/react-ui.development.js +106 -66
- package/dist/react-ui.js +1 -1
- package/package.json +13 -2
- package/src/CNAME +1 -0
- package/src/components/Alert/Alert.jsx +5 -6
- package/src/components/Alert/Alert.module.scss +12 -34
- package/src/components/Alert/README.md +28 -15
- 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 +19 -2
- 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 +8 -6
- 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/Card/Card.jsx +3 -2
- package/src/components/Card/Card.module.scss +13 -33
- package/src/components/Card/CardBody.jsx +1 -1
- package/src/components/Card/CardFooter.jsx +1 -1
- package/src/components/Card/README.md +28 -6
- package/src/components/Card/_settings.scss +5 -0
- package/src/components/Card/_theme.scss +0 -43
- package/src/components/CheckboxField/CheckboxField.jsx +9 -3
- package/src/components/CheckboxField/README.md +110 -5
- package/src/components/FileInputField/FileInputField.jsx +1 -1
- package/src/components/FormLayout/FormLayout.jsx +1 -1
- package/src/components/FormLayout/FormLayoutCustomField.jsx +1 -1
- package/src/components/Grid/Grid.jsx +1 -1
- package/src/components/Grid/Grid.module.scss +9 -2
- package/src/components/Grid/GridSpan.jsx +1 -1
- package/src/components/InputGroup/InputGroup.jsx +2 -2
- package/src/components/InputGroup/InputGroup.module.scss +9 -5
- package/src/components/Modal/Modal.jsx +1 -1
- package/src/components/Modal/ModalBody.jsx +1 -1
- package/src/components/Modal/ModalCloseButton.jsx +3 -5
- package/src/components/Modal/ModalContent.jsx +1 -1
- package/src/components/Modal/ModalFooter.jsx +1 -1
- package/src/components/Modal/ModalHeader.jsx +1 -1
- package/src/components/Modal/ModalTitle.jsx +1 -1
- package/src/components/Modal/README.md +18 -18
- package/src/components/Paper/Paper.jsx +1 -1
- package/src/components/Popover/Popover.jsx +58 -13
- package/src/components/Popover/Popover.module.scss +51 -23
- package/src/components/Popover/PopoverWrapper.jsx +1 -1
- package/src/components/Popover/README.md +60 -3
- package/src/components/Popover/_helpers/cleanPlacementStyle.js +20 -0
- package/src/components/Popover/_theme.scss +4 -2
- package/src/components/Radio/README.md +103 -0
- package/src/components/Radio/Radio.jsx +9 -3
- package/src/components/Radio/Radio.module.scss +4 -0
- package/src/components/ScrollView/ScrollView.jsx +3 -5
- package/src/components/SelectField/README.md +103 -0
- package/src/components/SelectField/SelectField.jsx +9 -3
- package/src/components/Table/Table.jsx +1 -1
- package/src/components/Tabs/Tabs.jsx +1 -1
- package/src/components/Tabs/TabsItem.jsx +1 -1
- package/src/components/Text/Text.jsx +1 -1
- package/src/components/TextArea/TextArea.jsx +1 -1
- package/src/components/TextField/README.md +14 -2
- package/src/components/TextField/TextField.jsx +1 -1
- package/src/components/TextLink/README.md +10 -3
- package/src/components/TextLink/TextLink.jsx +1 -1
- package/src/components/TextLink/_theme.scss +3 -3
- package/src/components/Toggle/README.md +83 -1
- package/src/components/Toggle/Toggle.jsx +9 -3
- 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/components/_helpers/resolveContextOrProp.js +6 -3
- package/src/index.js +3 -2
- package/src/providers/globalProps/GlobalPropsContext.jsx +5 -0
- package/src/providers/globalProps/GlobalPropsProvider.jsx +33 -0
- package/src/providers/globalProps/index.js +3 -0
- package/src/{provider → providers/globalProps}/withGlobalProps.jsx +16 -16
- package/src/providers/translations/TranslationsContext.jsx +6 -0
- package/src/providers/translations/TranslationsProvider.jsx +33 -0
- package/src/providers/translations/index.js +2 -0
- package/src/styles/elements/_links.scss +7 -2
- package/src/styles/settings/_collections.scss +9 -0
- package/src/styles/theme/_form-fields.scss +19 -0
- package/src/styles/theme/_links.scss +4 -3
- package/src/styles/tools/_collections.scss +265 -0
- package/src/styles/tools/_string.scss +5 -2
- package/src/styles/tools/form-fields/_box-field-layout.scss +7 -1
- package/src/styles/tools/form-fields/_foundation.scss +6 -4
- package/src/styles/tools/form-fields/_variants.scss +5 -1
- package/src/theme.scss +66 -1
- package/src/components/Alert/_tools.scss +0 -10
- package/src/components/Button/_base.scss +0 -156
- package/src/components/Button/_priorities.scss +0 -149
- package/src/components/Card/_tools.scss +0 -10
- package/src/provider/RUIContext.jsx +0 -9
- package/src/provider/RUIProvider.jsx +0 -42
- package/src/provider/index.js +0 -3
@@ -1,2 +1,183 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
// 1. ButtonGroup gap is implemented using the `margin` property so the buttons can overlap and reduce duplicate
|
2
|
+
// borders.
|
3
|
+
|
4
|
+
@use "sass:map";
|
5
|
+
@use "../../styles/tools/breakpoint";
|
6
|
+
@use "../../styles/tools/collections";
|
7
|
+
@use "settings";
|
8
|
+
@use "theme";
|
9
|
+
@use "tools";
|
10
|
+
|
11
|
+
@layer components.button {
|
12
|
+
.root {
|
13
|
+
@include tools.button();
|
14
|
+
}
|
15
|
+
|
16
|
+
.label {
|
17
|
+
display: block;
|
18
|
+
}
|
19
|
+
|
20
|
+
.beforeLabel,
|
21
|
+
.afterLabel,
|
22
|
+
.startCorner,
|
23
|
+
.endCorner,
|
24
|
+
.feedbackIcon {
|
25
|
+
display: flex;
|
26
|
+
align-items: baseline;
|
27
|
+
justify-content: center;
|
28
|
+
}
|
29
|
+
|
30
|
+
.startCorner,
|
31
|
+
.endCorner {
|
32
|
+
position: absolute;
|
33
|
+
top: -0.35rem;
|
34
|
+
z-index: 2;
|
35
|
+
}
|
36
|
+
|
37
|
+
.startCorner {
|
38
|
+
left: 0;
|
39
|
+
margin-left: -0.35rem;
|
40
|
+
}
|
41
|
+
|
42
|
+
.endCorner {
|
43
|
+
right: 0;
|
44
|
+
margin-right: -0.35rem;
|
45
|
+
}
|
46
|
+
|
47
|
+
.feedbackIcon {
|
48
|
+
position: absolute;
|
49
|
+
inset: 0;
|
50
|
+
z-index: 1;
|
51
|
+
align-items: center;
|
52
|
+
}
|
53
|
+
|
54
|
+
.isRootSizeSmall {
|
55
|
+
@include tools.button-size(small);
|
56
|
+
}
|
57
|
+
|
58
|
+
.isRootSizeMedium {
|
59
|
+
@include tools.button-size(medium);
|
60
|
+
}
|
61
|
+
|
62
|
+
.isRootSizeLarge {
|
63
|
+
@include tools.button-size(large);
|
64
|
+
}
|
65
|
+
|
66
|
+
.isRootBlock {
|
67
|
+
width: 100%;
|
68
|
+
}
|
69
|
+
|
70
|
+
.hasRootFeedback:disabled {
|
71
|
+
opacity: theme.$feedback-opacity;
|
72
|
+
cursor: theme.$feedback-cursor;
|
73
|
+
}
|
74
|
+
|
75
|
+
.hasRootFeedback .label,
|
76
|
+
.hasRootFeedback .beforeLabel,
|
77
|
+
.hasRootFeedback .afterLabel {
|
78
|
+
color: transparent;
|
79
|
+
}
|
80
|
+
|
81
|
+
.isRootInButtonGroup,
|
82
|
+
.isRootInInputGroup {
|
83
|
+
z-index: map.get(settings.$group-z-indexes, button);
|
84
|
+
|
85
|
+
&:not(:first-child) {
|
86
|
+
border-start-start-radius: var(--rui-local-inner-border-radius);
|
87
|
+
border-end-start-radius: var(--rui-local-inner-border-radius);
|
88
|
+
}
|
89
|
+
|
90
|
+
&:not(:last-child) {
|
91
|
+
border-start-end-radius: var(--rui-local-inner-border-radius);
|
92
|
+
border-end-end-radius: var(--rui-local-inner-border-radius);
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
.isRootInButtonGroup:not(:first-child) {
|
97
|
+
margin-inline-start: var(--rui-local-gap); // 1.
|
98
|
+
|
99
|
+
&::before {
|
100
|
+
content: "";
|
101
|
+
position: absolute;
|
102
|
+
top: calc(-1 * #{theme.$border-width});
|
103
|
+
bottom: calc(-1 * #{theme.$border-width});
|
104
|
+
left: calc(-1 * #{theme.$border-width});
|
105
|
+
z-index: map.get(settings.$group-z-indexes, separator);
|
106
|
+
border-left: var(--rui-local-separator-width) solid var(--rui-local-separator-color);
|
107
|
+
transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
.isRootInButtonGroup:focus,
|
112
|
+
.isRootInButtonGroup:not(:disabled):hover {
|
113
|
+
z-index: map.get(settings.$group-z-indexes, button-hover);
|
114
|
+
}
|
115
|
+
|
116
|
+
.isRootInButtonGroup .startCorner,
|
117
|
+
.isRootInInputGroup .startCorner,
|
118
|
+
.isRootInButtonGroup .endCorner,
|
119
|
+
.isRootInInputGroup .endCorner {
|
120
|
+
z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
|
121
|
+
}
|
122
|
+
|
123
|
+
.hasLabelHidden,
|
124
|
+
.hasLabelVisibleSm,
|
125
|
+
.hasLabelVisibleMd,
|
126
|
+
.hasLabelVisibleLg,
|
127
|
+
.hasLabelVisibleXl,
|
128
|
+
.hasLabelVisibleX2l,
|
129
|
+
.hasLabelVisibleX3l {
|
130
|
+
@include tools.hide-label();
|
131
|
+
}
|
132
|
+
|
133
|
+
.hasLabelVisibleSm {
|
134
|
+
@include breakpoint.up(sm) {
|
135
|
+
@include tools.show-label();
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
.hasLabelVisibleMd {
|
140
|
+
@include breakpoint.up(md) {
|
141
|
+
@include tools.show-label();
|
142
|
+
}
|
143
|
+
}
|
144
|
+
|
145
|
+
.hasLabelVisibleLg {
|
146
|
+
@include breakpoint.up(lg) {
|
147
|
+
@include tools.show-label();
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
.hasLabelVisibleXl {
|
152
|
+
@include breakpoint.up(xl) {
|
153
|
+
@include tools.show-label();
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
.hasLabelVisibleX2l {
|
158
|
+
@include breakpoint.up(x2l) {
|
159
|
+
@include tools.show-label();
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
163
|
+
.hasLabelVisibleX3l {
|
164
|
+
@include breakpoint.up(x3l) {
|
165
|
+
@include tools.show-label();
|
166
|
+
}
|
167
|
+
}
|
168
|
+
|
169
|
+
@each $priority in map.keys(settings.$themeable-properties) {
|
170
|
+
@each $color in settings.$colors {
|
171
|
+
@include collections.generate-class(
|
172
|
+
$prefix: "rui-",
|
173
|
+
$component-name: "Button",
|
174
|
+
$modifier-name: "priority",
|
175
|
+
$modifier-value: $priority,
|
176
|
+
$variant-name: "color",
|
177
|
+
$variant-value: $color,
|
178
|
+
$generate-interaction-states: true,
|
179
|
+
$properties: map.get(settings.$themeable-properties, $priority),
|
180
|
+
);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
}
|
@@ -40,8 +40,9 @@ lowest:
|
|
40
40
|
2. outline
|
41
41
|
3. flat
|
42
42
|
|
43
|
-
All priorities
|
44
|
-
[
|
43
|
+
All priorities are available in colors from supported
|
44
|
+
[color collections](/docs/foundation/collections#colors).
|
45
|
+
Check [API](#api) to see which collections are supported.
|
45
46
|
|
46
47
|
### Filled
|
47
48
|
|
@@ -257,7 +258,7 @@ Disabled state makes the action unavailable.
|
|
257
258
|
|
258
259
|
When user's action triggers an asynchronous process on background, the button's
|
259
260
|
feedback state (not to be mistaken with
|
260
|
-
[feedback colors](/docs/foundation/colors#
|
261
|
+
[feedback colors](/docs/foundation/colors#feedback-colors)) can be indicated by
|
261
262
|
showing an icon. The icon replaces button's label while retaining original
|
262
263
|
dimensions of the button. Buttons in feedback state are automatically disabled
|
263
264
|
to prevent unwanted interaction.
|
@@ -431,9 +432,10 @@ Where:
|
|
431
432
|
|
432
433
|
- `<PRIORITY>` is one of `filled`, `outline`, or `flat` (see
|
433
434
|
[Priorities](#priorities) and [API](#api)),
|
434
|
-
- `<COLOR>` is
|
435
|
-
[
|
436
|
-
(
|
435
|
+
- `<COLOR>` is a value from supported
|
436
|
+
[color collections](/docs/foundation/collections#colors)
|
437
|
+
(check color variants of [each priority](#priorities) and [API](#api) to see
|
438
|
+
which collections are supported),
|
437
439
|
- `<INTERACTION STATE>` is one of `default`, `hover`, `active`, or `disabled`
|
438
440
|
(the last one being optional),
|
439
441
|
- `<PROPERTY>` is one of:
|
@@ -1,3 +1,5 @@
|
|
1
|
+
@use "sass:list";
|
2
|
+
@use "../../styles/settings/collections";
|
1
3
|
@use "../../styles/theme/typography";
|
2
4
|
@use "../../styles/tools/spacing";
|
3
5
|
|
@@ -12,9 +14,12 @@ $group-z-indexes: (
|
|
12
14
|
button-overflowing-elements: 3,
|
13
15
|
);
|
14
16
|
|
15
|
-
$
|
16
|
-
|
17
|
-
|
17
|
+
$colors:
|
18
|
+
list.join(
|
19
|
+
list.join(collections.$action-colors, collections.$feedback-colors),
|
20
|
+
collections.$neutral-colors
|
21
|
+
);
|
22
|
+
$themeable-properties: (
|
18
23
|
filled: (color, border-color, background, box-shadow),
|
19
24
|
outline: (color, border-color, background),
|
20
25
|
flat: (color, background),
|
@@ -1,6 +1,3 @@
|
|
1
|
-
// Priority and variant specific theme options are obtained dynamically because there is way too
|
2
|
-
// many of them to maintain manually. See `_tools.scss` for details.
|
3
|
-
|
4
1
|
$font-weight: var(--rui-Button__font-weight);
|
5
2
|
$letter-spacing: var(--rui-Button__letter-spacing);
|
6
3
|
$text-transform: var(--rui-Button__text-transform);
|
@@ -1,71 +1,23 @@
|
|
1
|
-
// 1.
|
2
|
-
// a mixin. This way it's also easier to make theming adjustments to all supported modifications
|
3
|
-
// in one place. This applies to the following button priorities:
|
1
|
+
// 1. Get ready for position of corner elements and group separator.
|
4
2
|
//
|
5
|
-
//
|
6
|
-
// - outline
|
7
|
-
// - flat
|
3
|
+
// 2. Icon buttons should appear as squares, that's why width and height is equal here.
|
8
4
|
//
|
9
|
-
//
|
10
|
-
// styling is provided for specific variant.
|
11
|
-
//
|
12
|
-
// 3. Get ready for position of corner elements and group separator.
|
13
|
-
//
|
14
|
-
// 4. Icon buttons should appear as squares, that's why width and height is equal here.
|
15
|
-
//
|
16
|
-
// 5. Use original padding to restore square buttons back to their size.
|
5
|
+
// 3. Use original padding to restore square buttons back to their size.
|
17
6
|
|
18
7
|
@use "sass:list";
|
19
8
|
@use "sass:map";
|
20
|
-
@use "sass:math";
|
21
9
|
@use "../../styles/tools/accessibility";
|
22
|
-
@use "../../styles/tools/breakpoint";
|
23
10
|
@use "../../styles/tools/transition";
|
24
11
|
@use "settings";
|
25
12
|
@use "theme";
|
26
13
|
|
27
|
-
//
|
28
|
-
@mixin _get-themeable-properties($priority, $color, $state) {
|
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}.";
|
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
|
-
);
|
54
|
-
}
|
55
|
-
} @else {
|
56
|
-
@each $property in $properties {
|
57
|
-
--rui-local-#{$property}: var(--rui-Button--#{$priority}--#{$color}--#{$state}__#{$property});
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
// 4.
|
14
|
+
// 2.
|
63
15
|
@mixin _button-square() {
|
64
16
|
--rui-local-padding: 0;
|
65
17
|
--rui-local-width: var(--rui-local-height);
|
66
18
|
}
|
67
19
|
|
68
|
-
//
|
20
|
+
// 3.
|
69
21
|
@mixin _button-size-restore() {
|
70
22
|
--rui-local-padding: var(--rui-local-padding-original);
|
71
23
|
--rui-local-width: unset;
|
@@ -74,7 +26,7 @@
|
|
74
26
|
@mixin button() {
|
75
27
|
@include transition.add((opacity, color, border-color, background-color, box-shadow));
|
76
28
|
|
77
|
-
position: relative; //
|
29
|
+
position: relative; // 1.
|
78
30
|
display: inline-flex;
|
79
31
|
column-gap: settings.$icon-spacing;
|
80
32
|
align-items: center;
|
@@ -112,26 +64,10 @@
|
|
112
64
|
|
113
65
|
--rui-local-height: #{map.get($properties, height)};
|
114
66
|
--rui-local-padding: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)};
|
115
|
-
--rui-local-padding-original: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)}; //
|
67
|
+
--rui-local-padding-original: #{map.get($properties, padding-y)} #{map.get($properties, padding-x)}; // 3.
|
116
68
|
--rui-local-font-size: #{map.get($properties, font-size)};
|
117
69
|
}
|
118
70
|
|
119
|
-
@mixin button-color($priority, $color) {
|
120
|
-
@include _get-themeable-properties($priority, $color, default);
|
121
|
-
|
122
|
-
&:disabled {
|
123
|
-
@include _get-themeable-properties($priority, $color, disabled);
|
124
|
-
}
|
125
|
-
|
126
|
-
&:not(:disabled):hover {
|
127
|
-
@include _get-themeable-properties($priority, $color, hover);
|
128
|
-
}
|
129
|
-
|
130
|
-
&:not(:disabled):active {
|
131
|
-
@include _get-themeable-properties($priority, $color, active);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
71
|
@mixin hide-label() {
|
136
72
|
@include _button-square();
|
137
73
|
|
@@ -2,10 +2,10 @@ import PropTypes from 'prop-types';
|
|
2
2
|
import React, {
|
3
3
|
useMemo,
|
4
4
|
} from 'react';
|
5
|
-
import { withGlobalProps } from '../../
|
5
|
+
import { withGlobalProps } from '../../providers/globalProps';
|
6
6
|
import { classNames } from '../../utils/classNames';
|
7
7
|
import { transferProps } from '../../utils/transferProps';
|
8
|
-
import getRootPriorityClassName from '../_helpers/getRootPriorityClassName';
|
8
|
+
import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
|
9
9
|
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
10
10
|
import styles from './ButtonGroup.module.scss';
|
11
11
|
import { ButtonGroupContext } from './ButtonGroupContext';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import { withGlobalProps } from '../../
|
3
|
+
import { withGlobalProps } from '../../providers/globalProps';
|
4
4
|
import { classNames } from '../../utils/classNames';
|
5
5
|
import { transferProps } from '../../utils/transferProps';
|
6
6
|
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
@@ -44,7 +44,8 @@ Card.propTypes = {
|
|
44
44
|
*/
|
45
45
|
children: PropTypes.node.isRequired,
|
46
46
|
/**
|
47
|
-
*
|
47
|
+
* Color to clarify importance and meaning of the card. Implements
|
48
|
+
* [Feedback and Neutral color collections](/docs/foundation/collections#colors).
|
48
49
|
*/
|
49
50
|
color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
|
50
51
|
/**
|
@@ -1,7 +1,8 @@
|
|
1
1
|
// 1. Retain equal card widths in flex and grid layouts independently on their content.
|
2
2
|
|
3
|
+
@use "../../styles/tools/collections";
|
4
|
+
@use "settings";
|
3
5
|
@use "theme";
|
4
|
-
@use "tools";
|
5
6
|
|
6
7
|
@layer components.card {
|
7
8
|
.root {
|
@@ -33,40 +34,19 @@
|
|
33
34
|
box-shadow: theme.$raised-box-shadow;
|
34
35
|
}
|
35
36
|
|
36
|
-
.isRootColorSuccess {
|
37
|
-
@include tools.color(success);
|
38
|
-
}
|
39
|
-
|
40
|
-
.isRootColorWarning {
|
41
|
-
@include tools.color(warning);
|
42
|
-
}
|
43
|
-
|
44
|
-
.isRootColorDanger {
|
45
|
-
@include tools.color(danger);
|
46
|
-
}
|
47
|
-
|
48
|
-
.isRootColorHelp {
|
49
|
-
@include tools.color(help);
|
50
|
-
}
|
51
|
-
|
52
|
-
.isRootColorInfo {
|
53
|
-
@include tools.color(info);
|
54
|
-
}
|
55
|
-
|
56
|
-
.isRootColorNote {
|
57
|
-
@include tools.color(note);
|
58
|
-
}
|
59
|
-
|
60
|
-
.isRootColorLight {
|
61
|
-
@include tools.color(light);
|
62
|
-
}
|
63
|
-
|
64
|
-
.isRootColorDark {
|
65
|
-
@include tools.color(dark);
|
66
|
-
}
|
67
|
-
|
68
37
|
.isRootDisabled {
|
69
38
|
background-color: theme.$disabled-background-color;
|
70
39
|
opacity: theme.$disabled-opacity;
|
71
40
|
}
|
41
|
+
|
42
|
+
@each $color in settings.$colors {
|
43
|
+
@include collections.generate-class(
|
44
|
+
$prefix: "rui-",
|
45
|
+
$component-name: "Card",
|
46
|
+
$variant-name: "color",
|
47
|
+
$variant-value: $color,
|
48
|
+
$inherit-link-color: true,
|
49
|
+
$properties: settings.$themeable-properties,
|
50
|
+
);
|
51
|
+
}
|
72
52
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import { withGlobalProps } from '../../
|
3
|
+
import { withGlobalProps } from '../../providers/globalProps';
|
4
4
|
import { transferProps } from '../../utils/transferProps';
|
5
5
|
import styles from './Card.module.scss';
|
6
6
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
|
-
import { withGlobalProps } from '../../provider';
|
4
3
|
import { transferProps } from '../../utils/transferProps';
|
4
|
+
import { withGlobalProps } from '../../providers/globalProps';
|
5
5
|
import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
|
6
6
|
import styles from './Card.module.scss';
|
7
7
|
|
@@ -147,14 +147,15 @@ for card content.
|
|
147
147
|
|
148
148
|
## Color Variants
|
149
149
|
|
150
|
-
Card
|
151
|
-
[
|
152
|
-
of your app.
|
150
|
+
To cover all possible needs of your project, Card is available in colors from
|
151
|
+
[Feedback and Neutral color collections](/docs/foundation/collections#colors).
|
153
152
|
|
154
153
|
```docoff-react-preview
|
155
154
|
<Card color="success">
|
156
155
|
<CardBody>
|
157
156
|
Hello! I'm success variant of card.
|
157
|
+
{' '}
|
158
|
+
<TextLink href="/" label="This is a link" />
|
158
159
|
</CardBody>
|
159
160
|
<CardFooter>
|
160
161
|
<Button label="Read more" priority="outline" color="success" />
|
@@ -163,6 +164,8 @@ of your app.
|
|
163
164
|
<Card color="warning">
|
164
165
|
<CardBody>
|
165
166
|
Hello! I'm warning variant of card.
|
167
|
+
{' '}
|
168
|
+
<TextLink href="/" label="This is a link" />
|
166
169
|
</CardBody>
|
167
170
|
<CardFooter>
|
168
171
|
<Button label="Read more" priority="outline" color="warning" />
|
@@ -171,6 +174,8 @@ of your app.
|
|
171
174
|
<Card color="danger">
|
172
175
|
<CardBody>
|
173
176
|
Hello! I'm danger variant of card.
|
177
|
+
{' '}
|
178
|
+
<TextLink href="/" label="This is a link" />
|
174
179
|
</CardBody>
|
175
180
|
<CardFooter>
|
176
181
|
<Button label="Read more" priority="outline" color="danger" />
|
@@ -179,6 +184,8 @@ of your app.
|
|
179
184
|
<Card color="help">
|
180
185
|
<CardBody>
|
181
186
|
Hello! I'm help variant of card.
|
187
|
+
{' '}
|
188
|
+
<TextLink href="/" label="This is a link" />
|
182
189
|
</CardBody>
|
183
190
|
<CardFooter>
|
184
191
|
<Button label="Read more" priority="outline" color="help" />
|
@@ -187,6 +194,8 @@ of your app.
|
|
187
194
|
<Card color="info">
|
188
195
|
<CardBody>
|
189
196
|
Hello! I'm info variant of card.
|
197
|
+
{' '}
|
198
|
+
<TextLink href="/" label="This is a link" />
|
190
199
|
</CardBody>
|
191
200
|
<CardFooter>
|
192
201
|
<Button label="Read more" priority="outline" color="info" />
|
@@ -195,6 +204,8 @@ of your app.
|
|
195
204
|
<Card color="note">
|
196
205
|
<CardBody>
|
197
206
|
Hello! I'm note variant of card.
|
207
|
+
{' '}
|
208
|
+
<TextLink href="/" label="This is a link" />
|
198
209
|
</CardBody>
|
199
210
|
<CardFooter>
|
200
211
|
<Button label="Read more" priority="outline" color="note" />
|
@@ -203,6 +214,8 @@ of your app.
|
|
203
214
|
<Card>
|
204
215
|
<CardBody>
|
205
216
|
Hello! I'm light (default) variant of card.
|
217
|
+
{' '}
|
218
|
+
<TextLink href="/" label="This is a link" />
|
206
219
|
</CardBody>
|
207
220
|
<CardFooter>
|
208
221
|
<Button label="Read more" priority="outline" color="dark" />
|
@@ -211,6 +224,8 @@ of your app.
|
|
211
224
|
<Card color="dark">
|
212
225
|
<CardBody>
|
213
226
|
Hello! I'm dark variant of card.
|
227
|
+
{' '}
|
228
|
+
<TextLink href="/" label="This is a link" />
|
214
229
|
</CardBody>
|
215
230
|
<CardFooter>
|
216
231
|
<Button label="Read more" priority="outline" color="light" />
|
@@ -229,6 +244,8 @@ its interactive elements to disallow user's interaction.
|
|
229
244
|
<Card disabled>
|
230
245
|
<CardBody>
|
231
246
|
Hello! I'm a disabled card.
|
247
|
+
{' '}
|
248
|
+
<TextLink href="/" label="This is a link" />
|
232
249
|
</CardBody>
|
233
250
|
<CardFooter>
|
234
251
|
<Button label="Read more" priority="outline" disabled />
|
@@ -237,6 +254,8 @@ its interactive elements to disallow user's interaction.
|
|
237
254
|
<Card disabled raised>
|
238
255
|
<CardBody>
|
239
256
|
Hello! I'm a disabled raised card.
|
257
|
+
{' '}
|
258
|
+
<TextLink href="/" label="This is a link" />
|
240
259
|
</CardBody>
|
241
260
|
<CardFooter>
|
242
261
|
<Button label="Read more" priority="outline" disabled />
|
@@ -245,6 +264,8 @@ its interactive elements to disallow user's interaction.
|
|
245
264
|
<Card color="success" disabled>
|
246
265
|
<CardBody>
|
247
266
|
Hello! I'm a disabled success variant of card.
|
267
|
+
{' '}
|
268
|
+
<TextLink href="/" label="This is a link" />
|
248
269
|
</CardBody>
|
249
270
|
<CardFooter>
|
250
271
|
<Button label="Read more" priority="outline" color="success" disabled />
|
@@ -307,9 +328,10 @@ looks as follows:
|
|
307
328
|
|
308
329
|
Where:
|
309
330
|
|
310
|
-
- `<COLOR>` is
|
311
|
-
[
|
312
|
-
(
|
331
|
+
- `<COLOR>` is a value from supported
|
332
|
+
[color collections](/docs/foundation/collections#colors)
|
333
|
+
(check [color variants](#color-variants) and [API](#api) to see which
|
334
|
+
collections are supported),
|
313
335
|
- `<PROPERTY>` is one of `color` (color of text), `border-color`, or
|
314
336
|
`background-color`.
|
315
337
|
|
@@ -7,46 +7,3 @@ $raised-box-shadow: var(--rui-Card--raised__box-shadow);
|
|
7
7
|
|
8
8
|
$disabled-background-color: var(--rui-Card--disabled__background-color);
|
9
9
|
$disabled-opacity: var(--rui-Card--disabled__opacity);
|
10
|
-
|
11
|
-
$colors: (
|
12
|
-
success: (
|
13
|
-
color: var(--rui-Card--success__color),
|
14
|
-
border-color: var(--rui-Card--success__border-color),
|
15
|
-
background-color: var(--rui-Card--success__background-color),
|
16
|
-
),
|
17
|
-
warning: (
|
18
|
-
color: var(--rui-Card--warning__color),
|
19
|
-
border-color: var(--rui-Card--warning__border-color),
|
20
|
-
background-color: var(--rui-Card--warning__background-color),
|
21
|
-
),
|
22
|
-
danger: (
|
23
|
-
color: var(--rui-Card--danger__color),
|
24
|
-
border-color: var(--rui-Card--danger__border-color),
|
25
|
-
background-color: var(--rui-Card--danger__background-color),
|
26
|
-
),
|
27
|
-
info: (
|
28
|
-
color: var(--rui-Card--info__color),
|
29
|
-
border-color: var(--rui-Card--info__border-color),
|
30
|
-
background-color: var(--rui-Card--info__background-color),
|
31
|
-
),
|
32
|
-
help: (
|
33
|
-
color: var(--rui-Card--help__color),
|
34
|
-
border-color: var(--rui-Card--help__border-color),
|
35
|
-
background-color: var(--rui-Card--help__background-color),
|
36
|
-
),
|
37
|
-
note: (
|
38
|
-
color: var(--rui-Card--note__color),
|
39
|
-
border-color: var(--rui-Card--note__border-color),
|
40
|
-
background-color: var(--rui-Card--note__background-color),
|
41
|
-
),
|
42
|
-
light: (
|
43
|
-
color: var(--rui-Card--light__color),
|
44
|
-
border-color: var(--rui-Card--light__border-color),
|
45
|
-
background-color: var(--rui-Card--light__background-color),
|
46
|
-
),
|
47
|
-
dark: (
|
48
|
-
color: var(--rui-Card--dark__color),
|
49
|
-
border-color: var(--rui-Card--dark__border-color),
|
50
|
-
background-color: var(--rui-Card--dark__background-color),
|
51
|
-
),
|
52
|
-
);
|