//
// Copyright 2022 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.
//

// Selector '.mdc-*' should only be used in this project.
// stylelint-disable selector-class-pattern --
// NOTE: this is the implementation of the aforementioned classes.

@use 'sass:map';
@use '../theme/theme';
@use '../tokens/resolvers';
@use './select-theme';

$_light-theme: (
  menu-cascading-menu-indicator-icon-color: null,
  menu-cascading-menu-indicator-icon-size: null,
  menu-container-color: null,
  menu-container-elevation: null,
  menu-container-shadow-color: null,
  menu-container-shape: null,
  menu-container-surface-tint-layer-color: null,
  menu-divider-color: null,
  menu-divider-height: null,
  menu-list-item-container-height: null,
  menu-list-item-label-text-color: null,
  menu-list-item-label-text-font: null,
  menu-list-item-label-text-line-height: null,
  menu-list-item-label-text-size: null,
  menu-list-item-label-text-tracking: null,
  menu-list-item-label-text-weight: null,
  menu-list-item-selected-container-color: null,
  menu-list-item-with-leading-icon-leading-icon-color: null,
  menu-list-item-with-leading-icon-leading-icon-size: null,
  menu-list-item-with-trailing-icon-trailing-icon-color: null,
  menu-list-item-with-trailing-icon-trailing-icon-size: null,
  text-field-caret-color: null,
  text-field-hover-caret-color: null,
  text-field-focus-caret-color: null,
  text-field-container-color: null,
  text-field-container-height: null,
  text-field-container-shape: null,
  text-field-disabled-input-text-color: null,
  text-field-disabled-input-text-opacity: null,
  text-field-disabled-label-text-color: null,
  text-field-disabled-label-text-opacity: null,
  text-field-disabled-leading-icon-color: null,
  text-field-disabled-leading-icon-opacity: null,
  text-field-disabled-outline-color: null,
  text-field-disabled-outline-opacity: null,
  text-field-disabled-outline-width: null,
  text-field-disabled-supporting-text-color: null,
  text-field-disabled-supporting-text-opacity: null,
  text-field-disabled-trailing-icon-color: null,
  text-field-disabled-trailing-icon-opacity: null,
  text-field-error-caret-color: null,
  text-field-error-hover-caret-color: null,
  text-field-error-focus-caret-color: null,
  text-field-error-focus-input-text-color: null,
  text-field-error-focus-label-text-color: null,
  text-field-error-focus-leading-icon-color: null,
  text-field-error-focus-outline-color: null,
  text-field-error-focus-supporting-text-color: null,
  text-field-error-focus-trailing-icon-color: null,
  text-field-error-hover-input-text-color: null,
  text-field-error-hover-label-text-color: null,
  text-field-error-hover-leading-icon-color: null,
  text-field-error-hover-outline-color: null,
  text-field-error-hover-state-layer-color: null,
  text-field-error-hover-state-layer-opacity: null,
  text-field-error-hover-supporting-text-color: null,
  text-field-error-hover-trailing-icon-color: null,
  text-field-error-input-text-color: null,
  text-field-error-label-text-color: null,
  text-field-error-leading-icon-color: null,
  text-field-error-outline-color: null,
  text-field-error-supporting-text-color: null,
  text-field-error-trailing-icon-color: null,
  text-field-focus-input-text-color: null,
  text-field-focus-label-text-color: null,
  text-field-focus-leading-icon-color: null,
  text-field-focus-outline-color: null,
  text-field-focus-outline-width: null,
  text-field-focus-supporting-text-color: null,
  text-field-focus-trailing-icon-color: null,
  text-field-hover-input-text-color: null,
  text-field-hover-label-text-color: null,
  text-field-hover-leading-icon-color: null,
  text-field-hover-outline-color: null,
  text-field-hover-outline-width: null,
  text-field-hover-state-layer-color: null,
  text-field-hover-state-layer-opacity: null,
  text-field-hover-supporting-text-color: null,
  text-field-hover-trailing-icon-color: null,
  text-field-input-text-color: null,
  text-field-input-text-font: null,
  text-field-input-text-line-height: null,
  text-field-input-text-size: null,
  text-field-input-text-tracking: null,
  text-field-input-text-weight: null,
  text-field-label-text-color: null,
  text-field-label-text-font: null,
  text-field-label-text-line-height: null,
  text-field-label-text-populated-line-height: null,
  text-field-label-text-populated-size: null,
  text-field-label-text-size: null,
  text-field-label-text-tracking: null,
  text-field-label-text-weight: null,
  text-field-leading-icon-color: null,
  text-field-leading-icon-size: null,
  text-field-outline-color: null,
  text-field-outline-width: null,
  text-field-supporting-text-color: null,
  text-field-supporting-text-font: null,
  text-field-supporting-text-line-height: null,
  text-field-supporting-text-size: null,
  text-field-supporting-text-tracking: null,
  text-field-supporting-text-weight: null,
  text-field-trailing-icon-color: null,
  text-field-trailing-icon-size: null,
);

@mixin theme-styles($theme, $resolvers: resolvers.$material) {
  @include theme.validate-theme($_light-theme, $theme);
  @include select-theme.theme-styles($theme, $resolvers: $resolvers);
  @if map.get($theme, text-field-container-height) {
    @include select-theme.outlined-height(
      map.get($theme, text-field-container-height)
    );
    &.mdc-select--with-leading-icon {
      @include select-theme.outlined-with-leading-icon-height(
        map.get($theme, text-field-container-height)
      );
    }
  }
  @if map.get($theme, text-field-container-shape) {
    @include select-theme.outline-shape-radius(
      map.get($theme, text-field-container-shape),
      $height: map.get($theme, text-field-container-height)
    );
  }
}
