{"version":3,"sources":["../../../../src/nhsuk/core/tools/_spacing.scss"],"names":[],"mappings":"AAAA,4CAA4C;;AAE5C,eAAe;AACf,gBAAgB;AAChB,gBAAgB;AAChB,uBAAuB;AACvB,mBAAmB;;AAEnB,GAAG;AACH,UAAU;AACV,EAAE;AACF,eAAe;AACf,GAAG;;AAEH,uBAAuB;AACvB,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,8DAA8D;AAC9D,qCAAqC;AACrC,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,gBAAgB;AAChB,eAAe;AACf,iCAAiC;AACjC,MAAM;AACN,EAAE;AACF,uCAAuC;AACvC,eAAe;AACf,qCAAqC;AACrC,MAAM;AACN,EAAE;AACF,0DAA0D;AAC1D,eAAe;AACf,+CAA+C;AAC/C,MAAM;AACN,EAAE;AACF,6GAA6G;;AAE7G;EACE,gDAAgD;EAChD;IACE;gCAC4B;EAC9B;;EAEA,mBAAmB;EACnB;IACE,kBAAkB;IAClB,wCAAwC;EAC1C;;EAEA;IACE,0IAA0I;EAC5I;;EAEA,sDAAsD;;EAEtD;IACE,mBAAmB;EACrB;;EAEA,cAAc;AAChB;;AAEA,qBAAqB;AACrB,EAAE;AACF,+EAA+E;AAC/E,+EAA+E;AAC/E,qDAAqD;AACrD,EAAE;AACF,mEAAmE;AACnE,oCAAoC;AACpC,EAAE;AACF,8EAA8E;AAC9E,iEAAiE;AACjE,yEAAyE;AACzE,iEAAiE;AACjE,6CAA6C;AAC7C,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,gBAAgB;AAChB,WAAW;AACX,iCAAiC;AACjC,uEAAuE;AACvE,MAAM;AACN,EAAE;AACF,6EAA6E;AAC7E,6CAA6C;AAC7C,0CAA0C;AAC1C,EAAE;AACF,6GAA6G;;AAE7G;;;;;;;EAOE,2DAA2D;EAC3D;IACE,2EAA2E;EAC7E;;EAEA;IACE;+DAC2D;EAC7D;;EAEA,+EAA+E,EAAE,KAAK;EACtF,0CAA0C;EAC1C;IACE;uHACmH;EACrH;;EAEA,KAAK;EACL;IACE;MACE;QACE,wDAAwD;MAC1D,EAAE;QACA,kDAAkD;MACpD;IACF;;IAEA;MACE,+CAA+C;IACjD;;IAEA;MACE,KAAK;MACL;QACE;UACE,+BAA+B;QACjC,EAAE;UACA,6CAA6C;QAC/C;MACF,EAAE;QACA;UACE;YACE,+BAA+B;UACjC,EAAE;YACA,6CAA6C;UAC/C;QACF;MACF;IACF;EACF;AACF;;AAEA,oBAAoB;AACpB,EAAE;AACF,yEAAyE;AACzE,qEAAqE;AACrE,iEAAiE;AACjE,EAAE;AACF,8EAA8E;AAC9E,gEAAgE;AAChE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,oEAAoE;AACpE,EAAE;AACF,gBAAgB;AAChB,WAAW;AACX,qEAAqE;AACrE,MAAM;AACN,EAAE;AACF,6GAA6G;;AAE7G;EACE,2GAA2G;AAC7G;;AAEA,qBAAqB;AACrB,EAAE;AACF,0EAA0E;AAC1E,qEAAqE;AACrE,iEAAiE;AACjE,EAAE;AACF,8EAA8E;AAC9E,kEAAkE;AAClE,iEAAiE;AACjE,8CAA8C;AAC9C,wEAAwE;AACxE,iEAAiE;AACjE,EAAE;AACF,gBAAgB;AAChB,WAAW;AACX,sEAAsE;AACtE,MAAM;AACN,EAAE;AACF,6GAA6G;;AAE7G;EACE,4GAA4G;AAC9G","file":"_spacing.scss","sourcesContent":["// stylelint-disable declaration-no-important\n\n@use \"sass:map\";\n@use \"sass:math\";\n@use \"sass:meta\";\n@use \"../settings\" as *;\n@use \"sass-mq\" as *;\n\n////\n/// Spacing\n///\n/// @group tools\n////\n\n/// Single point spacing\n///\n/// Returns measurement corresponding to the spacing point requested.\n///\n/// @param {Number} $spacing-point - Point on the spacing scale\n///  (set in `settings/_spacing.scss`)\n///\n/// @returns {String} Spacing measurement eg. 8px\n///\n/// @example scss\n///   .element {\n///     padding: nhsuk-spacing(5);\n///   }\n///\n/// @example scss Using negative spacing\n///   .element {\n///     margin-top: nhsuk-spacing(-1);\n///   }\n///\n/// @example scss Marking spacing declarations as important\n///   .element {\n///     margin-top: nhsuk-spacing(1) !important;\n///   }\n///\n/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service)\n\n@function nhsuk-spacing($spacing-point) {\n  $actual-input-type: meta.type-of($spacing-point);\n  @if $actual-input-type != \"number\" {\n    @error \"Expected a number (integer), but got a \"\n      + \"#{$actual-input-type}.\";\n  }\n\n  $is-negative: false;\n  @if $spacing-point < 0 {\n    $is-negative: true;\n    $spacing-point: math.abs($spacing-point);\n  }\n\n  @if not map.has-key($nhsuk-spacing-points, $spacing-point) {\n    @error \"Unknown spacing variable `#{$spacing-point}`. Make sure you are using a point from the spacing scale in `_settings/spacing.scss`.\";\n  }\n\n  $value: map.get($nhsuk-spacing-points, $spacing-point);\n\n  @if $is-negative {\n    @return $value * -1;\n  }\n\n  @return $value;\n}\n\n/// Responsive spacing\n///\n/// Adds responsive spacing (either padding or margin, depending on `$property`)\n/// by fetching a 'spacing map' from the responsive spacing scale, which defines\n/// different spacing values at different breakpoints.\n///\n/// To generate responsive spacing, use 'nhsuk-responsive-margin' or\n/// 'nhsuk-responsive-padding' mixins\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n///  scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $property - Property to add spacing to (e.g. 'margin')\n/// @param {String} $direction [all] - Direction to add spacing to\n///  (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing by\n///\n/// @example scss\n///   .foo {\n///     padding: nhsuk-spacing(5);\n///     top: nhsuk-spacing(2) !important; // if `!important` is required\n///   }\n///\n/// 1. Make sure that the return value from `_settings/spacing.scss` is a map.\n/// 2. Loop through each breakpoint in the map\n/// 3. The 'null' breakpoint is for mobile.\n///\n/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service)\n\n@mixin nhsuk-responsive-spacing(\n  $responsive-spacing-point,\n  $property,\n  $direction: \"all\",\n  $important: false,\n  $adjustment: false\n) {\n  $actual-input-type: meta.type-of($responsive-spacing-point);\n  @if $actual-input-type != \"number\" {\n    @error \"Expected a number (integer), but got a \" + \"#{$actual-input-type}.\";\n  }\n\n  @if not map.has-key($nhsuk-spacing-responsive-scale, $responsive-spacing-point) {\n    @error \"Unknown spacing point `#{$responsive-spacing-point}`. Make sure you are using a point from the \"\n      + \"responsive spacing scale in `_settings/spacing.scss`.\";\n  }\n\n  $scale-map: map.get($nhsuk-spacing-responsive-scale, $responsive-spacing-point); // [1]\n  $actual-map-type: meta.type-of($scale-map);\n  @if $actual-map-type != \"map\" {\n    @error \"Expected a number (integer), but got a \"\n      + \"#{$actual-map-type}. Make sure you are using a map to set the responsive spacing in `_settings/spacing.scss`)\";\n  }\n\n  // [2]\n  @each $breakpoint, $breakpoint-value in $scale-map {\n    @if $adjustment {\n      @if not math.compatible($breakpoint-value, $adjustment) {\n        $breakpoint-value: calc($breakpoint-value + $adjustment);\n      } @else {\n        $breakpoint-value: $breakpoint-value + $adjustment;\n      }\n    }\n\n    @if $important == true {\n      $breakpoint-value: $breakpoint-value !important;\n    }\n\n    & {\n      // [3]\n      @if not $breakpoint {\n        @if $direction == all {\n          #{$property}: $breakpoint-value;\n        } @else {\n          #{$property}-#{$direction}: $breakpoint-value;\n        }\n      } @else {\n        @include nhsuk-media-query($from: $breakpoint) {\n          @if $direction == all {\n            #{$property}: $breakpoint-value;\n          } @else {\n            #{$property}-#{$direction}: $breakpoint-value;\n          }\n        }\n      }\n    }\n  }\n}\n\n/// Responsive margin\n///\n/// Adds responsive margin by fetching a 'spacing map' from the responsive\n/// spacing scale, which defines different spacing values at different\n/// breakpoints. Wrapper for the `nhsuk-responsive-spacing` mixin.\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n/// scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $direction [all] - Direction to add spacing to\n///   (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing by\n///\n/// @example scss\n///   .foo {\n///     @include nhsuk-responsive-margin(6, 'left', $adjustment: 1px);\n///   }\n///\n/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service)\n\n@mixin nhsuk-responsive-margin($responsive-spacing-point, $direction: \"all\", $important: false, $adjustment: false) {\n  @include nhsuk-responsive-spacing($responsive-spacing-point, \"margin\", $direction, $important, $adjustment);\n}\n\n/// Responsive padding\n///\n/// Adds responsive padding by fetching a 'spacing map' from the responsive\n/// spacing scale, which defines different spacing values at different\n/// breakpoints. Wrapper for the `nhsuk-responsive-spacing` mixin.\n///\n/// @param {Number} $responsive-spacing-point - Point on the responsive spacing\n///   scale, corresponds to a map of breakpoints and spacing values\n/// @param {String} $direction [all] - Direction to add spacing to\n///   (`top`, `right`, `bottom`, `left`, `all`)\n/// @param {Boolean} $important [false] - Whether to mark as `!important`\n/// @param {Number} $adjustment [false] - Offset to adjust spacing\n///\n/// @example scss\n///   .foo {\n///     @include nhsuk-responsive-padding(6, 'left', $adjustment: 1px);\n///   }\n///\n/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service)\n\n@mixin nhsuk-responsive-padding($responsive-spacing-point, $direction: \"all\", $important: false, $adjustment: false) {\n  @include nhsuk-responsive-spacing($responsive-spacing-point, \"padding\", $direction, $important, $adjustment);\n}\n"]}
