@nationalarchives/frontend 0.1.24-prerelease → 0.1.25-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 (97) hide show
  1. package/README.md +22 -0
  2. package/govuk-prototype-kit.config.json +4 -12
  3. package/nationalarchives/all.css +2 -2
  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/components/breadcrumbs/breadcrumbs.css +1 -1
  8. package/nationalarchives/components/breadcrumbs/breadcrumbs.css.map +1 -1
  9. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +1 -1
  10. package/nationalarchives/components/button/button.css +1 -1
  11. package/nationalarchives/components/button/button.css.map +1 -1
  12. package/nationalarchives/components/button/button.scss +8 -8
  13. package/nationalarchives/components/button/template.njk +2 -2
  14. package/nationalarchives/components/card/card.css +1 -1
  15. package/nationalarchives/components/card/card.css.map +1 -1
  16. package/nationalarchives/components/card/card.scss +6 -2
  17. package/nationalarchives/components/card/card.stories.js +6 -78
  18. package/nationalarchives/components/card/fixtures.json +17 -17
  19. package/nationalarchives/components/card/macro-options.json +41 -17
  20. package/nationalarchives/components/card/template.njk +46 -45
  21. package/nationalarchives/components/cookie-banner/cookie-banner.css +1 -1
  22. package/nationalarchives/components/cookie-banner/cookie-banner.css.map +1 -1
  23. package/nationalarchives/components/cookie-banner/cookie-banner.js +1 -1
  24. package/nationalarchives/components/cookie-banner/cookie-banner.js.map +1 -1
  25. package/nationalarchives/components/cookie-banner/cookie-banner.mjs +17 -16
  26. package/nationalarchives/components/cookie-banner/cookie-banner.stories.js +92 -42
  27. package/nationalarchives/components/cookie-banner/fixtures.json +35 -8
  28. package/nationalarchives/components/cookie-banner/macro-options.json +7 -1
  29. package/nationalarchives/components/cookie-banner/template.njk +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/filters/filters.css +1 -1
  33. package/nationalarchives/components/filters/filters.css.map +1 -1
  34. package/nationalarchives/components/filters/filters.scss +6 -6
  35. package/nationalarchives/components/filters/template.njk +1 -1
  36. package/nationalarchives/components/footer/footer.css +1 -1
  37. package/nationalarchives/components/footer/footer.css.map +1 -1
  38. package/nationalarchives/components/footer/footer.stories.js +1 -1
  39. package/nationalarchives/components/footer/template.njk +3 -3
  40. package/nationalarchives/components/gallery/gallery.css +1 -1
  41. package/nationalarchives/components/gallery/gallery.css.map +1 -1
  42. package/nationalarchives/components/gallery/gallery.stories.js +2 -2
  43. package/nationalarchives/components/grid/grid.css +1 -1
  44. package/nationalarchives/components/grid/grid.css.map +1 -1
  45. package/nationalarchives/components/grid/grid.scss +12 -0
  46. package/nationalarchives/components/grid/grid.stories.js +12 -0
  47. package/nationalarchives/components/header/header.css +1 -1
  48. package/nationalarchives/components/header/header.css.map +1 -1
  49. package/nationalarchives/components/header/header.scss +13 -19
  50. package/nationalarchives/components/header/template.njk +2 -2
  51. package/nationalarchives/components/hero/hero.css +1 -1
  52. package/nationalarchives/components/hero/hero.css.map +1 -1
  53. package/nationalarchives/components/hero/hero.scss +2 -2
  54. package/nationalarchives/components/hero/hero.stories.js +6 -0
  55. package/nationalarchives/components/index-grid/index-grid.css +1 -1
  56. package/nationalarchives/components/index-grid/index-grid.css.map +1 -1
  57. package/nationalarchives/components/index-grid/index-grid.stories.js +3 -1
  58. package/nationalarchives/components/message/message.css +1 -1
  59. package/nationalarchives/components/message/message.css.map +1 -1
  60. package/nationalarchives/components/pagination/macro-options.json +6 -0
  61. package/nationalarchives/components/pagination/pagination.css +1 -1
  62. package/nationalarchives/components/pagination/pagination.css.map +1 -1
  63. package/nationalarchives/components/pagination/pagination.scss +4 -0
  64. package/nationalarchives/components/pagination/pagination.stories.js +63 -2
  65. package/nationalarchives/components/pagination/template.njk +9 -2
  66. package/nationalarchives/components/phase-banner/phase-banner.css +1 -1
  67. package/nationalarchives/components/phase-banner/phase-banner.css.map +1 -1
  68. package/nationalarchives/components/picture/picture.css +1 -1
  69. package/nationalarchives/components/picture/picture.css.map +1 -1
  70. package/nationalarchives/components/sensitive-image/sensitive-image.css +1 -1
  71. package/nationalarchives/components/sensitive-image/sensitive-image.css.map +1 -1
  72. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +3 -0
  73. package/nationalarchives/components/skip-link/skip-link.css +1 -1
  74. package/nationalarchives/components/skip-link/skip-link.css.map +1 -1
  75. package/nationalarchives/components/skip-link/skip-link.stories.js +4 -1
  76. package/nationalarchives/components/tabs/tabs.css +1 -1
  77. package/nationalarchives/components/tabs/tabs.css.map +1 -1
  78. package/nationalarchives/components/tabs/tabs.stories.js +6 -3
  79. package/nationalarchives/lib/cookies.mjs +165 -62
  80. package/nationalarchives/prototype-kit.css +2 -2
  81. package/nationalarchives/prototype-kit.css.map +1 -1
  82. package/nationalarchives/prototype-kit.scss +3 -3
  83. package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.stories.js +153 -65
  84. package/nationalarchives/stories/utilities/overrides/overrides.stories.js +1 -0
  85. package/nationalarchives/stories/utilities/tables/tables.mdx +8 -0
  86. package/nationalarchives/stories/utilities/tables/tables.stories.js +45 -0
  87. package/nationalarchives/stories/utilities/typography/heading-groups.stories.js +59 -19
  88. package/nationalarchives/templates/layouts/_prototype-kit.njk +2 -0
  89. package/nationalarchives/tests/cookies.test.js +427 -0
  90. package/nationalarchives/tests/uuid.test.js +17 -0
  91. package/nationalarchives/tools/_colour.scss +2 -0
  92. package/nationalarchives/utilities/_index.scss +1 -0
  93. package/nationalarchives/utilities/_lists.scss +5 -0
  94. package/nationalarchives/utilities/_tables.scss +86 -0
  95. package/nationalarchives/utilities/_typography.scss +5 -20
  96. package/nationalarchives/variables/_colour.scss +1 -0
  97. package/package.json +6 -6
@@ -9,8 +9,8 @@
9
9
 
10
10
  .tna-template__body {
11
11
  p {
12
- color: inherit;
13
- font-family: inherit;
14
- font-weight: inherit;
12
+ // color: inherit;
13
+ // font-family: inherit;
14
+ // font-weight: inherit;
15
15
  }
16
16
  }
@@ -446,64 +446,68 @@ const Template = ({ theme, accent }) => {
446
446
  classes: "tna-hero--demo",
447
447
  },
448
448
  })}
449
- <div class="tna-container tna-section tna-!--padding-bottom-s">
450
- <div class="tna-column tna-column--width-1-3 tna-column--width-1-2-small tna-column--full-tiny">
451
- ${Card({
452
- params: {
453
- ...cardDefaultOptions,
454
- classes: "tna-!--margin-bottom-m",
455
- },
456
- })}
457
- </div>
458
- <div class="tna-column tna-column--width-1-3 tna-column--width-1-2-small tna-column--full-tiny">
459
- ${Card({
460
- params: {
461
- ...cardDefaultOptions,
462
- style: "boxed",
463
- classes: "tna-!--margin-bottom-m",
464
- },
465
- })}
466
- </div>
467
- <div class="tna-column tna-column--width-1-3 tna-column--width-1-2-small tna-column--full-tiny">
468
- ${Card({
469
- params: {
470
- ...cardDefaultOptions,
471
- style: "accent",
472
- classes: "tna-!--margin-bottom-m",
473
- },
474
- })}
475
- </div>
449
+ <div class="tna-section tna-!--padding-bottom-s">
450
+ <ul class="tna-ul tna-ul--plain tna-container">
451
+ <li class="tna-column tna-column--width-1-3 tna-column--width-1-2-small tna-column--full-tiny">
452
+ ${Card({
453
+ params: {
454
+ ...cardDefaultOptions,
455
+ classes: "tna-!--margin-bottom-m",
456
+ },
457
+ })}
458
+ </li>
459
+ <li class="tna-column tna-column--width-1-3 tna-column--width-1-2-small tna-column--full-tiny">
460
+ ${Card({
461
+ params: {
462
+ ...cardDefaultOptions,
463
+ style: "boxed",
464
+ classes: "tna-!--margin-bottom-m",
465
+ },
466
+ })}
467
+ </li>
468
+ <li class="tna-column tna-column--width-1-3 tna-column--width-1-2-small tna-column--full-tiny">
469
+ ${Card({
470
+ params: {
471
+ ...cardDefaultOptions,
472
+ style: "accent",
473
+ classes: "tna-!--margin-bottom-m",
474
+ },
475
+ })}
476
+ </li>
477
+ </ul>
476
478
  </div>
477
479
  <hr>
478
- <div class="tna-container tna-section">
479
- <div class="tna-column tna-column--width-2-3 tna-column--full-medium tna-column--full-small tna-column--full-tiny">
480
- ${Card({
481
- params: {
482
- ...cardDefaultOptions,
483
- horizontal: true,
484
- classes: "tna-!--margin-bottom-m",
485
- },
486
- })}
487
- </div>
488
- <div class="tna-column tna-column--width-2-3 tna-column--full-medium tna-column--full-small tna-column--full-tiny">
489
- ${Card({
490
- params: {
491
- ...cardDefaultOptions,
492
- horizontal: true,
493
- style: "boxed",
494
- classes: "tna-!--margin-bottom-m",
495
- },
496
- })}
497
- </div>
498
- <div class="tna-column tna-column--width-2-3 tna-column--full-medium tna-column--full-small tna-column--full-tiny">
499
- ${Card({
500
- params: {
501
- ...cardDefaultOptions,
502
- horizontal: true,
503
- style: "accent",
504
- },
505
- })}
506
- </div>
480
+ <div class="tna-section">
481
+ <ul class="tna-ul tna-ul--plain tna-container">
482
+ <li class="tna-column tna-column--width-2-3 tna-column--full-medium tna-column--full-small tna-column--full-tiny">
483
+ ${Card({
484
+ params: {
485
+ ...cardDefaultOptions,
486
+ horizontal: true,
487
+ classes: "tna-!--margin-bottom-m",
488
+ },
489
+ })}
490
+ </li>
491
+ <li class="tna-column tna-column--width-2-3 tna-column--full-medium tna-column--full-small tna-column--full-tiny">
492
+ ${Card({
493
+ params: {
494
+ ...cardDefaultOptions,
495
+ horizontal: true,
496
+ style: "boxed",
497
+ classes: "tna-!--margin-bottom-m",
498
+ },
499
+ })}
500
+ </li>
501
+ <li class="tna-column tna-column--width-2-3 tna-column--full-medium tna-column--full-small tna-column--full-tiny">
502
+ ${Card({
503
+ params: {
504
+ ...cardDefaultOptions,
505
+ horizontal: true,
506
+ style: "accent",
507
+ },
508
+ })}
509
+ </li>
510
+ </ul>
507
511
  </div>
508
512
  <hr>
509
513
  <div class="tna-container tna-section">
@@ -612,7 +616,7 @@ const Template = ({ theme, accent }) => {
612
616
  ${IndexGrid({
613
617
  params: {
614
618
  heading: { title: "My dogs 1", level: 3, href: "#" },
615
- items: Array(12)
619
+ items: Array(6)
616
620
  .fill({
617
621
  ...{
618
622
  href: "#",
@@ -690,11 +694,11 @@ const Template = ({ theme, accent }) => {
690
694
  </div>
691
695
  </div>
692
696
  </div>
693
- <div class="tna-section tna-background-contrast">
697
+ <div class="tna-section tna-background-tint">
694
698
  ${IndexGrid({
695
699
  params: {
696
700
  heading: { title: "My dogs 2", level: 3, href: "#" },
697
- items: Array(12)
701
+ items: Array(6)
698
702
  .fill({
699
703
  ...{
700
704
  href: "#",
@@ -772,11 +776,93 @@ const Template = ({ theme, accent }) => {
772
776
  </div>
773
777
  </div>
774
778
  </div>
775
- <div class="tna-section tna-background-accent-light">
779
+ <div class="tna-section tna-background-contrast">
776
780
  ${IndexGrid({
777
781
  params: {
778
782
  heading: { title: "My dogs 3", level: 3, href: "#" },
779
- items: Array(12)
783
+ items: Array(6)
784
+ .fill({
785
+ ...{
786
+ href: "#",
787
+ src: "https://picsum.photos/id/237/800/600",
788
+ alt: "Photo of a puppy",
789
+ width: "800",
790
+ height: "600",
791
+ title: "Cat",
792
+ subtitle: "4 photos",
793
+ },
794
+ })
795
+ .map((item, index) => {
796
+ const pseudoRandom = ((index * 29) % 8) + 1;
797
+ return {
798
+ ...item,
799
+ href: `#/category-${index}`,
800
+ title: `Category #${index + 101}`,
801
+ subtitle: `${pseudoRandom} photos`,
802
+ };
803
+ }),
804
+ columns: 4,
805
+ columnsMedium: 3,
806
+ columnsSmall: 2,
807
+ columnsTiny: 1,
808
+ },
809
+ })}
810
+ <div class="tna-container">
811
+ <div class="tna-column tna-column--full">
812
+ ${Pagination({
813
+ params: {
814
+ landmarkLabel: "My dogs 2 results",
815
+ previous: {
816
+ href: "#",
817
+ },
818
+ items: [
819
+ {
820
+ number: 1,
821
+ href: "#",
822
+ },
823
+ {
824
+ ellipsis: true,
825
+ },
826
+ {
827
+ number: 6,
828
+ href: "#",
829
+ },
830
+ {
831
+ number: 7,
832
+ current: true,
833
+ href: "#",
834
+ },
835
+ {
836
+ number: 8,
837
+ href: "#",
838
+ },
839
+ {
840
+ ellipsis: true,
841
+ },
842
+ {
843
+ number: 42,
844
+ href: "#",
845
+ },
846
+ ],
847
+ next: {
848
+ href: "#",
849
+ },
850
+ classes: "tna-pagination--demo",
851
+ },
852
+ })}
853
+ <div class="tna-button-group">
854
+ <a href="#" class="tna-button" role="button">Primary button</a>
855
+ <a href="#" class="tna-button tna-button--accent" role="button">Accent button</a>
856
+ <a href="" class="tna-button tna-button--plain" role="button">Plain button</a>
857
+ </div>
858
+ </div>
859
+ </div>
860
+ </div>
861
+ <div class="tna-section tna-background-accent-light">
862
+ ${IndexGrid({
863
+ params: {
864
+ heading: { title: "My dogs 4", level: 3, href: "#" },
865
+ items: Array(6)
780
866
  .fill({
781
867
  ...{
782
868
  href: "#",
@@ -857,8 +943,8 @@ const Template = ({ theme, accent }) => {
857
943
  <div class="tna-section tna-background-accent">
858
944
  ${IndexGrid({
859
945
  params: {
860
- heading: { title: "My dogs 4", level: 3, href: "#" },
861
- items: Array(12)
946
+ heading: { title: "My dogs 5", level: 3, href: "#" },
947
+ items: Array(6)
862
948
  .fill({
863
949
  ...{
864
950
  href: "#",
@@ -1068,7 +1154,7 @@ const Template = ({ theme, accent }) => {
1068
1154
  href: "#",
1069
1155
  },
1070
1156
  {
1071
- text: "Terms and condidtions",
1157
+ text: "Terms and conditions",
1072
1158
  href: "#",
1073
1159
  },
1074
1160
  {
@@ -1087,7 +1173,9 @@ const Template = ({ theme, accent }) => {
1087
1173
  };
1088
1174
 
1089
1175
  export const System = Template.bind({});
1090
- // System.parameters = { options: { showPanel: false } };
1176
+ System.parameters = {
1177
+ chromatic: { disableSnapshot: true },
1178
+ };
1091
1179
  System.args = {
1092
1180
  theme: "system",
1093
1181
  accent: "pink",
@@ -30,6 +30,7 @@ MarginMobile.parameters = {
30
30
  },
31
31
  chromatic: {
32
32
  viewports: [customViewports["small"].styles.width.replace(/px$/, "")],
33
+ disableSnapshot: true,
33
34
  },
34
35
  };
35
36
  MarginMobile.args = {};
@@ -0,0 +1,8 @@
1
+ import { Meta, Canvas } from "@storybook/blocks";
2
+ import * as TableStories from './tables.stories';
3
+
4
+ <Meta of={TableStories} />
5
+
6
+ # Tables
7
+
8
+ <Canvas of={TableStories.Table} />
@@ -0,0 +1,45 @@
1
+ export default {
2
+ title: "Utilities/Tables",
3
+ };
4
+
5
+ const TableTemplate = () =>
6
+ `<table class="tna-table">
7
+ <caption class="tna-table__caption tna-heading-m tna-visually-hidden">Primary options</caption>
8
+ <thead class="tna-table__head">
9
+ <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>
13
+ </tr>
14
+ </thead>
15
+ <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>
28
+ </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>
35
+ </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>
42
+ </tr>
43
+ </tbody>
44
+ </table>`;
45
+ export const Table = TableTemplate.bind({});
@@ -3,7 +3,7 @@ const argTypes = {
3
3
  title: { control: "text" },
4
4
  level: { control: "number", min: 1, max: 6, step: 1 },
5
5
  size: { control: "radio", options: ["m", "l", "xl"] },
6
- singleSentence: { control: "boolean" },
6
+ plainSupertitle: { control: "boolean" },
7
7
  };
8
8
 
9
9
  export default {
@@ -11,35 +11,75 @@ export default {
11
11
  argTypes,
12
12
  };
13
13
 
14
- const Template = ({
14
+ const HeadingGroupTemplate = ({
15
15
  supertitle,
16
16
  title,
17
- level = 3,
18
- size = "l",
19
- singleSentence,
17
+ level,
18
+ size,
19
+ plainSupertitle,
20
20
  }) =>
21
- singleSentence
22
- ? `<hgroup class="tna-hgroup-${size}">
23
- <h${level} class="tna-hgroup__title">
24
- <span class="tna-hgroup__supertitle">${supertitle}</span>
25
- <span class="tna-hgroup__title">${title}</span>
26
- </h${level}>
27
- </hgroup>`
28
- : `<hgroup class="tna-hgroup-${size}">
29
- <p class="tna-hgroup__supertitle">${supertitle}</p>
21
+ `<hgroup class="tna-hgroup-${size}">
22
+ <p class="tna-hgroup__supertitle${
23
+ plainSupertitle ? " tna-hgroup__supertitle--plain" : ""
24
+ }">${supertitle}</p>
30
25
  <h${level} class="tna-hgroup__title">${title}</h${level}>
31
26
  </hgroup>`;
32
27
 
33
- export const HeadingGroup = Template.bind({});
28
+ export const HeadingGroup = HeadingGroupTemplate.bind({});
34
29
  HeadingGroup.args = {
30
+ supertitle: "Record revealed",
31
+ title: "The Monteagle Letter",
32
+ level: 3,
33
+ size: "l",
34
+ plainSupertitle: false,
35
+ };
36
+
37
+ const HeadingGroupSingleSentenceTemplate = ({
38
+ supertitle,
39
+ title,
40
+ level,
41
+ size,
42
+ plainSupertitle,
43
+ }) =>
44
+ `<hgroup class="tna-hgroup-${size}">
45
+ <h${level} class="tna-hgroup__title">
46
+ <span class="tna-hgroup__supertitle${
47
+ plainSupertitle ? " tna-hgroup__supertitle--plain" : ""
48
+ }">${supertitle}</span>
49
+ <span class="tna-hgroup__title">${title}</span>
50
+ </h${level}>
51
+ </hgroup>`;
52
+
53
+ export const HeadingGroupSingleSentence =
54
+ HeadingGroupSingleSentenceTemplate.bind({});
55
+ HeadingGroupSingleSentence.args = {
35
56
  supertitle: "The story of",
36
57
  title: "Alice Hawkins",
37
- singleSentence: true,
58
+ level: 3,
59
+ size: "l",
60
+ plainSupertitle: false,
38
61
  };
39
62
 
40
- export const HeadingGroupSeparated = Template.bind({});
41
- HeadingGroupSeparated.args = {
63
+ const HeadingGroupPlainSupertitleTemplate = ({
64
+ supertitle,
65
+ title,
66
+ level,
67
+ size,
68
+ plainSupertitle,
69
+ }) =>
70
+ `<hgroup class="tna-hgroup-${size}">
71
+ <p class="tna-hgroup__supertitle${
72
+ plainSupertitle ? " tna-hgroup__supertitle--plain" : ""
73
+ }">${supertitle}</p>
74
+ <h${level} class="tna-hgroup__title">${title}</h${level}>
75
+ </hgroup>`;
76
+
77
+ export const HeadingGroupPlainSupertitle =
78
+ HeadingGroupPlainSupertitleTemplate.bind({});
79
+ HeadingGroupPlainSupertitle.args = {
42
80
  supertitle: "Record revealed",
43
81
  title: "The Monteagle Letter",
44
- singleSentence: false,
82
+ level: 3,
83
+ size: "l",
84
+ plainSupertitle: true,
45
85
  };
@@ -1,5 +1,7 @@
1
1
  {% extends "./_generic.njk" %}
2
2
 
3
+ {% set assetPath = "/plugin-assets/%40nationalarchives%2Ffrontend/nationalarchives/assets" %}
4
+
3
5
  {% block stylesheets %}
4
6
  {% include "govuk-prototype-kit/includes/stylesheets-plugins.njk" %}
5
7
  <link rel="stylesheet" type="text/css" href="https://use.typekit.net/hkj3kuz.css">