/**
 * Flex utilities
 */

@use 'sass:map';
@use '@ecl/vanilla-layout-grid/mixins/breakpoints';

// Exposed variables
$theme: null !default;

@each $breakpoint in map.keys(map.get($theme, 'breakpoint')) {
  @include breakpoints.up($breakpoint) {
    $infix: breakpoints.infix($breakpoint, map.get($theme, 'breakpoint'));

    /**
       * Container
       */

    /* Direction */
    .ecl-u-flex#{$infix}-row {
      flex-direction: row !important;
    }
    .ecl-u-flex#{$infix}-column {
      flex-direction: column !important;
    }
    .ecl-u-flex#{$infix}-row-reverse {
      flex-direction: row-reverse !important;
    }
    .ecl-u-flex#{$infix}-column-reverse {
      flex-direction: column-reverse !important;
    }

    /* Wrap */
    .ecl-u-flex#{$infix}-wrap {
      flex-wrap: wrap !important;
    }
    .ecl-u-flex#{$infix}-nowrap {
      flex-wrap: nowrap !important;
    }
    .ecl-u-flex#{$infix}-wrap-reverse {
      flex-wrap: wrap-reverse !important;
    }

    /* Justify content */
    .ecl-u-justify-content#{$infix}-start {
      justify-content: flex-start !important;
    }
    .ecl-u-justify-content#{$infix}-end {
      justify-content: flex-end !important;
    }
    .ecl-u-justify-content#{$infix}-center {
      justify-content: center !important;
    }
    .ecl-u-justify-content#{$infix}-between {
      justify-content: space-between !important;
    }
    .ecl-u-justify-content#{$infix}-around {
      justify-content: space-around !important;
    }

    /* Align items */
    .ecl-u-align-items#{$infix}-start {
      align-items: flex-start !important;
    }
    .ecl-u-align-items#{$infix}-end {
      align-items: flex-end !important;
    }
    .ecl-u-align-items#{$infix}-center {
      align-items: center !important;
    }
    .ecl-u-align-items#{$infix}-baseline {
      align-items: baseline !important;
    }
    .ecl-u-align-items#{$infix}-stretch {
      align-items: stretch !important;
    }

    /* Align content */
    .ecl-u-align-content#{$infix}-start {
      align-content: flex-start !important;
    }
    .ecl-u-align-content#{$infix}-end {
      align-content: flex-end !important;
    }
    .ecl-u-align-content#{$infix}-center {
      align-content: center !important;
    }
    .ecl-u-align-content#{$infix}-between {
      align-content: space-between !important;
    }
    .ecl-u-align-content#{$infix}-around {
      align-content: space-around !important;
    }
    .ecl-u-align-content#{$infix}-stretch {
      align-content: stretch !important;
    }

    /**
       * Items
       */

    /* Order */
    .ecl-u-order#{$infix}-first {
      order: -1 !important;
    }
    .ecl-u-order#{$infix}-last {
      order: 1 !important;
    }
    .ecl-u-order#{$infix}-0 {
      order: 0 !important;
    }

    /* Align self */
    .ecl-u-align-self#{$infix}-auto {
      align-self: auto !important;
    }
    .ecl-u-align-self#{$infix}-start {
      align-self: flex-start !important;
    }
    .ecl-u-align-self#{$infix}-end {
      align-self: flex-end !important;
    }
    .ecl-u-align-self#{$infix}-center {
      align-self: center !important;
    }
    .ecl-u-align-self#{$infix}-baseline {
      align-self: baseline !important;
    }
    .ecl-u-align-self#{$infix}-stretch {
      align-self: stretch !important;
    }

    /* Flex grow */
    .ecl-u-flex-grow#{$infix}-0 {
      flex-grow: 0 !important;
    }
    .ecl-u-flex-grow#{$infix}-1 {
      flex-grow: 1 !important;
    }

    /* Flex shrink */
    .ecl-u-flex-shrink#{$infix}-0 {
      flex-shrink: 0 !important;
    }
    .ecl-u-flex-shrink#{$infix}-1 {
      flex-shrink: 1 !important;
    }

    /* Flex basis */
    .ecl-u-flex-basis#{$infix}-100 {
      flex-basis: 100% !important;
    }
    .ecl-u-flex-basis#{$infix}-auto {
      flex-basis: auto !important;
    }
  }
}
