@use "../variables.scss"as *;
@use "../mixins"as *;

@mixin switch {
    ul.#{$prefix}-switch {
        list-style: none;
        padding   : 0;
        margin    : 0;
        display   : block;
        position  : relative;
        overflow  : hidden;
        min-height: 50px;

        &>li {
            display   : list-item;
            position  : absolute;
            top       : 0;
            left      : 0;
            bottom    : 0;
            right     : 0;
            overflow-y: auto;

            &:not(.animation-progress):not(.#{$prefix}-active) {
                display: none;
            }
        }
    }

    ul.#{$prefix}-slider {
        list-style: none;
        padding   : 0;
        margin    : 0;
        display   : block;
        position  : relative;
        overflow  : hidden;
        min-height: 50px;
        overflow  : hidden;

        &>li {
            display   : list-item;
            position  : absolute;
            top       : 0;
            left      : 0;
            bottom    : 0;
            right     : 0;
            overflow-y: auto;
            z-index   : 1;

            &:not(.animation-progress):not(.#{$prefix}-active) {
                display: none;
            }

            &.#{$prefix}-active {
                z-index: 0;
            }
        }
    }
}


@mixin switch-animation {
    .#{$prefix}-switch-animation-default-in {
        transform: translateX(-100%);
        animation: switchDefaultIn 500ms ease-in-out forwards;
    }

    .#{$prefix}-switch-animation-default-out {
        animation: switchDefaultOut 500ms ease-in-out forwards;
    }

    @keyframes switchDefaultIn {
        0% {
            transform: translateX(-100%);
        }

        100% {
            transform: translateX(0%);
        }
    }

    @keyframes switchDefaultOut {
        0% {
            transform: translateX(0%);
        }

        100% {
            transform: translateX(100%);
        }
    }
}

@mixin definitions($options: ()) {
    @include switch();

    @if(not-option-disabled($options, 'animation')) {
        @include switch-animation();
    }

}