govuk_publishing_components 9.3.6 → 9.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/app/assets/stylesheets/component_guide/application.scss +10 -0
- data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/admin_styles.scss +13 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +66 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
- data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss +1 -0
- data/app/models/govuk_publishing_components/component_doc.rb +12 -0
- data/app/views/govuk_publishing_components/component_guide/component_doc/_preview.html.erb +7 -5
- data/app/views/govuk_publishing_components/component_guide/show.html.erb +22 -0
- data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +39 -0
- data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +26 -0
- data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +10 -0
- data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +142 -0
- data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +12 -0
- data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +28 -0
- data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -0
- data/app/views/layouts/govuk_publishing_components/application.html.erb +5 -0
- data/config/initializers/assets.rb +12 -0
- data/lib/govuk_publishing_components.rb +1 -0
- data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +13 -0
- data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- 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 +89 -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
- metadata +249 -2
@@ -0,0 +1,43 @@
|
|
1
|
+
## Implementation notes
|
2
|
+
|
3
|
+
### Marker styling
|
4
|
+
|
5
|
+
Firefox uses display: list-item to show the arrow marker for the summary
|
6
|
+
element.
|
7
|
+
|
8
|
+
Unfortunately we want to use `display: inline-block` to 'shrink-wrap' the focus
|
9
|
+
outline around the summary text, which means that the arrow no longer shows up.
|
10
|
+
|
11
|
+
Previously in GOV.UK Elements we resolved this by targeting Firefox specifically
|
12
|
+
and reverting to `display: list-item`:
|
13
|
+
|
14
|
+
```
|
15
|
+
@-moz-document regexp('.*') {
|
16
|
+
details summary:not([tabindex]) {
|
17
|
+
// Allow duplicate properties, override the summary display property
|
18
|
+
// scss-lint:disable DuplicateProperty
|
19
|
+
display: list-item;
|
20
|
+
display: revert;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
```
|
24
|
+
|
25
|
+
However, `@-moz-document` has been removed in Firefox nightly as of 29th Nov
|
26
|
+
2017 so with this in mind we have taken a different approach, hiding the
|
27
|
+
browser's marker and injecting and styling our own one across all browsers
|
28
|
+
instead.
|
29
|
+
|
30
|
+
This also gives us more control over the styling of the marker, allowing us for
|
31
|
+
example to align the summary and disclosed text correctly across all browsers.
|
32
|
+
|
33
|
+
The downside of this approach is that older browsers that require a polyfill for
|
34
|
+
the details element will display the marker even when Javascript is disabled.
|
35
|
+
Whilst this is not perfect, it is a cosmetic issue and the user will still be
|
36
|
+
able to access the disclosed content.
|
37
|
+
|
38
|
+
For the arrows themselves, we originally tried using unicode glyphs –
|
39
|
+
specifically \25B6 (Black right-pointing triangle) and 25BC (Black down-pointing
|
40
|
+
triangle) but Android insists on substituting the the former for an emoji even
|
41
|
+
when the \00FE0E modifier is applied. Sad face.
|
42
|
+
|
43
|
+
Hence the border-based triangles we are using today.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<details {%- if params.id %} id="{{params.id}}"{% endif %} class="govuk-details {%- if params.classes %} {{ params.classes }}{% endif %}" {%- for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %} {{- " open" if params.open }}>
|
2
|
+
<summary class="govuk-details__summary">
|
3
|
+
<span class="govuk-details__summary-text">
|
4
|
+
{{ params.summaryHtml | safe if params.summaryHtml else params.summaryText }}
|
5
|
+
</span>
|
6
|
+
</summary>
|
7
|
+
<div class="govuk-details__text">
|
8
|
+
{{ params.html | safe if params.html else params.text }}
|
9
|
+
</div>
|
10
|
+
</details>
|
@@ -0,0 +1,143 @@
|
|
1
|
+
# Error message
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
Component to show a red error message - used for form validation. Use inside a label or legend.
|
6
|
+
|
7
|
+
## Guidance
|
8
|
+
|
9
|
+
Find out when to use the Error message component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/error-message).
|
10
|
+
|
11
|
+
## Quick start examples
|
12
|
+
|
13
|
+
### Component default
|
14
|
+
|
15
|
+
[Preview the error-message component](http://govuk-frontend-review.herokuapp.com/components/error-message/preview)
|
16
|
+
|
17
|
+
#### Markup
|
18
|
+
|
19
|
+
<span class="govuk-error-message">
|
20
|
+
Error message about full name goes here
|
21
|
+
</span>
|
22
|
+
|
23
|
+
#### Macro
|
24
|
+
|
25
|
+
{% from 'error-message/macro.njk' import govukErrorMessage %}
|
26
|
+
|
27
|
+
{{ govukErrorMessage({
|
28
|
+
"text": "Error message about full name goes here"
|
29
|
+
}) }}
|
30
|
+
|
31
|
+
## Requirements
|
32
|
+
|
33
|
+
### Build tool configuration
|
34
|
+
|
35
|
+
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
36
|
+
|
37
|
+
.pipe(sass({
|
38
|
+
includePaths: 'node_modules/'
|
39
|
+
}))
|
40
|
+
|
41
|
+
### Static asset path configuration
|
42
|
+
|
43
|
+
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:
|
44
|
+
|
45
|
+
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
46
|
+
|
47
|
+
## Component arguments
|
48
|
+
|
49
|
+
If you are using Nunjucks,then macros take the following arguments
|
50
|
+
|
51
|
+
**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).**
|
52
|
+
|
53
|
+
<table class="govuk-table">
|
54
|
+
|
55
|
+
<thead class="govuk-table__head">
|
56
|
+
|
57
|
+
<tr class="govuk-table__row">
|
58
|
+
|
59
|
+
<th class="govuk-table__header" scope="col">Name</th>
|
60
|
+
|
61
|
+
<th class="govuk-table__header" scope="col">Type</th>
|
62
|
+
|
63
|
+
<th class="govuk-table__header" scope="col">Required</th>
|
64
|
+
|
65
|
+
<th class="govuk-table__header" scope="col">Description</th>
|
66
|
+
|
67
|
+
</tr>
|
68
|
+
|
69
|
+
</thead>
|
70
|
+
|
71
|
+
<tbody class="govuk-table__body">
|
72
|
+
|
73
|
+
<tr class="govuk-table__row">
|
74
|
+
|
75
|
+
<th class="govuk-table__header" scope="row">text (or) html</th>
|
76
|
+
|
77
|
+
<td class="govuk-table__cell ">string</td>
|
78
|
+
|
79
|
+
<td class="govuk-table__cell ">No</td>
|
80
|
+
|
81
|
+
<td class="govuk-table__cell ">Text to use within the error message. If `html` is provided, the `text` argument will be ignored.</td>
|
82
|
+
|
83
|
+
</tr>
|
84
|
+
|
85
|
+
<tr class="govuk-table__row">
|
86
|
+
|
87
|
+
<th class="govuk-table__header" scope="row">id</th>
|
88
|
+
|
89
|
+
<td class="govuk-table__cell ">string</td>
|
90
|
+
|
91
|
+
<td class="govuk-table__cell ">No</td>
|
92
|
+
|
93
|
+
<td class="govuk-table__cell ">Optional id attribute to add to the error message span tag.</td>
|
94
|
+
|
95
|
+
</tr>
|
96
|
+
|
97
|
+
<tr class="govuk-table__row">
|
98
|
+
|
99
|
+
<th class="govuk-table__header" scope="row">classes</th>
|
100
|
+
|
101
|
+
<td class="govuk-table__cell ">string</td>
|
102
|
+
|
103
|
+
<td class="govuk-table__cell ">No</td>
|
104
|
+
|
105
|
+
<td class="govuk-table__cell ">Optional additional classes to add to the error message span tag.</td>
|
106
|
+
|
107
|
+
</tr>
|
108
|
+
|
109
|
+
<tr class="govuk-table__row">
|
110
|
+
|
111
|
+
<th class="govuk-table__header" scope="row">attributes</th>
|
112
|
+
|
113
|
+
<td class="govuk-table__cell ">object</td>
|
114
|
+
|
115
|
+
<td class="govuk-table__cell ">No</td>
|
116
|
+
|
117
|
+
<td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the error message span tag</td>
|
118
|
+
|
119
|
+
</tr>
|
120
|
+
|
121
|
+
</tbody>
|
122
|
+
|
123
|
+
</table>
|
124
|
+
|
125
|
+
**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).**
|
126
|
+
|
127
|
+
### Setting up Nunjucks views and paths
|
128
|
+
|
129
|
+
Below is an example setup using express configure views:
|
130
|
+
|
131
|
+
nunjucks.configure('node_modules/govuk-frontend/components', {
|
132
|
+
autoescape: true,
|
133
|
+
cache: false,
|
134
|
+
express: app
|
135
|
+
})
|
136
|
+
|
137
|
+
## Contribution
|
138
|
+
|
139
|
+
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")
|
140
|
+
|
141
|
+
## License
|
142
|
+
|
143
|
+
MIT
|
@@ -0,0 +1,15 @@
|
|
1
|
+
@import "../../settings/all";
|
2
|
+
@import "../../tools/all";
|
3
|
+
@import "../../helpers/all";
|
4
|
+
|
5
|
+
@include govuk-exports("govuk/component/error-message") {
|
6
|
+
.govuk-error-message {
|
7
|
+
@include govuk-font($size: 19, $weight: bold);
|
8
|
+
|
9
|
+
display: block;
|
10
|
+
margin-bottom: govuk-spacing(3);
|
11
|
+
clear: both;
|
12
|
+
|
13
|
+
color: $govuk-error-colour;
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
<span {%- if params.id %} id="{{ params.id }}"{% endif %} class="govuk-error-message{%- if params.classes %} {{ params.classes }}{% endif %}" {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>
|
2
|
+
{{ params.html | safe if params.html else params.text }}
|
3
|
+
</span>
|
@@ -0,0 +1,215 @@
|
|
1
|
+
# Error summary
|
2
|
+
|
3
|
+
## Introduction
|
4
|
+
|
5
|
+
Component to show an error summary box - used at the top of the page, to summarise validation errors.
|
6
|
+
|
7
|
+
## Guidance
|
8
|
+
|
9
|
+
Find out when to use the Error summary component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/error-summary).
|
10
|
+
|
11
|
+
## Quick start examples
|
12
|
+
|
13
|
+
### Component default
|
14
|
+
|
15
|
+
[Preview the error-summary component](http://govuk-frontend-review.herokuapp.com/components/error-summary/preview)
|
16
|
+
|
17
|
+
#### Markup
|
18
|
+
|
19
|
+
<div class="govuk-error-summary optional-extra-class" aria-labelledby="error-summary-title" role="alert" tabindex="-1" data-module="error-summary">
|
20
|
+
<h2 class="govuk-error-summary__title" id="error-summary-title">
|
21
|
+
Message to alert the user to a problem goes here
|
22
|
+
</h2>
|
23
|
+
<div class="govuk-error-summary__body">
|
24
|
+
|
25
|
+
<p>
|
26
|
+
Optional description of the errors and how to correct them
|
27
|
+
</p>
|
28
|
+
|
29
|
+
<ul class="govuk-list govuk-error-summary__list">
|
30
|
+
|
31
|
+
<li>
|
32
|
+
|
33
|
+
<a href="#example-error-1">Descriptive link to the question with an error</a>
|
34
|
+
|
35
|
+
</li>
|
36
|
+
|
37
|
+
<li>
|
38
|
+
|
39
|
+
<a href="#example-error-1">Descriptive link to the question with an error</a>
|
40
|
+
|
41
|
+
</li>
|
42
|
+
|
43
|
+
</ul>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
#### Macro
|
48
|
+
|
49
|
+
{% from 'error-summary/macro.njk' import govukErrorSummary %}
|
50
|
+
|
51
|
+
{{ govukErrorSummary({
|
52
|
+
"titleText": "Message to alert the user to a problem goes here",
|
53
|
+
"descriptionText": "Optional description of the errors and how to correct them",
|
54
|
+
"classes": "optional-extra-class",
|
55
|
+
"errorList": [
|
56
|
+
{
|
57
|
+
"text": "Descriptive link to the question with an error",
|
58
|
+
"href": "#example-error-1"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"html": "Descriptive link to the question with an error",
|
62
|
+
"href": "#example-error-1"
|
63
|
+
}
|
64
|
+
]
|
65
|
+
}) }}
|
66
|
+
|
67
|
+
## Requirements
|
68
|
+
|
69
|
+
### Build tool configuration
|
70
|
+
|
71
|
+
When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
|
72
|
+
|
73
|
+
.pipe(sass({
|
74
|
+
includePaths: 'node_modules/'
|
75
|
+
}))
|
76
|
+
|
77
|
+
### Static asset path configuration
|
78
|
+
|
79
|
+
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:
|
80
|
+
|
81
|
+
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
|
82
|
+
|
83
|
+
## Component arguments
|
84
|
+
|
85
|
+
If you are using Nunjucks,then macros take the following arguments
|
86
|
+
|
87
|
+
**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).**
|
88
|
+
|
89
|
+
<table class="govuk-table">
|
90
|
+
|
91
|
+
<thead class="govuk-table__head">
|
92
|
+
|
93
|
+
<tr class="govuk-table__row">
|
94
|
+
|
95
|
+
<th class="govuk-table__header" scope="col">Name</th>
|
96
|
+
|
97
|
+
<th class="govuk-table__header" scope="col">Type</th>
|
98
|
+
|
99
|
+
<th class="govuk-table__header" scope="col">Required</th>
|
100
|
+
|
101
|
+
<th class="govuk-table__header" scope="col">Description</th>
|
102
|
+
|
103
|
+
</tr>
|
104
|
+
|
105
|
+
</thead>
|
106
|
+
|
107
|
+
<tbody class="govuk-table__body">
|
108
|
+
|
109
|
+
<tr class="govuk-table__row">
|
110
|
+
|
111
|
+
<th class="govuk-table__header" scope="row">titleText (or) titleHtml</th>
|
112
|
+
|
113
|
+
<td class="govuk-table__cell ">string</td>
|
114
|
+
|
115
|
+
<td class="govuk-table__cell ">Yes</td>
|
116
|
+
|
117
|
+
<td class="govuk-table__cell ">Text or HTML to use for the heading of the error summary block. If `titleHtml` is provided, the `titleText` argument will be ignored.</td>
|
118
|
+
|
119
|
+
</tr>
|
120
|
+
|
121
|
+
<tr class="govuk-table__row">
|
122
|
+
|
123
|
+
<th class="govuk-table__header" scope="row">descriptionText (or) descriptionHtml</th>
|
124
|
+
|
125
|
+
<td class="govuk-table__cell ">string</td>
|
126
|
+
|
127
|
+
<td class="govuk-table__cell ">No</td>
|
128
|
+
|
129
|
+
<td class="govuk-table__cell ">Optional text or HTML description of the errors. If `descriptionhtml` is provided, the `descriptionText` argument will be ignored.</td>
|
130
|
+
|
131
|
+
</tr>
|
132
|
+
|
133
|
+
<tr class="govuk-table__row">
|
134
|
+
|
135
|
+
<th class="govuk-table__header" scope="row">errorList</th>
|
136
|
+
|
137
|
+
<td class="govuk-table__cell ">object</td>
|
138
|
+
|
139
|
+
<td class="govuk-table__cell ">Yes</td>
|
140
|
+
|
141
|
+
<td class="govuk-table__cell ">Contains an array of error link items and all their available arguments.</td>
|
142
|
+
|
143
|
+
</tr>
|
144
|
+
|
145
|
+
<tr class="govuk-table__row">
|
146
|
+
|
147
|
+
<th class="govuk-table__header" scope="row">errorList.{}.href</th>
|
148
|
+
|
149
|
+
<td class="govuk-table__cell ">string</td>
|
150
|
+
|
151
|
+
<td class="govuk-table__cell ">No</td>
|
152
|
+
|
153
|
+
<td class="govuk-table__cell ">Href attribute for the error link item. If provided item will be an anchor.</td>
|
154
|
+
|
155
|
+
</tr>
|
156
|
+
|
157
|
+
<tr class="govuk-table__row">
|
158
|
+
|
159
|
+
<th class="govuk-table__header" scope="row">errorList.{}.text (or) errorList.{}.html</th>
|
160
|
+
|
161
|
+
<td class="govuk-table__cell ">string</td>
|
162
|
+
|
163
|
+
<td class="govuk-table__cell ">Yes</td>
|
164
|
+
|
165
|
+
<td class="govuk-table__cell ">Text or HTML for the error link item. If `html` is provided, the `text` argument will be ignored.</td>
|
166
|
+
|
167
|
+
</tr>
|
168
|
+
|
169
|
+
<tr class="govuk-table__row">
|
170
|
+
|
171
|
+
<th class="govuk-table__header" scope="row">classes</th>
|
172
|
+
|
173
|
+
<td class="govuk-table__cell ">string</td>
|
174
|
+
|
175
|
+
<td class="govuk-table__cell ">No</td>
|
176
|
+
|
177
|
+
<td class="govuk-table__cell ">Optional additional classes to add to the error-summary container.</td>
|
178
|
+
|
179
|
+
</tr>
|
180
|
+
|
181
|
+
<tr class="govuk-table__row">
|
182
|
+
|
183
|
+
<th class="govuk-table__header" scope="row">attributes</th>
|
184
|
+
|
185
|
+
<td class="govuk-table__cell ">object</td>
|
186
|
+
|
187
|
+
<td class="govuk-table__cell ">No</td>
|
188
|
+
|
189
|
+
<td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the error-summary container.</td>
|
190
|
+
|
191
|
+
</tr>
|
192
|
+
|
193
|
+
</tbody>
|
194
|
+
|
195
|
+
</table>
|
196
|
+
|
197
|
+
**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).**
|
198
|
+
|
199
|
+
### Setting up Nunjucks views and paths
|
200
|
+
|
201
|
+
Below is an example setup using express configure views:
|
202
|
+
|
203
|
+
nunjucks.configure('node_modules/govuk-frontend/components', {
|
204
|
+
autoescape: true,
|
205
|
+
cache: false,
|
206
|
+
express: app
|
207
|
+
})
|
208
|
+
|
209
|
+
## Contribution
|
210
|
+
|
211
|
+
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")
|
212
|
+
|
213
|
+
## License
|
214
|
+
|
215
|
+
MIT
|