@nationalarchives/frontend 1.4.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/nationalarchives/all+analytics.js +1 -1
- package/nationalarchives/all+analytics.js.map +1 -1
- package/nationalarchives/all.css +1 -1
- package/nationalarchives/all.css.map +1 -1
- package/nationalarchives/all.js +1 -1
- package/nationalarchives/all.js.map +1 -1
- package/nationalarchives/all.mjs +11 -1
- package/nationalarchives/assets/images/favicon.ico +0 -0
- package/nationalarchives/assets/images/favicon.svg +7 -0
- package/nationalarchives/assets/images/mstile-150x150.png +0 -0
- package/nationalarchives/assets/images/nationalarchives-opengraph-image.png +0 -0
- package/nationalarchives/components/TextAreaCharacterCount/TextAreaCharacterCount.js +2 -0
- package/nationalarchives/components/TextAreaCharacterCount/TextAreaCharacterCount.js.map +1 -0
- package/nationalarchives/components/TextAreaItemisedRows/TextAreaItemisedRows.js +2 -0
- package/nationalarchives/components/TextAreaItemisedRows/TextAreaItemisedRows.js.map +1 -0
- package/nationalarchives/components/accordion/accordion.css +1 -1
- package/nationalarchives/components/accordion/accordion.css.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -1
- package/nationalarchives/components/breadcrumbs/breadcrumbs.mjs +1 -1
- package/nationalarchives/components/button/button.css +1 -1
- package/nationalarchives/components/button/button.css.map +1 -1
- package/nationalarchives/components/button/fixtures.json +1 -1
- package/nationalarchives/components/button/template.njk +1 -1
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/fixtures.json +1 -1
- package/nationalarchives/components/card/template.njk +1 -1
- package/nationalarchives/components/checkboxes/fixtures.json +1 -1
- package/nationalarchives/components/code-block/code-block.css +1 -1
- package/nationalarchives/components/code-block/code-block.css.map +1 -1
- package/nationalarchives/components/code-block/fixtures.json +1 -1
- package/nationalarchives/components/compound-filters/compound-filters.css +1 -1
- package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
- package/nationalarchives/components/date-input/fixtures.json +1 -1
- package/nationalarchives/components/date-input/macro-options.json +2 -1
- package/nationalarchives/components/date-search/fixtures.json +1 -1
- package/nationalarchives/components/error-summary/error-summary.css +1 -1
- package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
- package/nationalarchives/components/fieldset/fieldset.css +1 -1
- package/nationalarchives/components/fieldset/fieldset.css.map +1 -1
- package/nationalarchives/components/fieldset/template.njk +1 -1
- package/nationalarchives/components/file-input/fixtures.json +1 -1
- package/nationalarchives/components/files-list/files-list.css +1 -1
- package/nationalarchives/components/files-list/files-list.css.map +1 -1
- package/nationalarchives/components/footer/fixtures.json +4 -4
- package/nationalarchives/components/footer/template.njk +2 -2
- package/nationalarchives/components/gallery/gallery.css +1 -1
- package/nationalarchives/components/gallery/gallery.css.map +1 -1
- package/nationalarchives/components/hero/fixtures.json +1 -1
- package/nationalarchives/components/index-grid/fixtures.json +1 -1
- package/nationalarchives/components/index-grid/index-grid.css +1 -1
- package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
- package/nationalarchives/components/index-grid/template.njk +1 -1
- package/nationalarchives/components/pagination/fixtures.json +4 -4
- package/nationalarchives/components/pagination/pagination.css +1 -1
- package/nationalarchives/components/pagination/pagination.css.map +1 -1
- package/nationalarchives/components/picture/fixtures.json +1 -1
- package/nationalarchives/components/picture/picture.css +1 -1
- package/nationalarchives/components/picture/picture.css.map +1 -1
- package/nationalarchives/components/radios/fixtures.json +1 -1
- package/nationalarchives/components/select/fixtures.json +1 -1
- package/nationalarchives/components/skip-link/skip-link.css +1 -1
- package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
- package/nationalarchives/components/tabs/fixtures.json +133 -12
- package/nationalarchives/components/tabs/macro-options.json +13 -0
- package/nationalarchives/components/tabs/tabs.css +1 -1
- package/nationalarchives/components/tabs/tabs.css.map +1 -1
- package/nationalarchives/components/tabs/tabs.js +1 -1
- package/nationalarchives/components/tabs/tabs.js.map +1 -1
- package/nationalarchives/components/tabs/tabs.mjs +12 -11
- package/nationalarchives/components/tabs/tabs.scss +13 -2
- package/nationalarchives/components/tabs/template.njk +8 -5
- package/nationalarchives/components/tags/tags.css +1 -1
- package/nationalarchives/components/tags/tags.css.map +1 -1
- package/nationalarchives/components/text-input/fixtures.json +1 -1
- package/nationalarchives/components/textarea/TextAreaCharacterCount.mjs +160 -0
- package/nationalarchives/components/textarea/TextAreaItemisedRows.mjs +202 -0
- package/nationalarchives/components/textarea/fixtures.json +42 -1
- package/nationalarchives/components/textarea/macro-options.json +36 -1
- package/nationalarchives/components/textarea/template.njk +11 -2
- package/nationalarchives/components/textarea/textarea.css +1 -1
- package/nationalarchives/components/textarea/textarea.css.map +1 -1
- package/nationalarchives/components/textarea/textarea.js +1 -1
- package/nationalarchives/components/textarea/textarea.js.map +1 -1
- package/nationalarchives/components/textarea/textarea.mjs +3 -197
- package/nationalarchives/components/textarea/textarea.scss +12 -1
- package/nationalarchives/components/warning/warning.css +1 -1
- package/nationalarchives/components/warning/warning.css.map +1 -1
- package/nationalarchives/error-page.css +1 -1
- package/nationalarchives/error-page.css.map +1 -1
- package/nationalarchives/prototype-kit.css +1 -1
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/nationalarchives/templates/fixtures.json +3 -3
- package/nationalarchives/templates/layouts/_generic.njk +2 -14
- package/nationalarchives/templates/macros/title.njk +63 -0
- package/nationalarchives/tools/_spacing.scss +2 -1
- package/nationalarchives/utilities/a11y/_index.scss +1 -2
- package/nationalarchives/utilities/forms/form-item.njk +1 -1
- package/nationalarchives/utilities/typography/_index.scss +13 -5
- package/package.json +4 -4
- package/nationalarchives/assets/images/nationalarchives-opengraph-image-dark.png +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export class Tabs {
|
|
2
2
|
constructor($module) {
|
|
3
3
|
this.$module = $module;
|
|
4
|
+
this.$tabListHeading =
|
|
5
|
+
$module && $module.querySelector(".tna-tabs__list-heading");
|
|
4
6
|
this.$tabList = $module && $module.querySelector(".tna-tabs__list");
|
|
5
7
|
this.$tabListItemLinks =
|
|
6
8
|
$module &&
|
|
@@ -28,23 +30,24 @@ export class Tabs {
|
|
|
28
30
|
|
|
29
31
|
init() {
|
|
30
32
|
this.$module.classList.add("tna-tabs--interactive");
|
|
31
|
-
this.$
|
|
33
|
+
this.$tabListHeading.remove();
|
|
34
|
+
const clickEventHandler = (event) => this.handleItemLinkClick(event);
|
|
32
35
|
this.$tabListItemLinks.forEach(($tabListItemLink) => {
|
|
33
36
|
const tabPanelID = $tabListItemLink.getAttribute("aria-controls");
|
|
34
37
|
$tabListItemLink.setAttribute("aria-selected", false);
|
|
35
38
|
const $tabPanel = document.getElementById(tabPanelID);
|
|
36
39
|
$tabPanel.setAttribute("aria-labelledby", $tabListItemLink.id);
|
|
37
40
|
$tabPanel.setAttribute("role", "tabpanel");
|
|
38
|
-
$tabListItemLink.addEventListener(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
true,
|
|
42
|
-
);
|
|
41
|
+
$tabListItemLink.addEventListener("click", clickEventHandler, {
|
|
42
|
+
capture: true,
|
|
43
|
+
});
|
|
43
44
|
});
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
this.handleItemLinkKeyDown(event),
|
|
45
|
+
this.$tabList.addEventListener(
|
|
46
|
+
"keydown",
|
|
47
|
+
(event) => this.handleItemLinkKeyDown(event),
|
|
48
|
+
{ capture: true },
|
|
47
49
|
);
|
|
50
|
+
this.switchTabByIndex(this.currentTabIndex);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
handleItemLinkClick(itemLinkClickEvent) {
|
|
@@ -58,12 +61,10 @@ export class Tabs {
|
|
|
58
61
|
let preventDefaultKeyAction = false;
|
|
59
62
|
switch (itemLinkKeyDownEvent.key) {
|
|
60
63
|
case "ArrowLeft":
|
|
61
|
-
case "ArrowUp":
|
|
62
64
|
this.previousTab();
|
|
63
65
|
preventDefaultKeyAction = true;
|
|
64
66
|
break;
|
|
65
67
|
case "ArrowRight":
|
|
66
|
-
case "ArrowDown":
|
|
67
68
|
this.nextTab();
|
|
68
69
|
preventDefaultKeyAction = true;
|
|
69
70
|
break;
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
list-style: none;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
&__button-wrapper {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
|
|
26
30
|
&__button {
|
|
27
31
|
position: relative;
|
|
28
32
|
|
|
@@ -47,6 +51,8 @@
|
|
|
47
51
|
&[aria-selected="true"] {
|
|
48
52
|
padding-top: 0;
|
|
49
53
|
|
|
54
|
+
text-decoration: none;
|
|
55
|
+
|
|
50
56
|
@include colour.colour-border("keyline");
|
|
51
57
|
border-radius: bordersVars.$rounded-border-radius
|
|
52
58
|
bordersVars.$rounded-border-radius 0 0;
|
|
@@ -70,8 +76,6 @@
|
|
|
70
76
|
|
|
71
77
|
@include colour.colour-font("font-base");
|
|
72
78
|
|
|
73
|
-
// @include colour.base;
|
|
74
|
-
// @include colour.tint;
|
|
75
79
|
@include colour.colour-background("background-tint");
|
|
76
80
|
|
|
77
81
|
@include borders.rounded-border;
|
|
@@ -123,6 +127,13 @@
|
|
|
123
127
|
|
|
124
128
|
&--interactive &__item {
|
|
125
129
|
padding: spacing.space(1);
|
|
130
|
+
|
|
126
131
|
@include colour.colour-border("keyline", 1px, solid);
|
|
127
132
|
}
|
|
133
|
+
|
|
134
|
+
@include colour.on-forced-colours {
|
|
135
|
+
&__button[aria-selected="false"] {
|
|
136
|
+
border-width: 0;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
128
139
|
}
|
|
@@ -4,15 +4,18 @@
|
|
|
4
4
|
{%- endif -%}
|
|
5
5
|
{%- set classes = containerClasses | join(' ') -%}
|
|
6
6
|
<div class="tna-tabs{% if classes %} {{ classes }}{% endif %}" data-module="tna-tabs"{% if params.activeTabOnLoad %} data-active-tab-on-load="{{ params.activeTabOnLoad }}"{% endif %}{% if params.allowClose %} data-allow-close="true"{% endif %}{% for attribute, value in params.attributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
|
7
|
-
<
|
|
7
|
+
<h{{ params.itemHeadingLevel }} class="tna-tabs__list-heading tna-heading-m">{{ params.tabsTitle or 'Contents' }}</h{{ params.itemHeadingLevel }}>
|
|
8
|
+
<ul class="tna-tabs__list" role="tablist">
|
|
8
9
|
{%- for item in params.items %}
|
|
9
|
-
|
|
10
|
+
<li class="tna-tabs__button-wrapper" role="presentation">
|
|
11
|
+
<a href="#{{ item.id }}" class="tna-tabs__button{% if item.classes %} {{ item.classes }}{% endif %}" id="{{ item.id }}-tab" aria-controls="{{ item.id }}" role="tab"{% if item.ariaLabel %} aria-label="{{ item.ariaLabel }}"{% endif %} {%- for attribute, value in item.attributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
|
10
12
|
<span class="tna-tabs__button-inner">
|
|
11
|
-
{{ item.title }}
|
|
13
|
+
{{ item.tabTitle or item.title }}
|
|
12
14
|
</span>
|
|
13
|
-
</
|
|
15
|
+
</a>
|
|
16
|
+
</li>
|
|
14
17
|
{%- endfor %}
|
|
15
|
-
</
|
|
18
|
+
</ul>
|
|
16
19
|
<div class="tna-tabs__items">
|
|
17
20
|
{%- for item in params.items %}
|
|
18
21
|
<section id="{{ item.id }}" class="tna-tabs__item">
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.tna-tags{margin-top:2rem}.tna-tags:first-child{margin-top:0}.tna-tags{display:flex;flex-wrap:wrap;gap:0.5rem 0.75rem;list-style:none}.tna-tags--small{gap:0.5rem;font-size:1rem}.tna-tags--stacked{flex-direction:column;align-items:flex-start}.tna-tags__item{position:relative}.tna-tags__link{padding:0 0.625rem;display:block;line-height:1.75;border:1px var(--keyline, rgba(38, 38, 42, 0.25)) solid;border-radius:2px}.tna-tags__item--selected .tna-tags__link{padding-left:calc(0.625rem + 5px);font-weight:700}.tna-tags__item--selected .tna-tags__link::after{content:"";position:absolute;top:0;bottom:0;left:0;border-left:5px var(--accent-border, rgb(140, 150, 148)) solid;border-radius:2px 0 0 2px}.tna-tags--small .tna-tags__link{padding-inline:0.5rem}.tna-tags--small .tna-tags__item--selected .tna-tags__link{padding-left:calc(0.5rem + 5px)}/*# sourceMappingURL=tags.css.map */
|
|
1
|
+
.tna-tags{margin-top:2rem}.tna-tags:first-child,.tna-tags:first-child.tna-visually-hidden+*{margin-top:0}.tna-tags{display:flex;flex-wrap:wrap;gap:0.5rem 0.75rem;list-style:none}.tna-tags--small{gap:0.5rem;font-size:1rem}.tna-tags--stacked{flex-direction:column;align-items:flex-start}.tna-tags__item{position:relative}.tna-tags__link{padding:0 0.625rem;display:block;line-height:1.75;border:1px var(--keyline, rgba(38, 38, 42, 0.25)) solid;border-radius:2px}.tna-tags__item--selected .tna-tags__link{padding-left:calc(0.625rem + 5px);font-weight:700}.tna-tags__item--selected .tna-tags__link::after{content:"";position:absolute;top:0;bottom:0;left:0;border-left:5px var(--accent-border, rgb(140, 150, 148)) solid;border-radius:2px 0 0 2px}.tna-tags--small .tna-tags__link{padding-inline:0.5rem}.tna-tags--small .tna-tags__item--selected .tna-tags__link{padding-left:calc(0.5rem + 5px)}/*# sourceMappingURL=tags.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/tools/_spacing.scss","../../../../src/nationalarchives/components/tags/tags.scss","../../../../src/nationalarchives/tools/_typography.scss","../../../../src/nationalarchives/tools/_colour.scss","../../../../src/nationalarchives/tools/_borders.scss","../../../../src/nationalarchives/variables/_borders.scss","../../../../src/nationalarchives/variables/_typography.scss"],"names":[],"mappings":"AA0BA,UACE,gBAUA,sBACE,aChCJ,UAGE,aACA,eACA,mBAEA,gBAEA,iBACE,WCVF,eDeA,mBACE,sBACA,uBAGF,gBACE,kBAGF,gBACE,mBAEA,cAEA,iBE2EE,wDC3GJ,cCDsB,IJuCtB,0CACE,kCCnBF,YIiBsB,ILMpB,iDACE,WAEA,kBACA,MACA,SACA,OEgDA,+DF7CA,0BAKJ,iCACE,sBAGF,2DACE","file":"tags.css","sourcesContent":["@use \"sass:map\";\n@use \"sass:math\";\n@use \"../variables/spacing\";\n@use \"../variables/typography\";\n@use \"../tools/media\";\n\n/*\n * ------------------------------------------\n * Spacing is created with rem rather than px\n * units as when users use a custom font size\n * some browsers handle the resize of rem and\n * em separately from px which causes spacing\n * and layout issues, so to ensure everything\n * remaians consistent we use rem for spacing\n * and typography. The original intention was\n * separation so that we could scale the type\n * without affecting spacing, but in practice\n * there are too many ways to change the font\n * size in various browsers and devices\n * ------------------------------------------\n */\n@function space($size) {\n // @return #{$size * spacing.$spacing-unit-px}px;\n @return #{$size}rem;\n}\n\n%space-above {\n margin-top: space(2);\n @extend %no-space-above-for-first-children;\n}\n\n%space-only-above {\n margin: #{space(2)} 0 0;\n @extend %no-space-above-for-first-children;\n}\n\n%no-space-above-for-first-children {\n &:first-child {\n margin-top: 0;\n }\n}\n\n@mixin space-above($zero-other-margins: false) {\n @if $zero-other-margins {\n @extend %space-only-above;\n } @else {\n @extend %space-above;\n }\n}\n\n@mixin no-spacing-generator($suffix: \"\") {\n @if $suffix != \"\" {\n $suffix: \"-\" + $suffix;\n }\n @each $property in margin, padding {\n @each $direction in top, bottom {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix},\n .tna-\\!--no-#{$property}-#{$combined-direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n } @else {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n }\n }\n }\n}\n\n@mixin spacing-generator($suffix: \"\") {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n\n @include media.on-mobile {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing-mobile {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n }\n}\n","@use \"../../variables/borders\" as bordersVars;\n@use \"../../tools/borders\";\n@use \"../../tools/colour\";\n@use \"../../tools/spacing\";\n@use \"../../tools/typography\";\n\n.tna-tags {\n @include spacing.space-above;\n\n display: flex;\n flex-wrap: wrap;\n gap: spacing.space(0.5) spacing.space(0.75);\n\n list-style: none;\n\n &--small {\n gap: spacing.space(0.5);\n\n @include typography.font-size(16);\n }\n\n &--stacked {\n flex-direction: column;\n align-items: flex-start;\n }\n\n &__item {\n position: relative;\n }\n\n &__link {\n padding: 0 spacing.space(0.625);\n\n display: block;\n\n line-height: 1.75;\n\n @include colour.colour-border(\"keyline\", 1px);\n @include borders.rounded-border;\n }\n\n &__item--selected &__link {\n padding-left: calc(spacing.space(0.625) + bordersVars.$thick-border-width);\n\n @include typography.main-font-weight-bold;\n\n &::after {\n content: \"\";\n\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n\n @include colour.thick-keyline-accent(left);\n border-radius: bordersVars.$rounded-border-radius 0 0\n bordersVars.$rounded-border-radius;\n }\n }\n\n &--small &__link {\n padding-inline: spacing.space(0.5);\n }\n\n &--small &__item--selected &__link {\n padding-left: calc(spacing.space(0.5) + bordersVars.$thick-border-width);\n }\n}\n","@use \"sass:math\";\n@use \"../variables/typography\";\n@use \"colour\";\n@use \"media\";\n\n@mixin font-size($font-size-px) {\n font-size: #{math.div($font-size-px, typography.$relative-1rem-px)}rem;\n}\n\n@mixin relative-font-size($font-size-px) {\n @warn \"relative-font-size() will soon be deprecated in favour of font-size().\";\n @include font-size($font-size-px);\n}\n\n@mixin main-font-weight {\n font-weight: typography.$main-font-weight;\n}\n\n@mixin main-font-weight-medium {\n font-weight: typography.$main-font-weight-medium;\n}\n\n@mixin main-font-weight-bold {\n font-weight: typography.$main-font-weight-bold;\n}\n\n@mixin main-font($bold: false) {\n font-family: typography.$main-font-family;\n font-variation-settings: \"wdth\" 100;\n font-style: normal;\n font-optical-sizing: auto;\n @if $bold {\n @include main-font-weight-bold;\n } @else {\n @include main-font-weight;\n }\n}\n\n@mixin heading-font {\n font-family: typography.$heading-font-family;\n font-weight: typography.$heading-font-weight;\n}\n\n@mixin detail-font($bold: false) {\n font-family: typography.$detail-font-family;\n font-style: normal;\n font-optical-sizing: auto;\n @if $bold {\n font-weight: typography.$detail-font-weight-bold;\n } @else {\n font-weight: typography.$detail-font-weight;\n }\n}\n\n@mixin detail-font-small {\n @include detail-font;\n @include font-size(14);\n line-height: 1.1;\n text-transform: uppercase;\n}\n\n@mixin interactable-text-decoration {\n text-decoration-thickness: typography.$interactable-text-decoration-thickness;\n text-underline-offset: typography.$interactable-text-decoration-offset;\n}\n\n@mixin interacted-text-decoration {\n text-decoration: underline;\n text-decoration-thickness: typography.$interactive-text-decoration-thickness;\n text-underline-offset: typography.$interactable-text-decoration-offset;\n}\n\n@mixin heading-generator(\n $font-size-default,\n $font-size-medium,\n $font-size-small,\n $font-size-tiny,\n $line-height\n) {\n $small-and-tiny-identical: $font-size-small == $font-size-tiny;\n $medium-small-and-tiny-identical: $font-size-medium == $font-size-small and\n $small-and-tiny-identical;\n $all-identical: $font-size-default == $font-size-medium and\n $medium-small-and-tiny-identical and $small-and-tiny-identical;\n line-height: $line-height;\n @include font-size($font-size-default);\n\n @if $all-identical != true {\n @if $medium-small-and-tiny-identical != true {\n @include media.on-medium {\n @include font-size($font-size-medium);\n }\n\n @if $small-and-tiny-identical != true {\n @include media.on-small {\n @include font-size($font-size-small);\n }\n\n @include media.on-tiny {\n @include font-size($font-size-tiny);\n }\n } @else {\n @include media.on-mobile {\n @include font-size($font-size-small);\n }\n }\n } @else {\n @include media.on-smaller-than-large {\n @include font-size($font-size-medium);\n }\n }\n }\n}\n","@use \"sass:list\";\n@use \"sass:map\";\n@use \"sass:meta\";\n@use \"../variables/a11y\";\n@use \"../variables/borders\";\n@use \"../variables/forms\";\n@use \"../variables/colour\";\n@use \"../variables/features\";\n@use \"../tools/media\";\n\n$base-colours: (\n \"background\",\n \"font-base\",\n \"font-dark\",\n \"font-light\",\n \"icon-light\",\n \"link\",\n \"link-visited\",\n \"keyline\",\n \"keyline-dark\"\n);\n\n@function brand-colour($colour, $opacity: 1) {\n @return colour.brand-colour($colour, $opacity);\n}\n\n@mixin colour-css-vars($excludes...) {\n @each $name, $value in colour.$colour-palette-default {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index((\"keyline\", \"keyline-dark\"), $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@function colour-var($colour) {\n @return var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n );\n}\n\n@mixin colour-font($colour, $important: false) {\n color: colour-var($colour) if(sass($important): !important; else: null);\n}\n\n@mixin colour-background($colour, $important: false) {\n background-color: colour-var($colour)\n if(sass($important): !important; else: null);\n}\n\n@mixin colour-background-brand($brandColour, $important: false) {\n background-color: #{brand-colour($brandColour)}\n if(sass($important): !important; else: null);\n}\n\n@mixin colour-border(\n $colour,\n $width: \"\",\n $style: solid,\n $direction: \"\",\n $important: false\n) {\n @if $direction != \"\" {\n @if $width != \"\" {\n border-#{$direction}: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n border-#{$direction}-color: colour-var($colour)\n if(sass($important): !important; else: null);\n }\n } @else {\n @if $width != \"\" {\n border: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n border-color: var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n )\n if(sass($important): !important; else: null);\n }\n }\n}\n\n@mixin colour-outline($colour, $width: \"\", $style: solid, $important: false) {\n @if $width != \"\" {\n outline: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n outline-color: colour-var($colour)\n if(sass($important): !important; else: null);\n }\n}\n\n@mixin colour-fill($colour, $important: false) {\n fill: colour-var($colour) if(sass($important): !important; else: null);\n}\n\n%colour-input {\n @include colour-font(\"input-foreground\");\n @include colour-background(\"input-background\");\n @include colour-border(\"input-border\", forms.$form-field-border-width);\n\n &:hover {\n outline: a11y.$focus-outline-active-total-width var(--keyline) solid;\n }\n}\n\n@mixin colour-input() {\n @extend %colour-input;\n}\n\n@mixin thick-keyline($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"keyline\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"keyline\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-dark($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"keyline-dark\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"keyline-dark\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-accent($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"accent-border\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"accent-border\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-error($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\n \"form-error-border\",\n $border-width,\n solid,\n $direction\n );\n } @else {\n @include colour-border(\"form-error-border\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-brand($direction: \"\", $brandColour, $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n border-#{$direction}: $border-width #{brand-colour($brandColour)} solid;\n } @else {\n border: $border-width #{brand-colour($brandColour)} solid;\n }\n}\n\n@mixin thick-keyline-transparent($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n border-#{$direction}: $border-width transparent solid;\n } @else {\n border: $border-width transparent solid;\n }\n}\n\n%always-light {\n @include colour-css-vars;\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast;\n }\n}\n\n@mixin always-light {\n @extend %always-light;\n}\n\n%contrast {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-border: var(--accent-border-bright);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin contrast {\n @extend %contrast;\n}\n\n%contrast-on-mobile {\n @include media.on-mobile {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-border: var(--accent-border-bright);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n }\n}\n\n@mixin contrast-on-mobile {\n @extend %contrast-on-mobile;\n}\n\n%base {\n @each $name, $value in $base-colours {\n --#{$name}: var(--base-#{$value});\n }\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin base {\n @extend %base;\n}\n\n%tint {\n --background: var(--background-tint);\n\n @include colour-background(\"background\");\n}\n\n@mixin tint {\n @extend %tint;\n}\n\n%accent {\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin accent {\n @extend %accent;\n}\n\n%accent-light {\n --background: var(--accent-background-light);\n --font-base: #{map.get(colour.$colour-palette-default, \"font-base\")};\n --font-dark: #{map.get(colour.$colour-palette-default, \"font-dark\")};\n --font-light: #{map.get(colour.$colour-palette-default, \"font-light\")};\n --icon-light: #{map.get(colour.$colour-palette-default, \"icon-light\")};\n --keyline: #{map.get(colour.$colour-palette-default, \"keyline\")};\n --keyline-dark: #{map.get(colour.$colour-palette-default, \"keyline-dark\")};\n --button-text: #{map.get(colour.$colour-palette-default, \"button-text\")};\n --button-background: #{map.get(\n colour.$colour-palette-default,\n \"button-background\"\n )};\n --button-hover-text: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-text\"\n )};\n --button-hover-background: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-background\"\n )};\n --accent-border: var(--accent-background);\n\n @include colour-background(\"background\");\n @include colour-font(\"font-base\");\n\n .tna-template--system-theme & {\n @media (prefers-color-scheme: dark) {\n // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n }\n }\n\n .tna-template--dark-theme & {\n // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n }\n}\n\n@mixin accent-light {\n @extend %accent-light;\n}\n\n%yellow-accent {\n --accent-background: #{colour.brand-colour(\"yellow\")} !important;\n --accent-background-light: #{colour.brand-colour(\"cream\")} !important;\n --accent-border: #{colour.brand-colour(\"yellow\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"yellow\")} !important;\n --accent-font-base: #{colour.brand-colour(\"black\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"black\")} !important;\n --accent-font-light: #{colour.brand-colour(\"black\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"black\", 0.7)} !important;\n --accent-link: #{colour.brand-colour(\"black\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"black\")} !important;\n --accent-keyline: #{colour.brand-colour(\"black\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"black\", 0.8)} !important;\n --button-accented-text: #{colour.brand-colour(\"black\")} !important;\n --button-accented-background: #{colour.brand-colour(\"yellow\")} !important;\n}\n\n@mixin yellow-accent {\n @extend %yellow-accent;\n}\n\n%accent-lighter-text {\n --accent-font-base: #{colour.brand-colour(\"white\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"white\")} !important;\n --accent-font-light: #{colour.brand-colour(\"white\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"white\", 0.7)} !important;\n --accent-link: #{colour.brand-colour(\"white\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"white\")} !important;\n --accent-keyline: #{colour.brand-colour(\"white\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"white\", 0.8)} !important;\n --button-accented-text: #{colour.brand-colour(\"white\")} !important;\n}\n\n%black-accent {\n --accent-background: #{colour.brand-colour(\"black\")} !important;\n --accent-background-light: #{colour.brand-colour(\"light-grey\")} !important;\n --accent-border: #{colour.brand-colour(\"black\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"grey\")} !important;\n --button-accented-text: #{colour.brand-colour(\"black\")} !important;\n --button-accented-background: #{colour.brand-colour(\"grey\")} !important;\n}\n\n@mixin black-accent {\n @extend %accent-lighter-text;\n @extend %black-accent;\n}\n\n%pink-accent {\n --accent-background: #{colour.brand-colour(\"maroon\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-pink\")} !important;\n --accent-border: #{colour.brand-colour(\"maroon\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"pink\")} !important;\n --button-accented-background: #{colour.brand-colour(\"maroon\")} !important;\n}\n\n@mixin pink-accent {\n @extend %accent-lighter-text;\n @extend %pink-accent;\n}\n\n%orange-accent {\n --accent-background: #{colour.brand-colour(\"chestnut\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-orange\")} !important;\n --accent-border: #{colour.brand-colour(\"chestnut\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"orange\")} !important;\n --button-accented-background: #{colour.brand-colour(\"chestnut\")} !important;\n}\n\n@mixin orange-accent {\n @extend %accent-lighter-text;\n @extend %orange-accent;\n}\n\n%green-accent {\n --accent-background: #{colour.brand-colour(\"forest\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-green\")} !important;\n --accent-border: #{colour.brand-colour(\"forest\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"green\")} !important;\n --button-accented-background: #{colour.brand-colour(\"forest\")} !important;\n}\n\n@mixin green-accent {\n @extend %accent-lighter-text;\n @extend %green-accent;\n}\n\n%blue-accent {\n --accent-background: #{colour.brand-colour(\"navy\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-blue\")} !important;\n --accent-border: #{colour.brand-colour(\"navy\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"blue\")} !important;\n --button-accented-background: #{colour.brand-colour(\"navy\")} !important;\n}\n\n@mixin blue-accent {\n @extend %accent-lighter-text;\n @extend %blue-accent;\n}\n\n@mixin on-high-contrast {\n @media (prefers-contrast: more) {\n @content;\n }\n}\n\n@mixin on-forced-colours {\n @media (forced-colors: active) {\n @content;\n }\n}\n\n@mixin on-high-contrast-and-forced-colours {\n @include on-forced-colours {\n @content;\n }\n\n @include on-high-contrast {\n @content;\n }\n}\n\n%image-loader-background {\n background: linear-gradient(\n -45deg,\n rgb(0 0 0 / 25%),\n rgb(255 255 255 / 25%),\n rgb(0 0 0 / 25%)\n );\n background-size: 500% 500%;\n background-position: 0 50%;\n\n animation: image-loader-background ease-in-out 1.2s infinite;\n\n @media (prefers-reduced-motion) {\n animation: none !important;\n }\n}\n\n@mixin image-loader-background {\n @if features.$image-loader-animations {\n @extend %image-loader-background;\n }\n}\n","@use \"../variables/borders\";\n\n@mixin rounded-border {\n border-radius: borders.$rounded-border-radius;\n}\n","$thick-border-width: 5px !default;\n$very-thick-border-width: 8px !default;\n$rounded-border-radius: 2px !default;\n","@use \"sass:math\";\n\n/*\n * ------------------------------------------\n * The typefaces, sizes and spacings that are\n * defined in this file have been selected to\n * ensure 100% match with the latest National\n * Archives brand guidelines - avoid changing\n * or overwriting any of these values without\n * signing off with the Digital Services team\n * first\n * ------------------------------------------\n */\n\n$relative-1rem-px: 16; // 16px = 1rem\n\n/*\n * ------------------------------------------\n * When true, use the included font files for\n * Open Sans and Roboto Mono, rather than the\n * versions hosted by Google Fonts\n * ------------------------------------------\n */\n$use-local-fonts: false !default;\n\n$body-font-size-px: 19 !default;\n$body-font-size-px-medium: 18 !default;\n$body-font-size-px-mobile: 17 !default;\n$body-line-height: 1.75 !default;\n\n$interactable-text-decoration-offset: 0.125em !default;\n$interactable-text-decoration-thickness: #{math.div(1.5, $relative-1rem-px)}rem !default;\n$interactive-text-decoration-thickness: #{math.div(4, $relative-1rem-px)}rem !default;\n\n$main-font-family-name: \"Open Sans\" !default;\n$main-font-family:\n #{$main-font-family-name},\n sans-serif;\n$main-font-weight: 400 !default;\n$main-font-weight-medium: 600 !default;\n$main-font-weight-bold: 700 !default;\n$main-font-file: \"OpenSans-Regular.ttf\" !default;\n$main-font-file-medium: \"OpenSans-SemiBold.ttf\" !default;\n$main-font-file-bold: \"OpenSans-Bold.ttf\" !default;\n\n/*\n * ------------------------------------------\n * To use Supria Sans Condensed (which is the\n * approved heading typeface for The National\n * Archives), you need to obtain a licence to\n * properly embed the CSS files with the font\n * definitions in your service - check with a\n * member of the Digital Services team on how\n * to get a licence\n * ------------------------------------------\n */\n$heading-font-family-name: \"supria-sans-condensed\" !default;\n$heading-font-family:\n #{$heading-font-family-name},\n \"Arial Narrow\",\n sans-serif;\n$heading-font-weight: 500 !default;\n\n/*\n * ------------------------------------------\n * The detail font should be a monospace font\n * and is used for chips, supertitles as well\n * as the date search component\n * ------------------------------------------\n */\n$detail-font-family-name: \"Roboto Mono\" !default;\n$detail-font-family:\n #{$detail-font-family-name},\n monospace;\n$detail-font-weight: 400 !default;\n$detail-font-weight-bold: 500 !default;\n$detail-font-file: \"RobotoMono-Regular.ttf\" !default;\n$detail-font-file-bold: \"RobotoMono-Medium.ttf\" !default;\n\n$heading-xl-font-size-default: 64 !default;\n$heading-xl-font-size-medium: 48 !default;\n$heading-xl-font-size-small: 36 !default;\n$heading-xl-font-size-tiny: $heading-xl-font-size-small !default;\n$heading-xl-line-height: 1.1 !default;\n\n$heading-l-font-size-default: 36 !default;\n$heading-l-font-size-medium: 32 !default;\n$heading-l-font-size-small: 29 !default;\n$heading-l-font-size-tiny: $heading-l-font-size-small !default;\n$heading-l-line-height: 1.15 !default;\n\n$heading-m-font-size-default: 22 !default;\n$heading-m-font-size-medium: $heading-m-font-size-default !default;\n$heading-m-font-size-small: 21 !default;\n$heading-m-font-size-tiny: $heading-m-font-size-small !default;\n$heading-m-line-height: 1.4 !default;\n\n$heading-s-font-size-default: 19 !default;\n$heading-s-font-size-medium: $heading-s-font-size-default !default;\n$heading-s-font-size-small: $heading-s-font-size-default !default;\n$heading-s-font-size-tiny: $heading-s-font-size-default !default;\n$heading-s-line-height: 1.5 !default;\n\n$code-font-family: Consolas, Monaco, \"Ubuntu Mono\", monospace !default;\n"]}
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/tools/_spacing.scss","../../../../src/nationalarchives/components/tags/tags.scss","../../../../src/nationalarchives/tools/_typography.scss","../../../../src/nationalarchives/tools/_colour.scss","../../../../src/nationalarchives/tools/_borders.scss","../../../../src/nationalarchives/variables/_borders.scss","../../../../src/nationalarchives/variables/_typography.scss"],"names":[],"mappings":"AA0BA,UACE,gBAUA,kEAEE,aCjCJ,UAGE,aACA,eACA,mBAEA,gBAEA,iBACE,WCVF,eDeA,mBACE,sBACA,uBAGF,gBACE,kBAGF,gBACE,mBAEA,cAEA,iBE2EE,wDC3GJ,cCDsB,IJuCtB,0CACE,kCCnBF,YIiBsB,ILMpB,iDACE,WAEA,kBACA,MACA,SACA,OEgDA,+DF7CA,0BAKJ,iCACE,sBAGF,2DACE","file":"tags.css","sourcesContent":["@use \"sass:map\";\n@use \"sass:math\";\n@use \"../variables/spacing\";\n@use \"../variables/typography\";\n@use \"../tools/media\";\n\n/*\n * ------------------------------------------\n * Spacing is created with rem rather than px\n * units as when users use a custom font size\n * some browsers handle the resize of rem and\n * em separately from px which causes spacing\n * and layout issues, so to ensure everything\n * remaians consistent we use rem for spacing\n * and typography. The original intention was\n * separation so that we could scale the type\n * without affecting spacing, but in practice\n * there are too many ways to change the font\n * size in various browsers and devices\n * ------------------------------------------\n */\n@function space($size) {\n // @return #{$size * spacing.$spacing-unit-px}px;\n @return #{$size}rem;\n}\n\n%space-above {\n margin-top: space(2);\n @extend %no-space-above-for-first-children;\n}\n\n%space-only-above {\n margin: #{space(2)} 0 0;\n @extend %no-space-above-for-first-children;\n}\n\n%no-space-above-for-first-children {\n &:first-child,\n &:first-child.tna-visually-hidden + * {\n margin-top: 0;\n }\n}\n\n@mixin space-above($zero-other-margins: false) {\n @if $zero-other-margins {\n @extend %space-only-above;\n } @else {\n @extend %space-above;\n }\n}\n\n@mixin no-spacing-generator($suffix: \"\") {\n @if $suffix != \"\" {\n $suffix: \"-\" + $suffix;\n }\n @each $property in margin, padding {\n @each $direction in top, bottom {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix},\n .tna-\\!--no-#{$property}-#{$combined-direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n } @else {\n .tna-\\!--no-#{$property}-#{$direction}#{$suffix} {\n #{$property}-#{$direction}: 0 !important;\n }\n }\n }\n }\n}\n\n@mixin spacing-generator($suffix: \"\") {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n\n @include media.on-mobile {\n @each $property in margin, padding {\n @each $direction in top, bottom {\n @each $size, $amount in spacing.$spacing-mobile {\n @if $direction == all {\n .tna-\\!--#{$property}-#{$size} {\n #{$property}: #{space($amount)} !important;\n }\n } @else {\n $combined-direction: \"\";\n @if $direction == top or $direction == bottom {\n $combined-direction: vertical;\n } @else if $direction == right or $direction == left {\n $combined-direction: horizontal;\n }\n @if $combined-direction {\n .tna-\\!--#{$property}-#{$direction}-#{$size},\n .tna-\\!--#{$property}-#{$combined-direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n } @else {\n .tna-\\!--#{$property}-#{$direction}-#{$size} {\n #{$property}-#{$direction}: #{space($amount)} !important;\n }\n }\n }\n }\n }\n }\n }\n}\n","@use \"../../variables/borders\" as bordersVars;\n@use \"../../tools/borders\";\n@use \"../../tools/colour\";\n@use \"../../tools/spacing\";\n@use \"../../tools/typography\";\n\n.tna-tags {\n @include spacing.space-above;\n\n display: flex;\n flex-wrap: wrap;\n gap: spacing.space(0.5) spacing.space(0.75);\n\n list-style: none;\n\n &--small {\n gap: spacing.space(0.5);\n\n @include typography.font-size(16);\n }\n\n &--stacked {\n flex-direction: column;\n align-items: flex-start;\n }\n\n &__item {\n position: relative;\n }\n\n &__link {\n padding: 0 spacing.space(0.625);\n\n display: block;\n\n line-height: 1.75;\n\n @include colour.colour-border(\"keyline\", 1px);\n @include borders.rounded-border;\n }\n\n &__item--selected &__link {\n padding-left: calc(spacing.space(0.625) + bordersVars.$thick-border-width);\n\n @include typography.main-font-weight-bold;\n\n &::after {\n content: \"\";\n\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n\n @include colour.thick-keyline-accent(left);\n border-radius: bordersVars.$rounded-border-radius 0 0\n bordersVars.$rounded-border-radius;\n }\n }\n\n &--small &__link {\n padding-inline: spacing.space(0.5);\n }\n\n &--small &__item--selected &__link {\n padding-left: calc(spacing.space(0.5) + bordersVars.$thick-border-width);\n }\n}\n","@use \"sass:math\";\n@use \"../variables/typography\";\n@use \"colour\";\n@use \"media\";\n\n@mixin font-size($font-size-px) {\n font-size: #{math.div($font-size-px, typography.$relative-1rem-px)}rem;\n}\n\n@mixin relative-font-size($font-size-px) {\n @warn \"relative-font-size() will soon be deprecated in favour of font-size().\";\n @include font-size($font-size-px);\n}\n\n@mixin main-font-weight {\n font-weight: typography.$main-font-weight;\n}\n\n@mixin main-font-weight-medium {\n font-weight: typography.$main-font-weight-medium;\n}\n\n@mixin main-font-weight-bold {\n font-weight: typography.$main-font-weight-bold;\n}\n\n@mixin main-font($bold: false) {\n font-family: typography.$main-font-family;\n font-variation-settings: \"wdth\" 100;\n font-style: normal;\n font-optical-sizing: auto;\n @if $bold {\n @include main-font-weight-bold;\n } @else {\n @include main-font-weight;\n }\n}\n\n@mixin heading-font {\n font-family: typography.$heading-font-family;\n font-weight: typography.$heading-font-weight;\n}\n\n@mixin detail-font($bold: false) {\n font-family: typography.$detail-font-family;\n font-style: normal;\n font-optical-sizing: auto;\n @if $bold {\n font-weight: typography.$detail-font-weight-bold;\n } @else {\n font-weight: typography.$detail-font-weight;\n }\n}\n\n@mixin detail-font-small {\n @include detail-font;\n @include font-size(14);\n line-height: 1.1;\n text-transform: uppercase;\n}\n\n@mixin interactable-text-decoration {\n text-decoration-thickness: typography.$interactable-text-decoration-thickness;\n text-underline-offset: typography.$interactable-text-decoration-offset;\n}\n\n@mixin interacted-text-decoration {\n text-decoration: underline;\n text-decoration-thickness: typography.$interactive-text-decoration-thickness;\n text-underline-offset: typography.$interactable-text-decoration-offset;\n}\n\n@mixin heading-generator(\n $font-size-default,\n $font-size-medium,\n $font-size-small,\n $font-size-tiny,\n $line-height\n) {\n $small-and-tiny-identical: $font-size-small == $font-size-tiny;\n $medium-small-and-tiny-identical: $font-size-medium == $font-size-small and\n $small-and-tiny-identical;\n $all-identical: $font-size-default == $font-size-medium and\n $medium-small-and-tiny-identical and $small-and-tiny-identical;\n line-height: $line-height;\n @include font-size($font-size-default);\n\n @if $all-identical != true {\n @if $medium-small-and-tiny-identical != true {\n @include media.on-medium {\n @include font-size($font-size-medium);\n }\n\n @if $small-and-tiny-identical != true {\n @include media.on-small {\n @include font-size($font-size-small);\n }\n\n @include media.on-tiny {\n @include font-size($font-size-tiny);\n }\n } @else {\n @include media.on-mobile {\n @include font-size($font-size-small);\n }\n }\n } @else {\n @include media.on-smaller-than-large {\n @include font-size($font-size-medium);\n }\n }\n }\n}\n","@use \"sass:list\";\n@use \"sass:map\";\n@use \"sass:meta\";\n@use \"../variables/a11y\";\n@use \"../variables/borders\";\n@use \"../variables/forms\";\n@use \"../variables/colour\";\n@use \"../variables/features\";\n@use \"../tools/media\";\n\n$base-colours: (\n \"background\",\n \"font-base\",\n \"font-dark\",\n \"font-light\",\n \"icon-light\",\n \"link\",\n \"link-visited\",\n \"keyline\",\n \"keyline-dark\"\n);\n\n@function brand-colour($colour, $opacity: 1) {\n @return colour.brand-colour($colour, $opacity);\n}\n\n@mixin colour-css-vars($excludes...) {\n @each $name, $value in colour.$colour-palette-default {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index($base-colours, $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@mixin colour-css-vars-high-contrast-dark($excludes...) {\n @each $name, $value in colour.$colour-palette-high-contrast-dark {\n @if not list.index($excludes, $name) {\n --#{$name}: #{$value};\n @if list.index((\"keyline\", \"keyline-dark\"), $name) {\n --base-#{$name}: #{$value};\n }\n }\n }\n}\n\n@function colour-var($colour) {\n @return var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n );\n}\n\n@mixin colour-font($colour, $important: false) {\n color: colour-var($colour) if(sass($important): !important; else: null);\n}\n\n@mixin colour-background($colour, $important: false) {\n background-color: colour-var($colour)\n if(sass($important): !important; else: null);\n}\n\n@mixin colour-background-brand($brandColour, $important: false) {\n background-color: #{brand-colour($brandColour)}\n if(sass($important): !important; else: null);\n}\n\n@mixin colour-border(\n $colour,\n $width: \"\",\n $style: solid,\n $direction: \"\",\n $important: false\n) {\n @if $direction != \"\" {\n @if $width != \"\" {\n border-#{$direction}: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n border-#{$direction}-color: colour-var($colour)\n if(sass($important): !important; else: null);\n }\n } @else {\n @if $width != \"\" {\n border: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n border-color: var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n )\n if(sass($important): !important; else: null);\n }\n }\n}\n\n@mixin colour-outline($colour, $width: \"\", $style: solid, $important: false) {\n @if $width != \"\" {\n outline: $width\n colour-var($colour)\n $style\n if(sass($important): !important; else: null);\n } @else {\n outline-color: colour-var($colour)\n if(sass($important): !important; else: null);\n }\n}\n\n@mixin colour-fill($colour, $important: false) {\n fill: colour-var($colour) if(sass($important): !important; else: null);\n}\n\n%colour-input {\n @include colour-font(\"input-foreground\");\n @include colour-background(\"input-background\");\n @include colour-border(\"input-border\", forms.$form-field-border-width);\n\n &:hover {\n outline: a11y.$focus-outline-active-total-width var(--keyline) solid;\n }\n}\n\n@mixin colour-input() {\n @extend %colour-input;\n}\n\n@mixin thick-keyline($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"keyline\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"keyline\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-dark($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"keyline-dark\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"keyline-dark\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-accent($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\"accent-border\", $border-width, solid, $direction);\n } @else {\n @include colour-border(\"accent-border\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-error($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n @include colour-border(\n \"form-error-border\",\n $border-width,\n solid,\n $direction\n );\n } @else {\n @include colour-border(\"form-error-border\", $border-width, solid);\n }\n}\n\n@mixin thick-keyline-brand($direction: \"\", $brandColour, $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n border-#{$direction}: $border-width #{brand-colour($brandColour)} solid;\n } @else {\n border: $border-width #{brand-colour($brandColour)} solid;\n }\n}\n\n@mixin thick-keyline-transparent($direction: \"\", $veryThick: false) {\n $border-width: borders.$thick-border-width;\n @if $veryThick {\n $border-width: borders.$very-thick-border-width;\n }\n @if $direction != \"\" {\n border-#{$direction}: $border-width transparent solid;\n } @else {\n border: $border-width transparent solid;\n }\n}\n\n%always-light {\n @include colour-css-vars;\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast;\n }\n}\n\n@mixin always-light {\n @extend %always-light;\n}\n\n%contrast {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-border: var(--accent-border-bright);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin contrast {\n @extend %contrast;\n}\n\n%contrast-on-mobile {\n @include media.on-mobile {\n --background: var(--contrast-background);\n --font-base: var(--contrast-font-base);\n --font-dark: var(--contrast-font-dark);\n --font-light: var(--contrast-font-light);\n --icon-light: var(--contrast-icon-light);\n --link: var(--contrast-link);\n --link-visited: var(--contrast-link-visited);\n --keyline: var(--contrast-keyline);\n --keyline-dark: var(--contrast-keyline-dark);\n --button-text: var(--contrast-button-text);\n --button-background: var(--contrast-button-background);\n --button-hover-text: var(--contrast-button-hover-text);\n --button-hover-background: var(--contrast-button-hover-background);\n --accent-border: var(--accent-border-bright);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n }\n}\n\n@mixin contrast-on-mobile {\n @extend %contrast-on-mobile;\n}\n\n%base {\n @each $name, $value in $base-colours {\n --#{$name}: var(--base-#{$value});\n }\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin base {\n @extend %base;\n}\n\n%tint {\n --background: var(--background-tint);\n\n @include colour-background(\"background\");\n}\n\n@mixin tint {\n @extend %tint;\n}\n\n%accent {\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n\n @include colour-background(\"background\");\n\n @include colour-font(\"font-base\");\n}\n\n@mixin accent {\n @extend %accent;\n}\n\n%accent-light {\n --background: var(--accent-background-light);\n --font-base: #{map.get(colour.$colour-palette-default, \"font-base\")};\n --font-dark: #{map.get(colour.$colour-palette-default, \"font-dark\")};\n --font-light: #{map.get(colour.$colour-palette-default, \"font-light\")};\n --icon-light: #{map.get(colour.$colour-palette-default, \"icon-light\")};\n --keyline: #{map.get(colour.$colour-palette-default, \"keyline\")};\n --keyline-dark: #{map.get(colour.$colour-palette-default, \"keyline-dark\")};\n --button-text: #{map.get(colour.$colour-palette-default, \"button-text\")};\n --button-background: #{map.get(\n colour.$colour-palette-default,\n \"button-background\"\n )};\n --button-hover-text: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-text\"\n )};\n --button-hover-background: #{map.get(\n colour.$colour-palette-default,\n \"button-hover-background\"\n )};\n --accent-border: var(--accent-background);\n\n @include colour-background(\"background\");\n @include colour-font(\"font-base\");\n\n .tna-template--system-theme & {\n @media (prefers-color-scheme: dark) {\n // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n }\n }\n\n .tna-template--dark-theme & {\n // --link: #{map.get(colour.$colour-palette-default, \"link\")};\n // --link-visited: #{map.get(colour.$colour-palette-default, \"link-visited\")};\n\n --background: var(--accent-background);\n --font-base: var(--accent-font-base);\n --font-dark: var(--accent-font-dark);\n --font-light: var(--accent-font-light);\n --icon-light: var(--accent-icon-light);\n --link: var(--accent-link);\n --link-visited: var(--accent-link);\n --keyline: var(--accent-keyline);\n --keyline-dark: var(--accent-keyline-dark);\n --accent-border: var(--accent-font-dark);\n --button-text: var(--accent-button-text);\n --button-background: var(--accent-button-background);\n --button-hover-text: var(--accent-button-hover-text);\n --button-hover-background: var(--accent-button-hover-background);\n }\n}\n\n@mixin accent-light {\n @extend %accent-light;\n}\n\n%yellow-accent {\n --accent-background: #{colour.brand-colour(\"yellow\")} !important;\n --accent-background-light: #{colour.brand-colour(\"cream\")} !important;\n --accent-border: #{colour.brand-colour(\"yellow\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"yellow\")} !important;\n --accent-font-base: #{colour.brand-colour(\"black\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"black\")} !important;\n --accent-font-light: #{colour.brand-colour(\"black\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"black\", 0.7)} !important;\n --accent-link: #{colour.brand-colour(\"black\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"black\")} !important;\n --accent-keyline: #{colour.brand-colour(\"black\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"black\", 0.8)} !important;\n --button-accented-text: #{colour.brand-colour(\"black\")} !important;\n --button-accented-background: #{colour.brand-colour(\"yellow\")} !important;\n}\n\n@mixin yellow-accent {\n @extend %yellow-accent;\n}\n\n%accent-lighter-text {\n --accent-font-base: #{colour.brand-colour(\"white\")} !important;\n --accent-font-dark: #{colour.brand-colour(\"white\")} !important;\n --accent-font-light: #{colour.brand-colour(\"white\", 0.7)} !important;\n --accent-icon-light: #{colour.brand-colour(\"white\", 0.7)} !important;\n --accent-link: #{colour.brand-colour(\"white\")} !important;\n --accent-link-visited: #{colour.brand-colour(\"white\")} !important;\n --accent-keyline: #{colour.brand-colour(\"white\", 0.5)} !important;\n --accent-keyline-dark: #{colour.brand-colour(\"white\", 0.8)} !important;\n --button-accented-text: #{colour.brand-colour(\"white\")} !important;\n}\n\n%black-accent {\n --accent-background: #{colour.brand-colour(\"black\")} !important;\n --accent-background-light: #{colour.brand-colour(\"light-grey\")} !important;\n --accent-border: #{colour.brand-colour(\"black\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"grey\")} !important;\n --button-accented-text: #{colour.brand-colour(\"black\")} !important;\n --button-accented-background: #{colour.brand-colour(\"grey\")} !important;\n}\n\n@mixin black-accent {\n @extend %accent-lighter-text;\n @extend %black-accent;\n}\n\n%pink-accent {\n --accent-background: #{colour.brand-colour(\"maroon\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-pink\")} !important;\n --accent-border: #{colour.brand-colour(\"maroon\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"pink\")} !important;\n --button-accented-background: #{colour.brand-colour(\"maroon\")} !important;\n}\n\n@mixin pink-accent {\n @extend %accent-lighter-text;\n @extend %pink-accent;\n}\n\n%orange-accent {\n --accent-background: #{colour.brand-colour(\"chestnut\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-orange\")} !important;\n --accent-border: #{colour.brand-colour(\"chestnut\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"orange\")} !important;\n --button-accented-background: #{colour.brand-colour(\"chestnut\")} !important;\n}\n\n@mixin orange-accent {\n @extend %accent-lighter-text;\n @extend %orange-accent;\n}\n\n%green-accent {\n --accent-background: #{colour.brand-colour(\"forest\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-green\")} !important;\n --accent-border: #{colour.brand-colour(\"forest\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"green\")} !important;\n --button-accented-background: #{colour.brand-colour(\"forest\")} !important;\n}\n\n@mixin green-accent {\n @extend %accent-lighter-text;\n @extend %green-accent;\n}\n\n%blue-accent {\n --accent-background: #{colour.brand-colour(\"navy\")} !important;\n --accent-background-light: #{colour.brand-colour(\"pastel-blue\")} !important;\n --accent-border: #{colour.brand-colour(\"navy\")} !important;\n --accent-border-bright: #{colour.brand-colour(\"blue\")} !important;\n --button-accented-background: #{colour.brand-colour(\"navy\")} !important;\n}\n\n@mixin blue-accent {\n @extend %accent-lighter-text;\n @extend %blue-accent;\n}\n\n@mixin on-high-contrast {\n @media (prefers-contrast: more) {\n @content;\n }\n}\n\n@mixin on-forced-colours {\n @media (forced-colors: active) {\n @content;\n }\n}\n\n@mixin on-high-contrast-and-forced-colours {\n @include on-forced-colours {\n @content;\n }\n\n @include on-high-contrast {\n @content;\n }\n}\n\n%image-loader-background {\n background: linear-gradient(\n -45deg,\n rgb(0 0 0 / 25%),\n rgb(255 255 255 / 25%),\n rgb(0 0 0 / 25%)\n );\n background-size: 500% 500%;\n background-position: 0 50%;\n\n animation: image-loader-background ease-in-out 1.2s infinite;\n\n @media (prefers-reduced-motion) {\n animation: none !important;\n }\n}\n\n@mixin image-loader-background {\n @if features.$image-loader-animations {\n @extend %image-loader-background;\n }\n}\n","@use \"../variables/borders\";\n\n@mixin rounded-border {\n border-radius: borders.$rounded-border-radius;\n}\n","$thick-border-width: 5px !default;\n$very-thick-border-width: 8px !default;\n$rounded-border-radius: 2px !default;\n","@use \"sass:math\";\n\n/*\n * ------------------------------------------\n * The typefaces, sizes and spacings that are\n * defined in this file have been selected to\n * ensure 100% match with the latest National\n * Archives brand guidelines - avoid changing\n * or overwriting any of these values without\n * signing off with the Digital Services team\n * first\n * ------------------------------------------\n */\n\n$relative-1rem-px: 16; // 16px = 1rem\n\n/*\n * ------------------------------------------\n * When true, use the included font files for\n * Open Sans and Roboto Mono, rather than the\n * versions hosted by Google Fonts\n * ------------------------------------------\n */\n$use-local-fonts: false !default;\n\n$body-font-size-px: 19 !default;\n$body-font-size-px-medium: 18 !default;\n$body-font-size-px-mobile: 17 !default;\n$body-line-height: 1.75 !default;\n\n$interactable-text-decoration-offset: 0.125em !default;\n$interactable-text-decoration-thickness: #{math.div(1.5, $relative-1rem-px)}rem !default;\n$interactive-text-decoration-thickness: #{math.div(4, $relative-1rem-px)}rem !default;\n\n$main-font-family-name: \"Open Sans\" !default;\n$main-font-family:\n #{$main-font-family-name},\n sans-serif;\n$main-font-weight: 400 !default;\n$main-font-weight-medium: 600 !default;\n$main-font-weight-bold: 700 !default;\n$main-font-file: \"OpenSans-Regular.ttf\" !default;\n$main-font-file-medium: \"OpenSans-SemiBold.ttf\" !default;\n$main-font-file-bold: \"OpenSans-Bold.ttf\" !default;\n\n/*\n * ------------------------------------------\n * To use Supria Sans Condensed (which is the\n * approved heading typeface for The National\n * Archives), you need to obtain a licence to\n * properly embed the CSS files with the font\n * definitions in your service - check with a\n * member of the Digital Services team on how\n * to get a licence\n * ------------------------------------------\n */\n$heading-font-family-name: \"supria-sans-condensed\" !default;\n$heading-font-family:\n #{$heading-font-family-name},\n \"Arial Narrow\",\n sans-serif;\n$heading-font-weight: 500 !default;\n\n/*\n * ------------------------------------------\n * The detail font should be a monospace font\n * and is used for chips, supertitles as well\n * as the date search component\n * ------------------------------------------\n */\n$detail-font-family-name: \"Roboto Mono\" !default;\n$detail-font-family:\n #{$detail-font-family-name},\n monospace;\n$detail-font-weight: 400 !default;\n$detail-font-weight-bold: 500 !default;\n$detail-font-file: \"RobotoMono-Regular.ttf\" !default;\n$detail-font-file-bold: \"RobotoMono-Medium.ttf\" !default;\n\n$heading-xl-font-size-default: 64 !default;\n$heading-xl-font-size-medium: 48 !default;\n$heading-xl-font-size-small: 36 !default;\n$heading-xl-font-size-tiny: $heading-xl-font-size-small !default;\n$heading-xl-line-height: 1.1 !default;\n\n$heading-l-font-size-default: 36 !default;\n$heading-l-font-size-medium: 32 !default;\n$heading-l-font-size-small: 29 !default;\n$heading-l-font-size-tiny: $heading-l-font-size-small !default;\n$heading-l-line-height: 1.15 !default;\n\n$heading-m-font-size-default: 22 !default;\n$heading-m-font-size-medium: $heading-m-font-size-default !default;\n$heading-m-font-size-small: 21 !default;\n$heading-m-font-size-tiny: $heading-m-font-size-small !default;\n$heading-m-line-height: 1.4 !default;\n\n$heading-s-font-size-default: 19 !default;\n$heading-s-font-size-medium: $heading-s-font-size-default !default;\n$heading-s-font-size-small: $heading-s-font-size-default !default;\n$heading-s-font-size-tiny: $heading-s-font-size-default !default;\n$heading-s-line-height: 1.5 !default;\n\n$code-font-family: Consolas, Monaco, \"Ubuntu Mono\", monospace !default;\n"]}
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"text": "Enter a name"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
"html": "<div class=\"tna-form-item tna-form-item--error\"><div class=\"tna-form-item__header\"><label class=\"tna-form-item__label tna-heading-m\" for=\"name\">Enter your first name</label></div><p id=\"name-error\" class=\"tna-form-item__error\"><span class=\"tna
|
|
47
|
+
"html": "<div class=\"tna-form-item tna-form-item--error\"><div class=\"tna-form-item__header\"><label class=\"tna-form-item__label tna-heading-m\" for=\"name\">Enter your first name</label></div><p id=\"name-error\" class=\"tna-form-item__error\"><span class=\"tna-visually-hidden\">Error:</span> Enter a name</p><div class=\"tna-form-item__body\"><input id=\"name\" class=\"tna-text-input\" name=\"name\" value=\"\" aria-describedby=\" name-error\" type=\"text\" spellcheck=\"false\" autocapitalize=\"off\" autocorrect=\"off\"></div></div>"
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
"name": "text input size",
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
export default class TextAreaCharacterCount {
|
|
2
|
+
constructor($module, options = {}) {
|
|
3
|
+
this.$module = $module;
|
|
4
|
+
this.$formFieldInput =
|
|
5
|
+
this.$module && this.$module.querySelector(".tna-textarea");
|
|
6
|
+
this.$formFieldCharacterCount =
|
|
7
|
+
this.$module && this.$module.querySelector(".tna-textarea-count");
|
|
8
|
+
this.$formFieldCharacterCountScreenReader =
|
|
9
|
+
this.$module &&
|
|
10
|
+
this.$module.querySelector(".tna-textarea-count__screen-reader-status");
|
|
11
|
+
this.max = parseInt(this.$formFieldInput?.dataset?.maxLength, 10);
|
|
12
|
+
this.countType = this.$formFieldInput?.dataset?.countType || "characters";
|
|
13
|
+
|
|
14
|
+
if (
|
|
15
|
+
!this.$module ||
|
|
16
|
+
!this.$formFieldInput ||
|
|
17
|
+
!this.$formFieldCharacterCount ||
|
|
18
|
+
!this.$formFieldCharacterCountScreenReader ||
|
|
19
|
+
!this.max
|
|
20
|
+
) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
this.init(options);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
init(options) {
|
|
28
|
+
this.threshold =
|
|
29
|
+
options.threshold ||
|
|
30
|
+
parseInt(this.$formFieldInput?.dataset?.countThreshold, 10) ||
|
|
31
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
32
|
+
0;
|
|
33
|
+
this.debounceDuration =
|
|
34
|
+
options.debounceDuration ||
|
|
35
|
+
parseInt(this.$formFieldInput?.dataset?.debounceDuration, 10) ||
|
|
36
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
37
|
+
1000;
|
|
38
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
39
|
+
this.intervalChecker = options.intervalChecker || 1000;
|
|
40
|
+
this.debounceTimeout = null;
|
|
41
|
+
this.lastInputValue = "";
|
|
42
|
+
|
|
43
|
+
this.$formFieldInput.addEventListener("input", () => {
|
|
44
|
+
this.handleInput();
|
|
45
|
+
this.lastInputTimestamp = Date.now();
|
|
46
|
+
});
|
|
47
|
+
this.$formFieldInput.addEventListener("focus", () => {
|
|
48
|
+
this.handleFocus();
|
|
49
|
+
});
|
|
50
|
+
this.$formFieldInput.addEventListener("blur", () => {
|
|
51
|
+
this.handleBlur();
|
|
52
|
+
});
|
|
53
|
+
this.updateVisualCharacterCount();
|
|
54
|
+
this.updateScreenReaderCharacterCount();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
handleFocus() {
|
|
58
|
+
this.valueChecker = window.setInterval(() => {
|
|
59
|
+
if (
|
|
60
|
+
!this.lastInputTimestamp ||
|
|
61
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
62
|
+
Date.now() - this.intervalChecker / 2 >= this.lastInputTimestamp
|
|
63
|
+
) {
|
|
64
|
+
this.updateIfValueChanged();
|
|
65
|
+
}
|
|
66
|
+
}, this.intervalChecker);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
handleBlur() {
|
|
70
|
+
if (this.valueChecker) {
|
|
71
|
+
window.clearInterval(this.valueChecker);
|
|
72
|
+
}
|
|
73
|
+
this.updateScreenReaderCharacterCount();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
updateIfValueChanged() {
|
|
77
|
+
if (this.$formFieldInput.value !== this.lastInputValue) {
|
|
78
|
+
this.lastInputValue = this.$formFieldInput.value;
|
|
79
|
+
this.updateVisualCharacterCount();
|
|
80
|
+
this.updateScreenReaderCharacterCount();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
handleInput() {
|
|
85
|
+
this.updateVisualCharacterCount();
|
|
86
|
+
clearTimeout(this.debounceTimeout);
|
|
87
|
+
this.debounceTimeout = setTimeout(() => {
|
|
88
|
+
this.updateScreenReaderCharacterCount();
|
|
89
|
+
}, this.debounceDuration);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
getCurrentLength() {
|
|
93
|
+
if (this.countType === "words") {
|
|
94
|
+
const trimmedValue = this.$formFieldInput.value.trim();
|
|
95
|
+
if (trimmedValue === "") {
|
|
96
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
return trimmedValue.split(/\s+/).length;
|
|
100
|
+
}
|
|
101
|
+
return this.$formFieldInput.value.length;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getCurrentLengthMessage() {
|
|
105
|
+
const currentLength = this.getCurrentLength();
|
|
106
|
+
let typeLabel = this.countType;
|
|
107
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
108
|
+
if (Math.abs(this.max - currentLength) === 1) {
|
|
109
|
+
typeLabel = typeLabel.replace(/s$/, "");
|
|
110
|
+
}
|
|
111
|
+
if (currentLength > this.max) {
|
|
112
|
+
return `You have ${new Intl.NumberFormat().format(currentLength - this.max)} ${typeLabel} too many`;
|
|
113
|
+
}
|
|
114
|
+
return `You have ${new Intl.NumberFormat().format(this.max - currentLength)} ${typeLabel} remaining`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
isOverThreshold() {
|
|
118
|
+
return this.getCurrentLength() > this.max;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
updateVisualCharacterCount() {
|
|
122
|
+
if (this.threshold) {
|
|
123
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
124
|
+
if (this.getCurrentLength() > this.max * (this.threshold / 100)) {
|
|
125
|
+
this.showCharacterCount();
|
|
126
|
+
} else {
|
|
127
|
+
this.hideCharacterCount();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
this.$formFieldCharacterCount.innerText = this.getCurrentLengthMessage();
|
|
132
|
+
if (this.isOverThreshold()) {
|
|
133
|
+
this.$formFieldInput.classList.add("tna-textarea--error");
|
|
134
|
+
this.$formFieldCharacterCount.classList.add("tna-textarea-count--error");
|
|
135
|
+
} else {
|
|
136
|
+
this.$formFieldInput.classList.remove("tna-textarea--error");
|
|
137
|
+
this.$formFieldCharacterCount.classList.remove(
|
|
138
|
+
"tna-textarea-count--error",
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
updateScreenReaderCharacterCount() {
|
|
144
|
+
const currentLengthMessage = this.getCurrentLengthMessage();
|
|
145
|
+
this.$formFieldCharacterCountScreenReader.innerText = currentLengthMessage;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
showCharacterCount() {
|
|
149
|
+
this.$formFieldCharacterCount.removeAttribute("hidden");
|
|
150
|
+
this.$formFieldCharacterCountScreenReader.removeAttribute("aria-hidden");
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
hideCharacterCount() {
|
|
154
|
+
this.$formFieldCharacterCount.setAttribute("hidden", "");
|
|
155
|
+
this.$formFieldCharacterCountScreenReader.setAttribute(
|
|
156
|
+
"aria-hidden",
|
|
157
|
+
"true",
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export default class TextAreaItemisedRows {
|
|
2
|
+
constructor($module, options = {}) {
|
|
3
|
+
this.$module = $module;
|
|
4
|
+
this.$formFieldInput =
|
|
5
|
+
this.$module && this.$module.querySelector(".tna-textarea");
|
|
6
|
+
this.$formFieldInputHint =
|
|
7
|
+
this.$module && this.$module.querySelector(".tna-form-item__hint");
|
|
8
|
+
this.$formFieldBody =
|
|
9
|
+
this.$module && this.$module.querySelector(".tna-form-item__body");
|
|
10
|
+
|
|
11
|
+
if (
|
|
12
|
+
!this.$module ||
|
|
13
|
+
!this.$formFieldInput ||
|
|
14
|
+
!this.$formFieldBody ||
|
|
15
|
+
this.$formFieldInput.getAttribute("hidden") !== null
|
|
16
|
+
) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (!(this.$formFieldInput instanceof HTMLTextAreaElement)) {
|
|
21
|
+
throw new Error("Expected a textarea element");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const { enhancedHint } = options;
|
|
25
|
+
this.enhancedHint = enhancedHint || "Enter an item and press enter";
|
|
26
|
+
|
|
27
|
+
this.values = this.$formFieldInput.value
|
|
28
|
+
.split("\n")
|
|
29
|
+
.map((value) => value.trim())
|
|
30
|
+
.filter((value) => value);
|
|
31
|
+
|
|
32
|
+
this.id = this.$formFieldInput.id;
|
|
33
|
+
|
|
34
|
+
this.init();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
init() {
|
|
38
|
+
this.$formFieldNewInput = document.createElement("input");
|
|
39
|
+
this.$formFieldNewInput.classList.add("tna-text-input");
|
|
40
|
+
["id", "aria-describedby"].forEach((attribute) => {
|
|
41
|
+
this.$formFieldNewInput.setAttribute(
|
|
42
|
+
attribute,
|
|
43
|
+
this.$formFieldInput.getAttribute(attribute),
|
|
44
|
+
);
|
|
45
|
+
this.$formFieldInput.removeAttribute(attribute);
|
|
46
|
+
});
|
|
47
|
+
this.$formFieldBody.appendChild(this.$formFieldNewInput);
|
|
48
|
+
this.$formFieldInput.setAttribute("hidden", "");
|
|
49
|
+
this.$formFieldInput.addEventListener("keyup", () => this.updateList());
|
|
50
|
+
this.$formFieldNewInput.addEventListener("keypress", (event) => {
|
|
51
|
+
if (event.key === "Enter") {
|
|
52
|
+
this.appendValue(event.target.value);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
this.$formFieldNewInputAddButton = document.createElement("button");
|
|
57
|
+
this.$formFieldNewInputAddButton.setAttribute("type", "button");
|
|
58
|
+
this.$formFieldNewInputAddButton.classList.add(
|
|
59
|
+
"tna-button",
|
|
60
|
+
"tna-button--small",
|
|
61
|
+
);
|
|
62
|
+
this.$formFieldNewInputAddButtonInner = document.createElement("span");
|
|
63
|
+
this.$formFieldNewInputAddButtonInner.innerText = "Add";
|
|
64
|
+
this.$formFieldNewInputAddButtonInnerExtra = document.createElement("span");
|
|
65
|
+
this.$formFieldNewInputAddButtonInnerExtra.classList.add(
|
|
66
|
+
"tna-visually-hidden",
|
|
67
|
+
);
|
|
68
|
+
this.$formFieldNewInputAddButtonInnerExtra.innerText = " to list";
|
|
69
|
+
this.$formFieldNewInputAddButtonInner.appendChild(
|
|
70
|
+
this.$formFieldNewInputAddButtonInnerExtra,
|
|
71
|
+
);
|
|
72
|
+
this.$formFieldNewInputAddButton.appendChild(
|
|
73
|
+
this.$formFieldNewInputAddButtonInner,
|
|
74
|
+
);
|
|
75
|
+
this.$formFieldBody.appendChild(this.$formFieldNewInputAddButton);
|
|
76
|
+
this.$formFieldNewInputAddButton.addEventListener("click", () => {
|
|
77
|
+
this.appendValue(this.$formFieldNewInput.value);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
this.$formFieldLiveAria = document.createElement("div");
|
|
81
|
+
this.$formFieldLiveAria.setAttribute("aria-live", "polite");
|
|
82
|
+
this.$formFieldLiveAria.classList.add("tna-visually-hidden");
|
|
83
|
+
this.$module.appendChild(this.$formFieldLiveAria);
|
|
84
|
+
|
|
85
|
+
this.$formFieldCounter = document.createElement("p");
|
|
86
|
+
this.$formFieldCounter.id = `${this.id}-list-helper`;
|
|
87
|
+
this.$formFieldCounter.classList.add("tna-!--margin-top-xs");
|
|
88
|
+
this.$module.appendChild(this.$formFieldCounter);
|
|
89
|
+
|
|
90
|
+
this.$formFieldNewInput.setAttribute(
|
|
91
|
+
"aria-describedby",
|
|
92
|
+
`${this.$formFieldNewInput.getAttribute("aria-describedby")} ${
|
|
93
|
+
this.$formFieldCounter.id
|
|
94
|
+
}`,
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
this.$valuesList = document.createElement("ul");
|
|
98
|
+
this.$valuesList.classList.add(
|
|
99
|
+
"tna-compound-filters",
|
|
100
|
+
"tna-!--margin-top-xs",
|
|
101
|
+
);
|
|
102
|
+
this.$valuesList.addEventListener("blur", () => {
|
|
103
|
+
this.$valuesList.removeAttribute("tabindex");
|
|
104
|
+
this.updateAriaText("");
|
|
105
|
+
});
|
|
106
|
+
this.$module.appendChild(this.$valuesList);
|
|
107
|
+
|
|
108
|
+
if (!this.$formFieldInputHint) {
|
|
109
|
+
this.$formFieldInputHint = document.createElement("p");
|
|
110
|
+
this.$formFieldInputHint.classList.add("tna-form-item__hint");
|
|
111
|
+
this.$formFieldBody.parentNode.insertBefore(
|
|
112
|
+
this.$formFieldInputHint,
|
|
113
|
+
this.$formFieldBody,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
this.$formFieldInputHint.innerText = this.enhancedHint;
|
|
117
|
+
|
|
118
|
+
this.updateList();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
updateAriaText(content) {
|
|
122
|
+
this.$formFieldLiveAria.innerText = content;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* eslint-disable-next-line class-methods-use-this */
|
|
126
|
+
normaliseValue(value) {
|
|
127
|
+
return value.replace(/\s{2,}/u, " ").trim();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
isValueInList(value) {
|
|
131
|
+
return this.values
|
|
132
|
+
.map((eachValue) => this.normaliseValue(eachValue).toLowerCase())
|
|
133
|
+
.includes(value.toLowerCase().trim());
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
appendValue(value) {
|
|
137
|
+
const newValue = this.normaliseValue(value);
|
|
138
|
+
if (newValue) {
|
|
139
|
+
if (this.isValueInList(newValue)) {
|
|
140
|
+
this.updateAriaText(`'${newValue}' already added`);
|
|
141
|
+
} else {
|
|
142
|
+
this.values.push(newValue);
|
|
143
|
+
this.$formFieldInput.value = this.values.join("\n");
|
|
144
|
+
this.updateList();
|
|
145
|
+
this.updateAriaText(`'${newValue}' added`);
|
|
146
|
+
}
|
|
147
|
+
} else {
|
|
148
|
+
this.updateAriaText("Enter an item to add");
|
|
149
|
+
}
|
|
150
|
+
this.$formFieldNewInput.value = "";
|
|
151
|
+
this.$formFieldNewInput.focus();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
removeValue(value) {
|
|
155
|
+
const removeValue = this.normaliseValue(value);
|
|
156
|
+
if (removeValue && this.isValueInList(removeValue)) {
|
|
157
|
+
this.values = this.values.filter(
|
|
158
|
+
(existingValue) => existingValue !== removeValue,
|
|
159
|
+
);
|
|
160
|
+
this.$formFieldInput.value = this.values.join("\n");
|
|
161
|
+
this.updateList();
|
|
162
|
+
this.updateAriaText(`'${removeValue}' removed`);
|
|
163
|
+
}
|
|
164
|
+
if (this.values.length) {
|
|
165
|
+
this.$valuesList.setAttribute("tabindex", "0");
|
|
166
|
+
this.$valuesList.focus();
|
|
167
|
+
} else {
|
|
168
|
+
this.$formFieldNewInput.focus();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
updateList() {
|
|
173
|
+
this.$valuesList.innerHTML = "";
|
|
174
|
+
this.values
|
|
175
|
+
.map((value) => {
|
|
176
|
+
const $item = document.createElement("li");
|
|
177
|
+
$item.classList.add("tna-compound-filters__item");
|
|
178
|
+
const $itemLabel = document.createElement("span");
|
|
179
|
+
$itemLabel.innerText = value;
|
|
180
|
+
$item.appendChild($itemLabel);
|
|
181
|
+
|
|
182
|
+
const $removeItemButton = document.createElement("button");
|
|
183
|
+
$removeItemButton.innerText = `Remove '${value}'`;
|
|
184
|
+
$removeItemButton.setAttribute("type", "button");
|
|
185
|
+
$removeItemButton.classList.add("tna-compound-filters__link");
|
|
186
|
+
$removeItemButton.addEventListener("click", () => {
|
|
187
|
+
this.removeValue(value);
|
|
188
|
+
});
|
|
189
|
+
$item.appendChild($removeItemButton);
|
|
190
|
+
return $item;
|
|
191
|
+
})
|
|
192
|
+
.forEach(($item) => this.$valuesList.appendChild($item));
|
|
193
|
+
|
|
194
|
+
let innerTextItemValue = "item";
|
|
195
|
+
/* eslint-disable-next-line no-magic-numbers */
|
|
196
|
+
if (this.values.length !== 1) {
|
|
197
|
+
innerTextItemValue += "s";
|
|
198
|
+
}
|
|
199
|
+
const innerTextValue = `${new Intl.NumberFormat().format(this.values.length)} ${innerTextItemValue} added`;
|
|
200
|
+
this.$formFieldCounter.innerText = innerTextValue;
|
|
201
|
+
}
|
|
202
|
+
}
|