// Text utilities
// Mixin take size in parameter
// @see _breakpoints.scss
// Every class are generated with breakpoints prefix

// Available indents (key / size)
$indent: (
  '0': '0px',
  'px': '1px',
  '0-5': '0.125rem',
  '1': '0.25rem',
  '1-5': '0.375rem',
  '2': '0.5rem',
  '2-5	': '0.625rem',
  '3': '0.75rem',
  '3-5': '0.875rem',
  '4': '1rem',
  '5': '1.25rem',
  '6': '1.5rem',
  '7': '1.75rem',
  '8': '2rem',
  '9': '2.25rem',
  '10': '2.5rem',
  '11': '2.75rem',
  '12': ' 3rem',
  '14': '3.5rem',
  '16': '4rem',
  '20': '5rem',
  '24': '6rem',
  '28': '7rem',
  '32': '8rem',
  '36': '9rem',
  '40': '10rem',
  '44': '11rem',
  '48': '12rem',
  '52': '13rem',
  '56': '14rem',
  '60': '15rem',
  '64': '16rem',
  '72': '18rem',
  '80': '20rem',
  '96': '24rem'
);

$text-overflow-properties: (
  'text-ellipsis': 'ellipsis',
  'text-clip': 'clip;'
);

$text-align-properties: (
  'text-left': 'left',
  'text-center': 'center',
  'text-right': 'right',
  'text-justify': 'justify',
  'text-start': 'start',
  'text-end': 'end'
);

$text-decoration-properties: (
  'underline': 'underline',
  'overline': 'overline',
  'line-through': 'line-through',
  'no-underline': 'none'
);

$text-transform-properties: (
  'uppercase': 'uppercase',
  'lowercase': 'lowercase',
  'capitalize': 'capitalize',
  'normal-case': 'none'
);

$vertical-align-properties: (
  'align-baseline': 'baseline',
  'align-top': 'top',
  'align-middle': 'middle',
  'align-bottom': 'bottom',
  'align-text-top': 'text-top',
  'align-text-bottom': 'text-bottom',
  'align-sub': 'sub',
  'align-super': 'super'
);

$white-space-properties: (
  'whitespace-normal': 'normal',
  'whitespace-nowrap': 'nowrap',
  'whitespace-pre': 'pre',
  'whitespace-pre-line': 'pre-line',
  'whitespace-pre-wrap': 'pre-wrap',
  'whitespace-break-spaces': 'break-spaces'
);

$word-break-properties: (
  'break-all': 'break-all',
  'break-keep': 'keep-all'
);

$hyphens-properties: (
  'hyphens-none': 'none',
  'hyphens-manual': 'manual',
  'hyphens-auto': 'auto'
);

@mixin mic-text-utilities($size: '') {
  // Text Overflow
  @each $class, $property in $text-overflow-properties {
    .#{$size + $class} {
      text-overflow: #{$property};
    }
  }

  .#{$size + 'truncate'} {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
  }

  .#{$size + 'overflow-hidden'} {
    overflow: hidden;
  }

  // Text Align
  @each $class, $property in $text-align-properties {
    .#{$size + $class} {
      text-align: #{$property};
    }
  }

  // Text Decoration
  @each $class, $property in $text-decoration-properties {
    .#{$size + $class} {
      text-decoration: #{$property};
    }
  }

  // Text Transform
  @each $class, $property in $text-transform-properties {
    .#{$size + $class} {
      text-transform: #{$property};
    }
  }

  // Vertical Align
  @each $class, $property in $vertical-align-properties {
    .#{$size + $class} {
      vertical-align: #{$property};
    }
  }

  //White Space
  @each $class, $property in $white-space-properties {
    .#{$size + $class} {
      white-space: #{$property};
    }
  }

  //Word break
  @each $class, $property in $word-break-properties {
    .#{$size + $class} {
      word-break: #{$property};
    }
  }

  .#{$size + 'break-normal'} {
    overflow-wrap: normal;
    word-break: normal;
  }

  .#{$size + 'break-words'} {
    overflow-wrap: break-word;
  }

  //Hyphens
  @each $class, $property in $hyphens-properties {
    .#{$size + $class} {
      hyphens: #{$property};
    }
  }

  // Text Indent
  @each $i, $w in $indent {
    .#{$size + 'indent-' + $i} {
      text-indent: #{$w};
    }
  }
}
