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 +4 -4
- data/app/assets/javascripts/govuk_publishing_components/components/character-count.js +2 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_character-count.scss +3 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_button.scss +4 -2
- data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss +2 -1
- data/app/views/govuk_publishing_components/components/_character_count.html.erb +23 -0
- data/app/views/govuk_publishing_components/components/_textarea.html.erb +2 -0
- data/app/views/govuk_publishing_components/components/docs/character_count.yml +53 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- data/node_modules/govuk-frontend/package.json +8 -8
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a163b8629c527f42192e2e01c02b0b873752abb7af36601d12624d8c41f84c4e
|
4
|
+
data.tar.gz: f307b43dd38217403a89f8ed51c4fe8838f2a08db74724ca1949e317df21e4c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6df7a8ea26d0cb6bc456b4269970581e65834644349858756f59031043e05a8fb0c0bbfc7ef15d719f64da5205dc545805f73c914740dd918c80ee16e760eca
|
7
|
+
data.tar.gz: a6843135492f1ea827986ee8374f50487dc146b314f31d8112085c769f8a63c4d3699bc5b529a1d599b3d318048bea6fee283a975a922fe335c129ba3f2f8747
|
@@ -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
|
@@ -2,18 +2,18 @@
|
|
2
2
|
"_args": [
|
3
3
|
[
|
4
4
|
{
|
5
|
-
"raw": "govuk-frontend@^2.
|
5
|
+
"raw": "govuk-frontend@^2.2.0",
|
6
6
|
"scope": null,
|
7
7
|
"escapedName": "govuk-frontend",
|
8
8
|
"name": "govuk-frontend",
|
9
|
-
"rawSpec": "^2.
|
10
|
-
"spec": ">=2.
|
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.
|
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.
|
33
|
+
"raw": "govuk-frontend@^2.2.0",
|
34
34
|
"scope": null,
|
35
35
|
"escapedName": "govuk-frontend",
|
36
36
|
"name": "govuk-frontend",
|
37
|
-
"rawSpec": "^2.
|
38
|
-
"spec": ">=2.
|
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.
|
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.
|
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-
|
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
|