{"version":3,"sources":["../../../../src/nhsuk/core/tools/_typography.scss"],"names":[],"mappings":"AAAA,4CAA4C;;AAE5C,eAAe;AACf,gBAAgB;AAChB,kBAAkB;AAClB,uBAAuB;AACvB,qBAAqB;AACrB,mBAAmB;;AAEnB,GAAG;AACH,aAAa;AACb,EAAE;AACF,yEAAyE;AACzE,2CAA2C;AAC3C,EAAE;AACF,eAAe;AACf,GAAG;;AAEH,cAAc;AACd,EAAE;AACF,iEAAiE;AACjE,EAAE;AACF,6GAA6G;;AAE7G;EACE,yBAAyB;;EAEzB;IACE,+BAA+B;EACjC;AACF;;AAEA,2BAA2B;AAC3B,EAAE;AACF,2BAA2B;AAC3B,oEAAoE;;AAEpE;EACE,2GAA2G;EAC3G,0BAA0B;AAC5B;;AAEA,qBAAqB;AACrB,EAAE;AACF,wEAAwE;AACxE,6DAA6D;;AAE7D;EACE;IACE,iDAAiD;EACnD,EAAE;IACA,sCAAsC;EACxC;AACF;;AAEA,wCAAwC;AACxC,EAAE;AACF,kCAAkC;AAClC,2EAA2E;;AAE3E;EACE;;;GAGC;EACD,6CAA6C;AAC/C;;AAEA,mBAAmB;AACnB,EAAE;AACF,wEAAwE;AACxE,6DAA6D;;AAE7D;EACE;IACE,+CAA+C;EACjD,EAAE;IACA,oCAAoC;EACtC;AACF;;AAEA,sCAAsC;AACtC,EAAE;AACF,gCAAgC;AAChC,yEAAyE;;AAEzE;EACE;;;GAGC;EACD,2CAA2C;AAC7C;;AAEA,mBAAmB;AACnB,EAAE;AACF,+BAA+B;AAC/B,EAAE;AACF,wEAAwE;AACxE,6DAA6D;;AAE7D;EACE,yCAAyC;EACzC,uBAAuB;EACvB,oBAAoB;AACtB;;AAEA,wBAAwB;AACxB,EAAE;AACF,wEAAwE;AACxE,6DAA6D;;AAE7D;EACE,oCAAoC;;EAEpC;IACE,iDAAiD;EACnD;;EAEA,+BAA+B;EAC/B,qBAAqB;AACvB;;AAEA,oBAAoB;AACpB,EAAE;AACF,wEAAwE;AACxE,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;EAEA;IACE,iDAAiD;IACjD,2CAA2C;;IAE3C,mEAAmE;IACnE,+DAA+D;IAC/D,qCAAqC;IACrC,qCAAqC;IACrC;MACE,gEAAgE;IAClE;;IAEA,wEAAwE;IACxE,yBAAyB;IACzB;;;KAGC;;IAED,sEAAsE;IACtE,wEAAwE;IACxE,0BAA0B;IAC1B;MACE,iCAAiC;MACjC,yCAAyC;MACzC,2DAA2D;IAC7D;;IAEA;MACE;QACE,yBAAyB;QACzB,oCAAoC;MACtC,EAAE;QACA;UACE,qBAAqB;UACrB,oCAAoC;QACtC;MACF,EAAE;QACA;UACE,yBAAyB;UACzB,oCAAoC;QACtC;MACF;IACF;EACF;AACF;;AAEA,gDAAgD;AAChD,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,oBAAoB;AACpB,6EAA6E;AAC7E,2DAA2D;AAC3D,wEAAwE;AACxE,kBAAkB;AAClB,EAAE;AACF,8EAA8E;AAC9E,EAAE;AACF,yBAAyB;AACzB,kEAAkE;;AAElE;EACE;;;GAGC;EACD,kEAAkE;AACpE;;AAEA,cAAc;AACd,EAAE;AACF,gBAAgB;AAChB,WAAW;AACX,+BAA+B;AAC/B,MAAM;AACN,EAAE;AACF,WAAW;AACX,8CAA8C;AAC9C,MAAM;AACN,EAAE;AACF,2EAA2E;AAC3E,sCAAsC;AACtC,gEAAgE;AAChE,gFAAgF;;AAEhF;EACE;IACE;MACE,iCAAiC;IACnC,EAAE;MACA,+BAA+B;IACjC;EACF;;EAEA;IACE,6CAA6C;EAC/C;AACF","file":"_typography.scss","sourcesContent":["// stylelint-disable declaration-no-important\n\n@use \"sass:map\";\n@use \"sass:math\";\n@use \"sass:string\";\n@use \"../settings\" as *;\n@use \"functions\" as *;\n@use \"sass-mq\" as *;\n\n////\n/// Typography\n///\n/// These mixins allow us to quickly and consistently generate common text\n/// patterns such as colours and font-weight\n///\n/// @group tools\n////\n\n/// Text colour\n///\n/// Sets the text colour, including a suitable override for print.\n///\n/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service)\n\n@mixin nhsuk-text-colour {\n  color: $nhsuk-text-colour;\n\n  @include nhsuk-media-query($media-type: print) {\n    color: $nhsuk-print-text-colour;\n  }\n}\n\n/// Text colour (deprecated)\n///\n/// @alias nhsuk-text-colour\n/// @deprecated To be removed in v11.0, replaced by nhsuk-text-colour\n\n@mixin nhsuk-text-color {\n  @include nhsuk-warning(\"color-to-colour\", \"nhsuk-text-color is deprecated. Use nhsuk-text-colour instead.\");\n  @include nhsuk-text-colour;\n}\n\n/// Normal font weight\n///\n/// @param {Boolean} $important [false] - Whether to mark declarations as\n///   `!important`. Generally Used to create override classes.\n\n@mixin nhsuk-font-weight-normal($important: false) {\n  @if $important == true {\n    font-weight: $nhsuk-font-weight-normal !important;\n  } @else {\n    font-weight: $nhsuk-font-weight-normal;\n  }\n}\n\n/// Normal typography weight (deprecated)\n///\n/// @alias nhsuk-font-weight-normal\n/// @deprecated To be removed in v11.0, replaced by nhsuk-font-weight-normal\n\n@mixin nhsuk-typography-weight-normal($important: false) {\n  @include nhsuk-warning(\n    \"nhsuk-typography-weight\",\n    \"nhsuk-typography-weight-normal is deprecated. Use nhsuk-font-weight-normal instead.\"\n  );\n  @include nhsuk-font-weight-normal($important);\n}\n\n/// Bold font weight\n///\n/// @param {Boolean} $important [false] - Whether to mark declarations as\n///   `!important`. Generally Used to create override classes.\n\n@mixin nhsuk-font-weight-bold($important: false) {\n  @if $important == true {\n    font-weight: $nhsuk-font-weight-bold !important;\n  } @else {\n    font-weight: $nhsuk-font-weight-bold;\n  }\n}\n\n/// Bold typography weight (deprecated)\n///\n/// @alias nhsuk-font-weight-bold\n/// @deprecated To be removed in v11.0, replaced by nhsuk-font-weight-bold\n\n@mixin nhsuk-typography-weight-bold($important: false) {\n  @include nhsuk-warning(\n    \"nhsuk-typography-weight\",\n    \"nhsuk-typography-weight-bold is deprecated. Use nhsuk-font-weight-bold instead.\"\n  );\n  @include nhsuk-font-weight-bold($important);\n}\n\n/// Code font helper\n///\n/// Used for codes and sequences\n///\n/// @param {Boolean} $important [false] - Whether to mark declarations as\n///   `!important`. Generally used to create override classes.\n\n@mixin nhsuk-font-code($important: false) {\n  @include nhsuk-font-monospace($important);\n  letter-spacing: 0.075em;\n  word-spacing: -0.5ch;\n}\n\n/// Monospace font helper\n///\n/// @param {Boolean} $important [false] - Whether to mark declarations as\n///   `!important`. Generally used to create override classes.\n\n@mixin nhsuk-font-monospace($important: false) {\n  $font-family-value: $nhsuk-code-font;\n\n  @if $important == true {\n    $font-family-value: $font-family-value !important;\n  }\n\n  font-family: $font-family-value;\n  font-size-adjust: 0.5;\n}\n\n/// Word break helper\n///\n/// Forcibly breaks long words that lack spaces, such as email addresses,\n/// across multiple lines when they wouldn't otherwise fit.\n///\n/// @param {Boolean} $important [false] - Whether to mark declarations as\n///   `!important`. Generally used to create override classes.\n\n@mixin nhsuk-text-break-word($important: false) {\n  $properties: (\n    // IE 11 and Edge 16–17 only support the non-standard `word-wrap` property\n    \"word-wrap\": break-word,\n\n    // All other browsers support `overflow-wrap`\n    \"overflow-wrap\": break-word\n  );\n\n  // Workaround to avoid deprecated `if()` function\n  @each $property, $value in $properties {\n    @if $important == true {\n      #{$property}: $value !important;\n    } @else {\n      #{$property}: $value;\n    }\n  }\n}\n\n/// Line height\n///\n///\n/// Convert line-heights specified in pixels into a relative value, unless\n/// they are already unit-less (and thus already treated as relative values),\n/// in rems, or the units do not match the units used for the font size.\n///\n/// @param {Number} $line-height Line height\n/// @param {Number} $font-size Font size\n/// @return {Number} The line height as either a relative value or unmodified\n\n@function nhsuk-line-height($line-height, $font-size) {\n  @if not math.is-unitless($line-height) {\n    @if math.compatible($line-height, 1rem) and math.compatible($font-size, 1px) {\n      $line-height: math.div($line-height, 1rem) * $nhsuk-root-font-size;\n\n      @if math.is-unitless($font-size) {\n        $font-size: $font-size * 1px;\n      }\n    }\n\n    @if math.compatible($line-height, 1px) and math.compatible($font-size, 1rem) {\n      $font-size: math.div($font-size, 1rem) * $nhsuk-root-font-size;\n    }\n\n    @if math.unit($line-height) == math.unit($font-size) {\n      $line-height: math.div($line-height, $font-size);\n    }\n  }\n\n  @return $line-height;\n}\n\n/// Font size and line height helper\n///\n/// Takes a point from the responsive 'font map' as an argument (the size as it\n/// would appear on tablet and above), and uses it to create font-size and\n/// line-height declarations for different breakpoints, and print.\n///\n/// Example font map:\n///\n/// ```scss\n/// 19: (\n///   null: (\n///     font-size: 16px,\n///     line-height: 20px\n///   ),\n///   tablet: (\n///     font-size: 19px,\n///     line-height: 25px\n///   ),\n///   print: (\n///     font-size: 14pt,\n///     line-height: 1.15\n///   )\n/// );\n/// ```\n///\n/// @param {Number | String} $size - Point from the typography scale (the size\n///   as it would appear on tablet and above)\n/// @param {Number} $line-height [false] - Non responsive custom line\n///   height. Omit to use the line height from the font map.\n/// @param {Boolean} $important [false] - Whether to mark declarations as\n///   `!important`.\n///\n/// @throw if `$size` is not a valid point from the typography scale\n///\n/// @link https://github.com/alphagov/govuk-frontend Original code taken from GDS (Government Digital Service)\n\n@mixin nhsuk-font-size($size, $line-height: false, $important: false) {\n  // Flag font sizes that start with underscores so we can suppress warnings on\n  // deprecated sizes used internally, for example `nhsuk-font($size: \"_24\")`\n  $size-internal-use-only: string.slice(#{$size}, 1, 1) == \"_\";\n\n  // Remove underscore from font sizes flagged for internal use\n  @if $size-internal-use-only {\n    $size: string.slice(#{$size}, 2);\n  }\n\n  // Check for a font map exactly matching the given size\n  $font-map: map.get($nhsuk-typography-scale, $size);\n\n  // No match? Try with string type (e.g. $size: \"16\" not 16)\n  @if not $font-map {\n    @each $font-size in map.keys($nhsuk-typography-scale) {\n      @if not $font-map and \"#{$font-size}\" == \"#{$size}\" {\n        $font-map: map.get($nhsuk-typography-scale, $font-size);\n      }\n    }\n  }\n\n  // Still no match? Throw error\n  @if not $font-map {\n    @error \"Unknown font size `#{$size}` - expected a point from the typography scale.\";\n  }\n\n  // Check for a deprecation within the typography scale\n  $deprecation: map.get($font-map, \"deprecation\");\n\n  @if $deprecation {\n    // Warn on deprecated font sizes unless flagged for internal use\n    @if not $size-internal-use-only {\n      @include nhsuk-warning(map.get($deprecation, \"key\"), map.get($deprecation, \"message\"));\n    }\n\n    // remove the deprecation map keys so they do not break the breakpoint loop\n    $font-map: map.remove($font-map, \"deprecation\");\n  }\n\n  @each $breakpoint, $breakpoint-map in $font-map {\n    $font-size: map.get($breakpoint-map, \"font-size\");\n    $font-size-rem: nhsuk-px-to-rem($font-size);\n\n    // $calculated-line-height is a separate variable from $line-height,\n    // as otherwise the value would get redefined with each loop and\n    // eventually break nhsuk-line-height.\n    $calculated-line-height: $line-height;\n    @if $line-height == false {\n      $calculated-line-height: map.get($breakpoint-map, \"line-height\");\n    }\n\n    // We continue to call the param $line-height to stay consistent with the\n    // naming with nhsuk-font.\n    $calculated-line-height: nhsuk-line-height(\n      $line-height: $calculated-line-height,\n      $font-size: $font-size\n    );\n\n    // Mark rules as !important if $important is true - this will result in\n    // these variables becoming strings, so this needs to happen *after* they\n    // are used in calculations\n    @if $important == true {\n      $font-size: $font-size !important;\n      $font-size-rem: $font-size-rem !important;\n      $calculated-line-height: $calculated-line-height !important;\n    }\n\n    & {\n      @if not $breakpoint {\n        font-size: $font-size-rem;\n        line-height: $calculated-line-height;\n      } @else if $breakpoint == \"print\" {\n        @include nhsuk-media-query($media-type: print) {\n          font-size: $font-size;\n          line-height: $calculated-line-height;\n        }\n      } @else {\n        @include nhsuk-media-query($from: $breakpoint) {\n          font-size: $font-size-rem;\n          line-height: $calculated-line-height;\n        }\n      }\n    }\n  }\n}\n\n/// Font size and line height helper (deprecated)\n///\n/// @param {Number | Boolean | String} $size - Point from the typography scale\n///   (the size as it would appear on tablet and above). Use `false` to avoid\n///   setting a size.\n/// @param {Number} $override-line-height [false] - Non responsive custom line\n///   height. Omit to use the line height from the font map.\n/// @param {Boolean} $important [false] - Whether to mark declarations as\n///   `!important`.\n///\n/// @throw if `$size` is not a valid point from the typography scale (or false)\n///\n/// @alias nhsuk-font-size\n/// @deprecated To be removed in v11.0, replaced by nhsuk-font-size\n\n@mixin nhsuk-typography-responsive($size, $override-line-height: false, $important: false) {\n  @include nhsuk-warning(\n    \"nhsuk-typography-responsive\",\n    \"nhsuk-typography-responsive is deprecated. Use nhsuk-font-size instead.\"\n  );\n  @include nhsuk-font-size($size, $override-line-height, $important);\n}\n\n/// Font helper\n///\n/// @example scss\n///   .foo {\n///     @include nhsuk-font(19);\n///   }\n///\n///   .foo {\n///     @include nhsuk-font(36, $weight: bold);\n///   }\n///\n/// @param {Number} $size - Size of the font as it would appear on desktop -\n///   uses the responsive font size map\n/// @param {String} $weight [normal] - Weight: `bold` or `normal`\n/// @param {Number} $line-height [false] - Line-height, if overriding the default\n\n@mixin nhsuk-font($size, $weight: normal, $line-height: false) {\n  & {\n    @if $weight == normal {\n      @include nhsuk-font-weight-normal;\n    } @else if $weight == bold {\n      @include nhsuk-font-weight-bold;\n    }\n  }\n\n  @if $size {\n    @include nhsuk-font-size($size, $line-height);\n  }\n}\n"]}
