@react-ui-org/react-ui 0.56.0 → 0.57.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/react-ui.css +14 -14
- package/dist/react-ui.development.css +2352 -843
- package/dist/react-ui.development.js +10 -10
- package/dist/react-ui.js +1 -1
- package/package.json +2 -2
- package/src/CNAME +1 -0
- package/src/components/Alert/Alert.jsx +2 -1
- package/src/components/Alert/Alert.module.scss +9 -31
- package/src/components/Alert/README.md +6 -5
- package/src/components/Alert/_settings.scss +5 -0
- package/src/components/Alert/_theme.scss +0 -43
- package/src/components/Badge/Badge.jsx +4 -2
- 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 +3 -2
- 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 +1 -1
- package/src/components/Card/Card.jsx +2 -1
- package/src/components/Card/Card.module.scss +10 -31
- package/src/components/Card/README.md +6 -6
- package/src/components/Card/_settings.scss +5 -0
- package/src/components/Card/_theme.scss +0 -43
- package/src/components/Grid/Grid.module.scss +9 -2
- package/src/components/Popover/Popover.module.scss +16 -16
- package/src/components/Popover/_theme.scss +4 -2
- package/src/components/_helpers/getRootPriorityClassName.js +1 -1
- package/src/styles/settings/_collections.scss +9 -0
- package/src/styles/tools/_collections.scss +191 -0
- package/src/styles/tools/_string.scss +5 -2
- package/src/styles/tools/form-fields/_box-field-layout.scss +7 -1
- package/src/theme.scss +64 -0
- 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
@@ -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
|
|
@@ -5,7 +5,7 @@ import React, {
|
|
5
5
|
import { withGlobalProps } from '../../provider';
|
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';
|
@@ -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,36 +34,14 @@
|
|
33
34
|
box-shadow: theme.$raised-box-shadow;
|
34
35
|
}
|
35
36
|
|
36
|
-
|
37
|
-
@include
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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);
|
37
|
+
@each $color in settings.$colors {
|
38
|
+
@include collections.generate-class(
|
39
|
+
$prefix: "rui-",
|
40
|
+
$component-name: "Card",
|
41
|
+
$variant-name: "color",
|
42
|
+
$variant-value: $color,
|
43
|
+
$properties: settings.$themeable-properties,
|
44
|
+
);
|
66
45
|
}
|
67
46
|
|
68
47
|
.isRootDisabled {
|
@@ -147,9 +147,8 @@ 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">
|
@@ -307,9 +306,10 @@ looks as follows:
|
|
307
306
|
|
308
307
|
Where:
|
309
308
|
|
310
|
-
- `<COLOR>` is
|
311
|
-
[
|
312
|
-
(
|
309
|
+
- `<COLOR>` is a value from supported
|
310
|
+
[color collections](/docs/foundation/collections#colors)
|
311
|
+
(check [color variants](#color-variants) and [API](#api) to see which
|
312
|
+
collections are supported),
|
313
313
|
- `<PROPERTY>` is one of `color` (color of text), `border-color`, or
|
314
314
|
`background-color`.
|
315
315
|
|
@@ -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
|
-
);
|
@@ -19,6 +19,9 @@
|
|
19
19
|
// `--rui-local-<PROPERTY>: var(--rui-local-<PROPERTY>-sm, var(--rui-local-<PROPERTY>-xs, <INITIAL FALLBACK>))`
|
20
20
|
//
|
21
21
|
// 2. Apply custom property value that is defined within current breakpoint, see 1.
|
22
|
+
//
|
23
|
+
// 3. Intentionally use longhand properties because the custom property fallback mechanism evaluates `initial` values as
|
24
|
+
// empty. That makes the other value of the shorthand property unexpectedly used for both axes.
|
22
25
|
|
23
26
|
@use "sass:map";
|
24
27
|
@use "../../styles/tools/spacing";
|
@@ -35,8 +38,12 @@
|
|
35
38
|
grid-template-rows: var(--rui-local-rows); // 2.
|
36
39
|
grid-auto-flow: var(--rui-local-auto-flow); // 2.
|
37
40
|
grid-gap: var(--rui-local-row-gap) var(--rui-local-column-gap); // 2.
|
38
|
-
|
39
|
-
|
41
|
+
// stylelint-disable declaration-block-no-redundant-longhand-properties -- 3.
|
42
|
+
align-content: var(--rui-local-align-content); // 2.
|
43
|
+
align-items: var(--rui-local-align-items); // 2.
|
44
|
+
justify-content: var(--rui-local-justify-content); // 2.
|
45
|
+
justify-items: var(--rui-local-justify-items); // 2.
|
46
|
+
// stylelint-enable declaration-block-no-redundant-longhand-properties
|
40
47
|
}
|
41
48
|
|
42
49
|
// stylelint-disable-next-line selector-max-universal -- Reset any previously added margins.
|
@@ -51,52 +51,52 @@
|
|
51
51
|
|
52
52
|
// Sides
|
53
53
|
.isRootAtTop {
|
54
|
-
bottom: 100
|
54
|
+
bottom: calc(100% + #{theme.$arrow-gap} - #{theme.$arrow-safe-rendering-overlap});
|
55
55
|
}
|
56
56
|
|
57
57
|
.isRootAtBottom {
|
58
|
-
top: 100
|
58
|
+
top: calc(100% + #{theme.$arrow-gap} - #{theme.$arrow-safe-rendering-overlap});
|
59
59
|
}
|
60
60
|
|
61
61
|
.isRootAtLeft {
|
62
|
-
right: 100
|
62
|
+
right: calc(100% + #{theme.$arrow-gap} - #{theme.$arrow-safe-rendering-overlap});
|
63
63
|
}
|
64
64
|
|
65
65
|
.isRootAtRight {
|
66
|
-
left: 100
|
66
|
+
left: calc(100% + #{theme.$arrow-gap} - #{theme.$arrow-safe-rendering-overlap});
|
67
67
|
}
|
68
68
|
|
69
69
|
// Arrows
|
70
70
|
.isRootAtTop > .arrow {
|
71
|
-
top: 100
|
71
|
+
top: calc(100% - #{theme.$arrow-safe-rendering-overlap});
|
72
72
|
}
|
73
73
|
|
74
74
|
.isRootAtBottom > .arrow {
|
75
|
-
bottom: 100
|
75
|
+
bottom: calc(100% - #{theme.$arrow-safe-rendering-overlap});
|
76
76
|
}
|
77
77
|
|
78
78
|
.isRootAtLeft > .arrow {
|
79
|
-
left: 100
|
79
|
+
left: calc(100% - #{theme.$arrow-safe-rendering-overlap});
|
80
80
|
}
|
81
81
|
|
82
82
|
.isRootAtRight > .arrow {
|
83
|
-
right: 100
|
83
|
+
right: calc(100% - #{theme.$arrow-safe-rendering-overlap});
|
84
84
|
}
|
85
85
|
|
86
86
|
// Side alignments: top
|
87
87
|
.isRootAtTop.isRootAtCenter {
|
88
88
|
left: 50%;
|
89
|
-
transform: translate(-50%,
|
89
|
+
transform: translate(-50%, calc(-1 * #{theme.$arrow-height}));
|
90
90
|
}
|
91
91
|
|
92
92
|
.isRootAtTop.isRootAtStart {
|
93
93
|
left: 0;
|
94
|
-
transform: translate(0,
|
94
|
+
transform: translate(0, calc(-1 * #{theme.$arrow-height}));
|
95
95
|
}
|
96
96
|
|
97
97
|
.isRootAtTop.isRootAtEnd {
|
98
98
|
right: 0;
|
99
|
-
transform: translate(0,
|
99
|
+
transform: translate(0, calc(-1 * #{theme.$arrow-height}));
|
100
100
|
}
|
101
101
|
|
102
102
|
.isRootAtTop.isRootAtCenter > .arrow {
|
@@ -148,17 +148,17 @@
|
|
148
148
|
// Side alignments: left
|
149
149
|
.isRootAtLeft.isRootAtCenter {
|
150
150
|
top: 50%;
|
151
|
-
transform: translate(
|
151
|
+
transform: translate(calc(-1 * #{theme.$arrow-height}), -50%);
|
152
152
|
}
|
153
153
|
|
154
154
|
.isRootAtLeft.isRootAtStart {
|
155
155
|
top: 0;
|
156
|
-
transform: translate(
|
156
|
+
transform: translate(calc(-1 * #{theme.$arrow-height}), 0);
|
157
157
|
}
|
158
158
|
|
159
159
|
.isRootAtLeft.isRootAtEnd {
|
160
160
|
bottom: 0;
|
161
|
-
transform: translate(
|
161
|
+
transform: translate(calc(-1 * #{theme.$arrow-height}), 0);
|
162
162
|
}
|
163
163
|
|
164
164
|
.isRootAtLeft.isRootAtCenter > .arrow {
|
@@ -216,7 +216,7 @@
|
|
216
216
|
}
|
217
217
|
|
218
218
|
.isRootControlled.isRootAtTop {
|
219
|
-
transform: translate(0,
|
219
|
+
transform: translate(0, calc(-1 * #{theme.$arrow-height})); // 2.
|
220
220
|
}
|
221
221
|
|
222
222
|
.isRootControlled.isRootAtBottom {
|
@@ -224,7 +224,7 @@
|
|
224
224
|
}
|
225
225
|
|
226
226
|
.isRootControlled.isRootAtLeft {
|
227
|
-
transform: translate(
|
227
|
+
transform: translate(calc(-1 * #{theme.$arrow-height}), 0); // 2.
|
228
228
|
}
|
229
229
|
|
230
230
|
.isRootControlled.isRootAtRight {
|
@@ -11,6 +11,8 @@ $color: var(--rui-Popover__color);
|
|
11
11
|
$background-color: var(--rui-Popover__background-color);
|
12
12
|
$box-shadow: var(--rui-Popover__box-shadow);
|
13
13
|
|
14
|
-
$arrow-
|
15
|
-
$arrow-
|
14
|
+
$arrow-safe-rendering-overlap: 1px;
|
15
|
+
$arrow-gap: 1px;
|
16
|
+
$arrow-width: calc(1rem + #{$arrow-safe-rendering-overlap * 2});
|
17
|
+
$arrow-height: calc($arrow-width / 2); // 1.
|
16
18
|
$arrow-corner-offset: 0.75rem;
|
@@ -0,0 +1,191 @@
|
|
1
|
+
@use "string" as rui-string;
|
2
|
+
|
3
|
+
// Mixin to generate CSS custom properties for a set of visual properties.
|
4
|
+
//
|
5
|
+
// 1. Generates a CSS custom property for each property in the `$properties` list.
|
6
|
+
// 2. Theming of the disabled state is optional, so the `default` theme options are used (via CSS custom property
|
7
|
+
// fallback) if no `disabled` styling for the specific variant is provided by user.
|
8
|
+
//
|
9
|
+
// @param {String} $prefix - The prefix for the CSS custom properties.
|
10
|
+
// @param {String} $component-name - The name of the component.
|
11
|
+
// @param {String} $modifier-value - The value of the modifier.
|
12
|
+
// @param {String} $variant-value - The value of the variant.
|
13
|
+
// @param {String} $interaction-state - The interaction state.
|
14
|
+
// @param {List} $properties - The list of properties to generate CSS custom properties for.
|
15
|
+
//
|
16
|
+
// Example:
|
17
|
+
//
|
18
|
+
// @include generate-properties(
|
19
|
+
// $prefix: "rui-",
|
20
|
+
// $component-name: "Card",
|
21
|
+
// $variant-name: "color",
|
22
|
+
// $variant-value: "success",
|
23
|
+
// $properties: color, border-color, background-color,
|
24
|
+
// );
|
25
|
+
//
|
26
|
+
// … will output:
|
27
|
+
//
|
28
|
+
// --rui-local-color: var(--rui-Card--success__color);
|
29
|
+
// --rui-local-border-color: var(--rui-Card--success__border-color);
|
30
|
+
// --rui-local-background-color: var(--rui-Card--success__background-color);
|
31
|
+
|
32
|
+
@mixin generate-properties(
|
33
|
+
$prefix,
|
34
|
+
$component-name,
|
35
|
+
$modifier-value: null,
|
36
|
+
$variant-value,
|
37
|
+
$interaction-state: null,
|
38
|
+
$properties,
|
39
|
+
) {
|
40
|
+
@each $property in $properties {
|
41
|
+
$modifier: if($modifier-value, "--" + $modifier-value, "");
|
42
|
+
$state: if($interaction-state, "--" + $interaction-state, "");
|
43
|
+
|
44
|
+
// 1.
|
45
|
+
--#{$prefix}local-#{$property}:
|
46
|
+
var(
|
47
|
+
#{
|
48
|
+
"--"
|
49
|
+
+ $prefix
|
50
|
+
+ $component-name
|
51
|
+
+ $modifier
|
52
|
+
+ "--"
|
53
|
+
+ $variant-value
|
54
|
+
+ $state
|
55
|
+
+ "__"
|
56
|
+
+ $property
|
57
|
+
}
|
58
|
+
#{if(
|
59
|
+
$interaction-state and $interaction-state == "disabled",
|
60
|
+
", var(--"
|
61
|
+
+ $prefix
|
62
|
+
+ $component-name
|
63
|
+
+ $modifier
|
64
|
+
+ "--"
|
65
|
+
+ $variant-value
|
66
|
+
+ "--default__"
|
67
|
+
+ $property
|
68
|
+
+ ")",
|
69
|
+
""
|
70
|
+
)}
|
71
|
+
); // 2.
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
// Mixin to generate CSS classes for a component variant.
|
76
|
+
//
|
77
|
+
// @param {String} $prefix - The prefix for the CSS custom properties.
|
78
|
+
// @param {String} $component-name - The name of the component.
|
79
|
+
// @param {String} $modifier-name - Optional name of the class name modifier.
|
80
|
+
// @param {String} $modifier-name - Optional value of the class name modifier.
|
81
|
+
// @param {String} $variant-name - The name of the variant.
|
82
|
+
// @param {String} $variant-value - The value of the variant.
|
83
|
+
// @param {Boolean} $generate-interaction-states - Whether to generate interaction states (disabled, hover, active).
|
84
|
+
// @param {List} $properties - The list of properties to generate CSS custom properties for.
|
85
|
+
//
|
86
|
+
// Examples:
|
87
|
+
//
|
88
|
+
// @include collections.generate-class(
|
89
|
+
// $prefix: "rui-",
|
90
|
+
// $component-name: "Card",
|
91
|
+
// $variant-name: "color",
|
92
|
+
// $variant-value: "success",
|
93
|
+
// $properties: color, border-color, background-color,
|
94
|
+
// );
|
95
|
+
//
|
96
|
+
// … will output:
|
97
|
+
//
|
98
|
+
// .isRootColorSuccess {
|
99
|
+
// --rui-local-color: var(--rui-Card--success__color);
|
100
|
+
// --rui-local-border-color: var(--rui-Card--success__border-color);
|
101
|
+
// --rui-local-background-color: var(--rui-Card--success__background-color);
|
102
|
+
// }
|
103
|
+
//
|
104
|
+
// @include collections.generate-class(
|
105
|
+
// $prefix: "rui-",
|
106
|
+
// $component-name: "Button",
|
107
|
+
// $modifier-name: "priority",
|
108
|
+
// $modifier-value: "flat",
|
109
|
+
// $variant-name: "color",
|
110
|
+
// $variant-value: "success",
|
111
|
+
// $generate-interaction-states: true,
|
112
|
+
// $properties: color, background,
|
113
|
+
// );
|
114
|
+
//
|
115
|
+
// … will output:
|
116
|
+
//
|
117
|
+
// .isRootPriorityFlat.isRootColorSuccess {
|
118
|
+
// --rui-local-color: var(--rui-Button--flat--success--default__color);
|
119
|
+
// --rui-local-background: var(--rui-Button--flat--success--default__background);
|
120
|
+
// }
|
121
|
+
// .isRootPriorityFlat.isRootColorSuccess:disabled {
|
122
|
+
// --rui-local-color:
|
123
|
+
// var(
|
124
|
+
// --rui-Button--flat--success--disabled__color,
|
125
|
+
// var(--rui-Button--flat--success--default__color)
|
126
|
+
// );
|
127
|
+
// --rui-local-background:
|
128
|
+
// var(
|
129
|
+
// --rui-Button--flat--success--disabled__background,
|
130
|
+
// var(--rui-Button--flat--success--default__background)
|
131
|
+
// );
|
132
|
+
// }
|
133
|
+
// .isRootPriorityFlat.isRootColorSuccess:not(:disabled):hover {
|
134
|
+
// --rui-local-color: var(--rui-Button--flat--success--hover__color);
|
135
|
+
// --rui-local-background: var(--rui-Button--flat--success--hover__background);
|
136
|
+
// }
|
137
|
+
// .isRootPriorityFlat.isRootColorSuccess:not(:disabled):active {
|
138
|
+
// --rui-local-color: var(--rui-Button--flat--success--active__color);
|
139
|
+
// --rui-local-background: var(--rui-Button--flat--success--active__background);
|
140
|
+
// }
|
141
|
+
|
142
|
+
@mixin generate-class(
|
143
|
+
$prefix,
|
144
|
+
$component-name,
|
145
|
+
$modifier-name: null,
|
146
|
+
$modifier-value: null,
|
147
|
+
$variant-name,
|
148
|
+
$variant-value,
|
149
|
+
$generate-interaction-states: false,
|
150
|
+
$properties,
|
151
|
+
) {
|
152
|
+
$modifier-class-name:
|
153
|
+
if(
|
154
|
+
$modifier-name and $modifier-value,
|
155
|
+
".isRoot#{rui-string.capitalize($modifier-name)}#{rui-string.capitalize($modifier-value)}",
|
156
|
+
""
|
157
|
+
);
|
158
|
+
$variant-class-name: ".isRoot#{rui-string.capitalize($variant-name)}#{rui-string.capitalize($variant-value)}";
|
159
|
+
|
160
|
+
#{$modifier-class-name}#{$variant-class-name} {
|
161
|
+
@if $generate-interaction-states {
|
162
|
+
$interaction-state-selector-map: (
|
163
|
+
default: "&",
|
164
|
+
disabled: "&:disabled",
|
165
|
+
hover: "&:not(:disabled):hover",
|
166
|
+
active: "&:not(:disabled):active",
|
167
|
+
);
|
168
|
+
|
169
|
+
@each $interaction-state, $interaction-state-selector in $interaction-state-selector-map {
|
170
|
+
#{$interaction-state-selector} {
|
171
|
+
@include generate-properties(
|
172
|
+
$prefix: $prefix,
|
173
|
+
$component-name: $component-name,
|
174
|
+
$modifier-value: $modifier-value,
|
175
|
+
$variant-value: $variant-value,
|
176
|
+
$interaction-state: $interaction-state,
|
177
|
+
$properties: $properties,
|
178
|
+
);
|
179
|
+
}
|
180
|
+
}
|
181
|
+
} @else {
|
182
|
+
@include generate-properties(
|
183
|
+
$prefix: $prefix,
|
184
|
+
$component-name: $component-name,
|
185
|
+
$modifier-value: $modifier-value,
|
186
|
+
$variant-value: $variant-value,
|
187
|
+
$properties: $properties,
|
188
|
+
);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
}
|
@@ -1,7 +1,10 @@
|
|
1
|
-
// Author: Hugo Giraudel
|
2
|
-
|
3
1
|
@use "sass:string";
|
4
2
|
|
3
|
+
@function capitalize($string) {
|
4
|
+
@return string.to-upper-case(string.slice($string, 1, 1)) + string.slice($string, 2);
|
5
|
+
}
|
6
|
+
|
7
|
+
// Author: Hugo Giraudel
|
5
8
|
@function replace($string, $search, $replace: "") {
|
6
9
|
$index: string.index($string, $search);
|
7
10
|
|
@@ -55,6 +55,9 @@
|
|
55
55
|
//
|
56
56
|
// 13. Label and field are vertically aligned to top (start) by default (see 10.). Vertical
|
57
57
|
// alignment of each block can be changed by theme configuration.
|
58
|
+
//
|
59
|
+
// 14. Intentionally use longhand properties because the custom property fallback mechanism evaluates `initial` values
|
60
|
+
// as empty. That makes the other value of the shorthand property unexpectedly used for both axes.
|
58
61
|
|
59
62
|
@use "../../settings/forms";
|
60
63
|
@use "../../settings/form-fields" as settings;
|
@@ -125,7 +128,10 @@
|
|
125
128
|
|
126
129
|
.field {
|
127
130
|
grid-area: field;
|
128
|
-
|
131
|
+
// stylelint-disable declaration-block-no-redundant-longhand-properties -- 14.
|
132
|
+
align-self: theme.$horizontal-field-vertical-alignment; // 13.
|
133
|
+
justify-self: start; // 7.
|
134
|
+
// stylelint-enable declaration-block-no-redundant-longhand-properties
|
129
135
|
}
|
130
136
|
}
|
131
137
|
}
|