govuk_publishing_components 28.2.0 → 28.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-scroll-tracker.js +2 -1
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +22 -22
  5. data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +9 -5
  6. data/app/assets/javascripts/govuk_publishing_components/analytics/track-click.js +4 -3
  7. data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +4 -3
  8. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +21 -291
  9. data/app/assets/javascripts/govuk_publishing_components/components/button.js +1 -1
  10. data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +1 -1
  11. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -2
  12. data/app/assets/javascripts/govuk_publishing_components/components/details.js +3 -4
  13. data/app/assets/javascripts/govuk_publishing_components/components/error-summary.js +1 -1
  14. data/app/assets/javascripts/govuk_publishing_components/components/layout-header.js +1 -1
  15. data/app/assets/javascripts/govuk_publishing_components/components/radio.js +1 -1
  16. data/app/assets/javascripts/govuk_publishing_components/components/skip-link.js +5 -0
  17. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +40 -37
  18. data/app/assets/javascripts/govuk_publishing_components/components/tabs.js +1 -1
  19. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js +4 -3
  20. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +8 -10
  21. data/app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js +4 -3
  22. data/app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js +4 -3
  23. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +4 -3
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -329
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +5 -2
  26. data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +0 -5
  27. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +67 -21
  28. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +3 -3
  29. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +95 -56
  30. data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +6 -17
  31. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +0 -9
  32. data/app/views/govuk_publishing_components/components/_accordion.html.erb +30 -15
  33. data/app/views/govuk_publishing_components/components/_action_link.html.erb +1 -1
  34. data/app/views/govuk_publishing_components/components/_big_number.html.erb +12 -8
  35. data/app/views/govuk_publishing_components/components/_button.html.erb +1 -1
  36. data/app/views/govuk_publishing_components/components/_character_count.html.erb +2 -2
  37. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -2
  38. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +0 -4
  39. data/app/views/govuk_publishing_components/components/_details.html.erb +1 -1
  40. data/app/views/govuk_publishing_components/components/_error_message.html.erb +1 -1
  41. data/app/views/govuk_publishing_components/components/_error_summary.html.erb +0 -1
  42. data/app/views/govuk_publishing_components/components/_heading.html.erb +1 -1
  43. data/app/views/govuk_publishing_components/components/_hint.html.erb +1 -1
  44. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +12 -1
  45. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +1 -1
  46. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +22 -18
  47. data/app/views/govuk_publishing_components/components/_list.html.erb +1 -1
  48. data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +1 -1
  49. data/app/views/govuk_publishing_components/components/_notice.html.erb +1 -1
  50. data/app/views/govuk_publishing_components/components/_print_link.html.erb +2 -2
  51. data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -1
  52. data/app/views/govuk_publishing_components/components/_search.html.erb +2 -2
  53. data/app/views/govuk_publishing_components/components/_select.html.erb +19 -1
  54. data/app/views/govuk_publishing_components/components/_share_links.html.erb +25 -22
  55. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +1 -1
  56. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +1 -1
  57. data/app/views/govuk_publishing_components/components/_textarea.html.erb +1 -1
  58. data/app/views/govuk_publishing_components/components/_title.html.erb +3 -3
  59. data/app/views/govuk_publishing_components/components/docs/accordion.yml +2 -97
  60. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +0 -47
  61. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +1 -1
  62. data/app/views/govuk_publishing_components/components/docs/inset_text.yml +6 -0
  63. data/app/views/govuk_publishing_components/components/docs/select.yml +12 -0
  64. data/app/views/govuk_publishing_components/components/docs/share_links.yml +1 -1
  65. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +13 -13
  66. data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
  67. data/app/views/govuk_publishing_components/components/docs/textarea.yml +1 -1
  68. data/app/views/govuk_publishing_components/components/feedback/_problem_form.html.erb +26 -0
  69. data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +14 -8
  70. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +11 -11
  71. data/config/locales/ar.yml +2 -0
  72. data/config/locales/az.yml +2 -1
  73. data/config/locales/be.yml +2 -0
  74. data/config/locales/bg.yml +2 -0
  75. data/config/locales/bn.yml +2 -0
  76. data/config/locales/cs.yml +2 -0
  77. data/config/locales/cy.yml +2 -0
  78. data/config/locales/da.yml +2 -0
  79. data/config/locales/de.yml +2 -0
  80. data/config/locales/dr.yml +2 -0
  81. data/config/locales/el.yml +2 -0
  82. data/config/locales/en.yml +0 -4
  83. data/config/locales/es-419.yml +2 -0
  84. data/config/locales/es.yml +2 -0
  85. data/config/locales/et.yml +2 -0
  86. data/config/locales/fa.yml +2 -1
  87. data/config/locales/fi.yml +2 -0
  88. data/config/locales/fr.yml +2 -0
  89. data/config/locales/gd.yml +2 -0
  90. data/config/locales/gu.yml +2 -0
  91. data/config/locales/he.yml +2 -0
  92. data/config/locales/hi.yml +2 -0
  93. data/config/locales/hr.yml +2 -0
  94. data/config/locales/hu.yml +2 -0
  95. data/config/locales/hy.yml +2 -0
  96. data/config/locales/id.yml +2 -1
  97. data/config/locales/is.yml +2 -0
  98. data/config/locales/it.yml +2 -0
  99. data/config/locales/ja.yml +2 -1
  100. data/config/locales/ka.yml +2 -0
  101. data/config/locales/kk.yml +2 -0
  102. data/config/locales/ko.yml +2 -1
  103. data/config/locales/lt.yml +2 -0
  104. data/config/locales/lv.yml +2 -0
  105. data/config/locales/ms.yml +2 -1
  106. data/config/locales/mt.yml +2 -0
  107. data/config/locales/nl.yml +2 -0
  108. data/config/locales/no.yml +2 -0
  109. data/config/locales/pa-pk.yml +2 -0
  110. data/config/locales/pa.yml +2 -0
  111. data/config/locales/pl.yml +2 -0
  112. data/config/locales/ps.yml +2 -0
  113. data/config/locales/pt.yml +2 -0
  114. data/config/locales/ro.yml +2 -0
  115. data/config/locales/ru.yml +2 -0
  116. data/config/locales/si.yml +2 -0
  117. data/config/locales/sk.yml +2 -0
  118. data/config/locales/sl.yml +2 -0
  119. data/config/locales/so.yml +2 -0
  120. data/config/locales/sq.yml +2 -0
  121. data/config/locales/sr.yml +2 -1
  122. data/config/locales/sv.yml +2 -0
  123. data/config/locales/sw.yml +2 -0
  124. data/config/locales/ta.yml +2 -0
  125. data/config/locales/th.yml +2 -1
  126. data/config/locales/tk.yml +2 -0
  127. data/config/locales/tr.yml +2 -0
  128. data/config/locales/uk.yml +2 -0
  129. data/config/locales/ur.yml +2 -0
  130. data/config/locales/uz.yml +2 -0
  131. data/config/locales/vi.yml +2 -1
  132. data/config/locales/zh-hk.yml +2 -1
  133. data/config/locales/zh-tw.yml +2 -1
  134. data/config/locales/zh.yml +2 -1
  135. data/lib/govuk_publishing_components/presenters/big_number_helper.rb +30 -0
  136. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +0 -38
  137. data/lib/govuk_publishing_components/version.rb +1 -1
  138. data/lib/govuk_publishing_components.rb +1 -0
  139. data/node_modules/govuk-frontend/govuk/all.js +294 -76
  140. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +274 -99
  141. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +169 -65
  142. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +37 -5
  143. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +4 -4
  144. data/node_modules/govuk-frontend/govuk/components/button/button.js +2 -2
  145. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +3 -3
  146. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +15 -2
  147. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +8 -10
  148. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +52 -15
  149. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +0 -2
  150. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +31 -0
  151. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +25 -25
  152. data/node_modules/govuk-frontend/govuk/components/details/details.js +2 -2
  153. data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +1 -0
  154. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +8 -8
  155. data/node_modules/govuk-frontend/govuk/components/error-message/template.njk +2 -2
  156. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +24 -3
  157. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +25 -16
  158. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +6 -0
  159. data/node_modules/govuk-frontend/govuk/components/error-summary/template.njk +2 -1
  160. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +4 -4
  161. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +3 -37
  162. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +119 -15
  163. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +6 -0
  164. data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
  165. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +10 -4
  166. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +11 -11
  167. data/node_modules/govuk-frontend/govuk/components/header/header.js +4 -4
  168. data/node_modules/govuk-frontend/govuk/components/header/template.njk +4 -3
  169. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +1 -3
  170. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +1 -1
  171. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +40 -40
  172. data/node_modules/govuk-frontend/govuk/components/input/template.njk +4 -3
  173. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +499 -2
  174. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +2 -2
  175. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +0 -8
  176. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +44 -45
  177. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +4 -4
  178. data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -9
  179. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +6 -1
  180. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +3 -3
  181. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +13 -0
  182. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +9 -9
  183. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1108 -0
  184. data/node_modules/govuk-frontend/govuk/components/skip-link/template.njk +1 -1
  185. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +20 -23
  186. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +86 -1
  187. data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +1 -4
  188. data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +2 -2
  189. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +2 -2
  190. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +0 -5
  191. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +2 -2
  192. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +1 -1
  193. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +4 -4
  194. data/node_modules/govuk-frontend/govuk/core/_all.scss +0 -1
  195. data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +0 -6
  196. data/node_modules/govuk-frontend/govuk/core/_links.scss +0 -6
  197. data/node_modules/govuk-frontend/govuk/core/_lists.scss +0 -6
  198. data/node_modules/govuk-frontend/govuk/core/_section-break.scss +0 -6
  199. data/node_modules/govuk-frontend/govuk/core/_typography.scss +0 -6
  200. data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
  201. data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +15 -30
  202. data/node_modules/govuk-frontend/govuk/{core → objects}/_template.scss +1 -5
  203. data/node_modules/govuk-frontend/govuk/overrides/_display.scss +0 -6
  204. data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +0 -6
  205. data/node_modules/govuk-frontend/govuk/overrides/_text-align.scss +0 -6
  206. data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +0 -6
  207. data/node_modules/govuk-frontend/govuk/overrides/_width.scss +0 -6
  208. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +3 -0
  209. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +0 -10
  210. data/node_modules/govuk-frontend/govuk/tools/_all.scss +0 -1
  211. data/node_modules/govuk-frontend/package.json +1 -1
  212. metadata +11 -16
  213. data/app/views/govuk_publishing_components/components/contextual_sidebar/_covid_cta.html.erb +0 -27
  214. data/node_modules/govuk-frontend/govuk/tools/_iff.scss +0 -17
@@ -40,15 +40,6 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
40
40
  this.$module.sessionStoreLink = this.$module.sessionStoreLink + '_' + this.$module.uniqueId
41
41
  }
42
42
 
43
- this.$module.upChevronSvg = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">' +
44
- '<path class="gem-c-step-nav__chevron-stroke" d="M19.5 10C19.5 15.2467 15.2467 19.5 10 19.5C4.75329 19.5 0.499997 15.2467 0.499998 10C0.499999 4.7533 4.7533 0.500001 10 0.500002C15.2467 0.500003 19.5 4.7533 19.5 10Z" stroke="#1D70B8"/>' +
45
- '<path class="gem-c-step-nav__chevron-stroke" d="M6.32617 12.3262L10 8.65234L13.6738 12.3262" stroke="#1D70B8" stroke-width="2"/>' +
46
- '</svg>'
47
- this.$module.downChevronSvg = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">' +
48
- '<path class="gem-c-step-nav__chevron-stroke" d="M0.499997 10C0.499998 4.75329 4.75329 0.499999 10 0.499999C15.2467 0.5 19.5 4.75329 19.5 10C19.5 15.2467 15.2467 19.5 10 19.5C4.75329 19.5 0.499997 15.2467 0.499997 10Z" stroke="#1D70B8"/>' +
49
- '<path class="gem-c-step-nav__chevron-stroke" d="M13.6738 8.67383L10 12.3477L6.32617 8.67383" stroke="#1D70B8" stroke-width="2"/>' +
50
- '</svg>'
51
-
52
43
  var stepNavTracker = new this.StepNavTracker(this.$module.uniqueId, this.$module.totalSteps, this.$module.totalLinks)
53
44
 
54
45
  this.getTextForInsertedElements()
@@ -73,16 +64,19 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
73
64
  }
74
65
 
75
66
  Gemstepnav.prototype.addShowHideAllButton = function () {
76
- var showall = document.createElement('div')
77
- showall.className = 'gem-c-step-nav__controls govuk-!-display-none-print'
78
- showall.innerHTML = '<button aria-expanded="false" class="gem-c-step-nav__button gem-c-step-nav__button--controls js-step-controls-button">' +
79
- '<span class="gem-c-step-nav__button-text gem-c-step-nav__button-text--all js-step-controls-button-text">' + this.$module.actions.showAllText + '</span>' +
80
- '<span class="gem-c-step-nav__chevron js-step-controls-button-icon">' + this.$module.downChevronSvg + '</span>' +
81
- '</button>'
82
-
67
+ var showAll = document.createElement('div')
83
68
  var steps = this.$module.querySelectorAll('.gem-c-step-nav__steps')[0]
84
- this.$module.insertBefore(showall, steps)
85
69
 
70
+ showAll.className = 'gem-c-step-nav__controls govuk-!-display-none-print'
71
+ showAll.innerHTML =
72
+ '<button aria-expanded="false" class="gem-c-step-nav__button gem-c-step-nav__button--controls js-step-controls-button">' +
73
+ '<span class="gem-c-step-nav__chevron gem-c-step-nav__chevron--down js-step-controls-button-icon"></span>' +
74
+ '<span class="gem-c-step-nav__button-text gem-c-step-nav__button-text--all js-step-controls-button-text">' +
75
+ this.$module.actions.showAllText +
76
+ '</span>' +
77
+ '</button>'
78
+
79
+ this.$module.insertBefore(showAll, steps)
86
80
  this.$module.showOrHideAllButton = this.$module.querySelectorAll('.js-step-controls-button')[0]
87
81
  }
88
82
 
@@ -91,30 +85,26 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
91
85
  var thisel = this.$module.stepHeaders[i]
92
86
 
93
87
  if (!thisel.querySelectorAll('.js-toggle-link').length) {
94
- var span = document.createElement('span')
95
88
  var showHideSpan = document.createElement('span')
96
89
  var showHideSpanText = document.createElement('span')
97
90
  var showHideSpanIcon = document.createElement('span')
98
- var commaSpan = document.createElement('span')
91
+ var showHideSpanFocus = document.createElement('span')
99
92
  var thisSectionSpan = document.createElement('span')
100
93
 
101
94
  showHideSpan.className = 'gem-c-step-nav__toggle-link js-toggle-link govuk-!-display-none-print'
102
95
  showHideSpanText.className = 'gem-c-step-nav__button-text js-toggle-link-text'
103
96
  showHideSpanIcon.className = 'gem-c-step-nav__chevron js-toggle-link-icon'
104
- commaSpan.className = 'govuk-visually-hidden'
97
+ showHideSpanFocus.className = 'gem-c-step-nav__toggle-link-focus'
105
98
  thisSectionSpan.className = 'govuk-visually-hidden'
106
99
 
107
- showHideSpan.appendChild(showHideSpanText)
108
- showHideSpan.appendChild(showHideSpanIcon)
100
+ showHideSpan.appendChild(showHideSpanFocus)
101
+ showHideSpanFocus.appendChild(showHideSpanIcon)
102
+ showHideSpanFocus.appendChild(showHideSpanText)
109
103
 
110
- commaSpan.innerHTML = ', '
111
104
  thisSectionSpan.innerHTML = ' this section'
105
+ showHideSpan.appendChild(thisSectionSpan)
112
106
 
113
- span.appendChild(commaSpan)
114
- span.appendChild(showHideSpan)
115
- span.appendChild(thisSectionSpan)
116
-
117
- thisel.querySelectorAll('.js-step-title-button')[0].appendChild(span)
107
+ thisel.querySelectorAll('.js-step-title-button')[0].appendChild(showHideSpan)
118
108
  }
119
109
  }
120
110
  }
@@ -125,6 +115,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
125
115
 
126
116
  Gemstepnav.prototype.addAriaControlsAttrForShowHideAllButton = function () {
127
117
  var ariaControlsValue = this.$module.querySelectorAll('.js-panel')[0].getAttribute('id')
118
+
128
119
  this.$module.showOrHideAllButton.setAttribute('aria-controls', ariaControlsValue)
129
120
  }
130
121
 
@@ -184,7 +175,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
184
175
  '<button ' +
185
176
  'class="gem-c-step-nav__button gem-c-step-nav__button--title js-step-title-button" ' +
186
177
  'aria-expanded="false" aria-controls="' + contentId + '">' +
187
- '<span class="gem-c-step-nav__title-text js-step-title-text">' + titleText + '</span>' +
178
+ '<span class="gem-c-step-nav____title-text-focus">' +
179
+ '<span class="gem-c-step-nav__title-text js-step-title-text">' + titleText + '</span>' +
180
+ '<span class="govuk-visually-hidden gem-c-step-nav__section-heading-divider">, </span>' +
181
+ '</span>' +
188
182
  '</button>' +
189
183
  '</span>'
190
184
  }
@@ -358,12 +352,18 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
358
352
 
359
353
  Gemstepnav.prototype.setShowHideAllText = function () {
360
354
  var shownSteps = this.$module.querySelectorAll('.step-is-shown').length
361
-
355
+ var showAllChevon = this.$module.showOrHideAllButton.querySelector('.js-step-controls-button-icon')
356
+ var showAllButtonText = this.$module.showOrHideAllButton.querySelector('.js-step-controls-button-text')
362
357
  // Find out if the number of is-opens == total number of steps
363
358
  var shownStepsIsTotalSteps = shownSteps === this.$module.totalSteps
364
359
 
365
- this.$module.showOrHideAllButton.querySelector('.js-step-controls-button-text').innerHTML = shownStepsIsTotalSteps ? this.$module.actions.hideAllText : this.$module.actions.showAllText
366
- this.$module.showOrHideAllButton.querySelector('.js-step-controls-button-icon').innerHTML = shownStepsIsTotalSteps ? this.$module.upChevronSvg : this.$module.downChevronSvg
360
+ if (shownStepsIsTotalSteps) {
361
+ showAllButtonText.innerHTML = this.$module.actions.hideAllText
362
+ showAllChevon.classList.remove('gem-c-step-nav__chevron--down')
363
+ } else {
364
+ showAllButtonText.innerHTML = this.$module.actions.showAllText
365
+ showAllChevon.classList.add('gem-c-step-nav__chevron--down')
366
+ }
367
367
  }
368
368
 
369
369
  Gemstepnav.prototype.StepView = function (stepElement, $module) {
@@ -391,19 +391,22 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
391
391
  }
392
392
 
393
393
  this.setIsShown = function (isShown) {
394
+ var toggleLink = this.stepElement.querySelectorAll('.js-toggle-link')[0]
395
+ var toggleLinkText = toggleLink.querySelector('.js-toggle-link-text')
396
+ var stepChevron = toggleLink.querySelector('.js-toggle-link-icon')
397
+
394
398
  if (isShown) {
395
399
  this.stepElement.classList.add('step-is-shown')
396
400
  this.stepContent.classList.remove('js-hidden')
401
+ toggleLinkText.innerHTML = this.hideText
402
+ stepChevron.classList.remove('gem-c-step-nav__chevron--down')
397
403
  } else {
398
404
  this.stepElement.classList.remove('step-is-shown')
399
405
  this.stepContent.classList.add('js-hidden')
406
+ toggleLinkText.innerHTML = this.showText
407
+ stepChevron.classList.add('gem-c-step-nav__chevron--down')
400
408
  }
401
-
402
409
  this.titleButton.setAttribute('aria-expanded', isShown)
403
- var showHideText = this.stepElement.querySelectorAll('.js-toggle-link')[0]
404
-
405
- showHideText.querySelector('.js-toggle-link-text').innerHTML = isShown ? this.hideText : this.showText
406
- showHideText.querySelector('.js-toggle-link-icon').innerHTML = isShown ? this.upChevronSvg : this.downChevronSvg
407
410
  }
408
411
 
409
412
  this.isShown = function () {
@@ -2,4 +2,4 @@
2
2
  // = require govuk/components/tabs/tabs.js
3
3
  window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {}
5
- window.GOVUK.Modules.GovukTabs = window.GOVUKFrontend
5
+ window.GOVUK.Modules.GovukTabs = window.GOVUKFrontend.Tabs
@@ -2,7 +2,7 @@
2
2
 
3
3
  window.GOVUK = window.GOVUK || {};
4
4
 
5
- (function (GOVUK, $) {
5
+ (function (GOVUK) {
6
6
  'use strict'
7
7
 
8
8
  var BarchartEnhancement = function ($element) {
@@ -24,10 +24,11 @@ window.GOVUK = window.GOVUK || {};
24
24
 
25
25
  for (var i = 0; i < $barcharts.length; i++) {
26
26
  var $table = $barcharts[i]
27
- new GOVUK.Modules.MagnaCharta().start($table, { toggleText: 'Change between chart and table' })
27
+ var magna = new GOVUK.Modules.MagnaCharta($table, { toggleText: 'Change between chart and table' })
28
+ magna.init()
28
29
  $table.className = $table.className + ' js-barchart-table-init'
29
30
  }
30
31
  }
31
32
 
32
33
  GOVUK.GovspeakBarchartEnhancement = BarchartEnhancement
33
- }(window.GOVUK, window.jQuery))
34
+ }(window.GOVUK))
@@ -4,10 +4,8 @@ window.GOVUK = window.GOVUK || {}
4
4
  window.GOVUK.Modules = window.GOVUK.Modules || {};
5
5
 
6
6
  (function (Modules) {
7
- function MagnaCharta () { }
8
-
9
- MagnaCharta.prototype.start = function ($module, options) {
10
- this.$module = $module[0]
7
+ function MagnaCharta ($module, options) {
8
+ this.$table = $module
11
9
  this.options = {
12
10
  outOf: 65,
13
11
  applyOnInit: true,
@@ -22,14 +20,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
22
20
  }
23
21
 
24
22
  for (var k in options) this.options[k] = options[k]
23
+ }
24
+
25
+ MagnaCharta.prototype.init = function () {
25
26
  this.detectIEVersion()
26
27
 
27
28
  // Magna Charta doesn't work in IE7 or less - so plain tables are shown to those browsers
28
29
  this.ENABLED = !(this.ie && this.ie < 8)
29
30
 
30
- // store a reference to the table in the object
31
- this.$table = $module
32
-
33
31
  // a container around the graph element so that it can be targeted by screen readers, allowing us to inform screen reader users that the graph isn't accessible
34
32
  this.$graphContainer = document.createElement('div')
35
33
  this.$graphContainer.className = 'mc-chart-container'
@@ -47,7 +45,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
47
45
  this.$graph.classList.add('mc-chart')
48
46
 
49
47
  // get the id of the current chart within the page so that it can be used during the generation of the toggleLink
50
- this.chartId = this.getChartId($module)
48
+ this.chartId = this.getChartId()
51
49
 
52
50
  // set the stacked option based on
53
51
  // giving the table a class of mc-stacked
@@ -458,12 +456,12 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
458
456
  }
459
457
  }
460
458
 
461
- MagnaCharta.prototype.getChartId = function (module) {
459
+ MagnaCharta.prototype.getChartId = function () {
462
460
  var allCharts = document.querySelectorAll('table.js-barchart-table')
463
461
  var id = null
464
462
 
465
463
  for (var i = 0; i < allCharts.length; i++) {
466
- if (allCharts[i] === module) {
464
+ if (allCharts[i] === this.$table) {
467
465
  id = i
468
466
  }
469
467
  }
@@ -2,10 +2,11 @@ window.GOVUK = window.GOVUK || {}
2
2
  window.GOVUK.Modules = window.GOVUK.Modules || {};
3
3
 
4
4
  (function (Modules) {
5
- function InitialFocus () { }
5
+ function InitialFocus ($module) {
6
+ this.$module = $module
7
+ }
6
8
 
7
- InitialFocus.prototype.start = function ($module) {
8
- this.$module = $module[0]
9
+ InitialFocus.prototype.init = function () {
9
10
  this.$module.focus()
10
11
  }
11
12
 
@@ -7,10 +7,11 @@ window.GOVUK = window.GOVUK || {}
7
7
  window.GOVUK.Modules = window.GOVUK.Modules || {};
8
8
 
9
9
  (function (Modules) {
10
- function GemToggleInputClassOnFocus () { }
10
+ function GemToggleInputClassOnFocus ($module) {
11
+ this.$module = $module
12
+ }
11
13
 
12
- GemToggleInputClassOnFocus.prototype.start = function ($module) {
13
- this.$module = $module[0]
14
+ GemToggleInputClassOnFocus.prototype.init = function () {
14
15
  this.toggleTarget = this.$module.querySelector('.js-class-toggle')
15
16
  this.$module.addFocusClass = this.addFocusClass.bind(this)
16
17
  this.$module.removeFocusClassFromEmptyInput = this.removeFocusClassFromEmptyInput.bind(this)
@@ -87,10 +87,11 @@ window.GOVUK = window.GOVUK || {}
87
87
  window.GOVUK.Modules = window.GOVUK.Modules || {};
88
88
 
89
89
  (function (Modules) {
90
- function GemToggle () { }
90
+ function GemToggle ($module) {
91
+ this.$module = $module
92
+ }
91
93
 
92
- GemToggle.prototype.start = function ($module) {
93
- this.$module = $module[0]
94
+ GemToggle.prototype.init = function () {
94
95
  this.$module.toggleTrigger = this.$module.querySelector('[data-controls][data-expanded]')
95
96
 
96
97
  if (this.$module.toggleTrigger) {
@@ -1,330 +1,2 @@
1
1
  @import "mixins/prefixed-transform";
2
-
3
- $gem-c-accordion-border-width: 3px;
4
- $gem-c-accordion-bottom-border-width: 1px;
5
-
6
- // Buttons within the sections don’t need default styling
7
- .gem-c-accordion__section-button {
8
- display: inline-block;
9
- margin-bottom: 0;
10
- padding-top: govuk-spacing(3);
11
- font-weight: bold;
12
- @include govuk-font($size: 24, $weight: bold);
13
- }
14
-
15
- .gem-c-accordion__section-header {
16
- padding-top: govuk-spacing(2) 0;
17
- }
18
-
19
- .gem-c-accordion__section-heading {
20
- margin: govuk-spacing(1) 0;
21
- }
22
-
23
- .js-enabled {
24
- .gem-c-accordion {
25
- border-bottom: $gem-c-accordion-bottom-border-width solid $govuk-border-colour;
26
- }
27
-
28
- .gem-c-accordion__controls {
29
- text-align: left;
30
- }
31
-
32
- .gem-c-accordion__open-all {
33
- position: relative;
34
- z-index: 1;
35
- border-width: 0;
36
- color: $govuk-link-colour;
37
- background: none;
38
- -webkit-appearance: none;
39
- cursor: pointer;
40
- margin-bottom: govuk-spacing(4);
41
- padding: 0 govuk-spacing(1) govuk-spacing(1) 0;
42
- @include govuk-font($size: 16);
43
- @include govuk-link-common;
44
- @include govuk-link-style-default;
45
-
46
- // Remove default button focus outline in Firefox
47
- &::-moz-focus-inner {
48
- padding: 0;
49
- border: 0;
50
- }
51
- }
52
-
53
- // Create Chervon icon align with text
54
- .gem-c-accordion-nav__chevron {
55
- vertical-align: text-top;
56
- display: inline-block;
57
- box-sizing: border-box;
58
- position: relative;
59
- width: govuk-em(20, 14);
60
- height: govuk-em(20, 14);
61
- margin-left: govuk-em(5, 14);
62
- border: govuk-em(1, 14) solid;
63
- border-radius: govuk-em(100, 14);
64
-
65
- // Main icon size across views, yet keep responsive for zoom
66
- @include govuk-media-query($from: tablet) {
67
- width: govuk-em(20, 16);
68
- height: govuk-em(20, 16);
69
- margin-left: govuk-em(5, 16);
70
- border: govuk-em(1, 16) solid;
71
- }
72
-
73
- &:after {
74
- @include prefixed-transform($rotate: -45deg);
75
- content: "";
76
- display: block;
77
- box-sizing: border-box;
78
- position: absolute;
79
- overflow: visible;
80
- width: govuk-em(6, 14);
81
- height: govuk-em(6, 14);
82
- border-top: govuk-em(2, 14) solid;
83
- border-right: govuk-em(2, 14) solid;
84
- left: govuk-em(6, 14);
85
- bottom: govuk-em(5, 14);
86
-
87
- @include govuk-media-query($from: tablet) {
88
- width: govuk-em(6, 16);
89
- height: govuk-em(6, 16);
90
- border-top: govuk-em(2, 16) solid;
91
- border-right: govuk-em(2, 16) solid;
92
- left: govuk-em(6, 16);
93
- bottom: govuk-em(5, 16);
94
- }
95
- }
96
- }
97
-
98
- .gem-c-accordion__open-all:hover,
99
- .gem-c-accordion__section-button:hover {
100
- .gem-c-accordion-nav__chevron {
101
- color: $govuk-link-hover-colour;
102
- text-decoration: none;
103
- }
104
- }
105
-
106
- // Focus state, also to change chervon icon to black
107
- .gem-c-accordion__open-all:focus {
108
- .gem-c-accordion-nav__chevron {
109
- color: $govuk-focus-text-colour;
110
- text-decoration: none;
111
- }
112
- }
113
-
114
- // Rotate icon to create "Down" version
115
- .gem-c-accordion-nav__chevron--down {
116
- @include prefixed-transform($rotate: 180deg);
117
- }
118
-
119
- .gem-c-accordion__section-heading {
120
- // Override browser defaults to ensure consistent element height
121
- margin-top: 0; // Override browser default
122
- margin-bottom: 0; // Override browser default
123
- @include govuk-font(24);
124
- }
125
-
126
- // Section headers have a pointer cursor as an additional affordance
127
- .gem-c-accordion__section-header {
128
- position: relative;
129
- }
130
-
131
- // For devices that can't hover such as touch devices,
132
- // remove hover state as it can be stuck in that state (iOS).
133
- @media (hover: none) {
134
- .gem-c-accordion__section-header:hover {
135
- border-top-color: $govuk-link-colour;
136
- box-shadow: inset 0 $gem-c-accordion-border-width 0 0 $govuk-link-colour;
137
-
138
- .gem-c-accordion__section-button {
139
- border-top-color: $govuk-link-colour;
140
- }
141
- }
142
- }
143
-
144
- // Buttons within the headers don’t need default styling
145
- .gem-c-accordion__section-button {
146
- padding: govuk-spacing(2) 0 govuk-spacing(5);
147
- position: relative;
148
- margin: 0;
149
- border-width: $gem-c-accordion-bottom-border-width 0 0 0;
150
- border-top: $gem-c-accordion-bottom-border-width solid $govuk-border-colour;
151
- color: $govuk-text-colour;
152
- background: none;
153
- text-align: left;
154
- cursor: pointer;
155
- -webkit-appearance: none;
156
- @include govuk-typography-common;
157
- width: 100%;
158
-
159
- &:hover {
160
- color: $govuk-link-hover-colour;
161
- }
162
-
163
- &:active {
164
- z-index: 1;
165
- color: $govuk-link-active-colour;
166
- background: none;
167
- }
168
-
169
- // Remove default button focus outline in Firefox
170
- &::-moz-focus-inner {
171
- padding: 0;
172
- border: 0;
173
- }
174
- }
175
-
176
- .gem-c-accordion__section-button:focus {
177
- @include govuk-focused-text;
178
- // Overwrite focus border to top
179
- box-shadow: 0 0, 0 -4px;
180
- border-top: 1px solid transparent;
181
-
182
- // Focus state to change chervon icon colour within individual sections
183
- .gem-c-accordion-nav__chevron {
184
- color: $govuk-text-colour;
185
- }
186
- }
187
-
188
- // Extend the touch area of the button to span the section header
189
- .gem-c-accordion__section-button:after {
190
- content: "";
191
- position: absolute;
192
- top: 0;
193
- right: 0;
194
- bottom: 0;
195
- left: 0;
196
- }
197
-
198
- .gem-c-accordion__section-button:hover:not(:focus) {
199
- text-decoration: none;
200
- }
201
-
202
- // For devices that can't hover such as touch devices,
203
- // remove hover state as it can be stuck in that state (iOS).
204
- @media (hover: none) {
205
- .gem-c-accordion__section-button:hover {
206
- text-decoration: none;
207
- }
208
- }
209
-
210
- // Add toggle link with Chevron icon on right.
211
- .gem-c-accordion__toggle-link {
212
- display: block;
213
- color: $govuk-link-colour;
214
- text-transform: capitalize;
215
- margin-top: govuk-spacing(1);
216
- margin-bottom: govuk-spacing(1);
217
- @include govuk-font($size: 16, $line-height: 1);
218
-
219
- &:active {
220
- background: $govuk-link-active-colour;
221
- }
222
- }
223
-
224
- .gem-c-accordion__toggle-text {
225
- display: inline-block;
226
- // Setting width of the text so the icon doesn't shift left or right when
227
- // toggled:
228
- min-width: govuk-em(40, 16);
229
- }
230
-
231
- // On hover add underline to toggle link only:
232
- .gem-c-accordion__section-button:hover .gem-c-accordion__toggle-text {
233
- color: $govuk-link-hover-colour;
234
- @include govuk-link-decoration;
235
- @include govuk-link-hover-decoration;
236
- }
237
-
238
- // Ensure the correct focus sstate text colour and no underline:
239
- .gem-c-accordion__section-button:focus .gem-c-accordion__toggle-text {
240
- color: $govuk-focus-text-colour;
241
- text-decoration: none;
242
- }
243
-
244
- .gem-c-accordion__open-all-text {
245
- min-width: govuk-em(120, 16);
246
- display: inline-block;
247
- text-align: left;
248
- }
249
-
250
- .gem-c-accordion__open-all:hover {
251
- .gem-c-accordion__open-all-text {
252
- @include govuk-link-decoration;
253
- @include govuk-link-hover-decoration;
254
- }
255
- }
256
-
257
- .gem-c-accordion__open-all:focus .gem-c-accordion__open-all-text {
258
- text-decoration: none;
259
- }
260
-
261
- // Change the summary subheading size.
262
- .gem-c-accordion__section-summary {
263
- @include govuk-responsive-margin(1, "top");
264
- @include govuk-responsive-margin(2, "bottom");
265
- @include govuk-typography-common;
266
- @include govuk-typography-responsive($size: 19);
267
- }
268
-
269
- // Hide body of expanded sections
270
- .gem-c-accordion__section-content {
271
- display: none;
272
- @include govuk-responsive-padding(0, "top");
273
- @include govuk-responsive-padding(8, "bottom");
274
- }
275
-
276
- // Show the body of expanded sections
277
- .gem-c-accordion__section--expanded .gem-c-accordion__section-content {
278
- display: block;
279
- }
280
-
281
- // Remove the bottom margin from the last item inside the content
282
- .gem-c-accordion__section-content > :last-child {
283
- margin-bottom: 0;
284
- }
285
-
286
- // Condensed layout
287
- .gem-c-accordion--condensed {
288
- .gem-c-accordion__open-all {
289
- margin-bottom: govuk-spacing(5);
290
- @include govuk-font($size: 14, $line-height: 1);
291
- }
292
-
293
- .gem-c-accordion__section-button {
294
- @include govuk-typography-responsive($size: 19, $important: true);
295
- padding-top: govuk-spacing(1);
296
- padding-bottom: govuk-spacing(5);
297
- }
298
-
299
- // Reduce Chevron size
300
- .gem-c-accordion-nav__chevron {
301
- @include prefixed-transform($scale: .875);
302
- width: govuk-em(20, 14);
303
- height: govuk-em(20, 14);
304
- margin-left: govuk-em(5, 14);
305
- border: govuk-em(1, 14) solid;
306
- border-radius: govuk-em(100, 14);
307
-
308
- &:after {
309
- width: govuk-em(6, 14);
310
- height: govuk-em(6, 14);
311
- border-top: govuk-em(2, 14) solid;
312
- border-right: govuk-em(2, 14) solid;
313
- left: govuk-em(6, 14);
314
- bottom: govuk-em(5, 14);
315
- }
316
- }
317
-
318
- .gem-c-accordion-nav__chevron--down {
319
- @include prefixed-transform($rotate: 180deg, $scale: .875);
320
- }
321
-
322
- .gem-c-accordion__section-summary {
323
- @include govuk-typography-responsive($size: 16, $important: true);
324
- }
325
-
326
- .gem-c-accordion__toggle-link {
327
- @include govuk-font($size: 14, $line-height: 1);
328
- }
329
- }
330
- }
2
+ @import "govuk/components/accordion/accordion";
@@ -1,12 +1,11 @@
1
1
  .gem-c-big-number {
2
2
  margin-bottom: govuk-spacing(3);
3
- @include govuk-typography-common;
4
3
  @include govuk-text-colour;
5
4
  }
6
5
 
7
6
  .gem-c-big-number__value {
7
+ @include govuk-font($size: false, $weight: bold);
8
8
  font-size: 80px;
9
- @include govuk-typography-weight-bold;
10
9
  line-height: 1;
11
10
 
12
11
  @if $govuk-typography-use-rem {
@@ -55,3 +54,7 @@
55
54
  }
56
55
  }
57
56
  }
57
+
58
+ .gem-c-big-number__suffix {
59
+ vertical-align: middle;
60
+ }
@@ -1,5 +1,4 @@
1
1
  $transition-campaign-red: #ff003b;
2
- $covid-colour: $govuk-link-colour;
3
2
 
4
3
  .gem-c-contextual-sidebar__related-links {
5
4
  border-top: 2px solid $govuk-brand-colour;
@@ -30,7 +29,3 @@ $covid-colour: $govuk-link-colour;
30
29
  .gem-c-contextual-sidebar__cta--brexit {
31
30
  border-top: 2px solid $transition-campaign-red;
32
31
  }
33
-
34
- .gem-c-contextual-sidebar__cta--covid {
35
- border-top: 2px solid $covid-colour;
36
- }