govuk_publishing_components 28.5.0 → 28.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +3 -3
  4. data/app/assets/javascripts/govuk_publishing_components/analytics/track-select-change.js +4 -3
  5. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +21 -291
  6. data/app/assets/javascripts/govuk_publishing_components/components/button.js +1 -1
  7. data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +1 -1
  8. data/app/assets/javascripts/govuk_publishing_components/components/checkboxes.js +1 -1
  9. data/app/assets/javascripts/govuk_publishing_components/components/details.js +1 -1
  10. data/app/assets/javascripts/govuk_publishing_components/components/error-summary.js +1 -1
  11. data/app/assets/javascripts/govuk_publishing_components/components/feedback.js +7 -6
  12. data/app/assets/javascripts/govuk_publishing_components/components/layout-header.js +1 -1
  13. data/app/assets/javascripts/govuk_publishing_components/components/radio.js +1 -1
  14. data/app/assets/javascripts/govuk_publishing_components/components/skip-link.js +5 -0
  15. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +40 -37
  16. data/app/assets/javascripts/govuk_publishing_components/components/tabs.js +1 -1
  17. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js +2 -1
  18. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +8 -10
  19. data/app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js +4 -3
  20. data/app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js +4 -3
  21. data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +4 -3
  22. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +1796 -911
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +1 -329
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +1 -1
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +95 -56
  26. data/app/assets/stylesheets/govuk_publishing_components/components/print/_accordion.scss +6 -17
  27. data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +0 -9
  28. data/app/models/govuk_publishing_components/component_docs.rb +1 -1
  29. data/app/views/govuk_publishing_components/components/_accordion.html.erb +31 -16
  30. data/app/views/govuk_publishing_components/components/_attachment.html.erb +3 -1
  31. data/app/views/govuk_publishing_components/components/_button.html.erb +4 -4
  32. data/app/views/govuk_publishing_components/components/_character_count.html.erb +2 -2
  33. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +2 -2
  34. data/app/views/govuk_publishing_components/components/_error_message.html.erb +1 -1
  35. data/app/views/govuk_publishing_components/components/_error_summary.html.erb +0 -1
  36. data/app/views/govuk_publishing_components/components/_input.html.erb +3 -3
  37. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +12 -1
  38. data/app/views/govuk_publishing_components/components/_intervention.html.erb +2 -2
  39. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +1 -1
  40. data/app/views/govuk_publishing_components/components/_modal_dialogue.html.erb +1 -1
  41. data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -1
  42. data/app/views/govuk_publishing_components/components/_search.html.erb +2 -4
  43. data/app/views/govuk_publishing_components/components/_select.html.erb +15 -43
  44. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +1 -1
  45. data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +7 -8
  46. data/app/views/govuk_publishing_components/components/docs/accordion.yml +2 -97
  47. data/app/views/govuk_publishing_components/components/docs/attachment.yml +11 -0
  48. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +1 -1
  49. data/app/views/govuk_publishing_components/components/docs/inset_text.yml +6 -0
  50. data/app/views/govuk_publishing_components/components/docs/select.yml +1 -1
  51. data/app/views/govuk_publishing_components/components/docs/share_links.yml +1 -1
  52. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +13 -13
  53. data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
  54. data/app/views/govuk_publishing_components/components/docs/textarea.yml +1 -1
  55. data/app/views/govuk_publishing_components/components/layout_header/_navigation_items.html.erb +11 -11
  56. data/config/initializers/assets.rb +1 -0
  57. data/lib/govuk_publishing_components/presenters/attachment.rb +23 -0
  58. data/lib/govuk_publishing_components/presenters/select_helper.rb +85 -0
  59. data/lib/govuk_publishing_components/version.rb +1 -1
  60. data/lib/govuk_publishing_components.rb +1 -1
  61. data/node_modules/govuk-frontend/govuk/all.js +294 -76
  62. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +274 -99
  63. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +169 -65
  64. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +37 -5
  65. data/node_modules/govuk-frontend/govuk/components/accordion/macro-options.json +4 -4
  66. data/node_modules/govuk-frontend/govuk/components/button/button.js +2 -2
  67. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +3 -3
  68. data/node_modules/govuk-frontend/govuk/components/character-count/fixtures.json +15 -2
  69. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +8 -10
  70. data/node_modules/govuk-frontend/govuk/components/checkboxes/fixtures.json +52 -15
  71. data/node_modules/govuk-frontend/govuk/components/cookie-banner/_index.scss +0 -2
  72. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +31 -0
  73. data/node_modules/govuk-frontend/govuk/components/date-input/fixtures.json +25 -25
  74. data/node_modules/govuk-frontend/govuk/components/details/details.js +2 -2
  75. data/node_modules/govuk-frontend/govuk/components/error-message/_index.scss +1 -0
  76. data/node_modules/govuk-frontend/govuk/components/error-message/fixtures.json +8 -8
  77. data/node_modules/govuk-frontend/govuk/components/error-message/template.njk +2 -2
  78. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +24 -3
  79. data/node_modules/govuk-frontend/govuk/components/error-summary/fixtures.json +25 -16
  80. data/node_modules/govuk-frontend/govuk/components/error-summary/macro-options.json +6 -0
  81. data/node_modules/govuk-frontend/govuk/components/error-summary/template.njk +2 -1
  82. data/node_modules/govuk-frontend/govuk/components/file-upload/fixtures.json +4 -4
  83. data/node_modules/govuk-frontend/govuk/components/footer/_index.scss +3 -37
  84. data/node_modules/govuk-frontend/govuk/components/footer/fixtures.json +119 -15
  85. data/node_modules/govuk-frontend/govuk/components/footer/macro-options.json +6 -0
  86. data/node_modules/govuk-frontend/govuk/components/footer/template.njk +1 -1
  87. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +10 -4
  88. data/node_modules/govuk-frontend/govuk/components/header/fixtures.json +11 -11
  89. data/node_modules/govuk-frontend/govuk/components/header/header.js +4 -4
  90. data/node_modules/govuk-frontend/govuk/components/header/template.njk +4 -3
  91. data/node_modules/govuk-frontend/govuk/components/hint/_index.scss +1 -3
  92. data/node_modules/govuk-frontend/govuk/components/input/_index.scss +1 -1
  93. data/node_modules/govuk-frontend/govuk/components/input/fixtures.json +40 -40
  94. data/node_modules/govuk-frontend/govuk/components/input/template.njk +4 -3
  95. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +499 -2
  96. data/node_modules/govuk-frontend/govuk/components/phase-banner/fixtures.json +2 -2
  97. data/node_modules/govuk-frontend/govuk/components/radios/_index.scss +0 -8
  98. data/node_modules/govuk-frontend/govuk/components/radios/fixtures.json +44 -45
  99. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +4 -4
  100. data/node_modules/govuk-frontend/govuk/components/radios/template.njk +2 -9
  101. data/node_modules/govuk-frontend/govuk/components/select/_index.scss +6 -1
  102. data/node_modules/govuk-frontend/govuk/components/select/fixtures.json +3 -3
  103. data/node_modules/govuk-frontend/govuk/components/skip-link/_index.scss +13 -0
  104. data/node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json +9 -9
  105. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1108 -0
  106. data/node_modules/govuk-frontend/govuk/components/skip-link/template.njk +1 -1
  107. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +20 -23
  108. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +86 -1
  109. data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +1 -4
  110. data/node_modules/govuk-frontend/govuk/components/tabs/_index.scss +2 -2
  111. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +2 -2
  112. data/node_modules/govuk-frontend/govuk/components/tag/_index.scss +0 -5
  113. data/node_modules/govuk-frontend/govuk/components/tag/fixtures.json +2 -2
  114. data/node_modules/govuk-frontend/govuk/components/textarea/_index.scss +1 -1
  115. data/node_modules/govuk-frontend/govuk/components/textarea/fixtures.json +4 -4
  116. data/node_modules/govuk-frontend/govuk/core/_all.scss +0 -1
  117. data/node_modules/govuk-frontend/govuk/core/_global-styles.scss +0 -6
  118. data/node_modules/govuk-frontend/govuk/core/_links.scss +0 -6
  119. data/node_modules/govuk-frontend/govuk/core/_lists.scss +0 -6
  120. data/node_modules/govuk-frontend/govuk/core/_section-break.scss +0 -6
  121. data/node_modules/govuk-frontend/govuk/core/_typography.scss +0 -6
  122. data/node_modules/govuk-frontend/govuk/objects/_all.scss +1 -0
  123. data/node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss +15 -30
  124. data/node_modules/govuk-frontend/govuk/{core → objects}/_template.scss +1 -5
  125. data/node_modules/govuk-frontend/govuk/overrides/_display.scss +0 -6
  126. data/node_modules/govuk-frontend/govuk/overrides/_spacing.scss +0 -6
  127. data/node_modules/govuk-frontend/govuk/overrides/_text-align.scss +0 -6
  128. data/node_modules/govuk-frontend/govuk/overrides/_typography.scss +0 -6
  129. data/node_modules/govuk-frontend/govuk/overrides/_width.scss +0 -6
  130. data/node_modules/govuk-frontend/govuk/settings/_colours-organisations.scss +3 -0
  131. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +0 -10
  132. data/node_modules/govuk-frontend/govuk/tools/_all.scss +0 -1
  133. data/node_modules/govuk-frontend/package.json +1 -1
  134. metadata +22 -37
  135. data/app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js +0 -100
  136. data/lib/govuk_publishing_components/presenters/select.rb +0 -43
  137. data/lib/tasks/govuk_publishing_components_tasks.rake +0 -49
  138. data/node_modules/govuk-frontend/govuk/tools/_iff.scss +0 -17
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 28.5.0
4
+ version: 28.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-01 00:00:00.000000000 Z
11
+ date: 2022-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: psych
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '4'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '4'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rails
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -192,34 +206,6 @@ dependencies:
192
206
  - - ">="
193
207
  - !ruby/object:Gem::Version
194
208
  version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: jasmine
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - "~>"
200
- - !ruby/object:Gem::Version
201
- version: 3.10.0
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - "~>"
207
- - !ruby/object:Gem::Version
208
- version: 3.10.0
209
- - !ruby/object:Gem::Dependency
210
- name: jasmine_selenium_runner
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - "~>"
214
- - !ruby/object:Gem::Version
215
- version: 3.0.0
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - "~>"
221
- - !ruby/object:Gem::Version
222
- version: 3.0.0
223
209
  - !ruby/object:Gem::Dependency
224
210
  name: percy-capybara
225
211
  requirement: !ruby/object:Gem::Requirement
@@ -501,6 +487,7 @@ files:
501
487
  - app/assets/javascripts/govuk_publishing_components/components/reorderable-list.js
502
488
  - app/assets/javascripts/govuk_publishing_components/components/show-password.js
503
489
  - app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js
490
+ - app/assets/javascripts/govuk_publishing_components/components/skip-link.js
504
491
  - app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js
505
492
  - app/assets/javascripts/govuk_publishing_components/components/tabs.js
506
493
  - app/assets/javascripts/govuk_publishing_components/dependencies.js
@@ -513,7 +500,6 @@ files:
513
500
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/barchart-enhancement.js
514
501
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js
515
502
  - app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
516
- - app/assets/javascripts/govuk_publishing_components/lib/header-navigation.js
517
503
  - app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js
518
504
  - app/assets/javascripts/govuk_publishing_components/lib/primary-links.js
519
505
  - app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
@@ -961,14 +947,13 @@ files:
961
947
  - lib/govuk_publishing_components/presenters/public_layout_helper.rb
962
948
  - lib/govuk_publishing_components/presenters/related_navigation_helper.rb
963
949
  - lib/govuk_publishing_components/presenters/schema_org.rb
964
- - lib/govuk_publishing_components/presenters/select.rb
950
+ - lib/govuk_publishing_components/presenters/select_helper.rb
965
951
  - lib/govuk_publishing_components/presenters/shared_helper.rb
966
952
  - lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb
967
953
  - lib/govuk_publishing_components/presenters/step_by_step_nav_helper.rb
968
954
  - lib/govuk_publishing_components/presenters/subscription_links_helper.rb
969
955
  - lib/govuk_publishing_components/presenters/translation_nav_helper.rb
970
956
  - lib/govuk_publishing_components/version.rb
971
- - lib/tasks/govuk_publishing_components_tasks.rake
972
957
  - node_modules/axe-core/CHANGELOG.md
973
958
  - node_modules/axe-core/CONTRIBUTING.md
974
959
  - node_modules/axe-core/LICENSE
@@ -1771,6 +1756,7 @@ files:
1771
1756
  - node_modules/govuk-frontend/govuk/components/skip-link/fixtures.json
1772
1757
  - node_modules/govuk-frontend/govuk/components/skip-link/macro-options.json
1773
1758
  - node_modules/govuk-frontend/govuk/components/skip-link/macro.njk
1759
+ - node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js
1774
1760
  - node_modules/govuk-frontend/govuk/components/skip-link/template.njk
1775
1761
  - node_modules/govuk-frontend/govuk/components/summary-list/README.md
1776
1762
  - node_modules/govuk-frontend/govuk/components/summary-list/_index.scss
@@ -1820,7 +1806,6 @@ files:
1820
1806
  - node_modules/govuk-frontend/govuk/core/_links.scss
1821
1807
  - node_modules/govuk-frontend/govuk/core/_lists.scss
1822
1808
  - node_modules/govuk-frontend/govuk/core/_section-break.scss
1823
- - node_modules/govuk-frontend/govuk/core/_template.scss
1824
1809
  - node_modules/govuk-frontend/govuk/core/_typography.scss
1825
1810
  - node_modules/govuk-frontend/govuk/helpers/_all.scss
1826
1811
  - node_modules/govuk-frontend/govuk/helpers/_clearfix.scss
@@ -1840,6 +1825,7 @@ files:
1840
1825
  - node_modules/govuk-frontend/govuk/objects/_form-group.scss
1841
1826
  - node_modules/govuk-frontend/govuk/objects/_grid.scss
1842
1827
  - node_modules/govuk-frontend/govuk/objects/_main-wrapper.scss
1828
+ - node_modules/govuk-frontend/govuk/objects/_template.scss
1843
1829
  - node_modules/govuk-frontend/govuk/objects/_width-container.scss
1844
1830
  - node_modules/govuk-frontend/govuk/overrides/_all.scss
1845
1831
  - node_modules/govuk-frontend/govuk/overrides/_display.scss
@@ -1868,7 +1854,6 @@ files:
1868
1854
  - node_modules/govuk-frontend/govuk/tools/_exports.scss
1869
1855
  - node_modules/govuk-frontend/govuk/tools/_font-url.scss
1870
1856
  - node_modules/govuk-frontend/govuk/tools/_ie8.scss
1871
- - node_modules/govuk-frontend/govuk/tools/_iff.scss
1872
1857
  - node_modules/govuk-frontend/govuk/tools/_image-url.scss
1873
1858
  - node_modules/govuk-frontend/govuk/tools/_px-to-em.scss
1874
1859
  - node_modules/govuk-frontend/govuk/tools/_px-to-rem.scss
@@ -2016,14 +2001,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
2016
2001
  requirements:
2017
2002
  - - ">="
2018
2003
  - !ruby/object:Gem::Version
2019
- version: '2.6'
2004
+ version: '2.7'
2020
2005
  required_rubygems_version: !ruby/object:Gem::Requirement
2021
2006
  requirements:
2022
2007
  - - ">="
2023
2008
  - !ruby/object:Gem::Version
2024
2009
  version: '0'
2025
2010
  requirements: []
2026
- rubygems_version: 3.0.3
2011
+ rubygems_version: 3.3.8
2027
2012
  signing_key:
2028
2013
  specification_version: 4
2029
2014
  summary: A gem to document components in GOV.UK frontend applications
@@ -1,100 +0,0 @@
1
- /* eslint-disable no-var */
2
-
3
- // used by the header navigation from govuk_template
4
-
5
- (function () {
6
- 'use strict'
7
-
8
- if (document.querySelectorAll && document.addEventListener) {
9
- var els = document.querySelectorAll('.js-header-toggle')
10
- for (var i = 0; i < els.length; i++) {
11
- // Reassign current index to bypass rules in Chrome and Firefox around indexed property setting
12
- var thisEl = els[i]
13
-
14
- // If the element is an a tag, convert it to a button
15
- // This is to target instances where we want to change behaviour between a js and a no-js view eg: the search button on the mobile menu for some government pages. On no-js it's just a link to /search
16
- // This swaps a link for no-js to a button, making it interactable. Using a link for interactivity is poor accessibility as it's a misuse of the link tag and can be confusing to assistive tech users
17
-
18
- if (thisEl.tagName === 'A') {
19
- var attributes = thisEl.attributes
20
- var button = document.createElement('button')
21
-
22
- for (var k = 0; k < attributes.length; k++) {
23
- var thisAttr = attributes[k].name
24
-
25
- if (thisAttr === 'href') {
26
- if (button.getAttribute('data-search-toggle-for')) {
27
- continue
28
- } else {
29
- button.setAttribute('data-search-toggle-for', thisEl.getAttribute('href').substr(1))
30
- }
31
- } else if (thisAttr !== 'data-button-text') {
32
- button.setAttribute(thisAttr, thisEl.getAttribute(thisAttr))
33
- }
34
- }
35
-
36
- button.innerText = thisEl.getAttribute('data-button-text') || thisEl.innerText
37
-
38
- thisEl.parentNode.replaceChild(button, thisEl)
39
- thisEl = button
40
- }
41
-
42
- thisEl.addEventListener('click', function (e) {
43
- e.preventDefault()
44
- var target = document.getElementById(this.getAttribute('data-search-toggle-for'))
45
- var targetClass = target.getAttribute('class') || ''
46
- var sourceClass = this.getAttribute('class') || ''
47
- var isSearchToggle = sourceClass.match('search-toggle')
48
- var showText = this.getAttribute('data-show-text') || 'Show search'
49
- var hideText = this.getAttribute('data-hide-text') || 'Hide search'
50
- var buttonName = this.getAttribute('data-button-name') || 'menu'
51
-
52
- if (targetClass.indexOf('js-visible') !== -1) {
53
- target.setAttribute('class', targetClass.replace(/(^|\s)js-visible(\s|$)/, ''))
54
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
55
- window.GOVUK.analytics.trackEvent('headerClicked', buttonName + 'Closed', { label: 'none' })
56
- }
57
- } else {
58
- target.setAttribute('class', targetClass + ' js-visible')
59
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
60
- window.GOVUK.analytics.trackEvent('headerClicked', buttonName + 'Opened', { label: 'none' })
61
- }
62
- }
63
- if (sourceClass.indexOf('js-visible') !== -1) {
64
- this.setAttribute('class', sourceClass.replace(/(^|\s)js-visible(\s|$)/, ''))
65
- if (isSearchToggle) {
66
- this.innerText = showText
67
- }
68
- } else {
69
- this.setAttribute('class', sourceClass + ' js-visible')
70
- if (isSearchToggle) {
71
- this.innerText = hideText
72
- }
73
- }
74
- this.setAttribute('aria-expanded', this.getAttribute('aria-expanded') !== 'true')
75
- target.setAttribute('aria-hidden', target.getAttribute('aria-hidden') === 'false')
76
- })
77
- }
78
- }
79
- }).call(this)
80
-
81
- ;(function () {
82
- var $menuToggleButtons = document.querySelectorAll('.govuk-js-header-toggle')
83
-
84
- for (var j = 0; j < $menuToggleButtons.length; j++) {
85
- var element = $menuToggleButtons[j]
86
-
87
- element.addEventListener('click', function (event) {
88
- var buttonName = event.target.getAttribute('data-button-name') || 'menu'
89
- var expanded = event.target.getAttribute('aria-expanded')
90
-
91
- if (window.GOVUK.analytics && window.GOVUK.analytics.trackEvent) {
92
- if (expanded === 'true') {
93
- window.GOVUK.analytics.trackEvent('headerClicked', buttonName + 'Closed', { label: 'none' })
94
- } else {
95
- window.GOVUK.analytics.trackEvent('headerClicked', buttonName + 'Opened', { label: 'none' })
96
- }
97
- }
98
- })
99
- }
100
- })()
@@ -1,43 +0,0 @@
1
- module GovukPublishingComponents
2
- module Presenters
3
- class SelectHelper
4
- attr_reader :options, :option_markup, :selected_option
5
-
6
- def initialize(options)
7
- @options = options
8
- @option_markup = get_options
9
- end
10
-
11
- def data_tracking?
12
- @options.any? { |item| item[:data_attributes] && item[:data_attributes][:track_category] && item[:data_attributes][:track_action] }
13
- end
14
-
15
- private
16
-
17
- def get_options
18
- return if options.nil?
19
-
20
- options.map do |option|
21
- @selected_option = option[:value] if option[:selected]
22
- [
23
- option[:text],
24
- option[:value],
25
- options_data_attribute(option[:data_attributes]),
26
- ]
27
- end
28
- end
29
-
30
- def options_data_attribute(attributes)
31
- return {} if attributes.nil?
32
-
33
- attrs = {}
34
- attributes.each do |key, value|
35
- key_name = "data-#{key.to_s.split('_').join('-')}"
36
- attrs[key_name] = value.is_a?(Hash) ? value.to_json : value
37
- end
38
-
39
- attrs
40
- end
41
- end
42
- end
43
- end
@@ -1,49 +0,0 @@
1
- namespace :component do
2
- desc "warns if component view files exist without corresponding documentation"
3
- task :validate_documentation_exists do
4
- print "Validating that each component has documentation... "
5
- components_missing_docs = []
6
- component_views = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.html.erb"]
7
- component_views.each do |partial|
8
- expected_component_docs_file = partial.split("/")[-1].gsub("html.erb", "yml")
9
- expected_component_docs_file.sub!(/^_/, "")
10
-
11
- expected_component_docs_path = "app/views/#{GovukPublishingComponents::Config.component_directory_name}/docs/#{expected_component_docs_file}"
12
- components_missing_docs << partial unless File.exist?(expected_component_docs_path)
13
- end
14
-
15
- if components_missing_docs.any?
16
- error = "You have components which are missing documentation. These components will not be displayed in the component guide:\n"
17
- components_missing_docs.each { |component| error += "\t#{component}\n" }
18
- error += "\n"
19
- raise NotImplementedError, error
20
- end
21
- puts "✔︎"
22
- end
23
-
24
- desc "warns if component is missing accessibility criteria"
25
- task :validate_accessibility_criteria_exist do
26
- print "Validating that each component has accessibility criteria... "
27
- errors = []
28
-
29
- component_docs = Dir["app/views/#{GovukPublishingComponents::Config.component_directory_name}/**/*.yml"]
30
- component_docs.each do |doc_file|
31
- file = YAML.load_file(doc_file)
32
-
33
- if file["accessibility_criteria"].nil? && file["shared_accessibility_criteria"].nil?
34
- errors << file["name"]
35
- end
36
- end
37
- if errors.any?
38
- error = "The following components need accessibility criteria:\n#{errors.join("\n")}"
39
- raise NotImplementedError, error
40
- end
41
- puts "✔︎"
42
- end
43
-
44
- desc "warns if component view files exist without corresponding documentation or accessibility critera"
45
- task :validate_documentation do
46
- Rake::Task["component:validate_documentation_exists"].invoke
47
- Rake::Task["component:validate_accessibility_criteria_exist"].invoke
48
- end
49
- end
@@ -1,17 +0,0 @@
1
- ////
2
- /// @group tools
3
- ////
4
-
5
- /// Syntactic sugar around Sass' built-in `if` function that does not require
6
- /// you to pass a value for `$if-false`.
7
- ///
8
- /// @param {Boolean} $condition - Whether to return the value of `$if-true`
9
- /// @param {Mixed} $if-true - Value to return if `$condition` is truthy
10
- /// @return {Mixed} Value of `$if-true` if `$condition` is truthy, else null
11
- /// @access private
12
- /// @deprecated We will be removing this function in a future release, use `if($condition, $if-true, null);` instead.
13
-
14
- @function iff($condition, $if-true) {
15
- @warn "The `iff` function will be removed in a future release, use `if($condition, $if-true, null);` instead.";
16
- @return if($condition, $if-true, null);
17
- }