Spacing

Installation

  yarn add @chewy/kib-foundations

Import

  @use '~@chewy/kib-foundations/src/spacing';

Mixins

custom-properties

Deprecated!

Use prebuilt CSS theme files from @chewy/chirp-design-tokens instead.

Generates CSS Custom Properties for spacing tokens. Prefer importing theme files directly:

```css

@mixin custom-properties($theme, $overrides: null) { ... }@mixin custom-properties($theme, $overrides: null) { 
  @warn "spacing.custom-properties() is deprecated. Import CSS theme files from @chewy/chirp-design-tokens/web/css (for example, theme-base-light.css and theme-base-dark.css).";

  @if $theme != common.$default-theme and $theme != 'base' {
    @warn "The $theme parameter is deprecated. Non-base themes will be handled via separate CSS theme files.";
  }

  $spacing-properties: functions.get-properties();

  @if $overrides {
    $spacing-properties: map.deep-merge($spacing-properties, $overrides);
  }

  @each $key, $value in $spacing-properties {
    @if meta.type-of($value) != 'map' {
      #{common.get-property-name($key)}: $value;
    }
  }
 }
Parameters
Parameters
parameter Nameparameter Descriptionparameter Typeparameter Default value
$theme

Unused, retained for backwards compatibility.

String none
$overrides

Map that overrides matching custom property values.

Mapnull
Requires

Functions

-get-themes

@function -get-themes($tokens) { ... }@function -get-themes($tokens) { 
  $themes: ();

  @each $name, $theme in $tokens {
    $themes: map.set($themes, $name, map.get($theme, 'spacing'));
  }

  @return $themes;
 }
Description

Get map of all spacing themes Defined here to avoid a module loop.

Parameters
Parameters
parameter Nameparameter Descriptionparameter Typeparameter Default value
$tokens

Spacing tokens map

Map none
Returns
Map

Border themes definitions map

Requires

Variables

themes

$themes: (...);$themes: (
  'base': map.get(tokens.$chirp-theme, 'spacing')
);
Description

Map of spacing themes Adapted for new token structure: creates a 'base' theme from $chirp-theme.spacing

Type

Map