@nationalarchives/frontend 0.1.5-prerelease → 0.1.7-prerelease

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.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/govuk-prototype-kit.config.json +16 -1
  3. package/nationalarchives/all.css +1 -1
  4. package/nationalarchives/all.css.map +1 -1
  5. package/nationalarchives/all.js +1 -1
  6. package/nationalarchives/all.js.map +1 -1
  7. package/nationalarchives/all.scss +4 -3
  8. package/nationalarchives/components/_all.scss +6 -7
  9. package/nationalarchives/components/breadcrumbs/_index.scss +68 -0
  10. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +57 -0
  11. package/nationalarchives/components/breadcrumbs/fixtures.json +26 -0
  12. package/nationalarchives/components/breadcrumbs/macro-options.json +40 -0
  13. package/nationalarchives/components/breadcrumbs/macro.njk +3 -0
  14. package/nationalarchives/components/breadcrumbs/template.njk +13 -0
  15. package/nationalarchives/components/button/_index.scss +10 -11
  16. package/nationalarchives/components/button/button.stories.js +2 -3
  17. package/nationalarchives/components/card/_index.scss +48 -10
  18. package/nationalarchives/components/card/card.stories.js +43 -12
  19. package/nationalarchives/components/card/fixtures.json +135 -7
  20. package/nationalarchives/components/card/macro-options.json +42 -10
  21. package/nationalarchives/components/card/template.njk +53 -24
  22. package/nationalarchives/components/footer/_index.scss +33 -23
  23. package/nationalarchives/components/footer/fixtures.json +1 -1
  24. package/nationalarchives/components/footer/footer.stories.js +23 -3
  25. package/nationalarchives/components/footer/macro-options.json +12 -0
  26. package/nationalarchives/components/footer/template.njk +16 -5
  27. package/nationalarchives/components/grid/_index.scss +123 -51
  28. package/nationalarchives/components/grid/grid.stories.js +6 -4
  29. package/nationalarchives/components/grid/macro-options.json +7 -1
  30. package/nationalarchives/components/grid/template.njk +3 -0
  31. package/nationalarchives/components/hero/_index.scss +132 -0
  32. package/nationalarchives/components/hero/fixtures.json +4 -0
  33. package/nationalarchives/components/hero/hero.stories.js +74 -0
  34. package/nationalarchives/components/hero/macro-options.json +58 -0
  35. package/nationalarchives/components/hero/macro.njk +3 -0
  36. package/nationalarchives/components/hero/template.njk +30 -0
  37. package/nationalarchives/components/sensitive-image/_index.scss +10 -17
  38. package/nationalarchives/components/sensitive-image/sensitive-image.js +1 -1
  39. package/nationalarchives/components/sensitive-image/sensitive-image.js.map +1 -1
  40. package/nationalarchives/components/sensitive-image/sensitive-image.mjs +1 -1
  41. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +38 -3
  42. package/nationalarchives/stories/design/about.mdx +25 -0
  43. package/nationalarchives/stories/development/about.mdx +1 -1
  44. package/nationalarchives/stories/development/publishing.mdx +1 -0
  45. package/nationalarchives/stories/utilities/heading-groups.stories.js +44 -0
  46. package/nationalarchives/stories/{global → utilities}/headings.stories.js +1 -1
  47. package/nationalarchives/stories/utilities/lists.stories.js +38 -0
  48. package/nationalarchives/stories/{global → utilities}/typography.mdx +8 -8
  49. package/nationalarchives/stories/utilities/typography.stories.js +14 -0
  50. package/nationalarchives/templates/homepage.njk +64 -0
  51. package/nationalarchives/templates/layouts/_generic.njk +60 -0
  52. package/nationalarchives/templates/search-results.njk +38 -0
  53. package/nationalarchives/templates/topics.njk +42 -0
  54. package/nationalarchives/tools/_all.scss +3 -2
  55. package/nationalarchives/tools/_grid.scss +8 -95
  56. package/nationalarchives/tools/_media.scss +62 -0
  57. package/nationalarchives/tools/_typography.scss +6 -0
  58. package/nationalarchives/utilities/_all.scss +2 -2
  59. package/nationalarchives/utilities/_global.scss +8 -0
  60. package/nationalarchives/utilities/_typography.scss +126 -55
  61. package/nationalarchives/variables/_all.scss +4 -2
  62. package/nationalarchives/variables/_colour.scss +1 -0
  63. package/nationalarchives/variables/_grid.scss +7 -7
  64. package/nationalarchives/variables/_media.scss +11 -11
  65. package/nationalarchives/variables/_typography.scss +10 -0
  66. package/package.json +13 -5
  67. package/nationalarchives/_base.scss +0 -3
  68. package/nationalarchives/_prototype-kit.scss +0 -3
  69. package/nationalarchives/components/button/_button.scss +0 -2
  70. package/nationalarchives/components/card/_card.scss +0 -2
  71. package/nationalarchives/components/footer/_footer.scss +0 -2
  72. package/nationalarchives/components/grid/_grid.scss +0 -2
  73. package/nationalarchives/components/sensitive-image/_sensitive-image.scss +0 -2
  74. package/nationalarchives/stories/global/heading-groups.stories.js +0 -23
  75. package/nationalarchives/stories/global/typography.stories.js +0 -15
  76. package/nationalarchives/tools/_exports.scss +0 -36
@@ -1,84 +1,156 @@
1
1
  @use "sass:math";
2
+ @use "../../variables/grid";
3
+ @use "../../tools/media";
4
+ @use "../../tools/grid" as tools;
5
+
6
+ .tna-container {
7
+ max-width: grid.$largest-container-width;
8
+ width: 100%;
9
+ margin-right: auto;
10
+ margin-left: auto;
11
+ padding-right: math.div(grid.$gutter-width, 2);
12
+ padding-left: math.div(grid.$gutter-width, 2);
13
+
14
+ box-sizing: border-box;
15
+
16
+ display: -ms-flexbox;
17
+ display: flex;
18
+ flex-wrap: wrap;
19
+ justify-content: stretch;
20
+ align-items: stretch;
21
+
22
+ &--no-padding,
23
+ &--no-padding-all {
24
+ max-width: grid.$largest-container-width - (grid.$gutter-width * 2);
25
+ }
2
26
 
3
- @import "../../variables/all";
4
- @import "../../tools/grid";
27
+ &--max {
28
+ max-width: none;
29
+ }
30
+ }
5
31
 
6
- @include nationalarchives-exports("nationalarchives/utilities/grid") {
7
- .tna-container {
8
- max-width: $largest-container-width;
9
- width: 100%;
10
- margin-right: auto;
11
- margin-left: auto;
12
- padding-right: math.div($gutter-width, 2);
13
- padding-left: math.div($gutter-width, 2);
32
+ .tna-column {
33
+ padding-right: math.div(grid.$gutter-width, 2);
34
+ padding-left: math.div(grid.$gutter-width, 2);
14
35
 
15
- box-sizing: border-box;
36
+ box-sizing: border-box;
16
37
 
38
+ &--full {
39
+ width: 100%;
40
+ }
41
+
42
+ &--container {
17
43
  display: -ms-flexbox;
18
44
  display: flex;
19
45
  flex-wrap: wrap;
20
46
  justify-content: stretch;
21
47
  align-items: stretch;
48
+ }
22
49
 
23
- &.tna-container--max {
24
- max-width: none;
50
+ @for $i from 1 through 3 {
51
+ &--flex-#{$i} {
52
+ flex: $i 0;
25
53
  }
54
+ }
55
+ }
26
56
 
27
- &.tna-container--no-padding {
28
- max-width: $largest-container-width - ($gutter-width * 2);
29
- padding-right: 0;
30
- padding-left: 0;
57
+ .tna-container--no-padding,
58
+ .tna-container--no-padding-all,
59
+ .tna-container--no-padding-all > .tna-column,
60
+ .tna-column--no-padding,
61
+ .tna-column--container--no-padding-all,
62
+ .tna-column--container--no-padding-all > .tna-column {
63
+ padding-right: 0;
64
+ padding-left: 0;
65
+ }
66
+
67
+ // @for $i from 1 through 3 {
68
+ // .tna-column--order-#{$i} {
69
+ // order: $i;
70
+ // }
71
+ // }
72
+
73
+ @include tools.columns-generator(grid.$column-count);
74
+
75
+ @include media.on-medium {
76
+ .tna-column {
77
+ &--full-medium {
78
+ width: 100%;
79
+ flex: none;
80
+ }
31
81
 
32
- .tna-column {
33
- padding-right: 0;
34
- padding-left: 0;
82
+ @for $i from 1 through 3 {
83
+ &--flex-#{$i}-medium {
84
+ flex: $i 0;
35
85
  }
36
86
  }
87
+
88
+ // @for $i from 1 through 3 {
89
+ // &--order-#{$i}-medium {
90
+ // order: $i;
91
+ // }
92
+ // }
37
93
  }
38
94
 
39
- .tna-column {
40
- padding-right: math.div($gutter-width, 2);
41
- padding-left: math.div($gutter-width, 2);
95
+ @include tools.columns-generator(grid.$column-count-medium, "-medium");
96
+ }
42
97
 
43
- box-sizing: border-box;
98
+ @include media.on-mobile {
99
+ .tna-container {
100
+ padding-right: math.div(grid.$gutter-width-mobile, 2) + 0.75rem;
101
+ padding-left: math.div(grid.$gutter-width-mobile, 2) + 0.75rem;
102
+ }
103
+
104
+ .tna-column {
105
+ padding-right: math.div(grid.$gutter-width-mobile, 2);
106
+ padding-left: math.div(grid.$gutter-width-mobile, 2);
107
+ }
108
+ }
44
109
 
45
- &.tna-column--full {
110
+ @include media.on-small {
111
+ .tna-column {
112
+ &--full-small {
46
113
  width: 100%;
114
+ flex: none;
47
115
  }
48
116
 
49
- // &.column--no-padding {
50
- // padding-right: 0;
51
- // padding-left: 0;
52
- // }
53
- }
54
-
55
- @for $i from 1 through 3 {
56
- .tna-column--flex-#{$i} {
57
- flex: $i 0;
117
+ @for $i from 1 through 3 {
118
+ &--flex-#{$i}-small {
119
+ flex: $i 0;
120
+ }
58
121
  }
122
+
123
+ // @for $i from 1 through 3 {
124
+ // &--order-#{$i}-small {
125
+ // order: $i;
126
+ // }
127
+ // }
59
128
  }
60
129
 
61
- // @for $i from 1 through 3 {
62
- // .column--order-#{$i} {
63
- // order: $i;
64
- // }
65
- // }
130
+ @include tools.columns-generator(grid.$column-count-small, "-small");
131
+ }
66
132
 
67
- @include columns-generator($column-count);
133
+ @include media.on-tiny {
134
+ .tna-column {
135
+ &--full-tiny {
136
+ width: 100%;
137
+ flex: none;
138
+ }
68
139
 
69
- @media #{$media-medium} {
70
- @include grid-medium;
71
- }
140
+ @for $i from 1 through 3 {
141
+ &--flex-#{$i}-tiny {
142
+ width: auto;
72
143
 
73
- @media #{$media-mobile} {
74
- @include grid-mobile;
75
- }
144
+ flex: $i 0;
145
+ }
146
+ }
76
147
 
77
- @media #{$media-small} {
78
- @include grid-small;
148
+ // @for $i from 1 through 3 {
149
+ // &--order-#{$i}-tiny {
150
+ // order: $i;
151
+ // }
152
+ // }
79
153
  }
80
154
 
81
- @media #{$media-tiny} {
82
- @include grid-tiny;
83
- }
155
+ @include tools.columns-generator(grid.$column-count-tiny, "-tiny");
84
156
  }
@@ -1,15 +1,15 @@
1
1
  import Header from "./template.njk";
2
- import "../../all.scss";
3
- import "./_grid.scss";
2
+ import "./_index.scss";
4
3
  import macroOptions from "./macro-options.json";
5
4
 
6
5
  const argTypes = {
7
6
  columns: { control: "object" },
8
7
  maxWidth: { control: "boolean" },
9
8
  noPadding: { control: "boolean" },
9
+ noPaddingAll: { control: "boolean" },
10
10
  htmlElement: { control: "text" },
11
11
  classes: { control: "text" },
12
- attributes: { control: "text" },
12
+ attributes: { control: "object" },
13
13
  };
14
14
 
15
15
  Object.keys(argTypes).forEach((argType) => {
@@ -19,7 +19,7 @@ Object.keys(argTypes).forEach((argType) => {
19
19
  });
20
20
 
21
21
  export default {
22
- title: "Utilities/Grid",
22
+ title: "Components/Grid",
23
23
  argTypes,
24
24
  };
25
25
 
@@ -27,6 +27,7 @@ const Template = ({
27
27
  columns,
28
28
  maxWidth,
29
29
  noPadding,
30
+ noPaddingAll,
30
31
  htmlElement,
31
32
  classes,
32
33
  attributes,
@@ -36,6 +37,7 @@ const Template = ({
36
37
  columns,
37
38
  maxWidth,
38
39
  noPadding,
40
+ noPaddingAll,
39
41
  htmlElement,
40
42
  classes,
41
43
  attributes,
@@ -81,7 +81,13 @@
81
81
  },
82
82
  {
83
83
  "name": "noPadding",
84
- "type": "string",
84
+ "type": "boolean",
85
+ "required": false,
86
+ "description": ""
87
+ },
88
+ {
89
+ "name": "noPaddingAll",
90
+ "type": "boolean",
85
91
  "required": false,
86
92
  "description": ""
87
93
  },
@@ -6,6 +6,9 @@
6
6
  {%- if params.noPadding -%}
7
7
  {%- set containerClasses = containerClasses.concat('tna-container--no-padding') -%}
8
8
  {%- endif -%}
9
+ {%- if params.noPaddingAll -%}
10
+ {%- set containerClasses = containerClasses.concat('tna-container--no-padding-all') -%}
11
+ {%- endif -%}
9
12
  <{{ htmlElement }} class="tna-container {{ containerClasses | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
10
13
  {%- for item in params.columns -%}
11
14
  {%- set columnHtmlElement = item.htmlElement if item.htmlElement else 'div' -%}
@@ -0,0 +1,132 @@
1
+ @use "../../tools/media";
2
+
3
+ .tna-hero {
4
+ min-height: min(20vw, 300px);
5
+ padding-top: 5.25rem;
6
+ padding-bottom: 3.25rem;
7
+
8
+ display: -ms-flexbox;
9
+ display: flex;
10
+ align-items: end;
11
+
12
+ position: relative;
13
+
14
+ background-color: #000;
15
+
16
+ &__image {
17
+ width: 100%;
18
+ height: 100%;
19
+
20
+ position: absolute;
21
+ inset: 0;
22
+ z-index: 1;
23
+
24
+ object-fit: cover;
25
+ }
26
+
27
+ &__image-details {
28
+ position: absolute;
29
+ right: 1.25rem;
30
+ bottom: 1.25rem;
31
+ z-index: 3;
32
+ }
33
+
34
+ &__image-details-summary {
35
+ width: 2rem;
36
+ height: 2rem;
37
+
38
+ position: relative;
39
+ z-index: 2;
40
+
41
+ font-size: 0;
42
+ text-align: center;
43
+ line-height: 2rem;
44
+ list-style: none;
45
+
46
+ background-color: #fc0;
47
+
48
+ border-radius: 1rem;
49
+
50
+ cursor: pointer;
51
+ }
52
+
53
+ &__image-details-summary-icon {
54
+ font-size: 1.25rem;
55
+ font-style: normal;
56
+ font-weight: 700;
57
+ text-transform: lowercase;
58
+ }
59
+
60
+ &__image-information {
61
+ width: 20rem;
62
+ max-width: 45vw;
63
+ padding: 0.5rem 1rem;
64
+
65
+ position: absolute;
66
+ right: 0;
67
+ bottom: 2.5rem;
68
+ z-index: 1;
69
+
70
+ background-color: #fc0;
71
+ }
72
+
73
+ &__inner {
74
+ position: relative;
75
+ z-index: 2;
76
+ }
77
+
78
+ &__content {
79
+ padding-top: 1.5rem;
80
+ padding-bottom: 1.5rem;
81
+
82
+ background-color: #fff;
83
+ }
84
+
85
+ &__heading {
86
+ margin-bottom: 0;
87
+ }
88
+
89
+ &__body {
90
+ }
91
+
92
+ @include media.on-mobile {
93
+ padding: 0;
94
+
95
+ display: block;
96
+
97
+ &__image {
98
+ position: static;
99
+ }
100
+
101
+ &__image-details {
102
+ bottom: auto;
103
+ top: 1.25rem;
104
+ }
105
+
106
+ &__image-details-summary {
107
+ }
108
+
109
+ &__image-details-summary-icon {
110
+ }
111
+
112
+ &__image-information {
113
+ top: 2.5rem;
114
+ bottom: auto;
115
+ }
116
+
117
+ &__inner {
118
+ }
119
+
120
+ &__content {
121
+ color: #fff;
122
+
123
+ background-color: inherit;
124
+ }
125
+
126
+ &__heading {
127
+ }
128
+
129
+ &__body {
130
+ }
131
+ }
132
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "component": "hero",
3
+ "fixtures": []
4
+ }
@@ -0,0 +1,74 @@
1
+ import Hero from "./template.njk";
2
+ import "./_index.scss";
3
+ import macroOptions from "./macro-options.json";
4
+ import { expect } from "@storybook/jest";
5
+ import { within, userEvent } from "@storybook/testing-library";
6
+
7
+ const argTypes = {
8
+ heading: { control: "text" },
9
+ body: { control: "text" },
10
+ text: { control: "text" },
11
+ image: { control: "object" },
12
+ classes: { control: "text" },
13
+ attributes: { control: "object" },
14
+ };
15
+
16
+ Object.keys(argTypes).forEach((argType) => {
17
+ argTypes[argType].description = macroOptions.find(
18
+ (option) => option.name === argType
19
+ )?.description;
20
+ });
21
+
22
+ export default {
23
+ title: "Components/Hero",
24
+ argTypes,
25
+ };
26
+
27
+ const Template = ({ heading, body, text, image, classes, attributes }) => {
28
+ return Hero({
29
+ params: {
30
+ heading,
31
+ body,
32
+ text,
33
+ image,
34
+ classes,
35
+ attributes,
36
+ },
37
+ });
38
+ };
39
+
40
+ export const Standard = Template.bind({});
41
+ Standard.args = {
42
+ heading: "Title",
43
+ body: "<p>Body</p>",
44
+ image: {
45
+ src: "https://picsum.photos/id/29/640/360",
46
+ alt: "A placeholder image",
47
+ information: "Photo of some mountains by a famous photographer, ©2012",
48
+ },
49
+ classes: "tna-hero--demo",
50
+ };
51
+
52
+ Standard.play = async ({ args, canvasElement }) => {
53
+ const canvas = within(canvasElement);
54
+ const image = canvas.getByAltText(args.image.alt);
55
+ const title = canvas.getByText(args.heading);
56
+ const summary = canvasElement.querySelector(
57
+ ".tna-hero__image-details-summary"
58
+ );
59
+ const information = canvas.getByText(args.image.information);
60
+
61
+ await expect(image).toBeVisible();
62
+ await expect(title).toBeVisible();
63
+ await expect(summary).toBeVisible();
64
+ await expect(information).not.toBeVisible();
65
+
66
+ await userEvent.click(summary);
67
+ await expect(image).toBeVisible();
68
+ await expect(title).toBeVisible();
69
+ await expect(summary).toBeVisible();
70
+ await expect(information).toBeVisible();
71
+
72
+ await userEvent.click(summary);
73
+ await expect(information).not.toBeVisible();
74
+ };
@@ -0,0 +1,58 @@
1
+ [
2
+ {
3
+ "name": "heading",
4
+ "type": "string",
5
+ "required": false,
6
+ "description": ""
7
+ },
8
+ {
9
+ "name": "body",
10
+ "type": "string",
11
+ "required": false,
12
+ "description": ""
13
+ },
14
+ {
15
+ "name": "text",
16
+ "type": "string",
17
+ "required": false,
18
+ "description": ""
19
+ },
20
+ {
21
+ "name": "image",
22
+ "type": "object",
23
+ "required": false,
24
+ "description": "",
25
+ "params": [
26
+ {
27
+ "name": "src",
28
+ "type": "string",
29
+ "required": true,
30
+ "description": ""
31
+ },
32
+ {
33
+ "name": "alt",
34
+ "type": "string",
35
+ "required": true,
36
+ "description": ""
37
+ },
38
+ {
39
+ "name": "information",
40
+ "type": "string",
41
+ "required": false,
42
+ "description": ""
43
+ }
44
+ ]
45
+ },
46
+ {
47
+ "name": "classes",
48
+ "type": "string",
49
+ "required": false,
50
+ "description": "Classes to add to the card."
51
+ },
52
+ {
53
+ "name": "attributes",
54
+ "type": "object",
55
+ "required": false,
56
+ "description": "HTML attributes (for example data attributes) to add to the card."
57
+ }
58
+ ]
@@ -0,0 +1,3 @@
1
+ {% macro tnaHero(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,30 @@
1
+ {%- set classes = [params.classes] if params.classes else [] -%}
2
+ <header class="tna-hero {{ classes | join(' ') }}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
3
+ <img src="{{ params.image.src }}" alt="{{ params.image.alt }}" class="tna-hero__image">
4
+ {%- if params.image.information -%}
5
+ <details class="tna-hero__image-details">
6
+ <summary class="tna-hero__image-details-summary">
7
+ <span class="tna-hero__image-details-summary-icon">I</span>nformation about this image
8
+ </summary>
9
+ <div class="tna-hero__image-information">
10
+ <p>{{ params.image.information }}</p>
11
+ </div>
12
+ </details>
13
+ {%- endif -%}
14
+ <div class="tna-container tna-hero__inner">
15
+ <div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny tna-hero__content">
16
+ {%- if params.heading -%}
17
+ <h1 class="tna-heading tna-heading--xl tna-hero__heading">
18
+ {{ params.heading }}
19
+ </h1>
20
+ {%- endif -%}
21
+ <div class="tna-hero__body">
22
+ {%- if params.text -%}
23
+ <p>{{ params.text }}</p>
24
+ {%- elseif params.body -%}
25
+ {{ params.body | safe }}
26
+ {%- endif -%}
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </header>
@@ -1,13 +1,10 @@
1
- @include nationalarchives-exports(
2
- "nationalarchives/components/sensitive-image"
3
- ) {
4
- .tna-sensitive-image {
5
- }
1
+ @use "../../tools/typography" as typographyTools;
6
2
 
7
- .tna-sensitive-image__warning {
3
+ .tna-sensitive-image {
4
+ &__warning {
8
5
  }
9
6
 
10
- .tna-sensitive-image__details {
7
+ &__details {
11
8
  position: relative;
12
9
 
13
10
  // overflow: hidden;
@@ -33,16 +30,13 @@
33
30
  }
34
31
  }
35
32
 
36
- .tna-sensitive-image__show {
33
+ &__show {
37
34
  display: flex;
38
35
  align-items: center;
39
36
  justify-content: center;
40
37
 
41
38
  position: absolute;
42
- top: 0;
43
- right: 0;
44
- bottom: 0;
45
- left: 0;
39
+ inset: 0;
46
40
  z-index: 1;
47
41
 
48
42
  font-size: 0;
@@ -52,8 +46,7 @@
52
46
  &::after {
53
47
  padding: 0.5rem 2rem;
54
48
 
55
- font-size: 1rem;
56
-
49
+ @include typographyTools.relative-font-size(16);
57
50
  background-color: #ff0;
58
51
 
59
52
  content: attr(data-action);
@@ -68,14 +61,14 @@
68
61
  }
69
62
  }
70
63
 
71
- .tna-sensitive-image__container {
64
+ &__container {
72
65
  }
73
66
 
74
- .tna-sensitive-image__image {
67
+ &__image {
75
68
  width: 100%;
76
69
  }
77
70
 
78
- .tna-sensitive-image__details[open] {
71
+ &__details[open] {
79
72
  &::after,
80
73
  .tna-sensitive-image__show {
81
74
  display: none;
@@ -1,2 +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=e.TNAFrontend||{},e.TNAFrontend["components/sensitive-image/sensitive-image"]=t())}(self,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},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 i(e){this.$module=e,this.$imageDetails=e&&e.querySelector(".tna-sensitive-image__details"),this.$image=e&&e.querySelector(".tna-sensitive-image__image"),this.imageIsVisible=!1}e.r(t),e.d(t,{default:()=>o}),i.prototype.init=function(){console.log(this),this.$module&&this.$imageDetails&&this.$image&&this.$imageDetails.addEventListener("toggle",this.handleImageDetailsToggle.bind(this))},i.prototype.handleImageDetailsToggle=function(e){this.$imageDetails.hasAttribute("open")&&this.$image.focus({preventScroll:!0,focusVisible:!0})};const o=i;return t})()));
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=e.TNAFrontend||{},e.TNAFrontend["components/sensitive-image/sensitive-image"]=t())}(self,(()=>(()=>{"use strict";var e={d:(t,i)=>{for(var o in i)e.o(i,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:i[o]})},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 i(e){this.$module=e,this.$imageDetails=e&&e.querySelector(".tna-sensitive-image__details"),this.$image=e&&e.querySelector(".tna-sensitive-image__image"),this.imageIsVisible=!1}e.r(t),e.d(t,{default:()=>o}),i.prototype.init=function(){console.log(this),this.$module&&this.$imageDetails&&this.$image&&this.$imageDetails.addEventListener("toggle",this.handleImageDetailsToggle.bind(this))},i.prototype.handleImageDetailsToggle=function(){this.$imageDetails.hasAttribute("open")&&this.$image.focus({preventScroll:!0,focusVisible:!0})};const o=i;return t})()));
2
2
  //# sourceMappingURL=sensitive-image.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"components/sensitive-image/sensitive-image.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,KAEzBD,EAAkB,YAAIA,EAAkB,aAAK,CAAC,EAAGA,EAAkB,YAAE,8CAAgDC,IACtH,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,KCL9D,SAASC,EAAeC,GACtBC,KAAKD,QAAUA,EACfC,KAAKC,cACHF,GAAWA,EAAQG,cAAc,iCACnCF,KAAKG,OAASJ,GAAWA,EAAQG,cAAc,+BAC/CF,KAAKI,gBAAiB,CACxB,C,8BAEAN,EAAeN,UAAUa,KAAO,WAC9BC,QAAQC,IAAIP,MACPA,KAAKD,SAAYC,KAAKC,eAAkBD,KAAKG,QAGlDH,KAAKC,cAAcO,iBACjB,SACAR,KAAKS,yBAAyBC,KAAKV,MAEvC,EAEAF,EAAeN,UAAUiB,yBAA2B,SAAUE,GACxDX,KAAKC,cAAcW,aAAa,SAClCZ,KAAKG,OAAOU,MAAM,CAAEC,eAAe,EAAMC,cAAc,GAE3D,EAEA,U","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/sensitive-image/sensitive-image.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\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/sensitive-image/sensitive-image\"] = 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};","function SensitiveImage($module) {\n this.$module = $module;\n this.$imageDetails =\n $module && $module.querySelector(\".tna-sensitive-image__details\");\n this.$image = $module && $module.querySelector(\".tna-sensitive-image__image\");\n this.imageIsVisible = false;\n}\n\nSensitiveImage.prototype.init = function () {\n console.log(this);\n if (!this.$module || !this.$imageDetails || !this.$image) {\n return;\n }\n this.$imageDetails.addEventListener(\n \"toggle\",\n this.handleImageDetailsToggle.bind(this)\n );\n};\n\nSensitiveImage.prototype.handleImageDetailsToggle = function (e) {\n if (this.$imageDetails.hasAttribute(\"open\")) {\n this.$image.focus({ preventScroll: true, focusVisible: true });\n }\n};\n\nexport default SensitiveImage;\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","SensitiveImage","$module","this","$imageDetails","querySelector","$image","imageIsVisible","init","console","log","addEventListener","handleImageDetailsToggle","bind","e","hasAttribute","focus","preventScroll","focusVisible"],"sourceRoot":""}
1
+ {"version":3,"file":"components/sensitive-image/sensitive-image.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,cAAe,GAAIH,GACA,iBAAZC,QACdA,QAAqB,YAAID,KAEzBD,EAAkB,YAAIA,EAAkB,aAAK,CAAC,EAAGA,EAAkB,YAAE,8CAAgDC,IACtH,CATD,CASGK,MAAM,I,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,KCL9D,SAASC,EAAeC,GACtBC,KAAKD,QAAUA,EACfC,KAAKC,cACHF,GAAWA,EAAQG,cAAc,iCACnCF,KAAKG,OAASJ,GAAWA,EAAQG,cAAc,+BAC/CF,KAAKI,gBAAiB,CACxB,C,8BAEAN,EAAeN,UAAUa,KAAO,WAC9BC,QAAQC,IAAIP,MACPA,KAAKD,SAAYC,KAAKC,eAAkBD,KAAKG,QAGlDH,KAAKC,cAAcO,iBACjB,SACAR,KAAKS,yBAAyBC,KAAKV,MAEvC,EAEAF,EAAeN,UAAUiB,yBAA2B,WAC9CT,KAAKC,cAAcU,aAAa,SAClCX,KAAKG,OAAOS,MAAM,CAAEC,eAAe,EAAMC,cAAc,GAE3D,EAEA,U","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/sensitive-image/sensitive-image.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\"] = root[\"TNAFrontend\"] || {}, root[\"TNAFrontend\"][\"components/sensitive-image/sensitive-image\"] = 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};","function SensitiveImage($module) {\n this.$module = $module;\n this.$imageDetails =\n $module && $module.querySelector(\".tna-sensitive-image__details\");\n this.$image = $module && $module.querySelector(\".tna-sensitive-image__image\");\n this.imageIsVisible = false;\n}\n\nSensitiveImage.prototype.init = function () {\n console.log(this);\n if (!this.$module || !this.$imageDetails || !this.$image) {\n return;\n }\n this.$imageDetails.addEventListener(\n \"toggle\",\n this.handleImageDetailsToggle.bind(this)\n );\n};\n\nSensitiveImage.prototype.handleImageDetailsToggle = function () {\n if (this.$imageDetails.hasAttribute(\"open\")) {\n this.$image.focus({ preventScroll: true, focusVisible: true });\n }\n};\n\nexport default SensitiveImage;\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","SensitiveImage","$module","this","$imageDetails","querySelector","$image","imageIsVisible","init","console","log","addEventListener","handleImageDetailsToggle","bind","hasAttribute","focus","preventScroll","focusVisible"],"sourceRoot":""}