govuk_publishing_components 21.68.1 → 23.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.png +0 -0
  3. data/app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.svg +4 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics.js +16 -0
  5. data/app/assets/javascripts/govuk_publishing_components/analytics/analytics.js +85 -0
  6. data/app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js +30 -0
  7. data/app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js +120 -0
  8. data/app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js +41 -0
  9. data/app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js +101 -0
  10. data/app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js +51 -0
  11. data/app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js +56 -0
  12. data/app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js +198 -0
  13. data/app/assets/javascripts/govuk_publishing_components/analytics/init.js +48 -0
  14. data/app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js +38 -0
  15. data/app/assets/javascripts/govuk_publishing_components/analytics/page-content.js +129 -0
  16. data/app/assets/javascripts/govuk_publishing_components/analytics/pii.js +74 -0
  17. data/app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js +39 -0
  18. data/app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js +513 -0
  19. data/app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js +132 -0
  20. data/app/assets/javascripts/govuk_publishing_components/lib/track-click.js +61 -0
  21. data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +20 -10
  22. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-header.scss +5 -0
  23. data/app/assets/stylesheets/govuk_publishing_components/components/_print-link.scss +23 -20
  24. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +7 -1
  25. data/app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss +1 -1
  26. data/app/assets/stylesheets/govuk_publishing_components/components/print/_govspeak.scss +4 -0
  27. data/app/views/govuk_publishing_components/components/_action_link.html.erb +2 -0
  28. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +8 -13
  29. data/app/views/govuk_publishing_components/components/_govspeak.html.erb +8 -12
  30. data/app/views/govuk_publishing_components/components/_input.html.erb +17 -4
  31. data/app/views/govuk_publishing_components/components/_layout_for_public.html.erb +0 -1
  32. data/app/views/govuk_publishing_components/components/_layout_header.html.erb +6 -5
  33. data/app/views/govuk_publishing_components/components/_panel.html.erb +5 -2
  34. data/app/views/govuk_publishing_components/components/_print_link.html.erb +26 -11
  35. data/app/views/govuk_publishing_components/components/docs/action_link.yml +8 -0
  36. data/app/views/govuk_publishing_components/components/docs/contents_list.yml +0 -37
  37. data/app/views/govuk_publishing_components/components/docs/govspeak.yml +1 -6
  38. data/app/views/govuk_publishing_components/components/docs/input.yml +7 -3
  39. data/app/views/govuk_publishing_components/components/docs/layout_header.yml +0 -3
  40. data/app/views/govuk_publishing_components/components/docs/panel.yml +4 -0
  41. data/app/views/govuk_publishing_components/components/docs/print_link.yml +5 -0
  42. data/app/views/govuk_publishing_components/components/layout_header/_header_logo.html.erb +3 -1
  43. data/config/initializers/assets.rb +1 -0
  44. data/config/locales/et.yml +4 -0
  45. data/config/locales/fr.yml +4 -0
  46. data/lib/govuk_publishing_components/version.rb +1 -1
  47. metadata +23 -2
@@ -1,4 +1,6 @@
1
1
  <%
2
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
+
2
4
  id ||= "input-#{SecureRandom.hex(4)}"
3
5
  value ||= nil
4
6
  type ||= "text"
@@ -22,6 +24,7 @@
22
24
  error_id = "error-#{SecureRandom.hex(4)}"
23
25
  search_icon ||= nil
24
26
  heading_size = false unless ['s', 'm', 'l', 'xl'].include?(heading_size)
27
+ heading_level ||= nil
25
28
  prefix ||= nil
26
29
  suffix ||= nil
27
30
 
@@ -53,10 +56,20 @@
53
56
 
54
57
  <%= content_tag :div, class: form_group_css_classes do %>
55
58
  <% if label %>
56
- <%= render "govuk_publishing_components/components/label", {
57
- html_for: id,
58
- heading_size: heading_size
59
- }.merge(label.symbolize_keys) %>
59
+ <% label_markup = capture do %>
60
+ <%= render "govuk_publishing_components/components/label", {
61
+ html_for: id,
62
+ heading_size: heading_size
63
+ }.merge(label.symbolize_keys) %>
64
+ <% end %>
65
+
66
+ <% if heading_level %>
67
+ <%= content_tag(shared_helper.get_heading_level, class: "govuk-label-wrapper") do %>
68
+ <%= label_markup %>
69
+ <% end %>
70
+ <% else %>
71
+ <%= label_markup %>
72
+ <% end %>
60
73
  <% end %>
61
74
 
62
75
  <% if hint %>
@@ -47,7 +47,6 @@
47
47
 
48
48
  <% unless omit_header %>
49
49
  <%= render "govuk_publishing_components/components/layout_header", {
50
- environment: "public",
51
50
  search: show_search,
52
51
  # layout-header will always have border-bottom, unless the layout is full width
53
52
  remove_bottom_border: full_width,
@@ -1,6 +1,6 @@
1
1
  <%
2
- product_name ||= "Publishing"
3
- public_environment = environment.eql?("public")
2
+ product_name ||= nil
3
+ environment ||= nil
4
4
  full_width ||= false
5
5
  search ||= false
6
6
  search_left ||= false
@@ -8,8 +8,9 @@
8
8
  remove_bottom_border ||= false
9
9
  search_left ||= false
10
10
  width_class = full_width ? "govuk-header__container--full-width" : "govuk-width-container"
11
+
11
12
  header_classes = %w(gem-c-layout-header govuk-header)
12
- header_classes << "gem-c-layout-header--#{environment}"
13
+ header_classes << "gem-c-layout-header--#{environment}" if environment
13
14
  header_classes << "gem-c-layout-header--no-bottom-border" if remove_bottom_border
14
15
  header_classes << "gem-c-layout-header--search-left" if search_left
15
16
  %>
@@ -19,7 +20,7 @@
19
20
  <% if search_left %>
20
21
  <div class="govuk-grid-row govuk-!-margin-left-0 govuk-!-margin-right-0">
21
22
  <div class="gem-c-layout-header__logo govuk-grid-column-one-third-from-desktop">
22
- <%= render "govuk_publishing_components/components/layout_header/header_logo", public_environment: public_environment, environment: environment, product_name: product_name %>
23
+ <%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
23
24
  </div>
24
25
  </div>
25
26
  <div class="govuk-grid-row govuk-!-margin-left-0 govuk-!-margin-right-0">
@@ -33,7 +34,7 @@
33
34
  <% else %>
34
35
  <div class="govuk-grid-row govuk-!-margin-left-0 govuk-!-margin-right-0">
35
36
  <div class="gem-c-layout-header__logo govuk-grid-column-two-thirds">
36
- <%= render "govuk_publishing_components/components/layout_header/header_logo", public_environment: public_environment, environment: environment, product_name: product_name %>
37
+ <%= render "govuk_publishing_components/components/layout_header/header_logo", environment: environment, product_name: product_name %>
37
38
  </div>
38
39
  <div class="govuk-header__content gem-c-header__content">
39
40
  <%= render "govuk_publishing_components/components/layout_header/navigation_items", navigation_items: navigation_items %>
@@ -2,9 +2,11 @@
2
2
  description ||= false
3
3
  prepend ||= false
4
4
  append ||= false
5
+
6
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
5
7
  %>
6
8
  <div class="gem-c-panel govuk-panel govuk-panel--confirmation">
7
- <h2 class="govuk-panel__title">
9
+ <%= content_tag(shared_helper.get_heading_level, class: "govuk-panel__title") do %>
8
10
  <% if prepend %>
9
11
  <span class="gem-c-panel__prepend">
10
12
  <%= prepend %>
@@ -18,7 +20,8 @@
18
20
  <%= append %>
19
21
  </span>
20
22
  <% end %>
21
- </h2>
23
+ <% end %>
24
+
22
25
  <% if description %>
23
26
  <div class="govuk-panel__body">
24
27
  <%= description %>
@@ -2,26 +2,41 @@
2
2
  text ||= t('components.print_link.text')
3
3
  href ||= nil
4
4
  data_attributes ||= {}
5
-
6
5
  require_js ||= href.nil?
7
- data_attributes[:module] = 'print-link' if require_js
6
+ margin_top ||= 3
7
+ margin_bottom ||= 3
8
+
9
+ data_attributes[:module] = require_js ? "print-link" : "button"
10
+
11
+ shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new({
12
+ margin_top: margin_top,
13
+ margin_bottom: margin_bottom
14
+ })
15
+
16
+ wrapper_classes = %w(gem-c-print-link)
17
+ wrapper_classes << "gem-c-print-link--show-without-js" unless require_js
18
+ wrapper_classes << (shared_helper.get_margin_top)
19
+ wrapper_classes << (shared_helper.get_margin_bottom)
20
+
21
+ classes = %w(govuk-link)
22
+ classes << "gem-c-print-link__button" if href.nil?
23
+ classes << "gem-c-print-link__link govuk-link--no-visited-state" if href.present?
8
24
  %>
9
25
 
10
- <% if require_js %>
11
- <div class="gem-c-print-link" >
26
+ <%= tag.div class: wrapper_classes do %>
27
+ <% if require_js %>
12
28
  <%= content_tag(:button, text, {
13
- class: %w(gem-c-print-link__button govuk-link),
29
+ class: classes,
14
30
  data: data_attributes
15
31
  }) %>
16
- </div>
17
- <% else %>
18
- <div class="gem-c-print-link gem-c-print-link--show-without-js">
32
+ <% else %>
19
33
  <%= link_to(
20
34
  text,
21
35
  href,
22
- class: %w(gem-c-print-link__link govuk-link),
36
+ class: classes,
23
37
  rel: "alternate",
24
- data: data_attributes
38
+ data: data_attributes,
39
+ role: "button"
25
40
  ) %>
26
- </div>
41
+ <% end %>
27
42
  <% end %>
@@ -83,6 +83,14 @@ examples:
83
83
  text: Getting financial help and keeping your business safe
84
84
  href: "/financial-help"
85
85
  simple: true
86
+ simple_light_arrow:
87
+ data:
88
+ text: Getting financial help and keeping your business safe
89
+ href: "/financial-help"
90
+ light_text: true
91
+ simple_light: true
92
+ context:
93
+ dark_background: true
86
94
  with_small_icon:
87
95
  data:
88
96
  text: Coronavirus (COVID-19)
@@ -203,40 +203,3 @@ examples:
203
203
  text: 2. Numbers not parsed
204
204
  - href: "#third-thing"
205
205
  text: 3. Numbers are just text
206
- without_a_title:
207
- description: The component can be used to provide a list of links to other pages, in which case the 'Contents' title is inappropriate and can be removed.
208
- data:
209
- hide_title: true
210
- contents:
211
- - href: "#first-thing"
212
- text: Community best practice
213
- items:
214
- - href: "#second-thing"
215
- text: Guidance and regulation
216
- - href: "#third-thing"
217
- text: Consultations
218
- with_a_custom_title:
219
- description: Override the default title of "Contents" with a custom title
220
- data:
221
- title: "On this page"
222
- contents:
223
- - href: "#first-thing"
224
- text: First thing
225
- - href: "#second-thing"
226
- text: Second thing
227
- - href: "#third-thing"
228
- text: Third thing
229
- with_a_custom_title_locale:
230
- description: |
231
- This component is often used on translated pages that don’t have a translation for the title of the contents list. This means that it could display the fallback English string if the translate method can’t find an appropriate translation. This makes sure that the lang can be set to ensure that browsers understand which parts of the page are in each language.
232
-
233
- The lang attribute must be set to a [valid BCP47 string](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang#Language_tag_syntax). A valid code can be the two or three letter language code - for example, English is en or eng, Korean is ko or kor - but if in doubt please check.
234
- data:
235
- title_lang: "cy"
236
- contents:
237
- - href: "#first-thing"
238
- text: First thing
239
- - href: "#second-thing"
240
- text: Second thing
241
- - href: "#third-thing"
242
- text: Third thing
@@ -24,12 +24,7 @@ examples:
24
24
  data:
25
25
  block: |
26
26
  <h2>This is a title</h2>
27
- <p>This is some body text with <a href=#>a link</a></p>
28
- with_content:
29
- data:
30
- content: |
31
- <h2>This is a title</h2>
32
- <p>This is some body text with <a href=#>a link</a></p>
27
+ <p>This is some body text with <a href="https://example.com">a link</a>.</p>
33
28
  heading_levels:
34
29
  data:
35
30
  block: |
@@ -125,12 +125,16 @@ examples:
125
125
  name: "search-box"
126
126
  type: "search"
127
127
  search_icon: true
128
- with_custom_label_size:
129
- description: Make the label different sizes. Valid options are 's', 'm', 'l' and 'xl'.
128
+ with_label_as_heading:
129
+ description: |
130
+ Wraps the label in a heading tag. Valid options are 1 to 6. To adjust the size of the label/heading, use the `heading_size` option. Valid options are 's', 'm', 'l' and 'xl'.
131
+
132
+ Based on the [heading/label pattern](https://design-system.service.gov.uk/patterns/question-pages/) in the Design System.
130
133
  data:
131
134
  label:
132
- text: "What is your name?"
135
+ text: "This is a heading 1 and a label"
133
136
  name: "name"
137
+ heading_level: 1
134
138
  heading_size: "l"
135
139
  with_prefix:
136
140
  description: To help users understand how the input should look like. Often used for units of measurement.
@@ -44,7 +44,6 @@ examples:
44
44
  description: This supports pages where the search appears on the left with multiple navigation links on the right, such as the [How government works](https://www.gov.uk/government/how-government-works) page
45
45
  data:
46
46
  search_left: true
47
- environment: public
48
47
  navigation_items:
49
48
  - text: Departments
50
49
  href: "item-1"
@@ -71,10 +70,8 @@ examples:
71
70
  description: This is useful for pages where a large full-width banner is the first thing to appear on the page, for example, the [GOV.UK homepage](https://www.gov.uk)
72
71
  data:
73
72
  remove_bottom_border: true
74
- environment: 'public'
75
73
  with_search_bar:
76
74
  data:
77
- environment: 'public'
78
75
  search: true
79
76
 
80
77
  accessibility_criteria: |
@@ -23,3 +23,7 @@ examples:
23
23
  prepend: The next bank holiday in England and Wales is
24
24
  title: 19 April
25
25
  append: Good Friday
26
+ with_different_heading_level:
27
+ data:
28
+ title: This is a H1
29
+ heading_level: 1
@@ -22,3 +22,8 @@ examples:
22
22
  track-category: "printButton"
23
23
  track-action: "clicked"
24
24
  track-label: "Print this page"
25
+ with_custom_margins:
26
+ 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 having margin level 3 on top and bottom.
27
+ data:
28
+ margin_top: 0
29
+ margin_bottom: 4
@@ -11,10 +11,12 @@
11
11
  GOV.UK
12
12
  </span>
13
13
  </span>
14
- <% unless public_environment %>
14
+ <% if product_name %>
15
15
  <span class="govuk-header__product-name gem-c-header__product-name">
16
16
  <%= product_name %>
17
17
  </span>
18
+ <% end %>
19
+ <% if environment %>
18
20
  <span class="gem-c-environment-tag govuk-tag gem-c-environment-tag--<%= environment %>">
19
21
  <%= environment %>
20
22
  </span>
@@ -11,6 +11,7 @@ Rails.application.config.assets.precompile += %w[
11
11
  govuk_publishing_components/ie.js
12
12
  govuk_publishing_components/modules.js
13
13
  govuk_publishing_components/vendor/modernizr.js
14
+ govuk_publishing_components/analytics.js
14
15
  govuk_publishing_components/component_guide.css
15
16
  govuk_publishing_components/favicon-development.png
16
17
  govuk_publishing_components/favicon-example.png
@@ -0,0 +1,4 @@
1
+ et:
2
+ components:
3
+ contents_list:
4
+ contents: Sisukord
@@ -0,0 +1,4 @@
1
+ fr:
2
+ components:
3
+ contents_list:
4
+ contents: Contenu
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "21.68.1".freeze
2
+ VERSION = "23.2.1".freeze
3
3
  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: 21.68.1
4
+ version: 23.2.1
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: 2020-10-12 00:00:00.000000000 Z
11
+ date: 2020-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -318,6 +318,8 @@ files:
318
318
  - app/assets/images/govuk_publishing_components/action-link--nhs.svg
319
319
  - app/assets/images/govuk_publishing_components/action-link-arrow--dark.png
320
320
  - app/assets/images/govuk_publishing_components/action-link-arrow--dark.svg
321
+ - app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.png
322
+ - app/assets/images/govuk_publishing_components/action-link-arrow--simple-light.svg
321
323
  - app/assets/images/govuk_publishing_components/action-link-arrow--simple.png
322
324
  - app/assets/images/govuk_publishing_components/action-link-arrow--simple.svg
323
325
  - app/assets/images/govuk_publishing_components/action-link-arrow--transparent.svg
@@ -395,6 +397,22 @@ files:
395
397
  - app/assets/javascripts/component_guide/vendor/matches-polyfill.min.js
396
398
  - app/assets/javascripts/component_guide/visual-regression.js
397
399
  - app/assets/javascripts/govuk_publishing_components/all_components.js
400
+ - app/assets/javascripts/govuk_publishing_components/analytics.js
401
+ - app/assets/javascripts/govuk_publishing_components/analytics/analytics.js
402
+ - app/assets/javascripts/govuk_publishing_components/analytics/auto-track-event.js
403
+ - app/assets/javascripts/govuk_publishing_components/analytics/custom-dimensions.js
404
+ - app/assets/javascripts/govuk_publishing_components/analytics/download-link-tracker.js
405
+ - app/assets/javascripts/govuk_publishing_components/analytics/ecommerce.js
406
+ - app/assets/javascripts/govuk_publishing_components/analytics/error-tracking.js
407
+ - app/assets/javascripts/govuk_publishing_components/analytics/external-link-tracker.js
408
+ - app/assets/javascripts/govuk_publishing_components/analytics/google-analytics-universal-tracker.js
409
+ - app/assets/javascripts/govuk_publishing_components/analytics/init.js
410
+ - app/assets/javascripts/govuk_publishing_components/analytics/mailto-link-tracker.js
411
+ - app/assets/javascripts/govuk_publishing_components/analytics/page-content.js
412
+ - app/assets/javascripts/govuk_publishing_components/analytics/pii.js
413
+ - app/assets/javascripts/govuk_publishing_components/analytics/print-intent.js
414
+ - app/assets/javascripts/govuk_publishing_components/analytics/scroll-tracker.js
415
+ - app/assets/javascripts/govuk_publishing_components/analytics/static-analytics.js
398
416
  - app/assets/javascripts/govuk_publishing_components/components/accordion.js
399
417
  - app/assets/javascripts/govuk_publishing_components/components/button.js
400
418
  - app/assets/javascripts/govuk_publishing_components/components/character-count.js
@@ -427,6 +445,7 @@ files:
427
445
  - app/assets/javascripts/govuk_publishing_components/lib/select.js
428
446
  - app/assets/javascripts/govuk_publishing_components/lib/toggle-input-class-on-focus.js
429
447
  - app/assets/javascripts/govuk_publishing_components/lib/toggle.js
448
+ - app/assets/javascripts/govuk_publishing_components/lib/track-click.js
430
449
  - app/assets/javascripts/govuk_publishing_components/modules.js
431
450
  - app/assets/javascripts/govuk_publishing_components/vendor/html5shiv-printshiv.js
432
451
  - app/assets/javascripts/govuk_publishing_components/vendor/json2.js
@@ -746,6 +765,8 @@ files:
746
765
  - config/initializers/assets.rb
747
766
  - config/locales/cy.yml
748
767
  - config/locales/en.yml
768
+ - config/locales/et.yml
769
+ - config/locales/fr.yml
749
770
  - config/routes.rb
750
771
  - lib/generators/govuk_publishing_components/USAGE
751
772
  - lib/generators/govuk_publishing_components/component_generator.rb