1 // This file has been autogenerated by grunt task lessToSass. Any changes will be overwritten.
3 @import '_inputs-size';
7 border-radius: $border-radius-small;
8 @include variations(unquote(".label"), unquote(""), background-color, $grey);
11 // must be broken out for reuse - webkit selector breaks firefox
12 @mixin label-static($label-top, $static-font-size, $static-line-height){
16 // must repeat because the selector above is more specific than the general label sizing
17 font-size: $static-font-size;
18 line-height: $static-line-height;
22 @mixin label-size-variant($placeholder-font-size, $vertical-padding, $line-height, $static-font-size, $static-line-height, $help-block-font-size){
24 @include material-placeholder {
25 font-size: $placeholder-font-size;
26 line-height: $line-height;
27 color: $mdb-input-placeholder-color;
31 // margin-bottom must be specified to give help-block vertical space.
32 // $see also form-group padding-bottom (and size variants) re: collapsible margins. These work together.
33 margin-bottom: $vertical-padding;
36 // generic labels used anywhere in the form (not control-label)
40 font-size: $placeholder-font-size;
41 line-height: $line-height;
42 color: $mdb-input-placeholder-color;
46 // smaller focused or static size
48 font-size: $static-font-size;
49 line-height: $static-line-height;
50 color: $mdb-input-placeholder-color;
52 margin: 16px 0 0 0; // std and lg
56 margin-top: 0; // allow the input margin to set-off the top of the help-block
57 font-size: $help-block-font-size;
61 @mixin form-group-validation-state($name, $color){
63 &.#{$name} { // e.g. has-error
67 &.is-focused .form-control {
68 background-image: linear-gradient($color, $color), linear-gradient($mdb-input-underline-color, $mdb-input-underline-color);
77 @mixin form-group-size-variant($parent, $placeholder-font-size, $label-top-margin, $vertical-padding, $line-height, $label-as-placeholder-shim){
78 $static-font-size: ceil(($mdb-label-static-size-ratio * $placeholder-font-size)) !default;
79 $static-line-height: ($mdb-label-static-size-ratio * $line-height) !default;
81 $label-as-placeholder-top: -1 * ($vertical-padding + $label-as-placeholder-shim) !default;
82 $label-top: $label-as-placeholder-top - ($placeholder-font-size + $vertical-padding) !default;
84 $help-block-font-size: ceil(($mdb-help-block-size-ratio * $placeholder-font-size)) !default;
85 $help-block-line-height: ($mdb-help-block-size-ratio * $line-height) !default;
87 // this is outside a form-group
89 @include label-size-variant($placeholder-font-size, $vertical-padding, $line-height, $static-font-size, $static-line-height, $help-block-font-size);
92 // this is inside a form-group, may be .form-group.form-group-sm or .form-group.form-group-lg
95 @include label-size-variant($placeholder-font-size, $vertical-padding, $line-height, $static-font-size, $static-line-height, $help-block-font-size);
97 // form-group padding-bottom
98 // upon collapsing margins, the largest margin is honored which collapses the form-control margin-bottom,
99 // so the form-control margin-bottom must also be expressed as form-group padding
100 padding-bottom: $vertical-padding;
102 // form-group margin-top must be large enough for the label and the label's top padding since label is absolutely positioned
103 margin: ($label-top-margin + $static-font-size) 0 0 0;
105 // larger labels as placeholders
107 &.label-placeholder {
108 label.control-label {
109 top: $label-as-placeholder-top; // place the floating label to look like a placeholder with input padding
110 font-size: $placeholder-font-size;
111 line-height: $line-height;
115 // static, focused, or autofill floating labels
117 &.label-floating.is-focused,
118 &.label-floating:not(.is-empty) {
119 @include label-static($label-top, $static-font-size, $static-line-height);
121 // #559 Fix for webkit/chrome autofill - rule must be separate because it breaks firefox otherwise #731
122 &.label-floating input.form-control:-webkit-autofill ~ label.control-label {
123 @include label-static($label-top, $static-font-size, $static-line-height);
133 .form-group .form-control {
135 background-image: linear-gradient($brand-primary, $brand-primary), linear-gradient($mdb-input-underline-color, $mdb-input-underline-color);
136 background-size: 0 2px, 100% 1px;
137 background-repeat: no-repeat;
138 background-position: center bottom, center calc(100% - 1px);
139 background-color: rgba(0, 0, 0, 0);
140 transition: background 0s ease-out;
147 // Placeholders and and labels-as-placeholders should look the same
148 @include material-placeholder {
149 color: $mdb-input-placeholder-color;
154 //&:textarea { // appears to be an invalid selector
160 fieldset[disabled] & {
161 background-color: rgba(0, 0, 0, 0);
165 fieldset[disabled] & {
166 background-image: none;
167 border-bottom: 1px dotted $mdb-input-underline-color;
172 // Labels with form-group signalled state
174 // Reference http://www.google.com/design/spec/components/text-fields.html
175 // MDL implementation: http://www.getmdl.io/components/index.html#textfields-section
176 //.variations(unquote(" label.control-label"), color, $mdb-input-placeholder-color); // default label color variations
182 // Labels with form-group signalled state
184 // Reference http://www.google.com/design/spec/components/text-fields.html
185 // MDL implementation: http://www.getmdl.io/components/index.html#textfields-section
189 label.control-label {
191 pointer-events: none;
192 transition: 0.3s ease all;
196 // hint to browser for optimization
197 // TODO: evaluate effectiveness - looking for community feedback
198 &.label-floating label.control-label {
199 will-change: left, top, contents;
202 // hide label-placeholders when the field is not empty
203 &.label-placeholder:not(.is-empty){
209 // Help blocks - position: absolute approach - uses no vertical space, text wrapping - not so good.
211 position: absolute; // do not use position: absolute because width/wrapping isn't automatic and overflows occur
215 // form-group is-focused display
219 background-image: linear-gradient($brand-primary, $brand-primary), linear-gradient($mdb-input-underline-color, $mdb-input-underline-color);
220 background-size: 100% 2px, 100% 1px;
222 transition-duration: 0.3s;
224 .material-input:after {
225 background-color: $brand-primary;
229 //.variations(unquote(".is-focused label.control-label"), color, $brand-primary); // focused label color variations
231 label.control-label {
232 color: $brand-primary;
235 //.variations(unquote(".is-focused.label-placeholder label.control-label"), color, $mdb-input-placeholder-color); // default label color variations
236 &.label-placeholder {
238 label.control-label {
239 color: $mdb-input-placeholder-color;
248 @include form-group-validation-state(has-warning, $brand-warning);
249 @include form-group-validation-state(has-error, $brand-danger);
250 @include form-group-validation-state(has-success, $brand-success);
251 @include form-group-validation-state(has-info, $brand-info);
255 & ~ .form-control-highlight {
261 appearance: none; // Fix for OS X
263 & ~ .material-input:after {
269 // default floating size/location without a form-group (will skip form-group styles, and just render default sizing variation)
270 @include form-group-size-variant(null, $mdb-input-font-size-base, $mdb-label-top-margin-base, $mdb-input-padding-base-vertical, $mdb-input-line-height-base, $mdb-label-as-placeholder-shim-base);
272 // default floating size/location with a form-group (need margin etc from a default form-group)
273 @include form-group-size-variant(unquote(".form-group"), $mdb-input-font-size-base, $mdb-label-top-margin-base, $mdb-input-padding-base-vertical, $mdb-input-line-height-base, $mdb-label-as-placeholder-shim-base);
275 // sm floating size/location
276 @include form-group-size-variant(unquote(".form-group.form-group-sm"), $mdb-input-font-size-small, $mdb-label-top-margin-small, $mdb-input-padding-small-vertical, $mdb-input-line-height-small, $mdb-label-as-placeholder-shim-small);
278 // lg floating size/location
279 @include form-group-size-variant(unquote(".form-group.form-group-lg"), $mdb-input-font-size-large, $mdb-label-top-margin-large, $mdb-input-padding-large-vertical, $mdb-input-line-height-large, $mdb-label-as-placeholder-shim-large);
282 select.form-control {
288 .form-group.is-focused & {
290 border-color: $mdb-input-underline-color;
295 .form-group.is-focused & {
301 @mixin input-group-button-variation($vertical-padding){
304 margin: 0 0 $vertical-padding 0;
310 // input group/addon related styles
312 // default margin - no form-group required
313 @include input-group-button-variation($mdb-input-padding-base-vertical);
322 @include input-group-button-variation($mdb-input-padding-small-vertical);
327 @include input-group-button-variation($mdb-input-padding-large-vertical);
331 .input-group { // may be in or outside of form-group
333 padding: 0 12px; // match addon spacing
338 background: transparent;
339 padding: 12px 15px 0px;
343 // Input files - hide actual input - requires specific markup in the sample.
344 .form-group input[type=file] {
357 .form-control-feedback{