@planning-inspectorate/dynamic-forms 3.10.17 → 3.11.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.
- package/govuk-prototype-kit.config.json +6 -0
- package/package.json +2 -2
- package/src/questions/create-questions.js +3 -3
- package/src/questions/question-props.d.ts +7 -0
- package/types/eslint.config.d.ts +2 -0
- package/types/src/questions/create-questions.d.ts +6 -8
- package/types/src/questions/create-questions.d.ts.map +1 -1
- package/types/src/questions/question-props.d.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planning-inspectorate/dynamic-forms",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@eslint/js": "^10.0.1",
|
|
46
46
|
"@types/express": "^5.0.6",
|
|
47
47
|
"body-parser": "^2.2.0",
|
|
48
|
-
"conventional-changelog-conventionalcommits": "^
|
|
48
|
+
"conventional-changelog-conventionalcommits": "^10.2.0",
|
|
49
49
|
"cookie-parser": "^1.4.7",
|
|
50
50
|
"eslint": "^10.0.0",
|
|
51
51
|
"eslint-config-prettier": "^10.1.5",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/** @typedef {import('./question-props').QuestionProps} QuestionProps */
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
|
-
* @
|
|
2
|
+
* @template {import('./question-props.js').BaseQuestionProps} T
|
|
3
|
+
* @param {{[questionName: string]: T}} questionPropsRecord
|
|
5
4
|
* @param {Record<string, import('./question-types.js').QuestionClass>} questionClasses
|
|
6
5
|
* @param {{[questionType: string]: Record<string, Function>}} questionMethodOverrides
|
|
7
6
|
* @param {{notStartedText?: string, continueButtonText?: string, changeActionText?: string, answerActionText?: string}} [textOverrides] - customise question text
|
|
7
|
+
* @returns {Record<string, InstanceType<import('./question-types.js').QuestionClass>>}
|
|
8
8
|
*/
|
|
9
9
|
export function createQuestions(questionPropsRecord, questionClasses, questionMethodOverrides, textOverrides) {
|
|
10
10
|
return Object.fromEntries(
|
|
@@ -22,6 +22,13 @@ type CommonQuestionProps = Omit<QuestionParameters, 'viewFolder'> & {
|
|
|
22
22
|
type: QuestionTypes;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Generic question props type so that custom components can be used without having to define a new type for each one.
|
|
27
|
+
*/
|
|
28
|
+
export type BaseQuestionProps = Omit<CommonQuestionProps, 'type'> & {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
25
32
|
type Option =
|
|
26
33
|
| {
|
|
27
34
|
text: string;
|
package/types/eslint.config.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ declare const _default: ({
|
|
|
57
57
|
PerformanceResourceTiming: false;
|
|
58
58
|
process: false;
|
|
59
59
|
queueMicrotask: false;
|
|
60
|
+
QuotaExceededError: false;
|
|
60
61
|
ReadableByteStreamController: false;
|
|
61
62
|
ReadableStream: false;
|
|
62
63
|
ReadableStreamBYOBReader: false;
|
|
@@ -74,6 +75,7 @@ declare const _default: ({
|
|
|
74
75
|
structuredClone: false;
|
|
75
76
|
SubtleCrypto: false;
|
|
76
77
|
SuppressedError: false;
|
|
78
|
+
Temporal: false;
|
|
77
79
|
TextDecoder: false;
|
|
78
80
|
TextDecoderStream: false;
|
|
79
81
|
TextEncoder: false;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
/** @typedef {import('./question-props').QuestionProps} QuestionProps */
|
|
2
1
|
/**
|
|
3
|
-
* @
|
|
2
|
+
* @template {import('./question-props.js').BaseQuestionProps} T
|
|
3
|
+
* @param {{[questionName: string]: T}} questionPropsRecord
|
|
4
4
|
* @param {Record<string, import('./question-types.js').QuestionClass>} questionClasses
|
|
5
5
|
* @param {{[questionType: string]: Record<string, Function>}} questionMethodOverrides
|
|
6
6
|
* @param {{notStartedText?: string, continueButtonText?: string, changeActionText?: string, answerActionText?: string}} [textOverrides] - customise question text
|
|
7
|
+
* @returns {Record<string, InstanceType<import('./question-types.js').QuestionClass>>}
|
|
7
8
|
*/
|
|
8
|
-
export function createQuestions(questionPropsRecord: {
|
|
9
|
-
[questionName: string]:
|
|
9
|
+
export function createQuestions<T extends import("./question-props.js").BaseQuestionProps>(questionPropsRecord: {
|
|
10
|
+
[questionName: string]: T;
|
|
10
11
|
}, questionClasses: Record<string, import("./question-types.js").QuestionClass>, questionMethodOverrides: {
|
|
11
12
|
[questionType: string]: Record<string, Function>;
|
|
12
13
|
}, textOverrides?: {
|
|
@@ -14,8 +15,5 @@ export function createQuestions(questionPropsRecord: {
|
|
|
14
15
|
continueButtonText?: string;
|
|
15
16
|
changeActionText?: string;
|
|
16
17
|
answerActionText?: string;
|
|
17
|
-
}):
|
|
18
|
-
[k: string]: Question;
|
|
19
|
-
};
|
|
20
|
-
export type QuestionProps = any;
|
|
18
|
+
}): Record<string, InstanceType<import("./question-types.js").QuestionClass>>;
|
|
21
19
|
//# sourceMappingURL=create-questions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-questions.d.ts","sourceRoot":"","sources":["../../../src/questions/create-questions.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"create-questions.d.ts","sourceRoot":"","sources":["../../../src/questions/create-questions.js"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,gCAP+D,CAAC,SAAnD,OAAQ,qBAAqB,EAAE,iBAAkB,uBACnD;IAAC,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,CAAA;CAAC,mBAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,qBAAqB,EAAE,aAAa,CAAC,2BAC3D;IAAC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,WAAW,CAAA;CAAC,kBAClD;IAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAC,GAC1G,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,OAAO,qBAAqB,EAAE,aAAa,CAAC,CAAC,CAwBrF"}
|
|
@@ -22,6 +22,13 @@ type CommonQuestionProps = Omit<QuestionParameters, 'viewFolder'> & {
|
|
|
22
22
|
type: QuestionTypes;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Generic question props type so that custom components can be used without having to define a new type for each one.
|
|
27
|
+
*/
|
|
28
|
+
export type BaseQuestionProps = Omit<CommonQuestionProps, 'type'> & {
|
|
29
|
+
type: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
25
32
|
type Option =
|
|
26
33
|
| {
|
|
27
34
|
text: string;
|