/**
 * @license
 * Copyright 2020 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

// stylelint-disable selector-class-pattern --
// Selector '.mdc-*' should only be used in this project.

// Ignore function name case warnings from states module
// stylelint-disable function-name-case
@use 'sass:map';
@use '@material/ripple/ripple-theme';
@use '@material/theme/shadow-dom';
@use '@material/theme/css';

$light-theme: ripple-theme.$light-theme;

@mixin theme($theme) {
  @include ripple-theme.theme($theme);
}

@mixin theme-styles($theme) {
  .mdc-ripple-surface {
    @include ripple-theme.theme-styles($theme);
  }
}

$transparent-theme: (
  state: #000,
  opacity: (
    hover: 0,
    focus: 0,
    press: 0,
  ),
);

@mixin theme-deprecated($theme: $transparent-theme) {
  @include css.declaration(--mdc-ripple-color, map.get($theme, state));

  $opacity-map: map.get($theme, opacity);
  @if $opacity-map {
    @include css.declaration(
      --mdc-ripple-focus-opacity,
      map.get($opacity-map, focus)
    );
    @include css.declaration(
      --mdc-ripple-hover-opacity,
      map.get($opacity-map, hover)
    );
    @include css.declaration(
      --mdc-ripple-press-opacity,
      map.get($opacity-map, press)
    );
  }

  @if shadow-dom.$css-selector-fallback-declarations {
    .mdc-ripple-surface {
      @if map.get($theme, state) {
        @include ripple-theme.states-base-color(map.get($theme, state));
      }

      @if map.get($theme, opacity) {
        @include ripple-theme.states-opacities(map.get($theme, opacity));
      }
    }
  }
}
