//
// Copyright 2017 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions://
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

@import "@material/animation/variables";
@import "@material/theme/mixins";
@import "./variables";

@mixin mdc-checkbox-container-keyframes_(
  $from-stroke-color,
  $to-stroke-color,
  $from-fill-color,
  $to-fill-color,
  $uid) {
  @keyframes mdc-checkbox-fade-in-background-#{$uid} {
    0% {
      @include mdc-theme-prop(border-color, $from-stroke-color);
      @include mdc-theme-prop(background-color, $from-fill-color);
    }

    50% {
      @include mdc-theme-prop(border-color, $to-stroke-color);
      @include mdc-theme-prop(background-color, $to-fill-color);
    }
  }

  @keyframes mdc-checkbox-fade-out-background-#{$uid} {
    0%,
    80% {
      @include mdc-theme-prop(border-color, $to-stroke-color);
      @include mdc-theme-prop(background-color, $to-fill-color);
    }

    100% {
      @include mdc-theme-prop(border-color, $from-stroke-color);
      @include mdc-theme-prop(background-color, $from-fill-color);
    }
  }
}

@keyframes mdc-checkbox-unchecked-checked-checkmark-path {
  0%,
  50% {
    stroke-dashoffset: $mdc-checkbox-mark-path-length_;
  }

  50% {
    animation-timing-function: $mdc-animation-deceleration-curve-timing-function;
  }

  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes mdc-checkbox-unchecked-indeterminate-mixedmark {
  0%,
  68.2% {
    transform: scaleX(0);
  }

  68.2% {
    animation-timing-function: cubic-bezier(0, 0, 0, 1);
  }

  100% {
    transform: scaleX(1);
  }
}

@keyframes mdc-checkbox-checked-unchecked-checkmark-path {
  from {
    animation-timing-function: $mdc-animation-acceleration-curve-timing-function;
    opacity: 1;
    stroke-dashoffset: 0;
  }

  to {
    opacity: 0;
    stroke-dashoffset: $mdc-checkbox-mark-path-length_ * -1;
  }
}

@keyframes mdc-checkbox-checked-indeterminate-checkmark {
  from {
    animation-timing-function: $mdc-animation-deceleration-curve-timing-function;
    transform: rotate(0deg);
    opacity: 1;
  }

  to {
    transform: rotate(45deg);
    opacity: 0;
  }
}

@keyframes mdc-checkbox-indeterminate-checked-checkmark {
  from {
    animation-timing-function: $mdc-checkbox-indeterminate-checked-easing-function_;
    transform: rotate(45deg);
    opacity: 0;
  }

  to {
    transform: rotate(360deg);
    opacity: 1;
  }
}

@keyframes mdc-checkbox-checked-indeterminate-mixedmark {
  from {
    animation-timing-function: mdc-animation-deceleration-curve-timing-function;
    transform: rotate(-45deg);
    opacity: 0;
  }

  to {
    transform: rotate(0deg);
    opacity: 1;
  }
}

@keyframes mdc-checkbox-indeterminate-checked-mixedmark {
  from {
    animation-timing-function: $mdc-checkbox-indeterminate-checked-easing-function_;
    transform: rotate(0deg);
    opacity: 1;
  }

  to {
    transform: rotate(315deg);
    opacity: 0;
  }
}

@keyframes mdc-checkbox-indeterminate-unchecked-mixedmark {
  0% {
    animation-timing-function: linear;
    transform: scaleX(1);
    opacity: 1;
  }

  32.8%,
  100% {
    transform: scaleX(0);
    opacity: 0;
  }
}
