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