@gov-design-system-ce/components 4.6.3 → 4.6.4

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 (218) hide show
  1. package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -1
  2. package/dist/cjs/core.cjs.js +1 -1
  3. package/dist/cjs/gov-banner.cjs.entry.js +3 -3
  4. package/dist/cjs/gov-banner.cjs.entry.js.map +1 -1
  5. package/dist/cjs/gov-banner.entry.cjs.js.map +1 -1
  6. package/dist/cjs/gov-flex_3.cjs.entry.js +1 -1
  7. package/dist/cjs/gov-form-autocomplete.cjs.entry.js +67 -23
  8. package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
  9. package/dist/cjs/gov-form-autocomplete.entry.cjs.js.map +1 -1
  10. package/dist/cjs/gov-form-file.cjs.entry.js +32 -3
  11. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  12. package/dist/cjs/gov-form-file.entry.cjs.js.map +1 -1
  13. package/dist/cjs/gov-form-search.cjs.entry.js +1 -1
  14. package/dist/cjs/gov-form-search.cjs.entry.js.map +1 -1
  15. package/dist/cjs/gov-form-search.entry.cjs.js.map +1 -1
  16. package/dist/cjs/gov-form-select.cjs.entry.js +8 -15
  17. package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
  18. package/dist/cjs/gov-form-select.entry.cjs.js.map +1 -1
  19. package/dist/cjs/gov-tooltip.gov-tooltip-content.entry.cjs.js.map +1 -1
  20. package/dist/cjs/gov-tooltip_2.cjs.entry.js +34 -9
  21. package/dist/cjs/gov-tooltip_2.cjs.entry.js.map +1 -1
  22. package/dist/cjs/gov-wizard-item.cjs.entry.js +2 -2
  23. package/dist/cjs/gov-wizard.cjs.entry.js +1 -1
  24. package/dist/cjs/index-BEF5cZxd.js +4 -4
  25. package/dist/cjs/loader.cjs.js +1 -1
  26. package/dist/collection/components/gov-banner/gov-banner.js +4 -4
  27. package/dist/collection/components/gov-banner/gov-banner.js.map +1 -1
  28. package/dist/collection/components/gov-form/autocomplete/autocomplete.utils.js +14 -0
  29. package/dist/collection/components/gov-form/autocomplete/autocomplete.utils.js.map +1 -0
  30. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +76 -22
  31. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
  32. package/dist/collection/components/gov-form/file/gov-form-file.js +34 -3
  33. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  34. package/dist/collection/components/gov-form/search/gov-form-search.js +2 -2
  35. package/dist/collection/components/gov-form/search/gov-form-search.js.map +1 -1
  36. package/dist/collection/components/gov-form/select/gov-form-select.js +8 -15
  37. package/dist/collection/components/gov-form/select/gov-form-select.js.map +1 -1
  38. package/dist/collection/components/gov-tooltip/gov-tooltip-content.js +22 -1
  39. package/dist/collection/components/gov-tooltip/gov-tooltip-content.js.map +1 -1
  40. package/dist/collection/components/gov-tooltip/gov-tooltip.js +31 -8
  41. package/dist/collection/components/gov-tooltip/gov-tooltip.js.map +1 -1
  42. package/dist/collection/components/gov-wizard/gov-wizard-item.js +2 -2
  43. package/dist/collection/components/gov-wizard/gov-wizard.js +1 -1
  44. package/dist/components/gov-accordion-item.js +1 -1
  45. package/dist/components/gov-accordion.js +1 -1
  46. package/dist/components/gov-attachments-item.js +1 -1
  47. package/dist/components/gov-attachments.js +1 -1
  48. package/dist/components/gov-backdrop.js +1 -1
  49. package/dist/components/gov-banner.js +1 -1
  50. package/dist/components/gov-banner.js.map +1 -1
  51. package/dist/components/gov-blockquote.js +1 -1
  52. package/dist/components/gov-breadcrumbs.js +1 -1
  53. package/dist/components/gov-breadcrumbs.js.map +1 -1
  54. package/dist/components/gov-button.js +1 -1
  55. package/dist/components/gov-card.js +1 -1
  56. package/dist/components/gov-chip.js +1 -1
  57. package/dist/components/gov-collapsible.js +1 -1
  58. package/dist/components/gov-collapsible.js.map +1 -1
  59. package/dist/components/gov-container.js +1 -1
  60. package/dist/components/gov-control-group.js +1 -1
  61. package/dist/components/gov-cookiebar.js +1 -1
  62. package/dist/components/gov-dialog.js +1 -1
  63. package/dist/components/gov-dropdown.js +1 -1
  64. package/dist/components/gov-empty.js +1 -1
  65. package/dist/components/gov-error-code.js +1 -1
  66. package/dist/components/gov-flex.js +1 -1
  67. package/dist/components/gov-form-autocomplete.js +1 -1
  68. package/dist/components/gov-form-checkbox-group.js +1 -1
  69. package/dist/components/gov-form-checkbox.js +1 -1
  70. package/dist/components/gov-form-control.js +1 -1
  71. package/dist/components/gov-form-file.js +1 -1
  72. package/dist/components/gov-form-file.js.map +1 -1
  73. package/dist/components/gov-form-group.js +1 -1
  74. package/dist/components/gov-form-input.js +1 -1
  75. package/dist/components/gov-form-message.js +1 -1
  76. package/dist/components/gov-form-multi-select.js +1 -1
  77. package/dist/components/gov-form-multi-select.js.map +1 -1
  78. package/dist/components/gov-form-radio-group.js +1 -1
  79. package/dist/components/gov-form-radio.js +1 -1
  80. package/dist/components/gov-form-range.js +1 -1
  81. package/dist/components/gov-form-range.js.map +1 -1
  82. package/dist/components/gov-form-search.js +1 -1
  83. package/dist/components/gov-form-search.js.map +1 -1
  84. package/dist/components/gov-form-select.js +1 -1
  85. package/dist/components/gov-form-switch.js +1 -1
  86. package/dist/components/gov-grid-item.js +1 -1
  87. package/dist/components/gov-grid.js +1 -1
  88. package/dist/components/gov-icon.js +1 -1
  89. package/dist/components/gov-infobar.js +1 -1
  90. package/dist/components/gov-layout-column.js +1 -1
  91. package/dist/components/gov-layout.js +1 -1
  92. package/dist/components/gov-link.js +1 -1
  93. package/dist/components/gov-loading.js +1 -1
  94. package/dist/components/gov-message.js +1 -1
  95. package/dist/components/gov-pagination.js +1 -1
  96. package/dist/components/gov-skeleton.js +1 -1
  97. package/dist/components/gov-spacer.js +1 -1
  98. package/dist/components/gov-stepper-item.js +1 -1
  99. package/dist/components/gov-stepper.js +1 -1
  100. package/dist/components/gov-tabs-item.js +1 -1
  101. package/dist/components/gov-tabs.js +1 -1
  102. package/dist/components/gov-tag.js +1 -1
  103. package/dist/components/gov-theme-switch.js +1 -1
  104. package/dist/components/gov-tile.js +1 -1
  105. package/dist/components/gov-toast.js +1 -1
  106. package/dist/components/gov-tooltip-content.js +1 -1
  107. package/dist/components/gov-tooltip.js +1 -1
  108. package/dist/components/gov-wizard-item.js +1 -1
  109. package/dist/components/gov-wizard.js +1 -1
  110. package/dist/components/{p-DKo9A5gq.js → p-BHRF-5cf.js} +2 -2
  111. package/dist/components/{p-9imLQpxb.js → p-BSr8e18S.js} +2 -2
  112. package/dist/components/{p-BNnuBQvo.js → p-BxS4InzB.js} +2 -2
  113. package/dist/components/{p-CfaJM4SA.js → p-CMmyR4-k.js} +2 -2
  114. package/dist/components/{p-B0KFtEn3.js → p-CU0plGZP.js} +2 -2
  115. package/dist/components/{p-BrdXh0mI.js → p-CXPP9vec.js} +2 -2
  116. package/dist/components/{p-djqfSbq-.js → p-C_URF9Su.js} +2 -2
  117. package/dist/components/{p-yqJEurSE.js → p-CnKqUwf9.js} +2 -2
  118. package/dist/components/p-DEthsMuE.js +2 -0
  119. package/dist/components/p-DEthsMuE.js.map +1 -0
  120. package/dist/components/{p-Bv5L0j6n.js → p-DN5pb9xA.js} +2 -2
  121. package/dist/components/{p-DesycS6d.js → p-iTwUkISB.js} +2 -2
  122. package/dist/components/{p-BZTY3MxF.js → p-ibUK7mfI.js} +2 -2
  123. package/dist/components/p-keC6luw7.js +2 -0
  124. package/dist/components/p-keC6luw7.js.map +1 -0
  125. package/dist/components/p-pJ_vPAO0.js +2 -0
  126. package/dist/components/p-pJ_vPAO0.js.map +1 -0
  127. package/dist/components/p-yIpIIG5A.js +2 -0
  128. package/dist/components/p-yIpIIG5A.js.map +1 -0
  129. package/dist/core/core.css +47 -47
  130. package/dist/core/core.esm.js +1 -1
  131. package/dist/core/gov-banner.entry.esm.js.map +1 -1
  132. package/dist/core/gov-form-autocomplete.entry.esm.js.map +1 -1
  133. package/dist/core/gov-form-file.entry.esm.js.map +1 -1
  134. package/dist/core/gov-form-search.entry.esm.js.map +1 -1
  135. package/dist/core/gov-form-select.entry.esm.js.map +1 -1
  136. package/dist/core/gov-tooltip.gov-tooltip-content.entry.esm.js.map +1 -1
  137. package/dist/core/{p-4da8ac1d.entry.js → p-10991f00.entry.js} +2 -2
  138. package/dist/core/p-19300834.entry.js +2 -0
  139. package/dist/core/{p-bd389bfd.entry.js.map → p-19300834.entry.js.map} +1 -1
  140. package/dist/core/p-4e2faea7.entry.js +2 -0
  141. package/dist/core/p-4e2faea7.entry.js.map +1 -0
  142. package/dist/core/p-7f513718.entry.js +2 -0
  143. package/dist/core/p-7f513718.entry.js.map +1 -0
  144. package/dist/core/p-8d47e346.entry.js +2 -0
  145. package/dist/core/p-8d47e346.entry.js.map +1 -0
  146. package/dist/core/p-DQuL1Twl.js.map +1 -1
  147. package/dist/core/p-afe254cb.entry.js +2 -0
  148. package/dist/core/p-afe254cb.entry.js.map +1 -0
  149. package/dist/core/{p-469f14db.entry.js → p-bec959c4.entry.js} +2 -2
  150. package/dist/core/p-d9d29f50.entry.js +2 -0
  151. package/dist/core/p-d9d29f50.entry.js.map +1 -0
  152. package/dist/core/{p-4d365881.entry.js → p-f75ad657.entry.js} +2 -2
  153. package/dist/esm/app-globals-DQuL1Twl.js.map +1 -1
  154. package/dist/esm/core.js +1 -1
  155. package/dist/esm/gov-banner.entry.js +3 -3
  156. package/dist/esm/gov-banner.entry.js.map +1 -1
  157. package/dist/esm/gov-flex_3.entry.js +1 -1
  158. package/dist/esm/gov-form-autocomplete.entry.js +68 -24
  159. package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
  160. package/dist/esm/gov-form-file.entry.js +32 -3
  161. package/dist/esm/gov-form-file.entry.js.map +1 -1
  162. package/dist/esm/gov-form-search.entry.js +1 -1
  163. package/dist/esm/gov-form-search.entry.js.map +1 -1
  164. package/dist/esm/gov-form-select.entry.js +8 -15
  165. package/dist/esm/gov-form-select.entry.js.map +1 -1
  166. package/dist/esm/gov-tooltip.gov-tooltip-content.entry.js.map +1 -1
  167. package/dist/esm/gov-tooltip_2.entry.js +34 -9
  168. package/dist/esm/gov-tooltip_2.entry.js.map +1 -1
  169. package/dist/esm/gov-wizard-item.entry.js +2 -2
  170. package/dist/esm/gov-wizard.entry.js +1 -1
  171. package/dist/esm/index-ClISz4NF.js +4 -4
  172. package/dist/esm/loader.js +1 -1
  173. package/dist/hydrate/index.js +154 -60
  174. package/dist/hydrate/index.mjs +154 -60
  175. package/dist/types/Users/jf/dev/designSystem/gov-design-system/packages/core/.stencil/packages/core/stencil.config.d.ts +2 -0
  176. package/dist/types/components/gov-form/autocomplete/autocomplete.utils.d.ts +2 -0
  177. package/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.d.ts +9 -0
  178. package/dist/types/components/gov-form/file/gov-form-file.d.ts +1 -0
  179. package/dist/types/components/gov-form/select/gov-form-select.d.ts +1 -1
  180. package/dist/types/components/gov-tooltip/gov-tooltip-content.d.ts +4 -0
  181. package/dist/types/components/gov-tooltip/gov-tooltip.d.ts +3 -0
  182. package/dist/types/components.d.ts +20 -2
  183. package/package.json +2 -2
  184. package/readme.md +9 -0
  185. package/dist/components/p-DFu5UVoP.js +0 -2
  186. package/dist/components/p-DFu5UVoP.js.map +0 -1
  187. package/dist/components/p-DMVQRz4f.js +0 -2
  188. package/dist/components/p-DMVQRz4f.js.map +0 -1
  189. package/dist/components/p-UDT3DloZ.js +0 -2
  190. package/dist/components/p-UDT3DloZ.js.map +0 -1
  191. package/dist/components/p-x3w8Mun_.js +0 -2
  192. package/dist/components/p-x3w8Mun_.js.map +0 -1
  193. package/dist/core/p-11fc3899.entry.js +0 -2
  194. package/dist/core/p-11fc3899.entry.js.map +0 -1
  195. package/dist/core/p-33b462c9.entry.js +0 -2
  196. package/dist/core/p-33b462c9.entry.js.map +0 -1
  197. package/dist/core/p-3e5ae012.entry.js +0 -2
  198. package/dist/core/p-3e5ae012.entry.js.map +0 -1
  199. package/dist/core/p-bd389bfd.entry.js +0 -2
  200. package/dist/core/p-c21bc8f9.entry.js +0 -2
  201. package/dist/core/p-c21bc8f9.entry.js.map +0 -1
  202. package/dist/core/p-def34832.entry.js +0 -2
  203. package/dist/core/p-def34832.entry.js.map +0 -1
  204. package/dist/types/work/packages/core/.stencil/packages/core/stencil.config.d.ts +0 -2
  205. /package/dist/components/{p-DKo9A5gq.js.map → p-BHRF-5cf.js.map} +0 -0
  206. /package/dist/components/{p-9imLQpxb.js.map → p-BSr8e18S.js.map} +0 -0
  207. /package/dist/components/{p-BNnuBQvo.js.map → p-BxS4InzB.js.map} +0 -0
  208. /package/dist/components/{p-CfaJM4SA.js.map → p-CMmyR4-k.js.map} +0 -0
  209. /package/dist/components/{p-B0KFtEn3.js.map → p-CU0plGZP.js.map} +0 -0
  210. /package/dist/components/{p-BrdXh0mI.js.map → p-CXPP9vec.js.map} +0 -0
  211. /package/dist/components/{p-djqfSbq-.js.map → p-C_URF9Su.js.map} +0 -0
  212. /package/dist/components/{p-yqJEurSE.js.map → p-CnKqUwf9.js.map} +0 -0
  213. /package/dist/components/{p-Bv5L0j6n.js.map → p-DN5pb9xA.js.map} +0 -0
  214. /package/dist/components/{p-DesycS6d.js.map → p-iTwUkISB.js.map} +0 -0
  215. /package/dist/components/{p-BZTY3MxF.js.map → p-ibUK7mfI.js.map} +0 -0
  216. /package/dist/core/{p-4da8ac1d.entry.js.map → p-10991f00.entry.js.map} +0 -0
  217. /package/dist/core/{p-469f14db.entry.js.map → p-bec959c4.entry.js.map} +0 -0
  218. /package/dist/core/{p-4d365881.entry.js.map → p-f75ad657.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-file.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/file/gov-form-file.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAC,M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CAAA;IACH,CAAC;IAEO,eAAe,CAAC,CAAQ;QAC/B,CAAC,CAAC,eAAe,EAAE,CAAA;IACpB,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,CAAA;IACrB,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,UAAU;QACf,OAAO,IAAI,CAAC,OAAO,CAAA;IACpB,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,KAAK;QACV,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {createID} from \"../../../utils/string.utils\"\nimport {FormFileClass} from \"./constants\"\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from \"../../../helpers/Dom/template\"\nimport {fileAcceptValidation, fileSizeValidation, formatBytes} from \"../../../utils/file.utils\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovFormFileEvent, GovFormFileItem} from \"./gov-form-file.types\"\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\n\n@Component({\n\ttag: \"gov-form-file\",\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\n\tprivate attributeObserver: AttributeObserver\n\tprivate eventsRegistered = false\n\n\tconstructor() {\n\t\tthis.fileId = createID(\"GovInputFile\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: boolean = false\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 * Makes the File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop({reflect: true}) readonly disabled: boolean = false\n\t/**\n\t * After selecting the files, the main input element will be reset.\n\t * The propagation of the event with the selected files will not be affected.\n\t */\n\t@Prop({attribute: \"reset-after-pick\"}) readonly resetAfterPick: boolean = false\n\t/**\n\t * Selected files will not be checked for duplicates based on name and size.\n\t */\n\t@Prop({attribute: \"ignore-file-duplication-check\"}) readonly ignoreFileDuplicationCheck: boolean = false\n\t/**\n\t * Show list of attachments\n\t */\n\t@Prop({attribute: \"display-attachments\"}) readonly displayAttachments: boolean = true\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept\n\t */\n\t@Prop() readonly accept: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple\n\t */\n\t@Prop() readonly multiple: boolean = false\n\t/**\n\t * Maximum embedded file size\n\t */\n\t@Prop({attribute: \"max-file-size\"}) readonly maxFileSize: number = -1\n\t/**\n\t * Custom File identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\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 * Error message when the maximum file size is exceeded\n\t */\n\t@Prop({attribute: \"error-size\"}) readonly errorSize: string = \"Soubor je větší než povolená velikost {FILE_SIZE}\"\n\t/**\n\t * Insert unsupported file error message\n\t */\n\t@Prop({attribute: \"error-accept\"}) readonly errorAccept: string = \"Soubor tohoto typu není povolen\"\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({attribute: \"accessible-attachments-label\"}) readonly accessibleAttachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({eventName: \"gov-focus\"}) govFocus: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({eventName: \"gov-blur\"}) govBlur: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({eventName: \"gov-files\"}) govFiles: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({eventName: \"gov-add-file\"}) govAddFile: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({eventName: \"gov-remove-file\"}) govRemoveFile: EventEmitter<GovFormFileEvent>\n\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@State() files: GovFormFileItem[] = []\n\t@State() inheritedAttributes: Attributes = {}\n\n\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"disabled\", toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t}\n\n\n\tprivate registerListeners() {\n\t\tif (this.eventsRegistered) {\n\t\t\treturn\n\t\t}\n\t\tthis.eventsRegistered = true\n\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add(\"highlight\")\n\t\t}\n\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove(\"highlight\")\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t\"change\",\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tif (this.resetAfterPick) {\n\t\t\t\t\tif (files.length) {\n\t\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\n\t\tif (this.expanded) {\n\t\t\tconst events = [\"dragover\", \"dragleave\"]\n\t\t\tconst inEvents = [\"dragenter\", \"dragover\", \"mouseenter\"]\n\t\t\tconst outEvents = [\"dragleave\", \"mouseleave\"]\n\n\t\t\tevents.map(eventName => this.inputRef.addEventListener(eventName, this.preventDefaults.bind(this), false))\n\t\t\tinEvents.map(eventName => this.inputRef.addEventListener(eventName, highlight.bind(this), false))\n\t\t\toutEvents.forEach(eventName => this.inputRef.addEventListener(eventName, unhighlight.bind(this), false))\n\t\t}\n\t}\n\n\tpreventDefaults(e) {\n\t\te.preventDefault()\n\t\te.stopPropagation()\n\t}\n\n\thandleDrop(e: DragEvent) {\n\t\tconst dataTransfer = e.dataTransfer\n\t\tthis.validateFiles(dataTransfer.files)\n\t}\n\n\tprivate validateFiles(files: FileList) {\n\t\tlet filesBuffer: GovFormFileItem[] = []\n\t\tArray.from(files).map(file => {\n\t\t\tconst isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null\n\t\t\tif (isFile === null || this.ignoreFileDuplicationCheck) {\n\t\t\t\tconst isSizeValid = typeof this.maxFileSize === \"number\" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true\n\t\t\t\tconst isAcceptValid = fileAcceptValidation(file, this.accept)\n\t\t\t\tconst newFile = {\n\t\t\t\t\tid: createID(\"GovFormFile\"),\n\t\t\t\t\tfile,\n\t\t\t\t\tacceptValid: isAcceptValid,\n\t\t\t\t\tsizeValid: isSizeValid,\n\t\t\t\t}\n\t\t\t\tif (this.displayAttachments) {\n\t\t\t\t\tthis.files = [...this.files, newFile]\n\t\t\t\t} else {\n\t\t\t\t\tfilesBuffer = [...filesBuffer, newFile]\n\t\t\t\t}\n\t\t\t\tthis.govAddFile.emit({\n\t\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\t\tfile: newFile,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\tfiles: filesBuffer.length ? filesBuffer : this.files,\n\t\t})\n\n\t\tif (this.resetAfterPick) {\n\t\t\tthis.reset().finally()\n\t\t}\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.passControlAttrs()\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.registerListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver?.stopObserving();\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])}\n\t\t\t\t invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t expanded={toBoolAttrIfDefined(this.expanded)}>\n\t\t\t\t<div class={FormFileClass.area} ref={el => (this.areaRef = el as HTMLDivElement)}>\n\t\t\t\t\t<slot/>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormFileClass.input}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tid={this.identifier || this.fileId}\n\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\taccept={this.accept}\n\t\t\t\t\t\tmultiple={this.multiple}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.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\tdisabled={this.disabled}\n\t\t\t\t\t\t{...this.inheritedAttributes}\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-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t\t<div class={FormFileClass.inputFocus}/>\n\t\t\t\t</div>\n\n\t\t\t\t{this.h.hasSlot(\"attachments\") ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<slot name={\"attachments\"}/>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.files.length && this.displayAttachments ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<gov-attachments label={this.accessibleAttachmentsLabel}\n\t\t\t\t\t\t\t\t\t\t accessible-label={this.accessibleAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item accessible-remove-labelledby={item.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t on-gov-remove={() => this.onRemoveFileHandler(item)}>\n\t\t\t\t\t\t\t\t\t{item.file.name}\n\t\t\t\t\t\t\t\t\t<span slot=\"name\">{item.file.name}</span>\n\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" color=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? this.errorAccept : null}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{item.sizeValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" color=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace(\"{FILE_SIZE}\", formatBytes(this.maxFileSize))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t<span slot=\"info\">({formatBytes(item.file.size)})</span>\n\t\t\t\t\t\t\t\t</gov-attachments-item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</gov-attachments>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onRemoveFileHandler(file: GovFormFileItem) {\n\t\tconst index = this.files.findIndex(item => item.id === file.id)\n\t\tif (index !== -1) {\n\t\t\tconst files = this.files\n\t\t\tconst removeFile = this.files[index]\n\t\t\tfiles.splice(index, 1)\n\t\t\tthis.files = [...files]\n\t\t\tthis.govRemoveFile.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfile: removeFile,\n\t\t\t})\n\t\t\tthis.govFiles.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfiles,\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Returns the reference of the native area element\n\t */\n\t@Method()\n\tasync getAreaRef(): Promise<HTMLDivElement> {\n\t\treturn this.areaRef\n\t}\n\n\t/**\n\t * Remove all files from component state\n\t */\n\t@Method()\n\tasync reset(): Promise<void> {\n\t\tthis.files = []\n\t\tthis.inputRef.value = '';\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-form-file.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/file/gov-form-file.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,eAAe,CAAA;AAC1G,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAC,aAAa,E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AC,OAAO,CAAA;IACpB,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,KAAK;QACV,IAAI,CAAC,KAAK,GAAG,EAAE,CAAA;QACf,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAA;YACxB,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC5B,CAAC;IACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {createID} from \"../../../utils/string.utils\"\nimport {FormFileClass} from \"./constants\"\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from \"../../../helpers/Dom/template\"\nimport {fileAcceptValidation, fileSizeValidation, formatBytes} from \"../../../utils/file.utils\"\nimport {GovForm} from \"../../../helpers/Dom/form.types\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govForm} from \"../../../helpers/Dom/form\"\nimport {GovFormFileEvent, GovFormFileItem} from \"./gov-form-file.types\"\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\n\n@Component({\n\ttag: \"gov-form-file\",\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\n\tprivate attributeObserver: AttributeObserver\n\tprivate eventsRegistered = false\n\n\tconstructor() {\n\t\tthis.fileId = createID(\"GovInputFile\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: boolean = false\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 * Makes the File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop({reflect: true}) readonly disabled: boolean = false\n\t/**\n\t * After selecting the files, the main input element will be reset.\n\t * The propagation of the event with the selected files will not be affected.\n\t */\n\t@Prop({attribute: \"reset-after-pick\"}) readonly resetAfterPick: boolean = false\n\t/**\n\t * Selected files will not be checked for duplicates based on name and size.\n\t */\n\t@Prop({attribute: \"ignore-file-duplication-check\"}) readonly ignoreFileDuplicationCheck: boolean = false\n\t/**\n\t * Show list of attachments\n\t */\n\t@Prop({attribute: \"display-attachments\"}) readonly displayAttachments: boolean = true\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept\n\t */\n\t@Prop() readonly accept: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/multiple\n\t */\n\t@Prop() readonly multiple: boolean = false\n\t/**\n\t * Maximum embedded file size\n\t */\n\t@Prop({attribute: \"max-file-size\"}) readonly maxFileSize: number = -1\n\t/**\n\t * Custom File identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\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 * Error message when the maximum file size is exceeded\n\t */\n\t@Prop({attribute: \"error-size\"}) readonly errorSize: string = \"Soubor je větší než povolená velikost {FILE_SIZE}\"\n\t/**\n\t * Insert unsupported file error message\n\t */\n\t@Prop({attribute: \"error-accept\"}) readonly errorAccept: string = \"Soubor tohoto typu není povolen\"\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({attribute: \"accessible-attachments-label\"}) readonly accessibleAttachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({eventName: \"gov-focus\"}) govFocus: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({eventName: \"gov-blur\"}) govBlur: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({eventName: \"gov-files\"}) govFiles: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({eventName: \"gov-add-file\"}) govAddFile: EventEmitter<GovFormFileEvent>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({eventName: \"gov-remove-file\"}) govRemoveFile: EventEmitter<GovFormFileEvent>\n\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@State() files: GovFormFileItem[] = []\n\t@State() inheritedAttributes: Attributes = {}\n\n\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"disabled\", toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t}\n\n\n\tprivate registerListeners() {\n\t\tif (this.eventsRegistered) {\n\t\t\treturn\n\t\t}\n\t\tthis.eventsRegistered = true\n\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add(\"highlight\")\n\t\t}\n\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove(\"highlight\")\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t\"change\",\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tif (this.resetAfterPick) {\n\t\t\t\t\tif (files.length) {\n\t\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.validateFiles(files)\n\t\t\t\t}\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\n\t\tif (this.expanded) {\n\t\t\tconst events = [\"dragover\", \"dragleave\"]\n\t\t\tconst inEvents = [\"dragenter\", \"dragover\", \"mouseenter\"]\n\t\t\tconst outEvents = [\"dragleave\", \"mouseleave\"]\n\n\t\t\tevents.map(eventName => this.inputRef.addEventListener(eventName, this.preventDefaults.bind(this), false))\n\t\t\tinEvents.map(eventName => this.inputRef.addEventListener(eventName, highlight.bind(this), false))\n\t\t\toutEvents.forEach(eventName => this.inputRef.addEventListener(eventName, unhighlight.bind(this), false))\n\t\t}\n\t}\n\n\tpreventDefaults(e) {\n\t\te.preventDefault()\n\t\te.stopPropagation()\n\t}\n\n\thandleDrop(e: DragEvent) {\n\t\tconst dataTransfer = e.dataTransfer\n\t\tthis.validateFiles(dataTransfer.files)\n\t}\n\n\tprivate validateFiles(files: FileList) {\n\t\tlet filesBuffer: GovFormFileItem[] = []\n\t\tif (!this.multiple && this.displayAttachments) {\n\t\t\tthis.files = []\n\t\t}\n\t\tArray.from(files).forEach(file => {\n\t\t\tconst isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null\n\t\t\tif (isFile === null || this.ignoreFileDuplicationCheck) {\n\t\t\t\tconst isSizeValid = typeof this.maxFileSize === \"number\" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true\n\t\t\t\tconst isAcceptValid = fileAcceptValidation(file, this.accept)\n\t\t\t\tconst newFile = {\n\t\t\t\t\tid: createID(\"GovFormFile\"),\n\t\t\t\t\tfile,\n\t\t\t\t\tacceptValid: isAcceptValid,\n\t\t\t\t\tsizeValid: isSizeValid,\n\t\t\t\t}\n\t\t\t\tif (this.displayAttachments) {\n\t\t\t\t\tthis.files = [...this.files, newFile]\n\t\t\t\t} else {\n\t\t\t\t\tfilesBuffer = [...filesBuffer, newFile]\n\t\t\t\t}\n\t\t\t\tthis.govAddFile.emit({\n\t\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\t\tfile: newFile,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tif (this.displayAttachments) {\n\t\t\tthis.syncNativeInputFiles()\n\t\t}\n\n\t\tthis.govFiles.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\tfiles: filesBuffer.length ? filesBuffer : this.files,\n\t\t})\n\n\t\tif (this.resetAfterPick) {\n\t\t\tthis.reset().finally()\n\t\t}\n\t}\n\n\t// Keep native <input type=\"file\"> in sync with the visible attachments list so\n\t// that a native form submit / FormData carries exactly the files shown in the UI.\n\t// Invalid items (wrong type or oversize) are intentionally excluded.\n\tprivate syncNativeInputFiles() {\n\t\tif (!this.inputRef || typeof DataTransfer === \"undefined\") {\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tconst dt = new DataTransfer()\n\t\t\tthis.files\n\t\t\t\t.filter(item => item.acceptValid === true && item.sizeValid === true)\n\t\t\t\t.forEach(item => dt.items.add(item.file))\n\t\t\tthis.inputRef.files = dt.files\n\t\t} catch (e) {\n\t\t\t// Safari < 14.1 / older browsers may reject assigning to .files; nothing safe to fall back to.\n\t\t\tif (typeof process !== \"undefined\" && process.env && process.env.NODE_ENV !== \"production\") {\n\t\t\t\tconsole.warn(\"[gov-form-file] Could not sync native input.files:\", e)\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tthis.passControlAttrs()\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.registerListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver?.stopObserving();\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])}\n\t\t\t\t invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t expanded={toBoolAttrIfDefined(this.expanded)}>\n\t\t\t\t<div class={FormFileClass.area} ref={el => (this.areaRef = el as HTMLDivElement)}>\n\t\t\t\t\t<slot/>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormFileClass.input}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tid={this.identifier || this.fileId}\n\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\taccept={this.accept}\n\t\t\t\t\t\tmultiple={this.multiple}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.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\tdisabled={this.disabled}\n\t\t\t\t\t\t{...this.inheritedAttributes}\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-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t\t<div class={FormFileClass.inputFocus}/>\n\t\t\t\t</div>\n\n\t\t\t\t{this.h.hasSlot(\"attachments\") ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<slot name={\"attachments\"}/>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.files.length && this.displayAttachments ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<gov-attachments label={this.accessibleAttachmentsLabel}\n\t\t\t\t\t\t\t\t\t\t accessible-label={this.accessibleAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item accessible-remove-labelledby={item.id}\n\t\t\t\t\t\t\t\t\t\t\t\t\t on-gov-remove={() => this.onRemoveFileHandler(item)}>\n\t\t\t\t\t\t\t\t\t{item.file.name}\n\t\t\t\t\t\t\t\t\t<span slot=\"name\">{item.file.name}</span>\n\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" color=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? this.errorAccept : null}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{item.sizeValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" color=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\" type=\"components\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace(\"{FILE_SIZE}\", formatBytes(this.maxFileSize))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t<span slot=\"info\">({formatBytes(item.file.size)})</span>\n\t\t\t\t\t\t\t\t</gov-attachments-item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</gov-attachments>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onRemoveFileHandler(file: GovFormFileItem) {\n\t\tconst index = this.files.findIndex(item => item.id === file.id)\n\t\tif (index !== -1) {\n\t\t\tconst files = this.files\n\t\t\tconst removeFile = this.files[index]\n\t\t\tfiles.splice(index, 1)\n\t\t\tthis.files = [...files]\n\t\t\tthis.syncNativeInputFiles()\n\t\t\tthis.govRemoveFile.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfile: removeFile,\n\t\t\t})\n\t\t\tthis.govFiles.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfiles,\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Returns the reference of the native area element\n\t */\n\t@Method()\n\tasync getAreaRef(): Promise<HTMLDivElement> {\n\t\treturn this.areaRef\n\t}\n\n\t/**\n\t * Remove all files from component state\n\t */\n\t@Method()\n\tasync reset(): Promise<void> {\n\t\tthis.files = []\n\t\tif (this.inputRef) {\n\t\t\tthis.inputRef.value = ''\n\t\t\tthis.syncNativeInputFiles()\n\t\t}\n\t}\n}\n"]}
@@ -12,7 +12,7 @@ export class GovFormSearch {
12
12
  this.color = 'neutral';
13
13
  }
14
14
  render() {
15
- return (h(Host, { key: '8694237120321b5cea6dbe4c4152edfde30228a1', class: FormSearchClass.root, color: this.color, size: this.size }, h("slot", { key: '4c382e33221ff8b874a7f8544d94261298c3cf28', name: "input" }), h("slot", { key: '3b56d19118f2b75964a9ed62ae2210e7705ba4a5', name: "button-erase" }), h("slot", { key: 'c829a3df01bc53fab6b3022aac353ebe06b088db', name: "button" })));
15
+ return (h(Host, { key: 'c901368f70213c3be37b44b472002ce0872209d0', class: FormSearchClass.root, color: this.color, size: this.size }, h("slot", { key: '4ca581f75ccd75f785f94c1f93500c914b129cc8', name: "input" }), h("slot", { key: '10a34b30a9496b0d9a82b0baaf10b66ac5a2679f', name: "button-erase" }), h("slot", { key: '2888491da6babe4e7586abdda1863850ed67f8a9', name: "button" })));
16
16
  }
17
17
  static get is() { return "gov-form-search"; }
18
18
  static get properties() {
@@ -40,7 +40,7 @@ export class GovFormSearch {
40
40
  },
41
41
  "getter": false,
42
42
  "setter": false,
43
- "reflect": false,
43
+ "reflect": true,
44
44
  "defaultValue": "\"m\""
45
45
  },
46
46
  "color": {
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-search.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/search/gov-form-search.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAC,eAAe,EAA2C,MAAM,aAAa,CAAA;AAKrF,MAAM,OAAO,aAAa;IAH1B;QAKC;;WAEG;QACc,SAAI,GAAyB,GAAG,CAAA;QACjD;;WAEG;QAC6B,UAAK,GAAwB,SAAS,CAAA;KAWtE;IATA,MAAM;QACL,OAAO,CACN,EAAC,IAAI,qDAAC,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI;YACpE,6DAAM,IAAI,EAAC,OAAO,GAAE;YACpB,6DAAM,IAAI,EAAC,cAAc,GAAE;YAC3B,6DAAM,IAAI,EAAC,QAAQ,GAAE,CACf,CACP,CAAA;IACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, h, Host, Prop} from '@stencil/core'\nimport {FormSearchClass, FormSearchSizesType, FormSearchColorType} from './constants'\n\n@Component({\n\ttag: 'gov-form-search',\n})\nexport class GovFormSearch {\n\t@Element() host: HTMLGovFormSearchElement\n\t/**\n\t * Search’s size.\n\t */\n\t@Prop() readonly size?: FormSearchSizesType = \"m\"\n\t/**\n\t * Style variation of the form input.\n\t */\n\t@Prop({reflect: true}) readonly color: FormSearchColorType = 'neutral'\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSearchClass.root} color={this.color} size={this.size}>\n\t\t\t\t<slot name=\"input\"/>\n\t\t\t\t<slot name=\"button-erase\"/>\n\t\t\t\t<slot name=\"button\"/>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-form-search.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/search/gov-form-search.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,eAAe,CAAA;AAC/D,OAAO,EAAC,eAAe,EAA2C,MAAM,aAAa,CAAA;AAKrF,MAAM,OAAO,aAAa;IAH1B;QAKC;;WAEG;QAC6B,SAAI,GAAyB,GAAG,CAAA;QAChE;;WAEG;QAC6B,UAAK,GAAwB,SAAS,CAAA;KAWtE;IATA,MAAM;QACL,OAAO,CACN,EAAC,IAAI,qDAAC,KAAK,EAAE,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI;YACpE,6DAAM,IAAI,EAAC,OAAO,GAAE;YACpB,6DAAM,IAAI,EAAC,cAAc,GAAE;YAC3B,6DAAM,IAAI,EAAC,QAAQ,GAAE,CACf,CACP,CAAA;IACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, h, Host, Prop} from '@stencil/core'\nimport {FormSearchClass, FormSearchSizesType, FormSearchColorType} from './constants'\n\n@Component({\n\ttag: 'gov-form-search',\n})\nexport class GovFormSearch {\n\t@Element() host: HTMLGovFormSearchElement\n\t/**\n\t * Search’s size.\n\t */\n\t@Prop({reflect: true}) readonly size?: FormSearchSizesType = \"m\"\n\t/**\n\t * Style variation of the form input.\n\t */\n\t@Prop({reflect: true}) readonly color: FormSearchColorType = 'neutral'\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSearchClass.root} color={this.color} size={this.size}>\n\t\t\t\t<slot name=\"input\"/>\n\t\t\t\t<slot name=\"button-erase\"/>\n\t\t\t\t<slot name=\"button\"/>\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
@@ -5,7 +5,6 @@ import { validateProp } from "../../../helpers/Validate/props";
5
5
  import { createID } from "../../../utils/string.utils";
6
6
  import { FormSelectClass, FormSelectSizes, } from "./constants";
7
7
  import { propsValueToArray } from "../../../utils/array.utils";
8
- import { tick } from "../../../utils/stencil.utils";
9
8
  import { AttributeObserver } from "../../../helpers/Dom/attribute";
10
9
  import { ariaAttributes } from "../../../helpers/Accessibility/attributes";
11
10
  import { inheritAriaAttributes } from "../../../helpers/Accessibility/accessibility";
@@ -41,7 +40,7 @@ export class GovFormSelect {
41
40
  this.passControlAttrs();
42
41
  }
43
42
  watchValue() {
44
- this.markSelectedValue();
43
+ this.syncSelectValue();
45
44
  }
46
45
  passControlAttrs() {
47
46
  this.f.passAttrToControl('size', this.size);
@@ -55,6 +54,7 @@ export class GovFormSelect {
55
54
  this.onAriaAttributeChange(attributeName, newValue);
56
55
  });
57
56
  this.attributeObserver.startObserving(ariaAttributes);
57
+ this.syncSelectValue();
58
58
  }
59
59
  disconnectedCallback() {
60
60
  var _a;
@@ -62,34 +62,27 @@ export class GovFormSelect {
62
62
  }
63
63
  componentWillLoad() {
64
64
  this.validateSize(this.size);
65
- this.markSelectedValue();
66
65
  this.optionsState = propsValueToArray(this.options);
67
66
  this.inheritedAttributes = inheritAriaAttributes(this.host);
68
67
  }
69
68
  async componentDidRender() {
70
69
  this.passControlAttrs();
71
70
  this.f.passAttrToLabel('required', String(this.required));
72
- tick(() => this.markSelectedValue());
73
71
  }
74
72
  onAriaAttributeChange(attributeName, newValue) {
75
73
  this.host.removeAttribute(attributeName);
76
74
  this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attributeName]: newValue });
77
75
  }
78
- markSelectedValue() {
79
- this.host.querySelectorAll('option').forEach((option) => {
80
- if (option.value === this.value) {
81
- option.setAttribute('selected', 'selected');
82
- }
83
- else {
84
- option.removeAttribute('selected');
85
- }
86
- });
76
+ syncSelectValue() {
77
+ if (this.selectRef && this.value !== undefined && this.selectRef.value !== this.value) {
78
+ this.selectRef.value = this.value;
79
+ }
87
80
  }
88
81
  render() {
89
- return (h(Host, { key: '92b4679d9a9fb77628934ed90e00b1eafc593a3e', class: FormSelectClass.root, size: this.size }, this.h.hasSlot('prefix') && h("slot", { key: 'b51835a8b6254898a064a41c75f95cc746d46d57', name: "prefix" }), h("span", { key: '2324839a4c3821a46fcdace4755961a96216dadc', class: "element" }, h("select", Object.assign({ key: 'df1fe5989b6d427c0f48d673f951a4b1f5f8b728', id: this.identifier || this.selectId, onFocus: this.onFocusHandler.bind(this), onChange: this.onChangeHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, name: this.name, disabled: this.disabled, ref: el => (this.selectRef = el) }, this.inheritedAttributes, { "aria-disabled": toBoolAttrIfDefined(this.disabled), "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid) }), h("slot", { key: 'bc12463c981b174aa49a791f360d6001230c3fc4' }), Array.isArray(this.optionsState) && this.optionsState.map((option) => {
82
+ return (h(Host, { key: 'd29638f5868731a2324971d197dcd636364a4f6c', class: FormSelectClass.root, size: this.size }, this.h.hasSlot('prefix') && h("slot", { key: '41cc14ee33022a4cf6d10c3d86c8915551221e94', name: "prefix" }), h("span", { key: 'f9c167589fa81f0a060a13d9a31d16ab642d5ad2', class: "element" }, h("select", Object.assign({ key: '2dd5c948ccc7b65674e7d7f730cb2c9567287668', id: this.identifier || this.selectId, onFocus: this.onFocusHandler.bind(this), onChange: this.onChangeHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, name: this.name, disabled: this.disabled, ref: el => (this.selectRef = el) }, this.inheritedAttributes, { "aria-disabled": toBoolAttrIfDefined(this.disabled), "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid) }), h("slot", { key: 'f6f0b21c9e43e1216446bce09c57a757a40d7b7b' }), Array.isArray(this.optionsState) && this.optionsState.map((option) => {
90
83
  var _a;
91
84
  return (h("option", { value: option.value, selected: option.value === this.value, disabled: option === null || option === void 0 ? void 0 : option.disabled }, (_a = option.label) !== null && _a !== void 0 ? _a : option.value));
92
- })), this.success && h("gov-icon", { key: 'def96c72b9bd804797472954d591e16d25860036', class: "validation-icon", name: "check-lg", type: "components" }), this.invalid && h("gov-icon", { key: 'e20c8d4bac094529ff51d8412ae2105401edcf98', class: "validation-icon", name: "exclamation-lg", type: "components" }), h("gov-icon", { key: 'e004aae985d9de1202fb50c06f5baa4d12c19fd2', class: "arrow-icon", name: "chevron-down", type: "components" })), this.h.hasSlot('sufix') && h("slot", { key: '72b7791037616836108a7420d13b21bf44fdeb85', name: "sufix" })));
85
+ })), this.success && h("gov-icon", { key: 'd94a0191bc7d02d55450dfad627457101226ad22', class: "validation-icon", name: "check-lg", type: "components" }), this.invalid && h("gov-icon", { key: '84ecf7197313c8a145efa54730d22068679df3f5', class: "validation-icon", name: "exclamation-lg", type: "components" }), h("gov-icon", { key: '1a219d4d230466ac15e316eee16d4a55db1889fe', class: "arrow-icon", name: "chevron-down", type: "components" })), this.h.hasSlot('sufix') && h("slot", { key: 'c7f4816548e3494de94f7ff0dd33f6c904acc14b', name: "sufix" })));
93
86
  }
94
87
  onFocusHandler(e) {
95
88
  this.focused = true;
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-select.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/select/gov-form-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,eAAe,CAAA;AAC1G,OAAO,EAAC,OAAO,EAAC,MAAM,2BAA2B,CAAA;AAEjD,OAAO,EAAC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAC,MAAM,+BAA+B,CAAA;AAEtF,OAAO,EAAC,YAAY,EAAC,MAAM,iCAAiC,CAAA;AAC5D,OAAO,EAAC,QAAQ,EAAC,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAC,eAAe,EAAE,eAAe,GAAuB,MAAM,aAAa,CAAA;AAElF,OAAO,EAAC,iBAAiB,EAAC,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAC,IAAI,EAAC,MAAM,8BAA8B,CAAC;AAClD,OAAO,EAAC,iBAAiB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AC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACjB,SAAS,EAAE,eAAe,CAAC,IAAI;YAC/B,aAAa,EAAE,CAAC;YAChB,KAAK,EAAE,IAAI,CAAC,KAAK;SACjB,CAAC,CAAA;IACH,CAAC;IAEO,eAAe,CAAC,CAAQ;QAC/B,IAAI,CAAC,KAAK,GAAI,CAAC,CAAC,MAA4B,CAAC,KAAK,CAAA;QAClD,CAAC,CAAC,eAAe,EAAE,CAAA;QACnB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;YACnB,SAAS,EAAE,eAAe,CAAC,IAAI;YAC/B,aAAa,EAAE,CAAC;YAChB,KAAK,EAAE,IAAI,CAAC,KAAK;SACjB,CAAC,CAAA;IACH,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,QAAQ,CAAC,OAAsB;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,MAAM;QACX,OAAO,IAAI,CAAC,SAAS,CAAA;IACtB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["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 {validateProp} from '../../../helpers/Validate/props'\nimport {createID} from '../../../utils/string.utils'\nimport {FormSelectClass, FormSelectSizes, FormSelectSizesType,} from './constants'\nimport {FormSelectEvent, FormSelectOption} from './gov-form-select.types'\nimport {propsValueToArray} from \"../../../utils/array.utils\";\nimport {tick} from \"../../../utils/stencil.utils\";\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\n\n@Component({\n\ttag: 'gov-form-select',\n})\nexport class GovFormSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\tprivate selectRef?: HTMLSelectElement\n\tprivate attributeObserver: AttributeObserver\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 * 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({reflect: true}) 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({reflect: true}) 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 * 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('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('success')\n\t@Watch('size')\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@Watch('value')\n\twatchValue(): void {\n\t\tthis.markSelectedValue()\n\t}\n\n\t@State() inheritedAttributes: Attributes = {}\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('success', toBoolAttr(this.success))\n\t\tthis.f.passAttrToControl('disabled', toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl('type', 'select')\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver?.stopObserving();\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateSize(this.size)\n\n\t\tthis.markSelectedValue()\n\n\t\tthis.optionsState = propsValueToArray(this.options)\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t\ttick(() => this.markSelectedValue())\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\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}>\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<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\t{...this.inheritedAttributes}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\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>\n\t\t\t\t\t\t<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\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\t{this.success && <gov-icon class=\"validation-icon\" name=\"check-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t{this.invalid && <gov-icon class=\"validation-icon\" name=\"exclamation-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t<gov-icon class=\"arrow-icon\" name=\"chevron-down\" type=\"components\"></gov-icon>\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"]}
1
+ {"version":3,"file":"gov-form-select.js","sourceRoot":"","sources":["../../../../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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["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 {validateProp} from '../../../helpers/Validate/props'\nimport {createID} from '../../../utils/string.utils'\nimport {FormSelectClass, FormSelectSizes, FormSelectSizesType,} from './constants'\nimport {FormSelectEvent, FormSelectOption} from './gov-form-select.types'\nimport {propsValueToArray} from \"../../../utils/array.utils\";\nimport {AttributeObserver, Attributes} from \"../../../helpers/Dom/attribute\";\nimport {ariaAttributes} from \"../../../helpers/Accessibility/attributes\";\nimport {inheritAriaAttributes} from \"../../../helpers/Accessibility/accessibility\";\n\n@Component({\n\ttag: 'gov-form-select',\n})\nexport class GovFormSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\tprivate selectRef?: HTMLSelectElement\n\tprivate attributeObserver: AttributeObserver\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 * 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({reflect: true}) 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({reflect: true}) 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 * 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('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('success')\n\t@Watch('size')\n\twatchControlAttrs(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\t@Watch('value')\n\twatchValue(): void {\n\t\tthis.syncSelectValue()\n\t}\n\n\t@State() inheritedAttributes: Attributes = {}\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('success', toBoolAttr(this.success))\n\t\tthis.f.passAttrToControl('disabled', toBoolAttr(this.disabled))\n\t\tthis.f.passAttrToControl('type', 'select')\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.attributeObserver = new AttributeObserver(this.host, (attributeName, newValue) => {\n\t\t\tthis.onAriaAttributeChange(attributeName, newValue);\n\t\t});\n\n\t\tthis.attributeObserver.startObserving(ariaAttributes);\n\n\t\tthis.syncSelectValue()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.attributeObserver?.stopObserving();\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateSize(this.size)\n\t\tthis.optionsState = propsValueToArray(this.options)\n\t\tthis.inheritedAttributes = inheritAriaAttributes(this.host);\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t}\n\n\tonAriaAttributeChange(attributeName: string, newValue: string) {\n\t\tthis.host.removeAttribute(attributeName)\n\t\tthis.inheritedAttributes = {...this.inheritedAttributes, [attributeName]: newValue};\n\t}\n\n\tprivate syncSelectValue() {\n\t\tif (this.selectRef && this.value !== undefined && this.selectRef.value !== this.value) {\n\t\t\tthis.selectRef.value = this.value\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSelectClass.root} size={this.size}>\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<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\t{...this.inheritedAttributes}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\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>\n\t\t\t\t\t\t<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\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\t{this.success && <gov-icon class=\"validation-icon\" name=\"check-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t{this.invalid && <gov-icon class=\"validation-icon\" name=\"exclamation-lg\" type=\"components\"></gov-icon>}\n\t\t\t\t\t<gov-icon class=\"arrow-icon\" name=\"chevron-down\" type=\"components\"></gov-icon>\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"]}
@@ -44,7 +44,9 @@ export class GovTooltipContent {
44
44
  }
45
45
  }
46
46
  render() {
47
- return (h(Host, { key: '71d259cc8d7247030767f8ac36a6875f9c16ffea', class: TooltipContentClass.root, role: "tooltip", hidden: !this.isVisible, "aria-hidden": !toBoolAttr(this.isVisible), "is-visible": this.isVisible }, h("slot", { key: '06d883340271717da9d0b8de6c35339cd5c9dfb9' }), this.persist ? (h("gov-button", { "on-gov-click": this.hideContent.bind(this), color: this.color, size: this.size, type: "base" }, h("gov-icon", { slot: "icon-start", name: "x-lg", type: "components" }))) : null));
47
+ return (h(Host, { key: '121b5cd3878956618a7a917511e6d8d76edf6672', class: TooltipContentClass.root, role: "tooltip", hidden: !this.isVisible, "aria-hidden": !toBoolAttr(this.isVisible), "is-visible": this.isVisible }, this.message
48
+ ? h("span", { class: "gov-tooltip-content__message", innerHTML: this.message })
49
+ : h("slot", null), this.persist ? (h("gov-button", { "on-gov-click": this.hideContent.bind(this), color: this.color, size: this.size, type: "base" }, h("gov-icon", { slot: "icon-start", name: "x-lg", type: "components" }))) : null));
48
50
  }
49
51
  static get is() { return "gov-tooltip-content"; }
50
52
  static get properties() {
@@ -160,6 +162,25 @@ export class GovTooltipContent {
160
162
  "setter": false,
161
163
  "reflect": false,
162
164
  "defaultValue": "null"
165
+ },
166
+ "message": {
167
+ "type": "string",
168
+ "attribute": "message",
169
+ "mutable": true,
170
+ "complexType": {
171
+ "original": "string",
172
+ "resolved": "string",
173
+ "references": {}
174
+ },
175
+ "required": false,
176
+ "optional": true,
177
+ "docs": {
178
+ "tags": [],
179
+ "text": "Tooltip text. When set, renders the HTML message; otherwise the default `<slot/>` is used."
180
+ },
181
+ "getter": false,
182
+ "setter": false,
183
+ "reflect": false
163
184
  }
164
185
  };
165
186
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gov-tooltip-content.js","sourceRoot":"","sources":["../../../../../../src/components/gov-tooltip/gov-tooltip-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACxE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAmB,aAAa,EAAoB,MAAM,aAAa,CAAA;AAChH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AAKvD,MAAM,OAAO,iBAAiB;IAH9B;QAOC;;WAEG;QACc,UAAK,GAAsB,aAAa,CAAC,OAAO,CAAA;QACjE;;WAEG;QACc,SAAI,GAAqB,WAAW,CAAC,EAAE,CAAA;QACxD;;WAEG;QACK,YAAO,GAAa,KAAK,CAAA;QACjC;;WAEG;QAC+C,cAAS,GAAG,KAAK,CAAA;QACnE;;WAEG;QAC+B,aAAQ,GAAW,IAAI,CAAA;KA4CzD;IAzCA,cAAc,CAAC,QAAiB;QAC/B,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC1B,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;YACxB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAA;YACtC,CAAC,EAAE,GAAG,CAAC,CAAA;QACR,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,SAAS,CAAA;QACvC,CAAC;IACF,CAAC;IAED,WAAW;QACV,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;QACtB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,MAAM,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAA0B,CAAA;QAChF,IAAI,QAAQ,EAAE,CAAC;YACd,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAA;QACxB,CAAC;IACF,CAAC;IAED,MAAM;QACL,OAAO,CACN,EAAC,IAAI,qDACJ,KAAK,EAAE,mBAAmB,CAAC,IAAI,EAC/B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,iBACV,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,gBAC5B,IAAI,CAAC,SAAS;YAC1B,8DAAa;YACZ,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACf,kCACe,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EACzC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,MAAM;gBACZ,gBAAU,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAa,CAC/D,CACb,CAAC,CAAC,CAAC,IAAI,CACF,CACP,CAAA;IACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, h, Host, Prop, Watch } from \"@stencil/core\"\nimport { TooltipContentClass, TooltipSize, TooltipSizeType, TooltipColors, TooltipColorType } from \"./constants\"\nimport { toBoolAttr } from \"../../helpers/Dom/template\"\n\n@Component({\n\ttag: \"gov-tooltip-content\",\n})\nexport class GovTooltipContent {\n\tprivate timeout\n\n\t@Element() host: HTMLGovTooltipContentElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly color?: TooltipColorType = TooltipColors.PRIMARY\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = TooltipSize._M\n\t/**\n\t * Tooltip is still visible.\n\t */\n\t@Prop() persist?: boolean = false\n\t/**\n\t * Indicates display of tooltip content\n\t */\n\t@Prop({ attribute: \"is-visible\", mutable: true }) isVisible = false\n\t/**\n\t * Indicates display of tooltip content\n\t */\n\t@Prop({ attribute: \"parent-id\" }) parentId: string = null\n\n\t@Watch(\"isVisible\")\n\tvisibleContent(newValue: boolean): void {\n\t\tclearTimeout(this.timeout)\n\t\tif (newValue === false) {\n\t\t\tthis.timeout = setTimeout(() => {\n\t\t\t\tthis.host.style.visibility = \"hidden\"\n\t\t\t}, 250)\n\t\t} else {\n\t\t\tthis.host.style.visibility = \"visible\"\n\t\t}\n\t}\n\n\thideContent() {\n\t\tthis.isVisible = false\n\t\tthis.persist = false\n\t\tconst parentEl = document.getElementById(this.parentId) as HTMLGovTooltipElement\n\t\tif (parentEl) {\n\t\t\tparentEl.hide().catch()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={TooltipContentClass.root}\n\t\t\t\trole={\"tooltip\"}\n\t\t\t\thidden={!this.isVisible}\n\t\t\t\taria-hidden={!toBoolAttr(this.isVisible)}\n\t\t\t\tis-visible={this.isVisible}>\n\t\t\t\t<slot></slot>\n\t\t\t\t{this.persist ? (\n\t\t\t\t\t<gov-button\n\t\t\t\t\t\ton-gov-click={this.hideContent.bind(this)}\n\t\t\t\t\t\tcolor={this.color}\n\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\ttype={\"base\"}>\n\t\t\t\t\t\t<gov-icon slot={\"icon-start\"} name={\"x-lg\"} type={\"components\"}></gov-icon>\n\t\t\t\t\t</gov-button>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-tooltip-content.js","sourceRoot":"","sources":["../../../../../../src/components/gov-tooltip/gov-tooltip-content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,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/B,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,iBACV,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,gBAC5B,IAAI,CAAC,SAAS;YACzB,IAAI,CAAC,OAAO;gBACZ,CAAC,CAAC,YAAM,KAAK,EAAC,8BAA8B,EAAC,SAAS,EAAE,IAAI,CAAC,OAAO,GAAS;gBAC7E,CAAC,CAAC,eAAa;YACf,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACf,kCACe,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EACzC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,MAAM;gBACZ,gBAAU,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAa,CAC/D,CACb,CAAC,CAAC,CAAC,IAAI,CACF,CACP,CAAA;IACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, h, Host, Prop, Watch } from \"@stencil/core\"\nimport { TooltipContentClass, TooltipSize, TooltipSizeType, TooltipColors, TooltipColorType } from \"./constants\"\nimport { toBoolAttr } from \"../../helpers/Dom/template\"\n\n@Component({\n\ttag: \"gov-tooltip-content\",\n})\nexport class GovTooltipContent {\n\tprivate timeout\n\n\t@Element() host: HTMLGovTooltipContentElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly color?: TooltipColorType = TooltipColors.PRIMARY\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = TooltipSize._M\n\t/**\n\t * Tooltip is still visible.\n\t */\n\t@Prop() persist?: boolean = false\n\t/**\n\t * Indicates display of tooltip content\n\t */\n\t@Prop({ attribute: \"is-visible\", mutable: true }) isVisible = false\n\t/**\n\t * Indicates display of tooltip content\n\t */\n\t@Prop({ attribute: \"parent-id\" }) parentId: string = null\n\t/**\n\t * Tooltip text. When set, renders the HTML message; otherwise the default `<slot/>` is used.\n\t */\n\t@Prop({ attribute: \"message\", mutable: true }) message?: string\n\n\t@Watch(\"isVisible\")\n\tvisibleContent(newValue: boolean): void {\n\t\tclearTimeout(this.timeout)\n\t\tif (newValue === false) {\n\t\t\tthis.timeout = setTimeout(() => {\n\t\t\t\tthis.host.style.visibility = \"hidden\"\n\t\t\t}, 250)\n\t\t} else {\n\t\t\tthis.host.style.visibility = \"visible\"\n\t\t}\n\t}\n\n\thideContent() {\n\t\tthis.isVisible = false\n\t\tthis.persist = false\n\t\tconst parentEl = document.getElementById(this.parentId) as HTMLGovTooltipElement\n\t\tif (parentEl) {\n\t\t\tparentEl.hide().catch()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={TooltipContentClass.root}\n\t\t\t\trole={\"tooltip\"}\n\t\t\t\thidden={!this.isVisible}\n\t\t\t\taria-hidden={!toBoolAttr(this.isVisible)}\n\t\t\t\tis-visible={this.isVisible}>\n\t\t\t\t{this.message\n\t\t\t\t\t? <span class=\"gov-tooltip-content__message\" innerHTML={this.message}></span>\n\t\t\t\t\t: <slot></slot>}\n\t\t\t\t{this.persist ? (\n\t\t\t\t\t<gov-button\n\t\t\t\t\t\ton-gov-click={this.hideContent.bind(this)}\n\t\t\t\t\t\tcolor={this.color}\n\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\ttype={\"base\"}>\n\t\t\t\t\t\t<gov-icon slot={\"icon-start\"} name={\"x-lg\"} type={\"components\"}></gov-icon>\n\t\t\t\t\t</gov-button>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
@@ -30,6 +30,12 @@ export class GovTooltip {
30
30
  */
31
31
  this.icon = undefined;
32
32
  this.persist = false;
33
+ this.repositionListenersAttached = false;
34
+ this.reposition = () => {
35
+ if (this.tooltipContent) {
36
+ this.verifyPositionSpace();
37
+ }
38
+ };
33
39
  this.h = govHost(this.host);
34
40
  this.tooltipId = createID("GovTooltip");
35
41
  this.tooltipContentId = createID("GovContentTooltip");
@@ -59,16 +65,18 @@ export class GovTooltip {
59
65
  this.createContentWrapper();
60
66
  }
61
67
  disconnectedCallback() {
68
+ var _a;
69
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
70
+ this.resizeObserver = undefined;
71
+ window.removeEventListener("resize", this.reposition);
72
+ this.repositionListenersAttached = false;
62
73
  this.removeContent();
63
74
  }
64
75
  createContentWrapper() {
65
76
  var _a;
66
77
  if (this.tooltipContent) {
67
- if (this.message) {
68
- this.tooltipContent.innerHTML = this.message;
69
- }
70
- else if (this.insideContent) {
71
- this.tooltipContent.innerHTML = this.insideContent.innerHTML;
78
+ if (this.message != null) {
79
+ this.tooltipContent.setAttribute("message", this.message);
72
80
  }
73
81
  return;
74
82
  }
@@ -78,7 +86,9 @@ export class GovTooltip {
78
86
  }
79
87
  else {
80
88
  content = documentNode().createElement(TooltipContentClass.root);
81
- content.innerHTML = this.message;
89
+ if (this.message != null) {
90
+ content.setAttribute("message", this.message);
91
+ }
82
92
  }
83
93
  content.setAttribute("id", (_a = this.identifier) !== null && _a !== void 0 ? _a : this.tooltipContentId);
84
94
  content.setAttribute("parent-id", this.tooltipId);
@@ -193,14 +203,27 @@ export class GovTooltip {
193
203
  tick(() => {
194
204
  this.verifyPositionSpace();
195
205
  });
206
+ if (!this.repositionListenersAttached) {
207
+ this.repositionListenersAttached = true;
208
+ if (typeof ResizeObserver !== "undefined") {
209
+ this.resizeObserver = new ResizeObserver(this.reposition);
210
+ this.resizeObserver.observe(this.tooltipContent);
211
+ }
212
+ window.addEventListener("resize", this.reposition);
213
+ }
196
214
  }
197
215
  }
198
216
  hideTooltip() {
217
+ var _a;
199
218
  if (this.tooltipContent) {
200
219
  this.tooltipContent.setAttribute("is-visible", "false");
201
220
  this.tooltipContent.setAttribute("persist", "false");
202
221
  this.tooltipContent.removeAttribute('style');
203
222
  }
223
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
224
+ this.resizeObserver = undefined;
225
+ window.removeEventListener("resize", this.reposition);
226
+ this.repositionListenersAttached = false;
204
227
  }
205
228
  removeContent() {
206
229
  const contentEl = document.getElementById(this.tooltipContentId);
@@ -210,11 +233,11 @@ export class GovTooltip {
210
233
  }
211
234
  render() {
212
235
  var _a;
213
- return (h(Host, { key: 'dd78d93d3b5ba4bc3a128435f58467c9bd6def43', id: this.tooltipId, class: this.h.classes(TooltipClass.root), position: this.position }, h("span", { key: '2ede8642a4cf998367da3756c795847195c0f694', role: 'button', tabindex: 0, onKeyPress: () => this.showTooltip(), onBlur: () => {
236
+ return (h(Host, { key: '20ebe5eea59967e8681fd0e35fc7aff53b5915dd', id: this.tooltipId, class: this.h.classes(TooltipClass.root), position: this.position }, h("span", { key: '847b78886907d683425013227eb78bbf9261b709', role: 'button', tabindex: 0, onKeyPress: () => this.showTooltip(), onBlur: () => {
214
237
  if (this.persist === false) {
215
238
  this.hideTooltip();
216
239
  }
217
- }, "aria-describedby": (_a = this.identifier) !== null && _a !== void 0 ? _a : this.tooltipContentId }, h("slot", { key: '9607b4c9b24766f70b53c6372e6e7219e7a3a6fd' }))));
240
+ }, "aria-describedby": (_a = this.identifier) !== null && _a !== void 0 ? _a : this.tooltipContentId }, h("slot", { key: '84c4c02ee11e05166fca208b82ef54298dcaa6ee' }))));
218
241
  }
219
242
  /**
220
243
  * Showing the modal
@@ -1 +1 @@
1
- {"version":3,"file":"gov-tooltip.js","sourceRoot":"","sources":["../../../../../../src/components/gov-tooltip/gov-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipColors,\n\tTooltipColorType,\n} from \"./constants\"\nimport {createID} from \"../../utils/string.utils\"\nimport {govHost} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {documentNode} from \"../../helpers/Dom/win\";\nimport {Nullable} from \"../../utils/helpers.types\";\nimport {tick} from \"../../utils/stencil.utils\";\n\n@Component({\n\ttag: \"gov-tooltip\",\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate readonly tooltipContentId = undefined\n\tprivate readonly tooltipId = undefined\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID(\"GovTooltip\")\n\t\tthis.tooltipContentId = createID(\"GovContentTooltip\")\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly color?: TooltipColorType = TooltipColors.PRIMARY\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = TooltipSize._M\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop({mutable: true}) position: TooltipPositionType = \"right\"\n\t/**\n\t * Information contained in the tooltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({reflect: true}) readonly icon: boolean = undefined\n\n\t@State() persist = false\n\n\t@Watch(\"color\")\n\tvalidateColor(newValue: string): void {\n\t\tvalidateProp(TooltipColors, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"position\")\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"message\")\n\trerenderMessage(): void {\n\t\tthis.createContentWrapper();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateColor(this.color)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\t}\n\n\tcomponentDidUpdate() {\n\t\tthis.createContentWrapper()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.removeContent()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tif (this.tooltipContent) {\n\t\t\tif (this.message) {\n\t\t\t\tthis.tooltipContent.innerHTML = this.message\n\t\t\t} else if (this.insideContent) {\n\t\t\t\tthis.tooltipContent.innerHTML = this.insideContent.innerHTML\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet content: HTMLGovTooltipContentElement;\n\t\tif (this.insideContent) {\n\t\t\tcontent = this.insideContent\n\t\t} else {\n\t\t\tcontent = documentNode().createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tcontent.innerHTML = this.message\n\t\t}\n\n\t\tcontent.setAttribute(\"id\", this.identifier ?? this.tooltipContentId)\n\t\tcontent.setAttribute(\"parent-id\", this.tooltipId)\n\t\tcontent.setAttribute(\"color\", this.color)\n\t\tcontent.setAttribute(\"size\", this.size)\n\t\tdocumentNode().body.appendChild(content)\n\t}\n\n\tprivate get tooltipContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn documentNode().body.querySelector(`#${this.identifier ?? this.tooltipContentId}`);\n\t}\n\n\tprivate get insideContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn this.host.querySelector(TooltipContentClass.root)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener(\"click\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.persist = true\n\t\t\tif (this.tooltipContent) {\n\t\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"true\")\n\t\t\t}\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseenter\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseleave\", e => {\n\t\t\te.preventDefault()\n\t\t\tif (this.persist === false) {\n\t\t\t\tthis.hideTooltip()\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate verifyPositionSpace() {\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth - (window.innerWidth - document.documentElement.clientWidth);\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst trgHeight = this.host.offsetHeight\n\t\tconst contentWidth = this.tooltipContent.offsetWidth\n\t\tconst contentHeight = this.tooltipContent.offsetHeight\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\n\t\tconst isRightSpace = ((triggerPos.left + offset + trigger.width) + contentWidth) <= windowWidth;\n\t\tconst isLeftSpace = triggerPos.left > contentWidth;\n\n\t\t// LEFT/RIGHT\n\t\tif (this.position === TooltipPosition.LEFT || this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - ((contentHeight - trgHeight) / 2)) + \"px\";\n\t\t\tif (isRightSpace === false && isLeftSpace === false) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\t}\n\t\t\tif (isLeftSpace && isRightSpace === false && this.position === TooltipPosition.RIGHT) {\n\t\t\t\tthis.position = TooltipPosition.LEFT\n\t\t\t}\n\t\t\tif (isRightSpace && isLeftSpace === false && this.position === TooltipPosition.LEFT) {\n\t\t\t\tthis.position = TooltipPosition.RIGHT\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.RIGHT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left + offset + trigger.width) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.LEFT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left - (contentWidth + offset)) + \"px\"\n\t\t}\n\n\t\t// LEFT/RIGHT FOR TOP/BOTTOM\n\t\tif (this.position === TooltipPosition.TOP || this.position === TooltipPosition.BOTTOM) {\n\t\t\tif (contentWidth > trgWidth) {\n\t\t\t\tlet leftPosition = (triggerPos.left - ((contentWidth - trgWidth) / 2));\n\t\t\t\tconst isNotLeftSpace = leftPosition < 0;\n\t\t\t\tconst isNotRightSpace = (leftPosition + contentWidth) > windowWidth;\n\t\t\t\tif (isNotLeftSpace && isNotRightSpace) {\n\t\t\t\t\tthis.tooltipContent.style.width = \"auto\";\n\t\t\t\t\tthis.tooltipContent.style.left = offset + \"px\";\n\t\t\t\t\tthis.tooltipContent.style.right = offset + \"px\";\n\t\t\t\t} else {\n\t\t\t\t\tif (isNotLeftSpace) {\n\t\t\t\t\t\tleftPosition = offset\n\t\t\t\t\t}\n\t\t\t\t\tif (isNotRightSpace) {\n\t\t\t\t\t\tleftPosition = leftPosition - ((windowWidth - (leftPosition + contentWidth + offset)) * -1)\n\t\t\t\t\t}\n\t\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst leftPosition = (triggerPos.left + ((trgWidth - contentWidth) / 2))\n\n\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.TOP) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - (contentHeight + offset)) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.BOTTOM) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.BOTTOM)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top + (trgHeight + offset)) + \"px\"\n\t\t}\n\n\t\tthis.tooltipContent.style.opacity = '1'\n\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.style.opacity = '0'\n\t\t\tthis.tooltipContent.hidden = false\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"true\")\n\t\t\ttick(() => {\n\t\t\t\tthis.verifyPositionSpace()\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"false\")\n\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"false\")\n\t\t\tthis.tooltipContent.removeAttribute('style')\n\t\t}\n\t}\n\n\tprivate removeContent() {\n\t\tconst contentEl = document.getElementById(this.tooltipContentId)\n\t\tif (contentEl) {\n\t\t\tcontentEl.remove()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tid={this.tooltipId}\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}>\n\t\t\t\t<span role={'button'}\n\t\t\t\t\t\t\ttabindex={0}\n\t\t\t\t\t\t\tonKeyPress={() => this.showTooltip()}\n\t\t\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\t\t\tif (this.persist === false) {\n\t\t\t\t\t\t\t\t\tthis.hideTooltip()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\taria-describedby={this.identifier ?? this.tooltipContentId}><slot/></span>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showTooltip()\n\t}\n\n\t/**\n\t * Hiding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.persist = false\n\t\tthis.hideTooltip()\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-tooltip.js","sourceRoot":"","sources":["../../../../../../src/components/gov-tooltip/gov-tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,eAAe,CAAA;AACrF,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAA;AACzD,OAAO,EACN,YAAY,EACZ,mBAAmB,EACnB,eAAe,EAEf,WAAW,EAEX,aAAa,GAEb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,4BAA4B,CAAA;AAElD,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAC,IAAI,EAAC,MAAM,2BAA2B,CAAC;AAK/C,MAAM,OAAO,UAAU;IAKtB;QAHiB,qBAAgB,GAAG,SAAS,CAAA;QAC5B,cAAS,GAAG,SAAS,CAAA;QAStC;;WAEG;QACc,UAAK,GAAsB,aAAa,CAAC,OAAO,CAAA;QACjE;;WAEG;QACc,SAAI,GAAqB,WAAW,CAAC,EAAE,CAAA;QACxD;;WAEG;QACoB,aAAQ,GAAwB,OAAO,CAAA;QAC9D;;WAEG;QACc,YAAO,GAAW,SAAS,CAAA;QAK5C;;WAEG;QAC6B,SA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E,CACP,CAAA;IACF,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,IAAI;QACT,IAAI,CAAC,WAAW,EAAE,CAAA;IACnB,CAAC;IAED;;OAEG;IAEH,KAAK,CAAC,IAAI;QACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,WAAW,EAAE,CAAA;IACnB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import {Component, Element, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipColors,\n\tTooltipColorType,\n} from \"./constants\"\nimport {createID} from \"../../utils/string.utils\"\nimport {govHost} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\nimport {documentNode} from \"../../helpers/Dom/win\";\nimport {Nullable} from \"../../utils/helpers.types\";\nimport {tick} from \"../../utils/stencil.utils\";\n\n@Component({\n\ttag: \"gov-tooltip\",\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate readonly tooltipContentId = undefined\n\tprivate readonly tooltipId = undefined\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID(\"GovTooltip\")\n\t\tthis.tooltipContentId = createID(\"GovContentTooltip\")\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly color?: TooltipColorType = TooltipColors.PRIMARY\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = TooltipSize._M\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop({mutable: true}) position: TooltipPositionType = \"right\"\n\t/**\n\t * Information contained in the tooltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({reflect: true}) readonly icon: boolean = undefined\n\n\t@State() persist = false\n\n\t@Watch(\"color\")\n\tvalidateColor(newValue: string): void {\n\t\tvalidateProp(TooltipColors, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"position\")\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"message\")\n\trerenderMessage(): void {\n\t\tthis.createContentWrapper();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateColor(this.color)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\t}\n\n\tcomponentDidUpdate() {\n\t\tthis.createContentWrapper()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.resizeObserver?.disconnect()\n\t\tthis.resizeObserver = undefined\n\t\twindow.removeEventListener(\"resize\", this.reposition)\n\t\tthis.repositionListenersAttached = false\n\t\tthis.removeContent()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tif (this.tooltipContent) {\n\t\t\tif (this.message != null) {\n\t\t\t\tthis.tooltipContent.setAttribute(\"message\", this.message)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tlet content: HTMLGovTooltipContentElement;\n\t\tif (this.insideContent) {\n\t\t\tcontent = this.insideContent\n\t\t} else {\n\t\t\tcontent = documentNode().createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tif (this.message != null) {\n\t\t\t\tcontent.setAttribute(\"message\", this.message)\n\t\t\t}\n\t\t}\n\n\t\tcontent.setAttribute(\"id\", this.identifier ?? this.tooltipContentId)\n\t\tcontent.setAttribute(\"parent-id\", this.tooltipId)\n\t\tcontent.setAttribute(\"color\", this.color)\n\t\tcontent.setAttribute(\"size\", this.size)\n\t\tdocumentNode().body.appendChild(content)\n\t}\n\n\tprivate get tooltipContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn documentNode().body.querySelector(`#${this.identifier ?? this.tooltipContentId}`);\n\t}\n\n\tprivate get insideContent(): Nullable<HTMLGovTooltipContentElement> {\n\t\treturn this.host.querySelector(TooltipContentClass.root)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener(\"click\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.persist = true\n\t\t\tif (this.tooltipContent) {\n\t\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"true\")\n\t\t\t}\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseenter\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseleave\", e => {\n\t\t\te.preventDefault()\n\t\t\tif (this.persist === false) {\n\t\t\t\tthis.hideTooltip()\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate verifyPositionSpace() {\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth - (window.innerWidth - document.documentElement.clientWidth);\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst trgHeight = this.host.offsetHeight\n\t\tconst contentWidth = this.tooltipContent.offsetWidth\n\t\tconst contentHeight = this.tooltipContent.offsetHeight\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\n\t\tconst isRightSpace = ((triggerPos.left + offset + trigger.width) + contentWidth) <= windowWidth;\n\t\tconst isLeftSpace = triggerPos.left > contentWidth;\n\n\t\t// LEFT/RIGHT\n\t\tif (this.position === TooltipPosition.LEFT || this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - ((contentHeight - trgHeight) / 2)) + \"px\";\n\t\t\tif (isRightSpace === false && isLeftSpace === false) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\t}\n\t\t\tif (isLeftSpace && isRightSpace === false && this.position === TooltipPosition.RIGHT) {\n\t\t\t\tthis.position = TooltipPosition.LEFT\n\t\t\t}\n\t\t\tif (isRightSpace && isLeftSpace === false && this.position === TooltipPosition.LEFT) {\n\t\t\t\tthis.position = TooltipPosition.RIGHT\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.RIGHT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left + offset + trigger.width) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.LEFT)\n\t\t\tthis.tooltipContent.style.left = (triggerPos.left - (contentWidth + offset)) + \"px\"\n\t\t}\n\n\t\t// LEFT/RIGHT FOR TOP/BOTTOM\n\t\tif (this.position === TooltipPosition.TOP || this.position === TooltipPosition.BOTTOM) {\n\t\t\tif (contentWidth > trgWidth) {\n\t\t\t\tlet leftPosition = (triggerPos.left - ((contentWidth - trgWidth) / 2));\n\t\t\t\tconst isNotLeftSpace = leftPosition < 0;\n\t\t\t\tconst isNotRightSpace = (leftPosition + contentWidth) > windowWidth;\n\t\t\t\tif (isNotLeftSpace && isNotRightSpace) {\n\t\t\t\t\tthis.tooltipContent.style.width = \"auto\";\n\t\t\t\t\tthis.tooltipContent.style.left = offset + \"px\";\n\t\t\t\t\tthis.tooltipContent.style.right = offset + \"px\";\n\t\t\t\t} else {\n\t\t\t\t\tif (isNotLeftSpace) {\n\t\t\t\t\t\tleftPosition = offset\n\t\t\t\t\t}\n\t\t\t\t\tif (isNotRightSpace) {\n\t\t\t\t\t\tleftPosition = leftPosition - ((windowWidth - (leftPosition + contentWidth + offset)) * -1)\n\t\t\t\t\t}\n\t\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst leftPosition = (triggerPos.left + ((trgWidth - contentWidth) / 2))\n\n\t\t\t\tthis.tooltipContent.style.left = leftPosition + \"px\"\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.TOP) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top - (contentHeight + offset)) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.BOTTOM) {\n\t\t\tthis.tooltipContent.setAttribute(\"position\", TooltipPosition.BOTTOM)\n\t\t\tthis.tooltipContent.style.top = (triggerPos.top + (trgHeight + offset)) + \"px\"\n\t\t}\n\n\t\tthis.tooltipContent.style.opacity = '1'\n\n\t}\n\n\tprivate resizeObserver?: ResizeObserver\n\tprivate repositionListenersAttached = false\n\tprivate readonly reposition = () => {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.verifyPositionSpace()\n\t\t}\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.style.opacity = '0'\n\t\t\tthis.tooltipContent.hidden = false\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"true\")\n\t\t\ttick(() => {\n\t\t\t\tthis.verifyPositionSpace()\n\t\t\t})\n\t\t\tif (!this.repositionListenersAttached) {\n\t\t\t\tthis.repositionListenersAttached = true\n\t\t\t\tif (typeof ResizeObserver !== \"undefined\") {\n\t\t\t\t\tthis.resizeObserver = new ResizeObserver(this.reposition)\n\t\t\t\t\tthis.resizeObserver.observe(this.tooltipContent)\n\t\t\t\t}\n\t\t\t\twindow.addEventListener(\"resize\", this.reposition)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.tooltipContent) {\n\t\t\tthis.tooltipContent.setAttribute(\"is-visible\", \"false\")\n\t\t\tthis.tooltipContent.setAttribute(\"persist\", \"false\")\n\t\t\tthis.tooltipContent.removeAttribute('style')\n\t\t}\n\t\tthis.resizeObserver?.disconnect()\n\t\tthis.resizeObserver = undefined\n\t\twindow.removeEventListener(\"resize\", this.reposition)\n\t\tthis.repositionListenersAttached = false\n\t}\n\n\tprivate removeContent() {\n\t\tconst contentEl = document.getElementById(this.tooltipContentId)\n\t\tif (contentEl) {\n\t\t\tcontentEl.remove()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tid={this.tooltipId}\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}>\n\t\t\t\t<span role={'button'}\n\t\t\t\t\t\t\ttabindex={0}\n\t\t\t\t\t\t\tonKeyPress={() => this.showTooltip()}\n\t\t\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\t\t\tif (this.persist === false) {\n\t\t\t\t\t\t\t\t\tthis.hideTooltip()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\taria-describedby={this.identifier ?? this.tooltipContentId}><slot/></span>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showTooltip()\n\t}\n\n\t/**\n\t * Hiding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.persist = false\n\t\tthis.hideTooltip()\n\t}\n}\n"]}
@@ -50,8 +50,8 @@ export class GovWizardItem {
50
50
  render() {
51
51
  const triggerId = this.identifier || this.triggerId;
52
52
  const Tag = this.collapsible ? Tags.BUTTON : Tags.DIV;
53
- const prefixSlot = this.h.hasSlot("prefix") && (h("span", { key: '10144e93de98bf60873fa6c244c4129b040b8bae', class: WizardItemClass.prefix }, h("slot", { key: 'a946028d94e0c159cf4c91fa1773467c8203a5f2', name: "prefix" })));
54
- return (h(Host, { key: 'f33ced4d5d8f57bec50cc8ebce6f12cf2145833d', class: this.h.classes(WizardItemClass.root), "is-expanded": this.isExpanded, color: this.color, size: this.size, role: "listitem", collapsible: this.collapsible, hydrated: this.hydrated }, h("div", { key: '872e3e164b4cca4955c2ba4cf0a2d88563f50fc5', class: WizardItemClass.header }, prefixSlot, this.collapsible ? (h(Tag, { id: triggerId, class: this.h.classes(WizardItemClass.label), "aria-expanded": booleanString(this.isExpanded), "aria-controls": this.contentId, disabled: this.disabled, "aria-disabled": toBoolAttrIfDefined(this.disabled), onClick: (e) => {
53
+ const prefixSlot = this.h.hasSlot("prefix") && (h("span", { key: '3f00516020337fc142713c6edb468d0007eba3c5', class: WizardItemClass.prefix }, h("slot", { key: '05aa42bc8241f53bb3664dc3d06798cb0344f92f', name: "prefix" })));
54
+ return (h(Host, { key: '863700f5087e86d1f8d4e22b40108dfbc0cb96f5', class: this.h.classes(WizardItemClass.root), "is-expanded": this.isExpanded, color: this.color, size: this.size, role: "listitem", collapsible: this.collapsible, hydrated: this.hydrated }, h("div", { key: '6d93a5bb12dbe2fc2e308059ffd5d63ed915f16d', class: WizardItemClass.header }, prefixSlot, this.collapsible ? (h(Tag, { id: triggerId, class: this.h.classes(WizardItemClass.label), "aria-expanded": booleanString(this.isExpanded), "aria-controls": this.contentId, disabled: this.disabled, "aria-disabled": toBoolAttrIfDefined(this.disabled), onClick: (e) => {
55
55
  e.preventDefault();
56
56
  e.stopPropagation();
57
57
  this.toggle();
@@ -41,7 +41,7 @@ export class GovWizard {
41
41
  this.hydrated = true;
42
42
  }
43
43
  render() {
44
- return (h(Host, { key: '5d1d08b27c5a8b266d209841d4cfda654081124c', class: this.h.classes(WizardClass.root), role: "list", size: this.size, hydrated: this.hydrated }, h("slot", { key: 'c17071c8a7bed0dee95deec69c0ce1c668160209' })));
44
+ return (h(Host, { key: 'd1957fc0c0058c107769e3cc5390ef986fc9b921', class: this.h.classes(WizardClass.root), role: "list", size: this.size, hydrated: this.hydrated }, h("slot", { key: 'a34323c408d790c5945ca0d80db62de2433db438' })));
45
45
  }
46
46
  /**
47
47
  * Validate the WCAG attributes of the component
@@ -1,2 +1,2 @@
1
- import{p as e,H as s,c as t,h as a,a as i}from"./index.js";import{v as c}from"./p-BKP-F1qP.js";import{b as o,a as n,A as d}from"./p-4i8qDRtu.js";import{g as f,c as r,b}from"./p-DKo9A5gq.js";import{i as m}from"./p-CXgom82_.js";import{t as h}from"./p-Cjg0wpDG.js";import{d as l}from"./p-BrdXh0mI.js";const p=e(class e extends s{constructor(){super();this.__registerHost();this.govChange=t(this,"gov-change");this.inheritedAttributes={};this.disabled=false;this.open=false;this.h=f(this.host)}validateSize(e){c(n,e,o.root)}componentWillLoad(){this.validateSize(this.size);this.inheritedAttributes=m(this.host)}componentDidRender(){h((()=>this.getPropsFromParents()))}getPropsFromParents(){const e=this.h.getParent(d.root);if(e){this.size=e.getAttribute("size")}}render(){return a(i,{key:"1beb62527ea9274e6280ce0b64c9d52c12e4a993",class:this.h.classes([o.root,this.disabled&&o.disabled]),size:this.size,role:"listitem"},a("details",{key:"53ca7688e8f26e85cd76feb073a26d04c5505d2b",class:o.details,id:this.identifier,"aria-disabled":r(this.disabled),open:this.open},a("summary",Object.assign({key:"19fec49b0066b7a6162a6010e0ee20431c2a578b",onClick:e=>{e.stopPropagation();e.preventDefault();!this.disabled&&this.toggle().finally()},class:o.summary,tabIndex:this.disabled?-1:0,"aria-expanded":b(this.open)},this.inheritedAttributes),this.h.hasSlot("icon")&&a("span",{key:"19254947c22fa2b1a2fa4e26eacb22c0c89b40c9",class:o.icon},a("slot",{key:"262be1640f250fabf9918f4162c071bb68dc4fb3",name:"icon"})),a("span",{key:"ebb5ef762ef51921b68a8063fd09c979d7d0d32d",class:o.title},a("slot",{key:"75783345d2276f06e53c401761cb4e57d241e5e0",name:"label"}),a("slot",{key:"f2d9cdff693edbcae6293921fde7996d1b1251b6",name:"annotation"})),a("span",{key:"f7e28ea54455756c7d146c7b88be7001e80b07a8",class:o.right},a("slot",{key:"e76b31bf1c349a8a86d4b91ec1cfa650a75edf60",name:"suffix"}),a("span",{key:"87ea99c9862deb3ff9820fa383cec52956b4655a",class:o.arrow},a("slot",{key:"c8b64a90455a731f359e12550664ba5aa905abbc",name:"toggle-icon"},a("gov-icon",{key:"867406c5634d6446683529f5f647492b9b289a31",name:"chevron-down",type:"components"}))))),a("div",{key:"2adf7441dd470ae1b32a08fb374cd1d9e2d1f789",class:o.content},a("slot",{key:"8eb27d0b33689933b6e71850324c35c89d71c4c0"}))))}async toggle(){this.open=!this.open;this.govChange.emit({open:this.open,component:o.root,ref:this.host})}async currentState(){return this.open}get host(){return this}static get watchers(){return{size:["validateSize"]}}},[4,"gov-accordion-item",{identifier:[1],size:[1025],disabled:[4],open:[1028],openState:[32],toggle:[64],currentState:[64]},undefined,{size:["validateSize"]}]);function g(){if(typeof customElements==="undefined"){return}const e=["gov-accordion-item","gov-icon"];e.forEach((e=>{switch(e){case"gov-accordion-item":if(!customElements.get(e)){customElements.define(e,p)}break;case"gov-icon":if(!customElements.get(e)){l()}break}}))}g();const y=p;const u=g;export{y as GovAccordionItem,u as defineCustomElement};
1
+ import{p as e,H as s,c as t,h as a,a as i}from"./index.js";import{v as c}from"./p-BKP-F1qP.js";import{b as o,a as n,A as d}from"./p-4i8qDRtu.js";import{g as f,b,c as r}from"./p-BHRF-5cf.js";import{i as m}from"./p-CXgom82_.js";import{t as h}from"./p-Cjg0wpDG.js";import{d as l}from"./p-CXPP9vec.js";const p=e(class e extends s{constructor(){super();this.__registerHost();this.govChange=t(this,"gov-change");this.inheritedAttributes={};this.disabled=false;this.open=false;this.h=f(this.host)}validateSize(e){c(n,e,o.root)}componentWillLoad(){this.validateSize(this.size);this.inheritedAttributes=m(this.host)}componentDidRender(){h((()=>this.getPropsFromParents()))}getPropsFromParents(){const e=this.h.getParent(d.root);if(e){this.size=e.getAttribute("size")}}render(){return a(i,{key:"1beb62527ea9274e6280ce0b64c9d52c12e4a993",class:this.h.classes([o.root,this.disabled&&o.disabled]),size:this.size,role:"listitem"},a("details",{key:"53ca7688e8f26e85cd76feb073a26d04c5505d2b",class:o.details,id:this.identifier,"aria-disabled":b(this.disabled),open:this.open},a("summary",Object.assign({key:"19fec49b0066b7a6162a6010e0ee20431c2a578b",onClick:e=>{e.stopPropagation();e.preventDefault();!this.disabled&&this.toggle().finally()},class:o.summary,tabIndex:this.disabled?-1:0,"aria-expanded":r(this.open)},this.inheritedAttributes),this.h.hasSlot("icon")&&a("span",{key:"19254947c22fa2b1a2fa4e26eacb22c0c89b40c9",class:o.icon},a("slot",{key:"262be1640f250fabf9918f4162c071bb68dc4fb3",name:"icon"})),a("span",{key:"ebb5ef762ef51921b68a8063fd09c979d7d0d32d",class:o.title},a("slot",{key:"75783345d2276f06e53c401761cb4e57d241e5e0",name:"label"}),a("slot",{key:"f2d9cdff693edbcae6293921fde7996d1b1251b6",name:"annotation"})),a("span",{key:"f7e28ea54455756c7d146c7b88be7001e80b07a8",class:o.right},a("slot",{key:"e76b31bf1c349a8a86d4b91ec1cfa650a75edf60",name:"suffix"}),a("span",{key:"87ea99c9862deb3ff9820fa383cec52956b4655a",class:o.arrow},a("slot",{key:"c8b64a90455a731f359e12550664ba5aa905abbc",name:"toggle-icon"},a("gov-icon",{key:"867406c5634d6446683529f5f647492b9b289a31",name:"chevron-down",type:"components"}))))),a("div",{key:"2adf7441dd470ae1b32a08fb374cd1d9e2d1f789",class:o.content},a("slot",{key:"8eb27d0b33689933b6e71850324c35c89d71c4c0"}))))}async toggle(){this.open=!this.open;this.govChange.emit({open:this.open,component:o.root,ref:this.host})}async currentState(){return this.open}get host(){return this}static get watchers(){return{size:["validateSize"]}}},[4,"gov-accordion-item",{identifier:[1],size:[1025],disabled:[4],open:[1028],openState:[32],toggle:[64],currentState:[64]},undefined,{size:["validateSize"]}]);function g(){if(typeof customElements==="undefined"){return}const e=["gov-accordion-item","gov-icon"];e.forEach((e=>{switch(e){case"gov-accordion-item":if(!customElements.get(e)){customElements.define(e,p)}break;case"gov-icon":if(!customElements.get(e)){l()}break}}))}g();const y=p;const u=g;export{y as GovAccordionItem,u as defineCustomElement};
2
2
  //# sourceMappingURL=gov-accordion-item.js.map
@@ -1,2 +1,2 @@
1
- import{p as t,H as s,c as e,h as o,a as i}from"./index.js";import{v as a}from"./p-BKP-F1qP.js";import{A as c,a as n,b as r}from"./p-4i8qDRtu.js";import{g as d}from"./p-DKo9A5gq.js";const h=t(class t extends s{constructor(){super();this.__registerHost();this.govChange=e(this,"gov-change");this.hydrated=false;this.size="m";this.noBorder=false;this.h=d(this.host)}validateSize(t){a(n,t,c.root)}componentWillLoad(){this.validateSize(this.size)}componentDidLoad(){this.host.querySelectorAll(r.root).forEach((t=>{t.addEventListener("gov-change",(t=>{t.stopPropagation();this.govChange.emit({component:c.root,open:t.detail.open,ref:t.detail.ref})}))}))}connectedCallback(){this.hydrated=true}render(){return o(i,{key:"98666441f80fcb633f05142c4a695e2478af5383",hydrated:this.hydrated,class:this.h.classes(c.root),size:this.size,role:"list"},o("slot",{key:"db7aa61e809f901019dcb301aa529cdc9bc7530e"}))}get host(){return this}static get watchers(){return{size:["validateSize"]}}},[4,"gov-accordion",{size:[1],noBorder:[4,"no-border"]},undefined,{size:["validateSize"]}]);function f(){if(typeof customElements==="undefined"){return}const t=["gov-accordion"];t.forEach((t=>{switch(t){case"gov-accordion":if(!customElements.get(t)){customElements.define(t,h)}break}}))}f();const m=h;const l=f;export{m as GovAccordion,l as defineCustomElement};
1
+ import{p as t,H as s,c as e,h as o,a as i}from"./index.js";import{v as a}from"./p-BKP-F1qP.js";import{A as c,a as n,b as r}from"./p-4i8qDRtu.js";import{g as d}from"./p-BHRF-5cf.js";const h=t(class t extends s{constructor(){super();this.__registerHost();this.govChange=e(this,"gov-change");this.hydrated=false;this.size="m";this.noBorder=false;this.h=d(this.host)}validateSize(t){a(n,t,c.root)}componentWillLoad(){this.validateSize(this.size)}componentDidLoad(){this.host.querySelectorAll(r.root).forEach((t=>{t.addEventListener("gov-change",(t=>{t.stopPropagation();this.govChange.emit({component:c.root,open:t.detail.open,ref:t.detail.ref})}))}))}connectedCallback(){this.hydrated=true}render(){return o(i,{key:"98666441f80fcb633f05142c4a695e2478af5383",hydrated:this.hydrated,class:this.h.classes(c.root),size:this.size,role:"list"},o("slot",{key:"db7aa61e809f901019dcb301aa529cdc9bc7530e"}))}get host(){return this}static get watchers(){return{size:["validateSize"]}}},[4,"gov-accordion",{size:[1],noBorder:[4,"no-border"]},undefined,{size:["validateSize"]}]);function f(){if(typeof customElements==="undefined"){return}const t=["gov-accordion"];t.forEach((t=>{switch(t){case"gov-accordion":if(!customElements.get(t)){customElements.define(t,h)}break}}))}f();const m=h;const l=f;export{m as GovAccordion,l as defineCustomElement};
2
2
  //# sourceMappingURL=gov-accordion.js.map
@@ -1,2 +1,2 @@
1
- import{G as s,d as o}from"./p-DesycS6d.js";const t=s;const c=o;export{t as GovAttachmentsItem,c as defineCustomElement};
1
+ import{G as o,d as s}from"./p-iTwUkISB.js";const t=o;const p=s;export{t as GovAttachmentsItem,p as defineCustomElement};
2
2
  //# sourceMappingURL=gov-attachments-item.js.map