govuk_publishing_components 70.2.1 → 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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +19 -2
- data/app/assets/javascripts/govuk_publishing_components/components/govspeak.js +9 -0
- data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +1 -1
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/table-scroll.js +108 -0
- data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +2 -2
- data/app/assets/stylesheets/component_guide/application.scss +7 -3
- data/app/assets/stylesheets/govuk_publishing_components/all-components.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_cards.scss +0 -13
- data/app/assets/stylesheets/govuk_publishing_components/components/_chart.scss +31 -6
- data/app/assets/stylesheets/govuk_publishing_components/components/_metadata.scss +0 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_service-navigation.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +67 -0
- data/app/views/govuk_publishing_components/components/_chart.html.erb +5 -5
- data/app/views/govuk_publishing_components/components/_metadata.html.erb +0 -6
- data/app/views/govuk_publishing_components/components/_radio.html.erb +1 -2
- data/app/views/govuk_publishing_components/components/docs/chart.yml +76 -2
- data/app/views/govuk_publishing_components/components/docs/govspeak.yml +28 -0
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +12 -12
- data/app/views/govuk_publishing_components/components/docs/service_navigation.yml +37 -1
- data/config/locales/ar.yml +2 -10
- data/config/locales/az.yml +2 -10
- data/config/locales/be.yml +2 -10
- data/config/locales/bg.yml +2 -10
- data/config/locales/bn.yml +2 -10
- data/config/locales/cs.yml +2 -10
- data/config/locales/cy.yml +6 -14
- data/config/locales/da.yml +2 -10
- data/config/locales/de.yml +2 -10
- data/config/locales/dr.yml +2 -10
- data/config/locales/el.yml +2 -10
- data/config/locales/en.yml +14 -22
- data/config/locales/es-419.yml +2 -10
- data/config/locales/es.yml +2 -10
- data/config/locales/et.yml +2 -10
- data/config/locales/fa.yml +2 -10
- data/config/locales/fi.yml +2 -10
- data/config/locales/fr.yml +2 -10
- data/config/locales/gd.yml +2 -10
- data/config/locales/gu.yml +2 -10
- data/config/locales/he.yml +2 -10
- data/config/locales/hi.yml +2 -10
- data/config/locales/hr.yml +2 -10
- data/config/locales/hu.yml +2 -10
- data/config/locales/hy.yml +2 -10
- data/config/locales/id.yml +2 -10
- data/config/locales/is.yml +2 -10
- data/config/locales/it.yml +2 -10
- data/config/locales/ja.yml +2 -10
- data/config/locales/ka.yml +2 -10
- data/config/locales/kk.yml +2 -10
- data/config/locales/ko.yml +2 -10
- data/config/locales/ku.yml +2 -10
- data/config/locales/ky.yml +2 -10
- data/config/locales/lt.yml +2 -10
- data/config/locales/lv.yml +2 -10
- data/config/locales/ms.yml +2 -10
- data/config/locales/mt.yml +2 -10
- data/config/locales/ne.yml +2 -10
- data/config/locales/nl.yml +2 -10
- data/config/locales/no.yml +2 -10
- data/config/locales/pa-pk.yml +2 -10
- data/config/locales/pa.yml +2 -10
- data/config/locales/pl.yml +2 -10
- data/config/locales/ps.yml +2 -10
- data/config/locales/pt.yml +2 -10
- data/config/locales/ro.yml +2 -10
- data/config/locales/ru.yml +2 -10
- data/config/locales/si.yml +2 -10
- data/config/locales/sk.yml +2 -10
- data/config/locales/sl.yml +2 -10
- data/config/locales/so.yml +2 -10
- data/config/locales/sq.yml +2 -10
- data/config/locales/sr.yml +2 -10
- data/config/locales/sv.yml +2 -10
- data/config/locales/sw.yml +2 -10
- data/config/locales/ta.yml +2 -10
- data/config/locales/th.yml +2 -10
- data/config/locales/ti.yml +2 -10
- data/config/locales/tk.yml +2 -10
- data/config/locales/tr.yml +2 -10
- data/config/locales/uk.yml +2 -10
- data/config/locales/ur.yml +2 -10
- data/config/locales/uz.yml +2 -10
- data/config/locales/vi.yml +2 -10
- data/config/locales/zh-hk.yml +2 -10
- data/config/locales/zh-tw.yml +2 -10
- data/config/locales/zh.yml +2 -10
- data/lib/govuk_publishing_components/presenters/chart_helper.rb +33 -12
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/axe-core/README.md +1 -0
- data/node_modules/axe-core/axe.js +7695 -3210
- data/node_modules/axe-core/axe.min.js +2 -2
- data/node_modules/axe-core/locales/_template.json +46 -20
- data/node_modules/axe-core/locales/az.json +1161 -0
- data/node_modules/axe-core/locales/de.json +1 -1
- data/node_modules/axe-core/package.json +7 -8
- data/node_modules/axe-core/sri-history.json +4 -0
- metadata +4 -6
- data/app/assets/javascripts/govuk_publishing_components/components/metadata.js +0 -24
- data/app/assets/stylesheets/govuk_publishing_components/components/_published-dates.scss +0 -55
- data/app/views/govuk_publishing_components/components/_published_dates.html.erb +0 -48
- 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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74db3ccfb835e4b5298212da9a2fbcdd6c6df533a174622e62ef8c09f838e163
|
|
4
|
+
data.tar.gz: 6c8d9fba438b66e7f71191021547d009ffffff268061665ee7b3b7701888aef1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
},
|
|
@@ -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.
|
|
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.
|
|
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 },
|
|
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
|
-
|
|
32
|
-
text-align: center;
|
|
33
|
-
}
|
|
31
|
+
}
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
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;
|
|
@@ -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
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
chart_id = "chart-id-#{SecureRandom.hex(4)}"
|
|
22
22
|
table_id = "table-id-#{SecureRandom.hex(4)}"
|
|
23
23
|
|
|
24
|
-
@
|
|
24
|
+
@include_chart_script ||= OpenStruct.new(script_included: false)
|
|
25
25
|
|
|
26
26
|
chart_helper = GovukPublishingComponents::Presenters::ChartHelper.new(local_assigns)
|
|
27
27
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
Chartkick.options[:html] = '<div id="%{id}"><noscript><p class="govuk-body">This chart uses JavaScript to work. To view the chart, turn on JavaScript in your browser’s settings.</p></noscript></div>'
|
|
32
32
|
%>
|
|
33
33
|
<% if rows.length > 0 && keys.length > 0 %>
|
|
34
|
-
<% unless @
|
|
34
|
+
<% unless @include_chart_script[:script_included] %>
|
|
35
35
|
<%= javascript_include_tag "https://www.gstatic.com/charts/loader.js" %>
|
|
36
|
-
<% @
|
|
36
|
+
<% @include_chart_script[:script_included] = true %>
|
|
37
37
|
<% end %>
|
|
38
38
|
<%= tag.div(**component_helper.all_attributes) do %>
|
|
39
39
|
<div class="<%= header_class %>">
|
|
@@ -80,13 +80,13 @@
|
|
|
80
80
|
<td class="govuk-table__cell"></td>
|
|
81
81
|
<% if table_direction == "horizontal" %>
|
|
82
82
|
<% keys.each do |key| %>
|
|
83
|
-
<th class="govuk-table__header" scope="col">
|
|
83
|
+
<th class="govuk-table__header govuk-table__cell--numeric" scope="col">
|
|
84
84
|
<%= key %>
|
|
85
85
|
</th>
|
|
86
86
|
<% end %>
|
|
87
87
|
<% else %>
|
|
88
88
|
<% rows.each do |row| %>
|
|
89
|
-
<th class="govuk-table__header govuk-table__header--stacked" scope="row">
|
|
89
|
+
<th class="govuk-table__header govuk-table__header--stacked govuk-table__cell--numeric" scope="row">
|
|
90
90
|
<%= row[:label] %>
|
|
91
91
|
</th>
|
|
92
92
|
<% end %>
|
|
@@ -78,12 +78,6 @@
|
|
|
78
78
|
<dt class="gem-c-metadata__term"><%= t("components.metadata.last_updated") %>:</dt>
|
|
79
79
|
<dd class="gem-c-metadata__definition">
|
|
80
80
|
<%= last_updated %>
|
|
81
|
-
<% if local_assigns.include?(:see_updates_link) %>
|
|
82
|
-
— <a href="#full-publication-update-history"
|
|
83
|
-
class="gem-c-metadata__definition-link govuk-!-display-none-print js-see-all-updates-link">
|
|
84
|
-
<%= t("components.metadata.see_all_updates") %>
|
|
85
|
-
</a>
|
|
86
|
-
<% end %>
|
|
87
81
|
<% if page_history.any? %>
|
|
88
82
|
<div class="gem-c-metadata__details-wrapper">
|
|
89
83
|
<%= render "govuk_publishing_components/components/details", {
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
id_prefix ||= "radio-#{SecureRandom.hex(4)}"
|
|
6
6
|
items ||= []
|
|
7
7
|
|
|
8
|
-
label ||= nil
|
|
9
8
|
heading ||= nil
|
|
10
9
|
heading_caption ||= nil
|
|
11
10
|
heading_size ||= nil
|
|
@@ -43,7 +42,7 @@
|
|
|
43
42
|
radio_classes << "govuk-radios--inline" if inline
|
|
44
43
|
|
|
45
44
|
legend_classes = %w(govuk-fieldset__legend)
|
|
46
|
-
legend_classes << "govuk-fieldset__legend--#{size}"
|
|
45
|
+
legend_classes << "govuk-fieldset__legend--#{size}" unless heading_level == "span" # `span` is returned by the shared helper if heading_level is set to 0 in the local assigns
|
|
47
46
|
legend_classes << "govuk-visually-hidden" if visually_hidden_heading
|
|
48
47
|
|
|
49
48
|
aria = "#{hint_id} #{"#{error_id}" if has_error}".strip if hint or has_error
|
|
@@ -170,8 +170,8 @@ examples:
|
|
|
170
170
|
data:
|
|
171
171
|
chart_type: "bar"
|
|
172
172
|
heading: Hats owned
|
|
173
|
-
h_axis_title:
|
|
174
|
-
v_axis_title:
|
|
173
|
+
h_axis_title: Hats owned
|
|
174
|
+
v_axis_title: Person
|
|
175
175
|
description: This chart shows page views for January 2015.
|
|
176
176
|
hide_legend: true
|
|
177
177
|
keys:
|
|
@@ -186,6 +186,80 @@ examples:
|
|
|
186
186
|
- 1
|
|
187
187
|
- 1
|
|
188
188
|
- 2
|
|
189
|
+
bar_chart_with_all_colours:
|
|
190
|
+
description: There are six colours. After that, charts should show black bars. Not that charts like this one are not recommended to be used in production, as GSS recommended a maximum of four categories. This is just to demonstrate all the available colours.
|
|
191
|
+
data:
|
|
192
|
+
header_three_quarters: true
|
|
193
|
+
chart_type: column
|
|
194
|
+
heading: "Chart 6: Vehicle miles travelled by vehicle type in Great Britain, 2019 to 2025"
|
|
195
|
+
h_axis_title: Vehicle type
|
|
196
|
+
v_axis_title: Billion vehicle miles
|
|
197
|
+
description: Chart 6 is a bar chart that shows that car traffic levels in 2025 increased by 2.5% from 2024, and were similar to pre-pandemic (2019) levels.
|
|
198
|
+
hide_legend: true
|
|
199
|
+
source: Department for Transport
|
|
200
|
+
keys:
|
|
201
|
+
- Cars
|
|
202
|
+
- Vans
|
|
203
|
+
- Lorries
|
|
204
|
+
- Motorcycles
|
|
205
|
+
- Buses
|
|
206
|
+
rows:
|
|
207
|
+
- label: 2019
|
|
208
|
+
values:
|
|
209
|
+
- 250
|
|
210
|
+
- 51
|
|
211
|
+
- 15
|
|
212
|
+
- 3
|
|
213
|
+
- 5
|
|
214
|
+
- label: 2020
|
|
215
|
+
values:
|
|
216
|
+
- 200
|
|
217
|
+
- 45
|
|
218
|
+
- 13
|
|
219
|
+
- 1
|
|
220
|
+
- 1
|
|
221
|
+
- label: 2021
|
|
222
|
+
values:
|
|
223
|
+
- 220
|
|
224
|
+
- 50
|
|
225
|
+
- 13
|
|
226
|
+
- 1
|
|
227
|
+
- 1
|
|
228
|
+
- label: 2022
|
|
229
|
+
values:
|
|
230
|
+
- 240
|
|
231
|
+
- 50
|
|
232
|
+
- 15
|
|
233
|
+
- 1
|
|
234
|
+
- 1
|
|
235
|
+
- label: 2023
|
|
236
|
+
values:
|
|
237
|
+
- 245
|
|
238
|
+
- 50
|
|
239
|
+
- 13
|
|
240
|
+
- 1
|
|
241
|
+
- 1
|
|
242
|
+
- label: 2024
|
|
243
|
+
values:
|
|
244
|
+
- 247
|
|
245
|
+
- 50
|
|
246
|
+
- 11
|
|
247
|
+
- 1
|
|
248
|
+
- 1
|
|
249
|
+
- label: 2025
|
|
250
|
+
values:
|
|
251
|
+
- 250
|
|
252
|
+
- 50
|
|
253
|
+
- 10
|
|
254
|
+
- 1
|
|
255
|
+
- 1
|
|
256
|
+
- label: 2026
|
|
257
|
+
values:
|
|
258
|
+
- 260
|
|
259
|
+
- 60
|
|
260
|
+
- 15
|
|
261
|
+
- 5
|
|
262
|
+
- 5
|
|
189
263
|
column_chart:
|
|
190
264
|
data:
|
|
191
265
|
chart_type: "column"
|
|
@@ -1127,6 +1127,34 @@ examples:
|
|
|
1127
1127
|
</tr>
|
|
1128
1128
|
</tbody>
|
|
1129
1129
|
</table>
|
|
1130
|
+
wide_table:
|
|
1131
|
+
data:
|
|
1132
|
+
block: |
|
|
1133
|
+
<table>
|
|
1134
|
+
<caption>Long place names, courtesy of Wikipedia</caption>
|
|
1135
|
+
<thead>
|
|
1136
|
+
<tr>
|
|
1137
|
+
<th>Name</th>
|
|
1138
|
+
<th>Location</th>
|
|
1139
|
+
<th>Language</th>
|
|
1140
|
+
<th>Translation</th>
|
|
1141
|
+
</tr>
|
|
1142
|
+
</thead>
|
|
1143
|
+
<tbody>
|
|
1144
|
+
<tr>
|
|
1145
|
+
<td>Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu</td>
|
|
1146
|
+
<td>Hill in North Island, New Zealand</td>
|
|
1147
|
+
<td>Māori</td>
|
|
1148
|
+
<td>"The summit where Tamatea, the man with the big knees, the climber of mountains, the land-swallower who travelled about, played his kōauau (flute) to his loved one".</td>
|
|
1149
|
+
</tr>
|
|
1150
|
+
<tr>
|
|
1151
|
+
<td>Azpilikuetagaraikosaroiarenberekolarrea</td>
|
|
1152
|
+
<td>Place in Azpilkueta, Navarre, Spain</td>
|
|
1153
|
+
<td>Basque language</td>
|
|
1154
|
+
<td>"The low meadow of the sheep pen in upper Azpilikueta".</td>
|
|
1155
|
+
</tr>
|
|
1156
|
+
</tbody>
|
|
1157
|
+
</table>
|
|
1130
1158
|
tables_with_alignments:
|
|
1131
1159
|
data:
|
|
1132
1160
|
block: |
|