/**
 * Copyright (c) Matthieu Jabbour. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

@function ui-gap($gap) {
  @return map-get($gaps, $gap);
}

@function str-replace($string, $search, $replace: '') {
  $index: str-index($string, $search);

  @if $index {
    @return str-slice($string, 1, $index - 1) + $replace +
      str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
  }

  @return $string;
}

@mixin ui-elevation($level) {
  $elevation: map-get($elevations, $level);
  box-shadow: map-get($elevation, umbra) map-get($elevation, penumbra), map-get($elevation, ambiant);
}

@function ui-color($color, $opacity: 1) {
  @return rgba(map-get(map-get($colors, $color), main), $opacity);
}

@function ui-on-color($color, $opacity: 1) {
  @return rgba(map-get(map-get($colors, $color), on), $opacity);
}

@function ui-shape($shape) {
  @return map-get($shapes, $shape);
}

@function ui-font($font) {
  @return map-get($map: $font-families, $key: $font);
}
