diff --git a/src/demo-app/a11y/select/select-a11y.html b/src/demo-app/a11y/select/select-a11y.html index 26599933be10..4ca8f71378dd 100644 --- a/src/demo-app/a11y/select/select-a11y.html +++ b/src/demo-app/a11y/select/select-a11y.html @@ -2,71 +2,89 @@

Single selection

Select your favorite color

- - - {{ color.label }} - - + + + + {{ color.label }} + + +

Multiple selection

Pick toppings for your pizza

- - - {{ topping.label }} - - + + + + {{ topping.label }} + + +

Grouped options

Pick your Pokemon

- - - - {{ creature.label }} - - - + + + + + {{ creature.label }} + + + +

Colors

- - 2000 - 2100 - + + + 2000 + 2100 + + - - Alaska - Alabama - + + + Alaska + Alabama + + - - English - Spanish - + + + English + Spanish + +
- - Mihiramon - Sandiramon - + + + Mihiramon + Sandiramon + + - - Water - Coke - + + + Water + Coke + + - - Light - Dark - + + + Light + Dark + +
diff --git a/src/demo-app/baseline/baseline-demo.html b/src/demo-app/baseline/baseline-demo.html index fa30ca0d8aaf..ba4568cb36d5 100644 --- a/src/demo-app/baseline/baseline-demo.html +++ b/src/demo-app/baseline/baseline-demo.html @@ -14,9 +14,12 @@ | Text 5 | - - Option - + + + Option + This option is really really really long + + | Text 6 | @@ -42,9 +45,12 @@

| Text 5 | - - Option - + + + Option + This option is really really really long + + | Text 6 | diff --git a/src/demo-app/dialog/dialog-demo.html b/src/demo-app/dialog/dialog-demo.html index 37efd6e028f7..e5d40ad94b34 100644 --- a/src/demo-app/dialog/dialog-demo.html +++ b/src/demo-app/dialog/dialog-demo.html @@ -56,11 +56,13 @@

Dialog backdrop

Other options

- - Start - End - Center - + + + Start + End + Center + +

diff --git a/src/demo-app/select/select-demo.html b/src/demo-app/select/select-demo.html index 8fad21eb8a7c..c673924d5933 100644 --- a/src/demo-app/select/select-demo.html +++ b/src/demo-app/select/select-demo.html @@ -6,13 +6,18 @@ ngModel - - None - - {{ drink.viewValue }} - - + + + None + + {{ drink.viewValue }} + + + local_drink + Pick a drink! + You must make a selection +

Value: {{ currentDrink }}

Touched: {{ drinkControl.touched }}

Dirty: {{ drinkControl.dirty }}

@@ -28,7 +33,9 @@

@@ -42,12 +49,14 @@ Multiple selection - - - {{ creature.viewValue }} - - + + + + {{ creature.viewValue }} + + +

Value: {{ currentPokemon }}

Touched: {{ pokemonControl.touched }}

Dirty: {{ pokemonControl.dirty }}

@@ -68,12 +77,14 @@ Without Angular forms - - None - - {{ creature.viewValue }} - - + + + None + + {{ creature.viewValue }} + + +

Value: {{ currentDigimon }}

@@ -85,14 +96,16 @@ Option groups - - - - {{ creature.viewValue }} - - - + + + + + {{ creature.viewValue }} + + + +
@@ -100,15 +113,17 @@ compareWith - - - {{ drink.viewValue }} - - + + + + {{ drink.viewValue }} + + +

Value: {{ currentDrinkObject | json }}

Touched: {{ drinkObjectControl.touched }}

Dirty: {{ drinkObjectControl.dirty }}

@@ -130,9 +145,11 @@ formControl - - {{ food.viewValue }} - + + + {{ food.viewValue }} + +

Value: {{ foodControl.value }}

Touched: {{ foodControl.touched }}

Dirty: {{ foodControl.dirty }}

@@ -149,9 +166,11 @@ Change event - - {{ creature.viewValue }} - + + + {{ creature.viewValue }} + +

Change event value: {{ latestChangeEvent?.value }}

diff --git a/src/demo-app/select/select-demo.scss b/src/demo-app/select/select-demo.scss index 8380da8d2be2..f87b50cbe96b 100644 --- a/src/demo-app/select/select-demo.scss +++ b/src/demo-app/select/select-demo.scss @@ -7,4 +7,8 @@ margin: 24px; } + .demo-drink-icon { + vertical-align: bottom; + padding-right: 0.25em; + } } diff --git a/src/demo-app/snack-bar/snack-bar-demo.html b/src/demo-app/snack-bar/snack-bar-demo.html index 4d0634e59b74..c2f8171c1cc4 100644 --- a/src/demo-app/snack-bar/snack-bar-demo.html +++ b/src/demo-app/snack-bar/snack-bar-demo.html @@ -5,17 +5,21 @@

SnackBar demo

Position in page:
- - Start - End - Left - Right - Center - - - Top - Bottom - + + + Start + End + Left + Right + Center + + + + + Top + Bottom + +
diff --git a/src/lib/chips/chip-list.ts b/src/lib/chips/chip-list.ts index caa58d318872..487dceacdf3c 100644 --- a/src/lib/chips/chip-list.ts +++ b/src/lib/chips/chip-list.ts @@ -81,6 +81,7 @@ export class MdChipListChange { }) export class MdChipList implements MdFormFieldControl, ControlValueAccessor, AfterContentInit, OnInit, OnDestroy { + readonly controlType = 'mat-chip-list'; /** * Stream that emits whenever the state of the input changes such that the wrapping `MdFormField` @@ -238,6 +239,10 @@ export class MdChipList implements MdFormFieldControl, ControlValueAccessor return (!this._chipInput || this._chipInput.empty) && this.chips.length === 0; } + get shouldPlaceholderFloat(): boolean { + return this.empty; + } + /** Whether this chip-list is disabled. */ @Input() get disabled() { return this.ngControl ? this.ngControl.disabled : this._disabled; } @@ -387,6 +392,10 @@ export class MdChipList implements MdFormFieldControl, ControlValueAccessor this.stateChanges.next(); } + onContainerClick() { + this.focus(); + } + /** * Focuses the the first non-disabled chip in this chip list, or the associated input when there * are no eligible chips. diff --git a/src/lib/core/option/_option.scss b/src/lib/core/option/_option.scss index bf9e20c2d3f5..109f1ecc3d99 100644 --- a/src/lib/core/option/_option.scss +++ b/src/lib/core/option/_option.scss @@ -29,6 +29,14 @@ } } + // Collapses unwanted whitespace created by newlines in code like the following: + // + // {{value}} + // + .mat-option-text { + display: inline-block; + } + .mat-option-ripple { @include mat-fill; diff --git a/src/lib/core/option/option.html b/src/lib/core/option/option.html index a9b7b2e63374..7bf76128c4aa 100644 --- a/src/lib/core/option/option.html +++ b/src/lib/core/option/option.html @@ -3,7 +3,8 @@ [state]="selected ? 'checked' : ''" [disabled]="disabled"> - + +
diff --git a/src/lib/form-field/_form-field-theme.scss b/src/lib/form-field/_form-field-theme.scss index 9576bfa0e29a..010b6b368ce5 100644 --- a/src/lib/form-field/_form-field-theme.scss +++ b/src/lib/form-field/_form-field-theme.scss @@ -14,7 +14,7 @@ // Placeholder colors. Required is used for the `*` star shown in the placeholder. $placeholder-color: mat-color($foreground, secondary-text); - $floating-placeholder-color: mat-color($primary); + $focused-placeholder-color: mat-color($primary); $required-placeholder-color: mat-color($accent); // Underline colors. @@ -38,7 +38,7 @@ } .mat-focused .mat-form-field-placeholder { - color: $floating-placeholder-color; + color: $focused-placeholder-color; &.mat-accent { color: $underline-color-accent; @@ -49,11 +49,8 @@ } } - .mat-form-field-autofill-control:-webkit-autofill + .mat-form-field-placeholder, - .mat-focused .mat-form-field-placeholder.mat-form-field-float { - .mat-form-field-required-marker { - color: $required-placeholder-color; - } + .mat-focused .mat-form-field-required-marker { + color: $required-placeholder-color; } .mat-form-field-underline { @@ -84,7 +81,7 @@ color: $underline-color-warn; &.mat-accent, - &.mat-form-field-float .mat-form-field-required-marker { + .mat-form-field-required-marker { color: $underline-color-warn; } } @@ -109,8 +106,7 @@ translateZ(0.001px); // The tricks above used to smooth out the animation on chrome and firefox actually make things // worse on IE, so we don't include them in the IE version. - -ms-transform: translateY(-$infix-margin-top - $infix-padding) - scale($font-scale); + -ms-transform: translateY(-$infix-margin-top - $infix-padding) scale($font-scale); width: 100% / $font-scale; } @@ -184,11 +180,17 @@ border-top: $infix-margin-top solid transparent; } - .mat-form-field-autofill-control { - &:-webkit-autofill + .mat-form-field-placeholder-wrapper .mat-form-field-float { + .mat-form-field-can-float { + &.mat-form-field-should-float .mat-form-field-placeholder { @include _mat-form-field-placeholder-floating( $subscript-font-scale, $infix-padding, $infix-margin-top); } + + .mat-form-field-autofill-control:-webkit-autofill + .mat-form-field-placeholder-wrapper + .mat-form-field-placeholder { + @include _mat-form-field-placeholder-floating( + $subscript-font-scale, $infix-padding, $infix-margin-top); + } } .mat-form-field-placeholder-wrapper { @@ -198,13 +200,6 @@ .mat-form-field-placeholder { top: $infix-margin-top + $infix-padding; - - // Show the placeholder above the control when it's not empty, or focused. - &.mat-form-field-float:not(.mat-form-field-empty), - .mat-focused &.mat-form-field-float { - @include _mat-form-field-placeholder-floating($subscript-font-scale, - $infix-padding, $infix-margin-top); - } } .mat-form-field-underline { diff --git a/src/lib/form-field/form-field-control.ts b/src/lib/form-field/form-field-control.ts index 98a6ea02089b..8bbf3b6cf12c 100644 --- a/src/lib/form-field/form-field-control.ts +++ b/src/lib/form-field/form-field-control.ts @@ -36,6 +36,9 @@ export abstract class MdFormFieldControl { /** Whether the control is empty. */ readonly empty: boolean; + /** Whether the `MdFormField` label should try to float. */ + readonly shouldPlaceholderFloat: boolean; + /** Whether the control is required. */ readonly required: boolean; @@ -45,9 +48,16 @@ export abstract class MdFormFieldControl { /** Whether the control is in an error state. */ readonly errorState: boolean; + /** + * An optional name for the control type that can be used to distinguish `md-form-field` elements + * based on their control type. The form field will add a class, + * `mat-form-field-type-{{controlType}}` to its root element. + */ + readonly controlType?: string; + /** Sets the list of element IDs that currently describe this control. */ abstract setDescribedByIds(ids: string[]): void; - /** Focuses this control. */ - abstract focus(): void; + /** Handles a click on the control's container. */ + abstract onContainerClick(event: MouseEvent): void; } diff --git a/src/lib/form-field/form-field.html b/src/lib/form-field/form-field.html index 223cb79d0922..4bf46aec7a8a 100644 --- a/src/lib/form-field/form-field.html +++ b/src/lib/form-field/form-field.html @@ -1,5 +1,6 @@
-
+
@@ -15,8 +16,6 @@ [attr.aria-owns]="_control.id" [class.mat-empty]="_control.empty && !_shouldAlwaysFloat" [class.mat-form-field-empty]="_control.empty && !_shouldAlwaysFloat" - [class.mat-float]="_canPlaceholderFloat" - [class.mat-form-field-float]="_canPlaceholderFloat" [class.mat-accent]="color == 'accent'" [class.mat-warn]="color == 'warn'" #placeholder diff --git a/src/lib/form-field/form-field.scss b/src/lib/form-field/form-field.scss index 449f60ecb7db..33de45151f6e 100644 --- a/src/lib/form-field/form-field.scss +++ b/src/lib/form-field/form-field.scss @@ -59,23 +59,7 @@ $mat-form-field-underline-height: 1px !default; display: block; position: relative; flex: auto; -} - -// 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-form-field -// classes take over to fulfill this behaviour. Assumes the autofill is non-empty. -.mat-form-field-autofill-control:-webkit-autofill + .mat-form-field-placeholder-wrapper { - // The control is still technically empty at this point, so we need to hide non-floating - // placeholders to prevent overlapping with the autofilled value. - .mat-form-field-placeholder { - display: none; - } - - .mat-form-field-float { - display: block; - transition: none; - } + min-width: 0; } // Used to hide the placeholder overflow on IE, since IE doesn't take transform into account when @@ -120,12 +104,6 @@ $mat-form-field-underline-height: 1px !default; // Hide the placeholder initially, and only show it when it's floating or the control is empty. display: none; - &.mat-form-field-empty, - &.mat-form-field-float:not(.mat-form-field-empty), - .mat-focused &.mat-form-field-float { - display: block; - } - [dir='rtl'] & { transform-origin: 100% 0; left: auto; @@ -133,6 +111,28 @@ $mat-form-field-underline-height: 1px !default; } } +.mat-form-field-empty.mat-form-field-placeholder, +.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-placeholder { + display: block; +} + +// 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-form-field +// classes take over to fulfill this behaviour. +.mat-form-field-autofill-control:-webkit-autofill + .mat-form-field-placeholder-wrapper + .mat-form-field-placeholder { + // The form field will be considered empty if it is autofilled, and therefore the placeholder will + // be shown. Therefore we need to override it to hidden... + display: none; + + // ...and re-show it only if it's able to float. + .mat-form-field-can-float & { + display: block; + transition: none; + } +} + // Disable the placeholder animation when the control is not empty (this prevents placeholder // animating up when the value is set programmatically). .mat-form-field-placeholder:not(.mat-form-field-empty) { diff --git a/src/lib/form-field/form-field.ts b/src/lib/form-field/form-field.ts index c0644f2abdae..8d320f2f7fbc 100644 --- a/src/lib/form-field/form-field.ts +++ b/src/lib/form-field/form-field.ts @@ -22,7 +22,7 @@ import { Inject, Input, Optional, - QueryList, + QueryList, Renderer2, ViewChild, ViewEncapsulation, } from '@angular/core'; @@ -72,7 +72,12 @@ let nextUniqueId = 0; 'class': 'mat-input-container mat-form-field', '[class.mat-input-invalid]': '_control.errorState', '[class.mat-form-field-invalid]': '_control.errorState', + '[class.mat-form-field-can-float]': '_canPlaceholderFloat', + '[class.mat-form-field-should-float]': '_control.shouldPlaceholderFloat || _shouldAlwaysFloat', '[class.mat-focused]': '_control.focused', + '[class.mat-primary]': 'color == "primary"', + '[class.mat-accent]': 'color == "accent"', + '[class.mat-warn]': 'color == "warn"', '[class.ng-untouched]': '_shouldForward("untouched")', '[class.ng-touched]': '_shouldForward("touched")', '[class.ng-pristine]': '_shouldForward("pristine")', @@ -80,7 +85,6 @@ let nextUniqueId = 0; '[class.ng-valid]': '_shouldForward("valid")', '[class.ng-invalid]': '_shouldForward("invalid")', '[class.ng-pending]': '_shouldForward("pending")', - '(click)': '_control.focus()', }, encapsulation: ViewEncapsulation.None, preserveWhitespaces: false, @@ -155,7 +159,9 @@ export class MdFormField implements AfterViewInit, AfterContentInit, AfterConten @ContentChildren(MdSuffix) _suffixChildren: QueryList; constructor( - public _elementRef: ElementRef, private _changeDetectorRef: ChangeDetectorRef, + public _elementRef: ElementRef, + private _renderer: Renderer2, + private _changeDetectorRef: ChangeDetectorRef, @Optional() @Inject(MD_PLACEHOLDER_GLOBAL_OPTIONS) placeholderOptions: PlaceholderOptions) { this._placeholderOptions = placeholderOptions ? placeholderOptions : {}; this.floatPlaceholder = this._placeholderOptions.float || 'auto'; @@ -163,6 +169,10 @@ export class MdFormField implements AfterViewInit, AfterContentInit, AfterConten ngAfterContentInit() { this._validateControlChild(); + if (this._control.controlType) { + this._renderer.addClass( + this._elementRef.nativeElement, `mat-form-field-type-${this._control.controlType}`); + } // Subscribe to changes in the child control state in order to update the form field UI. startWith.call(this._control.stateChanges, null).subscribe(() => { diff --git a/src/lib/input/input.spec.ts b/src/lib/input/input.spec.ts index ba534a980a7e..5c083fdd825b 100644 --- a/src/lib/input/input.spec.ts +++ b/src/lib/input/input.spec.ts @@ -529,16 +529,16 @@ describe('MdInput without forms', function () { fixture.detectChanges(); let inputEl = fixture.debugElement.query(By.css('input')).nativeElement; - let labelEl = fixture.debugElement.query(By.css('label')).nativeElement; + let formFieldEl = fixture.debugElement.query(By.css('.mat-form-field')).nativeElement; - expect(labelEl.classList).not.toContain('mat-form-field-empty'); - expect(labelEl.classList).toContain('mat-form-field-float'); + expect(formFieldEl.classList).toContain('mat-form-field-can-float'); + expect(formFieldEl.classList).toContain('mat-form-field-should-float'); fixture.componentInstance.shouldFloat = 'auto'; fixture.detectChanges(); - expect(labelEl.classList).toContain('mat-form-field-empty'); - expect(labelEl.classList).toContain('mat-form-field-float'); + expect(formFieldEl.classList).toContain('mat-form-field-can-float'); + expect(formFieldEl.classList).not.toContain('mat-form-field-should-float'); // Update the value of the input. inputEl.value = 'Text'; @@ -546,8 +546,8 @@ describe('MdInput without forms', function () { // Fake behavior of the `(input)` event which should trigger a change detection. fixture.detectChanges(); - expect(labelEl.classList).not.toContain('mat-form-field-empty'); - expect(labelEl.classList).toContain('mat-form-field-float'); + expect(formFieldEl.classList).toContain('mat-form-field-can-float'); + expect(formFieldEl.classList).toContain('mat-form-field-should-float'); }); it('should always float the placeholder when floatPlaceholder is set to true', () => { @@ -555,10 +555,10 @@ describe('MdInput without forms', function () { fixture.detectChanges(); let inputEl = fixture.debugElement.query(By.css('input')).nativeElement; - let labelEl = fixture.debugElement.query(By.css('label')).nativeElement; + let formFieldEl = fixture.debugElement.query(By.css('.mat-form-field')).nativeElement; - expect(labelEl.classList).not.toContain('mat-form-field-empty'); - expect(labelEl.classList).toContain('mat-form-field-float'); + expect(formFieldEl.classList).toContain('mat-form-field-can-float'); + expect(formFieldEl.classList).toContain('mat-form-field-should-float'); fixture.detectChanges(); @@ -568,8 +568,8 @@ describe('MdInput without forms', function () { // Fake behavior of the `(input)` event which should trigger a change detection. fixture.detectChanges(); - expect(labelEl.classList).not.toContain('mat-form-field-empty'); - expect(labelEl.classList).toContain('mat-form-field-float'); + expect(formFieldEl.classList).toContain('mat-form-field-can-float'); + expect(formFieldEl.classList).toContain('mat-form-field-should-float'); }); diff --git a/src/lib/input/input.ts b/src/lib/input/input.ts index 6f02784aee05..85b47dce9dc5 100644 --- a/src/lib/input/input.ts +++ b/src/lib/input/input.ts @@ -55,7 +55,7 @@ let nextUniqueId = 0; 'class': 'mat-input-element mat-form-field-autofill-control', // Native input properties that are overwritten by Angular inputs need to be synced with // the native input element. Otherwise property bindings for those don't work. - '[id]': 'id', + '[attr.id]': 'id', '[placeholder]': 'placeholder', '[disabled]': 'disabled', '[required]': 'required', @@ -92,6 +92,9 @@ export class MdInput implements MdFormFieldControl, OnChanges, OnDestroy, D */ stateChanges = new Subject(); + /** A name for this control that can be used by `md-form-field`. */ + controlType = 'mat-input'; + /** Whether the element is disabled. */ @Input() get disabled() { return this.ngControl ? this.ngControl.disabled : this._disabled; } @@ -129,6 +132,7 @@ export class MdInput implements MdFormFieldControl, OnChanges, OnDestroy, D @Input() errorStateMatcher: ErrorStateMatcher; /** The input element's value. */ + @Input() get value() { return this._elementRef.nativeElement.value; } set value(value: string) { if (value !== this.value) { @@ -197,6 +201,8 @@ export class MdInput implements MdFormFieldControl, OnChanges, OnDestroy, D } } + focus() { this._elementRef.nativeElement.focus(); } + /** Callback for the cases where the focused state of the input changes. */ _focusChanged(isFocused: boolean) { if (isFocused !== this.focused) { @@ -278,9 +284,12 @@ export class MdInput implements MdFormFieldControl, OnChanges, OnDestroy, D !this._isBadInput(); } + // Implemented as part of MdFormFieldControl. + get shouldPlaceholderFloat(): boolean { return this.focused || !this.empty; } + // Implemented as part of MdFormFieldControl. setDescribedByIds(ids: string[]) { this._ariaDescribedby = ids.join(' '); } // Implemented as part of MdFormFieldControl. - focus() { this._elementRef.nativeElement.focus(); } + onContainerClick() { this.focus(); } } diff --git a/src/lib/paginator/paginator.html b/src/lib/paginator/paginator.html index 700efb48faaf..06297e5fb288 100644 --- a/src/lib/paginator/paginator.html +++ b/src/lib/paginator/paginator.html @@ -3,15 +3,16 @@ {{_intl.itemsPerPageLabel}}
- - - {{pageSizeOption}} - - + + + + {{pageSizeOption}} + + +
{{pageSize}}
diff --git a/src/lib/select/_select-theme.scss b/src/lib/select/_select-theme.scss index de7432ff3c30..685f8f2b82a1 100644 --- a/src/lib/select/_select-theme.scss +++ b/src/lib/select/_select-theme.scss @@ -3,17 +3,6 @@ @import '../core/style/form-common'; @import '../core/typography/typography-utils'; -@mixin _mat-select-inner-content-theme($palette) { - $color: mat-color($palette); - - .mat-select-trigger, .mat-select-arrow { - color: $color; - } - - .mat-select-underline { - background-color: $color; - } -} @mixin mat-select-theme($theme) { $foreground: map-get($theme, foreground); @@ -22,25 +11,9 @@ $accent: map-get($theme, accent); $warn: map-get($theme, warn); $is-dark-theme: map-get($theme, is-dark); - $underline-color: mat-color($foreground, divider, if($is-dark-theme, 0.7, 0.42)); - - .mat-select-trigger, - .mat-select-arrow { - color: mat-color($foreground, secondary-text); - } - - .mat-select-underline { - background-color: $underline-color; - } - - [aria-disabled='true'] .mat-select-underline { - // Since this is a dotted line, we need to make it slightly darker to get it to stand out. - @include mat-control-disabled-underline($underline-color); - } .mat-select-disabled .mat-select-value, - .mat-select-arrow, - .mat-select-trigger { + .mat-select-arrow { color: mat-color($foreground, secondary-text); } @@ -58,35 +31,44 @@ } } - .mat-select:focus:not(.mat-select-disabled) { - &.mat-primary { - @include _mat-select-inner-content-theme($primary); - } + .mat-form-field { + &.mat-focused { + &.mat-primary .mat-select-arrow { + color: mat-color($primary); + } + + &.mat-accent .mat-select-arrow { + color: mat-color($accent); + } - &.mat-accent { - @include _mat-select-inner-content-theme($accent); + &.mat-warn .mat-select-arrow { + color: mat-color($warn); + } } - &.mat-select-required .mat-select-placeholder::after { + .mat-select.mat-select-invalid .mat-select-arrow { color: mat-color($warn); } + + .mat-select.mat-select-disabled .mat-select-arrow { + color: mat-color($foreground, secondary-text); + } } - .mat-select:focus:not(.mat-select-disabled).mat-warn, .mat-select-invalid { - @include _mat-select-inner-content-theme($warn); + .mat-select.mat-select-disabled .mat-select-arrow { + color: mat-color($warn); } } @mixin mat-select-typography($config) { - $trigger-font-size: mat-font-size($config, subheading-2); + // The unit-less line-height from the font config. + $line-height: mat-line-height($config, input); .mat-select { - // Reserve enough space for the floating placeholder. - padding-top: $trigger-font-size; font-family: mat-font-family($config); } .mat-select-trigger { - font-size: $trigger-font-size; + height: $line-height * 1em; } } diff --git a/src/lib/select/public_api.ts b/src/lib/select/public_api.ts index ff3282c457e2..01ccc2f3e727 100644 --- a/src/lib/select/public_api.ts +++ b/src/lib/select/public_api.ts @@ -8,5 +8,5 @@ export * from './select-module'; export * from './select'; -export {fadeInContent, transformPanel, transformPlaceholder} from './select-animations'; +export * from './select-animations'; export * from './mat-exports'; diff --git a/src/lib/select/select-animations.ts b/src/lib/select/select-animations.ts index e92230508043..2813519212ef 100644 --- a/src/lib/select/select-animations.ts +++ b/src/lib/select/select-animations.ts @@ -22,25 +22,6 @@ import { * The values below match the implementation of the AngularJS Material md-select animation. */ -/** - * This animation shrinks the placeholder text to 75% of its normal size and translates - * it to either the top left corner (ltr) or top right corner (rtl) of the trigger, - * depending on the text direction of the application. - */ -export const transformPlaceholder: AnimationTriggerMetadata = trigger('transformPlaceholder', [ - state('floating-ltr', style({ - top: '-22px', - left: '-2px', - transform: 'scale(0.75)' - })), - state('floating-rtl', style({ - top: '-22px', - left: '2px', - transform: 'scale(0.75)' - })), - transition('* => *', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')) -]); - /** * This animation transforms the select's overlay panel on and off the page. * diff --git a/src/lib/select/select.html b/src/lib/select/select.html index e3c5823eea05..9379f0980a2e 100644 --- a/src/lib/select/select.html +++ b/src/lib/select/select.html @@ -1,26 +1,22 @@ -