@@ -5,9 +5,23 @@ $select-option-height: 48px !default;
5
5
$select-option-padding : 16px !default ;
6
6
$select-container-padding : 16px !default ;
7
7
$select-container-transition-duration : 350ms !default ;
8
+ $select-value-padding-top : 6px ;
9
+ $select-value-padding-bottom : 4px ;
8
10
9
11
$select-max-visible-options : 5 !default ;
10
12
13
+ // from input.scss
14
+ $input-container-margin-top : 18px !default ;
15
+ $input-container-padding-top : 2px !default ;
16
+ $input-padding-top : 2px !default ;
17
+ $input-padding-bottom : 1px !default ;
18
+
19
+ $input-alignment : ($input-padding-top + $input-padding-bottom )
20
+ - ($select-value-padding-top + $select-value-padding-bottom );
21
+ $md-inline-alignment : ($input-container-margin-top + $input-container-padding-top )
22
+ + ($input-padding-top + $input-padding-bottom )
23
+ - ($select-value-padding-top + $select-value-padding-bottom );
24
+
11
25
// Fixes the animations with the floating label when select is inside an input container
12
26
md-input-container {
13
27
& :not ([md-no-float ]) {
@@ -72,7 +86,7 @@ md-input-container {
72
86
}
73
87
74
88
md-input-container > md-select {
75
- margin : 0 ;
89
+ margin-top : $input-alignment ;
76
90
order : 2 ;
77
91
}
78
92
@@ -102,7 +116,6 @@ md-input-container.md-input-invalid {
102
116
103
117
md-select {
104
118
display : flex ;
105
- margin : 2.5 * $baseline-grid 0 3 * $baseline-grid + 2 0 ;
106
119
107
120
& [required ], & .ng-required {
108
121
& .ng-invalid {
@@ -120,7 +133,12 @@ md-select {
120
133
// to create a dotted line under the input.
121
134
background-size : 4px 1px ;
122
135
background-repeat : repeat-x ;
123
- margin-bottom : -1px ; // Shift downward so dotted line is positioned the same as other bottom borders
136
+ // Add to padding-bottom to keep dotted line aligned with other bottom borders
137
+ // Sub from padding-top to keep height consistent
138
+ // Translate text 1px up to keep in alignment
139
+ padding-bottom : $select-value-padding-bottom + 1 ;
140
+ padding-top : $select-value-padding-top - 1 ;
141
+ transform : translate3d (0 , 1px , 0 );
124
142
}
125
143
126
144
& :focus {
@@ -135,43 +153,33 @@ md-select {
135
153
}
136
154
& .ng-invalid.ng-touched {
137
155
._md-select-value {
138
- border-bottom-style : solid ;
139
- padding-bottom : 1px ;
156
+ border-bottom : 2px solid ;
140
157
}
141
158
}
142
159
& :focus {
143
160
._md-select-value {
144
161
border-bottom-width : 2px ;
145
162
border-bottom-style : solid ;
146
- padding-bottom : 0 ;
147
- }
148
- & .ng-invalid.ng-touched {
149
- ._md-select-value {
150
- padding-bottom : 0 ;
151
- }
163
+ padding-bottom : $select-value-padding-bottom - 1 ;
152
164
}
153
165
}
154
166
}
155
167
}
156
168
157
- // Fix value by 1px to align with standard text inputs (and spec)
158
- md-input-container .md-input-has-value ._md-select-value {
159
- > span :not (._md-select-icon ) {
160
- transform : translate3d (0 , 1px , 0 );
161
- }
162
- }
163
-
164
169
._md-select-value {
165
170
display : flex ;
166
171
align-items : center ;
167
- padding : 2px 2px 1px ;
172
+ padding-top : $select-value-padding-top ;
173
+ padding-bottom : $select-value-padding-bottom ;
168
174
border-bottom-width : 1px ;
169
175
border-bottom-style : solid ;
170
176
background-color : rgba (0 ,0 ,0 ,0 );
171
177
position : relative ;
172
178
box-sizing : content-box ;
173
- min-width : 8 * $baseline-grid ;
179
+ min-width : 11 * $baseline-grid ;
174
180
min-height : 26px ;
181
+ margin-bottom : auto ;
182
+ -ms-flex-item-align : start ; // workaround for margin-bottom: auto
175
183
flex-grow : 1 ;
176
184
177
185
@@ -192,7 +200,6 @@ md-input-container.md-input-has-value ._md-select-value {
192
200
align-items : flex-end ;
193
201
text-align : end ;
194
202
width : 3 * $baseline-grid ;
195
- margin : 0 .5 * $baseline-grid ;
196
203
transform : translate3d (0 , -2px , 0 );
197
204
font-size : 1.2rem ;
198
205
}
@@ -202,17 +209,18 @@ md-input-container.md-input-has-value ._md-select-value {
202
209
content : ' \25BC ' ;
203
210
position : relative ;
204
211
top : 2px ;
212
+ @include rtl (right , -4px , auto );
213
+ @include rtl (left , auto , -4px );
205
214
speak : none ;
206
215
font-size : 16px ;
207
- transform : scaleY (0.6 ) scaleX ( 1 );
216
+ transform : scaleY (0.5 );
208
217
}
209
218
210
219
& ._md-select-placeholder {
211
220
display : flex ;
212
221
order : 1 ;
213
222
pointer-events : none ;
214
223
-webkit-font-smoothing : antialiased ;
215
- padding-left : 2px ;
216
224
z-index : 1 ;
217
225
}
218
226
}
@@ -315,3 +323,19 @@ md-select-menu[multiple] {
315
323
}
316
324
}
317
325
}
326
+
327
+ .layout-row ,
328
+ .layout-xs-row , .layout-gt-xs-row ,
329
+ .layout-sm-row , .layout-gt-sm-row ,
330
+ .layout-md-row , .layout-gt-md-row ,
331
+ .layout-lg-row , .layout-gt-lg-row ,
332
+ .layout-xl-row {
333
+ & > md-select :not (:last-child ), {
334
+ @include rtl (margin-left , 0 , $select-container-padding );
335
+ @include rtl (margin-right , $select-container-padding , 0 );
336
+ }
337
+
338
+ .md-inline-form & > md-select {
339
+ margin-top : $md-inline-alignment ;
340
+ }
341
+ }
0 commit comments