@gov-design-system-ce/components 4.0.8-rc17 → 4.0.8-rc19

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 (176) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/gov-form-checkbox.cjs.entry.js +5 -4
  3. package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
  4. package/dist/cjs/gov-form-control.cjs.entry.js +1 -37
  5. package/dist/cjs/gov-form-control.cjs.entry.js.map +1 -1
  6. package/dist/cjs/gov-form-file.cjs.entry.js +7 -6
  7. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  8. package/dist/cjs/gov-form-input.cjs.entry.js +11 -9
  9. package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
  10. package/dist/cjs/gov-form-multi-select.cjs.entry.js +7 -7
  11. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  12. package/dist/cjs/gov-form-radio.cjs.entry.js +5 -4
  13. package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
  14. package/dist/cjs/gov-form-select.cjs.entry.js +10 -7
  15. package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
  16. package/dist/cjs/gov-form-switch.cjs.entry.js +2 -1
  17. package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
  18. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  19. package/dist/cjs/gov-tile.cjs.entry.js +1 -1
  20. package/dist/cjs/gov-tile.cjs.entry.js.map +1 -1
  21. package/dist/cjs/loader.cjs.js +1 -1
  22. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +5 -4
  23. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
  24. package/dist/collection/components/gov-form/control/gov-form-control.js +5 -64
  25. package/dist/collection/components/gov-form/control/gov-form-control.js.map +1 -1
  26. package/dist/collection/components/gov-form/file/gov-form-file.js +7 -6
  27. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  28. package/dist/collection/components/gov-form/input/gov-form-input.js +16 -14
  29. package/dist/collection/components/gov-form/input/gov-form-input.js.map +1 -1
  30. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +7 -7
  31. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
  32. package/dist/collection/components/gov-form/radio/gov-form-radio.js +5 -4
  33. package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
  34. package/dist/collection/components/gov-form/select/gov-form-select.js +12 -7
  35. package/dist/collection/components/gov-form/select/gov-form-select.js.map +1 -1
  36. package/dist/collection/components/gov-form/switch/gov-form-switch.js +2 -1
  37. package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
  38. package/dist/collection/components/gov-tile/gov-tile.js +1 -1
  39. package/dist/collection/components/gov-tile/gov-tile.js.map +1 -1
  40. package/dist/collection/pages/Forms.js +12 -12
  41. package/dist/collection/pages/Forms.js.map +1 -1
  42. package/dist/components/gov-accordion-item.js +1 -1
  43. package/dist/components/gov-attachments-item.js +1 -1
  44. package/dist/components/gov-breadcrumbs.js +1 -1
  45. package/dist/components/gov-button.js +1 -1
  46. package/dist/components/gov-card.js +1 -1
  47. package/dist/components/gov-chip.js +1 -1
  48. package/dist/components/gov-form-autocomplete.js +1 -1
  49. package/dist/components/gov-form-checkbox.js +1 -1
  50. package/dist/components/gov-form-checkbox.js.map +1 -1
  51. package/dist/components/gov-form-control.js +1 -1
  52. package/dist/components/gov-form-control.js.map +1 -1
  53. package/dist/components/gov-form-file.js +1 -1
  54. package/dist/components/gov-form-file.js.map +1 -1
  55. package/dist/components/gov-form-input.js +1 -1
  56. package/dist/components/gov-form-multi-select.js +1 -1
  57. package/dist/components/gov-form-multi-select.js.map +1 -1
  58. package/dist/components/gov-form-radio.js +1 -1
  59. package/dist/components/gov-form-radio.js.map +1 -1
  60. package/dist/components/gov-form-select.js +1 -1
  61. package/dist/components/gov-form-switch.js +1 -1
  62. package/dist/components/gov-form-switch.js.map +1 -1
  63. package/dist/components/gov-icon.js +1 -1
  64. package/dist/components/gov-infobar.js +1 -1
  65. package/dist/components/gov-loading.js +1 -1
  66. package/dist/components/gov-modal.js +1 -1
  67. package/dist/components/gov-pagination.js +1 -1
  68. package/dist/components/gov-prompt.js +1 -1
  69. package/dist/components/gov-side-nav-item.js +1 -1
  70. package/dist/components/gov-tabs.js +1 -1
  71. package/dist/components/gov-tabs.js.map +1 -1
  72. package/dist/components/gov-tag.js +1 -1
  73. package/dist/components/gov-tile.js +1 -1
  74. package/dist/components/gov-tile.js.map +1 -1
  75. package/dist/components/gov-toast.js +1 -1
  76. package/dist/components/gov-tooltip-content.js +1 -1
  77. package/dist/components/gov-wizard-item.js +1 -1
  78. package/dist/components/{p-8ac22724.js → p-37b342d0.js} +2 -2
  79. package/dist/components/p-37b342d0.js.map +1 -0
  80. package/dist/components/{p-57bc98b3.js → p-410e296d.js} +2 -2
  81. package/dist/components/{p-fd554fb4.js → p-4f694d25.js} +2 -2
  82. package/dist/components/{p-3248435d.js → p-5ee68c72.js} +2 -2
  83. package/dist/components/p-5ee68c72.js.map +1 -0
  84. package/dist/components/{p-483d079f.js → p-701f03e1.js} +2 -2
  85. package/dist/components/{p-e35fdedd.js → p-ab0ea373.js} +2 -2
  86. package/dist/components/{p-44c731a0.js → p-eefec75b.js} +2 -2
  87. package/dist/core/core.esm.js +1 -1
  88. package/dist/core/core.esm.js.map +1 -1
  89. package/dist/core/{p-a87d8f17.entry.js → p-2cdb5670.entry.js} +3 -2
  90. package/dist/core/p-2cdb5670.entry.js.map +1 -0
  91. package/dist/core/{p-4c83f443.entry.js → p-2e07619e.entry.js} +2 -2
  92. package/dist/core/{p-4c83f443.entry.js.map → p-2e07619e.entry.js.map} +1 -1
  93. package/dist/core/{p-14e5fd00.entry.js → p-396ae350.entry.js} +2 -2
  94. package/dist/core/p-396ae350.entry.js.map +1 -0
  95. package/dist/core/{p-065b396a.entry.js → p-3c0058a4.entry.js} +2 -2
  96. package/dist/core/p-3c0058a4.entry.js.map +1 -0
  97. package/dist/core/{p-98e89c46.entry.js → p-4b88cdf6.entry.js} +2 -2
  98. package/dist/core/{p-bc2ec133.entry.js → p-5f3721be.entry.js} +2 -2
  99. package/dist/core/p-5f3721be.entry.js.map +1 -0
  100. package/dist/core/p-6110119c.entry.js +2 -0
  101. package/dist/core/p-6110119c.entry.js.map +1 -0
  102. package/dist/core/{p-afb86442.entry.js → p-6be9b50d.entry.js} +3 -2
  103. package/dist/core/p-6be9b50d.entry.js.map +1 -0
  104. package/dist/core/{p-d0446df9.entry.js → p-74627eb2.entry.js} +2 -2
  105. package/dist/core/p-74627eb2.entry.js.map +1 -0
  106. package/dist/core/{p-b18be1d6.entry.js → p-753e4861.entry.js} +3 -2
  107. package/dist/core/p-753e4861.entry.js.map +1 -0
  108. package/dist/core/{p-36312bef.entry.js → p-92f752e1.entry.js} +3 -2
  109. package/dist/core/p-92f752e1.entry.js.map +1 -0
  110. package/dist/core/{p-6092fd22.entry.js → p-aa91f33f.entry.js} +2 -2
  111. package/dist/core/p-aa91f33f.entry.js.map +1 -0
  112. package/dist/core/{p-c7e8faec.entry.js → p-ab2f6b4d.entry.js} +2 -2
  113. package/dist/core/{p-c7e8faec.entry.js.map → p-ab2f6b4d.entry.js.map} +1 -1
  114. package/dist/core/{p-0d99a3d8.entry.js → p-e102ae1d.entry.js} +2 -2
  115. package/dist/core/p-e102ae1d.entry.js.map +1 -0
  116. package/dist/core/{p-dbb67e76.entry.js → p-e21b402c.entry.js} +3 -2
  117. package/dist/core/p-e21b402c.entry.js.map +1 -0
  118. package/dist/core/{p-1d67220c.entry.js → p-f9e6f776.entry.js} +3 -2
  119. package/dist/core/p-f9e6f776.entry.js.map +1 -0
  120. package/dist/core/{p-dbad9256.entry.js → p-fc3d4a73.entry.js} +3 -2
  121. package/dist/core/p-fc3d4a73.entry.js.map +1 -0
  122. package/dist/esm/core.js +1 -1
  123. package/dist/esm/gov-form-checkbox.entry.js +5 -4
  124. package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
  125. package/dist/esm/gov-form-control.entry.js +2 -38
  126. package/dist/esm/gov-form-control.entry.js.map +1 -1
  127. package/dist/esm/gov-form-file.entry.js +7 -6
  128. package/dist/esm/gov-form-file.entry.js.map +1 -1
  129. package/dist/esm/gov-form-input.entry.js +11 -9
  130. package/dist/esm/gov-form-input.entry.js.map +1 -1
  131. package/dist/esm/gov-form-multi-select.entry.js +7 -7
  132. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  133. package/dist/esm/gov-form-radio.entry.js +5 -4
  134. package/dist/esm/gov-form-radio.entry.js.map +1 -1
  135. package/dist/esm/gov-form-select.entry.js +10 -7
  136. package/dist/esm/gov-form-select.entry.js.map +1 -1
  137. package/dist/esm/gov-form-switch.entry.js +2 -1
  138. package/dist/esm/gov-form-switch.entry.js.map +1 -1
  139. package/dist/esm/gov-icon.entry.js +1 -1
  140. package/dist/esm/gov-tile.entry.js +1 -1
  141. package/dist/esm/gov-tile.entry.js.map +1 -1
  142. package/dist/esm/loader.js +1 -1
  143. package/dist/hydrate/index.js +54 -82
  144. package/dist/hydrate/index.mjs +54 -82
  145. package/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +1 -1
  146. package/dist/types/components/gov-form/control/gov-form-control.d.ts +3 -10
  147. package/dist/types/components/gov-form/file/gov-form-file.d.ts +1 -1
  148. package/dist/types/components/gov-form/input/gov-form-input.d.ts +1 -1
  149. package/dist/types/components/gov-form/multiselect/gov-form-multi-select.d.ts +1 -1
  150. package/dist/types/components/gov-form/radio/gov-form-radio.d.ts +1 -1
  151. package/dist/types/components/gov-form/select/gov-form-select.d.ts +1 -1
  152. package/dist/types/components.d.ts +6 -14
  153. package/package.json +1 -1
  154. package/dist/components/p-3248435d.js.map +0 -1
  155. package/dist/components/p-8ac22724.js.map +0 -1
  156. package/dist/core/p-065b396a.entry.js.map +0 -1
  157. package/dist/core/p-0d99a3d8.entry.js.map +0 -1
  158. package/dist/core/p-14e5fd00.entry.js.map +0 -1
  159. package/dist/core/p-1d67220c.entry.js.map +0 -1
  160. package/dist/core/p-36312bef.entry.js.map +0 -1
  161. package/dist/core/p-4b048e19.entry.js +0 -2
  162. package/dist/core/p-4b048e19.entry.js.map +0 -1
  163. package/dist/core/p-6092fd22.entry.js.map +0 -1
  164. package/dist/core/p-a87d8f17.entry.js.map +0 -1
  165. package/dist/core/p-afb86442.entry.js.map +0 -1
  166. package/dist/core/p-b18be1d6.entry.js.map +0 -1
  167. package/dist/core/p-bc2ec133.entry.js.map +0 -1
  168. package/dist/core/p-d0446df9.entry.js.map +0 -1
  169. package/dist/core/p-dbad9256.entry.js.map +0 -1
  170. package/dist/core/p-dbb67e76.entry.js.map +0 -1
  171. /package/dist/components/{p-57bc98b3.js.map → p-410e296d.js.map} +0 -0
  172. /package/dist/components/{p-fd554fb4.js.map → p-4f694d25.js.map} +0 -0
  173. /package/dist/components/{p-483d079f.js.map → p-701f03e1.js.map} +0 -0
  174. /package/dist/components/{p-e35fdedd.js.map → p-ab0ea373.js.map} +0 -0
  175. /package/dist/components/{p-44c731a0.js.map → p-eefec75b.js.map} +0 -0
  176. /package/dist/core/{p-98e89c46.entry.js.map → p-4b88cdf6.entry.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"names":["govFormSelectCss","GovFormSelectStyle0","GovFormSelect","constructor","hostRef","this","h","govHost","host","f","govForm","selectId","createID","validateVariant","newValue","validateProp","FormSelectVariants","FormSelectClass","root","validateSize","FormSelectSizes","watchOptions","optionsState","propsValueToArray","watchDisabled","passControlAttrs","watchValue","markSelectedValue","passAttrToControl","size","toBoolAttr","invalid","componentWillLoad","variant","passAttrToLabel","String","required","options","componentDidRender","canValidateWcagOnRender","delay","validateWcag","tick","querySelectorAll","forEach","option","value","setAttribute","removeAttribute","render","Host","key","class","hasSlot","name","slot","success","id","identifier","onFocus","onFocusHandler","bind","onChange","onChangeHandler","onBlur","onBlurHandler","disabled","ref","el","selectRef","toBoolAttrIfDefined","wcagActiveDescendant","wcagControls","wcagDescribedBy","wcagLabelledBy","wcagOwns","Array","isArray","map","selected","_a","label","e","focused","govFocus","emit","component","originalEvent","govBlur","target","stopPropagation","govChange","setFocus","focus","getRef","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/select/gov-form-select.scss?tag=gov-form-select","../../../packages/core/src/components/gov-form/select/gov-form-select.tsx"],"sourcesContent":["/*\n * Select\n */\n\n@import \"../select/gov-form-select-core.scss\";\n\n$class: \".gov-form-select\";\n\n#{$class} {\n\t@extend %form-select-core;\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {createID} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {\n\tFormSelectClass,\n\tFormSelectSizes,\n\tFormSelectSizesType,\n\tFormSelectVariants,\n\tFormSelectVariantType\n} from './constants'\nimport {FormSelectEvent, FormSelectOption} from './gov-form-select.types'\nimport {propsValueToArray} from \"../../../utils/array.utils\";\nimport {tick} from \"../../../utils/stencil.utils\";\n\n@Component({\n\ttag: 'gov-form-select',\n\tstyleUrl: 'gov-form-select.scss',\n})\nexport class GovFormSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\tprivate selectRef?: HTMLSelectElement\n\n\tprivate readonly selectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t\tthis.selectId = createID('GovSelect')\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Value of select\n\t */\n\t@Prop({reflect: true, mutable: true}) value: string\n\t/**\n\t * Options of select\n\t */\n\t@Prop({reflect: true, mutable: true}) options?: string | FormSelectOption[]\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormSelectVariantType = 'secondary'\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormSelectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a related component’s visually focused element.\n\t */\n\t@Prop({attribute: 'wcag-active-descendant'}) readonly wcagActiveDescendant: string\n\t/**\n\t * Use this prop to add an aria-controls attribute. Use the attribute to indicate the id of a component controlled by this component.\n\t */\n\t@Prop({attribute: 'wcag-controls'}) readonly wcagControls: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormSelectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormSelectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormSelectEvent>\n\t@State() focused: boolean\n\t@State() optionsState: FormSelectOption[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormSelectVariants, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSelectSizes, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('options')\n\twatchOptions(newValue: string | FormSelectOption[]): void {\n\t\tthis.optionsState = propsValueToArray(newValue)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('size')\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@Watch('value')\n\twatchValue(): void {\n\t\tthis.markSelectedValue()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('type', 'select')\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\n\t\tthis.markSelectedValue()\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t\tthis.optionsState = propsValueToArray(this.options)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t\ttick(() => this.markSelectedValue())\n\t}\n\n\tprivate markSelectedValue() {\n\t\tthis.host.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.value === this.value) {\n\t\t\t\toption.setAttribute('selected', 'selected')\n\t\t\t} else {\n\t\t\t\toption.removeAttribute('selected')\n\t\t\t}\n\t\t})\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t{this.h.hasSlot('prefix') && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t<gov-icon slot=\"right-icon\" name=\"chevron-down\" class=\"icon-arrow\"></gov-icon>\n\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t<select\n\t\t\t\t\t\tid={this.identifier || this.selectId}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\taria-activedescendant={this.wcagActiveDescendant}\n\t\t\t\t\t\taria-controls={this.wcagControls}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t{Array.isArray(this.optionsState) && this.optionsState.map((option) => {\n\t\t\t\t\t\t\treturn (<option value={option.value} selected={option.value === this.value}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.label ?? option.value}</option>)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</select>\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot('sufix') && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.value = (e.target as HTMLSelectElement).value\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagActiveDescendant, 'wcag-active-descendant', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagControls, 'wcag-controls', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier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AOiC,SAAUlC,EAAOC,QAAUzC,KAAKyC,MAC7DoB,SAAUrB,IAAM,MAANA,SAAM,SAANA,EAAQqB,WAAWc,EAAAnC,EAAOoC,SAAK,MAAAD,SAAA,EAAAA,EAAInC,EAAOC,MAAe,MAI7EzC,KAAKC,EAAE+C,QAAQ,UAAY/C,EAAA,QAAA6C,IAAA,2CAAMG,KAAK,U,CAKlC,cAAAM,CAAesB,GACtB7E,KAAK8E,QAAU,KACf9E,KAAK+E,SAASC,KAAK,CAClBC,UAAWrE,EAAgBC,KAC3BqE,cAAeL,EACfpC,MAAOzC,KAAKyC,O,CAIN,aAAAmB,CAAciB,GACrB7E,KAAK8E,QAAU,MACf9E,KAAKmF,QAAQH,KAAK,CACjBC,UAAWrE,EAAgBC,KAC3BqE,cAAeL,EACfpC,MAAOzC,KAAKyC,O,CAIN,eAAAiB,CAAgBmB,GACvB7E,KAAKyC,MAASoC,EAAEO,OAA6B3C,MAC7CoC,EAAEQ,kBACFrF,KAAKsF,UAAUN,KAAK,CACnBC,UAAWrE,EAAgBC,KAC3BqE,cAAeL,EACfpC,MAAOzC,KAAKyC,O,CAQd,cAAM8C,CAASvD,GACd,OAAOhC,KAAKgE,UAAUwB,MAAMxD,E,CAO7B,YAAMyD,GACL,OAAOzF,KAAKgE,S,CAOb,kBAAM5B,GACLsD,EAAgB1F,KAAKkE,qBAAsB,yBAA0BtD,EAAgBC,MACrF6E,EAAgB1F,KAAKmE,aAAc,gBAAiBvD,EAAgBC,MACpE6E,EAAgB1F,KAAKoE,gBAAiB,oBAAqBxD,EAAgBC,MAC3E6E,EAAgB1F,KAAKsE,SAAU,YAAa1D,EAAgBC,MAC5D8E,EAAqB3F,KAAKqD,YAAcrD,KAAKM,SAAUN,KAAKqE,eAAgBzD,EAAgBC,K","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["InfobarVariants","pick","Variants","InfobarClass","root","section","icon","content","closable","headline","close","govInfobarCss","GovInfobarStyle0","GovInfobar","constructor","hostRef","undefined","this","h","govHost","host","validateVariant","newValue","validateProp","componentWillLoad","variant","componentDidRender","canValidateWcagOnRender","delay","validateWcag","render","inverse","closeButton","key","class","size","wcagLabel","wcagCloseLabel","type","onCloseHandler","bind","name","Host","classes","role","hasSlot","Fragment","wcagToggleLabel","toggleContent","hidden","toBoolAttr","e","govClose","emit","component","ref","originalEvent","validateWcagProp"],"sources":["../../../packages/core/src/components/gov-infobar/constants.ts","../../../packages/core/src/components/gov-infobar/gov-infobar.scss?tag=gov-infobar","../../../packages/core/src/components/gov-infobar/gov-infobar.tsx"],"sourcesContent":["import { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const InfobarVariants = pick(Variants, ['PRIMARY', 'SECONDARY', 'WARNING', 'ERROR', 'SUCCESS'])\nexport type VariantType = `${ValueOf<typeof InfobarVariants>}`\n\nexport const InfobarClass = {\n\troot: 'gov-infobar',\n\tsection: 'gov-infobar__section',\n\ticon: 'gov-infobar__icon',\n\tcontent: 'gov-infobar__content',\n\tclosable: 'gov-infobar__content--closable',\n\theadline: 'gov-infobar__headline',\n\tclose: 'gov-infobar__close',\n}\n","/*\n * Infobar\n */\n\n$class: \".gov-infobar\";\n\n#{$class} {\n\t@include base();\n\n\t&__section {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tpadding: rem-calc(16);\n\t}\n\n\t&__icon {\n\t\tflex: 0 0 auto;\n\n\t\t& > * {\n\t\t\twidth: rem-calc(20);\n\t\t\theight: rem-calc(20);\n\t\t}\n\t}\n\n\t&__headline {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\n\t\t+ div {\n\t\t\tmargin-top: rem-calc(8);\n\t\t}\n\n\t\tp {\n\t\t\tmargin-bottom: 0;\n\t\t}\n\n\t\tgov-button {\n\t\t\tmargin-top: rem-calc(-4);\n\t\t}\n\t}\n\n\t&__content {\n\t\t@include reset-last-margin();\n\t\twidth: 100%;\n\n\t\t&--closable {\n\t\t\tpadding-right: rem-calc(56);\n\t\t}\n\n\t\tp {\n\t\t\t@include typography($font-size-m);\n\t\t}\n\n\t\ta {\n\t\t\tcolor: inherit;\n\t\t\t@include hover() {\n\t\t\t\tcolor: inherit;\n\t\t\t}\n\t\t\t.gov-icon {\n\t\t\t\tcolor: inherit;\n\t\t\t}\n\t\t}\n\t}\n\n\t&__close {\n\t\tposition: absolute;\n\t\ttop: rem-calc(14);\n\t\tright: rem-calc(16);\n\t}\n\n\t// VARIANTS\n\t@each $variant, $definitions in $infobar-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\tbackground-color: get(\"bg-color\", $definitions);\n\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tcolor: get(\"icon-color\", $definitions);\n\t\t\t\t}\n\n\t\t\t\t&__content {\n\t\t\t\t\tcolor: get(\"text-color\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@if deep-map-check($definitions, \"border\") {\n\t\t\t\tborder-bottom: $infobar-border;\n\t\t\t}\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"inverse\") {\n\t\t\t\tborder-bottom: $infobar-border;\n\t\t\t\tbackground-color: $infobar-inverse-bg;\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__icon {\n\t\t\t\t\t\tcolor: get(\"bg-color\", $definitions);\n\t\t\t\t\t}\n\n\t\t\t\t\t&__content {\n\t\t\t\t\t\tcolor: $infobar-inverse-color;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govHost, toBoolAttr} from '../../helpers/Dom/template'\nimport {GovHost} from '../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../helpers/Dom/win'\nimport Fragment from '../../helpers/Fragment'\nimport {validateProp} from '../../helpers/Validate/props'\nimport {validateWcagProp} from '../../helpers/Validate/wcag'\nimport {delay} from '../../utils/utils'\nimport {ButtonEvent} from '../gov-button/button/gov-button.types'\nimport {InfobarClass, InfobarVariants, VariantType} from './constants'\nimport {InfobarEvent} from './gov-infobar.types'\n\n@Component({\n\ttag: 'gov-infobar',\n\tstyleUrl: 'gov-infobar.scss',\n})\nexport class GovInfobar {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovInfobarElement\n\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly headline: string\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant: VariantType = 'primary'\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly role: HTMLElement['role'] = undefined\n\t/**\n\t * Determine if component should have inverse colors to be used on dark background\n\t */\n\t@Prop() readonly inverse: boolean = false\n\t/**\n\t * Aria label for the closing button. It is mandatory if the infobar is closable\n\t */\n\t@Prop({attribute: 'wcag-close-label'}) readonly wcagCloseLabel: string = 'Zavřít informační lištu'\n\t/**\n\t * Aria label for the toggle button. It is mandatory if the infobar has headline\n\t */\n\t@Prop({attribute: 'wcag-toggle-label'}) readonly wcagToggleLabel: string = 'Zobrazit více informací'\n\t/**\n\t * Called when the close button is clicked\n\t */\n\t@Event({eventName: 'gov-close'}) govClose: EventEmitter<InfobarEvent>\n\t/**\n\t * Displays the option to close the infobar\n\t */\n\t@Prop() readonly closable?: boolean = false\n\n\t@State() toggleContent = false\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(InfobarVariants, newValue, InfobarClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tlet inverse = !this.inverse\n\t\tlet variant = this.inverse ? 'secondary' : this.variant\n\n\t\tif (this.variant == 'warning') {\n\t\t\tinverse = false\n\t\t\tvariant = 'secondary'\n\t\t}\n\n\t\tconst closeButton = (\n\t\t\t<div class={InfobarClass.close}>\n\t\t\t\t<gov-button size=\"s\" wcagLabel={this.wcagCloseLabel} type=\"base\" variant={variant} inverse={inverse}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}>\n\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t</gov-button>\n\t\t\t</div>\n\t\t)\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(InfobarClass.root)} variant={this.variant}>\n\t\t\t\t<section class={InfobarClass.section} role={this.role}>\n\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t<div class={InfobarClass.icon}>\n\t\t\t\t\t\t\t<slot name=\"icon\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<div class={InfobarClass.content + (this.closable ? ' ' + InfobarClass.closable : '')}>\n\t\t\t\t\t\t{this.headline ? (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t<div class={InfobarClass.headline}>\n\t\t\t\t\t\t\t\t\t<p>{this.headline}</p>\n\t\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\t\twcagLabel={this.wcagToggleLabel}\n\t\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\t\t\t\tinverse={inverse}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => (this.toggleContent = !this.toggleContent)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<gov-icon name={this.toggleContent ? 'chevron-up' : 'chevron-down'}></gov-icon>\n\t\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div hidden={!this.toggleContent} aria-hidden={toBoolAttr(this.toggleContent)}>\n\t\t\t\t\t\t\t\t\t<slot/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<slot/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t\t{this.closable && closeButton}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tonCloseHandler(e: CustomEvent<ButtonEvent>) {\n\t\tthis.govClose.emit({\n\t\t\tcomponent: InfobarClass.root,\n\t\t\tref: this.host,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tif (this.closable) {\n\t\t\tvalidateWcagProp(this.wcagCloseLabel, 'wcag-close-label', InfobarClass.root)\n\t\t}\n\t\tif (this.headline) {\n\t\t\tvalidateWcagProp(this.wcagToggleLabel, 'wcag-toggle-label', InfobarClass.root)\n\t\t}\n\t}\n}\n"],"mappings":"0XAIO,MAAMA,EAAkBC,EAAKC,EAAU,CAAC,UAAW,YAAa,UAAW,QAAS,YAGpF,MAAMC,EAAe,CAC3BC,KAAM,cACNC,QAAS,uBACTC,KAAM,oBACNC,QAAS,uBACTC,SAAU,iCACVC,SAAU,wBACVC,MAAO,sBCdR,MAAMC,EAAgB,uiOACtB,MAAAC,EAAeD,E,MCeFE,EAAU,MAGtB,WAAAC,CAAAC,G,mFAawC,U,UAIKC,U,aAIT,M,oBAIqC,0B,qBAIE,0B,cAQrC,M,mBAEb,MAtCxBC,KAAKC,EAAIC,EAAQF,KAAKG,K,CAyCvB,eAAAC,CAAgBC,GACfC,EAAavB,EAAiBsB,EAAUnB,EAAaC,K,CAGtD,iBAAAoB,GACCP,KAAKI,gBAAgBJ,KAAKQ,Q,CAG3B,wBAAMC,GACL,GAAIC,IAA2B,OACxBC,EAAM,WACNX,KAAKY,c,EAIb,MAAAC,GACC,IAAIC,GAAWd,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K,CAClBC,UAAWnD,EAAaC,KACxBmD,IAAKtC,KAAKG,KACVoC,cAAeL,G,CAQjB,kBAAMtB,GACL,GAAIZ,KAAKT,SAAU,CAClBiD,EAAiBxC,KAAKoB,eAAgB,mBAAoBlC,EAAaC,K,CAExE,GAAIa,KAAKR,SAAU,CAClBgD,EAAiBxC,KAAK8B,gBAAiB,oBAAqB5C,EAAaC,K","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["govPromptCss","GovPromptStyle0","GovPrompt","constructor","hostRef","this","h","govHost","host","labelId","createID","contentId","validateLabelTag","newValue","validTags","includes","govErrorLog","ModalClass","root","watchOpen","open","closeCtaRef","setFocus","catch","showModal","document","body","classList","add","bodyFix","hideModal","remove","componentWillRender","componentDidRender","canValidateWcagOnRender","delay","validateWcag","render","LabelTag","labelTag","Host","key","class","classes","rootPrompt","dialog","hidden","tabindex","toBoolAttr","wcagLabelledBy","wcagDescribedBy","role","inner","header","hasSlot","icon","name","label","title","id","close","variant","wcagLabel","wcagCloseLabel","wcagCloseLabelledBy","type","ref","el","onCloseHandler","bind","content","actions","e","stopPropagation","govClose","emit","show","hide","validateWcagRef"],"sources":["../../../packages/core/src/components/gov-promp/gov-prompt.scss?tag=gov-prompt","../../../packages/core/src/components/gov-promp/gov-prompt.tsx"],"sourcesContent":["/*\n * Prompt\n */\n\n// $class: \".gov-prompt\";\n@import \"../gov-modal/gov-modal.scss\";\n\n// #{$class} {\n// \t//\n// }\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch} from '@stencil/core'\nimport {govHost, toBoolAttr} from '../../helpers/Dom/template'\nimport {GovHost} from '../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../helpers/Dom/win'\nimport {govErrorLog} from '../../helpers/Log/gov.log'\nimport {validateWcagRef} from '../../helpers/Validate/wcag'\nimport {Nullable} from '../../types/interfaces'\nimport {createID} from '../../utils/string.utils'\nimport {delay} from '../../utils/utils'\nimport {ModalClass} from '../gov-modal/constants'\n\n@Component({\n\ttag: 'gov-prompt',\n\tstyleUrl: 'gov-prompt.scss',\n})\nexport class GovPrompt {\n\tprivate h: GovHost\n\tprivate readonly labelId: string\n\tprivate readonly contentId: string\n\tprivate closeCtaRef?: HTMLGovButtonElement\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.labelId = createID('GovPromptLabel')\n\t\tthis.contentId = createID('GovPromptContent')\n\t}\n\n\t@Element() host: HTMLGovPromptElement\n\t/**\n\t * Attribute for modal window display\n\t */\n\t@Prop({mutable: true}) open = false\n\t/**\n\t * Title of modal window\n\t */\n\t@Prop() label: string\n\t/**\n\t * Role of modal\n\t */\n\t@Prop({attribute: 'role'}) role: Nullable<string> = 'dialog'\n\t/**\n\t * Used to change the HTML tag in the modal label for correct semantic structure\n\t */\n\t@Prop({attribute: 'label-tag'}) readonly labelTag: string = 'h2'\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the modal.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) wcagDescribedBy: string\n\t/**\n\t * Adds accessible label for the modal close button that is only shown for screen readers.\n\t */\n\t@Prop({attribute: 'wcag-close-label'}) readonly wcagCloseLabel: string = 'Zavřít okno'\n\t/**\n\t * A string of identifiers that indicate alternative label elements for closing the modal window\n\t */\n\t@Prop({attribute: 'wcag-close-labelled-by'}) wcagCloseLabelledBy: string\n\t/**\n\t * Emitted when modal window closes.\n\t */\n\t@Event({eventName: 'gov-close'}) govClose: EventEmitter<PointerEvent>\n\n\t@Watch('labelTag')\n\tvalidateLabelTag(newValue: string): void {\n\t\tconst validTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${ModalClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch('open')\n\twatchOpen(newValue: boolean): void {\n\t\tthis.open = newValue\n\t\tif (newValue && this.closeCtaRef) {\n\t\t\tthis.closeCtaRef.setFocus().catch()\n\t\t}\n\t}\n\n\tprivate showModal() {\n\t\tthis.open = true\n\t\tdocument.body.classList.add(ModalClass.bodyFix)\n\t}\n\n\tprivate hideModal() {\n\t\tthis.open = false\n\t\tdocument.body.classList.remove(ModalClass.bodyFix)\n\t}\n\n\tasync componentWillRender() {\n\t\tif (this.open) {\n\t\t\tthis.showModal()\n\t\t} else {\n\t\t\tthis.hideModal()\n\t\t}\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst LabelTag = this.labelTag\n\t\treturn (\n\t\t\t<Host class={this.h.classes(ModalClass.rootPrompt)} open={this.open}>\n\t\t\t\t<dialog\n\t\t\t\t\tclass={ModalClass.dialog}\n\t\t\t\t\thidden={!this.open}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\topen={this.open}\n\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\taria-hidden={toBoolAttr(!this.open)}\n\t\t\t\t\taria-labelledby={this.wcagLabelledBy || this.labelId}\n\t\t\t\t\taria-describedby={this.wcagDescribedBy || this.contentId}\n\t\t\t\t\trole={this.role}\n\t\t\t\t>\n\t\t\t\t\t<div class={ModalClass.inner}>\n\t\t\t\t\t\t<div class={ModalClass.header}>\n\t\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t\t<div class={ModalClass.icon}>\n\t\t\t\t\t\t\t\t\t<slot name=\"icon\"/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{this.label && (\n\t\t\t\t\t\t\t\t<LabelTag class={ModalClass.title} id={this.labelId}>\n\t\t\t\t\t\t\t\t\t{this.label}\n\t\t\t\t\t\t\t\t</LabelTag>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\tclass={ModalClass.close}\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\twcagLabel={this.wcagCloseLabel}\n\t\t\t\t\t\t\t\twcagLabelledBy={this.wcagCloseLabelledBy}\n\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\tref={el => (this.closeCtaRef = el)}\n\t\t\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\"/>\n\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class={ModalClass.content} id={this.contentId}>\n\t\t\t\t\t\t\t<slot/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class={ModalClass.actions}>\n\t\t\t\t\t\t\t<slot name=\"actions\"/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</dialog>\n\n\t\t\t\t{this.open ? (\n\t\t\t\t\t<gov-backdrop wcag-label={this.wcagCloseLabel} wcag-labelled-by={this.wcagCloseLabelledBy}\n\t\t\t\t\t\t\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}/>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onCloseHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t\tthis.hideModal()\n\t\tthis.govClose.emit(e)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showModal()\n\t}\n\n\t/**\n\t * Hiding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.hideModal()\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag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