@nationalarchives/frontend 0.1.42 → 0.1.43

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 (107) hide show
  1. package/nationalarchives/all.css +1 -1
  2. package/nationalarchives/all.css.map +1 -1
  3. package/nationalarchives/all.js +1 -1
  4. package/nationalarchives/all.js.map +1 -1
  5. package/nationalarchives/analytics.js +1 -1
  6. package/nationalarchives/analytics.js.map +1 -1
  7. package/nationalarchives/analytics.mjs +98 -55
  8. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  9. package/nationalarchives/components/breadcrumbs/template.njk +2 -1
  10. package/nationalarchives/components/button/button-group.stories.js +122 -0
  11. package/nationalarchives/components/button/button.css +1 -1
  12. package/nationalarchives/components/button/button.css.map +1 -1
  13. package/nationalarchives/components/button/button.scss +4 -8
  14. package/nationalarchives/components/button/button.stories.js +36 -38
  15. package/nationalarchives/components/button/fixtures.json +3 -3
  16. package/nationalarchives/components/button/template.njk +9 -8
  17. package/nationalarchives/components/card/card.css +1 -1
  18. package/nationalarchives/components/card/card.css.map +1 -1
  19. package/nationalarchives/components/card/card.scss +6 -0
  20. package/nationalarchives/components/card/card.stories.js +11 -0
  21. package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
  22. package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
  23. package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
  24. package/nationalarchives/components/cookie-banner/fixtures.json +10 -10
  25. package/nationalarchives/components/date-input/date-input.css.map +1 -1
  26. package/nationalarchives/components/date-search/date-search.css.map +1 -1
  27. package/nationalarchives/components/error-summary/error-summary.css +1 -1
  28. package/nationalarchives/components/error-summary/error-summary.css.map +1 -1
  29. package/nationalarchives/components/error-summary/error-summary.scss +1 -1
  30. package/nationalarchives/components/featured-records/featured-records.css +1 -1
  31. package/nationalarchives/components/featured-records/featured-records.css.map +1 -1
  32. package/nationalarchives/components/featured-records/featured-records.scss +1 -1
  33. package/nationalarchives/components/footer/analytics.js +97 -0
  34. package/nationalarchives/components/footer/fixtures.json +7 -12
  35. package/nationalarchives/components/footer/footer.css +1 -1
  36. package/nationalarchives/components/footer/footer.css.map +1 -1
  37. package/nationalarchives/components/footer/footer.scss +4 -2
  38. package/nationalarchives/components/footer/footer.stories.js +5 -11
  39. package/nationalarchives/components/footer/template.njk +13 -10
  40. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  41. package/nationalarchives/components/global-header/analytics.js +42 -8
  42. package/nationalarchives/components/global-header/fixtures.json +1 -1
  43. package/nationalarchives/components/global-header/global-header.css +1 -1
  44. package/nationalarchives/components/global-header/global-header.css.map +1 -1
  45. package/nationalarchives/components/global-header/global-header.js +1 -1
  46. package/nationalarchives/components/global-header/global-header.js.map +1 -1
  47. package/nationalarchives/components/global-header/global-header.mjs +40 -79
  48. package/nationalarchives/components/global-header/global-header.scss +9 -6
  49. package/nationalarchives/components/global-header/macro-options.json +12 -0
  50. package/nationalarchives/components/global-header/template.njk +7 -7
  51. package/nationalarchives/components/grid/grid.css +1 -1
  52. package/nationalarchives/components/grid/grid.css.map +1 -1
  53. package/nationalarchives/components/grid/grid.scss +0 -1
  54. package/nationalarchives/components/header/analytics.js +3 -8
  55. package/nationalarchives/components/header/fixtures.json +1 -1
  56. package/nationalarchives/components/header/header.css +1 -1
  57. package/nationalarchives/components/header/header.css.map +1 -1
  58. package/nationalarchives/components/header/header.js +1 -1
  59. package/nationalarchives/components/header/header.js.map +1 -1
  60. package/nationalarchives/components/header/header.mjs +32 -41
  61. package/nationalarchives/components/header/header.scss +3 -2
  62. package/nationalarchives/components/header/macro-options.json +6 -0
  63. package/nationalarchives/components/header/template.njk +6 -6
  64. package/nationalarchives/components/hero/hero.css +1 -1
  65. package/nationalarchives/components/hero/hero.css.map +1 -1
  66. package/nationalarchives/components/hero/hero.scss +1 -1
  67. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  68. package/nationalarchives/components/message/message.css +1 -1
  69. package/nationalarchives/components/message/message.css.map +1 -1
  70. package/nationalarchives/components/message/message.scss +2 -3
  71. package/nationalarchives/components/pagination/fixtures.json +1 -1
  72. package/nationalarchives/components/pagination/macro-options.json +6 -0
  73. package/nationalarchives/components/pagination/pagination.stories.js +44 -0
  74. package/nationalarchives/components/pagination/template.njk +4 -1
  75. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  76. package/nationalarchives/components/picture/analytics.js +5 -9
  77. package/nationalarchives/components/picture/picture.css.map +1 -1
  78. package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -1
  79. package/nationalarchives/components/radios/radios.css.map +1 -1
  80. package/nationalarchives/components/search-field/search-field.css.map +1 -1
  81. package/nationalarchives/components/search-filters/search-filters.css.map +1 -1
  82. package/nationalarchives/components/select/select.css.map +1 -1
  83. package/nationalarchives/components/skip-link/skip-link.css +1 -1
  84. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  85. package/nationalarchives/components/skip-link/skip-link.scss +1 -1
  86. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  87. package/nationalarchives/components/text-input/text-input.css.map +1 -1
  88. package/nationalarchives/components/textarea/textarea.css.map +1 -1
  89. package/nationalarchives/global-header-package.css +1 -1
  90. package/nationalarchives/global-header-package.css.map +1 -1
  91. package/nationalarchives/global-header-package.scss +4 -6
  92. package/nationalarchives/lib/analytics-helpers.mjs +13 -8
  93. package/nationalarchives/prototype-kit.css +1 -1
  94. package/nationalarchives/prototype-kit.css.map +1 -1
  95. package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +21 -16
  96. package/nationalarchives/stories/utilities/tables/tables.stories.js +30 -28
  97. package/nationalarchives/tools/_a11y.scss +11 -2
  98. package/nationalarchives/tools/_colour.scss +24 -0
  99. package/nationalarchives/utilities/_a11y.scss +4 -0
  100. package/nationalarchives/utilities/_forms.scss +1 -1
  101. package/nationalarchives/utilities/_global.scss +3 -1
  102. package/nationalarchives/utilities/_reset.scss +5 -2
  103. package/nationalarchives/utilities/_tables.scss +23 -6
  104. package/nationalarchives/utilities/_typography.scss +3 -21
  105. package/nationalarchives/variables/_a11y.scss +2 -0
  106. package/nationalarchives/variables/_index.scss +1 -0
  107. package/package.json +1 -1
@@ -652,7 +652,7 @@ const Template = ({ theme, accent }) => {
652
652
  title: "My dogs 1",
653
653
  headingLevel: 3,
654
654
  headingHref: "#",
655
- items: Array(6)
655
+ items: Array(4)
656
656
  .fill({
657
657
  ...{
658
658
  href: "#",
@@ -736,7 +736,7 @@ const Template = ({ theme, accent }) => {
736
736
  title: "My dogs 2",
737
737
  headingLevel: 3,
738
738
  headingHref: "#",
739
- items: Array(6)
739
+ items: Array(4)
740
740
  .fill({
741
741
  ...{
742
742
  href: "#",
@@ -820,7 +820,7 @@ const Template = ({ theme, accent }) => {
820
820
  title: "My dogs 3",
821
821
  headingLevel: 3,
822
822
  headingHref: "#",
823
- items: Array(6)
823
+ items: Array(4)
824
824
  .fill({
825
825
  ...{
826
826
  href: "#",
@@ -904,7 +904,7 @@ const Template = ({ theme, accent }) => {
904
904
  title: "My dogs 4",
905
905
  headingLevel: 3,
906
906
  headingHref: "#",
907
- items: Array(6)
907
+ items: Array(4)
908
908
  .fill({
909
909
  ...{
910
910
  href: "#",
@@ -988,7 +988,7 @@ const Template = ({ theme, accent }) => {
988
988
  title: "My dogs 5",
989
989
  headingLevel: 3,
990
990
  headingHref: "#",
991
- items: Array(6)
991
+ items: Array(4)
992
992
  .fill({
993
993
  ...{
994
994
  href: "#",
@@ -1098,6 +1098,7 @@ const Template = ({ theme, accent }) => {
1098
1098
  href: "#email",
1099
1099
  },
1100
1100
  ],
1101
+ disableAutoFocus: true,
1101
1102
  },
1102
1103
  })}
1103
1104
  ${TextInput({
@@ -1216,37 +1217,32 @@ const Template = ({ theme, accent }) => {
1216
1217
  </main>
1217
1218
  ${Footer({
1218
1219
  params: {
1219
- meta: "<p>Open today<br>09:00&mdash;19:00</p>",
1220
+ meta: "<p>Open today<br>09:00&ndash;19:00</p>",
1220
1221
  social: [
1221
1222
  {
1222
1223
  href: "https://twitter.com/UKNatArchives",
1223
1224
  icon: "twitter",
1224
- title: "Visit us on Twitter",
1225
+ title: "The National Archives X feed (formally known as Twitter)",
1225
1226
  },
1226
1227
  {
1227
1228
  href: "https://www.youtube.com/c/TheNationalArchivesUK",
1228
1229
  icon: "youtube",
1229
- title: "Watch us on YouTube",
1230
+ title: "The National Archives YouTube channel",
1230
1231
  },
1231
1232
  {
1232
1233
  href: "https://www.facebook.com/TheNationalArchives",
1233
1234
  icon: "facebook",
1234
- title: "See us on Facebook",
1235
+ title: "The National Archives Facebook page",
1235
1236
  },
1236
1237
  {
1237
1238
  href: "https://www.flickr.com/photos/nationalarchives",
1238
1239
  icon: "flickr",
1239
- title: "See our Flickr feed",
1240
+ title: "The National Archives Flickr feed",
1240
1241
  },
1241
1242
  {
1242
1243
  href: "https://www.instagram.com/nationalarchivesuk/",
1243
1244
  icon: "instagram",
1244
- title: "See us on Instagram",
1245
- },
1246
- {
1247
- href: "https://www.nationalarchives.gov.uk/rss/",
1248
- icon: "rss",
1249
- title: "Read our RSS feed",
1245
+ title: "The National Archives Instagram feed",
1250
1246
  },
1251
1247
  ],
1252
1248
  navigation: [
@@ -1367,18 +1363,27 @@ Light.args = {
1367
1363
  };
1368
1364
 
1369
1365
  export const Dark = Template.bind({});
1366
+ Dark.parameters = {
1367
+ chromatic: { disableSnapshot: true },
1368
+ };
1370
1369
  Dark.args = {
1371
1370
  theme: "dark",
1372
1371
  accent: "pink",
1373
1372
  };
1374
1373
 
1375
1374
  export const LightHighContrast = Template.bind({});
1375
+ LightHighContrast.parameters = {
1376
+ chromatic: { disableSnapshot: true },
1377
+ };
1376
1378
  LightHighContrast.args = {
1377
1379
  theme: "light high-contrast",
1378
1380
  accent: "pink",
1379
1381
  };
1380
1382
 
1381
1383
  export const DarkHighContrast = Template.bind({});
1384
+ DarkHighContrast.parameters = {
1385
+ chromatic: { disableSnapshot: true },
1386
+ };
1382
1387
  DarkHighContrast.args = {
1383
1388
  theme: "dark high-contrast",
1384
1389
  accent: "pink",
@@ -4,42 +4,44 @@ export default {
4
4
 
5
5
  const TableTemplate = () =>
6
6
  `<table class="tna-table">
7
- <caption class="tna-table__caption tna-heading-m tna-visually-hidden">Primary options</caption>
7
+ <caption class="tna-table__caption">
8
+ Records added and removed between 2020 and 2022
9
+ </caption>
8
10
  <thead class="tna-table__head">
9
11
  <tr class="tna-table__row">
10
- <th class="tna-table__header" scope="col">Name</th>
11
- <th class="tna-table__header" scope="col">Type</th>
12
- <th class="tna-table__header" scope="col">Description</th>
12
+ <th class="tna-table__header" scope="col">Year</th>
13
+ <th class="tna-table__header" scope="col">Chinese zodiac sign</th>
14
+ <th class="tna-table__header tna-table__header--numeric" scope="col">Records added</th>
15
+ <th class="tna-table__header tna-table__header--numeric" scope="col">Size (megabytes)</th>
13
16
  </tr>
14
17
  </thead>
15
18
  <tbody class="tna-table__body">
16
- <tr class="tna-table__row">
17
- <th class="tna-table__header" scope="row">items</th>
18
- <td class="tna-table__cell">array</td>
19
- <td class="tna-table__cell">
20
- <p><strong>Required.</strong></p>
21
- <p>See items.</p>
22
- </td>
23
- </tr>
24
- <tr class="tna-table__row">
25
- <th class="tna-table__header" scope="row">noCollapse</th>
26
- <td class="tna-table__cell">string</td>
27
- <td class="tna-table__cell"></td>
19
+ <tr>
20
+ <th class="tna-table__header" scope="row">2020</th>
21
+ <td class="tna-table__cell">Rat</td>
22
+ <td class="tna-table__cell tna-table__cell--numeric">123,456</td>
23
+ <td class="tna-table__cell tna-table__cell--numeric">789</td>
28
24
  </tr>
29
- <tr class="tna-table__row">
30
- <th class="tna-table__header" scope="row">classes</th>
31
- <td class="tna-table__cell">string</td>
32
- <td class="tna-table__cell">
33
- <p>Classes to add to the breadcrumbs.</p>
34
- </td>
25
+ <tr>
26
+ <th class="tna-table__header" scope="row">2021</th>
27
+ <td class="tna-table__cell">Ox</td>
28
+ <td class="tna-table__cell tna-table__cell--numeric">456,789</td>
29
+ <td class="tna-table__cell tna-table__cell--numeric">123</td>
35
30
  </tr>
36
- <tr class="tna-table__row">
37
- <th class="tna-table__header" scope="row">attributes</th>
38
- <td class="tna-table__cell">object</td>
39
- <td class="tna-table__cell">
40
- <p>HTML attributes (for example data attributes) to add to the breadcrumbs.</p>
41
- </td>
31
+ <tr>
32
+ <th class="tna-table__header" scope="row">2022</th>
33
+ <td class="tna-table__cell">Tiger</td>
34
+ <td class="tna-table__cell tna-table__cell--numeric">42,424</td>
35
+ <td class="tna-table__cell tna-table__cell--numeric">1,337</td>
42
36
  </tr>
43
37
  </tbody>
38
+ <tfoot class="tna-table__foot">
39
+ <tr>
40
+ <th class="tna-table__header" scope="row">Totals</th>
41
+ <td class="tna-table__cell"></td>
42
+ <td class="tna-table__cell tna-table__cell--numeric">622,669</td>
43
+ <td class="tna-table__cell tna-table__cell--numeric">2,249</td>
44
+ </tr>
45
+ </tfoot>
44
46
  </table>`;
45
47
  export const Table = TableTemplate.bind({});
@@ -1,6 +1,15 @@
1
+ @use "../variables/a11y";
1
2
  @use "colour";
2
3
 
3
4
  @mixin focus-outline {
4
- @include colour.colour-outline("focus-outline", 5px, solid);
5
- outline-offset: 2px;
5
+ @include colour.colour-outline(
6
+ "focus-outline",
7
+ a11y.$focus-outline-width,
8
+ solid
9
+ );
10
+ outline-offset: a11y.$focus-outline-offset;
11
+ }
12
+
13
+ @mixin active-outline {
14
+ outline-offset: a11y.$focus-outline-offset * 2;
6
15
  }
@@ -97,6 +97,10 @@
97
97
  background-color: var(--#{$colour}) if($important, !important, null);
98
98
  }
99
99
 
100
+ @mixin colour-background-brand($brandColour, $important: false) {
101
+ background-color: #{brand-colour($brandColour)} if($important, !important, null);
102
+ }
103
+
100
104
  @mixin colour-border(
101
105
  $colour,
102
106
  $width: "",
@@ -159,6 +163,26 @@
159
163
  fill: var(--#{$colour}) if($important, !important, null);
160
164
  }
161
165
 
166
+ @mixin thick-keyline($direction) {
167
+ @include colour-border("keyline", 5px, solid, $direction);
168
+ }
169
+
170
+ @mixin thick-keyline-dark($direction) {
171
+ @include colour-border("keyline-dark", 5px, solid, $direction);
172
+ }
173
+
174
+ @mixin thick-keyline-accent($direction) {
175
+ @include colour-border("accent-background", 5px, solid, $direction);
176
+ }
177
+
178
+ @mixin thick-keyline-error($direction) {
179
+ @include colour-border("form-error", 5px, solid, $direction);
180
+ }
181
+
182
+ @mixin thick-keyline-brand($direction, $brandColour) {
183
+ border-#{$direction}: 5px #{brand-colour($brandColour)} solid;
184
+ }
185
+
162
186
  %light {
163
187
  @include colour-css-vars("form-error");
164
188
 
@@ -32,6 +32,10 @@
32
32
  @include a11y.focus-outline;
33
33
  }
34
34
 
35
+ *:active {
36
+ @include a11y.active-outline;
37
+ }
38
+
35
39
  .tna-\!--no-focus-style {
36
40
  &:focus {
37
41
  outline: none;
@@ -17,7 +17,7 @@ select {
17
17
  &--error {
18
18
  padding-left: 1rem;
19
19
 
20
- @include colour.colour-border("form-error", 0.25rem, solid, left);
20
+ @include colour.thick-keyline-error(left);
21
21
  }
22
22
  }
23
23
 
@@ -19,7 +19,9 @@
19
19
  margin: 0;
20
20
  padding: 0;
21
21
 
22
- &:has(.tna-header):has(#main-content[role="main"]):has(.tna-footer) {
22
+ &:has(:is(.tna-global-header, .tna-header)):has(
23
+ #main-content[role="main"]
24
+ ):has(.tna-footer) {
23
25
  display: flex;
24
26
  flex-direction: column;
25
27
 
@@ -1,5 +1,10 @@
1
1
  @use "../tools/colour";
2
2
 
3
+ * {
4
+ margin: 0;
5
+ padding: 0;
6
+ }
7
+
3
8
  img,
4
9
  svg,
5
10
  picture,
@@ -21,8 +26,6 @@ canvas {
21
26
  }
22
27
 
23
28
  hr {
24
- margin: 0;
25
-
26
29
  border-width: 1px 0 0;
27
30
  @include colour.colour-border("keyline");
28
31
  border-style: solid;
@@ -4,7 +4,6 @@
4
4
  @use "../tools/media";
5
5
  @use "../tools/spacing";
6
6
  @use "../tools/typography";
7
- @use "../variables/assets";
8
7
  @use "../variables/grid";
9
8
 
10
9
  .tna-table {
@@ -20,23 +19,32 @@
20
19
  }
21
20
 
22
21
  &__caption {
23
- text-align: left;
22
+ padding: 1rem 0;
24
23
 
25
- @include typography.main-font-weight-bold;
24
+ caption-side: bottom;
25
+
26
+ @include typography.relative-font-size(16);
26
27
  }
27
28
 
28
29
  &__head {
30
+ vertical-align: bottom;
29
31
  }
30
32
 
31
- &__header {
33
+ &__body {
34
+ vertical-align: top;
32
35
  }
33
36
 
34
- &__body {
37
+ &__foot {
38
+ @include typography.main-font-weight-bold;
39
+ vertical-align: top;
35
40
  }
36
41
 
37
42
  &__row {
38
43
  }
39
44
 
45
+ &__header {
46
+ }
47
+
40
48
  &__cell {
41
49
  }
42
50
 
@@ -53,10 +61,19 @@
53
61
  &:last-child {
54
62
  padding-right: 0;
55
63
  }
64
+
65
+ &--numeric {
66
+ text-align: right;
67
+ }
56
68
  }
57
69
 
58
70
  &__head &__header {
59
- @include colour.colour-border("keyline-dark", 0.25rem, solid, bottom);
71
+ @include colour.colour-border("keyline-dark", 4px, solid, bottom);
72
+ }
73
+
74
+ &__foot &__header,
75
+ &__foot &__cell {
76
+ @include colour.colour-border("keyline-dark", 4px, solid, top);
60
77
  }
61
78
 
62
79
  p {
@@ -68,11 +68,6 @@
68
68
  }
69
69
  }
70
70
 
71
- * {
72
- margin: 0;
73
- padding: 0;
74
- }
75
-
76
71
  strong {
77
72
  @include typography.main-font-weight-bold;
78
73
  }
@@ -80,16 +75,9 @@ strong {
80
75
  p {
81
76
  @include spacing.space-above;
82
77
 
83
- + p/*,
84
- + .tna-ul,
85
- + .tna-ol,
86
- + .tna-blockquote*/ {
78
+ + p {
87
79
  margin-top: 1rem;
88
80
  }
89
-
90
- // + :is(p, .tna-ul, .tna-ol, .tna-blockquote) {
91
- // margin-top: 1rem;
92
- // }
93
81
  }
94
82
 
95
83
  a {
@@ -116,12 +104,6 @@ a {
116
104
  @include colour.colour-font("link");
117
105
  }
118
106
  }
119
-
120
- // &[target="_blank"]:not([title*="opens in a new"]) {
121
- // &::after {
122
- // content: "" / " (opens in a new window)"
123
- // }
124
- // }
125
107
  }
126
108
 
127
109
  small {
@@ -154,7 +136,7 @@ small {
154
136
  %chip-accent {
155
137
  @include colour.accent;
156
138
 
157
- @include colour.colour-border("accent-background", 0.125rem);
139
+ @include colour.colour-border("accent-background", 2px);
158
140
 
159
141
  .tna-background-accent & {
160
142
  @include colour.contrast;
@@ -381,7 +363,7 @@ small {
381
363
  margin-left: 0;
382
364
  padding: 1rem 1rem 1rem 2rem;
383
365
 
384
- @include colour.colour-border("accent-background", 0.375rem, solid, left);
366
+ @include colour.thick-keyline-accent(left);
385
367
 
386
368
  &__quote {
387
369
  font-weight: 700;
@@ -0,0 +1,2 @@
1
+ $focus-outline-width: 5px !default;
2
+ $focus-outline-offset: 2px !default;
@@ -1,3 +1,4 @@
1
+ @use "a11y";
1
2
  @use "assets";
2
3
  @use "colour";
3
4
  @use "features";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nationalarchives/frontend",
3
- "version": "0.1.42",
3
+ "version": "0.1.43",
4
4
  "description": "The National Archives frontend styles",
5
5
  "scripts": {
6
6
  "start": "storybook dev -p 6006",