govuk_publishing_components 27.14.1 → 27.17.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/auto-scroll-tracker.js +24 -3
- data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +52 -26
- data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +25 -25
- data/app/assets/javascripts/govuk_publishing_components/analytics/explicit-cross-domain-links.js +48 -31
- data/app/assets/javascripts/govuk_publishing_components/components/single-page-notification-button.js +3 -3
- data/app/assets/stylesheets/govuk_publishing_components/components/_big-number.scss +10 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +12 -11
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_tables.scss +8 -4
- data/app/views/govuk_publishing_components/components/_button.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +1 -1
- data/app/views/govuk_publishing_components/components/_intervention.html.erb +21 -4
- data/app/views/govuk_publishing_components/components/_search.html.erb +25 -9
- data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +9 -7
- data/app/views/govuk_publishing_components/components/_success_alert.html.erb +4 -1
- data/app/views/govuk_publishing_components/components/docs/intervention.yml +11 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_public.yml +1 -1
- data/app/views/govuk_publishing_components/components/docs/radio.yml +40 -33
- data/app/views/govuk_publishing_components/components/docs/search.yml +25 -0
- data/app/views/govuk_publishing_components/components/docs/success_alert.yml +6 -0
- data/config/i18n-tasks.yml +8 -0
- data/config/locales/ar.yml +134 -131
- data/config/locales/az.yml +131 -131
- data/config/locales/be.yml +136 -130
- data/config/locales/bg.yml +135 -131
- data/config/locales/bn.yml +132 -131
- data/config/locales/cs.yml +136 -131
- data/config/locales/cy.yml +129 -125
- data/config/locales/da.yml +132 -131
- data/config/locales/de.yml +135 -131
- data/config/locales/dr.yml +133 -131
- data/config/locales/el.yml +131 -131
- data/config/locales/en.yml +13 -12
- data/config/locales/es-419.yml +131 -131
- data/config/locales/es.yml +131 -131
- data/config/locales/et.yml +134 -131
- data/config/locales/fa.yml +130 -131
- data/config/locales/fi.yml +133 -131
- data/config/locales/fr.yml +130 -130
- data/config/locales/gd.yml +133 -131
- data/config/locales/gu.yml +131 -131
- data/config/locales/he.yml +131 -131
- data/config/locales/hi.yml +131 -131
- data/config/locales/hr.yml +133 -131
- data/config/locales/hu.yml +134 -131
- data/config/locales/hy.yml +135 -131
- data/config/locales/id.yml +132 -131
- data/config/locales/is.yml +131 -131
- data/config/locales/it.yml +131 -131
- data/config/locales/ja.yml +128 -131
- data/config/locales/ka.yml +134 -131
- data/config/locales/kk.yml +131 -131
- data/config/locales/ko.yml +13 -17
- data/config/locales/lt.yml +136 -131
- data/config/locales/lv.yml +135 -131
- data/config/locales/ms.yml +131 -131
- data/config/locales/mt.yml +133 -131
- data/config/locales/nl.yml +131 -131
- data/config/locales/no.yml +131 -131
- data/config/locales/pa-pk.yml +128 -132
- data/config/locales/pa.yml +131 -131
- data/config/locales/pl.yml +135 -131
- data/config/locales/ps.yml +128 -131
- data/config/locales/pt.yml +131 -131
- data/config/locales/ro.yml +132 -131
- data/config/locales/ru.yml +135 -131
- data/config/locales/si.yml +131 -131
- data/config/locales/sk.yml +136 -131
- data/config/locales/sl.yml +138 -131
- data/config/locales/so.yml +131 -131
- data/config/locales/sq.yml +131 -131
- data/config/locales/sr.yml +133 -131
- data/config/locales/sv.yml +131 -131
- data/config/locales/sw.yml +131 -131
- data/config/locales/ta.yml +132 -131
- data/config/locales/th.yml +130 -131
- data/config/locales/tk.yml +132 -131
- data/config/locales/tr.yml +132 -131
- data/config/locales/uk.yml +138 -131
- data/config/locales/ur.yml +128 -131
- data/config/locales/uz.yml +133 -131
- data/config/locales/vi.yml +131 -131
- data/config/locales/zh-hk.yml +130 -131
- data/config/locales/zh-tw.yml +130 -131
- data/config/locales/zh.yml +130 -131
- data/lib/govuk_publishing_components/presenters/button_helper.rb +24 -0
- data/lib/govuk_publishing_components/presenters/intervention_helper.rb +20 -2
- data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +4 -7
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +2 -2
data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb
CHANGED
@@ -2,16 +2,18 @@
|
|
2
2
|
component_helper = GovukPublishingComponents::Presenters::SinglePageNotificationButtonHelper.new(local_assigns)
|
3
3
|
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
4
4
|
|
5
|
-
wrapper_classes = %w(
|
5
|
+
wrapper_classes = %w(govuk-!-display-none-print)
|
6
6
|
wrapper_classes << shared_helper.get_margin_bottom
|
7
7
|
%>
|
8
8
|
<% button_text = capture do %>
|
9
9
|
<svg class="gem-c-single-page-notification-button__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" height="18" width="18" viewBox="0 0 459.334 459.334"><path fill="currentColor" d="M177.216 404.514c-.001.12-.009.239-.009.359 0 30.078 24.383 54.461 54.461 54.461s54.461-24.383 54.461-54.461c0-.12-.008-.239-.009-.359H175.216zM403.549 336.438l-49.015-72.002v-89.83c0-60.581-43.144-111.079-100.381-122.459V24.485C254.152 10.963 243.19 0 229.667 0s-24.485 10.963-24.485 24.485v27.663c-57.237 11.381-100.381 61.879-100.381 122.459v89.83l-49.015 72.002a24.76 24.76 0 0 0 20.468 38.693H383.08a24.761 24.761 0 0 0 20.469-38.694z"/></svg><%= component_helper.button_text %>
|
10
10
|
<% end %>
|
11
|
-
<%= tag.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
<%= tag.div class: wrapper_classes, data: { module: "gem-track-click"} do %>
|
12
|
+
<%= tag.form class: "gem-c-single-page-notification-button", action: "/email/subscriptions/single-page/new", method: "POST", data: component_helper.data do %>
|
13
|
+
<input type="hidden" name="base_path" value="<%= component_helper.base_path %>">
|
14
|
+
<%= content_tag(:button, button_text, {
|
15
|
+
class: "govuk-body-s gem-c-single-page-notification-button__submit",
|
16
|
+
type: "submit",
|
17
|
+
}) %>
|
18
|
+
<% end %>
|
17
19
|
<% end if component_helper.base_path %>
|
@@ -1,9 +1,12 @@
|
|
1
1
|
<%
|
2
2
|
description ||= nil
|
3
3
|
title_id ||= "govuk-notification-banner-title-#{SecureRandom.hex(4)}"
|
4
|
+
shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
|
5
|
+
classes = %w(gem-c-success-alert govuk-notification-banner govuk-notification-banner--success)
|
6
|
+
classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
|
4
7
|
%>
|
5
8
|
|
6
|
-
<%= tag.div class:
|
9
|
+
<%= tag.div class: classes,
|
7
10
|
role: "alert",
|
8
11
|
tabindex: "-1",
|
9
12
|
aria: {
|
@@ -38,6 +38,17 @@ examples:
|
|
38
38
|
suggestion_link_text: "You can now apply for a permit online."
|
39
39
|
suggestion_link_url: "/permit"
|
40
40
|
|
41
|
+
open_suggestion_link_in_new_tab:
|
42
|
+
description: |
|
43
|
+
When sending users to another online task, you don't want to completely hijack
|
44
|
+
their original flow on GOV.UK. Adding the option to open links in a new tab helps to address this.
|
45
|
+
Link text should tell the user that the link opens in a new tab.
|
46
|
+
Note: "(opens in a new tab)" is added to link text if the phrase isn't included.
|
47
|
+
data:
|
48
|
+
suggestion_link_text: "You can now apply for a permit online"
|
49
|
+
suggestion_link_url: "www.google.com/permit"
|
50
|
+
new_tab: true
|
51
|
+
|
41
52
|
with_data_attributes:
|
42
53
|
description: |
|
43
54
|
This example shows the use of `suggestion_data_attributes` and
|
@@ -69,7 +69,7 @@ examples:
|
|
69
69
|
<h2 class="govuk-heading-l">This is a title</h2>
|
70
70
|
<p class="govuk-body">This is some body text with <a href="https://example.com">a link</a>.
|
71
71
|
with_current_account_navigation:
|
72
|
-
description: "The account layout renders with an account-specific nav to help users navigate different areas of their account. This flag is here to allow control over which option in the nav is highlighted as `current`. Valid options are currently `your-account
|
72
|
+
description: "The account layout renders with an account-specific nav to help users navigate different areas of their account. This flag is here to allow control over which option in the nav is highlighted as `current`. Valid options are currently `your-account` and `manage`."
|
73
73
|
data:
|
74
74
|
show_account_layout: true
|
75
75
|
account_nav_location: "manage"
|
@@ -37,6 +37,7 @@ govuk_frontend_components:
|
|
37
37
|
examples:
|
38
38
|
default:
|
39
39
|
data:
|
40
|
+
heading: How do you want to sign in?
|
40
41
|
name: "radio-group"
|
41
42
|
items:
|
42
43
|
- value: "government-gateway"
|
@@ -45,6 +46,7 @@ examples:
|
|
45
46
|
text: "Use GOV.UK Verify"
|
46
47
|
with_small_radios:
|
47
48
|
data:
|
49
|
+
heading: How do you want to sign in?
|
48
50
|
name: "radio-group"
|
49
51
|
small: true
|
50
52
|
items:
|
@@ -52,9 +54,10 @@ examples:
|
|
52
54
|
text: "Use Government Gateway"
|
53
55
|
- value: "govuk-verify"
|
54
56
|
text: "Use GOV.UK Verify"
|
55
|
-
|
56
|
-
description: Used to provide better contrast between long labels and hint text
|
57
|
+
with_bold_labels:
|
58
|
+
description: Used to provide better contrast between long labels and hint text.
|
57
59
|
data:
|
60
|
+
heading: How do you want to sign in?
|
58
61
|
name: "radio-group-bold"
|
59
62
|
items:
|
60
63
|
- value: "government-gateway"
|
@@ -65,9 +68,10 @@ examples:
|
|
65
68
|
text: "Use GOV.UK Verify"
|
66
69
|
hint_text: "You'll have an account if you've already proved your identity with a certified company, such as the Post Office."
|
67
70
|
bold: true
|
68
|
-
|
71
|
+
with_custom_bottom_margin:
|
69
72
|
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 a margin bottom of `30px` (`6`).
|
70
73
|
data:
|
74
|
+
heading: How do you want to sign in?
|
71
75
|
name: "radio-group"
|
72
76
|
margin_bottom: 9
|
73
77
|
items:
|
@@ -77,6 +81,7 @@ examples:
|
|
77
81
|
text: "Use GOV.UK Verify"
|
78
82
|
with_hint_on_form_group:
|
79
83
|
data:
|
84
|
+
heading: How do you want to sign in?
|
80
85
|
name: "radio-group-error"
|
81
86
|
id_prefix: "hint"
|
82
87
|
hint: "You’ll need to prove your identity using one of the following methods"
|
@@ -97,10 +102,10 @@ examples:
|
|
97
102
|
text: "Yes"
|
98
103
|
- value: "no"
|
99
104
|
text: "No"
|
100
|
-
|
105
|
+
with_custom_heading_size:
|
101
106
|
description: |
|
102
|
-
By default, text supplied for the `legend` is wrapped inside a `h2`.
|
103
|
-
|
107
|
+
By default, text supplied for the `legend` is wrapped inside a `h2`.
|
108
|
+
|
104
109
|
The font size of this heading can be changed using the `heading_size` option. Valid options are `s`, `m`, `l`, `xl`, defaulting to `m` if no option is passed.
|
105
110
|
data:
|
106
111
|
name: "radio-group-description"
|
@@ -113,10 +118,10 @@ examples:
|
|
113
118
|
text: "Green"
|
114
119
|
- value: "blue"
|
115
120
|
text: "Blue"
|
116
|
-
|
121
|
+
with_custom_heading_level:
|
117
122
|
description: |
|
118
123
|
By default, text supplied for the `legend` is wrapped inside a `h2`. This can be changed using the `heading_level` option.
|
119
|
-
|
124
|
+
|
120
125
|
If `heading_level` is `1` and `heading_size` is not set, the text size will be `xl`.
|
121
126
|
data:
|
122
127
|
name: "radio-group-description"
|
@@ -129,22 +134,10 @@ examples:
|
|
129
134
|
text: "Green"
|
130
135
|
- value: "blue"
|
131
136
|
text: "Blue"
|
132
|
-
|
133
|
-
data:
|
134
|
-
name: "radio-group-heading"
|
135
|
-
heading: "What is your favourite colour?"
|
136
|
-
hint: "If your favourite is not below, pick the colour closest to it."
|
137
|
-
items:
|
138
|
-
- value: "red"
|
139
|
-
text: "Red"
|
140
|
-
- value: "green"
|
141
|
-
text: "Green"
|
142
|
-
- value: "blue"
|
143
|
-
text: "Blue"
|
144
|
-
with_page_header_and_caption:
|
137
|
+
with_page_heading_and_caption:
|
145
138
|
description: |
|
146
139
|
A caption can be added using the `heading_caption` option. Captions will only be displayed if text for the heading option is present.
|
147
|
-
|
140
|
+
|
148
141
|
The pattern is used across GOV.UK to show a high-level section that this page belongs to.
|
149
142
|
data:
|
150
143
|
name: "radio-group-heading"
|
@@ -167,7 +160,7 @@ examples:
|
|
167
160
|
text: "Yes"
|
168
161
|
- value: "no"
|
169
162
|
text: "No"
|
170
|
-
|
163
|
+
with_description:
|
171
164
|
data:
|
172
165
|
name: "radio-group-description"
|
173
166
|
heading: "What is your favourite colour?"
|
@@ -217,6 +210,7 @@ examples:
|
|
217
210
|
text: "Blue"
|
218
211
|
with_hint_text_on_radios:
|
219
212
|
data:
|
213
|
+
heading: How do you want to sign in?
|
220
214
|
name: "radio-group-hint-text"
|
221
215
|
items:
|
222
216
|
- value: "government-gateway"
|
@@ -227,6 +221,7 @@ examples:
|
|
227
221
|
text: "Use GOV.UK Verify"
|
228
222
|
with_checked_option:
|
229
223
|
data:
|
224
|
+
heading: How do you want to sign in?
|
230
225
|
name: "radio-group-checked"
|
231
226
|
items:
|
232
227
|
- value: "government-gateway"
|
@@ -236,15 +231,17 @@ examples:
|
|
236
231
|
checked: true
|
237
232
|
with_data_attributes:
|
238
233
|
data:
|
234
|
+
heading: How do you want to sign in?
|
239
235
|
name: "radio-group-data-attributes"
|
240
236
|
items:
|
241
|
-
- value: "
|
242
|
-
text: "
|
243
|
-
|
244
|
-
|
245
|
-
|
237
|
+
- value: "government-gateway"
|
238
|
+
text: "Use Government Gateway"
|
239
|
+
- value: "govuk-verify"
|
240
|
+
text: "Use GOV.UK Verify"
|
241
|
+
data_attributes: { "contextual-guidance": "government-gateway" }
|
246
242
|
with_custom_id_prefix:
|
247
243
|
data:
|
244
|
+
heading: How do you want to sign in?
|
248
245
|
id_prefix: 'custom'
|
249
246
|
name: "radio-custom-id-prefix"
|
250
247
|
items:
|
@@ -255,6 +252,7 @@ examples:
|
|
255
252
|
with_or_divider:
|
256
253
|
description: "See [related service manual guidance for this pattern](https://www.gov.uk/service-manual/design/writing-for-user-interfaces#ask-questions-that-users-can-understand)"
|
257
254
|
data:
|
255
|
+
heading: How do you want to sign in?
|
258
256
|
name: "radio-group-or-divider"
|
259
257
|
items:
|
260
258
|
- value: "government-gateway"
|
@@ -267,6 +265,7 @@ examples:
|
|
267
265
|
extreme:
|
268
266
|
description: 'Note that the `:or` option [is documented as a string due to a bug](https://github.com/alphagov/govuk_publishing_components/issues/102)'
|
269
267
|
data:
|
268
|
+
heading: How do you want to sign in?
|
270
269
|
id_prefix: 'extreme'
|
271
270
|
name: "radio-custom-extreme"
|
272
271
|
items:
|
@@ -289,6 +288,7 @@ examples:
|
|
289
288
|
bold: true
|
290
289
|
with_error_on_form_group:
|
291
290
|
data:
|
291
|
+
heading: How do you want to sign in?
|
292
292
|
name: "radio-group-error"
|
293
293
|
id_prefix: "error"
|
294
294
|
error_message: "Please select one option"
|
@@ -300,6 +300,7 @@ examples:
|
|
300
300
|
with_error_and_hint_on_form_group:
|
301
301
|
description: ""
|
302
302
|
data:
|
303
|
+
heading: How do you want to sign in?
|
303
304
|
name: "radio-group-error"
|
304
305
|
id_prefix: "error"
|
305
306
|
error_message: "Please select one option"
|
@@ -311,6 +312,7 @@ examples:
|
|
311
312
|
text: "Use GOV.UK Verify"
|
312
313
|
with_error_items_on_form_group:
|
313
314
|
data:
|
315
|
+
heading: How do you want to sign in?
|
314
316
|
name: "radio-group-error"
|
315
317
|
id_prefix: "error"
|
316
318
|
error_items:
|
@@ -325,6 +327,7 @@ examples:
|
|
325
327
|
text: "Use GOV.UK Verify"
|
326
328
|
conditional:
|
327
329
|
data:
|
330
|
+
heading: How do you want to sign in?
|
328
331
|
name: "radio-group-conditional"
|
329
332
|
id_prefix: "conditional"
|
330
333
|
items:
|
@@ -336,7 +339,8 @@ examples:
|
|
336
339
|
conditional: "You’ll need to prove your identity using GOV.UK Verify"
|
337
340
|
conditional_checked:
|
338
341
|
data:
|
339
|
-
|
342
|
+
heading: How do you want to sign in?
|
343
|
+
name: "radio-group-conditional-checked"
|
340
344
|
id_prefix: "conditional-checked"
|
341
345
|
items:
|
342
346
|
- value: "government-gateway"
|
@@ -348,6 +352,7 @@ examples:
|
|
348
352
|
conditional: "You’ll need to prove your identity using GOV.UK Verify"
|
349
353
|
tracking-url:
|
350
354
|
data:
|
355
|
+
heading: How do you want to sign in?
|
351
356
|
name: "radio-group-tracking-url"
|
352
357
|
id_prefix: "tracking-url"
|
353
358
|
items:
|
@@ -360,15 +365,17 @@ examples:
|
|
360
365
|
inline:
|
361
366
|
description: "When providing few options, radio buttons should be inline rather than stacked. We recommend this for two small options like yes and no, on and off"
|
362
367
|
data:
|
368
|
+
heading: Have you changed your name?
|
363
369
|
name: "inline-radios"
|
364
370
|
inline: true
|
365
371
|
items:
|
366
|
-
- value: "
|
367
|
-
text: "
|
368
|
-
- value: "
|
369
|
-
text: "
|
372
|
+
- value: "yes"
|
373
|
+
text: "Yes"
|
374
|
+
- value: "no"
|
375
|
+
text: "No"
|
370
376
|
with_custom_id_attribute:
|
371
377
|
data:
|
378
|
+
heading: How do you want to sign in?
|
372
379
|
name: "radio-group"
|
373
380
|
id: "radio-group"
|
374
381
|
items:
|
@@ -69,3 +69,28 @@ examples:
|
|
69
69
|
Allows the label text size to be set to `xl`, `l`, `m`, or `s`. If this is set, then `inline_label` is automatically set to `false`.
|
70
70
|
data:
|
71
71
|
label_size: "xl"
|
72
|
+
wrap_label_inside_a_heading:
|
73
|
+
description: |
|
74
|
+
Puts the label inside a heading; heading level defaults to 2 if not set.
|
75
|
+
|
76
|
+
(The size of the label can still be set with `label_size` to appear more like a heading.)
|
77
|
+
data:
|
78
|
+
wrap_label_in_a_heading: true
|
79
|
+
heading_level: 1
|
80
|
+
with_margin_bottom:
|
81
|
+
description: |
|
82
|
+
Allows the spacing at the bottom of the component to be adjusted.
|
83
|
+
|
84
|
+
This accepts a number 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.
|
85
|
+
data:
|
86
|
+
margin_bottom: 9
|
87
|
+
with_margin_bottom_for_the_label:
|
88
|
+
description: |
|
89
|
+
Allows the spacing between the label and the input be adjusted.
|
90
|
+
|
91
|
+
Requires `inline_label` to be false.
|
92
|
+
|
93
|
+
This accepts a number 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.
|
94
|
+
data:
|
95
|
+
label_margin_bottom: 9
|
96
|
+
inline_label: false
|
@@ -37,3 +37,9 @@ examples:
|
|
37
37
|
orci. Proin semper porttitor ipsum, vel maximus justo rutrum vel.
|
38
38
|
Morbi volutpat facilisis libero. Donec posuere eget odio non egestas.
|
39
39
|
Nullam sed neque quis turpis.
|
40
|
+
with_custom_margin_bottom:
|
41
|
+
description: |
|
42
|
+
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 margins for the component are inherited from the [notification-banner](https://github.com/alphagov/govuk-frontend/blob/main/package/govuk/components/notification-banner/_index.scss) styles defined in the Design System.
|
43
|
+
data:
|
44
|
+
message: Message to alert the user to a successful action goes here
|
45
|
+
margin_bottom: 3
|