govuk_publishing_components 23.12.0 → 23.13.1

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. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/header.js +3 -0
  3. data/app/assets/javascripts/govuk_publishing_components/components/layout-header.js +5 -0
  4. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +32 -36
  5. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +66 -14
  6. data/app/assets/javascripts/govuk_publishing_components/modules.js +1 -1
  7. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +0 -1
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +5 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_show-password.scss +4 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +19 -7
  11. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +17 -6
  12. data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +5 -0
  13. data/app/views/govuk_publishing_components/components/_button.html.erb +1 -0
  14. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +3 -2
  15. data/app/views/govuk_publishing_components/components/_machine_readable_metadata.html.erb +1 -1
  16. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +2 -2
  17. data/app/views/govuk_publishing_components/components/_subscription-links.html.erb +3 -0
  18. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +82 -0
  19. data/app/views/govuk_publishing_components/components/_translation-nav.html.erb +3 -0
  20. data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +30 -0
  21. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +21 -0
  22. data/app/views/govuk_publishing_components/components/docs/meta_tags.yml +99 -1
  23. data/app/views/govuk_publishing_components/components/docs/subscription-links.yml +3 -0
  24. data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +100 -0
  25. data/app/views/govuk_publishing_components/components/docs/translation-nav.yml +3 -1
  26. data/app/views/govuk_publishing_components/components/docs/translation_nav.yml +137 -0
  27. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +3 -3
  28. data/config/locales/en.yml +2 -2
  29. data/lib/govuk_publishing_components/presenters/meta_tags.rb +2 -0
  30. data/lib/govuk_publishing_components/version.rb +1 -1
  31. data/node_modules/govuk-frontend/govuk/all.js +57 -0
  32. data/node_modules/govuk-frontend/govuk/components/_all.scss +1 -0
  33. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +25 -10
  34. data/node_modules/govuk-frontend/govuk/components/back-link/fixtures.json +12 -6
  35. data/node_modules/govuk-frontend/govuk/components/back-link/macro-options.json +4 -4
  36. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/fixtures.json +34 -13
  37. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/macro-options.json +1 -0
  38. data/node_modules/govuk-frontend/govuk/components/button/fixtures.json +74 -31
  39. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +72 -15
  40. data/node_modules/govuk-frontend/govuk/components/character-count/macro-options.json +1 -1
  41. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +145 -52
  42. data/node_modules/govuk-frontend/govuk/components/checkboxes/macro-options.json +2 -2
  43. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +84 -34
  44. data/node_modules/govuk-frontend/govuk/components/date-input/macro-options.json +1 -1
  45. data/node_modules/govuk-frontend/govuk/components/date-input/template.njk +1 -1
  46. data/node_modules/govuk-frontend/govuk/components/details/fixtures.json +34 -14
  47. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +21 -10
  48. data/node_modules/govuk-frontend/govuk/components/error-message/macro-options.json +1 -0
  49. data/node_modules/govuk-frontend/govuk/components/error-summary/_index.scss +2 -12
  50. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +86 -25
  51. data/node_modules/govuk-frontend/govuk/components/fieldset/fixtures.json +20 -10
  52. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +60 -13
  53. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +37 -18
  54. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +8 -5
  55. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +36 -18
  56. data/node_modules/govuk-frontend/govuk/components/header/macro-options.json +2 -2
  57. data/node_modules/govuk-frontend/govuk/components/hint/fixtures.json +17 -8
  58. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +130 -40
  59. data/node_modules/govuk-frontend/govuk/components/input/macro-options.json +1 -1
  60. data/node_modules/govuk-frontend/govuk/components/inset-text/fixtures.json +17 -8
  61. data/node_modules/govuk-frontend/govuk/components/label/fixtures.json +20 -11
  62. data/node_modules/govuk-frontend/govuk/components/label/macro-options.json +1 -1
  63. data/node_modules/govuk-frontend/govuk/components/notification-banner/README.md +15 -0
  64. data/node_modules/govuk-frontend/govuk/components/notification-banner/_index.scss +89 -0
  65. data/node_modules/govuk-frontend/govuk/components/notification-banner/_notification-banner.scss +2 -0
  66. data/node_modules/govuk-frontend/govuk/components/notification-banner/fixtures.json +212 -0
  67. data/node_modules/govuk-frontend/govuk/components/notification-banner/macro-options.json +68 -0
  68. data/node_modules/govuk-frontend/govuk/components/notification-banner/macro.njk +3 -0
  69. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +61 -0
  70. data/node_modules/govuk-frontend/govuk/components/notification-banner/template.njk +47 -0
  71. data/node_modules/govuk-frontend/govuk/components/panel/fixtures.json +30 -13
  72. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +20 -9
  73. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +167 -50
  74. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +97 -18
  75. data/node_modules/govuk-frontend/govuk/components/select/macro-options.json +1 -1
  76. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +21 -9
  77. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +118 -25
  78. data/node_modules/govuk-frontend/govuk/components/table/fixtures.json +92 -22
  79. data/node_modules/govuk-frontend/govuk/components/tabs/fixtures.json +75 -18
  80. data/node_modules/govuk-frontend/govuk/components/tabs/macro-options.json +1 -1
  81. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +28 -14
  82. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +68 -17
  83. data/node_modules/govuk-frontend/govuk/components/warning-text/fixtures.json +19 -14
  84. data/node_modules/govuk-frontend/govuk/helpers/_links.scss +94 -0
  85. data/node_modules/govuk-frontend/govuk/settings/_colours-applied.scss +9 -0
  86. data/node_modules/govuk-frontend/govuk/settings/_typography-font.scss +3 -0
  87. data/node_modules/govuk-frontend/package.json +1 -1
  88. metadata +15 -3
  89. data/app/assets/stylesheets/govuk_publishing_components/components/_transition-countdown.scss +0 -125
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e893228b7aeae4913a2e99436d0d892e32200a65162d7965bcc0f15771bc7ee7
4
- data.tar.gz: c9b253d4e6ed92190ef52f2e625e9e495a7ab643ba8027d2f1f2988806fe369a
3
+ metadata.gz: b8e84f4736eb11902079ff68c2a4a2acb1c328126a4024664414adb2aa8a67fd
4
+ data.tar.gz: 693fabe38ddd9b79740a918e42bd1321a2f61b6abaca88e0b06e4360dcbb27fe
5
5
  SHA512:
6
- metadata.gz: fd695dffba2fdb7868f4fb20cbfcea406020f83f86bb616d1cb52dec78ab39204675224d0027fd96215140269b8fc28397f62067a7bf778bd6052631b4a5b9ec
7
- data.tar.gz: 48679f3a6272a937d4097c1f6269c180646a4cf7a4e9c975f5952b434a7302da98c0f350d4206da3ff6a9f38dd10d61392aa8c0bb52f5a63d895102a7e2aa9c4
6
+ metadata.gz: 1b833ced5ea9b6a0ca211eb846b0018fd51920edf04babb7d38126ddb5d85df400600558f73e066e21634346045c7d9819983648ddf3664976ee4ba2a3cd4ae5
7
+ data.tar.gz: 07132c1756b1ca69c9b674f39c393120679a61b62ee20c6e8c3ade957b4189cee7e9801b76f5c083d8f554d9c5360369dd6681e7f8724020576d3b084811b6cf
@@ -1,3 +1,6 @@
1
+ // DO NOT MAKE CHANGES TO THIS FILE
2
+ // It is a temporary copy of layout-header.js and will be deleted shortly
3
+
1
4
  // This component relies on JavaScript from GOV.UK Frontend
2
5
  // = require govuk/components/header/header.js
3
6
  window.GOVUK = window.GOVUK || {}
@@ -0,0 +1,5 @@
1
+ // This component relies on JavaScript from GOV.UK Frontend
2
+ // = require govuk/components/header/header.js
3
+ window.GOVUK = window.GOVUK || {}
4
+ window.GOVUK.Modules = window.GOVUK.Modules || {}
5
+ window.GOVUK.Modules.Header = window.GOVUKFrontend
@@ -40,6 +40,15 @@ 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" class="gem-c-step-nav__chevron">' +
44
+ '<path 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 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" class="gem-c-step-nav__chevron">' +
48
+ '<path 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 d="M13.6738 8.67383L10 12.3477L6.32617 8.67383" stroke="#1D70B8" stroke-width="2"/>' +
50
+ '</svg>'
51
+
43
52
  var stepNavTracker = new this.StepNavTracker(this.$module.uniqueId, this.$module.totalSteps, this.$module.totalLinks)
44
53
 
45
54
  this.getTextForInsertedElements()
@@ -66,7 +75,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
66
75
  Gemstepnav.prototype.addShowHideAllButton = function () {
67
76
  var showall = document.createElement('div')
68
77
  showall.className = 'gem-c-step-nav__controls'
69
- showall.innerHTML = '<button aria-expanded="false" class="gem-c-step-nav__button gem-c-step-nav__button--controls js-step-controls-button">' + this.$module.actions.showAllText + '</button>'
78
+ showall.innerHTML = '<button aria-expanded="false" class="gem-c-step-nav__button gem-c-step-nav__button--controls js-step-controls-button">' +
79
+ this.$module.downChevronSvg +
80
+ this.$module.actions.showAllText +
81
+ '</button>'
70
82
 
71
83
  var steps = this.$module.querySelectorAll('.gem-c-step-nav__steps')[0]
72
84
  this.$module.insertBefore(showall, steps)
@@ -114,7 +126,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
114
126
  var data = []
115
127
 
116
128
  for (var i = 0; i < this.$module.steps.length; i++) {
117
- var stepView = new this.StepView(this.$module.steps[i], this.$module.actions.showText, this.$module.actions.hideText)
129
+ var stepView = new this.StepView(this.$module.steps[i], this.$module)
118
130
  stepView.setIsShown(isShown)
119
131
 
120
132
  if (isShown) {
@@ -136,7 +148,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
136
148
  for (var i = 0; i < this.$module.steps.length; i++) {
137
149
  var thisel = this.$module.steps[i]
138
150
  var id = thisel.getAttribute('id')
139
- var stepView = new this.StepView(thisel, this.$module.actions.showText, this.$module.actions.hideText)
151
+ var stepView = new this.StepView(thisel, this.$module)
140
152
  var shouldBeShown = thisel.hasAttribute('data-show')
141
153
 
142
154
  // show the step if it has been remembered or if it has the 'data-show' attribute
@@ -165,7 +177,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
165
177
  '<button ' +
166
178
  'class="gem-c-step-nav__button gem-c-step-nav__button--title js-step-title-button" ' +
167
179
  'aria-expanded="false" aria-controls="' + contentId + '">' +
168
- '<span class="js-step-title-text">' + titleText + '</span>' +
180
+ '<span class="gem-c-step-nav__title-text js-step-title-text">' + titleText + '</span>' +
169
181
  '</button>' +
170
182
  '</span>'
171
183
  }
@@ -177,7 +189,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
177
189
 
178
190
  for (var i = 0; i < togglePanels.length; i++) {
179
191
  togglePanels[i].addEventListener('click', function (event) {
180
- var stepView = new that.StepView(this.parentNode, that.$module.actions.showText, that.$module.actions.hideText)
192
+ var stepView = new that.StepView(this.parentNode, that.$module)
181
193
  stepView.toggle()
182
194
 
183
195
  var stepIsOptional = this.parentNode.hasAttribute('data-optional')
@@ -321,34 +333,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
321
333
  var that = this
322
334
 
323
335
  this.$module.showOrHideAllButton.addEventListener('click', function (event) {
324
- var shouldshowAll
325
- var showHideTexts = that.$module.querySelectorAll('.js-toggle-link')
326
336
  var textContent = this.textContent || this.innerText
337
+ var shouldShowAll = textContent === that.$module.actions.showAllText
327
338
 
328
- if (textContent === that.$module.actions.showAllText) {
329
- that.$module.showOrHideAllButton.textContent = that.$module.actions.hideAllText
330
- for (var i = 0; i < showHideTexts.length; i++) {
331
- showHideTexts[i].innerHTML = that.$module.actions.hideText
332
- }
333
- shouldshowAll = true
334
-
335
- stepNavTracker.trackClick('pageElementInteraction', 'stepNavAllShown', {
336
- label: that.$module.actions.showAllText + ': ' + that.$module.stepNavSize
337
- })
338
- } else {
339
- that.$module.showOrHideAllButton.textContent = that.$module.actions.showAllText
340
- for (var j = 0; j < showHideTexts.length; j++) {
341
- showHideTexts[j].innerHTML = that.$module.actions.showText
342
- }
343
- shouldshowAll = false
344
-
345
- stepNavTracker.trackClick('pageElementInteraction', 'stepNavAllHidden', {
346
- label: that.$module.actions.hideAllText + ': ' + that.$module.stepNavSize
347
- })
348
- }
339
+ // Fire GA click tracking
340
+ stepNavTracker.trackClick('pageElementInteraction', (shouldShowAll ? 'stepNavAllShown' : 'stepNavAllHidden'), {
341
+ label: (shouldShowAll ? that.$module.actions.showAllText : that.$module.actions.hideAllText) + ': ' + that.$module.stepNavSize
342
+ })
349
343
 
350
- that.setAllStepsShownState(shouldshowAll)
351
- that.$module.showOrHideAllButton.setAttribute('aria-expanded', shouldshowAll)
344
+ that.setAllStepsShownState(shouldShowAll)
345
+ that.$module.showOrHideAllButton.setAttribute('aria-expanded', shouldShowAll)
352
346
  that.setShowHideAllText()
353
347
 
354
348
  return false
@@ -359,21 +353,23 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
359
353
  var shownSteps = this.$module.querySelectorAll('.step-is-shown').length
360
354
  // Find out if the number of is-opens == total number of steps
361
355
  if (shownSteps === this.$module.totalSteps) {
362
- this.$module.showOrHideAllButton.textContent = this.$module.actions.hideAllText
356
+ this.$module.showOrHideAllButton.innerHTML = this.$module.upChevronSvg + this.$module.actions.hideAllText
363
357
  } else {
364
- this.$module.showOrHideAllButton.textContent = this.$module.actions.showAllText
358
+ this.$module.showOrHideAllButton.innerHTML = this.$module.downChevronSvg + this.$module.actions.showAllText
365
359
  }
366
360
  }
367
361
 
368
- Gemstepnav.prototype.StepView = function (stepElement, showText, hideText) {
362
+ Gemstepnav.prototype.StepView = function (stepElement, $module) {
369
363
  this.stepElement = stepElement
370
364
  this.stepContent = this.stepElement.querySelectorAll('.js-panel')[0]
371
365
  this.titleButton = this.stepElement.querySelectorAll('.js-step-title-button')[0]
372
366
  var textElement = this.stepElement.querySelectorAll('.js-step-title-text')[0]
373
367
  this.title = textElement.textContent || textElement.innerText
374
368
  this.title = this.title.replace(/^\s+|\s+$/g, '') // this is 'trim' but supporting IE8
375
- this.showText = showText
376
- this.hideText = hideText
369
+ this.showText = $module.actions.showText
370
+ this.hideText = $module.actions.hideText
371
+ this.upChevronSvg = $module.upChevronSvg
372
+ this.downChevronSvg = $module.downChevronSvg
377
373
 
378
374
  this.show = function () {
379
375
  this.setIsShown(true)
@@ -398,7 +394,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
398
394
 
399
395
  this.titleButton.setAttribute('aria-expanded', isShown)
400
396
  var showHideText = this.stepElement.querySelectorAll('.js-toggle-link')[0]
401
- showHideText.innerHTML = isShown ? this.hideText : this.showText
397
+ showHideText.innerHTML = isShown ? this.upChevronSvg + this.hideText : this.downChevronSvg + this.showText
402
398
  }
403
399
 
404
400
  this.isShown = function () {
@@ -11,9 +11,12 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
11
11
  this.options = {
12
12
  outOf: 65,
13
13
  applyOnInit: true,
14
- toggleText: 'Toggle between chart and table',
15
14
  autoOutdent: false,
16
15
  outdentAll: false,
16
+ chartVisibleText: 'Change to table and accessible view',
17
+ tableVisibleText: 'Change to chart view',
18
+ chartAlertText: 'Chart visible',
19
+ tableAlertText: 'Table visible',
17
20
  toggleAfter: false, // BOOL set TRUE to append the toggle link
18
21
  returnReference: false // for testing purposes
19
22
  }
@@ -27,6 +30,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
27
30
  // store a reference to the table in the object
28
31
  this.$table = $module
29
32
 
33
+ // 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
+ this.$graphContainer = document.createElement('div')
35
+ this.$graphContainer.className = 'mc-chart-container'
36
+
30
37
  // lets make what will become the new graph
31
38
  this.$graph = document.createElement('div')
32
39
 
@@ -39,6 +46,9 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
39
46
  this.$graph.setAttribute('class', this.$table.className)
40
47
  this.$graph.classList.add('mc-chart')
41
48
 
49
+ // 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)
51
+
42
52
  // set the stacked option based on
43
53
  // giving the table a class of mc-stacked
44
54
  this.options.stacked = this.$table.classList.contains('mc-stacked')
@@ -102,7 +112,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
102
112
  this.addClassesToHeader()
103
113
  this.applyWidths()
104
114
  this.insert()
105
- this.$table.classList.add('visually-hidden')
115
+ this.$table.classList.add('mc-hidden')
106
116
  this.applyOutdent()
107
117
  }
108
118
  }
@@ -164,24 +174,42 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
164
174
  }
165
175
 
166
176
  // construct a link to allow the user to toggle between chart and table
167
- MagnaCharta.prototype.construct.toggleLink = function (toggleText) {
168
- var link = document.createElement('a')
169
- link.setAttribute('href', '#')
170
- link.classList.add('mc-toggle-link')
171
- link.innerHTML = toggleText
172
- link.setAttribute('aria-hidden', 'true')
177
+ MagnaCharta.prototype.construct.toggleLink = function (chartVisibleText) {
178
+ var link = document.createElement('button')
179
+
180
+ // These spans are for managing the content within the button
181
+ // toggleText is the public facing content whilst toggleStatus is visually hidden content that we use to let screen reader users know that the toggle link has been clicked
182
+ var toggleText = document.createElement('span')
183
+ var toggleStatus = document.createElement('span')
184
+
185
+ toggleText.classList.add('mc-toggle-text')
186
+ toggleText.innerHTML = chartVisibleText
187
+
188
+ toggleStatus.classList.add('govuk-visually-hidden', 'mc-toggle-status')
189
+ toggleStatus.setAttribute('role', 'alert')
190
+
191
+ link.classList.add('mc-toggle-button')
192
+ link.appendChild(toggleText)
193
+ link.appendChild(toggleStatus)
173
194
 
174
195
  return link
175
196
  }
176
197
 
177
198
  // toggles between showing the table and showing the chart
178
- MagnaCharta.prototype.addToggleClick = function () {
199
+ MagnaCharta.prototype.addToggleClick = function (chartVisible, tableVisible, chartAlert, tableAlert) {
179
200
  var that = this
180
201
 
181
202
  this.toggleLink.addEventListener('click', function (e) {
182
203
  e.preventDefault()
183
- that.$graph.classList.toggle('visually-hidden')
184
- that.$table.classList.toggle('visually-hidden')
204
+
205
+ var toggleText = that.toggleLink.querySelector('.mc-toggle-text')
206
+ var toggleStatus = that.toggleLink.querySelector('.mc-toggle-status')
207
+
208
+ that.$graphContainer.classList.toggle('mc-hidden')
209
+ that.$table.classList.toggle('mc-hidden')
210
+
211
+ toggleText.innerHTML = toggleText.innerHTML === tableVisible ? chartVisible : tableVisible
212
+ toggleStatus.innerHTML = toggleStatus.innerHTML === tableAlert ? chartAlert : tableAlert
185
213
  })
186
214
  }
187
215
 
@@ -191,8 +219,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
191
219
  // get at options and properties
192
220
  var thead = this.construct.thead.call(this)
193
221
  var tbody = this.construct.tbody.call(this)
194
- this.toggleLink = this.construct.toggleLink(this.options.toggleText)
195
- this.addToggleClick(this.toggleLink)
222
+ this.toggleLink = this.construct.toggleLink(this.options.chartVisibleText)
223
+ this.addToggleClick(this.options.chartVisibleText, this.options.tableVisibleText, this.options.chartAlertText, this.options.tableAlertText)
196
224
 
197
225
  if (this.options.hasCaption) {
198
226
  var caption = this.construct.caption.call(this)
@@ -379,7 +407,18 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
379
407
  }
380
408
 
381
409
  MagnaCharta.prototype.insert = function () {
382
- this.$table.insertAdjacentElement('afterend', this.$graph)
410
+ var label = document.createElement('span')
411
+ var labelId = 'mc-chart-not-accessible-' + this.chartId
412
+
413
+ label.innerHTML = 'This content is not accessible - switch to table'
414
+ label.className = 'mc-hidden'
415
+ label.id = labelId
416
+
417
+ this.$graphContainer.setAttribute('aria-labelledby', labelId)
418
+ this.$graphContainer.appendChild(this.$graph)
419
+ this.$graphContainer.appendChild(label)
420
+
421
+ this.$table.insertAdjacentElement('afterend', this.$graphContainer)
383
422
  }
384
423
 
385
424
  MagnaCharta.prototype.applyOutdent = function () {
@@ -419,5 +458,18 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
419
458
  }
420
459
  }
421
460
 
461
+ MagnaCharta.prototype.getChartId = function (module) {
462
+ var allCharts = document.querySelectorAll('table.js-barchart-table')
463
+ var id = null
464
+
465
+ allCharts.forEach(function (chart, i) {
466
+ if (chart === module) {
467
+ id = i
468
+ }
469
+ })
470
+
471
+ return id
472
+ }
473
+
422
474
  Modules.MagnaCharta = MagnaCharta
423
475
  })(window.GOVUK.Modules)
@@ -7,7 +7,7 @@
7
7
 
8
8
  GOVUK.modules = {
9
9
  find: function (container) {
10
- container = container || $('body')
10
+ container = container || $(document)
11
11
 
12
12
  var modules
13
13
  var moduleSelector = '[data-module]'
@@ -74,5 +74,4 @@
74
74
  @import "components/textarea";
75
75
  @import "components/title";
76
76
  @import "components/translation-nav";
77
- @import "components/transition-countdown";
78
77
  @import "components/warning-text";
@@ -4,6 +4,11 @@
4
4
  border-top: govuk-spacing(2) solid govuk-colour("blue");
5
5
  }
6
6
 
7
+ .govuk-footer__list-item {
8
+ display: inline-block;
9
+ width: 99%;
10
+ }
11
+
7
12
  .gem-c-layout-footer .govuk-footer__list {
8
13
  padding-bottom: govuk-spacing(7);
9
14
  }
@@ -14,6 +14,10 @@
14
14
  &:focus {
15
15
  z-index: 1;
16
16
  }
17
+
18
+ &::-ms-reveal {
19
+ display: none;
20
+ }
17
21
  }
18
22
  }
19
23
 
@@ -56,7 +56,6 @@ $top-border: solid 2px govuk-colour("mid-grey", $legacy: "grey-3");
56
56
 
57
57
  .gem-c-step-nav__controls {
58
58
  padding: 3px 3px 0 0;
59
- text-align: right;
60
59
  }
61
60
 
62
61
  .gem-c-step-nav__button {
@@ -93,14 +92,27 @@ $top-border: solid 2px govuk-colour("mid-grey", $legacy: "grey-3");
93
92
  @include step-nav-font(14, $line-height: 1);
94
93
  position: relative;
95
94
  z-index: 1; // this and relative position stops focus outline underlap with border of accordion
96
- padding: .5em 0;
97
- text-decoration: underline;
95
+ padding: .5em 0 1.5em;
96
+
97
+ &:hover {
98
+ text-decoration: underline;
99
+ }
98
100
 
99
101
  .gem-c-step-nav--large & {
100
102
  @include step-nav-font(14, $tablet-size: 16, $line-height: 1);
101
103
  }
102
104
  }
103
105
 
106
+ .gem-c-step-nav__title-text {
107
+ display: block;
108
+ margin-bottom: govuk-spacing(1);
109
+ }
110
+
111
+ .gem-c-step-nav__chevron {
112
+ vertical-align: text-top;
113
+ margin-right: govuk-spacing(1);
114
+ }
115
+
104
116
  .gem-c-step-nav__steps {
105
117
  padding: 0;
106
118
  margin: 0;
@@ -181,7 +193,7 @@ $top-border: solid 2px govuk-colour("mid-grey", $legacy: "grey-3");
181
193
  box-sizing: border-box;
182
194
  position: absolute;
183
195
  z-index: 5;
184
- top: govuk-spacing(3);
196
+ top: govuk-spacing(1);
185
197
  left: 0;
186
198
  width: $number-circle-size;
187
199
  height: $number-circle-size;
@@ -192,7 +204,7 @@ $top-border: solid 2px govuk-colour("mid-grey", $legacy: "grey-3");
192
204
 
193
205
  .gem-c-step-nav--large & {
194
206
  @include govuk-media-query($from: tablet) {
195
- top: govuk-spacing(6);
207
+ top: govuk-spacing(3);
196
208
  width: $number-circle-size-large;
197
209
  height: $number-circle-size-large;
198
210
  }
@@ -240,7 +252,7 @@ $top-border: solid 2px govuk-colour("mid-grey", $legacy: "grey-3");
240
252
  }
241
253
 
242
254
  .gem-c-step-nav__header {
243
- padding: govuk-spacing(3) 0;
255
+ padding: govuk-spacing(1) 0 govuk-spacing(3);
244
256
  border-top: $top-border;
245
257
 
246
258
  .gem-c-step-nav--active & {
@@ -270,7 +282,7 @@ $top-border: solid 2px govuk-colour("mid-grey", $legacy: "grey-3");
270
282
 
271
283
  .gem-c-step-nav--large & {
272
284
  @include govuk-media-query($from: tablet) {
273
- padding: govuk-spacing(6) 0;
285
+ padding: govuk-spacing(2) 0 govuk-spacing(6);
274
286
  }
275
287
  }
276
288
  }
@@ -270,15 +270,26 @@
270
270
  text-align: left;
271
271
  }
272
272
 
273
- .mc-toggle-link {
274
- display: block;
275
- margin-top: 30px;
273
+ .mc-toggle-button {
274
+ @extend %govuk-body-s;
275
+ border: 1px solid $govuk-border-colour;
276
+ color: $govuk-link-colour;
277
+ cursor: pointer;
278
+ margin: govuk-spacing(0);
279
+ padding: govuk-spacing(2);
280
+ background-color: govuk-colour("white");
281
+
282
+ &:focus {
283
+ @include govuk-focused-text;
284
+ background-color: $govuk-focus-colour;
285
+ border-color: transparent;
286
+ }
276
287
  }
277
288
 
278
289
  // Hides the original table
279
- .visually-hidden,
280
- .visually-hidden caption {
281
- @include govuk-visually-hidden;
290
+ .mc-hidden,
291
+ .mc-hidden caption {
292
+ display: none;
282
293
 
283
294
  // It's reapplied to captions because Firefox can't hide
284
295
  // table captions unless it's applied directly to it. Go figure.