@import "../common/varible";
@import "../common/animation";
@import "../common/function";
@import "option";

.yu-input {
  @include zoomInTopTransition();

  font-family: $font-family;
  position: relative;
  display: block;
  margin: 0 $space-small $space 0;
  font-size: 0;
  & > input {
    width: $input-length;
    padding: $space-tiny $space;
    outline: none;
    font-size: $normal;
    color: $text;
    font-family: $font-family;
    box-sizing: border-box;
    height: $height;
    &::placeholder {
      color: $text-lighter;
    }
    border: 1px solid $border;
    border-radius: $radius;
    &:hover {
      border: 1px solid $text-lighter;
    }
    &:focus {
      border: 1px solid $primary;
    }
    transition: all ease $transition-time;
    &.prefix {
      padding-left: $space-big;
    }
    &.suffix {
      padding-right: $space-big;
    }
    &.large {
      height: $height-large;
    }
    &.small {
      height: $height-small;
    }
    &.full {
      width: 100%;
    }
  }
  &.textarea {
    height: auto;
  }
  &.disabled {
    & > input {
      color: $text-lighter;
      background-color: $background;
      &:hover {
        border: 1px solid $border;
        cursor: not-allowed;
      }
      &:focus {
        border: 1px solid $border;
      }
    }
  }

  & > span.prefix {
    position: relative;
    color: $text-lighter;
    & > i {
      position: absolute;
      left: 10px;
      top: -14px;
    }
  }

  & > span.suffix {
    position: relative;
    color: $text-lighter;
    & > i {
      position: absolute;
      left: -25px;
      top: -14px;
    }
    &.clearable {
      & > i {
        transition: color .1s;
        cursor: pointer;
        &:hover {
          color: $text-light;
        }
      }
    }
  }

  & > textarea {
    padding: 8px;
    border-color: $border;
    border-radius: 4px;
    font-size: $normal;
    outline: none;
    box-sizing: border-box;
    &:hover {
      border: 1px solid $text-lighter;
    }
    &:focus {
      border: 1px solid $primary;
    }
    transition: all ease .4s;
    &::placeholder {
      color: $border-dark;
      font-weight: lighter;
    }
  }

  & > input.append {
    border-radius: $radius 0 0 $radius;
  }

  & > input.prepend {
    border-radius: 0 $radius $radius 0;
  }

  & > input.number {
    padding-right: 0;
  }

  & > .yu-button.prepend {
    margin: 0;
    border-radius: $radius 0 0 $radius;
    vertical-align: top;
  }
  & > .yu-button.append {
    margin: 0;
    border-radius: 0 $radius $radius 0;
    vertical-align: top;
  }

  &>.yu-option {
    margin-top: $space-small;
    position: absolute;
    top: 30px;
    left: 0;
    z-index: 1000;
  }
}
