govuk_publishing_components 28.9.1 → 29.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/config/govuk_publishing_components_manifest.js +15 -3
- data/app/assets/javascripts/govuk_publishing_components/analytics/cross-domain-tracking.js +55 -0
- data/app/assets/javascripts/govuk_publishing_components/analytics.js +3 -0
- data/app/assets/javascripts/govuk_publishing_components/dependencies.js +2 -5
- data/app/assets/javascripts/govuk_publishing_components/modules.js +15 -18
- data/app/assets/javascripts/govuk_publishing_components/{rum-loader.js.erb → rum-loader.js} +13 -10
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +1 -1
- data/app/views/govuk_publishing_components/components/_cards.html.erb +9 -25
- data/app/views/govuk_publishing_components/components/_input.html.erb +3 -0
- data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +7 -1
- data/app/views/govuk_publishing_components/components/_lead_paragraph.html.erb +0 -1
- data/app/views/govuk_publishing_components/components/_summary_list.html.erb +27 -22
- data/app/views/govuk_publishing_components/components/docs/attachment.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/big_number.yml +3 -3
- data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +3 -3
- data/app/views/govuk_publishing_components/components/docs/button.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/cards.yml +12 -6
- data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +5 -5
- data/app/views/govuk_publishing_components/components/docs/contents_list.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/contextual_guidance.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/cookie_banner.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/date_input.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/details.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/devolved_nations.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/document_list.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/error_alert.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/error_summary.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/feedback.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/fieldset.yml +4 -4
- data/app/views/govuk_publishing_components/components/docs/heading.yml +4 -4
- data/app/views/govuk_publishing_components/components/docs/hint.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/input.yml +18 -15
- data/app/views/govuk_publishing_components/components/docs/inset_text.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/label.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/lead_paragraph.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/list.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/notice.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/print_link.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/search.yml +4 -4
- data/app/views/govuk_publishing_components/components/docs/select.yml +5 -5
- data/app/views/govuk_publishing_components/components/docs/show_password.yml +3 -3
- data/app/views/govuk_publishing_components/components/docs/signup_link.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml +2 -2
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +3 -3
- data/app/views/govuk_publishing_components/components/docs/subscription_links.yml +3 -3
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/summary_list.yml +2 -7
- data/app/views/govuk_publishing_components/components/docs/table.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/textarea.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/title.yml +1 -1
- data/config/initializers/assets.rb +15 -45
- data/lib/govuk_publishing_components/presenters/attachment.rb +4 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +13 -119
- data/node_modules/jquery/AUTHORS.txt +0 -266
- data/node_modules/jquery/LICENSE.txt +0 -36
- data/node_modules/jquery/README.md +0 -65
- data/node_modules/jquery/bower.json +0 -14
- data/node_modules/jquery/dist/jquery.js +0 -11008
- data/node_modules/jquery/dist/jquery.min.js +0 -5
- data/node_modules/jquery/dist/jquery.min.map +0 -1
- data/node_modules/jquery/external/sizzle/LICENSE.txt +0 -36
- data/node_modules/jquery/external/sizzle/dist/sizzle.js +0 -2143
- data/node_modules/jquery/external/sizzle/dist/sizzle.min.js +0 -3
- data/node_modules/jquery/external/sizzle/dist/sizzle.min.map +0 -1
- data/node_modules/jquery/package.json +0 -85
- data/node_modules/jquery/src/ajax/jsonp.js +0 -100
- data/node_modules/jquery/src/ajax/load.js +0 -83
- data/node_modules/jquery/src/ajax/parseJSON.js +0 -53
- data/node_modules/jquery/src/ajax/parseXML.js +0 -31
- data/node_modules/jquery/src/ajax/script.js +0 -95
- data/node_modules/jquery/src/ajax/var/location.js +0 -3
- data/node_modules/jquery/src/ajax/var/nonce.js +0 -5
- data/node_modules/jquery/src/ajax/var/rquery.js +0 -3
- data/node_modules/jquery/src/ajax/xhr.js +0 -229
- data/node_modules/jquery/src/ajax.js +0 -842
- data/node_modules/jquery/src/attributes/attr.js +0 -281
- data/node_modules/jquery/src/attributes/classes.js +0 -174
- data/node_modules/jquery/src/attributes/prop.js +0 -156
- data/node_modules/jquery/src/attributes/support.js +0 -70
- data/node_modules/jquery/src/attributes/val.js +0 -191
- data/node_modules/jquery/src/attributes.js +0 -11
- data/node_modules/jquery/src/callbacks.js +0 -232
- data/node_modules/jquery/src/core/access.js +0 -65
- data/node_modules/jquery/src/core/init.js +0 -140
- data/node_modules/jquery/src/core/parseHTML.js +0 -41
- data/node_modules/jquery/src/core/ready.js +0 -163
- data/node_modules/jquery/src/core/var/rsingleTag.js +0 -5
- data/node_modules/jquery/src/core.js +0 -529
- data/node_modules/jquery/src/css/addGetHookIf.js +0 -24
- data/node_modules/jquery/src/css/adjustCSS.js +0 -65
- data/node_modules/jquery/src/css/curCSS.js +0 -137
- data/node_modules/jquery/src/css/defaultDisplay.js +0 -72
- data/node_modules/jquery/src/css/hiddenVisibleSelectors.js +0 -42
- data/node_modules/jquery/src/css/showHide.js +0 -45
- data/node_modules/jquery/src/css/support.js +0 -184
- data/node_modules/jquery/src/css/var/cssExpand.js +0 -3
- data/node_modules/jquery/src/css/var/isHidden.js +0 -16
- data/node_modules/jquery/src/css/var/rmargin.js +0 -3
- data/node_modules/jquery/src/css/var/rnumnonpx.js +0 -5
- data/node_modules/jquery/src/css/var/swap.js +0 -24
- data/node_modules/jquery/src/css.js +0 -563
- data/node_modules/jquery/src/data/support.js +0 -23
- data/node_modules/jquery/src/data/var/acceptData.js +0 -20
- data/node_modules/jquery/src/data.js +0 -342
- data/node_modules/jquery/src/deferred.js +0 -159
- data/node_modules/jquery/src/deprecated.js +0 -34
- data/node_modules/jquery/src/dimensions.js +0 -56
- data/node_modules/jquery/src/effects/Tween.js +0 -121
- data/node_modules/jquery/src/effects/animatedSelector.js +0 -13
- data/node_modules/jquery/src/effects/support.js +0 -58
- data/node_modules/jquery/src/effects.js +0 -640
- data/node_modules/jquery/src/event/ajax.js +0 -20
- data/node_modules/jquery/src/event/alias.js +0 -25
- data/node_modules/jquery/src/event/support.js +0 -28
- data/node_modules/jquery/src/event.js +0 -1134
- data/node_modules/jquery/src/exports/amd.js +0 -24
- data/node_modules/jquery/src/exports/global.js +0 -26
- data/node_modules/jquery/src/intro.js +0 -44
- data/node_modules/jquery/src/jquery.js +0 -37
- data/node_modules/jquery/src/manipulation/_evalUrl.js +0 -21
- data/node_modules/jquery/src/manipulation/buildFragment.js +0 -157
- data/node_modules/jquery/src/manipulation/createSafeFragment.js +0 -20
- data/node_modules/jquery/src/manipulation/getAll.js +0 -33
- data/node_modules/jquery/src/manipulation/setGlobalEval.js +0 -19
- data/node_modules/jquery/src/manipulation/support.js +0 -72
- data/node_modules/jquery/src/manipulation/var/nodeNames.js +0 -5
- data/node_modules/jquery/src/manipulation/var/rcheckableType.js +0 -3
- data/node_modules/jquery/src/manipulation/var/rleadingWhitespace.js +0 -3
- data/node_modules/jquery/src/manipulation/var/rscriptType.js +0 -3
- data/node_modules/jquery/src/manipulation/var/rtagName.js +0 -3
- data/node_modules/jquery/src/manipulation/wrapMap.js +0 -30
- data/node_modules/jquery/src/manipulation.js +0 -585
- data/node_modules/jquery/src/offset.js +0 -219
- data/node_modules/jquery/src/outro.js +0 -2
- data/node_modules/jquery/src/queue/delay.js +0 -22
- data/node_modules/jquery/src/queue.js +0 -144
- data/node_modules/jquery/src/selector-sizzle.js +0 -14
- data/node_modules/jquery/src/selector.js +0 -1
- data/node_modules/jquery/src/serialize.js +0 -125
- data/node_modules/jquery/src/support.js +0 -63
- data/node_modules/jquery/src/traversing/findFilter.js +0 -100
- data/node_modules/jquery/src/traversing/var/dir.js +0 -20
- data/node_modules/jquery/src/traversing/var/rneedsContext.js +0 -6
- data/node_modules/jquery/src/traversing/var/siblings.js +0 -15
- data/node_modules/jquery/src/traversing.js +0 -179
- data/node_modules/jquery/src/var/class2type.js +0 -5
- data/node_modules/jquery/src/var/concat.js +0 -5
- data/node_modules/jquery/src/var/deletedIds.js +0 -3
- data/node_modules/jquery/src/var/document.js +0 -3
- data/node_modules/jquery/src/var/documentElement.js +0 -5
- data/node_modules/jquery/src/var/hasOwn.js +0 -5
- data/node_modules/jquery/src/var/indexOf.js +0 -5
- data/node_modules/jquery/src/var/pnum.js +0 -3
- data/node_modules/jquery/src/var/push.js +0 -5
- data/node_modules/jquery/src/var/rcssNum.js +0 -7
- data/node_modules/jquery/src/var/rnotwhite.js +0 -3
- data/node_modules/jquery/src/var/slice.js +0 -5
- data/node_modules/jquery/src/var/support.js +0 -5
- data/node_modules/jquery/src/var/toString.js +0 -5
- data/node_modules/jquery/src/wrap.js +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2249b313207eb5d21c77d4b5daf9ff81a39459ca3ae488aa27385ac3d107ac
|
4
|
+
data.tar.gz: d484a78ee501972e49e477c386d84e4616b0668f9d865620875ddf687c0c5713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d745f36953d411596341155eaf6797db40950023c1bbacf5938b0571e480b3083f6e80453fbf13ed5adf0d8f0c5d13838f33fada99f6287d705efbf9cae17a60
|
7
|
+
data.tar.gz: b155b56e49062bdae108c6932d7e3c6baccb579a510a4018d5b89f789c9e1218d3e54f594738950bca50824c581c77aa573e59455b5aa2da63c4076eb5f4dced
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# GOV.UK Publishing Components
|
2
2
|
|
3
|
-
[![status](https://badgen.net/github/status/alphagov/govuk_publishing_components/
|
3
|
+
[![status](https://badgen.net/github/status/alphagov/govuk_publishing_components/main)](https://github.com/alphagov/govuk_publishing_components/actions?query=branch%3Amain)
|
4
4
|
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
|
5
5
|
[![Stylelint Style Guide](https://img.shields.io/badge/code_style-stylelint-brightgreen.svg)](https://github.com/alphagov/stylelint-config-gds/)
|
6
6
|
|
@@ -1,3 +1,15 @@
|
|
1
|
-
//
|
2
|
-
//=
|
3
|
-
//=
|
1
|
+
// Pre-compile image and font assets from here and govuk-frontend
|
2
|
+
//= link_tree ../images
|
3
|
+
//= link_tree ../../../node_modules/govuk-frontend/govuk/assets/images
|
4
|
+
//= link_tree ../../../node_modules/govuk-frontend/govuk/assets/fonts
|
5
|
+
|
6
|
+
// Create asset files of each of the files in these directory
|
7
|
+
//= link_directory ../javascripts/component_guide
|
8
|
+
//= link_directory ../javascripts/govuk_publishing_components
|
9
|
+
|
10
|
+
// Pre-compile these specific files
|
11
|
+
//= link govuk_publishing_components/vendor/modernizr.js
|
12
|
+
//= link govuk_publishing_components/vendor/lux/lux-reporter.js
|
13
|
+
//= link govuk_publishing_components/vendor/lux/lux-measurer.js
|
14
|
+
//= link component_guide/application.css
|
15
|
+
//= link component_guide/print.css
|
@@ -0,0 +1,55 @@
|
|
1
|
+
window.GOVUK = window.GOVUK || {}
|
2
|
+
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
3
|
+
|
4
|
+
(function (Modules) {
|
5
|
+
function CrossDomainTracking ($module) {
|
6
|
+
this.$module = $module
|
7
|
+
Modules.crossDomainLinkedTrackers = Modules.crossDomainLinkedTrackers || []
|
8
|
+
}
|
9
|
+
|
10
|
+
CrossDomainTracking.prototype.init = function () {
|
11
|
+
if (this.isTrackable(this.$module)) {
|
12
|
+
this.addLinkedTrackerDomain(this.$module)
|
13
|
+
} else {
|
14
|
+
this.findTrackableElements()
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
CrossDomainTracking.prototype.isTrackable = function (element) {
|
19
|
+
if (element.getAttribute('href') && element.getAttribute('data-tracking-code') && element.getAttribute('data-tracking-name')) {
|
20
|
+
return true
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
CrossDomainTracking.prototype.findTrackableElements = function () {
|
25
|
+
var links = this.$module.querySelectorAll('a')
|
26
|
+
for (var i = 0; i < links.length; i++) {
|
27
|
+
if (this.isTrackable(links[i])) {
|
28
|
+
this.addLinkedTrackerDomain(links[i])
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
CrossDomainTracking.prototype.addLinkedTrackerDomain = function (element) {
|
34
|
+
var name = element.getAttribute('data-tracking-name')
|
35
|
+
var code = element.getAttribute('data-tracking-code')
|
36
|
+
var trackEvent = (element.getAttribute('data-tracking-track-event') === 'true')
|
37
|
+
|
38
|
+
if (window.GOVUK.analytics !== 'undefined') {
|
39
|
+
if (Modules.crossDomainLinkedTrackers.indexOf(name) === -1) {
|
40
|
+
var hostname = element.hostname
|
41
|
+
window.GOVUK.analytics.addLinkedTrackerDomain(code, name, hostname)
|
42
|
+
Modules.crossDomainLinkedTrackers.push(name)
|
43
|
+
}
|
44
|
+
|
45
|
+
if (trackEvent) {
|
46
|
+
element.addEventListener('click', function (e) {
|
47
|
+
var target = e.target
|
48
|
+
window.GOVUK.analytics.trackEvent('External Link Clicked', target.textContent, { trackerName: name })
|
49
|
+
})
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
Modules.CrossDomainTracking = CrossDomainTracking
|
55
|
+
})(window.GOVUK.Modules)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
// these scripts are specifically ordered
|
2
|
+
|
1
3
|
//= require govuk_publishing_components/lib/cookie-functions
|
2
4
|
//= require govuk_publishing_components/lib/extend-object
|
3
5
|
//= require ./analytics/pii
|
@@ -18,3 +20,4 @@
|
|
18
20
|
//= require ./analytics/explicit-cross-domain-links
|
19
21
|
//= require ./analytics/track-click
|
20
22
|
//= require ./analytics/track-select-change
|
23
|
+
//= require ./analytics/cross-domain-tracking
|
@@ -1,12 +1,9 @@
|
|
1
|
-
/* eslint-env
|
1
|
+
/* eslint-env */
|
2
2
|
|
3
3
|
// This adds in javascript that initialises components and dependencies
|
4
4
|
// that are provided by Slimmer in public frontend applications.
|
5
|
-
// = require jquery/dist/jquery
|
6
5
|
// = require ./modules.js
|
7
6
|
|
8
|
-
|
9
|
-
'use strict'
|
10
|
-
|
7
|
+
document.addEventListener('DOMContentLoaded', function () {
|
11
8
|
window.GOVUK.modules.start()
|
12
9
|
})
|
@@ -1,49 +1,46 @@
|
|
1
1
|
;(function (global) {
|
2
2
|
'use strict'
|
3
3
|
|
4
|
-
var $ = global.jQuery
|
5
4
|
var GOVUK = global.GOVUK || {}
|
6
5
|
GOVUK.Modules = GOVUK.Modules || {}
|
7
6
|
|
8
7
|
GOVUK.modules = {
|
9
8
|
find: function (container) {
|
10
|
-
container =
|
9
|
+
container = container || document
|
11
10
|
|
12
11
|
var modules
|
13
12
|
var moduleSelector = '[data-module]'
|
14
13
|
|
15
|
-
modules = container.
|
14
|
+
modules = container.querySelectorAll(moduleSelector)
|
15
|
+
var modulesArray = []
|
16
|
+
// convert nodelist of modules to array
|
17
|
+
for (var i = 0; i < modules.length; i++) {
|
18
|
+
modulesArray.push(modules[i])
|
19
|
+
}
|
16
20
|
|
17
21
|
// Container could be a module too
|
18
|
-
if (container.
|
19
|
-
|
22
|
+
if (container !== document && container.getAttribute('data-module')) {
|
23
|
+
modulesArray.push(container)
|
20
24
|
}
|
21
|
-
|
22
|
-
return modules
|
25
|
+
return modulesArray
|
23
26
|
},
|
24
27
|
|
25
28
|
start: function (container) {
|
26
29
|
var modules = this.find(container)
|
27
30
|
|
28
31
|
for (var i = 0, l = modules.length; i < l; i++) {
|
29
|
-
var element =
|
30
|
-
var moduleNames = element.
|
32
|
+
var element = modules[i]
|
33
|
+
var moduleNames = element.getAttribute('data-module').split(' ')
|
31
34
|
|
32
35
|
for (var j = 0, k = moduleNames.length; j < k; j++) {
|
33
36
|
var moduleName = camelCaseAndCapitalise(moduleNames[j])
|
34
|
-
var started = element.data
|
37
|
+
var started = element.getAttribute('data-' + moduleNames[j] + '-module-started')
|
35
38
|
|
36
39
|
if (typeof GOVUK.Modules[moduleName] === 'function' && !started) {
|
37
|
-
// GOV.UK Legacy Modules using jQuery
|
38
|
-
if (!GOVUK.Modules[moduleName].prototype.init) {
|
39
|
-
new GOVUK.Modules[moduleName]().start(element)
|
40
|
-
element.data(moduleNames[j] + '-module-started', true)
|
41
|
-
}
|
42
|
-
|
43
40
|
// Vanilla JavaScript GOV.UK Modules and GOV.UK Frontend Modules
|
44
41
|
if (GOVUK.Modules[moduleName].prototype.init) {
|
45
|
-
new GOVUK.Modules[moduleName](element
|
46
|
-
element.data
|
42
|
+
new GOVUK.Modules[moduleName](element).init()
|
43
|
+
element.setAttribute('data-' + moduleNames[j] + '-module-started', true)
|
47
44
|
}
|
48
45
|
}
|
49
46
|
}
|
@@ -1,7 +1,5 @@
|
|
1
|
-
(function() {
|
2
|
-
var
|
3
|
-
|
4
|
-
var parsedCookie = (function() {
|
1
|
+
(function () {
|
2
|
+
var parsedCookie = (function () {
|
5
3
|
try {
|
6
4
|
var cookies = document.cookie.split(';')
|
7
5
|
|
@@ -20,11 +18,16 @@
|
|
20
18
|
return {}
|
21
19
|
})()
|
22
20
|
|
23
|
-
var insertScript = function(
|
24
|
-
var marker = document.
|
21
|
+
var insertScript = function () {
|
22
|
+
var marker = document.querySelector('script[data-lux-reporter-script]')
|
23
|
+
|
24
|
+
if (!marker) {
|
25
|
+
console.error("Failed to configure real-user-monitoring because couldn't the lux-reporter script path wasn't available")
|
26
|
+
return
|
27
|
+
}
|
25
28
|
|
26
29
|
var script = document.createElement('script')
|
27
|
-
script.src =
|
30
|
+
script.src = marker.getAttribute('data-lux-reporter-script')
|
28
31
|
script.async = true
|
29
32
|
script.defer = true
|
30
33
|
|
@@ -32,10 +35,10 @@
|
|
32
35
|
}
|
33
36
|
|
34
37
|
if (parsedCookie.usage === true) {
|
35
|
-
insertScript(
|
38
|
+
insertScript()
|
36
39
|
} else {
|
37
|
-
window.addEventListener('cookie-consent', function() {
|
38
|
-
insertScript(
|
40
|
+
window.addEventListener('cookie-consent', function () {
|
41
|
+
insertScript()
|
39
42
|
})
|
40
43
|
}
|
41
44
|
})()
|
@@ -474,6 +474,7 @@ $button-pipe-colour: darken(govuk-colour("mid-grey"), 20%);
|
|
474
474
|
&:visited {
|
475
475
|
@include govuk-media-query($from: "desktop") {
|
476
476
|
background: $govuk-brand-colour;
|
477
|
+
border-bottom: 1px solid govuk-colour("dark-blue");
|
477
478
|
|
478
479
|
&:hover {
|
479
480
|
background: govuk-colour("black");
|
data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
.govspeak, // Legacy class name that's still used in some content items - needs to be kept until `.govspeak` is removed from the content items.
|
10
10
|
.gem-c-govspeak {
|
11
11
|
.help-notice {
|
12
|
-
$icon-size:
|
12
|
+
$icon-size: 35px;
|
13
13
|
$line-height-mobile: 20px;
|
14
14
|
$line-height-tablet: 25px;
|
15
15
|
|
@@ -4,6 +4,7 @@
|
|
4
4
|
sub_heading_level ||= 3
|
5
5
|
two_column_layout ||= false
|
6
6
|
local_assigns ||= nil
|
7
|
+
data_attributes ||= nil
|
7
8
|
|
8
9
|
ul_classes = %w[gem-c-cards__list]
|
9
10
|
ul_classes << 'gem-c-cards__list--two-column-desktop' if two_column_layout
|
@@ -16,8 +17,9 @@
|
|
16
17
|
<%= content_tag(shared_helper.get_heading_level, class: "gem-c-cards__heading govuk-heading-m") do %>
|
17
18
|
<%= heading %>
|
18
19
|
<% end %>
|
19
|
-
<% end %>
|
20
|
-
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<%= content_tag('ul', class: ul_classes) do %>
|
21
23
|
<%
|
22
24
|
items.each do |item|
|
23
25
|
link = item[:link]
|
@@ -25,33 +27,15 @@
|
|
25
27
|
if !link[:path].present?
|
26
28
|
raise ArgumentError, "The cards component requires a href for all the links"
|
27
29
|
end
|
28
|
-
|
29
|
-
data_attributes = nil
|
30
|
-
attributes = link[:tracking_attributes].presence
|
31
|
-
|
32
|
-
if attributes && attributes[:track_category] && attributes[:track_action]
|
33
|
-
data_attributes = {
|
34
|
-
track_action: attributes[:track_action],
|
35
|
-
track_category: attributes[:track_category],
|
36
|
-
track_dimension_index: attributes[:track_dimension_index],
|
37
|
-
track_dimension: link[:text],
|
38
|
-
track_label: link[:path],
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
link = capture do
|
43
|
-
link_to(link[:text], link[:path], {
|
44
|
-
class: "govuk-link gem-c-cards__link",
|
45
|
-
data: data_attributes,
|
46
|
-
})
|
47
|
-
end
|
48
30
|
%>
|
49
|
-
|
50
31
|
<li class="gem-c-cards__list-item">
|
51
32
|
<%= content_tag("h#{sub_heading_level}", class: "gem-c-cards__sub-heading govuk-heading-s") do %>
|
52
|
-
<%=
|
33
|
+
<%=
|
34
|
+
link_to link[:text], link[:path],
|
35
|
+
class: "govuk-link gem-c-cards__link",
|
36
|
+
data: link[:data_attributes]
|
37
|
+
%>
|
53
38
|
<% end %>
|
54
|
-
|
55
39
|
<% if item[:description] %>
|
56
40
|
<p class="govuk-body gem-c-cards__description"><%= item[:description] %></p>
|
57
41
|
<% end %>
|
@@ -7,6 +7,7 @@
|
|
7
7
|
describedby ||= nil
|
8
8
|
enterkeyhint ||= nil
|
9
9
|
id ||= "input-#{SecureRandom.hex(4)}"
|
10
|
+
spellcheck ||= "false"
|
10
11
|
type ||= "text"
|
11
12
|
value ||= nil
|
12
13
|
inputmode ||= nil
|
@@ -63,6 +64,7 @@
|
|
63
64
|
inputmode = "numeric"
|
64
65
|
pattern = "[0-9]*"
|
65
66
|
end
|
67
|
+
|
66
68
|
%>
|
67
69
|
|
68
70
|
<%= content_tag :div, class: form_group_css_classes do %>
|
@@ -114,6 +116,7 @@
|
|
114
116
|
name: name,
|
115
117
|
pattern: pattern,
|
116
118
|
readonly: readonly,
|
119
|
+
spellcheck: spellcheck,
|
117
120
|
tabindex: tabindex,
|
118
121
|
type: type,
|
119
122
|
value: value
|
@@ -51,7 +51,13 @@
|
|
51
51
|
<title><%= title %></title>
|
52
52
|
|
53
53
|
<%= javascript_include_tag "govuk_publishing_components/vendor/lux/lux-measurer", { async: true } %>
|
54
|
-
<%= javascript_include_tag "govuk_publishing_components/rum-loader",
|
54
|
+
<%= javascript_include_tag "govuk_publishing_components/rum-loader",
|
55
|
+
{
|
56
|
+
async: true,
|
57
|
+
data: {
|
58
|
+
"lux-reporter-script": path_to_javascript("govuk_publishing_components/vendor/lux/lux-reporter")
|
59
|
+
}
|
60
|
+
} %>
|
55
61
|
|
56
62
|
<%= csrf_meta_tags %>
|
57
63
|
|
@@ -32,12 +32,10 @@
|
|
32
32
|
|
33
33
|
<% if delete.any? %>
|
34
34
|
<% delete_main_link = capture do %>
|
35
|
-
<%
|
36
|
-
delete_section_link_text = delete[:link_text] || t("components.summary_list.delete")
|
37
|
-
%>
|
35
|
+
<% delete_section_link_text = delete[:link_text] || t("components.summary_list.delete") %>
|
38
36
|
<%= link_to delete.fetch(:href),
|
39
|
-
|
40
|
-
|
37
|
+
class: "govuk-link gem-link--destructive",
|
38
|
+
data: delete.fetch(:data_attributes, {}) do %>
|
41
39
|
<%= delete_section_link_text %><%= tag.span " #{title}", class: "govuk-visually-hidden" unless delete[:link_text_no_enhance] -%>
|
42
40
|
<% end %>
|
43
41
|
<% end %>
|
@@ -62,39 +60,46 @@
|
|
62
60
|
<%= delete_main_link %>
|
63
61
|
<% end %>
|
64
62
|
<% end %>
|
65
|
-
|
66
63
|
<% end %>
|
67
64
|
|
65
|
+
<% any_body_actions = items.detect { |item| item.has_key?("edit") || item.has_key?("delete") } %>
|
68
66
|
<% if items.any? %>
|
69
67
|
<%= tag.dl class: "govuk-summary-list" do %>
|
70
68
|
<% items.each do |item| %>
|
71
|
-
|
69
|
+
<%
|
70
|
+
item_body_actions = (item.fetch(:edit, {}).any? || item.fetch(:delete, {}).any?)
|
71
|
+
|
72
|
+
if any_body_actions.present? && !item_body_actions.present?
|
73
|
+
classes = "govuk-summary-list__row govuk-summary-list__row--no-actions"
|
74
|
+
else
|
75
|
+
classes = "govuk-summary-list__row"
|
76
|
+
end
|
77
|
+
%>
|
78
|
+
<%= tag.div class: classes do %>
|
72
79
|
|
73
80
|
<%= tag.dt item[:field], class: "govuk-summary-list__key" %>
|
74
81
|
<%= tag.dd item[:value], class: "govuk-summary-list__value" %>
|
75
82
|
|
76
83
|
<% if item.fetch(:edit, {}).any? %>
|
77
84
|
<% edit_link = capture do %>
|
78
|
-
<%
|
79
|
-
edit_link_text = item[:edit][:link_text] || t("components.summary_list.edit")
|
80
|
-
%>
|
85
|
+
<% edit_link_text = item[:edit][:link_text] || t("components.summary_list.edit") %>
|
81
86
|
<%= link_to item[:edit].fetch(:href),
|
82
|
-
|
83
|
-
|
84
|
-
<%= edit_link_text
|
87
|
+
class: "govuk-link",
|
88
|
+
data: item[:edit].fetch(:data_attributes, {}) do %>
|
89
|
+
<%= edit_link_text %>
|
90
|
+
<%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless item[:edit][:link_text_no_enhance] -%>
|
85
91
|
<% end %>
|
86
92
|
<% end %>
|
87
93
|
<% end %>
|
88
94
|
|
89
95
|
<% if item.fetch(:delete, {}).any? %>
|
90
96
|
<% delete_link = capture do %>
|
91
|
-
<%
|
92
|
-
delete_link_text = item[:delete][:link_text] || t("components.summary_list.delete")
|
93
|
-
%>
|
97
|
+
<% delete_link_text = item[:delete][:link_text] || t("components.summary_list.delete") %>
|
94
98
|
<%= link_to item[:delete].fetch(:href),
|
95
|
-
|
96
|
-
|
97
|
-
<%= delete_link_text
|
99
|
+
class: "govuk-link gem-link--destructive",
|
100
|
+
data: item[:delete].fetch(:data_attributes, {}) do %>
|
101
|
+
<%= delete_link_text %>
|
102
|
+
<%= tag.span " #{item[:field]}", class: "govuk-visually-hidden" unless item[:delete][:link_text_no_enhance] -%>
|
98
103
|
<% end %>
|
99
104
|
<% end %>
|
100
105
|
<% end %>
|
@@ -115,17 +120,17 @@
|
|
115
120
|
<% end %>
|
116
121
|
<% end %>
|
117
122
|
<% else %>
|
123
|
+
<% if edit_link || delete_link %>
|
118
124
|
<%= tag.dd class: "govuk-summary-list__actions" do %>
|
119
125
|
<%= edit_link %>
|
120
126
|
<%= delete_link %>
|
121
127
|
<% end %>
|
122
128
|
<% end %>
|
123
|
-
|
124
129
|
<% end %>
|
125
130
|
<% end %>
|
126
131
|
<% end %>
|
127
132
|
<% end %>
|
128
|
-
|
129
|
-
<%= tag.div block, class: "gem-c-summary__block" if block %>
|
130
133
|
<% end %>
|
134
|
+
<%= tag.div block, class: "gem-c-summary__block" if block %>
|
135
|
+
<% end %>
|
131
136
|
<% end %>
|
@@ -86,7 +86,7 @@ examples:
|
|
86
86
|
file_size: 20000
|
87
87
|
owning_document_content_id: 456_abc
|
88
88
|
attachment_id: 123
|
89
|
-
alternative_format_contact_email:
|
89
|
+
alternative_format_contact_email: govuk_publishing_components@example.com
|
90
90
|
with_data_attributes:
|
91
91
|
data:
|
92
92
|
attachment:
|
@@ -19,7 +19,7 @@ examples:
|
|
19
19
|
number: 119
|
20
20
|
label: Open consultations
|
21
21
|
passing_extra_symbols:
|
22
|
-
description: "In some cases, we want to communicate more than just the flat numeric value eg: 400
|
22
|
+
description: "In some cases, we want to communicate more than just the flat numeric value eg: `400+`, `90%`, `-20`, `1M` etc. This is why we allow values to be passed as flat strings."
|
23
23
|
data:
|
24
24
|
number: "400+"
|
25
25
|
label: Other agencies and public bodies
|
@@ -35,7 +35,7 @@ examples:
|
|
35
35
|
href: "/government/organisations#ministerial_departments"
|
36
36
|
with_data_attributes:
|
37
37
|
description: |
|
38
|
-
If a `href` attribute is present,
|
38
|
+
If a `href` attribute is present, `data_attributes` will apply to the `span` containing the number value (see below).
|
39
39
|
|
40
40
|
This will also not automatically apply a `gem-track-click` module attribute if the data attributes pertain to click tracking. Remember to apply this outside the component call in a surrounding element, if using.
|
41
41
|
data:
|
@@ -62,7 +62,7 @@ examples:
|
|
62
62
|
aria:
|
63
63
|
hidden: true
|
64
64
|
with_bottom_margin:
|
65
|
-
description: The component accepts a number for margin bottom from 0 to 9 (0px to 60px) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). The default big number margin bottom is 15px (govuk
|
65
|
+
description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). The default big number margin bottom is `15px` (`govuk-spacing(3)`).
|
66
66
|
data:
|
67
67
|
number: 119
|
68
68
|
label: Open consultations
|
@@ -2,9 +2,9 @@ name: "Breadcrumbs"
|
|
2
2
|
description: "Navigational breadcrumbs, showing page hierarchy"
|
3
3
|
body: |
|
4
4
|
Accepts an array of breadcrumb objects. Each crumb must have a title and a URL.
|
5
|
-
Links have tracking data but links to the homepage (any link with a url of
|
5
|
+
Links have tracking data but links to the homepage (any link with a url of `/`) will be tracked separately as `homeLinkClicked`
|
6
6
|
|
7
|
-
We recommend that if using the breadcrumbs for navigation purposes, you set collapse_on_mobile to true to make things more readable for mobile users. However, you can specify `collapse_on_mobile
|
7
|
+
We recommend that if using the breadcrumbs for navigation purposes, you set `collapse_on_mobile` to `true` to make things more readable for mobile users. However, you can specify `collapse_on_mobile:``false` or remove the flag completely to stop this behaviour.
|
8
8
|
shared_accessibility_criteria:
|
9
9
|
- link
|
10
10
|
accessibility_criteria:
|
@@ -87,7 +87,7 @@ examples:
|
|
87
87
|
- title: 'Education of disadvantaged children appended with some extra long content to make this a very very very very long taxon'
|
88
88
|
url: '/education'
|
89
89
|
stop_collapsing_on_mobile:
|
90
|
-
description: We recommend that if using the breadcrumbs for navigation purposes, you set collapse_on_mobile to true to make things more readable for mobile users. However, you can specify `collapse_on_mobile
|
90
|
+
description: We recommend that if using the breadcrumbs for navigation purposes, you set `collapse_on_mobile` to `true` to make things more readable for mobile users. However, you can specify `collapse_on_mobile:``false` or remove the flag completely to stop this behaviour.
|
91
91
|
data:
|
92
92
|
collapse_on_mobile: false
|
93
93
|
breadcrumbs:
|
@@ -67,12 +67,12 @@ examples:
|
|
67
67
|
start: true
|
68
68
|
info_text: "Sometimes you want to explain where a user is going to."
|
69
69
|
with_margin_bottom:
|
70
|
-
description:
|
70
|
+
description: The component accepts a number for margin bottom from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale). It defaults to having no margin bottom.
|
71
71
|
data:
|
72
72
|
text: "Submit"
|
73
73
|
margin_bottom: 6
|
74
74
|
start_now_button_with_info_text_and_margin_bottom:
|
75
|
-
description:
|
75
|
+
description: When the component requires margin bottom and has info text, the margin is applied to the info text.
|
76
76
|
data:
|
77
77
|
text: "Start now"
|
78
78
|
href: "#"
|
@@ -116,24 +116,30 @@ examples:
|
|
116
116
|
text: Benefits
|
117
117
|
path: http://www.gov.uk
|
118
118
|
description: Includes eligibility, appeals, tax credits and Universal Credit
|
119
|
-
|
119
|
+
with_data_attributes:
|
120
120
|
description: |
|
121
|
-
|
121
|
+
Data attributes can be passed to individual links within the component as shown.
|
122
122
|
data:
|
123
123
|
items:
|
124
124
|
- link:
|
125
125
|
text: Benefits
|
126
126
|
path: http://www.gov.uk
|
127
|
-
|
128
|
-
track_action: track_action
|
127
|
+
data_attributes:
|
129
128
|
track_category: homepageClicked
|
129
|
+
track_action: track-action
|
130
|
+
track_label: track-label
|
131
|
+
track_dimension: track-dimension
|
130
132
|
track_dimension_index: 29
|
133
|
+
track_value: 9
|
131
134
|
description: Includes eligibility, appeals, tax credits and Universal Credit
|
132
135
|
- link:
|
133
136
|
text: Births, deaths, marriages and care
|
134
137
|
path: http://www.gov.uk
|
135
|
-
|
136
|
-
track_action: track_action
|
138
|
+
data_attributes:
|
137
139
|
track_category: homepageClicked
|
140
|
+
track_action: track-action
|
141
|
+
track_label: track-label
|
142
|
+
track_dimension: track-dimension
|
138
143
|
track_dimension_index: 29
|
144
|
+
track_value: 9
|
139
145
|
description: Parenting, civil partnerships, divorce and Lasting Power of Attorney
|
@@ -124,7 +124,7 @@ examples:
|
|
124
124
|
- label: "Blue"
|
125
125
|
value: "blue"
|
126
126
|
without_hint_text:
|
127
|
-
description: Hint text can be removed entirely with this option. Note that this option can be combined with the visually_hide_heading option.
|
127
|
+
description: Hint text can be removed entirely with this option. Note that this option can be combined with the `visually_hide_heading` option.
|
128
128
|
data:
|
129
129
|
name: "favourite_skittle[]"
|
130
130
|
heading: "What is your favourite skittle?"
|
@@ -148,7 +148,7 @@ examples:
|
|
148
148
|
- label: "Blue"
|
149
149
|
value: "blue"
|
150
150
|
with_a_custom_id_attribute:
|
151
|
-
description: Note that if an id is not given one is generated automatically. In either case, the id is applied to the parent element of the checkboxes, and each checkbox is given the same id with an incremented number at the end, e.g. the checkboxes below have ids of potatoes-0 and potatoes-1
|
151
|
+
description: Note that if an `id` is not given one is generated automatically. In either case, the `id` is applied to the parent element of the checkboxes, and each checkbox is given the same `id` with an incremented number at the end, e.g. the checkboxes below have ids of `potatoes-0` and `potatoes-1`.
|
152
152
|
data:
|
153
153
|
name: "potatoes[]"
|
154
154
|
id: "potatoes"
|
@@ -185,9 +185,9 @@ examples:
|
|
185
185
|
value: "blue"
|
186
186
|
with_custom_heading_size:
|
187
187
|
description: |
|
188
|
-
This allows the size of the legend to be changed. Valid options are s
|
188
|
+
This allows the size of the legend to be changed. Valid options are `s`, `m`, `l`, `xl`, defaulting to m if no option is passed.
|
189
189
|
|
190
|
-
If the is_page_heading option is true and heading_size is not set, the text size will be xl
|
190
|
+
If the `is_page_heading` option is `true` and `heading_size` is not set, the text size will be `xl`.
|
191
191
|
data:
|
192
192
|
name: "favourite_colour[]"
|
193
193
|
heading: "What is your favourite colour?"
|
@@ -233,7 +233,7 @@ examples:
|
|
233
233
|
}
|
234
234
|
}
|
235
235
|
with_aria_controls_attributes:
|
236
|
-
description: Aria controls attributes are applied to the checkboxes only if
|
236
|
+
description: Aria controls attributes are applied to the checkboxes only if JavaScript is enabled.
|
237
237
|
data:
|
238
238
|
name: "aria_controls[]"
|
239
239
|
heading: "What areas are you interested in?"
|
@@ -66,7 +66,7 @@ examples:
|
|
66
66
|
- href: "#third-thing"
|
67
67
|
text: Third thing
|
68
68
|
with_custom_aria_label:
|
69
|
-
description: 'An aria-label string should be used to contextualise the navigation for assistive technology. Defaults to
|
69
|
+
description: 'An `aria-label` string should be used to contextualise the navigation for assistive technology. Defaults to `Contents` if `aria-label` is not passed.'
|
70
70
|
data:
|
71
71
|
aria_label: "Pages in this guide"
|
72
72
|
contents:
|
@@ -25,7 +25,7 @@ examples:
|
|
25
25
|
content_item:
|
26
26
|
title: "A content item"
|
27
27
|
inverse:
|
28
|
-
description: Passes the
|
28
|
+
description: Passes the `inverse` option to the breadcrumbs, if shown.
|
29
29
|
data:
|
30
30
|
content_item:
|
31
31
|
title: "Another content item"
|