@planning-inspectorate/dynamic-forms 3.15.6 → 3.17.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.
Files changed (264) hide show
  1. package/.gitattributes +3 -0
  2. package/.prettierrc +1 -0
  3. package/README.md +123 -4
  4. package/package.json +6 -4
  5. package/{types/src → src}/components/address/question.d.ts +6 -2
  6. package/src/components/address/question.d.ts.map +1 -0
  7. package/src/components/address/question.js +7 -19
  8. package/{types/src → src}/components/boolean/question.d.ts +2 -2
  9. package/src/components/boolean/question.d.ts.map +1 -0
  10. package/src/components/boolean/question.js +1 -1
  11. package/src/components/checkbox/question.d.ts +9 -0
  12. package/src/components/checkbox/question.d.ts.map +1 -0
  13. package/src/components/checkbox/question.js +37 -54
  14. package/src/components/checkbox/question.test.js +170 -27
  15. package/{types/src → src}/components/date/question.d.ts +2 -2
  16. package/src/components/date/question.d.ts.map +1 -0
  17. package/src/components/date/question.js +7 -16
  18. package/{types/src → src}/components/date-period/question.d.ts +12 -4
  19. package/src/components/date-period/question.d.ts.map +1 -0
  20. package/src/components/date-period/question.js +2 -3
  21. package/{types/src → src}/components/date-time/question.d.ts +2 -2
  22. package/src/components/date-time/question.d.ts.map +1 -0
  23. package/src/components/date-time/question.js +5 -14
  24. package/src/components/email/question.d.ts +23 -0
  25. package/src/components/email/question.d.ts.map +1 -0
  26. package/src/components/email/question.js +1 -9
  27. package/src/components/manage-list/answer-summary-list.njk +1 -1
  28. package/src/components/manage-list/manage-list-actions.d.ts.map +1 -0
  29. package/src/components/manage-list/manage-list-section.d.ts.map +1 -0
  30. package/{types/src → src}/components/manage-list/question.d.ts +6 -3
  31. package/src/components/manage-list/question.d.ts.map +1 -0
  32. package/src/components/manage-list/question.js +5 -2
  33. package/{types/src → src}/components/manage-list/utils.d.ts +3 -3
  34. package/src/components/manage-list/utils.d.ts.map +1 -0
  35. package/src/components/manage-list/utils.js +2 -2
  36. package/src/components/multi-field-input/question.d.ts +52 -0
  37. package/src/components/multi-field-input/question.d.ts.map +1 -0
  38. package/src/components/multi-field-input/question.js +5 -13
  39. package/src/components/number-entry/question.d.ts +12 -0
  40. package/src/components/number-entry/question.d.ts.map +1 -0
  41. package/src/components/number-entry/question.js +4 -22
  42. package/src/components/radio/question.d.ts +11 -0
  43. package/src/components/radio/question.d.ts.map +1 -0
  44. package/src/components/radio/question.js +30 -51
  45. package/src/components/radio/question.test.js +139 -60
  46. package/src/components/select/question.d.ts +12 -0
  47. package/src/components/select/question.d.ts.map +1 -0
  48. package/src/components/select/question.js +5 -48
  49. package/{types/src → src}/components/single-line-input/question.d.ts +2 -2
  50. package/src/components/single-line-input/question.d.ts.map +1 -0
  51. package/src/components/single-line-input/question.js +2 -2
  52. package/{types/src → src}/components/text-entry/question.d.ts +3 -3
  53. package/src/components/text-entry/question.d.ts.map +1 -0
  54. package/src/components/text-entry/question.js +2 -2
  55. package/{types/src → src}/components/text-entry-redact/question.d.ts +8 -9
  56. package/src/components/text-entry-redact/question.d.ts.map +1 -0
  57. package/src/components/text-entry-redact/question.js +5 -2
  58. package/{types/src → src}/components/unit-option-entry/question.d.ts +12 -8
  59. package/src/components/unit-option-entry/question.d.ts.map +1 -0
  60. package/src/components/unit-option-entry/question.js +5 -6
  61. package/src/components/utils/component-types.d.ts.map +1 -0
  62. package/src/components/utils/persisted-number-answer.d.ts.map +1 -0
  63. package/src/components/utils/question-has-answer.d.ts.map +1 -0
  64. package/src/components/utils/question-has-answer.js +1 -1
  65. package/src/components/utils/question-utils.d.ts +33 -0
  66. package/src/components/utils/question-utils.d.ts.map +1 -0
  67. package/src/components/utils/question-utils.js +31 -2
  68. package/src/components/utils/question-utils.test.js +89 -2
  69. package/{types/src → src}/controller.d.ts +2 -7
  70. package/src/controller.d.ts.map +1 -0
  71. package/src/controller.js +3 -10
  72. package/{types/src → src}/index.d.ts +4 -3
  73. package/src/index.d.ts.map +1 -0
  74. package/src/index.js +6 -4
  75. package/src/journey/journey-response.d.ts +28 -0
  76. package/src/journey/journey-response.d.ts.map +1 -0
  77. package/src/journey/journey-response.js +4 -8
  78. package/{types/src → src}/journey/journey.d.ts +8 -8
  79. package/src/journey/journey.d.ts.map +1 -0
  80. package/src/journey/journey.js +6 -6
  81. package/src/lib/address-utils.d.ts.map +1 -0
  82. package/src/lib/address.d.ts.map +1 -0
  83. package/src/lib/date-utils.d.ts.map +1 -0
  84. package/src/lib/session-answer-store.d.ts.map +1 -0
  85. package/src/lib/utils.d.ts.map +1 -0
  86. package/src/lib/uuid.d.ts.map +1 -0
  87. package/src/middleware/build-get-journey.d.ts.map +1 -0
  88. package/src/middleware/redirect-to-unanswered-question.d.ts +12 -0
  89. package/src/middleware/redirect-to-unanswered-question.d.ts.map +1 -0
  90. package/src/middleware/redirect-to-unanswered-question.js +1 -1
  91. package/src/questions/create-questions.d.ts +18 -0
  92. package/src/questions/create-questions.d.ts.map +1 -0
  93. package/src/questions/create-questions.js +3 -3
  94. package/{types/src → src}/questions/options-question.d.ts +7 -7
  95. package/src/questions/options-question.d.ts.map +1 -0
  96. package/src/questions/options-question.js +29 -4
  97. package/src/questions/options-question.test.js +106 -0
  98. package/{types/src → src}/questions/question.d.ts +48 -79
  99. package/src/questions/question.d.ts.map +1 -0
  100. package/src/questions/question.js +83 -60
  101. package/src/questions/question.test.js +86 -0
  102. package/src/questions/questions.d.ts +3 -0
  103. package/src/questions/questions.d.ts.map +1 -0
  104. package/src/questions/questions.js +1 -1
  105. package/{types/src → src}/section.d.ts +16 -15
  106. package/src/section.d.ts.map +1 -0
  107. package/src/section.js +12 -14
  108. package/src/validator/address-validator.d.ts.map +1 -0
  109. package/src/validator/base-validator.d.ts.map +1 -0
  110. package/src/validator/conditional-required-validator.d.ts.map +1 -0
  111. package/src/validator/confirmation-checkbox-validator.d.ts.map +1 -0
  112. package/src/validator/coordinates-validator.d.ts.map +1 -0
  113. package/src/validator/cross-question-validator.d.ts.map +1 -0
  114. package/src/validator/date-period-validator.d.ts.map +1 -0
  115. package/src/validator/date-time-validator.d.ts.map +1 -0
  116. package/src/validator/date-validator.d.ts.map +1 -0
  117. package/src/validator/document-upload-validator.d.ts.map +1 -0
  118. package/src/validator/email-validator.d.ts.map +1 -0
  119. package/{types/src → src}/validator/multi-field-input-validator.d.ts +3 -3
  120. package/src/validator/multi-field-input-validator.d.ts.map +1 -0
  121. package/src/validator/multi-field-input-validator.js +3 -3
  122. package/{types/src → src}/validator/numeric-validator.d.ts +2 -2
  123. package/src/validator/numeric-validator.d.ts.map +1 -0
  124. package/src/validator/numeric-validator.js +2 -2
  125. package/src/validator/required-validator.d.ts.map +1 -0
  126. package/src/validator/same-answer-validator.d.ts.map +1 -0
  127. package/{types/src → src}/validator/string-validator.d.ts +3 -3
  128. package/src/validator/string-validator.d.ts.map +1 -0
  129. package/src/validator/string-validator.js +3 -3
  130. package/src/validator/unit-option-entry-validator.d.ts.map +1 -0
  131. package/src/validator/valid-option-validator.d.ts.map +1 -0
  132. package/src/validator/validation-error-handler.d.ts.map +1 -0
  133. package/src/validator/validator.d.ts.map +1 -0
  134. package/test/journey.js +2 -0
  135. package/test/questions.js +51 -1
  136. package/test/secondary-actions.test.js +1 -1
  137. package/test/snapshots/check-your-answers-not-started.html +22 -0
  138. package/test/snapshots/check-your-answers-with-answers.html +22 -0
  139. package/test/snapshots/favourite-activity-reason.html +54 -0
  140. package/test/snapshots/travel-requirements.html +48 -0
  141. package/test/utils/question-test-utils.js +36 -6
  142. package/tsconfig.json +11 -4
  143. package/{types/src/questions → typedefs}/question-props.d.ts +28 -26
  144. package/typedefs/question-types.d.ts +141 -0
  145. package/{src → typedefs}/section-types.d.ts +1 -1
  146. package/typedefs/section-types.js +1 -0
  147. package/move-types.js +0 -12
  148. package/src/questions/question-props.d.ts +0 -295
  149. package/src/questions/question-types.d.ts +0 -86
  150. package/types/commitlint.config.d.ts +0 -7
  151. package/types/commitlint.config.d.ts.map +0 -1
  152. package/types/eslint.config.d.ts +0 -97
  153. package/types/eslint.config.d.ts.map +0 -1
  154. package/types/move-types.d.ts +0 -2
  155. package/types/move-types.d.ts.map +0 -1
  156. package/types/src/components/address/question.d.ts.map +0 -1
  157. package/types/src/components/boolean/question.d.ts.map +0 -1
  158. package/types/src/components/checkbox/question.d.ts +0 -33
  159. package/types/src/components/checkbox/question.d.ts.map +0 -1
  160. package/types/src/components/date/question.d.ts.map +0 -1
  161. package/types/src/components/date-period/question.d.ts.map +0 -1
  162. package/types/src/components/date-time/question.d.ts.map +0 -1
  163. package/types/src/components/email/question.d.ts +0 -35
  164. package/types/src/components/email/question.d.ts.map +0 -1
  165. package/types/src/components/manage-list/manage-list-actions.d.ts.map +0 -1
  166. package/types/src/components/manage-list/manage-list-section.d.ts.map +0 -1
  167. package/types/src/components/manage-list/question.d.ts.map +0 -1
  168. package/types/src/components/manage-list/utils.d.ts.map +0 -1
  169. package/types/src/components/multi-field-input/question.d.ts +0 -64
  170. package/types/src/components/multi-field-input/question.d.ts.map +0 -1
  171. package/types/src/components/number-entry/question.d.ts +0 -36
  172. package/types/src/components/number-entry/question.d.ts.map +0 -1
  173. package/types/src/components/radio/question.d.ts +0 -23
  174. package/types/src/components/radio/question.d.ts.map +0 -1
  175. package/types/src/components/select/question.d.ts +0 -22
  176. package/types/src/components/select/question.d.ts.map +0 -1
  177. package/types/src/components/single-line-input/question.d.ts.map +0 -1
  178. package/types/src/components/text-entry/question.d.ts.map +0 -1
  179. package/types/src/components/text-entry-redact/question.d.ts.map +0 -1
  180. package/types/src/components/unit-option-entry/question.d.ts.map +0 -1
  181. package/types/src/components/utils/component-types.d.ts.map +0 -1
  182. package/types/src/components/utils/persisted-number-answer.d.ts.map +0 -1
  183. package/types/src/components/utils/question-has-answer.d.ts.map +0 -1
  184. package/types/src/components/utils/question-utils.d.ts +0 -15
  185. package/types/src/components/utils/question-utils.d.ts.map +0 -1
  186. package/types/src/controller.d.ts.map +0 -1
  187. package/types/src/index.d.ts.map +0 -1
  188. package/types/src/journey/journey-response.d.ts +0 -32
  189. package/types/src/journey/journey-response.d.ts.map +0 -1
  190. package/types/src/journey/journey-types.d.ts +0 -28
  191. package/types/src/journey/journey-types.d.ts.map +0 -1
  192. package/types/src/journey/journey.d.ts.map +0 -1
  193. package/types/src/lib/address-utils.d.ts.map +0 -1
  194. package/types/src/lib/address.d.ts.map +0 -1
  195. package/types/src/lib/date-utils.d.ts.map +0 -1
  196. package/types/src/lib/session-answer-store.d.ts.map +0 -1
  197. package/types/src/lib/utils.d.ts.map +0 -1
  198. package/types/src/lib/uuid.d.ts.map +0 -1
  199. package/types/src/middleware/build-get-journey.d.ts.map +0 -1
  200. package/types/src/middleware/redirect-to-unanswered-question.d.ts +0 -12
  201. package/types/src/middleware/redirect-to-unanswered-question.d.ts.map +0 -1
  202. package/types/src/questions/create-questions.d.ts +0 -18
  203. package/types/src/questions/create-questions.d.ts.map +0 -1
  204. package/types/src/questions/options-question.d.ts.map +0 -1
  205. package/types/src/questions/question-props.d.ts.map +0 -1
  206. package/types/src/questions/question-types.d.ts +0 -86
  207. package/types/src/questions/question-types.d.ts.map +0 -1
  208. package/types/src/questions/question.d.ts.map +0 -1
  209. package/types/src/questions/questions.d.ts +0 -3
  210. package/types/src/questions/questions.d.ts.map +0 -1
  211. package/types/src/section.d.ts.map +0 -1
  212. package/types/src/validator/address-validator.d.ts.map +0 -1
  213. package/types/src/validator/base-validator.d.ts.map +0 -1
  214. package/types/src/validator/conditional-required-validator.d.ts.map +0 -1
  215. package/types/src/validator/confirmation-checkbox-validator.d.ts.map +0 -1
  216. package/types/src/validator/coordinates-validator.d.ts.map +0 -1
  217. package/types/src/validator/cross-question-validator.d.ts.map +0 -1
  218. package/types/src/validator/date-period-validator.d.ts.map +0 -1
  219. package/types/src/validator/date-time-validator.d.ts.map +0 -1
  220. package/types/src/validator/date-validator.d.ts.map +0 -1
  221. package/types/src/validator/document-upload-validator.d.ts.map +0 -1
  222. package/types/src/validator/email-validator.d.ts.map +0 -1
  223. package/types/src/validator/multi-field-input-validator.d.ts.map +0 -1
  224. package/types/src/validator/numeric-validator.d.ts.map +0 -1
  225. package/types/src/validator/required-validator.d.ts.map +0 -1
  226. package/types/src/validator/same-answer-validator.d.ts.map +0 -1
  227. package/types/src/validator/string-validator.d.ts.map +0 -1
  228. package/types/src/validator/unit-option-entry-validator.d.ts.map +0 -1
  229. package/types/src/validator/valid-option-validator.d.ts.map +0 -1
  230. package/types/src/validator/validation-error-handler.d.ts.map +0 -1
  231. package/types/src/validator/validator.d.ts.map +0 -1
  232. /package/{types/src → src}/components/manage-list/manage-list-actions.d.ts +0 -0
  233. /package/{types/src → src}/components/manage-list/manage-list-section.d.ts +0 -0
  234. /package/{types/src → src}/components/utils/component-types.d.ts +0 -0
  235. /package/{types/src → src}/components/utils/persisted-number-answer.d.ts +0 -0
  236. /package/{types/src → src}/components/utils/question-has-answer.d.ts +0 -0
  237. /package/{types/src → src}/lib/address-utils.d.ts +0 -0
  238. /package/{types/src → src}/lib/address.d.ts +0 -0
  239. /package/{types/src → src}/lib/date-utils.d.ts +0 -0
  240. /package/{types/src → src}/lib/session-answer-store.d.ts +0 -0
  241. /package/{types/src → src}/lib/utils.d.ts +0 -0
  242. /package/{types/src → src}/lib/uuid.d.ts +0 -0
  243. /package/{types/src → src}/middleware/build-get-journey.d.ts +0 -0
  244. /package/{types/src → src}/validator/address-validator.d.ts +0 -0
  245. /package/{types/src → src}/validator/base-validator.d.ts +0 -0
  246. /package/{types/src → src}/validator/conditional-required-validator.d.ts +0 -0
  247. /package/{types/src → src}/validator/confirmation-checkbox-validator.d.ts +0 -0
  248. /package/{types/src → src}/validator/coordinates-validator.d.ts +0 -0
  249. /package/{types/src → src}/validator/cross-question-validator.d.ts +0 -0
  250. /package/{types/src → src}/validator/date-period-validator.d.ts +0 -0
  251. /package/{types/src → src}/validator/date-time-validator.d.ts +0 -0
  252. /package/{types/src → src}/validator/date-validator.d.ts +0 -0
  253. /package/{types/src → src}/validator/document-upload-validator.d.ts +0 -0
  254. /package/{types/src → src}/validator/email-validator.d.ts +0 -0
  255. /package/{types/src → src}/validator/required-validator.d.ts +0 -0
  256. /package/{types/src → src}/validator/same-answer-validator.d.ts +0 -0
  257. /package/{types/src → src}/validator/unit-option-entry-validator.d.ts +0 -0
  258. /package/{types/src → src}/validator/valid-option-validator.d.ts +0 -0
  259. /package/{types/src → src}/validator/validation-error-handler.d.ts +0 -0
  260. /package/{types/src → src}/validator/validator.d.ts +0 -0
  261. /package/{src/journey → typedefs}/journey-types.d.ts +0 -0
  262. /package/{src/journey → typedefs}/journey-types.js +0 -0
  263. /package/{src/questions → typedefs}/question-props.js +0 -0
  264. /package/{src/questions → typedefs}/question-types.js +0 -0
@@ -1,295 +0,0 @@
1
- import type { QuestionParameters } from '#src/questions/question-types.d.ts';
2
-
3
- type QuestionTypes =
4
- | 'boolean'
5
- | 'checkbox'
6
- | 'date'
7
- | 'date-period'
8
- | 'date-time'
9
- | 'email'
10
- | 'manage-list'
11
- | 'multi-field-input'
12
- | 'number'
13
- | 'radio'
14
- | 'select'
15
- | 'single-line-input'
16
- | 'site-address'
17
- | 'text-entry'
18
- | 'text-entry-redact'
19
- | 'unit-option';
20
-
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 & {
30
- type: QuestionTypes;
31
- };
32
-
33
- /**
34
- * Generic question props type so that custom components can be used without having to define a new type for each one.
35
- */
36
- export type BaseQuestionProps = CommonQuestionParams & {
37
- type: string;
38
- };
39
-
40
- type Option =
41
- | {
42
- text: string;
43
- value: string;
44
- hint?: object;
45
- checked?: boolean | undefined;
46
- attributes?: Record<string, string>;
47
- behaviour?: 'exclusive';
48
- conditional?: {
49
- question: string;
50
- type: string;
51
- fieldName: string;
52
- inputClasses?: string;
53
- html?: string;
54
- value?: unknown;
55
- label?: string;
56
- hint?: string;
57
- };
58
- conditionalText?: {
59
- html: string;
60
- };
61
- }
62
- | { divider?: string };
63
-
64
- type Affix = {
65
- text: string;
66
- classes?: string;
67
- };
68
-
69
- interface InputField {
70
- fieldName: string;
71
- label: string;
72
- formatJoinString?: string; // used by formatAnswerForSummary (e.g. task list display), effective default to line break
73
- formatPrefix?: string; // used by formatAnswerForSummary (e.g. task list display), to prefix answer
74
- formatTextFunction?: (text: string) => string; // used to format the answer for display and value in question
75
- attributes?: Record<string, string>; // used to add HTML attributes to the field
76
- suffix?: Affix; // used to add a suffix to the field
77
- prefix?: Affix; // used to add a prefix to the field
78
- hint?: string;
79
- classes?: string;
80
- inputmode?: 'decimal' | 'numeric';
81
- pattern?: string; // Used for backwards-compatibility for older iOS devices in numeric input fields
82
- }
83
-
84
- /*
85
- * UnitOptions are the options displayed in the radio format - in this case the value
86
- * represents the unit.
87
- * Conditionals must be used to capture the relevant quantity.
88
- * Each conditional must have a fieldName which uses the conditionalFieldName from the
89
- * UnitOptionEntryQuestion object as a base, followed by an underscore and unit reference
90
- * eg 'siteAreaSquareMetres_hectares' - this is required for validation and saving to the DB
91
- */
92
- interface UnitOption {
93
- text: string;
94
- value: string;
95
- hint?: object;
96
- checked?: boolean | undefined;
97
- attributes?: Record<string, string>;
98
- behaviour?: 'exclusive';
99
- conditional: {
100
- fieldName: string;
101
- suffix: string;
102
- value?: unknown;
103
- label?: string;
104
- hint?: string;
105
- conversionFactor?: number;
106
- };
107
- }
108
-
109
- /**
110
- * Internal base params for questions with options - not exported
111
- */
112
- type OptionsQuestionParams = CommonQuestionParams & {
113
- options: Option[];
114
- };
115
-
116
- export type BooleanQuestionParams = Omit<RadioQuestionParams, 'options'> & {
117
- options?: Option[];
118
- interfaceType?: 'checkbox' | 'radio';
119
- };
120
-
121
- type BooleanQuestionProps = BooleanQuestionParams & {
122
- type: 'boolean';
123
- };
124
-
125
- export type CheckboxQuestionParams = OptionsQuestionParams;
126
-
127
- type CheckboxQuestionProps = CheckboxQuestionParams & {
128
- type: 'checkbox';
129
- };
130
-
131
- export type DateQuestionParams = CommonQuestionParams & {
132
- dateFormat?: string;
133
- };
134
-
135
- type DateQuestionProps = DateQuestionParams & {
136
- type: 'date';
137
- };
138
-
139
- // Minute and second will default to 0 if not provided
140
- interface TimeComponents {
141
- hour: number;
142
- minute?: number;
143
- second?: number;
144
- }
145
-
146
- export type DatePeriodQuestionParams = CommonQuestionParams & {
147
- dateFormat?: string;
148
- labels?: { start: string; end: string };
149
- hintStart?: string;
150
- hintEnd?: string;
151
- startTime?: TimeComponents;
152
- endTime?: TimeComponents;
153
- };
154
-
155
- type DatePeriodQuestionProps = DatePeriodQuestionParams & {
156
- type: 'date-period';
157
- };
158
-
159
- export type DateTimeQuestionParams = CommonQuestionParams & {
160
- dateFormat?: string;
161
- timeFormat?: string;
162
- };
163
-
164
- type DateTimeQuestionProps = DateTimeQuestionParams & {
165
- type: 'date-time';
166
- };
167
-
168
- export type ManageListQuestionParams = CommonQuestionParams & {
169
- titleSingular?: string;
170
- showManageListQuestions?: boolean;
171
- showAnswersInSummary?: boolean;
172
- confirmationQuestion?: string;
173
- };
174
-
175
- type ManageListQuestionProps = ManageListQuestionParams & {
176
- type: 'manage-list';
177
- };
178
-
179
- export type EmailQuestionParams = SingleLineInputQuestionParams & {
180
- autocomplete?: string; // autocomplete attribute value (defaults to 'email')
181
- };
182
-
183
- type EmailQuestionProps = EmailQuestionParams & {
184
- type: 'email';
185
- };
186
-
187
- export type MultiFieldInputQuestionParams = CommonQuestionParams & {
188
- inputFields: InputField[];
189
- };
190
-
191
- export type MultiFieldInputQuestionProps = MultiFieldInputQuestionParams & {
192
- type: 'multi-field-input';
193
- };
194
-
195
- export type NumberEntryQuestionParams = CommonQuestionParams & {
196
- suffix?: string;
197
- label?: string;
198
- };
199
-
200
- type NumberEntryQuestionProps = NumberEntryQuestionParams & {
201
- type: 'number';
202
- };
203
-
204
- export type RadioQuestionParams = OptionsQuestionParams & {
205
- label?: string;
206
- legend?: string;
207
- };
208
-
209
- type RadioQuestionProps = RadioQuestionParams & {
210
- type: 'radio';
211
- };
212
-
213
- export type SelectQuestionParams = OptionsQuestionParams & {
214
- disableAccessibleAutocomplete?: boolean;
215
- label?: string;
216
- legend?: string;
217
- };
218
-
219
- type SelectQuestionProps = SelectQuestionParams & {
220
- type: 'select';
221
- };
222
-
223
- export type SingleLineInputQuestionParams = CommonQuestionParams & {
224
- inputAttributes?: Record<string, string>; // HTML attributes to add to the input
225
- label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
226
- classes?: string; // HTML classes to add to the input
227
- };
228
-
229
- type SingleLineInputQuestionProps = SingleLineInputQuestionParams & {
230
- type: 'single-line-input';
231
- };
232
-
233
- export type SiteAddressQuestionParams = CommonQuestionParams;
234
-
235
- type SiteAddressQuestionProps = SiteAddressQuestionParams & {
236
- type: 'site-address';
237
- };
238
-
239
- type TextEntryCheckbox = {
240
- header: string;
241
- text: string;
242
- name: string;
243
- errorMessage?: string;
244
- };
245
-
246
- export type TextEntryQuestionParams = CommonQuestionParams & {
247
- textEntryCheckbox?: TextEntryCheckbox;
248
- label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
249
- };
250
-
251
- type TextEntryQuestionProps = TextEntryQuestionParams & {
252
- type: 'text-entry';
253
- };
254
-
255
- export type TextEntryRedactQuestionParams = CommonQuestionParams & {
256
- textEntryCheckbox?: TextEntryCheckbox;
257
- label?: string; // if defined this will show as a label for the input and the question will just be a standard h1
258
- onlyShowRedactedValueForSummary?: boolean;
259
- useRedactedFieldNameForSave?: boolean;
260
- showSuggestionsUi?: boolean;
261
- summaryText?: string; // summaryText to use with the details component
262
- shouldTruncateSummary?: boolean; // determines whether redacted comment is truncated in summary view
263
- };
264
-
265
- type TextEntryRedactQuestionProps = TextEntryRedactQuestionParams & {
266
- type: 'text-entry-redact';
267
- };
268
-
269
- export type UnitOptionEntryQuestionParams = CommonQuestionParams & {
270
- conditionalFieldName: string; // will be the quantity and is captured by the conditional in the options
271
- options: UnitOption[];
272
- label?: string;
273
- };
274
-
275
- type UnitOptionEntryQuestionProps = UnitOptionEntryQuestionParams & {
276
- type: 'unit-option';
277
- };
278
-
279
- export type QuestionProps =
280
- | BooleanQuestionProps
281
- | CheckboxQuestionProps
282
- | DateQuestionProps
283
- | DatePeriodQuestionProps
284
- | DateTimeQuestionProps
285
- | ManageListQuestionProps
286
- | EmailQuestionProps
287
- | MultiFieldInputQuestionProps
288
- | NumberEntryQuestionProps
289
- | RadioQuestionProps
290
- | SelectQuestionProps
291
- | SingleLineInputQuestionProps
292
- | SiteAddressQuestionProps
293
- | TextEntryQuestionProps
294
- | TextEntryRedactQuestionProps
295
- | UnitOptionEntryQuestionProps;
@@ -1,86 +0,0 @@
1
- import type { RouteParams } from '#src/journey/journey-types.d.ts';
2
- import type ManageListQuestion from '#src/components/manage-list/question.js';
3
- import type BaseValidator from '../validator/base-validator.js';
4
- import type { JourneyResponse } from '../journey/journey-response.js';
5
-
6
- export interface QuestionParameters {
7
- title: string;
8
- question: string;
9
- viewFolder: string;
10
- fieldName: string;
11
- url?: string;
12
- pageTitle?: string;
13
- description?: string;
14
- validators?: BaseValidator[];
15
- html?: string;
16
- hint?: string;
17
- interfaceType?: string;
18
- shouldDisplay?: (response: JourneyResponse) => boolean;
19
- autocomplete?: string;
20
- // is this question editable? defaults to true
21
- editable?: boolean;
22
- // override the action link for this question
23
- actionLink?: ActionLink;
24
- // static view data for this question
25
- viewData?: {
26
- /**
27
- * @deprecated replaced by secondaryActions
28
- */
29
- extraActionButtons?: SecondaryAction[];
30
- /**
31
- * Secondary action buttons
32
- */
33
- secondaryActions?: SecondaryAction[];
34
- [key: string]: any;
35
- };
36
- }
37
-
38
- export interface ActionLink {
39
- text: string;
40
- href: string;
41
- }
42
-
43
- export type SecondaryAction = SecondaryActionButton | SecondaryActionLink;
44
-
45
- export interface SecondaryActionButton {
46
- text: string;
47
- type?: string;
48
- formaction?: string;
49
- classes?: string;
50
- }
51
-
52
- export interface SecondaryActionLink {
53
- text: string;
54
- href: string;
55
- classes?: string;
56
- }
57
-
58
- export interface QuestionViewModel {
59
- question: {
60
- value: string | number | Record<string, any>;
61
- question: string;
62
- fieldName: string;
63
- pageTitle: string;
64
- description?: string;
65
- html?: string;
66
- };
67
- layoutTemplate: string;
68
- pageCaption: string;
69
- continueButtonText: string;
70
- backLink: string;
71
- showBackToListLink: string;
72
- listLink: string;
73
- journeyTitle: string;
74
- [k: string]: any;
75
- }
76
-
77
- export interface PrepQuestionForRenderingOptions {
78
- params: RouteParams;
79
- manageListQuestion?: ManageListQuestion;
80
- }
81
-
82
- /**
83
- * Define a question class type so that projects downstream can extend the
84
- * Question class and still pass them to the createQuestions function.
85
- */
86
- export type QuestionClass<TQuestion extends Question = Question> = new (...args: never[]) => TQuestion;
@@ -1,7 +0,0 @@
1
- declare namespace _default {
2
- let _extends: string[];
3
- export { _extends as extends };
4
- export let ignores: ((commit: any) => any)[];
5
- }
6
- export default _default;
7
- //# sourceMappingURL=commitlint.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commitlint.config.d.ts","sourceRoot":"","sources":["../commitlint.config.js"],"names":[],"mappings":""}
@@ -1,97 +0,0 @@
1
- declare const _default: ({
2
- readonly rules: Readonly<import("eslint").Linter.RulesRecord>;
3
- } | {
4
- ignores: string[];
5
- languageOptions: {
6
- ecmaVersion: number;
7
- sourceType: string;
8
- globals: {
9
- __dirname: false;
10
- __filename: false;
11
- AbortController: false;
12
- AbortSignal: false;
13
- AsyncDisposableStack: false;
14
- atob: false;
15
- Blob: false;
16
- BroadcastChannel: false;
17
- btoa: false;
18
- Buffer: false;
19
- ByteLengthQueuingStrategy: false;
20
- clearImmediate: false;
21
- clearInterval: false;
22
- clearTimeout: false;
23
- CloseEvent: false;
24
- CompressionStream: false;
25
- console: false;
26
- CountQueuingStrategy: false;
27
- crypto: false;
28
- Crypto: false;
29
- CryptoKey: false;
30
- CustomEvent: false;
31
- DecompressionStream: false;
32
- DisposableStack: false;
33
- DOMException: false;
34
- ErrorEvent: false;
35
- Event: false;
36
- EventTarget: false;
37
- exports: true;
38
- fetch: false;
39
- File: false;
40
- FormData: false;
41
- global: false;
42
- Headers: false;
43
- localStorage: false;
44
- MessageChannel: false;
45
- MessageEvent: false;
46
- MessagePort: false;
47
- module: false;
48
- navigator: false;
49
- Navigator: false;
50
- performance: false;
51
- Performance: false;
52
- PerformanceEntry: false;
53
- PerformanceMark: false;
54
- PerformanceMeasure: false;
55
- PerformanceObserver: false;
56
- PerformanceObserverEntryList: false;
57
- PerformanceResourceTiming: false;
58
- process: false;
59
- queueMicrotask: false;
60
- QuotaExceededError: false;
61
- ReadableByteStreamController: false;
62
- ReadableStream: false;
63
- ReadableStreamBYOBReader: false;
64
- ReadableStreamBYOBRequest: false;
65
- ReadableStreamDefaultController: false;
66
- ReadableStreamDefaultReader: false;
67
- Request: false;
68
- require: false;
69
- Response: false;
70
- sessionStorage: false;
71
- setImmediate: false;
72
- setInterval: false;
73
- setTimeout: false;
74
- Storage: false;
75
- structuredClone: false;
76
- SubtleCrypto: false;
77
- SuppressedError: false;
78
- Temporal: false;
79
- TextDecoder: false;
80
- TextDecoderStream: false;
81
- TextEncoder: false;
82
- TextEncoderStream: false;
83
- TransformStream: false;
84
- TransformStreamDefaultController: false;
85
- URL: false;
86
- URLPattern: false;
87
- URLSearchParams: false;
88
- WebAssembly: false;
89
- WebSocket: false;
90
- WritableStream: false;
91
- WritableStreamDefaultController: false;
92
- WritableStreamDefaultWriter: false;
93
- };
94
- };
95
- })[];
96
- export default _default;
97
- //# sourceMappingURL=eslint.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eslint.config.d.ts","sourceRoot":"","sources":["../eslint.config.js"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=move-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"move-types.d.ts","sourceRoot":"","sources":["../move-types.js"],"names":[],"mappings":""}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1,33 +0,0 @@
1
- /**
2
- * @typedef ConditionalAnswerObject
3
- * @type {object}
4
- * @property {string} value the checkbox answer
5
- * @property {string} conditional the conditional text input
6
- */
7
- export class CheckboxQuestion extends OptionsQuestion {
8
- /**
9
- * @param {import('../../questions/question-props.d.ts').CheckboxQuestionParams} params
10
- */
11
- constructor({ title, question, fieldName, url, pageTitle, description, options, validators, viewData }: import("../../questions/question-props.d.ts").CheckboxQuestionParams);
12
- /**
13
- * returns the formatted answers values to be used to build task list elements
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
15
- * @param {import('#journey').Journey} journey
16
- * @param {String} sectionSegment
17
- * @returns {Array.<Object>}
18
- */
19
- formatAnswerForSummary(sectionSegment: string, journey: import("#journey").Journey, answer: string | ConditionalAnswerObject): Array<Object>;
20
- }
21
- export default CheckboxQuestion;
22
- export type ConditionalAnswerObject = {
23
- /**
24
- * the checkbox answer
25
- */
26
- value: string;
27
- /**
28
- * the conditional text input
29
- */
30
- conditional: string;
31
- };
32
- import OptionsQuestion from '../../questions/options-question.js';
33
- //# sourceMappingURL=question.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date/question.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IACC;;OAEG;IACH,6CAFW,OAAO,qCAAqC,EAAE,kBAAkB,EAQ1E;IADA,mBAA4B;IAW7B;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAY5B;IAED;;MAwBC;CAoBD;;yBAzFwB,6BAA6B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date-period/question.js"],"names":[],"mappings":"AAOA;;;GAGG;AACH;IACC;;OAEG;IACH,mGAFW,OAAO,qCAAqC,EAAE,wBAAwB,EAuBhF;IAPA,mBAA4B;IAC5B;;;MAAsD;IAEtD,8BAA0B;IAC1B,4BAAsB;IACtB,wEAA+D;IAC/D,sEAA2D;IAkB5D;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,OAAO,mBAAmB,EAAE,eAAe,GACzC,OAAO,CAAE,MAAM,CAAC,CAgC5B;IAED;;MAuCC;CAyCD;;yBA1KwB,WAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/date-time/question.js"],"names":[],"mappings":"AAMA;IACC,kBAAiB;IACjB,kBAAiB;IAEjB;;OAEG;IACH,yDAFW,OAAO,qCAAqC,EAAE,sBAAsB,EAS9E;IAFA,mBAA4B;IAC5B,mBAA4B;IAkB7B;;;;;OAKG,CACH,mBAJW,OAAO,SAAS,EAAE,OAAO,mBACzB,eAAe,GACb,OAAO,CAAE,MAAM,CAAC,CAqB5B;IAED;;MAqCC;;CAoCD;;yBAzIwB,6BAA6B"}
@@ -1,35 +0,0 @@
1
- /**
2
- * @typedef {import('#question').QuestionViewModel} QuestionViewModel
3
- * @typedef {import('#journey').Journey} Journey
4
- * @typedef {import('#journey-response').JourneyResponse} JourneyResponse
5
- * @typedef {import('../../section').Section} Section
6
- * @typedef {import('../../validator/base-validator')} BaseValidator
7
- */
8
- /**
9
- * Email input question that extends SingleLineInputQuestion
10
- * Automatically sets the input type to "email" and adds appropriate attributes
11
- * @class
12
- */
13
- export class EmailQuestion extends SingleLineInputQuestion {
14
- /**
15
- * @param {import('../../questions/question-props.d.ts').EmailQuestionParams} params
16
- */
17
- constructor(params: import("../../questions/question-props.d.ts").EmailQuestionParams);
18
- /**
19
- * Override formatAnswerForSummary to prevent capitalization of email addresses
20
- * Email addresses should remain in their original case (typically lowercase)
21
- * @param {string} sectionSegment
22
- * @param {import('#journey').Journey} journey
23
- * @param {string} answer
24
- * @returns {Array}
25
- */
26
- formatAnswerForSummary(sectionSegment: string, journey: import("#journey").Journey, answer: string): any[];
27
- }
28
- export default EmailQuestion;
29
- export type QuestionViewModel = import("#question").QuestionViewModel;
30
- export type Journey = import("#journey").Journey;
31
- export type JourneyResponse = import("#journey-response").JourneyResponse;
32
- export type Section = any;
33
- export type BaseValidator = any;
34
- import SingleLineInputQuestion from '../single-line-input/question.js';
35
- //# sourceMappingURL=question.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/email/question.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH;;;;GAIG;AACH;IACC;;OAEG;IACH,oBAFW,OAAO,qCAAqC,EAAE,mBAAmB,EAmB3E;IAED;;;;;;;OAOG;IACH,uCALW,MAAM,WACN,OAAO,UAAU,EAAE,OAAO,UAC1B,MAAM,SAMhB;CACD;;gCA/CY,OAAO,WAAW,EAAE,iBAAiB;sBACrC,OAAO,UAAU,EAAE,OAAO;8BAC1B,OAAO,mBAAmB,EAAE,eAAe;;;oCALpB,kCAAkC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"manage-list-actions.d.ts","sourceRoot":"","sources":["../../../../src/components/manage-list/manage-list-actions.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,kCAFU,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,CAAC,CAM5D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"manage-list-section.d.ts","sourceRoot":"","sources":["../../../../src/components/manage-list/manage-list-section.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;IACC,cAEC;IAED;;;;;;OAMG;IACH,2BAFa,OAAO,CAInB;IAED;;;;;OAKG;IACH,sBAJW,OAAO,6BAA6B,EAAE,QAAQ,sBAC9C,OAAO,0BAA0B,EAAE,iBAAiB,GAClD,IAAI,CAYhB;CACD;wBAtCuB,kBAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/manage-list/question.js"],"names":[],"mappings":"AAKA;;;;;;GAMG;AAEH;IAOC;;OAEG;IACH,oBAFW,OAAO,qCAAqC,EAAE,wBAAwB,EAehF;IAcD,wCAEC;IAyDD;;;;OAMC;IAED;;;;QAsBC;IAED,4EAQC;IAoCD,yDAEC;IATD,kDAKC;;CAKD;;;;;;mBArLa,MAAM;;;;;;;;;;;;;;yBAPK,WAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/manage-list/utils.js"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oDALW,OAAO,mCAAmC,EAAE,eAAe,wEAE3D,MAAM,GACJ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQnC;AAED;;;;;;;GAOG;AACH,0DALW,OAAO,mCAAmC,EAAE,eAAe,8DAE3D,OAAO,gCAAgC,EAAE,WAAW,GAClD,OAAO,gCAAgC,EAAE,iBAAiB,CAatE"}
@@ -1,64 +0,0 @@
1
- /**
2
- * @typedef {import('#question').QuestionViewModel} QuestionViewModel
3
- * @typedef {import('#journey').Journey} Journey
4
- * @typedef {import('#journey-response').JourneyResponse} JourneyResponse
5
- * @typedef {import('../../section').Section} Section
6
- * @typedef {import('../../validator/base-validator')} BaseValidator
7
- */
8
- /**
9
- * @class
10
- */
11
- export class MultiFieldInputQuestion extends Question {
12
- /**
13
- * @param {import('../../questions/question-props.d.ts').MultiFieldInputQuestionParams} params
14
- */
15
- constructor({ inputFields, ...parentParams }: import("../../questions/question-props.d.ts").MultiFieldInputQuestionParams);
16
- inputFields: import("../../questions/question-props.d.ts").InputField[];
17
- answerForViewModel(answers: any): {
18
- value: string;
19
- fieldName: string;
20
- label: string;
21
- formatJoinString?: string;
22
- formatPrefix?: string;
23
- formatTextFunction?: (text: string) => string;
24
- attributes?: Record<string, string>;
25
- suffix?: import("../../questions/question-props.d.ts").Affix;
26
- prefix?: import("../../questions/question-props.d.ts").Affix;
27
- hint?: string;
28
- classes?: string;
29
- inputmode?: "decimal" | "numeric";
30
- pattern?: string;
31
- }[];
32
- /**
33
- * returns the formatted answers values to be used to build task list elements
34
- * @param {Journey} journey
35
- * @param {String} sectionSegment
36
- * @returns {Array<{
37
- * key: string;
38
- * value: string | Object;
39
- * action: {
40
- * href: string;
41
- * text: string;
42
- * visuallyHiddenText: string;
43
- * };
44
- * }>}
45
- */
46
- formatAnswerForSummary(sectionSegment: string, journey: Journey): Array<{
47
- key: string;
48
- value: string | Object;
49
- action: {
50
- href: string;
51
- text: string;
52
- visuallyHiddenText: string;
53
- };
54
- }>;
55
- #private;
56
- }
57
- export default MultiFieldInputQuestion;
58
- export type QuestionViewModel = import("#question").QuestionViewModel;
59
- export type Journey = import("#journey").Journey;
60
- export type JourneyResponse = import("#journey-response").JourneyResponse;
61
- export type Section = any;
62
- export type BaseValidator = any;
63
- import { Question } from '#question';
64
- //# sourceMappingURL=question.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../../src/components/multi-field-input/question.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AAEH;;GAEG;AACH;IACC;;OAEG;IACH,8CAFW,OAAO,qCAAqC,EAAE,6BAA6B,EAarF;IAJC,wEAA8B;IAchC;;;;;;;;;;;;;;QAOC;IAsBD;;;;;;;;;;;;;OAaG;IACH,wDAZW,OAAO,GAEL,KAAK,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;QACvB,MAAM,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,EAAE,MAAM,CAAC;YACb,kBAAkB,EAAE,MAAM,CAAC;SAC5B,CAAC;KACH,CAAC,CAkBJ;;CAyBD;;gCAvHY,OAAO,WAAW,EAAE,iBAAiB;sBACrC,OAAO,UAAU,EAAE,OAAO;8BAC1B,OAAO,mBAAmB,EAAE,eAAe;;;yBAP/B,WAAW"}