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 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) || 'block-label',
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
- // @import "node_modules/govuk-frontend/govuk/all";
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "20.0.0-beta.12",
4
+ "version": "20.0.0-beta.15",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -1,6 +1,5 @@
1
1
 
2
2
  @import "../../../frontend/themes/gov-uk/styles/govuk";
3
- @import "../../../node_modules/govuk-frontend/govuk/all";
4
3
 
5
4
  //autocomplete styling
6
5
  .tt-menu {
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "author": "",
17
17
  "dependencies": {
18
+ "govuk-frontend": "3.14",
18
19
  "jquery": "^3.6.0",
19
20
  "sass": "^1.53.0",
20
21
  "typeahead-aria": "^1.0.4"
package/sandbox/server.js CHANGED
@@ -13,6 +13,5 @@ bootstrap({
13
13
  active: true
14
14
  }
15
15
  },
16
- getAccessibility: true,
17
- "port": 8082
16
+ getAccessibility: true
18
17
  });
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"