@defra/forms-model 3.0.451 → 3.0.453

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 (75) hide show
  1. package/dist/module/form/form-editor/__stubs__/preview.js +43 -0
  2. package/dist/module/form/form-editor/__stubs__/preview.js.map +1 -1
  3. package/dist/module/form/form-editor/preview/checkbox-sortable.js +12 -0
  4. package/dist/module/form/form-editor/preview/checkbox-sortable.js.map +1 -0
  5. package/dist/module/form/form-editor/preview/date-input.js +4 -10
  6. package/dist/module/form/form-editor/preview/date-input.js.map +1 -1
  7. package/dist/module/form/form-editor/preview/email-address.js +1 -1
  8. package/dist/module/form/form-editor/preview/email-address.js.map +1 -1
  9. package/dist/module/form/form-editor/preview/fieldset-question.js +18 -0
  10. package/dist/module/form/form-editor/preview/fieldset-question.js.map +1 -0
  11. package/dist/module/form/form-editor/preview/index.js +2 -0
  12. package/dist/module/form/form-editor/preview/index.js.map +1 -1
  13. package/dist/module/form/form-editor/preview/long-answer.js +1 -1
  14. package/dist/module/form/form-editor/preview/long-answer.js.map +1 -1
  15. package/dist/module/form/form-editor/preview/month-year.js +13 -8
  16. package/dist/module/form/form-editor/preview/month-year.js.map +1 -1
  17. package/dist/module/form/form-editor/preview/number-only.js +2 -6
  18. package/dist/module/form/form-editor/preview/number-only.js.map +1 -1
  19. package/dist/module/form/form-editor/preview/phone-number.js +1 -1
  20. package/dist/module/form/form-editor/preview/phone-number.js.map +1 -1
  21. package/dist/module/form/form-editor/preview/question.js +12 -2
  22. package/dist/module/form/form-editor/preview/question.js.map +1 -1
  23. package/dist/module/form/form-editor/preview/radio-sortable.js +2 -1
  24. package/dist/module/form/form-editor/preview/radio-sortable.js.map +1 -1
  25. package/dist/module/form/form-editor/preview/radio.js +2 -1
  26. package/dist/module/form/form-editor/preview/radio.js.map +1 -1
  27. package/dist/module/form/form-editor/preview/types.js.map +1 -1
  28. package/dist/module/form/form-editor/preview/uk-address.js +4 -15
  29. package/dist/module/form/form-editor/preview/uk-address.js.map +1 -1
  30. package/dist/module/form/form-editor/preview/yes-no.js +45 -0
  31. package/dist/module/form/form-editor/preview/yes-no.js.map +1 -0
  32. package/dist/module/form/form-editor/types.js.map +1 -1
  33. package/dist/types/form/form-editor/__stubs__/preview.d.ts +13 -0
  34. package/dist/types/form/form-editor/__stubs__/preview.d.ts.map +1 -1
  35. package/dist/types/form/form-editor/preview/checkbox-sortable.d.ts +4 -0
  36. package/dist/types/form/form-editor/preview/checkbox-sortable.d.ts.map +1 -0
  37. package/dist/types/form/form-editor/preview/date-input.d.ts +2 -8
  38. package/dist/types/form/form-editor/preview/date-input.d.ts.map +1 -1
  39. package/dist/types/form/form-editor/preview/fieldset-question.d.ts +23 -0
  40. package/dist/types/form/form-editor/preview/fieldset-question.d.ts.map +1 -0
  41. package/dist/types/form/form-editor/preview/index.d.ts +2 -0
  42. package/dist/types/form/form-editor/preview/list-sortable.d.ts +1 -1
  43. package/dist/types/form/form-editor/preview/month-year.d.ts +2 -12
  44. package/dist/types/form/form-editor/preview/month-year.d.ts.map +1 -1
  45. package/dist/types/form/form-editor/preview/number-only.d.ts.map +1 -1
  46. package/dist/types/form/form-editor/preview/question.d.ts +5 -0
  47. package/dist/types/form/form-editor/preview/question.d.ts.map +1 -1
  48. package/dist/types/form/form-editor/preview/radio-sortable.d.ts.map +1 -1
  49. package/dist/types/form/form-editor/preview/radio.d.ts.map +1 -1
  50. package/dist/types/form/form-editor/preview/types.d.ts +1 -1
  51. package/dist/types/form/form-editor/preview/types.d.ts.map +1 -1
  52. package/dist/types/form/form-editor/preview/uk-address.d.ts +2 -2
  53. package/dist/types/form/form-editor/preview/uk-address.d.ts.map +1 -1
  54. package/dist/types/form/form-editor/preview/yes-no.d.ts +4 -0
  55. package/dist/types/form/form-editor/preview/yes-no.d.ts.map +1 -0
  56. package/dist/types/form/form-editor/types.d.ts +4 -4
  57. package/dist/types/form/form-editor/types.d.ts.map +1 -1
  58. package/package.json +1 -1
  59. package/src/form/form-editor/__stubs__/preview.js +43 -0
  60. package/src/form/form-editor/preview/checkbox-sortable.js +12 -0
  61. package/src/form/form-editor/preview/date-input.js +4 -12
  62. package/src/form/form-editor/preview/email-address.js +1 -1
  63. package/src/form/form-editor/preview/fieldset-question.js +17 -0
  64. package/src/form/form-editor/preview/index.js +2 -0
  65. package/src/form/form-editor/preview/long-answer.js +1 -1
  66. package/src/form/form-editor/preview/month-year.js +12 -8
  67. package/src/form/form-editor/preview/number-only.js +2 -6
  68. package/src/form/form-editor/preview/phone-number.js +1 -1
  69. package/src/form/form-editor/preview/question.js +12 -2
  70. package/src/form/form-editor/preview/radio-sortable.js +2 -1
  71. package/src/form/form-editor/preview/radio.js +2 -1
  72. package/src/form/form-editor/preview/types.ts +1 -1
  73. package/src/form/form-editor/preview/uk-address.js +4 -15
  74. package/src/form/form-editor/preview/yes-no.js +48 -0
  75. package/src/form/form-editor/types.ts +4 -4
@@ -97,6 +97,49 @@ export const baseElements = /** @type {BaseSettings} */{
97
97
  hintText: 'Choose one adventure that best suits you.',
98
98
  shortDesc: ''
99
99
  };
100
+ const list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120';
101
+ const list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22';
102
+ const list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd';
103
+ const list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f';
104
+ const listElementsBase = /** @type {BaseSettings} */{
105
+ ...baseElements,
106
+ items: [{
107
+ label: {
108
+ text: 'Treasure Hunting'
109
+ },
110
+ text: 'Treasure Hunting',
111
+ value: 'Treasure Hunting',
112
+ id: list1Id
113
+ }, {
114
+ label: {
115
+ text: 'Rescuing the princess'
116
+ },
117
+ text: 'Rescuing the princess',
118
+ value: 'Rescuing the princess',
119
+ id: list2Id
120
+ }, {
121
+ label: {
122
+ text: 'Saving a city'
123
+ },
124
+ text: 'Saving a city',
125
+ value: 'Saving a city',
126
+ id: list3Id
127
+ }, {
128
+ label: {
129
+ text: 'Defeating the baron'
130
+ },
131
+ text: 'Defeating the baron',
132
+ value: 'Defeating the baron',
133
+ id: list4Id
134
+ }]
135
+ };
136
+ export const listElementsStub = {
137
+ list1Id,
138
+ list2Id,
139
+ list3Id,
140
+ list4Id,
141
+ baseElements: listElementsBase
142
+ };
100
143
 
101
144
  /**
102
145
  * @import { ListElement } from '~/src/form/form-editor/types.js'
@@ -1 +1 @@
1
- {"version":3,"file":"preview.js","names":["QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_items","afterInputsHTML","question","hintText","optional","shortDesc","items","values","setPreviewHTML","_value","baseElements"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({ question, hintText, optional, shortDesc, items }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._items = items\n }\n\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n items: this._items\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n shortDesc: ''\n})\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { BaseSettings, ListElements, RenderContext, QuestionBaseModel, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,CAAC;EAChC;AACF;AACA;EACEC,UAAU;;EAEV;AACF;AACA;EACEC,WAAWA,CAACD,UAAU,EAAE;IACtB,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;;EAEA;AACF;AACA;AACA;EACEE,MAAMA,CAACC,gBAAgB,EAAEC,iBAAiB,EAAE;IAC1C,IAAI,CAACJ,UAAU,CAACG,gBAAgB,EAAEC,iBAAiB,CAAC;EACtD;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAOC,SAASA,CAACC,iBAAiB,EAAEC,cAAc,EAAE;IAClD,OAAO,sBAAsB;EAC/B;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,CAAC;EACnC;AACF;AACA;EACEC,SAAS,GAAG,EAAE;EACd;EACAC,SAAS,GAAG,EAAE;EACd;EACAC,SAAS,GAAG,KAAK;EACjB;AACF;AACA;AACA;EACEC,UAAU,GAAG,EAAE;EACf;AACF;AACA;AACA;AACA;EACEC,MAAM,GAAG,EAAE;EAEXC,eAAe,GAAG,yDAAyD;;EAE3E;AACF;AACA;EACEb,WAAWA,CAAC;IAAEc,QAAQ;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,SAAS;IAAEC;EAAM,CAAC,EAAE;IAC9D,IAAI,CAACV,SAAS,GAAGM,QAAQ;IACzB,IAAI,CAACL,SAAS,GAAGM,QAAQ;IACzB,IAAI,CAACL,SAAS,GAAGM,QAAQ;IACzB,IAAI,CAACL,UAAU,GAAGM,SAAS;IAC3B,IAAI,CAACL,MAAM,GAAGM,KAAK;EACrB;EAEA,IAAIC,MAAMA,CAAA,EAAG;IACX,OAAO;MACLL,QAAQ,EAAE,IAAI,CAACN,SAAS;MACxBO,QAAQ,EAAE,IAAI,CAACN,SAAS;MACxBO,QAAQ,EAAE,IAAI,CAACN,SAAS;MACxBO,SAAS,EAAE,IAAI,CAACN,UAAU;MAC1BO,KAAK,EAAE,IAAI,CAACN;IACd,CAAC;EACH;;EAEA;AACF;AACA;EACEQ,cAAcA,CAACC,MAAM,EAAE;IACrB;EAAA;AAEJ;AAEA,OAAO,MAAMC,YAAY,GAAG,2BAA6B;EACvDJ,KAAK,EAAE,EAAE;EACTF,QAAQ,EAAE,KAAK;EACfF,QAAQ,EAAE,qCAAqC;EAC/CC,QAAQ,EAAE,2CAA2C;EACrDE,SAAS,EAAE;AACb,CAAE;;AAEF;AACA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"preview.js","names":["QuestionRendererStub","renderMock","constructor","render","questionTemplate","questionBaseModel","buildHTML","_questionTemplate","_renderContext","QuestionPreviewElements","_question","_hintText","_optional","_shortDesc","_items","afterInputsHTML","question","hintText","optional","shortDesc","items","values","setPreviewHTML","_value","baseElements","list1Id","list2Id","list3Id","list4Id","listElementsBase","label","text","value","id","listElementsStub"],"sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"sourcesContent":["/**\n * @implements {QuestionRenderer}\n */\nexport class QuestionRendererStub {\n /**\n * @type {jest.Mock<void, [string, QuestionBaseModel]>}\n */\n renderMock\n\n /**\n * @param {jest.Mock<void, [string, QuestionBaseModel]>} renderMock\n */\n constructor(renderMock) {\n this.renderMock = renderMock\n }\n\n /**\n * @param {string} questionTemplate\n * @param {QuestionBaseModel} questionBaseModel\n */\n render(questionTemplate, questionBaseModel) {\n this.renderMock(questionTemplate, questionBaseModel)\n }\n\n /**\n * @returns {string}\n * @param {string} _questionTemplate\n * @param {RenderContext} _renderContext\n */\n static buildHTML(_questionTemplate, _renderContext) {\n return '**** BUILT HTML ****'\n }\n}\n\n/**\n * @implements {ListElements}\n */\nexport class QuestionPreviewElements {\n /**\n * @protected\n */\n _question = ''\n /** @protected */\n _hintText = ''\n /** @protected */\n _optional = false\n /**\n * @type {string}\n * @protected\n */\n _shortDesc = ''\n /**\n *\n * @type {ListElement[]}\n * @private\n */\n _items = []\n\n afterInputsHTML = '<div class=\"govuk-inset-text\">No items added yet.</div>'\n\n /**\n * @param {BaseSettings} baseSettings\n */\n constructor({ question, hintText, optional, shortDesc, items }) {\n this._question = question\n this._hintText = hintText\n this._optional = optional\n this._shortDesc = shortDesc\n this._items = items\n }\n\n get values() {\n return {\n question: this._question,\n hintText: this._hintText,\n optional: this._optional,\n shortDesc: this._shortDesc,\n items: this._items\n }\n }\n\n /**\n * @param {string} _value\n */\n setPreviewHTML(_value) {\n // Not implemented for server side render\n }\n}\n\nexport const baseElements = /** @type {BaseSettings} */ ({\n items: [],\n optional: false,\n question: 'Which quest would you like to pick?',\n hintText: 'Choose one adventure that best suits you.',\n shortDesc: ''\n})\n\nconst list1Id = '414d82a3-4cab-416a-bd54-6b86fbd51120'\nconst list2Id = '801385a4-81e6-4171-96c3-6c6727d97f22'\nconst list3Id = 'e6e3f621-b875-4ca3-a054-cca9149149dd'\nconst list4Id = 'd71b3909-582f-4e90-b6f5-490b89a6eb8f'\n\nconst listElementsBase = /** @type {BaseSettings} */ ({\n ...baseElements,\n items: [\n {\n label: { text: 'Treasure Hunting' },\n text: 'Treasure Hunting',\n value: 'Treasure Hunting',\n id: list1Id\n },\n {\n label: { text: 'Rescuing the princess' },\n text: 'Rescuing the princess',\n value: 'Rescuing the princess',\n id: list2Id\n },\n {\n label: { text: 'Saving a city' },\n text: 'Saving a city',\n value: 'Saving a city',\n id: list3Id\n },\n {\n label: { text: 'Defeating the baron' },\n text: 'Defeating the baron',\n value: 'Defeating the baron',\n id: list4Id\n }\n ]\n})\n\nexport const listElementsStub = {\n list1Id,\n list2Id,\n list3Id,\n list4Id,\n baseElements: listElementsBase\n}\n\n/**\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { BaseSettings, ListElements, RenderContext, QuestionBaseModel, QuestionElements, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"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","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ import { ListSortableQuestion } from "./list-sortable.js";
2
+ import { Question } from "./question.js";
3
+ export class CheckboxSortableQuestion extends ListSortableQuestion {
4
+ /**
5
+ * @type {string}
6
+ * @protected
7
+ */
8
+ _questionTemplate = Question.PATH + 'checkboxesfield.njk';
9
+ listRenderId = 'checkboxField';
10
+ listRenderName = 'checkboxField';
11
+ }
12
+ //# sourceMappingURL=checkbox-sortable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkbox-sortable.js","names":["ListSortableQuestion","Question","CheckboxSortableQuestion","_questionTemplate","PATH","listRenderId","listRenderName"],"sources":["../../../../../src/form/form-editor/preview/checkbox-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class CheckboxSortableQuestion extends ListSortableQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'checkboxesfield.njk'\n listRenderId = 'checkboxField'\n listRenderName = 'checkboxField'\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,QAAQ;AAEjB,OAAO,MAAMC,wBAAwB,SAASF,oBAAoB,CAAC;EACjE;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,qBAAqB;EACzDC,YAAY,GAAG,eAAe;EAC9BC,cAAc,GAAG,eAAe;AAClC","ignoreList":[]}
@@ -1,17 +1,11 @@
1
+ import { FieldsetQuestion } from "./fieldset-question.js";
1
2
  import { Question } from "./question.js";
2
- export class DateInputQuestion extends Question {
3
+ export class DateInputQuestion extends FieldsetQuestion {
3
4
  /**
4
5
  * @type {string}
5
6
  * @protected
6
7
  */
7
- _questionTemplate = 'date-input.njk';
8
- get renderInput() {
9
- return {
10
- id: 'dateInput',
11
- name: 'dateInputField',
12
- fieldset: this.fieldSet,
13
- hint: this.hint
14
- };
15
- }
8
+ _questionTemplate = Question.PATH + 'date-input.njk';
9
+ _fieldName = 'dateInput';
16
10
  }
17
11
  //# sourceMappingURL=date-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-input.js","names":["Question","DateInputQuestion","_questionTemplate","renderInput","id","name","fieldset","fieldSet","hint"],"sources":["../../../../../src/form/form-editor/preview/date-input.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class DateInputQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'date-input.njk'\n\n get renderInput() {\n return {\n id: 'dateInput',\n name: 'dateInputField',\n fieldset: this.fieldSet,\n hint: this.hint\n }\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,iBAAiB,SAASD,QAAQ,CAAC;EAC9C;AACF;AACA;AACA;EACEE,iBAAiB,GAAG,gBAAgB;EAEpC,IAAIC,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLC,EAAE,EAAE,WAAW;MACfC,IAAI,EAAE,gBAAgB;MACtBC,QAAQ,EAAE,IAAI,CAACC,QAAQ;MACvBC,IAAI,EAAE,IAAI,CAACA;IACb,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"date-input.js","names":["FieldsetQuestion","Question","DateInputQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/date-input.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\nexport class DateInputQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'date-input.njk'\n _fieldName = 'dateInput'\n}\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,QAAQ;AACjB,OAAO,MAAMC,iBAAiB,SAASF,gBAAgB,CAAC;EACtD;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,gBAAgB;EACpDC,UAAU,GAAG,WAAW;AAC1B","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { Question } from "./question.js";
2
2
  export class EmailAddressQuestion extends Question {
3
- _questionTemplate = 'emailaddressfield.njk';
3
+ _questionTemplate = Question.PATH + 'emailaddressfield.njk';
4
4
  _fieldName = 'emailAddressField';
5
5
  }
6
6
  //# sourceMappingURL=email-address.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"email-address.js","names":["Question","EmailAddressQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/email-address.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class EmailAddressQuestion extends Question {\n _questionTemplate = 'emailaddressfield.njk'\n _fieldName = 'emailAddressField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,oBAAoB,SAASD,QAAQ,CAAC;EACjDE,iBAAiB,GAAG,uBAAuB;EAC3CC,UAAU,GAAG,mBAAmB;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"email-address.js","names":["Question","EmailAddressQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/email-address.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class EmailAddressQuestion extends Question {\n _questionTemplate = Question.PATH + 'emailaddressfield.njk'\n _fieldName = 'emailAddressField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,oBAAoB,SAASD,QAAQ,CAAC;EACjDE,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,uBAAuB;EAC3DC,UAAU,GAAG,mBAAmB;AAClC","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import { Question } from "./question.js";
2
+
3
+ /**
4
+ * Simple extension of Question that uses fieldset instead of label - not exported
5
+ * @abstract
6
+ */
7
+ export class FieldsetQuestion extends Question {
8
+ get renderInput() {
9
+ return {
10
+ id: this._fieldName,
11
+ name: this._fieldName,
12
+ fieldset: this.fieldSet,
13
+ hint: this.hint,
14
+ ...this.customRenderFields
15
+ };
16
+ }
17
+ }
18
+ //# sourceMappingURL=fieldset-question.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldset-question.js","names":["Question","FieldsetQuestion","renderInput","id","_fieldName","name","fieldset","fieldSet","hint","customRenderFields"],"sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\n/**\n * Simple extension of Question that uses fieldset instead of label - not exported\n * @abstract\n */\nexport class FieldsetQuestion extends Question {\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n fieldset: this.fieldSet,\n hint: this.hint,\n ...this.customRenderFields\n }\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ;;AAEjB;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,SAASD,QAAQ,CAAC;EAC7C,IAAIE,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLC,EAAE,EAAE,IAAI,CAACC,UAAU;MACnBC,IAAI,EAAE,IAAI,CAACD,UAAU;MACrBE,QAAQ,EAAE,IAAI,CAACC,QAAQ;MACvBC,IAAI,EAAE,IAAI,CAACA,IAAI;MACf,GAAG,IAAI,CAACC;IACV,CAAC;EACH;AACF","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ export * from "./checkbox-sortable.js";
1
2
  export * from "./date-input.js";
2
3
  export * from "./email-address.js";
3
4
  export * from "./list.js";
@@ -11,4 +12,5 @@ export * from "./radio-sortable.js";
11
12
  export * from "./short-answer.js";
12
13
  export * from "./long-answer.js";
13
14
  export * from "./uk-address.js";
15
+ export * from "./yes-no.js";
14
16
  //# 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/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/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/short-answer.js'\nexport * from '~/src/form/form-editor/preview/long-answer.js'\nexport * from '~/src/form/form-editor/preview/uk-address.js'\n"],"mappings":"AAAA;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/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/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/short-answer.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'\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
@@ -4,7 +4,7 @@ export class LongAnswerQuestion extends Question {
4
4
  * @type {string}
5
5
  * @protected
6
6
  */
7
- _questionTemplate = 'textarea.njk';
7
+ _questionTemplate = Question.PATH + 'textarea.njk';
8
8
  /**
9
9
  * @type {string}
10
10
  * @protected
@@ -1 +1 @@
1
- {"version":3,"file":"long-answer.js","names":["Question","LongAnswerQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/long-answer.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class LongAnswerQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'textarea.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'longAnswerField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;AACA;EACEE,iBAAiB,GAAG,cAAc;EAClC;AACF;AACA;AACA;EACEC,UAAU,GAAG,iBAAiB;AAChC","ignoreList":[]}
1
+ {"version":3,"file":"long-answer.js","names":["Question","LongAnswerQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/long-answer.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class LongAnswerQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'textarea.njk'\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'longAnswerField'\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;AACA;EACEE,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,cAAc;EAClD;AACF;AACA;AACA;EACEC,UAAU,GAAG,iBAAiB;AAChC","ignoreList":[]}
@@ -1,16 +1,18 @@
1
- import { Question } from "./question.js";
2
- export class MonthYearQuestion extends Question {
1
+ import { FieldsetQuestion } from "./fieldset-question.js";
2
+ import { Question } from "../../../index.js";
3
+ export class MonthYearQuestion extends FieldsetQuestion {
3
4
  /**
4
5
  * @type {string}
5
6
  * @protected
6
7
  */
7
- _questionTemplate = 'monthyearfield.njk';
8
- get renderInput() {
8
+ _questionTemplate = Question.PATH + 'monthyearfield.njk';
9
+ _fieldName = 'monthYear';
10
+
11
+ /**
12
+ * @returns {Partial<QuestionBaseModel>}
13
+ */
14
+ get customRenderFields() {
9
15
  return {
10
- id: 'monthYear',
11
- name: 'monthYearField',
12
- fieldset: this.fieldSet,
13
- hint: this.hint,
14
16
  items: [{
15
17
  name: 'month',
16
18
  classes: 'govuk-input--width-2'
@@ -21,4 +23,7 @@ export class MonthYearQuestion extends Question {
21
23
  };
22
24
  }
23
25
  }
26
+ /**
27
+ * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'
28
+ */
24
29
  //# sourceMappingURL=month-year.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"month-year.js","names":["Question","MonthYearQuestion","_questionTemplate","renderInput","id","name","fieldset","fieldSet","hint","items","classes"],"sources":["../../../../../src/form/form-editor/preview/month-year.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class MonthYearQuestion extends Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'monthyearfield.njk'\n\n get renderInput() {\n return {\n id: 'monthYear',\n name: 'monthYearField',\n fieldset: this.fieldSet,\n hint: this.hint,\n items: [\n { name: 'month', classes: 'govuk-input--width-2' },\n { name: 'year', classes: 'govuk-input--width-4' }\n ]\n }\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,iBAAiB,SAASD,QAAQ,CAAC;EAC9C;AACF;AACA;AACA;EACEE,iBAAiB,GAAG,oBAAoB;EAExC,IAAIC,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLC,EAAE,EAAE,WAAW;MACfC,IAAI,EAAE,gBAAgB;MACtBC,QAAQ,EAAE,IAAI,CAACC,QAAQ;MACvBC,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,CACL;QAAEJ,IAAI,EAAE,OAAO;QAAEK,OAAO,EAAE;MAAuB,CAAC,EAClD;QAAEL,IAAI,EAAE,MAAM;QAAEK,OAAO,EAAE;MAAuB,CAAC;IAErD,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"month-year.js","names":["FieldsetQuestion","Question","MonthYearQuestion","_questionTemplate","PATH","_fieldName","customRenderFields","items","name","classes"],"sources":["../../../../../src/form/form-editor/preview/month-year.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/index.js'\n\nexport class MonthYearQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'monthyearfield.njk'\n _fieldName = 'monthYear'\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {\n items: [\n { name: 'month', classes: 'govuk-input--width-2' },\n { name: 'year', classes: 'govuk-input--width-4' }\n ]\n }\n }\n}\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,iBAAiB,SAASF,gBAAgB,CAAC;EACtD;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,oBAAoB;EACxDC,UAAU,GAAG,WAAW;;EAExB;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,KAAK,EAAE,CACL;QAAEC,IAAI,EAAE,OAAO;QAAEC,OAAO,EAAE;MAAuB,CAAC,EAClD;QAAED,IAAI,EAAE,MAAM;QAAEC,OAAO,EAAE;MAAuB,CAAC;IAErD,CAAC;EACH;AACF;AACA;AACA;AACA","ignoreList":[]}
@@ -1,14 +1,10 @@
1
1
  import { Question } from "./question.js";
2
2
  export class NumberOnlyQuestion extends Question {
3
3
  /**
4
- * @type {QuestionBaseModel}
4
+ * @returns {Partial<QuestionBaseModel>}
5
5
  */
6
- get renderInput() {
6
+ get customRenderFields() {
7
7
  return {
8
- id: this._fieldName,
9
- name: this._fieldName,
10
- label: this.label,
11
- hint: this.hint,
12
8
  type: 'number'
13
9
  };
14
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"number-only.js","names":["Question","NumberOnlyQuestion","renderInput","id","_fieldName","name","label","hint","type"],"sources":["../../../../../src/form/form-editor/preview/number-only.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class NumberOnlyQuestion extends Question {\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n label: this.label,\n hint: this.hint,\n type: 'number'\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;EACE,IAAIE,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLC,EAAE,EAAE,IAAI,CAACC,UAAU;MACnBC,IAAI,EAAE,IAAI,CAACD,UAAU;MACrBE,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,IAAI,EAAE;IACR,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"number-only.js","names":["Question","NumberOnlyQuestion","customRenderFields","type"],"sources":["../../../../../src/form/form-editor/preview/number-only.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class NumberOnlyQuestion extends Question {\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {\n type: 'number'\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,kBAAkB,SAASD,QAAQ,CAAC;EAC/C;AACF;AACA;EACE,IAAIE,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,IAAI,EAAE;IACR,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { Question } from "./question.js";
2
2
  export class PhoneNumberQuestion extends Question {
3
- _questionTemplate = 'telephonenumberfield.njk';
3
+ _questionTemplate = Question.PATH + 'telephonenumberfield.njk';
4
4
  _fieldName = 'phoneNumberField';
5
5
  }
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"phone-number.js","names":["Question","PhoneNumberQuestion","_questionTemplate","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/phone-number.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class PhoneNumberQuestion extends Question {\n _questionTemplate = 'telephonenumberfield.njk'\n _fieldName = 'phoneNumberField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/question.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,mBAAmB,SAASD,QAAQ,CAAC;EAChDE,iBAAiB,GAAG,0BAA0B;EAC9CC,UAAU,GAAG,kBAAkB;AACjC;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"phone-number.js","names":["Question","PhoneNumberQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/phone-number.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class PhoneNumberQuestion extends Question {\n _questionTemplate = Question.PATH + 'telephonenumberfield.njk'\n _fieldName = 'phoneNumberField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/question.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,mBAAmB,SAASD,QAAQ,CAAC;EAChDE,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,0BAA0B;EAC9DC,UAAU,GAAG,kBAAkB;AACjC;;AAEA;AACA;AACA","ignoreList":[]}
@@ -9,11 +9,13 @@
9
9
  * server side.
10
10
  */
11
11
  export class Question {
12
+ static PATH = '';
13
+
12
14
  /**
13
15
  * @type {string}
14
16
  * @protected
15
17
  */
16
- _questionTemplate = 'textfield.njk';
18
+ _questionTemplate = Question.PATH + 'textfield.njk';
17
19
  /**
18
20
  * @type { string|null }
19
21
  * @protected
@@ -118,6 +120,13 @@ export class Question {
118
120
  };
119
121
  }
120
122
 
123
+ /**
124
+ * @returns {Partial<QuestionBaseModel>}
125
+ */
126
+ get customRenderFields() {
127
+ return {};
128
+ }
129
+
121
130
  /**
122
131
  * @type {QuestionBaseModel}
123
132
  */
@@ -126,7 +135,8 @@ export class Question {
126
135
  id: this._fieldName,
127
136
  name: this._fieldName,
128
137
  label: this.label,
129
- hint: this.hint
138
+ hint: this.hint,
139
+ ...this.customRenderFields
130
140
  };
131
141
  }
132
142
  render() {
@@ -1 +1 @@
1
- {"version":3,"file":"question.js","names":["Question","_questionTemplate","_highlight","_fieldName","_questionRenderer","constructor","htmlElements","questionRenderer","question","hintText","optional","values","_htmlElements","_question","_hintText","_optional","getHighlight","element","titleText","optionalText","label","text","classes","fieldSet","legend","hint","length","renderInput","id","name","render","value","highlight"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = 'textfield.njk'\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, hintText, optional } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @private\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n /**\n * @type {boolean}\n * @private\n */\n this._optional = optional\n /**\n *\n * @type {QuestionRenderer}\n * @protected\n */\n this._questionRenderer = questionRenderer\n }\n\n /**\n * @param {string} element\n * @returns {string}\n * @protected\n */\n getHighlight(element) {\n return this._highlight === element ? ' highlight' : ''\n }\n\n get titleText() {\n const optionalText = this._optional ? ' (optional)' : ''\n return (!this._question ? 'Question' : this._question) + optionalText\n }\n\n /**\n * @protected\n * @type {DefaultComponent}\n */\n get label() {\n return {\n text: this.titleText,\n classes: 'govuk-label--l' + this.getHighlight('question')\n }\n }\n\n /**\n * @protected\n * @type {GovukFieldset}\n */\n get fieldSet() {\n return {\n legend: {\n text: this.titleText,\n classes: 'govuk-fieldset__legend--l' + this.getHighlight('question')\n }\n }\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n label: this.label,\n hint: this.hint\n }\n }\n\n render() {\n this._questionRenderer.render(this._questionTemplate, this.renderInput)\n }\n\n /**\n * @type {string}\n */\n get question() {\n return this._question\n }\n\n /**\n * @param {string} value\n */\n set question(value) {\n this._question = value\n this.render()\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n\n get optional() {\n return this._optional\n }\n\n /**\n * @param {boolean} value\n */\n set optional(value) {\n this._optional = value\n this.render()\n }\n\n /**\n * @type {string | null}\n */\n get highlight() {\n return this._highlight\n }\n\n /**\n * @param {string | null} value\n */\n set highlight(value) {\n this._highlight = value\n this.render()\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"question.js","names":["Question","PATH","_questionTemplate","_highlight","_fieldName","_questionRenderer","constructor","htmlElements","questionRenderer","question","hintText","optional","values","_htmlElements","_question","_hintText","_optional","getHighlight","element","titleText","optionalText","label","text","classes","fieldSet","legend","hint","length","customRenderFields","renderInput","id","name","render","value","highlight"],"sources":["../../../../../src/form/form-editor/preview/question.js"],"sourcesContent":["/**\n * @class Question\n * @classdesc\n * A data object that has access to the underlying data via the QuestionElements object interface\n * and the templating mechanism to render the HTML for the data.\n *\n * It does not have access to the DOM, but has access to QuestionElements.setPreviewHTML to update\n * the HTML. Question classes should only be responsible for data and rendering as are reused in the\n * server side.\n */\nexport class Question {\n static PATH = ''\n\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.PATH + 'textfield.njk'\n /**\n * @type { string|null }\n * @protected\n */\n _highlight = null\n /**\n * @type {string}\n * @protected\n */\n _fieldName = 'inputField'\n /**\n * @type {QuestionRenderer}\n * @protected\n */\n _questionRenderer\n\n /**\n * @param {QuestionElements} htmlElements\n * @param {QuestionRenderer} questionRenderer\n */\n constructor(htmlElements, questionRenderer) {\n const { question, hintText, optional } = htmlElements.values\n\n /**\n * @type {QuestionElements}\n * @private\n */\n this._htmlElements = htmlElements\n /**\n * @type {string}\n * @private\n */\n this._question = question\n /**\n * @type {string}\n * @private\n */\n this._hintText = hintText\n /**\n * @type {boolean}\n * @private\n */\n this._optional = optional\n /**\n *\n * @type {QuestionRenderer}\n * @protected\n */\n this._questionRenderer = questionRenderer\n }\n\n /**\n * @param {string} element\n * @returns {string}\n * @protected\n */\n getHighlight(element) {\n return this._highlight === element ? ' highlight' : ''\n }\n\n get titleText() {\n const optionalText = this._optional ? ' (optional)' : ''\n return (!this._question ? 'Question' : this._question) + optionalText\n }\n\n /**\n * @protected\n * @type {DefaultComponent}\n */\n get label() {\n return {\n text: this.titleText,\n classes: 'govuk-label--l' + this.getHighlight('question')\n }\n }\n\n /**\n * @protected\n * @type {GovukFieldset}\n */\n get fieldSet() {\n return {\n legend: {\n text: this.titleText,\n classes: 'govuk-fieldset__legend--l' + this.getHighlight('question')\n }\n }\n }\n\n /**\n * @type {DefaultComponent}\n * @protected\n */\n get hint() {\n const text =\n this._highlight === 'hintText' && !this._hintText.length\n ? 'Hint text'\n : this._hintText\n\n return {\n text,\n classes: this.getHighlight('hintText')\n }\n }\n\n /**\n * @returns {Partial<QuestionBaseModel>}\n */\n get customRenderFields() {\n return {}\n }\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n label: this.label,\n hint: this.hint,\n ...this.customRenderFields\n }\n }\n\n render() {\n this._questionRenderer.render(this._questionTemplate, this.renderInput)\n }\n\n /**\n * @type {string}\n */\n get question() {\n return this._question\n }\n\n /**\n * @param {string} value\n */\n set question(value) {\n this._question = value\n this.render()\n }\n\n /**\n * @type {string}\n */\n get hintText() {\n return this._hintText\n }\n\n /**\n * @param {string} value\n */\n set hintText(value) {\n this._hintText = value\n this.render()\n }\n\n get optional() {\n return this._optional\n }\n\n /**\n * @param {boolean} value\n */\n set optional(value) {\n this._optional = value\n this.render()\n }\n\n /**\n * @type {string | null}\n */\n get highlight() {\n return this._highlight\n }\n\n /**\n * @param {string | null} value\n */\n set highlight(value) {\n this._highlight = value\n this.render()\n }\n}\n\n/**\n * @import { ListenerRow, BaseSettings, QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n * @import { ListElement, ListItemReadonly } from '~/src/form/form-editor/types.js'\n */\n"],"mappings":"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","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { ListSortableQuestion } from "./list-sortable.js";
2
+ import { Question } from "../../../index.js";
2
3
  export class RadioSortableQuestion extends ListSortableQuestion {
3
- _questionTemplate = 'radios.njk';
4
+ _questionTemplate = Question.PATH + 'radios.njk';
4
5
  }
5
6
  //# sourceMappingURL=radio-sortable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-sortable.js","names":["ListSortableQuestion","RadioSortableQuestion","_questionTemplate"],"sources":["../../../../../src/form/form-editor/preview/radio-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\n\nexport class RadioSortableQuestion extends ListSortableQuestion {\n _questionTemplate = 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAE7B,OAAO,MAAMC,qBAAqB,SAASD,oBAAoB,CAAC;EAC9DE,iBAAiB,GAAG,YAAY;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"radio-sortable.js","names":["ListSortableQuestion","Question","RadioSortableQuestion","_questionTemplate","PATH"],"sources":["../../../../../src/form/form-editor/preview/radio-sortable.js"],"sourcesContent":["import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { Question } from '~/src/index.js'\n\nexport class RadioSortableQuestion extends ListSortableQuestion {\n _questionTemplate = Question.PATH + 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,oBAAoB;AAC7B,SAASC,QAAQ;AAEjB,OAAO,MAAMC,qBAAqB,SAASF,oBAAoB,CAAC;EAC9DG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,YAAY;AAClD","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  import { ListQuestion } from "./list.js";
2
+ import { Question } from "../../../index.js";
2
3
  export class RadioQuestion extends ListQuestion {
3
- _questionTemplate = 'radios.njk';
4
+ _questionTemplate = Question.PATH + 'radios.njk';
4
5
  }
5
6
  //# sourceMappingURL=radio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.js","names":["ListQuestion","RadioQuestion","_questionTemplate"],"sources":["../../../../../src/form/form-editor/preview/radio.js"],"sourcesContent":["import { ListQuestion } from '~/src/form/form-editor/preview/list.js'\n\nexport class RadioQuestion extends ListQuestion {\n _questionTemplate = 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,YAAY;AAErB,OAAO,MAAMC,aAAa,SAASD,YAAY,CAAC;EAC9CE,iBAAiB,GAAG,YAAY;AAClC","ignoreList":[]}
1
+ {"version":3,"file":"radio.js","names":["ListQuestion","Question","RadioQuestion","_questionTemplate","PATH"],"sources":["../../../../../src/form/form-editor/preview/radio.js"],"sourcesContent":["import { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { Question } from '~/src/index.js'\n\nexport class RadioQuestion extends ListQuestion {\n _questionTemplate = Question.PATH + 'radios.njk'\n}\n"],"mappings":"AAAA,SAASA,YAAY;AACrB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,aAAa,SAASF,YAAY,CAAC;EAC9CG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,YAAY;AAClD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import { 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 ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport {\n type DateItem,\n type ListElement,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\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 interface QuestionBaseModel {\n id?: string\n name?: string\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: { afterInputs: { html: string } }\n type?: 'text' | 'number'\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface QuestionElements {\n readonly values: BaseSettings\n setPreviewHTML(value: string): void\n}\n\nexport interface RenderContext {\n model: QuestionBaseModel\n}\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 ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/form/form-editor/preview/types.ts"],"sourcesContent":["import { 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 ShortAnswerQuestion } from '~/src/form/form-editor/preview/short-answer.js'\nimport { type UkAddressQuestion } from '~/src/form/form-editor/preview/uk-address.js'\nimport {\n type DateItem,\n type ListElement,\n type ListItemReadonly\n} from '~/src/form/form-editor/types.js'\n\nexport interface BaseSettings {\n question: string\n hintText: string\n optional: boolean\n shortDesc: string\n items: ListElement[]\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 interface QuestionBaseModel {\n id?: string\n name?: string\n label?: DefaultComponent\n hint?: DefaultComponent\n fieldset?: GovukFieldset\n readonly items?: ListItemReadonly[] | DateItem[]\n text?: string\n formGroup?: { afterInputs: { html: string } }\n type?: 'text' | 'number' | 'boolean'\n}\n\nexport type ListenerRow = [\n HTMLInputElement | null,\n (target: HTMLInputElement, e: Event) => void,\n keyof HTMLElementEventMap\n]\n\nexport interface QuestionElements {\n readonly values: BaseSettings\n setPreviewHTML(value: string): void\n}\n\nexport interface RenderContext {\n model: QuestionBaseModel\n}\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 ListElements extends QuestionElements {\n afterInputsHTML: string\n}\n\nexport type PreviewQuestion =\n | DateInputQuestion\n | EmailAddressQuestion\n | ListSortableQuestion\n | LongAnswerQuestion\n | PhoneNumberQuestion\n | Question\n | RadioSortableQuestion\n | ShortAnswerQuestion\n | UkAddressQuestion\n"],"mappings":"","ignoreList":[]}
@@ -1,19 +1,8 @@
1
- import { Question } from "./question.js";
2
- export class UkAddressQuestion extends Question {
3
- _questionTemplate = 'ukaddressfield.njk';
1
+ import { FieldsetQuestion } from "./fieldset-question.js";
2
+ import { Question } from "../../../index.js";
3
+ export class UkAddressQuestion extends FieldsetQuestion {
4
+ _questionTemplate = Question.PATH + 'ukaddressfield.njk';
4
5
  _fieldName = 'addressField';
5
-
6
- /**
7
- * @type {QuestionBaseModel}
8
- */
9
- get renderInput() {
10
- return {
11
- id: this._fieldName,
12
- name: this._fieldName,
13
- fieldset: this.fieldSet,
14
- hint: this.hint
15
- };
16
- }
17
6
  }
18
7
 
19
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"uk-address.js","names":["Question","UkAddressQuestion","_questionTemplate","_fieldName","renderInput","id","name","fieldset","fieldSet","hint"],"sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"sourcesContent":["import { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class UkAddressQuestion extends Question {\n _questionTemplate = 'ukaddressfield.njk'\n _fieldName = 'addressField'\n\n /**\n * @type {QuestionBaseModel}\n */\n get renderInput() {\n return {\n id: this._fieldName,\n name: this._fieldName,\n fieldset: this.fieldSet,\n hint: this.hint\n }\n }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,QAAQ;AAEjB,OAAO,MAAMC,iBAAiB,SAASD,QAAQ,CAAC;EAC9CE,iBAAiB,GAAG,oBAAoB;EACxCC,UAAU,GAAG,cAAc;;EAE3B;AACF;AACA;EACE,IAAIC,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLC,EAAE,EAAE,IAAI,CAACF,UAAU;MACnBG,IAAI,EAAE,IAAI,CAACH,UAAU;MACrBI,QAAQ,EAAE,IAAI,CAACC,QAAQ;MACvBC,IAAI,EAAE,IAAI,CAACA;IACb,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
1
+ {"version":3,"file":"uk-address.js","names":["FieldsetQuestion","Question","UkAddressQuestion","_questionTemplate","PATH","_fieldName"],"sources":["../../../../../src/form/form-editor/preview/uk-address.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/index.js'\n\nexport class UkAddressQuestion extends FieldsetQuestion {\n _questionTemplate = Question.PATH + 'ukaddressfield.njk'\n _fieldName = 'addressField'\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,iBAAiB,SAASF,gBAAgB,CAAC;EACtDG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,oBAAoB;EACxDC,UAAU,GAAG,cAAc;AAC7B;;AAEA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ import { FieldsetQuestion } from "./fieldset-question.js";
2
+ import { Question } from "../../../index.js";
3
+ export class YesNoQuestion extends FieldsetQuestion {
4
+ /**
5
+ * @type {string}
6
+ * @protected
7
+ */
8
+ _questionTemplate = Question.PATH + 'radios.njk';
9
+ _fieldName = 'yesNo';
10
+
11
+ /**
12
+ * @returns {Partial<QuestionBaseModel>}
13
+ */
14
+ get customRenderFields() {
15
+ /**
16
+ *
17
+ */
18
+ return {
19
+ type: 'boolean',
20
+ items: (/** @type {ListElement[]} */[{
21
+ id: 'yesNo-yes',
22
+ text: 'Yes',
23
+ value: true,
24
+ label: {
25
+ text: 'Yes',
26
+ classes: ''
27
+ }
28
+ }, {
29
+ id: 'yesNo-no',
30
+ text: 'No',
31
+ value: false,
32
+ label: {
33
+ text: 'No',
34
+ classes: ''
35
+ }
36
+ }])
37
+ };
38
+ }
39
+ }
40
+
41
+ /**
42
+ * @import { QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'
43
+ * @import { ListElement } from '~/src/form/form-editor/types.js'
44
+ */
45
+ //# sourceMappingURL=yes-no.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"yes-no.js","names":["FieldsetQuestion","Question","YesNoQuestion","_questionTemplate","PATH","_fieldName","customRenderFields","type","items","id","text","value","label","classes"],"sources":["../../../../../src/form/form-editor/preview/yes-no.js"],"sourcesContent":["import { FieldsetQuestion } from '~/src/form/form-editor/preview/fieldset-question.js'\nimport { Question } from '~/src/index.js'\n\nexport class YesNoQuestion extends FieldsetQuestion {\n /**\n * @type {string}\n * @protected\n */\n _questionTemplate = Question.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,gBAAgB;AACzB,SAASC,QAAQ;AAEjB,OAAO,MAAMC,aAAa,SAASF,gBAAgB,CAAC;EAClD;AACF;AACA;AACA;EACEG,iBAAiB,GAAGF,QAAQ,CAACG,IAAI,GAAG,YAAY;EAChDC,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 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type Item } from '~/src/index.js'\n\n/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The sub-type of lists\n */\n listSub: string\n\n /**\n * The name of the question (unique id)\n */\n name: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n\n /**\n * The value of checkbox to reveal repeater section\n */\n repeater: string\n\n /**\n * The maximum number of repeater items\n */\n minItems: number\n\n /**\n * The minimum number of repeater items\n */\n maxItems: number\n\n /**\n * The repeater question set name\n */\n questionSetName: string\n\n /**\n * The value of radio to reveal declaration text field\n */\n needDeclaration: string\n\n /**\n * The check answers declaration text\n */\n declarationText: string\n\n /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The number of rows of a textarea\n */\n rows: string\n\n /**\n * The classes to be applied to a field\n */\n classes: string\n\n /**\n * The prefix to be applied to a field\n */\n prefix: string\n\n /**\n * The suffix to be applied to a field\n */\n suffix: string\n\n /**\n * The decimal precision of a number field\n */\n precision: string\n\n /**\n * The lowest number allowed in a field\n */\n min: string\n\n /**\n * The highest number allowed in a field\n */\n max: string\n\n /**\n * The maximum days in the future to allow for a date\n */\n maxFuture: string\n\n /**\n * The maximum days in the past to allow for a date\n */\n maxPast: string\n\n /**\n * The exact number of files to upload\n */\n exactFiles: string\n\n /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: string[]\n\n /**\n * The action required from within a sub-section\n */\n enhancedAction: string\n\n /**\n * Placeholder for inserted section to handle adding/editing radios or checkboxes\n */\n radiosOrCheckboxes: string\n\n /**\n * The unique id of the radio item\n */\n radioId: string\n\n /**\n * The display text of the radio item\n */\n radioText?: string\n\n /**\n * The hint of the radio item\n */\n radioHint?: string\n\n /**\n * The value of the radio item\n */\n radioValue?: string\n\n /**\n * The list name to be applied to a field (if applicable)\n */\n list: string\n\n /**\n * List items in JSON format, such as for radios ro checkboxes\n */\n listItemsData: string\n\n /**\n * An array of options for autocomplete\n */\n autoCompleteOptions: Item[]\n\n /**\n * Set to 'true' is Javascript is enabled\n */\n jsEnabled: string\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'\n>\n\nexport type FormEditorInputCheckAnswersSettings = Pick<\n FormEditor,\n 'needDeclaration' | 'declarationText'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'rows'\n | 'classes'\n | 'prefix'\n | 'suffix'\n | 'precision'\n | 'min'\n | 'max'\n | 'maxFuture'\n | 'maxPast'\n | 'exactFiles'\n | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'list'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n | 'pageHeadingAndGuidance'\n | 'pageHeading'\n | 'guidanceText'\n | 'repeater'\n | 'minItems'\n | 'maxItems'\n | 'questionSetName'\n>\n\nexport type FormEditorInputGuidancePage = Pick<\n FormEditor,\n 'pageHeading' | 'guidanceText'\n>\n\nexport type FormEditorInputQuestionDetails = Pick<\n FormEditorInputQuestion,\n | 'question'\n | 'hintText'\n | 'shortDescription'\n | 'questionOptional'\n | 'questionType'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport interface ListItem {\n id?: string\n text?: string\n hint?: {\n text: string\n }\n value?: string\n}\n\nexport interface ListLabel {\n text: string\n classes: string\n}\n\nexport interface ListElement extends ListItem {\n readonly id: string\n text: string\n value: string\n label: ListLabel\n}\n\nexport interface ReadonlyHint {\n readonly text: string\n}\n\nexport interface ListItemReadonly extends ListElement {\n readonly text: string\n readonly hint?: ReadonlyHint\n readonly value: string\n readonly label: ListLabel\n}\n\nexport interface DateItem {\n name: string\n classes: string\n}\n\nexport interface QuestionSessionState {\n questionType?: ComponentType\n questionDetails?: Partial<ComponentDef>\n editRow?: {\n radioId?: string\n radioText?: string\n radioHint?: string\n radioValue?: string\n expanded?: boolean\n }\n listItems?: ListItem[]\n isReordering?: boolean\n lastMovedId?: string\n lastMoveDirection?: string\n}\n\nexport interface GovukFieldItem {\n text?: string\n value?: string\n checked?: boolean\n}\n\nexport interface GovukField {\n id?: string\n name?: string\n idPrefix?: string\n fieldset?: {\n legend?: { text?: string; isPageHeading?: boolean; classes?: string }\n }\n value?: string | boolean | number | string[] | Item[]\n classes?: string\n label?: {\n text?: string\n html?: string\n classes?: string\n isPageHeading?: boolean\n }\n hint?: { text?: string; html?: string; classes?: string }\n items?: GovukFieldItem[]\n rows?: number\n type?: string\n customTemplate?: string\n}\n\nexport type GovukFieldQuestionOptional = Omit<GovukField, 'name' | 'items'> & {\n name: 'questionOptional'\n items: [\n {\n text?: string\n value?: string\n checked: boolean\n }\n ]\n}\n\nexport type GovukStringField = Omit<GovukField, 'value'> & { value: string }\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n fileTypes?: GovukField\n documentTypes?: GovukField\n imageTypes?: GovukField\n tabularDataTypes?: GovukField\n radiosOrCheckboxes?: GovukField\n autoCompleteOptions?: GovukField\n errorMessage?: { text: string }\n}\n\nexport type FormEditorGovukFieldBase = Omit<\n FormEditorGovukField,\n 'errorMessage'\n>\n\nexport type FormEditorGovukFieldBaseKeys = keyof FormEditorGovukFieldBase\n\nexport interface FormEditorCheckbox {\n text?: string\n hint?: {\n text?: string\n }\n value?: string\n divider?: {\n text?: string\n hint?: string\n value?: string\n }\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/form/form-editor/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport { type Item } from '~/src/index.js'\n\n/**\n * Interface for `FormEditor` Joi schema\n */\nexport interface FormEditor {\n /**\n * The type of the page\n */\n pageType: string\n\n /**\n * The type of the question\n */\n questionType: string | undefined\n\n /**\n * The sub-type of written answer\n */\n writtenAnswerSub: string\n\n /**\n * The sub-type of date\n */\n dateSub: string\n\n /**\n * The sub-type of lists\n */\n listSub: string\n\n /**\n * The name of the question (unique id)\n */\n name: string\n\n /**\n * The text of the question\n */\n question: string\n\n /**\n * The hint text of the question\n */\n hintText: string\n\n /**\n * Denotes if the question is optional\n */\n questionOptional: string\n\n /**\n * The short description of the question\n */\n shortDescription: string\n\n /**\n * The value of checkbox to reveal heading and guidance section\n */\n pageHeadingAndGuidance: string\n\n /**\n * The page heading\n */\n pageHeading: string\n\n /**\n * The page guidance text\n */\n guidanceText: string\n\n /**\n * The value of checkbox to reveal repeater section\n */\n repeater: string\n\n /**\n * The maximum number of repeater items\n */\n minItems: number\n\n /**\n * The minimum number of repeater items\n */\n maxItems: number\n\n /**\n * The repeater question set name\n */\n questionSetName: string\n\n /**\n * The value of radio to reveal declaration text field\n */\n needDeclaration: string\n\n /**\n * The check answers declaration text\n */\n declarationText: string\n\n /**\n * The min length a field can have\n */\n minLength: string\n\n /**\n * The max length a field can have\n */\n maxLength: string\n\n /**\n * The regex value of a field\n */\n regex: string\n\n /**\n * The number of rows of a textarea\n */\n rows: string\n\n /**\n * The classes to be applied to a field\n */\n classes: string\n\n /**\n * The prefix to be applied to a field\n */\n prefix: string\n\n /**\n * The suffix to be applied to a field\n */\n suffix: string\n\n /**\n * The decimal precision of a number field\n */\n precision: string\n\n /**\n * The lowest number allowed in a field\n */\n min: string\n\n /**\n * The highest number allowed in a field\n */\n max: string\n\n /**\n * The maximum days in the future to allow for a date\n */\n maxFuture: string\n\n /**\n * The maximum days in the past to allow for a date\n */\n maxPast: string\n\n /**\n * The exact number of files to upload\n */\n exactFiles: string\n\n /**\n * The minimum number of files to upload\n */\n minFiles: string\n\n /**\n * The maximum number of files to upload\n */\n maxFiles: string\n\n /**\n * The type of files for upload\n */\n fileTypes: string[]\n\n /**\n * The types of document files for upload\n */\n documentTypes: string[]\n\n /**\n * The types of image files for upload\n */\n imageTypes: string[]\n\n /**\n * The types of tabular data files for upload\n */\n tabularDataTypes: string[]\n\n /**\n * The action required from within a sub-section\n */\n enhancedAction: string\n\n /**\n * Placeholder for inserted section to handle adding/editing radios or checkboxes\n */\n radiosOrCheckboxes: string\n\n /**\n * The unique id of the radio item\n */\n radioId: string\n\n /**\n * The display text of the radio item\n */\n radioText?: string\n\n /**\n * The hint of the radio item\n */\n radioHint?: string\n\n /**\n * The value of the radio item\n */\n radioValue?: string\n\n /**\n * The list name to be applied to a field (if applicable)\n */\n list: string\n\n /**\n * List items in JSON format, such as for radios ro checkboxes\n */\n listItemsData: string\n\n /**\n * An array of options for autocomplete\n */\n autoCompleteOptions: Item[]\n\n /**\n * Set to 'true' is Javascript is enabled\n */\n jsEnabled: string\n}\n\nexport type FormEditorInputPage = Pick<\n FormEditor,\n 'pageType' | 'questionType' | 'writtenAnswerSub' | 'dateSub' | 'listSub'\n>\n\nexport type FormEditorInputCheckAnswersSettings = Pick<\n FormEditor,\n 'needDeclaration' | 'declarationText'\n>\n\nexport type FormEditorInputQuestion = Pick<\n FormEditor,\n | 'questionType'\n | 'name'\n | 'question'\n | 'shortDescription'\n | 'hintText'\n | 'questionOptional'\n | 'minLength'\n | 'maxLength'\n | 'regex'\n | 'rows'\n | 'classes'\n | 'prefix'\n | 'suffix'\n | 'precision'\n | 'min'\n | 'max'\n | 'maxFuture'\n | 'maxPast'\n | 'exactFiles'\n | 'minFiles'\n | 'maxFiles'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'list'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport type FormEditorInputPageSettings = Pick<\n FormEditor,\n | 'pageHeadingAndGuidance'\n | 'pageHeading'\n | 'guidanceText'\n | 'repeater'\n | 'minItems'\n | 'maxItems'\n | 'questionSetName'\n>\n\nexport type FormEditorInputGuidancePage = Pick<\n FormEditor,\n 'pageHeading' | 'guidanceText'\n>\n\nexport type FormEditorInputQuestionDetails = Pick<\n FormEditorInputQuestion,\n | 'question'\n | 'hintText'\n | 'shortDescription'\n | 'questionOptional'\n | 'questionType'\n | 'fileTypes'\n | 'documentTypes'\n | 'imageTypes'\n | 'tabularDataTypes'\n | 'autoCompleteOptions'\n | 'enhancedAction'\n | 'radioId'\n | 'radioText'\n | 'radioHint'\n | 'radioValue'\n | 'listItemsData'\n | 'jsEnabled'\n>\n\nexport interface ListItem {\n id?: string\n text?: string\n hint?: {\n text: string\n }\n value?: string | boolean\n}\n\nexport interface ListLabel {\n text: string\n classes: string\n}\n\nexport interface ListElement extends ListItem {\n readonly id: string\n text: string\n value: string | boolean\n label: ListLabel\n}\n\nexport interface ReadonlyHint {\n readonly text: string\n}\n\nexport interface ListItemReadonly extends ListElement {\n readonly text: string\n readonly hint?: ReadonlyHint\n readonly value: string | boolean\n readonly label: ListLabel\n}\n\nexport interface DateItem {\n name: string\n classes: string\n}\n\nexport interface QuestionSessionState {\n questionType?: ComponentType\n questionDetails?: Partial<ComponentDef>\n editRow?: {\n radioId?: string\n radioText?: string\n radioHint?: string\n radioValue?: string | boolean\n expanded?: boolean\n }\n listItems?: ListItem[]\n isReordering?: boolean\n lastMovedId?: string\n lastMoveDirection?: string\n}\n\nexport interface GovukFieldItem {\n text?: string\n value?: string\n checked?: boolean\n}\n\nexport interface GovukField {\n id?: string\n name?: string\n idPrefix?: string\n fieldset?: {\n legend?: { text?: string; isPageHeading?: boolean; classes?: string }\n }\n value?: string | boolean | number | string[] | Item[]\n classes?: string\n label?: {\n text?: string\n html?: string\n classes?: string\n isPageHeading?: boolean\n }\n hint?: { text?: string; html?: string; classes?: string }\n items?: GovukFieldItem[]\n rows?: number\n type?: string\n customTemplate?: string\n}\n\nexport type GovukFieldQuestionOptional = Omit<GovukField, 'name' | 'items'> & {\n name: 'questionOptional'\n items: [\n {\n text?: string\n value?: string\n checked: boolean\n }\n ]\n}\n\nexport type GovukStringField = Omit<GovukField, 'value'> & { value: string }\n\nexport interface FormEditorGovukField {\n question?: GovukField\n hintText?: GovukField\n questionOptional?: GovukField\n shortDescription?: GovukField\n fileTypes?: GovukField\n documentTypes?: GovukField\n imageTypes?: GovukField\n tabularDataTypes?: GovukField\n radiosOrCheckboxes?: GovukField\n autoCompleteOptions?: GovukField\n errorMessage?: { text: string }\n}\n\nexport type FormEditorGovukFieldBase = Omit<\n FormEditorGovukField,\n 'errorMessage'\n>\n\nexport type FormEditorGovukFieldBaseKeys = keyof FormEditorGovukFieldBase\n\nexport interface FormEditorCheckbox {\n text?: string\n hint?: {\n text?: string\n }\n value?: string\n divider?: {\n text?: string\n hint?: string\n value?: string\n }\n}\n"],"mappings":"","ignoreList":[]}
@@ -63,10 +63,23 @@ export class QuestionPreviewElements implements ListElements {
63
63
  setPreviewHTML(_value: string): void;
64
64
  }
65
65
  export const baseElements: BaseSettings;
66
+ export namespace listElementsStub {
67
+ export { list1Id };
68
+ export { list2Id };
69
+ export { list3Id };
70
+ export { list4Id };
71
+ export { listElementsBase as baseElements };
72
+ }
66
73
  import type { QuestionRenderer } from '../../../form/form-editor/preview/types.js';
67
74
  import type { QuestionBaseModel } from '../../../form/form-editor/preview/types.js';
68
75
  import type { RenderContext } from '../../../form/form-editor/preview/types.js';
69
76
  import type { ListElements } from '../../../form/form-editor/preview/types.js';
70
77
  import type { ListElement } from '../../../form/form-editor/types.js';
71
78
  import type { BaseSettings } from '../../../form/form-editor/preview/types.js';
79
+ declare const list1Id: "414d82a3-4cab-416a-bd54-6b86fbd51120";
80
+ declare const list2Id: "801385a4-81e6-4171-96c3-6c6727d97f22";
81
+ declare const list3Id: "e6e3f621-b875-4ca3-a054-cca9149149dd";
82
+ declare const list4Id: "d71b3909-582f-4e90-b6f5-490b89a6eb8f";
83
+ declare const listElementsBase: BaseSettings;
84
+ export {};
72
85
  //# sourceMappingURL=preview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAqBE;;;;OAIG;IACH,oCAHW,MAAM,kBACN,aAAa,GAFX,MAAM,CAMlB;IAtBD;;OAEG;IACH,wBAFW,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAItD;IAVD;;OAEG;IACH,YAFU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAE5C;IASV;;;OAGG;IACH,yBAHW,MAAM,qBACN,iBAAiB,QAI3B;CAUF;AAED;;GAEG;AACH;IAuBE;;OAEG;IACH,gEAFW,YAAY,EAQtB;IA/BD;;OAEG;IACH,4BAAc;IACd,iBAAiB;IACjB,4BAAc;IACd,iBAAiB;IACjB,6BAAiB;IACjB;;;OAGG;IACH,sBAHU,MAAM,CAGD;IACf;;;;OAIG;IACH,eAAW;IAEX,wBAA2E;IAa3E;;;;;;MAQC;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;CACF;AAED,2BAAuC,YAAY,CAMjD;sCAIoH,yCAAyC;uCAAzC,yCAAyC;mCAAzC,yCAAyC;kCAAzC,yCAAyC;iCAD9H,iCAAiC;kCACoD,yCAAyC"}
1
+ {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/__stubs__/preview.js"],"names":[],"mappings":"AAAA;;GAEG;AACH;IAqBE;;;;OAIG;IACH,oCAHW,MAAM,kBACN,aAAa,GAFX,MAAM,CAMlB;IAtBD;;OAEG;IACH,wBAFW,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAItD;IAVD;;OAEG;IACH,YAFU,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAE5C;IASV;;;OAGG;IACH,yBAHW,MAAM,qBACN,iBAAiB,QAI3B;CAUF;AAED;;GAEG;AACH;IAuBE;;OAEG;IACH,gEAFW,YAAY,EAQtB;IA/BD;;OAEG;IACH,4BAAc;IACd,iBAAiB;IACjB,4BAAc;IACd,iBAAiB;IACjB,6BAAiB;IACjB;;;OAGG;IACH,sBAHU,MAAM,CAGD;IACf;;;;OAIG;IACH,eAAW;IAEX,wBAA2E;IAa3E;;;;;;MAQC;IAED;;OAEG;IACH,uBAFW,MAAM,QAIhB;CACF;AAED,2BAAuC,YAAY,CAMjD;;;;;;;;sCA+CoH,yCAAyC;uCAAzC,yCAAyC;mCAAzC,yCAAyC;kCAAzC,yCAAyC;iCAD9H,iCAAiC;kCACoD,yCAAyC;AA7C/J,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AACtD,uBAAgB,sCAAsC,CAAA;AAEtD,gCAAoC,YAAY,CA4B9C"}
@@ -0,0 +1,4 @@
1
+ export class CheckboxSortableQuestion extends ListSortableQuestion {
2
+ }
3
+ import { ListSortableQuestion } from '../../../form/form-editor/preview/list-sortable.js';
4
+ //# sourceMappingURL=checkbox-sortable.d.ts.map