@nationalarchives/frontend 0.1.41 → 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 (214) 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/all.mjs +18 -0
  6. package/nationalarchives/analytics.js +2 -0
  7. package/nationalarchives/analytics.js.map +1 -0
  8. package/nationalarchives/analytics.mjs +281 -0
  9. package/nationalarchives/components/_index.scss +3 -1
  10. package/nationalarchives/components/breadcrumbs/analytics.js +17 -0
  11. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  12. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +3 -1
  13. package/nationalarchives/components/breadcrumbs/fixtures.json +69 -6
  14. package/nationalarchives/components/breadcrumbs/macro-options.json +12 -6
  15. package/nationalarchives/components/breadcrumbs/template.njk +12 -4
  16. package/nationalarchives/components/button/_index.scss +1 -0
  17. package/nationalarchives/components/button/button-group.stories.js +122 -0
  18. package/nationalarchives/components/button/button.css +1 -1
  19. package/nationalarchives/components/button/button.css.map +1 -1
  20. package/nationalarchives/components/button/button.scss +5 -8
  21. package/nationalarchives/components/button/button.stories.js +36 -38
  22. package/nationalarchives/components/button/fixtures.json +5 -10
  23. package/nationalarchives/components/button/template.njk +11 -10
  24. package/nationalarchives/components/card/card.css +1 -1
  25. package/nationalarchives/components/card/card.css.map +1 -1
  26. package/nationalarchives/components/card/card.scss +6 -0
  27. package/nationalarchives/components/card/card.stories.js +11 -0
  28. package/nationalarchives/components/card/fixtures.json +17 -34
  29. package/nationalarchives/components/checkboxes/analytics.js +25 -0
  30. package/nationalarchives/components/checkboxes/checkboxes.css +1 -1
  31. package/nationalarchives/components/checkboxes/checkboxes.css.map +1 -1
  32. package/nationalarchives/components/checkboxes/checkboxes.njk +12 -0
  33. package/nationalarchives/components/checkboxes/checkboxes.scss +1 -0
  34. package/nationalarchives/components/checkboxes/fixtures.json +6 -12
  35. package/nationalarchives/components/checkboxes/template.njk +10 -7
  36. package/nationalarchives/components/compound-filters/compound-filters.css +1 -1
  37. package/nationalarchives/components/compound-filters/compound-filters.css.map +1 -1
  38. package/nationalarchives/components/compound-filters/compound-filters.scss +2 -0
  39. package/nationalarchives/components/compound-filters/fixtures.json +1 -2
  40. package/nationalarchives/components/compound-filters/template.njk +1 -1
  41. package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
  42. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  43. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  44. package/nationalarchives/components/cookie-banner/fixtures.json +10 -20
  45. package/nationalarchives/components/date-input/date-input.css +1 -1
  46. package/nationalarchives/components/date-input/date-input.css.map +1 -1
  47. package/nationalarchives/components/date-input/fixtures.json +5 -10
  48. package/nationalarchives/components/date-input/template.njk +9 -9
  49. package/nationalarchives/components/date-search/date-search.css +1 -1
  50. package/nationalarchives/components/date-search/date-search.css.map +1 -1
  51. package/nationalarchives/components/date-search/date-search.njk +7 -0
  52. package/nationalarchives/components/date-search/fixtures.json +6 -12
  53. package/nationalarchives/components/date-search/template.njk +6 -7
  54. package/nationalarchives/components/error-summary/_index.scss +1 -0
  55. package/nationalarchives/components/error-summary/error-summary.css +1 -0
  56. package/nationalarchives/components/error-summary/error-summary.css.map +1 -0
  57. package/nationalarchives/components/error-summary/error-summary.js +2 -0
  58. package/nationalarchives/components/error-summary/error-summary.js.map +1 -0
  59. package/nationalarchives/components/error-summary/error-summary.mjs +51 -0
  60. package/nationalarchives/components/error-summary/error-summary.scss +39 -0
  61. package/nationalarchives/components/error-summary/error-summary.stories.js +59 -0
  62. package/nationalarchives/components/error-summary/fixtures.json +24 -0
  63. package/nationalarchives/components/error-summary/macro-options.json +52 -0
  64. package/nationalarchives/components/error-summary/macro.njk +3 -0
  65. package/nationalarchives/components/error-summary/template.njk +15 -0
  66. package/nationalarchives/components/featured-records/featured-records.css +1 -1
  67. package/nationalarchives/components/featured-records/featured-records.css.map +1 -1
  68. package/nationalarchives/components/featured-records/featured-records.scss +1 -1
  69. package/nationalarchives/components/featured-records/fixtures.json +2 -4
  70. package/nationalarchives/components/footer/analytics.js +97 -0
  71. package/nationalarchives/components/footer/fixtures.json +8 -15
  72. package/nationalarchives/components/footer/footer.css +1 -1
  73. package/nationalarchives/components/footer/footer.css.map +1 -1
  74. package/nationalarchives/components/footer/footer.scss +4 -2
  75. package/nationalarchives/components/footer/footer.stories.js +5 -11
  76. package/nationalarchives/components/footer/template.njk +13 -10
  77. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  78. package/nationalarchives/components/global-header/analytics.js +57 -0
  79. package/nationalarchives/components/global-header/fixtures.json +1 -2
  80. package/nationalarchives/components/global-header/global-header.css +1 -1
  81. package/nationalarchives/components/global-header/global-header.css.map +1 -1
  82. package/nationalarchives/components/global-header/global-header.js +1 -1
  83. package/nationalarchives/components/global-header/global-header.js.map +1 -1
  84. package/nationalarchives/components/global-header/global-header.mjs +40 -79
  85. package/nationalarchives/components/global-header/global-header.scss +9 -6
  86. package/nationalarchives/components/global-header/global-header.stories.js +32 -20
  87. package/nationalarchives/components/global-header/macro-options.json +12 -0
  88. package/nationalarchives/components/global-header/template.njk +7 -7
  89. package/nationalarchives/components/grid/fixtures.json +13 -26
  90. package/nationalarchives/components/grid/grid.css +1 -1
  91. package/nationalarchives/components/grid/grid.css.map +1 -1
  92. package/nationalarchives/components/grid/grid.scss +0 -1
  93. package/nationalarchives/components/header/analytics.js +18 -0
  94. package/nationalarchives/components/header/fixtures.json +1 -2
  95. package/nationalarchives/components/header/header.css +1 -1
  96. package/nationalarchives/components/header/header.css.map +1 -1
  97. package/nationalarchives/components/header/header.js +1 -1
  98. package/nationalarchives/components/header/header.js.map +1 -1
  99. package/nationalarchives/components/header/header.mjs +32 -41
  100. package/nationalarchives/components/header/header.scss +3 -2
  101. package/nationalarchives/components/header/macro-options.json +6 -0
  102. package/nationalarchives/components/header/template.njk +6 -6
  103. package/nationalarchives/components/hero/analytics.js +26 -0
  104. package/nationalarchives/components/hero/fixtures.json +12 -24
  105. package/nationalarchives/components/hero/hero.css +1 -1
  106. package/nationalarchives/components/hero/hero.css.map +1 -1
  107. package/nationalarchives/components/hero/hero.scss +1 -1
  108. package/nationalarchives/components/index-grid/fixtures.json +8 -16
  109. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  110. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  111. package/nationalarchives/components/message/fixtures.json +1 -2
  112. package/nationalarchives/components/message/message.css +1 -1
  113. package/nationalarchives/components/message/message.css.map +1 -1
  114. package/nationalarchives/components/message/message.scss +2 -3
  115. package/nationalarchives/components/message/phase-banner.stories.js +1 -1
  116. package/nationalarchives/components/pagination/fixtures.json +1 -2
  117. package/nationalarchives/components/pagination/macro-options.json +6 -0
  118. package/nationalarchives/components/pagination/pagination.stories.js +44 -0
  119. package/nationalarchives/components/pagination/template.njk +4 -1
  120. package/nationalarchives/components/phase-banner/fixtures.json +4 -8
  121. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  122. package/nationalarchives/components/picture/analytics.js +30 -0
  123. package/nationalarchives/components/picture/fixtures.json +5 -10
  124. package/nationalarchives/components/picture/picture.css.map +1 -1
  125. package/nationalarchives/components/quick-filters/_index.scss +1 -0
  126. package/nationalarchives/components/quick-filters/fixtures.json +51 -0
  127. package/nationalarchives/components/{filters → quick-filters}/macro-options.json +2 -2
  128. package/nationalarchives/components/quick-filters/macro.njk +3 -0
  129. package/nationalarchives/components/quick-filters/quick-filters.css +1 -0
  130. package/nationalarchives/components/quick-filters/quick-filters.css.map +1 -0
  131. package/nationalarchives/components/{filters/filters.scss → quick-filters/quick-filters.scss} +10 -8
  132. package/nationalarchives/components/{filters/filters.stories.js → quick-filters/quick-filters.stories.js} +2 -2
  133. package/nationalarchives/components/quick-filters/template.njk +8 -0
  134. package/nationalarchives/components/radios/analytics.js +25 -0
  135. package/nationalarchives/components/radios/fixtures.json +6 -12
  136. package/nationalarchives/components/radios/radios.css +1 -1
  137. package/nationalarchives/components/radios/radios.css.map +1 -1
  138. package/nationalarchives/components/radios/radios.njk +12 -0
  139. package/nationalarchives/components/radios/template.njk +6 -13
  140. package/nationalarchives/components/search-field/analytics.js +22 -0
  141. package/nationalarchives/components/search-field/fixtures.json +3 -6
  142. package/nationalarchives/components/search-field/search-field.css +1 -1
  143. package/nationalarchives/components/search-field/search-field.css.map +1 -1
  144. package/nationalarchives/components/search-field/search-field.scss +7 -2
  145. package/nationalarchives/components/search-field/template.njk +4 -4
  146. package/nationalarchives/components/search-filters/_index.scss +1 -0
  147. package/nationalarchives/components/search-filters/fixtures.json +16 -0
  148. package/nationalarchives/components/search-filters/macro-options.json +39 -0
  149. package/nationalarchives/components/search-filters/macro.njk +3 -0
  150. package/nationalarchives/components/search-filters/search-filters.css +1 -0
  151. package/nationalarchives/components/search-filters/search-filters.css.map +1 -0
  152. package/nationalarchives/components/search-filters/search-filters.js +2 -0
  153. package/nationalarchives/components/search-filters/search-filters.js.map +1 -0
  154. package/nationalarchives/components/search-filters/search-filters.mjs +67 -0
  155. package/nationalarchives/components/search-filters/search-filters.scss +163 -0
  156. package/nationalarchives/components/search-filters/search-filters.stories.js +207 -0
  157. package/nationalarchives/components/search-filters/template.njk +107 -0
  158. package/nationalarchives/components/select/fixtures.json +6 -12
  159. package/nationalarchives/components/select/select.css +1 -1
  160. package/nationalarchives/components/select/select.css.map +1 -1
  161. package/nationalarchives/components/select/select.scss +1 -1
  162. package/nationalarchives/components/select/template.njk +4 -4
  163. package/nationalarchives/components/sensitive-image/fixtures.json +3 -6
  164. package/nationalarchives/components/skip-link/fixtures.json +1 -2
  165. package/nationalarchives/components/skip-link/skip-link.css +1 -1
  166. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  167. package/nationalarchives/components/skip-link/skip-link.scss +1 -1
  168. package/nationalarchives/components/tabs/fixtures.json +1 -2
  169. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  170. package/nationalarchives/components/text-input/analytics.js +23 -0
  171. package/nationalarchives/components/text-input/fixtures.json +6 -12
  172. package/nationalarchives/components/text-input/template.njk +6 -10
  173. package/nationalarchives/components/text-input/text-input.css +1 -1
  174. package/nationalarchives/components/text-input/text-input.css.map +1 -1
  175. package/nationalarchives/components/text-input/text-input.njk +10 -0
  176. package/nationalarchives/components/text-input/text-input.scss +1 -1
  177. package/nationalarchives/components/textarea/analytics.js +23 -0
  178. package/nationalarchives/components/textarea/fixtures.json +6 -12
  179. package/nationalarchives/components/textarea/template.njk +5 -5
  180. package/nationalarchives/components/textarea/textarea.css +1 -1
  181. package/nationalarchives/components/textarea/textarea.css.map +1 -1
  182. package/nationalarchives/components/textarea/textarea.scss +1 -1
  183. package/nationalarchives/global-header-package.css +1 -1
  184. package/nationalarchives/global-header-package.css.map +1 -1
  185. package/nationalarchives/global-header-package.scss +4 -6
  186. package/nationalarchives/lib/analytics-helpers.mjs +68 -0
  187. package/nationalarchives/lib/cookies.mjs +59 -35
  188. package/nationalarchives/prototype-kit.css +1 -1
  189. package/nationalarchives/prototype-kit.css.map +1 -1
  190. package/nationalarchives/stories/utilities/colour-schemes/colour-themes.stories.js +49 -22
  191. package/nationalarchives/stories/utilities/forms/forms.mdx +6 -6
  192. package/nationalarchives/stories/utilities/tables/tables.stories.js +30 -28
  193. package/nationalarchives/tests/analytics.test.js +11 -0
  194. package/nationalarchives/tests/cookies.test.js +21 -0
  195. package/nationalarchives/tests/uuid.test.js +0 -6
  196. package/nationalarchives/tools/_a11y.scss +11 -2
  197. package/nationalarchives/tools/_colour.scss +47 -14
  198. package/nationalarchives/utilities/_a11y.scss +4 -0
  199. package/nationalarchives/utilities/_forms.scss +7 -1
  200. package/nationalarchives/utilities/_global.scss +3 -1
  201. package/nationalarchives/utilities/_reset.scss +5 -2
  202. package/nationalarchives/utilities/_tables.scss +23 -6
  203. package/nationalarchives/utilities/_typography.scss +5 -21
  204. package/nationalarchives/variables/_a11y.scss +2 -0
  205. package/nationalarchives/variables/_colour.scss +2 -0
  206. package/nationalarchives/variables/_forms.scss +1 -1
  207. package/nationalarchives/variables/_index.scss +1 -0
  208. package/package.json +2 -2
  209. package/nationalarchives/components/filters/_index.scss +0 -1
  210. package/nationalarchives/components/filters/filters.css +0 -1
  211. package/nationalarchives/components/filters/filters.css.map +0 -1
  212. package/nationalarchives/components/filters/fixtures.json +0 -51
  213. package/nationalarchives/components/filters/macro.njk +0 -3
  214. package/nationalarchives/components/filters/template.njk +0 -8
@@ -3,6 +3,7 @@ import Breadcrumbs from "../../../components/breadcrumbs/template.njk";
3
3
  import Button from "../../../components/button/template.njk";
4
4
  import Card from "../../../components/card/template.njk";
5
5
  import Checkboxes from "../../../components/checkboxes/template.njk";
6
+ import ErrorSummary from "../../../components/error-summary/template.njk";
6
7
  import FeaturedRecords from "../../../components/featured-records/template.njk";
7
8
  import Footer from "../../../components/footer/template.njk";
8
9
  import Gallery from "../../../components/gallery/template.njk";
@@ -651,7 +652,7 @@ const Template = ({ theme, accent }) => {
651
652
  title: "My dogs 1",
652
653
  headingLevel: 3,
653
654
  headingHref: "#",
654
- items: Array(6)
655
+ items: Array(4)
655
656
  .fill({
656
657
  ...{
657
658
  href: "#",
@@ -735,7 +736,7 @@ const Template = ({ theme, accent }) => {
735
736
  title: "My dogs 2",
736
737
  headingLevel: 3,
737
738
  headingHref: "#",
738
- items: Array(6)
739
+ items: Array(4)
739
740
  .fill({
740
741
  ...{
741
742
  href: "#",
@@ -819,7 +820,7 @@ const Template = ({ theme, accent }) => {
819
820
  title: "My dogs 3",
820
821
  headingLevel: 3,
821
822
  headingHref: "#",
822
- items: Array(6)
823
+ items: Array(4)
823
824
  .fill({
824
825
  ...{
825
826
  href: "#",
@@ -903,7 +904,7 @@ const Template = ({ theme, accent }) => {
903
904
  title: "My dogs 4",
904
905
  headingLevel: 3,
905
906
  headingHref: "#",
906
- items: Array(6)
907
+ items: Array(4)
907
908
  .fill({
908
909
  ...{
909
910
  href: "#",
@@ -987,7 +988,7 @@ const Template = ({ theme, accent }) => {
987
988
  title: "My dogs 5",
988
989
  headingLevel: 3,
989
990
  headingHref: "#",
990
- items: Array(6)
991
+ items: Array(4)
991
992
  .fill({
992
993
  ...{
993
994
  href: "#",
@@ -1065,6 +1066,21 @@ const Template = ({ theme, accent }) => {
1065
1066
  </div>
1066
1067
  </div>
1067
1068
  </div>
1069
+ <div class="tna-section tna-background-contrast">
1070
+ <div class="tna-container">
1071
+ <div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny">
1072
+ ${SearchField({
1073
+ params: {
1074
+ label: "Catalogue search results",
1075
+ headingLevel: 3,
1076
+ headingSize: "l",
1077
+ id: "search1",
1078
+ name: "q",
1079
+ },
1080
+ })}
1081
+ </div>
1082
+ </div>
1083
+ </div>
1068
1084
  <div class="tna-section">
1069
1085
  <div class="tna-container">
1070
1086
  <div class="tna-column tna-column--width-2-3 tna-column--full-small tna-column--full-tiny">
@@ -1072,13 +1088,17 @@ const Template = ({ theme, accent }) => {
1072
1088
  <h2 class="tna-heading tna-heading--l">
1073
1089
  Forms
1074
1090
  </h2>
1075
- ${SearchField({
1091
+ ${ErrorSummary({
1076
1092
  params: {
1077
- label: "Catalogue search results",
1078
- headingLevel: 3,
1079
- headingSize: "l",
1080
- id: "search1",
1081
- name: "q",
1093
+ title: "There is a problem",
1094
+ headingLevel: 2,
1095
+ items: [
1096
+ {
1097
+ text: "Enter a valid email address",
1098
+ href: "#email",
1099
+ },
1100
+ ],
1101
+ disableAutoFocus: true,
1082
1102
  },
1083
1103
  })}
1084
1104
  ${TextInput({
@@ -1099,6 +1119,9 @@ const Template = ({ theme, accent }) => {
1099
1119
  id: "email",
1100
1120
  name: "email",
1101
1121
  autofill: "email",
1122
+ error: {
1123
+ text: "Enter a valid email address",
1124
+ },
1102
1125
  },
1103
1126
  })}
1104
1127
  ${Select({
@@ -1194,37 +1217,32 @@ const Template = ({ theme, accent }) => {
1194
1217
  </main>
1195
1218
  ${Footer({
1196
1219
  params: {
1197
- meta: "<p>Open today<br>09:00&mdash;19:00</p>",
1220
+ meta: "<p>Open today<br>09:00&ndash;19:00</p>",
1198
1221
  social: [
1199
1222
  {
1200
1223
  href: "https://twitter.com/UKNatArchives",
1201
1224
  icon: "twitter",
1202
- title: "Visit us on Twitter",
1225
+ title: "The National Archives X feed (formally known as Twitter)",
1203
1226
  },
1204
1227
  {
1205
1228
  href: "https://www.youtube.com/c/TheNationalArchivesUK",
1206
1229
  icon: "youtube",
1207
- title: "Watch us on YouTube",
1230
+ title: "The National Archives YouTube channel",
1208
1231
  },
1209
1232
  {
1210
1233
  href: "https://www.facebook.com/TheNationalArchives",
1211
1234
  icon: "facebook",
1212
- title: "See us on Facebook",
1235
+ title: "The National Archives Facebook page",
1213
1236
  },
1214
1237
  {
1215
1238
  href: "https://www.flickr.com/photos/nationalarchives",
1216
1239
  icon: "flickr",
1217
- title: "See our Flickr feed",
1240
+ title: "The National Archives Flickr feed",
1218
1241
  },
1219
1242
  {
1220
1243
  href: "https://www.instagram.com/nationalarchivesuk/",
1221
1244
  icon: "instagram",
1222
- title: "See us on Instagram",
1223
- },
1224
- {
1225
- href: "https://www.nationalarchives.gov.uk/rss/",
1226
- icon: "rss",
1227
- title: "Read our RSS feed",
1245
+ title: "The National Archives Instagram feed",
1228
1246
  },
1229
1247
  ],
1230
1248
  navigation: [
@@ -1345,18 +1363,27 @@ Light.args = {
1345
1363
  };
1346
1364
 
1347
1365
  export const Dark = Template.bind({});
1366
+ Dark.parameters = {
1367
+ chromatic: { disableSnapshot: true },
1368
+ };
1348
1369
  Dark.args = {
1349
1370
  theme: "dark",
1350
1371
  accent: "pink",
1351
1372
  };
1352
1373
 
1353
1374
  export const LightHighContrast = Template.bind({});
1375
+ LightHighContrast.parameters = {
1376
+ chromatic: { disableSnapshot: true },
1377
+ };
1354
1378
  LightHighContrast.args = {
1355
1379
  theme: "light high-contrast",
1356
1380
  accent: "pink",
1357
1381
  };
1358
1382
 
1359
1383
  export const DarkHighContrast = Template.bind({});
1384
+ DarkHighContrast.parameters = {
1385
+ chromatic: { disableSnapshot: true },
1386
+ };
1360
1387
  DarkHighContrast.args = {
1361
1388
  theme: "dark high-contrast",
1362
1389
  accent: "pink",
@@ -43,26 +43,26 @@ import * as SearchFieldStories from "../../../components/search-field/search-fie
43
43
  <div class="tna-form__group-contents">
44
44
 
45
45
  <h4 class="tna-form__heading tna-form__heading--m">
46
- <label class="tna-form__label" for="tna-form__ELEMENT-ID">
46
+ <label class="tna-form__label" for="ELEMENT-ID">
47
47
  <!-- Field title -->
48
48
  </label>
49
49
  </h4>
50
50
 
51
51
  <!-- Optional hint
52
- <p id="tna-form__ELEMENT-ID-hint" class="tna-form__hint">
52
+ <p id="ELEMENT-ID-hint" class="tna-form__hint">
53
53
  [Hint text]
54
54
  </p>
55
55
  -->
56
56
 
57
57
  <!-- Optional error
58
- <p id="tna-form__ELEMENT-ID-error" class="tna-form__error-message">
58
+ <p id="ELEMENT-ID-error" class="tna-form__error-message">
59
59
  <span class="tna-!--visually-hidden">Error:</span> [Error text]
60
60
  </p>
61
61
  -->
62
62
 
63
63
  </div>
64
64
 
65
- <!-- Field id="tna-form__ELEMENT-ID"
65
+ <!-- Field id="ELEMENT-ID"
66
66
  If hint:
67
67
  aria-describedby="tna-form__ELEMENT-ID-hint"
68
68
  If error:
@@ -97,13 +97,13 @@ import * as SearchFieldStories from "../../../components/search-field/search-fie
97
97
  </legend>
98
98
 
99
99
  <!-- Optional hint
100
- <p id="tna-form__ELEMENT-ID-hint" class="tna-form__hint">
100
+ <p id="ELEMENT-ID-hint" class="tna-form__hint">
101
101
  [Hint text]
102
102
  </p>
103
103
  -->
104
104
 
105
105
  <!-- Optional error
106
- <p id="tna-form__ELEMENT-ID-error" class="tna-form__error-message">
106
+ <p id="ELEMENT-ID-error" class="tna-form__error-message">
107
107
  <span class="tna-!--visually-hidden">Error:</span> [Error text]
108
108
  </p>
109
109
  -->
@@ -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({});
@@ -0,0 +1,11 @@
1
+ import { describe, expect, test } from "@jest/globals";
2
+ import { GA4 } from "../analytics.mjs";
3
+
4
+ describe("Analytics", () => {
5
+ test("Initialisation", async () => {
6
+ const id = "example-id";
7
+ const ga4 = new GA4(id);
8
+
9
+ expect(ga4.gTagId).toEqual(id);
10
+ });
11
+ });
@@ -347,6 +347,8 @@ describe("No existing cookies", () => {
347
347
  const testKey = "foo";
348
348
  const testValue = "bar";
349
349
 
350
+ expect(mockCallback.mock.calls).toHaveLength(0);
351
+
350
352
  cookies1.set(testKey, testValue);
351
353
  expect(mockCallback.mock.calls).toHaveLength(1);
352
354
 
@@ -357,6 +359,25 @@ describe("No existing cookies", () => {
357
359
  expect(mockCallback.mock.calls).toHaveLength(3);
358
360
  });
359
361
 
362
+ test("One-time events", async () => {
363
+ const mockCallback = jest.fn();
364
+
365
+ const cookies = new Cookies();
366
+
367
+ cookies.once("setCookie", mockCallback);
368
+
369
+ const testKey = "foo";
370
+ const testValue = "bar";
371
+
372
+ expect(mockCallback.mock.calls).toHaveLength(0);
373
+
374
+ cookies.set(testKey, testValue);
375
+ expect(mockCallback.mock.calls).toHaveLength(1);
376
+
377
+ cookies.set(testKey, testValue);
378
+ expect(mockCallback.mock.calls).toHaveLength(1);
379
+ });
380
+
360
381
  test("Custom policies", async () => {
361
382
  const cookies = new Cookies({ extraPolicies: ["custom"] });
362
383
 
@@ -1,12 +1,6 @@
1
1
  import { describe, expect, test } from "@jest/globals";
2
- import { TextEncoder, TextDecoder, store, options } from "util";
3
2
  import uuidv4 from "../lib/uuid.mjs";
4
3
 
5
- global.TextEncoder = TextEncoder;
6
- global.TextDecoder = TextDecoder;
7
- global.store = store;
8
- global.options = options;
9
-
10
4
  describe("UUID", () => {
11
5
  test("Initialisation", async () => {
12
6
  const uuid1 = uuidv4();
@@ -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", 0.3125rem, solid);
5
- outline-offset: 0.125rem;
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
  }
@@ -1,4 +1,5 @@
1
1
  @use "sass:map";
2
+ @use "sass:list";
2
3
  @use "../variables/colour";
3
4
  @use "../tools/media";
4
5
 
@@ -6,27 +7,35 @@
6
7
  @return colour.brand-colour($colour, $opacity);
7
8
  }
8
9
 
9
- @mixin colour-css-vars() {
10
+ @mixin colour-css-vars($excludes...) {
10
11
  @each $name, $value in colour.$colour-palette-default {
11
- --#{$name}: #{$value};
12
+ @if not list.index($excludes, $name) {
13
+ --#{$name}: #{$value};
14
+ }
12
15
  }
13
16
  }
14
17
 
15
- @mixin colour-css-vars-dark() {
18
+ @mixin colour-css-vars-dark($excludes...) {
16
19
  @each $name, $value in colour.$colour-palette-dark {
17
- --#{$name}: #{$value};
20
+ @if not list.index($excludes, $name) {
21
+ --#{$name}: #{$value};
22
+ }
18
23
  }
19
24
  }
20
25
 
21
- @mixin colour-css-vars-high-contrast() {
26
+ @mixin colour-css-vars-high-contrast($excludes...) {
22
27
  @each $name, $value in colour.$colour-palette-high-contrast {
23
- --#{$name}: #{$value};
28
+ @if not list.index($excludes, $name) {
29
+ --#{$name}: #{$value};
30
+ }
24
31
  }
25
32
  }
26
33
 
27
- @mixin colour-css-vars-high-contrast-dark() {
34
+ @mixin colour-css-vars-high-contrast-dark($excludes...) {
28
35
  @each $name, $value in colour.$colour-palette-high-contrast-dark {
29
- --#{$name}: #{$value};
36
+ @if not list.index($excludes, $name) {
37
+ --#{$name}: #{$value};
38
+ }
30
39
  }
31
40
  }
32
41
 
@@ -88,6 +97,10 @@
88
97
  background-color: var(--#{$colour}) if($important, !important, null);
89
98
  }
90
99
 
100
+ @mixin colour-background-brand($brandColour, $important: false) {
101
+ background-color: #{brand-colour($brandColour)} if($important, !important, null);
102
+ }
103
+
91
104
  @mixin colour-border(
92
105
  $colour,
93
106
  $width: "",
@@ -150,15 +163,35 @@
150
163
  fill: var(--#{$colour}) if($important, !important, null);
151
164
  }
152
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
+
153
186
  %light {
154
- @include colour-css-vars;
187
+ @include colour-css-vars("form-error");
155
188
 
156
189
  @media (prefers-contrast: more) {
157
- @include colour-css-vars-high-contrast;
190
+ @include colour-css-vars-high-contrast("form-error");
158
191
  }
159
192
 
160
193
  .tna-template--high-contrast-theme & {
161
- @include colour-css-vars-high-contrast;
194
+ @include colour-css-vars-high-contrast("form-error");
162
195
  }
163
196
  }
164
197
 
@@ -167,14 +200,14 @@
167
200
  }
168
201
 
169
202
  %dark {
170
- @include colour-css-vars-dark;
203
+ @include colour-css-vars-dark("form-error");
171
204
 
172
205
  @media (prefers-contrast: more) {
173
- @include colour-css-vars-high-contrast-dark;
206
+ @include colour-css-vars-high-contrast-dark("form-error");
174
207
  }
175
208
 
176
209
  .tna-template--high-contrast-theme & {
177
- @include colour-css-vars-high-contrast-dark;
210
+ @include colour-css-vars-high-contrast-dark("form-error");
178
211
  }
179
212
  }
180
213
 
@@ -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;
@@ -4,6 +4,12 @@
4
4
  @use "../tools/spacing";
5
5
  @use "../tools/typography";
6
6
 
7
+ button,
8
+ input,
9
+ select {
10
+ border-radius: 0.1px;
11
+ }
12
+
7
13
  .tna-form {
8
14
  &__group {
9
15
  @include spacing.space-above;
@@ -11,7 +17,7 @@
11
17
  &--error {
12
18
  padding-left: 1rem;
13
19
 
14
- @include colour.colour-border("form-error", 0.25rem, solid, left);
20
+ @include colour.thick-keyline-error(left);
15
21
  }
16
22
  }
17
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 {