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

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 (549) hide show
  1. package/dist/cjs/gov-flex_3.cjs.entry.js +1 -1
  2. package/dist/cjs/gov-form-file.cjs.entry.js +35 -11
  3. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  4. package/dist/cjs/gov-form-file.entry.cjs.js.map +1 -1
  5. package/dist/collection/components/gov-form/file/gov-form-file.js +7 -2
  6. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  7. package/dist/collection/utils/file.utils.js +28 -9
  8. package/dist/collection/utils/file.utils.js.map +1 -1
  9. package/dist/components/gov-accordion-item.js +1 -1
  10. package/dist/components/gov-attachments-item.js +1 -1
  11. package/dist/components/gov-blockquote.js +1 -1
  12. package/dist/components/gov-breadcrumbs.js +1 -1
  13. package/dist/components/gov-breadcrumbs.js.map +1 -1
  14. package/dist/components/gov-button.js +1 -1
  15. package/dist/components/gov-card.js +1 -1
  16. package/dist/components/gov-chip.js +1 -1
  17. package/dist/components/gov-collapsible.js +1 -1
  18. package/dist/components/gov-dialog.js +1 -1
  19. package/dist/components/gov-form-autocomplete.js +1 -1
  20. package/dist/components/gov-form-checkbox.js +1 -1
  21. package/dist/components/gov-form-file.js +1 -1
  22. package/dist/components/gov-form-file.js.map +1 -1
  23. package/dist/components/gov-form-input.js +1 -1
  24. package/dist/components/gov-form-multi-select.js +1 -1
  25. package/dist/components/gov-form-range.js +1 -1
  26. package/dist/components/gov-form-select.js +1 -1
  27. package/dist/components/gov-form-switch.js +1 -1
  28. package/dist/components/gov-icon.js +1 -1
  29. package/dist/components/gov-infobar.js +1 -1
  30. package/dist/components/gov-link.js +1 -1
  31. package/dist/components/gov-loading.js +1 -1
  32. package/dist/components/gov-pagination.js +1 -1
  33. package/dist/components/gov-tabs.js +1 -1
  34. package/dist/components/gov-tag.js +1 -1
  35. package/dist/components/gov-theme-switch.js +1 -1
  36. package/dist/components/gov-tile.js +1 -1
  37. package/dist/components/gov-toast.js +1 -1
  38. package/dist/components/gov-tooltip-content.js +1 -1
  39. package/dist/components/gov-wizard-item.js +1 -1
  40. package/dist/components/{p-DEthsMuE.js → p-BIB-JMbL.js} +2 -2
  41. package/dist/components/{p-iTwUkISB.js → p-BVG9PtuQ.js} +2 -2
  42. package/dist/components/{p-yIpIIG5A.js → p-DV0Pdd1S.js} +2 -2
  43. package/dist/components/{p-CXPP9vec.js → p-Dj-FiQ37.js} +2 -2
  44. package/dist/components/{p-pJ_vPAO0.js → p-DlpZtTcv.js} +2 -2
  45. package/dist/components/{p-DN5pb9xA.js → p-Dw1o8KoZ.js} +2 -2
  46. package/dist/components/{p-ibUK7mfI.js → p-NU_8kxGz.js} +2 -2
  47. package/dist/components/{p-C_URF9Su.js → p-o4vVG5sG.js} +2 -2
  48. package/dist/core/core.esm.js +1 -1
  49. package/dist/core/gov-form-file.entry.esm.js.map +1 -1
  50. package/dist/core/{p-bec959c4.entry.js → p-002e72bf.entry.js} +2 -2
  51. package/dist/core/p-441e67f6.entry.js +2 -0
  52. package/dist/core/p-441e67f6.entry.js.map +1 -0
  53. package/dist/dist/components/gov-accordion-item.d.ts +11 -0
  54. package/dist/dist/components/gov-accordion.d.ts +11 -0
  55. package/dist/dist/components/gov-attachments-item.d.ts +11 -0
  56. package/dist/dist/components/gov-attachments.d.ts +11 -0
  57. package/dist/dist/components/gov-backdrop.d.ts +11 -0
  58. package/dist/dist/components/gov-banner.d.ts +11 -0
  59. package/dist/dist/components/gov-blockquote.d.ts +11 -0
  60. package/dist/dist/components/gov-breadcrumbs.d.ts +11 -0
  61. package/dist/dist/components/gov-button.d.ts +11 -0
  62. package/dist/dist/components/gov-card.d.ts +11 -0
  63. package/dist/dist/components/gov-chip.d.ts +11 -0
  64. package/dist/dist/components/gov-collapsible.d.ts +11 -0
  65. package/dist/dist/components/gov-container.d.ts +11 -0
  66. package/dist/dist/components/gov-control-group.d.ts +11 -0
  67. package/dist/dist/components/gov-cookiebar.d.ts +11 -0
  68. package/dist/dist/components/gov-dialog.d.ts +11 -0
  69. package/dist/dist/components/gov-dropdown.d.ts +11 -0
  70. package/dist/dist/components/gov-empty.d.ts +11 -0
  71. package/dist/dist/components/gov-error-code.d.ts +11 -0
  72. package/dist/dist/components/gov-flex.d.ts +11 -0
  73. package/dist/dist/components/gov-form-autocomplete.d.ts +11 -0
  74. package/dist/dist/components/gov-form-checkbox-group.d.ts +11 -0
  75. package/dist/dist/components/gov-form-checkbox.d.ts +11 -0
  76. package/dist/dist/components/gov-form-control.d.ts +11 -0
  77. package/dist/dist/components/gov-form-file.d.ts +11 -0
  78. package/dist/dist/components/gov-form-group.d.ts +11 -0
  79. package/dist/dist/components/gov-form-input.d.ts +11 -0
  80. package/dist/dist/components/gov-form-label.d.ts +11 -0
  81. package/dist/dist/components/gov-form-message.d.ts +11 -0
  82. package/dist/dist/components/gov-form-multi-select.d.ts +11 -0
  83. package/dist/dist/components/gov-form-password-power.d.ts +11 -0
  84. package/dist/dist/components/gov-form-radio-group.d.ts +11 -0
  85. package/dist/dist/components/gov-form-radio.d.ts +11 -0
  86. package/dist/dist/components/gov-form-range.d.ts +11 -0
  87. package/dist/dist/components/gov-form-search.d.ts +11 -0
  88. package/dist/dist/components/gov-form-select.d.ts +11 -0
  89. package/dist/dist/components/gov-form-switch.d.ts +11 -0
  90. package/dist/dist/components/gov-grid-item.d.ts +11 -0
  91. package/dist/dist/components/gov-grid.d.ts +11 -0
  92. package/dist/dist/components/gov-icon.d.ts +11 -0
  93. package/dist/dist/components/gov-infobar.d.ts +11 -0
  94. package/dist/dist/components/gov-layout-column.d.ts +11 -0
  95. package/dist/dist/components/gov-layout.d.ts +11 -0
  96. package/dist/dist/components/gov-lifecycle.d.ts +11 -0
  97. package/dist/dist/components/gov-link.d.ts +11 -0
  98. package/dist/dist/components/gov-loading.d.ts +11 -0
  99. package/dist/dist/components/gov-message.d.ts +11 -0
  100. package/dist/dist/components/gov-pagination.d.ts +11 -0
  101. package/dist/dist/components/gov-skeleton.d.ts +11 -0
  102. package/dist/dist/components/gov-spacer.d.ts +11 -0
  103. package/dist/dist/components/gov-stepper-item.d.ts +11 -0
  104. package/dist/dist/components/gov-stepper.d.ts +11 -0
  105. package/dist/dist/components/gov-tabs-item.d.ts +11 -0
  106. package/dist/dist/components/gov-tabs.d.ts +11 -0
  107. package/dist/dist/components/gov-tag.d.ts +11 -0
  108. package/dist/dist/components/gov-theme-switch.d.ts +11 -0
  109. package/dist/dist/components/gov-tile.d.ts +11 -0
  110. package/dist/dist/components/gov-toast.d.ts +11 -0
  111. package/dist/dist/components/gov-tooltip-content.d.ts +11 -0
  112. package/dist/dist/components/gov-tooltip.d.ts +11 -0
  113. package/dist/dist/components/gov-wizard-item.d.ts +11 -0
  114. package/dist/dist/components/gov-wizard.d.ts +11 -0
  115. package/dist/dist/components/index.d.ts +35 -0
  116. package/dist/dist/dist/components/gov-accordion-item.d.ts +11 -0
  117. package/dist/dist/dist/components/gov-accordion.d.ts +11 -0
  118. package/dist/dist/dist/components/gov-app.d.ts +11 -0
  119. package/dist/dist/dist/components/gov-attachments-item.d.ts +11 -0
  120. package/dist/dist/dist/components/gov-attachments.d.ts +11 -0
  121. package/dist/dist/dist/components/gov-backdrop.d.ts +11 -0
  122. package/dist/dist/dist/components/gov-banner.d.ts +11 -0
  123. package/dist/dist/dist/components/gov-blockquote.d.ts +11 -0
  124. package/dist/dist/dist/components/gov-breadcrumbs.d.ts +11 -0
  125. package/dist/dist/dist/components/gov-button.d.ts +11 -0
  126. package/dist/dist/dist/components/gov-card.d.ts +11 -0
  127. package/dist/dist/dist/components/gov-chip.d.ts +11 -0
  128. package/dist/dist/dist/components/gov-collapsible.d.ts +11 -0
  129. package/dist/dist/dist/components/gov-container.d.ts +11 -0
  130. package/dist/dist/dist/components/gov-control-group.d.ts +11 -0
  131. package/dist/dist/dist/components/gov-cookiebar.d.ts +11 -0
  132. package/dist/dist/dist/components/gov-dialog.d.ts +11 -0
  133. package/dist/dist/dist/components/gov-dropdown.d.ts +11 -0
  134. package/dist/dist/dist/components/gov-empty.d.ts +11 -0
  135. package/dist/dist/dist/components/gov-error-code.d.ts +11 -0
  136. package/dist/dist/dist/components/gov-flex.d.ts +11 -0
  137. package/dist/dist/dist/components/gov-form-autocomplete.d.ts +11 -0
  138. package/dist/dist/dist/components/gov-form-checkbox-group.d.ts +11 -0
  139. package/dist/dist/dist/components/gov-form-checkbox.d.ts +11 -0
  140. package/dist/dist/dist/components/gov-form-control.d.ts +11 -0
  141. package/dist/dist/dist/components/gov-form-file.d.ts +11 -0
  142. package/dist/dist/dist/components/gov-form-group.d.ts +11 -0
  143. package/dist/dist/dist/components/gov-form-input.d.ts +11 -0
  144. package/dist/dist/dist/components/gov-form-label.d.ts +11 -0
  145. package/dist/dist/dist/components/gov-form-message.d.ts +11 -0
  146. package/dist/dist/dist/components/gov-form-multi-select.d.ts +11 -0
  147. package/dist/dist/dist/components/gov-form-password-power.d.ts +11 -0
  148. package/dist/dist/dist/components/gov-form-radio-group.d.ts +11 -0
  149. package/dist/dist/dist/components/gov-form-radio.d.ts +11 -0
  150. package/dist/dist/dist/components/gov-form-range.d.ts +11 -0
  151. package/dist/dist/dist/components/gov-form-search.d.ts +11 -0
  152. package/dist/dist/dist/components/gov-form-select.d.ts +11 -0
  153. package/dist/dist/dist/components/gov-form-switch.d.ts +11 -0
  154. package/dist/dist/dist/components/gov-grid-item.d.ts +11 -0
  155. package/dist/dist/dist/components/gov-grid.d.ts +11 -0
  156. package/dist/dist/dist/components/gov-icon.d.ts +11 -0
  157. package/dist/dist/dist/components/gov-infobar.d.ts +11 -0
  158. package/dist/dist/dist/components/gov-layout-column.d.ts +11 -0
  159. package/dist/dist/dist/components/gov-layout.d.ts +11 -0
  160. package/dist/dist/dist/components/gov-lifecycle.d.ts +11 -0
  161. package/dist/dist/dist/components/gov-link.d.ts +11 -0
  162. package/dist/dist/dist/components/gov-loading.d.ts +11 -0
  163. package/dist/dist/dist/components/gov-message.d.ts +11 -0
  164. package/dist/dist/dist/components/gov-pagination.d.ts +11 -0
  165. package/dist/dist/dist/components/gov-skeleton.d.ts +11 -0
  166. package/dist/dist/dist/components/gov-spacer.d.ts +11 -0
  167. package/dist/dist/dist/components/gov-stepper-item.d.ts +11 -0
  168. package/dist/dist/dist/components/gov-stepper.d.ts +11 -0
  169. package/dist/dist/dist/components/gov-tabs-item.d.ts +11 -0
  170. package/dist/dist/dist/components/gov-tabs.d.ts +11 -0
  171. package/dist/dist/dist/components/gov-tag.d.ts +11 -0
  172. package/dist/dist/dist/components/gov-theme-switch.d.ts +11 -0
  173. package/dist/dist/dist/components/gov-tile.d.ts +11 -0
  174. package/dist/dist/dist/components/gov-toast.d.ts +11 -0
  175. package/dist/dist/dist/components/gov-tooltip-content.d.ts +11 -0
  176. package/dist/dist/dist/components/gov-tooltip.d.ts +11 -0
  177. package/dist/dist/dist/components/gov-wizard-item.d.ts +11 -0
  178. package/dist/dist/dist/components/gov-wizard.d.ts +11 -0
  179. package/dist/dist/dist/components/index.d.ts +35 -0
  180. package/dist/dist/dist/globals.d.ts +2 -0
  181. package/dist/dist/dist/hydrate/index.d.ts +287 -0
  182. package/dist/dist/dist/types/components/gov-accordion/constants.d.ts +19 -0
  183. package/dist/dist/dist/types/components/gov-accordion/gov-accordion-item.d.ts +43 -0
  184. package/dist/dist/dist/types/components/gov-accordion/gov-accordion.d.ts +26 -0
  185. package/dist/dist/dist/types/components/gov-accordion/gov-accordion.types.d.ts +9 -0
  186. package/dist/dist/dist/types/components/gov-attachments/constants.d.ts +11 -0
  187. package/dist/dist/dist/types/components/gov-attachments/gov-attachments-item.d.d.ts +4 -0
  188. package/dist/dist/dist/types/components/gov-attachments/gov-attachments-item.d.ts +24 -0
  189. package/dist/dist/dist/types/components/gov-attachments/gov-attachments.d.ts +19 -0
  190. package/dist/dist/dist/types/components/gov-backdrop/constants.d.ts +4 -0
  191. package/dist/dist/dist/types/components/gov-backdrop/gov-backdrop.d.ts +32 -0
  192. package/dist/dist/dist/types/components/gov-banner/constants.d.ts +26 -0
  193. package/dist/dist/dist/types/components/gov-banner/gov-banner.d.ts +28 -0
  194. package/dist/dist/dist/types/components/gov-blockquote/constants.d.ts +10 -0
  195. package/dist/dist/dist/types/components/gov-blockquote/gov-blockquote.d.ts +15 -0
  196. package/dist/dist/dist/types/components/gov-breadcrumbs/constants.d.ts +3 -0
  197. package/dist/dist/dist/types/components/gov-breadcrumbs/gov-breadcrumbs.d.d.ts +4 -0
  198. package/dist/dist/dist/types/components/gov-breadcrumbs/gov-breadcrumbs.d.ts +42 -0
  199. package/dist/dist/dist/types/components/gov-button/button/constants.d.ts +29 -0
  200. package/dist/dist/dist/types/components/gov-button/button/gov-button.d.ts +133 -0
  201. package/dist/dist/dist/types/components/gov-button/button/gov-button.types.d.ts +4 -0
  202. package/dist/dist/dist/types/components/gov-button/dropdown/constants.d.ts +10 -0
  203. package/dist/dist/dist/types/components/gov-button/dropdown/gov-dropdown.d.ts +40 -0
  204. package/dist/dist/dist/types/components/gov-button/dropdown/gov-dropdown.types.d.ts +4 -0
  205. package/dist/dist/dist/types/components/gov-card/constants.d.ts +16 -0
  206. package/dist/dist/dist/types/components/gov-card/gov-card.d.ts +57 -0
  207. package/dist/dist/dist/types/components/gov-card/interfaces.d.ts +4 -0
  208. package/dist/dist/dist/types/components/gov-chip/constants.d.ts +21 -0
  209. package/dist/dist/dist/types/components/gov-chip/gov-chip.d.ts +82 -0
  210. package/dist/dist/dist/types/components/gov-collapsible/constants.d.ts +18 -0
  211. package/dist/dist/dist/types/components/gov-collapsible/gov-collapsible.d.ts +36 -0
  212. package/dist/dist/dist/types/components/gov-container/constants.d.ts +3 -0
  213. package/dist/dist/dist/types/components/gov-container/gov-container.d.ts +6 -0
  214. package/dist/dist/dist/types/components/gov-control-group/constants.d.ts +7 -0
  215. package/dist/dist/dist/types/components/gov-control-group/gov-control-group.d.ts +24 -0
  216. package/dist/dist/dist/types/components/gov-cookiebar/constants.d.ts +7 -0
  217. package/dist/dist/dist/types/components/gov-cookiebar/gov-cookiebar.d.ts +7 -0
  218. package/dist/dist/dist/types/components/gov-dialog/constants.d.ts +11 -0
  219. package/dist/dist/dist/types/components/gov-dialog/gov-dialog.d.ts +70 -0
  220. package/dist/dist/dist/types/components/gov-empty/constants.d.ts +19 -0
  221. package/dist/dist/dist/types/components/gov-empty/gov-empty.d.ts +21 -0
  222. package/dist/dist/dist/types/components/gov-error-code/constants.d.ts +4 -0
  223. package/dist/dist/dist/types/components/gov-error-code/gov-error-code.d.ts +6 -0
  224. package/dist/dist/dist/types/components/gov-flex/constants.d.ts +7 -0
  225. package/dist/dist/dist/types/components/gov-flex/gov-flex.d.ts +39 -0
  226. package/dist/dist/dist/types/components/gov-form/autocomplete/autocomplete.utils.d.ts +2 -0
  227. package/dist/dist/dist/types/components/gov-form/autocomplete/constants.d.ts +11 -0
  228. package/dist/dist/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.d.ts +158 -0
  229. package/dist/dist/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.types.d.ts +9 -0
  230. package/dist/dist/dist/types/components/gov-form/checkbox/constants.d.ts +10 -0
  231. package/dist/dist/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +86 -0
  232. package/dist/dist/dist/types/components/gov-form/checkbox/gov-form-checkbox.types.d.ts +5 -0
  233. package/dist/dist/dist/types/components/gov-form/control/constants.d.ts +9 -0
  234. package/dist/dist/dist/types/components/gov-form/control/gov-form-control.d.ts +40 -0
  235. package/dist/dist/dist/types/components/gov-form/file/constants.d.ts +7 -0
  236. package/dist/dist/dist/types/components/gov-form/file/gov-form-file.d.ts +130 -0
  237. package/dist/dist/dist/types/components/gov-form/file/gov-form-file.types.d.ts +11 -0
  238. package/dist/dist/dist/types/components/gov-form/group/constants.d.ts +18 -0
  239. package/dist/dist/dist/types/components/gov-form/group/gov-form-checkbox-group.d.ts +32 -0
  240. package/dist/dist/dist/types/components/gov-form/group/gov-form-group.d.ts +18 -0
  241. package/dist/dist/dist/types/components/gov-form/group/gov-form-group.types.d.ts +7 -0
  242. package/dist/dist/dist/types/components/gov-form/group/gov-form-radio-group.d.ts +32 -0
  243. package/dist/dist/dist/types/components/gov-form/input/constants.d.ts +28 -0
  244. package/dist/dist/dist/types/components/gov-form/input/gov-form-input.d.ts +178 -0
  245. package/dist/dist/dist/types/components/gov-form/input/gov-form-input.types.d.ts +4 -0
  246. package/dist/dist/dist/types/components/gov-form/label/constants.d.ts +8 -0
  247. package/dist/dist/dist/types/components/gov-form/label/gov-form-label.d.ts +26 -0
  248. package/dist/dist/dist/types/components/gov-form/message/constants.d.ts +11 -0
  249. package/dist/dist/dist/types/components/gov-form/message/gov-form-message.d.ts +23 -0
  250. package/dist/dist/dist/types/components/gov-form/multiselect/constants.d.ts +10 -0
  251. package/dist/dist/dist/types/components/gov-form/multiselect/gov-form-multi-select.d.ts +127 -0
  252. package/dist/dist/dist/types/components/gov-form/multiselect/gov-form-multi-select.types.d.ts +10 -0
  253. package/dist/dist/dist/types/components/gov-form/password-power/constants.d.ts +5 -0
  254. package/dist/dist/dist/types/components/gov-form/password-power/gov-form-password-power.d.ts +7 -0
  255. package/dist/dist/dist/types/components/gov-form/radio/constants.d.ts +10 -0
  256. package/dist/dist/dist/types/components/gov-form/radio/gov-form-radio.d.ts +83 -0
  257. package/dist/dist/dist/types/components/gov-form/radio/gov-form-radio.types.d.ts +5 -0
  258. package/dist/dist/dist/types/components/gov-form/range/constants.d.ts +9 -0
  259. package/dist/dist/dist/types/components/gov-form/range/gov-form-range.d.ts +116 -0
  260. package/dist/dist/dist/types/components/gov-form/search/constants.d.ts +10 -0
  261. package/dist/dist/dist/types/components/gov-form/search/gov-form-search.d.ts +13 -0
  262. package/dist/dist/dist/types/components/gov-form/select/constants.d.ts +8 -0
  263. package/dist/dist/dist/types/components/gov-form/select/gov-form-select.d.ts +89 -0
  264. package/dist/dist/dist/types/components/gov-form/select/gov-form-select.types.d.ts +9 -0
  265. package/dist/dist/dist/types/components/gov-form/switch/constants.d.ts +12 -0
  266. package/dist/dist/dist/types/components/gov-form/switch/gov-form-switch.d.ts +81 -0
  267. package/dist/dist/dist/types/components/gov-form/switch/gov-form-switch.types.d.ts +5 -0
  268. package/dist/dist/dist/types/components/gov-grid/constants.d.ts +10 -0
  269. package/dist/dist/dist/types/components/gov-grid/gov-grid-item.d.ts +46 -0
  270. package/dist/dist/dist/types/components/gov-grid/gov-grid.d.ts +19 -0
  271. package/dist/dist/dist/types/components/gov-icon/constants.d.ts +18 -0
  272. package/dist/dist/dist/types/components/gov-icon/gov-icon.d.ts +34 -0
  273. package/dist/dist/dist/types/components/gov-icon/helpers.d.ts +6 -0
  274. package/dist/dist/dist/types/components/gov-icon/list.d.ts +3 -0
  275. package/dist/dist/dist/types/components/gov-infobar/constants.d.ts +16 -0
  276. package/dist/dist/dist/types/components/gov-infobar/gov-infobar.d.ts +51 -0
  277. package/dist/dist/dist/types/components/gov-infobar/gov-infobar.types.d.ts +4 -0
  278. package/dist/dist/dist/types/components/gov-layout/constants.d.ts +20 -0
  279. package/dist/dist/dist/types/components/gov-layout/gov-layout-column.d.ts +6 -0
  280. package/dist/dist/dist/types/components/gov-layout/gov-layout.d.ts +20 -0
  281. package/dist/dist/dist/types/components/gov-lifecycle-tester/gov-lifecycle-tester.d.ts +14 -0
  282. package/dist/dist/dist/types/components/gov-link/constants.d.ts +8 -0
  283. package/dist/dist/dist/types/components/gov-link/gov-link.d.ts +34 -0
  284. package/dist/dist/dist/types/components/gov-loading/loading/constants.d.ts +9 -0
  285. package/dist/dist/dist/types/components/gov-loading/loading/gov-loading.d.ts +13 -0
  286. package/dist/dist/dist/types/components/gov-loading/skeleton/constants.d.ts +21 -0
  287. package/dist/dist/dist/types/components/gov-loading/skeleton/gov-skeleton.d.ts +46 -0
  288. package/dist/dist/dist/types/components/gov-message/constants.d.ts +13 -0
  289. package/dist/dist/dist/types/components/gov-message/gov-message.d.ts +16 -0
  290. package/dist/dist/dist/types/components/gov-pagination/constants.d.ts +22 -0
  291. package/dist/dist/dist/types/components/gov-pagination/gov-pagination.d.ts +97 -0
  292. package/dist/dist/dist/types/components/gov-pagination/gov-pagination.types.d.ts +5 -0
  293. package/dist/dist/dist/types/components/gov-pagination/pagination.d.ts +12 -0
  294. package/dist/dist/dist/types/components/gov-spacer/constants.d.ts +15 -0
  295. package/dist/dist/dist/types/components/gov-spacer/gov-spacer.d.ts +18 -0
  296. package/dist/dist/dist/types/components/gov-stepper/stepper/constants.d.ts +21 -0
  297. package/dist/dist/dist/types/components/gov-stepper/stepper/gov-stepper-item.d.d.ts +4 -0
  298. package/dist/dist/dist/types/components/gov-stepper/stepper/gov-stepper-item.d.ts +31 -0
  299. package/dist/dist/dist/types/components/gov-stepper/stepper/gov-stepper.d.ts +22 -0
  300. package/dist/dist/dist/types/components/gov-tabs/constants.d.ts +28 -0
  301. package/dist/dist/dist/types/components/gov-tabs/gov-tabs-item.d.ts +54 -0
  302. package/dist/dist/dist/types/components/gov-tabs/gov-tabs.d.ts +70 -0
  303. package/dist/dist/dist/types/components/gov-tabs/gov-tabs.types.d.ts +14 -0
  304. package/dist/dist/dist/types/components/gov-tag/constants.d.ts +12 -0
  305. package/dist/dist/dist/types/components/gov-tag/gov-tag.d.ts +35 -0
  306. package/dist/dist/dist/types/components/gov-theme-switch/constants.d.ts +12 -0
  307. package/dist/dist/dist/types/components/gov-theme-switch/gov-theme-switch.d.ts +46 -0
  308. package/dist/dist/dist/types/components/gov-theme-switch/gov-theme-switch.types.d.ts +10 -0
  309. package/dist/dist/dist/types/components/gov-tile/constants.d.ts +13 -0
  310. package/dist/dist/dist/types/components/gov-tile/gov-tile.d.ts +34 -0
  311. package/dist/dist/dist/types/components/gov-toast/constants.d.ts +17 -0
  312. package/dist/dist/dist/types/components/gov-toast/gov-toast.d.ts +58 -0
  313. package/dist/dist/dist/types/components/gov-tooltip/constants.d.ts +20 -0
  314. package/dist/dist/dist/types/components/gov-tooltip/gov-tooltip-content.d.ts +32 -0
  315. package/dist/dist/dist/types/components/gov-tooltip/gov-tooltip.d.ts +61 -0
  316. package/dist/dist/dist/types/components/gov-wizard/constants.d.ts +19 -0
  317. package/dist/dist/dist/types/components/gov-wizard/gov-wizard-item.d.d.ts +4 -0
  318. package/dist/dist/dist/types/components/gov-wizard/gov-wizard-item.d.ts +60 -0
  319. package/dist/dist/dist/types/components/gov-wizard/gov-wizard-item.types.d.ts +4 -0
  320. package/dist/dist/dist/types/components/gov-wizard/gov-wizard.d.ts +35 -0
  321. package/dist/dist/dist/types/core/constants/colors.d.ts +13 -0
  322. package/dist/dist/dist/types/core/constants/sizes.d.ts +13 -0
  323. package/dist/dist/dist/types/core/constants/tags.d.ts +12 -0
  324. package/dist/dist/dist/types/core/constants/tokens.d.ts +1 -0
  325. package/dist/dist/dist/types/helpers/Accessibility/accessibility.d.ts +1 -0
  326. package/dist/dist/dist/types/helpers/Accessibility/attributes.d.ts +1 -0
  327. package/dist/dist/dist/types/helpers/Dom/attribute.d.ts +13 -0
  328. package/dist/dist/dist/types/helpers/Dom/document.d.ts +4 -0
  329. package/dist/dist/dist/types/helpers/Dom/form.d.ts +3 -0
  330. package/dist/dist/dist/types/helpers/Dom/form.types.d.ts +11 -0
  331. package/dist/dist/dist/types/helpers/Dom/template.d.ts +10 -0
  332. package/dist/dist/dist/types/helpers/Dom/template.types.d.ts +14 -0
  333. package/dist/dist/dist/types/helpers/Dom/win.d.ts +18 -0
  334. package/dist/dist/dist/types/helpers/Fragment.d.ts +2 -0
  335. package/dist/dist/dist/types/helpers/Log/gov.log.d.ts +8 -0
  336. package/dist/dist/dist/types/helpers/Validate/props.d.ts +1 -0
  337. package/dist/dist/dist/types/helpers/Validate/wcag.d.ts +4 -0
  338. package/dist/dist/dist/types/index.d.ts +0 -0
  339. package/dist/dist/dist/types/interfaces.d.ts +1 -0
  340. package/dist/dist/dist/types/stencil-public-runtime.d.ts +1861 -0
  341. package/dist/dist/dist/types/types/event.types.d.ts +4 -0
  342. package/dist/dist/dist/types/types/interfaces.d.ts +2 -0
  343. package/dist/dist/dist/types/types/typings.d.ts +6 -0
  344. package/dist/dist/dist/types/utils/array.utils.d.ts +2 -0
  345. package/dist/dist/dist/types/utils/bool.utils.d.ts +1 -0
  346. package/dist/dist/dist/types/utils/dom.utils.d.ts +1 -0
  347. package/dist/dist/dist/types/utils/ds.utils.d.ts +1 -0
  348. package/dist/dist/dist/types/utils/file.utils.d.ts +3 -0
  349. package/dist/dist/dist/types/utils/helpers.types.d.ts +49 -0
  350. package/dist/dist/dist/types/utils/icon.utils.d.ts +4 -0
  351. package/dist/dist/dist/types/utils/number.utils.d.ts +1 -0
  352. package/dist/dist/dist/types/utils/object.utils.d.ts +2 -0
  353. package/dist/dist/dist/types/utils/stencil.utils.d.ts +1 -0
  354. package/dist/dist/dist/types/utils/string.utils.d.ts +4 -0
  355. package/dist/dist/dist/types/utils/utils.d.ts +20 -0
  356. package/dist/dist/globals.d.ts +2 -0
  357. package/dist/dist/hydrate/index.d.ts +287 -0
  358. package/dist/dist/types/components/gov-accordion/constants.d.ts +19 -0
  359. package/dist/dist/types/components/gov-accordion/gov-accordion-item.d.ts +43 -0
  360. package/dist/dist/types/components/gov-accordion/gov-accordion.d.ts +26 -0
  361. package/dist/dist/types/components/gov-accordion/gov-accordion.types.d.ts +9 -0
  362. package/dist/dist/types/components/gov-attachments/constants.d.ts +11 -0
  363. package/dist/dist/types/components/gov-attachments/gov-attachments-item.d.d.ts +4 -0
  364. package/dist/dist/types/components/gov-attachments/gov-attachments-item.d.ts +24 -0
  365. package/dist/dist/types/components/gov-attachments/gov-attachments.d.ts +19 -0
  366. package/dist/dist/types/components/gov-backdrop/constants.d.ts +4 -0
  367. package/dist/dist/types/components/gov-backdrop/gov-backdrop.d.ts +32 -0
  368. package/dist/dist/types/components/gov-banner/constants.d.ts +26 -0
  369. package/dist/dist/types/components/gov-banner/gov-banner.d.ts +28 -0
  370. package/dist/dist/types/components/gov-blockquote/constants.d.ts +10 -0
  371. package/dist/dist/types/components/gov-blockquote/gov-blockquote.d.ts +15 -0
  372. package/dist/dist/types/components/gov-breadcrumbs/constants.d.ts +3 -0
  373. package/dist/dist/types/components/gov-breadcrumbs/gov-breadcrumbs.d.d.ts +4 -0
  374. package/dist/dist/types/components/gov-breadcrumbs/gov-breadcrumbs.d.ts +42 -0
  375. package/dist/dist/types/components/gov-button/button/constants.d.ts +29 -0
  376. package/dist/dist/types/components/gov-button/button/gov-button.d.ts +133 -0
  377. package/dist/dist/types/components/gov-button/button/gov-button.types.d.ts +4 -0
  378. package/dist/dist/types/components/gov-button/dropdown/constants.d.ts +10 -0
  379. package/dist/dist/types/components/gov-button/dropdown/gov-dropdown.d.ts +40 -0
  380. package/dist/dist/types/components/gov-button/dropdown/gov-dropdown.types.d.ts +4 -0
  381. package/dist/dist/types/components/gov-card/constants.d.ts +16 -0
  382. package/dist/dist/types/components/gov-card/gov-card.d.ts +57 -0
  383. package/dist/dist/types/components/gov-card/interfaces.d.ts +4 -0
  384. package/dist/dist/types/components/gov-chip/constants.d.ts +21 -0
  385. package/dist/dist/types/components/gov-chip/gov-chip.d.ts +82 -0
  386. package/dist/dist/types/components/gov-collapsible/constants.d.ts +18 -0
  387. package/dist/dist/types/components/gov-collapsible/gov-collapsible.d.ts +36 -0
  388. package/dist/dist/types/components/gov-container/constants.d.ts +3 -0
  389. package/dist/dist/types/components/gov-container/gov-container.d.ts +6 -0
  390. package/dist/dist/types/components/gov-control-group/constants.d.ts +7 -0
  391. package/dist/dist/types/components/gov-control-group/gov-control-group.d.ts +24 -0
  392. package/dist/dist/types/components/gov-cookiebar/constants.d.ts +7 -0
  393. package/dist/dist/types/components/gov-cookiebar/gov-cookiebar.d.ts +7 -0
  394. package/dist/dist/types/components/gov-dialog/constants.d.ts +11 -0
  395. package/dist/dist/types/components/gov-dialog/gov-dialog.d.ts +70 -0
  396. package/dist/dist/types/components/gov-empty/constants.d.ts +19 -0
  397. package/dist/dist/types/components/gov-empty/gov-empty.d.ts +21 -0
  398. package/dist/dist/types/components/gov-error-code/constants.d.ts +4 -0
  399. package/dist/dist/types/components/gov-error-code/gov-error-code.d.ts +6 -0
  400. package/dist/dist/types/components/gov-flex/constants.d.ts +7 -0
  401. package/dist/dist/types/components/gov-flex/gov-flex.d.ts +39 -0
  402. package/dist/dist/types/components/gov-form/autocomplete/autocomplete.utils.d.ts +2 -0
  403. package/dist/dist/types/components/gov-form/autocomplete/constants.d.ts +11 -0
  404. package/dist/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.d.ts +158 -0
  405. package/dist/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.types.d.ts +9 -0
  406. package/dist/dist/types/components/gov-form/checkbox/constants.d.ts +10 -0
  407. package/dist/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +86 -0
  408. package/dist/dist/types/components/gov-form/checkbox/gov-form-checkbox.types.d.ts +5 -0
  409. package/dist/dist/types/components/gov-form/control/constants.d.ts +9 -0
  410. package/dist/dist/types/components/gov-form/control/gov-form-control.d.ts +40 -0
  411. package/dist/dist/types/components/gov-form/file/constants.d.ts +7 -0
  412. package/dist/dist/types/components/gov-form/file/gov-form-file.d.ts +130 -0
  413. package/dist/dist/types/components/gov-form/file/gov-form-file.types.d.ts +11 -0
  414. package/dist/dist/types/components/gov-form/group/constants.d.ts +18 -0
  415. package/dist/dist/types/components/gov-form/group/gov-form-checkbox-group.d.ts +32 -0
  416. package/dist/dist/types/components/gov-form/group/gov-form-group.d.ts +18 -0
  417. package/dist/dist/types/components/gov-form/group/gov-form-group.types.d.ts +7 -0
  418. package/dist/dist/types/components/gov-form/group/gov-form-radio-group.d.ts +32 -0
  419. package/dist/dist/types/components/gov-form/input/constants.d.ts +28 -0
  420. package/dist/dist/types/components/gov-form/input/gov-form-input.d.ts +178 -0
  421. package/dist/dist/types/components/gov-form/input/gov-form-input.types.d.ts +4 -0
  422. package/dist/dist/types/components/gov-form/label/constants.d.ts +8 -0
  423. package/dist/dist/types/components/gov-form/label/gov-form-label.d.ts +26 -0
  424. package/dist/dist/types/components/gov-form/message/constants.d.ts +11 -0
  425. package/dist/dist/types/components/gov-form/message/gov-form-message.d.ts +23 -0
  426. package/dist/dist/types/components/gov-form/multiselect/constants.d.ts +10 -0
  427. package/dist/dist/types/components/gov-form/multiselect/gov-form-multi-select.d.ts +127 -0
  428. package/dist/dist/types/components/gov-form/multiselect/gov-form-multi-select.types.d.ts +10 -0
  429. package/dist/dist/types/components/gov-form/password-power/constants.d.ts +5 -0
  430. package/dist/dist/types/components/gov-form/password-power/gov-form-password-power.d.ts +7 -0
  431. package/dist/dist/types/components/gov-form/radio/constants.d.ts +10 -0
  432. package/dist/dist/types/components/gov-form/radio/gov-form-radio.d.ts +83 -0
  433. package/dist/dist/types/components/gov-form/radio/gov-form-radio.types.d.ts +5 -0
  434. package/dist/dist/types/components/gov-form/range/constants.d.ts +9 -0
  435. package/dist/dist/types/components/gov-form/range/gov-form-range.d.ts +116 -0
  436. package/dist/dist/types/components/gov-form/search/constants.d.ts +10 -0
  437. package/dist/dist/types/components/gov-form/search/gov-form-search.d.ts +13 -0
  438. package/dist/dist/types/components/gov-form/select/constants.d.ts +8 -0
  439. package/dist/dist/types/components/gov-form/select/gov-form-select.d.ts +89 -0
  440. package/dist/dist/types/components/gov-form/select/gov-form-select.types.d.ts +9 -0
  441. package/dist/dist/types/components/gov-form/switch/constants.d.ts +12 -0
  442. package/dist/dist/types/components/gov-form/switch/gov-form-switch.d.ts +81 -0
  443. package/dist/dist/types/components/gov-form/switch/gov-form-switch.types.d.ts +5 -0
  444. package/dist/dist/types/components/gov-grid/constants.d.ts +10 -0
  445. package/dist/dist/types/components/gov-grid/gov-grid-item.d.ts +46 -0
  446. package/dist/dist/types/components/gov-grid/gov-grid.d.ts +19 -0
  447. package/dist/dist/types/components/gov-icon/constants.d.ts +18 -0
  448. package/dist/dist/types/components/gov-icon/gov-icon.d.ts +34 -0
  449. package/dist/dist/types/components/gov-icon/helpers.d.ts +6 -0
  450. package/dist/dist/types/components/gov-icon/list.d.ts +3 -0
  451. package/dist/dist/types/components/gov-infobar/constants.d.ts +16 -0
  452. package/dist/dist/types/components/gov-infobar/gov-infobar.d.ts +51 -0
  453. package/dist/dist/types/components/gov-infobar/gov-infobar.types.d.ts +4 -0
  454. package/dist/dist/types/components/gov-layout/constants.d.ts +20 -0
  455. package/dist/dist/types/components/gov-layout/gov-layout-column.d.ts +6 -0
  456. package/dist/dist/types/components/gov-layout/gov-layout.d.ts +20 -0
  457. package/dist/dist/types/components/gov-lifecycle-tester/gov-lifecycle-tester.d.ts +14 -0
  458. package/dist/dist/types/components/gov-link/constants.d.ts +8 -0
  459. package/dist/dist/types/components/gov-link/gov-link.d.ts +34 -0
  460. package/dist/dist/types/components/gov-loading/loading/constants.d.ts +9 -0
  461. package/dist/dist/types/components/gov-loading/loading/gov-loading.d.ts +13 -0
  462. package/dist/dist/types/components/gov-loading/skeleton/constants.d.ts +21 -0
  463. package/dist/dist/types/components/gov-loading/skeleton/gov-skeleton.d.ts +46 -0
  464. package/dist/dist/types/components/gov-message/constants.d.ts +13 -0
  465. package/dist/dist/types/components/gov-message/gov-message.d.ts +16 -0
  466. package/dist/dist/types/components/gov-pagination/constants.d.ts +22 -0
  467. package/dist/dist/types/components/gov-pagination/gov-pagination.d.ts +97 -0
  468. package/dist/dist/types/components/gov-pagination/gov-pagination.types.d.ts +5 -0
  469. package/dist/dist/types/components/gov-pagination/pagination.d.ts +12 -0
  470. package/dist/dist/types/components/gov-spacer/constants.d.ts +15 -0
  471. package/dist/dist/types/components/gov-spacer/gov-spacer.d.ts +18 -0
  472. package/dist/dist/types/components/gov-stepper/stepper/constants.d.ts +21 -0
  473. package/dist/dist/types/components/gov-stepper/stepper/gov-stepper-item.d.d.ts +4 -0
  474. package/dist/dist/types/components/gov-stepper/stepper/gov-stepper-item.d.ts +31 -0
  475. package/dist/dist/types/components/gov-stepper/stepper/gov-stepper.d.ts +22 -0
  476. package/dist/dist/types/components/gov-tabs/constants.d.ts +28 -0
  477. package/dist/dist/types/components/gov-tabs/gov-tabs-item.d.ts +54 -0
  478. package/dist/dist/types/components/gov-tabs/gov-tabs.d.ts +70 -0
  479. package/dist/dist/types/components/gov-tabs/gov-tabs.types.d.ts +14 -0
  480. package/dist/dist/types/components/gov-tag/constants.d.ts +12 -0
  481. package/dist/dist/types/components/gov-tag/gov-tag.d.ts +35 -0
  482. package/dist/dist/types/components/gov-theme-switch/constants.d.ts +12 -0
  483. package/dist/dist/types/components/gov-theme-switch/gov-theme-switch.d.ts +46 -0
  484. package/dist/dist/types/components/gov-theme-switch/gov-theme-switch.types.d.ts +10 -0
  485. package/dist/dist/types/components/gov-tile/constants.d.ts +13 -0
  486. package/dist/dist/types/components/gov-tile/gov-tile.d.ts +34 -0
  487. package/dist/dist/types/components/gov-toast/constants.d.ts +17 -0
  488. package/dist/dist/types/components/gov-toast/gov-toast.d.ts +58 -0
  489. package/dist/dist/types/components/gov-tooltip/constants.d.ts +20 -0
  490. package/dist/dist/types/components/gov-tooltip/gov-tooltip-content.d.ts +32 -0
  491. package/dist/dist/types/components/gov-tooltip/gov-tooltip.d.ts +61 -0
  492. package/dist/dist/types/components/gov-wizard/constants.d.ts +19 -0
  493. package/dist/dist/types/components/gov-wizard/gov-wizard-item.d.d.ts +4 -0
  494. package/dist/dist/types/components/gov-wizard/gov-wizard-item.d.ts +60 -0
  495. package/dist/dist/types/components/gov-wizard/gov-wizard-item.types.d.ts +4 -0
  496. package/dist/dist/types/components/gov-wizard/gov-wizard.d.ts +35 -0
  497. package/dist/dist/types/core/constants/colors.d.ts +13 -0
  498. package/dist/dist/types/core/constants/sizes.d.ts +13 -0
  499. package/dist/dist/types/core/constants/tags.d.ts +12 -0
  500. package/dist/dist/types/core/constants/tokens.d.ts +1 -0
  501. package/dist/dist/types/helpers/Accessibility/accessibility.d.ts +1 -0
  502. package/dist/dist/types/helpers/Accessibility/attributes.d.ts +1 -0
  503. package/dist/dist/types/helpers/Dom/attribute.d.ts +13 -0
  504. package/dist/dist/types/helpers/Dom/document.d.ts +4 -0
  505. package/dist/dist/types/helpers/Dom/form.d.ts +3 -0
  506. package/dist/dist/types/helpers/Dom/form.types.d.ts +11 -0
  507. package/dist/dist/types/helpers/Dom/template.d.ts +10 -0
  508. package/dist/dist/types/helpers/Dom/template.types.d.ts +14 -0
  509. package/dist/dist/types/helpers/Dom/win.d.ts +18 -0
  510. package/dist/dist/types/helpers/Fragment.d.ts +2 -0
  511. package/dist/dist/types/helpers/Log/gov.log.d.ts +8 -0
  512. package/dist/dist/types/helpers/Validate/props.d.ts +1 -0
  513. package/dist/dist/types/helpers/Validate/wcag.d.ts +4 -0
  514. package/dist/dist/types/index.d.ts +0 -0
  515. package/dist/dist/types/interfaces.d.ts +1 -0
  516. package/dist/dist/types/stencil-public-runtime.d.ts +1861 -0
  517. package/dist/dist/types/types/event.types.d.ts +4 -0
  518. package/dist/dist/types/types/interfaces.d.ts +2 -0
  519. package/dist/dist/types/types/typings.d.ts +6 -0
  520. package/dist/dist/types/utils/array.utils.d.ts +2 -0
  521. package/dist/dist/types/utils/bool.utils.d.ts +1 -0
  522. package/dist/dist/types/utils/dom.utils.d.ts +1 -0
  523. package/dist/dist/types/utils/ds.utils.d.ts +1 -0
  524. package/dist/dist/types/utils/file.utils.d.ts +3 -0
  525. package/dist/dist/types/utils/helpers.types.d.ts +49 -0
  526. package/dist/dist/types/utils/icon.utils.d.ts +4 -0
  527. package/dist/dist/types/utils/number.utils.d.ts +1 -0
  528. package/dist/dist/types/utils/object.utils.d.ts +2 -0
  529. package/dist/dist/types/utils/stencil.utils.d.ts +1 -0
  530. package/dist/dist/types/utils/string.utils.d.ts +4 -0
  531. package/dist/dist/types/utils/utils.d.ts +20 -0
  532. package/dist/esm/gov-flex_3.entry.js +1 -1
  533. package/dist/esm/gov-form-file.entry.js +35 -11
  534. package/dist/esm/gov-form-file.entry.js.map +1 -1
  535. package/dist/hydrate/index.js +36 -12
  536. package/dist/hydrate/index.mjs +36 -12
  537. package/package.json +2 -2
  538. package/dist/core/p-afe254cb.entry.js +0 -2
  539. package/dist/core/p-afe254cb.entry.js.map +0 -1
  540. package/readme.md +0 -9
  541. /package/dist/components/{p-DEthsMuE.js.map → p-BIB-JMbL.js.map} +0 -0
  542. /package/dist/components/{p-iTwUkISB.js.map → p-BVG9PtuQ.js.map} +0 -0
  543. /package/dist/components/{p-yIpIIG5A.js.map → p-DV0Pdd1S.js.map} +0 -0
  544. /package/dist/components/{p-CXPP9vec.js.map → p-Dj-FiQ37.js.map} +0 -0
  545. /package/dist/components/{p-pJ_vPAO0.js.map → p-DlpZtTcv.js.map} +0 -0
  546. /package/dist/components/{p-DN5pb9xA.js.map → p-Dw1o8KoZ.js.map} +0 -0
  547. /package/dist/components/{p-ibUK7mfI.js.map → p-NU_8kxGz.js.map} +0 -0
  548. /package/dist/components/{p-C_URF9Su.js.map → p-o4vVG5sG.js.map} +0 -0
  549. /package/dist/core/{p-bec959c4.entry.js.map → p-002e72bf.entry.js.map} +0 -0
@@ -0,0 +1,4 @@
1
+ export interface GovBaseEvent {
2
+ component: string;
3
+ originalEvent?: Event;
4
+ }
@@ -0,0 +1,2 @@
1
+ export type Nullable<T> = T | null;
2
+ export type ValueOf<T> = T[keyof T];
@@ -0,0 +1,6 @@
1
+ declare module '*.jpg'
2
+
3
+ declare module '*.md' {
4
+ const value: string // markdown is just a string
5
+ export default value
6
+ }
@@ -0,0 +1,2 @@
1
+ export declare const createArrayRange: (from: number, to: number) => number[];
2
+ export declare const propsValueToArray: <T>(value: unknown) => T;
@@ -0,0 +1 @@
1
+ export declare function toBool(value: any): boolean;
@@ -0,0 +1 @@
1
+ export declare function getFocusableElements(container: HTMLElement): Element[];
@@ -0,0 +1 @@
1
+ export declare const dsVersion: () => string;
@@ -0,0 +1,3 @@
1
+ export declare function formatBytes(bytes: any): string;
2
+ export declare function fileAcceptValidation(file: File, accept: string): boolean;
3
+ export declare function fileSizeValidation(file: File, maxSize: number): boolean;
@@ -0,0 +1,49 @@
1
+ export type Optional<T> = T | undefined;
2
+ export type Nullable<T> = T | null;
3
+ export type OptionalProperty<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
4
+ export type ValueOf<T> = T[keyof T];
5
+ export type DeepPartial<T> = {
6
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
7
+ };
8
+ export type ObjectOrArrayType<T> = T | T[];
9
+ export declare const ObjectOrArray: {
10
+ first: <T>(item: ObjectOrArrayType<T>) => T;
11
+ array: <T>(item: ObjectOrArrayType<T>) => T[];
12
+ };
13
+ export declare const Omit: <T extends object, P extends keyof T, R extends Omit<T, P>>(properties: P[], object: T) => R;
14
+ export declare const whenDefined: <I, O>(fn: (input: I) => O) => (value?: I) => O | undefined;
15
+ /**
16
+ * Comparator function which defines the sort order
17
+ * @example
18
+ * ```
19
+ * // sorts objects by `id` property
20
+ * [{ id: 3 }, { id: 2 }, { id: 1 }].sort(compare(['id']))
21
+ *
22
+ * // sorts objects by `id` and `name` properties
23
+ * [{ id: 3, name: 'b' }, { id: 2, name: 'a' }, { id: 1, name: 'b' }].sort(compare(['id', 'name']))
24
+ * ```
25
+ *
26
+ * @param {Array<keyof T>} properties
27
+ * @return {number}
28
+ */
29
+ export declare const compare: <T extends object>(properties: Array<keyof T>) => (a: T, b: T) => number;
30
+ export declare const is: <T>(value: T | undefined | null) => value is T;
31
+ export declare const has: <T extends object, P extends keyof T>(property: P) => (object: OptionalProperty<T, P>) => object is T;
32
+ export declare const equals: <A>(a?: A) => (b?: A) => boolean;
33
+ export declare const prop: <T, P extends keyof T>(property: P) => (object: T) => T[P];
34
+ export declare const propOptional: <T, P extends keyof T>(property: P) => (object?: T) => Optional<T[P]>;
35
+ export declare const hasOwnProperty: <X extends object, Y extends PropertyKey>(obj: X, prop: Y) => obj is X & Record<Y, ValueOf<X>>;
36
+ export declare const isObject: <T extends object>(obj: unknown) => obj is T;
37
+ export declare const isString: (input: unknown) => input is string;
38
+ export declare const isNumber: (input: unknown) => input is string;
39
+ type Entries<T> = {
40
+ [K in keyof T]: [K, T[K]];
41
+ }[keyof T][];
42
+ export declare const getEntries: <T extends object>(obj: T) => Entries<T>;
43
+ export declare const getKeys: <T extends object>(obj: T) => Array<keyof T>;
44
+ export declare const getValues: <T extends object>(obj: T) => Array<ValueOf<T>>;
45
+ export declare const first: <T>(array: T[]) => Optional<T>;
46
+ export declare const pairs: <T>(arr: T[]) => Array<[string, string]>;
47
+ export declare const find: <T, S extends T>(predicate: (item: T) => item is S) => (array?: T[]) => Optional<S>;
48
+ export declare const filter: <T, S extends T>(predicate: (item: T) => item is S) => (array?: T[]) => S[];
49
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare function fetchIcon({ name, type }: {
2
+ name: string;
3
+ type: string;
4
+ }): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare const randomNumber: (min: number, max: number) => number;
@@ -0,0 +1,2 @@
1
+ export declare const parseJSONString: (value: unknown) => object | [] | null;
2
+ export declare const propsValueToObject: <T>(value: unknown) => T;
@@ -0,0 +1 @@
1
+ export declare const tick: (callback: () => void) => void;
@@ -0,0 +1,4 @@
1
+ export declare function chr4(): string;
2
+ export declare function createID(prefix: string): string;
3
+ export declare function removeDiacritics(string: any): string | any;
4
+ export declare function splitByWhitespace(string: any): string | any;
@@ -0,0 +1,20 @@
1
+ export declare function format(first: string, middle: string, last: string): string;
2
+ export declare function delay(miliseconds: number): Promise<void>;
3
+ export declare function throttle(f: (entries: any) => void, delay: number): (...args: any[]) => void;
4
+ /**
5
+ * Checks if object has that property
6
+ *
7
+ * @param {K} prop
8
+ * @param {T} obj
9
+ * @return {obj is T & Record<K, V>}
10
+ */
11
+ export declare const has: <T extends object, K extends PropertyKey, V>(prop: K, obj: T) => obj is T & Record<K, V>;
12
+ /**
13
+ * Returns property of given Object
14
+ *
15
+ * @param {K} name
16
+ * @param {T} object
17
+ * @return {(T & Record<K, unknown>)[K]}
18
+ */
19
+ export declare const property: <T extends object, K extends keyof T>(name: K, object: T) => T[K];
20
+ export declare const pick: <T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: readonly K[]) => Pick<T, K>;
@@ -51,7 +51,7 @@ var Types;
51
51
  const IconClass = {
52
52
  root: 'gov-icon'};
53
53
 
54
- const version = "4.6.4";
54
+ const version = "4.6.5";
55
55
 
56
56
  const dsVersion = () => {
57
57
  return version;
@@ -27,18 +27,37 @@ function formatBytes(bytes) {
27
27
  }
28
28
  return n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l];
29
29
  }
30
+ // Validates a file against an `accept` attribute value, following the HTML spec
31
+ // (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept):
32
+ // - ".ext" → matched against the file NAME suffix (case-insensitive)
33
+ // - "type/*" → matched against the file MIME group
34
+ // - "type/sub" → exact MIME match
35
+ // Matching the name (not only file.type) is essential: browsers often report an
36
+ // empty or non-standard MIME for extensions like .jsonld, which the previous
37
+ // MIME-only RegExp check always rejected.
30
38
  function fileAcceptValidation(file, accept) {
31
- if (typeof accept === 'string' && accept.length) {
32
- return (accept
33
- .replace(/\s/g, '')
34
- .split(',')
35
- .filter(accept => {
36
- return new RegExp(accept.replace('*', '.*')).test(file.type);
37
- }).length > 0);
38
- }
39
- else {
39
+ if (typeof accept !== 'string' || accept.trim().length === 0) {
40
40
  return true;
41
41
  }
42
+ const fileName = file.name.toLowerCase();
43
+ const fileType = (file.type || '').toLowerCase();
44
+ return accept
45
+ .split(',')
46
+ .map(token => token.trim().toLowerCase())
47
+ .filter(token => token.length > 0)
48
+ .some(token => {
49
+ if (token.startsWith('.')) {
50
+ return fileName.endsWith(token);
51
+ }
52
+ if (token === '*' || token === '*/*') {
53
+ return true;
54
+ }
55
+ if (token.endsWith('/*')) {
56
+ const group = token.slice(0, token.indexOf('/') + 1);
57
+ return fileType.startsWith(group);
58
+ }
59
+ return fileType === token;
60
+ });
42
61
  }
43
62
  function fileSizeValidation(file, maxSize) {
44
63
  const fileSize = Math.round(file.size);
@@ -159,10 +178,15 @@ const GovFormFile = class {
159
178
  }
160
179
  validateFiles(files) {
161
180
  let filesBuffer = [];
181
+ // Without `multiple`, only a single file is allowed. An incoming batch
182
+ // (drag-drop, framework wrapper, programmatic assignment) can still carry
183
+ // several files, so cap it to the last one — consistent with the
184
+ // "second pick replaces the first" semantics. (Bug #30570313)
185
+ const incoming = this.multiple ? Array.from(files) : Array.from(files).slice(-1);
162
186
  if (!this.multiple && this.displayAttachments) {
163
187
  this.files = [];
164
188
  }
165
- Array.from(files).forEach(file => {
189
+ incoming.forEach(file => {
166
190
  const isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null;
167
191
  if (isFile === null || this.ignoreFileDuplicationCheck) {
168
192
  const isSizeValid = typeof this.maxFileSize === "number" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true;
@@ -238,7 +262,7 @@ const GovFormFile = class {
238
262
  this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attributeName]: newValue });
239
263
  }
240
264
  render() {
241
- return (h(Host, { key: '6709aba5a796ccb9cf712dd5f962d5f903050d26', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, h("div", { key: '668f6959ca55220ed2543dbbeddeb98f1b6c19ba', class: FormFileClass.area, ref: el => (this.areaRef = el) }, h("slot", { key: '5f12f12d074163b525e2200e23f61e6d0fb34c74' }), h("input", Object.assign({ key: '7cf43884dad3c28be956b9897862ff5a1fa22e75', class: FormFileClass.input, ref: el => (this.inputRef = el), id: this.identifier || this.fileId, type: "file", name: this.name, accept: this.accept, multiple: this.multiple, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, disabled: this.disabled }, this.inheritedAttributes, { "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-disabled": toBoolAttrIfDefined(this.disabled) })), h("div", { key: 'ec717f584bcd4d74416821736fb4bdcea517bc83', class: FormFileClass.inputFocus })), this.h.hasSlot("attachments") ? (h("div", { class: FormFileClass.attachments }, h("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (h("div", { class: FormFileClass.attachments }, h("gov-attachments", { label: this.accessibleAttachmentsLabel, "accessible-label": this.accessibleAttachmentsLabel }, this.files.map(item => (h("gov-attachments-item", { "accessible-remove-labelledby": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, item.file.name, h("span", { slot: "name" }, item.file.name), item.acceptValid === false ? (h("gov-form-message", { slot: "message", color: "error" }, h("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (h("gov-form-message", { slot: "message", color: "error" }, h("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, h("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
265
+ return (h(Host, { key: '2d89af24db1447bba2c7987946b5c63bff65a58a', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, h("div", { key: '7a37869f8ef203b0f1d6b07cfee8e4f325fe9ecc', class: FormFileClass.area, ref: el => (this.areaRef = el) }, h("slot", { key: '10344be7bedf53a4754c8e79bb069c57291b7663' }), h("input", Object.assign({ key: '52dc1692d0eaa6310c0166faceb5906627aac73c', class: FormFileClass.input, ref: el => (this.inputRef = el), id: this.identifier || this.fileId, type: "file", name: this.name, accept: this.accept, multiple: this.multiple, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, disabled: this.disabled }, this.inheritedAttributes, { "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-disabled": toBoolAttrIfDefined(this.disabled) })), h("div", { key: '1193c6ef7a57894baab2f14619827c2f51441d08', class: FormFileClass.inputFocus })), this.h.hasSlot("attachments") ? (h("div", { class: FormFileClass.attachments }, h("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (h("div", { class: FormFileClass.attachments }, h("gov-attachments", { label: this.accessibleAttachmentsLabel, "accessible-label": this.accessibleAttachmentsLabel }, this.files.map(item => (h("gov-attachments-item", { "accessible-remove-labelledby": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, item.file.name, h("span", { slot: "name" }, item.file.name), item.acceptValid === false ? (h("gov-form-message", { slot: "message", color: "error" }, h("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (h("gov-form-message", { slot: "message", color: "error" }, h("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, h("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
242
266
  }
243
267
  onRemoveFileHandler(file) {
244
268
  const index = this.files.findIndex(item => item.id === file.id);
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-file.entry.js","sources":["../../../packages/core/src/components/gov-form/file/constants.ts","../../../packages/core/src/utils/file.utils.ts","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tinput: 'gov-form-file__input',\n\tinputFocus: 'gov-form-file__input-focus',\n\tattachments: 'gov-form-file__attachments',\n}\n","export function formatBytes(bytes: any): string {\n\tconst units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']\n\tlet l = 0,\n\t\tn = parseInt(bytes, 10) || 0\n\n\twhile (n >= 1024 && ++l) {\n\t\tn = n / 1024\n\t}\n\n\treturn n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]\n}\n\nexport function fileAcceptValidation(file: File, accept: string): boolean {\n\tif (typeof accept === 'string' && accept.length) {\n\t\treturn (\n\t\t\taccept\n\t\t\t\t.replace(/\\s/g, '')\n\t\t\t\t.split(',')\n\t\t\t\t.filter(accept => {\n\t\t\t\t\treturn new RegExp(accept.replace('*', '.*')).test(file.type)\n\t\t\t\t}).length > 0\n\t\t)\n\t} else {\n\t\treturn true\n\t}\n}\n\nexport function fileSizeValidation(file: File, maxSize: number): boolean {\n\tconst fileSize = Math.round(file.size)\n\treturn fileSize <= maxSize\n}\n","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"],"names":[],"mappings":";;;;;;;;;;;;;AAAO,MAAM,aAAa,GAAG;AAC5B,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,IAAI,EAAE,qBAAqB;AAC3B,IAAA,KAAK,EAAE,sBAAsB;AAC7B,IAAA,UAAU,EAAE,4BAA4B;AACxC,IAAA,WAAW,EAAE,4BAA4B;C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C,oBAAoB,EAAE;AAC3B,YAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;gBACvB,SAAS,EAAE,aAAa,CAAC,IAAI;AAC7B,gBAAA,IAAI,EAAE,UAAU;AAChB,aAAA,CAAC;AACF,YAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAClB,SAAS,EAAE,aAAa,CAAC,IAAI;gBAC7B,KAAK;AACL,aAAA,CAAC;;;AAII,IAAA,cAAc,CAAC,CAAa,EAAA;QACnC,CAAC,CAAC,eAAe,EAAE;AACnB,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YAClB,SAAS,EAAE,aAAa,CAAC,IAAI;AAC7B,YAAA,aAAa,EAAE,CAAC;AAChB,SAAA,CAAC;;AAGK,IAAA,aAAa,CAAC,CAAa,EAAA;QAClC,CAAC,CAAC,eAAe,EAAE;AACnB,QAAA,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YACjB,SAAS,EAAE,aAAa,CAAC,IAAI;AAC7B,YAAA,aAAa,EAAE,CAAC;AAChB,SAAA,CAAC;;AAGK,IAAA,eAAe,CAAC,CAAQ,EAAA;QAC/B,CAAC,CAAC,eAAe,EAAE;;AAGpB;;AAEG;AAEH,IAAA,MAAM,MAAM,GAAA;QACX,OAAO,IAAI,CAAC,QAAQ;;AAGrB;;AAEG;AAEH,IAAA,MAAM,UAAU,GAAA;QACf,OAAO,IAAI,CAAC,OAAO;;AAGpB;;AAEG;AAEH,IAAA,MAAM,KAAK,GAAA;AACV,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE;AACf,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;AAClB,YAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE;YACxB,IAAI,CAAC,oBAAoB,EAAE;;;;;;;;;;;;"}
1
+ {"version":3,"file":"gov-form-file.entry.js","sources":["../../../packages/core/src/components/gov-form/file/constants.ts","../../../packages/core/src/utils/file.utils.ts","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tinput: 'gov-form-file__input',\n\tinputFocus: 'gov-form-file__input-focus',\n\tattachments: 'gov-form-file__attachments',\n}\n","export function formatBytes(bytes: any): string {\n\tconst units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']\n\tlet l = 0,\n\t\tn = parseInt(bytes, 10) || 0\n\n\twhile (n >= 1024 && ++l) {\n\t\tn = n / 1024\n\t}\n\n\treturn n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]\n}\n\n// Validates a file against an `accept` attribute value, following the HTML spec\n// (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept):\n// - \".ext\" → matched against the file NAME suffix (case-insensitive)\n// - \"type/*\" → matched against the file MIME group\n// - \"type/sub\" → exact MIME match\n// Matching the name (not only file.type) is essential: browsers often report an\n// empty or non-standard MIME for extensions like .jsonld, which the previous\n// MIME-only RegExp check always rejected.\nexport function fileAcceptValidation(file: File, accept: string): boolean {\n\tif (typeof accept !== 'string' || accept.trim().length === 0) {\n\t\treturn true\n\t}\n\tconst fileName = file.name.toLowerCase()\n\tconst fileType = (file.type || '').toLowerCase()\n\treturn accept\n\t\t.split(',')\n\t\t.map(token => token.trim().toLowerCase())\n\t\t.filter(token => token.length > 0)\n\t\t.some(token => {\n\t\t\tif (token.startsWith('.')) {\n\t\t\t\treturn fileName.endsWith(token)\n\t\t\t}\n\t\t\tif (token === '*' || token === '*/*') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (token.endsWith('/*')) {\n\t\t\t\tconst group = token.slice(0, token.indexOf('/') + 1)\n\t\t\t\treturn fileType.startsWith(group)\n\t\t\t}\n\t\t\treturn fileType === token\n\t\t})\n}\n\nexport function fileSizeValidation(file: File, maxSize: number): boolean {\n\tconst fileSize = Math.round(file.size)\n\treturn fileSize <= maxSize\n}\n","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\t// Without `multiple`, only a single file is allowed. An incoming batch\n\t\t// (drag-drop, framework wrapper, programmatic assignment) can still carry\n\t\t// several files, so cap it to the last one — consistent with the\n\t\t// \"second pick replaces the first\" semantics. (Bug #30570313)\n\t\tconst incoming = this.multiple ? Array.from(files) : Array.from(files).slice(-1)\n\t\tif (!this.multiple && this.displayAttachments) {\n\t\t\tthis.files = []\n\t\t}\n\t\tincoming.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"],"names":[],"mappings":";;;;;;;;;;;;;AAAO,MAAM,aAAa,GAAG;AAC5B,IAAA,IAAI,EAAE,eAAe;AACrB,IAAA,IAAI,EAAE,qBAAqB;AAC3B,IAAA,KAAK,EAAE,sBAAsB;AAC7B,IAAA,UAAU,EAAE,4BAA4B;AACxC,IAAA,WAAW,EAAE,4BAA4B;CACzC;;ACNK,SAAU,WAAW,CAAC,KAAU,EAAA;IACrC,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE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AC,IAAI;AAC7B,YAAA,aAAa,EAAE,CAAC;AAChB,SAAA,CAAC;;AAGK,IAAA,eAAe,CAAC,CAAQ,EAAA;QAC/B,CAAC,CAAC,eAAe,EAAE;;AAGpB;;AAEG;AAEH,IAAA,MAAM,MAAM,GAAA;QACX,OAAO,IAAI,CAAC,QAAQ;;AAGrB;;AAEG;AAEH,IAAA,MAAM,UAAU,GAAA;QACf,OAAO,IAAI,CAAC,OAAO;;AAGpB;;AAEG;AAEH,IAAA,MAAM,KAAK,GAAA;AACV,QAAA,IAAI,CAAC,KAAK,GAAG,EAAE;AACf,QAAA,IAAI,IAAI,CAAC,QAAQ,EAAE;AAClB,YAAA,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE;YACxB,IAAI,CAAC,oBAAoB,EAAE;;;;;;;;;;;;"}
@@ -5603,18 +5603,37 @@ function formatBytes(bytes) {
5603
5603
  }
5604
5604
  return n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l];
5605
5605
  }
5606
+ // Validates a file against an `accept` attribute value, following the HTML spec
5607
+ // (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept):
5608
+ // - ".ext" → matched against the file NAME suffix (case-insensitive)
5609
+ // - "type/*" → matched against the file MIME group
5610
+ // - "type/sub" → exact MIME match
5611
+ // Matching the name (not only file.type) is essential: browsers often report an
5612
+ // empty or non-standard MIME for extensions like .jsonld, which the previous
5613
+ // MIME-only RegExp check always rejected.
5606
5614
  function fileAcceptValidation(file, accept) {
5607
- if (typeof accept === 'string' && accept.length) {
5608
- return (accept
5609
- .replace(/\s/g, '')
5610
- .split(',')
5611
- .filter(accept => {
5612
- return new RegExp(accept.replace('*', '.*')).test(file.type);
5613
- }).length > 0);
5614
- }
5615
- else {
5615
+ if (typeof accept !== 'string' || accept.trim().length === 0) {
5616
5616
  return true;
5617
5617
  }
5618
+ const fileName = file.name.toLowerCase();
5619
+ const fileType = (file.type || '').toLowerCase();
5620
+ return accept
5621
+ .split(',')
5622
+ .map(token => token.trim().toLowerCase())
5623
+ .filter(token => token.length > 0)
5624
+ .some(token => {
5625
+ if (token.startsWith('.')) {
5626
+ return fileName.endsWith(token);
5627
+ }
5628
+ if (token === '*' || token === '*/*') {
5629
+ return true;
5630
+ }
5631
+ if (token.endsWith('/*')) {
5632
+ const group = token.slice(0, token.indexOf('/') + 1);
5633
+ return fileType.startsWith(group);
5634
+ }
5635
+ return fileType === token;
5636
+ });
5618
5637
  }
5619
5638
  function fileSizeValidation(file, maxSize) {
5620
5639
  const fileSize = Math.round(file.size);
@@ -5735,10 +5754,15 @@ class GovFormFile {
5735
5754
  }
5736
5755
  validateFiles(files) {
5737
5756
  let filesBuffer = [];
5757
+ // Without `multiple`, only a single file is allowed. An incoming batch
5758
+ // (drag-drop, framework wrapper, programmatic assignment) can still carry
5759
+ // several files, so cap it to the last one — consistent with the
5760
+ // "second pick replaces the first" semantics. (Bug #30570313)
5761
+ const incoming = this.multiple ? Array.from(files) : Array.from(files).slice(-1);
5738
5762
  if (!this.multiple && this.displayAttachments) {
5739
5763
  this.files = [];
5740
5764
  }
5741
- Array.from(files).forEach(file => {
5765
+ incoming.forEach(file => {
5742
5766
  const isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null;
5743
5767
  if (isFile === null || this.ignoreFileDuplicationCheck) {
5744
5768
  const isSizeValid = typeof this.maxFileSize === "number" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true;
@@ -5814,7 +5838,7 @@ class GovFormFile {
5814
5838
  this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attributeName]: newValue });
5815
5839
  }
5816
5840
  render() {
5817
- return (hAsync(Host, { key: '6709aba5a796ccb9cf712dd5f962d5f903050d26', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, hAsync("div", { key: '668f6959ca55220ed2543dbbeddeb98f1b6c19ba', class: FormFileClass.area, ref: el => (this.areaRef = el) }, hAsync("slot", { key: '5f12f12d074163b525e2200e23f61e6d0fb34c74' }), hAsync("input", Object.assign({ key: '7cf43884dad3c28be956b9897862ff5a1fa22e75', class: FormFileClass.input, ref: el => (this.inputRef = el), id: this.identifier || this.fileId, type: "file", name: this.name, accept: this.accept, multiple: this.multiple, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, disabled: this.disabled }, this.inheritedAttributes, { "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-disabled": toBoolAttrIfDefined(this.disabled) })), hAsync("div", { key: 'ec717f584bcd4d74416821736fb4bdcea517bc83', class: FormFileClass.inputFocus })), this.h.hasSlot("attachments") ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("gov-attachments", { label: this.accessibleAttachmentsLabel, "accessible-label": this.accessibleAttachmentsLabel }, this.files.map(item => (hAsync("gov-attachments-item", { "accessible-remove-labelledby": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, item.file.name, hAsync("span", { slot: "name" }, item.file.name), item.acceptValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, hAsync("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
5841
+ return (hAsync(Host, { key: '2d89af24db1447bba2c7987946b5c63bff65a58a', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, hAsync("div", { key: '7a37869f8ef203b0f1d6b07cfee8e4f325fe9ecc', class: FormFileClass.area, ref: el => (this.areaRef = el) }, hAsync("slot", { key: '10344be7bedf53a4754c8e79bb069c57291b7663' }), hAsync("input", Object.assign({ key: '52dc1692d0eaa6310c0166faceb5906627aac73c', class: FormFileClass.input, ref: el => (this.inputRef = el), id: this.identifier || this.fileId, type: "file", name: this.name, accept: this.accept, multiple: this.multiple, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, disabled: this.disabled }, this.inheritedAttributes, { "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-disabled": toBoolAttrIfDefined(this.disabled) })), hAsync("div", { key: '1193c6ef7a57894baab2f14619827c2f51441d08', class: FormFileClass.inputFocus })), this.h.hasSlot("attachments") ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("gov-attachments", { label: this.accessibleAttachmentsLabel, "accessible-label": this.accessibleAttachmentsLabel }, this.files.map(item => (hAsync("gov-attachments-item", { "accessible-remove-labelledby": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, item.file.name, hAsync("span", { slot: "name" }, item.file.name), item.acceptValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, hAsync("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
5818
5842
  }
5819
5843
  onRemoveFileHandler(file) {
5820
5844
  const index = this.files.findIndex(item => item.id === file.id);
@@ -7413,7 +7437,7 @@ var Types;
7413
7437
  const IconClass = {
7414
7438
  root: 'gov-icon'};
7415
7439
 
7416
- const version = "4.6.4";
7440
+ const version = "4.6.5";
7417
7441
 
7418
7442
  const dsVersion = () => {
7419
7443
  return version;
@@ -5601,18 +5601,37 @@ function formatBytes(bytes) {
5601
5601
  }
5602
5602
  return n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l];
5603
5603
  }
5604
+ // Validates a file against an `accept` attribute value, following the HTML spec
5605
+ // (https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept):
5606
+ // - ".ext" → matched against the file NAME suffix (case-insensitive)
5607
+ // - "type/*" → matched against the file MIME group
5608
+ // - "type/sub" → exact MIME match
5609
+ // Matching the name (not only file.type) is essential: browsers often report an
5610
+ // empty or non-standard MIME for extensions like .jsonld, which the previous
5611
+ // MIME-only RegExp check always rejected.
5604
5612
  function fileAcceptValidation(file, accept) {
5605
- if (typeof accept === 'string' && accept.length) {
5606
- return (accept
5607
- .replace(/\s/g, '')
5608
- .split(',')
5609
- .filter(accept => {
5610
- return new RegExp(accept.replace('*', '.*')).test(file.type);
5611
- }).length > 0);
5612
- }
5613
- else {
5613
+ if (typeof accept !== 'string' || accept.trim().length === 0) {
5614
5614
  return true;
5615
5615
  }
5616
+ const fileName = file.name.toLowerCase();
5617
+ const fileType = (file.type || '').toLowerCase();
5618
+ return accept
5619
+ .split(',')
5620
+ .map(token => token.trim().toLowerCase())
5621
+ .filter(token => token.length > 0)
5622
+ .some(token => {
5623
+ if (token.startsWith('.')) {
5624
+ return fileName.endsWith(token);
5625
+ }
5626
+ if (token === '*' || token === '*/*') {
5627
+ return true;
5628
+ }
5629
+ if (token.endsWith('/*')) {
5630
+ const group = token.slice(0, token.indexOf('/') + 1);
5631
+ return fileType.startsWith(group);
5632
+ }
5633
+ return fileType === token;
5634
+ });
5616
5635
  }
5617
5636
  function fileSizeValidation(file, maxSize) {
5618
5637
  const fileSize = Math.round(file.size);
@@ -5733,10 +5752,15 @@ class GovFormFile {
5733
5752
  }
5734
5753
  validateFiles(files) {
5735
5754
  let filesBuffer = [];
5755
+ // Without `multiple`, only a single file is allowed. An incoming batch
5756
+ // (drag-drop, framework wrapper, programmatic assignment) can still carry
5757
+ // several files, so cap it to the last one — consistent with the
5758
+ // "second pick replaces the first" semantics. (Bug #30570313)
5759
+ const incoming = this.multiple ? Array.from(files) : Array.from(files).slice(-1);
5736
5760
  if (!this.multiple && this.displayAttachments) {
5737
5761
  this.files = [];
5738
5762
  }
5739
- Array.from(files).forEach(file => {
5763
+ incoming.forEach(file => {
5740
5764
  const isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null;
5741
5765
  if (isFile === null || this.ignoreFileDuplicationCheck) {
5742
5766
  const isSizeValid = typeof this.maxFileSize === "number" && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true;
@@ -5812,7 +5836,7 @@ class GovFormFile {
5812
5836
  this.inheritedAttributes = Object.assign(Object.assign({}, this.inheritedAttributes), { [attributeName]: newValue });
5813
5837
  }
5814
5838
  render() {
5815
- return (hAsync(Host, { key: '6709aba5a796ccb9cf712dd5f962d5f903050d26', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, hAsync("div", { key: '668f6959ca55220ed2543dbbeddeb98f1b6c19ba', class: FormFileClass.area, ref: el => (this.areaRef = el) }, hAsync("slot", { key: '5f12f12d074163b525e2200e23f61e6d0fb34c74' }), hAsync("input", Object.assign({ key: '7cf43884dad3c28be956b9897862ff5a1fa22e75', class: FormFileClass.input, ref: el => (this.inputRef = el), id: this.identifier || this.fileId, type: "file", name: this.name, accept: this.accept, multiple: this.multiple, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, disabled: this.disabled }, this.inheritedAttributes, { "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-disabled": toBoolAttrIfDefined(this.disabled) })), hAsync("div", { key: 'ec717f584bcd4d74416821736fb4bdcea517bc83', class: FormFileClass.inputFocus })), this.h.hasSlot("attachments") ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("gov-attachments", { label: this.accessibleAttachmentsLabel, "accessible-label": this.accessibleAttachmentsLabel }, this.files.map(item => (hAsync("gov-attachments-item", { "accessible-remove-labelledby": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, item.file.name, hAsync("span", { slot: "name" }, item.file.name), item.acceptValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, hAsync("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
5839
+ return (hAsync(Host, { key: '2d89af24db1447bba2c7987946b5c63bff65a58a', class: this.h.classes([FormFileClass.root]), invalid: toBoolAttrIfDefined(this.invalid), expanded: toBoolAttrIfDefined(this.expanded) }, hAsync("div", { key: '7a37869f8ef203b0f1d6b07cfee8e4f325fe9ecc', class: FormFileClass.area, ref: el => (this.areaRef = el) }, hAsync("slot", { key: '10344be7bedf53a4754c8e79bb069c57291b7663' }), hAsync("input", Object.assign({ key: '52dc1692d0eaa6310c0166faceb5906627aac73c', class: FormFileClass.input, ref: el => (this.inputRef = el), id: this.identifier || this.fileId, type: "file", name: this.name, accept: this.accept, multiple: this.multiple, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, disabled: this.disabled }, this.inheritedAttributes, { "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-disabled": toBoolAttrIfDefined(this.disabled) })), hAsync("div", { key: '1193c6ef7a57894baab2f14619827c2f51441d08', class: FormFileClass.inputFocus })), this.h.hasSlot("attachments") ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("slot", { name: "attachments" }))) : null, this.files.length && this.displayAttachments ? (hAsync("div", { class: FormFileClass.attachments }, hAsync("gov-attachments", { label: this.accessibleAttachmentsLabel, "accessible-label": this.accessibleAttachmentsLabel }, this.files.map(item => (hAsync("gov-attachments-item", { "accessible-remove-labelledby": item.id, "on-gov-remove": () => this.onRemoveFileHandler(item) }, item.file.name, hAsync("span", { slot: "name" }, item.file.name), item.acceptValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), item.acceptValid === false ? this.errorAccept : null)) : null, item.sizeValid === false ? (hAsync("gov-form-message", { slot: "message", color: "error" }, hAsync("gov-icon", { slot: "icon", name: "exclamation-triangle-fill", type: "components" }), this.errorSize.replace("{FILE_SIZE}", formatBytes(this.maxFileSize)))) : null, hAsync("span", { slot: "info" }, "(", formatBytes(item.file.size), ")"))))))) : null));
5816
5840
  }
5817
5841
  onRemoveFileHandler(file) {
5818
5842
  const index = this.files.findIndex(item => item.id === file.id);
@@ -7411,7 +7435,7 @@ var Types;
7411
7435
  const IconClass = {
7412
7436
  root: 'gov-icon'};
7413
7437
 
7414
- const version = "4.6.4";
7438
+ const version = "4.6.5";
7415
7439
 
7416
7440
  const dsVersion = () => {
7417
7441
  return version;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gov-design-system-ce/components",
3
3
  "description": "This package includes Gov Design System Web Components and related utilities.",
4
4
  "author": "Zdeněk Vítek",
5
- "version": "4.6.4",
5
+ "version": "4.6.5",
6
6
  "license": "EUPL v1.2 Licensed",
7
7
  "main": "./dist/index.cjs.js",
8
8
  "unpkg": "./dist/core/core.esm.js",
@@ -22,8 +22,8 @@
22
22
  "test": "echo \"Error: no test specified\" && exit 1"
23
23
  },
24
24
  "dependencies": {
25
- "@gov-design-system-ce/icons": "^4.0.0",
26
25
  "@gov-design-system-ce/fonts": "^4.0.0",
26
+ "@gov-design-system-ce/icons": "^4.0.0",
27
27
  "@gov-design-system-ce/styles": "^4.6.4"
28
28
  }
29
29
  }
@@ -1,2 +0,0 @@
1
- import{r as t,c as s,h as i,H as e,g as o}from"./p-ClISz4NF.js";import{c as h}from"./p-vN03FcXN.js";import{g as n,a,t as r}from"./p-CoD1xawt.js";import{g as l}from"./p-B6CqPcY_.js";import{i as c}from"./p-CzXeijOj.js";import{A as f,a as d}from"./p-Bz_RzYFb.js";import"./p-BcQO4NH2.js";import"./p-CQvUntGY.js";import"./p-EeKNA85D.js";import"./p-U40vKHrs.js";import"./p-DYcNEwSZ.js";import"./p-DBXGhafv.js";const p={root:"gov-form-file",area:"gov-form-file__area",input:"gov-form-file__input",inputFocus:"gov-form-file__input-focus",attachments:"gov-form-file__attachments"};function m(t){const s=["bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"];let i=0,e=parseInt(t,10)||0;while(e>=1024&&++i){e=e/1024}return e.toFixed(e<10&&i>0?1:0)+" "+s[i]}function u(t,s){if(typeof s==="string"&&s.length){return s.replace(/\s/g,"").split(",").filter((s=>new RegExp(s.replace("*",".*")).test(t.type))).length>0}else{return true}}function v(t,s){const i=Math.round(t.size);return i<=s}const g=class{constructor(i){t(this,i);this.govFocus=s(this,"gov-focus");this.govBlur=s(this,"gov-blur");this.govFiles=s(this,"gov-files");this.govAddFile=s(this,"gov-add-file");this.govRemoveFile=s(this,"gov-remove-file");this.eventsRegistered=false;this.expanded=false;this.required=false;this.disabled=false;this.resetAfterPick=false;this.ignoreFileDuplicationCheck=false;this.displayAttachments=true;this.multiple=false;this.maxFileSize=-1;this.errorSize="Soubor je větší než povolená velikost {FILE_SIZE}";this.errorAccept="Soubor tohoto typu není povolen";this.accessibleAttachmentsLabel="Přílohy";this.files=[];this.inheritedAttributes={};this.fileId=h("GovInputFile");this.h=n(this.host);this.f=l(this.h)}watchControlAttrs(){this.passControlAttrs()}passControlAttrs(){this.f.passAttrToControl("invalid",a(this.invalid));this.f.passAttrToControl("disabled",a(this.disabled));this.f.passAttrToControl("type","File")}registerListeners(){if(this.eventsRegistered){return}this.eventsRegistered=true;function t(){this.areaRef.classList.add("highlight")}function s(){this.areaRef.classList.remove("highlight")}this.inputRef.addEventListener("change",(t=>{t.preventDefault();t.stopPropagation();const s=t.target.files;if(this.resetAfterPick){if(s.length){this.validateFiles(s)}}else{this.validateFiles(s)}}),false);if(this.expanded){const i=["dragover","dragleave"];const e=["dragenter","dragover","mouseenter"];const o=["dragleave","mouseleave"];i.map((t=>this.inputRef.addEventListener(t,this.preventDefaults.bind(this),false)));e.map((s=>this.inputRef.addEventListener(s,t.bind(this),false)));o.forEach((t=>this.inputRef.addEventListener(t,s.bind(this),false)))}}preventDefaults(t){t.preventDefault();t.stopPropagation()}handleDrop(t){const s=t.dataTransfer;this.validateFiles(s.files)}validateFiles(t){let s=[];if(!this.multiple&&this.displayAttachments){this.files=[]}Array.from(t).forEach((t=>{const i=this.files.find((s=>s.file.name===t.name&&s.file.size===t.size))||null;if(i===null||this.ignoreFileDuplicationCheck){const i=typeof this.maxFileSize==="number"&&this.maxFileSize>0?v(t,this.maxFileSize):true;const e=u(t,this.accept);const o={id:h("GovFormFile"),file:t,acceptValid:e,sizeValid:i};if(this.displayAttachments){this.files=[...this.files,o]}else{s=[...s,o]}this.govAddFile.emit({component:p.root,file:o})}}));if(this.displayAttachments){this.syncNativeInputFiles()}this.govFiles.emit({component:p.root,files:s.length?s:this.files});if(this.resetAfterPick){this.reset().finally()}}syncNativeInputFiles(){if(!this.inputRef||typeof DataTransfer==="undefined"){return}try{const t=new DataTransfer;this.files.filter((t=>t.acceptValid===true&&t.sizeValid===true)).forEach((s=>t.items.add(s.file)));this.inputRef.files=t.files}catch(t){if(typeof process!=="undefined"&&process.env&&"production"!=="production");}}componentDidLoad(){this.attributeObserver=new f(this.host,((t,s)=>{this.onAriaAttributeChange(t,s)}));this.attributeObserver.startObserving(d)}componentWillLoad(){this.f.passAttrToLabel("required",String(this.required));this.passControlAttrs();this.inheritedAttributes=c(this.host)}async componentDidRender(){this.registerListeners()}disconnectedCallback(){var t;(t=this.attributeObserver)===null||t===void 0?void 0:t.stopObserving()}onAriaAttributeChange(t,s){this.host.removeAttribute(t);this.inheritedAttributes=Object.assign(Object.assign({},this.inheritedAttributes),{[t]:s})}render(){return i(e,{key:"6709aba5a796ccb9cf712dd5f962d5f903050d26",class:this.h.classes([p.root]),invalid:r(this.invalid),expanded:r(this.expanded)},i("div",{key:"668f6959ca55220ed2543dbbeddeb98f1b6c19ba",class:p.area,ref:t=>this.areaRef=t},i("slot",{key:"5f12f12d074163b525e2200e23f61e6d0fb34c74"}),i("input",Object.assign({key:"7cf43884dad3c28be956b9897862ff5a1fa22e75",class:p.input,ref:t=>this.inputRef=t,id:this.identifier||this.fileId,type:"file",name:this.name,accept:this.accept,multiple:this.multiple,onChange:this.onChangeHandler.bind(this),onFocus:this.onFocusHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,disabled:this.disabled},this.inheritedAttributes,{"aria-required":r(this.required),"aria-invalid":r(this.invalid),"aria-disabled":r(this.disabled)})),i("div",{key:"ec717f584bcd4d74416821736fb4bdcea517bc83",class:p.inputFocus})),this.h.hasSlot("attachments")?i("div",{class:p.attachments},i("slot",{name:"attachments"})):null,this.files.length&&this.displayAttachments?i("div",{class:p.attachments},i("gov-attachments",{label:this.accessibleAttachmentsLabel,"accessible-label":this.accessibleAttachmentsLabel},this.files.map((t=>i("gov-attachments-item",{"accessible-remove-labelledby":t.id,"on-gov-remove":()=>this.onRemoveFileHandler(t)},t.file.name,i("span",{slot:"name"},t.file.name),t.acceptValid===false?i("gov-form-message",{slot:"message",color:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill",type:"components"}),t.acceptValid===false?this.errorAccept:null):null,t.sizeValid===false?i("gov-form-message",{slot:"message",color:"error"},i("gov-icon",{slot:"icon",name:"exclamation-triangle-fill",type:"components"}),this.errorSize.replace("{FILE_SIZE}",m(this.maxFileSize))):null,i("span",{slot:"info"},"(",m(t.file.size),")")))))):null)}onRemoveFileHandler(t){const s=this.files.findIndex((s=>s.id===t.id));if(s!==-1){const t=this.files;const i=this.files[s];t.splice(s,1);this.files=[...t];this.syncNativeInputFiles();this.govRemoveFile.emit({component:p.root,file:i});this.govFiles.emit({component:p.root,files:t})}}onFocusHandler(t){t.stopPropagation();this.govFocus.emit({component:p.root,originalEvent:t})}onBlurHandler(t){t.stopPropagation();this.govBlur.emit({component:p.root,originalEvent:t})}onChangeHandler(t){t.stopPropagation()}async getRef(){return this.inputRef}async getAreaRef(){return this.areaRef}async reset(){this.files=[];if(this.inputRef){this.inputRef.value="";this.syncNativeInputFiles()}}get host(){return o(this)}static get watchers(){return{disabled:["watchControlAttrs"],invalid:["watchControlAttrs"]}}};export{g as gov_form_file};
2
- //# sourceMappingURL=p-afe254cb.entry.js.map