/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

@use "@material/animation";
@use "@material/base";
@use "@material/rtl";
@use "@material/typography";
@use "@material/floating-label" as floatinglabel;

// Floating Label is intended for use by multiple components, but its styles should only be emitted once when bundled
@include base.emit-once('mdc-floating-label') {
  // postcss-bem-linter: define floating-label
  :host {
    @include typography.typography(subtitle1);

    position: absolute;
    /* @noflip */
    left: 0;
    /* @noflip */
    transform-origin: left top;
    transition: transform floatinglabel.$transition-duration
        animation.$standard-curve-timing-function,
      color floatinglabel.$transition-duration
        animation.$standard-curve-timing-function;
    /* @alternate */
    line-height: 1.15rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
    overflow: hidden;
    // Force the label into its own layer to prevent visible layer promotion adjustments
    // when the ripple is activated behind it.
    will-change: transform;

    @include rtl.rtl() {
      /* @noflip */
      right: 0;
      /* @noflip */
      left: auto;
      /* @noflip */
      transform-origin: right top;
      /* @noflip */
      text-align: right;
    }
  }

  :host(.--float-above) {
    cursor: auto;
  }

  @at-root {
    @include floatinglabel.float-position(floatinglabel.$position-y);
    @include floatinglabel.shake-animation(standard);
  }

  @include floatinglabel.shake-keyframes(standard, floatinglabel.$position-y);
}
