@nationalarchives/frontend 0.1.14-prerelease → 0.1.16-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 (89) hide show
  1. package/LICENCE +21 -0
  2. package/nationalarchives/all.css +1 -1
  3. package/nationalarchives/all.css.map +1 -1
  4. package/nationalarchives/all.js +1 -1
  5. package/nationalarchives/all.js.map +1 -1
  6. package/nationalarchives/all.mjs +7 -7
  7. package/nationalarchives/all.scss +2 -5
  8. package/nationalarchives/components/_index.scss +1 -0
  9. package/nationalarchives/components/breadcrumbs/_index.scss +54 -39
  10. package/nationalarchives/components/breadcrumbs/breadcrumbs.js +2 -0
  11. package/nationalarchives/components/breadcrumbs/breadcrumbs.js.map +1 -0
  12. package/nationalarchives/components/breadcrumbs/breadcrumbs.mjs +67 -0
  13. package/nationalarchives/components/breadcrumbs/breadcrumbs.stories.js +10 -3
  14. package/nationalarchives/components/breadcrumbs/fixtures.json +23 -1
  15. package/nationalarchives/components/breadcrumbs/macro-options.json +6 -0
  16. package/nationalarchives/components/breadcrumbs/template.njk +17 -12
  17. package/nationalarchives/components/button/_index.scss +1 -2
  18. package/nationalarchives/components/button/button.stories.js +2 -3
  19. package/nationalarchives/components/button/fixtures.json +5 -5
  20. package/nationalarchives/components/button/template.njk +1 -1
  21. package/nationalarchives/components/card/_index.scss +78 -34
  22. package/nationalarchives/components/card/card.stories.js +72 -5
  23. package/nationalarchives/components/card/fixtures.json +15 -2
  24. package/nationalarchives/components/card/macro-options.json +6 -12
  25. package/nationalarchives/components/card/template.njk +6 -6
  26. package/nationalarchives/components/filters/filters.stories.js +3 -4
  27. package/nationalarchives/components/footer/_index.scss +8 -14
  28. package/nationalarchives/components/footer/footer.stories.js +2 -3
  29. package/nationalarchives/components/footer/template.njk +1 -1
  30. package/nationalarchives/components/grid/_index.scss +2 -2
  31. package/nationalarchives/components/grid/grid.stories.js +2 -3
  32. package/nationalarchives/components/header/_index.scss +27 -26
  33. package/nationalarchives/components/header/header.stories.js +2 -3
  34. package/nationalarchives/components/header/template.njk +1 -1
  35. package/nationalarchives/components/hero/_index.scss +7 -20
  36. package/nationalarchives/components/hero/hero.stories.js +2 -3
  37. package/nationalarchives/components/index-grid/_index.scss +17 -1
  38. package/nationalarchives/components/index-grid/index-grid.stories.js +7 -5
  39. package/nationalarchives/components/index-grid/macro-options.json +22 -2
  40. package/nationalarchives/components/index-grid/template.njk +12 -6
  41. package/nationalarchives/components/message/_index.scss +4 -6
  42. package/nationalarchives/components/message/phase-banner.stories.js +2 -3
  43. package/nationalarchives/components/phase-banner/phase-banner.stories.js +2 -3
  44. package/nationalarchives/components/picture/_index.scss +12 -15
  45. package/nationalarchives/components/picture/picture.stories.js +2 -3
  46. package/nationalarchives/components/profile/profile.stories.js +2 -3
  47. package/nationalarchives/components/sensitive-image/sensitive-image.stories.js +3 -4
  48. package/nationalarchives/components/skip-link/_index.scss +63 -0
  49. package/nationalarchives/components/skip-link/fixtures.json +11 -0
  50. package/nationalarchives/components/skip-link/macro-options.json +26 -0
  51. package/nationalarchives/components/skip-link/macro.njk +3 -0
  52. package/nationalarchives/components/skip-link/skip-link.stories.js +31 -0
  53. package/nationalarchives/components/skip-link/template.njk +4 -0
  54. package/nationalarchives/components/tabs/_index.scss +7 -14
  55. package/nationalarchives/components/tabs/tabs.stories.js +2 -3
  56. package/nationalarchives/patterns/featured-collection/_index.scss +2 -2
  57. package/nationalarchives/patterns/featured-collection/featured-collection.stories.js +3 -4
  58. package/nationalarchives/patterns/featured-collection/template.njk +2 -2
  59. package/nationalarchives/stories/utilities/colour-schemes/colour-schemes.mdx +85 -0
  60. package/nationalarchives/stories/utilities/{colour.stories.js → colour-schemes/colour-schemes.stories.js} +142 -52
  61. package/nationalarchives/stories/utilities/overrides/overrides.mdx +66 -0
  62. package/nationalarchives/stories/utilities/overrides/overrides.stories.js +30 -0
  63. package/nationalarchives/stories/utilities/{headings.stories.js → typography/headings.stories.js} +2 -1
  64. package/nationalarchives/stories/utilities/typography/typography.stories.js +34 -0
  65. package/nationalarchives/templates/layouts/_generic.njk +10 -8
  66. package/nationalarchives/tools/_colour.scss +105 -16
  67. package/nationalarchives/tools/_index.scss +0 -1
  68. package/nationalarchives/tools/_typography.scss +13 -1
  69. package/nationalarchives/utilities/_debug.scss +41 -1
  70. package/nationalarchives/utilities/_global.scss +13 -4
  71. package/nationalarchives/utilities/_index.scss +1 -0
  72. package/nationalarchives/utilities/_overrides.scss +30 -0
  73. package/nationalarchives/utilities/_typography.scss +42 -34
  74. package/nationalarchives/variables/_colour.scss +103 -106
  75. package/nationalarchives/variables/_grid.scss +1 -1
  76. package/nationalarchives/variables/_index.scss +1 -1
  77. package/nationalarchives/variables/_media.scss +23 -23
  78. package/nationalarchives/variables/_spacing.scss +15 -0
  79. package/nationalarchives/variables/_typography.scss +2 -1
  80. package/package.json +2 -2
  81. package/nationalarchives/components/card/card.js +0 -2
  82. package/nationalarchives/components/card/card.js.map +0 -1
  83. package/nationalarchives/components/card/card.mjs +0 -45
  84. package/nationalarchives/stories/utilities/typography.stories.js +0 -29
  85. package/nationalarchives/tools/_assets.scss +0 -5
  86. package/nationalarchives/variables/_assets.scss +0 -1
  87. /package/nationalarchives/stories/utilities/{heading-groups.stories.js → typography/heading-groups.stories.js} +0 -0
  88. /package/nationalarchives/stories/utilities/{lists.stories.js → typography/lists.stories.js} +0 -0
  89. /package/nationalarchives/stories/utilities/{typography.mdx → typography/typography.mdx} +0 -0
@@ -1,5 +1,5 @@
1
1
  {# Based on https://github.com/alphagov/govuk-frontend/blob/8b6bf304b9fc891f64459c25a08f3d623f3fea72/packages/govuk-frontend/src/govuk/template.njk #}
2
- {#% from "./components/skip-link/macro.njk" import tnaSkipLink -%#}
2
+ {% from "./components/skip-link/macro.njk" import tnaSkipLink -%}
3
3
  <!DOCTYPE html>
4
4
  <html lang="{{ htmlLang | default('en-GB') }}" class="tna-template {{ htmlClasses }}">
5
5
  <head>
@@ -23,15 +23,17 @@
23
23
  {% block stylesheets %}{% endblock %}
24
24
  </head>
25
25
  <body class="tna-template__body {{ bodyClasses }}" {%- for attribute, value in bodyAttributes %} {{attribute}}="{{value}}"{% endfor %}>
26
- {% block skipLink %}
27
- {#{ govukSkipLink({
28
- href: '#main-content',
29
- text: 'Skip to main content'
30
- }) }#}
26
+ {% block bodyStart %}
27
+ {% block cookies %}{% endblock %}
28
+
29
+ {% block skipLink %}
30
+ {{ tnaSkipLink({
31
+ href: '#main-content',
32
+ text: 'Skip to main content'
33
+ }) }}
34
+ {% endblock %}
31
35
  {% endblock %}
32
36
 
33
- {% block bodyStart %}{% endblock %}
34
-
35
37
  {% block header %}{% endblock %}
36
38
 
37
39
  {% block main %}
@@ -1,6 +1,11 @@
1
1
  @use "sass:map";
2
2
  @use "../features";
3
3
  @use "../variables/colour";
4
+ @use "../tools/media";
5
+
6
+ @function brand-colour($colour) {
7
+ @return map.get(colour.$colour-palette-brand, $colour);
8
+ }
4
9
 
5
10
  @mixin colour-css-vars() {
6
11
  @each $name, $value in colour.$colour-palette-default {
@@ -26,38 +31,87 @@
26
31
  }
27
32
  }
28
33
 
29
- @mixin colour-font($colour) {
34
+ @mixin colour-font($colour, $important: false) {
30
35
  color: map.get(colour.$colour-palette-default, $colour);
31
- color: var(--#{$colour});
36
+ @if $colour == "accent" {
37
+ color: var(--#{$colour}, var(--accent-default))
38
+ if($important, !important, null);
39
+ } @else {
40
+ color: var(--#{$colour}) if($important, !important, null);
41
+ }
32
42
  }
33
43
 
34
- @mixin colour-background($colour) {
44
+ @mixin colour-background($colour, $important: false) {
35
45
  background-color: map.get(colour.$colour-palette-default, $colour);
36
- background-color: var(--#{$colour});
46
+ @if $colour == "accent" {
47
+ background-color: var(--#{$colour}, var(--accent-default))
48
+ if($important, !important, null);
49
+ } @else {
50
+ background-color: var(--#{$colour}) if($important, !important, null);
51
+ }
37
52
  }
38
53
 
39
- @mixin colour-border($colour) {
40
- border-color: map.get(colour.$colour-palette-default, $colour);
41
- border-color: var(--#{$colour});
54
+ @mixin colour-border(
55
+ $colour,
56
+ $width: "",
57
+ $style: solid,
58
+ $direction: "",
59
+ $important: false
60
+ ) {
61
+ @if $direction != "" {
62
+ @if $width != "" {
63
+ $property: border-#{$direction};
64
+ border-#{$direction}: $width
65
+ map.get(colour.$colour-palette-default, $colour)
66
+ $style
67
+ if($important, !important, null);
68
+ border-#{$direction}: $width
69
+ var(--#{$colour})
70
+ $style
71
+ if($important, !important, null);
72
+ } @else {
73
+ border-#{$direction}-color: map.get(
74
+ colour.$colour-palette-default,
75
+ $colour
76
+ )
77
+ if($important, !important, null);
78
+ border-#{$direction}-color: var(--#{$colour})
79
+ if($important, !important, null);
80
+ }
81
+ } @else {
82
+ @if $width != "" {
83
+ border: $width
84
+ map.get(colour.$colour-palette-default, $colour)
85
+ $style
86
+ if($important, !important, null);
87
+ border: $width var(--#{$colour}) $style if($important, !important, null);
88
+ } @else {
89
+ border-color: map.get(colour.$colour-palette-default, $colour)
90
+ if($important, !important, null);
91
+ border-color: var(--#{$colour}) if($important, !important, null);
92
+ }
93
+ }
42
94
  }
43
95
 
44
- @mixin colour-outline($colour) {
45
- outline-color: map.get(colour.$colour-palette-default, $colour);
46
- outline-color: var(--#{$colour});
96
+ @mixin colour-outline($colour, $important: false) {
97
+ outline-color: map.get(colour.$colour-palette-default, $colour)
98
+ if($important, !important, null);
99
+ outline-color: var(--#{$colour}) if($important, !important, null);
47
100
  }
48
101
 
49
- @mixin colour-fill($colour) {
50
- fill: map.get(colour.$colour-palette-default, $colour);
51
- fill: var(--#{$colour});
102
+ @mixin colour-fill($colour, $important: false) {
103
+ fill: map.get(colour.$colour-palette-default, $colour)
104
+ if($important, !important, null);
105
+ fill: var(--#{$colour}) if($important, !important, null);
52
106
  }
53
107
 
54
108
  @mixin fixed {
55
109
  @include colour-css-vars;
56
110
 
57
- @include colour-font("font-base");
111
+ // @include colour-font("font-base");
58
112
  }
59
113
 
60
- @mixin invert {
114
+ %invert {
61
115
  --font-base: var(--contrast-font-base);
62
116
  --font-dark: var(--contrast-font-dark);
63
117
  --font-light: var(--contrast-font-light);
@@ -66,10 +120,33 @@
66
120
  --keyline: var(--contrast-keyline);
67
121
  --keyline-dark: var(--contrast-keyline-dark);
68
122
 
69
- @include colour-font("contrast-font-base");
123
+ // @include colour-font("contrast-font-base");
70
124
  @include colour-background("contrast-background");
71
125
  }
72
126
 
127
+ @mixin invert {
128
+ @extend %invert;
129
+ }
130
+
131
+ %invert-on-mobile {
132
+ @include media.on-mobile {
133
+ --font-base: var(--contrast-font-base);
134
+ --font-dark: var(--contrast-font-dark);
135
+ --font-light: var(--contrast-font-light);
136
+ --link: var(--contrast-link);
137
+ --link-visited: var(--contrast-link-visited);
138
+ --keyline: var(--contrast-keyline);
139
+ --keyline-dark: var(--contrast-keyline-dark);
140
+
141
+ // @include colour-font("contrast-font-base");
142
+ @include colour-background("contrast-background");
143
+ }
144
+ }
145
+
146
+ @mixin invert-on-mobile {
147
+ @extend %invert-on-mobile;
148
+ }
149
+
73
150
  @mixin uninvert {
74
151
  @include colour-css-vars;
75
152
 
@@ -105,3 +182,15 @@
105
182
  @include colour-css-vars-high-contrast-dark;
106
183
  }
107
184
  }
185
+
186
+ @mixin on-high-contrast {
187
+ .tna-template--high-contrast-theme & {
188
+ @content;
189
+ }
190
+
191
+ @media (prefers-contrast: more) {
192
+ .tna-template--system-theme & {
193
+ @content;
194
+ }
195
+ }
196
+ }
@@ -1,4 +1,3 @@
1
- @forward "assets";
2
1
  @forward "colour";
3
2
  @forward "grid";
4
3
  @forward "media";
@@ -5,9 +5,17 @@
5
5
  font-size: #{math.div($fontSizePx, typography.$base-font-size-px)}rem;
6
6
  }
7
7
 
8
+ @mixin main-font-weight {
9
+ font-weight: typography.$font-weight-main;
10
+ }
11
+
12
+ @mixin main-font-weight-bold {
13
+ font-weight: typography.$font-weight-main-bold;
14
+ }
15
+
8
16
  @mixin main-font {
9
17
  font-family: typography.$font-family-main;
10
- font-weight: typography.$font-weight-main;
18
+ @include main-font-weight;
11
19
  }
12
20
 
13
21
  @mixin heading-font {
@@ -18,4 +26,8 @@
18
26
  @mixin detail-font {
19
27
  font-family: typography.$font-family-detail;
20
28
  font-weight: typography.$font-weight-detail;
29
+ @include relative-font-size(14);
30
+ text-transform: uppercase;
31
+ line-height: #{math.div(typography.$base-font-size-px, 14)};
32
+ // line-height: 1;
21
33
  }
@@ -1,11 +1,51 @@
1
1
  @use "../features";
2
2
 
3
+ /*
4
+ * ==========================================
5
+ * WCAG 2.2 SC 2.5.8
6
+ * https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum
7
+ * ------------------------------------------
8
+ * AA - Small green circles should not intersect
9
+ * ------------------------------------------
10
+ */
3
11
  @if features.$debug-interactable-areas {
4
12
  a,
5
13
  button,
6
14
  label[for] {
7
15
  background-color: rgba(#f0a, 0.25) !important;
8
16
 
9
- box-shadow: 0 0 0 1px #f0a !important;
17
+ box-shadow:
18
+ 0 0 0 2px #f0a,
19
+ 0 0 0.5rem #f0a !important;
20
+
21
+ position: relative;
22
+
23
+ &::before {
24
+ width: 20px;
25
+ height: 20px;
26
+
27
+ display: block;
28
+
29
+ position: absolute;
30
+ top: 50%;
31
+ left: 50%;
32
+
33
+ background-color: rgba(#0f3, 0.25) !important;
34
+
35
+ border-radius: 100%;
36
+ outline: 2px #0f3 solid;
37
+ outline-offset: 10px;
38
+
39
+ box-shadow:
40
+ 0 0 0 2px #0f3,
41
+ 0 0 0.5rem #0f3 !important;
42
+
43
+ transform: translateX(-50%) translateY(-50%);
44
+
45
+ content: "";
46
+ }
47
+
48
+ .tna-template--dark-theme & {
49
+ }
10
50
  }
11
51
  }
@@ -98,11 +98,11 @@
98
98
 
99
99
  overflow: auto;
100
100
 
101
- &:has(.tna-header):has(#main[role="main"]):has(.tna-footer) {
101
+ &:has(.tna-header):has(#main-content[role="main"]):has(.tna-footer) {
102
102
  display: flex;
103
103
  flex-direction: column;
104
104
 
105
- #main[role="main"] {
105
+ #main-content[role="main"] {
106
106
  flex: 1;
107
107
  }
108
108
  }
@@ -134,11 +134,15 @@ canvas {
134
134
  }
135
135
 
136
136
  hr {
137
- margin: 1rem;
137
+ margin: 3rem 0;
138
138
 
139
139
  border-width: 1px 0 0;
140
140
  @include colour.colour-border("keyline");
141
- border-style: solid;
141
+ border-style: dashed;
142
+
143
+ @include colour.on-high-contrast {
144
+ border-style: solid;
145
+ }
142
146
  }
143
147
 
144
148
  .tna-visually-hidden {
@@ -159,4 +163,9 @@ hr {
159
163
  border: 0 !important;
160
164
 
161
165
  background-color: transparent !important;
166
+
167
+ &::before,
168
+ &::after {
169
+ content: "\00a0";
170
+ }
162
171
  }
@@ -1,3 +1,4 @@
1
1
  @forward "debug";
2
2
  @forward "global";
3
+ @forward "overrides";
3
4
  @forward "typography";
@@ -0,0 +1,30 @@
1
+ @use "../variables/spacing";
2
+ @use "../tools/media";
3
+
4
+ @each $property in margin, padding {
5
+ @each $direction in top, bottom {
6
+ .tna-\!--no-#{$property}-#{$direction},
7
+ .tna-\!--no-#{$property}-vertical {
8
+ #{$property}-#{$direction}: 0 !important;
9
+ }
10
+ }
11
+ }
12
+
13
+ @mixin overrides($spacing) {
14
+ @each $property in margin, padding {
15
+ @each $direction in top, bottom {
16
+ @each $size, $amount in $spacing {
17
+ .tna-\!--#{$property}-#{$direction}-#{$size},
18
+ .tna-\!--#{$property}-vertical-#{$size} {
19
+ #{$property}-#{$direction}: #{$amount}rem !important;
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }
25
+
26
+ @include overrides(spacing.$spacing);
27
+
28
+ @include media.on-mobile {
29
+ @include overrides(spacing.$spacing-mobile);
30
+ }
@@ -1,9 +1,10 @@
1
+ @use "sass:math";
1
2
  @use "../tools/colour";
2
3
  @use "../tools/media";
3
4
  @use "../tools/typography";
4
5
 
5
- // Temporary - will eventually bundle font files into package
6
- @import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&family=Roboto+Mono:wght@400;700&display=swap";
6
+ // TODO: Temporary - will eventually bundle font files into package
7
+ @import "https://fonts.googleapis.com/css2?family=Open+Sans:wght@500;700&family=Roboto+Mono:wght@400&display=swap";
7
8
  @import "https://use.typekit.net/hkj3kuz.css";
8
9
 
9
10
  .tna-template {
@@ -19,7 +20,8 @@
19
20
  .tna-template__body {
20
21
  color: inherit;
21
22
  @include typography.relative-font-size(18);
22
- line-height: 1.6;
23
+ // line-height: 1.6;
24
+ line-height: #{math.div(16, 18) * 2};
23
25
  }
24
26
 
25
27
  h1,
@@ -33,6 +35,16 @@ ol {
33
35
  margin-top: 0;
34
36
  }
35
37
 
38
+ h1,
39
+ h2,
40
+ h3,
41
+ h4,
42
+ h5,
43
+ h6,
44
+ strong {
45
+ @include typography.main-font-weight-bold;
46
+ }
47
+
36
48
  p {
37
49
  margin: 0 0 1.5rem;
38
50
 
@@ -43,23 +55,26 @@ p {
43
55
 
44
56
  a {
45
57
  @include colour.colour-font("link");
58
+ text-decoration-thickness: 1.5px;
46
59
 
47
60
  &:visited {
48
61
  @include colour.colour-font("link-visited");
49
62
  }
50
63
 
64
+ &:hover,
51
65
  &:active {
52
- text-decoration-thickness: 4px;
53
- }
54
-
55
- &:hover {
56
- text-decoration-thickness: 3px;
66
+ text-decoration-thickness: 3.5px;
57
67
  }
58
68
  }
59
69
 
60
70
  .tna-ul,
61
71
  .tna-ol {
62
- padding-left: 2rem;
72
+ margin: 0 0 2rem;
73
+ padding: 0 0 0 2rem;
74
+
75
+ &:last-child {
76
+ margin-bottom: 0;
77
+ }
63
78
 
64
79
  li::marker {
65
80
  @include colour.colour-font("accent");
@@ -121,22 +136,20 @@ a {
121
136
  }
122
137
 
123
138
  .tna-hgroup {
124
- margin-bottom: 2rem;
139
+ margin-bottom: 1rem;
125
140
 
126
141
  &:last-child {
127
142
  margin-bottom: 0;
128
143
  }
129
144
 
130
145
  &__supertitle {
131
- margin: 0;
146
+ margin: 0 0 0.5rem;
132
147
 
133
148
  @include colour.colour-font("font-base");
134
- @include typography.relative-font-size(14);
135
149
  @include typography.detail-font;
136
- text-transform: uppercase;
137
150
 
138
151
  .tna-hgroup & {
139
- margin: 0;
152
+ // margin: 0;
140
153
  }
141
154
  }
142
155
 
@@ -153,57 +166,52 @@ a {
153
166
  }
154
167
 
155
168
  &--xl {
156
- .tna-hgroup__supertitle {
157
- }
158
-
159
169
  .tna-hgroup__title {
160
170
  @include typography.relative-font-size(64);
171
+ line-height: 1;
161
172
  }
162
173
  }
163
174
 
164
175
  &--l {
165
- .tna-hgroup__supertitle {
166
- }
167
-
168
176
  .tna-hgroup__title {
169
177
  @include typography.relative-font-size(32);
178
+ line-height: 1.2;
170
179
  }
171
180
  }
172
181
 
173
182
  &--m {
174
- .tna-hgroup__supertitle {
175
- }
176
-
177
183
  .tna-hgroup__title {
178
184
  @include typography.relative-font-size(20);
185
+ line-height: 1.4;
179
186
  }
180
187
  }
181
188
 
182
189
  &--s {
183
- .tna-hgroup__supertitle {
184
- }
185
-
186
190
  .tna-hgroup__title {
187
191
  @include typography.relative-font-size(18);
192
+ line-height: 1.6;
188
193
  }
189
194
  }
190
195
  }
191
196
 
192
197
  .tna-blockquote {
193
- margin: 0;
198
+ margin: 0 0 2rem;
194
199
  padding: 1rem 1rem 1rem 2rem;
195
200
 
196
- border-left: 0.35rem solid;
197
- @include colour.colour-border("keyline");
198
-
199
- quotes: "“" "”" "‘" "’";
201
+ @include colour.colour-border("keyline", 0.35rem, solid, left);
200
202
 
201
- &::before {
202
- float: left;
203
+ // quotes: "“" "”" "‘" "’";
203
204
 
204
- content: open-quote;
205
+ &:last-child {
206
+ margin-bottom: 0;
205
207
  }
206
208
 
209
+ // &::before {
210
+ // float: left;
211
+
212
+ // content: open-quote;
213
+ // }
214
+
207
215
  &__quote {
208
216
  font-weight: 700;
209
217
  }