govuk_publishing_components 24.9.0 → 24.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +7 -0
- data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +36 -6
- data/app/assets/javascripts/govuk_publishing_components/components/show-password.js +12 -0
- data/app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js +1 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_accordion.scss +34 -34
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +0 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_button.scss +0 -8
- data/app/assets/stylesheets/govuk_publishing_components/components/_contextual-sidebar.scss +0 -37
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +1 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +1 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/_notice.scss +4 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_previous-and-next-navigation.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +4 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav-related.scss +0 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/_step-by-step-nav.scss +20 -20
- data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss +0 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +16 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_charts.scss +0 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_px-to-em.scss +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/govuk_frontend_support.scss +15 -0
- data/app/views/govuk_publishing_components/component_guide/index.html.erb +2 -2
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_accordion.html.erb +25 -0
- data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_layout_header.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_notice.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_previous_and_next_navigation.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_print_link.html.erb +2 -2
- data/app/views/govuk_publishing_components/components/_share_links.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_show_password.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +4 -4
- data/app/views/govuk_publishing_components/components/_subscription_links.html.erb +3 -3
- data/app/views/govuk_publishing_components/components/_translation_nav.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/contextual_sidebar/_brexit_cta.html.erb +9 -27
- data/app/views/govuk_publishing_components/components/docs/accordion.yml +73 -73
- data/app/views/govuk_publishing_components/components/docs/show_password.yml +10 -0
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +5 -0
- data/app/views/govuk_publishing_components/components/feedback/_yes_no_banner.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +2 -1
- data/config/locales/cy.yml +0 -5
- data/config/locales/en.yml +10 -6
- data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +0 -4
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +22 -3
- data/app/assets/javascripts/component_guide/visual-regression.js +0 -71
@@ -1,71 +0,0 @@
|
|
1
|
-
(function (window, document) {
|
2
|
-
window.GOVUK = window.GOVUK || {}
|
3
|
-
|
4
|
-
window.GOVUK.VisualDiffTool = function (currentWindowLocation) {
|
5
|
-
var visualDiffSelector = 'visual-diff'
|
6
|
-
var existingIframe = document.getElementById(visualDiffSelector)
|
7
|
-
var windowLocation = currentWindowLocation || window.location
|
8
|
-
|
9
|
-
if (existingIframe) {
|
10
|
-
existingIframe.parentNode.removeChild(existingIframe)
|
11
|
-
document.body.style.filter = null
|
12
|
-
} else {
|
13
|
-
var iframe = document.createElement('iframe')
|
14
|
-
iframe.id = visualDiffSelector
|
15
|
-
iframe.setAttribute('scrolling', 'no')
|
16
|
-
_setElementStyles(iframe, {
|
17
|
-
width: '100%',
|
18
|
-
height: document.body.scrollHeight + 'px',
|
19
|
-
position: 'absolute',
|
20
|
-
top: '0',
|
21
|
-
'pointer-events': 'none',
|
22
|
-
border: '0'
|
23
|
-
})
|
24
|
-
iframe.style.setProperty('z-index', '999', 'important')
|
25
|
-
|
26
|
-
// For browsers that support it, do mix-blend-mode diff
|
27
|
-
if ('mix-blend-mode' in document.body.style) {
|
28
|
-
_setElementStyles(iframe, { 'mix-blend-mode': 'difference' })
|
29
|
-
document.body.style.filter = 'invert(100%)'
|
30
|
-
} else {
|
31
|
-
// Else do a simple overlay of the live page for comparison (IE and Edge)
|
32
|
-
_setElementStyles(iframe, { opacity: '0.7' })
|
33
|
-
}
|
34
|
-
|
35
|
-
iframe.src = _processComparisonURL(windowLocation)
|
36
|
-
|
37
|
-
if (iframe.src) {
|
38
|
-
document.body.appendChild(iframe)
|
39
|
-
console.log('comparing to ' + iframe.src)
|
40
|
-
}
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
var _processComparisonURL = function (url) {
|
45
|
-
var appName
|
46
|
-
var href = url.href
|
47
|
-
var host = url.host
|
48
|
-
|
49
|
-
if (href.includes('dev.gov.uk/component-guide')) {
|
50
|
-
appName = host.split('.')[0]
|
51
|
-
return _forceHTTPS(href.replace(host, appName + '.herokuapp.com'))
|
52
|
-
} else if (href.includes('dev.gov.uk')) {
|
53
|
-
return _forceHTTPS(href.replace(host, 'www.gov.uk'))
|
54
|
-
} else if (href.includes('-pr-')) {
|
55
|
-
appName = host.split('-pr')[0]
|
56
|
-
return _forceHTTPS(href.replace(host, appName + '.herokuapp.com'))
|
57
|
-
} else {
|
58
|
-
throw new Error('Visual Diff Tool: You need to run this tool against a page running on your local dev environment')
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
var _forceHTTPS = function (href) {
|
63
|
-
return href.replace('http://', 'https://')
|
64
|
-
}
|
65
|
-
|
66
|
-
var _setElementStyles = function (element, styles) {
|
67
|
-
for (var style in styles) {
|
68
|
-
element.style[style] = styles[style]
|
69
|
-
}
|
70
|
-
}
|
71
|
-
})(window, document)
|