govuk_publishing_components 49.1.0 → 50.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/components/_add-another.scss +8 -6
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss +5 -1
  4. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_warning-callout.scss +9 -15
  5. data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +1 -1
  6. data/app/views/govuk_publishing_components/components/_button.html.erb +0 -3
  7. data/app/views/govuk_publishing_components/components/_character_count.html.erb +6 -5
  8. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +9 -4
  9. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +0 -6
  10. data/app/views/govuk_publishing_components/components/_print_link.html.erb +14 -22
  11. data/app/views/govuk_publishing_components/components/_search.html.erb +0 -1
  12. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +8 -2
  13. data/app/views/govuk_publishing_components/components/_textarea.html.erb +11 -14
  14. data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +1 -0
  15. data/app/views/govuk_publishing_components/components/docs/inset_text.yml +0 -6
  16. data/app/views/govuk_publishing_components/components/docs/print_link.yml +4 -8
  17. data/app/views/govuk_publishing_components/components/docs/search.yml +3 -2
  18. data/app/views/govuk_publishing_components/components/docs/search_with_autocomplete.yml +1 -0
  19. data/app/views/govuk_publishing_components/components/docs/textarea.yml +3 -2
  20. data/config/locales/ar.yml +1 -1
  21. data/config/locales/ru.yml +1 -1
  22. data/config/locales/zh.yml +2 -2
  23. data/lib/govuk_publishing_components/presenters/button_helper.rb +7 -1
  24. data/lib/govuk_publishing_components/presenters/single_page_notification_button_helper.rb +1 -13
  25. data/lib/govuk_publishing_components/version.rb +1 -1
  26. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9138d245bd1d57f9a78c08fad8234385936554efa39c18fcde3b1e37b1d25a33
4
- data.tar.gz: 905cd9baa8e3975c2a4fba5540039179d7f4a08e296124be5ec130de3fb86568
3
+ metadata.gz: acbc54b26a0b9ba3956697b9bb7cbf49a0b70dbf237170ad7f0efd8947457966
4
+ data.tar.gz: e13dc0ed3b7545f84d2c584b8420f04b24728a7ccaadbcf05b7242f30d8bc5aa
5
5
  SHA512:
6
- metadata.gz: 7411d2ecc8f7992e32352b12fcbd6f1363edff9bf2d79e7052b5f117c17ff7060da05c9fdaa07338e8a84540d0826c7a9630e0d82abb623c81763cf5e0da4b55
7
- data.tar.gz: e0a37e610ddb60d74f694f9fd4056b98730a54b0d2dd941b089209e373a6228b045bab3bc398a25ade701359a6e0fb92b250d51da570180a8d61bf65c013ad7f
6
+ metadata.gz: d515d37ebca58a7f1916894985b0a1b89d604717f566a92832a4f33f0a2af2728704e9b836e32eceb0b74fa2795cbaccbc2f18fa0085a1b56b0c4ea148541ea7
7
+ data.tar.gz: d053ad367613bff67475fecb2cebbd00e2317df106a2dce032b2c266a96e3e3bd297d5fdc7c919397f3121aa761fbb75087db45be81d6803b73001fa65a259b7
@@ -2,11 +2,13 @@
2
2
  @import "govuk/components/button/button";
3
3
  @import "govuk/components/fieldset/fieldset";
4
4
 
5
- .gem-c-add-another__remove-button {
6
- margin-top: govuk-spacing(6);
7
- margin-bottom: 0;
8
- }
5
+ .gem-c-add-another {
6
+ .gem-c-add-another__remove-button {
7
+ margin-top: govuk-spacing(6);
8
+ margin-bottom: 0;
9
+ }
9
10
 
10
- .js-add-another__remove-button--hidden {
11
- display: none;
11
+ .js-add-another__remove-button--hidden {
12
+ display: none;
13
+ }
12
14
  }
@@ -5,7 +5,11 @@
5
5
  .govuk-textarea {
6
6
  margin-bottom: 0;
7
7
 
8
- + .govuk-hint {
8
+ ~ .govuk-hint {
9
+ margin-top: govuk-spacing(1);
10
+ }
11
+
12
+ ~ .govuk-error-message {
9
13
  margin-top: govuk-spacing(1);
10
14
  }
11
15
  }
@@ -8,29 +8,23 @@
8
8
 
9
9
  .govspeak, // Legacy class name that's still used in some content items - needs to be kept until `.govspeak` is removed from the content items.
10
10
  .gem-c-govspeak {
11
+ @import "govuk/components/warning-text/warning-text";
12
+
11
13
  .help-notice {
12
14
  $icon-size: 35px;
13
- $line-height-mobile: 20px;
14
- $line-height-tablet: 25px;
15
+ $icon-spacing: 10px;
15
16
 
16
17
  margin: 2em 0;
18
+ padding-left: calc($icon-size + $icon-spacing);
19
+ position: relative;
17
20
 
18
- // Add '!' icon
19
- background-image: url("govuk_publishing_components/icon-important.svg");
20
- background-size: $icon-size $icon-size;
21
- background-repeat: no-repeat;
22
- min-height: $icon-size;
23
- padding-left: $icon-size;
24
-
25
- // Center the icon around the baseline
26
- padding-top: calc(($icon-size - $line-height-mobile) / 2);
27
-
28
- @include govuk-media-query($from: tablet) {
29
- padding-top: calc(($icon-size - $line-height-tablet) / 2);
21
+ &::before {
22
+ content: "!";
23
+ @include govuk-typography-weight-bold($important: false);
24
+ @extend .govuk-warning-text__icon; // stylelint-disable-line scss/at-extend-no-missing-placeholder
30
25
  }
31
26
 
32
27
  p {
33
- margin-left: 1em;
34
28
  @include govuk-font($size: 19, $weight: bold);
35
29
  }
36
30
  }
@@ -8,7 +8,7 @@ This component uses the component wrapper helper. It accepts the following optio
8
8
  - `data_attributes` - accepts a hash of data attributes
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
- - `margin_bottom` - 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) (defaults to no margin)
11
+ - `margin_bottom` - 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)
12
12
  - `role` - accepts a space separated string of roles
13
13
  - `lang` - accepts a language attribute value
14
14
  - `open` - accepts an open attribute value (true or false)
@@ -3,11 +3,8 @@
3
3
  disable_ga4 ||= false
4
4
 
5
5
  # button_helper.css_classes generates "gem-c-button"
6
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
7
- local_assigns[:classes] = shared_helper.classes
8
6
  button = GovukPublishingComponents::Presenters::ButtonHelper.new(local_assigns)
9
7
  %>
10
-
11
8
  <% start_button_text = capture do %>
12
9
  <span>
13
10
  <%= button.text %>
@@ -1,9 +1,14 @@
1
1
  <%
2
+ add_gem_component_stylesheet("error-message")
3
+ add_gem_component_stylesheet("character-count")
4
+
2
5
  id ||= "character-count-#{SecureRandom.hex(4)}"
3
6
  maxlength ||= nil
4
7
  maxwords ||= nil
5
8
  threshold ||= nil
6
9
  textarea ||= {}
10
+
11
+ textarea[:textarea_id] = id
7
12
  %>
8
13
  <% if maxlength || maxwords %>
9
14
  <%= content_tag :div,
@@ -15,14 +20,10 @@
15
20
  threshold: threshold
16
21
  } do %>
17
22
 
18
- <%= render "govuk_publishing_components/components/textarea", { id: id, character_count: true }.merge(textarea.symbolize_keys) %>
23
+ <%= render "govuk_publishing_components/components/textarea", { textarea_id: id, character_count: true, margin_bottom: 1 }.merge(textarea.symbolize_keys) %>
19
24
 
20
25
  <div id="<%= id %>-info" class="govuk-hint govuk-character-count__message">
21
26
  <%= t("components.character_count.body", number: maxlength || maxwords, type: maxwords ? t("components.character_count.type.words") : t("components.character_count.type.characters")) %>
22
27
  </div>
23
28
  <% end %>
24
29
  <% end %>
25
- <%
26
- add_gem_component_stylesheet("error-message")
27
- add_gem_component_stylesheet("character-count")
28
- %>
@@ -1,12 +1,17 @@
1
- <% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
2
- <% disable_ga4 ||= false %>
1
+ <%
2
+ navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request)
3
+ disable_ga4 ||= false
4
+
5
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
6
+ component_helper.add_class("gem-c-contextual-footer govuk-!-display-none-print")
7
+ %>
3
8
 
4
9
  <% unless navigation.content_tagged_to_current_step_by_step? %>
5
- <div class="gem-c-contextual-footer govuk-!-display-none-print">
10
+ <%= tag.div(**component_helper.all_attributes) do %>
6
11
  <%# Rendering related navigation because no step by step list %>
7
12
  <%= render 'govuk_publishing_components/components/related_navigation',
8
13
  content_item: content_item,
9
14
  disable_ga4: disable_ga4,
10
15
  context: :footer %>
11
- </div>
16
+ <% end %>
12
17
  <% end %>
@@ -2,16 +2,10 @@
2
2
  add_gem_component_stylesheet("inset-text")
3
3
 
4
4
  id ||= "inset-text-#{SecureRandom.hex(4)}"
5
- margin_top ||= 6
6
5
  local_assigns[:margin_bottom] ||= 6
7
6
 
8
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new({
9
- margin_top: margin_top,
10
- })
11
-
12
7
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
13
8
  component_helper.add_class("gem-c-inset-text govuk-inset-text gem-c-force-print-link-styles-within")
14
- component_helper.add_class(shared_helper.get_margin_top)
15
9
  component_helper.set_id(id)
16
10
  %>
17
11
  <%= tag.div(**component_helper.all_attributes) do %>
@@ -3,41 +3,33 @@
3
3
 
4
4
  text ||= t('components.print_link.text')
5
5
  href ||= nil
6
- data_attributes ||= {}
6
+ child_data_attributes ||= {}
7
7
  require_js ||= href.nil?
8
- margin_top ||= 3
9
- margin_bottom ||= 3
8
+ local_assigns[:margin_bottom] ||= 3
10
9
 
11
- ((data_attributes[:module] ||= "") << " " << (require_js ? "print-link" : "button")).strip!
10
+ ((child_data_attributes[:module] ||= "") << " " << (require_js ? "print-link" : "button")).strip!
12
11
 
13
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new({
14
- margin_top: margin_top,
15
- margin_bottom: margin_bottom
16
- })
12
+ child_classes = %w[govuk-link]
13
+ child_classes << "govuk-body-s gem-c-print-link__button" if href.nil?
14
+ child_classes << "gem-c-print-link__link govuk-link--no-visited-state" if href.present?
17
15
 
18
- wrapper_classes = %w(gem-c-print-link govuk-!-display-none-print)
19
- wrapper_classes << "gem-c-print-link--show-without-js" unless require_js
20
- wrapper_classes << shared_helper.get_margin_top
21
- wrapper_classes << shared_helper.get_margin_bottom
22
-
23
- classes = %w[govuk-link]
24
- classes << "govuk-body-s gem-c-print-link__button" if href.nil?
25
- classes << "gem-c-print-link__link govuk-link--no-visited-state" if href.present?
16
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
17
+ component_helper.add_class("gem-c-print-link govuk-!-display-none-print")
18
+ component_helper.add_class("gem-c-print-link--show-without-js") unless require_js
26
19
  %>
27
-
28
- <%= tag.div class: wrapper_classes do %>
20
+ <%= tag.div(**component_helper.all_attributes) do %>
29
21
  <% if require_js %>
30
22
  <%= content_tag(:button, text, {
31
- class: classes,
32
- data: data_attributes
23
+ class: child_classes,
24
+ data: child_data_attributes
33
25
  }) %>
34
26
  <% else %>
35
27
  <%= link_to(
36
28
  text,
37
29
  href,
38
- class: classes,
30
+ class: child_classes,
39
31
  rel: "alternate",
40
- data: data_attributes,
32
+ data: child_data_attributes,
41
33
  role: "button"
42
34
  ) %>
43
35
  <% end %>
@@ -22,7 +22,6 @@
22
22
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
23
23
  component_helper.add_data_attribute({ module: "gem-toggle-input-class-on-focus" })
24
24
  component_helper.add_class("gem-c-search govuk-!-display-none-print")
25
- component_helper.add_class(shared_helper.get_margin_top)
26
25
  component_helper.add_class("gem-c-search--large") if size == "large"
27
26
  component_helper.add_class("gem-c-search--large-on-mobile") if size == "large-mobile"
28
27
  component_helper.add_class("gem-c-search--homepage") if homepage
@@ -2,10 +2,16 @@
2
2
  add_gem_component_stylesheet("single-page-notification-button")
3
3
 
4
4
  local_assigns[:margin_bottom] ||= 3
5
+ js_enhancement ||= false
5
6
 
6
7
  spnb_helper = GovukPublishingComponents::Presenters::SinglePageNotificationButtonHelper.new(local_assigns)
7
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
8
8
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
9
+ component_helper.add_class("gem-c-single-page-notification-button")
10
+ component_helper.add_class("js-personalisation-enhancement") if local_assigns[:js_enhancement]
11
+ component_helper.add_data_attribute({ module: "single-page-notification-button" }) if js_enhancement
12
+ component_helper.add_data_attribute({ button_location: spnb_helper.button_location })
13
+ component_helper.add_data_attribute({ button_text_subscribe: spnb_helper.button_text_subscribe })
14
+ component_helper.add_data_attribute({ button_text_unsubscribe: spnb_helper.button_text_unsubscribe })
9
15
 
10
16
  ga4_data_attributes = ga4_data_attributes ||= nil
11
17
  ga4_link_data_attributes = ga4_data_attributes[:ga4_link] if ga4_data_attributes
@@ -18,7 +24,7 @@
18
24
  <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><span class="gem-c-single-page-notication-button__text"><%= spnb_helper.button_text %></span>
19
25
  <% end %>
20
26
  <%= tag.div(**component_helper.all_attributes) do %>
21
- <%= tag.form class: spnb_helper.classes, action: spnb_helper.form_action, method: "POST", data: spnb_helper.data do %>
27
+ <%= tag.form action: spnb_helper.form_action, method: "POST" do %>
22
28
  <input type="hidden" name="base_path" value="<%= spnb_helper.base_path %>">
23
29
  <% if spnb_helper.skip_the_gov_uk_account? %>
24
30
  <input type="hidden" name="<%= spnb_helper.skip_account_param %>" value="true">
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("textarea")
3
3
 
4
- id ||= "textarea-#{SecureRandom.hex(4)}"
4
+ textarea_id ||= "textarea-#{SecureRandom.hex(4)}"
5
5
  value ||= nil
6
6
  rows ||= 5
7
7
  describedby ||= nil
@@ -11,7 +11,6 @@
11
11
  label ||= nil
12
12
  hint ||= nil
13
13
  local_assigns[:margin_bottom] ||= 6
14
- local_assigns[:margin_bottom] = 6 if local_assigns[:margin_bottom] > 9
15
14
  error_message ||= nil
16
15
  error_items ||= []
17
16
  character_count ||= nil
@@ -22,14 +21,13 @@
22
21
  right_to_left ||= false
23
22
  right_to_left_help = right_to_left_help.nil? ? right_to_left : right_to_left_help
24
23
 
25
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
24
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
25
+ component_helper.add_class("gem-c-textarea govuk-form-group")
26
+ component_helper.add_class("govuk-form-group--error") if has_error
26
27
 
27
- css_classes = %w(govuk-textarea)
28
- css_classes << "govuk-js-character-count" if character_count
29
- css_classes << "govuk-textarea--error" if has_error
30
- form_group_css_classes = %w(gem-c-textarea govuk-form-group)
31
- form_group_css_classes << "govuk-form-group--error" if has_error
32
- form_group_css_classes << shared_helper.get_margin_bottom
28
+ textarea_classes = %w(govuk-textarea)
29
+ textarea_classes << "govuk-js-character-count" if character_count
30
+ textarea_classes << "govuk-textarea--error" if has_error
33
31
 
34
32
  aria_described_by ||= nil
35
33
  if hint || has_error || describedby
@@ -40,11 +38,10 @@
40
38
  aria_described_by = aria_described_by.join(" ")
41
39
  end
42
40
  %>
43
-
44
- <%= content_tag :div, class: form_group_css_classes do %>
41
+ <%= tag.div(**component_helper.all_attributes) do %>
45
42
  <% if label %>
46
43
  <%= render "govuk_publishing_components/components/label", {
47
- html_for: id,
44
+ html_for: textarea_id,
48
45
  right_to_left: right_to_left_help
49
46
  }.merge(label.symbolize_keys) %>
50
47
  <% end %>
@@ -67,9 +64,9 @@
67
64
  <% end %>
68
65
 
69
66
  <%= tag.textarea name: name,
70
- class: css_classes,
67
+ class: textarea_classes,
71
68
  dir: right_to_left ? "rtl" : nil,
72
- id: id,
69
+ id: textarea_id,
73
70
  rows: rows,
74
71
  maxlength: maxlength,
75
72
  data: data,
@@ -15,6 +15,7 @@ body: |
15
15
  [contextual_breadcrumbs]: /component-guide/contextual_breadcrumbs
16
16
  accessibility_criteria: |
17
17
  Components called by this component must be accessible
18
+ uses_component_wrapper_helper: true
18
19
  examples:
19
20
  default:
20
21
  description: Displays contacts, external links, statistical datasets, topical events, topics and world locations.
@@ -19,9 +19,3 @@ examples:
19
19
  <h2 class="govuk-heading-m" id='heading'>To publish this step by step you need to</h2>
20
20
  <a class="govuk-link" href='/foo'>Check for broken links</a>
21
21
  </div>
22
- with_custom_margins:
23
- 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 of `6` (`30px`) top and bottom.
24
- data:
25
- text: "When a failure occurs, you must submit logbook, landing and transhipment data manually to the UK Fisheries Call Centre each day and by no later than 23.59 UTC"
26
- margin_top: 0
27
- margin_bottom: 9
@@ -6,6 +6,7 @@ accessibility_criteria: |
6
6
  - The print icon must be presentational and ignored by screen readers.
7
7
  shared_accessibility_criteria:
8
8
  - link
9
+ uses_component_wrapper_helper: true
9
10
  examples:
10
11
  default:
11
12
  description: This component calls `print()` via the browser's DOM API. By default it relies on JavaScript and is not shown in environments where JavaScript is disabled. The \"link\" here is actually a button tag because this is not a navigation event.
@@ -16,16 +17,11 @@ examples:
16
17
  description: You can specify a alternative `href` URL that will override the default behaviour. When a `href` is specified the print link will render as an anchor tag and be displayed even when JavaScript is disabled.
17
18
  data:
18
19
  href: "/print"
19
- with_data_attributes:
20
+ with_child_data_attributes:
20
21
  description: |
21
- Data attributes can be passed to the component as shown.
22
+ Data attributes can be passed to the link/button as shown.
22
23
 
23
24
  Note that the component does not include built in tracking. If this is required consider using the [GA4 link tracker](https://github.com/alphagov/govuk_publishing_components/blob/main/docs/analytics-ga4/trackers/ga4-link-tracker.md).
24
25
  data:
25
- data_attributes:
26
+ child_data_attributes:
26
27
  an_attribute: some_value
27
- with_custom_margins:
28
- 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.
29
- data:
30
- margin_top: 0
31
- margin_bottom: 4
@@ -34,16 +34,17 @@ examples:
34
34
  context:
35
35
  dark_background: true
36
36
  homepage:
37
- description: For use on the homepage.
37
+ description: For use on the homepage. See the `search with autocomplete` component for reference, which wraps this component.
38
38
  data:
39
39
  label_text: "Search"
40
40
  inline_label: false
41
41
  on_govuk_blue: true
42
42
  label_size: "s"
43
+ label_margin_bottom: 3
43
44
  homepage: true
44
45
  size: "large"
45
46
  context:
46
- dark_background: true
47
+ dark_background: true
47
48
  change_label_text:
48
49
  data:
49
50
  label_text: "Search"
@@ -51,6 +51,7 @@ examples:
51
51
  on_govuk_blue: true
52
52
  label_size: "s"
53
53
  homepage: true
54
+ label_margin_bottom: 3
54
55
  size: "large"
55
56
  context:
56
57
  dark_background: true
@@ -14,6 +14,7 @@ accessibility_criteria: |
14
14
  - have correctly associated labels
15
15
 
16
16
  Labels use the [label component](/component-guide/label).
17
+ uses_component_wrapper_helper: true
17
18
  examples:
18
19
  default:
19
20
  data:
@@ -26,7 +27,7 @@ examples:
26
27
  label:
27
28
  text: "What is the nature of your medical emergency?"
28
29
  name: "emergency-name"
29
- id: "emergency-id"
30
+ textarea_id: "emergency-id"
30
31
  with_margin_bottom:
31
32
  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 6 (30px).
32
33
  data:
@@ -102,7 +103,7 @@ examples:
102
103
  <%= component %>
103
104
  <% end %>
104
105
  data:
105
- id: "contextual-guidance-id"
106
+ textarea_id: "contextual-guidance-id"
106
107
  label:
107
108
  text: "Title"
108
109
  bold: true
@@ -129,7 +129,7 @@ ar:
129
129
  navigation_search_subheading:
130
130
  search_text:
131
131
  metadata:
132
- and:
132
+ and: و
133
133
  from: من
134
134
  history: المحفوظات
135
135
  last_updated: التحديث الأخير
@@ -130,7 +130,7 @@ ru:
130
130
  navigation_search_subheading:
131
131
  search_text:
132
132
  metadata:
133
- and:
133
+ and: и
134
134
  from: Из
135
135
  history: История
136
136
  last_updated: Последнее обновление
@@ -124,8 +124,8 @@ zh:
124
124
  navigation_search_subheading:
125
125
  search_text:
126
126
  metadata:
127
- and:
128
- from:
127
+ and:
128
+ from: 发自
129
129
  history: 历史
130
130
  last_updated: 上次更新
131
131
  part_of: 一部分
@@ -53,12 +53,18 @@ module GovukPublishingComponents
53
53
  @destructive = local_assigns[:destructive]
54
54
  @name = local_assigns[:name]
55
55
  @value = local_assigns[:value]
56
- @classes = local_assigns[:classes]
57
56
  @aria_label = local_assigns[:aria_label]
58
57
  @info_text_id = "info-text-id-#{SecureRandom.hex(4)}"
59
58
  @button_id = "button-id-#{SecureRandom.hex(4)}"
60
59
  @aria_controls = local_assigns[:aria_controls]
61
60
  @aria_describedby = local_assigns[:aria_describedby]
61
+
62
+ if local_assigns.include?(:classes)
63
+ @classes = local_assigns[:classes].split(" ")
64
+ unless @classes.all? { |c| c.start_with?("js-") }
65
+ raise(ArgumentError, "Passed classes must be prefixed with `js-`")
66
+ end
67
+ end
62
68
  end
63
69
 
64
70
  def link?
@@ -1,32 +1,20 @@
1
1
  module GovukPublishingComponents
2
2
  module Presenters
3
3
  class SinglePageNotificationButtonHelper
4
- attr_reader :already_subscribed, :data_attributes, :base_path, :js_enhancement, :button_type, :button_location, :classes, :skip_account
4
+ attr_reader :already_subscribed, :data_attributes, :base_path, :button_type, :button_location, :skip_account, :button_text_subscribe, :button_text_unsubscribe
5
5
 
6
6
  def initialize(local_assigns)
7
7
  @local_assigns = local_assigns
8
8
  @data_attributes = @local_assigns[:data_attributes] || {}
9
- @js_enhancement = @local_assigns[:js_enhancement] || false
10
9
  @already_subscribed = @local_assigns[:already_subscribed] || false
11
10
  @base_path = @local_assigns[:base_path] || nil
12
11
  @button_location = button_location_is_valid? ? @local_assigns[:button_location] : nil
13
12
  @button_type = @local_assigns[:already_subscribed] ? "Unsubscribe" : "Subscribe"
14
- @classes = %w[gem-c-single-page-notification-button]
15
- @classes << "js-personalisation-enhancement" if js_enhancement
16
13
  @button_text_subscribe = custom_button_text_is_valid? ? custom_subscribe_text : default_subscribe_text
17
14
  @button_text_unsubscribe = custom_button_text_is_valid? ? custom_unsubscribe_text : default_unsubscribe_text
18
15
  @skip_account = @local_assigns[:skip_account] || nil
19
16
  end
20
17
 
21
- def data
22
- @data_attributes[:module] = "single-page-notification-button" if js_enhancement
23
- # This attribute is passed through to the personalisation API to ensure when a new button is returned from the API, it has the same button_location
24
- @data_attributes[:button_location] = button_location
25
- @data_attributes[:button_text_subscribe] = @button_text_subscribe
26
- @data_attributes[:button_text_unsubscribe] = @button_text_unsubscribe
27
- @data_attributes
28
- end
29
-
30
18
  def button_location_is_valid?
31
19
  %w[bottom top].include? @local_assigns[:button_location]
32
20
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "49.1.0".freeze
2
+ VERSION = "50.0.0".freeze
3
3
  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: 49.1.0
4
+ version: 50.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-01-17 00:00:00.000000000 Z
10
+ date: 2025-01-22 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: govuk_app_config