@react-ui-org/react-ui 0.44.1 → 0.45.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/lib.development.js +138 -258
- package/dist/lib.js +1 -1
- package/package.json +7 -10
- 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 +5 -4
- 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 +6 -1
- 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 +4 -3
- package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
- package/src/lib/components/Card/Card.jsx +7 -6
- package/src/lib/components/Card/Card.scss +28 -28
- 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 +12 -11
- package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
- package/src/lib/components/FileInputField/FileInputField.jsx +13 -12
- package/src/lib/components/FileInputField/FileInputField.scss +19 -19
- package/src/lib/components/FormLayout/FormLayout.jsx +5 -4
- package/src/lib/components/FormLayout/FormLayout.scss +17 -17
- package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +9 -8
- package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
- package/src/lib/components/FormLayout/README.mdx +16 -36
- package/src/lib/components/Grid/Grid.jsx +1 -1
- package/src/lib/components/Grid/Grid.scss +28 -30
- package/src/lib/components/Grid/GridSpan.jsx +1 -1
- 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/Link/Link.jsx +1 -1
- package/src/lib/components/Link/Link.scss +7 -7
- package/src/lib/components/List/List.jsx +11 -10
- package/src/lib/components/List/List.scss +21 -21
- package/src/lib/components/Media/Media.scss +6 -6
- package/src/lib/components/Modal/Modal.jsx +6 -5
- package/src/lib/components/Modal/Modal.scss +73 -73
- 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 +5 -4
- package/src/lib/components/Paper/Paper.scss +8 -8
- package/src/lib/components/Radio/Radio.jsx +12 -11
- package/src/lib/components/Radio/Radio.scss +26 -26
- package/src/lib/components/ScrollView/ScrollView.jsx +9 -8
- 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/SelectField.jsx +14 -13
- package/src/lib/components/SelectField/SelectField.scss +30 -30
- package/src/lib/components/Table/Table.scss +28 -35
- package/src/lib/components/Table/_settings.scss +5 -5
- 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/Text.jsx +5 -4
- package/src/lib/components/Text/Text.scss +12 -12
- 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/TextArea.jsx +14 -13
- package/src/lib/components/TextArea/TextArea.scss +27 -27
- package/src/lib/components/TextField/TextField.jsx +16 -15
- package/src/lib/components/TextField/TextField.scss +28 -28
- package/src/lib/components/Toggle/Toggle.jsx +12 -11
- package/src/lib/components/Toggle/Toggle.scss +20 -20
- package/src/lib/components/Toolbar/Toolbar.jsx +5 -4
- package/src/lib/components/Toolbar/Toolbar.scss +25 -25
- package/src/lib/components/Toolbar/ToolbarGroup.jsx +5 -4
- 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/{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 +3 -7
- 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 +21 -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 +144 -144
- 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 +71 -71
- package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +44 -44
- 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
@@ -1,28 +1,28 @@
|
|
1
1
|
// 1. Decorative bottom border.
|
2
2
|
|
3
|
-
@use
|
4
|
-
@use
|
3
|
+
@use "../../styles/tools/reset";
|
4
|
+
@use "theme";
|
5
5
|
|
6
6
|
.list {
|
7
|
-
|
7
|
+
@include reset.list();
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
position: relative;
|
10
|
+
display: inline-flex;
|
11
|
+
min-width: 100%;
|
12
|
+
padding-right: theme.$padding-x;
|
13
|
+
padding-left: theme.$padding-x;
|
14
|
+
overflow-y: hidden;
|
15
|
+
white-space: nowrap;
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
// 1.
|
18
|
+
&::after {
|
19
|
+
content: "";
|
20
|
+
position: absolute;
|
21
|
+
right: 0;
|
22
|
+
bottom: 0;
|
23
|
+
left: 0;
|
24
|
+
z-index: 1;
|
25
|
+
height: theme.$border-bottom-width;
|
26
|
+
background-color: theme.$border-bottom-color;
|
27
|
+
}
|
28
28
|
}
|
@@ -1,6 +1,7 @@
|
|
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';
|
4
5
|
import styles from './TabsItem.scss';
|
5
6
|
|
6
7
|
export const TabsItem = ({
|
@@ -13,10 +14,10 @@ export const TabsItem = ({
|
|
13
14
|
onClick,
|
14
15
|
}) => (
|
15
16
|
<li
|
16
|
-
className={
|
17
|
+
className={classNames(
|
17
18
|
styles.root,
|
18
|
-
isActive
|
19
|
-
|
19
|
+
isActive && styles.isRootActive,
|
20
|
+
)}
|
20
21
|
id={id}
|
21
22
|
key={href}
|
22
23
|
>
|
@@ -1,118 +1,118 @@
|
|
1
1
|
// 1. Keep inactive items under Tabs' decorative bottom border and pop active ones above it.
|
2
2
|
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
6
|
-
@use
|
3
|
+
@use "../../styles/tools/breakpoint";
|
4
|
+
@use "../../styles/tools/reset";
|
5
|
+
@use "../../styles/tools/transition";
|
6
|
+
@use "theme";
|
7
7
|
|
8
8
|
.root {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
&:not(:last-child) {
|
24
|
-
margin-right: theme.$gap-xs;
|
25
|
-
}
|
9
|
+
@include transition.add(transform);
|
10
|
+
|
11
|
+
position: relative; // 1.
|
12
|
+
z-index: 1; // 1.
|
13
|
+
flex: none;
|
14
|
+
padding-top: calc(-1 * #{theme.$item-active-shift-y});
|
15
|
+
margin-bottom: theme.$item-active-shift-y;
|
16
|
+
transform: translateY(0);
|
17
|
+
|
18
|
+
&:hover,
|
19
|
+
&:focus-within {
|
20
|
+
transform: translateY(theme.$item-hover-shift-y);
|
21
|
+
}
|
26
22
|
|
27
|
-
@include breakpoint.up(sm) {
|
28
23
|
&:not(:last-child) {
|
29
|
-
|
24
|
+
margin-right: theme.$gap-xs;
|
30
25
|
}
|
31
|
-
}
|
32
26
|
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
@include breakpoint.up(sm) {
|
28
|
+
&:not(:last-child) {
|
29
|
+
margin-right: theme.$gap-sm;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
@include breakpoint.up(md) {
|
34
|
+
&:not(:last-child) {
|
35
|
+
margin-right: theme.$gap-md;
|
36
|
+
}
|
36
37
|
}
|
37
|
-
}
|
38
38
|
}
|
39
39
|
|
40
40
|
.link {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
41
|
+
@include reset.link();
|
42
|
+
@include transition.add((color, border-color, background-color, box-shadow));
|
43
|
+
|
44
|
+
display: block;
|
45
|
+
padding: theme.$item-padding-xs;
|
46
|
+
font-weight: theme.$item-font-weight;
|
47
|
+
line-height: 1;
|
48
|
+
text-decoration: none;
|
49
|
+
color: theme.$item-color;
|
50
|
+
border-width: theme.$item-border-width;
|
51
|
+
border-style: solid;
|
52
|
+
border-color: theme.$item-border-color;
|
53
|
+
border-top-left-radius: theme.$item-border-radius;
|
54
|
+
border-top-right-radius: theme.$item-border-radius;
|
55
|
+
background-color: theme.$item-background-color;
|
56
|
+
box-shadow: theme.$item-box-shadow;
|
57
|
+
|
58
|
+
&:hover,
|
59
|
+
&:focus {
|
60
|
+
font-weight: theme.$item-hover-font-weight;
|
61
|
+
color: theme.$item-hover-color;
|
62
|
+
border-width: theme.$item-hover-border-width;
|
63
|
+
border-color: theme.$item-hover-border-color;
|
64
|
+
background-color: theme.$item-hover-background-color;
|
65
|
+
box-shadow: theme.$item-hover-box-shadow;
|
66
|
+
}
|
67
|
+
|
68
|
+
@include breakpoint.up(sm) {
|
69
|
+
padding: theme.$item-padding-sm;
|
70
|
+
}
|
71
|
+
|
72
|
+
@include breakpoint.up(md) {
|
73
|
+
padding: theme.$item-padding-md;
|
74
|
+
}
|
75
75
|
}
|
76
76
|
|
77
77
|
.linkContent {
|
78
|
-
|
78
|
+
@include transition.add(transform);
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
display: flex;
|
81
|
+
align-items: center;
|
82
|
+
transform: translateY(0);
|
83
83
|
}
|
84
84
|
|
85
85
|
.label:not(:first-child) {
|
86
|
-
|
86
|
+
margin-left: theme.$item-icon-gap;
|
87
87
|
}
|
88
88
|
|
89
89
|
.label:not(:last-child) {
|
90
|
-
|
90
|
+
margin-right: theme.$item-icon-gap;
|
91
91
|
}
|
92
92
|
|
93
93
|
.isRootActive,
|
94
94
|
.isRootActive:hover,
|
95
95
|
.isRootActive:focus-within {
|
96
|
-
|
97
|
-
|
96
|
+
z-index: 2; // 1.
|
97
|
+
transform: translateY(theme.$item-active-shift-y);
|
98
98
|
}
|
99
99
|
|
100
100
|
.isRootActive .link {
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
101
|
+
font-weight: theme.$item-active-font-weight;
|
102
|
+
color: theme.$item-active-color;
|
103
|
+
border-width: theme.$item-active-border-width;
|
104
|
+
border-color: theme.$item-active-border-color;
|
105
|
+
background-color: theme.$item-active-background-color;
|
106
|
+
box-shadow: theme.$item-active-box-shadow;
|
107
107
|
}
|
108
108
|
|
109
109
|
.link:hover .linkContent,
|
110
110
|
.link:focus .linkContent {
|
111
|
-
|
111
|
+
transform: translateY(theme.$item-hover-label-shift-y);
|
112
112
|
}
|
113
113
|
|
114
114
|
.isRootActive .link .linkContent,
|
115
115
|
.isRootActive .link:hover .linkContent,
|
116
116
|
.isRootActive .link:focus .linkContent {
|
117
|
-
|
117
|
+
transform: translateY(theme.$item-active-label-shift-y);
|
118
118
|
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React from 'react';
|
3
3
|
import { withProviderContext } from '../../provider';
|
4
|
-
import
|
5
|
-
import
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootHyphensClassName } from './_helpers/getRootHyphensClassName';
|
6
|
+
import { getRootWordWrappingClassName } from './_helpers/getRootWordWrappingClassName';
|
6
7
|
import styles from './Text.scss';
|
7
8
|
|
8
9
|
export const Text = ({
|
@@ -18,11 +19,11 @@ export const Text = ({
|
|
18
19
|
return (
|
19
20
|
<HtmlElement
|
20
21
|
className={(hyphens !== 'none' || lines > 0 || wordWrapping !== 'normal')
|
21
|
-
?
|
22
|
+
? classNames(
|
22
23
|
(lines > 0) ? styles.rootClampLines : '',
|
23
24
|
getRootHyphensClassName(hyphens, styles),
|
24
25
|
getRootWordWrappingClassName(wordWrapping, styles),
|
25
|
-
|
26
|
+
)
|
26
27
|
: undefined}
|
27
28
|
id={id}
|
28
29
|
style={(lines > 0) ? { '--rui-custom-lines': lines } : undefined}
|
@@ -2,29 +2,29 @@
|
|
2
2
|
// required for Safari.
|
3
3
|
// https://caniuse.com/mdn-css_properties_overflow-wrap_anywhere
|
4
4
|
|
5
|
-
|
5
|
+
// stylelint-disable property-no-vendor-prefix, value-no-vendor-prefix
|
6
6
|
.rootClampLines {
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
display: -webkit-box;
|
8
|
+
-webkit-line-clamp: var(--rui-custom-lines);
|
9
|
+
-webkit-box-orient: vertical;
|
10
|
+
overflow: hidden;
|
11
|
+
text-overflow: ellipsis;
|
12
12
|
}
|
13
|
-
|
13
|
+
// stylelint-enable property-no-vendor-prefix, value-no-vendor-prefix
|
14
14
|
|
15
15
|
.rootHyphensAuto {
|
16
|
-
|
16
|
+
hyphens: auto;
|
17
17
|
}
|
18
18
|
|
19
19
|
.rootHyphensManual {
|
20
|
-
|
20
|
+
hyphens: manual;
|
21
21
|
}
|
22
22
|
|
23
23
|
.rootWordWrappingAnywhere {
|
24
|
-
|
24
|
+
word-break: break-all;
|
25
25
|
}
|
26
26
|
|
27
27
|
.rootWordWrappingLongWords {
|
28
|
-
|
29
|
-
|
28
|
+
word-break: break-word; // 1.
|
29
|
+
overflow-wrap: anywhere;
|
30
30
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React, { useContext } from 'react';
|
3
|
-
import getRootSizeClassName from '../../helpers/getRootSizeClassName';
|
4
|
-
import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
|
5
|
-
import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
|
6
3
|
import { withProviderContext } from '../../provider';
|
7
|
-
import
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
|
6
|
+
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
|
7
|
+
import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
|
8
|
+
import { transferProps } from '../_helpers/transferProps';
|
8
9
|
import { FormLayoutContext } from '../FormLayout';
|
9
10
|
import withForwardedRef from '../withForwardedRef';
|
10
11
|
import styles from './TextArea.scss';
|
@@ -33,27 +34,27 @@ export const TextArea = ({
|
|
33
34
|
|
34
35
|
return (
|
35
36
|
<label
|
36
|
-
className={
|
37
|
+
className={classNames(
|
37
38
|
styles.root,
|
38
|
-
fullWidth
|
39
|
-
context
|
39
|
+
fullWidth && styles.isRootFullWidth,
|
40
|
+
context && styles.isRootInFormLayout,
|
40
41
|
resolveContextOrProp(context && context.layout, layout) === 'horizontal'
|
41
42
|
? styles.rootLayoutHorizontal
|
42
43
|
: styles.rootLayoutVertical,
|
43
|
-
disabled
|
44
|
-
required
|
44
|
+
disabled && styles.isRootDisabled,
|
45
|
+
required && styles.isRootRequired,
|
45
46
|
getRootSizeClassName(size, styles),
|
46
47
|
getRootValidationStateClassName(validationState, styles),
|
47
48
|
variant === 'filled' ? styles.rootVariantFilled : styles.rootVariantOutline,
|
48
|
-
|
49
|
+
)}
|
49
50
|
htmlFor={id}
|
50
51
|
id={id && `${id}__label`}
|
51
52
|
>
|
52
53
|
<div
|
53
|
-
className={
|
54
|
+
className={classNames(
|
54
55
|
styles.label,
|
55
|
-
isLabelVisible
|
56
|
-
|
56
|
+
!isLabelVisible && styles.isLabelHidden,
|
57
|
+
)}
|
57
58
|
id={id && `${id}__labelText`}
|
58
59
|
>
|
59
60
|
{label}
|
@@ -1,95 +1,95 @@
|
|
1
|
-
@use
|
2
|
-
@use
|
3
|
-
@use
|
4
|
-
@use
|
5
|
-
@use
|
6
|
-
@use
|
1
|
+
@use "../../styles/tools/form-fields/box-field-elements";
|
2
|
+
@use "../../styles/tools/form-fields/box-field-layout";
|
3
|
+
@use "../../styles/tools/form-fields/box-field-sizes";
|
4
|
+
@use "../../styles/tools/form-fields/foundation";
|
5
|
+
@use "../../styles/tools/form-fields/variants";
|
6
|
+
@use "../../styles/tools/accessibility";
|
7
7
|
|
8
8
|
// Foundation
|
9
9
|
.root {
|
10
|
-
|
10
|
+
@include foundation.root();
|
11
11
|
}
|
12
12
|
|
13
13
|
.label {
|
14
|
-
|
14
|
+
@include foundation.label();
|
15
15
|
}
|
16
16
|
|
17
17
|
.inputContainer {
|
18
|
-
|
18
|
+
@include box-field-elements.input-container();
|
19
19
|
}
|
20
20
|
|
21
21
|
.input {
|
22
|
-
|
23
|
-
|
22
|
+
@include box-field-elements.input();
|
23
|
+
@include box-field-elements.input-textarea();
|
24
24
|
}
|
25
25
|
|
26
26
|
.bottomLine {
|
27
|
-
|
27
|
+
@include box-field-elements.bottom-line();
|
28
28
|
}
|
29
29
|
|
30
30
|
.helpText,
|
31
31
|
.validationText {
|
32
|
-
|
32
|
+
@include foundation.help-text();
|
33
33
|
}
|
34
34
|
|
35
35
|
.isRootRequired .label {
|
36
|
-
|
36
|
+
@include foundation.label-required();
|
37
37
|
}
|
38
38
|
|
39
39
|
// Visual variants
|
40
40
|
.rootVariantFilled {
|
41
|
-
|
41
|
+
@include variants.visual(box, $variant: filled);
|
42
42
|
}
|
43
43
|
|
44
44
|
.rootVariantOutline {
|
45
|
-
|
45
|
+
@include variants.visual(box, $variant: outline);
|
46
46
|
}
|
47
47
|
|
48
48
|
// States
|
49
49
|
.isRootStateInvalid {
|
50
|
-
|
50
|
+
@include variants.validation(invalid);
|
51
51
|
}
|
52
52
|
|
53
53
|
.isRootStateValid {
|
54
|
-
|
54
|
+
@include variants.validation(valid);
|
55
55
|
}
|
56
56
|
|
57
57
|
.isRootStateWarning {
|
58
|
-
|
58
|
+
@include variants.validation(warning);
|
59
59
|
}
|
60
60
|
|
61
61
|
// Invisible label
|
62
62
|
.isLabelHidden {
|
63
|
-
|
63
|
+
@include accessibility.hide-text();
|
64
64
|
}
|
65
65
|
|
66
66
|
// Layouts
|
67
67
|
.rootLayoutVertical,
|
68
68
|
.rootLayoutHorizontal {
|
69
|
-
|
69
|
+
@include box-field-layout.vertical();
|
70
70
|
}
|
71
71
|
|
72
72
|
.rootLayoutHorizontal {
|
73
|
-
|
73
|
+
@include box-field-layout.horizontal();
|
74
74
|
}
|
75
75
|
|
76
76
|
.isRootFullWidth {
|
77
|
-
|
77
|
+
@include box-field-layout.full-width();
|
78
78
|
}
|
79
79
|
|
80
80
|
.isRootInFormLayout {
|
81
|
-
|
81
|
+
@include box-field-layout.in-form-layout();
|
82
82
|
}
|
83
83
|
|
84
84
|
// Sizes
|
85
85
|
.rootSizeSmall {
|
86
|
-
|
86
|
+
@include box-field-sizes.size(small, $is-multiline: true);
|
87
87
|
}
|
88
88
|
|
89
89
|
.rootSizeMedium {
|
90
|
-
|
90
|
+
@include box-field-sizes.size(medium, $is-multiline: true);
|
91
91
|
}
|
92
92
|
|
93
93
|
.rootSizeLarge {
|
94
|
-
|
94
|
+
@include box-field-sizes.size(large, $is-multiline: true);
|
95
95
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
import PropTypes from 'prop-types';
|
2
2
|
import React, { useContext } from 'react';
|
3
|
-
import getRootSizeClassName from '../../helpers/getRootSizeClassName';
|
4
|
-
import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
|
5
|
-
import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
|
6
3
|
import { withProviderContext } from '../../provider';
|
7
|
-
import
|
4
|
+
import { classNames } from '../../utils/classNames';
|
5
|
+
import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
|
6
|
+
import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
|
7
|
+
import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
|
8
|
+
import { transferProps } from '../_helpers/transferProps';
|
8
9
|
import { FormLayoutContext } from '../FormLayout';
|
9
10
|
import withForwardedRef from '../withForwardedRef';
|
10
11
|
import styles from './TextField.scss';
|
@@ -36,30 +37,30 @@ export const TextField = ({
|
|
36
37
|
|
37
38
|
return (
|
38
39
|
<label
|
39
|
-
className={
|
40
|
+
className={classNames(
|
40
41
|
styles.root,
|
41
|
-
fullWidth
|
42
|
-
hasSmallInput
|
43
|
-
inputSize
|
44
|
-
context
|
42
|
+
fullWidth && styles.isRootFullWidth,
|
43
|
+
hasSmallInput && styles.hasRootSmallInput,
|
44
|
+
inputSize && styles.hasRootCustomInputSize,
|
45
|
+
context && styles.isRootInFormLayout,
|
45
46
|
resolveContextOrProp(context && context.layout, layout) === 'horizontal'
|
46
47
|
? styles.rootLayoutHorizontal
|
47
48
|
: styles.rootLayoutVertical,
|
48
|
-
disabled
|
49
|
-
required
|
49
|
+
disabled && styles.isRootDisabled,
|
50
|
+
required && styles.isRootRequired,
|
50
51
|
getRootSizeClassName(size, styles),
|
51
52
|
getRootValidationStateClassName(validationState, styles),
|
52
53
|
variant === 'filled' ? styles.rootVariantFilled : styles.rootVariantOutline,
|
53
|
-
|
54
|
+
)}
|
54
55
|
htmlFor={id}
|
55
56
|
id={id && `${id}__label`}
|
56
57
|
{...(inputSize ? { style: { '--rui-custom-input-size': inputSize } } : {})}
|
57
58
|
>
|
58
59
|
<div
|
59
|
-
className={
|
60
|
+
className={classNames(
|
60
61
|
styles.label,
|
61
|
-
isLabelVisible
|
62
|
-
|
62
|
+
!isLabelVisible && styles.isLabelHidden,
|
63
|
+
)}
|
63
64
|
id={id && `${id}__labelText`}
|
64
65
|
>
|
65
66
|
{label}
|