5
5
* ==========================================================================
6
6
*/
7
7
8
- $margin : em (map-get ($inputs-single-line , margin ));
8
+ $margin : em (map-get ($inputs-element , margin ));
9
+ $margin-label : em (map-get ($inputs-label , margin ));
9
10
10
11
@mixin input () {
11
- padding : em (map-get ($inputs-single-line , padding ));
12
- margin : $margin 0 ;
13
- border : map-get ($inputs-single-line , border );
14
- border-color : map-deep-get ($inputs-single-line , border-color , base );
15
- background : map-deep-get ($inputs-single-line , background , base );
12
+ padding : em (map-get ($inputs-element , padding ));
13
+ margin : $margin ;
14
+ border : map-get ($inputs-element , border );
15
+ border-color : map-deep-get ($inputs-element , border-color , base );
16
+ background : map-deep-get ($inputs-element , background , base );
16
17
box-shadow : map-get ($inputs-shadows , normal );
17
- border-radius : em (map-get ($inputs-single-line , border-radius ));
18
+ border-radius : em (map-get ($inputs-element , border-radius ));
18
19
transition : map-get ($inputs-transitions , blur );
19
- font-size : em (map-get ($inputs-single-line , font-size ));
20
- width : map-get ($inputs-single-line , width );
20
+ font-size : em (map-get ($inputs-element , font-size ));
21
+ width : map-get ($inputs-element , width );
21
22
22
23
& :focus ,
23
24
& .focus {
@@ -33,10 +34,15 @@ $margin: em(map-get($inputs-single-line, margin));
33
34
& .active {
34
35
@include input-active ();
35
36
}
37
+
38
+ & .error {
39
+ @include input-error ();
40
+ }
36
41
}
37
42
43
+ // Input state mixins
44
+
38
45
@mixin input-focus () {
39
- border : map-get ($inputs-focus , border );
40
46
border-color : map-deep-get ($inputs-focus , border-color , light );
41
47
transition : map-get ($inputs-transitions , focus );
42
48
outline : map-get ($inputs-focus , outline );
@@ -46,7 +52,6 @@ $margin: em(map-get($inputs-single-line, margin));
46
52
@mixin input-disabled () {
47
53
background : map-deep-get ($inputs-disabled , background , base );
48
54
box-shadow : map-get ($inputs-shadows , disabled );
49
- border : map-get ($inputs-disabled , border );
50
55
border-color : map-deep-get ($inputs-disabled , border-color , darker );
51
56
color : map-deep-get ($inputs-disabled , color , darker );
52
57
cursor : map-get ($inputs-disabled , cursor );
@@ -56,9 +61,22 @@ $margin: em(map-get($inputs-single-line, margin));
56
61
border-color : map-deep-get ($inputs-active , border-color , light );
57
62
}
58
63
64
+ @mixin input-error () {
65
+ border-color : map-deep-get ($inputs-error , border-color , base );
66
+ box-shadow : map-get ($inputs-shadows , error-base ), map-get ($inputs-shadows , error-spread );
67
+ background : rgba (map-deep-get ($inputs-error , background , base ), .08 );
68
+ }
69
+
59
70
@mixin input-label () {
60
71
display : map-get ($inputs-label , display );
61
72
max-width : map-get ($inputs-label , max-width );
62
73
font-size : em (map-get ($inputs-label , font-size ));
63
74
font-weight : map-get ($inputs-label , font-weight );
75
+ margin : $margin-label 0 ;
76
+
77
+ & .error {
78
+ font-size : em (map-get ($inputs-label-error , font-size ));
79
+ color : map-deep-get ($inputs-label-error , color , base );
80
+ font-weight : map-get ($inputs-label-error , font-weight );
81
+ }
64
82
}
0 commit comments