1
- // $checkbox-width: 20px !default;
1
+ // $checkbox-width: 18px !default;
2
2
// $checkbox-height: $checkbox-width !default;
3
3
// $checkbox-border-radius: 2px !default;
4
4
// $checkbox-border-width: 2px !default;
5
5
//
6
6
// ^^ defined in variables.scss
7
7
//
8
- $checkbox-margin : 16px !default ;
9
- $checkbox-text-margin : 10px !default ;
10
- $checkbox-top : 12px !default ;
8
+ $checkbox-margin-end : 16px !default ;
9
+ $checkbox-text-margin-top : 8px !default ;
10
+ $container-checkbox-margin : 3px !default ;
11
+
12
+ // md-spacing values (horizontal spacing with icons)
13
+ // default = 36px (Angular Material default)
14
+ // wide = 48px (Material Design Spec dense)
15
+ // extra-wide = 56px (Material Design Spec default)
16
+ $checkbox-text-margin : 36px !default ;
17
+ $checkbox-text-margin-wide : 48px !default ;
18
+ $checkbox-text-margin-extra-wide : 56px !default ;
19
+
20
+ // from input.scss
21
+ $input-container-margin-top : 18px !default ;
22
+ $input-container-padding-top : 2px !default ;
23
+ $input-padding-top : 2px !default ;
24
+ $input-padding-bottom : 1px !default ;
25
+ $input-border : 1px !default ;
26
+
27
+ $md-inline-alignment : $input-container-margin-top + $input-container-padding-top
28
+ + $input-padding-top + $input-padding-bottom + $input-border
29
+ - $checkbox-text-margin-top !default ;
11
30
12
31
.md-inline-form {
13
32
md-checkbox {
14
- margin : 19px 0 18px ;
33
+ margin-top : $md-inline-alignment ;
34
+ margin-bottom : auto ;
15
35
}
16
36
}
17
37
18
38
md-checkbox {
19
39
box-sizing : border-box ;
20
40
display : inline-block ;
21
- margin-bottom : $checkbox-margin ;
22
41
white-space : nowrap ;
23
42
cursor : pointer ;
24
43
outline : none ;
25
44
user-select : none ;
26
45
position : relative ;
27
46
min-width : $checkbox-width ;
28
- min-height : $checkbox-width ;
29
- @include rtl (margin-left , 0 , $checkbox-margin );
30
- @include rtl (margin-right , $checkbox-margin , 0 );
47
+ min-height : $checkbox-width * 2 ;
48
+ @include rtl (margin-left , 0 , $checkbox-margin-end );
49
+ @include rtl (margin-right , $checkbox-margin-end , 0 );
31
50
32
51
& :last-of-type {
33
52
margin-left : 0 ;
34
53
margin-right : 0 ;
35
54
}
36
-
37
55
& .md-focused :not ([disabled ]) {
38
56
.md-container :before {
39
57
left : -8px ;
@@ -49,22 +67,51 @@ md-checkbox {
49
67
}
50
68
}
51
69
52
- & .md-align-top-left > div .md-container {
53
- top : $checkbox-top ;
54
- }
55
-
56
70
@include checkbox-container ;
57
71
72
+ .md-container {
73
+ // Use auto for compatibility with md-checkbox padding
74
+ top : auto ;
75
+ @include rtl (left , initial , auto );
76
+ @include rtl (right , auto , initial );
77
+ margin : $container-checkbox-margin ;
78
+ margin-top : $checkbox-height + $container-checkbox-margin ;
79
+ }
80
+
58
81
.md-label {
59
82
box-sizing : border-box ;
60
83
position : relative ;
61
84
display : inline-block ;
62
85
vertical-align : middle ;
63
86
white-space : normal ;
64
87
user-select : text ;
88
+ margin-top : $checkbox-text-margin-top ;
89
+ margin-bottom : auto ;
65
90
66
- @include rtl (margin-left , $checkbox-text-margin + $checkbox-width , 0 );
67
- @include rtl (margin-right , 0 , $checkbox-text-margin + $checkbox-width );
91
+ @include rtl (margin-left , $checkbox-text-margin , 0 );
92
+ @include rtl (margin-right , 0 , $checkbox-text-margin );
68
93
94
+ & :empty {
95
+ // clamp to checkbox-container margins
96
+ @include rtl (margin-left , $checkbox-height + ($container-checkbox-margin * 2 ), 0 );
97
+ @include rtl (margin-right , 0 , $checkbox-height + ($container-checkbox-margin * 2 ));
98
+ }
99
+
100
+ }
101
+
102
+ [md-spacing = " wide" ] & :not[md- spacing=" default" ],
103
+ &[md- spacing=" wide" ] {
104
+ ._md- label {
105
+ @include rtl (margin-left , $checkbox-text-margin-wide , 0 );
106
+ @include rtl (margin-right , 0 , $checkbox-text-margin-wide );
107
+ }
108
+ }
109
+
110
+ [md-spacing = " extra-wide" ] & :not[md-spacing = " default" ],
111
+ & [md-spacing = " extra-wide" ]{
112
+ ._md-label {
113
+ @include rtl (margin-left , $checkbox-text-margin-extra-wide , 0 );
114
+ @include rtl (margin-right , 0 , $checkbox-text-margin-extra-wide );
115
+ }
69
116
}
70
117
}
0 commit comments