@charset "UTF-8";

// @description
// * order mixin.
// * This mixin applies the `order` property with vendor prefixes to
// * reorder flex items. It allows you to control the visual order of
// * flex items within their flex container.

// @access public

// @version 1.2.0

// @author Khaled Mohamed

// @license MIT

// @repository: https://github.com/Black-Axis/sass-pire

// @reference: https://developer.mozilla.org/en-US/docs/Web/CSS/order

// @namespace main-props

// @module main-props/order

// @dependencies:
// * - meta.type-of (SASS function).
// * - LibFunc.cut-unit (function).

// @param {Number} $val
// * The order value. Must be a number.

// @throws {string}
// * Throws an error if the provided value is not a number.

// @example
// * .example {
// *   @include order(2);
// * }

// @output:
// * .example {
// *   -webkit-box-ordinal-group: 2;
// *   -moz-box-ordinal-group: 2;
// *   -webkit-order: 2;
// *   -ms-flex-order: 2;
// *   -ms-order: 2;
// *   -moz-order: 2;
// *   -o-order: 2;
// *   order: 2;
// * }

@use "sass:meta";
@use "../../../functions/global/cut-unit" as LibFunc;

@mixin order($value: 0) {
    $order-props: (
        -webkit-box-ordinal-group,
        -moz-box-ordinal-group,
        -webkit-order,
        -ms-flex-order,
        -ms-order,
        -moz-order,
        -o-order,
        order
    ) !default;

    @if meta.type-of($value) != number {
        @error "The value of order mixin argument must be of type number.";
    }

    $actual-val: LibFunc.cut-unit($value);

    @each $prop in $order-props {
        #{$prop}: $actual-val;
    }
}
