hof 20.0.0-beta.12 → 20.0.0-beta.15
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -0
- package/frontend/template-mixins/mixins/template-mixins.js +4 -1
- package/frontend/template-mixins/partials/forms/checkbox-group.html +9 -0
- package/frontend/template-mixins/partials/forms/option-group.html +9 -0
- package/frontend/themes/gov-uk/styles/govuk.scss +1 -2
- package/package.json +1 -1
- package/sandbox/assets/scss/app.scss +0 -1
- package/sandbox/package.json +1 -0
- package/sandbox/server.js +1 -2
- package/sandbox/yarn.lock +5 -0
- package/.nyc_output/e2fdc3eb-4fd2-47e0-a392-fe5f665776a4.json +0 -1
- package/.nyc_output/processinfo/e2fdc3eb-4fd2-47e0-a392-fe5f665776a4.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.vscode/settings.json +0 -6
- package/frontend/govuk-template/govuk_template_generated.html +0 -104
- package/sandbox/.env +0 -1
- package/sandbox/apps/sandbox/translations/en/default.json +0 -203
- package/sandbox/public/css/app.css +0 -9389
- package/sandbox/public/images/icons/icon-caret-left.png +0 -0
- package/sandbox/public/images/icons/icon-complete.png +0 -0
- package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
- package/sandbox/public/js/bundle.js +0 -35658
package/README.md
CHANGED
@@ -1471,6 +1471,8 @@ To render a specific fields in your templates use the mixin name (matching those
|
|
1471
1471
|
- `toggle`: Can be used to toggle the display of the HTML element with a matching `id`. See [hof-frontend-toolkit](https://github.com/UKHomeOfficeForms/hof-frontend-toolkit/blob/master/assets/javascript/progressive-reveal.js) for details.
|
1472
1472
|
- `attributes`: A hash of key/value pairs applicable to a HTML `textarea` field. Each key/value is assigned as an attribute of the `textarea`. For example `spellcheck="true"`.
|
1473
1473
|
- `child`: Render a child partial beneath each option in an `optionGroup`. Accepts a custom mustache template string, a custom partial in the format `partials/{your-partial-name}`, `'html'` which is used to specify the html for the field has already been prerendered, such as in [hof-component-date](https://github.com/UKHomeOfficeForms/hof-component-date) or a template mixin key which will be rendered within a panel element partial.
|
1474
|
+
- `isPageHeading`: Applicable to `checkbox` and `radio` controls. Sets the legend as the page heading on single page questions.
|
1475
|
+
- `isWarning`: Applicable to `checkbox` and `radio` controls. Allows warning text to be placed after page headings on single page questions if required.
|
1474
1476
|
|
1475
1477
|
|
1476
1478
|
# HOF-template-partials
|
@@ -224,6 +224,7 @@ module.exports = function (options) {
|
|
224
224
|
const field = Object.assign({}, this.options.fields[key] || options.fields[key]);
|
225
225
|
const legend = field.legend;
|
226
226
|
const detail = field.detail;
|
227
|
+
const warningValue = 'fields.' + key + '.warning';
|
227
228
|
let legendClassName;
|
228
229
|
let legendValue = 'fields.' + key + '.legend';
|
229
230
|
if (legend) {
|
@@ -241,6 +242,8 @@ module.exports = function (options) {
|
|
241
242
|
legendClassName: legendClassName,
|
242
243
|
role: opts.type === 'radio' ? 'radiogroup' : 'group',
|
243
244
|
isPageHeading: field.isPageHeading,
|
245
|
+
isWarning: field.isWarning,
|
246
|
+
warning: t(warningValue),
|
244
247
|
detail: detail ? detail : '',
|
245
248
|
hint: conditionalTranslate(getTranslationKey(field, key, 'hint')),
|
246
249
|
options: _.map(field.options, function (obj) {
|
@@ -303,7 +306,7 @@ module.exports = function (options) {
|
|
303
306
|
invalid: this.errors && this.errors[key] && opts.required,
|
304
307
|
label: t(fieldLabel || 'fields.' + key + '.label'),
|
305
308
|
selected: selected,
|
306
|
-
className: classNames(field) || '
|
309
|
+
className: classNames(field) || 'govuk-label govuk-checkboxes__label',
|
307
310
|
child: field.child,
|
308
311
|
renderChild: renderChild.bind(this)
|
309
312
|
});
|
@@ -5,6 +5,15 @@
|
|
5
5
|
{{legend}}
|
6
6
|
{{#isPageHeading}}</h1>{{/isPageHeading}}
|
7
7
|
</legend>
|
8
|
+
{{#isWarning}}
|
9
|
+
<div class="govuk-warning-text">
|
10
|
+
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
|
11
|
+
<strong class="govuk-warning-text__text">
|
12
|
+
<span class="govuk-warning-text__assistive">Warning</span>
|
13
|
+
{{warning}}
|
14
|
+
</strong>
|
15
|
+
</div>
|
16
|
+
{{/isWarning}}
|
8
17
|
{{#hint}}<div id="{{key}}-hint" class="govuk-hint">{{hint}}</div>{{/hint}}
|
9
18
|
{{#error}}
|
10
19
|
<p id="{{key}}-error" class="govuk-error-message">
|
@@ -5,6 +5,15 @@
|
|
5
5
|
{{legend}}
|
6
6
|
{{#isPageHeading}}</h1>{{/isPageHeading}}
|
7
7
|
</legend>
|
8
|
+
{{#isWarning}}
|
9
|
+
<div class="govuk-warning-text">
|
10
|
+
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
|
11
|
+
<strong class="govuk-warning-text__text">
|
12
|
+
<span class="govuk-warning-text__assistive">Warning</span>
|
13
|
+
{{warning}}
|
14
|
+
</strong>
|
15
|
+
</div>
|
16
|
+
{{/isWarning}}
|
8
17
|
{{#hint}}<div id="{{key}}-hint" class="govuk-hint">{{hint}}</div>{{/hint}}
|
9
18
|
{{#error}}<p id="{{key}}-error" class="govuk-error-message"><span class="govuk-visually-hidden">Error:</span> {{error.message}}</p>{{/error}}
|
10
19
|
{{{detail}}}
|
@@ -14,8 +14,7 @@ $path: "/public/images/" !default;
|
|
14
14
|
|
15
15
|
// Govuk frontend
|
16
16
|
// https://github.com/alphagov/govuk-frontend-docs
|
17
|
-
|
18
|
-
@import "../../../../node_modules/govuk-frontend/govuk/all";
|
17
|
+
@import "node_modules/govuk-frontend/govuk/all";
|
19
18
|
|
20
19
|
// Custom
|
21
20
|
@import "base";
|
package/package.json
CHANGED
package/sandbox/package.json
CHANGED
package/sandbox/server.js
CHANGED
package/sandbox/yarn.lock
CHANGED
@@ -287,6 +287,11 @@ got@^9.6.0:
|
|
287
287
|
to-readable-stream "^1.0.0"
|
288
288
|
url-parse-lax "^3.0.0"
|
289
289
|
|
290
|
+
govuk-frontend@3.14:
|
291
|
+
version "3.14.0"
|
292
|
+
resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-3.14.0.tgz#d3a9c54437c08f5188f87b1f4480ba60e95c8eb6"
|
293
|
+
integrity sha512-y7FTuihCSA8Hty+e9h0uPhCoNanCAN+CLioNFlPmlbeHXpbi09VMyxTcH+XfnMPY4Cp++7096v0rLwwdapTXnA==
|
294
|
+
|
290
295
|
graceful-fs@^4.1.2:
|
291
296
|
version "4.2.10"
|
292
297
|
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c"
|