govuk_fe_assets 0.1.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/govuk_fe_assets.gemspec +26 -0
- data/lib/govuk_fe_assets.rb +5 -0
- data/lib/govuk_fe_assets/version.rb +3 -0
- data/node_modules/govuk-frontend/README.md +96 -0
- data/node_modules/govuk-frontend/all-ie8.scss +6 -0
- data/node_modules/govuk-frontend/all.js +1720 -0
- data/node_modules/govuk-frontend/all.scss +11 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
- data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
- data/node_modules/govuk-frontend/assets/images/favicon.ico +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-crest-2x.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-crest.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-logotype-crown.png +0 -0
- data/node_modules/govuk-frontend/assets/images/govuk-mask-icon.svg +7 -0
- data/node_modules/govuk-frontend/assets/images/govuk-opengraph-image.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
- data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
- data/node_modules/govuk-frontend/common.js +39 -0
- data/node_modules/govuk-frontend/components/_all.scss +26 -0
- data/node_modules/govuk-frontend/components/back-link/README.md +142 -0
- data/node_modules/govuk-frontend/components/back-link/_back-link.scss +54 -0
- data/node_modules/govuk-frontend/components/back-link/back-link.njk +3 -0
- data/node_modules/govuk-frontend/components/back-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/back-link/template.njk +2 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/README.md +335 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/_breadcrumbs.scss +119 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/breadcrumbs.njk +14 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/breadcrumbs/template.njk +13 -0
- data/node_modules/govuk-frontend/components/button/README.md +319 -0
- data/node_modules/govuk-frontend/components/button/_button.scss +185 -0
- data/node_modules/govuk-frontend/components/button/button.js +548 -0
- data/node_modules/govuk-frontend/components/button/button.njk +3 -0
- data/node_modules/govuk-frontend/components/button/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/button/template.njk +35 -0
- data/node_modules/govuk-frontend/components/checkboxes/README.md +782 -0
- data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +151 -0
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +730 -0
- data/node_modules/govuk-frontend/components/checkboxes/checkboxes.njk +27 -0
- data/node_modules/govuk-frontend/components/checkboxes/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/checkboxes/template.njk +86 -0
- data/node_modules/govuk-frontend/components/date-input/README.md +640 -0
- data/node_modules/govuk-frontend/components/date-input/_date-input.scss +35 -0
- data/node_modules/govuk-frontend/components/date-input/date-input.njk +23 -0
- data/node_modules/govuk-frontend/components/date-input/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/date-input/template.njk +76 -0
- data/node_modules/govuk-frontend/components/details/README.md +237 -0
- data/node_modules/govuk-frontend/components/details/_details.scss +86 -0
- data/node_modules/govuk-frontend/components/details/details.js +836 -0
- data/node_modules/govuk-frontend/components/details/details.njk +7 -0
- data/node_modules/govuk-frontend/components/details/implementation.md +43 -0
- data/node_modules/govuk-frontend/components/details/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/details/template.njk +10 -0
- data/node_modules/govuk-frontend/components/error-message/README.md +143 -0
- data/node_modules/govuk-frontend/components/error-message/_error-message.scss +15 -0
- data/node_modules/govuk-frontend/components/error-message/error-message.njk +7 -0
- data/node_modules/govuk-frontend/components/error-message/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/error-message/template.njk +3 -0
- data/node_modules/govuk-frontend/components/error-summary/README.md +215 -0
- data/node_modules/govuk-frontend/components/error-summary/_error-summary.scss +68 -0
- data/node_modules/govuk-frontend/components/error-summary/error-summary.js +520 -0
- data/node_modules/govuk-frontend/components/error-summary/error-summary.njk +17 -0
- data/node_modules/govuk-frontend/components/error-summary/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/error-summary/template.njk +25 -0
- data/node_modules/govuk-frontend/components/fieldset/README.md +213 -0
- data/node_modules/govuk-frontend/components/fieldset/_fieldset.scss +58 -0
- data/node_modules/govuk-frontend/components/fieldset/fieldset.njk +13 -0
- data/node_modules/govuk-frontend/components/fieldset/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/fieldset/template.njk +17 -0
- data/node_modules/govuk-frontend/components/file-upload/README.md +332 -0
- data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +19 -0
- data/node_modules/govuk-frontend/components/file-upload/file-upload.njk +9 -0
- data/node_modules/govuk-frontend/components/file-upload/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/file-upload/template.njk +42 -0
- data/node_modules/govuk-frontend/components/footer/README.md +284 -0
- data/node_modules/govuk-frontend/components/footer/_footer.scss +216 -0
- data/node_modules/govuk-frontend/components/footer/footer.njk +3 -0
- data/node_modules/govuk-frontend/components/footer/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/footer/template.njk +80 -0
- data/node_modules/govuk-frontend/components/header/README.md +524 -0
- data/node_modules/govuk-frontend/components/header/_header.scss +285 -0
- data/node_modules/govuk-frontend/components/header/header.js +717 -0
- data/node_modules/govuk-frontend/components/header/header.njk +3 -0
- data/node_modules/govuk-frontend/components/header/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/header/template.njk +82 -0
- data/node_modules/govuk-frontend/components/hint/README.md +157 -0
- data/node_modules/govuk-frontend/components/hint/_hint.scss +29 -0
- data/node_modules/govuk-frontend/components/hint/hint.njk +7 -0
- data/node_modules/govuk-frontend/components/hint/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/hint/template.njk +4 -0
- data/node_modules/govuk-frontend/components/input/README.md +416 -0
- data/node_modules/govuk-frontend/components/input/_input.scss +62 -0
- data/node_modules/govuk-frontend/components/input/input.njk +9 -0
- data/node_modules/govuk-frontend/components/input/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/input/template.njk +42 -0
- data/node_modules/govuk-frontend/components/inset-text/README.md +157 -0
- data/node_modules/govuk-frontend/components/inset-text/_inset-text.scss +28 -0
- data/node_modules/govuk-frontend/components/inset-text/inset-text.njk +7 -0
- data/node_modules/govuk-frontend/components/inset-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/inset-text/template.njk +4 -0
- data/node_modules/govuk-frontend/components/label/README.md +193 -0
- data/node_modules/govuk-frontend/components/label/_label.scss +45 -0
- data/node_modules/govuk-frontend/components/label/label.njk +6 -0
- data/node_modules/govuk-frontend/components/label/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/label/template.njk +15 -0
- data/node_modules/govuk-frontend/components/panel/README.md +151 -0
- data/node_modules/govuk-frontend/components/panel/_panel.scss +42 -0
- data/node_modules/govuk-frontend/components/panel/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/panel/panel.njk +7 -0
- data/node_modules/govuk-frontend/components/panel/template.njk +12 -0
- data/node_modules/govuk-frontend/components/phase-banner/README.md +152 -0
- data/node_modules/govuk-frontend/components/phase-banner/_phase-banner.scss +31 -0
- data/node_modules/govuk-frontend/components/phase-banner/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/phase-banner/phase-banner.njk +7 -0
- data/node_modules/govuk-frontend/components/phase-banner/template.njk +17 -0
- data/node_modules/govuk-frontend/components/radios/README.md +686 -0
- data/node_modules/govuk-frontend/components/radios/_radios.scss +157 -0
- data/node_modules/govuk-frontend/components/radios/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/radios/radios.js +730 -0
- data/node_modules/govuk-frontend/components/radios/radios.njk +27 -0
- data/node_modules/govuk-frontend/components/radios/template.njk +85 -0
- data/node_modules/govuk-frontend/components/select/README.md +387 -0
- data/node_modules/govuk-frontend/components/select/_select.scss +35 -0
- data/node_modules/govuk-frontend/components/select/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/select/select.njk +24 -0
- data/node_modules/govuk-frontend/components/select/template.njk +44 -0
- data/node_modules/govuk-frontend/components/skip-link/README.md +142 -0
- data/node_modules/govuk-frontend/components/skip-link/_skip-link.scss +15 -0
- data/node_modules/govuk-frontend/components/skip-link/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/skip-link/skip-link.njk +3 -0
- data/node_modules/govuk-frontend/components/skip-link/template.njk +3 -0
- data/node_modules/govuk-frontend/components/table/README.md +585 -0
- data/node_modules/govuk-frontend/components/table/_table.scss +50 -0
- data/node_modules/govuk-frontend/components/table/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/table/table.njk +45 -0
- data/node_modules/govuk-frontend/components/table/template.njk +39 -0
- data/node_modules/govuk-frontend/components/tabs/README.md +375 -0
- data/node_modules/govuk-frontend/components/tabs/_tabs.scss +120 -0
- data/node_modules/govuk-frontend/components/tabs/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/tabs/tabs.js +1302 -0
- data/node_modules/govuk-frontend/components/tabs/tabs.njk +3 -0
- data/node_modules/govuk-frontend/components/tabs/template.njk +29 -0
- data/node_modules/govuk-frontend/components/tag/README.md +150 -0
- data/node_modules/govuk-frontend/components/tag/_tag.scss +23 -0
- data/node_modules/govuk-frontend/components/tag/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/tag/tag.njk +7 -0
- data/node_modules/govuk-frontend/components/tag/template.njk +3 -0
- data/node_modules/govuk-frontend/components/textarea/README.md +350 -0
- data/node_modules/govuk-frontend/components/textarea/_textarea.scss +31 -0
- data/node_modules/govuk-frontend/components/textarea/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/textarea/template.njk +41 -0
- data/node_modules/govuk-frontend/components/textarea/textarea.njk +11 -0
- data/node_modules/govuk-frontend/components/warning-text/README.md +148 -0
- data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +50 -0
- data/node_modules/govuk-frontend/components/warning-text/macro.njk +3 -0
- data/node_modules/govuk-frontend/components/warning-text/template.njk +9 -0
- data/node_modules/govuk-frontend/components/warning-text/warning-text.njk +9 -0
- data/node_modules/govuk-frontend/core/_all.scss +6 -0
- data/node_modules/govuk-frontend/core/_global-styles.scss +19 -0
- data/node_modules/govuk-frontend/core/_links.scss +40 -0
- data/node_modules/govuk-frontend/core/_lists.scss +63 -0
- data/node_modules/govuk-frontend/core/_section-break.scss +56 -0
- data/node_modules/govuk-frontend/core/_template.scss +16 -0
- data/node_modules/govuk-frontend/core/_typography.scss +186 -0
- data/node_modules/govuk-frontend/helpers/_all.scss +12 -0
- data/node_modules/govuk-frontend/helpers/_clearfix.scss +15 -0
- data/node_modules/govuk-frontend/helpers/_colour.scss +51 -0
- data/node_modules/govuk-frontend/helpers/_device-pixels.scss +38 -0
- data/node_modules/govuk-frontend/helpers/_focusable.scss +34 -0
- data/node_modules/govuk-frontend/helpers/_font-faces.scss +67 -0
- data/node_modules/govuk-frontend/helpers/_grid.scss +100 -0
- data/node_modules/govuk-frontend/helpers/_links.scss +149 -0
- data/node_modules/govuk-frontend/helpers/_media-queries.scss +95 -0
- data/node_modules/govuk-frontend/helpers/_shape-arrow.scss +80 -0
- data/node_modules/govuk-frontend/helpers/_spacing.scss +152 -0
- data/node_modules/govuk-frontend/helpers/_typography.scss +153 -0
- data/node_modules/govuk-frontend/helpers/_visually-hidden.scss +76 -0
- data/node_modules/govuk-frontend/objects/_all.scss +4 -0
- data/node_modules/govuk-frontend/objects/_form-group.scss +21 -0
- data/node_modules/govuk-frontend/objects/_grid.scss +10 -0
- data/node_modules/govuk-frontend/objects/_main-wrapper.scss +37 -0
- data/node_modules/govuk-frontend/objects/_width-container.scss +28 -0
- data/node_modules/govuk-frontend/overrides/_all.scss +4 -0
- data/node_modules/govuk-frontend/overrides/_display.scss +14 -0
- data/node_modules/govuk-frontend/overrides/_spacing.scss +58 -0
- data/node_modules/govuk-frontend/overrides/_typography.scss +21 -0
- data/node_modules/govuk-frontend/overrides/_width.scss +41 -0
- data/node_modules/govuk-frontend/package.json +50 -0
- data/node_modules/govuk-frontend/settings/_all.scss +21 -0
- data/node_modules/govuk-frontend/settings/_assets.scss +82 -0
- data/node_modules/govuk-frontend/settings/_colours-applied.scss +130 -0
- data/node_modules/govuk-frontend/settings/_colours-organisations.scss +136 -0
- data/node_modules/govuk-frontend/settings/_colours-palette.scss +37 -0
- data/node_modules/govuk-frontend/settings/_compatibility.scss +51 -0
- data/node_modules/govuk-frontend/settings/_global-styles.scss +13 -0
- data/node_modules/govuk-frontend/settings/_ie8.scss +18 -0
- data/node_modules/govuk-frontend/settings/_measurements.scss +85 -0
- data/node_modules/govuk-frontend/settings/_media-queries.scss +23 -0
- data/node_modules/govuk-frontend/settings/_spacing.scss +80 -0
- data/node_modules/govuk-frontend/settings/_typography-font-families.scss +22 -0
- data/node_modules/govuk-frontend/settings/_typography-font.scss +48 -0
- data/node_modules/govuk-frontend/settings/_typography-responsive.scss +138 -0
- data/node_modules/govuk-frontend/template.njk +56 -0
- data/node_modules/govuk-frontend/tools/_all.scss +7 -0
- data/node_modules/govuk-frontend/tools/_compatibility.scss +36 -0
- data/node_modules/govuk-frontend/tools/_exports.scss +33 -0
- data/node_modules/govuk-frontend/tools/_font-url.scss +28 -0
- data/node_modules/govuk-frontend/tools/_ie8.scss +51 -0
- data/node_modules/govuk-frontend/tools/_iff.scss +15 -0
- data/node_modules/govuk-frontend/tools/_image-url.scss +28 -0
- data/node_modules/govuk-frontend/tools/_px-to-em.scss +20 -0
- data/node_modules/govuk-frontend/utilities/_all.scss +2 -0
- data/node_modules/govuk-frontend/utilities/_clearfix.scss +5 -0
- data/node_modules/govuk-frontend/utilities/_visually-hidden.scss +9 -0
- data/node_modules/govuk-frontend/vendor/_sass-mq.scss +351 -0
- data/node_modules/govuk-frontend/vendor/polyfills/DOMTokenList.js +272 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Document.js +34 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Element.js +147 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +449 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Event.js +504 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Function/prototype/bind.js +252 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Object/defineProperty.js +94 -0
- data/node_modules/govuk-frontend/vendor/polyfills/Window.js +28 -0
- data/package-lock.json +10 -0
- data/package.json +5 -0
- metadata +334 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
@import "../../settings/all";
|
2
|
+
@import "../../tools/all";
|
3
|
+
@import "../../helpers/all";
|
4
|
+
|
5
|
+
@import "../error-message/error-message";
|
6
|
+
@import "../input/input";
|
7
|
+
@import "../hint/hint";
|
8
|
+
@import "../label/label";
|
9
|
+
|
10
|
+
@include govuk-exports("govuk/component/date-input") {
|
11
|
+
.govuk-date-input {
|
12
|
+
@include govuk-clearfix;
|
13
|
+
}
|
14
|
+
|
15
|
+
.govuk-date-input__item {
|
16
|
+
width: 50px;
|
17
|
+
margin-right: govuk-spacing(4);
|
18
|
+
margin-bottom: 0;
|
19
|
+
float: left;
|
20
|
+
clear: none;
|
21
|
+
}
|
22
|
+
|
23
|
+
.govuk-date-input__label {
|
24
|
+
display: block;
|
25
|
+
padding-bottom: 2px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.govuk-date-input__input {
|
29
|
+
margin-bottom: 0;
|
30
|
+
}
|
31
|
+
|
32
|
+
.govuk-date-input__item--year {
|
33
|
+
width: 70px;
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{% from "date-input/macro.njk" import govukDateInput %}
|
2
|
+
|
3
|
+
{{- govukDateInput({
|
4
|
+
fieldset: {
|
5
|
+
legend: {
|
6
|
+
text: 'What is your date of birth?'
|
7
|
+
}
|
8
|
+
},
|
9
|
+
id: 'dob',
|
10
|
+
name: 'dob',
|
11
|
+
items:[
|
12
|
+
{
|
13
|
+
name: 'day'
|
14
|
+
},
|
15
|
+
{
|
16
|
+
name: 'month'
|
17
|
+
},
|
18
|
+
{
|
19
|
+
name: 'year'
|
20
|
+
}
|
21
|
+
]
|
22
|
+
})
|
23
|
+
-}}
|
@@ -0,0 +1,76 @@
|
|
1
|
+
{% from "../error-message/macro.njk" import govukErrorMessage -%}
|
2
|
+
{% from "../fieldset/macro.njk" import govukFieldset %}
|
3
|
+
{% from "../hint/macro.njk" import govukHint %}
|
4
|
+
{% from "../input/macro.njk" import govukInput %}
|
5
|
+
|
6
|
+
{#- a record of other elements that we need to associate with the input using
|
7
|
+
aria-describedby – for example hints or error messages -#}
|
8
|
+
{% set describedBy = "" %}
|
9
|
+
|
10
|
+
{#- Capture the HTML so we can optionally nest it in a fieldset -#}
|
11
|
+
{% set innerHtml %}
|
12
|
+
{% if params.hint %}
|
13
|
+
{% set hintId = params.id + '-hint' %}
|
14
|
+
{% set describedBy = describedBy + ' ' + hintId if describedBy else hintId %}
|
15
|
+
{{ govukHint({
|
16
|
+
id: hintId,
|
17
|
+
classes: params.hint.classes,
|
18
|
+
attributes: params.hint.attributes,
|
19
|
+
html: params.hint.html,
|
20
|
+
text: params.hint.text
|
21
|
+
}) | indent(2) | trim }}
|
22
|
+
{% endif %}
|
23
|
+
{% if params.errorMessage %}
|
24
|
+
{% set errorId = params.id + '-error' %}
|
25
|
+
{% set describedBy = describedBy + ' ' + errorId if describedBy else errorId %}
|
26
|
+
{{ govukErrorMessage({
|
27
|
+
id: errorId,
|
28
|
+
classes: params.errorMessage.classes,
|
29
|
+
html: params.errorMessage.html,
|
30
|
+
text: params.errorMessage.text
|
31
|
+
}) | indent(2) | trim }}
|
32
|
+
{% endif %}
|
33
|
+
<div class="govuk-date-input {%- if params.classes %} {{ params.classes }}{% endif %}"
|
34
|
+
{%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}
|
35
|
+
{%- if params.id %} id="{{ params.id }}"{% endif %}>
|
36
|
+
{% for item in params.items %}
|
37
|
+
<div class="govuk-date-input__item govuk-date-input__item--{{ item.name }}">
|
38
|
+
{{ govukInput({
|
39
|
+
"label":{
|
40
|
+
"text": item.name | capitalize,
|
41
|
+
"classes": 'govuk-date-input__label'
|
42
|
+
},
|
43
|
+
"id": params.id + "-" + item.name,
|
44
|
+
"classes": "govuk-date-input__input" + (" " + item.classes if item.classes),
|
45
|
+
"name": params.name + "-" + item.name,
|
46
|
+
"value": item.value,
|
47
|
+
"type": "number",
|
48
|
+
"attributes": {
|
49
|
+
"pattern": "[0-9]*"
|
50
|
+
}
|
51
|
+
}) | indent(6) | trim }}
|
52
|
+
</div>
|
53
|
+
{% endfor %}
|
54
|
+
</div>
|
55
|
+
{% endset %}
|
56
|
+
|
57
|
+
<div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %}">
|
58
|
+
{% if params.fieldset %}
|
59
|
+
{#- We override the fieldset's role to 'group' because otherwise JAWS does not
|
60
|
+
announce the description for a fieldset comprised of text inputs, but
|
61
|
+
adding the role to the fieldset always makes the output overly verbose for
|
62
|
+
radio buttons or checkboxes. -#}
|
63
|
+
{% call govukFieldset({
|
64
|
+
describedBy: describedBy,
|
65
|
+
classes: params.fieldset.classes,
|
66
|
+
attributes: {
|
67
|
+
role: 'group'
|
68
|
+
},
|
69
|
+
legend: params.fieldset.legend
|
70
|
+
}) %}
|
71
|
+
{{ innerHtml | trim | safe }}
|
72
|
+
{% endcall %}
|
73
|
+
{% else %}
|
74
|
+
{{ innerHtml | trim | safe }}
|
75
|
+
{% endif %}
|
76
|
+
</div>
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# Details
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
Component for conditionally revealing content, using the details HTML element.
|
6
|
+
|
7
|
+
## Guidance
|
8
|
+
|
9
|
+
Find out when to use the Details component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/details).
|
10
|
+
|
11
|
+
## Quick start examples
|
12
|
+
|
13
|
+
### Component default
|
14
|
+
|
15
|
+
[Preview the details component](http://govuk-frontend-review.herokuapp.com/components/details/preview)
|
16
|
+
|
17
|
+
#### Markup
|
18
|
+
|
19
|
+
<details class="govuk-details">
|
20
|
+
<summary class="govuk-details__summary">
|
21
|
+
<span class="govuk-details__summary-text">
|
22
|
+
Help with nationality
|
23
|
+
</span>
|
24
|
+
</summary>
|
25
|
+
<div class="govuk-details__text">
|
26
|
+
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.
|
27
|
+
</div>
|
28
|
+
</details>
|
29
|
+
|
30
|
+
#### Macro
|
31
|
+
|
32
|
+
{% from 'details/macro.njk' import govukDetails %}
|
33
|
+
|
34
|
+
{{ govukDetails({
|
35
|
+
"summaryText": "Help with nationality",
|
36
|
+
"text": "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."
|
37
|
+
}) }}
|
38
|
+
|
39
|
+
### Details--expanded
|
40
|
+
|
41
|
+
[Preview the details--expanded example](http://govuk-frontend-review.herokuapp.com/components/details/expanded/preview)
|
42
|
+
|
43
|
+
#### Markup
|
44
|
+
|
45
|
+
<details id="help-with-nationality" class="govuk-details" open>
|
46
|
+
<summary class="govuk-details__summary">
|
47
|
+
<span class="govuk-details__summary-text">
|
48
|
+
Help with nationality
|
49
|
+
</span>
|
50
|
+
</summary>
|
51
|
+
<div class="govuk-details__text">
|
52
|
+
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.
|
53
|
+
</div>
|
54
|
+
</details>
|
55
|
+
|
56
|
+
#### Macro
|
57
|
+
|
58
|
+
{% from 'details/macro.njk' import govukDetails %}
|
59
|
+
|
60
|
+
{{ govukDetails({
|
61
|
+
"id": "help-with-nationality",
|
62
|
+
"summaryText": "Help with nationality",
|
63
|
+
"text": "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.",
|
64
|
+
"open": true
|
65
|
+
}) }}
|
66
|
+
|
67
|
+
### Details--with-html
|
68
|
+
|
69
|
+
[Preview the details--with-html example](http://govuk-frontend-review.herokuapp.com/components/details/with-html/preview)
|
70
|
+
|
71
|
+
#### Markup
|
72
|
+
|
73
|
+
<details class="govuk-details">
|
74
|
+
<summary class="govuk-details__summary">
|
75
|
+
<span class="govuk-details__summary-text">
|
76
|
+
Where to find your National Insurance Number
|
77
|
+
</span>
|
78
|
+
</summary>
|
79
|
+
<div class="govuk-details__text">
|
80
|
+
Your National Insurance number can be found on
|
81
|
+
<ul>
|
82
|
+
<li>your National Insurance card</li>
|
83
|
+
<li>your payslip</li>
|
84
|
+
<li>P60</li>
|
85
|
+
<li>benefits information</li>
|
86
|
+
<li>tax return</li>
|
87
|
+
</ul>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</details>
|
91
|
+
|
92
|
+
#### Macro
|
93
|
+
|
94
|
+
{% from 'details/macro.njk' import govukDetails %}
|
95
|
+
|
96
|
+
{{ govukDetails({
|
97
|
+
"summaryText": "Where to find your National Insurance Number",
|
98
|
+
"html": "Your National Insurance number can be found on\n<ul>\n <li>your National Insurance card</li>\n <li>your payslip</li>\n <li>P60</li>\n <li>benefits information</li>\n <li>tax return</li>\n</ul>\n"
|
99
|
+
}) }}
|
100
|
+
|
101
|
+
## Requirements
|
102
|
+
|
103
|
+
### Build tool configuration
|
104
|
+
|
105
|
+
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
106
|
+
|
107
|
+
.pipe(sass({
|
108
|
+
includePaths: 'node_modules/'
|
109
|
+
}))
|
110
|
+
|
111
|
+
### Static asset path configuration
|
112
|
+
|
113
|
+
In order to include the images used in the components, you need to configure your app to show these assets. Below is a sample configuration using Express js:
|
114
|
+
|
115
|
+
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
116
|
+
|
117
|
+
## Component arguments
|
118
|
+
|
119
|
+
If you are using Nunjucks,then macros take the following arguments
|
120
|
+
|
121
|
+
**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
|
122
|
+
|
123
|
+
<table class="govuk-table">
|
124
|
+
|
125
|
+
<thead class="govuk-table__head">
|
126
|
+
|
127
|
+
<tr class="govuk-table__row">
|
128
|
+
|
129
|
+
<th class="govuk-table__header" scope="col">Name</th>
|
130
|
+
|
131
|
+
<th class="govuk-table__header" scope="col">Type</th>
|
132
|
+
|
133
|
+
<th class="govuk-table__header" scope="col">Required</th>
|
134
|
+
|
135
|
+
<th class="govuk-table__header" scope="col">Description</th>
|
136
|
+
|
137
|
+
</tr>
|
138
|
+
|
139
|
+
</thead>
|
140
|
+
|
141
|
+
<tbody class="govuk-table__body">
|
142
|
+
|
143
|
+
<tr class="govuk-table__row">
|
144
|
+
|
145
|
+
<th class="govuk-table__header" scope="row">summaryText (or) summaryHtml</th>
|
146
|
+
|
147
|
+
<td class="govuk-table__cell ">string</td>
|
148
|
+
|
149
|
+
<td class="govuk-table__cell ">Yes</td>
|
150
|
+
|
151
|
+
<td class="govuk-table__cell ">Text or HTML to use within the summary element (the visible part of the details element). If `summaryHtml` is provided, the `summaryText` argument will be ignored.</td>
|
152
|
+
|
153
|
+
</tr>
|
154
|
+
|
155
|
+
<tr class="govuk-table__row">
|
156
|
+
|
157
|
+
<th class="govuk-table__header" scope="row">text (or) html</th>
|
158
|
+
|
159
|
+
<td class="govuk-table__cell ">string</td>
|
160
|
+
|
161
|
+
<td class="govuk-table__cell ">Yes</td>
|
162
|
+
|
163
|
+
<td class="govuk-table__cell ">Text or HTML to use within the disclosed part of the details element. If `html` is provided, the `text` argument will be ignored.</td>
|
164
|
+
|
165
|
+
</tr>
|
166
|
+
|
167
|
+
<tr class="govuk-table__row">
|
168
|
+
|
169
|
+
<th class="govuk-table__header" scope="row">id</th>
|
170
|
+
|
171
|
+
<td class="govuk-table__cell ">string</td>
|
172
|
+
|
173
|
+
<td class="govuk-table__cell ">No</td>
|
174
|
+
|
175
|
+
<td class="govuk-table__cell ">Optional id to add to the details element.</td>
|
176
|
+
|
177
|
+
</tr>
|
178
|
+
|
179
|
+
<tr class="govuk-table__row">
|
180
|
+
|
181
|
+
<th class="govuk-table__header" scope="row">open</th>
|
182
|
+
|
183
|
+
<td class="govuk-table__cell ">boolean</td>
|
184
|
+
|
185
|
+
<td class="govuk-table__cell ">No</td>
|
186
|
+
|
187
|
+
<td class="govuk-table__cell ">If true, details element will be expanded.</td>
|
188
|
+
|
189
|
+
</tr>
|
190
|
+
|
191
|
+
<tr class="govuk-table__row">
|
192
|
+
|
193
|
+
<th class="govuk-table__header" scope="row">classes</th>
|
194
|
+
|
195
|
+
<td class="govuk-table__cell ">string</td>
|
196
|
+
|
197
|
+
<td class="govuk-table__cell ">No</td>
|
198
|
+
|
199
|
+
<td class="govuk-table__cell ">Optional additional classes to add to the details element.</td>
|
200
|
+
|
201
|
+
</tr>
|
202
|
+
|
203
|
+
<tr class="govuk-table__row">
|
204
|
+
|
205
|
+
<th class="govuk-table__header" scope="row">attributes</th>
|
206
|
+
|
207
|
+
<td class="govuk-table__cell ">object</td>
|
208
|
+
|
209
|
+
<td class="govuk-table__cell ">No</td>
|
210
|
+
|
211
|
+
<td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the details element.</td>
|
212
|
+
|
213
|
+
</tr>
|
214
|
+
|
215
|
+
</tbody>
|
216
|
+
|
217
|
+
</table>
|
218
|
+
|
219
|
+
**If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
|
220
|
+
|
221
|
+
### Setting up Nunjucks views and paths
|
222
|
+
|
223
|
+
Below is an example setup using express configure views:
|
224
|
+
|
225
|
+
nunjucks.configure('node_modules/govuk-frontend/components', {
|
226
|
+
autoescape: true,
|
227
|
+
cache: false,
|
228
|
+
express: app
|
229
|
+
})
|
230
|
+
|
231
|
+
## Contribution
|
232
|
+
|
233
|
+
Guidelines can be found at [on our Github repository.](https://github.com/alphagov/govuk-frontend/blob/master/CONTRIBUTING.md "link to contributing guidelines on our github repository")
|
234
|
+
|
235
|
+
## License
|
236
|
+
|
237
|
+
MIT
|
@@ -0,0 +1,86 @@
|
|
1
|
+
@import "../../settings/all";
|
2
|
+
@import "../../tools/all";
|
3
|
+
@import "../../helpers/all";
|
4
|
+
|
5
|
+
@include govuk-exports("govuk/component/details") {
|
6
|
+
|
7
|
+
.govuk-details {
|
8
|
+
@include govuk-font($size: 19);
|
9
|
+
@include govuk-text-colour;
|
10
|
+
@include govuk-responsive-margin(6, "bottom");
|
11
|
+
|
12
|
+
display: block;
|
13
|
+
}
|
14
|
+
|
15
|
+
.govuk-details__summary {
|
16
|
+
// Make the focus outline shrink-wrap the text content of the summary
|
17
|
+
display: inline-block;
|
18
|
+
|
19
|
+
// Absolutely position the marker against this element
|
20
|
+
position: relative;
|
21
|
+
|
22
|
+
margin-bottom: govuk-spacing(1);
|
23
|
+
|
24
|
+
// Allow for absolutely positioned marker and align with disclosed text
|
25
|
+
padding-left: govuk-spacing(4) + $govuk-border-width;
|
26
|
+
|
27
|
+
// Style the summary to look like a link...
|
28
|
+
color: $govuk-link-colour;
|
29
|
+
cursor: pointer;
|
30
|
+
}
|
31
|
+
|
32
|
+
// ...but only underline the text, not the arrow
|
33
|
+
.govuk-details__summary-text {
|
34
|
+
text-decoration: underline;
|
35
|
+
}
|
36
|
+
|
37
|
+
.govuk-details__summary:hover {
|
38
|
+
color: $govuk-link-hover-colour;
|
39
|
+
}
|
40
|
+
|
41
|
+
.govuk-details__summary:focus {
|
42
|
+
// -1px offset fixes gap between background and outline in Firefox
|
43
|
+
outline: ($govuk-focus-width + 1px) solid $govuk-focus-colour;
|
44
|
+
outline-offset: -1px;
|
45
|
+
background: $govuk-focus-colour;
|
46
|
+
}
|
47
|
+
|
48
|
+
// Remove the default details marker so we can style our own consistently and
|
49
|
+
// ensure it displays in Firefox (see implementation.md for details)
|
50
|
+
.govuk-details__summary::-webkit-details-marker {
|
51
|
+
display: none;
|
52
|
+
}
|
53
|
+
|
54
|
+
// Append our own open / closed marker using a pseudo-element
|
55
|
+
.govuk-details__summary:before {
|
56
|
+
content: "";
|
57
|
+
position: absolute;
|
58
|
+
|
59
|
+
top: 0;
|
60
|
+
bottom: 0;
|
61
|
+
left: 0;
|
62
|
+
|
63
|
+
margin: auto;
|
64
|
+
|
65
|
+
@include govuk-shape-arrow($direction: right, $base: 14px);
|
66
|
+
|
67
|
+
.govuk-details[open] > & {
|
68
|
+
@include govuk-shape-arrow($direction: down, $base: 14px);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
.govuk-details__text {
|
73
|
+
padding: govuk-spacing(3);
|
74
|
+
padding-left: govuk-spacing(4);
|
75
|
+
border-left: $govuk-border-width solid $govuk-border-colour;
|
76
|
+
}
|
77
|
+
|
78
|
+
.govuk-details__text p {
|
79
|
+
margin-top: 0;
|
80
|
+
margin-bottom: govuk-spacing(4);
|
81
|
+
}
|
82
|
+
|
83
|
+
.govuk-details__text p:last-child {
|
84
|
+
margin-bottom: 0;
|
85
|
+
}
|
86
|
+
}
|