@nationalarchives/frontend 0.20.1 → 0.22.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+analytics.mjs +4 -2
- 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 +14 -5
- package/nationalarchives/analytics.js +1 -1
- package/nationalarchives/analytics.js.map +1 -1
- package/nationalarchives/analytics.mjs +4 -0
- package/nationalarchives/components/_forms.scss +1 -0
- package/nationalarchives/components/card/card.css +1 -1
- package/nationalarchives/components/card/card.css.map +1 -1
- package/nationalarchives/components/card/card.scss +1 -0
- package/nationalarchives/components/checkboxes/macro-options.json +1 -1
- package/nationalarchives/components/date-input/date-input.js +1 -1
- package/nationalarchives/components/date-input/date-input.js.map +1 -1
- package/nationalarchives/components/date-input/date-input.mjs +42 -15
- package/nationalarchives/components/date-input/fixtures.json +15 -3
- package/nationalarchives/components/date-input/macro-options.json +6 -6
- package/nationalarchives/components/date-input/template.njk +4 -4
- package/nationalarchives/components/date-search/macro-options.json +1 -1
- package/nationalarchives/components/error-summary/analytics.js +16 -0
- package/nationalarchives/components/error-summary/fixtures.json +4 -1
- package/nationalarchives/components/error-summary/macro-options.json +1 -1
- package/nationalarchives/components/error-summary/template.njk +4 -0
- package/nationalarchives/components/file-input/_index.scss +1 -0
- package/nationalarchives/components/file-input/analytics.js +59 -0
- package/nationalarchives/components/file-input/file-input.css +1 -0
- package/nationalarchives/components/file-input/file-input.css.map +1 -0
- package/nationalarchives/components/file-input/file-input.js +2 -0
- package/nationalarchives/components/file-input/file-input.js.map +1 -0
- package/nationalarchives/components/file-input/file-input.mjs +99 -0
- package/nationalarchives/components/file-input/file-input.njk +8 -0
- package/nationalarchives/components/file-input/file-input.scss +127 -0
- package/nationalarchives/components/file-input/fixtures.json +131 -0
- package/nationalarchives/components/file-input/macro-options.json +90 -0
- package/nationalarchives/components/file-input/macro.njk +3 -0
- package/nationalarchives/components/file-input/template.njk +27 -0
- package/nationalarchives/components/gallery/gallery.js +1 -1
- package/nationalarchives/components/gallery/gallery.js.map +1 -1
- package/nationalarchives/components/gallery/gallery.mjs +1 -0
- package/nationalarchives/components/radios/macro-options.json +1 -1
- package/nationalarchives/components/search-field/macro-options.json +1 -1
- package/nationalarchives/components/secondary-navigation/secondary-navigation.css +1 -1
- package/nationalarchives/components/secondary-navigation/secondary-navigation.css.map +1 -1
- package/nationalarchives/components/secondary-navigation/secondary-navigation.scss +5 -0
- package/nationalarchives/components/select/macro-options.json +1 -1
- package/nationalarchives/components/text-input/analytics.js +1 -2
- package/nationalarchives/components/text-input/macro-options.json +1 -1
- package/nationalarchives/components/textarea/macro-options.json +1 -1
- package/nationalarchives/prototype-kit.css +1 -1
- package/nationalarchives/prototype-kit.css.map +1 -1
- package/package.json +2 -2
@@ -15,7 +15,7 @@
|
|
15
15
|
"name": "headingSize",
|
16
16
|
"type": "string",
|
17
17
|
"required": false,
|
18
|
-
"description": "The physical size of the date input title (`xl`, `l`, `m` or `
|
18
|
+
"description": "The physical size of the date input title (`xl`, `l`, `m`, `s` or `xs`)."
|
19
19
|
},
|
20
20
|
{
|
21
21
|
"name": "id",
|
@@ -39,7 +39,7 @@
|
|
39
39
|
"name": "fields",
|
40
40
|
"type": "array",
|
41
41
|
"required": false,
|
42
|
-
"description": ""
|
42
|
+
"description": "An array of fields to display. Can be `d`, `m` or `y`. Order is preserved unless `progressive` is true."
|
43
43
|
},
|
44
44
|
{
|
45
45
|
"name": "value",
|
@@ -51,19 +51,19 @@
|
|
51
51
|
"name": "day",
|
52
52
|
"type": "string",
|
53
53
|
"required": false,
|
54
|
-
"description": ""
|
54
|
+
"description": "The value for the day field."
|
55
55
|
},
|
56
56
|
{
|
57
57
|
"name": "month",
|
58
58
|
"type": "string",
|
59
59
|
"required": false,
|
60
|
-
"description": ""
|
60
|
+
"description": "The value for the month field. Usually a number between 1 and 12, a three character month (jan-dec) or the month name (January-December)."
|
61
61
|
},
|
62
62
|
{
|
63
63
|
"name": "year",
|
64
64
|
"type": "string",
|
65
65
|
"required": false,
|
66
|
-
"description": ""
|
66
|
+
"description": "The value for the year field."
|
67
67
|
}
|
68
68
|
]
|
69
69
|
},
|
@@ -91,7 +91,7 @@
|
|
91
91
|
"name": "progressive",
|
92
92
|
"type": "boolean",
|
93
93
|
"required": false,
|
94
|
-
"description": ""
|
94
|
+
"description": "If true, order the date fields in a year-month-day order and only show the next field when the previous has a valid value."
|
95
95
|
},
|
96
96
|
{
|
97
97
|
"name": "formGroupClasses",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
{%- set inputClassesParams = [params.classes] if params.classes else [] -%}
|
12
12
|
{%- set inputClasses = inputClassesParams | join(' ') -%}
|
13
13
|
|
14
|
-
<div class="tna-form__group{% if params.error %} tna-form__group--error{% endif %}{% if classes %} {{ classes }}{% endif %}"{% if params.progressive %} data-module="date-input"{% endif %}{% for attribute, value in params.formGroupAttributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
14
|
+
<div class="tna-form__group{% if params.error %} tna-form__group--error{% endif %}{% if classes %} {{ classes }}{% endif %}"{% if params.progressive %} data-module="date-input-progressive"{% endif %}{% for attribute, value in params.formGroupAttributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
15
15
|
<fieldset class="tna-form__fieldset"{%- if params.hint or params.error %} aria-describedby="{%- if params.hint -%}{{ params.id }}-hint{%- endif %} {% if params.error -%}{{ params.id }}-error{%- endif -%}"{%- endif %}>
|
16
16
|
<legend class="tna-form__legend">
|
17
17
|
<h{{ params.headingLevel }} class="tna-form__heading tna-form__heading--{{ params.headingSize or 'm' }}">
|
@@ -34,13 +34,13 @@
|
|
34
34
|
{%- if params.fields %}
|
35
35
|
{%- set fields = [] -%}
|
36
36
|
{% if 'y' in params.fields %}
|
37
|
-
{%- set fields = fields + ['
|
37
|
+
{%- set fields = fields + ['y'] -%}
|
38
38
|
{%- endif %}
|
39
39
|
{% if 'm' in params.fields %}
|
40
|
-
{%- set fields = fields + ['
|
40
|
+
{%- set fields = fields + ['m'] -%}
|
41
41
|
{%- endif %}
|
42
42
|
{% if 'd' in params.fields %}
|
43
|
-
{%- set fields = fields + ['
|
43
|
+
{%- set fields = fields + ['d'] -%}
|
44
44
|
{%- endif %}
|
45
45
|
{%- else %}
|
46
46
|
{%- set fields = ['y', 'm', 'd'] -%}
|
@@ -15,7 +15,7 @@
|
|
15
15
|
"name": "headingSize",
|
16
16
|
"type": "string",
|
17
17
|
"required": false,
|
18
|
-
"description": "The physical size of the date search title (`xl`, `l`, `m` or `
|
18
|
+
"description": "The physical size of the date search title (`xl`, `l`, `m`, `s` or `xs`)."
|
19
19
|
},
|
20
20
|
{
|
21
21
|
"name": "id",
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { valueGetters } from "../../lib/analytics-helpers.mjs";
|
2
|
+
|
3
|
+
export default [
|
4
|
+
{
|
5
|
+
scope: ".tna-error-summary",
|
6
|
+
areaName: "error-summary",
|
7
|
+
events: [
|
8
|
+
{
|
9
|
+
eventName: "jump",
|
10
|
+
targetElement: "a.tna-error-summary__link",
|
11
|
+
on: "click",
|
12
|
+
data: { value: valueGetters.text },
|
13
|
+
},
|
14
|
+
],
|
15
|
+
},
|
16
|
+
];
|
@@ -14,11 +14,14 @@
|
|
14
14
|
{
|
15
15
|
"text": "The date of the record cannot be in the future",
|
16
16
|
"href": "#"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"text": "Try submitting the form again"
|
17
20
|
}
|
18
21
|
],
|
19
22
|
"disableAutoFocus": true
|
20
23
|
},
|
21
|
-
"html": "<div class=\"tna-error-summary\" data-module=\"tna-error-summary\" data-disable-autofocus=\"true\"><div role=\"alert\"><h2 class=\"tna-error-summary__heading tna-heading-m\">There is a problem</h2><ul class=\"tna-error-summary__list\"><li class=\"tna-error-summary__item\"><a href=\"#\" class=\"tna-error-summary__link\">Enter your full name</a></li><li class=\"tna-error-summary__item\"><a href=\"#\" class=\"tna-error-summary__link\">The date of the record cannot be in the future</a></li></ul></div></div>"
|
24
|
+
"html": "<div class=\"tna-error-summary\" data-module=\"tna-error-summary\" data-disable-autofocus=\"true\"><div role=\"alert\"><h2 class=\"tna-error-summary__heading tna-heading-m\">There is a problem</h2><ul class=\"tna-error-summary__list\"><li class=\"tna-error-summary__item\"><a href=\"#\" class=\"tna-error-summary__link\">Enter your full name</a></li><li class=\"tna-error-summary__item\"><a href=\"#\" class=\"tna-error-summary__link\">The date of the record cannot be in the future</a></li><li class=\"tna-error-summary__item\"><span class=\"tna-error-summary__link\">Try submitting the form again</span></li></ul></div></div>"
|
22
25
|
}
|
23
26
|
]
|
24
27
|
}
|
@@ -8,7 +8,11 @@
|
|
8
8
|
<ul class="tna-error-summary__list">
|
9
9
|
{%- for item in params.items %}
|
10
10
|
<li class="tna-error-summary__item">
|
11
|
+
{%- if item.href %}
|
11
12
|
<a href="{{ item.href }}" class="tna-error-summary__link">{{ item.text }}</a>
|
13
|
+
{%- else %}
|
14
|
+
<span class="tna-error-summary__link">{{ item.text }}</span>
|
15
|
+
{%- endif %}
|
12
16
|
</li>
|
13
17
|
{%- endfor %}
|
14
18
|
</ul>
|
@@ -0,0 +1 @@
|
|
1
|
+
@use "file-input";
|
@@ -0,0 +1,59 @@
|
|
1
|
+
const getFileDetails = ($el) =>
|
2
|
+
JSON.stringify(
|
3
|
+
Array.from($el.files).map((file) => ({
|
4
|
+
name: file.name,
|
5
|
+
size: file.size,
|
6
|
+
type: file.type,
|
7
|
+
})),
|
8
|
+
);
|
9
|
+
|
10
|
+
export default [
|
11
|
+
{
|
12
|
+
scope: ".tna-file-input",
|
13
|
+
areaName: "file-input",
|
14
|
+
events: [
|
15
|
+
{
|
16
|
+
eventName: "blurred",
|
17
|
+
on: "blur",
|
18
|
+
data: {
|
19
|
+
value: getFileDetails,
|
20
|
+
state: ($el) => $el.files.length,
|
21
|
+
// eslint-disable-next-line no-unused-vars
|
22
|
+
group: ($el, $scope) =>
|
23
|
+
$scope
|
24
|
+
.closest(".tna-form__group")
|
25
|
+
?.querySelector(".tna-form__heading")
|
26
|
+
?.innerText?.trim(),
|
27
|
+
},
|
28
|
+
},
|
29
|
+
{
|
30
|
+
eventName: "cancelled",
|
31
|
+
on: "cancel",
|
32
|
+
data: {
|
33
|
+
value: getFileDetails,
|
34
|
+
state: ($el) => $el.files.length,
|
35
|
+
// eslint-disable-next-line no-unused-vars
|
36
|
+
group: ($el, $scope) =>
|
37
|
+
$scope
|
38
|
+
.closest(".tna-form__group")
|
39
|
+
?.querySelector(".tna-form__heading")
|
40
|
+
?.innerText?.trim(),
|
41
|
+
},
|
42
|
+
},
|
43
|
+
{
|
44
|
+
eventName: "changed",
|
45
|
+
on: "change",
|
46
|
+
data: {
|
47
|
+
value: getFileDetails,
|
48
|
+
state: ($el) => $el.files.length,
|
49
|
+
// eslint-disable-next-line no-unused-vars
|
50
|
+
group: ($el, $scope) =>
|
51
|
+
$scope
|
52
|
+
.closest(".tna-form__group")
|
53
|
+
?.querySelector(".tna-form__heading")
|
54
|
+
?.innerText?.trim(),
|
55
|
+
},
|
56
|
+
},
|
57
|
+
],
|
58
|
+
},
|
59
|
+
];
|
@@ -0,0 +1 @@
|
|
1
|
+
.tna-file-input__droppable--over::before,.tna-file-input__droppable--over-multiple::before{--accent-font-base: rgb(255, 255, 255) !important;--accent-font-dark: rgb(255, 255, 255) !important;--accent-font-light: rgba(255, 255, 255, 0.7) !important;--accent-icon-light: rgba(255, 255, 255, 0.7) !important;--accent-link: rgb(255, 255, 255) !important;--accent-link-visited: rgb(255, 255, 255) !important;--accent-keyline: rgba(255, 255, 255, 0.5) !important;--accent-keyline-dark: rgba(255, 255, 255, 0.8) !important;--button-accented-text: rgb(255, 255, 255) !important}.tna-file-input__droppable--over::before,.tna-file-input__droppable--over-multiple::before{--accent-background: rgb(0, 98, 59) !important;--accent-background-light: rgb(221, 229, 213) !important;--accent-border: rgb(134, 188, 37) !important;--button-accented-background: rgb(0, 98, 59) !important}.tna-file-input{width:100%;display:block;box-sizing:border-box;border-radius:.1px;cursor:pointer}.tna-file-input::file-selector-button{margin-right:8px;cursor:inherit}.tna-file-input__droppable{width:100%;padding:8px 16px 16px;box-sizing:border-box;position:relative;border:2px var(--keyline, rgba(38, 38, 42, 0.25)) dashed;border-radius:4px}.tna-file-input__droppable:has(.tna-file-input:focus-visible){outline:5px var(--focus-outline, rgb(0, 176, 255)) solid;outline-offset:2px}.tna-file-input__droppable:has(.tna-file-input:active){outline:5px var(--focus-outline, rgb(0, 176, 255)) solid}.tna-file-input__droppable .tna-file-input{padding:16px;position:absolute;inset:0;z-index:1;opacity:0}.tna-file-input__droppable-buttons{font-size:0.875rem;line-height:1.5rem}@media(max-width: 30em){.tna-file-input__droppable-buttons{flex-direction:row;align-items:center}}.tna-file-input__droppable-status{display:block;overflow:hidden;line-height:2;text-overflow:ellipsis;white-space:nowrap}.tna-file-input__droppable .tna-file-input:hover~.tna-file-input__droppable-buttons .tna-button:not(.tna-button--plain),.tna-file-input__droppable .tna-file-input:focus-visible~.tna-file-input__droppable-buttons .tna-button:not(.tna-button--plain){color:var(--button-hover-text, rgb(1, 1, 1));text-decoration:none;background:rgba(0,0,0,0)}.tna-file-input__droppable--over,.tna-file-input__droppable--over-multiple{border-color:var(--keyline-dark, rgb(38, 38, 42))}.tna-file-input__droppable--over::before,.tna-file-input__droppable--over-multiple::before{display:flex;align-items:center;justify-content:center;position:absolute;inset:8px;z-index:2;pointer-events:none;color:var(--accent-font-base, rgb(1, 1, 1));font-weight:700;background-color:var(--accent-background, #afb6b5)}.tna-file-input__droppable--over::before{content:"Drop file here"}.tna-file-input__droppable--over-multiple::before{content:"Drop files here"}/*# sourceMappingURL=file-input.css.map */
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../../src/nationalarchives/tools/_colour.scss","../../../../src/nationalarchives/components/file-input/file-input.scss","../../../../src/nationalarchives/tools/_borders.scss","../../../../src/nationalarchives/variables/_borders.scss","../../../../src/nationalarchives/tools/_a11y.scss","../../../../src/nationalarchives/variables/_a11y.scss","../../../../src/nationalarchives/tools/_typography.scss","../../../../src/nationalarchives/tools/_media.scss","../../../../src/nationalarchives/variables/_typography.scss"],"names":[],"mappings":"AA4aA,2FACE,kDACA,kDACA,yDACA,yDACA,6CACA,qDACA,sDACA,2DACA,sDAwCF,2FACE,+CACA,yDACA,8CACA,wDCzdF,gBACE,WAEA,cAEA,sBAEA,mBAEA,eAEA,sCACE,iBAEA,eAGF,2BACE,WACA,sBAEA,sBAEA,kBDsFE,yDElHJ,cCDsB,IFuCtB,8DD4FE,yDI/FF,eCrCqB,IJ4CrB,uDDwFE,yDCpFF,2CACE,aAEA,kBACA,QACA,UAEA,UAGF,mCKrDA,mBL4DE,mBMRF,wBNCA,mCAEI,mBACA,oBAOJ,kCACE,cACA,gBAEA,cACA,uBAEA,mBAME,wPDIJ,6CCFM,qBAEA,yBAKN,2ED+BI,kDC3BF,2FACE,aACA,mBACA,uBAEA,kBACA,UACA,UAEA,oBDlBJ,4CM/DA,YEiBsB,IRkDtB,mDC0BE,yCACE,yBAKF,kDACE","file":"file-input.css","sourcesContent":["@use \"sass:list\";\n@use \"sass:map\";\n@use \"../variables/borders\";\n@use \"../variables/colour\";\n@use \"../variables/features\";\n@use \"../tools/media\";\n\n$base-colours: (\n \"background\",\n // \"background-tint\",\n \"font-base\",\n \"font-dark\",\n \"font-light\",\n \"icon-light\",\n \"link\",\n \"link-visited\",\n // \"focus-outline\",\n \"keyline\",\n \"keyline-dark\",\n // \"input-foreground\",\n // \"input-background\",\n // \"input-border\",\n // \"form-error-border\",\n // \"form-error-text\",\n // \"button-text\",\n // \"button-background\",\n // \"button-hover-text\",\n // \"button-hover-background\",\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($important, !important, null);\n}\n\n@mixin colour-background($colour, $important: false) {\n background-color: colour-var($colour) if($important, !important, null);\n}\n\n@mixin colour-background-brand($brandColour, $important: false) {\n background-color: #{brand-colour($brandColour)}\n if($important, !important, 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($important, !important, null);\n } @else {\n border-#{$direction}-color: colour-var($colour)\n if($important, !important, null);\n }\n } @else {\n @if $width != \"\" {\n border: $width\n colour-var($colour)\n $style\n if($important, !important, null);\n } @else {\n border-color: var(\n --#{$colour},\n #{map.get(colour.$colour-palette-default, $colour)}\n )\n if($important, !important, null);\n }\n }\n}\n\n@mixin colour-outline($colour, $width: \"\", $style: solid, $important: false) {\n @if $width != \"\" {\n outline: $width colour-var($colour) $style if($important, !important, null);\n } @else {\n outline-color: colour-var($colour) if($important, !important, null);\n }\n}\n\n@mixin colour-fill($colour, $important: false) {\n fill: colour-var($colour) if($important, !important, null);\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// Use light theme colours (except for \"form-error-border\")\n%always-light {\n @include colour-css-vars(\"form-error-border\", \"focus-outline\");\n\n @media (prefers-contrast: more) {\n @include colour-css-vars-high-contrast(\n \"form-error-border\",\n \"focus-outline\"\n );\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\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\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-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(\"white\")} !important;\n --button-accented-background: #{colour.brand-colour(\"brown\")} !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 --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(\"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(\"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(\"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(\"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@mixin image-loader-background {\n @if features.$image-loader-animations {\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}\n","@use \"../../variables/forms\";\n@use \"../../tools/a11y\";\n@use \"../../tools/borders\";\n@use \"../../tools/colour\";\n@use \"../../tools/media\";\n@use \"../../tools/spacing\";\n@use \"../../tools/typography\";\n\n.tna-file-input {\n width: 100%;\n\n display: block;\n\n box-sizing: border-box;\n\n border-radius: 0.1px;\n\n cursor: pointer;\n\n &::file-selector-button {\n margin-right: spacing.space(0.5);\n\n cursor: inherit;\n }\n\n &__droppable {\n width: 100%;\n padding: spacing.space(0.5) spacing.space(1) spacing.space(1);\n\n box-sizing: border-box;\n\n position: relative;\n\n @include colour.colour-border(\n \"keyline\",\n forms.$form-field-border-width,\n dashed\n );\n @include borders.rounded-border;\n }\n\n &__droppable:has(&:focus-visible) {\n @include a11y.focus-outline;\n }\n\n &__droppable:has(&:active) {\n @include a11y.focus-outline-without-offset;\n }\n\n &__droppable & {\n padding: spacing.space(1);\n\n position: absolute;\n inset: 0;\n z-index: 1;\n\n opacity: 0;\n }\n\n &__droppable-buttons {\n @include media.on-tiny {\n flex-direction: row;\n align-items: center;\n }\n\n @include typography.font-size(14);\n line-height: 1.5rem;\n }\n\n &__droppable-status {\n display: block;\n overflow: hidden;\n\n line-height: 2;\n text-overflow: ellipsis;\n\n white-space: nowrap;\n }\n\n &__droppable &:hover ~ &__droppable-buttons,\n &__droppable &:focus-visible ~ &__droppable-buttons {\n .tna-button {\n &:not(.tna-button--plain) {\n @include colour.colour-font(\"button-hover-text\");\n text-decoration: none;\n\n background: transparent;\n }\n }\n }\n\n &__droppable--over,\n &__droppable--over-multiple {\n @include colour.colour-border(\"keyline-dark\");\n\n &::before {\n display: flex;\n align-items: center;\n justify-content: center;\n\n position: absolute;\n inset: spacing.space(0.5);\n z-index: 2;\n\n pointer-events: none;\n\n @include colour.green-accent;\n\n @include colour.colour-font(\"accent-font-base\");\n @include typography.main-font-weight-bold;\n\n @include colour.colour-background(\"accent-background\");\n }\n }\n\n &__droppable--over {\n &::before {\n content: \"Drop file here\";\n }\n }\n\n &__droppable--over-multiple {\n &::before {\n content: \"Drop files here\";\n }\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: 4px !default;\n","@use \"../variables/a11y\";\n@use \"colour\";\n\n@mixin visually-hidden {\n width: 1px !important;\n height: 1px !important;\n margin: 0 !important;\n padding: 0 !important;\n\n overflow: hidden !important;\n\n position: absolute !important;\n top: -9999px !important;\n left: -9999px !important;\n z-index: -1 !important;\n\n background-color: transparent !important;\n\n border: 0 !important;\n\n clip: rect(0, 0, 0, 0) !important;\n\n // &::before,\n // &::after {\n // content: \"\\00a0\";\n // }\n}\n\n@mixin focus-outline-without-offset {\n @include colour.colour-outline(\n \"focus-outline\",\n a11y.$focus-outline-width,\n solid\n );\n}\n\n@mixin focus-outline {\n @include focus-outline-without-offset;\n outline-offset: a11y.$focus-outline-offset;\n}\n\n@mixin active-outline {\n outline-offset: 0;\n}\n\n@mixin no-focus-outline-on-click {\n .tna-template--clicked &:focus {\n outline: none;\n }\n}\n","$focus-outline-width: 5px !default;\n$focus-outline-offset: 2px !default;\n$focus-outline-padding: $focus-outline-width + $focus-outline-offset;\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-style: normal;\n font-optical-sizing: auto;\n font-variation-settings: \"wdth\" 100;\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:math\";\n@use \"../variables/media\";\n@use \"../variables/typography\";\n\n$smallest-large-device-em: #{math.div(\n media.$largest-medium-device-px + 1,\n typography.$relative-1rem-px\n )}em;\n$largest-medium-device-em: #{math.div(\n media.$largest-medium-device-px,\n typography.$relative-1rem-px\n )}em;\n$smallest-medium-device-em: #{math.div(\n media.$largest-small-device-px + 1,\n typography.$relative-1rem-px\n )}em;\n$largest-small-device-em: #{math.div(\n media.$largest-small-device-px,\n typography.$relative-1rem-px\n )}em;\n$smallest-small-device-em: #{math.div(\n media.$largest-tiny-device-px + 1,\n typography.$relative-1rem-px\n )}em;\n$largest-tiny-device-em: #{math.div(\n media.$largest-tiny-device-px,\n typography.$relative-1rem-px\n )}em;\n\n$media-large: \"(min-width: #{$smallest-large-device-em})\";\n$media-lt-large: \"(max-width: #{$largest-medium-device-em})\";\n$media-medium: \"(min-width: #{$smallest-medium-device-em}) and (max-width: #{$largest-medium-device-em})\";\n$media-gt-mobile: \"(min-width: #{$smallest-medium-device-em})\";\n$media-mobile: \"(max-width: #{$largest-small-device-em})\";\n$media-small: \"(min-width: #{$smallest-small-device-em}) and (max-width: #{$largest-small-device-em})\";\n$media-gt-tiny: \"(min-width: #{$smallest-small-device-em})\";\n$media-tiny: \"(max-width: #{$largest-tiny-device-em})\";\n\n// https://nationalarchives.github.io/design-system/styles/media/#media-queries\n@mixin on-large() {\n @media #{$media-large} {\n @content;\n }\n}\n\n@mixin on-medium() {\n @media #{$media-medium} {\n @content;\n }\n}\n\n@mixin on-small() {\n @media #{$media-small} {\n @content;\n }\n}\n\n@mixin on-tiny() {\n @media #{$media-tiny} {\n @content;\n }\n}\n\n@mixin on-larger-than-mobile() {\n @media #{$media-gt-mobile} {\n @content;\n }\n}\n\n@mixin on-larger-than-tiny() {\n @media #{$media-gt-tiny} {\n @content;\n }\n}\n\n@mixin on-smaller-than-large() {\n @media #{$media-lt-large} {\n @content;\n }\n}\n\n@mixin on-mobile() {\n @media #{$media-mobile} {\n @content;\n }\n}\n\n@mixin on-print() {\n @media print {\n @content;\n }\n}\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"]}
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("TNAFrontend",[],t):"object"==typeof exports?exports.TNAFrontend=t():e.TNAFrontend=t()}(self,(()=>(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,r(i.key),i)}}function r(e){var t=function(e){if("object"!=n(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var i=t.call(e,"string");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==n(t)?t:t+""}e.r(t),e.d(t,{FileInputDroppable:()=>o});var o=function(){return e=function e(t){var n=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.$module=t,this.$input=t&&t.querySelector(".tna-file-input"),this.$module&&this.$input){this.acceptMutltipleFiles=this.$input.hasAttribute("multiple"),this.$droppableArea=document.createElement("div"),this.$droppableArea.classList.add("tna-file-input__droppable"),this.$module.insertBefore(this.$droppableArea,this.$input),this.$droppableArea.appendChild(this.$input),this.$pseudoSelectFileText=document.createElement("span"),this.$pseudoSelectFileText.setAttribute("aria-live","polite"),this.$pseudoSelectFileText.classList.add("tna-file-input__droppable-status"),this.$pseudoSelectFileText.textContent="No file".concat(this.acceptMutltipleFiles?"s":""," chosen"),this.$droppableArea.appendChild(this.$pseudoSelectFileText);var i=document.createElement("div");i.classList.add("tna-button-group","tna-button-group--small","tna-!--margin-top-xs","tna-file-input__droppable-buttons"),this.$droppableArea.appendChild(i);var r=document.createElement("span");r.classList.add("tna-button"),r.textContent="Choose file".concat(this.acceptMutltipleFiles?"s":""),i.appendChild(r);var o=document.createElement("span");o.textContent="or drop file".concat(this.acceptMutltipleFiles?"s":""),i.appendChild(o),this.$droppableAreaAriaLabel=document.createElement("span"),this.$droppableAreaAriaLabel.classList.add("tna-visually-hidden"),this.$droppableAreaAriaLabel.setAttribute("aria-live","assertive"),this.$droppableArea.appendChild(this.$droppableAreaAriaLabel),this.$input.addEventListener("dragenter",(function(e){return n.showDropTarget(e)})),this.$input.addEventListener("dragleave",(function(){return n.hideDropTarget()})),this.$input.addEventListener("dragend",(function(){return n.hideDropTarget()})),this.$input.addEventListener("change",(function(){return n.onChange()})),this.$input.addEventListener("drop",(function(){return n.onChange()}))}},t=[{key:"isContainingFiles",value:function(e){var t=0===e.types.length,n=e.types.some((function(e){return"Files"===e}));return t||n}},{key:"showDropTarget",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e.dataTransfer&&this.isContainingFiles(e.dataTransfer)&&(this.$droppableArea.classList.add(e.dataTransfer.items.length>1?"tna-file-input__droppable--over-multiple":"tna-file-input__droppable--over"),t&&(this.$droppableAreaAriaLabel.textContent="Entered drop zone"))}},{key:"hideDropTarget",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.$droppableArea.classList.remove("tna-file-input__droppable--over","tna-file-input__droppable--over-multiple"),e&&(this.$droppableAreaAriaLabel.textContent="Left drop zone")}},{key:"onChange",value:function(){var e,t=this.$input.files;this.acceptMutltipleFiles?0===t.length?this.$pseudoSelectFileText.textContent="No files chosen":this.$pseudoSelectFileText.textContent="".concat(t.length," file").concat(t.length>1?"s":""," chosen"):this.$pseudoSelectFileText.textContent=(null===(e=t[0])||void 0===e?void 0:e.name)||"No file chosen",this.hideDropTarget(!1)}}],t&&i(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();return t})()));
|
2
|
+
//# sourceMappingURL=file-input.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"components/file-input/file-input.js","mappings":"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","sources":["webpack://TNAFrontend/webpack/universalModuleDefinition","webpack://TNAFrontend/webpack/bootstrap","webpack://TNAFrontend/webpack/runtime/define property getters","webpack://TNAFrontend/webpack/runtime/hasOwnProperty shorthand","webpack://TNAFrontend/webpack/runtime/make namespace object","webpack://TNAFrontend/./src/nationalarchives/components/file-input/file-input.mjs"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"TNAFrontend\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"TNAFrontend\"] = factory();\n\telse\n\t\troot[\"TNAFrontend\"] = factory();\n})(self, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export class FileInputDroppable {\n constructor($module) {\n this.$module = $module;\n this.$input = $module && $module.querySelector(\".tna-file-input\");\n\n if (!this.$module || !this.$input) {\n return;\n }\n\n this.acceptMutltipleFiles = this.$input.hasAttribute(\"multiple\");\n\n this.$droppableArea = document.createElement(\"div\");\n this.$droppableArea.classList.add(\"tna-file-input__droppable\");\n this.$module.insertBefore(this.$droppableArea, this.$input);\n this.$droppableArea.appendChild(this.$input);\n\n this.$pseudoSelectFileText = document.createElement(\"span\");\n this.$pseudoSelectFileText.setAttribute(\"aria-live\", \"polite\");\n this.$pseudoSelectFileText.classList.add(\n \"tna-file-input__droppable-status\",\n );\n this.$pseudoSelectFileText.textContent = `No file${this.acceptMutltipleFiles ? \"s\" : \"\"} chosen`;\n this.$droppableArea.appendChild(this.$pseudoSelectFileText);\n\n const $droppableButtons = document.createElement(\"div\");\n $droppableButtons.classList.add(\n \"tna-button-group\",\n \"tna-button-group--small\",\n \"tna-!--margin-top-xs\",\n \"tna-file-input__droppable-buttons\",\n );\n this.$droppableArea.appendChild($droppableButtons);\n\n const $pseudoSelectFileButton = document.createElement(\"span\");\n $pseudoSelectFileButton.classList.add(\"tna-button\");\n $pseudoSelectFileButton.textContent = `Choose file${this.acceptMutltipleFiles ? \"s\" : \"\"}`;\n $droppableButtons.appendChild($pseudoSelectFileButton);\n\n const $pseudoDropFileButton = document.createElement(\"span\");\n $pseudoDropFileButton.textContent = `or drop file${this.acceptMutltipleFiles ? \"s\" : \"\"}`;\n $droppableButtons.appendChild($pseudoDropFileButton);\n\n this.$droppableAreaAriaLabel = document.createElement(\"span\");\n this.$droppableAreaAriaLabel.classList.add(\"tna-visually-hidden\");\n this.$droppableAreaAriaLabel.setAttribute(\"aria-live\", \"assertive\");\n this.$droppableArea.appendChild(this.$droppableAreaAriaLabel);\n\n this.$input.addEventListener(\"dragenter\", (e) => this.showDropTarget(e));\n this.$input.addEventListener(\"dragleave\", () => this.hideDropTarget());\n this.$input.addEventListener(\"dragend\", () => this.hideDropTarget());\n this.$input.addEventListener(\"change\", () => this.onChange());\n this.$input.addEventListener(\"drop\", () => this.onChange());\n }\n\n isContainingFiles(dataTransfer) {\n const hasNoTypesInfo = dataTransfer.types.length === 0;\n const isDraggingFiles = dataTransfer.types.some((type) => type === \"Files\");\n return hasNoTypesInfo || isDraggingFiles;\n }\n\n showDropTarget(event, updateAriaLabel = true) {\n if (event.dataTransfer && this.isContainingFiles(event.dataTransfer)) {\n this.$droppableArea.classList.add(\n event.dataTransfer.items.length > 1\n ? \"tna-file-input__droppable--over-multiple\"\n : \"tna-file-input__droppable--over\",\n );\n\n if (updateAriaLabel) {\n this.$droppableAreaAriaLabel.textContent = \"Entered drop zone\";\n }\n }\n }\n\n hideDropTarget(updateAriaLabel = true) {\n this.$droppableArea.classList.remove(\n \"tna-file-input__droppable--over\",\n \"tna-file-input__droppable--over-multiple\",\n );\n if (updateAriaLabel) {\n this.$droppableAreaAriaLabel.textContent = \"Left drop zone\";\n }\n }\n\n onChange() {\n const files = this.$input.files;\n if (this.acceptMutltipleFiles) {\n if (files.length === 0) {\n this.$pseudoSelectFileText.textContent = `No files chosen`;\n } else {\n this.$pseudoSelectFileText.textContent = `${files.length} file${files.length > 1 ? \"s\" : \"\"} chosen`;\n }\n } else {\n this.$pseudoSelectFileText.textContent =\n files[0]?.name || `No file chosen`;\n }\n this.hideDropTarget(false);\n }\n}\n"],"names":["root","factory","exports","module","define","amd","self","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","FileInputDroppable","$module","_this","_classCallCheck","this","$input","querySelector","acceptMutltipleFiles","hasAttribute","$droppableArea","document","createElement","classList","add","insertBefore","appendChild","$pseudoSelectFileText","setAttribute","textContent","concat","$droppableButtons","$pseudoSelectFileButton","$pseudoDropFileButton","$droppableAreaAriaLabel","addEventListener","e","showDropTarget","hideDropTarget","onChange","dataTransfer","hasNoTypesInfo","types","length","isDraggingFiles","some","type","event","updateAriaLabel","arguments","undefined","isContainingFiles","items","remove","_files$","files","name"],"sourceRoot":""}
|
@@ -0,0 +1,99 @@
|
|
1
|
+
export class FileInputDroppable {
|
2
|
+
constructor($module) {
|
3
|
+
this.$module = $module;
|
4
|
+
this.$input = $module && $module.querySelector(".tna-file-input");
|
5
|
+
|
6
|
+
if (!this.$module || !this.$input) {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
|
10
|
+
this.acceptMutltipleFiles = this.$input.hasAttribute("multiple");
|
11
|
+
|
12
|
+
this.$droppableArea = document.createElement("div");
|
13
|
+
this.$droppableArea.classList.add("tna-file-input__droppable");
|
14
|
+
this.$module.insertBefore(this.$droppableArea, this.$input);
|
15
|
+
this.$droppableArea.appendChild(this.$input);
|
16
|
+
|
17
|
+
this.$pseudoSelectFileText = document.createElement("span");
|
18
|
+
this.$pseudoSelectFileText.setAttribute("aria-live", "polite");
|
19
|
+
this.$pseudoSelectFileText.classList.add(
|
20
|
+
"tna-file-input__droppable-status",
|
21
|
+
);
|
22
|
+
this.$pseudoSelectFileText.textContent = `No file${this.acceptMutltipleFiles ? "s" : ""} chosen`;
|
23
|
+
this.$droppableArea.appendChild(this.$pseudoSelectFileText);
|
24
|
+
|
25
|
+
const $droppableButtons = document.createElement("div");
|
26
|
+
$droppableButtons.classList.add(
|
27
|
+
"tna-button-group",
|
28
|
+
"tna-button-group--small",
|
29
|
+
"tna-!--margin-top-xs",
|
30
|
+
"tna-file-input__droppable-buttons",
|
31
|
+
);
|
32
|
+
this.$droppableArea.appendChild($droppableButtons);
|
33
|
+
|
34
|
+
const $pseudoSelectFileButton = document.createElement("span");
|
35
|
+
$pseudoSelectFileButton.classList.add("tna-button");
|
36
|
+
$pseudoSelectFileButton.textContent = `Choose file${this.acceptMutltipleFiles ? "s" : ""}`;
|
37
|
+
$droppableButtons.appendChild($pseudoSelectFileButton);
|
38
|
+
|
39
|
+
const $pseudoDropFileButton = document.createElement("span");
|
40
|
+
$pseudoDropFileButton.textContent = `or drop file${this.acceptMutltipleFiles ? "s" : ""}`;
|
41
|
+
$droppableButtons.appendChild($pseudoDropFileButton);
|
42
|
+
|
43
|
+
this.$droppableAreaAriaLabel = document.createElement("span");
|
44
|
+
this.$droppableAreaAriaLabel.classList.add("tna-visually-hidden");
|
45
|
+
this.$droppableAreaAriaLabel.setAttribute("aria-live", "assertive");
|
46
|
+
this.$droppableArea.appendChild(this.$droppableAreaAriaLabel);
|
47
|
+
|
48
|
+
this.$input.addEventListener("dragenter", (e) => this.showDropTarget(e));
|
49
|
+
this.$input.addEventListener("dragleave", () => this.hideDropTarget());
|
50
|
+
this.$input.addEventListener("dragend", () => this.hideDropTarget());
|
51
|
+
this.$input.addEventListener("change", () => this.onChange());
|
52
|
+
this.$input.addEventListener("drop", () => this.onChange());
|
53
|
+
}
|
54
|
+
|
55
|
+
isContainingFiles(dataTransfer) {
|
56
|
+
const hasNoTypesInfo = dataTransfer.types.length === 0;
|
57
|
+
const isDraggingFiles = dataTransfer.types.some((type) => type === "Files");
|
58
|
+
return hasNoTypesInfo || isDraggingFiles;
|
59
|
+
}
|
60
|
+
|
61
|
+
showDropTarget(event, updateAriaLabel = true) {
|
62
|
+
if (event.dataTransfer && this.isContainingFiles(event.dataTransfer)) {
|
63
|
+
this.$droppableArea.classList.add(
|
64
|
+
event.dataTransfer.items.length > 1
|
65
|
+
? "tna-file-input__droppable--over-multiple"
|
66
|
+
: "tna-file-input__droppable--over",
|
67
|
+
);
|
68
|
+
|
69
|
+
if (updateAriaLabel) {
|
70
|
+
this.$droppableAreaAriaLabel.textContent = "Entered drop zone";
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
hideDropTarget(updateAriaLabel = true) {
|
76
|
+
this.$droppableArea.classList.remove(
|
77
|
+
"tna-file-input__droppable--over",
|
78
|
+
"tna-file-input__droppable--over-multiple",
|
79
|
+
);
|
80
|
+
if (updateAriaLabel) {
|
81
|
+
this.$droppableAreaAriaLabel.textContent = "Left drop zone";
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
onChange() {
|
86
|
+
const files = this.$input.files;
|
87
|
+
if (this.acceptMutltipleFiles) {
|
88
|
+
if (files.length === 0) {
|
89
|
+
this.$pseudoSelectFileText.textContent = `No files chosen`;
|
90
|
+
} else {
|
91
|
+
this.$pseudoSelectFileText.textContent = `${files.length} file${files.length > 1 ? "s" : ""} chosen`;
|
92
|
+
}
|
93
|
+
} else {
|
94
|
+
this.$pseudoSelectFileText.textContent =
|
95
|
+
files[0]?.name || `No file chosen`;
|
96
|
+
}
|
97
|
+
this.hideDropTarget(false);
|
98
|
+
}
|
99
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
{%- macro tnaFileInputElement(params, extraAttributes) -%}
|
2
|
+
{%- set inputClasses = [params.classes] if params.classes else [] -%}
|
3
|
+
<input id="{{ params.id }}" class="tna-file-input{% if inputClasses %} {{ inputClasses | join(' ') }}{% endif %}" name="{{ params.name }}" type="file"
|
4
|
+
{%- if params.hint or params.error %} aria-describedby="{%- if params.hint -%}{{ params.id }}-hint{%- endif %} {% if params.error -%}{{ params.id }}-error{%- endif -%}"{%- endif %}
|
5
|
+
{%- if params.multiple %} multiple{%- endif %}
|
6
|
+
{%- for attribute, value in params.attributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}
|
7
|
+
{%- for attribute, value in extraAttributes %} {{ attribute }}{% if value !== '' %}="{{ value }}"{% endif %}{% endfor %}>
|
8
|
+
{%- endmacro %}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
@use "../../variables/forms";
|
2
|
+
@use "../../tools/a11y";
|
3
|
+
@use "../../tools/borders";
|
4
|
+
@use "../../tools/colour";
|
5
|
+
@use "../../tools/media";
|
6
|
+
@use "../../tools/spacing";
|
7
|
+
@use "../../tools/typography";
|
8
|
+
|
9
|
+
.tna-file-input {
|
10
|
+
width: 100%;
|
11
|
+
|
12
|
+
display: block;
|
13
|
+
|
14
|
+
box-sizing: border-box;
|
15
|
+
|
16
|
+
border-radius: 0.1px;
|
17
|
+
|
18
|
+
cursor: pointer;
|
19
|
+
|
20
|
+
&::file-selector-button {
|
21
|
+
margin-right: spacing.space(0.5);
|
22
|
+
|
23
|
+
cursor: inherit;
|
24
|
+
}
|
25
|
+
|
26
|
+
&__droppable {
|
27
|
+
width: 100%;
|
28
|
+
padding: spacing.space(0.5) spacing.space(1) spacing.space(1);
|
29
|
+
|
30
|
+
box-sizing: border-box;
|
31
|
+
|
32
|
+
position: relative;
|
33
|
+
|
34
|
+
@include colour.colour-border(
|
35
|
+
"keyline",
|
36
|
+
forms.$form-field-border-width,
|
37
|
+
dashed
|
38
|
+
);
|
39
|
+
@include borders.rounded-border;
|
40
|
+
}
|
41
|
+
|
42
|
+
&__droppable:has(&:focus-visible) {
|
43
|
+
@include a11y.focus-outline;
|
44
|
+
}
|
45
|
+
|
46
|
+
&__droppable:has(&:active) {
|
47
|
+
@include a11y.focus-outline-without-offset;
|
48
|
+
}
|
49
|
+
|
50
|
+
&__droppable & {
|
51
|
+
padding: spacing.space(1);
|
52
|
+
|
53
|
+
position: absolute;
|
54
|
+
inset: 0;
|
55
|
+
z-index: 1;
|
56
|
+
|
57
|
+
opacity: 0;
|
58
|
+
}
|
59
|
+
|
60
|
+
&__droppable-buttons {
|
61
|
+
@include media.on-tiny {
|
62
|
+
flex-direction: row;
|
63
|
+
align-items: center;
|
64
|
+
}
|
65
|
+
|
66
|
+
@include typography.font-size(14);
|
67
|
+
line-height: 1.5rem;
|
68
|
+
}
|
69
|
+
|
70
|
+
&__droppable-status {
|
71
|
+
display: block;
|
72
|
+
overflow: hidden;
|
73
|
+
|
74
|
+
line-height: 2;
|
75
|
+
text-overflow: ellipsis;
|
76
|
+
|
77
|
+
white-space: nowrap;
|
78
|
+
}
|
79
|
+
|
80
|
+
&__droppable &:hover ~ &__droppable-buttons,
|
81
|
+
&__droppable &:focus-visible ~ &__droppable-buttons {
|
82
|
+
.tna-button {
|
83
|
+
&:not(.tna-button--plain) {
|
84
|
+
@include colour.colour-font("button-hover-text");
|
85
|
+
text-decoration: none;
|
86
|
+
|
87
|
+
background: transparent;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
&__droppable--over,
|
93
|
+
&__droppable--over-multiple {
|
94
|
+
@include colour.colour-border("keyline-dark");
|
95
|
+
|
96
|
+
&::before {
|
97
|
+
display: flex;
|
98
|
+
align-items: center;
|
99
|
+
justify-content: center;
|
100
|
+
|
101
|
+
position: absolute;
|
102
|
+
inset: spacing.space(0.5);
|
103
|
+
z-index: 2;
|
104
|
+
|
105
|
+
pointer-events: none;
|
106
|
+
|
107
|
+
@include colour.green-accent;
|
108
|
+
|
109
|
+
@include colour.colour-font("accent-font-base");
|
110
|
+
@include typography.main-font-weight-bold;
|
111
|
+
|
112
|
+
@include colour.colour-background("accent-background");
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
&__droppable--over {
|
117
|
+
&::before {
|
118
|
+
content: "Drop file here";
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
&__droppable--over-multiple {
|
123
|
+
&::before {
|
124
|
+
content: "Drop files here";
|
125
|
+
}
|
126
|
+
}
|
127
|
+
}
|