@charset "UTF-8";

// @description
// * fade mixin.
// * This mixin provides a simple way to control the visibility and
// * opacity of an element for creating fade-in and fade-out effects.

// @access public

// @version 1.2.1

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @namespace general

// @module general/fade

// @dependencies:
// * - meta.type-of (SASS function).
// * - list.index (SASS function).
// * - Error.throw (function).

// @param {String} $type - The type of fade effect. Possible values are:
// * - "hide" or "no": Sets visibility to hidden and opacity to 0.
// * - "show" or "yes": Sets visibility to visible and opacity to 1.

// @example
// * .example {
// *    @include fade(hide);
// * }

// @output
// * .example {
// *   visibility: hidden;
// *   opacity: 0;
// * }

@use "sass:meta";
@use "sass:list";
@use "../../development-utils/toggle-error-message" as Error;

@mixin fade($type: show) {
    @if meta.type-of($type) != string {
        content: Error.throw("The parameters of fade mixin must be in a string type.");
    } @else {
        $fade-values: (hide, show, yes, no) !default;

        @if list.index($fade-values, $type) {
            @if $type == "hide" or $type == "no" {
                visibility: hidden;
                opacity: 0;
            } @else if $type == "show" or $type == "yes" {
                visibility: visible;
                opacity: 1;
            } @else {
                content: Error.throw(
                    "The type parameter of fade mixin must be one of these values: (#{$fade-values})."
                );
            }
        } @else {
            content: Error.throw("The type parameter of fade mixin must be one of these values: (#{$fade-values}).");
        }
    }
}
