govuk_publishing_components 51.0.0 → 51.1.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/vendor/lux/lux-reporter.js +30 -30
- data/app/views/govuk_publishing_components/components/docs/button.yml +9 -0
- data/app/views/govuk_publishing_components/components/docs/title.yml +0 -10
- data/lib/govuk_publishing_components/presenters/button_helper.rb +4 -1
- data/lib/govuk_publishing_components/presenters/shared_helper.rb +1 -6
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc93d3d2e0d58cb2889e655c2329ab804743dc817263461f04c1c67992a45b65
|
4
|
+
data.tar.gz: 3f0105fd23e588fbf9596cc8af2730f9f3b3eec848b2fa2c15c945d8a259702e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c40f84acabd6a47fe2b46c29e1d759821eec65e16884dccf0feb0d88b868c2cfa11565d1fcdafa1e2f0cea536daf623fbe8233204762285c689fdcb6982f75b7
|
7
|
+
data.tar.gz: 806abfe7bf6f5b5ef250bde33701af3aaf80b6003588bcf21a1beb337a02370c900140f75f3e3670100a929c538c239160b8def9ca1a31c7e0acd3a8c31d3c9e
|
@@ -336,7 +336,7 @@
|
|
336
336
|
return str;
|
337
337
|
}
|
338
338
|
|
339
|
-
var VERSION = "4.0.
|
339
|
+
var VERSION = "4.0.29";
|
340
340
|
/**
|
341
341
|
* Returns the version of the script as a float to be stored in legacy systems that do not support
|
342
342
|
* string versions.
|
@@ -626,36 +626,36 @@
|
|
626
626
|
try {
|
627
627
|
if (selector &&
|
628
628
|
(node.nodeType === 9 || selector.length > MAX_SELECTOR_LENGTH || !node.parentNode)) {
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
}
|
650
|
-
var currentSelector = name_1 + classes + (selector ? ">" + selector : "");
|
651
|
-
if (el.parentNode) {
|
652
|
-
var selectorWithParent = getNodeSelector(el.parentNode, currentSelector);
|
653
|
-
if (selectorWithParent.length < MAX_SELECTOR_LENGTH) {
|
654
|
-
return selectorWithParent;
|
629
|
+
// Final selector.
|
630
|
+
return selector;
|
631
|
+
}
|
632
|
+
var el = node;
|
633
|
+
// Our first preference is to use the data-sctrack attribute from anywhere in the tree
|
634
|
+
var trackId = getClosestScTrackAttribute(el);
|
635
|
+
if (trackId) {
|
636
|
+
return trackId;
|
637
|
+
}
|
638
|
+
if (el.id) {
|
639
|
+
// Once we've found an element with ID we return the selector.
|
640
|
+
return "#" + el.id + (selector ? ">" + selector : "");
|
641
|
+
}
|
642
|
+
else if (el) {
|
643
|
+
// Otherwise attempt to get parent elements recursively
|
644
|
+
var name_1 = el.nodeType === 1 ? el.nodeName.toLowerCase() : el.nodeName.toUpperCase();
|
645
|
+
var classes = el.className ? "." + el.className.replace(/\s+/g, ".") : "";
|
646
|
+
// Remove classes until the selector is short enough
|
647
|
+
while ((name_1 + classes).length > MAX_SELECTOR_LENGTH) {
|
648
|
+
classes = classes.split(".").slice(0, -1).join(".");
|
655
649
|
}
|
650
|
+
var currentSelector = name_1 + classes + (selector ? ">" + selector : "");
|
651
|
+
if (el.parentNode) {
|
652
|
+
var selectorWithParent = getNodeSelector(el.parentNode, currentSelector);
|
653
|
+
if (selectorWithParent.length < MAX_SELECTOR_LENGTH) {
|
654
|
+
return selectorWithParent;
|
655
|
+
}
|
656
|
+
}
|
657
|
+
return currentSelector;
|
656
658
|
}
|
657
|
-
return currentSelector;
|
658
|
-
}
|
659
659
|
}
|
660
660
|
catch (error) {
|
661
661
|
// Do nothing.
|
@@ -1963,7 +1963,7 @@
|
|
1963
1963
|
].join("");
|
1964
1964
|
}
|
1965
1965
|
function getCustomerId() {
|
1966
|
-
return String(_thisCustomerId)
|
1966
|
+
return String(_thisCustomerId);
|
1967
1967
|
}
|
1968
1968
|
function avgDomDepth() {
|
1969
1969
|
var aElems = document.getElementsByTagName("*");
|
@@ -147,3 +147,12 @@ examples:
|
|
147
147
|
data:
|
148
148
|
text: Button
|
149
149
|
aria_describedby: with_aria_describedby
|
150
|
+
with_form_attribute:
|
151
|
+
description: |
|
152
|
+
Buttons will usually be contained within their containing form, but sometimes it is desirable to have the button
|
153
|
+
outside the form with the `form` attribute pointing to the ID of the form. See
|
154
|
+
[The Mozilla dev docs on a button's `form` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#form)
|
155
|
+
for more information.
|
156
|
+
data:
|
157
|
+
text: With `form` argument
|
158
|
+
form: some_form_id
|
@@ -62,13 +62,3 @@ examples:
|
|
62
62
|
margin_bottom: 0
|
63
63
|
context:
|
64
64
|
dark_background: true
|
65
|
-
using_design_system_template:
|
66
|
-
description: |
|
67
|
-
This option allows the removal of top margin from the component so that it works within a [Design System page template](https://design-system.service.gov.uk/styles/page-template/default/index.html), where spacing above the title is already provided by padding on the wrapping div.
|
68
|
-
embed: |
|
69
|
-
<main class="govuk-main-wrapper">
|
70
|
-
<%= component %>
|
71
|
-
</main>
|
72
|
-
data:
|
73
|
-
title: My page title
|
74
|
-
margin_top: 0
|
@@ -25,7 +25,8 @@ module GovukPublishingComponents
|
|
25
25
|
:classes,
|
26
26
|
:aria_label,
|
27
27
|
:aria_controls,
|
28
|
-
:aria_describedby
|
28
|
+
:aria_describedby,
|
29
|
+
:form
|
29
30
|
|
30
31
|
def initialize(local_assigns)
|
31
32
|
@disable_ga4 = local_assigns[:disable_ga4]
|
@@ -58,6 +59,7 @@ module GovukPublishingComponents
|
|
58
59
|
@button_id = "button-id-#{SecureRandom.hex(4)}"
|
59
60
|
@aria_controls = local_assigns[:aria_controls]
|
60
61
|
@aria_describedby = local_assigns[:aria_describedby]
|
62
|
+
@form = local_assigns[:form]
|
61
63
|
|
62
64
|
if local_assigns.include?(:classes)
|
63
65
|
@classes = local_assigns[:classes].split(" ")
|
@@ -106,6 +108,7 @@ module GovukPublishingComponents
|
|
106
108
|
options[:aria][:controls] = aria_controls if aria_controls
|
107
109
|
options[:aria][:describedby] = aria_describedby if aria_describedby
|
108
110
|
options[:draggable] = false if link?
|
111
|
+
options[:form] = form if form
|
109
112
|
options
|
110
113
|
end
|
111
114
|
|
@@ -1,11 +1,10 @@
|
|
1
1
|
module GovukPublishingComponents
|
2
2
|
module Presenters
|
3
3
|
class SharedHelper
|
4
|
-
attr_reader :options, :
|
4
|
+
attr_reader :options, :margin_bottom, :heading_level, :classes
|
5
5
|
|
6
6
|
def initialize(local_assigns)
|
7
7
|
@options = local_assigns
|
8
|
-
@margin_top = @options[:margin_top] || nil
|
9
8
|
@margin_bottom = @options[:margin_bottom] || 3
|
10
9
|
@heading_level = @options[:heading_level] || 2
|
11
10
|
|
@@ -17,10 +16,6 @@ module GovukPublishingComponents
|
|
17
16
|
end
|
18
17
|
end
|
19
18
|
|
20
|
-
def get_margin_top
|
21
|
-
[*0..9].include?(@margin_top) ? "govuk-!-margin-top-#{margin_top}" : ""
|
22
|
-
end
|
23
|
-
|
24
19
|
def get_margin_bottom
|
25
20
|
[*0..9].include?(@margin_bottom) ? "govuk-!-margin-bottom-#{margin_bottom}" : "govuk-!-margin-bottom-3"
|
26
21
|
end
|
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: 51.
|
4
|
+
version: 51.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-01-
|
10
|
+
date: 2025-01-30 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: govuk_app_config
|