govuk_tech_docs 5.2.1 → 6.0.0.beta

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 (169) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +59 -0
  3. data/.npmrc +1 -0
  4. data/.ruby-version +1 -0
  5. data/CHANGELOG.md +19 -0
  6. data/README.md +13 -4
  7. data/example/config/tech-docs.yml +1 -1
  8. data/govuk_tech_docs.gemspec +2 -2
  9. data/lib/assets/stylesheets/_core.scss +1 -0
  10. data/lib/assets/stylesheets/_govuk_tech_docs.scss +13 -15
  11. data/lib/assets/stylesheets/modules/_app-pane.scss +3 -3
  12. data/lib/assets/stylesheets/modules/_page-review.scss +4 -4
  13. data/lib/assets/stylesheets/modules/_search.scss +3 -3
  14. data/lib/assets/stylesheets/modules/_service-navigation.scss +5 -0
  15. data/lib/assets/stylesheets/modules/_technical-documentation.scss +7 -7
  16. data/lib/assets/stylesheets/modules/_toc.scss +13 -13
  17. data/lib/assets/stylesheets/palette/_syntax-highlighting.scss +9 -7
  18. data/lib/govuk_tech_docs/meta_tags.rb +1 -1
  19. data/lib/govuk_tech_docs/version.rb +1 -1
  20. data/lib/source/layouts/_header.erb +2 -16
  21. data/lib/source/layouts/_service_navigation.erb +27 -0
  22. data/lib/source/layouts/core.erb +7 -7
  23. data/node_modules/govuk-frontend/dist/govuk/_base.scss +1 -0
  24. data/node_modules/govuk-frontend/dist/govuk/all.bundle.js +183 -300
  25. data/node_modules/govuk-frontend/dist/govuk/all.bundle.mjs +184 -300
  26. data/node_modules/govuk-frontend/dist/govuk/all.mjs +0 -1
  27. data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.ico +0 -0
  28. data/node_modules/govuk-frontend/dist/govuk/assets/images/favicon.svg +1 -1
  29. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-180.png +0 -0
  30. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-192.png +0 -0
  31. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-icon-512.png +0 -0
  32. data/node_modules/govuk-frontend/dist/govuk/assets/images/govuk-opengraph-image.png +0 -0
  33. data/node_modules/govuk-frontend/dist/govuk/common/configuration.mjs +29 -2
  34. data/node_modules/govuk-frontend/dist/govuk/common/govuk-frontend-version.mjs +1 -1
  35. data/node_modules/govuk-frontend/dist/govuk/common/index.mjs +4 -10
  36. data/node_modules/govuk-frontend/dist/govuk/components/accordion/_index.scss +18 -15
  37. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.js +14 -137
  38. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.bundle.mjs +14 -137
  39. data/node_modules/govuk-frontend/dist/govuk/components/accordion/accordion.mjs +4 -4
  40. data/node_modules/govuk-frontend/dist/govuk/components/back-link/_index.scss +2 -2
  41. data/node_modules/govuk-frontend/dist/govuk/components/breadcrumbs/_index.scss +2 -2
  42. data/node_modules/govuk-frontend/dist/govuk/components/button/_index.scss +18 -21
  43. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.js +7 -5
  44. data/node_modules/govuk-frontend/dist/govuk/components/button/button.bundle.mjs +7 -5
  45. data/node_modules/govuk-frontend/dist/govuk/components/character-count/_index.scss +2 -2
  46. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.js +30 -143
  47. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.bundle.mjs +30 -143
  48. data/node_modules/govuk-frontend/dist/govuk/components/character-count/character-count.mjs +20 -10
  49. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/_index.scss +7 -6
  50. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.js +10 -5
  51. data/node_modules/govuk-frontend/dist/govuk/components/checkboxes/checkboxes.bundle.mjs +10 -5
  52. data/node_modules/govuk-frontend/dist/govuk/components/cookie-banner/_index.scss +2 -5
  53. data/node_modules/govuk-frontend/dist/govuk/components/date-input/_index.scss +5 -0
  54. data/node_modules/govuk-frontend/dist/govuk/components/details/_index.scss +6 -4
  55. data/node_modules/govuk-frontend/dist/govuk/components/error-message/_index.scss +1 -1
  56. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/_index.scss +4 -2
  57. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.js +8 -12
  58. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.bundle.mjs +8 -12
  59. data/node_modules/govuk-frontend/dist/govuk/components/error-summary/error-summary.mjs +2 -2
  60. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/_index.scss +1 -1
  61. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.js +10 -133
  62. data/node_modules/govuk-frontend/dist/govuk/components/exit-this-page/exit-this-page.bundle.mjs +10 -133
  63. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/_index.scss +30 -38
  64. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.js +46 -140
  65. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.bundle.mjs +46 -140
  66. data/node_modules/govuk-frontend/dist/govuk/components/file-upload/file-upload.mjs +36 -7
  67. data/node_modules/govuk-frontend/dist/govuk/components/footer/_index.scss +30 -27
  68. data/node_modules/govuk-frontend/dist/govuk/components/header/_index.scss +89 -449
  69. data/node_modules/govuk-frontend/dist/govuk/components/hint/_index.scss +1 -1
  70. data/node_modules/govuk-frontend/dist/govuk/components/input/_index.scss +14 -20
  71. data/node_modules/govuk-frontend/dist/govuk/components/inset-text/_index.scss +2 -1
  72. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/_index.scss +10 -8
  73. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.js +7 -5
  74. data/node_modules/govuk-frontend/dist/govuk/components/notification-banner/notification-banner.bundle.mjs +7 -5
  75. data/node_modules/govuk-frontend/dist/govuk/components/pagination/_index.scss +16 -11
  76. data/node_modules/govuk-frontend/dist/govuk/components/panel/_index.scss +4 -4
  77. data/node_modules/govuk-frontend/dist/govuk/components/password-input/_index.scss +2 -2
  78. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.js +10 -133
  79. data/node_modules/govuk-frontend/dist/govuk/components/password-input/password-input.bundle.mjs +10 -133
  80. data/node_modules/govuk-frontend/dist/govuk/components/phase-banner/_index.scss +12 -6
  81. data/node_modules/govuk-frontend/dist/govuk/components/radios/_index.scss +8 -7
  82. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.js +10 -5
  83. data/node_modules/govuk-frontend/dist/govuk/components/radios/radios.bundle.mjs +10 -5
  84. data/node_modules/govuk-frontend/dist/govuk/components/select/_index.scss +6 -11
  85. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/_index.scss +58 -74
  86. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.js +40 -7
  87. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.bundle.mjs +40 -7
  88. data/node_modules/govuk-frontend/dist/govuk/components/service-navigation/service-navigation.mjs +30 -2
  89. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/_index.scss +8 -4
  90. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.js +12 -19
  91. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.bundle.mjs +12 -19
  92. data/node_modules/govuk-frontend/dist/govuk/components/skip-link/skip-link.mjs +3 -9
  93. data/node_modules/govuk-frontend/dist/govuk/components/summary-list/_index.scss +25 -21
  94. data/node_modules/govuk-frontend/dist/govuk/components/table/_index.scss +7 -8
  95. data/node_modules/govuk-frontend/dist/govuk/components/tabs/_index.scss +9 -6
  96. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.js +12 -13
  97. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.bundle.mjs +12 -13
  98. data/node_modules/govuk-frontend/dist/govuk/components/tabs/tabs.mjs +3 -3
  99. data/node_modules/govuk-frontend/dist/govuk/components/tag/_index.scss +66 -31
  100. data/node_modules/govuk-frontend/dist/govuk/components/task-list/_index.scss +7 -5
  101. data/node_modules/govuk-frontend/dist/govuk/components/textarea/_index.scss +5 -10
  102. data/node_modules/govuk-frontend/dist/govuk/components/warning-text/_index.scss +5 -4
  103. data/node_modules/govuk-frontend/dist/govuk/core/_index.scss +0 -1
  104. data/node_modules/govuk-frontend/dist/govuk/core/_lists.scss +2 -2
  105. data/node_modules/govuk-frontend/dist/govuk/core/_section-break.scss +2 -1
  106. data/node_modules/govuk-frontend/dist/govuk/core/_typography.scss +6 -20
  107. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_breakpoints.scss +17 -0
  108. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_frontend-version.scss +15 -0
  109. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_functional-colours.scss +17 -0
  110. data/node_modules/govuk-frontend/dist/govuk/custom-properties/_index.scss +5 -0
  111. data/node_modules/govuk-frontend/dist/govuk/errors/index.mjs +5 -3
  112. data/node_modules/govuk-frontend/dist/govuk/govuk-frontend.min.js +1 -1
  113. data/node_modules/govuk-frontend/dist/govuk/helpers/_colour.scss +187 -72
  114. data/node_modules/govuk-frontend/dist/govuk/helpers/_focused.scss +41 -6
  115. data/node_modules/govuk-frontend/dist/govuk/helpers/_grid.scss +1 -1
  116. data/node_modules/govuk-frontend/dist/govuk/helpers/_links.scss +24 -40
  117. data/node_modules/govuk-frontend/dist/govuk/helpers/_media-queries.scss +172 -33
  118. data/node_modules/govuk-frontend/dist/govuk/helpers/_spacing.scss +1 -1
  119. data/node_modules/govuk-frontend/dist/govuk/helpers/_typography.scss +6 -30
  120. data/node_modules/govuk-frontend/dist/govuk/helpers/_visually-hidden.scss +4 -1
  121. data/node_modules/govuk-frontend/dist/govuk/i18n.mjs +5 -128
  122. data/node_modules/govuk-frontend/dist/govuk/init.mjs +53 -45
  123. data/node_modules/govuk-frontend/dist/govuk/objects/_button-group.scss +1 -1
  124. data/node_modules/govuk-frontend/dist/govuk/objects/_form-group.scss +2 -1
  125. data/node_modules/govuk-frontend/dist/govuk/objects/_main-wrapper.scss +1 -1
  126. data/node_modules/govuk-frontend/dist/govuk/objects/_template.scss +3 -7
  127. data/node_modules/govuk-frontend/dist/govuk/objects/_width-container.scss +2 -2
  128. data/node_modules/govuk-frontend/dist/govuk/overrides/_display.scss +1 -1
  129. data/node_modules/govuk-frontend/dist/govuk/overrides/_typography.scss +0 -2
  130. data/node_modules/govuk-frontend/dist/govuk/overrides/_width.scss +5 -5
  131. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-applied.scss +3 -188
  132. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-functional.scss +366 -0
  133. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-organisations.scss +9 -255
  134. data/node_modules/govuk-frontend/dist/govuk/settings/_colours-palette.scss +117 -25
  135. data/node_modules/govuk-frontend/dist/govuk/settings/_custom-properties.scss +18 -0
  136. data/node_modules/govuk-frontend/dist/govuk/settings/_index.scss +3 -14
  137. data/node_modules/govuk-frontend/dist/govuk/settings/_media-queries.scss +0 -9
  138. data/node_modules/govuk-frontend/dist/govuk/settings/_typography-responsive.scss +12 -189
  139. data/node_modules/govuk-frontend/dist/govuk/tools/_index.scss +0 -1
  140. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-em.scss +4 -2
  141. data/node_modules/govuk-frontend/dist/govuk/tools/_px-to-rem.scss +2 -0
  142. data/package-lock.json +2461 -1150
  143. data/package.json +3 -3
  144. metadata +16 -30
  145. data/node_modules/govuk-frontend/dist/govuk/all.scss +0 -9
  146. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.ico +0 -0
  147. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/favicon.svg +0 -1
  148. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-crest.svg +0 -1
  149. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-180.png +0 -0
  150. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-192.png +0 -0
  151. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-512.png +0 -0
  152. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-icon-mask.svg +0 -1
  153. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/images/govuk-opengraph-image.png +0 -0
  154. data/node_modules/govuk-frontend/dist/govuk/assets/rebrand/manifest.json +0 -39
  155. data/node_modules/govuk-frontend/dist/govuk/components/_all.scss +0 -10
  156. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.js +0 -233
  157. data/node_modules/govuk-frontend/dist/govuk/components/header/header.bundle.mjs +0 -225
  158. data/node_modules/govuk-frontend/dist/govuk/components/header/header.mjs +0 -89
  159. data/node_modules/govuk-frontend/dist/govuk/core/_all.scss +0 -10
  160. data/node_modules/govuk-frontend/dist/govuk/core/_govuk-frontend-properties.scss +0 -15
  161. data/node_modules/govuk-frontend/dist/govuk/helpers/_all.scss +0 -10
  162. data/node_modules/govuk-frontend/dist/govuk/objects/_all.scss +0 -10
  163. data/node_modules/govuk-frontend/dist/govuk/overrides/_all.scss +0 -9
  164. data/node_modules/govuk-frontend/dist/govuk/settings/_all.scss +0 -10
  165. data/node_modules/govuk-frontend/dist/govuk/tools/_all.scss +0 -10
  166. data/node_modules/govuk-frontend/dist/govuk/tools/_rebrand.scss +0 -65
  167. data/node_modules/govuk-frontend/dist/govuk/utilities/_all.scss +0 -10
  168. data/node_modules/govuk-frontend/dist/govuk/vendor/_sass-mq.scss +0 -349
  169. data/node_modules/govuk-frontend/dist/govuk-prototype-kit/functions.js +0 -25
@@ -15,23 +15,16 @@
15
15
  // to dark backgrounds in Firefox (https://bugzil.la/1335476). As
16
16
  // background-color and color need to always be set together, color should
17
17
  // not be set either
18
- border: $govuk-border-width-form-element solid $govuk-input-border-colour;
18
+ border: $govuk-border-width-form-element solid;
19
19
  border-radius: 0;
20
+ border-color: govuk-functional-colour(input-border);
20
21
 
21
22
  // Disable inner shadow and remove rounded corners
22
23
  -webkit-appearance: none;
23
24
  appearance: none;
24
25
 
25
26
  &:focus {
26
- outline: $govuk-focus-width solid $govuk-focus-colour;
27
- // Ensure outline appears outside of the element
28
- outline-offset: 0;
29
- // Double the border by adding its width again. Use `box-shadow` for this
30
- // instead of changing `border-width` - this is for consistency with
31
- // components such as textarea where we avoid changing `border-width` as
32
- // it will change the element size. Also, `outline` cannot be utilised
33
- // here as it is already used for the yellow focus state.
34
- box-shadow: inset 0 0 0 $govuk-border-width-form-element;
27
+ @include govuk-focused-form-input;
35
28
  }
36
29
 
37
30
  &:disabled {
@@ -53,10 +46,10 @@
53
46
  }
54
47
 
55
48
  .govuk-input--error {
56
- border-color: $govuk-error-colour;
49
+ border-color: govuk-functional-colour(error);
57
50
 
58
51
  &:focus {
59
- border-color: $govuk-input-border-colour;
52
+ border-color: govuk-functional-colour(input-border);
60
53
  }
61
54
  }
62
55
 
@@ -109,7 +102,7 @@
109
102
  }
110
103
 
111
104
  // Split prefix/suffix onto separate lines on narrow screens
112
- @include govuk-media-query($until: mobile) {
105
+ @media #{govuk-until-breakpoint(mobile)} {
113
106
  display: block;
114
107
 
115
108
  .govuk-input {
@@ -130,15 +123,16 @@
130
123
  min-width: govuk-px-to-rem(40px);
131
124
  height: govuk-px-to-rem(40px);
132
125
  padding: govuk-spacing(1);
133
- border: $govuk-border-width-form-element solid $govuk-input-border-colour;
134
- background-color: govuk-colour("light-grey");
126
+ border: $govuk-border-width-form-element solid;
127
+ border-color: govuk-functional-colour(input-border);
128
+ background-color: govuk-colour("black", $variant: "tint-95");
135
129
  text-align: center;
136
130
  white-space: nowrap;
137
131
  // Emphasise non-editable status of prefixes and suffixes
138
132
  cursor: default;
139
133
  flex: 0 0 auto;
140
134
  // Split prefix/suffix onto separate lines on narrow screens
141
- @include govuk-media-query($until: mobile) {
135
+ @media #{govuk-until-breakpoint(mobile)} {
142
136
  display: block;
143
137
  height: 100%;
144
138
  white-space: normal;
@@ -146,20 +140,20 @@
146
140
  }
147
141
 
148
142
  .govuk-input__prefix {
149
- @include govuk-media-query($until: mobile) {
143
+ @media #{govuk-until-breakpoint(mobile)} {
150
144
  border-bottom: 0;
151
145
  }
152
- @include govuk-media-query($from: mobile) {
146
+ @media #{govuk-from-breakpoint(mobile)} {
153
147
  border-right: 0;
154
148
  }
155
149
  }
156
150
 
157
151
  // Split prefix/suffix onto separate lines on narrow screens
158
152
  .govuk-input__suffix {
159
- @include govuk-media-query($until: mobile) {
153
+ @media #{govuk-until-breakpoint(mobile)} {
160
154
  border-top: 0;
161
155
  }
162
- @include govuk-media-query($from: mobile) {
156
+ @media #{govuk-from-breakpoint(mobile)} {
163
157
  border-left: 0;
164
158
  }
165
159
  }
@@ -10,7 +10,8 @@
10
10
 
11
11
  clear: both;
12
12
 
13
- border-left: $govuk-border-width-wide solid $govuk-border-colour;
13
+ border-left: $govuk-border-width-wide solid;
14
+ border-left-color: govuk-functional-colour(border);
14
15
 
15
16
  > :first-child {
16
17
  margin-top: 0;
@@ -3,12 +3,14 @@
3
3
  @include govuk-font($size: 19);
4
4
  @include govuk-responsive-margin(8, "bottom");
5
5
 
6
- border: $govuk-border-width solid $govuk-brand-colour;
6
+ border: $govuk-border-width solid;
7
+ border-color: govuk-functional-colour(brand);
7
8
 
8
- background-color: $govuk-brand-colour;
9
+ background-color: govuk-functional-colour(brand);
9
10
 
10
11
  &:focus {
11
- outline: $govuk-focus-width solid $govuk-focus-colour;
12
+ outline: $govuk-focus-width solid;
13
+ outline-color: govuk-functional-colour(focus);
12
14
  }
13
15
  }
14
16
 
@@ -19,7 +21,7 @@
19
21
  // text in high contrast mode
20
22
  border-bottom: 1px solid transparent;
21
23
 
22
- @include govuk-media-query($from: tablet) {
24
+ @media #{govuk-from-breakpoint(tablet)} {
23
25
  padding: 2px govuk-spacing(4) govuk-spacing(1);
24
26
  }
25
27
  }
@@ -39,9 +41,9 @@
39
41
  @include govuk-text-colour;
40
42
  padding: govuk-spacing(3);
41
43
 
42
- background-color: $govuk-body-background-colour;
44
+ background-color: govuk-functional-colour(body-background);
43
45
 
44
- @include govuk-media-query($from: tablet) {
46
+ @media #{govuk-from-breakpoint(tablet)} {
45
47
  padding: $padding-tablet;
46
48
  }
47
49
 
@@ -80,9 +82,9 @@
80
82
  }
81
83
 
82
84
  .govuk-notification-banner--success {
83
- border-color: $govuk-success-colour;
85
+ border-color: govuk-functional-colour(success);
84
86
 
85
- background-color: $govuk-success-colour;
87
+ background-color: govuk-functional-colour(success);
86
88
 
87
89
  .govuk-notification-banner__link {
88
90
  @include govuk-link-style-success;
@@ -60,9 +60,6 @@
60
60
  * @typedef ComponentWithModuleName
61
61
  * @property {string} moduleName - Name of the component
62
62
  */
63
- /**
64
- * @import { ObjectNested } from './configuration.mjs'
65
- */
66
63
 
67
64
  class GOVUKFrontendError extends Error {
68
65
  constructor(...args) {
@@ -91,7 +88,7 @@
91
88
  class ElementError extends GOVUKFrontendError {
92
89
  constructor(messageOrOptions) {
93
90
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
94
- if (typeof messageOrOptions === 'object') {
91
+ if (isObject(messageOrOptions)) {
95
92
  const {
96
93
  component,
97
94
  identifier,
@@ -100,7 +97,9 @@
100
97
  } = messageOrOptions;
101
98
  message = identifier;
102
99
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
103
- message = formatErrorMessage(component, message);
100
+ if (component) {
101
+ message = formatErrorMessage(component, message);
102
+ }
104
103
  }
105
104
  super(message);
106
105
  this.name = 'ElementError';
@@ -314,6 +313,9 @@
314
313
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
315
314
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
316
315
  */
316
+ /**
317
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
318
+ */
317
319
 
318
320
  /**
319
321
  * Notification Banner component
@@ -54,9 +54,6 @@ function formatErrorMessage(Component, message) {
54
54
  * @typedef ComponentWithModuleName
55
55
  * @property {string} moduleName - Name of the component
56
56
  */
57
- /**
58
- * @import { ObjectNested } from './configuration.mjs'
59
- */
60
57
 
61
58
  class GOVUKFrontendError extends Error {
62
59
  constructor(...args) {
@@ -85,7 +82,7 @@ class ConfigError extends GOVUKFrontendError {
85
82
  class ElementError extends GOVUKFrontendError {
86
83
  constructor(messageOrOptions) {
87
84
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
88
- if (typeof messageOrOptions === 'object') {
85
+ if (isObject(messageOrOptions)) {
89
86
  const {
90
87
  component,
91
88
  identifier,
@@ -94,7 +91,9 @@ class ElementError extends GOVUKFrontendError {
94
91
  } = messageOrOptions;
95
92
  message = identifier;
96
93
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
97
- message = formatErrorMessage(component, message);
94
+ if (component) {
95
+ message = formatErrorMessage(component, message);
96
+ }
98
97
  }
99
98
  super(message);
100
99
  this.name = 'ElementError';
@@ -308,6 +307,9 @@ function extractConfigByNamespace(schema, dataset, namespace) {
308
307
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
309
308
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
310
309
  */
310
+ /**
311
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
312
+ */
311
313
 
312
314
  /**
313
315
  * Notification Banner component
@@ -8,7 +8,7 @@
8
8
  align-items: center;
9
9
  flex-wrap: wrap;
10
10
 
11
- @include govuk-media-query($from: tablet) {
11
+ @media #{govuk-from-breakpoint(tablet)} {
12
12
  flex-direction: row;
13
13
  align-items: flex-start;
14
14
  }
@@ -32,7 +32,7 @@
32
32
  float: left; // Float is ignored if flex is active for prev/next links
33
33
 
34
34
  &:hover {
35
- background-color: govuk-colour("light-grey");
35
+ background-color: govuk-colour("black", $variant: "tint-95");
36
36
  }
37
37
  }
38
38
 
@@ -45,7 +45,7 @@
45
45
  // visually sit in the middle of their touch area
46
46
  text-align: center;
47
47
 
48
- @include govuk-media-query($from: tablet) {
48
+ @media #{govuk-from-breakpoint(tablet)} {
49
49
  display: block;
50
50
  }
51
51
  }
@@ -72,7 +72,7 @@
72
72
 
73
73
  // Only show first, last and non-link items on mobile
74
74
  .govuk-pagination__item--current,
75
- .govuk-pagination__item--ellipses,
75
+ .govuk-pagination__item--ellipsis,
76
76
  .govuk-pagination__item:first-child,
77
77
  .govuk-pagination__item:last-child {
78
78
  display: block;
@@ -81,10 +81,10 @@
81
81
  .govuk-pagination__item--current {
82
82
  @include govuk-typography-weight-bold;
83
83
  outline: 1px solid transparent;
84
- background-color: $govuk-link-colour;
84
+ background-color: govuk-functional-colour(link);
85
85
 
86
86
  &:hover {
87
- background-color: $govuk-link-colour;
87
+ background-color: govuk-functional-colour(link);
88
88
  }
89
89
 
90
90
  .govuk-pagination__link {
@@ -92,9 +92,9 @@
92
92
  }
93
93
  }
94
94
 
95
- .govuk-pagination__item--ellipses {
95
+ .govuk-pagination__item--ellipsis {
96
96
  @include govuk-typography-weight-bold;
97
- color: $govuk-secondary-text-colour;
97
+ color: govuk-functional-colour(secondary-text);
98
98
 
99
99
  // Remove hover state for ellipsis items as they don't contain links
100
100
  &:hover {
@@ -134,7 +134,7 @@
134
134
 
135
135
  &:focus {
136
136
  .govuk-pagination__icon {
137
- color: $govuk-focus-text-colour;
137
+ color: govuk-functional-colour(focus-text);
138
138
  }
139
139
 
140
140
  .govuk-pagination__link-label {
@@ -147,6 +147,10 @@
147
147
  }
148
148
  }
149
149
 
150
+ .govuk-pagination__link-title {
151
+ text-decoration-thickness: inherit;
152
+ }
153
+
150
154
  .govuk-pagination__link-label {
151
155
  @include govuk-typography-weight-regular;
152
156
  @include govuk-link-decoration;
@@ -157,7 +161,7 @@
157
161
  // Set size using rems to make the icon scale with text
158
162
  width: govuk-px-to-rem(15px);
159
163
  height: govuk-px-to-rem(13px);
160
- color: $govuk-secondary-text-colour;
164
+ color: govuk-functional-colour(secondary-text);
161
165
  fill: currentcolor;
162
166
  forced-color-adjust: auto;
163
167
  }
@@ -190,7 +194,8 @@
190
194
 
191
195
  // Only apply a border between prev and next if both are present
192
196
  .govuk-pagination__prev + .govuk-pagination__next {
193
- border-top: 1px solid $govuk-border-colour;
197
+ border-top: 1px solid;
198
+ border-top-color: govuk-functional-colour(border);
194
199
  }
195
200
 
196
201
  // Set the after pseudo element to a block which makes the title visually
@@ -11,8 +11,8 @@
11
11
 
12
12
  text-align: center;
13
13
 
14
- @include govuk-media-query($until: tablet) {
15
- padding: govuk-spacing(if($govuk-new-typography-scale, 4, 3)) - $govuk-border-width;
14
+ @media #{govuk-until-breakpoint(tablet)} {
15
+ padding: govuk-spacing(4) - $govuk-border-width;
16
16
 
17
17
  // This is an if-all-else-fails attempt to stop long words from
18
18
  // overflowing the container on very narrow viewports by forcing them to
@@ -36,9 +36,9 @@
36
36
  color: govuk-colour("white");
37
37
  background: govuk-colour("green");
38
38
 
39
- @include govuk-media-query($media-type: print) {
39
+ @media print {
40
40
  border-color: currentcolor;
41
- color: $govuk-print-text-colour;
41
+ color: govuk-functional-colour(print-text);
42
42
  background: none;
43
43
  }
44
44
  }
@@ -8,7 +8,7 @@
8
8
  // breakpoint
9
9
  // - being display: flex above the mobile breakpoint
10
10
 
11
- @include govuk-media-query($from: mobile) {
11
+ @media #{govuk-from-breakpoint(mobile)} {
12
12
  flex-direction: row;
13
13
 
14
14
  // The default of `stretch` makes the toggle button appear taller than the
@@ -41,7 +41,7 @@
41
41
  display: none;
42
42
  }
43
43
 
44
- @include govuk-media-query($from: mobile) {
44
+ @media #{govuk-from-breakpoint(mobile)} {
45
45
  // Buttons are normally 100% wide on mobile, but we don't want that here
46
46
  width: auto;
47
47
  flex-shrink: 0;
@@ -41,9 +41,6 @@
41
41
  * @typedef ComponentWithModuleName
42
42
  * @property {string} moduleName - Name of the component
43
43
  */
44
- /**
45
- * @import { ObjectNested } from './configuration.mjs'
46
- */
47
44
 
48
45
  class GOVUKFrontendError extends Error {
49
46
  constructor(...args) {
@@ -72,7 +69,7 @@
72
69
  class ElementError extends GOVUKFrontendError {
73
70
  constructor(messageOrOptions) {
74
71
  let message = typeof messageOrOptions === 'string' ? messageOrOptions : '';
75
- if (typeof messageOrOptions === 'object') {
72
+ if (isObject(messageOrOptions)) {
76
73
  const {
77
74
  component,
78
75
  identifier,
@@ -81,7 +78,9 @@
81
78
  } = messageOrOptions;
82
79
  message = identifier;
83
80
  message += element ? ` is not of type ${expectedType != null ? expectedType : 'HTMLElement'}` : ' not found';
84
- message = formatErrorMessage(component, message);
81
+ if (component) {
82
+ message = formatErrorMessage(component, message);
83
+ }
85
84
  }
86
85
  super(message);
87
86
  this.name = 'ElementError';
@@ -295,6 +294,9 @@
295
294
  * @template {Partial<Record<keyof ConfigurationType, unknown>>} [ConfigurationType=ObjectNested]
296
295
  * @typedef {typeof Component & ChildClass<ConfigurationType>} ChildClassConstructor<ConfigurationType>
297
296
  */
297
+ /**
298
+ * @import { CompatibleClass, Config, CreateAllOptions, OnErrorCallback } from '../init.mjs'
299
+ */
298
300
 
299
301
  class I18n {
300
302
  constructor(translations = {}, config = {}) {
@@ -309,7 +311,7 @@
309
311
  throw new Error('i18n: lookup key missing');
310
312
  }
311
313
  let translation = this.translations[lookupKey];
312
- if (typeof (options == null ? void 0 : options.count) === 'number' && typeof translation === 'object') {
314
+ if (typeof (options == null ? void 0 : options.count) === 'number' && isObject(translation)) {
313
315
  const translationPluralForm = translation[this.getPluralSuffix(lookupKey, options.count)];
314
316
  if (translationPluralForm) {
315
317
  translation = translationPluralForm;
@@ -351,8 +353,8 @@
351
353
  return 'other';
352
354
  }
353
355
  const translation = this.translations[lookupKey];
354
- const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : this.selectPluralFormUsingFallbackRules(count);
355
- if (typeof translation === 'object') {
356
+ const preferredForm = this.hasIntlPluralRulesSupport() ? new Intl.PluralRules(this.locale).select(count) : 'other';
357
+ if (isObject(translation)) {
356
358
  if (preferredForm in translation) {
357
359
  return preferredForm;
358
360
  } else if ('other' in translation) {
@@ -362,132 +364,7 @@
362
364
  }
363
365
  throw new Error(`i18n: Plural form ".other" is required for "${this.locale}" locale`);
364
366
  }
365
- selectPluralFormUsingFallbackRules(count) {
366
- count = Math.abs(Math.floor(count));
367
- const ruleset = this.getPluralRulesForLocale();
368
- if (ruleset) {
369
- return I18n.pluralRules[ruleset](count);
370
- }
371
- return 'other';
372
- }
373
- getPluralRulesForLocale() {
374
- const localeShort = this.locale.split('-')[0];
375
- for (const pluralRule in I18n.pluralRulesMap) {
376
- const languages = I18n.pluralRulesMap[pluralRule];
377
- if (languages.includes(this.locale) || languages.includes(localeShort)) {
378
- return pluralRule;
379
- }
380
- }
381
- }
382
367
  }
383
- I18n.pluralRulesMap = {
384
- arabic: ['ar'],
385
- chinese: ['my', 'zh', 'id', 'ja', 'jv', 'ko', 'ms', 'th', 'vi'],
386
- french: ['hy', 'bn', 'fr', 'gu', 'hi', 'fa', 'pa', 'zu'],
387
- german: ['af', 'sq', 'az', 'eu', 'bg', 'ca', 'da', 'nl', 'en', 'et', 'fi', 'ka', 'de', 'el', 'hu', 'lb', 'no', 'so', 'sw', 'sv', 'ta', 'te', 'tr', 'ur'],
388
- irish: ['ga'],
389
- russian: ['ru', 'uk'],
390
- scottish: ['gd'],
391
- spanish: ['pt-PT', 'it', 'es'],
392
- welsh: ['cy']
393
- };
394
- I18n.pluralRules = {
395
- arabic(n) {
396
- if (n === 0) {
397
- return 'zero';
398
- }
399
- if (n === 1) {
400
- return 'one';
401
- }
402
- if (n === 2) {
403
- return 'two';
404
- }
405
- if (n % 100 >= 3 && n % 100 <= 10) {
406
- return 'few';
407
- }
408
- if (n % 100 >= 11 && n % 100 <= 99) {
409
- return 'many';
410
- }
411
- return 'other';
412
- },
413
- chinese() {
414
- return 'other';
415
- },
416
- french(n) {
417
- return n === 0 || n === 1 ? 'one' : 'other';
418
- },
419
- german(n) {
420
- return n === 1 ? 'one' : 'other';
421
- },
422
- irish(n) {
423
- if (n === 1) {
424
- return 'one';
425
- }
426
- if (n === 2) {
427
- return 'two';
428
- }
429
- if (n >= 3 && n <= 6) {
430
- return 'few';
431
- }
432
- if (n >= 7 && n <= 10) {
433
- return 'many';
434
- }
435
- return 'other';
436
- },
437
- russian(n) {
438
- const lastTwo = n % 100;
439
- const last = lastTwo % 10;
440
- if (last === 1 && lastTwo !== 11) {
441
- return 'one';
442
- }
443
- if (last >= 2 && last <= 4 && !(lastTwo >= 12 && lastTwo <= 14)) {
444
- return 'few';
445
- }
446
- if (last === 0 || last >= 5 && last <= 9 || lastTwo >= 11 && lastTwo <= 14) {
447
- return 'many';
448
- }
449
- return 'other';
450
- },
451
- scottish(n) {
452
- if (n === 1 || n === 11) {
453
- return 'one';
454
- }
455
- if (n === 2 || n === 12) {
456
- return 'two';
457
- }
458
- if (n >= 3 && n <= 10 || n >= 13 && n <= 19) {
459
- return 'few';
460
- }
461
- return 'other';
462
- },
463
- spanish(n) {
464
- if (n === 1) {
465
- return 'one';
466
- }
467
- if (n % 1000000 === 0 && n !== 0) {
468
- return 'many';
469
- }
470
- return 'other';
471
- },
472
- welsh(n) {
473
- if (n === 0) {
474
- return 'zero';
475
- }
476
- if (n === 1) {
477
- return 'one';
478
- }
479
- if (n === 2) {
480
- return 'two';
481
- }
482
- if (n === 3) {
483
- return 'few';
484
- }
485
- if (n === 6) {
486
- return 'many';
487
- }
488
- return 'other';
489
- }
490
- };
491
368
 
492
369
  /**
493
370
  * Password input component