@charset "UTF-8";

// @description
// * circle mixin.
// * This mixin generates CSS properties to create a circular element
// * with a specified side length. It sets the width, height, and
// * border-radius properties to create a perfect circle.

// @access public

// @version 1.3.1

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @namespace general

// @module general/circle

// @dependencies:
// * - meta.type-of (SASS function).
// * - math.unit (SASS function).
// * - list.index (SASS function).
// * - var.$all-units (variable).
// * - Error.throw (function).

// @param {Number} $side
// * The length of one side of the circle. It must be a number.

// @example
// * .example {
// *   @include circle(50px);
// * }

// @output
// * .example {
// *   width: 50px;
// *   height: 50px;
// *   border-radius: 50%;
// * }

// @note
// * The mixin assumes that the provided side length will create a circle.
// * It's essential to ensure that the specified side length is the same
// * for both width and height to maintain a perfect circle.

@use "sass:meta";
@use "sass:list";
@use "sass:math";
@use "../../abstract/global-variables" as var;
@use "../../development-utils/toggle-error-message" as Error;

@mixin circle($one-side: 0) {
    @if meta.type-of($one-side) != number {
        content: Error.throw("The parameter of circle mixin must be in a number type.");
    } @else {
        $get-unit: math.unit($one-side);

        @if $get-unit != "" {
            @if list.index(var.$all-units, $get-unit) {
                width: #{$one-side};
                height: #{$one-side};
                border-radius: 50%;
            } @else {
                content: Error.throw("The parameter of circle mixin must be one of these values: (#{var.$all-units}).");
            }
        } @else {
            content: Error.throw("The parameter of circle mixin must have a unit.");
        }
    }
}
