@planning-inspectorate/dynamic-forms 1.12.2 → 1.14.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.
@@ -9,3 +9,8 @@ updates:
9
9
  directory: '/' # Location of package manifests
10
10
  schedule:
11
11
  interval: 'weekly'
12
+ groups:
13
+ devDeps: # group all dev dependencies
14
+ patterns:
15
+ - '*'
16
+ dependency-type: 'development'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planning-inspectorate/dynamic-forms",
3
- "version": "1.12.2",
3
+ "version": "1.14.0",
4
4
  "description": "This package is for building GDS forms using a configuration-based approach.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -28,15 +28,15 @@
28
28
  "#question-types": "./src/questions/question-types.d.ts"
29
29
  },
30
30
  "devDependencies": {
31
- "@commitlint/cli": "^19.8.1",
32
- "@commitlint/config-conventional": "^19.8.1",
31
+ "@commitlint/cli": "^20.0.0",
32
+ "@commitlint/config-conventional": "^20.0.0",
33
33
  "eslint": "^9.29.0",
34
34
  "eslint-config-prettier": "^10.1.5",
35
35
  "govuk-frontend": "^5.11.0",
36
36
  "husky": "^9.1.7",
37
37
  "lint-staged": "^16.1.2",
38
38
  "prettier": "^3.6.2",
39
- "semantic-release": "^24.2.5"
39
+ "semantic-release": "^25.0.1"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
@@ -56,6 +56,22 @@
56
56
  attributes: { "data-cy":"button-save-and-continue"}
57
57
  }) }}
58
58
 
59
+ {% if extraActionButtons|length %}
60
+ {% for extraActionButton in extraActionButtons %}
61
+ {{ govukButton({
62
+ text: extraActionButton.text,
63
+ type: extraActionButton.type,
64
+ href: extraActionButton.href,
65
+ attributes: {
66
+ "formaction": extraActionButton.formaction or "",
67
+ "data-cy": "button-" + extraActionButton.text|lower|replace(" ", "-"),
68
+ "name": extraActionButton.text|lower|replace(" ", "-")
69
+ },
70
+ classes: extraActionButton.classes or "govuk-button--secondary"
71
+ }) }}
72
+ {% endfor %}
73
+ {% endif %}
74
+
59
75
  </form>
60
76
  </div>
61
77
  </div>
@@ -63,7 +79,17 @@
63
79
  <script {% if cspNonce %}nonce={{ cspNonce }}{% endif %}>
64
80
  if (window.accessibleAutocomplete) {
65
81
  accessibleAutocomplete.enhanceSelectElement({
66
- selectElement: document.querySelector('#{{ question.fieldName }}')
82
+ selectElement: document.querySelector('#{{ question.fieldName }}'),
83
+ onConfirm: () => {
84
+ let input = document.querySelector('#{{ question.fieldName }}');
85
+ let select = document.querySelector('#{{ question.fieldName }}-select');
86
+ let options = Array.from(select.options);
87
+ if (!input.value || !options.some(option => option.value === input.value)) {
88
+ select.options.selectedIndex = -1;
89
+ } else {
90
+ select.options.selectedIndex = options.findIndex(option => option.value === input.value);
91
+ }
92
+ }
67
93
  })
68
94
  }
69
95
  </script>
@@ -15,6 +15,7 @@ export default class SelectQuestion extends OptionsQuestion {
15
15
  * @param {string} [params.html]
16
16
  * @param {string} [params.legend] - optional legend, used instead of h1
17
17
  * @param {Array.<import('../../questions/options-question.js').Option>} params.options
18
+ * @param {Object<string, any>} [params.viewData]
18
19
  * @param {Array.<import('../../questions/question.js').BaseValidator>} [params.validators]
19
20
  */
20
21
  constructor({
@@ -30,7 +31,8 @@ export default class SelectQuestion extends OptionsQuestion {
30
31
  html,
31
32
  legend,
32
33
  options,
33
- validators
34
+ validators,
35
+ viewData
34
36
  }) {
35
37
  super({
36
38
  title,
@@ -42,7 +44,8 @@ export default class SelectQuestion extends OptionsQuestion {
42
44
  pageTitle,
43
45
  description,
44
46
  options,
45
- validators
47
+ validators,
48
+ viewData
46
49
  });
47
50
 
48
51
  this.html = html;