@planning-inspectorate/dynamic-forms 3.15.0 → 3.15.2

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.
Files changed (51) hide show
  1. package/package.json +1 -1
  2. package/src/components/address/question.js +1 -1
  3. package/src/components/boolean/question.js +1 -14
  4. package/src/components/checkbox/question.js +1 -10
  5. package/src/components/date/question.js +3 -4
  6. package/src/components/date-period/question.js +12 -10
  7. package/src/components/date-time/question.js +3 -5
  8. package/src/components/email/question.js +1 -5
  9. package/src/components/manage-list/question.js +1 -1
  10. package/src/components/multi-field-input/question.js +3 -3
  11. package/src/components/number-entry/question.js +3 -5
  12. package/src/components/radio/question.js +1 -17
  13. package/src/components/select/question.js +1 -16
  14. package/src/components/single-line-input/question.js +1 -4
  15. package/src/components/text-entry/question.js +3 -5
  16. package/src/components/text-entry-redact/question.js +3 -10
  17. package/src/components/unit-option-entry/question.js +3 -6
  18. package/src/questions/question-props.d.ts +132 -28
  19. package/types/src/components/address/question.d.ts +2 -2
  20. package/types/src/components/address/question.d.ts.map +1 -1
  21. package/types/src/components/boolean/question.d.ts +3 -30
  22. package/types/src/components/boolean/question.d.ts.map +1 -1
  23. package/types/src/components/checkbox/question.d.ts +2 -21
  24. package/types/src/components/checkbox/question.d.ts.map +1 -1
  25. package/types/src/components/date/question.d.ts +3 -4
  26. package/types/src/components/date/question.d.ts.map +1 -1
  27. package/types/src/components/date-period/question.d.ts +11 -15
  28. package/types/src/components/date-period/question.d.ts.map +1 -1
  29. package/types/src/components/date-time/question.d.ts +4 -6
  30. package/types/src/components/date-time/question.d.ts.map +1 -1
  31. package/types/src/components/email/question.d.ts +4 -0
  32. package/types/src/components/email/question.d.ts.map +1 -1
  33. package/types/src/components/manage-list/question.d.ts +2 -2
  34. package/types/src/components/manage-list/question.d.ts.map +1 -1
  35. package/types/src/components/multi-field-input/question.d.ts +6 -5
  36. package/types/src/components/multi-field-input/question.d.ts.map +1 -1
  37. package/types/src/components/number-entry/question.d.ts +4 -6
  38. package/types/src/components/number-entry/question.d.ts.map +1 -1
  39. package/types/src/components/radio/question.d.ts +2 -37
  40. package/types/src/components/radio/question.d.ts.map +1 -1
  41. package/types/src/components/select/question.d.ts +2 -35
  42. package/types/src/components/select/question.d.ts.map +1 -1
  43. package/types/src/components/single-line-input/question.d.ts +4 -7
  44. package/types/src/components/single-line-input/question.d.ts.map +1 -1
  45. package/types/src/components/text-entry/question.d.ts +4 -6
  46. package/types/src/components/text-entry/question.d.ts.map +1 -1
  47. package/types/src/components/text-entry-redact/question.d.ts +9 -16
  48. package/types/src/components/text-entry-redact/question.d.ts.map +1 -1
  49. package/types/src/components/unit-option-entry/question.d.ts +7 -2
  50. package/types/src/components/unit-option-entry/question.d.ts.map +1 -1
  51. package/types/src/questions/question-props.d.ts +132 -28
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planning-inspectorate/dynamic-forms",
3
- "version": "3.15.0",
3
+ "version": "3.15.2",
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",
@@ -7,7 +7,7 @@ import AddressValidator from '../../validator/address-validator.js';
7
7
 
8
8
  export class AddressQuestion extends Question {
9
9
  /**
10
- * @param {import('#question-types').QuestionParameters} params
10
+ * @param {import('../../questions/question-props.d.ts').SiteAddressQuestionParams} params
11
11
  */
12
12
  constructor(params) {
13
13
  super({
@@ -33,20 +33,7 @@ export const booleanToYesNoOrNull = (value) => {
33
33
 
34
34
  export class BooleanQuestion extends RadioQuestion {
35
35
  /**
36
- * @param {Object} params
37
- * @param {string} params.title
38
- * @param {string} params.question
39
- * @param {string} params.fieldName
40
- * @param {string} [params.url]
41
- * @param {string} [params.hint]
42
- * @param {string} [params.pageTitle]
43
- * @param {string} [params.description]
44
- * @param {string} [params.html]
45
- * @param {string} [params.interfaceType]
46
- * @param {Array.<import('../../questions/options-question.js').Option>} [params.options]
47
- * @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
48
- * @param {boolean} [params.editable]
49
- * @param {import('#question-types').QuestionParameters['viewData']} [params.viewData]
36
+ * @param {import('../../questions/question-props.d.ts').BooleanQuestionParams} params
50
37
  */
51
38
  constructor({
52
39
  title,
@@ -12,16 +12,7 @@ const defaultOptionJoinString = ',';
12
12
 
13
13
  export class CheckboxQuestion extends OptionsQuestion {
14
14
  /**
15
- * @param {Object} params
16
- * @param {string} params.title
17
- * @param {string} params.question
18
- * @param {string} params.fieldName
19
- * @param {string} [params.url]
20
- * @param {string} [params.pageTitle]
21
- * @param {string} [params.description]
22
- * @param {Array.<import('../../questions/options-question.js').Option>} params.options
23
- * @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
24
- * @param {import('#question-types').QuestionParameters['viewData']} [params.viewData]
15
+ * @param {import('../../questions/question-props.d.ts').CheckboxQuestionParams} params
25
16
  */
26
17
  constructor({ title, question, fieldName, url, pageTitle, description, options, validators, viewData }) {
27
18
  super({
@@ -8,12 +8,11 @@ const DEFAULT_DATE_FORMAT = 'd MMMM yyyy';
8
8
  */
9
9
  export class DateQuestion extends Question {
10
10
  /**
11
- * @param {import('#question-types').QuestionParameters} params
12
- * @param {string} [params.dateFormat]
11
+ * @param {import('../../questions/question-props.d.ts').DateQuestionParams} params
13
12
  */
14
- constructor({ dateFormat = DEFAULT_DATE_FORMAT, ...params }) {
13
+ constructor({ dateFormat = DEFAULT_DATE_FORMAT, ...parentParams }) {
15
14
  super({
16
- ...params,
15
+ ...parentParams,
17
16
  viewFolder: 'date'
18
17
  });
19
18
  this.dateFormat = dateFormat;
@@ -11,18 +11,20 @@ const DEFAULT_DATE_FORMAT = 'HH:mm d MMMM yyyy';
11
11
  */
12
12
  export class DatePeriodQuestion extends Question {
13
13
  /**
14
- * @param {import('#question-types').QuestionParameters} params
15
- * @param {string} [params.dateFormat]
16
- * @param {{start: string, end: string}} [params.labels]
17
- * @param {string} [params.hint]
18
- * @param {string} [params.hintStart]
19
- * @param {string} [params.hintEnd]
20
- * @param {{hour: number, minute: number, second: number}} [params.startTime]
21
- * @param {{hour: number, minute: number, second: number}} [params.endTime]
14
+ * @param {import('../../questions/question-props.d.ts').DatePeriodQuestionParams} params
22
15
  */
23
- constructor({ dateFormat = DEFAULT_DATE_FORMAT, hint, labels, hintStart, startTime, hintEnd, endTime, ...params }) {
16
+ constructor({
17
+ dateFormat = DEFAULT_DATE_FORMAT,
18
+ hint,
19
+ labels,
20
+ hintStart,
21
+ startTime,
22
+ hintEnd,
23
+ endTime,
24
+ ...parentParams
25
+ }) {
24
26
  super({
25
- ...params,
27
+ ...parentParams,
26
28
  viewFolder: 'date-period'
27
29
  });
28
30
  this.dateFormat = dateFormat;
@@ -9,13 +9,11 @@ export class DateTimeQuestion extends Question {
9
9
  static PM = 'pm';
10
10
 
11
11
  /**
12
- * @param {import('#question-types').QuestionParameters} params
13
- * @param {string} [params.dateFormat]
14
- * @param {string} [params.timeFormat]
12
+ * @param {import('../../questions/question-props.d.ts').DateTimeQuestionParams} params
15
13
  */
16
- constructor({ dateFormat = DEFAULT_DATE_FORMAT, timeFormat = DEFAULT_TIME_FORMAT, ...params }) {
14
+ constructor({ dateFormat = DEFAULT_DATE_FORMAT, timeFormat = DEFAULT_TIME_FORMAT, ...parentParams }) {
17
15
  super({
18
- ...params,
16
+ ...parentParams,
19
17
  viewFolder: 'date-time'
20
18
  });
21
19
  this.dateFormat = dateFormat;
@@ -15,11 +15,7 @@ import SingleLineInputQuestion from '../single-line-input/question.js';
15
15
  */
16
16
  export class EmailQuestion extends SingleLineInputQuestion {
17
17
  /**
18
- * @param {import('#question-types').QuestionParameters} params
19
- * @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
20
- * @param {Record<string, string>} [params.inputAttributes] html attributes to add to the input (will be merged with email defaults)
21
- * @param {string} [params.classes] html classes to add to the input
22
- * @param {string} [params.autocomplete] autocomplete attribute value (defaults to 'email')
18
+ * @param {import('../../questions/question-props.d.ts').EmailQuestionParams} params
23
19
  */
24
20
  constructor(params) {
25
21
  // Set default input attributes for email
@@ -19,7 +19,7 @@ export class ManageListQuestion extends Question {
19
19
  #confirmationQuestionParam;
20
20
 
21
21
  /**
22
- * @param {import('#question-types').QuestionParameters & ManageListQuestionParameters} params
22
+ * @param {import('../../questions/question-props.d.ts').ManageListQuestionParams} params
23
23
  */
24
24
  constructor(params) {
25
25
  super({
@@ -15,11 +15,11 @@ import { nl2br } from '../../lib/utils.js';
15
15
  */
16
16
  export class MultiFieldInputQuestion extends Question {
17
17
  /**
18
- * @param {import('#src/questions/question-props.d.ts').MultiFieldInputQuestionProps} params
18
+ * @param {import('../../questions/question-props.d.ts').MultiFieldInputQuestionParams} params
19
19
  */
20
- constructor({ inputFields, ...params }) {
20
+ constructor({ inputFields, ...parentParams }) {
21
21
  super({
22
- ...params,
22
+ ...parentParams,
23
23
  viewFolder: 'multi-field-input'
24
24
  });
25
25
 
@@ -3,13 +3,11 @@ import { getPersistedNumberAnswer } from '../utils/persisted-number-answer.js';
3
3
 
4
4
  export class NumberEntryQuestion extends Question {
5
5
  /**
6
- * @param {import('#question-types').QuestionParameters} params
7
- * @param {string} [params.suffix]
8
- * @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
6
+ * @param {import('../../questions/question-props.d.ts').NumberEntryQuestionParams} params
9
7
  */
10
- constructor({ label, suffix, ...params }) {
8
+ constructor({ label, suffix, ...parentParams }) {
11
9
  super({
12
- ...params,
10
+ ...parentParams,
13
11
  viewFolder: 'number-entry'
14
12
  });
15
13
 
@@ -2,23 +2,7 @@ import OptionsQuestion from '../../questions/options-question.js';
2
2
 
3
3
  export class RadioQuestion extends OptionsQuestion {
4
4
  /**
5
- * @param {Object} params
6
- * @param {string} params.title
7
- * @param {string} params.question
8
- * @param {string} params.fieldName
9
- * @param {string} [params.viewFolder]
10
- * @param {string} [params.url]
11
- * @param {string} [params.hint]
12
- * @param {string} [params.pageTitle]
13
- * @param {string} [params.description]
14
- * @param {string} [params.label]
15
- * @param {string} [params.html]
16
- * @param {string} [params.legend] - optional legend, used instead of h1
17
- * @param {Array.<import('../../questions/options-question.js').Option>} params.options
18
- * @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
19
- * @param {boolean} [params.editable]
20
- * @param {Object<string, any>} [params.viewData]
21
- * @param {import('#question-types').ActionLink} [params.actionLink]
5
+ * @param {import('../../questions/question-props.d.ts').RadioQuestionParams} params
22
6
  */
23
7
  constructor({
24
8
  title,
@@ -3,22 +3,7 @@ import OptionsQuestion from '../../questions/options-question.js';
3
3
  export class SelectQuestion extends OptionsQuestion {
4
4
  #disableAccessibleAutocomplete;
5
5
  /**
6
- * @param {Object} params
7
- * @param {string} params.title
8
- * @param {string} params.question
9
- * @param {string} params.fieldName
10
- * @param {string} [params.viewFolder]
11
- * @param {string} [params.url]
12
- * @param {string} [params.hint]
13
- * @param {string} [params.pageTitle]
14
- * @param {string} [params.description]
15
- * @param {string} [params.label]
16
- * @param {string} [params.html]
17
- * @param {string} [params.legend] - optional legend, used instead of h1
18
- * @param {string} [params.disableAccessibleAutocomplete]
19
- * @param {Array.<import('../../questions/options-question.js').Option>} params.options
20
- * @param {Object<string, any>} [params.viewData]
21
- * @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
6
+ * @param {import('../../questions/question-props.d.ts').SelectQuestionParams} params
22
7
  */
23
8
  constructor({
24
9
  title,
@@ -8,10 +8,7 @@ export class SingleLineInputQuestion extends Question {
8
8
  inputAttributes;
9
9
 
10
10
  /**
11
- * @param {import('#question-types').QuestionParameters} params
12
- * @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
13
- * @param {Record<string, string>} [params.inputAttributes] html attributes to add to the input
14
- * @param {string} [params.classes] html classes to add to the input
11
+ * @param {import('../../questions/question-props.d.ts').SingleLineInputQuestionParams} params
15
12
  */
16
13
  constructor(params) {
17
14
  super({
@@ -19,13 +19,11 @@ import { Question } from '#question';
19
19
  */
20
20
  export class TextEntryQuestion extends Question {
21
21
  /**
22
- * @param {import('#question-types').QuestionParameters} params
23
- * @param {TextEntryCheckbox} [params.textEntryCheckbox]
24
- * @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
22
+ * @param {import('../../questions/question-props.d.ts').TextEntryQuestionParams} params
25
23
  */
26
- constructor({ textEntryCheckbox, label, ...params }) {
24
+ constructor({ textEntryCheckbox, label, ...parentParams }) {
27
25
  super({
28
- ...params,
26
+ ...parentParams,
29
27
  viewFolder: 'text-entry'
30
28
  });
31
29
 
@@ -9,14 +9,7 @@ export const TRUNCATED_MAX_LENGTH = 500;
9
9
  */
10
10
  export class TextEntryRedactQuestion extends Question {
11
11
  /**
12
- * @param {import('#question-types').QuestionParameters} params
13
- * @param {import('../text-entry/question.js').TextEntryCheckbox} [params.textEntryCheckbox]
14
- * @param {string|undefined} [params.label] if defined this show as a label for the input and the question will just be a standard h1
15
- * @param {boolean} [params.onlyShowRedactedValueForSummary] whether to only show redacted value for summary
16
- * @param {boolean} [params.useRedactedFieldNameForSave] whether to use the redacted field name when saving answers
17
- * @param {boolean} [params.showSuggestionsUi] use the suggestions UI for this question
18
- * @param {string} [params.summaryText] summaryText to use with the details component
19
- * @param {boolean} [params.shouldTruncateSummary] determines whether redacted comment is truncated in summary view
12
+ * @param {import('../../questions/question-props.d.ts').TextEntryRedactQuestionParams} params
20
13
  */
21
14
  constructor({
22
15
  textEntryCheckbox,
@@ -26,10 +19,10 @@ export class TextEntryRedactQuestion extends Question {
26
19
  showSuggestionsUi,
27
20
  summaryText,
28
21
  shouldTruncateSummary,
29
- ...params
22
+ ...parentParams
30
23
  }) {
31
24
  super({
32
- ...params,
25
+ ...parentParams,
33
26
  viewFolder: 'text-entry-redact'
34
27
  });
35
28
 
@@ -35,16 +35,13 @@ export class UnitOptionEntryQuestion extends Question {
35
35
  options;
36
36
 
37
37
  /**
38
- * @param {import('#question-types').QuestionParameters} params
39
- * @param {string} [params.conditionalFieldName] // will be the quantity and is captured by the conditional in the options
40
- * @param {string} [params.label]
41
- * @param {Array.<UnitOption>} [params.options]
38
+ * @param {import('../../questions/question-props.d.ts').UnitOptionEntryQuestionParams} params
42
39
  * @param {Record<string, Function>} [methodOverrides]
43
40
  */
44
- constructor({ conditionalFieldName, options, label, ...params }, methodOverrides) {
41
+ constructor({ conditionalFieldName, options, label, ...parentParams }, methodOverrides) {
45
42
  super(
46
43
  {
47
- ...params,
44
+ ...parentParams,
48
45
  viewFolder: 'unit-option-entry'
49
46
  },
50
47
  methodOverrides
@@ -18,14 +18,22 @@ type QuestionTypes =
18
18
  | 'text-entry-redact'
19
19
  | 'unit-option';
20
20
 
21
- type CommonQuestionProps = Omit<QuestionParameters, 'viewFolder'> & {
21
+ /**
22
+ * Base params that question classes need to function (NO type - that's routing metadata)
23
+ */
24
+ export type CommonQuestionParams = Omit<QuestionParameters, 'viewFolder'>;
25
+
26
+ /**
27
+ * Full props including type for routing/factory layer
28
+ */
29
+ type CommonQuestionProps = CommonQuestionParams & {
22
30
  type: QuestionTypes;
23
31
  };
24
32
 
25
33
  /**
26
34
  * Generic question props type so that custom components can be used without having to define a new type for each one.
27
35
  */
28
- export type BaseQuestionProps = Omit<CommonQuestionProps, 'type'> & {
36
+ export type BaseQuestionProps = CommonQuestionParams & {
29
37
  type: string;
30
38
  };
31
39
 
@@ -68,6 +76,7 @@ interface InputField {
68
76
  suffix?: Affix; // used to add a suffix to the field
69
77
  prefix?: Affix; // used to add a prefix to the field
70
78
  hint?: string;
79
+ classes?: string;
71
80
  }
72
81
 
73
82
  /*
@@ -95,79 +104,174 @@ interface UnitOption {
95
104
  };
96
105
  }
97
106
 
98
- type BooleanQuestionProps = CommonQuestionProps & {
99
- type: 'boolean';
107
+ /**
108
+ * Internal base params for questions with options - not exported
109
+ */
110
+ type OptionsQuestionParams = CommonQuestionParams & {
111
+ options: Option[];
112
+ };
113
+
114
+ export type BooleanQuestionParams = Omit<RadioQuestionParams, 'options'> & {
100
115
  options?: Option[];
101
116
  interfaceType?: 'checkbox' | 'radio';
102
117
  };
103
118
 
104
- type CheckboxQuestionProps = CommonQuestionProps & {
119
+ type BooleanQuestionProps = BooleanQuestionParams & {
120
+ type: 'boolean';
121
+ };
122
+
123
+ export type CheckboxQuestionParams = OptionsQuestionParams;
124
+
125
+ type CheckboxQuestionProps = CheckboxQuestionParams & {
105
126
  type: 'checkbox';
106
- options: Option[];
107
127
  };
108
128
 
109
- type DateQuestionProps = CommonQuestionProps & {
129
+ export type DateQuestionParams = CommonQuestionParams & {
130
+ dateFormat?: string;
131
+ };
132
+
133
+ type DateQuestionProps = DateQuestionParams & {
110
134
  type: 'date';
111
135
  };
112
136
 
113
- type DatePeriodQuestionProps = CommonQuestionProps & {
137
+ // Minute and second will default to 0 if not provided
138
+ interface TimeComponents {
139
+ hour: number;
140
+ minute?: number;
141
+ second?: number;
142
+ }
143
+
144
+ export type DatePeriodQuestionParams = CommonQuestionParams & {
145
+ dateFormat?: string;
146
+ labels?: { start: string; end: string };
147
+ hintStart?: string;
148
+ hintEnd?: string;
149
+ startTime?: TimeComponents;
150
+ endTime?: TimeComponents;
151
+ };
152
+
153
+ type DatePeriodQuestionProps = DatePeriodQuestionParams & {
114
154
  type: 'date-period';
115
155
  };
116
156
 
117
- type DateTimeQuestionProps = CommonQuestionProps & {
157
+ export type DateTimeQuestionParams = CommonQuestionParams & {
158
+ dateFormat?: string;
159
+ timeFormat?: string;
160
+ };
161
+
162
+ type DateTimeQuestionProps = DateTimeQuestionParams & {
118
163
  type: 'date-time';
119
164
  };
120
165
 
121
- type ManageListQuestionProps = CommonQuestionProps & {
166
+ export type ManageListQuestionParams = CommonQuestionParams & {
167
+ titleSingular?: string;
168
+ showManageListQuestions?: boolean;
169
+ showAnswersInSummary?: boolean;
170
+ confirmationQuestion?: string;
171
+ };
172
+
173
+ type ManageListQuestionProps = ManageListQuestionParams & {
122
174
  type: 'manage-list';
123
175
  };
124
176
 
125
- type EmailQuestionProps = CommonQuestionProps & {
177
+ export type EmailQuestionParams = SingleLineInputQuestionParams & {
178
+ autocomplete?: string; // autocomplete attribute value (defaults to 'email')
179
+ };
180
+
181
+ type EmailQuestionProps = EmailQuestionParams & {
126
182
  type: 'email';
127
183
  };
128
184
 
129
- export type MultiFieldInputQuestionProps = CommonQuestionProps & {
130
- type: 'multi-field-input';
185
+ export type MultiFieldInputQuestionParams = CommonQuestionParams & {
131
186
  inputFields: InputField[];
132
187
  };
133
188
 
134
- type NumberEntryQuestionProps = CommonQuestionProps & {
135
- type: 'number';
189
+ export type MultiFieldInputQuestionProps = MultiFieldInputQuestionParams & {
190
+ type: 'multi-field-input';
191
+ };
192
+
193
+ export type NumberEntryQuestionParams = CommonQuestionParams & {
136
194
  suffix?: string;
195
+ label?: string;
137
196
  };
138
197
 
139
- type RadioQuestionProps = CommonQuestionProps & {
198
+ type NumberEntryQuestionProps = NumberEntryQuestionParams & {
199
+ type: 'number';
200
+ };
201
+
202
+ export type RadioQuestionParams = OptionsQuestionParams & {
203
+ label?: string;
204
+ legend?: string;
205
+ };
206
+
207
+ type RadioQuestionProps = RadioQuestionParams & {
140
208
  type: 'radio';
141
- options: Option[];
142
209
  };
143
210
 
144
- type SelectQuestionProps = CommonQuestionProps & {
145
- type: 'select';
146
- options: Option[];
211
+ export type SelectQuestionParams = OptionsQuestionParams & {
147
212
  disableAccessibleAutocomplete?: boolean;
213
+ label?: string;
214
+ legend?: string;
215
+ };
216
+
217
+ type SelectQuestionProps = SelectQuestionParams & {
218
+ type: 'select';
148
219
  };
149
220
 
150
- type SingleLineInputQuestionProps = CommonQuestionProps & {
221
+ export type SingleLineInputQuestionParams = CommonQuestionParams & {
222
+ inputAttributes?: Record<string, string>; // HTML attributes to add to the input
223
+ label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
224
+ classes?: string; // HTML classes to add to the input
225
+ };
226
+
227
+ type SingleLineInputQuestionProps = SingleLineInputQuestionParams & {
151
228
  type: 'single-line-input';
152
- inputAttributes?: Record<string, string>;
153
229
  };
154
230
 
155
- type SiteAddressQuestionProps = CommonQuestionProps & {
231
+ export type SiteAddressQuestionParams = CommonQuestionParams;
232
+
233
+ type SiteAddressQuestionProps = SiteAddressQuestionParams & {
156
234
  type: 'site-address';
157
235
  };
158
236
 
159
- type TextEntryQuestionProps = CommonQuestionProps & {
237
+ type TextEntryCheckbox = {
238
+ header: string;
239
+ text: string;
240
+ name: string;
241
+ errorMessage?: string;
242
+ };
243
+
244
+ export type TextEntryQuestionParams = CommonQuestionParams & {
245
+ textEntryCheckbox?: TextEntryCheckbox;
246
+ label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
247
+ };
248
+
249
+ type TextEntryQuestionProps = TextEntryQuestionParams & {
160
250
  type: 'text-entry';
161
251
  };
162
252
 
163
- type TextEntryRedactQuestionProps = CommonQuestionProps & {
253
+ export type TextEntryRedactQuestionParams = CommonQuestionParams & {
254
+ textEntryCheckbox?: TextEntryCheckbox;
255
+ label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
256
+ onlyShowRedactedValueForSummary?: boolean;
257
+ useRedactedFieldNameForSave?: boolean;
258
+ showSuggestionsUi?: boolean;
259
+ summaryText?: string; // summaryText to use with the details component
260
+ shouldTruncateSummary?: boolean; // determines whether redacted comment is truncated in summary view
261
+ };
262
+
263
+ type TextEntryRedactQuestionProps = TextEntryRedactQuestionParams & {
164
264
  type: 'text-entry-redact';
165
265
  };
166
266
 
167
- type UnitOptionEntryQuestionProps = CommonQuestionProps & {
168
- type: 'unit-option';
169
- conditionalFieldName: string;
267
+ export type UnitOptionEntryQuestionParams = CommonQuestionParams & {
268
+ conditionalFieldName: string; // will be the quantity and is captured by the conditional in the options
170
269
  options: UnitOption[];
270
+ label?: string;
271
+ };
272
+
273
+ type UnitOptionEntryQuestionProps = UnitOptionEntryQuestionParams & {
274
+ type: 'unit-option';
171
275
  };
172
276
 
173
277
  export type QuestionProps =
@@ -1,8 +1,8 @@
1
1
  export class AddressQuestion extends Question {
2
2
  /**
3
- * @param {import('#question-types').QuestionParameters} params
3
+ * @param {import('../../questions/question-props.d.ts').SiteAddressQuestionParams} params
4
4
  */
5
- constructor(params: import("#question-types").QuestionParameters);
5
+ constructor(params: import("../../questions/question-props.d.ts").SiteAddressQuestionParams);
6
6
  requiredFields: {
7
7
  addressLine1: boolean;
8
8
  addressLine2: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/address/question.js"],"names":[],"mappings":"AAOA;IACC;;OAEG;IACH,oBAFW,OAAO,iBAAiB,EAAE,kBAAkB,EAqBtD;IAXE;;;;;;kBAA8C;IAIhD;;;;;;MAMC;IAiBF;;;OAGG;IACH,4BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,GAAC,GAAC,MAAM,CAqBpB;IAqCD;;;OAGG;IACH;;eAUC;IAuBD,kEAMC;CACD;;yBAtJwB,WAAW"}
1
+ {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/address/question.js"],"names":[],"mappings":"AAOA;IACC;;OAEG;IACH,oBAFW,OAAO,qCAAqC,EAAE,yBAAyB,EAqBjF;IAXE;;;;;;kBAA8C;IAIhD;;;;;;MAMC;IAiBF;;;OAGG;IACH,4BAHW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjB,GAAC,GAAC,MAAM,CAqBpB;IAqCD;;;OAGG;IACH;;eAUC;IAuBD,kEAMC;CACD;;yBAtJwB,WAAW"}
@@ -7,37 +7,10 @@ export function booleanToYesNoValue(value: any): "yes" | "no";
7
7
  export function booleanToYesNoOrNull(value: boolean | null): string | null;
8
8
  export class BooleanQuestion extends RadioQuestion {
9
9
  /**
10
- * @param {Object} params
11
- * @param {string} params.title
12
- * @param {string} params.question
13
- * @param {string} params.fieldName
14
- * @param {string} [params.url]
15
- * @param {string} [params.hint]
16
- * @param {string} [params.pageTitle]
17
- * @param {string} [params.description]
18
- * @param {string} [params.html]
19
- * @param {string} [params.interfaceType]
20
- * @param {Array.<import('../../questions/options-question.js').Option>} [params.options]
21
- * @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
22
- * @param {boolean} [params.editable]
23
- * @param {import('#question-types').QuestionParameters['viewData']} [params.viewData]
10
+ * @param {import('../../questions/question-props.d.ts').BooleanQuestionParams} params
24
11
  */
25
- constructor({ title, question, fieldName, url, hint, pageTitle, description, html, validators, interfaceType, options, editable, viewData }: {
26
- title: string;
27
- question: string;
28
- fieldName: string;
29
- url?: string | undefined;
30
- hint?: string | undefined;
31
- pageTitle?: string | undefined;
32
- description?: string | undefined;
33
- html?: string | undefined;
34
- interfaceType?: string | undefined;
35
- options?: import("../../questions/options-question.js").Option[] | undefined;
36
- validators?: import("#base-validator").BaseValidator[] | undefined;
37
- editable?: boolean | undefined;
38
- viewData?: import("#question-types").QuestionParameters["viewData"];
39
- });
40
- interfaceType: string;
12
+ constructor({ title, question, fieldName, url, hint, pageTitle, description, html, validators, interfaceType, options, editable, viewData }: import("../../questions/question-props.d.ts").BooleanQuestionParams);
13
+ interfaceType: "checkbox" | "radio";
41
14
  /**
42
15
  * Get the data to save from the request, returns an object of answers
43
16
  * @param {import('express').Request} req
@@ -1 +1 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/boolean/question.js"],"names":[],"mappings":"AAEA;;;GAGG;AAMI,sCAHI,MAAM,GAAC,GAAC,GACN,OAAO,CAOnB;AAEM,8DAEN;AAMM,4CAHI,OAAO,GAAC,IAAI,GACV,MAAM,GAAC,IAAI,CAOvB;AAED;IACC;;;;;;;;;;;;;;;OAeG;IACH,6IAdG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,GAAG;QACH,IAAI;QACJ,SAAS;QACT,WAAW;QACX,IAAI;QACJ,aAAa;QACyC,OAAO;QACpB,UAAU;QAClD,QAAQ;QACyC,QAAQ,GAA1E,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,UAAU,CAAC;KAAmB,EAmDrF;IADA,sBAAkC;IAGnC;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,eAAe,GACb,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAezD;CACD;;0BAzHyB,sBAAsB"}
1
+ {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/boolean/question.js"],"names":[],"mappings":"AAEA;;;GAGG;AAMI,sCAHI,MAAM,GAAC,GAAC,GACN,OAAO,CAOnB;AAEM,8DAEN;AAMM,4CAHI,OAAO,GAAC,IAAI,GACV,MAAM,GAAC,IAAI,CAOvB;AAED;IACC;;OAEG;IACH,6IAFW,OAAO,qCAAqC,EAAE,qBAAqB,EAmD7E;IADA,oCAAkC;IAGnC;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,eAAe,GACb,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAezD;CACD;;0BA5GyB,sBAAsB"}
@@ -6,28 +6,9 @@
6
6
  */
7
7
  export class CheckboxQuestion extends OptionsQuestion {
8
8
  /**
9
- * @param {Object} params
10
- * @param {string} params.title
11
- * @param {string} params.question
12
- * @param {string} params.fieldName
13
- * @param {string} [params.url]
14
- * @param {string} [params.pageTitle]
15
- * @param {string} [params.description]
16
- * @param {Array.<import('../../questions/options-question.js').Option>} params.options
17
- * @param {Array.<import('#base-validator').BaseValidator>} [params.validators]
18
- * @param {import('#question-types').QuestionParameters['viewData']} [params.viewData]
9
+ * @param {import('../../questions/question-props.d.ts').CheckboxQuestionParams} params
19
10
  */
20
- constructor({ title, question, fieldName, url, pageTitle, description, options, validators, viewData }: {
21
- title: string;
22
- question: string;
23
- fieldName: string;
24
- url?: string | undefined;
25
- pageTitle?: string | undefined;
26
- description?: string | undefined;
27
- options: Array<import("../../questions/options-question.js").Option>;
28
- validators?: import("#base-validator").BaseValidator[] | undefined;
29
- viewData?: import("#question-types").QuestionParameters["viewData"];
30
- });
11
+ constructor({ title, question, fieldName, url, pageTitle, description, options, validators, viewData }: import("../../questions/question-props.d.ts").CheckboxQuestionParams);
31
12
  /**
32
13
  * returns the formatted answers values to be used to build task list elements
33
14
  * @param {string | ConditionalAnswerObject } answer will be a single value string, a comma-separated string representing multiple values (one of which may be a conditional) or a single ConditionalAnswerObject
@@ -1 +1 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/checkbox/question.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;IACC;;;;;;;;;;;OAWG;IACH,wGAVG;QAAuB,KAAK,EAApB,MAAM;QACS,QAAQ,EAAvB,MAAM;QACS,SAAS,EAAxB,MAAM;QACU,GAAG;QACH,SAAS;QACT,WAAW;QAC0C,OAAO,EAA5E,KAAK,CAAE,OAAO,qCAAqC,EAAE,MAAM,CAAC;QACH,UAAU;QACD,QAAQ,GAA1E,OAAO,iBAAiB,EAAE,kBAAkB,CAAC,UAAU,CAAC;KAAmB,EAiBrF;IAED;;;;;;OAMG;IACH,wDAJW,OAAO,UAAU,EAAE,OAAO,UAD1B,MAAM,GAAG,uBAAuB,GAG9B,KAAK,CAAE,MAAM,CAAC,CAuC1B;CACD;;;;;;WA/Ea,MAAM;;;;iBACN,MAAM;;4BATQ,qCAAqC"}
1
+ {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/checkbox/question.js"],"names":[],"mappings":"AAKA;;;;;GAKG;AAEH;IACC;;OAEG;IACH,wGAFW,OAAO,qCAAqC,EAAE,sBAAsB,EAiB9E;IAED;;;;;;OAMG;IACH,wDAJW,OAAO,UAAU,EAAE,OAAO,UAD1B,MAAM,GAAG,uBAAuB,GAG9B,KAAK,CAAE,MAAM,CAAC,CAuC1B;CACD;;;;;;WAtEa,MAAM;;;;iBACN,MAAM;;4BATQ,qCAAqC"}