govuk_publishing_components 55.1.0 → 56.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/{lib/sticky-element-container.js → components/contents-list-with-body.js} +21 -21
- data/app/assets/javascripts/govuk_publishing_components/lib/cookie-settings.js +13 -15
- data/app/assets/javascripts/govuk_publishing_components/lib/toggle.js +2 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list-with-body.scss +25 -2
- data/app/models/govuk_publishing_components/audit_comparer.rb +0 -1
- data/app/views/govuk_publishing_components/components/_contents_list_with_body.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_figure.html.erb +19 -18
- data/app/views/govuk_publishing_components/components/_published_dates.html.erb +5 -5
- data/app/views/govuk_publishing_components/components/_select.html.erb +2 -1
- data/app/views/govuk_publishing_components/components/docs/select.yml +16 -1
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +3 -4
- data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_sticky-element-container.scss +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd7ea7301bfc4ad16b432de2454f8557703f0da104df7238390c0898e9d71da
|
4
|
+
data.tar.gz: 8558af085431866c26875ef71548ac8dd1918e61ef5c42ca13978b9866e0274c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d5024063bd18beaae519aabf8c9e1e04a07c3492d1150e38179cc677954d1ed8481b10e35b39f5588d14208c6939ff1199b5a215d29fdb394c1c165d119899b
|
7
|
+
data.tar.gz: e34384803cbf5b6b9b507aa88700248ecb0d61b7eee230acfcac87b17d0be706cf400c35d49bd5659647758eccf4fb1ae7761ad0e510715a6855791faed6ffc9
|
@@ -4,7 +4,7 @@
|
|
4
4
|
- stick to the bottom of the window while the parent element is in view;
|
5
5
|
- stick to the bottom of the target when the user scrolls past the bottom.
|
6
6
|
|
7
|
-
Use 'data-module="
|
7
|
+
Use 'data-module="contents-list-with-body"' to instantiate, and add
|
8
8
|
`[data-sticky-element]` to the child you want to position.
|
9
9
|
*/
|
10
10
|
|
@@ -12,7 +12,7 @@ window.GOVUK = window.GOVUK || {}
|
|
12
12
|
window.GOVUK.Modules = window.GOVUK.Modules || {};
|
13
13
|
|
14
14
|
(function (Modules) {
|
15
|
-
function
|
15
|
+
function ContentsListWithBody (element) {
|
16
16
|
this.wrapper = element
|
17
17
|
this.stickyElement = this.wrapper.querySelector('[data-sticky-element]')
|
18
18
|
this.hasResized = true
|
@@ -23,7 +23,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
23
23
|
this.stopPosition = 0
|
24
24
|
}
|
25
25
|
|
26
|
-
|
26
|
+
ContentsListWithBody.prototype.init = function () {
|
27
27
|
if (!this.stickyElement) return
|
28
28
|
|
29
29
|
window.onresize = this.onResize.bind(this)
|
@@ -32,31 +32,31 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
32
32
|
setInterval(this.checkScroll.bind(this), this.interval)
|
33
33
|
this.checkResize()
|
34
34
|
this.checkScroll()
|
35
|
-
this.stickyElement.classList.add('
|
35
|
+
this.stickyElement.classList.add('gem-c-contents-list-with-body__sticky-element--enabled')
|
36
36
|
}
|
37
37
|
|
38
|
-
|
38
|
+
ContentsListWithBody.prototype.getWindowDimensions = function () {
|
39
39
|
return {
|
40
40
|
height: window.innerHeight,
|
41
41
|
width: window.innerWidth
|
42
42
|
}
|
43
43
|
}
|
44
44
|
|
45
|
-
|
45
|
+
ContentsListWithBody.prototype.getWindowPositions = function () {
|
46
46
|
return {
|
47
47
|
scrollTop: window.scrollY
|
48
48
|
}
|
49
49
|
}
|
50
50
|
|
51
|
-
|
51
|
+
ContentsListWithBody.prototype.onResize = function () {
|
52
52
|
this.hasResized = true
|
53
53
|
}
|
54
54
|
|
55
|
-
|
55
|
+
ContentsListWithBody.prototype.onScroll = function () {
|
56
56
|
this.hasScrolled = true
|
57
57
|
}
|
58
58
|
|
59
|
-
|
59
|
+
ContentsListWithBody.prototype.checkResize = function () {
|
60
60
|
if (this.hasResized) {
|
61
61
|
this.hasResized = false
|
62
62
|
this.hasScrolled = true
|
@@ -68,7 +68,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
68
68
|
}
|
69
69
|
}
|
70
70
|
|
71
|
-
|
71
|
+
ContentsListWithBody.prototype.checkScroll = function () {
|
72
72
|
if (this.hasScrolled) {
|
73
73
|
this.hasScrolled = false
|
74
74
|
|
@@ -79,7 +79,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
79
79
|
}
|
80
80
|
}
|
81
81
|
|
82
|
-
|
82
|
+
ContentsListWithBody.prototype.updateVisibility = function () {
|
83
83
|
var isPastStart = this.startPosition < this.windowVerticalPosition
|
84
84
|
if (isPastStart) {
|
85
85
|
this.show()
|
@@ -88,7 +88,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
88
88
|
}
|
89
89
|
}
|
90
90
|
|
91
|
-
|
91
|
+
ContentsListWithBody.prototype.updatePosition = function () {
|
92
92
|
var isPastEnd = this.stopPosition < this.windowVerticalPosition
|
93
93
|
if (isPastEnd) {
|
94
94
|
this.stickToParent()
|
@@ -97,21 +97,21 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
97
97
|
}
|
98
98
|
}
|
99
99
|
|
100
|
-
|
101
|
-
this.stickyElement.classList.add('
|
100
|
+
ContentsListWithBody.prototype.stickToWindow = function () {
|
101
|
+
this.stickyElement.classList.add('gem-c-contents-list-with-body__sticky-element--stuck-to-window')
|
102
102
|
}
|
103
103
|
|
104
|
-
|
105
|
-
this.stickyElement.classList.remove('
|
104
|
+
ContentsListWithBody.prototype.stickToParent = function () {
|
105
|
+
this.stickyElement.classList.remove('gem-c-contents-list-with-body__sticky-element--stuck-to-window')
|
106
106
|
}
|
107
107
|
|
108
|
-
|
109
|
-
this.stickyElement.classList.remove('
|
108
|
+
ContentsListWithBody.prototype.show = function () {
|
109
|
+
this.stickyElement.classList.remove('gem-c-contents-list-with-body__sticky-element--hidden')
|
110
110
|
}
|
111
111
|
|
112
|
-
|
113
|
-
this.stickyElement.classList.add('
|
112
|
+
ContentsListWithBody.prototype.hide = function () {
|
113
|
+
this.stickyElement.classList.add('gem-c-contents-list-with-body__sticky-element--hidden')
|
114
114
|
}
|
115
115
|
|
116
|
-
Modules.
|
116
|
+
Modules.ContentsListWithBody = ContentsListWithBody
|
117
117
|
})(window.GOVUK.Modules)
|
@@ -29,21 +29,19 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
29
29
|
var currentConsentCookie = window.GOVUK.cookie('cookies_policy')
|
30
30
|
if (currentConsentCookie) {
|
31
31
|
var currentConsentCookieJSON = JSON.parse(currentConsentCookie)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
if (radioButton) {
|
46
|
-
radioButton.checked = true
|
32
|
+
if (currentConsentCookieJSON) {
|
33
|
+
// We don't need the essential value as this cannot be changed by the user
|
34
|
+
delete currentConsentCookieJSON.essential
|
35
|
+
for (var cookieType in currentConsentCookieJSON) {
|
36
|
+
var radioButton
|
37
|
+
if (currentConsentCookieJSON[cookieType]) {
|
38
|
+
radioButton = document.querySelector('input[name=cookies-' + cookieType + '][value=on]')
|
39
|
+
} else {
|
40
|
+
radioButton = document.querySelector('input[name=cookies-' + cookieType + '][value=off]')
|
41
|
+
}
|
42
|
+
if (radioButton) {
|
43
|
+
radioButton.checked = true
|
44
|
+
}
|
47
45
|
}
|
48
46
|
}
|
49
47
|
}
|
@@ -129,8 +129,8 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
129
129
|
var toggledText = this.getAttribute('data-toggled-text')
|
130
130
|
|
131
131
|
if (typeof toggledText === 'string') {
|
132
|
-
this.setAttribute('data-toggled-text', this.
|
133
|
-
this.
|
132
|
+
this.setAttribute('data-toggled-text', this.innerHTML)
|
133
|
+
this.innerHTML = toggledText
|
134
134
|
}
|
135
135
|
})
|
136
136
|
}
|
data/app/assets/stylesheets/govuk_publishing_components/components/_contents-list-with-body.scss
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
@import "govuk_publishing_components/individual_component_support";
|
2
|
-
|
2
|
+
|
3
|
+
.govuk-frontend-supported .gem-c-contents-list-with-body__sticky-element {
|
4
|
+
position: absolute;
|
5
|
+
bottom: 0;
|
6
|
+
|
7
|
+
&--stuck-to-window {
|
8
|
+
bottom: 0;
|
9
|
+
position: fixed;
|
10
|
+
}
|
11
|
+
|
12
|
+
&--enabled {
|
13
|
+
transition: opacity, .3s, ease;
|
14
|
+
opacity: 1;
|
15
|
+
|
16
|
+
@include govuk-media-query($until: tablet) {
|
17
|
+
position: static;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
&--hidden {
|
22
|
+
opacity: 0;
|
23
|
+
pointer-events: none;
|
24
|
+
}
|
25
|
+
}
|
3
26
|
|
4
27
|
.gem-c-contents-list-with-body__link-container {
|
5
28
|
margin: 0 auto;
|
@@ -31,7 +54,7 @@
|
|
31
54
|
}
|
32
55
|
}
|
33
56
|
|
34
|
-
.gem-c-contents-list-with-body__link-wrapper.
|
57
|
+
.gem-c-contents-list-with-body__link-wrapper.gem-c-contents-list-with-body__sticky-element--stuck-to-window {
|
35
58
|
background-color: govuk-colour("light-grey");
|
36
59
|
bottom: -1px; // 'Fix' for anomalous 1px margin which sporadically appears below this element.
|
37
60
|
left: 0;
|
@@ -7,7 +7,7 @@
|
|
7
7
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
8
8
|
component_helper.set_id(id)
|
9
9
|
component_helper.add_class("gem-c-contents-list-with-body")
|
10
|
-
component_helper.add_data_attribute({ module: "
|
10
|
+
component_helper.add_data_attribute({ module: "contents-list-with-body" }) if contents.any?
|
11
11
|
%>
|
12
12
|
<%= tag.div(**component_helper.all_attributes) do %>
|
13
13
|
<% if contents.any? %>
|
@@ -3,26 +3,27 @@
|
|
3
3
|
alt ||= ""
|
4
4
|
caption ||= ""
|
5
5
|
credit ||= ""
|
6
|
+
src ||= nil
|
6
7
|
local_assigns[:lang] ||= "en"
|
7
8
|
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
8
9
|
component_helper.add_class("gem-c-figure")
|
9
10
|
%>
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
<% if src.present? %>
|
12
|
+
<%= tag.figure(**component_helper.all_attributes) do %>
|
13
|
+
<%= tag.img(class: "gem-c-figure__image", src: src, alt: alt) %>
|
14
|
+
<% if caption.present? || credit.present? %>
|
15
|
+
<figcaption class="gem-c-figure__figcaption">
|
16
|
+
<% if caption.present? %>
|
17
|
+
<p class="gem-c-figure__figcaption-text">
|
18
|
+
<%= caption %>
|
19
|
+
</p>
|
20
|
+
<% end %>
|
21
|
+
<% if credit.present? %>
|
22
|
+
<p class="gem-c-figure__figcaption-text">
|
23
|
+
<%= I18n.t("components.figure.image_credit", credit: credit) %>
|
24
|
+
</p>
|
25
|
+
<% end %>
|
26
|
+
</figcaption>
|
27
|
+
<% end %>
|
13
28
|
<% end %>
|
14
|
-
|
15
|
-
<figcaption class="gem-c-figure__figcaption">
|
16
|
-
<% if caption.present? %>
|
17
|
-
<p class="gem-c-figure__figcaption-text">
|
18
|
-
<%= caption %>
|
19
|
-
</p>
|
20
|
-
<% end %>
|
21
|
-
<% if credit.present? %>
|
22
|
-
<p class="gem-c-figure__figcaption-text">
|
23
|
-
<%= I18n.t("components.figure.image_credit", credit: credit) %>
|
24
|
-
</p>
|
25
|
-
<% end %>
|
26
|
-
</figcaption>
|
27
|
-
<% end %>
|
28
|
-
<% end %>
|
29
|
+
<% end %>
|
@@ -18,22 +18,22 @@
|
|
18
18
|
<%= tag.div(**component_helper.all_attributes) do %>
|
19
19
|
<h2 class="govuk-visually-hidden"><%= t('components.published_dates.hidden_heading') %></h2>
|
20
20
|
<% if published %>
|
21
|
-
|
21
|
+
<div><%= t('components.published_dates.published', date: published) %></div>
|
22
22
|
<% end %>
|
23
23
|
<% if last_updated %>
|
24
|
-
|
24
|
+
<%= t('components.published_dates.last_updated', date: last_updated) %>
|
25
25
|
<% if link_to_history && history.empty? %>
|
26
|
-
|
26
|
+
<span aria-hidden="true">— </span><a href="#history" class="gem-c-published-dates__history-link govuk-link"><%= t('components.published_dates.see_all_updates', locale: :en) %></a>
|
27
27
|
<% elsif history.any? %>
|
28
28
|
<a href="#full-history"
|
29
29
|
class="gem-c-published-dates__toggle govuk-link"
|
30
30
|
data-controls="full-history"
|
31
31
|
data-expanded="false"
|
32
|
-
data-toggled-text="
|
32
|
+
data-toggled-text="<span aria-hidden='true'>‐ </span><%= t('components.published_dates.hide_all_updates', locale: :en) %>"
|
33
33
|
data-module="ga4-event-tracker"
|
34
34
|
data-ga4-event="<%= {event_name: "select_content", type: "content history", section: "Footer"}.to_json %>"
|
35
35
|
data-ga4-expandable
|
36
|
-
|
36
|
+
><span aria-hidden="true">+ </span><%= t('components.published_dates.show_all_updates', locale: :en) %></a>
|
37
37
|
<div class="gem-c-published-dates__change-history js-hidden" id="full-history">
|
38
38
|
<ol class="gem-c-published-dates__list">
|
39
39
|
<% history.each do |change| %>
|
@@ -6,6 +6,7 @@
|
|
6
6
|
label ||= false
|
7
7
|
name ||= id
|
8
8
|
is_page_heading ||= false
|
9
|
+
data_attributes ||= {}
|
9
10
|
|
10
11
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
11
12
|
heading_size = false unless shared_helper.valid_heading_size?(heading_size)
|
@@ -39,6 +40,6 @@
|
|
39
40
|
} %>
|
40
41
|
<% end %>
|
41
42
|
|
42
|
-
<%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_helper.select_classes, aria: aria_describedby %>
|
43
|
+
<%= select_tag name, options_for_select(select_helper.option_markup, select_helper.selected_option), id: id, class: select_helper.select_classes, aria: aria_describedby, data: data_attributes %>
|
43
44
|
<% end %>
|
44
45
|
<% end %>
|
@@ -55,7 +55,22 @@ examples:
|
|
55
55
|
- text: Something else
|
56
56
|
value: option2
|
57
57
|
with_data_attributes:
|
58
|
-
description:
|
58
|
+
description: Data attributes can be passed to the select component if needed.
|
59
|
+
data:
|
60
|
+
id: dropdown4-3
|
61
|
+
label: With data attributes
|
62
|
+
data_attributes:
|
63
|
+
another_attribute: attribute 1
|
64
|
+
something_else: attribute 2
|
65
|
+
options:
|
66
|
+
- text: Option one
|
67
|
+
value: option1
|
68
|
+
- text: Option two
|
69
|
+
value: option2
|
70
|
+
- text: Option three
|
71
|
+
value: option3
|
72
|
+
with_data_attributes_for_options:
|
73
|
+
description: Other data attributes can be passed to the select component options if needed.
|
59
74
|
data:
|
60
75
|
id: dropdown4
|
61
76
|
label: With data attributes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 56.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-03-
|
10
|
+
date: 2025-03-24 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: govuk_app_config
|
@@ -474,6 +474,7 @@ files:
|
|
474
474
|
- app/assets/javascripts/govuk_publishing_components/components/button.js
|
475
475
|
- app/assets/javascripts/govuk_publishing_components/components/character-count.js
|
476
476
|
- app/assets/javascripts/govuk_publishing_components/components/checkboxes.js
|
477
|
+
- app/assets/javascripts/govuk_publishing_components/components/contents-list-with-body.js
|
477
478
|
- app/assets/javascripts/govuk_publishing_components/components/contextual-guidance.js
|
478
479
|
- app/assets/javascripts/govuk_publishing_components/components/cookie-banner.js
|
479
480
|
- app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js
|
@@ -511,7 +512,6 @@ files:
|
|
511
512
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/magna-charta.js
|
512
513
|
- app/assets/javascripts/govuk_publishing_components/lib/govspeak/youtube-link-enhancement.js
|
513
514
|
- app/assets/javascripts/govuk_publishing_components/lib/initial-focus.js
|
514
|
-
- app/assets/javascripts/govuk_publishing_components/lib/sticky-element-container.js
|
515
515
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
|
516
516
|
- app/assets/javascripts/govuk_publishing_components/lib/toggle.js
|
517
517
|
- app/assets/javascripts/govuk_publishing_components/lib/trigger-event.js
|
@@ -636,7 +636,6 @@ files:
|
|
636
636
|
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_govuk-frontend-settings.scss
|
637
637
|
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_link.scss
|
638
638
|
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_markdown-typography.scss
|
639
|
-
- app/assets/stylesheets/govuk_publishing_components/components/helpers/_sticky-element-container.scss
|
640
639
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_css3.scss
|
641
640
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_govuk-template-link-focus-override.scss
|
642
641
|
- app/assets/stylesheets/govuk_publishing_components/components/mixins/_grid-helper.scss
|
@@ -1,23 +0,0 @@
|
|
1
|
-
.govuk-frontend-supported .sticky-element {
|
2
|
-
position: absolute;
|
3
|
-
bottom: 0;
|
4
|
-
|
5
|
-
&--stuck-to-window {
|
6
|
-
bottom: 0;
|
7
|
-
position: fixed;
|
8
|
-
}
|
9
|
-
|
10
|
-
&--enabled {
|
11
|
-
transition: opacity, .3s, ease;
|
12
|
-
opacity: 1;
|
13
|
-
|
14
|
-
@include govuk-media-query($until: tablet) {
|
15
|
-
position: static;
|
16
|
-
}
|
17
|
-
}
|
18
|
-
|
19
|
-
&--hidden {
|
20
|
-
opacity: 0;
|
21
|
-
pointer-events: none;
|
22
|
-
}
|
23
|
-
}
|