govuk_publishing_components 35.12.0 → 35.13.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-ga4/ga4-scroll-tracker.js +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +3 -1
- data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +8 -2
- data/app/controllers/govuk_publishing_components/audit_controller.rb +3 -2
- data/app/models/govuk_publishing_components/audit_applications.rb +3 -1
- data/app/models/govuk_publishing_components/audit_comparer.rb +1 -1
- data/app/models/govuk_publishing_components/audit_components.rb +3 -2
- data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +1 -0
- data/app/views/govuk_publishing_components/audit/_applications.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_document_list.html.erb +29 -27
- data/app/views/govuk_publishing_components/components/_heading.html.erb +8 -5
- data/app/views/govuk_publishing_components/components/docs/heading.yml +1 -4
- data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml +1 -6
- data/app/views/govuk_publishing_components/components/docs/tabs.yml +1 -1
- data/lib/govuk_publishing_components/config.rb +3 -0
- data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +17 -1
- 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: b6417c1bd3d66d89500aac39c49427caa95791623fe26f1ee4844c025ef3f3c7
|
4
|
+
data.tar.gz: d21986e9895007dc2560b4aacd1eb28ff7f43251519029672b85d13d91211d94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ca4a123db1c519256eb7ee46ff97e940d69c161f687611fb3b46915acee3454b995f2793e763ed82f5d87ae8a32d2df074b4c72587ca5c0a3c02ee858026a79
|
7
|
+
data.tar.gz: b1cc9c87e984de69229d5b6807d81eca27802b35a3be15caaaea249388fc0ce9934be7a4d75006e2a93c5374fc48738d9f8e8dbbc624955b2a14da78a01df8a8
|
@@ -199,14 +199,14 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
199
199
|
Ga4ScrollTracker.Percentage.prototype.getTrackingNodes = function (trackedNodes) {
|
200
200
|
var body = document.body
|
201
201
|
var html = document.documentElement
|
202
|
-
|
202
|
+
// remove 20px from the calculated page height to allow for a possible horizontal scrollbar
|
203
|
+
var pageHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight) - 20
|
203
204
|
|
204
205
|
var percentDetails = []
|
205
206
|
|
206
207
|
for (var i = 0; i < this.config.percentages.length; i++) {
|
207
208
|
var percent = this.config.percentages[i]
|
208
|
-
|
209
|
-
var pos = ((pageHeight / 100) * percent) - 1
|
209
|
+
var pos = ((pageHeight / 100) * percent)
|
210
210
|
var alreadySeen = false
|
211
211
|
if (trackedNodes.length) {
|
212
212
|
alreadySeen = trackedNodes[i].alreadySeen
|
@@ -110,6 +110,10 @@ $large-input-size: 50px;
|
|
110
110
|
border: 0;
|
111
111
|
cursor: pointer;
|
112
112
|
border-radius: 0;
|
113
|
+
// render a border in high contrast mode
|
114
|
+
outline: $govuk-border-width-form-element solid transparent;
|
115
|
+
// Ensure outline appears outside of the element
|
116
|
+
outline-offset: 0;
|
113
117
|
position: relative;
|
114
118
|
padding: 0;
|
115
119
|
width: $input-size;
|
@@ -124,8 +128,6 @@ $large-input-size: 50px;
|
|
124
128
|
&:focus {
|
125
129
|
z-index: 2;
|
126
130
|
outline: $govuk-focus-width solid $govuk-focus-colour;
|
127
|
-
// Ensure outline appears outside of the element
|
128
|
-
outline-offset: 0;
|
129
131
|
// Double the border by adding its width again. Use `box-shadow` for this // instead of changing `border-width` - this is for consistency with
|
130
132
|
// Also, `outline` cannot be utilised
|
131
133
|
// here as it is already used for the yellow focus state.
|
@@ -161,6 +163,10 @@ $large-input-size: 50px;
|
|
161
163
|
|
162
164
|
.gem-c-search__input {
|
163
165
|
border-width: 0;
|
166
|
+
// Render a border in high contrast mode
|
167
|
+
outline: $govuk-border-width-form-element solid transparent;
|
168
|
+
// Ensure outline appears outside of the element
|
169
|
+
outline-offset: 0;
|
164
170
|
|
165
171
|
// no need for black outline as there is enough contrast
|
166
172
|
// with the blue background
|
@@ -14,7 +14,6 @@ module GovukPublishingComponents
|
|
14
14
|
government-frontend
|
15
15
|
govspeak-preview
|
16
16
|
info-frontend
|
17
|
-
licence-finder
|
18
17
|
release
|
19
18
|
search-admin
|
20
19
|
signon
|
@@ -49,7 +48,9 @@ module GovukPublishingComponents
|
|
49
48
|
|
50
49
|
application_dirs.each do |application|
|
51
50
|
application_path = [path, application].join("/")
|
52
|
-
|
51
|
+
dir = application
|
52
|
+
dir = Rails.application.class.module_parent_name.underscore.dasherize unless ENV["MAIN_COMPONENT_GUIDE"]
|
53
|
+
app = AuditApplications.new(application_path, application, dir)
|
53
54
|
applications_found += 1 if app.data[:application_found]
|
54
55
|
results << app.data
|
55
56
|
end
|
@@ -2,7 +2,7 @@ module GovukPublishingComponents
|
|
2
2
|
class AuditApplications
|
3
3
|
attr_reader :data
|
4
4
|
|
5
|
-
def initialize(path, name)
|
5
|
+
def initialize(path, name, dir)
|
6
6
|
@path = path
|
7
7
|
application_found = application_exists(path)
|
8
8
|
components_found = []
|
@@ -59,6 +59,7 @@ module GovukPublishingComponents
|
|
59
59
|
# applications might not have all of these things for all components
|
60
60
|
options = {
|
61
61
|
application_name: name,
|
62
|
+
application_dir: dir,
|
62
63
|
templates_path: "app/views/components",
|
63
64
|
stylesheets_path: "app/assets/stylesheets/components",
|
64
65
|
javascripts_path: "app/assets/javascripts/components/",
|
@@ -72,6 +73,7 @@ module GovukPublishingComponents
|
|
72
73
|
|
73
74
|
@data = {
|
74
75
|
name: name,
|
76
|
+
dir: dir,
|
75
77
|
application_found: application_found,
|
76
78
|
components_found: components_found,
|
77
79
|
gem_style_references: @gem_style_references.flatten.uniq.sort,
|
@@ -12,7 +12,6 @@ module GovukPublishingComponents
|
|
12
12
|
frontend
|
13
13
|
government-frontend
|
14
14
|
info-frontend
|
15
|
-
licence-finder
|
16
15
|
service-manual-frontend
|
17
16
|
smart-answers
|
18
17
|
whitehall
|
@@ -93,6 +92,7 @@ module GovukPublishingComponents
|
|
93
92
|
|
94
93
|
data << {
|
95
94
|
name: result[:name],
|
95
|
+
dir: result[:dir],
|
96
96
|
application_found: result[:application_found],
|
97
97
|
uses_static: application_uses_static,
|
98
98
|
summary: summary,
|
@@ -13,6 +13,7 @@ module GovukPublishingComponents
|
|
13
13
|
@helpers_path = options[:helpers_path] || "lib/govuk_publishing_components/presenters"
|
14
14
|
|
15
15
|
@application_name = options[:application_name] || "govuk_publishing_components"
|
16
|
+
@application_dir = options[:application_dir] || "govuk_publishing_components"
|
16
17
|
@all_templates = Dir["#{path}/#{@templates_path}/*.erb"].sort
|
17
18
|
@templates_full_path = "#{path}/#{@templates_path}/"
|
18
19
|
|
@@ -57,7 +58,7 @@ module GovukPublishingComponents
|
|
57
58
|
component_templates.each do |component|
|
58
59
|
component_detail = {}
|
59
60
|
component_detail[:name] = component
|
60
|
-
component_detail[:application] = @
|
61
|
+
component_detail[:application] = @application_dir
|
61
62
|
component_detail[:link] = get_component_link(component) unless @auditing_an_application
|
62
63
|
file_details = [
|
63
64
|
{
|
@@ -214,7 +215,7 @@ module GovukPublishingComponents
|
|
214
215
|
|
215
216
|
def get_asset_link(a_thing, component)
|
216
217
|
url = "https://github.com/alphagov"
|
217
|
-
repo = @
|
218
|
+
repo = @application_dir
|
218
219
|
blob = "blob/main"
|
219
220
|
link = nil
|
220
221
|
link = "#{url}/#{repo}/#{blob}/#{@templates_path}/_#{component.gsub(' ', '_')}.html.erb" if a_thing == "template"
|
@@ -9,6 +9,7 @@ This component uses the component wrapper helper. It accepts the following optio
|
|
9
9
|
- `aria` - accepts a hash of aria attributes
|
10
10
|
- `classes` - accepts a space separated string of classes, these should not be used for styling and must be prefixed with `js-`
|
11
11
|
- `role` - accepts a space separated string of roles
|
12
|
+
- `lang` - accepts a language attribute value
|
12
13
|
"
|
13
14
|
end
|
14
15
|
end
|
@@ -34,7 +34,7 @@
|
|
34
34
|
|
35
35
|
<% accordion_content = capture do %>
|
36
36
|
<% if application[:application_found] %>
|
37
|
-
<% github_link = 'https://github.com/alphagov/' + application[:
|
37
|
+
<% github_link = 'https://github.com/alphagov/' + application[:dir] + '/blob/main/' %>
|
38
38
|
|
39
39
|
<% if @other_applications %>
|
40
40
|
<% if application[:uses_individual_asset_model] %>
|
@@ -29,35 +29,37 @@
|
|
29
29
|
<p class='gem-c-document-list__highlight-text'><%= item[:highlight_text] %></p>
|
30
30
|
<% end %>
|
31
31
|
|
32
|
-
<%=
|
33
|
-
|
32
|
+
<%= content_tag :div, class: "gem-c-document-list__item-title" do -%>
|
33
|
+
<%=
|
34
|
+
item_classes = "#{brand_helper.color_class} #{title_with_context_class if item[:link][:context]}"
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
36
|
+
if item[:link][:path]
|
37
|
+
rel = [
|
38
|
+
"external",
|
39
|
+
"nofollow",
|
40
|
+
"noopener",
|
41
|
+
"noreferrer",
|
42
|
+
"opener",
|
43
|
+
].include?(item[:link][:rel]) ? item[:link][:rel] : nil
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
45
|
+
link_to(
|
46
|
+
item[:link][:text],
|
47
|
+
item[:link][:path],
|
48
|
+
data: item[:link][:data_attributes],
|
49
|
+
class: "#{item_classes} govuk-link",
|
50
|
+
lang: item[:link][:locale].presence,
|
51
|
+
rel: rel,
|
52
|
+
)
|
53
|
+
else
|
54
|
+
content_tag(
|
55
|
+
"span",
|
56
|
+
item[:link][:text],
|
57
|
+
data: item[:link][:data_attributes],
|
58
|
+
class: item_classes,
|
59
|
+
)
|
60
|
+
end
|
61
|
+
%>
|
62
|
+
<% end %>
|
61
63
|
|
62
64
|
<% if item[:link][:context] %>
|
63
65
|
<span class="gem-c-document-list__item-context"><%= item[:link][:context] %></span>
|
@@ -7,15 +7,18 @@
|
|
7
7
|
brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
|
8
8
|
heading_helper = GovukPublishingComponents::Presenters::HeadingHelper.new(local_assigns)
|
9
9
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
10
|
+
component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
|
10
11
|
|
11
12
|
classes = %w(gem-c-heading)
|
12
13
|
classes << heading_helper.classes
|
13
14
|
classes << brand_helper.brand_class
|
14
15
|
classes << brand_helper.border_color_class
|
15
16
|
classes << shared_helper.get_margin_bottom if [*0..9].include?(local_assigns[:margin_bottom])
|
17
|
+
|
18
|
+
component_helper.add_class(classes.join(" "))
|
19
|
+
component_helper.set_id(heading_helper.id)
|
20
|
+
element = shared_helper.get_heading_level
|
16
21
|
%>
|
17
|
-
<%= content_tag(
|
18
|
-
|
19
|
-
|
20
|
-
lang: lang
|
21
|
-
) %>
|
22
|
+
<%= content_tag(element, component_helper.all_attributes) do %>
|
23
|
+
<%= text %>
|
24
|
+
<% end %>
|
@@ -15,6 +15,7 @@ accessibility_criteria: |
|
|
15
15
|
- be part of a correct heading structure for a page
|
16
16
|
- be semantically represented as a heading
|
17
17
|
- convey the heading level
|
18
|
+
uses_component_wrapper_helper: true
|
18
19
|
examples:
|
19
20
|
default:
|
20
21
|
data:
|
@@ -31,10 +32,6 @@ examples:
|
|
31
32
|
data:
|
32
33
|
text: 'One big heading'
|
33
34
|
font_size: "xl"
|
34
|
-
with_id_attribute:
|
35
|
-
data:
|
36
|
-
text: 'Detail of outcome'
|
37
|
-
id: 'detail_of_outcome'
|
38
35
|
right_to_left:
|
39
36
|
data:
|
40
37
|
text: 'مستندات'
|
data/app/views/govuk_publishing_components/components/docs/single_page_notification_button.yml
CHANGED
@@ -9,6 +9,7 @@ body: |
|
|
9
9
|
When the button is clicked, the `base_path` is submitted to an endpoint which proceeds to check the user's authentication status and whether they are already subscribed to the page or not. Depending on these factors, they will be routed accordingly.
|
10
10
|
accessibility_criteria: |
|
11
11
|
- The bell icon must be presentational and ignored by screen readers.
|
12
|
+
uses_component_wrapper_helper: true
|
12
13
|
examples:
|
13
14
|
default:
|
14
15
|
description: By default this component prompts the user to subscribe to email notifications to this page.
|
@@ -19,12 +20,6 @@ examples:
|
|
19
20
|
data:
|
20
21
|
base_path: '/current-page-path'
|
21
22
|
already_subscribed: true
|
22
|
-
with_data_attributes:
|
23
|
-
description: The component accepts data attributes (for example, for analytics)
|
24
|
-
data:
|
25
|
-
base_path: '/current-page-path'
|
26
|
-
data_attributes:
|
27
|
-
test_attribute: "testing"
|
28
23
|
with_ga4_tracking:
|
29
24
|
description: To add GA4 tracking, pass a `ga4_data_attributes` object with the necessary properties to the component. For example:-
|
30
25
|
data:
|
@@ -9,6 +9,9 @@ module GovukPublishingComponents
|
|
9
9
|
mattr_accessor :component_guide_title
|
10
10
|
self.component_guide_title = "Component Guide"
|
11
11
|
|
12
|
+
mattr_accessor :application_dir
|
13
|
+
self.application_dir = ""
|
14
|
+
|
12
15
|
mattr_accessor :application_stylesheet
|
13
16
|
self.application_stylesheet = "application"
|
14
17
|
|
@@ -9,6 +9,7 @@ module GovukPublishingComponents
|
|
9
9
|
check_classes_are_valid(@options[:classes]) if @options.include?(:classes)
|
10
10
|
check_aria_is_valid(@options[:aria]) if @options.include?(:aria)
|
11
11
|
check_role_is_valid(@options[:role]) if @options.include?(:role)
|
12
|
+
check_lang_is_valid(@options[:lang]) if @options.include?(:lang)
|
12
13
|
end
|
13
14
|
|
14
15
|
def all_attributes
|
@@ -19,6 +20,7 @@ module GovukPublishingComponents
|
|
19
20
|
attributes[:aria] = @options[:aria] unless @options[:aria].blank?
|
20
21
|
attributes[:class] = @options[:classes] unless @options[:classes].blank?
|
21
22
|
attributes[:role] = @options[:role] unless @options[:role].blank?
|
23
|
+
attributes[:lang] = @options[:lang] unless @options[:lang].blank?
|
22
24
|
|
23
25
|
attributes
|
24
26
|
end
|
@@ -48,6 +50,11 @@ module GovukPublishingComponents
|
|
48
50
|
extend_string(:role, role)
|
49
51
|
end
|
50
52
|
|
53
|
+
def set_lang(lang)
|
54
|
+
check_lang_is_valid(lang)
|
55
|
+
@options[:lang] = lang
|
56
|
+
end
|
57
|
+
|
51
58
|
private
|
52
59
|
|
53
60
|
def check_id_is_valid(id)
|
@@ -69,7 +76,7 @@ module GovukPublishingComponents
|
|
69
76
|
return if classes.blank?
|
70
77
|
|
71
78
|
class_array = classes.split(" ")
|
72
|
-
unless class_array.all? { |c| c.start_with?("js-", "gem-c-", "govuk-", "brand--") }
|
79
|
+
unless class_array.all? { |c| c.start_with?("js-", "gem-c-", "govuk-", "brand--", "brand__") }
|
73
80
|
raise(ArgumentError, "Classes (#{classes}) must be prefixed with `js-`")
|
74
81
|
end
|
75
82
|
end
|
@@ -98,6 +105,15 @@ module GovukPublishingComponents
|
|
98
105
|
end
|
99
106
|
end
|
100
107
|
|
108
|
+
def check_lang_is_valid(lang)
|
109
|
+
return if lang.blank?
|
110
|
+
|
111
|
+
langs = %w[ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh zh-Hans zh-Hant cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl gd gv ka de el kl gn gu ht ha he hz hi ho hu is io ig id in ia ie iu ik ga it ja jv kl kn kr ks kk km ki rw rn ky kv kg ko ku kj lo la lv li ln lt lu lg lb gv mk mg ms ml mt mi mr mh mo mn na nv ng nd ne no nb nn ii oc oj cu or om os pi ps fa pl pt pa qu rm ro ru se sm sg sa sr sh st tn sn ii sd si ss sk sl so nr es su sw ss sv tl ty tg ta tt te th bo ti to ts tr tk tw ug uk ur uz ve vi vo wa cy wo fy xh yi ji yo za zu]
|
112
|
+
unless langs.include? lang
|
113
|
+
raise(ArgumentError, "lang attribute (#{lang}) is not recognised")
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
101
117
|
def extend_string(option, string)
|
102
118
|
((@options[option] ||= "") << " #{string}").strip!
|
103
119
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 35.
|
4
|
+
version: 35.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: govuk_app_config
|