// Media query used to create responsive classes
@mixin pf-media-query($point) {
  @if $point == "" or $point == null or $point == "base" {
    @content;
  }

  @else if $point == "sm" {
    @media screen and (min-width: $pf-global--breakpoint--sm) {
      @content;
    }
  }

  @else if $point == "md" {
    @media screen and (min-width: $pf-global--breakpoint--md) {
      @content;
    }
  }

  @else if $point == "lg" {
    @media screen and (min-width: $pf-global--breakpoint--lg) {
      @content;
    }
  }

  @else if $point == "xl" {
    @media screen and (min-width: $pf-global--breakpoint--xl) {
      @content;
    }
  }
}

// Create single prop / value classes, optionally add responsive suffix
// @group mixins
// @moduleType mixin
// @parameter: {Suffix} xs, sm, md, lg, xl, base or null
// @usage: @include pf-utility-builder(class-name, base sm md lg xl);
// ===============================================================================================
//
// ## Example sass map:
// this must be used when order matters or a cluster of similar utilties need to overwrite each other
//
// Justify content options
// $pf-u-flex-options: (
//   flex-none:  (flex none),
//   flex-1:     (flex 1)
// );
//
// non-responsive, base only                @include pf-utility-builder($sass-map)
// responsive, including all breakpoints    @include pf-utility-builder($sass-map, $pf-global--breakpoint-list)
//
// ## Passing individual utilities values
// ===============================================================================================
// Example individual utility:
// @include pf-utility-builder(flex-fill flex "1 1 auto", $pf-global--breakpoint-list);

@mixin pf-utility-builder($props, $breakpoints: null) {
  // if $class-name is a map

  /* stylelint-disable */
  @if type-of($props) == map {
    @each $class, $val in $props {
      $property: nth($val, 1);
      $value: #{nth($val, 2) !important};

      .pf-u-#{$class} {
        #{$property}: #{$value};
      }
    }

    // if breakpoints are requested
    @if $breakpoints != null {
      @each $breakpoint in $breakpoints {
        $suffix: -on-#{$breakpoint};

        @include pf-media-query($breakpoint) {
          @each $class, $val in $props {
            $property: nth($val, 1);
            $value: #{nth($val, 2) !important};

            .pf-u-#{$class}#{$suffix} {
              #{$property}: #{$value};
            }
          }
        }
      }
    }
  }

  @else if type-of($props) == list {
    $class: nth($props, 1);
    $property: nth($props, 2);
    $value: nth($props, 3) !important;

    .pf-u-#{$class} {
      #{$property}: #{$value};
    }

    @if $breakpoints != null {
      @each $breakpoint in $breakpoints {
        $suffix: -on-#{$breakpoint};

        .pf-u-#{$class}#{$suffix} {
          @include pf-media-query($breakpoint) {
            #{$property}: #{$value};
          }
        }
      }
    }
  }
}
/* stylelint-enable */

@mixin pf-u-screen-reader {
  position: fixed;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@mixin pf-u-visible {
  position: static;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border: inherit;
}
