//
// Copyright 2019 Stijn de Witt. Some rights reserved.
// Licensed under the MIT Open Source license. 
// https://opensource.org/licenses/MIT
// See LICENSE for details.
//
// Based on code copyright 2018 Google Inc. All Rights Reserved.
// Licensed under the Apache License, Version 2.0.
// http://www.apache.org/licenses/LICENSE-2.0
// See LICENSE-MDC for details.
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under these licenses is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the licenses for the specific language governing permissions and
// limitations under these licenses.
// 

@import "../floating-label/mixins";
@import "../theme/mixins";
@import "../line-ripple/mixins";

// Public

@mixin mdc-select-ink-color($color) {
  &:not(.mdc-select--disabled) {
    @include mdc-select-ink-color_($color);
  }
}

@mixin mdc-select-container-fill-color($color) {
  &:not(.mdc-select--disabled) {
    @include mdc-select-container-fill-color_($color);
  }
}

@mixin mdc-select-focused-label-color($color) {
  &:not(.mdc-select--disabled) {
    .mdc-select__native-control:focus ~ .mdc-floating-label {
      @include mdc-floating-label-ink-color(mdc-theme-prop-value($color));
    }
  }
}

@mixin mdc-select-hover-bottom-line-color($color) {
  &:not(.mdc-select--disabled) .mdc-select__native-control:hover {
    @include mdc-select-native-control-bottom-line-color_($color);
  }
}

@mixin mdc-select-bottom-line-color($color) {
  &:not(.mdc-select--disabled) {
    @include mdc-select-bottom-line-color_($color);
  }
}

@mixin mdc-select-focused-bottom-line-color($color) {
  &:not(.mdc-select--disabled) {
    @include mdc-select-focused-line-ripple-color_($color);
  }
}

@mixin mdc-select-label-color($color) {
  &:not(.mdc-select--disabled) .mdc-floating-label {
    @include mdc-floating-label-ink-color($color);
  }
}

// Private
@mixin mdc-select-focused-line-ripple_ {
  .mdc-select__native-control:focus ~ .mdc-line-ripple {
    @content;
  }
}

@mixin mdc-select-ink-color_($color) {
  .mdc-select__native-control {
    @include mdc-theme-prop(color, $color);
  }
}

@mixin mdc-select-container-fill-color_($color) {
  @include mdc-theme-prop(background-color, $color);
}

@mixin mdc-select-bottom-line-color_($color) {
  .mdc-select__native-control {
    @include mdc-select-native-control-bottom-line-color_($color);
  }
}

@mixin mdc-select-native-control-bottom-line-color_($color) {
  border-bottom-color: $color;
}

@mixin mdc-select-focused-line-ripple-color_($color) {
  @include mdc-select-focused-line-ripple_ {
    @include mdc-line-ripple-color($color);
  }
}

@mixin mdc-select-dd-arrow-svg-bg_($fill-hex-number: 000000, $opacity: .54) {
  background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2210px%22%20height%3D%225px%22%20viewBox%3D%227%2010%2010%205%22%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%3E%0A%20%20%20%20%3Cpolygon%20id%3D%22Shape%22%20stroke%3D%22none%22%20fill%3D%22%23#{$fill-hex-number}%22%20fill-rule%3D%22evenodd%22%20opacity%3D%22#{$opacity}%22%20points%3D%227%2010%2012%2015%2017%2010%22%3E%3C%2Fpolygon%3E%0A%3C%2Fsvg%3E");
}
