////
/// @group themes
/// @access public
/// @author <a href="https://github.com/simeonoff" target="_blank">Simeon Simeonoff</a>
/// @author <a href="https://github.com/desig9stein" target="_blank">Marin Popov</a>
////

/// @param {Map} $palette [$default-palette] - The palette used as basis for styling the component.
/// @param {Map} $schema [$light-schema] - The schema used as basis for styling the component.
///
/// @param {Color} $color [null] - The color of the ripple.
///
/// @requires $default-palette
/// @requires $light-schema
/// @requires apply-palette
/// @requires extend
///
/// @example scss Change the color
///   $my-ripple-theme: igx-ripple-theme($color: yellow);
///   // Pass the theme to the igx-ripple component mixin
///   igx-ripple($my-ripple-theme);
@function igx-ripple-theme(
    $palette: $default-palette,
    $schema: $light-schema,
    $color: null
) {
    $name: 'igx-ripple';
    $ripple-schema: ();

    @if map-has-key($schema, $name) {
        $ripple-schema: map-get($schema, $name);
    } @else {
        $ripple-schema: $schema;
    }

    $theme: apply-palette($ripple-schema, $palette);

    @return extend($theme, (
        name: $name,
        palette: $palette,
        color: $color
    ));
}

/// @param {Map} $theme - The theme used to style the component.
/// @requires {mixin} igx-root-css-vars
/// @requires --var
@mixin igx-ripple($theme, $palette: $default-palette) {
    @include igx-root-css-vars($theme);

    // @debug $theme;

    %igx-ripple-display {
        display: block;
        position: absolute;
        border-radius: 50%;
        background: --var($theme, 'color');
        pointer-events: none;
        transform-origin: center;
        transform: translate3d(0, 0, 0) scale(0);
        will-change: opacity, transform;
        opacity: .5;
    }

    %igx-ripple-wrapper {
        overflow: hidden;
    }
}
