@use '../variables'as *;
@use '../mixins'as *;

@mixin widths($size:"") {
    @for $i from 1 through 6 {
        .#{$prefix}-width-1-#{$i}#{$size} {
            width: calc(100% / #{$i}) !important;
        }

        @if $i>2 {

            .#{$prefix}-width-2-#{$i}#{$size} {
                width: calc(2*(100% / #{$i})) !important;
            }
        }

        @if $i>3 {
            .#{$prefix}-width-3-#{$i}#{$size} {
                width: calc(3*(100% / #{$i})) !important;
            }
        }

        @if $i>4 {
            .#{$prefix}-width-4-#{$i}#{$size} {
                width: calc(4*(100% / #{$i})) !important;
            }
        }

        @if $i>5 {
            .#{$prefix}-width-5-#{$i}#{$size} {
                width: calc(5*(100% / #{$i})) !important;
            }
        }
    }

    .#{$prefix}-width-auto#{$size} {
        width: auto !important;
    }

    .#{$prefix}-width-grow#{$size} {
        flex: 1 0 auto !important;
    }

    .#{$prefix}-width-shrink#{$size} {
        flex: 0 1 auto !important;
    }
}

@mixin widths_small() {
    @for $i from 1 through 6 {

        .#{$prefix}-width-1-#{$i},
        .#{$prefix}-width-2-#{$i},
        .#{$prefix}-width-3-#{$i},
        .#{$prefix}-width-4-#{$i},
        .#{$prefix}-width-5-#{$i} {
            width: 100% !important;
        }
    }
}

@mixin definitions($options: ()) {
    [class*="#{$prefix}-width"] {
        box-sizing: border-box;
        width     : 100%;
        max-width : 100%;
    }

    .#{$prefix}-fill-parent {
        height: 100%;
        width : 100%;
    }

    @include widths();

    @if(not-option-disabled($options, 'responsive')) {
        @include media-screen-min-small {
            @include widths(--s);
        }

        @include media-screen-min-medium {
            @include widths(--m);
        }

        @include media-screen-min-large {
            @include widths(--l);
        }

        @include media-screen-min-xlarge {
            @include widths(--xl);
        }
    }


}