2016-12-09 15:17:10 -08:00
|
|
|
@import '../core/style/variables';
|
2017-01-26 10:03:09 -08:00
|
|
|
@import '../core/style/form-common';
|
|
|
|
|
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
$mat-input-floating-placeholder-scale-factor: 0.75 !default;
|
2017-01-26 10:03:09 -08:00
|
|
|
|
|
|
|
|
// Gradient for showing the dashed line when the input is disabled.
|
2017-02-08 11:24:31 -08:00
|
|
|
$mat-input-underline-disabled-background-image:
|
2017-01-26 10:03:09 -08:00
|
|
|
linear-gradient(to right, rgba(0, 0, 0, 0.26) 0%, rgba(0, 0, 0, 0.26) 33%, transparent 0%);
|
|
|
|
|
|
|
|
|
|
// Applies a floating placeholder above the input itself.
|
2017-02-08 11:24:31 -08:00
|
|
|
@mixin mat-input-placeholder-floating {
|
2017-01-26 10:03:09 -08:00
|
|
|
display: block;
|
2017-02-08 11:24:31 -08:00
|
|
|
transform: translateY(-1.35em) scale($mat-input-floating-placeholder-scale-factor);
|
|
|
|
|
width: 100% / $mat-input-floating-placeholder-scale-factor;
|
2017-01-26 10:03:09 -08:00
|
|
|
}
|
2016-12-09 15:17:10 -08:00
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-container {
|
2016-12-09 15:17:10 -08:00
|
|
|
display: inline-block;
|
|
|
|
|
position: relative;
|
2017-02-08 11:24:31 -08:00
|
|
|
font-family: $mat-font-family;
|
2016-12-09 15:17:10 -08:00
|
|
|
line-height: normal;
|
|
|
|
|
|
|
|
|
|
// To avoid problems with text-align.
|
|
|
|
|
text-align: left;
|
|
|
|
|
|
|
|
|
|
[dir='rtl'] & {
|
|
|
|
|
text-align: right;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-26 10:03:09 -08:00
|
|
|
// Global wrapper. We need to apply margin to the element for spacing, but
|
|
|
|
|
// cannot apply it to the host element directly.
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-wrapper {
|
2017-01-26 10:03:09 -08:00
|
|
|
margin: 1em 0;
|
|
|
|
|
// Account for the underline which has 4px of margin + 2px of border.
|
|
|
|
|
padding-bottom: 6px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// We use a table layout to baseline align the prefix and suffix classes.
|
|
|
|
|
// The underline is outside of it so it can cover all of the elements under
|
|
|
|
|
// this table.
|
|
|
|
|
// Flex does not respect the baseline. What we really want is akin to a table
|
|
|
|
|
// as want an inline-block where elements don't wrap.
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-table {
|
2017-01-26 10:03:09 -08:00
|
|
|
display: inline-table;
|
|
|
|
|
flex-flow: column;
|
|
|
|
|
vertical-align: bottom;
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
|
|
& > * {
|
|
|
|
|
display: table-cell;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-infix {
|
2017-01-26 10:03:09 -08:00
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The Input element proper.
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-element {
|
2017-01-26 10:03:09 -08:00
|
|
|
// Font needs to be inherited, because by default <input> has a system font.
|
|
|
|
|
font: inherit;
|
|
|
|
|
|
|
|
|
|
// The Material input should match whatever background it is above.
|
|
|
|
|
background: transparent;
|
|
|
|
|
|
|
|
|
|
// If background matches current background then so should the color for proper contrast
|
|
|
|
|
color: currentColor;
|
|
|
|
|
|
|
|
|
|
// By default, <input> has a padding, border, outline and a default width.
|
|
|
|
|
border: none;
|
|
|
|
|
outline: none;
|
|
|
|
|
padding: 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-end & {
|
2017-01-26 10:03:09 -08:00
|
|
|
text-align: right;
|
|
|
|
|
|
|
|
|
|
[dir='rtl'] & {
|
|
|
|
|
text-align: left;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Undo the red box-shadow glow added by Firefox on invalid inputs.
|
|
|
|
|
// See https://developer.mozilla.org/en-US/docs/Web/CSS/:-moz-ui-invalid
|
|
|
|
|
&:-moz-ui-invalid {
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Pseudo-class for Chrome and Safari auto-fill to move the placeholder to
|
|
|
|
|
// the floating position. This is necessary because these browsers do not actually
|
|
|
|
|
// fire any events when a form auto-fill is occurring.
|
|
|
|
|
// Once the autofill is committed, a change event happen and the regular md-input-container
|
|
|
|
|
// classes take over to fulfill this behaviour.
|
|
|
|
|
// Assumes the autofill is non-empty.
|
2017-02-08 11:24:31 -08:00
|
|
|
&:-webkit-autofill + .mat-input-placeholder.mat-float {
|
|
|
|
|
@include mat-input-placeholder-floating;
|
2017-01-26 10:03:09 -08:00
|
|
|
}
|
|
|
|
|
|
2017-01-05 17:34:03 -08:00
|
|
|
// Note that we can't use something like visibility: hidden or
|
|
|
|
|
// display: none, because IE ends up preventing the user from
|
|
|
|
|
// focusing the input altogether.
|
2016-12-09 15:17:10 -08:00
|
|
|
&::placeholder {
|
2017-01-05 17:34:03 -08:00
|
|
|
color: transparent;
|
|
|
|
|
}
|
|
|
|
|
&::-moz-placeholder {
|
|
|
|
|
color: transparent;
|
|
|
|
|
}
|
|
|
|
|
&::-webkit-input-placeholder {
|
|
|
|
|
color: transparent;
|
|
|
|
|
}
|
|
|
|
|
&:-ms-input-placeholder {
|
2016-12-20 23:52:10 +02:00
|
|
|
color: transparent;
|
2016-12-09 15:17:10 -08:00
|
|
|
}
|
2017-01-26 10:03:09 -08:00
|
|
|
}
|
2016-12-09 15:17:10 -08:00
|
|
|
|
2017-01-26 10:03:09 -08:00
|
|
|
// The placeholder label. This is invisible unless it is. The logic to show it is
|
|
|
|
|
// basically `empty || (float && (!empty || focused))`. Float is dependent on the
|
|
|
|
|
// `floatingPlaceholder` input.
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-placeholder {
|
2017-01-26 10:03:09 -08:00
|
|
|
// The placeholder is after the <input>, but needs to be aligned top-left of the
|
|
|
|
|
// infix <div>.
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
top: 0;
|
2016-12-09 15:17:10 -08:00
|
|
|
|
2017-01-26 10:03:09 -08:00
|
|
|
font-size: 100%;
|
|
|
|
|
pointer-events: none; // We shouldn't catch mouse events (let them through).
|
|
|
|
|
z-index: 1;
|
2017-02-09 23:09:11 +01:00
|
|
|
padding-top: 1em;
|
2017-01-26 10:03:09 -08:00
|
|
|
|
|
|
|
|
// Put ellipsis text overflow.
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: none;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
overflow-x: hidden;
|
|
|
|
|
|
|
|
|
|
transform: translateY(0);
|
|
|
|
|
transform-origin: bottom left;
|
|
|
|
|
transition: transform $swift-ease-out-duration $swift-ease-out-timing-function,
|
|
|
|
|
color $swift-ease-out-duration $swift-ease-out-timing-function,
|
|
|
|
|
width $swift-ease-out-duration $swift-ease-out-timing-function;
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
&.mat-empty {
|
2017-01-26 10:03:09 -08:00
|
|
|
display: block;
|
|
|
|
|
cursor: text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Show the placeholder above the input when it's not empty, or focused.
|
2017-02-16 16:57:12 -08:00
|
|
|
&.mat-float:not(.mat-empty), .mat-focused &.mat-float {
|
2017-02-08 11:24:31 -08:00
|
|
|
@include mat-input-placeholder-floating;
|
2017-01-26 10:03:09 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[dir='rtl'] & {
|
|
|
|
|
transform-origin: bottom right;
|
|
|
|
|
left: auto;
|
|
|
|
|
right: 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-09 23:09:11 +01:00
|
|
|
// Used to hide the placeholder overflow on IE, since IE doesn't take transform into account when
|
|
|
|
|
// determining overflow.
|
|
|
|
|
.mat-input-placeholder-wrapper {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 0;
|
|
|
|
|
top: -1em;
|
|
|
|
|
width: 100%;
|
|
|
|
|
padding-top: 1em;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
pointer-events: none; // We shouldn't catch mouse events (let them through).
|
|
|
|
|
|
|
|
|
|
// Keeps the element height since the placeholder text is `position: absolute`.
|
|
|
|
|
&::after {
|
2017-02-11 00:18:05 +01:00
|
|
|
content: '';
|
|
|
|
|
display: inline-table;
|
2017-02-09 23:09:11 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2017-01-26 10:03:09 -08:00
|
|
|
// The underline is what's shown under the input, its prefix and its suffix.
|
|
|
|
|
// The ripple is the blue animation coming on top of it.
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-underline {
|
2017-01-26 10:03:09 -08:00
|
|
|
position: absolute;
|
|
|
|
|
height: 1px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-top: 4px;
|
|
|
|
|
border-top-width: 1px;
|
|
|
|
|
border-top-style: solid;
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
&.mat-disabled {
|
|
|
|
|
@include mat-control-disabled-underline();
|
2017-01-26 10:03:09 -08:00
|
|
|
border-top: 0;
|
|
|
|
|
background-position: 0;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-ripple {
|
2017-01-26 10:03:09 -08:00
|
|
|
position: absolute;
|
|
|
|
|
height: 2px;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
top: -1px;
|
|
|
|
|
width: 100%;
|
|
|
|
|
transform-origin: top;
|
|
|
|
|
opacity: 0;
|
2017-03-01 14:01:58 -08:00
|
|
|
transition: opacity $swift-ease-out-duration $swift-ease-out-timing-function;
|
2017-01-26 10:03:09 -08:00
|
|
|
|
2017-02-16 16:57:12 -08:00
|
|
|
.mat-focused & {
|
2017-01-26 10:03:09 -08:00
|
|
|
opacity: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The hint is shown below the underline. There can be more than one; one at the start
|
|
|
|
|
// and one at the end.
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-hint {
|
2017-01-26 10:03:09 -08:00
|
|
|
display: block;
|
|
|
|
|
position: absolute;
|
|
|
|
|
font-size: 75%;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
&.mat-right {
|
2017-01-26 10:03:09 -08:00
|
|
|
right: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[dir='rtl'] & {
|
|
|
|
|
right: 0;
|
|
|
|
|
left: auto;
|
|
|
|
|
|
2017-02-08 11:24:31 -08:00
|
|
|
&.mat-right {
|
2017-01-26 10:03:09 -08:00
|
|
|
right: auto;
|
|
|
|
|
left: 0;
|
2016-12-09 15:17:10 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-01-12 22:24:37 +01:00
|
|
|
|
|
|
|
|
// Prevents the prefix and suffix from stretching together with the container.
|
2017-02-08 11:24:31 -08:00
|
|
|
.mat-input-prefix, .mat-input-suffix {
|
2017-01-12 22:24:37 +01:00
|
|
|
width: 0.1px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
}
|