govuk_publishing_components 12.1.0 → 12.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72fafab7cf3f7469c29c69b902693f7de941fae8628e74bf436552f442c6120c
4
- data.tar.gz: b9705621014e8d577e223fdcad143187997e6bdad1d94d23a96817a15f7d3cfb
3
+ metadata.gz: a163b8629c527f42192e2e01c02b0b873752abb7af36601d12624d8c41f84c4e
4
+ data.tar.gz: f307b43dd38217403a89f8ed51c4fe8838f2a08db74724ca1949e317df21e4c9
5
5
  SHA512:
6
- metadata.gz: c11f346224e358f56ae9d6bc924aae648a3017cb12ae06ecf518b540d343bd644c334d693b898675ef24384dded15471c641d3426ca39fb0990df10a04488f2d
7
- data.tar.gz: 94e87dcc0493b6dd93848e0ef15d9c5c645f54d4422fd72c0892007280b7532e31a16343c61d0562f50b3eb4c440be9001c0da1d83952cc6e323d07dc1a97436
6
+ metadata.gz: d6df7a8ea26d0cb6bc456b4269970581e65834644349858756f59031043e05a8fb0c0bbfc7ef15d719f64da5205dc545805f73c914740dd918c80ee16e760eca
7
+ data.tar.gz: a6843135492f1ea827986ee8374f50487dc146b314f31d8112085c769f8a63c4d3699bc5b529a1d599b3d318048bea6fee283a975a922fe335c129ba3f2f8747
@@ -0,0 +1,2 @@
1
+ // This component relies on JavaScript from GOV.UK Frontend
2
+ //= require govuk-frontend/components/character-count/character-count.js
@@ -15,6 +15,7 @@
15
15
  @import "components/back-link";
16
16
  @import "components/breadcrumbs";
17
17
  @import "components/button";
18
+ @import "components/character-count";
18
19
  @import "components/contents-list";
19
20
  @import "components/copy-to-clipboard";
20
21
  @import "components/details";
@@ -0,0 +1,3 @@
1
+ @import "helpers/govuk-frontend-settings";
2
+ @import "govuk-frontend/components/character-count/character-count";
3
+ @import "govuk-frontend/objects/form-group";
@@ -2,11 +2,13 @@
2
2
 
3
3
  // scss-lint:disable PlaceholderInExtend
4
4
  .gem-c-govspeak {
5
- .button {
5
+ .button,
6
+ .govuk-button {
6
7
  @extend .govuk-button;
7
8
  }
8
9
 
9
- .button-start {
10
+ .button-start,
11
+ .govuk-button--start {
10
12
  @extend .govuk-button--start;
11
13
  }
12
14
  }
@@ -76,7 +76,8 @@
76
76
 
77
77
  // Links
78
78
  a {
79
- @extend %govuk-link;
79
+ @include govuk-link-style-default;
80
+ @include govuk-focusable-fill;
80
81
  }
81
82
 
82
83
  // Lists
@@ -0,0 +1,23 @@
1
+ <%
2
+ id ||= "character-count-#{SecureRandom.hex(4)}"
3
+ maxlength ||= nil
4
+ maxwords ||= nil
5
+ threshold ||= nil
6
+ textarea ||= {}
7
+ %>
8
+
9
+ <%= content_tag :div,
10
+ class: "gem-c-character-count govuk-character-count",
11
+ data: {
12
+ module: "character-count",
13
+ maxlength: maxlength,
14
+ maxwords: maxwords,
15
+ threshold: threshold
16
+ } do %>
17
+
18
+ <%= render "govuk_publishing_components/components/textarea", { id: id, character_count: true }.merge(textarea.symbolize_keys) %>
19
+
20
+ <span id="<%= id %>-info" class="govuk-hint govuk-character-count__message" aria-live="polite">
21
+ You can enter up to <%= maxlength || maxwords %> <%= maxwords ? 'words' : 'characters' %>
22
+ </span>
23
+ <% end %>
@@ -8,10 +8,12 @@
8
8
  label ||= nil
9
9
  hint ||= nil
10
10
  error_message ||= nil
11
+ character_count ||= nil
11
12
  hint_id = "hint-#{SecureRandom.hex(4)}" if hint
12
13
  error_message_id = "error-message-#{SecureRandom.hex(4)}" if error_message
13
14
 
14
15
  css_classes = %w(gem-c-textarea govuk-textarea)
16
+ css_classes << "js-character-count" if character_count
15
17
  css_classes << "govuk-textarea--error" if error_message
16
18
  form_group_css_classes = %w(govuk-form-group)
17
19
  form_group_css_classes << "govuk-form-group--error" if error_message
@@ -0,0 +1,53 @@
1
+ name: Form character count
2
+ description: Help users enter text when there is a limit on the number of characters they can type
3
+ govuk_frontend_components:
4
+ - character-count
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 they have focus
13
+ - be recognisable as form textarea elements
14
+ - have correctly associated labels
15
+ - inform the user about the character limit
16
+ - inform the user as the number of left characters changes
17
+
18
+ Labels use the [label component](/component-guide/label).
19
+ examples:
20
+ default:
21
+ data:
22
+ textarea:
23
+ label:
24
+ text: "Can you provide more detail?"
25
+ name: "more-detail"
26
+ maxlength: 10
27
+ with_hint:
28
+ data:
29
+ textarea:
30
+ label:
31
+ text: "Can you provide more detail?"
32
+ name: "with-hint"
33
+ hint: "Please include as much information as possible."
34
+ maxlength: 10
35
+ with_error:
36
+ data:
37
+ textarea:
38
+ label:
39
+ text: "Can you provide more detail?"
40
+ name: "more-detail-error"
41
+ error_message: "Detail must be 10 characters or less"
42
+ value: |
43
+ 221B Baker Street
44
+ London
45
+ NW1 6XE
46
+ maxlength: 10
47
+ with_word_count:
48
+ data:
49
+ textarea:
50
+ label:
51
+ text: "Can you provide more detail?"
52
+ name: "more-detail-value"
53
+ maxwords: 10
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '12.1.0'.freeze
2
+ VERSION = '12.2.0'.freeze
3
3
  end
@@ -2,18 +2,18 @@
2
2
  "_args": [
3
3
  [
4
4
  {
5
- "raw": "govuk-frontend@^2.1.0",
5
+ "raw": "govuk-frontend@^2.2.0",
6
6
  "scope": null,
7
7
  "escapedName": "govuk-frontend",
8
8
  "name": "govuk-frontend",
9
- "rawSpec": "^2.1.0",
10
- "spec": ">=2.1.0 <3.0.0",
9
+ "rawSpec": "^2.2.0",
10
+ "spec": ">=2.2.0 <3.0.0",
11
11
  "type": "range"
12
12
  },
13
13
  "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ"
14
14
  ]
15
15
  ],
16
- "_from": "govuk-frontend@>=2.1.0 <3.0.0",
16
+ "_from": "govuk-frontend@>=2.2.0 <3.0.0",
17
17
  "_hasShrinkwrap": false,
18
18
  "_id": "govuk-frontend@2.2.0",
19
19
  "_inCache": true,
@@ -30,12 +30,12 @@
30
30
  "_npmVersion": "5.6.0",
31
31
  "_phantomChildren": {},
32
32
  "_requested": {
33
- "raw": "govuk-frontend@^2.1.0",
33
+ "raw": "govuk-frontend@^2.2.0",
34
34
  "scope": null,
35
35
  "escapedName": "govuk-frontend",
36
36
  "name": "govuk-frontend",
37
- "rawSpec": "^2.1.0",
38
- "spec": ">=2.1.0 <3.0.0",
37
+ "rawSpec": "^2.2.0",
38
+ "spec": ">=2.2.0 <3.0.0",
39
39
  "type": "range"
40
40
  },
41
41
  "_requiredBy": [
@@ -44,7 +44,7 @@
44
44
  "_resolved": "https://registry.npmjs.org/govuk-frontend/-/govuk-frontend-2.2.0.tgz",
45
45
  "_shasum": "ef14463f8c0b4b628d5a498f8aa4f3bf6833315e",
46
46
  "_shrinkwrap": null,
47
- "_spec": "govuk-frontend@^2.1.0",
47
+ "_spec": "govuk-frontend@^2.2.0",
48
48
  "_where": "/var/lib/jenkins/workspace/ublishing_components_master-N4FWJIUY4CIFHKGZOAAEVVXODRY3YBORQOPIBBXWX72VUPSGJRRQ",
49
49
  "author": {
50
50
  "name": "GOV.UK Design System Team",
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: 12.1.0
4
+ version: 12.2.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-10-15 00:00:00.000000000 Z
11
+ date: 2018-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: govuk_app_config
@@ -308,6 +308,7 @@ files:
308
308
  - app/assets/javascripts/component_guide/vendor/matches-polyfill.min.js
309
309
  - app/assets/javascripts/component_guide/visual-regression.js
310
310
  - app/assets/javascripts/govuk_publishing_components/all_components.js
311
+ - app/assets/javascripts/govuk_publishing_components/components/character-count.js
311
312
  - app/assets/javascripts/govuk_publishing_components/components/copy-to-clipboard.js
312
313
  - app/assets/javascripts/govuk_publishing_components/components/error-summary.js
313
314
  - app/assets/javascripts/govuk_publishing_components/components/feedback.js
@@ -325,6 +326,7 @@ files:
325
326
  - app/assets/stylesheets/govuk_publishing_components/components/_back-link.scss
326
327
  - app/assets/stylesheets/govuk_publishing_components/components/_breadcrumbs.scss
327
328
  - app/assets/stylesheets/govuk_publishing_components/components/_button.scss
329
+ - app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss
328
330
  - app/assets/stylesheets/govuk_publishing_components/components/_contents-list.scss
329
331
  - app/assets/stylesheets/govuk_publishing_components/components/_copy-to-clipboard.scss
330
332
  - app/assets/stylesheets/govuk_publishing_components/components/_details.scss
@@ -431,6 +433,7 @@ files:
431
433
  - app/views/govuk_publishing_components/components/_back_link.html.erb
432
434
  - app/views/govuk_publishing_components/components/_breadcrumbs.html.erb
433
435
  - app/views/govuk_publishing_components/components/_button.html.erb
436
+ - app/views/govuk_publishing_components/components/_character_count.html.erb
434
437
  - app/views/govuk_publishing_components/components/_contents_list.html.erb
435
438
  - app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb
436
439
  - app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb
@@ -489,6 +492,7 @@ files:
489
492
  - app/views/govuk_publishing_components/components/docs/back_link.yml
490
493
  - app/views/govuk_publishing_components/components/docs/breadcrumbs.yml
491
494
  - app/views/govuk_publishing_components/components/docs/button.yml
495
+ - app/views/govuk_publishing_components/components/docs/character_count.yml
492
496
  - app/views/govuk_publishing_components/components/docs/contents_list.yml
493
497
  - app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml
494
498
  - app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml