govuk_publishing_components 70.2.0 → 71.0.0

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 (115) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +19 -2
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +3 -3
  4. data/app/assets/javascripts/govuk_publishing_components/components/govspeak.js +9 -0
  5. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +1 -1
  6. data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/table-scroll.js +108 -0
  7. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +2 -2
  8. data/app/assets/stylesheets/component_guide/application.scss +7 -3
  9. data/app/assets/stylesheets/govuk_publishing_components/all-components.scss +0 -1
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +0 -13
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_chart.scss +31 -6
  12. data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +0 -4
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_service-navigation.scss +1 -0
  14. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +67 -0
  15. data/app/controllers/govuk_publishing_components/component_guide_controller.rb +11 -39
  16. data/app/models/govuk_publishing_components/component_doc.rb +2 -6
  17. data/app/models/govuk_publishing_components/component_docs.rb +2 -8
  18. data/app/views/govuk_publishing_components/component_guide/_component_list.html.erb +1 -5
  19. data/app/views/govuk_publishing_components/component_guide/component_doc/_component_output.html.erb +2 -10
  20. data/app/views/govuk_publishing_components/component_guide/example.html.erb +1 -1
  21. data/app/views/govuk_publishing_components/component_guide/index.html.erb +0 -7
  22. data/app/views/govuk_publishing_components/component_guide/preview.html.erb +1 -9
  23. data/app/views/govuk_publishing_components/component_guide/show.html.erb +10 -28
  24. data/app/views/govuk_publishing_components/components/_chart.html.erb +5 -5
  25. data/app/views/govuk_publishing_components/components/_metadata.html.erb +0 -6
  26. data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -2
  27. data/app/views/govuk_publishing_components/components/docs/chart.yml +76 -2
  28. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +28 -0
  29. data/app/views/govuk_publishing_components/components/docs/metadata.yml +12 -12
  30. data/app/views/govuk_publishing_components/components/docs/service_navigation.yml +38 -3
  31. data/config/locales/ar.yml +2 -10
  32. data/config/locales/az.yml +2 -10
  33. data/config/locales/be.yml +2 -10
  34. data/config/locales/bg.yml +2 -10
  35. data/config/locales/bn.yml +2 -10
  36. data/config/locales/cs.yml +2 -10
  37. data/config/locales/cy.yml +6 -14
  38. data/config/locales/da.yml +2 -10
  39. data/config/locales/de.yml +2 -10
  40. data/config/locales/dr.yml +2 -10
  41. data/config/locales/el.yml +2 -10
  42. data/config/locales/en.yml +14 -22
  43. data/config/locales/es-419.yml +2 -10
  44. data/config/locales/es.yml +2 -10
  45. data/config/locales/et.yml +2 -10
  46. data/config/locales/fa.yml +2 -10
  47. data/config/locales/fi.yml +2 -10
  48. data/config/locales/fr.yml +2 -10
  49. data/config/locales/gd.yml +2 -10
  50. data/config/locales/gu.yml +2 -10
  51. data/config/locales/he.yml +2 -10
  52. data/config/locales/hi.yml +2 -10
  53. data/config/locales/hr.yml +2 -10
  54. data/config/locales/hu.yml +2 -10
  55. data/config/locales/hy.yml +2 -10
  56. data/config/locales/id.yml +2 -10
  57. data/config/locales/is.yml +2 -10
  58. data/config/locales/it.yml +2 -10
  59. data/config/locales/ja.yml +2 -10
  60. data/config/locales/ka.yml +2 -10
  61. data/config/locales/kk.yml +2 -10
  62. data/config/locales/ko.yml +2 -10
  63. data/config/locales/ku.yml +2 -10
  64. data/config/locales/ky.yml +2 -10
  65. data/config/locales/lt.yml +2 -10
  66. data/config/locales/lv.yml +2 -10
  67. data/config/locales/ms.yml +2 -10
  68. data/config/locales/mt.yml +2 -10
  69. data/config/locales/ne.yml +2 -10
  70. data/config/locales/nl.yml +2 -10
  71. data/config/locales/no.yml +2 -10
  72. data/config/locales/pa-pk.yml +2 -10
  73. data/config/locales/pa.yml +2 -10
  74. data/config/locales/pl.yml +2 -10
  75. data/config/locales/ps.yml +2 -10
  76. data/config/locales/pt.yml +2 -10
  77. data/config/locales/ro.yml +2 -10
  78. data/config/locales/ru.yml +2 -10
  79. data/config/locales/si.yml +2 -10
  80. data/config/locales/sk.yml +2 -10
  81. data/config/locales/sl.yml +2 -10
  82. data/config/locales/so.yml +2 -10
  83. data/config/locales/sq.yml +2 -10
  84. data/config/locales/sr.yml +2 -10
  85. data/config/locales/sv.yml +2 -10
  86. data/config/locales/sw.yml +2 -10
  87. data/config/locales/ta.yml +2 -10
  88. data/config/locales/th.yml +2 -10
  89. data/config/locales/ti.yml +2 -10
  90. data/config/locales/tk.yml +2 -10
  91. data/config/locales/tr.yml +2 -10
  92. data/config/locales/uk.yml +2 -10
  93. data/config/locales/ur.yml +2 -10
  94. data/config/locales/uz.yml +2 -10
  95. data/config/locales/vi.yml +2 -10
  96. data/config/locales/zh-hk.yml +2 -10
  97. data/config/locales/zh-tw.yml +2 -10
  98. data/config/locales/zh.yml +2 -10
  99. data/config/routes.rb +0 -7
  100. data/lib/govuk_publishing_components/config.rb +0 -4
  101. data/lib/govuk_publishing_components/presenters/chart_helper.rb +33 -12
  102. data/lib/govuk_publishing_components/version.rb +1 -1
  103. data/node_modules/axe-core/README.md +1 -0
  104. data/node_modules/axe-core/axe.js +7695 -3210
  105. data/node_modules/axe-core/axe.min.js +2 -2
  106. data/node_modules/axe-core/locales/_template.json +46 -20
  107. data/node_modules/axe-core/locales/az.json +1161 -0
  108. data/node_modules/axe-core/locales/de.json +1 -1
  109. data/node_modules/axe-core/package.json +7 -8
  110. data/node_modules/axe-core/sri-history.json +4 -0
  111. metadata +4 -6
  112. data/app/assets/javascripts/govuk_publishing_components/components/metadata.js +0 -24
  113. data/app/assets/stylesheets/govuk_publishing_components/components/_published-dates.scss +0 -55
  114. data/app/views/govuk_publishing_components/components/_published_dates.html.erb +0 -48
  115. data/app/views/govuk_publishing_components/components/docs/published_dates.yml +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1a6d5f7de8f25961e21640cb7b451099f2c1d5cf7b885b189a6c7f1db6229dd
4
- data.tar.gz: 319ae2c442a8165da752b22f7572c8efe3c14d35d9243cf6f76a4c238be8b538
3
+ metadata.gz: 74db3ccfb835e4b5298212da9a2fbcdd6c6df533a174622e62ef8c09f838e163
4
+ data.tar.gz: 6c8d9fba438b66e7f71191021547d009ffffff268061665ee7b3b7701888aef1
5
5
  SHA512:
6
- metadata.gz: 0ca7d6d4464fc5d4e604619e44f7c4e0cb8c579e12caa9c0d1b15ecc8adf712fc72677244f6253ff43dc60e36c8ddcc0a0ff3e20630d80ccf1eac771d824133e
7
- data.tar.gz: 8cabc09cbdbe57bdf87a68b141a58e9a199cfc47a6ed844c296a862214392a52444bb5a1c28aab06103250caf50d27c11d0524afdaa5a424527150d513f55f23
6
+ metadata.gz: 6a304e13a7a304c5851f17efc0e6920589401ebe9943f16837b0e548a3ca80d9f4468ddb6b3d5114506ab0cfd1cd90f34e619f01591f31df4420eddb4f6b22ad
7
+ data.tar.gz: d0814535e7016e51788030010ad2cc7b6a490a138e81ccca427e3dc80cb9e143dfceb3792593571ec8c94da87ad536930b3cb55bf3542d3fdfc45a801b64aa9c
@@ -69,13 +69,28 @@
69
69
  user_created_at: this.getMetaContent('user-created-at'),
70
70
  user_organisation_name: this.getMetaContent('user-organisation-name'),
71
71
  user_role: this.getMetaContent('user-role'),
72
- user_id: this.getMetaContent('user-id')
72
+ user_id: this.getMetaContent('user-id'),
73
+
74
+ utm_source: this.getUtmParams('utm_source'),
75
+ utm_medium: this.getUtmParams('utm_medium'),
76
+ utm_campaign: this.getUtmParams('utm_campaign'),
77
+ utm_term: this.getUtmParams('utm_term'),
78
+ utm_content: this.getUtmParams('utm_content')
73
79
  }
74
80
  }
75
81
  window.GOVUK.analyticsGa4.core.sendData(data)
76
82
  }
77
83
  },
78
84
 
85
+ getUtmParams: function (key) {
86
+ if (this.getLocation().indexOf('?') > -1) {
87
+ var queryStringParams = new URLSearchParams(this.getLocation().split('?')[1])
88
+ return queryStringParams.get(key) || undefined
89
+ } else {
90
+ return undefined
91
+ }
92
+ },
93
+
79
94
  removeHyphensAndDowncase: function (text) {
80
95
  if (text) {
81
96
  return text.replace(/-/g, ' ').toLowerCase()
@@ -102,7 +117,8 @@
102
117
 
103
118
  getLocation: function () {
104
119
  // We don't want to remove dates on search pages.
105
- return this.PIIRemover.stripPIIWithOverride(this.stripGaParam(document.location.href), this.stripDates, true)
120
+ // Where a token is present this should be redacted
121
+ return this.PIIRemover.stripPIIWithOverride(this.stripGaParam(document.location.href.replace(/(&token=)(\S+)/, '')), this.stripDates, true)
106
122
  },
107
123
 
108
124
  getSearchTerm: function () {
@@ -149,6 +165,7 @@
149
165
  queryString = this.stripGaParam(queryString)
150
166
  queryString = this.PIIRemover.stripPIIWithOverride(queryString, this.stripDates, true)
151
167
  queryString = queryString.substring(1) // removes the '?' character from the start.
168
+ queryString = queryString.replace(/(&token=)(\S+)/, '') // where a token is present this should be redacted
152
169
  return queryString
153
170
  }
154
171
  },
@@ -10,8 +10,8 @@
10
10
  // e.g. 1990/01/01 or 1990-01-01 or 1990-1-1 or 1990/1/1 or 1990\1\1 or 1990\01\01
11
11
  var DATE_PATTERN_NUMERIC_2 = /\d{4}([-\/\\])\d{1,2}([-\/\\])\d{1,2}/g // eslint-disable-line no-useless-escape
12
12
 
13
- // e.g. 12345678 (This originated from the UA PII Remover)
14
- var DATE_PATTERN_NUMERIC_3 = /[0-9]{8}/g
13
+ // e.g. Matches 8 digit date strings in either DDMMYYYY or YYYYMMDD format, constrained to years between 1900 and 2099.
14
+ const DATE_PATTERN_NUMERIC_3 = /\b(?:(?:0[1-9]|[12]\d|3[01])(?:0[1-9]|1[0-2])(?:19|20)\d{2}|(?:19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01]))\b/g
15
15
 
16
16
  // e.g. 1(st) (of) Jan(uary) 1990 (or 90 or '90) - where the bracketed characters are optional parts that can be matched
17
17
  var DATE_PATTERN_STRING_1 = /\d{1,2}(?:st|nd|rd|th)?\s(?:of\s)?(Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:t)?(?:ember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\s(?:')?(\d{4}|\d{2})/gi
@@ -33,7 +33,7 @@
33
33
 
34
34
  // 2 valid letters - optional +/space - 6 digits with optional +/spaces every 2 digits (to account for '12 34 56') - optional +/space - 1 valid letter. Case insensitive.
35
35
  // e.g. 'AB123456A', 'AB 12 34 56 A', 'ab 123456 a', 'ab 12 34 56 a', 'AB+12+34+56+A'
36
- var NATIONAL_INSURANCE_NUMBER = /[A-CEGHJ-OPR-TW-Z]{2}(\s+|\++)?(\d{2}(\s+|\++)?){3}[A-D]/gi
36
+ var NATIONAL_INSURANCE_NUMBER = /\b[A-CEGHJ-OPR-TW-Z]{2}(\s+|\++)?(\d{2}(\s+|\++)?){3}[A-D]\b/gi
37
37
 
38
38
  function shouldStripDates () {
39
39
  var metas = document.querySelectorAll('meta[name="govuk:ga4-strip-dates"]')
@@ -9,6 +9,10 @@
9
9
  }
10
10
 
11
11
  this.createBarcharts()
12
+
13
+ if (this.$module.querySelectorAll('table').length) {
14
+ this.tableScroll()
15
+ }
12
16
  }
13
17
 
14
18
  Govspeak.prototype.embedYoutube = function () {
@@ -21,5 +25,10 @@
21
25
  enhancement.init()
22
26
  }
23
27
 
28
+ Govspeak.prototype.tableScroll = function () {
29
+ var enhancement = new window.GOVUK.GovspeakTableScroll(this.$module)
30
+ enhancement.init()
31
+ }
32
+
24
33
  Modules.Govspeak = Govspeak
25
34
  })(window.GOVUK.Modules)
@@ -287,7 +287,7 @@
287
287
 
288
288
  var loaded = this.loadFromSessionStorage(this.$module.sessionStoreLink)
289
289
  var activeParent = this.$module.querySelectorAll('.' + this.$module.activeLinkClass)[0]
290
- var activeChild = activeParent.firstChild
290
+ var activeChild = activeParent.firstElementChild
291
291
  var foundLink = activeChild.getAttribute('data-position')
292
292
  var lastClicked = loaded || foundLink // the value saved has priority
293
293
 
@@ -0,0 +1,108 @@
1
+ (function (GOVUK) {
2
+ 'use strict'
3
+
4
+ var TableScroll = function ($element) {
5
+ this.element = $element
6
+ this.tables = this.element.querySelectorAll('table')
7
+ this.windowResizeTimeout = null
8
+ }
9
+
10
+ TableScroll.prototype.init = function () {
11
+ if (this.tables.length === 0) {
12
+ return
13
+ }
14
+
15
+ // a small timeout ensures scrollWidth is accurate
16
+ setTimeout(() => {
17
+ this.windowResized()
18
+ }, 10)
19
+
20
+ window.onresize = () => {
21
+ if (this.windowResizeTimeout) {
22
+ clearTimeout(this.windowResizeTimeout)
23
+ }
24
+
25
+ this.windowResizeTimeout = setTimeout(function () {
26
+ this.windowResized()
27
+ }.bind(this), 500)
28
+ }
29
+ }
30
+
31
+ TableScroll.prototype.windowResized = function () {
32
+ this.destroyElements()
33
+ this.setupElements()
34
+ }
35
+
36
+ TableScroll.prototype.setupElements = function () {
37
+ this.tables.forEach(table => {
38
+ const tablewrapper = table.closest('.tablewrapper')
39
+
40
+ if (!(table.scrollWidth > table.clientWidth)) {
41
+ if (tablewrapper) {
42
+ tablewrapper.className = 'tablewrapper'
43
+ }
44
+ return
45
+ }
46
+
47
+ // wrap the table in a div, but only the first time
48
+ if (!tablewrapper) {
49
+ var wrapper = document.createElement('div')
50
+ wrapper.classList.add('tablewrapper')
51
+ table.parentNode.insertBefore(wrapper, table)
52
+ wrapper.appendChild(table)
53
+ }
54
+
55
+ const scrollBar = document.createElement('div')
56
+ scrollBar.setAttribute('tabindex', '-1')
57
+ scrollBar.classList.add('govspeak-table-scrollbar')
58
+
59
+ const scrollBarChild = document.createElement('div')
60
+ scrollBarChild.classList.add('govspeak-table-scrollbar__child')
61
+ scrollBarChild.style.width = `${table.scrollWidth}px`
62
+
63
+ scrollBar.append(scrollBarChild)
64
+ table.before(scrollBar)
65
+ scrollBar.scrollLeft = table.scrollLeft
66
+ this.updateLeftRight(table)
67
+
68
+ scrollBar.onscroll = () => {
69
+ if (this.preventScrolling) {
70
+ this.preventScrolling = false
71
+ return
72
+ }
73
+ this.preventScrolling = true
74
+ table.scrollLeft = scrollBar.scrollLeft
75
+ this.updateLeftRight(table)
76
+ }
77
+
78
+ table.onscroll = () => {
79
+ if (this.preventScrolling) {
80
+ this.preventScrolling = false
81
+ return
82
+ }
83
+ this.preventScrolling = true
84
+ scrollBar.scrollLeft = table.scrollLeft
85
+ this.updateLeftRight(table)
86
+ }
87
+ })
88
+ }
89
+
90
+ TableScroll.prototype.updateLeftRight = function (table) {
91
+ if ((table.scrollWidth - table.scrollLeft) < (table.offsetWidth + 1)) {
92
+ table.parentElement.className = 'tablewrapper tablewrapper--active tablewrapper--end'
93
+ } else if (table.scrollLeft < 1) {
94
+ table.parentElement.className = 'tablewrapper tablewrapper--active tablewrapper--start'
95
+ } else {
96
+ table.parentElement.className = 'tablewrapper tablewrapper--active'
97
+ }
98
+ }
99
+
100
+ TableScroll.prototype.destroyElements = function () {
101
+ const scrollBars = this.element.querySelectorAll('.govspeak-table-scrollbar')
102
+ scrollBars.forEach(bar => {
103
+ bar.remove()
104
+ })
105
+ }
106
+
107
+ GOVUK.GovspeakTableScroll = TableScroll
108
+ }(window.GOVUK))
@@ -298,7 +298,7 @@
298
298
  return sendBeaconImpl(url, data);
299
299
  }
300
300
 
301
- var version = "4.5.2";
301
+ var version = "4.5.3";
302
302
  var pkg = {
303
303
  version: version};
304
304
 
@@ -1191,7 +1191,7 @@
1191
1191
  var po = new PerformanceObserver(function (list) {
1192
1192
  list.getEntries().forEach(function (entry) { return callback(entry); });
1193
1193
  });
1194
- po.observe(Object.assign({ type: type, buffered: true }, { options: options }));
1194
+ po.observe(Object.assign({ type: type, buffered: true }, options));
1195
1195
  return po;
1196
1196
  }
1197
1197
  return undefined;
@@ -115,7 +115,7 @@ $gem-guide-border-width: 1px;
115
115
  .component-guide-preview--violation,
116
116
  .component-guide-preview--warning {
117
117
  margin-top: -$gem-guide-border-width;
118
-
118
+
119
119
  color: govuk-functional-colour(text);
120
120
  @include govuk-font($size: 19);
121
121
 
@@ -217,6 +217,11 @@ html {
217
217
  .preview-title {
218
218
  padding-left: govuk-spacing(3);
219
219
  }
220
+
221
+ .gem-full-width__element {
222
+ margin-left: 0;
223
+ margin-right: 0;
224
+ }
220
225
  }
221
226
 
222
227
  // Rouge syntax highlighting
@@ -489,10 +494,9 @@ $code-delete-bg: #fadddd;
489
494
  padding: 0;
490
495
  padding-bottom: 0.1px; // forces child margin inside
491
496
  border: 0;
497
+ border-top: solid 1px govuk-functional-colour(border);
492
498
  margin-left: -(govuk-spacing(3));
493
499
  margin-right: -(govuk-spacing(3));
494
- border-top: solid 1px govuk-functional-colour(border);
495
- border-bottom: solid 1px govuk-functional-colour(border);
496
500
 
497
501
  @include govuk-media-query($from: tablet) {
498
502
  margin-left: -(govuk-spacing(6));
@@ -72,7 +72,6 @@ $govuk-output-custom-properties: true;
72
72
  @import "components/phase-banner";
73
73
  @import "components/pagination";
74
74
  @import "components/print-link";
75
- @import "components/published-dates";
76
75
  @import "components/radio";
77
76
  @import "components/related-navigation";
78
77
  @import "components/reorderable-list";
@@ -7,20 +7,7 @@
7
7
  padding: 0;
8
8
  margin: 0;
9
9
  display: grid;
10
- // stylelint-disable-next-line property-no-deprecated
11
- grid-column-gap: govuk-spacing(6); // Use deprecated grid-column-gap for Grade C browser support
12
10
  column-gap: govuk-spacing(6);
13
-
14
- @include govuk-media-query($from: "desktop") {
15
- // For browsers that don't support CSS grid, constrain the width to 50% to improve usability
16
- // especially for screen magnifier users
17
- width: 50%;
18
-
19
- // Reset the width for browsers that support CSS grid
20
- @supports (display: grid) {
21
- width: initial;
22
- }
23
- }
24
11
  }
25
12
 
26
13
  .gem-c-cards__list--one-column {
@@ -28,15 +28,36 @@
28
28
  margin: 0;
29
29
  }
30
30
 
31
- .govuk-table .govuk-table__header {
32
- text-align: center;
33
- }
31
+ }
34
32
 
35
- .govuk-table .govuk-table__cell {
36
- text-align: center;
37
- }
33
+ .gem-c-chart div svg g[clip-path] rect,
34
+ .gem-c-chart div svg g[clip-path] circle {
35
+ cursor: pointer;
36
+ }
37
+
38
+ // Legend
39
+ .gem-c-chart div svg g:has(text[text-anchor="start"]) * {
40
+ cursor: pointer;
41
+ }
42
+
43
+ // For line chart points
44
+ .gem-c-chart svg circle {
45
+ cursor: pointer;
38
46
  }
39
47
 
48
+ // Prevent line chart lines having cursor: pointer
49
+ .gem-c-chart svg g[clip-path] path[fill="none"] {
50
+ cursor: default;
51
+ }
52
+
53
+ // Force grid lines back to default
54
+ .gem-c-chart div svg g[clip-path] rect[height="1"],
55
+ .gem-c-chart div svg g[clip-path] rect[width="1"] {
56
+ cursor: default;
57
+ pointer-events: none;
58
+ }
59
+
60
+
40
61
  .gem-c-chart .gem-c-chart__a11y-note-link {
41
62
  display: none;
42
63
  margin-bottom: govuk-spacing(2);
@@ -56,6 +77,10 @@
56
77
  }
57
78
  }
58
79
 
80
+ .gem-c-chart__source {
81
+ color: govuk-functional-colour(secondary-text);
82
+ }
83
+
59
84
  .js-enabled {
60
85
  .gem-c-chart .gem-c-chart__a11y-note-link {
61
86
  display: inline;
@@ -8,10 +8,6 @@
8
8
  @include govuk-link-common;
9
9
  @include govuk-link-style-default;
10
10
  }
11
-
12
- .gem-c-metadata__definition-link {
13
- font-weight: normal;
14
- }
15
11
  }
16
12
 
17
13
  .direction-rtl .gem-c-metadata,
@@ -2,6 +2,7 @@
2
2
 
3
3
  .gem-c-service-navigation--full-width {
4
4
  padding-left: govuk-spacing(3);
5
+ padding-right: govuk-spacing(3);
5
6
  }
6
7
 
7
8
  .gem-c-service-navigation--hide-service-name-on-mobile {
@@ -54,6 +54,73 @@
54
54
  text-align: right;
55
55
  }
56
56
  }
57
+
58
+ .tablewrapper {
59
+ position: relative;
60
+ }
61
+
62
+ .tablewrapper--active {
63
+ &::before,
64
+ &::after {
65
+ content: "";
66
+ position: absolute;
67
+ top: 24px;
68
+ width: 10px;
69
+ bottom: 20px;
70
+ background: rgb(0, 0, 0, 0.1);
71
+ border-color: $govuk-border-colour;
72
+ border-width: 5px;
73
+ }
74
+
75
+ &::before {
76
+ left: 0;
77
+ border-left-style: solid;
78
+ border-radius: 0 15px 15px 0;
79
+ }
80
+
81
+ &::after {
82
+ right: 0;
83
+ border-right-style: solid;
84
+ border-radius: 15px 0 0 15px;
85
+ }
86
+ }
87
+
88
+ .tablewrapper--start {
89
+ &::before {
90
+ display: none;
91
+ }
92
+ }
93
+
94
+ .tablewrapper--end {
95
+ &::after {
96
+ display: none;
97
+ }
98
+ }
99
+
100
+ .govspeak-table-scrollbar {
101
+ overflow-x: scroll;
102
+ overflow-y: hidden;
103
+ height: 20px;
104
+ margin-bottom: 5px;
105
+
106
+ &:focus {
107
+ outline: none;
108
+ }
109
+ }
110
+
111
+ .govspeak-table-scrollbar__child {
112
+ height: 20px;
113
+ }
114
+
115
+ .govspeak-table-scrollbar + table:focus {
116
+ outline: $govuk-focus-width solid govuk-functional-colour(focus);
117
+ box-shadow: 0 0 0 6px govuk-functional-colour("focus-text");
118
+
119
+ &::before,
120
+ &::after {
121
+ display: none;
122
+ }
123
+ }
57
124
  }
58
125
 
59
126
  // Add rtl table styling when `direction: "rtl"` is set
@@ -1,7 +1,6 @@
1
1
  module GovukPublishingComponents
2
2
  class ComponentGuideController < GovukPublishingComponents::ApplicationController
3
3
  append_view_path Rails.root.join("app", "views", GovukPublishingComponents::Config.component_directory_name).to_s
4
- append_view_path Rails.root.join("app", "views", GovukPublishingComponents::Config.flexible_sections_directory_name).to_s
5
4
 
6
5
  MATCH_COMPONENTS = /(?<=govuk_publishing_components\/components\/)[\/a-zA-Z_-]+(?=['"])/
7
6
 
@@ -14,45 +13,29 @@ module GovukPublishingComponents
14
13
  @unused_components = unused_components_names.get_component_docs
15
14
  @components_in_use_sass = components_in_use_sass
16
15
  @components_in_use_js = components_in_use_js
17
- @flexible_section_docs = flexible_section_docs.all
18
16
  end
19
17
 
20
18
  def show
21
- if params[:flexible_section]
22
- @component_doc = flexible_section_docs.get(params[:flexible_section])
23
- @example_path = flexible_section_example_path(@component_doc.id, "default")
24
- @preview_path = flexible_section_preview_path(@component_doc.id, "default")
25
- @preview_all_path = flexible_section_preview_all_path(@component_doc.id)
26
-
27
- @guide_breadcrumbs = [index_breadcrumb, flexible_section_breadcrumb(@component_doc)]
28
- else
29
- @component_doc = component_docs.get(params[:component])
30
- @example_path = component_example_path(@component_doc.id, "default")
31
- @preview_path = component_preview_path(@component_doc.id, "default")
32
- @preview_all_path = component_preview_all_path(@component_doc.id)
33
-
34
- @guide_breadcrumbs = [index_breadcrumb, component_breadcrumb(@component_doc)]
35
- end
19
+ @component_doc = component_docs.get(params[:component])
20
+ @guide_breadcrumbs = [index_breadcrumb, component_breadcrumb(@component_doc)]
36
21
  end
37
22
 
38
23
  def example
39
- @component_doc = params[:flexible_section] ? flexible_section_docs.get(params[:flexible_section]) : component_docs.get(params[:component])
24
+ @component_doc = component_docs.get(params[:component])
40
25
  @component_example = @component_doc.examples.find { |f| f.id == params[:example] }
41
26
 
42
- @guide_breadcrumbs = [index_breadcrumb]
43
- if params[:flexible_section]
44
- @preview_path = flexible_section_preview_path(@component_doc.id, @component_example.id)
45
- @guide_breadcrumbs << flexible_section_breadcrumb(@component_doc, @component_example)
46
- else
47
- @preview_path = component_preview_path(@component_doc.id, @component_example.id)
48
- @guide_breadcrumbs << component_breadcrumb(@component_doc, @component_example)
49
- end
50
- @guide_breadcrumbs << { title: @component_example.name }
27
+ @guide_breadcrumbs = [
28
+ index_breadcrumb,
29
+ component_breadcrumb(@component_doc, @component_example),
30
+ {
31
+ title: @component_example.name,
32
+ },
33
+ ]
51
34
  end
52
35
 
53
36
  def preview
54
37
  @component_examples = []
55
- @component_doc = params[:flexible_section] ? flexible_section_docs.get(params[:flexible_section]) : component_docs.get(params[:component])
38
+ @component_doc = component_docs.get(params[:component])
56
39
  @preview = true
57
40
 
58
41
  if params[:example].present?
@@ -91,10 +74,6 @@ module GovukPublishingComponents
91
74
  @gem_component_docs ||= ComponentDocs.new(gem_components: true)
92
75
  end
93
76
 
94
- def flexible_section_docs
95
- @flexible_section_docs ||= ComponentDocs.new(flexible_sections: true)
96
- end
97
-
98
77
  def used_components_names
99
78
  @used_components_names ||= ComponentDocs.new(gem_components: true, limit_to: get_used_component_names)
100
79
  end
@@ -188,12 +167,5 @@ module GovukPublishingComponents
188
167
  h[:url] = component_doc_path(component_doc.id) if component_example
189
168
  end
190
169
  end
191
-
192
- def flexible_section_breadcrumb(component_doc, component_example = nil)
193
- {}.tap do |h|
194
- h[:title] = "#{component_doc.name} (flexible section)"
195
- h[:url] = flexible_section_doc_path(component_doc.id) if component_example
196
- end
197
- end
198
170
  end
199
171
  end
@@ -7,10 +7,9 @@ module GovukPublishingComponents
7
7
  :component,
8
8
  :accessibility_excluded_rules,
9
9
  :source,
10
- :embed,
11
- :type
10
+ :embed
12
11
 
13
- def initialize(component, type)
12
+ def initialize(component)
14
13
  @component = component
15
14
  @id = component[:id]
16
15
  @name = component[:name]
@@ -19,7 +18,6 @@ module GovukPublishingComponents
19
18
  @accessibility_excluded_rules = component[:accessibility_excluded_rules]
20
19
  @source = component[:source]
21
20
  @embed = component[:embed]
22
- @type = type
23
21
  end
24
22
 
25
23
  def accessibility_criteria
@@ -90,8 +88,6 @@ module GovukPublishingComponents
90
88
  def partial_path
91
89
  if source == "gem"
92
90
  "govuk_publishing_components/components/#{id}"
93
- elsif type == "flexible section"
94
- "#{GovukPublishingComponents::Config.flexible_sections_directory_name}/#{id}"
95
91
  else
96
92
  "#{GovukPublishingComponents::Config.component_directory_name}/#{id}"
97
93
  end
@@ -1,11 +1,9 @@
1
1
  module GovukPublishingComponents
2
2
  # @private
3
3
  class ComponentDocs
4
- def initialize(gem_components: false, limit_to: false, flexible_sections: false)
4
+ def initialize(gem_components: false, limit_to: false)
5
5
  @limit_to = limit_to
6
6
  @documentation_directory = gem_components ? gem_documentation_directory : app_documentation_directory
7
- @documentation_directory = flexible_sections_documentation_directory if flexible_sections
8
- @type = flexible_sections ? "flexible section" : "component"
9
7
  end
10
8
 
11
9
  def get(id)
@@ -24,7 +22,7 @@ module GovukPublishingComponents
24
22
  private
25
23
 
26
24
  def build(component)
27
- ComponentDoc.new(component, @type)
25
+ ComponentDoc.new(component)
28
26
  end
29
27
 
30
28
  def fetch_component_doc_files
@@ -58,9 +56,5 @@ module GovukPublishingComponents
58
56
  def gem_documentation_directory
59
57
  Pathname.new(GovukPublishingComponents::Config.gem_directory).join("app", "views", "govuk_publishing_components", "components", "docs")
60
58
  end
61
-
62
- def flexible_sections_documentation_directory
63
- Rails.root.join("app", "views", GovukPublishingComponents::Config.flexible_sections_directory_name, "docs")
64
- end
65
59
  end
66
60
  end
@@ -5,11 +5,7 @@
5
5
  <ul class="govuk-list govuk-list--bullet govuk-list--spaced">
6
6
  <% local_assigns[:components].each do |component_doc| %>
7
7
  <li data-filter-item data-filter-item-search-terms="<%= component_doc.id %>">
8
- <% if local_assigns[:type] == "flexible_section" %>
9
- <%= link_to component_doc.name, flexible_section_doc_path(component_doc.id), class: "govuk-link" %>
10
- <% else %>
11
- <%= link_to component_doc.name, component_doc_path(component_doc.id), class: "govuk-link" %>
12
- <% end %>
8
+ <%= link_to component_doc.name, component_doc_path(component_doc.id), class: "govuk-link" %>
13
9
  <p class="govuk-body">
14
10
  <%= component_doc.description %>
15
11
  </p>
@@ -1,19 +1,11 @@
1
1
  <% content_for :body_classes, "gem-full-width__container", flush: true %>
2
- <%
3
- if @component_doc.type == "component"
4
- data = example.html_safe_data
5
- else
6
- flexible_section_class = "FlexiblePage::FlexibleSection::#{@component_doc.id.titleize.gsub(" ", "")}".constantize
7
- data = { flexible_section: flexible_section_class.new(**example.html_safe_data.deep_symbolize_keys)}
8
- end
9
- %>
10
2
  <% component = capture do %>
11
3
  <% if example.has_block? %>
12
- <%= render component_doc.partial_path, data do %>
4
+ <%= render component_doc.partial_path, example.html_safe_data do %>
13
5
  <%= render inline: example.block %>
14
6
  <% end %>
15
7
  <% else %>
16
- <%= render component_doc.partial_path, data %>
8
+ <%= render component_doc.partial_path, example.html_safe_data %>
17
9
  <% end %>
18
10
  <% end %>
19
11
 
@@ -24,7 +24,7 @@
24
24
  </div>
25
25
  <h2 class="govuk-heading-m">
26
26
  How it looks
27
- <small class="govuk-!-font-size-16">(<a href="<%= @preview_path %>" class="govuk-link">preview</a>)</small>
27
+ <small class="govuk-!-font-size-16">(<a href="<%= component_preview_path(@component_doc.id, @component_example.id) %>" class="govuk-link">preview</a>)</small>
28
28
  </h2>
29
29
  <%= render partial: "govuk_publishing_components/component_guide/component_doc/preview", locals: { component_doc: @component_doc, example: @component_example } %>
30
30
 
@@ -18,13 +18,6 @@
18
18
 
19
19
  <div data-module="filter-list" data-filter-label="Search components">
20
20
  <% if !ENV["MAIN_COMPONENT_GUIDE"] %>
21
- <%= render partial: "component_list", locals: {
22
- heading: "Flexible sections in this application",
23
- size: @flexible_section_docs.length,
24
- components: @flexible_section_docs,
25
- type: "flexible_section",
26
- } %>
27
-
28
21
  <%= render partial: "component_list", locals: {
29
22
  heading: "Components in this application",
30
23
  size: @component_docs.length,