/*
 * Copyright (c) 2008-2016 Haulmont.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

@mixin halo-cuba-textfield($primary-stylename: v-textfield) {
  .#{$primary-stylename}.c-disabled-or-readonly.c-empty-value {
    color: transparent;
  }

  .#{$primary-stylename}-readonly:focus {
    border-color: $v-focus-color;
  }

  .v-caption-icon > img.v-icon {
    height: round($v-unit-size/2);
    width: round($v-unit-size/2);
  }

  .v-slot-inline-icon > .v-caption-on-top,
  .c-fglayout-slot:not(.inline) {
    & > .v-caption-inline-icon {
      & > .v-icon {
        bottom: auto;
        left: auto;

        // Move the icon if TextField has a caption
        &:not(:only-child) {
          $caption-padding-bottom: $v-font-size * 0.3;
          $caption-font-height: $v-font-size * $v-line-height;
          margin-top: $caption-padding-bottom + $caption-font-height;
        }
      }

      & > span.v-icon {
        padding-left: first-number($v-textfield-border);
      }

      & > img.v-icon {
        padding-top: round($v-unit-size/4);
        padding-left: round($v-unit-size/4);
      }
    }
  }
}