bsw/jbe@1309: /** bsw/jbe@1309: * Copyright 2015 Google Inc. All Rights Reserved. bsw/jbe@1309: * bsw/jbe@1309: * Licensed under the Apache License, Version 2.0 (the "License"); bsw/jbe@1309: * you may not use this file except in compliance with the License. bsw/jbe@1309: * You may obtain a copy of the License at bsw/jbe@1309: * bsw/jbe@1309: * http://www.apache.org/licenses/LICENSE-2.0 bsw/jbe@1309: * bsw/jbe@1309: * Unless required by applicable law or agreed to in writing, software bsw/jbe@1309: * distributed under the License is distributed on an "AS IS" BASIS, bsw/jbe@1309: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. bsw/jbe@1309: * See the License for the specific language governing permissions and bsw/jbe@1309: * limitations under the License. bsw/jbe@1309: */ bsw/jbe@1309: bsw/jbe@1309: @import "../variables"; bsw/jbe@1309: @import "../mixins"; bsw/jbe@1309: bsw/jbe@1309: // The container for the whole component. bsw/jbe@1309: .mdl-textfield { bsw/jbe@1309: position: relative; bsw/jbe@1309: font-size: $input-text-font-size; bsw/jbe@1309: display: inline-block; bsw/jbe@1309: box-sizing: border-box; bsw/jbe@1309: width: 300px; bsw/jbe@1309: max-width: 100%; bsw/jbe@1309: margin: 0; bsw/jbe@1309: padding: $input-text-vertical-spacing 0; bsw/jbe@1309: bsw/jbe@1309: // Align buttons, if used. bsw/jbe@1309: & .mdl-button { bsw/jbe@1309: position: absolute; bsw/jbe@1309: bottom: $input-text-vertical-spacing; bsw/jbe@1309: } bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // Optional class to align right. bsw/jbe@1309: .mdl-textfield--align-right { bsw/jbe@1309: text-align: right; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // Optional class to display at full width. bsw/jbe@1309: .mdl-textfield--full-width { bsw/jbe@1309: width: 100%; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // Optional class to make the text field expandable. bsw/jbe@1309: .mdl-textfield--expandable { bsw/jbe@1309: min-width: $input-text-button-size; bsw/jbe@1309: width: auto; bsw/jbe@1309: min-height: $input-text-button-size; bsw/jbe@1309: bsw/jbe@1309: // Align icon button bsw/jbe@1309: .mdl-button--icon { bsw/jbe@1309: top: $input-text-expandable-icon-top; bsw/jbe@1309: } bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // Styling for the input element. bsw/jbe@1309: .mdl-textfield__input { bsw/jbe@1309: border: none; bsw/jbe@1309: border-bottom: 1px solid $input-text-bottom-border-color; bsw/jbe@1309: display: block; bsw/jbe@1309: font-size: $input-text-font-size; bsw/jbe@1309: font-family: $performance_font; bsw/jbe@1309: margin: 0; bsw/jbe@1309: padding: $input-text-padding 0; bsw/jbe@1309: width: $input-text-width; bsw/jbe@1309: background: none; bsw/jbe@1309: text-align: left; bsw/jbe@1309: color: inherit; bsw/jbe@1309: bsw/jbe@1309: &[type="number"] { bsw/jbe@1309: -moz-appearance: textfield; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: &[type="number"]::-webkit-inner-spin-button, bsw/jbe@1309: &[type="number"]::-webkit-outer-spin-button { bsw/jbe@1309: -webkit-appearance: none; bsw/jbe@1309: margin: 0; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield.is-focused & { bsw/jbe@1309: outline: none; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield.is-invalid & { bsw/jbe@1309: border-color: $input-text-error-color; bsw/jbe@1309: box-shadow: none; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: fieldset[disabled] .mdl-textfield &, bsw/jbe@1309: .mdl-textfield.is-disabled & { bsw/jbe@1309: background-color: transparent; bsw/jbe@1309: border-bottom: 1px dotted $input-text-disabled-color; bsw/jbe@1309: color: $input-text-disabled-text-color; bsw/jbe@1309: } bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield textarea.mdl-textfield__input { bsw/jbe@1309: display: block; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // Styling for the label / floating label. bsw/jbe@1309: .mdl-textfield__label { bsw/jbe@1309: bottom: 0; bsw/jbe@1309: color: $input-text-label-color; bsw/jbe@1309: font-size: $input-text-font-size; bsw/jbe@1309: left: 0; bsw/jbe@1309: right: 0; bsw/jbe@1309: pointer-events: none; bsw/jbe@1309: position: absolute; bsw/jbe@1309: display: block; bsw/jbe@1309: top: ($input-text-padding + $input-text-vertical-spacing); bsw/jbe@1309: width: 100%; bsw/jbe@1309: overflow: hidden; bsw/jbe@1309: white-space: nowrap; bsw/jbe@1309: text-align: left; bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield.is-dirty &, bsw/jbe@1309: .mdl-textfield.has-placeholder & { bsw/jbe@1309: visibility: hidden; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // Floating Label bsw/jbe@1309: .mdl-textfield--floating-label & { bsw/jbe@1309: @include material-animation-default(); bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield--floating-label.has-placeholder & { bsw/jbe@1309: transition: none; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: fieldset[disabled] .mdl-textfield &, bsw/jbe@1309: .mdl-textfield.is-disabled.is-disabled & { bsw/jbe@1309: color: $input-text-disabled-text-color; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield--floating-label.is-focused &, bsw/jbe@1309: .mdl-textfield--floating-label.is-dirty &, bsw/jbe@1309: .mdl-textfield--floating-label.has-placeholder & { bsw/jbe@1309: color: $input-text-highlight-color; bsw/jbe@1309: font-size : $input-text-floating-label-fontsize; bsw/jbe@1309: top: $input-text-vertical-spacing - ($input-text-floating-label-fontsize + $input-text-padding); bsw/jbe@1309: visibility: visible; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield--floating-label.is-focused .mdl-textfield__expandable-holder &, bsw/jbe@1309: .mdl-textfield--floating-label.is-dirty .mdl-textfield__expandable-holder &, bsw/jbe@1309: .mdl-textfield--floating-label.has-placeholder .mdl-textfield__expandable-holder & { bsw/jbe@1309: top: -($input-text-floating-label-fontsize + $input-text-padding); bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield--floating-label.is-invalid & { bsw/jbe@1309: color: $input-text-error-color; bsw/jbe@1309: font-size: $input-text-floating-label-fontsize; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // The after label is the colored underline for the TextField. bsw/jbe@1309: &:after { bsw/jbe@1309: background-color: $input-text-highlight-color; bsw/jbe@1309: bottom: $input-text-vertical-spacing; bsw/jbe@1309: content: ''; bsw/jbe@1309: height: 2px; bsw/jbe@1309: left: 45%; bsw/jbe@1309: position: absolute; bsw/jbe@1309: @include material-animation-default(); bsw/jbe@1309: visibility: hidden; bsw/jbe@1309: width: 10px; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield.is-focused &:after { bsw/jbe@1309: left: 0; bsw/jbe@1309: visibility: visible; bsw/jbe@1309: width: 100%; bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield.is-invalid &:after { bsw/jbe@1309: background-color: $input-text-error-color; bsw/jbe@1309: } bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // TextField Error. bsw/jbe@1309: .mdl-textfield__error { bsw/jbe@1309: color: $input-text-error-color; bsw/jbe@1309: position: absolute; bsw/jbe@1309: font-size: $input-text-floating-label-fontsize; bsw/jbe@1309: margin-top: 3px; bsw/jbe@1309: visibility: hidden; bsw/jbe@1309: display: block; bsw/jbe@1309: bsw/jbe@1309: .mdl-textfield.is-invalid & { bsw/jbe@1309: visibility: visible; bsw/jbe@1309: } bsw/jbe@1309: } bsw/jbe@1309: bsw/jbe@1309: // Expandable Holder. bsw/jbe@1309: .mdl-textfield__expandable-holder { bsw/jbe@1309: display: inline-block; bsw/jbe@1309: position: relative; bsw/jbe@1309: margin-left: $input-text-button-size; bsw/jbe@1309: bsw/jbe@1309: @include material-animation-default(); bsw/jbe@1309: display: inline-block; bsw/jbe@1309: bsw/jbe@1309: // Safari (possibly others) need to be convinced that this field is actually bsw/jbe@1309: // visible, otherwise it cannot be tabbed to nor focused via a