@react-ui-org/react-ui 0.65.0 → 0.66.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 +10 -10
- package/dist/react-ui.d.ts +35 -27
- package/dist/react-ui.development.css +732 -145
- package/dist/react-ui.development.js +34 -34
- package/dist/react-ui.js +1 -1
- package/package.json +2 -2
- package/src/components/Button/helpers/getRootLabelVisibilityClassName.ts +1 -1
- package/src/components/CheckboxField/CheckboxField.module.scss +7 -3
- package/src/components/CheckboxField/CheckboxField.tsx +3 -3
- package/src/components/CheckboxField/CheckboxField.types.ts +4 -3
- package/src/components/CheckboxField/README.md +25 -3
- package/src/components/FileInputField/FileInputField.module.scss +7 -3
- package/src/components/FileInputField/FileInputField.tsx +3 -3
- package/src/components/FileInputField/FileInputField.types.ts +4 -3
- package/src/components/FileInputField/README.md +20 -3
- package/src/components/FormLayout/FormLayout.module.scss +4 -6
- package/src/components/FormLayout/FormLayoutCustomField.module.scss +7 -3
- package/src/components/FormLayout/FormLayoutCustomField.tsx +3 -3
- package/src/components/FormLayout/FormLayoutCustomField.types.ts +4 -3
- package/src/components/FormLayout/README.md +2 -9
- package/src/components/Grid/_helpers/generateResponsiveCustomProperties.ts +1 -0
- package/src/components/InputGroup/InputGroup.module.scss +7 -3
- package/src/components/InputGroup/InputGroup.tsx +8 -14
- package/src/components/InputGroup/README.md +35 -7
- package/src/components/Modal/_helpers/getPositionClassName.ts +1 -1
- package/src/components/Modal/_helpers/getScrollingClassName.ts +1 -1
- package/src/components/Radio/README.md +40 -3
- package/src/components/Radio/Radio.module.scss +7 -3
- package/src/components/Radio/Radio.tsx +3 -3
- package/src/components/Radio/Radio.types.ts +4 -3
- package/src/components/SelectField/README.md +53 -6
- package/src/components/SelectField/SelectField.module.scss +7 -3
- package/src/components/SelectField/SelectField.tsx +3 -3
- package/src/components/SelectField/SelectField.types.ts +4 -3
- package/src/components/Text/_helpers/getRootClampClassName.ts +1 -1
- package/src/components/Text/_helpers/getRootHyphensClassName.ts +1 -1
- package/src/components/Text/_helpers/getRootWordWrappingClassName.ts +1 -1
- package/src/components/TextArea/README.md +30 -6
- package/src/components/TextArea/TextArea.module.scss +7 -3
- package/src/components/TextArea/TextArea.tsx +3 -3
- package/src/components/TextArea/TextArea.types.ts +4 -3
- package/src/components/TextField/README.md +30 -6
- package/src/components/TextField/TextField.module.scss +7 -3
- package/src/components/TextField/TextField.tsx +3 -3
- package/src/components/TextField/TextField.types.ts +6 -5
- package/src/components/TextLink/README.md +1 -1
- package/src/components/Toggle/README.md +25 -3
- package/src/components/Toggle/Toggle.module.scss +7 -3
- package/src/components/Toggle/Toggle.tsx +3 -3
- package/src/components/Toggle/Toggle.types.ts +4 -3
- package/src/components/_helpers/getRootColorClassName.ts +1 -1
- package/src/components/_helpers/getRootPriorityClassName.ts +1 -1
- package/src/components/_helpers/getRootSizeClassName.ts +1 -1
- package/src/components/_helpers/getRootStateClassName.ts +24 -0
- package/src/index.ts +1 -1
- package/src/styles/settings/_form-fields.scss +2 -1
- package/src/styles/theme/_form-fields.scss +16 -11
- package/src/styles/theme-constants/_colors.scss +21 -0
- package/src/styles/tools/form-fields/_box-field-layout.scss +5 -8
- package/src/styles/tools/form-fields/_inline-field-elements.scss +0 -7
- package/src/styles/tools/form-fields/_inline-field-layout.scss +0 -8
- package/src/styles/tools/form-fields/_variants.scss +7 -7
- package/src/theme.scss +37 -12
- package/src/types/index.ts +1 -1
- package/src/types/states.ts +1 -0
- package/src/components/_helpers/getRootValidationStateClassName.ts +0 -20
- package/src/types/validationStates.ts +0 -1
|
@@ -131,13 +131,13 @@ React.createElement(() => {
|
|
|
131
131
|
checked={studioQuality}
|
|
132
132
|
label="Listen in studio quality"
|
|
133
133
|
onChange={() => setStudioQuality(!studioQuality)}
|
|
134
|
-
|
|
134
|
+
state="valid"
|
|
135
135
|
/>
|
|
136
136
|
<Toggle
|
|
137
137
|
checked={studioQuality}
|
|
138
138
|
label="Listen in studio quality"
|
|
139
139
|
onChange={() => setStudioQuality(!studioQuality)}
|
|
140
|
-
|
|
140
|
+
state="warning"
|
|
141
141
|
validationText={
|
|
142
142
|
'Looks like you are connected over cellular network. '
|
|
143
143
|
+ 'Please make sure you know what you are doing.'
|
|
@@ -147,7 +147,7 @@ React.createElement(() => {
|
|
|
147
147
|
checked={studioQuality}
|
|
148
148
|
label="Listen in studio quality"
|
|
149
149
|
onChange={() => setStudioQuality(!studioQuality)}
|
|
150
|
-
|
|
150
|
+
state="invalid"
|
|
151
151
|
validationText={(
|
|
152
152
|
<>
|
|
153
153
|
Please
|
|
@@ -163,6 +163,28 @@ React.createElement(() => {
|
|
|
163
163
|
});
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
+
### Changed State
|
|
167
|
+
|
|
168
|
+
Changed state highlights fields whose value differs from the saved one, so users
|
|
169
|
+
can review their edits before saving.
|
|
170
|
+
|
|
171
|
+
A field shows one state at a time. When a changed value is also invalid, it's
|
|
172
|
+
up to you to pick the state that matters more to the user.
|
|
173
|
+
|
|
174
|
+
```docoff-react-preview
|
|
175
|
+
React.createElement(() => {
|
|
176
|
+
const [studioQuality, setStudioQuality] = React.useState(true);
|
|
177
|
+
return (
|
|
178
|
+
<Toggle
|
|
179
|
+
checked={studioQuality}
|
|
180
|
+
label="Listen in studio quality"
|
|
181
|
+
onChange={() => setStudioQuality(!studioQuality)}
|
|
182
|
+
state="changed"
|
|
183
|
+
/>
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
166
188
|
### Required State
|
|
167
189
|
|
|
168
190
|
The required state indicates that the input is mandatory.
|
|
@@ -35,16 +35,20 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// States
|
|
38
|
+
.isRootStateChanged {
|
|
39
|
+
@include variants.state(changed);
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
.isRootStateInvalid {
|
|
39
|
-
@include variants.
|
|
43
|
+
@include variants.state(invalid);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
.isRootStateValid {
|
|
43
|
-
@include variants.
|
|
47
|
+
@include variants.state(valid);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
.isRootStateWarning {
|
|
47
|
-
@include variants.
|
|
51
|
+
@include variants.state(warning);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
// Invisible label
|
|
@@ -2,7 +2,7 @@ import React, { useContext } from 'react';
|
|
|
2
2
|
import { withGlobalProps } from '../../providers/globalProps';
|
|
3
3
|
import { classNames } from '../../helpers/classNames/classNames';
|
|
4
4
|
import { transferProps } from '../../helpers/transferProps';
|
|
5
|
-
import {
|
|
5
|
+
import { getRootStateClassName } from '../_helpers/getRootStateClassName';
|
|
6
6
|
import { FormLayoutContext } from '../FormLayout/FormLayoutContext';
|
|
7
7
|
import styles from './Toggle.module.scss';
|
|
8
8
|
import type { ToggleProps } from './Toggle.types';
|
|
@@ -16,7 +16,7 @@ export const Toggle = React.forwardRef<HTMLInputElement, ToggleProps>(({
|
|
|
16
16
|
labelPosition = 'after',
|
|
17
17
|
renderAsRequired = false,
|
|
18
18
|
required = false,
|
|
19
|
-
|
|
19
|
+
state,
|
|
20
20
|
validationText,
|
|
21
21
|
...restProps
|
|
22
22
|
}, ref) => {
|
|
@@ -31,7 +31,7 @@ export const Toggle = React.forwardRef<HTMLInputElement, ToggleProps>(({
|
|
|
31
31
|
labelPosition === 'before' && styles.hasRootLabelBefore,
|
|
32
32
|
disabled && styles.isRootDisabled,
|
|
33
33
|
(required || renderAsRequired) && styles.isRootRequired,
|
|
34
|
-
|
|
34
|
+
getRootStateClassName(styles, state),
|
|
35
35
|
)}
|
|
36
36
|
htmlFor={id}
|
|
37
37
|
id={id && `${id}__label`}
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
} from 'react';
|
|
5
5
|
import type {
|
|
6
6
|
LabelPosition,
|
|
7
|
-
|
|
7
|
+
State,
|
|
8
8
|
} from '../../types';
|
|
9
9
|
|
|
10
10
|
export type ToggleLabelPosition = LabelPosition;
|
|
@@ -48,9 +48,10 @@ export type ToggleProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> &
|
|
|
48
48
|
*/
|
|
49
49
|
required?: boolean;
|
|
50
50
|
/**
|
|
51
|
-
* Alter the field to
|
|
51
|
+
* Alter the field to reflect the state of its data, e.g. a validation result or a change
|
|
52
|
+
* against the saved value.
|
|
52
53
|
*/
|
|
53
|
-
|
|
54
|
+
state?: State;
|
|
54
55
|
/**
|
|
55
56
|
* Validation message to be displayed.
|
|
56
57
|
*/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CssModuleClasses,
|
|
3
|
+
State,
|
|
4
|
+
} from '../../types';
|
|
5
|
+
|
|
6
|
+
export const getRootStateClassName = (styles: CssModuleClasses, state?: State) => {
|
|
7
|
+
if (state === 'changed') {
|
|
8
|
+
return styles.isRootStateChanged;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (state === 'invalid') {
|
|
12
|
+
return styles.isRootStateInvalid;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (state === 'valid') {
|
|
16
|
+
return styles.isRootStateValid;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (state === 'warning') {
|
|
20
|
+
return styles.isRootStateWarning;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return undefined;
|
|
24
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -34,7 +34,8 @@ $themeable-variant-states: (
|
|
|
34
34
|
custom: (
|
|
35
35
|
default: (default, disabled),
|
|
36
36
|
),
|
|
37
|
-
|
|
37
|
+
state: (
|
|
38
|
+
changed: (default, checked, disabled, checked-disabled),
|
|
38
39
|
invalid: (default, checked, disabled, checked-disabled),
|
|
39
40
|
valid: (default, checked, disabled, checked-disabled),
|
|
40
41
|
warning: (default, checked, disabled, checked-disabled),
|
|
@@ -30,22 +30,27 @@ $horizontal-label-vertical-alignment: var(--rui-FormField--horizontal__label__ve
|
|
|
30
30
|
$horizontal-field-vertical-alignment: var(--rui-FormField--horizontal__field__vertical-alignment);
|
|
31
31
|
$horizontal-full-width-label-width: var(--rui-FormField--horizontal--full-width__label__width);
|
|
32
32
|
|
|
33
|
-
// Form fields: links in
|
|
34
|
-
$link-
|
|
33
|
+
// Form fields: links in states
|
|
34
|
+
$link-state-colors: (
|
|
35
|
+
changed: (
|
|
36
|
+
default: var(--rui-color-state-changed),
|
|
37
|
+
hover: var(--rui-color-state-changed-hover),
|
|
38
|
+
active: var(--rui-color-state-changed-active),
|
|
39
|
+
),
|
|
35
40
|
invalid: (
|
|
36
|
-
default: var(--rui-color-
|
|
37
|
-
hover: var(--rui-color-
|
|
38
|
-
active: var(--rui-color-
|
|
41
|
+
default: var(--rui-color-state-invalid),
|
|
42
|
+
hover: var(--rui-color-state-invalid-hover),
|
|
43
|
+
active: var(--rui-color-state-invalid-active),
|
|
39
44
|
),
|
|
40
45
|
valid: (
|
|
41
|
-
default: var(--rui-color-
|
|
42
|
-
hover: var(--rui-color-
|
|
43
|
-
active: var(--rui-color-
|
|
46
|
+
default: var(--rui-color-state-valid),
|
|
47
|
+
hover: var(--rui-color-state-valid-hover),
|
|
48
|
+
active: var(--rui-color-state-valid-active),
|
|
44
49
|
),
|
|
45
50
|
warning: (
|
|
46
|
-
default: var(--rui-color-
|
|
47
|
-
hover: var(--rui-color-
|
|
48
|
-
active: var(--rui-color-
|
|
51
|
+
default: var(--rui-color-state-warning),
|
|
52
|
+
hover: var(--rui-color-state-warning-hover),
|
|
53
|
+
active: var(--rui-color-state-warning-active),
|
|
49
54
|
),
|
|
50
55
|
);
|
|
51
56
|
|
|
@@ -34,6 +34,11 @@ $help: #6610f2;
|
|
|
34
34
|
$info: #17a2b8;
|
|
35
35
|
$note: #007bff;
|
|
36
36
|
|
|
37
|
+
$state-valid: #2f9e44;
|
|
38
|
+
$state-invalid: #e03131;
|
|
39
|
+
$state-warning: #f59f00;
|
|
40
|
+
$state-changed: #b5179e;
|
|
41
|
+
|
|
37
42
|
$white: #fff;
|
|
38
43
|
$black: #000;
|
|
39
44
|
|
|
@@ -81,3 +86,19 @@ $note-light: colors.lighten-color($note, $_amount-light);
|
|
|
81
86
|
$note-dark: colors.darken-color($note, $_amount-dark);
|
|
82
87
|
$note-darker: colors.darken-color($note, $_amount-darker);
|
|
83
88
|
$on-note: $white;
|
|
89
|
+
|
|
90
|
+
$state-valid-light: colors.lighten-color($state-valid, $_amount-light);
|
|
91
|
+
$state-valid-dark: colors.darken-color($state-valid, $_amount-dark);
|
|
92
|
+
$state-valid-darker: colors.darken-color($state-valid, $_amount-darker);
|
|
93
|
+
|
|
94
|
+
$state-invalid-light: colors.lighten-color($state-invalid, $_amount-light);
|
|
95
|
+
$state-invalid-dark: colors.darken-color($state-invalid, $_amount-dark);
|
|
96
|
+
$state-invalid-darker: colors.darken-color($state-invalid, $_amount-darker);
|
|
97
|
+
|
|
98
|
+
$state-warning-light: colors.lighten-color($state-warning, $_amount-light);
|
|
99
|
+
$state-warning-dark: colors.darken-color($state-warning, $_amount-dark);
|
|
100
|
+
$state-warning-darker: colors.darken-color($state-warning, $_amount-darker);
|
|
101
|
+
|
|
102
|
+
$state-changed-light: colors.lighten-color($state-changed, $_amount-light);
|
|
103
|
+
$state-changed-dark: colors.darken-color($state-changed, $_amount-dark);
|
|
104
|
+
$state-changed-darker: colors.darken-color($state-changed, $_amount-darker);
|
|
@@ -26,12 +26,13 @@
|
|
|
26
26
|
// Reverted for full-width fields.
|
|
27
27
|
//
|
|
28
28
|
// 8. Grid settings are inherited from horizontal FormLayout and applied using `subgrid`.
|
|
29
|
-
// A fallback is supplied to browsers that don't support `subgrid` yet.
|
|
30
29
|
//
|
|
31
|
-
//
|
|
32
|
-
//
|
|
30
|
+
// `<fieldset>` cannot be a subgrid: the HTML spec wraps its content in an anonymous box which
|
|
31
|
+
// breaks it, and Chrome doesn't support it at all. This is why `<fieldset>` uses
|
|
32
|
+
// `display: contents` instead.
|
|
33
33
|
//
|
|
34
|
-
// https://
|
|
34
|
+
// https://issues.chromium.org/issues/40278914
|
|
35
|
+
// https://github.com/whatwg/html/issues/11546
|
|
35
36
|
// https://github.com/react-ui-org/react-ui/issues/232
|
|
36
37
|
//
|
|
37
38
|
// 9. Help texts and validation messages can take up full width of FormLayout. There is no reason
|
|
@@ -213,10 +214,6 @@
|
|
|
213
214
|
grid: inherit;
|
|
214
215
|
grid-template-columns: subgrid;
|
|
215
216
|
grid-column: span 2;
|
|
216
|
-
|
|
217
|
-
@supports not (grid-template-columns: subgrid) {
|
|
218
|
-
display: contents;
|
|
219
|
-
}
|
|
220
217
|
}
|
|
221
218
|
|
|
222
219
|
&.isRootLayoutHorizontal.isRootFullWidth {
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
//
|
|
7
7
|
// 3. Reset extra space previously added to symmetrically pad the field in FormLayout context as
|
|
8
8
|
// there already is a sufficient row gap provided by FormLayout.
|
|
9
|
-
//
|
|
10
|
-
// 4. Destroy tap target when subgrid is not supported.
|
|
11
9
|
|
|
12
10
|
@use "../../theme/typography";
|
|
13
11
|
@use "../../theme/form-fields" as theme;
|
|
@@ -101,11 +99,6 @@
|
|
|
101
99
|
|
|
102
100
|
&.isRootInFormLayout.isRootLayoutHorizontal::before {
|
|
103
101
|
grid-column-start: 2;
|
|
104
|
-
|
|
105
|
-
// 4.
|
|
106
|
-
@supports not (grid-template-columns: subgrid) {
|
|
107
|
-
display: none;
|
|
108
|
-
}
|
|
109
102
|
}
|
|
110
103
|
}
|
|
111
104
|
}
|
|
@@ -73,10 +73,6 @@
|
|
|
73
73
|
grid: inherit;
|
|
74
74
|
grid-template-columns: subgrid;
|
|
75
75
|
grid-column: span 2;
|
|
76
|
-
|
|
77
|
-
@supports not (grid-template-columns: subgrid) {
|
|
78
|
-
display: contents;
|
|
79
|
-
}
|
|
80
76
|
}
|
|
81
77
|
|
|
82
78
|
&.isRootLayoutHorizontal .field {
|
|
@@ -102,10 +98,6 @@
|
|
|
102
98
|
&.isRootLayoutHorizontal .validationText {
|
|
103
99
|
width: auto;
|
|
104
100
|
max-width: 100%;
|
|
105
|
-
|
|
106
|
-
@supports not (grid-template-columns: subgrid) {
|
|
107
|
-
margin-top: calc(-1 * var(--rui-FormLayout__row-gap));
|
|
108
|
-
}
|
|
109
101
|
}
|
|
110
102
|
|
|
111
103
|
&.isRootLayoutHorizontal.hasRootLabelBefore .label {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
$infix: $type;
|
|
30
30
|
$fallback-state: "default";
|
|
31
31
|
|
|
32
|
-
@if $type == "
|
|
32
|
+
@if $type == "state" {
|
|
33
33
|
$infix: $variant;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@if $type != "
|
|
36
|
+
@if $type != "state" and $variant != "default" {
|
|
37
37
|
$infix: #{$type}--#{$variant};
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -142,10 +142,10 @@
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
@mixin
|
|
146
|
-
--rui-local-link-color: #{map.get(theme.$link-
|
|
147
|
-
--rui-local-link-color-hover: #{map.get(theme.$link-
|
|
148
|
-
--rui-local-link-color-active: #{map.get(theme.$link-
|
|
145
|
+
@mixin state($variant) {
|
|
146
|
+
--rui-local-link-color: #{map.get(theme.$link-state-colors, $variant, default)};
|
|
147
|
+
--rui-local-link-color-hover: #{map.get(theme.$link-state-colors, $variant, hover)};
|
|
148
|
+
--rui-local-link-color-active: #{map.get(theme.$link-state-colors, $variant, active)};
|
|
149
149
|
|
|
150
|
-
@include _get-theme(
|
|
150
|
+
@include _get-theme(state, $variant);
|
|
151
151
|
}
|
package/src/theme.scss
CHANGED
|
@@ -208,6 +208,20 @@
|
|
|
208
208
|
--rui-color-feedback-note-active: #{colors.$note-darker};
|
|
209
209
|
--rui-color-feedback-on-note: #{colors.$on-note};
|
|
210
210
|
|
|
211
|
+
// State colors
|
|
212
|
+
--rui-color-state-valid: #{colors.$state-valid};
|
|
213
|
+
--rui-color-state-valid-hover: #{colors.$state-valid-dark};
|
|
214
|
+
--rui-color-state-valid-active: #{colors.$state-valid-darker};
|
|
215
|
+
--rui-color-state-invalid: #{colors.$state-invalid};
|
|
216
|
+
--rui-color-state-invalid-hover: #{colors.$state-invalid-dark};
|
|
217
|
+
--rui-color-state-invalid-active: #{colors.$state-invalid-darker};
|
|
218
|
+
--rui-color-state-warning: #{colors.$state-warning};
|
|
219
|
+
--rui-color-state-warning-hover: #{colors.$state-warning-dark};
|
|
220
|
+
--rui-color-state-warning-active: #{colors.$state-warning-darker};
|
|
221
|
+
--rui-color-state-changed: #{colors.$state-changed};
|
|
222
|
+
--rui-color-state-changed-hover: #{colors.$state-changed-dark};
|
|
223
|
+
--rui-color-state-changed-active: #{colors.$state-changed-darker};
|
|
224
|
+
|
|
211
225
|
// Neutral colors
|
|
212
226
|
--rui-color-neutral-light: #{colors.$white};
|
|
213
227
|
--rui-color-neutral-light-hover: #{colors.$gray-50};
|
|
@@ -236,6 +250,10 @@
|
|
|
236
250
|
--rui-color-background-help: #{colors.$help-light};
|
|
237
251
|
--rui-color-background-info: #{colors.$info-light};
|
|
238
252
|
--rui-color-background-note: #{colors.$note-light};
|
|
253
|
+
--rui-color-background-state-valid: #{colors.$state-valid-light};
|
|
254
|
+
--rui-color-background-state-invalid: #{colors.$state-invalid-light};
|
|
255
|
+
--rui-color-background-state-warning: #{colors.$state-warning-light};
|
|
256
|
+
--rui-color-background-state-changed: #{colors.$state-changed-light};
|
|
239
257
|
--rui-color-background-light: #{colors.$gray-100};
|
|
240
258
|
--rui-color-background-dark: #{colors.$gray-600};
|
|
241
259
|
|
|
@@ -910,27 +928,34 @@
|
|
|
910
928
|
--rui-FormField--disabled__cursor: var(--rui-cursor-not-allowed);
|
|
911
929
|
--rui-FormField--disabled__opacity: var(--rui-ratio-disabled-opacity);
|
|
912
930
|
|
|
913
|
-
// Form fields:
|
|
914
|
-
--rui-FormField--invalid--default__border-color: var(--rui-color-
|
|
915
|
-
--rui-FormField--invalid--default__background: var(--rui-color-background-
|
|
931
|
+
// Form fields: states: invalid
|
|
932
|
+
--rui-FormField--invalid--default__border-color: var(--rui-color-state-invalid);
|
|
933
|
+
--rui-FormField--invalid--default__background: var(--rui-color-background-state-invalid);
|
|
916
934
|
--rui-FormField--invalid--default__check-background-color: var(--rui-FormField--invalid--default__background);
|
|
917
|
-
--rui-FormField--invalid--default__surrounding-text-color: var(--rui-color-
|
|
935
|
+
--rui-FormField--invalid--default__surrounding-text-color: var(--rui-color-state-invalid);
|
|
918
936
|
--rui-FormField--invalid--checked__check-background-color: var(--rui-FormField--invalid--default__border-color);
|
|
919
937
|
|
|
920
|
-
// Form fields:
|
|
921
|
-
--rui-FormField--valid--default__border-color: var(--rui-color-
|
|
922
|
-
--rui-FormField--valid--default__background: var(--rui-color-background-
|
|
938
|
+
// Form fields: states: valid
|
|
939
|
+
--rui-FormField--valid--default__border-color: var(--rui-color-state-valid);
|
|
940
|
+
--rui-FormField--valid--default__background: var(--rui-color-background-state-valid);
|
|
923
941
|
--rui-FormField--valid--default__check-background-color: var(--rui-FormField--valid--default__background);
|
|
924
|
-
--rui-FormField--valid--default__surrounding-text-color: var(--rui-color-
|
|
942
|
+
--rui-FormField--valid--default__surrounding-text-color: var(--rui-color-state-valid);
|
|
925
943
|
--rui-FormField--valid--checked__check-background-color: var(--rui-FormField--valid--default__border-color);
|
|
926
944
|
|
|
927
|
-
// Form fields:
|
|
928
|
-
--rui-FormField--warning--default__border-color: var(--rui-color-
|
|
929
|
-
--rui-FormField--warning--default__background: var(--rui-color-background-warning);
|
|
945
|
+
// Form fields: states: warning
|
|
946
|
+
--rui-FormField--warning--default__border-color: var(--rui-color-state-warning-hover);
|
|
947
|
+
--rui-FormField--warning--default__background: var(--rui-color-background-state-warning);
|
|
930
948
|
--rui-FormField--warning--default__check-background-color: var(--rui-FormField--warning--default__background);
|
|
931
|
-
--rui-FormField--warning--default__surrounding-text-color: var(--rui-color-
|
|
949
|
+
--rui-FormField--warning--default__surrounding-text-color: var(--rui-color-state-warning-active);
|
|
932
950
|
--rui-FormField--warning--checked__check-background-color: var(--rui-FormField--warning--default__border-color);
|
|
933
951
|
|
|
952
|
+
// Form fields: states: changed
|
|
953
|
+
--rui-FormField--changed--default__border-color: var(--rui-color-state-changed);
|
|
954
|
+
--rui-FormField--changed--default__background: var(--rui-color-background-state-changed);
|
|
955
|
+
--rui-FormField--changed--default__check-background-color: var(--rui-FormField--changed--default__background);
|
|
956
|
+
--rui-FormField--changed--default__surrounding-text-color: var(--rui-color-state-changed);
|
|
957
|
+
--rui-FormField--changed--checked__check-background-color: var(--rui-FormField--changed--default__border-color);
|
|
958
|
+
|
|
934
959
|
// Form fields: box fields
|
|
935
960
|
--rui-FormField--box__border-width: var(--rui-dimension-border-width-1);
|
|
936
961
|
--rui-FormField--box__border-radius: var(--rui-dimension-radius-2);
|
package/src/types/index.ts
CHANGED
|
@@ -9,5 +9,5 @@ export type { LabelPosition } from './labelPositions';
|
|
|
9
9
|
export type { Layout } from './layouts';
|
|
10
10
|
export type { Priority } from './priorities';
|
|
11
11
|
export type { Size } from './sizes';
|
|
12
|
+
export type { State } from './states';
|
|
12
13
|
export type { CssModuleClasses } from './styles';
|
|
13
|
-
export type { ValidationState } from './validationStates';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type State = 'changed' | 'invalid' | 'valid' | 'warning';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CssModuleClasses,
|
|
3
|
-
ValidationState,
|
|
4
|
-
} from '../../types';
|
|
5
|
-
|
|
6
|
-
export const getRootValidationStateClassName = (styles: CssModuleClasses, validationState?: ValidationState) => {
|
|
7
|
-
if (validationState === 'invalid') {
|
|
8
|
-
return styles.isRootStateInvalid;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (validationState === 'valid') {
|
|
12
|
-
return styles.isRootStateValid;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (validationState === 'warning') {
|
|
16
|
-
return styles.isRootStateWarning;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return null;
|
|
20
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type ValidationState = 'invalid' | 'valid' | 'warning';
|