// stylelint-disable-next-line scss/partial-no-import
@import '../polaris-tokens/spacing.spacing-map';

$spacing-data: $polaris-spacing;

/// Returns the spacing value for a given variant.
///
/// @param {String} $variant - The key for the given variant.
/// @return {Number} The spacing for the variant.

@function spacing($variant: base) {
  $fetched-value: map-get($spacing-data, $variant);

  @if type-of($fetched-value) == number {
    @return rem($fetched-value);
  } @else {
    @error 'Spacing variant `#{$variant}` not found. Available variants: #{available-names($spacing-data)}';
  }
}
