@defra/forms-model 3.0.564 → 3.0.565
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/form/form-editor/preview/autocomplete.js +2 -1
 - package/dist/module/form/form-editor/preview/autocomplete.js.map +1 -1
 - package/dist/module/form/form-editor/preview/controller/page-controller.js.map +1 -1
 - package/dist/module/form/form-editor/preview/fieldset-question.js +2 -1
 - package/dist/module/form/form-editor/preview/fieldset-question.js.map +1 -1
 - package/dist/module/form/form-editor/preview/preview.js +2 -1
 - package/dist/module/form/form-editor/preview/preview.js.map +1 -1
 - package/dist/module/form/form-editor/preview/select-sortable.js +2 -1
 - package/dist/module/form/form-editor/preview/select-sortable.js.map +1 -1
 - package/dist/module/form/form-editor/preview/select.js +2 -1
 - package/dist/module/form/form-editor/preview/select.js.map +1 -1
 - package/dist/module/form/form-editor/preview/utils.js +9 -0
 - package/dist/module/form/form-editor/preview/utils.js.map +1 -0
 - package/dist/types/form/form-editor/preview/autocomplete.d.ts.map +1 -1
 - package/dist/types/form/form-editor/preview/controller/page-controller.d.ts.map +1 -1
 - package/dist/types/form/form-editor/preview/fieldset-question.d.ts.map +1 -1
 - package/dist/types/form/form-editor/preview/preview.d.ts.map +1 -1
 - package/dist/types/form/form-editor/preview/select-sortable.d.ts.map +1 -1
 - package/dist/types/form/form-editor/preview/select.d.ts.map +1 -1
 - package/dist/types/form/form-editor/preview/utils.d.ts +6 -0
 - package/dist/types/form/form-editor/preview/utils.d.ts.map +1 -0
 - package/package.json +1 -1
 - package/src/form/form-editor/preview/autocomplete.js +2 -1
 - package/src/form/form-editor/preview/controller/page-controller.js +1 -0
 - package/src/form/form-editor/preview/fieldset-question.js +2 -1
 - package/src/form/form-editor/preview/preview.js +2 -1
 - package/src/form/form-editor/preview/select-sortable.js +2 -1
 - package/src/form/form-editor/preview/select.js +2 -1
 - package/src/form/form-editor/preview/utils.js +8 -0
 
| 
         @@ -2,6 +2,7 @@ import { ComponentType } from "../../../components/enums.js"; 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { autoCompleteOptionsSchema } from "../index.js";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { PreviewComponent } from "./preview.js";
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { Question } from "./question.js";
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { buildCombinedId } from "./utils.js";
         
     | 
| 
       5 
6 
     | 
    
         
             
            export class AutocompleteListQuestion extends Question {
         
     | 
| 
       6 
7 
     | 
    
         
             
              /**
         
     | 
| 
       7 
8 
     | 
    
         
             
               * @type {ComponentType}
         
     | 
| 
         @@ -68,7 +69,7 @@ export class AutocompleteQuestion extends AutocompleteListQuestion { 
     | 
|
| 
       68 
69 
     | 
    
         
             
              }
         
     | 
| 
       69 
70 
     | 
    
         
             
              get renderInput() {
         
     | 
| 
       70 
71 
     | 
    
         
             
                return {
         
     | 
| 
       71 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 72 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       72 
73 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       73 
74 
     | 
    
         
             
                  attributes: {
         
     | 
| 
       74 
75 
     | 
    
         
             
                    'data-module': 'govuk-accessible-autocomplete'
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"autocomplete.js","names":["ComponentType","autoCompleteOptionsSchema","PreviewComponent","Question","AutocompleteListQuestion","componentType","AutocompleteField","_questionTemplate","PATH","_fieldName","customRenderFields","attributes","items","_htmlElements","values","AutocompleteQuestion","_autocompleteList","constructor","autocompleteElements","questionRenderer","setAutocompleteList","autocompleteOptions","autoCompleteList","id","value","text","listHTML","validationResult","validate","error","map","render","renderInput","name","hint","label"],"sources":["../../../../../src/form/form-editor/preview/autocomplete.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { autoCompleteOptionsSchema } from '~/src/form/form-editor/index.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\n\nexport class AutocompleteListQuestion extends Question {\n  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.AutocompleteField\n  _questionTemplate = PreviewComponent.PATH + 'autocompletefield.njk'\n  /**\n   * @type {string}\n   * @protected\n   */\n  _fieldName = 'autoCompleteField'\n\n  /**\n   * @returns {Partial<QuestionBaseModel>}\n   */\n  get customRenderFields() {\n    return {\n      attributes: { 'data-module': 'govuk-accessible-autocomplete' },\n      items: this._htmlElements.values.items\n    }\n  }\n}\n\nexport class AutocompleteQuestion extends AutocompleteListQuestion {\n  /**\n   * @type {ListElement[]}\n   * @private\n   */\n  _autocompleteList = []\n  /**\n   * @param {AutocompleteElements} autocompleteElements\n   * @param {QuestionRenderer} questionRenderer\n   */\n  constructor(autocompleteElements, questionRenderer) {\n    super(autocompleteElements, questionRenderer)\n    this.setAutocompleteList(autocompleteElements.autocompleteOptions)\n  }\n\n  get autoCompleteList() {\n    return [{ id: '', value: '', text: '' }, ...this._autocompleteList]\n  }\n\n  /**\n   * @param {string} listHTML\n   */\n  setAutocompleteList(listHTML) {\n    const validationResult =\n      /** @type {ValidationResult<{text: string, value: string}[]>} */ (\n        autoCompleteOptionsSchema.validate(listHTML)\n      )\n\n    if (!validationResult.error) {\n      this._autocompleteList = validationResult.value.map(\n        ({ text, value }) => ({\n          id: text,\n          text,\n          value\n        })\n      )\n      this.render()\n    }\n  }\n\n  get renderInput() {\n    return {\n      id: this._fieldName,\n      name: this._fieldName,\n      attributes: { 'data-module': 'govuk-accessible-autocomplete' },\n      hint: this.hint,\n      label: this.label,\n      items: this.autoCompleteList\n    }\n  }\n}\n\n/**\n * @import { ValidationResult } from 'joi'\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { AutocompleteElements, QuestionRenderer, QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,yBAAyB;AAClC,SAASC,gBAAgB;AACzB,SAASC,QAAQ; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"autocomplete.js","names":["ComponentType","autoCompleteOptionsSchema","PreviewComponent","Question","buildCombinedId","AutocompleteListQuestion","componentType","AutocompleteField","_questionTemplate","PATH","_fieldName","customRenderFields","attributes","items","_htmlElements","values","AutocompleteQuestion","_autocompleteList","constructor","autocompleteElements","questionRenderer","setAutocompleteList","autocompleteOptions","autoCompleteList","id","value","text","listHTML","validationResult","validate","error","map","render","renderInput","_id","name","hint","label"],"sources":["../../../../../src/form/form-editor/preview/autocomplete.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { autoCompleteOptionsSchema } from '~/src/form/form-editor/index.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\nimport { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'\n\nexport class AutocompleteListQuestion extends Question {\n  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.AutocompleteField\n  _questionTemplate = PreviewComponent.PATH + 'autocompletefield.njk'\n  /**\n   * @type {string}\n   * @protected\n   */\n  _fieldName = 'autoCompleteField'\n\n  /**\n   * @returns {Partial<QuestionBaseModel>}\n   */\n  get customRenderFields() {\n    return {\n      attributes: { 'data-module': 'govuk-accessible-autocomplete' },\n      items: this._htmlElements.values.items\n    }\n  }\n}\n\nexport class AutocompleteQuestion extends AutocompleteListQuestion {\n  /**\n   * @type {ListElement[]}\n   * @private\n   */\n  _autocompleteList = []\n  /**\n   * @param {AutocompleteElements} autocompleteElements\n   * @param {QuestionRenderer} questionRenderer\n   */\n  constructor(autocompleteElements, questionRenderer) {\n    super(autocompleteElements, questionRenderer)\n    this.setAutocompleteList(autocompleteElements.autocompleteOptions)\n  }\n\n  get autoCompleteList() {\n    return [{ id: '', value: '', text: '' }, ...this._autocompleteList]\n  }\n\n  /**\n   * @param {string} listHTML\n   */\n  setAutocompleteList(listHTML) {\n    const validationResult =\n      /** @type {ValidationResult<{text: string, value: string}[]>} */ (\n        autoCompleteOptionsSchema.validate(listHTML)\n      )\n\n    if (!validationResult.error) {\n      this._autocompleteList = validationResult.value.map(\n        ({ text, value }) => ({\n          id: text,\n          text,\n          value\n        })\n      )\n      this.render()\n    }\n  }\n\n  get renderInput() {\n    return {\n      id: buildCombinedId(this._fieldName, this._id),\n      name: this._fieldName,\n      attributes: { 'data-module': 'govuk-accessible-autocomplete' },\n      hint: this.hint,\n      label: this.label,\n      items: this.autoCompleteList\n    }\n  }\n}\n\n/**\n * @import { ValidationResult } from 'joi'\n * @import { ListElement } from '~/src/form/form-editor/types.js'\n * @import { AutocompleteElements, QuestionRenderer, QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,yBAAyB;AAClC,SAASC,gBAAgB;AACzB,SAASC,QAAQ;AACjB,SAASC,eAAe;AAExB,OAAO,MAAMC,wBAAwB,SAASF,QAAQ,CAAC;EACrD;AACF;AACA;EACEG,aAAa,GAAGN,aAAa,CAACO,iBAAiB;EAC/CC,iBAAiB,GAAGN,gBAAgB,CAACO,IAAI,GAAG,uBAAuB;EACnE;AACF;AACA;AACA;EACEC,UAAU,GAAG,mBAAmB;;EAEhC;AACF;AACA;EACE,IAAIC,kBAAkBA,CAAA,EAAG;IACvB,OAAO;MACLC,UAAU,EAAE;QAAE,aAAa,EAAE;MAAgC,CAAC;MAC9DC,KAAK,EAAE,IAAI,CAACC,aAAa,CAACC,MAAM,CAACF;IACnC,CAAC;EACH;AACF;AAEA,OAAO,MAAMG,oBAAoB,SAASX,wBAAwB,CAAC;EACjE;AACF;AACA;AACA;EACEY,iBAAiB,GAAG,EAAE;EACtB;AACF;AACA;AACA;EACEC,WAAWA,CAACC,oBAAoB,EAAEC,gBAAgB,EAAE;IAClD,KAAK,CAACD,oBAAoB,EAAEC,gBAAgB,CAAC;IAC7C,IAAI,CAACC,mBAAmB,CAACF,oBAAoB,CAACG,mBAAmB,CAAC;EACpE;EAEA,IAAIC,gBAAgBA,CAAA,EAAG;IACrB,OAAO,CAAC;MAAEC,EAAE,EAAE,EAAE;MAAEC,KAAK,EAAE,EAAE;MAAEC,IAAI,EAAE;IAAG,CAAC,EAAE,GAAG,IAAI,CAACT,iBAAiB,CAAC;EACrE;;EAEA;AACF;AACA;EACEI,mBAAmBA,CAACM,QAAQ,EAAE;IAC5B,MAAMC,gBAAgB,GACpB;IACE3B,yBAAyB,CAAC4B,QAAQ,CAACF,QAAQ,CAC5C;IAEH,IAAI,CAACC,gBAAgB,CAACE,KAAK,EAAE;MAC3B,IAAI,CAACb,iBAAiB,GAAGW,gBAAgB,CAACH,KAAK,CAACM,GAAG,CACjD,CAAC;QAAEL,IAAI;QAAED;MAAM,CAAC,MAAM;QACpBD,EAAE,EAAEE,IAAI;QACRA,IAAI;QACJD;MACF,CAAC,CACH,CAAC;MACD,IAAI,CAACO,MAAM,CAAC,CAAC;IACf;EACF;EAEA,IAAIC,WAAWA,CAAA,EAAG;IAChB,OAAO;MACLT,EAAE,EAAEpB,eAAe,CAAC,IAAI,CAACM,UAAU,EAAE,IAAI,CAACwB,GAAG,CAAC;MAC9CC,IAAI,EAAE,IAAI,CAACzB,UAAU;MACrBE,UAAU,EAAE;QAAE,aAAa,EAAE;MAAgC,CAAC;MAC9DwB,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBxB,KAAK,EAAE,IAAI,CAACU;IACd,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA;AACA","ignoreList":[]}
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"page-controller.js","names":["PreviewPageControllerBase","mapComponentToPreviewQuestion","Markdown","questionRenderer","render","_questionTemplate","_questionBaseModel","PreviewPageController","PATH","_components","constructor","components","elements","definition","renderer","questions","map","firstQuestion","shift","_guidanceComponent","getOrCreateGuidanceComponent","_guidanceText","guidance","constructComponents","_showTitle","addHeading","_sectionTitle","repeatQuestion","_isRepeater","hasRepeater","HighlightClass","#constructComponents","undefined","componentsWithGuidance","_guidanceComponents","component","model","_overrideComponentHeading","questionType","componentType","showLargeTitle","componentsLength","length","_highlighted","_title","trim","question","largeTitle","fieldset","renderInput","legend","classes","label","titleAndFirstTitleSame","_getTitle","_getGuidanceText","repeaterText","_getSectionTitleText","repeaterButton","repeaterButtonText","_isHighlighted","REPEATER","text","firstToken","rest","restOfStr","join","toLowerCase","guidanceComponent","createGuidanceComponent"],"sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"sourcesContent":["import { PreviewPageControllerBase } from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nimport { mapComponentToPreviewQuestion } from '~/src/form/form-editor/preview/helpers.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\n\n/**\n * @type {QuestionRenderer}\n */\nconst questionRenderer = {\n  /**\n   * @param {string} _questionTemplate\n   * @param {QuestionBaseModel} _questionBaseModel\n   */\n  render(_questionTemplate, _questionBaseModel) {\n    //\n  }\n}\n\nexport class PreviewPageController extends PreviewPageControllerBase {\n  static PATH = PreviewPageControllerBase.PATH\n  /**\n   * @protected\n   * @type {Question[]}\n   */\n  _components = []\n\n  /**\n   * @param {ComponentDef[]} components\n   * @param {PageOverviewElements} elements\n   * @param {FormDefinition} definition\n   * @param {PageRenderer} renderer\n   */\n  constructor(components, elements, definition, renderer) {\n    super(elements, renderer)\n    const questions = components.map(\n      mapComponentToPreviewQuestion(questionRenderer, definition)\n    )\n    const firstQuestion = /** @type { Markdown | undefined | Question }  */ (\n      questions.shift()\n    )\n    this._guidanceComponent =\n      PreviewPageController.getOrCreateGuidanceComponent(firstQuestion)\n    this._guidanceText = elements.guidance\n    this._components = this.#constructComponents(firstQuestion, questions)\n    this._showTitle = elements.addHeading\n    this._sectionTitle = elements.repeatQuestion ?? ''\n    this._isRepeater = elements.hasRepeater\n  }\n\n  /**\n   * @type {typeof PreviewPageControllerBase.HighlightClass}\n   */\n  static HighlightClass = PreviewPageControllerBase.HighlightClass\n\n  /**\n   * @param { Question | Markdown | undefined} firstQuestion\n   * @param {Question[]} questions\n   * @returns {Question[]}\n   */\n  #constructComponents(firstQuestion, questions) {\n    return firstQuestion instanceof Markdown || firstQuestion === undefined\n      ? questions\n      : [firstQuestion, ...questions]\n  }\n\n  /**\n   * @returns {PagePreviewComponent[]}\n   */\n  get components() {\n    const componentsWithGuidance = /** @type {Question[]} */ ([\n      ...this._guidanceComponents,\n      ...this._components\n    ])\n\n    return componentsWithGuidance.map((component) => {\n      return {\n        model: this._overrideComponentHeading(component),\n        questionType: component.componentType\n      }\n    })\n  }\n\n  /**\n   * @returns {boolean}\n   */\n  get showLargeTitle() {\n    const componentsLength =\n      this._components.length + this._guidanceComponents.length\n\n    if (componentsLength > 1 || this._highlighted === 'title') {\n      return false\n    }\n    // |_ one component and title not highlighted\n    if (this._title.trim() === this._components[0]?.question?.trim()) {\n      return true\n    }\n    // titles not the same\n\n    return !this._showTitle // add page heading deselected?\n  }\n\n  /**\n   * @param {PreviewComponent} component\n   * @returns {QuestionBaseModel}\n   */\n  _overrideComponentHeading(component) {\n    const largeTitle = this.showLargeTitle\n\n    const fieldset = component.renderInput.fieldset\n      ? {\n          fieldset: {\n            legend: {\n              ...component.renderInput.fieldset.legend,\n              classes: largeTitle\n                ? 'govuk-fieldset__legend--l'\n                : 'govuk-fieldset__legend--m'\n            }\n          }\n        }\n      : {}\n\n    const label = component.renderInput.label\n      ? {\n          label: {\n            ...component.renderInput.label,\n            classes: largeTitle ? 'govuk-label--l' : 'govuk-label--m'\n          }\n        }\n      : {}\n\n    return {\n      ...component.renderInput,\n      ...fieldset,\n      ...label\n    }\n  }\n\n  /**\n   * @returns {boolean}\n   */\n  get titleAndFirstTitleSame() {\n    return (\n      this._components.length > 0 &&\n      this._title.trim() === this._components[0]?.question?.trim() &&\n      this.components.length === 1 &&\n      this._highlighted !== 'title'\n    )\n  }\n\n  /**\n   * @returns {string}\n   * @protected\n   */\n  _getTitle() {\n    if (!this._showTitle || this.titleAndFirstTitleSame) {\n      return ''\n    }\n    return super._getTitle()\n  }\n\n  /**\n   * @returns {string}\n   * @protected\n   */\n  _getGuidanceText() {\n    if (!this._showTitle) {\n      return ''\n    }\n    return super._getGuidanceText()\n  }\n\n  get repeaterText() {\n    if (!this._isRepeater) {\n      return undefined\n    }\n    if (!this._sectionTitle.length) {\n      return 'Question set name'\n    }\n    return this._sectionTitle + ' 1'\n  }\n\n  /**\n   * @returns {string|undefined}\n   * @protected\n   */\n  _getSectionTitleText() {\n    if (this._isRepeater) {\n      return this.repeaterText\n    }\n    return undefined\n  }\n\n  get repeaterButton() {\n    if (this.repeaterButtonText === undefined) {\n      return undefined\n    }\n    return {\n      classes: this._isHighlighted(\n        PreviewPageControllerBase.HighlightClass.REPEATER\n      ),\n      text: this.repeaterButtonText\n    }\n  }\n\n  get repeaterButtonText() {\n    if (!this._isRepeater) {\n      return undefined\n    }\n\n    if (this._sectionTitle === '') {\n      return '[question set name]'\n    }\n\n    const [firstToken, ...rest] = this._sectionTitle\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    const restOfStr = rest ? rest.join('') : ''\n    return firstToken.toLowerCase() + restOfStr\n  }\n\n  /**\n   * Helper method to return the guidance or a new one\n   * @param { Markdown | Question | undefined } guidanceComponent\n   * @returns {Markdown}\n   * @private\n   */\n  static getOrCreateGuidanceComponent(guidanceComponent) {\n    if (guidanceComponent instanceof Markdown) {\n      return guidanceComponent\n    }\n    return PreviewPageControllerBase.createGuidanceComponent()\n  }\n}\n\n/**\n * @import { PageRenderer, PageOverviewElements, QuestionRenderer, QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n * @import { PagePreviewComponent } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,yBAAyB;AAClC,SAASC,6BAA6B;AACtC,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG;EACvB;AACF;AACA;AACA;EACEC,MAAMA,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;IAC5C;EAAA;AAEJ,CAAC;AAED,OAAO,MAAMC,qBAAqB,SAASP,yBAAyB,CAAC;EACnE,OAAOQ,IAAI,GAAGR,yBAAyB,CAACQ,IAAI;EAC5C;AACF;AACA;AACA;EACEC,WAAW,GAAG,EAAE;;EAEhB;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,UAAU,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IACtD,KAAK,CAACF,QAAQ,EAAEE,QAAQ,CAAC;IACzB,MAAMC,SAAS,GAAGJ,UAAU,CAACK,GAAG,CAC9Bf,6BAA6B,CAACE,gBAAgB,EAAEU,UAAU,CAC5D,CAAC;IACD,MAAMI,aAAa,GAAG;IACpBF,SAAS,CAACG,KAAK,CAAC,CACjB;IACD,IAAI,CAACC,kBAAkB,GACrBZ,qBAAqB,CAACa,4BAA4B,CAACH,aAAa,CAAC;IACnE,IAAI,CAACI,aAAa,GAAGT,QAAQ,CAACU,QAAQ;IACtC,IAAI,CAACb,WAAW,GAAG,IAAI,CAAC,CAACc,mBAAmB,CAACN,aAAa,EAAEF,SAAS,CAAC;IACtE,IAAI,CAACS,UAAU,GAAGZ,QAAQ,CAACa,UAAU;IACrC,IAAI,CAACC,aAAa,GAAGd,QAAQ,CAACe,cAAc,IAAI,EAAE;IAClD,IAAI,CAACC,WAAW,GAAGhB,QAAQ,CAACiB,WAAW;EACzC;;EAEA;AACF;AACA;EACE,OAAOC,cAAc,GAAG9B,yBAAyB,CAAC8B,cAAc;;EAEhE;AACF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      
 1 
     | 
    
         
            +
            {"version":3,"file":"page-controller.js","names":["PreviewPageControllerBase","mapComponentToPreviewQuestion","Markdown","questionRenderer","render","_questionTemplate","_questionBaseModel","PreviewPageController","PATH","_components","constructor","components","elements","definition","renderer","questions","map","firstQuestion","shift","_guidanceComponent","getOrCreateGuidanceComponent","_guidanceText","guidance","constructComponents","_showTitle","addHeading","_sectionTitle","repeatQuestion","_isRepeater","hasRepeater","HighlightClass","#constructComponents","undefined","componentsWithGuidance","_guidanceComponents","component","model","_overrideComponentHeading","questionType","componentType","showLargeTitle","componentsLength","length","_highlighted","_title","trim","question","largeTitle","fieldset","renderInput","legend","classes","label","titleAndFirstTitleSame","_getTitle","_getGuidanceText","repeaterText","_getSectionTitleText","repeaterButton","repeaterButtonText","_isHighlighted","REPEATER","text","firstToken","rest","restOfStr","join","toLowerCase","guidanceComponent","createGuidanceComponent"],"sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"sourcesContent":["import { PreviewPageControllerBase } from '~/src/form/form-editor/preview/controller/page-controller-base.js'\nimport { mapComponentToPreviewQuestion } from '~/src/form/form-editor/preview/helpers.js'\nimport { Markdown } from '~/src/form/form-editor/preview/markdown.js'\n\n/**\n * @type {QuestionRenderer}\n */\nconst questionRenderer = {\n  /**\n   * @param {string} _questionTemplate\n   * @param {QuestionBaseModel} _questionBaseModel\n   */\n  render(_questionTemplate, _questionBaseModel) {\n    //\n  }\n}\n\nexport class PreviewPageController extends PreviewPageControllerBase {\n  static PATH = PreviewPageControllerBase.PATH\n  /**\n   * @protected\n   * @type {Question[]}\n   */\n  _components = []\n\n  /**\n   * @param {ComponentDef[]} components\n   * @param {PageOverviewElements} elements\n   * @param {FormDefinition} definition\n   * @param {PageRenderer} renderer\n   */\n  constructor(components, elements, definition, renderer) {\n    super(elements, renderer)\n    const questions = components.map(\n      mapComponentToPreviewQuestion(questionRenderer, definition)\n    )\n\n    const firstQuestion = /** @type { Markdown | undefined | Question }  */ (\n      questions.shift()\n    )\n    this._guidanceComponent =\n      PreviewPageController.getOrCreateGuidanceComponent(firstQuestion)\n    this._guidanceText = elements.guidance\n    this._components = this.#constructComponents(firstQuestion, questions)\n    this._showTitle = elements.addHeading\n    this._sectionTitle = elements.repeatQuestion ?? ''\n    this._isRepeater = elements.hasRepeater\n  }\n\n  /**\n   * @type {typeof PreviewPageControllerBase.HighlightClass}\n   */\n  static HighlightClass = PreviewPageControllerBase.HighlightClass\n\n  /**\n   * @param { Question | Markdown | undefined} firstQuestion\n   * @param {Question[]} questions\n   * @returns {Question[]}\n   */\n  #constructComponents(firstQuestion, questions) {\n    return firstQuestion instanceof Markdown || firstQuestion === undefined\n      ? questions\n      : [firstQuestion, ...questions]\n  }\n\n  /**\n   * @returns {PagePreviewComponent[]}\n   */\n  get components() {\n    const componentsWithGuidance = /** @type {Question[]} */ ([\n      ...this._guidanceComponents,\n      ...this._components\n    ])\n\n    return componentsWithGuidance.map((component) => {\n      return {\n        model: this._overrideComponentHeading(component),\n        questionType: component.componentType\n      }\n    })\n  }\n\n  /**\n   * @returns {boolean}\n   */\n  get showLargeTitle() {\n    const componentsLength =\n      this._components.length + this._guidanceComponents.length\n\n    if (componentsLength > 1 || this._highlighted === 'title') {\n      return false\n    }\n    // |_ one component and title not highlighted\n    if (this._title.trim() === this._components[0]?.question?.trim()) {\n      return true\n    }\n    // titles not the same\n\n    return !this._showTitle // add page heading deselected?\n  }\n\n  /**\n   * @param {PreviewComponent} component\n   * @returns {QuestionBaseModel}\n   */\n  _overrideComponentHeading(component) {\n    const largeTitle = this.showLargeTitle\n\n    const fieldset = component.renderInput.fieldset\n      ? {\n          fieldset: {\n            legend: {\n              ...component.renderInput.fieldset.legend,\n              classes: largeTitle\n                ? 'govuk-fieldset__legend--l'\n                : 'govuk-fieldset__legend--m'\n            }\n          }\n        }\n      : {}\n\n    const label = component.renderInput.label\n      ? {\n          label: {\n            ...component.renderInput.label,\n            classes: largeTitle ? 'govuk-label--l' : 'govuk-label--m'\n          }\n        }\n      : {}\n\n    return {\n      ...component.renderInput,\n      ...fieldset,\n      ...label\n    }\n  }\n\n  /**\n   * @returns {boolean}\n   */\n  get titleAndFirstTitleSame() {\n    return (\n      this._components.length > 0 &&\n      this._title.trim() === this._components[0]?.question?.trim() &&\n      this.components.length === 1 &&\n      this._highlighted !== 'title'\n    )\n  }\n\n  /**\n   * @returns {string}\n   * @protected\n   */\n  _getTitle() {\n    if (!this._showTitle || this.titleAndFirstTitleSame) {\n      return ''\n    }\n    return super._getTitle()\n  }\n\n  /**\n   * @returns {string}\n   * @protected\n   */\n  _getGuidanceText() {\n    if (!this._showTitle) {\n      return ''\n    }\n    return super._getGuidanceText()\n  }\n\n  get repeaterText() {\n    if (!this._isRepeater) {\n      return undefined\n    }\n    if (!this._sectionTitle.length) {\n      return 'Question set name'\n    }\n    return this._sectionTitle + ' 1'\n  }\n\n  /**\n   * @returns {string|undefined}\n   * @protected\n   */\n  _getSectionTitleText() {\n    if (this._isRepeater) {\n      return this.repeaterText\n    }\n    return undefined\n  }\n\n  get repeaterButton() {\n    if (this.repeaterButtonText === undefined) {\n      return undefined\n    }\n    return {\n      classes: this._isHighlighted(\n        PreviewPageControllerBase.HighlightClass.REPEATER\n      ),\n      text: this.repeaterButtonText\n    }\n  }\n\n  get repeaterButtonText() {\n    if (!this._isRepeater) {\n      return undefined\n    }\n\n    if (this._sectionTitle === '') {\n      return '[question set name]'\n    }\n\n    const [firstToken, ...rest] = this._sectionTitle\n    // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n    const restOfStr = rest ? rest.join('') : ''\n    return firstToken.toLowerCase() + restOfStr\n  }\n\n  /**\n   * Helper method to return the guidance or a new one\n   * @param { Markdown | Question | undefined } guidanceComponent\n   * @returns {Markdown}\n   * @private\n   */\n  static getOrCreateGuidanceComponent(guidanceComponent) {\n    if (guidanceComponent instanceof Markdown) {\n      return guidanceComponent\n    }\n    return PreviewPageControllerBase.createGuidanceComponent()\n  }\n}\n\n/**\n * @import { PageRenderer, PageOverviewElements, QuestionRenderer, QuestionBaseModel } from '~/src/form/form-editor/preview/types.js'\n * @import { Question } from '~/src/form/form-editor/preview/question.js'\n * @import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n * @import { FormDefinition } from '~/src/form/form-definition/types.js'\n * @import { ComponentDef } from '~/src/components/types.js'\n * @import { PagePreviewComponent } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,yBAAyB;AAClC,SAASC,6BAA6B;AACtC,SAASC,QAAQ;;AAEjB;AACA;AACA;AACA,MAAMC,gBAAgB,GAAG;EACvB;AACF;AACA;AACA;EACEC,MAAMA,CAACC,iBAAiB,EAAEC,kBAAkB,EAAE;IAC5C;EAAA;AAEJ,CAAC;AAED,OAAO,MAAMC,qBAAqB,SAASP,yBAAyB,CAAC;EACnE,OAAOQ,IAAI,GAAGR,yBAAyB,CAACQ,IAAI;EAC5C;AACF;AACA;AACA;EACEC,WAAW,GAAG,EAAE;;EAEhB;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,UAAU,EAAEC,QAAQ,EAAEC,UAAU,EAAEC,QAAQ,EAAE;IACtD,KAAK,CAACF,QAAQ,EAAEE,QAAQ,CAAC;IACzB,MAAMC,SAAS,GAAGJ,UAAU,CAACK,GAAG,CAC9Bf,6BAA6B,CAACE,gBAAgB,EAAEU,UAAU,CAC5D,CAAC;IAED,MAAMI,aAAa,GAAG;IACpBF,SAAS,CAACG,KAAK,CAAC,CACjB;IACD,IAAI,CAACC,kBAAkB,GACrBZ,qBAAqB,CAACa,4BAA4B,CAACH,aAAa,CAAC;IACnE,IAAI,CAACI,aAAa,GAAGT,QAAQ,CAACU,QAAQ;IACtC,IAAI,CAACb,WAAW,GAAG,IAAI,CAAC,CAACc,mBAAmB,CAACN,aAAa,EAAEF,SAAS,CAAC;IACtE,IAAI,CAACS,UAAU,GAAGZ,QAAQ,CAACa,UAAU;IACrC,IAAI,CAACC,aAAa,GAAGd,QAAQ,CAACe,cAAc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,OAAOkE,iBAAiB;IAC1B;IACA,OAAOpE,yBAAyB,CAACqE,uBAAuB,CAAC,CAAC;EAC5D;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { ComponentType } from "../../../components/enums.js";
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from "./constants.js";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { Question } from "./question.js";
         
     | 
| 
      
 4 
     | 
    
         
            +
            import { buildCombinedId } from "./utils.js";
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            /**
         
     | 
| 
       6 
7 
     | 
    
         
             
             * Simple extension of Question that uses fieldset instead of label - not exported
         
     | 
| 
         @@ -18,7 +19,7 @@ export class FieldsetQuestion extends Question { 
     | 
|
| 
       18 
19 
     | 
    
         
             
               */
         
     | 
| 
       19 
20 
     | 
    
         
             
              _renderInput() {
         
     | 
| 
       20 
21 
     | 
    
         
             
                return {
         
     | 
| 
       21 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 22 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       22 
23 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       23 
24 
     | 
    
         
             
                  fieldset: this.fieldSet,
         
     | 
| 
       24 
25 
     | 
    
         
             
                  hint: this.hint,
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"fieldset-question.js","names":["ComponentType","HIGHLIGHT_CLASS","Question","FieldsetQuestion","componentType","TextField","_renderInput","id","_fieldName","name","fieldset","fieldSet","hint","classes","_highlighted","customRenderFields"],"sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { 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  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.TextField\n\n  /**\n   * @protected\n   * @returns {QuestionBaseModel}\n   */\n  _renderInput() {\n    return {\n      id: this._fieldName,\n      name: this._fieldName,\n      fieldset: this.fieldSet,\n      hint: this.hint,\n      classes: this._highlighted ? HIGHLIGHT_CLASS : '',\n      ...this.customRenderFields\n    }\n  }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,QAAQ;; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"fieldset-question.js","names":["ComponentType","HIGHLIGHT_CLASS","Question","buildCombinedId","FieldsetQuestion","componentType","TextField","_renderInput","id","_fieldName","_id","name","fieldset","fieldSet","hint","classes","_highlighted","customRenderFields"],"sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { Question } from '~/src/form/form-editor/preview/question.js'\nimport { buildCombinedId } from '~/src/form/form-editor/preview/utils.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  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.TextField\n\n  /**\n   * @protected\n   * @returns {QuestionBaseModel}\n   */\n  _renderInput() {\n    return {\n      id: buildCombinedId(this._fieldName, this._id),\n      name: this._fieldName,\n      fieldset: this.fieldSet,\n      hint: this.hint,\n      classes: this._highlighted ? HIGHLIGHT_CLASS : '',\n      ...this.customRenderFields\n    }\n  }\n}\n\n/**\n * @import { QuestionBaseModel } from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,QAAQ;AACjB,SAASC,eAAe;;AAExB;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,SAASF,QAAQ,CAAC;EAC7C;AACF;AACA;EACEG,aAAa,GAAGL,aAAa,CAACM,SAAS;;EAEvC;AACF;AACA;AACA;EACEC,YAAYA,CAAA,EAAG;IACb,OAAO;MACLC,EAAE,EAAEL,eAAe,CAAC,IAAI,CAACM,UAAU,EAAE,IAAI,CAACC,GAAG,CAAC;MAC9CC,IAAI,EAAE,IAAI,CAACF,UAAU;MACrBG,QAAQ,EAAE,IAAI,CAACC,QAAQ;MACvBC,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,OAAO,EAAE,IAAI,CAACC,YAAY,GAAGf,eAAe,GAAG,EAAE;MACjD,GAAG,IAAI,CAACgB;IACV,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { ComponentType } from "../../../components/enums.js";
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from "./constants.js";
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { buildCombinedId } from "./utils.js";
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            /**
         
     | 
| 
       5 
6 
     | 
    
         
             
             * @abstract
         
     | 
| 
         @@ -140,7 +141,7 @@ export class PreviewComponent { 
     | 
|
| 
       140 
141 
     | 
    
         
             
               */
         
     | 
| 
       141 
142 
     | 
    
         
             
              _renderInput() {
         
     | 
| 
       142 
143 
     | 
    
         
             
                return {
         
     | 
| 
       143 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 144 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       144 
145 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       145 
146 
     | 
    
         
             
                  classes: this._highlighted ? HIGHLIGHT_CLASS : ''
         
     | 
| 
       146 
147 
     | 
    
         
             
                };
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"preview.js","names":["ComponentType","HIGHLIGHT_CLASS","PreviewComponent","PATH","_id","undefined","componentType","Details","_questionTemplate","_highlight","_fieldName","_questionRenderer","_htmlElements","_highlighted","constructor","htmlElements","questionRenderer","question","optional","values","_question","_optional","getHighlight","element","titleText","optionalText","questionText","label","text","classes","isPageHeading","trim","fieldSet","legend","customRenderFields","_renderInput","id","name","renderInput","render","value","highlight","highlightContent","unHighlightContent"],"sources":["../../../../../src/form/form-editor/preview/preview.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\n\n/**\n * @abstract\n */\nexport class PreviewComponent {\n  static PATH = 'preview-components/'\n  /**\n   * @type { string | undefined }\n   */\n  _id = undefined\n  /**\n   * @abstract\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.Details\n  /**\n   * @abstract\n   * @type {string}\n   * @protected\n   */\n  _questionTemplate = ''\n  /**\n   * @type { string|null }\n   * @protected\n   */\n  _highlight = null\n  /**\n   * @abstract\n   * @type {string}\n   * @protected\n   */\n  _fieldName = ''\n  /**\n   * @type {QuestionRenderer}\n   * @protected\n   */\n  _questionRenderer\n\n  /**\n   * @type {QuestionElements}\n   * @protected\n   */\n  _htmlElements\n  /**\n   * @type {boolean}\n   * @protected\n   */\n  _highlighted = false\n  /**\n   * @type {boolean}\n   * @protected\n   */\n\n  /**\n   * @param {QuestionElements} htmlElements\n   * @param {QuestionRenderer} questionRenderer\n   */\n  constructor(htmlElements, questionRenderer) {\n    const { question, optional } = htmlElements.values\n\n    /**\n     * @type {QuestionElements}\n     * @protected\n     */\n    this._htmlElements = htmlElements\n    /**\n     * @type {string | undefined}\n     * @private\n     */\n    this._question = question\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    const questionText =\n      this._question === '' || !this._question ? 'Question' : this._question\n    return questionText + 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      isPageHeading: !!this._question?.trim()\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        isPageHeading: !!this._question?.trim()\n      }\n    }\n  }\n\n  /**\n   * @returns {Partial<QuestionBaseModel>}\n   */\n  get customRenderFields() {\n    return {}\n  }\n\n  /**\n   *\n   * @returns {QuestionBaseModel}\n   * @protected\n   */\n  _renderInput() {\n    return {\n      id: this._fieldName,\n      name: this._fieldName,\n      classes: this._highlighted ? HIGHLIGHT_CLASS : ''\n    }\n  }\n\n  /**\n   * @type {QuestionBaseModel}\n   */\n  get renderInput() {\n    return {\n      ...this._renderInput(),\n      ...this.customRenderFields\n    }\n  }\n\n  render() {\n    this._questionRenderer.render(this._questionTemplate, this.renderInput)\n  }\n\n  /**\n   * @type {string | undefined}\n   */\n  get question() {\n    return this._question\n  }\n\n  /**\n   * @param {string | undefined} value\n   */\n  set question(value) {\n    this._question = 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   * @type { string | undefined }\n   */\n  get id() {\n    return this._id\n  }\n\n  /**\n   * @param { string | undefined } value\n   */\n  set id(value) {\n    this._id = value\n  }\n\n  /**\n   * no render\n   */\n  highlightContent() {\n    this._highlighted = true\n  }\n\n  /**\n   * no render\n   */\n  unHighlightContent() {\n    this._highlighted = false\n  }\n}\n\n/**\n * @import { QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,OAAOC,IAAI,GAAG,qBAAqB;EACnC;AACF;AACA;EACEC,GAAG,GAAGC,SAAS;EACf;AACF;AACA;AACA;EACEC,aAAa, 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"preview.js","names":["ComponentType","HIGHLIGHT_CLASS","buildCombinedId","PreviewComponent","PATH","_id","undefined","componentType","Details","_questionTemplate","_highlight","_fieldName","_questionRenderer","_htmlElements","_highlighted","constructor","htmlElements","questionRenderer","question","optional","values","_question","_optional","getHighlight","element","titleText","optionalText","questionText","label","text","classes","isPageHeading","trim","fieldSet","legend","customRenderFields","_renderInput","id","name","renderInput","render","value","highlight","highlightContent","unHighlightContent"],"sources":["../../../../../src/form/form-editor/preview/preview.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'\n\n/**\n * @abstract\n */\nexport class PreviewComponent {\n  static PATH = 'preview-components/'\n  /**\n   * @type { string | undefined }\n   */\n  _id = undefined\n  /**\n   * @abstract\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.Details\n  /**\n   * @abstract\n   * @type {string}\n   * @protected\n   */\n  _questionTemplate = ''\n  /**\n   * @type { string|null }\n   * @protected\n   */\n  _highlight = null\n  /**\n   * @abstract\n   * @type {string}\n   * @protected\n   */\n  _fieldName = ''\n  /**\n   * @type {QuestionRenderer}\n   * @protected\n   */\n  _questionRenderer\n\n  /**\n   * @type {QuestionElements}\n   * @protected\n   */\n  _htmlElements\n  /**\n   * @type {boolean}\n   * @protected\n   */\n  _highlighted = false\n  /**\n   * @type {boolean}\n   * @protected\n   */\n\n  /**\n   * @param {QuestionElements} htmlElements\n   * @param {QuestionRenderer} questionRenderer\n   */\n  constructor(htmlElements, questionRenderer) {\n    const { question, optional } = htmlElements.values\n\n    /**\n     * @type {QuestionElements}\n     * @protected\n     */\n    this._htmlElements = htmlElements\n    /**\n     * @type {string | undefined}\n     * @private\n     */\n    this._question = question\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    const questionText =\n      this._question === '' || !this._question ? 'Question' : this._question\n    return questionText + 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      isPageHeading: !!this._question?.trim()\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        isPageHeading: !!this._question?.trim()\n      }\n    }\n  }\n\n  /**\n   * @returns {Partial<QuestionBaseModel>}\n   */\n  get customRenderFields() {\n    return {}\n  }\n\n  /**\n   *\n   * @returns {QuestionBaseModel}\n   * @protected\n   */\n  _renderInput() {\n    return {\n      id: buildCombinedId(this._fieldName, this._id),\n      name: this._fieldName,\n      classes: this._highlighted ? HIGHLIGHT_CLASS : ''\n    }\n  }\n\n  /**\n   * @type {QuestionBaseModel}\n   */\n  get renderInput() {\n    return {\n      ...this._renderInput(),\n      ...this.customRenderFields\n    }\n  }\n\n  render() {\n    this._questionRenderer.render(this._questionTemplate, this.renderInput)\n  }\n\n  /**\n   * @type {string | undefined}\n   */\n  get question() {\n    return this._question\n  }\n\n  /**\n   * @param {string | undefined} value\n   */\n  set question(value) {\n    this._question = 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   * @type { string | undefined }\n   */\n  get id() {\n    return this._id\n  }\n\n  /**\n   * @param { string | undefined } value\n   */\n  set id(value) {\n    this._id = value\n  }\n\n  /**\n   * no render\n   */\n  highlightContent() {\n    this._highlighted = true\n  }\n\n  /**\n   * no render\n   */\n  unHighlightContent() {\n    this._highlighted = false\n  }\n}\n\n/**\n * @import { QuestionElements, QuestionBaseModel, GovukFieldset, DefaultComponent, QuestionRenderer } from '~/src/form/form-editor/preview/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,eAAe;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,gBAAgB,CAAC;EAC5B,OAAOC,IAAI,GAAG,qBAAqB;EACnC;AACF;AACA;EACEC,GAAG,GAAGC,SAAS;EACf;AACF;AACA;AACA;EACEC,aAAa,GAAGP,aAAa,CAACQ,OAAO;EACrC;AACF;AACA;AACA;AACA;EACEC,iBAAiB,GAAG,EAAE;EACtB;AACF;AACA;AACA;EACEC,UAAU,GAAG,IAAI;EACjB;AACF;AACA;AACA;AACA;EACEC,UAAU,GAAG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tB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACE,IAAIE,SAASA,CAAA,EAAG;IACd,OAAO,IAAI,CAAChC,UAAU;EACxB;;EAEA;AACF;AACA;EACE,IAAIgC,SAASA,CAACD,KAAK,EAAE;IACnB,IAAI,CAAC/B,UAAU,GAAG+B,KAAK;IACvB,IAAI,CAACD,MAAM,CAAC,CAAC;EACf;;EAEA;AACF;AACA;EACE,IAAIH,EAAEA,CAAA,EAAG;IACP,OAAO,IAAI,CAAChC,GAAG;EACjB;;EAEA;AACF;AACA;EACE,IAAIgC,EAAEA,CAACI,KAAK,EAAE;IACZ,IAAI,CAACpC,GAAG,GAAGoC,KAAK;EAClB;;EAEA;AACF;AACA;EACEE,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAAC7B,YAAY,GAAG,IAAI;EAC1B;;EAEA;AACF;AACA;EACE8B,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAAC9B,YAAY,GAAG,KAAK;EAC3B;AACF;;AAEA;AACA;AACA","ignoreList":[]}
         
     | 
| 
         @@ -2,6 +2,7 @@ import { ComponentType } from "../../../components/enums.js"; 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from "./constants.js";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { ListSortableQuestion } from "./list-sortable.js";
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { PreviewComponent } from "./preview.js";
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { buildCombinedId } from "./utils.js";
         
     | 
| 
       5 
6 
     | 
    
         
             
            export class SelectSortableQuestion extends ListSortableQuestion {
         
     | 
| 
       6 
7 
     | 
    
         
             
              _questionTemplate = PreviewComponent.PATH + 'selectfield.njk';
         
     | 
| 
       7 
8 
     | 
    
         
             
              get selectList() {
         
     | 
| 
         @@ -27,7 +28,7 @@ export class SelectSortableQuestion extends ListSortableQuestion { 
     | 
|
| 
       27 
28 
     | 
    
         
             
                };
         
     | 
| 
       28 
29 
     | 
    
         
             
                const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : '';
         
     | 
| 
       29 
30 
     | 
    
         
             
                return {
         
     | 
| 
       30 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 31 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       31 
32 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       32 
33 
     | 
    
         
             
                  hint: this.hint,
         
     | 
| 
       33 
34 
     | 
    
         
             
                  label: this.label,
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"select-sortable.js","names":["ComponentType","HIGHLIGHT_CLASS","ListSortableQuestion","PreviewComponent","SelectSortableQuestion","_questionTemplate","PATH","selectList","list","length","id","value","text","componentType","SelectField","renderInput","afterInput","formGroup","html","_listElements","afterInputsHTML","highlightedClass","_highlighted","_fieldName","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class SelectSortableQuestion extends ListSortableQuestion {\n  _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n\n  get selectList() {\n    return this.list.length\n      ? [{ id: '', value: '', text: ' ' }, ...this.list]\n      : this.list\n  }\n\n  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.SelectField\n\n  get renderInput() {\n    const afterInput =\n      /** @type {{ formGroup?: { afterInput: { html: string }} }} */ (\n        this.list.length\n          ? {}\n          : {\n              formGroup: {\n                afterInput: {\n                  html: this._listElements.afterInputsHTML\n                }\n              }\n            }\n      )\n\n    const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : ''\n\n    return {\n      id: this._fieldName,\n      name: this._fieldName,\n      hint: this.hint,\n      label: this.label,\n      items: this.selectList,\n      classes: this.list.length ? highlightedClass : 'govuk-visually-hidden',\n      ...afterInput\n    }\n  }\n}\n\n/**\n * @import { FormGroupAfterInput }  from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"select-sortable.js","names":["ComponentType","HIGHLIGHT_CLASS","ListSortableQuestion","PreviewComponent","buildCombinedId","SelectSortableQuestion","_questionTemplate","PATH","selectList","list","length","id","value","text","componentType","SelectField","renderInput","afterInput","formGroup","html","_listElements","afterInputsHTML","highlightedClass","_highlighted","_fieldName","_id","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'\n\nexport class SelectSortableQuestion extends ListSortableQuestion {\n  _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n\n  get selectList() {\n    return this.list.length\n      ? [{ id: '', value: '', text: ' ' }, ...this.list]\n      : this.list\n  }\n\n  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.SelectField\n\n  get renderInput() {\n    const afterInput =\n      /** @type {{ formGroup?: { afterInput: { html: string }} }} */ (\n        this.list.length\n          ? {}\n          : {\n              formGroup: {\n                afterInput: {\n                  html: this._listElements.afterInputsHTML\n                }\n              }\n            }\n      )\n\n    const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : ''\n\n    return {\n      id: buildCombinedId(this._fieldName, this._id),\n      name: this._fieldName,\n      hint: this.hint,\n      label: this.label,\n      items: this.selectList,\n      classes: this.list.length ? highlightedClass : 'govuk-visually-hidden',\n      ...afterInput\n    }\n  }\n}\n\n/**\n * @import { FormGroupAfterInput }  from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,oBAAoB;AAC7B,SAASC,gBAAgB;AACzB,SAASC,eAAe;AAExB,OAAO,MAAMC,sBAAsB,SAASH,oBAAoB,CAAC;EAC/DI,iBAAiB,GAAGH,gBAAgB,CAACI,IAAI,GAAG,iBAAiB;EAE7D,IAAIC,UAAUA,CAAA,EAAG;IACf,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,GACnB,CAAC;MAAEC,EAAE,EAAE,EAAE;MAAEC,KAAK,EAAE,EAAE;MAAEC,IAAI,EAAE;IAAI,CAAC,EAAE,GAAG,IAAI,CAACJ,IAAI,CAAC,GAChD,IAAI,CAACA,IAAI;EACf;;EAEA;AACF;AACA;EACEK,aAAa,GAAGd,aAAa,CAACe,WAAW;EAEzC,IAAIC,WAAWA,CAAA,EAAG;IAChB,MAAMC,UAAU,GACd;IACE,IAAI,CAACR,IAAI,CAACC,MAAM,GACZ,CAAC,CAAC,GACF;MACEQ,SAAS,EAAE;QACTD,UAAU,EAAE;UACVE,IAAI,EAAE,IAAI,CAACC,aAAa,CAACC;QAC3B;MACF;IACF,CACL;IAEH,MAAMC,gBAAgB,GAAG,IAAI,CAACC,YAAY,GAAGtB,eAAe,GAAG,EAAE;IAEjE,OAAO;MACLU,EAAE,EAAEP,eAAe,CAAC,IAAI,CAACoB,UAAU,EAAE,IAAI,CAACC,GAAG,CAAC;MAC9CC,IAAI,EAAE,IAAI,CAACF,UAAU;MACrBG,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,KAAK,EAAE,IAAI,CAACrB,UAAU;MACtBsB,OAAO,EAAE,IAAI,CAACrB,IAAI,CAACC,MAAM,GAAGY,gBAAgB,GAAG,uBAAuB;MACtE,GAAGL;IACL,CAAC;EACH;AACF;;AAEA;AACA;AACA","ignoreList":[]}
         
     | 
| 
         @@ -2,6 +2,7 @@ import { ComponentType } from "../../../components/enums.js"; 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from "./constants.js";
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { ListQuestion } from "./list.js";
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { PreviewComponent } from "./preview.js";
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { buildCombinedId } from "./utils.js";
         
     | 
| 
       5 
6 
     | 
    
         
             
            export class SelectQuestion extends ListQuestion {
         
     | 
| 
       6 
7 
     | 
    
         
             
              _questionTemplate = PreviewComponent.PATH + 'selectfield.njk';
         
     | 
| 
       7 
8 
     | 
    
         
             
              _fieldName = 'selectInput';
         
     | 
| 
         @@ -27,7 +28,7 @@ export class SelectQuestion extends ListQuestion { 
     | 
|
| 
       27 
28 
     | 
    
         
             
                };
         
     | 
| 
       28 
29 
     | 
    
         
             
                const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : '';
         
     | 
| 
       29 
30 
     | 
    
         
             
                return {
         
     | 
| 
       30 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 31 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       31 
32 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       32 
33 
     | 
    
         
             
                  hint: this.hint,
         
     | 
| 
       33 
34 
     | 
    
         
             
                  label: this.label,
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"select.js","names":["ComponentType","HIGHLIGHT_CLASS","ListQuestion","PreviewComponent","SelectQuestion","_questionTemplate","PATH","_fieldName","componentType","SelectField","list","_getList","renderInput","afterInput","length","formGroup","html","_listElements","afterInputsHTML","highlightedClass","_highlighted","id","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\n\nexport class SelectQuestion extends ListQuestion {\n  _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n  _fieldName = 'selectInput'\n  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.SelectField\n\n  /**\n   * @returns {ListItemReadonly[]}\n   */\n  get list() {\n    return this._getList()\n  }\n\n  get renderInput() {\n    const afterInput =\n      /** @type {{ formGroup?: { afterInput: { html: string }} }} */ (\n        this.list.length\n          ? {}\n          : {\n              formGroup: {\n                afterInput: {\n                  html: this._listElements.afterInputsHTML\n                }\n              }\n            }\n      )\n\n    const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : ''\n\n    return {\n      id: this._fieldName,\n      name: this._fieldName,\n      hint: this.hint,\n      label: this.label,\n      items: this.list,\n      classes: this.list.length ? highlightedClass : 'govuk-visually-hidden',\n      ...afterInput\n    }\n  }\n}\n\n/**\n * @import { ListItemReadonly } from '~/src/form/form-editor/types.js'\n * @import { FormGroupAfterInput }  from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,YAAY;AACrB,SAASC,gBAAgB; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"select.js","names":["ComponentType","HIGHLIGHT_CLASS","ListQuestion","PreviewComponent","buildCombinedId","SelectQuestion","_questionTemplate","PATH","_fieldName","componentType","SelectField","list","_getList","renderInput","afterInput","length","formGroup","html","_listElements","afterInputsHTML","highlightedClass","_highlighted","id","_id","name","hint","label","items","classes"],"sources":["../../../../../src/form/form-editor/preview/select.js"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'\nimport { ListQuestion } from '~/src/form/form-editor/preview/list.js'\nimport { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'\nimport { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'\n\nexport class SelectQuestion extends ListQuestion {\n  _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'\n  _fieldName = 'selectInput'\n  /**\n   * @type {ComponentType}\n   */\n  componentType = ComponentType.SelectField\n\n  /**\n   * @returns {ListItemReadonly[]}\n   */\n  get list() {\n    return this._getList()\n  }\n\n  get renderInput() {\n    const afterInput =\n      /** @type {{ formGroup?: { afterInput: { html: string }} }} */ (\n        this.list.length\n          ? {}\n          : {\n              formGroup: {\n                afterInput: {\n                  html: this._listElements.afterInputsHTML\n                }\n              }\n            }\n      )\n\n    const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : ''\n\n    return {\n      id: buildCombinedId(this._fieldName, this._id),\n      name: this._fieldName,\n      hint: this.hint,\n      label: this.label,\n      items: this.list,\n      classes: this.list.length ? highlightedClass : 'govuk-visually-hidden',\n      ...afterInput\n    }\n  }\n}\n\n/**\n * @import { ListItemReadonly } from '~/src/form/form-editor/types.js'\n * @import { FormGroupAfterInput }  from '~/src/form/form-editor/macros/types.js'\n */\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,eAAe;AACxB,SAASC,YAAY;AACrB,SAASC,gBAAgB;AACzB,SAASC,eAAe;AAExB,OAAO,MAAMC,cAAc,SAASH,YAAY,CAAC;EAC/CI,iBAAiB,GAAGH,gBAAgB,CAACI,IAAI,GAAG,iBAAiB;EAC7DC,UAAU,GAAG,aAAa;EAC1B;AACF;AACA;EACEC,aAAa,GAAGT,aAAa,CAACU,WAAW;;EAEzC;AACF;AACA;EACE,IAAIC,IAAIA,CAAA,EAAG;IACT,OAAO,IAAI,CAACC,QAAQ,CAAC,CAAC;EACxB;EAEA,IAAIC,WAAWA,CAAA,EAAG;IAChB,MAAMC,UAAU,GACd;IACE,IAAI,CAACH,IAAI,CAACI,MAAM,GACZ,CAAC,CAAC,GACF;MACEC,SAAS,EAAE;QACTF,UAAU,EAAE;UACVG,IAAI,EAAE,IAAI,CAACC,aAAa,CAACC;QAC3B;MACF;IACF,CACL;IAEH,MAAMC,gBAAgB,GAAG,IAAI,CAACC,YAAY,GAAGpB,eAAe,GAAG,EAAE;IAEjE,OAAO;MACLqB,EAAE,EAAElB,eAAe,CAAC,IAAI,CAACI,UAAU,EAAE,IAAI,CAACe,GAAG,CAAC;MAC9CC,IAAI,EAAE,IAAI,CAAChB,UAAU;MACrBiB,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA,KAAK;MACjBC,KAAK,EAAE,IAAI,CAAChB,IAAI;MAChBiB,OAAO,EAAE,IAAI,CAACjB,IAAI,CAACI,MAAM,GAAGK,gBAAgB,GAAG,uBAAuB;MACtE,GAAGN;IACL,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA","ignoreList":[]}
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"utils.js","names":["buildCombinedId","fieldName","id","idSuffix"],"sources":["../../../../../src/form/form-editor/preview/utils.js"],"sourcesContent":["/**\n * @param {string} fieldName\n * @param { string | undefined } id\n */\nexport function buildCombinedId(fieldName, id) {\n  const idSuffix = id ? `-${id}` : ''\n  return `${fieldName}${idSuffix}`\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,SAASA,eAAeA,CAACC,SAAS,EAAEC,EAAE,EAAE;EAC7C,MAAMC,QAAQ,GAAGD,EAAE,GAAG,IAAIA,EAAE,EAAE,GAAG,EAAE;EACnC,OAAO,GAAGD,SAAS,GAAGE,QAAQ,EAAE;AAClC","ignoreList":[]}
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/autocomplete.js"],"names":[],"mappings":" 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"autocomplete.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/autocomplete.js"],"names":[],"mappings":"AAMA;CAqBC;AAED;IAME;;;OAGG;IACH,kCAHW,oBAAoB,oBACpB,gBAAgB,EAK1B;IAZD;;;OAGG;IACH,0BAAsB;IAUtB,sCAEC;IAED;;OAEG;IACH,8BAFW,MAAM,QAkBhB;IAED;;;;;;;;;MASC;CACF;yBA5EwB,4CAA4C;iCAgFrC,iCAAiC;0CACa,yCAAyC;sCAAzC,yCAAyC"}
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAiBA; 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"page-controller.d.ts","sourceRoot":"","sources":["../../../../../../src/form/form-editor/preview/controller/page-controller.js"],"names":[],"mappings":"AAiBA;IA0ME;;;;;OAKG;IACH,4CAKC;IA7MD;;;;;OAKG;IACH,wBALW,YAAY,EAAE,YACd,oBAAoB,cACpB,cAAc,YACd,YAAY,EAkBtB;IAmCD;;OAEG;IACH,sBAFa,OAAO,CAgBnB;IAED;;;OAGG;IACH,qCAHW,gBAAgB,GACd,iBAAiB,CAgC7B;IAED;;OAEG;IACH,8BAFa,OAAO,CASnB;IAwBD,uCAQC;IAaD;;;kBAUC;IAED,6CAaC;;CAcF;0CAvOyC,mEAAmE;sCA4OxE,2CAA2C;uCAFY,yCAAyC;kCAIpG,2BAA2B;0CAJgC,yCAAyC;oCAGlG,qCAAqC;kCAHoB,yCAAyC"}
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"fieldset-question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"names":[],"mappings":" 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"fieldset-question.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/fieldset-question.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH;CAoBC;yBA3BwB,4CAA4C"}
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/preview.js"],"names":[],"mappings":" 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/preview.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;IACE,oBAAmC;IA2CnC;;;OAGG;IAEH;;;OAGG;IACH,0BAHW,gBAAgB,oBAChB,gBAAgB,EA0B1B;IA3ED;;OAEG;IACH,KAFW,MAAM,GAAG,SAAS,CAEd;IACf;;;OAGG;IACH,eAFU,aAAa,CAEc;IACrC;;;;OAIG;IACH,6BAHU,MAAM,CAGM;IACtB;;;OAGG;IACH,sBAHW,MAAM,GAAC,IAAI,CAGL;IACjB;;;;OAIG;IACH,sBAHU,MAAM,CAGD;IACf;;;OAGG;IACH,6BAHU,gBAAgB,CAGT;IAEjB;;;OAGG;IACH,yBAHU,gBAAgB,CAGb;IACb;;;OAGG;IACH,wBAHU,OAAO,CAGG;IAkBlB;;;OAGG;IACH,kBAAyB;IACzB;;;OAGG;IACH,kBAAyB;IAS3B;;;;OAIG;IACH,gCAJW,MAAM,GACJ,MAAM,CAKlB;IAED,wBAKC;IAED;;;OAGG;IACH,uBAFU,gBAAgB,CAQzB;IAED;;;OAGG;IACH,0BAFU,aAAa,CAUtB;IAED;;OAEG;IACH,0BAFa,OAAO,CAAC,iBAAiB,CAAC,CAItC;IAED;;;;OAIG;IACH,0BAHa,iBAAiB,CAS7B;IAED;;OAEG;IACH,mBAFU,iBAAiB,CAO1B;IAED,eAEC;IASD;;OAEG;IACH,oBAFW,MAAM,GAAG,SAAS,EAK5B;IAbD;;OAEG;IACH,gBAFU,MAAM,GAAG,SAAS,CAI3B;IAcD;;OAEG;IACH,oBAFW,OAAO,EAKjB;IAVD,gBAKW,OAAO,CAHjB;IAiBD;;OAEG;IACH,qBAFW,MAAM,GAAG,IAAI,EAKvB;IAbD;;OAEG;IACH,iBAFU,MAAM,GAAG,IAAI,CAItB;IAiBD;;OAEG;IACH,cAFY,MAAM,GAAG,SAAS,EAI7B;IAZD;;OAEG;IACH,UAFW,MAAM,GAAG,SAAS,CAI5B;IASD;;OAEG;IACH,yBAEC;IAED;;OAEG;IACH,2BAEC;CACF;8BAvO6B,2BAA2B;sCA0OkD,yCAAyC;sCAAzC,yCAAyC;sCAAzC,yCAAyC;mCAAzC,yCAAyC;uCAAzC,yCAAyC"}
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"select-sortable.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"names":[],"mappings":" 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"select-sortable.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select-sortable.js"],"names":[],"mappings":"AAMA;IAGE,2DAIC;IAOD;oBAE6B;YAAE,UAAU,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,CAAA;SAAC;;;;;;;MAuB3D;CACF;qCA5CoC,iDAAiD"}
         
     | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select.js"],"names":[],"mappings":" 
     | 
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/select.js"],"names":[],"mappings":"AAMA;IAeE;oBAE6B;YAAE,UAAU,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAA;aAAE,CAAA;SAAC;;;;;;;MAuB3D;CACF;6BA7C4B,wCAAwC;sCAgDhC,iCAAiC"}
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/form/form-editor/preview/utils.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,2CAHW,MAAM,MACL,MAAM,GAAG,SAAS,UAK7B"}
         
     | 
    
        package/package.json
    CHANGED
    
    
| 
         @@ -2,6 +2,7 @@ import { ComponentType } from '~/src/components/enums.js' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { autoCompleteOptionsSchema } from '~/src/form/form-editor/index.js'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { Question } from '~/src/form/form-editor/preview/question.js'
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            export class AutocompleteListQuestion extends Question {
         
     | 
| 
       7 
8 
     | 
    
         
             
              /**
         
     | 
| 
         @@ -68,7 +69,7 @@ export class AutocompleteQuestion extends AutocompleteListQuestion { 
     | 
|
| 
       68 
69 
     | 
    
         | 
| 
       69 
70 
     | 
    
         
             
              get renderInput() {
         
     | 
| 
       70 
71 
     | 
    
         
             
                return {
         
     | 
| 
       71 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 72 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       72 
73 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       73 
74 
     | 
    
         
             
                  attributes: { 'data-module': 'govuk-accessible-autocomplete' },
         
     | 
| 
       74 
75 
     | 
    
         
             
                  hint: this.hint,
         
     | 
| 
         @@ -34,6 +34,7 @@ export class PreviewPageController extends PreviewPageControllerBase { 
     | 
|
| 
       34 
34 
     | 
    
         
             
                const questions = components.map(
         
     | 
| 
       35 
35 
     | 
    
         
             
                  mapComponentToPreviewQuestion(questionRenderer, definition)
         
     | 
| 
       36 
36 
     | 
    
         
             
                )
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
       37 
38 
     | 
    
         
             
                const firstQuestion = /** @type { Markdown | undefined | Question }  */ (
         
     | 
| 
       38 
39 
     | 
    
         
             
                  questions.shift()
         
     | 
| 
       39 
40 
     | 
    
         
             
                )
         
     | 
| 
         @@ -1,6 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { ComponentType } from '~/src/components/enums.js'
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { Question } from '~/src/form/form-editor/preview/question.js'
         
     | 
| 
      
 4 
     | 
    
         
            +
            import { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'
         
     | 
| 
       4 
5 
     | 
    
         | 
| 
       5 
6 
     | 
    
         
             
            /**
         
     | 
| 
       6 
7 
     | 
    
         
             
             * Simple extension of Question that uses fieldset instead of label - not exported
         
     | 
| 
         @@ -18,7 +19,7 @@ export class FieldsetQuestion extends Question { 
     | 
|
| 
       18 
19 
     | 
    
         
             
               */
         
     | 
| 
       19 
20 
     | 
    
         
             
              _renderInput() {
         
     | 
| 
       20 
21 
     | 
    
         
             
                return {
         
     | 
| 
       21 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 22 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       22 
23 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       23 
24 
     | 
    
         
             
                  fieldset: this.fieldSet,
         
     | 
| 
       24 
25 
     | 
    
         
             
                  hint: this.hint,
         
     | 
| 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            import { ComponentType } from '~/src/components/enums.js'
         
     | 
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'
         
     | 
| 
      
 3 
     | 
    
         
            +
            import { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'
         
     | 
| 
       3 
4 
     | 
    
         | 
| 
       4 
5 
     | 
    
         
             
            /**
         
     | 
| 
       5 
6 
     | 
    
         
             
             * @abstract
         
     | 
| 
         @@ -139,7 +140,7 @@ export class PreviewComponent { 
     | 
|
| 
       139 
140 
     | 
    
         
             
               */
         
     | 
| 
       140 
141 
     | 
    
         
             
              _renderInput() {
         
     | 
| 
       141 
142 
     | 
    
         
             
                return {
         
     | 
| 
       142 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 143 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       143 
144 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       144 
145 
     | 
    
         
             
                  classes: this._highlighted ? HIGHLIGHT_CLASS : ''
         
     | 
| 
       145 
146 
     | 
    
         
             
                }
         
     | 
| 
         @@ -2,6 +2,7 @@ import { ComponentType } from '~/src/components/enums.js' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { ListSortableQuestion } from '~/src/form/form-editor/preview/list-sortable.js'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            export class SelectSortableQuestion extends ListSortableQuestion {
         
     | 
| 
       7 
8 
     | 
    
         
             
              _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'
         
     | 
| 
         @@ -34,7 +35,7 @@ export class SelectSortableQuestion extends ListSortableQuestion { 
     | 
|
| 
       34 
35 
     | 
    
         
             
                const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : ''
         
     | 
| 
       35 
36 
     | 
    
         | 
| 
       36 
37 
     | 
    
         
             
                return {
         
     | 
| 
       37 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 38 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       38 
39 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       39 
40 
     | 
    
         
             
                  hint: this.hint,
         
     | 
| 
       40 
41 
     | 
    
         
             
                  label: this.label,
         
     | 
| 
         @@ -2,6 +2,7 @@ import { ComponentType } from '~/src/components/enums.js' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            import { HIGHLIGHT_CLASS } from '~/src/form/form-editor/preview/constants.js'
         
     | 
| 
       3 
3 
     | 
    
         
             
            import { ListQuestion } from '~/src/form/form-editor/preview/list.js'
         
     | 
| 
       4 
4 
     | 
    
         
             
            import { PreviewComponent } from '~/src/form/form-editor/preview/preview.js'
         
     | 
| 
      
 5 
     | 
    
         
            +
            import { buildCombinedId } from '~/src/form/form-editor/preview/utils.js'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            export class SelectQuestion extends ListQuestion {
         
     | 
| 
       7 
8 
     | 
    
         
             
              _questionTemplate = PreviewComponent.PATH + 'selectfield.njk'
         
     | 
| 
         @@ -35,7 +36,7 @@ export class SelectQuestion extends ListQuestion { 
     | 
|
| 
       35 
36 
     | 
    
         
             
                const highlightedClass = this._highlighted ? HIGHLIGHT_CLASS : ''
         
     | 
| 
       36 
37 
     | 
    
         | 
| 
       37 
38 
     | 
    
         
             
                return {
         
     | 
| 
       38 
     | 
    
         
            -
                  id: this._fieldName,
         
     | 
| 
      
 39 
     | 
    
         
            +
                  id: buildCombinedId(this._fieldName, this._id),
         
     | 
| 
       39 
40 
     | 
    
         
             
                  name: this._fieldName,
         
     | 
| 
       40 
41 
     | 
    
         
             
                  hint: this.hint,
         
     | 
| 
       41 
42 
     | 
    
         
             
                  label: this.label,
         
     |