//------------------------------------------------------------------------------------------------
// SPACING FUNCTIONS
//------------------------------------------------------------------------------------------------

/*
A collection of functions and mixins for handling spacing values
*/


// GET SPACING
//------------------------------------------------------------------------------------------------

/*
A function to return a specific spacing value from the map in settings.spacing

.myElement {
	padding-left: spacing("large");
}
*/

@function spacing($value) {
	$chosen-spacing: null;
	@if map-has-key($spacing, $value) {
		$chosen-spacing: map-get($spacing, $value);
	}
	@else {
		@error "'#{$value}' doesn't exist in 'settings/spacing'";
	}
	@return $chosen-spacing;
}


// SET SPACING
//------------------------------------------------------------------------------------------------

/*
Some objects & utility classes use spacing values from settings/spacing to
programatically generate classes.

For example:- u-margin-bottom-large, o-box--spacing-small etc.

You can amend the default spacing values using the `set-spacing` function.

@include set-spacing((
	'large' : 60px,
	'small' : 10px
));
*/

@mixin set-spacing($map) {
	$spacing: map-sort(amend-map($spacing, $map)) !global;
}