@defra/forms-model 3.0.506 → 3.0.508

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.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\nimport { type DefaultComponent, type GovukFieldset } from '~/src/index.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n readonly repeaterButton?: {\n text: string\n classes: string\n }\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/macros/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport {\n type DateItem,\n type GovukField,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\nimport { type DefaultComponent, type GovukFieldset } from '~/src/index.js'\n\nexport interface AppPreviewErrorPanelMacroErrorTemplate {\n advancedSettingsErrors: []\n baseErrors: { template: unknown; type: string }[]\n}\n\nexport interface AppPreviewErrorPanelMacro {\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n fieldDetails: {\n extraFields: GovukField[]\n basePageFields: GovukField[]\n }\n questionType: ComponentType\n}\n\nexport interface AppPreviewPanelTabsMacro {\n questionType: ComponentType\n previewPageUrl: string\n previewErrorsUrl: string\n errorTemplates: AppPreviewErrorPanelMacroErrorTemplate\n extraFields: GovukField[]\n basePageFields: GovukField[]\n}\n\nexport interface SelectAfterInput {\n afterInput: { html: string }\n}\nexport interface RadioAndCheckboxAfterInputs {\n afterInputs: { html: string }\n}\n\n// GDS components - Select uses afterInput, while Radio uses afterInputs\nexport type FormGroupAfterInput = SelectAfterInput | RadioAndCheckboxAfterInputs\n\nexport interface QuestionBaseModel {\n id?: string\n name?: string\n content?: string\n attributes?: Record<string, string>\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: FormGroupAfterInput\n type?: 'text' | 'number' | 'boolean'\n classes?: string\n}\n\nexport interface AppPreviewPanelMacro extends AppPreviewPanelTabsMacro {\n model: QuestionBaseModel\n}\n\nexport interface PagePreviewComponent {\n model: QuestionBaseModel\n questionType: ComponentType\n}\n\nexport interface PagePreviewPanelMacro {\n readonly pageTitle: {\n text: string\n classes: string\n }\n readonly guidance: {\n text: string\n classes: string\n }\n readonly components: PagePreviewComponent[]\n readonly sectionTitle?: {\n text: string\n classes: string\n }\n readonly repeaterButton?: {\n text: string\n classes: string\n }\n}\n\nexport interface SummaryRowActionItem {\n href: string\n text: string\n visuallyHiddenText: string\n}\n\nexport interface SummaryRow {\n key: { text: string }\n value: { text: string }\n actions: {\n items: SummaryRowActionItem[]\n }\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,151 @@
1
+ import { hasFormField } from "../../../../components/helpers.js";
2
+ import { HIGHLIGHT_CLASS } from "../constants.js";
3
+ import { PreviewPageControllerBase } from "./page-controller-base.js";
4
+ import { hasComponents } from "../../../../pages/helpers.js";
5
+ const EXAMPLE_TEXT = 'Answer goes here';
6
+ export class SummaryPageController extends PreviewPageControllerBase {
7
+ /**
8
+ * @type {string}
9
+ * @protected
10
+ */
11
+ _pageTemplate = PreviewPageControllerBase.PATH + 'summary-controller.njk';
12
+ /**
13
+ * @type {Markdown}
14
+ * @protected
15
+ */
16
+ _guidanceComponent = PreviewPageControllerBase.createGuidanceComponent(false);
17
+ /**
18
+ * @type {FormComponentsDef[]}
19
+ * @private
20
+ */
21
+ _componentDefs = [];
22
+ /**
23
+ * @type {boolean}
24
+ * @private
25
+ */
26
+ _makeDeclaration = false;
27
+ /**
28
+ * @param {SummaryPageElements} elements
29
+ * @param {FormDefinition} formDefinition
30
+ * @param {PageRenderer} renderer
31
+ */
32
+ constructor(elements, formDefinition, renderer) {
33
+ super(elements, renderer);
34
+ this._componentDefs = formDefinition.pages.flatMap(page => {
35
+ if (hasComponents(page)) {
36
+ return page.components.filter(hasFormField);
37
+ }
38
+ return [];
39
+ });
40
+ this._makeDeclaration = elements.declaration;
41
+ this._guidanceComponent.content = elements.guidance;
42
+ }
43
+
44
+ /**
45
+ * @returns {{ rows: SummaryRow[] }}
46
+ */
47
+ get componentRows() {
48
+ const rows = this._componentDefs.map(component => {
49
+ const summaryRowHeading = component.shortDescription ?? '';
50
+ return {
51
+ key: {
52
+ text: summaryRowHeading
53
+ },
54
+ value: {
55
+ text: EXAMPLE_TEXT
56
+ },
57
+ actions: {
58
+ items: [{
59
+ href: '#',
60
+ text: 'Change',
61
+ visuallyHiddenText: summaryRowHeading
62
+ }]
63
+ }
64
+ };
65
+ });
66
+ return {
67
+ rows
68
+ };
69
+ }
70
+
71
+ /**
72
+ * @returns {{ text: string; classes: string }}
73
+ */
74
+ get pageTitle() {
75
+ return {
76
+ text: 'Check your answers before sending your form',
77
+ classes: ''
78
+ };
79
+ }
80
+ get guidance() {
81
+ if (!this._makeDeclaration) {
82
+ return {
83
+ classes: '',
84
+ text: ''
85
+ };
86
+ }
87
+ const guidanceHighlighted = this._highlighted === 'guidance';
88
+ const classes = guidanceHighlighted ? HIGHLIGHT_CLASS : '';
89
+ let text = this._guidanceText.length ? this._guidanceText : '';
90
+ if (!text.length && guidanceHighlighted) {
91
+ text = 'Declaration text';
92
+ }
93
+ return {
94
+ text,
95
+ classes
96
+ };
97
+ }
98
+
99
+ /**
100
+ * @param {string} declarationText
101
+ */
102
+ set declarationText(declarationText) {
103
+ this.guidanceText = declarationText;
104
+ }
105
+ get declarationText() {
106
+ return this.guidanceText;
107
+ }
108
+ get declaration() {
109
+ return this.guidance;
110
+ }
111
+ setMakeDeclaration() {
112
+ this._makeDeclaration = true;
113
+ this.render();
114
+ }
115
+ unsetMakeDeclaration() {
116
+ this._makeDeclaration = false;
117
+ this.render();
118
+ }
119
+ get makeDeclaration() {
120
+ return this._makeDeclaration;
121
+ }
122
+ highlightDeclaration() {
123
+ this.highlightGuidance();
124
+ }
125
+ unhighlightDeclaration() {
126
+ this.clearHighlight();
127
+ }
128
+
129
+ /**
130
+ * @returns {Markdown[]}
131
+ * @protected
132
+ */
133
+ _getGuidanceComponents() {
134
+ if (!this._makeDeclaration) {
135
+ return [];
136
+ }
137
+ return super._getGuidanceComponents();
138
+ }
139
+ get buttonText() {
140
+ return this.makeDeclaration ? 'Accept and send' : 'Send';
141
+ }
142
+ }
143
+
144
+ /**
145
+ * @import { ComponentDef, ContentComponentsDef, ListComponent, FormComponentsDef } from '~/src/components/types.js'
146
+ * @import { FormDefinition } from '~/src/form/form-definition/types.js'
147
+ * @import { PageRenderer, PagePreviewBaseElements, SummaryPageElements } from '~/src/form/form-editor/preview/types.js'
148
+ * @import { SummaryRowActionItem, SummaryRow } from '~/src/form/form-editor/macros/types.js'
149
+ * @import { Markdown } from '~/src/form/form-editor/preview/markdown.js'
150
+ */
151
+ //# sourceMappingURL=summary-page-controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary-page-controller.js","names":["hasFormField","HIGHLIGHT_CLASS","PreviewPageControllerBase","hasComponents","EXAMPLE_TEXT","SummaryPageController","_pageTemplate","PATH","_guidanceComponent","createGuidanceComponent","_componentDefs","_makeDeclaration","constructor","elements","formDefinition","renderer","pages","flatMap","page","components","filter","declaration","content","guidance","componentRows","rows","map","component","summaryRowHeading","shortDescription","key","text","value","actions","items","href","visuallyHiddenText","pageTitle","classes","guidanceHighlighted","_highlighted","_guidanceText","length","declarationText","guidanceText","setMakeDeclaration","render","unsetMakeDeclaration","makeDeclaration","highlightDeclaration","highlightGuidance","unhighlightDeclaration","clearHighlight","_getGuidanceComponents","buttonText"],"sources":["../../../../../../src/form/form-editor/preview/controller/summary-page-controller.js"],"sourcesContent":["import { hasFormField } from '~/src/components/helpers.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { PreviewPageControllerBase } from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nimport { hasComponents } from '~/src/pages/helpers.js'\n\nconst EXAMPLE_TEXT = 'Answer goes here'\n\nexport class SummaryPageController extends PreviewPageControllerBase {\n /**\n * @type {string}\n * @protected\n */\n _pageTemplate = PreviewPageControllerBase.PATH + 'summary-controller.njk'\n /**\n * @type {Markdown}\n * @protected\n */\n _guidanceComponent = PreviewPageControllerBase.createGuidanceComponent(false)\n /**\n * @type {FormComponentsDef[]}\n * @private\n */\n _componentDefs = []\n /**\n * @type {boolean}\n * @private\n */\n _makeDeclaration = false\n /**\n * @param {SummaryPageElements} elements\n * @param {FormDefinition} formDefinition\n * @param {PageRenderer} renderer\n */\n constructor(elements, formDefinition, renderer) {\n super(elements, renderer)\n this._componentDefs = formDefinition.pages.flatMap((page) => {\n if (hasComponents(page)) {\n return page.components.filter(hasFormField)\n }\n return []\n })\n this._makeDeclaration = elements.declaration\n\n this._guidanceComponent.content = elements.guidance\n }\n\n /**\n * @returns {{ rows: SummaryRow[] }}\n */\n get componentRows() {\n const rows = this._componentDefs.map((component) => {\n const summaryRowHeading = component.shortDescription ?? ''\n return {\n key: { text: summaryRowHeading },\n value: { text: EXAMPLE_TEXT },\n actions: {\n items: [\n { href: '#', text: 'Change', visuallyHiddenText: summaryRowHeading }\n ]\n }\n }\n })\n return {\n rows\n }\n }\n\n /**\n * @returns {{ text: string; classes: string }}\n */\n get pageTitle() {\n return {\n text: 'Check your answers before sending your form',\n classes: ''\n }\n }\n\n get guidance() {\n if (!this._makeDeclaration) {\n return {\n classes: '',\n text: ''\n }\n }\n const guidanceHighlighted = this._highlighted === 'guidance'\n const classes = guidanceHighlighted ? HIGHLIGHT_CLASS : ''\n let text = this._guidanceText.length ? this._guidanceText : ''\n\n if (!text.length && guidanceHighlighted) {\n text = 'Declaration text'\n }\n return {\n text,\n classes\n }\n }\n\n /**\n * @param {string} declarationText\n */\n set declarationText(declarationText) {\n this.guidanceText = declarationText\n }\n\n get declarationText() {\n return this.guidanceText\n }\n\n get declaration() {\n return this.guidance\n }\n\n setMakeDeclaration() {\n this._makeDeclaration = true\n this.render()\n }\n\n unsetMakeDeclaration() {\n this._makeDeclaration = false\n this.render()\n }\n\n get makeDeclaration() {\n return this._makeDeclaration\n }\n\n highlightDeclaration() {\n this.highlightGuidance()\n }\n\n unhighlightDeclaration() {\n this.clearHighlight()\n }\n\n /**\n * @returns {Markdown[]}\n * @protected\n */\n _getGuidanceComponents() {\n if (!this._makeDeclaration) {\n return []\n }\n return super._getGuidanceComponents()\n }\n\n get buttonText() {\n return this.makeDeclaration ? 'Accept and send' : 'Send'\n }\n}\n\n/**\n * @import { ComponentDef, ContentComponentsDef, ListComponent, FormComponentsDef } from '~/src/components/types.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { PageRenderer, PagePreviewBaseElements, SummaryPageElements } from '~/src/form/form-editor/preview/types.js'\n * @import { SummaryRowActionItem, SummaryRow } from '~/src/form/form-editor/macros/types.js'\n * @import { Markdown } from '~/src/form/form-editor/preview/markdown.js'\n */\n"],"mappings":"AAAA,SAASA,YAAY;AACrB,SAASC,eAAe;AACxB,SAASC,yBAAyB;AAClC,SAASC,aAAa;AAEtB,MAAMC,YAAY,GAAG,kBAAkB;AAEvC,OAAO,MAAMC,qBAAqB,SAASH,yBAAyB,CAAC;EACnE;AACF;AACA;AACA;EACEI,aAAa,GAAGJ,yBAAyB,CAACK,IAAI,GAAG,wBAAwB;EACzE;AACF;AACA;AACA;EACEC,kBAAkB,GAAGN,yBAAyB,CAACO,uBAAuB,CAAC,KAAK,CAAC;EAC7E;AACF;AACA;AACA;EACEC,cAAc,GAAG,EAAE;EACnB;AACF;AACA;AACA;EACEC,gBAAgB,GAAG,KAAK;EACxB;AACF;AACA;AACA;AACA;EACEC,WAAWA,CAACC,QAAQ,EAAEC,cAAc,EAAEC,QAAQ,EAAE;IAC9C,KAAK,CAACF,QAAQ,EAAEE,QAAQ,CAAC;IACzB,IAAI,CAACL,cAAc,GAAGI,cAAc,CAACE,KAAK,CAACC,OAAO,CAAEC,IAAI,IAAK;MAC3D,IAAIf,aAAa,CAACe,IAAI,CAAC,EAAE;QACvB,OAAOA,IAAI,CAACC,UAAU,CAACC,MAAM,CAACpB,YAAY,CAAC;MAC7C;MACA,OAAO,EAAE;IACX,CAAC,CAAC;IACF,IAAI,CAACW,gBAAgB,GAAGE,QAAQ,CAACQ,WAAW;IAE5C,IAAI,CAAC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IACnC,IAAI,CAACC,YAAY,GAAGD,eAAe;EACrC;EAEA,IAAIA,eAAeA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACC,YAAY;EAC1B;EAEA,IAAIvB,WAAWA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACE,QAAQ;EACtB;EAEAsB,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAAClC,gBAAgB,GAAG,IAAI;IAC5B,IAAI,CAACmC,MAAM,CAAC,CAAC;EACf;EAEAC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAACpC,gBAAgB,GAAG,KAAK;IAC7B,IAAI,CAACmC,MAAM,CAAC,CAAC;EACf;EAEA,IAAIE,eAAeA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACrC,gBAAgB;EAC9B;EAEAsC,oBAAoBA,CAAA,EAAG;IACrB,IAAI,CAACC,iBAAiB,CAAC,CAAC;EAC1B;EAEAC,sBAAsBA,CAAA,EAAG;IACvB,IAAI,CAACC,cAAc,CAAC,CAAC;EACvB;;EAEA;AACF;AACA;AACA;EACEC,sBAAsBA,CAAA,EAAG;IACvB,IAAI,CAAC,IAAI,CAAC1C,gBAAgB,EAAE;MAC1B,OAAO,EAAE;IACX;IACA,OAAO,KAAK,CAAC0C,sBAAsB,CAAC,CAAC;EACvC;EAEA,IAAIC,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACN,eAAe,GAAG,iBAAiB,GAAG,MAAM;EAC1D;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -22,5 +22,6 @@ export * from "./uk-address.js";
22
22
  export * from "./yes-no.js";
23
23
  export * from "./controller/page-controller.js";
24
24
  export * from "./controller/guidance-page-controller.js";
25
+ export * from "./controller/summary-page-controller.js";
25
26
  export * from "./controller/page-controller-base.js";
26
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/autocomplete.js'\nexport * from '~/src/form/form-editor/preview/checkbox.js'\nexport * from '~/src/form/form-editor/preview/checkbox-sortable.js'\nexport * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/markdown.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/select.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/supporting-evidence.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/form/form-editor/preview/index.js"],"sourcesContent":["export * from '~/src/form/form-editor/preview/autocomplete.js'\nexport * from '~/src/form/form-editor/preview/checkbox.js'\nexport * from '~/src/form/form-editor/preview/checkbox-sortable.js'\nexport * from '~/src/form/form-editor/preview/date-input.js'\nexport * from '~/src/form/form-editor/preview/email-address.js'\nexport * from '~/src/form/form-editor/preview/list.js'\nexport * from '~/src/form/form-editor/preview/list-sortable.js'\nexport * from '~/src/form/form-editor/preview/markdown.js'\nexport * from '~/src/form/form-editor/preview/month-year.js'\nexport * from '~/src/form/form-editor/preview/number-only.js'\nexport * from '~/src/form/form-editor/preview/phone-number.js'\nexport * from '~/src/form/form-editor/preview/question.js'\nexport * from '~/src/form/form-editor/preview/radio.js'\nexport * from '~/src/form/form-editor/preview/radio-sortable.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/short-answer.js'\nexport * from '~/src/form/form-editor/preview/select.js'\nexport * from '~/src/form/form-editor/preview/select-sortable.js'\nexport * from '~/src/form/form-editor/preview/supporting-evidence.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\nexport * from '~/src/form/form-editor/preview/yes-no.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/summary-page-controller.js'\nexport * from '~/src/form/form-editor/preview/controller/page-controller-base.js'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n attributes?: Record<string, string>\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface DomElementsBase {\n readonly values?: BaseSettings\n autocompleteOptions?: string\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\n\nexport interface QuestionElements extends DomElementsBase {\n readonly values: BaseSettings\n}\n\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderBase {\n render(questionTemplate: string, renderContext: RenderContext): void\n}\n\nexport interface QuestionRenderContext {\n model: QuestionBaseModel\n}\n\nexport interface PageRenderContext {\n params: PagePreviewPanelMacro\n}\n\nexport type RenderContext = QuestionRenderContext | PageRenderContext\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport type Renderer = QuestionRenderer | PageRenderer\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PagePreviewBaseElements {\n heading: string\n guidance: string\n}\n\nexport interface PageOverviewElements extends PagePreviewBaseElements {\n addHeading: boolean\n repeatQuestion: string | undefined\n hasRepeater: boolean\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import {\n type PagePreviewPanelMacro,\n type QuestionBaseModel\n} from '~/src/form/form-editor/macros/types.js'\nimport { type AutocompleteQuestion } from '~/src/form/form-editor/preview/autocomplete.js'\nimport { type DateInputQuestion } from '~/src/form/form-editor/preview/date-input.js'\nimport { type EmailAddressQuestion } from '~/src/form/form-editor/preview/email-address.js'\nimport { type ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { type LongAnswerQuestion } from '~/src/form/form-editor/preview/long-answer.js'\nimport { type PhoneNumberQuestion } from '~/src/form/form-editor/preview/phone-number.js'\nimport { type Question } from '~/src/form/form-editor/preview/question.js'\nimport { type RadioSortableQuestion } from '~/src/form/form-editor/preview/radio-sortable.js'\nimport { type SelectSortableQuestion } from '~/src/form/form-editor/preview/select-sortable.js'\nimport { type ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport { type ListElement } from '~/src/form/form-editor/types.js'\nexport { type QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\n content: string\n attributes?: Record<string, string>\n}\n\nexport interface DefaultComponent {\n id?: string\n text: string\n classes: string\n}\n\nexport interface GovukFieldset {\n legend: DefaultComponent\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface DomElementsBase {\n readonly values?: BaseSettings\n autocompleteOptions?: string\n setPreviewHTML(value: string): void\n setPreviewDOM(element: HTMLElement): void\n}\n\nexport interface QuestionElements extends DomElementsBase {\n readonly values: BaseSettings\n}\n\nexport interface AutocompleteElements extends QuestionElements {\n autocompleteOptions: string\n}\n\nexport interface RenderBase {\n render(questionTemplate: string, renderContext: RenderContext): void\n}\n\nexport interface QuestionRenderContext {\n model: QuestionBaseModel\n}\n\nexport interface PageRenderContext {\n params: PagePreviewPanelMacro\n}\n\nexport type RenderContext = QuestionRenderContext | PageRenderContext\n\nexport interface HTMLBuilder {\n buildHTML(questionTemplate: string, renderContext: RenderContext): string\n}\n\nexport interface QuestionRenderer {\n render(questionTemplate: string, questionBaseModel: QuestionBaseModel): void\n}\n\nexport interface PageRenderer {\n render(pageTemplate: string, pagePreview: PagePreviewPanelMacro): void\n}\n\nexport type Renderer = QuestionRenderer | PageRenderer\n\nexport interface ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport interface PagePreviewBaseElements {\n heading: string\n guidance: string\n}\n\nexport interface PageOverviewElements extends PagePreviewBaseElements {\n addHeading: boolean\n repeatQuestion: string | undefined\n hasRepeater: boolean\n}\n\nexport interface SummaryPageElements extends PagePreviewBaseElements {\n declaration: boolean\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | SelectSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n | AutocompleteQuestion\n"],"mappings":"","ignoreList":[]}
@@ -22,6 +22,7 @@ export class YesNoQuestion extends FieldsetQuestion {
22
22
  */
23
23
  return {
24
24
  type: 'boolean',
25
+ classes: 'govuk-radios--inline',
25
26
  items: (/** @type {ListElement[]} */[{
26
27
  id: 'yesNo-yes',
27
28
  text: 'Yes',
@@ -1 +1 @@
1
- {"version":3,"file":"yes-no.js","names":["ComponentType","FieldsetQuestion","PreviewComponent","YesNoQuestion","componentType","YesNoField","_questionTemplate","PATH","_fieldName","customRenderFields","type","items","id","text","value","label","classes"],"sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class YesNoQuestion extends FieldsetQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.YesNoField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'radios.njk'\n _fieldName = 'yesNo'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n /**\n *\n */\n return {\n type: 'boolean',\n items: /** @type {ListElement[]} */ ([\n {\n id: 'yesNo-yes',\n text: 'Yes',\n value: true,\n label: {\n text: 'Yes',\n classes: ''\n }\n },\n {\n id: 'yesNo-no',\n text: 'No',\n value: false,\n label: {\n text: 'No',\n classes: ''\n }\n }\n ])\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,aAAa,SAASF,gBAAgB,CAAC;EAClD;AACF;AACA;EACEG,aAAa,GAAGJ,aAAa,CAACK,UAAU;EACxC;AACF;AACA;AACA;EACEC,iBAAiB,GAAGJ,gBAAgB,CAACK,IAAI,GAAG,YAAY;EACxDC,UAAU,GAAG,OAAO;;EAEpB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB;AACJ;AACA;IACI,OAAO;MACLC,IAAI,EAAE,SAAS;MACfC,KAAK,GAAE,4BAA8B,CACnC;QACEC,EAAE,EAAE,WAAW;QACfC,IAAI,EAAE,KAAK;QACXC,KAAK,EAAE,IAAI;QACXC,KAAK,EAAE;UACLF,IAAI,EAAE,KAAK;UACXG,OAAO,EAAE;QACX;MACF,CAAC,EACD;QACEJ,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,IAAI;QACVC,KAAK,EAAE,KAAK;QACZC,KAAK,EAAE;UACLF,IAAI,EAAE,IAAI;UACVG,OAAO,EAAE;QACX;MACF,CAAC,CACF;IACH,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"yes-no.js","names":["ComponentType","FieldsetQuestion","PreviewComponent","YesNoQuestion","componentType","YesNoField","_questionTemplate","PATH","_fieldName","customRenderFields","type","classes","items","id","text","value","label"],"sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class YesNoQuestion extends FieldsetQuestion {\n /**\n * @type {ComponentType}\n */\n componentType = ComponentType.YesNoField\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = PreviewComponent.PATH + 'radios.njk'\n _fieldName = 'yesNo'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n /**\n *\n */\n return {\n type: 'boolean',\n classes: 'govuk-radios--inline',\n items: /** @type {ListElement[]} */ ([\n {\n id: 'yesNo-yes',\n text: 'Yes',\n value: true,\n label: {\n text: 'Yes',\n classes: ''\n }\n },\n {\n id: 'yesNo-no',\n text: 'No',\n value: false,\n label: {\n text: 'No',\n classes: ''\n }\n }\n ])\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,gBAAgB;AACzB,SAASC,gBAAgB;AAEzB,OAAO,MAAMC,aAAa,SAASF,gBAAgB,CAAC;EAClD;AACF;AACA;EACEG,aAAa,GAAGJ,aAAa,CAACK,UAAU;EACxC;AACF;AACA;AACA;EACEC,iBAAiB,GAAGJ,gBAAgB,CAACK,IAAI,GAAG,YAAY;EACxDC,UAAU,GAAG,OAAO;;EAEpB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB;AACJ;AACA;IACI,OAAO;MACLC,IAAI,EAAE,SAAS;MACfC,OAAO,EAAE,sBAAsB;MAC/BC,KAAK,GAAE,4BAA8B,CACnC;QACEC,EAAE,EAAE,WAAW;QACfC,IAAI,EAAE,KAAK;QACXC,KAAK,EAAE,IAAI;QACXC,KAAK,EAAE;UACLF,IAAI,EAAE,KAAK;UACXH,OAAO,EAAE;QACX;MACF,CAAC,EACD;QACEE,EAAE,EAAE,UAAU;QACdC,IAAI,EAAE,IAAI;QACVC,KAAK,EAAE,KAAK;QACZC,KAAK,EAAE;UACLF,IAAI,EAAE,IAAI;UACVH,OAAO,EAAE;QACX;MACF,CAAC,CACF;IACH,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
@@ -75,4 +75,20 @@ export interface PagePreviewPanelMacro {
75
75
  classes: string;
76
76
  };
77
77
  }
78
+ export interface SummaryRowActionItem {
79
+ href: string;
80
+ text: string;
81
+ visuallyHiddenText: string;
82
+ }
83
+ export interface SummaryRow {
84
+ key: {
85
+ text: string;
86
+ };
87
+ value: {
88
+ text: string;
89
+ };
90
+ actions: {
91
+ items: SummaryRowActionItem[];
92
+ };
93
+ }
78
94
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/macros/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC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AA;IACvB,OAAO,EAAE;QACP,KAAK,EAAE,oBAAoB,EAAE,CAAA;KAC9B,CAAA;CACF"}
@@ -0,0 +1,45 @@
1
+ export class SummaryPageController extends PreviewPageControllerBase {
2
+ /**
3
+ * @param {SummaryPageElements} elements
4
+ * @param {FormDefinition} formDefinition
5
+ * @param {PageRenderer} renderer
6
+ */
7
+ constructor(elements: SummaryPageElements, formDefinition: FormDefinition, renderer: PageRenderer);
8
+ /**
9
+ * @type {FormComponentsDef[]}
10
+ * @private
11
+ */
12
+ private _componentDefs;
13
+ /**
14
+ * @type {boolean}
15
+ * @private
16
+ */
17
+ private _makeDeclaration;
18
+ /**
19
+ * @returns {{ rows: SummaryRow[] }}
20
+ */
21
+ get componentRows(): {
22
+ rows: SummaryRow[];
23
+ };
24
+ /**
25
+ * @param {string} declarationText
26
+ */
27
+ set declarationText(declarationText: string);
28
+ get declarationText(): string;
29
+ get declaration(): {
30
+ classes: string;
31
+ text: string;
32
+ };
33
+ setMakeDeclaration(): void;
34
+ unsetMakeDeclaration(): void;
35
+ get makeDeclaration(): boolean;
36
+ highlightDeclaration(): void;
37
+ unhighlightDeclaration(): void;
38
+ get buttonText(): "Accept and send" | "Send";
39
+ }
40
+ import { PreviewPageControllerBase } from '../../../../form/form-editor/preview/controller/page-controller-base.js';
41
+ import type { SummaryRow } from '../../../../form/form-editor/macros/types.js';
42
+ import type { SummaryPageElements } from '../../../../form/form-editor/preview/types.js';
43
+ import type { FormDefinition } from '../../../../form/form-definition/types.js';
44
+ import type { PageRenderer } from '../../../../form/form-editor/preview/types.js';
45
+ //# sourceMappingURL=summary-page-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summary-page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/summary-page-controller.js"],"names":[],"mappings":"AAOA;IAqBE;;;;OAIG;IACH,sBAJW,mBAAmB,kBACnB,cAAc,YACd,YAAY,EAatB;IA1BD;;;OAGG;IACH,uBAAmB;IACnB;;;OAGG;IACH,yBAAwB;IAmBxB;;OAEG;IACH,qBAFa;QAAE,IAAI,EAAE,UAAU,EAAE,CAAA;KAAE,CAkBlC;IAgCD;;OAEG;IACH,qCAFW,MAAM,EAIhB;IAED,uBANW,MAAM,CAQhB;IAED;;;MAEC;IAED,2BAGC;IAED,6BAGC;IAED,+BAEC;IAED,6BAEC;IAED,+BAEC;IAaD,6CAEC;CACF;0CAlJyC,mEAAmE;gCAwJxD,wCAAwC;yCADd,yCAAyC;oCADrF,qCAAqC;kCACO,yCAAyC"}
@@ -22,5 +22,6 @@ export * from "../../../form/form-editor/preview/uk-address.js";
22
22
  export * from "../../../form/form-editor/preview/yes-no.js";
23
23
  export * from "../../../form/form-editor/preview/controller/page-controller.js";
24
24
  export * from "../../../form/form-editor/preview/controller/guidance-page-controller.js";
25
+ export * from "../../../form/form-editor/preview/controller/summary-page-controller.js";
25
26
  export * from "../../../form/form-editor/preview/controller/page-controller-base.js";
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -78,5 +78,8 @@ export interface PageOverviewElements extends PagePreviewBaseElements {
78
78
  repeatQuestion: string | undefined;
79
79
  hasRepeater: boolean;
80
80
  }
81
+ export interface SummaryPageElements extends PagePreviewBaseElements {
82
+ declaration: boolean;
83
+ }
81
84
  export type PreviewQuestion = DateInputQuestion | EmailAddressQuestion | ListSortableQuestion | LongAnswerQuestion | PhoneNumberQuestion | Question | RadioSortableQuestion | SelectSortableQuestion | ShortAnswerQuestion | UkAddressQuestion | AutocompleteQuestion;
82
85
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACvB,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,gDAAgD,CAAA;AAC1F,OAAO,EAAE,KAAK,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B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"yes-no.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"names":[],"mappings":"AAIA;CA2CC;iCA9CgC,qDAAqD"}
1
+ {"version":3,"file":"yes-no.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"names":[],"mappings":"AAIA;CA4CC;iCA/CgC,qDAAqD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/forms-model",
3
- "version": "3.0.506",
3
+ "version": "3.0.508",
4
4
  "description": "A hapi plugin providing the model for Defra forms",
5
5
  "homepage": "https://github.com/DEFRA/forms-designer/tree/main/model#readme",
6
6
  "types": "dist/types/index.d.ts",
@@ -82,3 +82,17 @@ export interface PagePreviewPanelMacro {
82
82
  classes: string
83
83
  }
84
84
  }
85
+
86
+ export interface SummaryRowActionItem {
87
+ href: string
88
+ text: string
89
+ visuallyHiddenText: string
90
+ }
91
+
92
+ export interface SummaryRow {
93
+ key: { text: string }
94
+ value: { text: string }
95
+ actions: {
96
+ items: SummaryRowActionItem[]
97
+ }
98
+ }
@@ -0,0 +1,157 @@
1
+ import { hasFormField } from '~/src/components/helpers.js'
2
+ import { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'
3
+ import { PreviewPageControllerBase } from '~/src/form/form-editor/preview/controller/page-controller-base.js'
4
+ import { hasComponents } from '~/src/pages/helpers.js'
5
+
6
+ const EXAMPLE_TEXT = 'Answer goes here'
7
+
8
+ export class SummaryPageController extends PreviewPageControllerBase {
9
+ /**
10
+ * @type {string}
11
+ * @protected
12
+ */
13
+ _pageTemplate = PreviewPageControllerBase.PATH + 'summary-controller.njk'
14
+ /**
15
+ * @type {Markdown}
16
+ * @protected
17
+ */
18
+ _guidanceComponent = PreviewPageControllerBase.createGuidanceComponent(false)
19
+ /**
20
+ * @type {FormComponentsDef[]}
21
+ * @private
22
+ */
23
+ _componentDefs = []
24
+ /**
25
+ * @type {boolean}
26
+ * @private
27
+ */
28
+ _makeDeclaration = false
29
+ /**
30
+ * @param {SummaryPageElements} elements
31
+ * @param {FormDefinition} formDefinition
32
+ * @param {PageRenderer} renderer
33
+ */
34
+ constructor(elements, formDefinition, renderer) {
35
+ super(elements, renderer)
36
+ this._componentDefs = formDefinition.pages.flatMap((page) => {
37
+ if (hasComponents(page)) {
38
+ return page.components.filter(hasFormField)
39
+ }
40
+ return []
41
+ })
42
+ this._makeDeclaration = elements.declaration
43
+
44
+ this._guidanceComponent.content = elements.guidance
45
+ }
46
+
47
+ /**
48
+ * @returns {{ rows: SummaryRow[] }}
49
+ */
50
+ get componentRows() {
51
+ const rows = this._componentDefs.map((component) => {
52
+ const summaryRowHeading = component.shortDescription ?? ''
53
+ return {
54
+ key: { text: summaryRowHeading },
55
+ value: { text: EXAMPLE_TEXT },
56
+ actions: {
57
+ items: [
58
+ { href: '#', text: 'Change', visuallyHiddenText: summaryRowHeading }
59
+ ]
60
+ }
61
+ }
62
+ })
63
+ return {
64
+ rows
65
+ }
66
+ }
67
+
68
+ /**
69
+ * @returns {{ text: string; classes: string }}
70
+ */
71
+ get pageTitle() {
72
+ return {
73
+ text: 'Check your answers before sending your form',
74
+ classes: ''
75
+ }
76
+ }
77
+
78
+ get guidance() {
79
+ if (!this._makeDeclaration) {
80
+ return {
81
+ classes: '',
82
+ text: ''
83
+ }
84
+ }
85
+ const guidanceHighlighted = this._highlighted === 'guidance'
86
+ const classes = guidanceHighlighted ? HIGHLIGHT_CLASS : ''
87
+ let text = this._guidanceText.length ? this._guidanceText : ''
88
+
89
+ if (!text.length && guidanceHighlighted) {
90
+ text = 'Declaration text'
91
+ }
92
+ return {
93
+ text,
94
+ classes
95
+ }
96
+ }
97
+
98
+ /**
99
+ * @param {string} declarationText
100
+ */
101
+ set declarationText(declarationText) {
102
+ this.guidanceText = declarationText
103
+ }
104
+
105
+ get declarationText() {
106
+ return this.guidanceText
107
+ }
108
+
109
+ get declaration() {
110
+ return this.guidance
111
+ }
112
+
113
+ setMakeDeclaration() {
114
+ this._makeDeclaration = true
115
+ this.render()
116
+ }
117
+
118
+ unsetMakeDeclaration() {
119
+ this._makeDeclaration = false
120
+ this.render()
121
+ }
122
+
123
+ get makeDeclaration() {
124
+ return this._makeDeclaration
125
+ }
126
+
127
+ highlightDeclaration() {
128
+ this.highlightGuidance()
129
+ }
130
+
131
+ unhighlightDeclaration() {
132
+ this.clearHighlight()
133
+ }
134
+
135
+ /**
136
+ * @returns {Markdown[]}
137
+ * @protected
138
+ */
139
+ _getGuidanceComponents() {
140
+ if (!this._makeDeclaration) {
141
+ return []
142
+ }
143
+ return super._getGuidanceComponents()
144
+ }
145
+
146
+ get buttonText() {
147
+ return this.makeDeclaration ? 'Accept and send' : 'Send'
148
+ }
149
+ }
150
+
151
+ /**
152
+ * @import { ComponentDef, ContentComponentsDef, ListComponent, FormComponentsDef } from '~/src/components/types.js'
153
+ * @import { FormDefinition } from '~/src/form/form-definition/types.js'
154
+ * @import { PageRenderer, PagePreviewBaseElements, SummaryPageElements } from '~/src/form/form-editor/preview/types.js'
155
+ * @import { SummaryRowActionItem, SummaryRow } from '~/src/form/form-editor/macros/types.js'
156
+ * @import { Markdown } from '~/src/form/form-editor/preview/markdown.js'
157
+ */
@@ -22,4 +22,5 @@ export * from '~/src/form/form-editor/preview/uk-address.js'
22
22
  export * from '~/src/form/form-editor/preview/yes-no.js'
23
23
  export * from '~/src/form/form-editor/preview/controller/page-controller.js'
24
24
  export * from '~/src/form/form-editor/preview/controller/guidance-page-controller.js'
25
+ export * from '~/src/form/form-editor/preview/controller/summary-page-controller.js'
25
26
  export * from '~/src/form/form-editor/preview/controller/page-controller-base.js'
@@ -99,6 +99,10 @@ export interface PageOverviewElements extends PagePreviewBaseElements {
99
99
  hasRepeater: boolean
100
100
  }
101
101
 
102
+ export interface SummaryPageElements extends PagePreviewBaseElements {
103
+ declaration: boolean
104
+ }
105
+
102
106
  export type PreviewQuestion =
103
107
  | DateInputQuestion
104
108
  | EmailAddressQuestion
@@ -23,6 +23,7 @@ export class YesNoQuestion extends FieldsetQuestion {
23
23
  */
24
24
  return {
25
25
  type: 'boolean',
26
+ classes: 'govuk-radios--inline',
26
27
  items: /** @type {ListElement[]} */ ([
27
28
  {
28
29
  id: 'yesNo-yes',