govuk_publishing_components 9.7.0 → 9.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +2 -5
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_details.scss +1 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss +13 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss +6 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss +8 -4
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_hint.scss +6 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_input.scss +1 -0
  9. data/app/assets/stylesheets/govuk_publishing_components/components/_inset-text.scss +1 -0
  10. data/app/assets/stylesheets/govuk_publishing_components/components/_radio.scss +1 -0
  11. data/app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss +1 -0
  12. data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +7 -0
  13. data/app/views/govuk_publishing_components/components/_details.html.erb +10 -0
  14. data/app/views/govuk_publishing_components/components/_document_list.html.erb +1 -1
  15. data/app/views/govuk_publishing_components/components/_error_message.html.erb +10 -0
  16. data/app/views/govuk_publishing_components/components/_feedback.html.erb +6 -4
  17. data/app/views/govuk_publishing_components/components/_hint.html.erb +10 -0
  18. data/app/views/govuk_publishing_components/components/_input.html.erb +39 -19
  19. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +10 -0
  20. data/app/views/govuk_publishing_components/components/_radio.html.erb +25 -1
  21. data/app/views/govuk_publishing_components/components/_textarea.html.erb +56 -0
  22. data/app/views/govuk_publishing_components/components/docs/back_link.yml +2 -0
  23. data/app/views/govuk_publishing_components/components/docs/button.yml +2 -5
  24. data/app/views/govuk_publishing_components/components/docs/details.yml +24 -0
  25. data/app/views/govuk_publishing_components/components/docs/error_message.yml +16 -0
  26. data/app/views/govuk_publishing_components/components/docs/hint.yml +16 -0
  27. data/app/views/govuk_publishing_components/components/docs/input.yml +8 -2
  28. data/app/views/govuk_publishing_components/components/docs/inset_text.yml +11 -0
  29. data/app/views/govuk_publishing_components/components/docs/label.yml +2 -2
  30. data/app/views/govuk_publishing_components/components/docs/radio.yml +24 -2
  31. data/app/views/govuk_publishing_components/components/docs/textarea.yml +48 -0
  32. data/lib/govuk_publishing_components/version.rb +1 -1
  33. metadata +17 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f3131ba99a3b7dd9d31bf4334388ab00549d24e094139aa9ca894fe992bdbb1
4
- data.tar.gz: 9649c4163ee5badbcb2ad66fe321293c106010068bad671db17a59b625075a22
3
+ metadata.gz: a5448e205e6135944563a216db12b37c143b57016d6bafd80ade3b31bdb8625e
4
+ data.tar.gz: d108ec91620a235bb335674ffa4549a76a253867c7f18d460be47689babc507c
5
5
  SHA512:
6
- metadata.gz: f393badabcf4a976abc0fa696026351809a10c7158b6ea5146c6c105dcf1c2cc80e2c5c66717a06cd7dc5d83b6c8514619c1413fb3bb919cf70ff068b054b240
7
- data.tar.gz: 45801c06bfda33cd98104c7031a308ff9459a522a8879c4cd2486f6f85244b1953b2c03648d110e4bcdef9e57802ca1b7c2e3ce0d99c6e3040d0fe462e48c752
6
+ metadata.gz: 0dcd90698c861c27e9f3fd036526ad256a20f5896096b8b7b99bc63464f2f754be2267cabb07772686b794b785f68958510e7158fe21cdebadd23412c00f9932
7
+ data.tar.gz: 40c868822baa69b8d497dcfc3408e8c1c96c677cb0d5a830e232bb8fcf9a2b2f94e214fd0dbb0c84b8763a4ef8106908a1d210a626fab9187391c5785652ae26
@@ -51,11 +51,8 @@
51
51
  bindComponentLinkClicks(stepNavTracker);
52
52
 
53
53
  function getTextForInsertedElements() {
54
- var openBracket = '<span class="visuallyhidden">(</span>';
55
- var closeBracket = '<span class="visuallyhidden">)</span>';
56
-
57
- actions.showText = openBracket + $element.attr('data-show-text') + closeBracket;
58
- actions.hideText = openBracket + $element.attr('data-hide-text') + closeBracket;
54
+ actions.showText = $element.attr('data-show-text');
55
+ actions.hideText = $element.attr('data-hide-text');
59
56
  actions.showAllText = $element.attr('data-show-all-text');
60
57
  actions.hideAllText = $element.attr('data-hide-all-text');
61
58
  }
@@ -0,0 +1 @@
1
+ // This component relies on styles from GOV.UK Frontend
@@ -1,3 +1,12 @@
1
+ // `govuk_frontend_toolkit`
2
+ @import "typography";
3
+
4
+ .gem-c-document-list {
5
+ @include core-19;
6
+ margin: 0;
7
+ padding: 0;
8
+ }
9
+
1
10
  .gem-c-document-list__item {
2
11
  overflow: hidden;
3
12
  margin-bottom: $gutter-one-third;
@@ -32,6 +41,10 @@
32
41
  margin-bottom: 5px;
33
42
  }
34
43
 
44
+ .gem-c-document-list__item-metadata {
45
+ padding: 0;
46
+ }
47
+
35
48
  .gem-c-document-list__attribute {
36
49
  @include core-14;
37
50
  display: inline-block;
@@ -0,0 +1,6 @@
1
+ // This component relies on styles from GOV.UK Frontend
2
+
3
+ // Specify the functions used to resolve assets paths in SCSS
4
+ $govuk-font-url-function: "font-url";
5
+
6
+ @import "../../../../node_modules/govuk-frontend/components/error-message/error-message";
@@ -1,6 +1,5 @@
1
1
  // govuk_frontend_toolkit
2
- @import 'grid_layout';
3
- @import 'design-patterns/buttons';
2
+ @import "grid_layout";
4
3
 
5
4
  .gem-c-feedback {
6
5
  max-width: 960px;
@@ -178,6 +177,11 @@
178
177
  }
179
178
  }
180
179
 
181
- .gem-c-feedback__submit {
182
- @include button;
180
+ // static.css on GOV.UK overwrites the component styles using input[type="text"]
181
+ // so we need to apply govuk-input styles using a stronger selector
182
+ .gem-c-feedback input[type="text"] {
183
+ // scss-lint:disable PlaceholderInExtend
184
+ @extend .govuk-input;
185
+ // scss-lint:enable PlaceholderInExtend
186
+ margin: 0;
183
187
  }
@@ -0,0 +1,6 @@
1
+ // This component relies on styles from GOV.UK Frontend
2
+
3
+ // Specify the functions used to resolve assets paths in SCSS
4
+ $govuk-font-url-function: "font-url";
5
+
6
+ @import "../../../../node_modules/govuk-frontend/components/hint/hint";
@@ -4,3 +4,4 @@
4
4
  $govuk-font-url-function: "font-url";
5
5
 
6
6
  @import "../../../../node_modules/govuk-frontend/components/input/input";
7
+ @import "../../../../node_modules/govuk-frontend/objects/form-group";
@@ -0,0 +1 @@
1
+ // This component relies on styles from GOV.UK Frontend
@@ -5,3 +5,4 @@ $govuk-image-url-function: "image-url";
5
5
  $govuk-font-url-function: "font-url";
6
6
 
7
7
  @import "../../../../node_modules/govuk-frontend/components/radios/radios";
8
+ @import "../../../../node_modules/govuk-frontend/objects/form-group";
@@ -0,0 +1 @@
1
+ // This component relies on styles from GOV.UK Frontend
@@ -1,10 +1,17 @@
1
1
  <% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request.path) %>
2
+ <% prioritise_taxon_breadcrumbs ||= false %>
2
3
 
3
4
  <div class='gem-c-contextual-breadcrumbs'>
4
5
  <% if navigation.content_tagged_to_single_step_by_step? %>
5
6
  <!-- Rendering step by step nav breadcrumbs because there's 1 step by step -->
6
7
  <%= render 'govuk_publishing_components/components/step_by_step_nav_header',
7
8
  navigation.step_nav_helper.header %>
9
+ <% elsif navigation.content_is_tagged_to_a_live_taxon? && prioritise_taxon_breadcrumbs %>
10
+ <!-- Rendering taxonomy breadcrumbs because the page is tagged to live taxons
11
+ and we want to prioritise them over all other breadcrumbs -->
12
+ <%= render 'govuk_publishing_components/components/breadcrumbs',
13
+ breadcrumbs: navigation.taxon_breadcrumbs[:breadcrumbs],
14
+ collapse_on_mobile: true %>
8
15
  <% elsif navigation.content_tagged_to_mainstream_browse_pages? %>
9
16
  <!-- Rendering parent-based breadcrumbs because the page is tagged to mainstream browse -->
10
17
  <%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
@@ -0,0 +1,10 @@
1
+ <details class="gem-c-details govuk-details">
2
+ <summary class="govuk-details__summary">
3
+ <span class="govuk-details__summary-text">
4
+ <%= title %>
5
+ </span>
6
+ </summary>
7
+ <div class="govuk-details__text">
8
+ <%= yield %>
9
+ </div>
10
+ </details>
@@ -35,7 +35,7 @@
35
35
  <% end %>
36
36
 
37
37
  <% if item[:metadata] %>
38
- <ul>
38
+ <ul class="gem-c-document-list__item-metadata">
39
39
  <% item[:metadata].each do |item_metadata_key, item_metadata_value| %>
40
40
  <li class="gem-c-document-list__attribute">
41
41
  <% if item_metadata_key.to_s.eql?("public_updated_at") %>
@@ -0,0 +1,10 @@
1
+ <%
2
+ id ||= "error-message-#{SecureRandom.hex(4)}"
3
+ classes ||= ''
4
+ css_classes = %w( gem-c-error-message govuk-error-message )
5
+ css_classes << classes if classes
6
+ %>
7
+
8
+ <%= tag.span id: id, class: css_classes do %>
9
+ <%= text %>
10
+ <% end %>
@@ -93,8 +93,9 @@
93
93
  name: "what_wrong"
94
94
  } %>
95
95
 
96
- <%# TODO: use button component once available in gem %>
97
- <input class="gem-c-feedback__submit" type="submit" value="Send">
96
+ <%= render "govuk_publishing_components/components/button", {
97
+ text: "Send"
98
+ } %>
98
99
  </div>
99
100
  </div>
100
101
  </form>
@@ -136,8 +137,9 @@
136
137
  describedby: "survey_explanation"
137
138
  } %>
138
139
 
139
- <%# TODO: use button component once available in gem %>
140
- <input class="gem-c-feedback__submit" type="submit" value="Send me the survey">
140
+ <%= render "govuk_publishing_components/components/button", {
141
+ text: "Send me the survey"
142
+ } %>
141
143
  <a href="https://www.smartsurvey.co.uk/s/gov-uk-banner/?c=<%= stripped_url -%>&amp;gcl=1627485790.1515403243" class="gem-c-feedback__email-link" id="take-survey" target="_blank" rel="noopener noreferrer">Don’t have an email address?</a>
142
144
  </div>
143
145
  </div>
@@ -0,0 +1,10 @@
1
+ <%
2
+ id ||= "hint-#{SecureRandom.hex(4)}"
3
+ classes ||= ''
4
+ css_classes = %w( gem-c-hint govuk-hint )
5
+ css_classes << classes if classes
6
+ %>
7
+
8
+ <%= tag.span id: id, class: css_classes do %>
9
+ <%= text %>
10
+ <% end %>
@@ -1,32 +1,52 @@
1
1
  <%
2
2
  id ||= "input-#{SecureRandom.hex(4)}"
3
- hint_id ||= "hint-#{SecureRandom.hex(4)}"
4
3
  value ||= nil
5
- error_message ||= false
6
- label ||= {}
7
4
  type ||= "text"
8
5
  describedby ||= false
9
- ariadescribedby ||= nil
6
+
7
+ label ||= nil
8
+ hint ||= nil
9
+ error_message ||= nil
10
+ hint_id = "hint-#{SecureRandom.hex(4)}" if hint
11
+ error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
12
+
10
13
  css_classes = %w(gem-c-input govuk-input)
11
14
  css_classes << "govuk-input--error" if error_message
12
- hint_text_css_classes = "govuk-error-message" if error_message
15
+ form_group_css_classes = %w(govuk-form-group)
16
+ form_group_css_classes << "govuk-form-group--error" if error_message
13
17
 
14
- if error_message
15
- ariadescribedby = hint_id
16
- elsif describedby
17
- ariadescribedby = describedby
18
+ aria_described_by ||= nil
19
+ if hint || error_message || describedby
20
+ aria_described_by = []
21
+ aria_described_by << hint_id if hint
22
+ aria_described_by << error_message_id if error_message
23
+ aria_described_by << describedby if describedby
24
+ aria_described_by = aria_described_by.join(" ")
18
25
  end
26
+
19
27
  %>
20
28
 
21
- <%= content_tag :div, class: "govuk-form-group" do %>
22
- <%= render "govuk_publishing_components/components/label", {
23
- text: label[:text],
24
- html_for: id,
25
- hint_text: error_message,
26
- hint_text_classes: hint_text_css_classes,
27
- hint_id: hint_id,
28
- bold: error_message ? true : false,
29
- } %>
29
+ <%= content_tag :div, class: form_group_css_classes do %>
30
+ <% if label %>
31
+ <%= render "govuk_publishing_components/components/label", {
32
+ text: label[:text],
33
+ html_for: id
34
+ } %>
35
+ <% end %>
36
+
37
+ <% if hint %>
38
+ <%= render "govuk_publishing_components/components/hint", {
39
+ id: hint_id,
40
+ text: hint
41
+ } %>
42
+ <% end %>
43
+
44
+ <% if error_message %>
45
+ <%= render "govuk_publishing_components/components/error_message", {
46
+ id: error_message_id,
47
+ text: error_message
48
+ } %>
49
+ <% end %>
30
50
 
31
51
  <%= text_field_tag name,
32
52
  value,
@@ -35,7 +55,7 @@
35
55
  id: id,
36
56
  type: type,
37
57
  aria: {
38
- describedby: ariadescribedby
58
+ describedby: aria_described_by
39
59
  }
40
60
  }
41
61
  %>
@@ -0,0 +1,10 @@
1
+ <%
2
+ id ||= "inset-text-#{SecureRandom.hex(4)}"
3
+ classes ||= ''
4
+ css_classes = %w( gem-c-inset-text govuk-inset-text )
5
+ css_classes << classes if classes
6
+ %>
7
+
8
+ <%= tag.div id: id, class: css_classes do %>
9
+ <%= text %>
10
+ <% end %>
@@ -2,10 +2,34 @@
2
2
  id_prefix ||= "radio-#{SecureRandom.hex(4)}"
3
3
  items ||= []
4
4
 
5
+ label ||= nil
6
+ hint ||= nil
7
+ error_message ||= nil
8
+ hint_id = "hint-#{SecureRandom.hex(4)}" if hint
9
+ error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
10
+
11
+ form_group_css_classes = %w(govuk-form-group)
12
+ form_group_css_classes << "govuk-form-group--error" if error_message
13
+
5
14
  # check if any item is set as being conditional
6
15
  has_conditional = items.any? { |item| item["conditional"] }
7
16
  %>
8
- <%= content_tag :div, class: "govuk-form-group" do %>
17
+ <%= content_tag :div, class: form_group_css_classes do %>
18
+
19
+ <% if hint %>
20
+ <%= render "govuk_publishing_components/components/hint", {
21
+ id: hint_id,
22
+ text: hint
23
+ } %>
24
+ <% end %>
25
+
26
+ <% if error_message %>
27
+ <%= render "govuk_publishing_components/components/error_message", {
28
+ id: error_message_id,
29
+ text: error_message
30
+ } %>
31
+ <% end %>
32
+
9
33
  <%= content_tag :div, class: "govuk-radios",
10
34
  data: {
11
35
  module: ('radios' if has_conditional)
@@ -0,0 +1,56 @@
1
+ <%
2
+ id ||= "textarea-#{SecureRandom.hex(4)}"
3
+ value ||= nil
4
+ rows ||= 5
5
+
6
+ label ||= nil
7
+ hint ||= nil
8
+ error_message ||= nil
9
+ hint_id = "hint-#{SecureRandom.hex(4)}" if hint
10
+ error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
11
+
12
+ css_classes = %w(gem-c-textarea govuk-textarea)
13
+ css_classes << "govuk-textarea--error" if error_message
14
+ form_group_css_classes = %w(govuk-form-group)
15
+ form_group_css_classes << "govuk-form-group--error" if error_message
16
+
17
+ aria_described_by ||= nil
18
+ if hint || error_message
19
+ aria_described_by = []
20
+ aria_described_by << hint_id if hint
21
+ aria_described_by << error_message_id if error_message
22
+ aria_described_by = aria_described_by.join(" ")
23
+ end
24
+ %>
25
+
26
+ <%= content_tag :div, class: form_group_css_classes do %>
27
+ <% if label %>
28
+ <%= render "govuk_publishing_components/components/label", {
29
+ text: label[:text],
30
+ html_for: id
31
+ } %>
32
+ <% end %>
33
+
34
+ <% if hint %>
35
+ <%= render "govuk_publishing_components/components/hint", {
36
+ id: hint_id,
37
+ text: hint
38
+ } %>
39
+ <% end %>
40
+
41
+ <% if error_message %>
42
+ <%= render "govuk_publishing_components/components/error_message", {
43
+ id: error_message_id,
44
+ text: error_message
45
+ } %>
46
+ <% end %>
47
+
48
+ <%= tag.textarea name: name,
49
+ value: value,
50
+ class: css_classes,
51
+ id: id,
52
+ rows: rows,
53
+ aria: {
54
+ describedby: aria_described_by
55
+ } do %><%= value %><% end %>
56
+ <% end %>
@@ -4,6 +4,8 @@ accessibility_criteria: |
4
4
  - has a touch area easy for users to touch
5
5
  shared_accessibility_criteria:
6
6
  - link
7
+ govuk_frontend_components:
8
+ - back-link
7
9
  examples:
8
10
  default:
9
11
  data:
@@ -3,11 +3,6 @@ description: Use buttons to move though a transaction, aim to use only one butto
3
3
  body: |
4
4
  Button text should be short and describe the action the button performs.
5
5
 
6
- [GOV.UK Elements has more information](https://govuk-elements.herokuapp.com/buttons/) on how buttons should be used.
7
-
8
- Note: We do not consume GOV.UK Elements directly due to the naming conventions being leaky,
9
- in time this component will be a wrapper for the [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend) project's button component.
10
-
11
6
  This component is also [extended for use in govspeak](https://govuk-publishing-components.herokuapp.com/component-guide/govspeak/button).
12
7
 
13
8
  These instances of buttons are added by Content Designers, ideally this duplication would not exist but we currently don't have shared markup
@@ -23,6 +18,8 @@ accessibility_criteria: |
23
18
  - activate when focused and enter is pressed
24
19
  - have a role of button
25
20
  - have an accessible label
21
+ govuk_frontend_components:
22
+ - button
26
23
  examples:
27
24
  default:
28
25
  data:
@@ -0,0 +1,24 @@
1
+ name: Details
2
+ description: Make a page easier to scan by letting users reveal more detailed information only if they need it
3
+ shared_accessibility_criteria:
4
+ - link
5
+ accessibility_criteria: |
6
+ The component must:
7
+
8
+ * accept focus
9
+ * be focusable with a keyboard
10
+ * be usable with a keyboard
11
+ * be usable with touch
12
+ * indicate when it has focus
13
+ * toggle the visibility of the details element's content when interacted with
14
+ * indicate the expanded state when details' content is visible
15
+ * indicate the collapsed state when details' content is hidden
16
+ part_of_admin_layout: true
17
+ govuk_frontend_components:
18
+ - header
19
+ examples:
20
+ default:
21
+ data:
22
+ title: Help with nationality
23
+ block: |
24
+ We need to know your nationality so we can work out which elections you’re entitled to vote in. If you can’t provide your nationality, you’ll have to send copies of identity documents through the post.
@@ -0,0 +1,16 @@
1
+ name: Form error message
2
+ description: Use error messages for any form fields.
3
+ govuk_frontend_components:
4
+ - error-message
5
+ accessibility_criteria: |
6
+ All text must have a contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
7
+
8
+ Error message must:
9
+
10
+ - be associated with an input. The `error_message_id` must match the `aria-describedby` property on the input your label is associated with.
11
+
12
+ If error message is within a label it will be announced in its entirety by screen readers. By associating error messages with inputs using `aria-describedby`, then screen readers will read the label, describe the type of input (eg radio) and then read additional text. It means users of screen readers can scan and skip options as easy as people making choices with sight.
13
+ examples:
14
+ default:
15
+ data:
16
+ text: "Please enter your National Insurance Number"
@@ -0,0 +1,16 @@
1
+ name: Form hint text
2
+ description: Use hints for any form fields.
3
+ govuk_frontend_components:
4
+ - hint
5
+ accessibility_criteria: |
6
+ All text must have a contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
7
+
8
+ Hint text must:
9
+
10
+ - be associated with an input. The `hint_id` must match the `aria-describedby` property on the input your label is associated with.
11
+
12
+ If hint text is within a label it will be announced in its entirety by screen readers. By associating hints with inputs using `aria-describedby`, then screen readers will read the label, describe the type of input (eg radio) and then read additional text. It means users of screen readers can scan and skip options as easy as people making choices with sight.
13
+ examples:
14
+ default:
15
+ data:
16
+ text: "It’s on your National Insurance card, benefit letter, payslip or P60. For example, ‘QQ 12 34 56 C’."
@@ -1,7 +1,5 @@
1
1
  name: Form input
2
2
  description: A form input field and an associated label.
3
- body: |
4
- [Forked from GOV.UK Frontend](https://govuk-frontend-review.herokuapp.com/components/input)
5
3
  accessibility_criteria: |
6
4
  Inputs in the component must:
7
5
 
@@ -15,6 +13,8 @@ accessibility_criteria: |
15
13
  * be of the appropriate type for their use, e.g. password inputs should be of type 'password'
16
14
 
17
15
  Labels use the [label component](/component-guide/label).
16
+ govuk_frontend_components:
17
+ - input
18
18
  examples:
19
19
  default:
20
20
  data:
@@ -38,6 +38,12 @@ examples:
38
38
  text: "This might not work"
39
39
  name: "labelledby"
40
40
  describedby: "wrapper"
41
+ with_hint:
42
+ data:
43
+ label:
44
+ text: "What is your name?"
45
+ name: "name"
46
+ hint: "Please provide your first and last name"
41
47
  with_error:
42
48
  data:
43
49
  label:
@@ -0,0 +1,11 @@
1
+ name: Inset text (experimental)
2
+ description: Use the inset text component to differentiate a block of text from the content that surrounds it.
3
+ part_of_admin_layout: true
4
+ govuk_frontend_components:
5
+ - inset-text
6
+ accessibility_criteria: |
7
+ All text must have a contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
8
+ examples:
9
+ default:
10
+ data:
11
+ text: "It can take up to 8 weeks to register a lasting power of attorney if there are no mistakes in the application."
@@ -2,8 +2,6 @@ name: Form label
2
2
  description: Use labels for all form fields.
3
3
  body: |
4
4
  For use with other form inputs e.g. [Radio buttons](/component-guide/radio)
5
-
6
- Forked from the upcoming [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend), when GOV.UK Frontend release we can replace these source files.
7
5
  accessibility_criteria: |
8
6
  All text must have a contrast ratio higher than 4.5:1 against the background colour to meet [WCAG AA](https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast)
9
7
 
@@ -16,6 +14,8 @@ accessibility_criteria: |
16
14
  - be associated with an input. The `hint_id` must match the `aria-describedby` property on the input your label is associated with.
17
15
 
18
16
  If hint text is within a label it will be announced in its entirity by screen readers. By putting the hint alongside labels and associating hints with inputs using `aria-describedby`, then screen readers will read the label, describe the type of input (eg radio) and then read additional text. It means users of screen readers can scan and skip options as easy as people making choices with sight. [A discussion of this approach](https://github.com/alphagov/govuk_elements/issues/574).
17
+ govuk_frontend_components:
18
+ - label
19
19
  examples:
20
20
  default:
21
21
  data:
@@ -1,5 +1,5 @@
1
- name: Radio button
2
- description: A radio button is a GOV.UK element that allows users to answer a question by selecting an option. If you have a question with more than one option you should stack radio buttons.
1
+ name: Form radio button
2
+ description: A radio button is an element that allows users to answer a question by selecting an option. If you have a question with more than one option you should stack radio buttons.
3
3
  body: |
4
4
  You can also use 'or' as an item to break up radios.
5
5
 
@@ -33,6 +33,8 @@ accessibility_criteria: |
33
33
  accessibility_excluded_rules:
34
34
  - radiogroup # Since this is in isolation we don't want to wrap a fieldset here.
35
35
  - aria-expanded # We use aria expanded to reflect the state of a conditionally revealed radio content even if this attribute is not officially supported on this element.
36
+ govuk_frontend_components:
37
+ - radios
36
38
  examples:
37
39
  default:
38
40
  data:
@@ -118,6 +120,26 @@ examples:
118
120
  hint_text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sapien justo, lobortis elementum tortor in, luctus interdum turpis. Nam sit amet nulla nec arcu condimentum dapibus quis varius metus. Suspendisse cursus tristique diam et vestibulum. Proin nec lacinia tortor. Morbi at nisi id lorem aliquam ullamcorper. Pellentesque laoreet sit amet leo sodales ultricies. Suspendisse maximus efficitur odio in tristique."
119
121
  text: "Quisque tincidunt venenatis bibendum. Morbi volutpat magna euismod ipsum consequat cursus. Etiam bibendum interdum ultricies."
120
122
  bold: true
123
+ with_hint_on_form_group:
124
+ data:
125
+ name: "radio-group-error"
126
+ id_prefix: "hint"
127
+ hint: "You’ll need to prove your identity using one of the following methods"
128
+ items:
129
+ - value: "government-gateway"
130
+ text: "Use Government Gateway"
131
+ - value: "govuk-verify"
132
+ text: "Use GOV.UK Verify"
133
+ with_error_on_form_group:
134
+ data:
135
+ name: "radio-group-error"
136
+ id_prefix: "error"
137
+ error_message: "Please select one option"
138
+ items:
139
+ - value: "government-gateway"
140
+ text: "Use Government Gateway"
141
+ - value: "govuk-verify"
142
+ text: "Use GOV.UK Verify"
121
143
  conditional:
122
144
  data:
123
145
  name: "radio-group-conditional"
@@ -0,0 +1,48 @@
1
+ name: Form textarea (experimental)
2
+ description: A textarea field and an associated label
3
+ part_of_admin_layout: true
4
+ govuk_frontend_components:
5
+ - textarea
6
+ accessibility_criteria: |
7
+ The component must:
8
+
9
+ - accept focus
10
+ - be focusable with a keyboard
11
+ - be usable with a keyboard
12
+ - be usable with touch
13
+ - indicate when they have focus
14
+ - be recognisable as form textarea elements
15
+ - have correctly associated labels
16
+
17
+ Labels use the [label component](/component-guide/label).
18
+ examples:
19
+ default:
20
+ data:
21
+ label:
22
+ text: "Can you provide more detail?"
23
+ name: "more-detail"
24
+ specific_rows:
25
+ description: Textarea with 10 rows
26
+ data:
27
+ label:
28
+ text: "Can you provide more detail?"
29
+ name: "more-detail-rows"
30
+ rows: 10
31
+ with_hint:
32
+ data:
33
+ label:
34
+ text: "Can you provide more detail?"
35
+ name: "with-hint"
36
+ hint: "Please include as much information as possible."
37
+ with_error:
38
+ data:
39
+ label:
40
+ text: "Can you provide more detail?"
41
+ name: "more-detail-error"
42
+ error_message: "Please could you provide more detail"
43
+ with_value:
44
+ data:
45
+ label:
46
+ text: "Can you provide more detail?"
47
+ name: "more-detail-value"
48
+ value: "More detail"
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '9.7.0'.freeze
2
+ VERSION = '9.8.0'.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: 9.7.0
4
+ version: 9.8.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: 2018-07-27 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -341,7 +341,9 @@ files:
341
341
  - app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss
342
342
  - app/assets/stylesheets/govuk_publishing_components/components/_button.scss
343
343
  - app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss
344
+ - app/assets/stylesheets/govuk_publishing_components/components/_details.scss
344
345
  - app/assets/stylesheets/govuk_publishing_components/components/_document-list.scss
346
+ - app/assets/stylesheets/govuk_publishing_components/components/_error-message.scss
345
347
  - app/assets/stylesheets/govuk_publishing_components/components/_error-summary.scss
346
348
  - app/assets/stylesheets/govuk_publishing_components/components/_feedback.scss
347
349
  - app/assets/stylesheets/govuk_publishing_components/components/_fieldset.scss
@@ -349,8 +351,10 @@ files:
349
351
  - app/assets/stylesheets/govuk_publishing_components/components/_govspeak.scss
350
352
  - app/assets/stylesheets/govuk_publishing_components/components/_heading.scss
351
353
  - app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss
354
+ - app/assets/stylesheets/govuk_publishing_components/components/_hint.scss
352
355
  - app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss
353
356
  - app/assets/stylesheets/govuk_publishing_components/components/_input.scss
357
+ - app/assets/stylesheets/govuk_publishing_components/components/_inset-text.scss
354
358
  - app/assets/stylesheets/govuk_publishing_components/components/_inverse-header.scss
355
359
  - app/assets/stylesheets/govuk_publishing_components/components/_label.scss
356
360
  - app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss
@@ -374,6 +378,7 @@ files:
374
378
  - app/assets/stylesheets/govuk_publishing_components/components/_subscription-links.scss
375
379
  - app/assets/stylesheets/govuk_publishing_components/components/_success-alert.scss
376
380
  - app/assets/stylesheets/govuk_publishing_components/components/_taxonomy-navigation.scss
381
+ - app/assets/stylesheets/govuk_publishing_components/components/_textarea.scss
377
382
  - app/assets/stylesheets/govuk_publishing_components/components/_title.scss
378
383
  - app/assets/stylesheets/govuk_publishing_components/components/_translation-nav.scss
379
384
  - app/assets/stylesheets/govuk_publishing_components/components/govspeak/_advisory.scss
@@ -436,7 +441,9 @@ files:
436
441
  - app/views/govuk_publishing_components/components/_contents_list.html.erb
437
442
  - app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb
438
443
  - app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb
444
+ - app/views/govuk_publishing_components/components/_details.html.erb
439
445
  - app/views/govuk_publishing_components/components/_document_list.html.erb
446
+ - app/views/govuk_publishing_components/components/_error_message.html.erb
440
447
  - app/views/govuk_publishing_components/components/_error_summary.html.erb
441
448
  - app/views/govuk_publishing_components/components/_feedback.html.erb
442
449
  - app/views/govuk_publishing_components/components/_fieldset.html.erb
@@ -445,8 +452,10 @@ files:
445
452
  - app/views/govuk_publishing_components/components/_govspeak_html_publication.html.erb
446
453
  - app/views/govuk_publishing_components/components/_heading.html.erb
447
454
  - app/views/govuk_publishing_components/components/_highlight_boxes.html.erb
455
+ - app/views/govuk_publishing_components/components/_hint.html.erb
448
456
  - app/views/govuk_publishing_components/components/_image_card.html.erb
449
457
  - app/views/govuk_publishing_components/components/_input.html.erb
458
+ - app/views/govuk_publishing_components/components/_inset_text.html.erb
450
459
  - app/views/govuk_publishing_components/components/_inverse_header.html.erb
451
460
  - app/views/govuk_publishing_components/components/_label.html.erb
452
461
  - app/views/govuk_publishing_components/components/_layout_footer.html.erb
@@ -472,6 +481,7 @@ files:
472
481
  - app/views/govuk_publishing_components/components/_subscription-links.html.erb
473
482
  - app/views/govuk_publishing_components/components/_success_alert.html.erb
474
483
  - app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb
484
+ - app/views/govuk_publishing_components/components/_textarea.html.erb
475
485
  - app/views/govuk_publishing_components/components/_title.html.erb
476
486
  - app/views/govuk_publishing_components/components/_translation-nav.html.erb
477
487
  - app/views/govuk_publishing_components/components/docs/back_link.yml
@@ -480,7 +490,9 @@ files:
480
490
  - app/views/govuk_publishing_components/components/docs/contents_list.yml
481
491
  - app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml
482
492
  - app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml
493
+ - app/views/govuk_publishing_components/components/docs/details.yml
483
494
  - app/views/govuk_publishing_components/components/docs/document_list.yml
495
+ - app/views/govuk_publishing_components/components/docs/error_message.yml
484
496
  - app/views/govuk_publishing_components/components/docs/error_summary.yml
485
497
  - app/views/govuk_publishing_components/components/docs/feedback.yml
486
498
  - app/views/govuk_publishing_components/components/docs/fieldset.yml
@@ -489,8 +501,10 @@ files:
489
501
  - app/views/govuk_publishing_components/components/docs/govspeak_html_publication.yml
490
502
  - app/views/govuk_publishing_components/components/docs/heading.yml
491
503
  - app/views/govuk_publishing_components/components/docs/highlight_boxes.yml
504
+ - app/views/govuk_publishing_components/components/docs/hint.yml
492
505
  - app/views/govuk_publishing_components/components/docs/image_card.yml
493
506
  - app/views/govuk_publishing_components/components/docs/input.yml
507
+ - app/views/govuk_publishing_components/components/docs/inset_text.yml
494
508
  - app/views/govuk_publishing_components/components/docs/inverse_header.yml
495
509
  - app/views/govuk_publishing_components/components/docs/label.yml
496
510
  - app/views/govuk_publishing_components/components/docs/layout_footer.yml
@@ -516,6 +530,7 @@ files:
516
530
  - app/views/govuk_publishing_components/components/docs/subscription-links.yml
517
531
  - app/views/govuk_publishing_components/components/docs/success_alert.yml
518
532
  - app/views/govuk_publishing_components/components/docs/taxonomy_navigation.yml
533
+ - app/views/govuk_publishing_components/components/docs/textarea.yml
519
534
  - app/views/govuk_publishing_components/components/docs/title.yml
520
535
  - app/views/govuk_publishing_components/components/docs/translation-nav.yml
521
536
  - app/views/govuk_publishing_components/components/metadata/_sentence.html.erb