@gov-design-system-ce/components 0.0.17 → 0.0.19

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 (317) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/gov-accordion-item.cjs.entry.js +16 -4
  3. package/dist/cjs/gov-accordion-item.cjs.entry.js.map +1 -1
  4. package/dist/cjs/gov-accordion.cjs.entry.js +5 -3
  5. package/dist/cjs/gov-accordion.cjs.entry.js.map +1 -1
  6. package/dist/cjs/gov-app.cjs.entry.js +11 -8
  7. package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
  8. package/dist/cjs/gov-backdrop.cjs.entry.js +0 -4
  9. package/dist/cjs/gov-backdrop.cjs.entry.js.map +1 -1
  10. package/dist/cjs/gov-button.cjs.entry.js +28 -14
  11. package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
  12. package/dist/cjs/gov-form-autocomplete.cjs.entry.js +33 -14
  13. package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
  14. package/dist/cjs/gov-form-checkbox.cjs.entry.js +29 -15
  15. package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
  16. package/dist/cjs/gov-form-control.cjs.entry.js +1 -1
  17. package/dist/cjs/gov-form-control.cjs.entry.js.map +1 -1
  18. package/dist/cjs/gov-form-file.cjs.entry.js +57 -27
  19. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  20. package/dist/cjs/gov-form-input.cjs.entry.js +22 -6
  21. package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
  22. package/dist/cjs/gov-form-label.cjs.entry.js +1 -1
  23. package/dist/cjs/gov-form-label.cjs.entry.js.map +1 -1
  24. package/dist/cjs/gov-form-multi-select.cjs.entry.js +31 -20
  25. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  26. package/dist/cjs/gov-form-radio.cjs.entry.js +27 -13
  27. package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
  28. package/dist/cjs/gov-form-select.cjs.entry.js +28 -16
  29. package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
  30. package/dist/cjs/gov-form-switch.cjs.entry.js +26 -12
  31. package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
  32. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  33. package/dist/cjs/gov-layout-column.cjs.entry.js +1 -1
  34. package/dist/cjs/gov-layout-column.cjs.entry.js.map +1 -1
  35. package/dist/cjs/gov-loading.cjs.entry.js +1 -1
  36. package/dist/cjs/gov-loading.cjs.entry.js.map +1 -1
  37. package/dist/cjs/gov-modal.cjs.entry.js +1 -1
  38. package/dist/cjs/gov-modal.cjs.entry.js.map +1 -1
  39. package/dist/cjs/gov-pagination.cjs.entry.js +18 -10
  40. package/dist/cjs/gov-pagination.cjs.entry.js.map +1 -1
  41. package/dist/cjs/gov-prompt.cjs.entry.js +8 -8
  42. package/dist/cjs/gov-prompt.cjs.entry.js.map +1 -1
  43. package/dist/cjs/gov-tile.cjs.entry.js.map +1 -1
  44. package/dist/cjs/loader.cjs.js +1 -1
  45. package/dist/collection/components/gov-accordion/gov-accordion-item.js +23 -11
  46. package/dist/collection/components/gov-accordion/gov-accordion-item.js.map +1 -1
  47. package/dist/collection/components/gov-accordion/gov-accordion.js +9 -7
  48. package/dist/collection/components/gov-accordion/gov-accordion.js.map +1 -1
  49. package/dist/collection/components/gov-accordion/gov-accordion.types.js +2 -0
  50. package/dist/collection/components/gov-accordion/gov-accordion.types.js.map +1 -0
  51. package/dist/collection/components/gov-backdrop/gov-backdrop.js +0 -22
  52. package/dist/collection/components/gov-backdrop/gov-backdrop.js.map +1 -1
  53. package/dist/collection/components/gov-button/gov-button.css +14 -11
  54. package/dist/collection/components/gov-button/gov-button.js +54 -37
  55. package/dist/collection/components/gov-button/gov-button.js.map +1 -1
  56. package/dist/collection/components/gov-button/gov-button.types.js +2 -0
  57. package/dist/collection/components/gov-button/gov-button.types.js.map +1 -0
  58. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +60 -38
  59. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
  60. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.types.js.map +1 -1
  61. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.css +1 -0
  62. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +61 -33
  63. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
  64. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.types.js +2 -0
  65. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.types.js.map +1 -0
  66. package/dist/collection/components/gov-form/control/gov-form-control.css +2 -2
  67. package/dist/collection/components/gov-form/file/gov-form-file.js +129 -59
  68. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  69. package/dist/collection/components/gov-form/file/gov-form-file.types.js.map +1 -1
  70. package/dist/collection/components/gov-form/input/gov-form-input.css +1 -0
  71. package/dist/collection/components/gov-form/input/gov-form-input.js +42 -22
  72. package/dist/collection/components/gov-form/input/gov-form-input.js.map +1 -1
  73. package/dist/collection/components/gov-form/input/gov-form-input.types.js +2 -0
  74. package/dist/collection/components/gov-form/input/gov-form-input.types.js.map +1 -0
  75. package/dist/collection/components/gov-form/label/gov-form-label.css +0 -35
  76. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.css +1 -0
  77. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +53 -40
  78. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
  79. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.types.js +2 -0
  80. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.types.js.map +1 -0
  81. package/dist/collection/components/gov-form/radio/gov-form-radio.css +1 -0
  82. package/dist/collection/components/gov-form/radio/gov-form-radio.js +59 -31
  83. package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
  84. package/dist/collection/components/gov-form/radio/gov-form-radio.types.js +2 -0
  85. package/dist/collection/components/gov-form/radio/gov-form-radio.types.js.map +1 -0
  86. package/dist/collection/components/gov-form/select/gov-form-select.css +1 -0
  87. package/dist/collection/components/gov-form/select/gov-form-select.js +56 -37
  88. package/dist/collection/components/gov-form/select/gov-form-select.js.map +1 -1
  89. package/dist/collection/components/gov-form/select/gov-form-select.types.js +2 -0
  90. package/dist/collection/components/gov-form/select/gov-form-select.types.js.map +1 -0
  91. package/dist/collection/components/gov-form/switch/gov-form-switch.js +59 -31
  92. package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
  93. package/dist/collection/components/gov-form/switch/gov-form-switch.types.js +2 -0
  94. package/dist/collection/components/gov-form/switch/gov-form-switch.types.js.map +1 -0
  95. package/dist/collection/components/gov-icon/list.js +3 -0
  96. package/dist/collection/components/gov-icon/list.js.map +1 -1
  97. package/dist/collection/components/gov-layout/gov-layout-column.css +1 -0
  98. package/dist/collection/components/gov-loading/loading/gov-loading.js +1 -1
  99. package/dist/collection/components/gov-loading/loading/gov-loading.js.map +1 -1
  100. package/dist/collection/components/gov-modal/gov-modal.js +1 -1
  101. package/dist/collection/components/gov-modal/gov-modal.js.map +1 -1
  102. package/dist/collection/components/gov-pagination/gov-pagination.js +16 -13
  103. package/dist/collection/components/gov-pagination/gov-pagination.js.map +1 -1
  104. package/dist/collection/components/gov-pagination/gov-pagination.types.js +2 -0
  105. package/dist/collection/components/gov-pagination/gov-pagination.types.js.map +1 -0
  106. package/dist/collection/components/gov-promp/gov-prompt.js +18 -18
  107. package/dist/collection/components/gov-promp/gov-prompt.js.map +1 -1
  108. package/dist/collection/components/gov-tile/gov-tile.js.map +1 -1
  109. package/dist/collection/pages/Forms.js +3 -0
  110. package/dist/collection/pages/Forms.js.map +1 -1
  111. package/dist/collection/pages/Pagination.js +8 -8
  112. package/dist/collection/pages/Pagination.js.map +1 -1
  113. package/dist/collection/types/event.types.js +2 -0
  114. package/dist/collection/types/event.types.js.map +1 -0
  115. package/dist/collection/utils/array.utils.js +6 -1
  116. package/dist/collection/utils/array.utils.js.map +1 -1
  117. package/dist/components/gov-accordion-item.js +19 -7
  118. package/dist/components/gov-accordion-item.js.map +1 -1
  119. package/dist/components/gov-accordion.js +5 -3
  120. package/dist/components/gov-accordion.js.map +1 -1
  121. package/dist/components/gov-app.js +11 -8
  122. package/dist/components/gov-app.js.map +1 -1
  123. package/dist/components/gov-backdrop2.js +0 -5
  124. package/dist/components/gov-backdrop2.js.map +1 -1
  125. package/dist/components/gov-button2.js +28 -14
  126. package/dist/components/gov-button2.js.map +1 -1
  127. package/dist/components/gov-form-autocomplete2.js +33 -14
  128. package/dist/components/gov-form-autocomplete2.js.map +1 -1
  129. package/dist/components/gov-form-checkbox.js +30 -16
  130. package/dist/components/gov-form-checkbox.js.map +1 -1
  131. package/dist/components/gov-form-control.js +1 -1
  132. package/dist/components/gov-form-control.js.map +1 -1
  133. package/dist/components/gov-form-file.js +59 -27
  134. package/dist/components/gov-form-file.js.map +1 -1
  135. package/dist/components/gov-form-input2.js +23 -7
  136. package/dist/components/gov-form-input2.js.map +1 -1
  137. package/dist/components/gov-form-label.js +1 -1
  138. package/dist/components/gov-form-label.js.map +1 -1
  139. package/dist/components/gov-form-multi-select.js +31 -20
  140. package/dist/components/gov-form-multi-select.js.map +1 -1
  141. package/dist/components/gov-form-radio.js +28 -14
  142. package/dist/components/gov-form-radio.js.map +1 -1
  143. package/dist/components/gov-form-select2.js +29 -17
  144. package/dist/components/gov-form-select2.js.map +1 -1
  145. package/dist/components/gov-form-switch.js +27 -13
  146. package/dist/components/gov-form-switch.js.map +1 -1
  147. package/dist/components/gov-icon2.js +1 -1
  148. package/dist/components/gov-layout-column.js +1 -1
  149. package/dist/components/gov-layout-column.js.map +1 -1
  150. package/dist/components/gov-loading.js +1 -1
  151. package/dist/components/gov-loading.js.map +1 -1
  152. package/dist/components/gov-modal.js +1 -1
  153. package/dist/components/gov-modal.js.map +1 -1
  154. package/dist/components/gov-pagination.js +18 -10
  155. package/dist/components/gov-pagination.js.map +1 -1
  156. package/dist/components/gov-prompt.js +8 -8
  157. package/dist/components/gov-prompt.js.map +1 -1
  158. package/dist/components/gov-tile.js.map +1 -1
  159. package/dist/core/core.esm.js +1 -1
  160. package/dist/core/core.esm.js.map +1 -1
  161. package/dist/core/p-07a2c755.entry.js +2 -0
  162. package/dist/core/p-07a2c755.entry.js.map +1 -0
  163. package/dist/core/p-26260897.entry.js +2 -0
  164. package/dist/core/p-26260897.entry.js.map +1 -0
  165. package/dist/core/{p-a37ef1b2.entry.js → p-299f3d3c.entry.js} +2 -2
  166. package/dist/core/{p-30b162df.entry.js → p-354c6a6d.entry.js} +2 -2
  167. package/dist/core/p-354c6a6d.entry.js.map +1 -0
  168. package/dist/core/p-3ad9cc54.entry.js +2 -0
  169. package/dist/core/p-3ad9cc54.entry.js.map +1 -0
  170. package/dist/core/{p-7bfa06b1.entry.js → p-50e94566.entry.js} +2 -2
  171. package/dist/core/p-50e94566.entry.js.map +1 -0
  172. package/dist/core/p-5176fad8.entry.js +2 -0
  173. package/dist/core/p-5176fad8.entry.js.map +1 -0
  174. package/dist/core/p-52f2f67c.entry.js +2 -0
  175. package/dist/core/p-52f2f67c.entry.js.map +1 -0
  176. package/dist/core/{p-e3141382.entry.js → p-5e5e925d.entry.js} +2 -2
  177. package/dist/core/p-5e5e925d.entry.js.map +1 -0
  178. package/dist/core/p-67006730.entry.js.map +1 -1
  179. package/dist/core/p-724921e7.entry.js +2 -0
  180. package/dist/core/p-724921e7.entry.js.map +1 -0
  181. package/dist/core/p-85404e69.entry.js +2 -0
  182. package/dist/core/p-85404e69.entry.js.map +1 -0
  183. package/dist/core/p-8bb1ad43.entry.js +2 -0
  184. package/dist/core/p-8bb1ad43.entry.js.map +1 -0
  185. package/dist/core/p-96a59983.entry.js +2 -0
  186. package/dist/core/p-96a59983.entry.js.map +1 -0
  187. package/dist/core/p-a929f64e.entry.js +2 -0
  188. package/dist/core/p-a929f64e.entry.js.map +1 -0
  189. package/dist/core/{p-bce96aac.entry.js → p-b2d1dd2a.entry.js} +2 -2
  190. package/dist/core/p-b2d1dd2a.entry.js.map +1 -0
  191. package/dist/core/{p-b7587525.entry.js → p-bb3afae6.entry.js} +2 -2
  192. package/dist/core/p-bb3afae6.entry.js.map +1 -0
  193. package/dist/core/{p-8815fa81.entry.js → p-d79d0f7a.entry.js} +2 -2
  194. package/dist/core/p-d79d0f7a.entry.js.map +1 -0
  195. package/dist/core/p-d83b4bdc.entry.js +2 -0
  196. package/dist/core/p-d83b4bdc.entry.js.map +1 -0
  197. package/dist/core/p-d8ef1d7a.entry.js +2 -0
  198. package/dist/core/p-d8ef1d7a.entry.js.map +1 -0
  199. package/dist/core/{p-e38e0ad9.entry.js → p-e409d788.entry.js} +2 -2
  200. package/dist/core/p-e409d788.entry.js.map +1 -0
  201. package/dist/core/{p-0272ffa0.entry.js → p-f73d482b.entry.js} +2 -2
  202. package/dist/core/p-f73d482b.entry.js.map +1 -0
  203. package/dist/custom-elements/index.js +1 -1
  204. package/dist/custom-elements/index.js.map +1 -1
  205. package/dist/esm/core.js +1 -1
  206. package/dist/esm/gov-accordion-item.entry.js +17 -5
  207. package/dist/esm/gov-accordion-item.entry.js.map +1 -1
  208. package/dist/esm/gov-accordion.entry.js +5 -3
  209. package/dist/esm/gov-accordion.entry.js.map +1 -1
  210. package/dist/esm/gov-app.entry.js +11 -8
  211. package/dist/esm/gov-app.entry.js.map +1 -1
  212. package/dist/esm/gov-backdrop.entry.js +0 -4
  213. package/dist/esm/gov-backdrop.entry.js.map +1 -1
  214. package/dist/esm/gov-button.entry.js +28 -14
  215. package/dist/esm/gov-button.entry.js.map +1 -1
  216. package/dist/esm/gov-form-autocomplete.entry.js +33 -14
  217. package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
  218. package/dist/esm/gov-form-checkbox.entry.js +29 -15
  219. package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
  220. package/dist/esm/gov-form-control.entry.js +1 -1
  221. package/dist/esm/gov-form-control.entry.js.map +1 -1
  222. package/dist/esm/gov-form-file.entry.js +57 -27
  223. package/dist/esm/gov-form-file.entry.js.map +1 -1
  224. package/dist/esm/gov-form-input.entry.js +22 -6
  225. package/dist/esm/gov-form-input.entry.js.map +1 -1
  226. package/dist/esm/gov-form-label.entry.js +1 -1
  227. package/dist/esm/gov-form-label.entry.js.map +1 -1
  228. package/dist/esm/gov-form-multi-select.entry.js +31 -20
  229. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  230. package/dist/esm/gov-form-radio.entry.js +27 -13
  231. package/dist/esm/gov-form-radio.entry.js.map +1 -1
  232. package/dist/esm/gov-form-select.entry.js +28 -16
  233. package/dist/esm/gov-form-select.entry.js.map +1 -1
  234. package/dist/esm/gov-form-switch.entry.js +26 -12
  235. package/dist/esm/gov-form-switch.entry.js.map +1 -1
  236. package/dist/esm/gov-icon.entry.js +1 -1
  237. package/dist/esm/gov-layout-column.entry.js +1 -1
  238. package/dist/esm/gov-layout-column.entry.js.map +1 -1
  239. package/dist/esm/gov-loading.entry.js +1 -1
  240. package/dist/esm/gov-loading.entry.js.map +1 -1
  241. package/dist/esm/gov-modal.entry.js +1 -1
  242. package/dist/esm/gov-modal.entry.js.map +1 -1
  243. package/dist/esm/gov-pagination.entry.js +18 -10
  244. package/dist/esm/gov-pagination.entry.js.map +1 -1
  245. package/dist/esm/gov-prompt.entry.js +8 -8
  246. package/dist/esm/gov-prompt.entry.js.map +1 -1
  247. package/dist/esm/gov-tile.entry.js.map +1 -1
  248. package/dist/esm/loader.js +1 -1
  249. package/dist/hydrate/index.js +353 -187
  250. package/dist/stencil.config.js +0 -9
  251. package/dist/stencil.config.js.map +1 -1
  252. package/dist/types/components/gov-accordion/gov-accordion-item.d.ts +5 -4
  253. package/dist/types/components/gov-accordion/gov-accordion.d.ts +2 -2
  254. package/dist/types/components/gov-accordion/gov-accordion.types.d.ts +9 -0
  255. package/dist/types/components/gov-backdrop/gov-backdrop.d.ts +0 -4
  256. package/dist/types/components/gov-button/gov-button.d.ts +6 -5
  257. package/dist/types/components/gov-button/gov-button.types.d.ts +4 -0
  258. package/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.d.ts +8 -8
  259. package/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.types.d.ts +6 -0
  260. package/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +10 -7
  261. package/dist/types/components/gov-form/checkbox/gov-form-checkbox.types.d.ts +5 -0
  262. package/dist/types/components/gov-form/file/gov-form-file.d.ts +16 -8
  263. package/dist/types/components/gov-form/file/gov-form-file.types.d.ts +5 -0
  264. package/dist/types/components/gov-form/input/gov-form-input.d.ts +6 -5
  265. package/dist/types/components/gov-form/input/gov-form-input.types.d.ts +4 -0
  266. package/dist/types/components/gov-form/multiselect/gov-form-multi-select.d.ts +6 -6
  267. package/dist/types/components/gov-form/multiselect/gov-form-multi-select.types.d.ts +8 -0
  268. package/dist/types/components/gov-form/radio/gov-form-radio.d.ts +10 -7
  269. package/dist/types/components/gov-form/radio/gov-form-radio.types.d.ts +5 -0
  270. package/dist/types/components/gov-form/select/gov-form-select.d.ts +7 -6
  271. package/dist/types/components/gov-form/select/gov-form-select.types.d.ts +4 -0
  272. package/dist/types/components/gov-form/switch/gov-form-switch.d.ts +10 -7
  273. package/dist/types/components/gov-form/switch/gov-form-switch.types.d.ts +5 -0
  274. package/dist/types/components/gov-pagination/gov-pagination.d.ts +2 -1
  275. package/dist/types/components/gov-pagination/gov-pagination.types.d.ts +5 -0
  276. package/dist/types/components.d.ts +67 -50
  277. package/dist/types/types/event.types.d.ts +4 -0
  278. package/package.json +1 -1
  279. package/dist/collection/components/gov-accordion/gov-accordion-item.d.js +0 -2
  280. package/dist/collection/components/gov-accordion/gov-accordion-item.d.js.map +0 -1
  281. package/dist/collection/components/gov-form/multiselect/interfaces.js +0 -2
  282. package/dist/collection/components/gov-form/multiselect/interfaces.js.map +0 -1
  283. package/dist/core/p-0272ffa0.entry.js.map +0 -1
  284. package/dist/core/p-131c50d1.entry.js +0 -2
  285. package/dist/core/p-131c50d1.entry.js.map +0 -1
  286. package/dist/core/p-2426fa82.entry.js +0 -2
  287. package/dist/core/p-2426fa82.entry.js.map +0 -1
  288. package/dist/core/p-30b162df.entry.js.map +0 -1
  289. package/dist/core/p-337fb136.entry.js +0 -2
  290. package/dist/core/p-337fb136.entry.js.map +0 -1
  291. package/dist/core/p-402c2751.entry.js +0 -2
  292. package/dist/core/p-402c2751.entry.js.map +0 -1
  293. package/dist/core/p-405fc50f.entry.js +0 -2
  294. package/dist/core/p-405fc50f.entry.js.map +0 -1
  295. package/dist/core/p-471c0863.entry.js +0 -2
  296. package/dist/core/p-471c0863.entry.js.map +0 -1
  297. package/dist/core/p-61103476.entry.js +0 -2
  298. package/dist/core/p-61103476.entry.js.map +0 -1
  299. package/dist/core/p-7bfa06b1.entry.js.map +0 -1
  300. package/dist/core/p-81f73a28.entry.js +0 -2
  301. package/dist/core/p-81f73a28.entry.js.map +0 -1
  302. package/dist/core/p-8815fa81.entry.js.map +0 -1
  303. package/dist/core/p-9bdce72b.entry.js +0 -2
  304. package/dist/core/p-9bdce72b.entry.js.map +0 -1
  305. package/dist/core/p-b7587525.entry.js.map +0 -1
  306. package/dist/core/p-bce96aac.entry.js.map +0 -1
  307. package/dist/core/p-c91928ed.entry.js +0 -2
  308. package/dist/core/p-c91928ed.entry.js.map +0 -1
  309. package/dist/core/p-cfb5cd82.entry.js +0 -2
  310. package/dist/core/p-cfb5cd82.entry.js.map +0 -1
  311. package/dist/core/p-d5c2db32.entry.js +0 -2
  312. package/dist/core/p-d5c2db32.entry.js.map +0 -1
  313. package/dist/core/p-e3141382.entry.js.map +0 -1
  314. package/dist/core/p-e38e0ad9.entry.js.map +0 -1
  315. package/dist/types/components/gov-accordion/gov-accordion-item.d.d.ts +0 -4
  316. package/dist/types/components/gov-form/multiselect/interfaces.d.ts +0 -4
  317. /package/dist/core/{p-a37ef1b2.entry.js.map → p-299f3d3c.entry.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"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.scss?tag=gov-form-file","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"names":["FormFileClass","root","area","label","input","list","item","attachments","formatBytes","bytes","units","l","n","parseInt","toFixed","fileAcceptValidation","file","accept","length","replace","split","filter","RegExp","test","type","fileSizeValidation","maxSize","fileSize","Math","round","size","govFormFileCss","GovFormFile","[object Object]","hostRef","this","fileId","createID","h","govHost","host","f","govForm","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","Array","from","isFile","find","name","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","govAddFile","emit","component","govFiles","passAttrToControl","passAttrToLabel","String","required","canValidateWcagOnRender","delay","validateWcag","registerListeners","Host","class","classes","invalid","toBoolAttrIfDefined","ref","el","identifier","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","disabled","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","hasSlot","displayAttachments","wcagAttachmentsLabel","wcag-label","wcag-remove-labelled-by","on-gov-remove","onRemoveFileHandler","wcagRemoveLabel","slot","variant","errorAccept","errorSize","index","findIndex","removeFile","splice","govRemoveFile","govFocus","originalEvent","govBlur","validateWcagRef","validateWcagLabelFor"],"mappings":"8cAAO,MAAMA,EAAgB,CAC5BC,KAAM,gBACNC,KAAM,sBACNC,MAAO,uBACPC,MAAO,uBACPC,KAAM,sBACNC,KAAM,sBACNC,YAAa,uCCPEC,EAAYC,GAC3B,MAAMC,EAAQ,CAAC,QAAS,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,OACzE,IAAIC,EA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C,MACvEsI,EAAqBpG,KAAKgE,YAAchE,KAAKC,OAAQD,KAAK6E,eAAgBhH,EAAcC","sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tlabel: 'gov-form-file__label',\n\tinput: 'gov-form-file__input',\n\tlist: 'gov-form-file__list',\n\titem: 'gov-form-file__item',\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 / 1024)\n\treturn fileSize <= maxSize\n}\n","/*\n * File\n */\n\n$class: \".gov-form-file\";\n\n#{$class} {\n\t@include base();\n\t&__label .gov-form-label__label {\n\t\t@include reset-last-margin();\n\t}\n\t&__input {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\topacity: 0.0001;\n\t\tcursor: pointer;\n\t}\n\t&__attachments {\n\t\tmargin-top: rem-calc(16 0 0);\n\t}\n\t&__item {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\talign-items: center;\n\t}\n\n\t// STATES\n\t@include parameter(\"disabled\") {\n\t\t#{$class} {\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\tpointer-events: none;\n\t\t\t\t* {\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"expanded\") {\n\t\t#{$class} {\n\t\t\t&__area {\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(32) rem-calc(22) rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t\ttransition: background-color $t ease-in-out;\n\t\t\t\twill-change: background-color;\n\t\t\t\t&.highlight {\n\t\t\t\t\tbackground-color: color(\"primary.200\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t\t&__attachments {\n\t\t\t\tmargin: rem-calc(24 0 0);\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"invalid\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t@include parameter(\"expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Host, h, Prop, Event, EventEmitter, Element, Method, State } from \"@stencil/core\"\nimport { createID } from \"../../../utils/string.utils\"\nimport { FormFileClass } from \"./constants\"\nimport { toBoolAttrIfDefined } from \"../../../helpers/Dom/template\"\nimport { validateWcagLabelFor, validateWcagRef } from \"../../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { fileAcceptValidation, fileSizeValidation, formatBytes } from \"../../../utils/file.utils\"\nimport { delay } from \"../../../utils/utils\"\nimport { GovForm } from \"../../../helpers/Dom/form.types\"\nimport { govHost } from \"../../../helpers/Dom/template\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport { GovFormFileEvent, GovFormFileItem } from \"./gov-form-file.types\"\n\n@Component({\n\ttag: \"gov-form-file\",\n\tstyleUrl: \"gov-form-file.scss\",\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\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() readonly disabled: boolean\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 * 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 * Description of the list of attachments\n\t */\n\t@Prop({ attribute: \"attachments-label\" }) readonly attachmentsLabel: string = \"Přílohy\"\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the remove button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-remove-label\" }) readonly wcagRemoveLabel: string = \"Odebrat soubor {FILE_NAME}\"\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({ attribute: \"wcag-attachments-label\" }) readonly wcagAttachmentsLabel: 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\t@State() files: GovFormFileItem[] = []\n\n\tprivate registerListeners() {\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\tthis.validateFiles(files)\n\t\t\t},\n\t\t\tfalse,\n\t\t)\n\t\t//this.inputRef.addEventListener('focus')\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\", \"drop\", \"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\n\t\t\tthis.areaRef.addEventListener(\"drop\", this.handleDrop.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\tArray.from(files).map(file => {\n\t\t\tconst isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null\n\t\t\tif (isFile === null) {\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\tthis.files = [...this.files, newFile]\n\t\t\t\tthis.govAddFile.emit({\n\t\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\t\tfile: newFile,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\tfiles: this.files,\n\t\t})\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToControl(\"type\", \"File\")\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)} 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\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\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\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.wcagAttachmentsLabel} wcag-label={this.wcagAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item wcag-remove-labelled-by={item.id} on-gov-remove={() => this.onRemoveFileHandler(item)}>\n\t\t\t\t\t\t\t\t\t<span class={\"sr-only\"} id={item.id}>\n\t\t\t\t\t\t\t\t\t\t{this.wcagRemoveLabel.replace(\"{FILE_NAME}\", item.file.name)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{item.file.name}\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\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></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\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace(\"{FILE_SIZE}\", formatBytes(this.maxFileSize * 1024))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t<span slot=\"info\">({formatBytes(item.file.size)})</span>\n\t\t\t\t\t\t\t\t</gov-attachments-item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</gov-attachments>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onRemoveFileHandler(file: GovFormFileItem) {\n\t\tconst index = this.files.findIndex(item => item.id === file.id)\n\t\tif (index !== -1) {\n\t\t\tconst files = this.files\n\t\t\tconst removeFile = this.files[index]\n\t\t\tfiles.splice(index, 1)\n\t\t\tthis.files = [...files]\n\t\t\tthis.govRemoveFile.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfile: removeFile,\n\t\t\t})\n\t\t\tthis.govFiles.emit({\n\t\t\t\tcomponent: FormFileClass.root,\n\t\t\t\tfiles,\n\t\t\t})\n\t\t}\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormFileClass.root,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Returns the reference of the native area element\n\t */\n\t@Method()\n\tasync getAreaRef(): Promise<HTMLDivElement> {\n\t\treturn this.areaRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{a as t,r as s,h as i,H as n,g as o}from"./p-4af5e4f4.js";import{i as e}from"./p-c20102ff.js";import{g as a}from"./p-3f37ddb6.js";import"./p-03990da5.js";var r;(function(t){t["BASIC"]="basic";t["COMPLEX"]="complex";t["COLORED"]="colored"})(r||(r={}));const c={root:"gov-icon",holder:"gov-icon__holder"};const h="0.0.17";const l=()=>h;const f={};const p={};const d=t=>t.startsWith("http://")||t.startsWith("https://");const u=(s,i,n)=>{if(d(s)){return`${s}/${n}/${i}.svg?v=${l()}`}return t(`${s}/${n}/${i}.svg`)+`?v=${l()}`};async function g({name:t,type:s}){if(f[t]){return f[t]}if(!p[t]){p[t]=fetch(u(e(),t,s)).then((t=>{if(t.status===200){return t.text()}else{throw new Error("Gov Icon doesn't exists")}}))}const i=await p[t];f[t]=i;return i}const m=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-icon{display:inline-flex}.gov-icon__holder,.gov-icon svg{display:inline-flex;width:100%;height:100%}";const y=class{constructor(t){s(this,t);this.name=null;this.type="basic";this.iconData=undefined;this.visible=false;this.error=false;this.h=a(this.host)}async loadIconPathData(){const{name:t,visible:s,type:i}=this;if(!t||!s){return}try{this.iconData=await g({name:t,type:i})}catch(t){this.error=true}}connectedCallback(){this.waitUntilVisible((async()=>{this.visible=true;await this.loadIconPathData()}))}disconnectedCallback(){if(this.intersectionObserver){this.intersectionObserver.disconnect();this.intersectionObserver=null}}async componentWillLoad(){await this.loadIconPathData()}waitUntilVisible(t){if(typeof window==="undefined"||!window.IntersectionObserver){t();return}this.intersectionObserver=new IntersectionObserver((s=>{s.forEach((s=>{if(s.isIntersecting){this.intersectionObserver.disconnect();this.intersectionObserver=null;t()}}))}),{rootMargin:"50px"});this.intersectionObserver.observe(this.host)}render(){if(this.error){return null}return i(n,{class:this.h.classes(c.root)},i("span",{class:c.holder,innerHTML:this.iconData}))}static get assetsDirs(){return["assets"]}get host(){return o(this)}static get watchers(){return{name:["loadIconPathData"]}}};y.style=m;export{y as gov_icon};
2
- //# sourceMappingURL=p-a37ef1b2.entry.js.map
1
+ import{a as t,r as s,h as i,H as n,g as o}from"./p-4af5e4f4.js";import{i as e}from"./p-c20102ff.js";import{g as a}from"./p-3f37ddb6.js";import"./p-03990da5.js";var r;(function(t){t["BASIC"]="basic";t["COMPLEX"]="complex";t["COLORED"]="colored"})(r||(r={}));const c={root:"gov-icon",holder:"gov-icon__holder"};const h="0.0.19";const l=()=>h;const f={};const p={};const d=t=>t.startsWith("http://")||t.startsWith("https://");const u=(s,i,n)=>{if(d(s)){return`${s}/${n}/${i}.svg?v=${l()}`}return t(`${s}/${n}/${i}.svg`)+`?v=${l()}`};async function g({name:t,type:s}){if(f[t]){return f[t]}if(!p[t]){p[t]=fetch(u(e(),t,s)).then((t=>{if(t.status===200){return t.text()}else{throw new Error("Gov Icon doesn't exists")}}))}const i=await p[t];f[t]=i;return i}const m=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-icon{display:inline-flex}.gov-icon__holder,.gov-icon svg{display:inline-flex;width:100%;height:100%}";const y=class{constructor(t){s(this,t);this.name=null;this.type="basic";this.iconData=undefined;this.visible=false;this.error=false;this.h=a(this.host)}async loadIconPathData(){const{name:t,visible:s,type:i}=this;if(!t||!s){return}try{this.iconData=await g({name:t,type:i})}catch(t){this.error=true}}connectedCallback(){this.waitUntilVisible((async()=>{this.visible=true;await this.loadIconPathData()}))}disconnectedCallback(){if(this.intersectionObserver){this.intersectionObserver.disconnect();this.intersectionObserver=null}}async componentWillLoad(){await this.loadIconPathData()}waitUntilVisible(t){if(typeof window==="undefined"||!window.IntersectionObserver){t();return}this.intersectionObserver=new IntersectionObserver((s=>{s.forEach((s=>{if(s.isIntersecting){this.intersectionObserver.disconnect();this.intersectionObserver=null;t()}}))}),{rootMargin:"50px"});this.intersectionObserver.observe(this.host)}render(){if(this.error){return null}return i(n,{class:this.h.classes(c.root)},i("span",{class:c.holder,innerHTML:this.iconData}))}static get assetsDirs(){return["assets"]}get host(){return o(this)}static get watchers(){return{name:["loadIconPathData"]}}};y.style=m;export{y as gov_icon};
2
+ //# sourceMappingURL=p-299f3d3c.entry.js.map
@@ -1,2 +1,2 @@
1
- import{r as o,h as i,H as n,g as a}from"./p-4af5e4f4.js";import{g as r,p as t}from"./p-3f37ddb6.js";const e={root:"gov-loading",content:"gov-loading__content",icon:"gov-loading__icon"};const s='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-loading{display:none}.gov-loading__content{z-index:101;position:fixed;top:50%;left:50%;display:flex;gap:1rem;flex-direction:column;align-items:center;min-width:9.6875rem;padding:1.5rem;border-radius:0.5rem;background:var(--gov-loading-bg, rgba(var(--gov-color-secondary-400-rgb), 0.8));color:var(--gov-loading-color, var(--gov-color-primary));text-align:center;transform:translate(-50%, -50%)}.gov-loading__icon{width:4rem;height:4rem;line-height:1}.gov-loading[loading=""],.gov-loading[loading=true i],.gov-loading[loading="1"]{display:block}';const g=class{constructor(i){o(this,i);this.loading=false;this.h=r(this.host)}render(){return i(n,{class:this.h.classes(e.root),loading:this.loading},i("div",{class:e.content},i("gov-icon",{class:t([e.icon,"gov-spin-animation"]),name:"loader"}),i("slot",null)),i("gov-backdrop",{visible:this.loading,inverse:true}))}get host(){return a(this)}};g.style=s;export{g as gov_loading};
2
- //# sourceMappingURL=p-30b162df.entry.js.map
1
+ import{r as o,h as i,H as n,g as a}from"./p-4af5e4f4.js";import{g as r,p as t}from"./p-3f37ddb6.js";const e={root:"gov-loading",content:"gov-loading__content",icon:"gov-loading__icon"};const s='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-loading{display:none}.gov-loading__content{z-index:101;position:fixed;top:50%;left:50%;display:flex;gap:1rem;flex-direction:column;align-items:center;min-width:9.6875rem;padding:1.5rem;border-radius:0.5rem;background:var(--gov-loading-bg, rgba(var(--gov-color-secondary-400-rgb), 0.8));color:var(--gov-loading-color, var(--gov-color-primary));text-align:center;transform:translate(-50%, -50%)}.gov-loading__icon{width:4rem;height:4rem;line-height:1}.gov-loading[loading=""],.gov-loading[loading=true i],.gov-loading[loading="1"]{display:block}';const g=class{constructor(i){o(this,i);this.loading=false;this.h=r(this.host)}render(){return i(n,{class:this.h.classes(e.root),loading:this.loading},i("div",{class:e.content},i("gov-icon",{class:t([e.icon,"gov-spin-animation"]),name:"loader"}),i("slot",null)),this.loading?i("gov-backdrop",{inverse:true}):null)}get host(){return a(this)}};g.style=s;export{g as gov_loading};
2
+ //# sourceMappingURL=p-354c6a6d.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-loading/loading/constants.ts","../../../packages/core/src/components/gov-loading/loading/gov-loading.scss?tag=gov-loading","../../../packages/core/src/components/gov-loading/loading/gov-loading.tsx"],"names":["LoadingClass","root","content","icon","govLoadingCss","GovLoading","[object Object]","hostRef","this","h","govHost","host","Host","class","classes","loading","prepareClasses","name","inverse"],"mappings":"oGAAO,MAAMA,EAAe,CAC3BC,KAAM,cACNC,QAAS,uBACTC,KAAM,qBCHP,MAAMC,EAAgB,m4BCSTC,EAAU,MAGtBC,YAAAC,0BAQkB,MAPjBC,KAAKC,EAAIC,EAAQF,KAAKG,MASvBL,SACC,OACCG,EAACG,EAAI,CAACC,MAAOL,KAAKC,EAAEK,QAAQd,EAAaC,MAAOc,QAASP,KAAKO,SAC7DN,EAAA,MAAA,CAAKI,MAAOb,EAAaE,SACxBO,EAAA,WAAA,CAAUI,MAAOG,EAAe,CAAChB,EAAaG,KAAM,uBAAwBc,KAAK,WACjFR,EAAA,OAAA,OAEAD,KAAKO,QAAWN,EAAA,eAAA,CAAcS,QAAS,OAAY","sourcesContent":["export const LoadingClass = {\n\troot: 'gov-loading',\n\tcontent: 'gov-loading__content',\n\ticon: 'gov-loading__icon',\n}\n","/*\n * Loading\n */\n\n$class: \".gov-loading\";\n\n#{$class} {\n\tdisplay: none;\n\t&__content {\n\t\t@include z-index(\"modal\", 1);\n\t\tposition: fixed;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\tmin-width: rem-calc(155);\n\t\tpadding: rem-calc(24);\n\t\tborder-radius: rem-calc(8);\n\t\tbackground: $loading-bg;\n\t\tcolor: $loading-color;\n\t\ttext-align: center;\n\t\ttransform: translate(-50%, -50%);\n\t}\n\t&__icon {\n\t\twidth: rem-calc(64);\n\t\theight: rem-calc(64);\n\t\tline-height: 1;\n\t}\n\n\t// STATES\n\t@include parameter(\"loading\") {\n\t\tdisplay: block;\n\t}\n}\n","import { Component, Element, h, Host, Prop } from '@stencil/core'\nimport { LoadingClass } from './constants'\nimport { govHost, prepareClasses } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-loading',\n\tstyleUrl: 'gov-loading.scss',\n})\nexport class GovLoading {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovLoadingElement\n\t/**\n\t * Determine if loading is active\n\t */\n\t@Prop() loading = false\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(LoadingClass.root)} loading={this.loading}>\n\t\t\t\t<div class={LoadingClass.content}>\n\t\t\t\t\t<gov-icon class={prepareClasses([LoadingClass.icon, 'gov-spin-animation'])} name=\"loader\"></gov-icon>\n\t\t\t\t\t<slot />\n\t\t\t\t</div>\n\t\t\t\t{this.loading ? (<gov-backdrop inverse={true} />) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{r as o,c as i,h as t,H as e,g as r}from"./p-4af5e4f4.js";import{g as n,h as a,i as s,j as l}from"./p-9cd80b05.js";import{c as v}from"./p-24636c53.js";import{g,t as c,c as p}from"./p-3f37ddb6.js";import{v as m}from"./p-26acf964.js";import{c as f}from"./p-c20102ff.js";import{d as u}from"./p-03990da5.js";import{a as d,b as h}from"./p-364b4792.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-ef79904e.js";import"./p-6278531b.js";import"./p-f687452c.js";import"./p-3464136c.js";import"./p-561fa17b.js";const x='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-input{position:relative;display:flex;width:100%;align-items:center}.gov-form-input .element{position:relative;display:flex;flex:1 1 auto}.gov-form-input input,.gov-form-input select,.gov-form-input textarea{width:100%;border:var(--gov-form-input-border-width, 0.0625rem solid var(--gov-color-secondary-700));border-radius:var(--gov-border-radius, 0.1875rem);background-color:var(--gov-form-bg-color, var(--gov-color-neutral-white));color:var(--gov-form-input-color, var(--gov-color-secondary-700));font-family:var(--gov-font-family, "Roboto", sans-serif)}.gov-form-input input:focus,.gov-form-input select:focus,.gov-form-input textarea:focus{outline:none}.gov-form-input input:focus-visible,.gov-form-input select:focus-visible,.gov-form-input textarea:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-form-input input::-moz-placeholder,.gov-form-input select::-moz-placeholder,.gov-form-input textarea::-moz-placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-input input::placeholder,.gov-form-input select::placeholder,.gov-form-input textarea::placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-input textarea{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);padding:0.5rem 0.75rem;resize:none}.gov-form-input *[slot=left-icon],.gov-form-input *[slot=right-icon]{position:absolute;top:50%;display:flex;justify-content:center;color:var(--gov-form-input-icon-color, var(--gov-color-primary));transform:translateY(-50%);pointer-events:none}.gov-form-input *[slot=left-icon]{left:0}.gov-form-input *[slot=right-icon]{right:0}[disabled=""].gov-form-input,[disabled=true i].gov-form-input,[disabled="1"].gov-form-input{pointer-events:none}[disabled=""].gov-form-input input,[disabled=""].gov-form-input select,[disabled=""].gov-form-input textarea,[disabled=true i].gov-form-input input,[disabled=true i].gov-form-input select,[disabled=true i].gov-form-input textarea,[disabled="1"].gov-form-input input,[disabled="1"].gov-form-input select,[disabled="1"].gov-form-input textarea{border-color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600));background:var(--gov-form-input-disabled-bg, var(--gov-color-secondary-300));color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[disabled=""].gov-form-input *[slot=left-icon],[disabled=""].gov-form-input *[slot=right-icon],[disabled=true i].gov-form-input *[slot=left-icon],[disabled=true i].gov-form-input *[slot=right-icon],[disabled="1"].gov-form-input *[slot=left-icon],[disabled="1"].gov-form-input *[slot=right-icon]{color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[invalid=""].gov-form-input input,[invalid=""].gov-form-input select,[invalid=""].gov-form-input textarea,[invalid=true i].gov-form-input input,[invalid=true i].gov-form-input select,[invalid=true i].gov-form-input textarea,[invalid="1"].gov-form-input input,[invalid="1"].gov-form-input select,[invalid="1"].gov-form-input textarea{border-color:var(--gov-form-state-color-error, var(--gov-color-error));color:var(--gov-form-state-color-error, var(--gov-color-error))}[invalid=""].gov-form-input input::-moz-placeholder,[invalid=""].gov-form-input select::-moz-placeholder,[invalid=""].gov-form-input textarea::-moz-placeholder,[invalid=true i].gov-form-input input::-moz-placeholder,[invalid=true i].gov-form-input select::-moz-placeholder,[invalid=true i].gov-form-input textarea::-moz-placeholder,[invalid="1"].gov-form-input input::-moz-placeholder,[invalid="1"].gov-form-input select::-moz-placeholder,[invalid="1"].gov-form-input textarea::-moz-placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-input input::placeholder,[invalid=""].gov-form-input select::placeholder,[invalid=""].gov-form-input textarea::placeholder,[invalid=true i].gov-form-input input::placeholder,[invalid=true i].gov-form-input select::placeholder,[invalid=true i].gov-form-input textarea::placeholder,[invalid="1"].gov-form-input input::placeholder,[invalid="1"].gov-form-input select::placeholder,[invalid="1"].gov-form-input textarea::placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-input *[slot=left-icon],[invalid=""].gov-form-input *[slot=right-icon],[invalid=true i].gov-form-input *[slot=left-icon],[invalid=true i].gov-form-input *[slot=right-icon],[invalid="1"].gov-form-input *[slot=left-icon],[invalid="1"].gov-form-input *[slot=right-icon]{color:var(--gov-form-state-color-error, var(--gov-color-error))}[success=""].gov-form-input *[slot=right-icon],[success=true i].gov-form-input *[slot=right-icon],[success="1"].gov-form-input *[slot=right-icon]{color:var(--gov-form-state-color-success, var(--gov-color-success))}[success=""].gov-form-input *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success=true i].gov-form-input *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success="1"].gov-form-input *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[size=m].gov-form-input{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-input input,[size=m].gov-form-input select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-m-height, 2.5rem);padding:var(--gov-form-input-core-m-padding, 0.4375rem 0.75rem)}[size=m].gov-form-input *[slot=left-icon],[size=m].gov-form-input *[slot=right-icon]{width:var(--gov-form-input-core-m-icon-size, 1rem);height:var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-input *[slot=left-icon]{left:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-input *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=m].gov-form-input *[slot=right-icon]{right:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-input *[slot=right-icon]~input,[size=m].gov-form-input *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=l].gov-form-input{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-input input,[size=l].gov-form-input select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-l-height, 3rem);padding:var(--gov-form-input-core-l-padding, 0.6875rem 0.75rem)}[size=l].gov-form-input *[slot=left-icon],[size=l].gov-form-input *[slot=right-icon]{width:var(--gov-form-input-core-l-icon-size, 1rem);height:var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-input *[slot=left-icon]{left:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-input *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=l].gov-form-input *[slot=right-icon]{right:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-input *[slot=right-icon]~input,[size=l].gov-form-input *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=xl].gov-form-input{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);gap:0.5rem var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-input input,[size=xl].gov-form-input select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);height:var(--gov-form-input-core-xl-height, 3.5rem);padding:var(--gov-form-input-core-xl-padding, 0.9375rem 1rem 0.875rem)}[size=xl].gov-form-input *[slot=left-icon],[size=xl].gov-form-input *[slot=right-icon]{width:var(--gov-form-input-core-xl-icon-size, 1.25rem);height:var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-input *[slot=left-icon]{left:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-input *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-xl-icon-padding, 3rem)}[size=xl].gov-form-input *[slot=right-icon]{right:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-input *[slot=right-icon]~input,[size=xl].gov-form-input *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-xl-icon-padding, 3rem)}.gov-form-input[invalid=""] *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),.gov-form-input[invalid=true i] *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),.gov-form-input[invalid="1"] *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}.gov-form-input[type=reset] input{border-width:0}.gov-form-input[type=reset] input:focus{outline:none}';var z;(function(o){o["INPUT"]="input";o["TEXTAREA"]="textarea"})(z||(z={}));const b=class{constructor(t){o(this,t);this.govFocus=i(this,"gov-focus",7);this.govBlur=i(this,"gov-blur",7);this.govInput=i(this,"gov-input",7);this.govKeyUp=i(this,"gov-keyup",7);this.value=undefined;this.identifier=undefined;this.variant=undefined;this.success=undefined;this.size="m";this.name=undefined;this.multiline=undefined;this.rows=undefined;this.cols=undefined;this.required=false;this.disabled=undefined;this.placeholder=undefined;this.readonly=undefined;this.minlength=undefined;this.maxlength=undefined;this.autocomplete=undefined;this.autocorrect=undefined;this.type=undefined;this.inputType="text";this.role=undefined;this.invalid=undefined;this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagOwns=undefined;this.wcagAutocomplete=undefined;this.wcagExpanded=undefined;this.focused=undefined;this.h=g(this.host);this.inputId=v("GovInput");this.f=n(g(this.host))}validateVariant(o){m(s,o,a.root)}validateSize(o){m(l,o,a.root)}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size);this.f.passAttrToControl("type",this.multiline?z.TEXTAREA:z.INPUT);this.f.passAttrToLabel("required",String(this.required))}async componentDidRender(){if(f()){await u(500);await this.validateWcag()}}render(){const o=this.multiline?z.TEXTAREA:z.INPUT;return t(e,{class:a.root,size:this.size,variant:this.variant,type:this.type},this.h.hasSlot("prefix")&&t("slot",{name:"prefix"}),t("span",{class:"element"},this.h.hasSlot("left-icon")&&t("slot",{name:"left-icon"}),this.h.hasSlot("right-icon")&&!(this.success||this.invalid)&&t("slot",{name:"right-icon"}),this.success&&!this.multiline&&t("gov-icon",{slot:"right-icon",class:"icon-validation",name:"check-lg"}),this.invalid&&!this.multiline&&t("gov-icon",{slot:"right-icon",class:"icon-validation",name:"exclamation-lg"}),t(o,{type:this.inputType,disabled:this.disabled,id:this.identifier||this.inputId,name:this.name,onFocus:this.onFocusHandler.bind(this),onInput:this.onInputHandler.bind(this),onBlur:this.onBlurHandler.bind(this),onKeyUp:this.onKeyUpHandler.bind(this),ref:o=>this.inputRef=o,placeholder:this.placeholder,value:this.value,readonly:c(this.readonly),autocomplete:p(this.autocomplete),autocorrect:p(this.autocorrect),minlength:this.minlength,maxlength:this.maxlength,required:this.required,rows:this.rows,cols:this.cols,role:this.role,"aria-required":c(this.required),"aria-invalid":c(this.invalid),"aria-disabled":c(this.disabled),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-owns":this.wcagOwns,"aria-expanded":c(this.wcagExpanded),"aria-autocomplete":this.wcagAutocomplete})),this.h.hasSlot("sufix")&&t("slot",{name:"sufix"}))}onFocusHandler(o){o.stopPropagation();this.focused=true;this.govFocus.emit({component:a.root,value:this.value,originalEvent:o})}onBlurHandler(o){o.stopPropagation();this.focused=false;this.govBlur.emit({component:a.root,value:this.value,originalEvent:o})}onKeyUpHandler(o){o.stopPropagation();this.govKeyUp.emit({component:a.root,value:this.value,originalEvent:o})}onInputHandler(o){this.value=o.target.value;o.stopPropagation();this.govInput.emit({component:a.root,value:this.value,originalEvent:o})}async setFocus(o){return this.inputRef.focus(o)}async setValue(o){this.value=o}async clearValue(){this.value="";this.inputRef.value=""}async getRef(){return this.inputRef}async validateWcag(){d(this.wcagDescribedBy,"wcag-described-by",a.root);d(this.wcagLabelledBy,"wcag-labelled-by",a.root);d(this.wcagOwns,"wcag-owns",a.root);h(this.identifier||this.inputId,this.wcagLabelledBy,a.root)}get host(){return r(this)}static get watchers(){return{variant:["validateVariant"],size:["validateSize"]}}};b.style=x;export{b as gov_form_input};
2
+ //# sourceMappingURL=p-3ad9cc54.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-form/input/gov-form-input.scss?tag=gov-form-input","../../../packages/core/src/components/gov-form/input/gov-form-input.tsx"],"names":["govFormInputCss","Tags","GovFormInput","[object Object]","hostRef","this","h","govHost","host","inputId","createID","f","govForm","newValue","validateProp","FormInputVariants","FormInputClass","root","FormInputSizes","validateVariant","variant","validateSize","size","passAttrToControl","multiline","TEXTAREA","INPUT","passAttrToLabel","String","required","canValidateWcagOnRender","delay","validateWcag","Tag","Host","class","type","hasSlot","name","success","invalid","slot","inputType","disabled","id","identifier","onFocus","onFocusHandler","bind","onInput","onInputHandler","onBlur","onBlurHandler","onKeyUp","onKeyUpHandler","ref","el","inputRef","placeholder","value","readonly","toBoolAttrIfDefined","autocomplete","toOnOffAttrIfDefined","autocorrect","minlength","maxlength","rows","cols","role","aria-required","aria-invalid","aria-disabled","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-owns","wcagOwns","aria-expanded","wcagExpanded","aria-autocomplete","wcagAutocomplete","e","stopPropagation","focused","govFocus","emit","component","originalEvent","govBlur","govKeyUp","target","govInput","options","focus","validateWcagRef","validateWcagLabelFor"],"mappings":"ygBAAA,MAAMA,EAAkB,i8TCcxB,IAAKC,GAAL,SAAKA,GACJA,EAAA,SAAA,QACAA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,IAIThF,eAAegF,GACtBA,EAAEC,kBACF/E,KAAKsF,SAASJ,KAAK,CAClBC,UAAWxE,EAAeC,KAC1B0C,MAAOtD,KAAKsD,MACZ8B,cAAeN,IAIThF,eAAegF,GACtB9E,KAAKsD,MAASwB,EAAES,OAA4BjC,MAC5CwB,EAAEC,kBACF/E,KAAKwF,SAASN,KAAK,CAClBC,UAAWxE,EAAeC,KAC1B0C,MAAOtD,KAAKsD,MACZ8B,cAAeN,IAQjBhF,eAAe2F,GACd,OAAOzF,KAAKoD,SAASsC,MAAMD,GAO5B3F,eAAewD,GACdtD,KAAKsD,MAAQA,EAOdxD,mBACCE,KAAKsD,MAAQ,GACbtD,KAAKoD,SAASE,MAAQ,GAOvBxD,eACC,OAAOE,KAAKoD,SAObtD,qBACC6F,EAAgB3F,KAAKqE,gBAAiB,oBAAqB1D,EAAeC,MAC1E+E,EAAgB3F,KAAKuE,eAAgB,mBAAoB5D,EAAeC,MACxE+E,EAAgB3F,KAAKyE,SAAU,YAAa9D,EAAeC,MAC3DgF,EAAqB5F,KAAKwC,YAAcxC,KAAKI,QAASJ,KAAKuE,eAAgB5D,EAAeC","sourcesContent":["/*\n * Input\n */\n\n@import \"../input/gov-form-input-core.scss\";\n$class: \".gov-form-input\";\n\n#{$class} {\n\t@extend %form-input-core;\n\n\t// STATES\n\t@include parameter(\"invalid\") {\n\t\t*[slot=\"right-icon\"]:not(.icon-validation):not(.icon-arrow) {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t&[type=\"reset\"] {\n\t\tinput {\n\t\t\tborder-width: 0;\n\t\t\t&:focus {\n\t\t\t\toutline: none;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, Host, h, Prop, Watch, Event, EventEmitter, State, Method } from '@stencil/core'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { FormInputSizes, FormInputSizesType, InputType, Type } from './constants'\nimport { createID } from '../../../utils/string.utils'\nimport { govHost, toBoolAttrIfDefined, toOnOffAttrIfDefined } from '../../../helpers/Dom/template'\nimport { FormInputClass, FormInputVariants, FormInputVariantType } from './constants'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { delay } from '../../../utils/utils'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govForm } from '../../../helpers/Dom/form'\nimport { FormInputEvent } from \"./gov-form-input.types\"\n\nenum Tags {\n\tINPUT = 'input',\n\tTEXTAREA = 'textarea',\n}\n\n@Component({\n\ttag: 'gov-form-input',\n\tstyleUrl: 'gov-form-input.scss',\n})\nexport class GovFormInput {\n\tprivate f: GovForm\n\tprivate h: GovHost\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly inputId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.inputId = createID('GovInput')\n\t\tthis.f = govForm(govHost(this.host))\n\t}\n\n\t@Element() host: HTMLGovFormInputElement\n\t/**\n\t * Value of input\n\t */\n\t@Prop({ reflect: true, mutable: true }) value: string\n\t/**\n\t * Custom input identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Style variation of the form input.\n\t */\n\t@Prop() readonly variant?: FormInputVariantType\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Input’s size.\n\t */\n\t@Prop() readonly size?: FormInputSizesType = 'm'\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Generates a texarea for the possibility of multiple lines\n\t */\n\t@Prop() readonly multiline: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n\t */\n\t@Prop() readonly rows: number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols\n\t */\n\t@Prop() readonly cols: number\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 input component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Text that appears in the form control when it has no value set\n\t */\n\t@Prop() readonly placeholder: string\n\t/**\n\t * The value is not editable\n\t */\n\t@Prop() readonly readonly: boolean\n\t/**\n\t * Minimum length (number of characters) of value\n\t */\n\t@Prop() readonly minlength: number\n\t/**\n\t * Maximum length (number of characters) of value\n\t */\n\t@Prop() readonly maxlength: number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocomplete\n\t */\n\t@Prop() readonly autocomplete: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocorrect\n\t */\n\t@Prop() readonly autocorrect: boolean\n\t/**\n\t * Defineds the visual style of input\n\t */\n\t@Prop() readonly type?: Type\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n\t */\n\t@Prop() readonly inputType: InputType = 'text'\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/input_role\n\t */\n\t@Prop() readonly role: 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 * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-owns' }) readonly wcagOwns: string\n\t/**\n\t * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value.\n\t */\n\t@Prop({ attribute: 'wcag-autocomplete' }) readonly wcagAutocomplete: string\n\t/**\n\t * Attribute is set on an element to indicate if a control is expanded or collapsed\n\t */\n\t@Prop({ attribute: 'wcag-expanded' }) readonly wcagExpanded: boolean\n\t/**\n\t * Emitted when the input has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({ eventName: 'gov-input' }) govInput: EventEmitter<FormInputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({ eventName: 'gov-keyup' }) govKeyUp: EventEmitter<FormInputEvent>\n\t@State() focused: boolean\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormInputVariants, newValue, FormInputClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormInputSizes, newValue, FormInputClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\n\t\tthis.f.passAttrToControl('type', this.multiline ? Tags.TEXTAREA : Tags.INPUT)\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst Tag = this.multiline ? Tags.TEXTAREA : Tags.INPUT\n\n\t\treturn (\n\t\t\t<Host class={FormInputClass.root} size={this.size} variant={this.variant} type={this.type}>\n\t\t\t\t{this.h.hasSlot('prefix') && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t{this.h.hasSlot('left-icon') && <slot name=\"left-icon\" />}\n\n\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\" />}\n\n\t\t\t\t\t{this.success && !this.multiline && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t{this.invalid && !this.multiline && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t<Tag\n\t\t\t\t\t\ttype={this.inputType}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tid={this.identifier || this.inputId}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonInput={this.onInputHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\tonKeyUp={this.onKeyUpHandler.bind(this)}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\treadonly={toBoolAttrIfDefined(this.readonly)}\n\t\t\t\t\t\tautocomplete={toOnOffAttrIfDefined(this.autocomplete)}\n\t\t\t\t\t\tautocorrect={toOnOffAttrIfDefined(this.autocorrect)}\n\t\t\t\t\t\tminlength={this.minlength}\n\t\t\t\t\t\tmaxlength={this.maxlength}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\trows={this.rows}\n\t\t\t\t\t\tcols={this.cols}\n\t\t\t\t\t\trole={this.role}\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\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t\taria-expanded={toBoolAttrIfDefined(this.wcagExpanded)}\n\t\t\t\t\t\taria-autocomplete={this.wcagAutocomplete}\n\t\t\t\t\t/>\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot('sufix') && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onKeyUpHandler(e: KeyboardEvent) {\n\t\te.stopPropagation()\n\t\tthis.govKeyUp.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: InputEvent) {\n\t\tthis.value = (e.target as HTMLInputElement).value\n\t\te.stopPropagation()\n\t\tthis.govInput.emit({\n\t\t\tcomponent: FormInputClass.root,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.inputRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Clears input value\n\t */\n\t@Method()\n\tasync clearValue(): Promise<void> {\n\t\tthis.value = ''\n\t\tthis.inputRef.value = ''\n\t}\n\n\t/**\n\t * Returns an instance of the native html input element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormInputClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormInputClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormInputClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.inputId, this.wcagLabelledBy, FormInputClass.root)\n\t}\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{r as o,h as s,H as t,g as a}from"./p-4af5e4f4.js";import{a as i}from"./p-5defdc5e.js";import{g as r}from"./p-3f37ddb6.js";const n=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-layout-column{position:relative;display:block}";const e=class{constructor(s){o(this,s);this.h=r(this.host)}render(){return s(t,{class:this.h.classes(i.root)},s("slot",null))}get host(){return a(this)}};e.style=n;export{e as gov_layout_column};
2
- //# sourceMappingURL=p-7bfa06b1.entry.js.map
1
+ import{r as o,h as s,H as t,g as a}from"./p-4af5e4f4.js";import{a as i}from"./p-5defdc5e.js";import{g as r}from"./p-3f37ddb6.js";const n=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-layout-column{position:relative;display:block;width:100%}";const e=class{constructor(s){o(this,s);this.h=r(this.host)}render(){return s(t,{class:this.h.classes(i.root)},s("slot",null))}get host(){return a(this)}};e.style=n;export{e as gov_layout_column};
2
+ //# sourceMappingURL=p-50e94566.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-layout/gov-layout-column.scss?tag=gov-layout-column","../../../packages/core/src/components/gov-layout/gov-layout-column.tsx"],"names":["govLayoutColumnCss","GovLayoutColumn","[object Object]","hostRef","this","h","govHost","host","Host","class","classes","LayoutColumnClass","root"],"mappings":"iIAAA,MAAMA,EAAqB,6ZCSdC,EAAe,MAG3BC,YAAAC,aACCC,KAAKC,EAAIC,EAAQF,KAAKG,MAKvBL,SACC,OACCG,EAACG,EAAI,CAACC,MAAOL,KAAKC,EAAEK,QAAQC,EAAkBC,OAC7CP,EAAA,OAAA","sourcesContent":["/*\n * Layout column\n */\n\n$class: \".gov-layout-column\";\n\n#{$class} {\n\tposition: relative;\n\tdisplay: block;\n\twidth: 100%;\n}\n","import { Component, Element, h, Host } from '@stencil/core'\nimport { LayoutColumnClass } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-layout-column',\n\tstyleUrl: 'gov-layout-column.scss',\n})\nexport class GovLayoutColumn {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() readonly host: HTMLGovLayoutColumnElement\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(LayoutColumnClass.root)}>\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{r as o,c as i,h as e,H as a,g as r}from"./p-4af5e4f4.js";import{a as t}from"./p-561fa17b.js";import{v as n}from"./p-26acf964.js";import{A as c,a as d,b as s,c as g}from"./p-a5d69694.js";import{c as v}from"./p-24636c53.js";import{g as m,b as l,t as h}from"./p-3f37ddb6.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-03990da5.js";const p='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-accordion-item{position:relative;display:block;width:100%}.gov-accordion-item__header{display:inline-flex;vertical-align:middle;justify-content:center;align-items:center;border:0;background-color:transparent;text-align:center;text-decoration:none;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;position:relative;display:flex;justify-content:space-between;align-items:center;width:100%;border-radius:0;text-align:left;text-transform:none;transition:background-color 150ms ease-in-out}.gov-accordion-item__header:focus{outline:none}.gov-accordion-item__header:focus{outline:none}.gov-accordion-item__header:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-accordion-item__header::before{content:"";position:absolute;display:block;right:0;bottom:-1px;left:0;height:1px}.gov-accordion-item__header:focus-visible::before{display:none}.gov-accordion-item__header[aria-expanded=""] .gov-accordion-item__arrow,.gov-accordion-item__header[aria-expanded=true i] .gov-accordion-item__arrow,.gov-accordion-item__header[aria-expanded="1"] .gov-accordion-item__arrow{transform:scale(-1)}.gov-accordion-item__arrow{flex:0 0 auto;align-self:center}.gov-accordion-item__icon{display:inline-flex;vertical-align:middle;flex:0 0 auto}.gov-accordion-item__suffix{display:inline-flex;vertical-align:middle;flex:0 0 auto;align-self:start;margin-left:auto;line-height:initial}.gov-accordion-item__title{margin:0;padding:0;font-family:var(--gov-font-family, "Roboto", sans-serif);font-weight:400;box-sizing:border-box;display:flex;flex:1 1 auto;align-items:flex-start}.gov-accordion-item__name{display:flex;flex-direction:column}.gov-accordion-item__annot{color:var(--gov-color-secondary)}.gov-accordion-item__content>*:last-child{margin-bottom:0}.gov-accordion-item[size=xs] .gov-accordion-item__header{gap:var(--gov-accordion-s-headline-gap, 0.5rem);min-height:var(--gov-accordion-s-min-height, 3rem);padding:var(--gov-accordion-s-padding-y, 0.75rem) var(--gov-accordion-s-padding-x, 0.5rem)}.gov-accordion-item[size=xs] .gov-accordion-item__arrow{width:var(--gov-accordion-s-icon-size, 0.75rem);height:var(--gov-accordion-s-icon-size, 0.75rem)}.gov-accordion-item[size=xs] .gov-accordion-item__icon{width:calc(var(--gov-text-m-font-size) * 1.2);height:calc(var(--gov-text-m-font-size) * 1.2);transform:translateY(var(--gov-accordion-s-icon-position, 0.0625rem))}.gov-accordion-item[size=xs] .gov-accordion-item__title{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:var(--gov-accordion-s-headline-gap, 0.5rem)}.gov-accordion-item[size=xs] .gov-accordion-item__annot{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing)}.gov-accordion-item[size=xs] .gov-accordion-item__content{padding:var(--gov-accordion-s-padding-inner, 1rem 0.5rem)}.gov-accordion-item[size=s] .gov-accordion-item__header{gap:var(--gov-accordion-s-headline-gap, 0.5rem);min-height:var(--gov-accordion-s-min-height, 3rem);padding:var(--gov-accordion-s-padding-y, 1.125rem) var(--gov-accordion-s-padding-x, 0.5rem)}.gov-accordion-item[size=s] .gov-accordion-item__arrow{width:var(--gov-accordion-s-icon-size, 0.75rem);height:var(--gov-accordion-s-icon-size, 0.75rem)}.gov-accordion-item[size=s] .gov-accordion-item__icon{width:calc(var(--gov-text-xl-font-size) * 1.2);height:calc(var(--gov-text-xl-font-size) * 1.2);transform:translateY(var(--gov-accordion-s-icon-position, 0.0625rem))}.gov-accordion-item[size=s] .gov-accordion-item__title{font-weight:var(--gov-text-xl-font-weight);font-size:var(--gov-text-xl-font-size);line-height:var(--gov-text-xl-line-height);letter-spacing:var(--gov-text-xl-letter-spacing);gap:var(--gov-accordion-s-headline-gap, 0.5rem)}.gov-accordion-item[size=s] .gov-accordion-item__annot{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing)}.gov-accordion-item[size=s] .gov-accordion-item__content{padding:var(--gov-accordion-s-padding-inner, 1rem 0.5rem)}.gov-accordion-item[size=m] .gov-accordion-item__header{gap:var(--gov-accordion-m-headline-gap, 1rem);min-height:var(--gov-accordion-m-min-height, 4.5rem);padding:var(--gov-accordion-m-padding-y, 1.25rem) var(--gov-accordion-m-padding-x, 0.5rem)}.gov-accordion-item[size=m] .gov-accordion-item__arrow{width:var(--gov-accordion-m-icon-size, 1rem);height:var(--gov-accordion-m-icon-size, 1rem)}.gov-accordion-item[size=m] .gov-accordion-item__icon{width:calc(var(--gov-text-2xl-font-size) * 1.2);height:calc(var(--gov-text-2xl-font-size) * 1.2);transform:translateY(var(--gov-accordion-m-icon-position, 0.125rem))}.gov-accordion-item[size=m] .gov-accordion-item__title{font-weight:var(--gov-text-2xl-font-weight);font-size:var(--gov-text-2xl-font-size);line-height:var(--gov-text-2xl-line-height);letter-spacing:var(--gov-text-2xl-letter-spacing);gap:var(--gov-accordion-m-headline-gap, 1rem)}.gov-accordion-item[size=m] .gov-accordion-item__annot{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing)}.gov-accordion-item[size=m] .gov-accordion-item__content{padding:var(--gov-accordion-m-padding-inner, 1.25rem 0.5rem)}.gov-accordion-item[size=l] .gov-accordion-item__header{gap:var(--gov-accordion-l-headline-gap, 1rem);min-height:var(--gov-accordion-l-min-height, 5.5rem);padding:var(--gov-accordion-l-padding-y, 1.375rem) var(--gov-accordion-l-padding-x, 0.5rem)}.gov-accordion-item[size=l] .gov-accordion-item__arrow{width:var(--gov-accordion-l-icon-size, 1.25rem);height:var(--gov-accordion-l-icon-size, 1.25rem)}.gov-accordion-item[size=l] .gov-accordion-item__icon{width:calc(var(--gov-text-3xl-font-size) * 1.2);height:calc(var(--gov-text-3xl-font-size) * 1.2);transform:translateY(var(--gov-accordion-l-icon-position, 0.125rem))}.gov-accordion-item[size=l] .gov-accordion-item__title{font-weight:var(--gov-text-3xl-font-weight);font-size:var(--gov-text-3xl-font-size);line-height:var(--gov-text-3xl-line-height);letter-spacing:var(--gov-text-3xl-letter-spacing);gap:var(--gov-accordion-l-headline-gap, 1rem)}.gov-accordion-item[size=l] .gov-accordion-item__annot{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing)}.gov-accordion-item[size=l] .gov-accordion-item__content{padding:var(--gov-accordion-l-padding-inner, 1.25rem 0.5rem)}.gov-accordion-item[variant=primary] .gov-accordion-item__header{background-color:var(--gov-accordion-primary-background, transparent);color:var(--gov-accordion-primary-color, var(--gov-color-primary))}.gov-accordion-item[variant=primary] .gov-accordion-item__header::before{background-color:var(--gov-accordion-primary-separator, var(--gov-color-secondary-500))}@media not all and (pointer: coarse){.gov-accordion-item[variant=primary] .gov-accordion-item__header:hover{background-color:var(--gov-accordion-primary-background-hover, var(--gov-color-primary-200))}}.gov-accordion-item[variant=primary][disabled=""] .gov-accordion-item__header,.gov-accordion-item[variant=primary][disabled=true i] .gov-accordion-item__header,.gov-accordion-item[variant=primary][disabled="1"] .gov-accordion-item__header{color:var(--gov-accordion-primary-disabled-color, var(--gov-color-primary-400))}@media not all and (pointer: coarse){.gov-accordion-item[variant=primary][disabled=""] .gov-accordion-item__header:hover,.gov-accordion-item[variant=primary][disabled=true i] .gov-accordion-item__header:hover,.gov-accordion-item[variant=primary][disabled="1"] .gov-accordion-item__header:hover{background:transparent;cursor:not-allowed}}.gov-accordion-item[variant=secondary] .gov-accordion-item__header{background-color:var(--gov-accordion-secondary-background, transparent);color:var(--gov-accordion-secondary-color, var(--gov-color-secondary))}.gov-accordion-item[variant=secondary] .gov-accordion-item__header::before{background-color:var(--gov-accordion-secondary-separator, var(--gov-color-secondary-500))}@media not all and (pointer: coarse){.gov-accordion-item[variant=secondary] .gov-accordion-item__header:hover{background-color:var(--gov-accordion-secondary-background-hover, var(--gov-color-secondary-200))}}.gov-accordion-item[variant=secondary][disabled=""] .gov-accordion-item__header,.gov-accordion-item[variant=secondary][disabled=true i] .gov-accordion-item__header,.gov-accordion-item[variant=secondary][disabled="1"] .gov-accordion-item__header{color:var(--gov-accordion-secondary-disabled-color, var(--gov-color-secondary-600))}@media not all and (pointer: coarse){.gov-accordion-item[variant=secondary][disabled=""] .gov-accordion-item__header:hover,.gov-accordion-item[variant=secondary][disabled=true i] .gov-accordion-item__header:hover,.gov-accordion-item[variant=secondary][disabled="1"] .gov-accordion-item__header:hover{background:transparent;cursor:not-allowed}}@media (max-width: 47.99em){.gov-accordion-item__title{flex-wrap:wrap}.gov-accordion-item__label{flex:0 0 auto}}';const _=class{constructor(e){o(this,e);this.govChange=i(this,"gov-change",7);this.isExpandedState=undefined;this.variant="primary";this.identifier=undefined;this.size=undefined;this.label=undefined;this.annotation=undefined;this.disabled=false;this.isExpanded=false;this.triggerTag="h3";this.noBorder=false;this.h=m(this.host);this.triggerId=v("GovAccordionItem");this.contentId=v("GovAccordionContent")}validateLabel(o){if(!o){t(`[${c.root}]: Parameter label is required.`)}}validateTriggerTag(o){const i=["h1","h2","h3","h4","h5","h6","span"];if(o){if(!i.includes(o)){t(`[${c.root}]: Tag ${o} is not allowed.`)}}}validateSize(o){n(s,o,c.root)}validateVariant(o){n(g,o,c.root)}emmitChange(){this.govChange.emit({open:this.isExpandedState,component:c.root,ref:this.host})}componentWillLoad(){this.isExpandedState=this.isExpanded;this.getPropsFromParents();this.validateLabel(this.label);this.validateTriggerTag(this.triggerTag);this.validateSize(this.size);this.validateVariant(this.variant)}getPropsFromParents(){const o=this.h.getParent(d.root);if(o){this.size=o.getAttribute("size");this.variant=o.getAttribute("variant")}}render(){const o=this.identifier||this.triggerId;const i=this.contentId;const{isExpandedState:r,label:t}=this;const n=this.triggerTag;return e(a,{class:this.h.classes(c.root),"no-border":this.noBorder,size:this.size,variant:this.variant,role:"listitem"},e("button",{id:o,class:c.header,"aria-expanded":l(r),"aria-controls":i,disabled:this.disabled,"aria-disabled":h(this.disabled),onClick:o=>{o.stopPropagation();this.toggle().finally()}},e(n,{class:c.title},this.h.hasSlot("icon")&&e("span",{class:c.icon},e("slot",{name:"icon"})),e("span",{class:c.name},e("span",{class:c.label},t),this.annotation&&e("span",{class:c.annot},this.annotation)),this.h.hasSlot("suffix")&&e("span",{class:c.suffix},e("slot",{name:"suffix"}))),e("gov-icon",{class:c.arrow,name:"chevron-down"})),e("div",{class:c.content,id:i,"aria-hidden":l(!r),hidden:!r,"aria-labelledby":o},e("slot",null)))}async open(){this.isExpandedState=true;this.emmitChange()}async close(){this.isExpandedState=false;this.emmitChange()}async toggle(){this.isExpandedState=!this.isExpandedState;this.emmitChange()}async currentState(){return this.isExpandedState}get host(){return r(this)}static get watchers(){return{label:["validateLabel"],triggerTag:["validateTriggerTag"],size:["validateSize"],variant:["validateVariant"]}}};_.style=p;export{_ as gov_accordion_item};
2
+ //# sourceMappingURL=p-5176fad8.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-accordion/gov-accordion-item.scss?tag=gov-accordion-item","../../../packages/core/src/components/gov-accordion/gov-accordion-item.tsx"],"names":["govAccordionItemCss","GovAccordionItem","[object Object]","hostRef","this","h","govHost","host","triggerId","createID","contentId","newValue","govErrorLog","AccordionItemClass","root","validTags","includes","validateProp","AccordionSizes","AccordionVariants","govChange","emit","open","isExpandedState","component","ref","isExpanded","getPropsFromParents","validateLabel","label","validateTriggerTag","triggerTag","validateSize","size","validateVariant","variant","accordion","getParent","AccordionClass","getAttribute","identifier","TriggerTag","Host","class","classes","no-border","noBorder","role","id","header","aria-expanded","booleanString","aria-controls","disabled","aria-disabled","toBoolAttrIfDefined","onClick","e","stopPropagation","toggle","finally","title","hasSlot","icon","name","annotation","annot","suffix","arrow","content","aria-hidden","hidden","aria-labelledby","emmitChange"],"mappings":"+VAAA,MAAMA,EAAsB,yhTCoBfC,EAAgB,MAK5BC,YAAAC,+FAYwD,qHAqBnB,sBAI8B,sBAID,mBAIH,MA5C9DC,KAAKC,EAAIC,EAAQF,KAAKG,MACtBH,KAAKI,UAAYC,EAAS,oBAC1BL,KAAKM,UAAYD,EAAS,uBAiD3BP,cAAcS,GACb,IAAKA,EAAU,CACdC,EAAY,IAAIC,EAAmBC,wCAKrCZ,mBAAmBS,GAClB,MAAMI,EAAY,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,QACvD,GAAIJ,EAAU,CACb,IAAKI,EAAUC,SAASL,GAAW,CAClCC,EAAY,IAAIC,EAAmBC,cAAcH,uBAMpDT,aAAaS,GACZM,EAAaC,EAAgBP,EAAUE,EAAmBC,MAI3DZ,gBAAgBS,GACfM,EAAaE,EAAmBR,EAAUE,EAAmBC,MAGtDZ,cACPE,KAAKgB,UAAUC,KAAK,CACnBC,KAAMlB,KAAKmB,gBACXC,UAAWX,EAAmBC,KAC9BW,IAAKrB,KAAKG,OAIZL,oBACCE,KAAKmB,gBAAkBnB,KAAKsB,WAC5BtB,KAAKuB,sBAELvB,KAAKwB,cAAcxB,KAAKyB,OACxBzB,KAAK0B,mBAAmB1B,KAAK2B,YAC7B3B,KAAK4B,aAAa5B,KAAK6B,MACvB7B,KAAK8B,gBAAgB9B,KAAK+B,SAI3BjC,sBACC,MAAMkC,EAAYhC,KAAKC,EAAEgC,UAAUC,EAAexB,MAClD,GAAGsB,EAAW,CACbhC,KAAK6B,KAAOG,EAAUG,aAAa,QACnCnC,KAAK+B,QAAUC,EAAUG,aAAa,YAIxCrC,SACC,MAAMM,EAAYJ,KAAKoC,YAAcpC,KAAKI,UAC1C,MAAME,EAAYN,KAAKM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B,KAAKmB,gBAC7BnB,KAAKqE,cAONvE,qBACC,OAAOE,KAAKmB","sourcesContent":["/*\n * Accordion - Item\n */\n\n$class: \".gov-accordion-item\";\n\n#{$class} {\n\t@include base();\n\t&__header {\n\t\t@include button-core();\n\t\t@include focus-outline();\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\talign-items: center;\n\t\twidth: 100%;\n\t\tborder-radius: 0;\n\t\ttext-align: left;\n\t\ttext-transform: none;\n\t\ttransition: background-color $t ease-in-out;\n\t\t&::before {\n\t\t\t@include pseudo();\n\t\t\tright: 0;\n\t\t\tbottom: -1px;\n\t\t\tleft: 0;\n\t\t\theight: 1px;\n\t\t}\n\n\t\t// STATES\n\t\t&:focus-visible {\n\t\t\t&::before {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t\t@include parameter(\"aria-expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__arrow {\n\t\t\t\t\ttransform: scale(-1);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t&__arrow {\n\t\tflex: 0 0 auto;\n\t\talign-self: center;\n\t}\n\t&__icon {\n\t\tdisplay: inline-flex;\n\t\tvertical-align: middle;\n\t\tflex: 0 0 auto;\n\t}\n\t&__suffix {\n\t\tdisplay: inline-flex;\n\t\tvertical-align: middle;\n\t\tflex: 0 0 auto;\n\t\talign-self: start;\n\t\tmargin-left: auto;\n\t\tline-height: initial;\n\t}\n\t&__title {\n\t\t@include general;\n\t\tdisplay: flex;\n\t\tflex: 1 1 auto;\n\t\talign-items: flex-start;\n\t}\n\t&__name {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t}\n\t&__annot {\n\t\tcolor: color(\"secondary\");\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $accordion-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__header {\n\t\t\t\t\tgap: get(\"headline-gap\", $definitions);\n\t\t\t\t\tmin-height: get(\"min-height\", $definitions);\n\t\t\t\t\tpadding: get(\"padding-y\", $definitions) get(\"padding-x\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__arrow {\n\t\t\t\t\twidth: get(\"icon-size\", $definitions);\n\t\t\t\t\theight: get(\"icon-size\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__icon {\n\t\t\t\t\twidth: calc(get-font-size(get(\"font\", $definitions)) * 1.2);\n\t\t\t\t\theight: calc(get-font-size(get(\"font\", $definitions)) * 1.2);\n\t\t\t\t\ttransform: translateY(get(\"icon-position\", $definitions));\n\t\t\t\t}\n\t\t\t\t&__title {\n\t\t\t\t\t@include typography(get(\"font\", $definitions));\n\t\t\t\t\tgap: get(\"headline-gap\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__annot {\n\t\t\t\t\t@include typography(get(\"font-annot\", $definitions));\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tpadding: get(\"padding-inner\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t@each $variant, $definitions in $accordion-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__header {\n\t\t\t\t\tbackground-color: get(\"background\", $definitions);\n\t\t\t\t\tcolor: get(\"color\", $definitions);\n\t\t\t\t\t&::before {\n\t\t\t\t\t\tbackground-color: get(\"separator\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t\t@include hover() {\n\t\t\t\t\t\tbackground-color: get(\"background-hover\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"disabled\") {\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__header {\n\t\t\t\t\t\tcolor: get(\"disabled-color\", $definitions);\n\t\t\t\t\t\t@include hover() {\n\t\t\t\t\t\t\tbackground: transparent;\n\t\t\t\t\t\t\tcursor: not-allowed;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($until: md) {\n\t\t&__title {\n\t\t\tflex-wrap: wrap;\n\t\t}\n\t\t&__label {\n\t\t\tflex: 0 0 auto;\n\t\t\t// max-width: calc(100% - 50px);\n\t\t}\n\t}\n}\n","import { Component, Element, h, Prop, State, Watch, Host, Method, Event, EventEmitter } from \"@stencil/core\"\nimport { govErrorLog } from \"../../helpers/Log/gov.log\"\nimport { validateProp } from \"../../helpers/Validate/props\"\nimport {\n\tAccordionSizeType,\n\tAccordionSizes,\n\tAccordionItemClass,\n\tAccordionVariantType,\n\tAccordionVariants, AccordionClass,\n} from \"./constants\"\nimport { createID } from \"../../utils/string.utils\"\nimport { booleanString, toBoolAttrIfDefined } from \"../../helpers/Dom/template\"\nimport { AccordionItemEvent } from \"./gov-accordion.types\"\nimport { govHost } from \"../../helpers/Dom/template\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\n\n@Component({\n\ttag: \"gov-accordion-item\",\n\tstyleUrl: \"gov-accordion-item.scss\",\n})\nexport class GovAccordionItem {\n\tprivate readonly triggerId: string\n\tprivate readonly contentId: string\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.triggerId = createID(\"GovAccordionItem\")\n\t\tthis.contentId = createID(\"GovAccordionContent\")\n\t}\n\n\t@Element() readonly host: HTMLGovAccordionItemElement\n\t@State() isExpandedState: boolean\n\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop({mutable: true}) variant?: AccordionVariantType = \"primary\"\n\t/**\n\t * Custom accordion item identifier. Otherwise, it will be generated\n\t */\n\t@Prop() readonly identifier: string\n\t/**\n\t * Accordion’s size.\n\t */\n\t@Prop({mutable: true}) size?: AccordionSizeType\n\t/**\n\t * Item name of the accordion\n\t */\n\t@Prop() readonly label: string\n\t/**\n\t * Item annotation of the accordion\n\t */\n\t@Prop() readonly annotation: string\n\t/**\n\t * Makes the button component disabled.\n\t * This prevents users from being able to interact with the button, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Defines whether the accordion is open or closed by default\n\t */\n\t@Prop({ attribute: \"is-expanded\" }) readonly isExpanded: boolean = false\n\t/**\n\t * Used to change the HTML tag in the accordion trigger for correct semantic structure\n\t */\n\t@Prop({ attribute: \"trigger-tag\" }) readonly triggerTag: string = \"h3\"\n\t/**\n\t * To remove the main underline of an item\n\t */\n\t@Prop({ attribute: \"no-border\" }) readonly noBorder: boolean = false\n\t/**\n\t * Called when the accordion state changes\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<AccordionItemEvent>\n\n\t@Watch(\"label\")\n\tvalidateLabel(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${AccordionItemClass.root}]: Parameter label is required.`)\n\t\t}\n\t}\n\n\t@Watch(\"triggerTag\")\n\tvalidateTriggerTag(newValue: string): void {\n\t\tconst validTags = [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"span\"]\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${AccordionItemClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(AccordionSizes, newValue, AccordionItemClass.root)\n\t}\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(AccordionVariants, newValue, AccordionItemClass.root)\n\t}\n\n\tprivate emmitChange(): void {\n\t\tthis.govChange.emit({\n\t\t\topen: this.isExpandedState,\n\t\t\tcomponent: AccordionItemClass.root,\n\t\t\tref: this.host,\n\t\t})\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.isExpandedState = this.isExpanded\n\t\tthis.getPropsFromParents()\n\n\t\tthis.validateLabel(this.label)\n\t\tthis.validateTriggerTag(this.triggerTag)\n\t\tthis.validateSize(this.size)\n\t\tthis.validateVariant(this.variant)\n\n\t}\n\n\tgetPropsFromParents() {\n\t\tconst accordion = this.h.getParent(AccordionClass.root)\n\t\tif(accordion) {\n\t\t\tthis.size = accordion.getAttribute('size') as AccordionSizeType\n\t\t\tthis.variant = accordion.getAttribute('variant') as AccordionVariantType\n\t\t}\n\t}\n\n\trender() {\n\t\tconst triggerId = this.identifier || this.triggerId\n\t\tconst contentId = this.contentId\n\t\tconst { isExpandedState, label } = this\n\t\tconst TriggerTag = this.triggerTag\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(AccordionItemClass.root)} no-border={this.noBorder} size={this.size} variant={this.variant} role=\"listitem\">\n\t\t\t\t<button\n\t\t\t\t\tid={triggerId}\n\t\t\t\t\tclass={AccordionItemClass.header}\n\t\t\t\t\taria-expanded={booleanString(isExpandedState)}\n\t\t\t\t\taria-controls={contentId}\n\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\tonClick={(e: Event) => {\n\t\t\t\t\t\te.stopPropagation()\n\t\t\t\t\t\tthis.toggle().finally()\n\t\t\t\t\t}}>\n\t\t\t\t\t<TriggerTag class={AccordionItemClass.title}>\n\t\t\t\t\t\t{this.h.hasSlot(\"icon\") && (\n\t\t\t\t\t\t\t<span class={AccordionItemClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<span class={AccordionItemClass.name}>\n\t\t\t\t\t\t\t<span class={AccordionItemClass.label}>{label}</span>\n\t\t\t\t\t\t\t{this.annotation && <span class={AccordionItemClass.annot}>{this.annotation}</span>}\n\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t{this.h.hasSlot(\"suffix\") && (\n\t\t\t\t\t\t\t<span class={AccordionItemClass.suffix}>\n\t\t\t\t\t\t\t\t<slot name=\"suffix\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</TriggerTag>\n\n\t\t\t\t\t<gov-icon class={AccordionItemClass.arrow} name=\"chevron-down\"></gov-icon>\n\t\t\t\t</button>\n\t\t\t\t<div\n\t\t\t\t\tclass={AccordionItemClass.content}\n\t\t\t\t\tid={contentId}\n\t\t\t\t\taria-hidden={booleanString(!isExpandedState)}\n\t\t\t\t\thidden={!isExpandedState}\n\t\t\t\t\taria-labelledby={triggerId}>\n\t\t\t\t\t<slot />\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Opening the accordion\n\t */\n\t@Method()\n\tasync open(): Promise<void> {\n\t\tthis.isExpandedState = true\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Closing the accordion\n\t */\n\t@Method()\n\tasync close(): Promise<void> {\n\t\tthis.isExpandedState = false\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Accordion switch\n\t */\n\t@Method()\n\tasync toggle(): Promise<void> {\n\t\tthis.isExpandedState = !this.isExpandedState\n\t\tthis.emmitChange()\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync currentState(): Promise<boolean> {\n\t\treturn this.isExpandedState\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{r as o,c as a,h as r,H as i,g as s}from"./p-4af5e4f4.js";import{v as t}from"./p-364b4792.js";import{c}from"./p-c20102ff.js";import{d as e}from"./p-03990da5.js";import{g as p}from"./p-3f37ddb6.js";import"./p-561fa17b.js";import"./p-24636c53.js";const n={root:"gov-backdrop",bg:"gov-backdrop__bg"};const d='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-backdrop__bg{z-index:100;position:fixed;top:0;right:0;bottom:0;left:0;background-color:var(--gov-backdrop-bg, var(--gov-color-secondary));opacity:var(--gov-backdrop-opacity, 0.45)}.gov-backdrop[inverse=""] .gov-backdrop__bg,.gov-backdrop[inverse=true i] .gov-backdrop__bg,.gov-backdrop[inverse="1"] .gov-backdrop__bg{background-color:var(--gov-backdrop-bg-inverse, var(--gov-color-neutral-white));opacity:var(--gov-backdrop-opacity, 0.8)}';const g=class{constructor(r){o(this,r);this.govClick=a(this,"gov-click",7);this.inverse=false;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.h=p(this.host)}async componentDidRender(){if(c()){await e(500);await this.validateWcag()}}render(){return r(i,{class:this.h.classes(n.root)},r("div",{role:"button","aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy,onClick:o=>this.govClick.emit(o),class:n.bg}))}async validateWcag(){t(this.wcagLabel,this.wcagLabelledBy,n.root)}get host(){return s(this)}};g.style=d;export{g as gov_backdrop};
2
+ //# sourceMappingURL=p-52f2f67c.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-backdrop/constants.ts","../../../packages/core/src/components/gov-backdrop/gov-backdrop.scss?tag=gov-backdrop","../../../packages/core/src/components/gov-backdrop/gov-backdrop.tsx"],"names":["BackdropClass","root","bg","govBackdropCss","GovBackdrop","[object Object]","hostRef","this","h","govHost","host","canValidateWcagOnRender","delay","validateWcag","Host","class","classes","role","aria-label","wcagLabel","aria-labelledby","wcagLabelledBy","onClick","e","govClick","emit","validateWcagLabel"],"mappings":"2PAAO,MAAMA,EAAgB,CAC5BC,KAAM,eACNC,GAAI,oBCFL,MAAMC,EAAiB,0xBCYVC,EAAW,MAGvBC,YAAAC,8DAQoC,6DAPnCC,KAAKC,EAAIC,EAAQF,KAAKG,MAqBvBL,2BACC,GAAIM,IAA2B,OACxBC,EAAM,WACNL,KAAKM,gBAIbR,SACC,OACCG,EAACM,EAAI,CAACC,MAAOR,KAAKC,EAAEQ,QAAQhB,EAAcC,OACzCO,EAAA,MAAA,CACCS,KAAM,SAAQC,aACFX,KAAKY,UAASC,kBACTb,KAAKc,eACtBC,QAASC,GAAKhB,KAAKiB,SAASC,KAAKF,GACjCR,MAAOf,EAAcE,MAUzBG,qBACCqB,EAAkBnB,KAAKY,UAAWZ,KAAKc,eAAgBrB,EAAcC","sourcesContent":["export const BackdropClass = {\n\troot: 'gov-backdrop',\n\tbg: 'gov-backdrop__bg',\n}\n","/*\n * Backdrop\n */\n\n$class: \".gov-backdrop\";\n\n#{$class} {\n\t&__bg {\n\t\t@include z-index(\"modal\", 0);\n\t\tposition: fixed;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\tbackground-color: $backdrop-bg;\n\t\topacity: $backdrop-opacity;\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"inverse\") {\n\t\t#{$class} {\n\t\t\t&__bg {\n\t\t\t\tbackground-color: $backdrop-bg-inverse;\n\t\t\t\topacity: $backdrop-opacity-inverse;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Event, EventEmitter, h, Method, Prop, Host, Element } from '@stencil/core'\nimport { validateWcagLabel } from '../../helpers/Validate/wcag'\nimport { BackdropClass } from './constants'\nimport { canValidateWcagOnRender } from '../../helpers/Dom/win'\nimport { delay } from '../../utils/utils'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-backdrop',\n\tstyleUrl: 'gov-backdrop.scss',\n})\nexport class GovBackdrop {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovAlertElement\n\t/**\n\t * Determide if component should have inversed colors to be used on dark background.\n\t */\n\t@Prop() readonly inverse: boolean = false\n\t/**\n\t * Adds accessible label for the backdrop that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-label' }) readonly wcagLabel: string\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when button clicks.\n\t */\n\t@Event({ eventName: 'gov-click' }) govClick: EventEmitter<MouseEvent>\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(BackdropClass.root)}>\n\t\t\t\t<div\n\t\t\t\t\trole={'button'}\n\t\t\t\t\taria-label={this.wcagLabel}\n\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\tonClick={e => this.govClick.emit(e)}\n\t\t\t\t\tclass={BackdropClass.bg}\n\t\t\t\t></div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, BackdropClass.root)\n\t}\n}\n"]}
@@ -1,2 +1,2 @@
1
- import{r as o,c as a,h as e,H as t,g as i}from"./p-4af5e4f4.js";import{c as r}from"./p-24636c53.js";import{a as s}from"./p-364b4792.js";import{M as d}from"./p-45485d1c.js";import{c as l}from"./p-c20102ff.js";import{d as n}from"./p-03990da5.js";import{g as m,a as g}from"./p-3f37ddb6.js";import{a as c}from"./p-561fa17b.js";const h='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-modal{display:none}.gov-modal__dialog{z-index:101;position:fixed;top:50%;left:50%;display:flex;justify-content:center;align-items:center;width:100%;max-width:var(--gov-modal-max-width, 52.5rem);height:100%;padding:0.5rem;border:none;background:transparent;transform:translate(-50%, -50%);pointer-events:none}.gov-modal__inner{position:relative;display:flex;flex-direction:column;width:100%;max-height:100%;border-radius:var(--gov-border-radius, 0.1875rem);background:var(--gov-modal-bg, var(--gov-color-neutral-white));overflow:hidden;pointer-events:auto;box-shadow:0 0 1.5rem rgba(var(--gov-color-secondary-800-rgb), 0.24)}.gov-modal__header{display:flex;gap:1rem;align-items:flex-start;padding:1.5rem 1rem;border-bottom:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__icon{flex:0 0 auto;padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 1.5rem) / 2)}.gov-modal__icon>*{width:1.5rem;height:1.5rem}.gov-modal__title{font-weight:var(--gov-text-3xl-font-weight);font-size:var(--gov-text-3xl-font-size);line-height:var(--gov-text-3xl-line-height);letter-spacing:var(--gov-text-3xl-letter-spacing);margin:0}.gov-modal__close{flex:0 0 auto;margin-left:auto;padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 2rem) / 2)}.gov-modal__content{height:100%;padding:1.5rem 1rem;color:var(--gov-modal-text-color, var(--gov-color-secondary-700));overflow:auto}.gov-modal__content>*:last-child{margin-bottom:0}.gov-modal__actions{display:flex;gap:0.5rem 1rem;flex-wrap:wrap;justify-content:flex-end;padding:1.5rem 1rem;border-top:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__dialog:focus .gov-modal__inner{outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base)}.gov-modal[open=""],.gov-modal[open=true i],.gov-modal[open="1"]{display:block}@media (min-width: 30em){.gov-modal__dialog{max-width:calc(var(--gov-modal-max-width, 52.5rem) + 3rem);padding:1.5rem}.gov-modal__dialog:focus{outline-offset:-1.5rem}.gov-modal__inner{box-shadow:0 0 2rem rgba(var(--gov-color-secondary-800-rgb), 0.32)}.gov-modal--prompt .gov-modal__dialog{max-width:calc(var(--gov-modal-prompt-max-width, 33.125rem) + 3rem)}}@media (min-width: 48em){.gov-modal__header{gap:1.25rem;padding:2rem 2.5rem 2rem 3rem}.gov-modal__close{padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 2.5rem) / 2)}.gov-modal__content{padding:2rem 3rem}.gov-modal--prompt .gov-modal__header,.gov-modal--prompt .gov-modal__content,.gov-modal--prompt .gov-modal__actions{padding:1.5rem}}';const v=class{constructor(e){o(this,e);this.govClose=a(this,"gov-close",7);this.open=false;this.label=undefined;this.role="dialog";this.labelTag="h2";this.wcaglabelledBy=undefined;this.wcagDescribedBy=undefined;this.wcagCloseLabel=undefined;this.wcagCloseLabelledBy=undefined;this.modalVisible=false;this.h=m(this.host);this.labelId=r("GovPromptLabel");this.contentId=r("GovPromptContent")}validateLabelTag(o){const a=["h1","h2","h3","h4","h5","h6"];if(o){if(!a.includes(o)){c(`[${d.root}]: Tag ${o} is not allowed.`)}}}watchOpen(o){this.modalVisible=o}showModal(){this.modalVisible=true;document.body.classList.add(d.bodyFix)}hideModal(){this.modalVisible=false;document.body.classList.remove(d.bodyFix)}async componentWillRender(){if(this.modalVisible){this.showModal()}else{this.hideModal()}}async componentDidRender(){this.modalVisible=this.open;if(l()){await n(500);await this.validateWcag()}}render(){const o=this.labelTag;return e(t,{class:this.h.classes(d.rootPrompt),open:this.modalVisible},e("dialog",{class:d.dialog,hidden:!this.modalVisible,tabindex:"-1",open:this.modalVisible,"aria-modal":"true","aria-hidden":g(!this.modalVisible),"aria-labelledby":this.wcaglabelledBy||this.labelId,"aria-describedby":this.wcagDescribedBy||this.contentId,role:this.role},e("div",{class:d.inner},e("div",{class:d.header},this.h.hasSlot("icon")&&e("div",{class:d.icon},e("slot",{name:"icon"})),this.label&&e(o,{class:d.title,id:this.labelId},this.label),e("gov-button",{class:d.close,variant:"primary",wcagLabel:this.wcagCloseLabel,wcagLabelledBy:this.wcagCloseLabelledBy,type:"base","on-gov-click":this.onCloseHandler.bind(this)},e("gov-icon",{name:"x-lg"}))),e("div",{class:d.content,id:this.contentId},e("slot",null)),e("div",{class:d.actions},e("slot",{name:"actions"})))),e("gov-backdrop",{visible:this.modalVisible,"wcag-label":this.wcagCloseLabel,"wcag-labelled-by":this.wcagCloseLabelledBy,"on-gov-click":this.onCloseHandler.bind(this)}))}onCloseHandler(o){o.stopPropagation();this.hideModal();this.govClose.emit(o)}async show(){this.showModal()}async hide(){this.hideModal()}async validateWcag(){s(this.wcaglabelledBy,"aria-labelledby",d.root);s(this.wcagDescribedBy,"aria-describedby",d.root)}get host(){return i(this)}static get watchers(){return{labelTag:["validateLabelTag"],open:["watchOpen"]}}};v.style=h;export{v as gov_prompt};
2
- //# sourceMappingURL=p-e3141382.entry.js.map
1
+ import{r as o,c as a,h as e,H as t,g as i}from"./p-4af5e4f4.js";import{c as r}from"./p-24636c53.js";import{a as s}from"./p-364b4792.js";import{M as d}from"./p-45485d1c.js";import{c as l}from"./p-c20102ff.js";import{d as n}from"./p-03990da5.js";import{g as m,a as g}from"./p-3f37ddb6.js";import{a as c}from"./p-561fa17b.js";const h='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-modal{display:none}.gov-modal__dialog{z-index:101;position:fixed;top:50%;left:50%;display:flex;justify-content:center;align-items:center;width:100%;max-width:var(--gov-modal-max-width, 52.5rem);height:100%;padding:0.5rem;border:none;background:transparent;transform:translate(-50%, -50%);pointer-events:none}.gov-modal__inner{position:relative;display:flex;flex-direction:column;width:100%;max-height:100%;border-radius:var(--gov-border-radius, 0.1875rem);background:var(--gov-modal-bg, var(--gov-color-neutral-white));overflow:hidden;pointer-events:auto;box-shadow:0 0 1.5rem rgba(var(--gov-color-secondary-800-rgb), 0.24)}.gov-modal__header{display:flex;gap:1rem;align-items:flex-start;padding:1.5rem 1rem;border-bottom:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__icon{flex:0 0 auto;padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 1.5rem) / 2)}.gov-modal__icon>*{width:1.5rem;height:1.5rem}.gov-modal__title{font-weight:var(--gov-text-3xl-font-weight);font-size:var(--gov-text-3xl-font-size);line-height:var(--gov-text-3xl-line-height);letter-spacing:var(--gov-text-3xl-letter-spacing);margin:0}.gov-modal__close{flex:0 0 auto;margin-left:auto;padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 2rem) / 2)}.gov-modal__content{height:100%;padding:1.5rem 1rem;color:var(--gov-modal-text-color, var(--gov-color-secondary-700));overflow:auto}.gov-modal__content>*:last-child{margin-bottom:0}.gov-modal__actions{display:flex;gap:0.5rem 1rem;flex-wrap:wrap;justify-content:flex-end;padding:1.5rem 1rem;border-top:var(--gov-modal-border-color, 0.0625rem solid var(--gov-color-secondary-500))}.gov-modal__dialog:focus .gov-modal__inner{outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base)}.gov-modal[open=""],.gov-modal[open=true i],.gov-modal[open="1"]{display:block}@media (min-width: 30em){.gov-modal__dialog{max-width:calc(var(--gov-modal-max-width, 52.5rem) + 3rem);padding:1.5rem}.gov-modal__dialog:focus{outline-offset:-1.5rem}.gov-modal__inner{box-shadow:0 0 2rem rgba(var(--gov-color-secondary-800-rgb), 0.32)}.gov-modal--prompt .gov-modal__dialog{max-width:calc(var(--gov-modal-prompt-max-width, 33.125rem) + 3rem)}}@media (min-width: 48em){.gov-modal__header{gap:1.25rem;padding:2rem 2.5rem 2rem 3rem}.gov-modal__close{padding-top:calc((var(--gov-text-3xl-font-size) * 1.5 - 2.5rem) / 2)}.gov-modal__content{padding:2rem 3rem}.gov-modal--prompt .gov-modal__header,.gov-modal--prompt .gov-modal__content,.gov-modal--prompt .gov-modal__actions{padding:1.5rem}}';const v=class{constructor(e){o(this,e);this.govClose=a(this,"gov-close",7);this.open=false;this.label=undefined;this.role="dialog";this.labelTag="h2";this.wcaglabelledBy=undefined;this.wcagDescribedBy=undefined;this.wcagCloseLabel=undefined;this.wcagCloseLabelledBy=undefined;this.modalVisible=false;this.h=m(this.host);this.labelId=r("GovPromptLabel");this.contentId=r("GovPromptContent")}validateLabelTag(o){const a=["h1","h2","h3","h4","h5","h6"];if(o){if(!a.includes(o)){c(`[${d.root}]: Tag ${o} is not allowed.`)}}}watchOpen(o){this.modalVisible=o}showModal(){this.modalVisible=true;document.body.classList.add(d.bodyFix)}hideModal(){this.modalVisible=false;document.body.classList.remove(d.bodyFix)}async componentWillRender(){if(this.modalVisible){this.showModal()}else{this.hideModal()}}async componentDidRender(){this.modalVisible=this.open;if(l()){await n(500);await this.validateWcag()}}render(){const o=this.labelTag;return e(t,{class:this.h.classes(d.rootPrompt),open:this.modalVisible},e("dialog",{class:d.dialog,hidden:!this.modalVisible,tabindex:"-1",open:this.modalVisible,"aria-modal":"true","aria-hidden":g(!this.modalVisible),"aria-labelledby":this.wcaglabelledBy||this.labelId,"aria-describedby":this.wcagDescribedBy||this.contentId,role:this.role},e("div",{class:d.inner},e("div",{class:d.header},this.h.hasSlot("icon")&&e("div",{class:d.icon},e("slot",{name:"icon"})),this.label&&e(o,{class:d.title,id:this.labelId},this.label),e("gov-button",{class:d.close,variant:"primary",wcagLabel:this.wcagCloseLabel,wcagLabelledBy:this.wcagCloseLabelledBy,type:"base","on-gov-click":this.onCloseHandler.bind(this)},e("gov-icon",{name:"x-lg"}))),e("div",{class:d.content,id:this.contentId},e("slot",null)),e("div",{class:d.actions},e("slot",{name:"actions"})))),this.modalVisible?e("gov-backdrop",{"wcag-label":this.wcagCloseLabel,"wcag-labelled-by":this.wcagCloseLabelledBy,"on-gov-click":this.onCloseHandler.bind(this)}):null)}onCloseHandler(o){o.stopPropagation();this.hideModal();this.govClose.emit(o)}async show(){this.showModal()}async hide(){this.hideModal()}async validateWcag(){s(this.wcaglabelledBy,"aria-labelledby",d.root);s(this.wcagDescribedBy,"aria-describedby",d.root)}get host(){return i(this)}static get watchers(){return{labelTag:["validateLabelTag"],open:["watchOpen"]}}};v.style=h;export{v as gov_prompt};
2
+ //# sourceMappingURL=p-5e5e925d.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-promp/gov-prompt.scss?tag=gov-prompt","../../../packages/core/src/components/gov-promp/gov-prompt.tsx"],"names":["govPromptCss","GovPrompt","[object Object]","hostRef","this","h","govHost","host","labelId","createID","contentId","newValue","validTags","includes","govErrorLog","ModalClass","root","modalVisible","document","body","classList","add","bodyFix","remove","showModal","hideModal","open","canValidateWcagOnRender","delay","validateWcag","LabelTag","labelTag","Host","class","classes","rootPrompt","dialog","hidden","tabindex","aria-modal","aria-hidden","toBoolAttr","aria-labelledby","wcaglabelledBy","aria-describedby","wcagDescribedBy","role","inner","header","hasSlot","icon","name","label","title","id","close","variant","wcagLabel","wcagCloseLabel","wcagLabelledBy","wcagCloseLabelledBy","type","on-gov-click","onCloseHandler","bind","content","actions","wcag-label","wcag-labelled-by","e","stopPropagation","govClose","emit","validateWcagRef"],"mappings":"mUAAA,MAAMA,EAAe,s1FCeRC,EAAS,MAKrBC,YAAAC,2DAUe,qCAQqB,uBAI0B,qJAsBtC,MA3CvBC,KAAKC,EAAIC,EAAQF,KAAKG,MACtBH,KAAKI,QAAUC,EAAS,kBACxBL,KAAKM,UAAYD,EAAS,oBA4C3BP,iBAAiBS,GAChB,MAAMC,EAAY,CAAC,KAAM,KAAM,KAAM,KAAM,KAAM,MACjD,GAAID,EAAU,CACb,IAAKC,EAAUC,SAASF,GAAW,CAClCG,EAAY,IAAIC,EAAWC,cAAcL,uBAM5CT,UAAUS,GACTP,KAAKa,aAAeN,EAGbT,YACPE,KAAKa,aAAe,KACpBC,SAASC,KAAKC,UAAUC,IAAIN,EAAWO,SAGhCpB,YACPE,KAAKa,aAAe,MACpBC,SAASC,KAAKC,UAAUG,OAAOR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AAK,eAKb/C,KAAKa,aACLZ,EAAA,eAAA,CAAA8D,aACa/D,KAAKsD,eAAcU,mBACbhE,KAAKwD,oBAAmBE,eAC5B1D,KAAK2D,eAAeC,KAAK5D,QAErC,MAKCF,eAAemE,GACtBA,EAAEC,kBACFlE,KAAKqB,YACLrB,KAAKmE,SAASC,KAAKH,GAOpBnE,aACCE,KAAKoB,YAONtB,aACCE,KAAKqB,YAONvB,qBACCuE,EAAgBrE,KAAKuC,eAAgB,kBAAmB5B,EAAWC,MACnEyD,EAAgBrE,KAAKyC,gBAAiB,mBAAoB9B,EAAWC","sourcesContent":["/*\n * Prompt\n */\n\n// $class: \".gov-prompt\";\n@import \"../gov-modal/gov-modal.scss\";\n\n// #{$class} {\n// \t//\n// }\n","import { Component, Event, Element, EventEmitter, h, Host, Method, Prop, Watch, State } from \"@stencil/core\"\nimport { createID } from \"../../utils/string.utils\"\nimport { validateWcagRef } from \"../../helpers/Validate/wcag\"\nimport { ModalClass } from \"../gov-modal/constants\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\nimport { toBoolAttr } from \"../../helpers/Dom/template\"\nimport { govHost } from \"../../helpers/Dom/template\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport { govErrorLog } from \"../../helpers/Log/gov.log\"\n\n@Component({\n\ttag: \"gov-prompt\",\n\tstyleUrl: \"gov-prompt.scss\",\n})\nexport class GovPrompt {\n\tprivate h: GovHost\n\tprivate readonly labelId: string\n\tprivate readonly contentId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.labelId = createID(\"GovPromptLabel\")\n\t\tthis.contentId = createID(\"GovPromptContent\")\n\t}\n\n\t@Element() host: HTMLGovPromptElement\n\t/**\n\t * Attribute for modal window display\n\t */\n\t@Prop() open = false\n\t/**\n\t * Title of modal window\n\t */\n\t@Prop() label: string\n\t/**\n\t * Role of modal\n\t */\n\t@Prop({ attribute: \"role\" }) role = \"dialog\"\n\t/**\n\t * Used to change the HMTL tag in the modal label for correct semantic structure\n\t */\n\t@Prop({ attribute: \"label-tag\" }) readonly labelTag: string = \"h2\"\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) wcaglabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the modal.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) wcagDescribedBy: string\n\t/**\n\t * Adds accessible label for the modal close button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-close-label\" }) wcagCloseLabel: string\n\t/**\n\t * A string of identifiers that indicate alternative label elements for closing the modal window\n\t */\n\t@Prop({ attribute: \"wcag-close-labelled-by\" }) wcagCloseLabelledBy: string\n\t/**\n\t * Emitted when modal window closes.\n\t */\n\t@Event({ eventName: \"gov-close\" }) govClose: EventEmitter<PointerEvent>\n\n\t@State() modalVisible = false\n\n\t@Watch(\"labelTag\")\n\tvalidateLabelTag(newValue: string): void {\n\t\tconst validTags = [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]\n\t\tif (newValue) {\n\t\t\tif (!validTags.includes(newValue)) {\n\t\t\t\tgovErrorLog(`[${ModalClass.root}]: Tag ${newValue} is not allowed.`)\n\t\t\t}\n\t\t}\n\t}\n\n\t@Watch(\"open\")\n\twatchOpen(newValue: boolean): void {\n\t\tthis.modalVisible = newValue\n\t}\n\n\tprivate showModal() {\n\t\tthis.modalVisible = true\n\t\tdocument.body.classList.add(ModalClass.bodyFix)\n\t}\n\n\tprivate hideModal() {\n\t\tthis.modalVisible = false\n\t\tdocument.body.classList.remove(ModalClass.bodyFix)\n\t}\n\n\tasync componentWillRender() {\n\t\tif (this.modalVisible) {\n\t\t\tthis.showModal()\n\t\t} else {\n\t\t\tthis.hideModal()\n\t\t}\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.modalVisible = this.open\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst LabelTag = this.labelTag\n\t\treturn (\n\t\t\t<Host class={this.h.classes(ModalClass.rootPrompt)} open={this.modalVisible}>\n\t\t\t\t<dialog\n\t\t\t\t\tclass={ModalClass.dialog}\n\t\t\t\t\thidden={!this.modalVisible}\n\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\topen={this.modalVisible}\n\t\t\t\t\taria-modal=\"true\"\n\t\t\t\t\taria-hidden={toBoolAttr(!this.modalVisible)}\n\t\t\t\t\taria-labelledby={this.wcaglabelledBy || this.labelId}\n\t\t\t\t\taria-describedby={this.wcagDescribedBy || this.contentId}\n\t\t\t\t\trole={this.role}\n\t\t\t\t>\n\t\t\t\t\t<div class={ModalClass.inner}>\n\t\t\t\t\t\t<div class={ModalClass.header}>\n\t\t\t\t\t\t\t{this.h.hasSlot(\"icon\") && (\n\t\t\t\t\t\t\t\t<div class={ModalClass.icon}>\n\t\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{this.label && (\n\t\t\t\t\t\t\t\t<LabelTag class={ModalClass.title} id={this.labelId}>\n\t\t\t\t\t\t\t\t\t{this.label}\n\t\t\t\t\t\t\t\t</LabelTag>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\tclass={ModalClass.close}\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\twcagLabel={this.wcagCloseLabel}\n\t\t\t\t\t\t\t\twcagLabelledBy={this.wcagCloseLabelledBy}\n\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\" />\n\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class={ModalClass.content} id={this.contentId}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class={ModalClass.actions}>\n\t\t\t\t\t\t\t<slot name=\"actions\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</dialog>\n\n\t\t\t\t{this.modalVisible ? (\n\t\t\t\t\t<gov-backdrop\n\t\t\t\t\t\twcag-label={this.wcagCloseLabel}\n\t\t\t\t\t\twcag-labelled-by={this.wcagCloseLabelledBy}\n\t\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t\t/>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onCloseHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t\tthis.hideModal()\n\t\tthis.govClose.emit(e)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showModal()\n\t}\n\n\t/**\n\t * Hidding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.hideModal()\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcaglabelledBy, \"aria-labelledby\", ModalClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"aria-describedby\", ModalClass.root)\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-tile/constants.ts","../../../packages/core/src/components/gov-tile/gov-tile.scss?tag=gov-tile","../../../packages/core/src/components/gov-tile/gov-tile.tsx"],"names":["TileClass","root","icon","arrow","title","link","content","heading","govTileCss","GovTile","[object Object]","hostRef","this","h","govHost","host","newValue","govErrorLog","validateName","name","Host","class","classes","promotion","href","hasSlot"],"mappings":"iIAAO,MAAMA,EAAY,CACxBC,KAAM,WACNC,KAAM,iBACNC,MAAO,kBACPC,MAAO,kBACPC,KAAM,iBACNC,QAAS,oBACTC,QAAS,qBCPV,MAAMC,EAAa,27ECUNC,EAAO,MAGnBC,YAAAC,4BAQsC,8CAPrCC,KAAKC,EAAIC,EAAQF,KAAKG,MAkBvBL,aAAaM,GACZ,IAAKA,EAAU,CACdC,EAAY,IAAIjB,EAAUC,wCAI5BS,oBACCE,KAAKM,aAAaN,KAAKO,MAGxBT,SAEC,OACCG,EAACO,EAAI,CAACC,MAAOT,KAAKC,EAAES,QAAQtB,EAAUC,MAAOsB,UAAWX,KAAKW,WAC3DX,KAAKY,KACLX,EAAA,IAAA,CAAGW,KAAMZ,KAAKY,KAAMH,MAAOrB,EAAUK,MACnCO,KAAKC,EAAEY,QAAQ,SACfZ,EAAA,MAAA,CAAKQ,MAAOrB,EAAUE,MACrBW,EAAA,OAAA,CAAMM,KAAK,UAGbN,EAAA,KAAA,CAAIQ,MAAOrB,EAAUI,OACpBS,EAAA,OAAA,CAAMQ,MAAOrB,EAAUO,SACrBK,KAAKO,KACNN,EAAA,WAAA,CAAUQ,MAAOrB,EAAUG,MAAOgB,KAAK,oBAGzCN,EAAA,MAAA,CAAKQ,MAAOrB,EAAUM,SACrBO,EAAA,OAAA,QAIFA,EAAA,OAAA,KACED,KAAKC,EAAEY,QAAQ,SACfZ,EAAA,MAAA,CAAKQ,MAAOrB,EAAUE,MACrBW,EAAA,OAAA,CAAMM,KAAK,UAGbN,EAAA,KAAA,CAAIQ,MAAOrB,EAAUI,OACnBS,EAAA,OAAA,KAAOD,KAAKO,OAEdN,EAAA,MAAA,CAAKQ,MAAOrB,EAAUM,SACrBO,EAAA,OAAA","sourcesContent":["export const TileClass = {\n\troot: 'gov-tile',\n\ticon: 'gov-tile__icon',\n\tarrow: 'gov-tile__arrow',\n\ttitle: 'gov-tile__title',\n\tlink: 'gov-tile__link',\n\tcontent: 'gov-tile__content',\n\theading: 'gov-tile__heading',\n}\n","/*\n * Tile\n */\n\n$class: \".gov-tile\";\n\n#{$class} {\n\t@include base();\n\tpadding: rem-calc(12);\n\ttransition: background-color $t;\n\t&__icon {\n\t\tdisplay: flex;\n\t\tmargin: rem-calc(0 0 12);\n\t\tcolor: $tile-main-color;\n\t\t.gov-icon {\n\t\t\twidth: rem-calc(40);\n\t\t\theight: rem-calc(40);\n\t\t}\n\t}\n\t&__title {\n\t\t@include typography($font-size-xl);\n\t\tmargin: 0 0 rem-calc(8);\n\t}\n\t&__heading {\n\t\t@extend %link-mask;\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\tjustify-content: space-between;\n\t\tcolor: $tile-main-color;\n\t\ttext-decoration: none;\n\t}\n\t&__arrow {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(12);\n\t\theight: rem-calc(32);\n\t\tmargin: rem-calc(8);\n\t\tcolor: inherit;\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t\tcolor: $tile-text-color;\n\t\ta {\n\t\t\tposition: relative;\n\t\t\tz-index: 1;\n\t\t}\n\t}\n\t&__link {\n\t\tdisplay: block;\n\t\ttext-decoration: none;\n\t}\n\n\t// HOVERS\n\t&[href] {\n\t\t@include hover() {\n\t\t\tbackground: $tile-hover-bg;\n\t\t\t#{$class} {\n\t\t\t\t&__heading {\n\t\t\t\t\tcolor: $tile-main-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: auto 1fr;\n\t\t\tgap: 0 rem-calc(14);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tgrid-area: 1/1/3/1;\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\t\t\t\t&__title {\n\t\t\t\t\tgrid-area: 1/2/1/2;\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tgrid-area: 2/2/2/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: md) {\n\t\tpadding: rem-calc(24);\n\t\t&__icon {\n\t\t\tmargin: rem-calc(0 0 24);\n\t\t\t.gov-icon {\n\t\t\t\twidth: rem-calc(48);\n\t\t\t\theight: rem-calc(48);\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: lg) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\tgap: 0 rem-calc(26);\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Prop, Watch } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { TileClass } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tile',\n\tstyleUrl: 'gov-tile.scss',\n})\nexport class GovTile {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovTileElement\n\t/**\n\t * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Link on whole tile\n\t */\n\t@Prop() readonly href: string\n\t/**\n\t * Item name\n\t */\n\t@Prop() readonly name: string\n\n\t@Watch('name')\n\tvalidateName(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${TileClass.root}]: Parameter title is required.`)\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateName(this.name)\n\t}\n\n\trender() {\n\t\t// tag type\n\t\treturn (\n\t\t\t<Host class={this.h.classes(TileClass.root)} promotion={this.promotion}>\n\t\t\t\t{this.href ? (\n\t\t\t\t\t<a href={this.href} class={TileClass.link}>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t<span class={TileClass.heading}>\n\t\t\t\t\t\t\t\t{this.name}\n\t\t\t\t\t\t\t\t<gov-icon class={TileClass.arrow} name=\"chevron-right\"></gov-icon>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t\t<span>{this.name}</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-tile/constants.ts","../../../packages/core/src/components/gov-tile/gov-tile.scss?tag=gov-tile","../../../packages/core/src/components/gov-tile/gov-tile.tsx"],"names":["TileClass","root","icon","arrow","title","link","content","heading","govTileCss","GovTile","[object Object]","hostRef","this","h","govHost","host","newValue","govErrorLog","validateName","name","Host","class","classes","promotion","href","hasSlot"],"mappings":"iIAAO,MAAMA,EAAY,CACxBC,KAAM,WACNC,KAAM,iBACNC,MAAO,kBACPC,MAAO,kBACPC,KAAM,iBACNC,QAAS,oBACTC,QAAS,qBCPV,MAAMC,EAAa,27ECUNC,EAAO,MAGnBC,YAAAC,4BAQsC,8CAPrCC,KAAKC,EAAIC,EAAQF,KAAKG,MAkBvBL,aAAaM,GACZ,IAAKA,EAAU,CACdC,EAAY,IAAIjB,EAAUC,wCAI5BS,oBACCE,KAAKM,aAAaN,KAAKO,MAGxBT,SAEC,OACCG,EAACO,EAAI,CAACC,MAAOT,KAAKC,EAAES,QAAQtB,EAAUC,MAAOsB,UAAWX,KAAKW,WAC3DX,KAAKY,KACLX,EAAA,IAAA,CAAGW,KAAMZ,KAAKY,KAAMH,MAAOrB,EAAUK,MACnCO,KAAKC,EAAEY,QAAQ,SACfZ,EAAA,MAAA,CAAKQ,MAAOrB,EAAUE,MACrBW,EAAA,OAAA,CAAMM,KAAK,UAGbN,EAAA,KAAA,CAAIQ,MAAOrB,EAAUI,OACpBS,EAAA,OAAA,CAAMQ,MAAOrB,EAAUO,SACrBK,KAAKO,KACNN,EAAA,WAAA,CAAUQ,MAAOrB,EAAUG,MAAOgB,KAAK,oBAGzCN,EAAA,MAAA,CAAKQ,MAAOrB,EAAUM,SACrBO,EAAA,OAAA,QAIFA,EAAA,OAAA,KACED,KAAKC,EAAEY,QAAQ,SACfZ,EAAA,MAAA,CAAKQ,MAAOrB,EAAUE,MACrBW,EAAA,OAAA,CAAMM,KAAK,UAGbN,EAAA,KAAA,CAAIQ,MAAOrB,EAAUI,OACnBS,EAAA,OAAA,KAAOD,KAAKO,OAEdN,EAAA,MAAA,CAAKQ,MAAOrB,EAAUM,SACrBO,EAAA,OAAA","sourcesContent":["export const TileClass = {\n\troot: 'gov-tile',\n\ticon: 'gov-tile__icon',\n\tarrow: 'gov-tile__arrow',\n\ttitle: 'gov-tile__title',\n\tlink: 'gov-tile__link',\n\tcontent: 'gov-tile__content',\n\theading: 'gov-tile__heading',\n}\n","/*\n * Tile\n */\n\n$class: \".gov-tile\";\n\n#{$class} {\n\t@include base();\n\tpadding: rem-calc(12);\n\ttransition: background-color $t;\n\t&__icon {\n\t\tdisplay: flex;\n\t\tmargin: rem-calc(0 0 12);\n\t\tcolor: $tile-main-color;\n\t\t.gov-icon {\n\t\t\twidth: rem-calc(40);\n\t\t\theight: rem-calc(40);\n\t\t}\n\t}\n\t&__title {\n\t\t@include typography($font-size-xl);\n\t\tmargin: 0 0 rem-calc(8);\n\t}\n\t&__heading {\n\t\t@extend %link-mask;\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\tjustify-content: space-between;\n\t\tcolor: $tile-main-color;\n\t\ttext-decoration: none;\n\t}\n\t&__arrow {\n\t\tflex: 0 0 auto;\n\t\twidth: rem-calc(12);\n\t\theight: rem-calc(32);\n\t\tmargin: rem-calc(8);\n\t\tcolor: inherit;\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t\tcolor: $tile-text-color;\n\t\ta {\n\t\t\tposition: relative;\n\t\t\tz-index: 1;\n\t\t}\n\t}\n\t&__link {\n\t\tdisplay: block;\n\t\ttext-decoration: none;\n\t}\n\n\t// HOVERS\n\t&[href] {\n\t\t@include hover() {\n\t\t\tbackground: $tile-hover-bg;\n\t\t\t#{$class} {\n\t\t\t\t&__heading {\n\t\t\t\t\tcolor: $tile-main-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: auto 1fr;\n\t\t\tgap: 0 rem-calc(14);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tgrid-area: 1/1/3/1;\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\t\t\t\t&__title {\n\t\t\t\t\tgrid-area: 1/2/1/2;\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tgrid-area: 2/2/2/2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: md) {\n\t\tpadding: rem-calc(24);\n\t\t&__icon {\n\t\t\tmargin: rem-calc(0 0 24);\n\t\t\t.gov-icon {\n\t\t\t\twidth: rem-calc(48);\n\t\t\t\theight: rem-calc(48);\n\t\t\t}\n\t\t}\n\t}\n\t@include mq($from: lg) {\n\t\t// VARIANTS\n\t\t@include parameter(\"promotion\") {\n\t\t\tgap: 0 rem-calc(26);\n\t\t}\n\t}\n}\n","\timport { Component, Element, h, Host, Prop, Watch } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { TileClass } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tile',\n\tstyleUrl: 'gov-tile.scss',\n})\nexport class GovTile {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovTileElement\n\t/**\n\t * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Link on whole tile\n\t */\n\t@Prop() readonly href: string\n\t/**\n\t * Item name\n\t */\n\t@Prop() readonly name: string\n\n\t@Watch('name')\n\tvalidateName(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${TileClass.root}]: Parameter title is required.`)\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateName(this.name)\n\t}\n\n\trender() {\n\t\t// tag type\n\t\treturn (\n\t\t\t<Host class={this.h.classes(TileClass.root)} promotion={this.promotion}>\n\t\t\t\t{this.href ? (\n\t\t\t\t\t<a href={this.href} class={TileClass.link}>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t<span class={TileClass.heading}>\n\t\t\t\t\t\t\t\t{this.name}\n\t\t\t\t\t\t\t\t<gov-icon class={TileClass.arrow} name=\"chevron-right\"></gov-icon>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t\t<span>{this.name}</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{r as o,c as r,h as t,H as e,g as n}from"./p-4af5e4f4.js";import{F as a}from"./p-1c1d0bbe.js";import{v as i}from"./p-26acf964.js";import{S as s}from"./p-55500e5a.js";import{V as g}from"./p-ff7365ae.js";import{p as v,d as c}from"./p-03990da5.js";import{g as l,p as u,t as p}from"./p-3f37ddb6.js";import{c as h,v as d}from"./p-364b4792.js";import{c as b}from"./p-c20102ff.js";import{c as m}from"./p-24636c53.js";import"./p-561fa17b.js";const _=v(s,["_S","_M"]);const y=v(g,["PRIMARY","SECONDARY"]);var f;(function(o){o["BUTTON"]="button";o["SELECT"]="select"})(f||(f={}));const w={root:"gov-pagination",list:"gov-pagination__list",item:"gov-pagination__item",itemArrow:"gov-pagination__item--arrow",itemMore:"gov-pagination__item--more",itemSelect:"gov-pagination__item--select",inner:"gov-pagination__inner",arrow:"gov-pagination__arrow"};function k(o,r=1,t=10,e=10){const n=Math.ceil(o/t);if(r<1){r=1}else if(r>n){r=n}let a,i;if(n<=e){a=1;i=n}else{const o=Math.floor(e/2);const t=Math.ceil(e/2)-1;if(r<=o){a=1;i=e}else if(r+t>=n){a=n-e+1;i=n}else{a=r-o;i=r+t}}const s=(r-1)*t;const g=Math.min(s+t-1,o-1);const v=Array.from(Array(i+1-a).keys()).map((o=>a+o));return{totalItems:o,currentPage:r,pageSize:t,totalPages:n,startPage:a,endPage:i,startIndex:s,endIndex:g,pages:v}}const x=(o,r)=>{if(Number.isInteger(o)&&Number.isInteger(r)){return[...Array(r+1).keys()].slice(o)}return[]};const z=".gov-pagination__list{margin:0;padding:0}.gov-pagination__list .gov-pagination__item{margin:0;padding:0;background:none}.gov-pagination__list .gov-pagination__item::before{display:none}.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-pagination{position:relative;display:block;width:100%}.gov-pagination__list{display:flex;align-items:center;flex-wrap:wrap;font-weight:bold;text-align:center}.gov-pagination__list .gov-pagination__item{display:flex;justify-content:center;align-items:center;margin:0;padding:0.125rem;border-radius:var(--gov-border-radius, 0.1875rem);overflow:hidden}.gov-pagination__list .gov-pagination__item--arrow{display:flex}.gov-pagination__list .gov-pagination__item--select{z-index:1;display:flex;overflow:visible;padding:0rem 1rem}.gov-pagination__arrow{margin:0}.gov-pagination__item--more .gov-form-select select{border:none;padding-right:0.75rem !important}.gov-pagination__item--more .gov-form-select .gov-icon{display:none}.gov-pagination__inner{display:flex;justify-content:center;align-items:center;align-self:stretch;width:100%;text-decoration:none}.gov-pagination__inner[wcag-current=true][type=solid][variant=primary] .element{background-color:var(--gov-button-primary-solid-hover-bg, var(--gov-color-primary-700));color:var(--gov-button-primary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=primary] .element{background-color:var(--gov-button-primary-outlined-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-outlined-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=base][variant=primary] .element{background-color:var(--gov-button-primary-base-hover-bg, var(--gov-color-primary-100));color:var(--gov-button-primary-base-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=link][variant=primary] .element{background-color:var(--gov-button-primary-link-hover-bg, transparent);color:var(--gov-button-primary-link-hover-color, var(--gov-color-primary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=secondary] .element{background-color:var(--gov-button-secondary-solid-hover-bg, var(--gov-color-secondary-900));color:var(--gov-button-secondary-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=secondary] .element{background-color:var(--gov-button-secondary-outlined-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-outlined-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=base][variant=secondary] .element{background-color:var(--gov-button-secondary-base-hover-bg, var(--gov-color-secondary-300));color:var(--gov-button-secondary-base-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=link][variant=secondary] .element{background-color:var(--gov-button-secondary-link-hover-bg, transparent);color:var(--gov-button-secondary-link-hover-color, var(--gov-color-secondary))}.gov-pagination__inner[wcag-current=true][type=solid][variant=error] .element{background-color:var(--gov-button-error-solid-hover-bg, var(--gov-color-error-500));color:var(--gov-button-error-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=error] .element{background-color:var(--gov-button-error-outlined-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-outlined-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=base][variant=error] .element{background-color:var(--gov-button-error-base-hover-bg, var(--gov-color-error-100));color:var(--gov-button-error-base-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=link][variant=error] .element{background-color:var(--gov-button-error-link-hover-bg, transparent);color:var(--gov-button-error-link-hover-color, var(--gov-color-error))}.gov-pagination__inner[wcag-current=true][type=solid][variant=success] .element{background-color:var(--gov-button-success-solid-hover-bg, var(--gov-color-success-600));color:var(--gov-button-success-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=success] .element{background-color:var(--gov-button-success-outlined-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-outlined-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=success] .element{background-color:var(--gov-button-success-base-hover-bg, var(--gov-color-success-100));color:var(--gov-button-success-base-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=success] .element{background-color:var(--gov-button-success-link-hover-bg, transparent);color:var(--gov-button-success-link-hover-color, var(--gov-color-success-500))}.gov-pagination__inner[wcag-current=true][type=solid][variant=warning] .element{background-color:var(--gov-button-warning-solid-hover-bg, var(--gov-color-warning-600));color:var(--gov-button-warning-solid-hover-color, var(--gov-color-neutral-white))}.gov-pagination__inner[wcag-current=true][type=outlined][variant=warning] .element{background-color:var(--gov-button-warning-outlined-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-outlined-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=base][variant=warning] .element{background-color:var(--gov-button-warning-base-hover-bg, var(--gov-color-warning-200));color:var(--gov-button-warning-base-hover-color, var(--gov-color-warning-500))}.gov-pagination__inner[wcag-current=true][type=link][variant=warning] .element{background-color:var(--gov-button-warning-link-hover-bg, transparent);color:var(--gov-button-warning-link-hover-color, var(--gov-color-warning-500))}.gov-pagination[size=s] .gov-pagination__inner{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);font-weight:inherit}.gov-pagination[size=s] .gov-pagination__inner .element{min-width:var(--gov-pagination-s-button-size, 2rem)}.gov-pagination[size=m] .gov-pagination__inner{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);font-weight:inherit}.gov-pagination[size=m] .gov-pagination__inner .element{min-width:var(--gov-pagination-m-button-size, 2.5rem)}";const j=class{constructor(t){o(this,t);this.govPage=r(this,"gov-page",7);this.type="button";this.current=1;this.total=undefined;this.inverse=undefined;this.size="m";this.variant="primary";this.pageSize=10;this.maxPages=5;this.link=undefined;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.wcagSelectLabel="Vybrat stranu";this.wcagPageLabel="Strana";this.pagination=undefined;this.h=l(this.host);this.pageSelectId=m("GovPageSelect")}validateType(o){i(f,o,w.root)}validateSize(o){i(_,o,w.root)}validateVariant(o){i(y,o,w.root)}componentWillLoad(){this.recalculatePagination(this.current);this.validateSize(this.size);this.validateVariant(this.variant)}async componentDidRender(){if(b()){await c(500);await this.validateWcag()}}recalculatePagination(o){this.pagination=k(this.total,o,this.pageSize,this.maxPages)}isActivePageClass(o,r){if(this.pagination.currentPage===r){return o+" is-active"}else{return o}}prepareLinkUrl(o){if(this.link){return String(this.link).replace("{PAGE}",String(o))}return undefined}resetSelectValue(){if(this.spreadSelectRef){this.spreadSelectRef.getRef().then((o=>{o.value="..."}))}}render(){const o=(o,r)=>{const e=o===-1;const n=p(this.pagination.currentPage===o?true:undefined);return t("gov-button",{href:this.prepareLinkUrl(o),variant:this.variant,size:this.size,type:"base",disabled:e,"on-gov-click":r=>this.onClickHandler(r,o),"wcag-label":o>-1?this.wcagPageLabel+" "+o:undefined,"wcag-current":n,class:w.inner},r)};return t(e,{class:this.h.classes(w.root),type:this.type,variant:this.variant,size:this.size},t("nav",{"aria-label":this.wcagLabel,"aria-labelledby":this.wcagLabelledBy},t("ul",{class:w.list},t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.currentPage>1?1:-1,t("gov-icon",{class:w.arrow,name:"chevron-double-left"}))),t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.startPage<this.pagination.currentPage?this.pagination.currentPage-1:-1,t("gov-icon",{class:w.arrow,name:"chevron-left"}))),this.type=="select"?t("li",{class:u([w.item,w.itemSelect])},t("span",{class:w.inner},t("span",{id:this.pageSelectId,hidden:true},this.wcagSelectLabel),t("gov-form-select",{size:"m",variant:this.variant,"wcag-labelled-by":this.pageSelectId,"on-gov-change":this.onSelectHandler.bind(this)},x(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:this.pagination.currentPage===o},o)))))):t(a,null,this.pagination.pages.map((r=>t("li",{class:this.isActivePageClass(w.item,r)},o(r,r)))),t("li",{class:u([w.item,w.itemMore])},t("span",{class:w.inner},t("span",{id:this.pageSelectId,hidden:true},this.wcagSelectLabel),t("gov-form-select",{size:"m",variant:this.variant,"wcag-labelled-by":this.pageSelectId,ref:o=>this.spreadSelectRef=o,"on-gov-change":this.onSelectHandler.bind(this)},t("option",{selected:true,hidden:true},"..."),x(1,this.pagination.totalPages).map((o=>t("option",{value:o,selected:false},o))))))),t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.currentPage+1:-1,t("gov-icon",{class:w.arrow,name:"chevron-right"}))),t("li",{class:u([w.item,w.itemArrow])},o(this.pagination.totalPages>this.pagination.currentPage?this.pagination.totalPages:-1,t("gov-icon",{class:w.arrow,name:"chevron-double-right"}))))))}onClickHandler(o,r){o.stopPropagation();this.recalculatePagination(r);this.govPage.emit({component:w.root,pagination:this.pagination})}onSelectHandler(o){o.stopPropagation();const r=o.detail.value;const t=parseInt(r);this.resetSelectValue();if(isNaN(t)===false){this.recalculatePagination(t);if(this.link){window.location.href=this.prepareLinkUrl(t)}else{this.govPage.emit({component:w.root,pagination:this.pagination})}}}async validateWcag(){h(this.wcagPageLabel,"wcag-page-label",w.root);d(this.wcagLabel,this.wcagLabelledBy,w.root)}get host(){return n(this)}static get watchers(){return{type:["validateType"],size:["validateSize"],variant:["validateVariant"]}}};j.style=z;export{j as gov_pagination};
2
+ //# sourceMappingURL=p-724921e7.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-pagination/constants.ts","../../../packages/core/src/components/gov-pagination/pagination.ts","../../../packages/core/src/utils/array.utils.ts","../../../packages/core/src/components/gov-pagination/gov-pagination.scss?tag=gov-pagination","../../../packages/core/src/components/gov-pagination/gov-pagination.tsx"],"names":["PaginationSizes","pick","Sizes","PaginationVariants","Variants","PaginationTypes","PaginationClass","root","list","item","itemArrow","itemMore","itemSelect","inner","arrow","paginate","totalItems","currentPage","pageSize","maxPages","totalPages","Math","ceil","startPage","endPage","maxPagesBeforeCurrentPage","floor","maxPagesAfterCurrentPage","startIndex","endIndex","min","pages","Array","from","keys","map","i","createArrayRange","to","Number","isInteger","slice","govPaginationCss","GovPagination","[object Object]","hostRef","this","h","govHost","host","pageSelectId","createID","newValue","validateProp","recalculatePagination","current","validateSize","size","validateVariant","variant","canValidateWcagOnRender","delay","validateWcag","pagination","total","originalClass","page","link","String","replace","undefined","spreadSelectRef","getRef","then","el","value","pageResolver","content","isDisabled","ariaCurrent","toBoolAttrIfDefined","href","prepareLinkUrl","type","disabled","on-gov-click","e","onClickHandler","wcag-label","wcagPageLabel","wcag-current","class","Host","classes","aria-label","wcagLabel","aria-labelledby","wcagLabelledBy","prepareClasses","name","id","hidden","wcagSelectLabel","wcag-labelled-by","on-gov-change","onSelectHandler","bind","selected","Fragment","isActivePageClass","ref","stopPropagation","govPage","emit","component","detail","parseInt","resetSelectValue","isNaN","window","location","validateWcagProp","validateWcagLabel"],"mappings":"wbAKO,MAAMA,EAAkBC,EAAKC,EAAO,CAAC,KAAM,OAG3C,MAAMC,EAAqBF,EAAKG,EAAU,CAAC,UAAW,cAG7D,IAAYC,GAAZ,SAAYA,GACXA,EAAA,UAAA,SACAA,EAAA,UAAA,UAFD,CAAYA,IAAAA,EAAe,KAMpB,MAAMC,EAAkB,CAC9BC,KAAM,iBACNC,KAAM,uBACNC,KAAM,uBACNC,UAAW,8BACXC,SAAU,6BACVC,WAAY,+BACZC,MAAO,wBACPC,MAAO,kCCbQC,EAASC,EAAoBC,EAAc,EAAGC,EAAW,GAAIC,EAAW,IAEvF,MAAMC,EAAaC,KAAKC,KAAKN,EAAaE,GAG1C,GAAID,EAAc,EAAG,CACpBA,EAAc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AAIpB,KAAKqB,KAAM,CACdoD,OAAOC,SAASvC,KAAOnC,KAAKoC,eAAehB,OACrC,CACNpB,KAAKkE,QAAQC,KAAK,CACjBC,UAAW5G,EAAgBC,KAC3BwD,WAAYjB,KAAKiB,eAUrBnB,qBACC6E,EAAiB3E,KAAK2C,cAAe,kBAAmBnF,EAAgBC,MACxEmH,EAAkB5E,KAAKiD,UAAWjD,KAAKmD,eAAgB3F,EAAgBC","sourcesContent":["import { Sizes } from '../../core/constants/sizes'\nimport { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const PaginationSizes = pick(Sizes, ['_S', '_M'])\nexport type PaginationSizeType = `${ValueOf<typeof PaginationSizes>}`\n\nexport const PaginationVariants = pick(Variants, ['PRIMARY', 'SECONDARY'])\nexport type PaginationVariantType = `${ValueOf<typeof PaginationVariants>}`\n\nexport enum PaginationTypes {\n\tBUTTON = 'button',\n\tSELECT = 'select',\n}\nexport type PaginationType = `${ValueOf<typeof PaginationTypes>}`\n\nexport const PaginationClass = {\n\troot: 'gov-pagination',\n\tlist: 'gov-pagination__list',\n\titem: 'gov-pagination__item',\n\titemArrow: 'gov-pagination__item--arrow',\n\titemMore: 'gov-pagination__item--more',\n\titemSelect: 'gov-pagination__item--select',\n\tinner: 'gov-pagination__inner',\n\tarrow: 'gov-pagination__arrow',\n}\n","export interface Pagination {\n\ttotalItems: number\n\tcurrentPage: number\n\tpageSize: number\n\ttotalPages: number\n\tstartPage: number\n\tendPage: number\n\tstartIndex: number\n\tendIndex: number\n\tpages: number[]\n}\n\nexport function paginate(totalItems: number, currentPage = 1, pageSize = 10, maxPages = 10): Pagination {\n\t// calculate total pages\n\tconst totalPages = Math.ceil(totalItems / pageSize)\n\n\t// ensure current page isn't out of range\n\tif (currentPage < 1) {\n\t\tcurrentPage = 1\n\t} else if (currentPage > totalPages) {\n\t\tcurrentPage = totalPages\n\t}\n\n\tlet startPage: number, endPage: number\n\tif (totalPages <= maxPages) {\n\t\t// total pages less than max so show all pages\n\t\tstartPage = 1\n\t\tendPage = totalPages\n\t} else {\n\t\t// total pages more than max so calculate start and end pages\n\t\tconst maxPagesBeforeCurrentPage = Math.floor(maxPages / 2)\n\t\tconst maxPagesAfterCurrentPage = Math.ceil(maxPages / 2) - 1\n\t\tif (currentPage <= maxPagesBeforeCurrentPage) {\n\t\t\t// current page near the start\n\t\t\tstartPage = 1\n\t\t\tendPage = maxPages\n\t\t} else if (currentPage + maxPagesAfterCurrentPage >= totalPages) {\n\t\t\t// current page near the end\n\t\t\tstartPage = totalPages - maxPages + 1\n\t\t\tendPage = totalPages\n\t\t} else {\n\t\t\t// current page somewhere in the middle\n\t\t\tstartPage = currentPage - maxPagesBeforeCurrentPage\n\t\t\tendPage = currentPage + maxPagesAfterCurrentPage\n\t\t}\n\t}\n\n\t// calculate start and end item indexes\n\tconst startIndex = (currentPage - 1) * pageSize\n\tconst endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1)\n\n\t// create an array of pages to ng-repeat in the pager control\n\tconst pages = Array.from(Array(endPage + 1 - startPage).keys()).map(i => startPage + i)\n\n\t// return object with all pager properties required by the view\n\treturn {\n\t\ttotalItems: totalItems,\n\t\tcurrentPage: currentPage,\n\t\tpageSize: pageSize,\n\t\ttotalPages: totalPages,\n\t\tstartPage: startPage,\n\t\tendPage: endPage,\n\t\tstartIndex: startIndex,\n\t\tendIndex: endIndex,\n\t\tpages: pages,\n\t}\n}\n","export const createArrayRange = (from: number, to: number): number[] => {\n\tif (Number.isInteger(from) && Number.isInteger(to)) {\n\t\treturn [...Array(to + 1).keys()].slice(from)\n\t}\n\treturn []\n}\n","/*\n * Pagination\n */\n\n$class: \".gov-pagination\";\n\n#{$class} {\n\t@include base();\n\t&__list {\n\t\t@extend %reset-ul;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tflex-wrap: wrap;\n\t\tfont-weight: bold;\n\t\ttext-align: center;\n\t}\n\t&__list &__item {\n\t\t@extend %reset-ul-li;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tmargin: 0;\n\t\tpadding: rem-calc(2);\n\t\tborder-radius: $border-radius;\n\t\toverflow: hidden;\n\t\t&--arrow {\n\t\t\tdisplay: flex;\n\t\t}\n\t\t&--select {\n\t\t\tz-index: 1;\n\t\t\tdisplay: flex;\n\t\t\toverflow: visible;\n\t\t\tpadding: rem-calc(0 16);\n\t\t}\n\t}\n\t&__arrow {\n\t\tmargin: 0;\n\t}\n\t&__item--more {\n\t\t.gov-form-select {\n\t\t\tselect {\n\t\t\t\tborder: none;\n\t\t\t\tpadding-right: rem-calc(12) !important;\n\t\t\t}\n\t\t\t.gov-icon {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\talign-self: stretch;\n\t\twidth: 100%;\n\t\ttext-decoration: none;\n\t\t// Use hover styles from gov-button to active page button\n\t\t&[wcag-current=\"true\"] {\n\t\t\t@each $variant, $types in $button-variants {\n\t\t\t\t@each $type, $definitions in $types {\n\t\t\t\t\t&[type=\"#{$type}\"][variant=\"#{$variant}\"] {\n\t\t\t\t\t\t.element {\n\t\t\t\t\t\t\tbackground-color: deep-map-get($button-variants, $variant, $type, \"hover-bg\");\n\t\t\t\t\t\t\tcolor: deep-map-get($button-variants, $variant, $type, \"hover-color\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $pagination-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__inner {\n\t\t\t\t\t@include typography(get(\"font\", $definitions));\n\t\t\t\t\tfont-weight: inherit;\n\t\t\t\t\t.element {\n\t\t\t\t\t\tmin-width: get(\"button-size\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import Fragment from \"../../helpers/Fragment\"\nimport { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from \"@stencil/core\"\nimport { validateProp } from \"../../helpers/Validate/props\"\nimport {\n\tPaginationClass,\n\tPaginationSizeType,\n\tPaginationSizes,\n\tPaginationVariantType,\n\tPaginationType,\n\tPaginationTypes,\n\tPaginationVariants,\n} from \"./constants\"\nimport { govHost, prepareClasses } from \"../../helpers/Dom/template\"\nimport { paginate, Pagination } from \"./pagination\"\nimport { toBoolAttrIfDefined } from \"../../helpers/Dom/template\"\nimport { validateWcagLabel, validateWcagProp } from \"../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\nimport { createID } from \"../../utils/string.utils\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport {createArrayRange } from \"../../utils/array.utils\"\nimport { FormSelectEvent } from \"../gov-form/select/gov-form-select.types\"\nimport { PaginationEvent } from \"./gov-pagination.types\"\n\n@Component({\n\ttag: \"gov-pagination\",\n\tstyleUrl: \"gov-pagination.scss\",\n})\nexport class GovPagination {\n\tprivate h: GovHost\n\tprivate readonly pageSelectId: string\n\n\tprivate spreadSelectRef?: HTMLGovFormSelectElement\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.pageSelectId = createID(\"GovPageSelect\")\n\t}\n\n\t@Element() readonly host: HTMLGovPaginationElement\n\t/**\n\t * Pagination type\n\t */\n\t@Prop() readonly type: PaginationType = \"button\"\n\t/**\n\t * Currently displayed page\n\t */\n\t@Prop() readonly current: number = 1\n\t/**\n\t * Total count of entries\n\t */\n\t@Prop() readonly total: number\n\t/**\n\t * Set on active page\n\t */\n\t@Prop() readonly inverse: boolean\n\t/**\n\t * Pagination's size\n\t */\n\t@Prop() readonly size?: PaginationSizeType = \"m\"\n\t/**\n\t * Style variation of the pagination.\n\t */\n\t@Prop() readonly variant?: PaginationVariantType = \"primary\"\n\t/**\n\t * Maximum number of entries per page\n\t */\n\t@Prop({ attribute: \"page-size\" }) readonly pageSize: number = 10\n\t/**\n\t * Maximum pages displayed for selection\n\t */\n\t@Prop({ attribute: \"max-pages\" }) readonly maxPages: number = 5\n\t/**\n\t * Setting a link to redirect to a given page.\n\t * The {PAGE} wildcard can be used in the link to replace the page number.\n\t * Note that in the case of paging through a link, it is always necessary to send to the component the current page where the user is.\n\t */\n\t@Prop() readonly link: string\n\t/**\n\t * Adds accessible label for the pagination that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-label\" }) readonly wcagLabel: string\n\t/**\n\t * Indicates the id of a component that labels the pagination.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the page select\n\t */\n\t@Prop({ attribute: \"wcag-select-label\" }) readonly wcagSelectLabel: string = \"Vybrat stranu\"\n\t/**\n\t * Adds accessible label for the page item\n\t */\n\t@Prop({ attribute: \"wcag-page-label\" }) readonly wcagPageLabel: string = \"Strana\"\n\t/**\n\t * Event called when changing the page with the current setting of the whole paging\n\t */\n\t@Event({ eventName: \"gov-page\" }) govPage: EventEmitter<PaginationEvent>\n\n\t@State() pagination: Pagination\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(PaginationTypes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(PaginationSizes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(PaginationVariants, newValue, PaginationClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.recalculatePagination(this.current)\n\t\tthis.validateSize(this.size)\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\tprivate recalculatePagination(currentPage: number) {\n\t\tthis.pagination = paginate(this.total, currentPage, this.pageSize, this.maxPages)\n\t}\n\n\tprivate isActivePageClass(originalClass: string, page: number) {\n\t\tif (this.pagination.currentPage === page) {\n\t\t\treturn originalClass + \" is-active\"\n\t\t} else {\n\t\t\treturn originalClass\n\t\t}\n\t}\n\n\tprivate prepareLinkUrl(page: number) {\n\t\tif (this.link) {\n\t\t\treturn String(this.link).replace(\"{PAGE}\", String(page))\n\t\t}\n\t\treturn undefined\n\t}\n\n\tprivate resetSelectValue() {\n\t\tif (this.spreadSelectRef) {\n\t\t\tthis.spreadSelectRef.getRef()\n\t\t\t\t.then((el: HTMLSelectElement) => {\n\t\t\t\t\tel.value = '...'\n\t\t\t\t})\n\t\t}\n\t}\n\n\trender() {\n\t\tconst pageResolver = (page: number, content: any) => {\n\t\t\tconst isDisabled = page === -1\n\t\t\tconst ariaCurrent = toBoolAttrIfDefined(this.pagination.currentPage === page ? true : undefined)\n\t\t\treturn (\n\t\t\t\t<gov-button\n\t\t\t\t\thref={this.prepareLinkUrl(page)}\n\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\tsize={this.size}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\ton-gov-click={(e) => this.onClickHandler(e, page)}\n\t\t\t\t\twcag-label={page > -1 ? this.wcagPageLabel + \" \" + page : undefined}\n\t\t\t\t\twcag-current={ariaCurrent}\n\t\t\t\t\tclass={PaginationClass.inner}>\n\t\t\t\t\t{content}\n\t\t\t\t</gov-button>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<Host class={this.h.classes(PaginationClass.root)} type={this.type} variant={this.variant} size={this.size}>\n\t\t\t\t<nav aria-label={this.wcagLabel} aria-labelledby={this.wcagLabelledBy}>\n\t\t\t\t\t<ul class={PaginationClass.list}>\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.currentPage > 1 ? 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.startPage < this.pagination.currentPage ? this.pagination.currentPage - 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t{this.type == \"select\" ? (\n\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemSelect])}>\n\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={this.pagination.currentPage === page}>\n\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{this.pagination.pages.map(page => (\n\t\t\t\t\t\t\t\t\t<li class={this.isActivePageClass(PaginationClass.item, page)}>{pageResolver(page, page)}</li>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemMore])}>\n\t\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\t\tref={el => (this.spreadSelectRef = el as HTMLGovFormSelectElement)}\n\t\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t\t<option selected hidden>...</option>\n\t\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={false}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.currentPage + 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.totalPages : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: CustomEvent, page: number): void {\n\t\te.stopPropagation()\n\t\tthis.recalculatePagination(page)\n\t\tthis.govPage.emit({\n\t\t\tcomponent: PaginationClass.root,\n\t\t\tpagination: this.pagination\n\t\t})\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent<FormSelectEvent>): void {\n\t\te.stopPropagation()\n\t\tconst value = e.detail.value\n\t\tconst page = parseInt(value)\n\t\tthis.resetSelectValue()\n\t\tif (isNaN(page) === false) {\n\t\t\tthis.recalculatePagination(page)\n\t\t\tif (this.link) {\n\t\t\t\twindow.location.href = this.prepareLinkUrl(page)\n\t\t\t} else {\n\t\t\t\tthis.govPage.emit({\n\t\t\t\t\tcomponent: PaginationClass.root,\n\t\t\t\t\tpagination: this.pagination\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagProp(this.wcagPageLabel, \"wcag-page-label\", PaginationClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, PaginationClass.root)\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{r as a,c as i,h as t,H as s,g as o}from"./p-4af5e4f4.js";import{v as r}from"./p-26acf964.js";import{A as e,a as n,b as p}from"./p-a5d69694.js";import{V as c}from"./p-ff7365ae.js";import{v as d}from"./p-364b4792.js";import{c as m}from"./p-c20102ff.js";import{d as f}from"./p-03990da5.js";import{g as h}from"./p-3f37ddb6.js";import"./p-561fa17b.js";import"./p-55500e5a.js";import"./p-24636c53.js";const l=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-accordion{position:relative;display:block;width:100%}.gov-accordion[no-border] .gov-accordion-item__header::before{background-color:transparent !important}";const g=class{constructor(t){a(this,t);this.govChange=i(this,"gov-change",7);this.size="m";this.variant="primary";this.noBorder=false;this.wcagLabel=undefined;this.wcagLabelledBy=undefined;this.h=h(this.host)}validateSize(a){r(p,a,n.root)}validateVariant(a){r(c,a,n.root)}componentWillLoad(){this.validateSize(this.size);this.validateVariant(this.variant)}componentDidLoad(){this.host.querySelectorAll(e.root).forEach((a=>{a.addEventListener("gov-change",(a=>{a.stopPropagation();this.govChange.emit({component:n.root,open:a.detail.open,ref:a.detail.ref})}))}))}async componentDidRender(){if(m()){await f(500);await this.validateWcag()}}render(){return t(s,{class:this.h.classes(n.root),size:this.size,variant:this.variant},t("div",{role:"list","arial-label":this.wcagLabel,"arial-labelledby":this.wcagLabelledBy},t("slot",null)))}async validateWcag(){d(this.wcagLabel,this.wcagLabelledBy,n.root)}get host(){return o(this)}static get watchers(){return{size:["validateSize"],variant:["validateVariant"]}}};g.style=l;export{g as gov_accordion};
2
+ //# sourceMappingURL=p-85404e69.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-accordion/gov-accordion.scss?tag=gov-accordion","../../../packages/core/src/components/gov-accordion/gov-accordion.tsx"],"names":["govAccordionCss","GovAccordion","[object Object]","hostRef","this","h","govHost","host","newValue","validateProp","AccordionSizes","AccordionClass","root","Variants","validateSize","size","validateVariant","variant","querySelectorAll","AccordionItemClass","forEach","child","addEventListener","e","stopPropagation","govChange","emit","component","open","detail","ref","canValidateWcagOnRender","delay","validateWcag","Host","class","classes","role","arial-label","wcagLabel","arial-labelledby","wcagLabelledBy","validateWcagLabel"],"mappings":"kZAAA,MAAMA,EAAkB,+fCeXC,EAAY,MAGxBC,YAAAC,6DAQ4C,iBAIM,wBAIa,6DAf9DC,KAAKC,EAAIC,EAAQF,KAAKG,MA8BvBL,aAAaM,GACZC,EAAaC,EAAgBF,EAAUG,EAAeC,MAIvDV,gBAAgBM,GACfC,EAAaI,EAAUL,EAAUG,EAAeC,MAGjDV,oBACCE,KAAKU,aAAaV,KAAKW,MACvBX,KAAKY,gBAAgBZ,KAAKa,SAG3Bf,mBACCE,KAAKG,KAAKW,iBAAiBC,EAAmBP,MAAMQ,SAASC,IAC5DA,EAAMC,iBAAiB,cAAeC,IACrCA,EAAEC,kBACFpB,KAAKqB,UAAUC,KAAK,CACnBC,UAAWhB,EAAeC,KAC1BgB,KAAML,EAAEM,OAAOD,KACfE,IAAKP,EAAEM,OAAOC,YAMlB5B,2BACC,GAAI6B,IAA2B,OACxBC,EAAM,WACN5B,KAAK6B,gBAIb/B,SACC,OACCG,EAAC6B,EAAI,CAACC,MAAO/B,KAAKC,EAAE+B,QAAQzB,EAAeC,MAAOG,KAAMX,KAAKW,KAAME,QAASb,KAAKa,SAChFZ,EAAA,MAAA,CAAKgC,KAAM,OAAMC,cAAelC,KAAKmC,UAASC,mBAAoBpC,KAAKqC,gBACtEpC,EAAA,OAAA,QAUJH,qBACCwC,EAAkBtC,KAAKmC,UAAWnC,KAAKqC,eAAgB9B,EAAeC","sourcesContent":["/*\n * Accordion\n */\n\n$class: \".gov-accordion\";\n\n#{$class} {\n\t@include base();\n\n\t&[no-border] {\n\t\t.gov-accordion-item__header::before {\n\t\t\tbackground-color: transparent !important;\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { AccordionClass, AccordionSizes, AccordionSizeType, AccordionItemClass, AccordionVariantType } from './constants'\nimport { Variants } from '../../core/constants/variants'\nimport { validateWcagLabel } from '../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../helpers/Dom/win'\nimport { delay } from '../../utils/utils'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\nimport { AccordionEvent, AccordionItemEvent } from \"./gov-accordion.types\"\n\n@Component({\n\ttag: 'gov-accordion',\n\tstyleUrl: 'gov-accordion.scss',\n})\nexport class GovAccordion {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() readonly host: HTMLGovAccordionElement\n\t/**\n\t * Accordion’s size.\n\t */\n\t@Prop() readonly size?: AccordionSizeType = 'm'\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant?: AccordionVariantType = 'primary'\n\t/**\n\t * Accordion item underline\n\t */\n\t@Prop({ attribute: 'no-border' }) readonly noBorder: boolean = false\n\t/**\n\t * Adds accessible label for the accordion that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-label' }) readonly wcagLabel: string\n\t/**\n\t * String of id's that indicate alternative labels elements\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Called when the accordion state changes\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<AccordionEvent>\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(AccordionSizes, newValue, AccordionClass.root)\n\t}\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(Variants, newValue, AccordionClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateSize(this.size)\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\tcomponentDidLoad() {\n\t\tthis.host.querySelectorAll(AccordionItemClass.root).forEach((child: HTMLGovAccordionItemElement) => {\n\t\t\tchild.addEventListener('gov-change', (e: CustomEvent<AccordionItemEvent>) => {\n\t\t\t\te.stopPropagation()\n\t\t\t\tthis.govChange.emit({\n\t\t\t\t\tcomponent: AccordionClass.root,\n\t\t\t\t\topen: e.detail.open,\n\t\t\t\t\tref: e.detail.ref\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes(AccordionClass.root)} size={this.size} variant={this.variant}>\n\t\t\t\t<div role={'list'} arial-label={this.wcagLabel} arial-labelledby={this.wcagLabelledBy}>\n\t\t\t\t\t<slot />\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, AccordionClass.root)\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{r as o,c as e,h as r,H as c,g as i}from"./p-4af5e4f4.js";import{c as a}from"./p-24636c53.js";import{v as t}from"./p-26acf964.js";import{g as s,F as h,a as v}from"./p-9cd80b05.js";import{g as n,a as m,t as g}from"./p-3f37ddb6.js";import{a as l,b}from"./p-364b4792.js";import{c as f}from"./p-c20102ff.js";import{d}from"./p-03990da5.js";import{F as k}from"./p-1c1d0bbe.js";import"./p-561fa17b.js";import"./p-55500e5a.js";import"./p-ff7365ae.js";import"./p-ef79904e.js";import"./p-6278531b.js";import"./p-f687452c.js";import"./p-3464136c.js";const p='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-checkbox{cursor:pointer}.gov-form-checkbox input{position:absolute;top:0;left:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.gov-form-checkbox input+span{position:relative;display:block}.gov-form-checkbox input+span::before{content:"";position:absolute;display:block;top:0;left:0;border:var(--gov-form-checkbox-border-size, 0.125rem solid var(--gov-color-primary));background-color:var(--gov-form-checkbox-background-color, var(--gov-color-neutral-white));transition:150ms linear border-color, 150ms linear background-color, 150ms linear outline-color}.gov-form-checkbox .gov-form-label__label{position:relative;z-index:1;width:100%}.gov-form-checkbox input:focus-visible+span::before{outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base)}[invalid=""].gov-form-checkbox .gov-form-label__label,[invalid=true i].gov-form-checkbox .gov-form-label__label,[invalid="1"].gov-form-checkbox .gov-form-label__label{color:var(--gov-form-state-color-error, var(--gov-color-error))}[invalid=""].gov-form-checkbox input+span::before,[invalid=true i].gov-form-checkbox input+span::before,[invalid="1"].gov-form-checkbox input+span::before{border-color:var(--gov-form-state-color-error, var(--gov-color-error))}[disabled=""].gov-form-checkbox,[disabled=true i].gov-form-checkbox,[disabled="1"].gov-form-checkbox{pointer-events:none}[disabled=""].gov-form-checkbox .gov-form-label__label,[disabled=true i].gov-form-checkbox .gov-form-label__label,[disabled="1"].gov-form-checkbox .gov-form-label__label{color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[disabled=""].gov-form-checkbox input+span::before,[disabled=true i].gov-form-checkbox input+span::before,[disabled="1"].gov-form-checkbox input+span::before{border-color:var(--gov-form-input-disabled-bg, var(--gov-color-primary-400))}[size=xs].gov-form-checkbox{font-weight:var(--gov-text-xs-font-weight);font-size:var(--gov-text-xs-font-size);line-height:var(--gov-text-xs-line-height);letter-spacing:var(--gov-text-xs-letter-spacing);display:block;min-width:var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem);min-height:var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem)}[size=xs].gov-form-checkbox .gov-form-label__label{padding-top:calc((var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem) - var(--gov-text-xs-font-size) * 1.5) / 2);padding-left:calc(var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem) + var(--gov-form-checkbox-core-xs-gap, 0.75rem))}[size=xs].gov-form-checkbox input+span::before{width:var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem);height:var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem)}[size=s].gov-form-checkbox{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);display:block;min-width:var(--gov-form-checkbox-core-s-indicator-size, 1.375rem);min-height:var(--gov-form-checkbox-core-s-indicator-size, 1.375rem)}[size=s].gov-form-checkbox .gov-form-label__label{padding-top:calc((var(--gov-form-checkbox-core-s-indicator-size, 1.375rem) - var(--gov-text-s-font-size) * 1.5) / 2);padding-left:calc(var(--gov-form-checkbox-core-s-indicator-size, 1.375rem) + var(--gov-form-checkbox-core-s-gap, 0.75rem))}[size=s].gov-form-checkbox input+span::before{width:var(--gov-form-checkbox-core-s-indicator-size, 1.375rem);height:var(--gov-form-checkbox-core-s-indicator-size, 1.375rem)}[size=m].gov-form-checkbox{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);display:block;min-width:var(--gov-form-checkbox-core-m-indicator-size, 1.5rem);min-height:var(--gov-form-checkbox-core-m-indicator-size, 1.5rem)}[size=m].gov-form-checkbox .gov-form-label__label{padding-top:calc((var(--gov-form-checkbox-core-m-indicator-size, 1.5rem) - var(--gov-text-m-font-size) * 1.5) / 2);padding-left:calc(var(--gov-form-checkbox-core-m-indicator-size, 1.5rem) + var(--gov-form-checkbox-core-m-gap, 1rem))}[size=m].gov-form-checkbox input+span::before{width:var(--gov-form-checkbox-core-m-indicator-size, 1.5rem);height:var(--gov-form-checkbox-core-m-indicator-size, 1.5rem)}[size=l].gov-form-checkbox{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);display:block;min-width:var(--gov-form-checkbox-core-l-indicator-size, 2rem);min-height:var(--gov-form-checkbox-core-l-indicator-size, 2rem)}[size=l].gov-form-checkbox .gov-form-label__label{padding-top:calc((var(--gov-form-checkbox-core-l-indicator-size, 2rem) - var(--gov-text-l-font-size) * 1.5) / 2);padding-left:calc(var(--gov-form-checkbox-core-l-indicator-size, 2rem) + var(--gov-form-checkbox-core-l-gap, 1rem))}[size=l].gov-form-checkbox input+span::before{width:var(--gov-form-checkbox-core-l-indicator-size, 2rem);height:var(--gov-form-checkbox-core-l-indicator-size, 2rem)}.gov-form-checkbox input+span::before{border-radius:var(--gov-border-radius, 0.1875rem)}.gov-form-checkbox__check{position:absolute;color:var(--gov-form-checkbox-check-color, var(--gov-color-neutral-white));opacity:0;transition:150ms linear opacity}.gov-form-checkbox input:checked+span::before{background:var(--gov-form-checkbox-indicator-bg, var(--gov-color-primary))}input:checked+span .gov-form-checkbox__check{opacity:1}.gov-form-checkbox[invalid=""] input:checked+span::before,.gov-form-checkbox[invalid=true i] input:checked+span::before,.gov-form-checkbox[invalid="1"] input:checked+span::before{background:var(--gov-form-state-color-error, var(--gov-color-error))}.gov-form-checkbox[disabled=""] input:checked+span::before,.gov-form-checkbox[disabled=true i] input:checked+span::before,.gov-form-checkbox[disabled="1"] input:checked+span::before{border-color:var(--gov-form-input-disabled-bg, var(--gov-color-primary-400));background-color:var(--gov-form-input-disabled-bg, var(--gov-color-primary-400))}.gov-form-checkbox[size=xs] .gov-form-checkbox__check{top:calc((var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem) - var(--gov-form-checkbox-core-xs-check-size, 0.75rem)) / 2);left:calc((var(--gov-form-checkbox-core-xs-indicator-size, 1.25rem) - var(--gov-form-checkbox-core-xs-check-size, 0.75rem)) / 2);width:var(--gov-form-checkbox-core-xs-check-size, 0.75rem);height:var(--gov-form-checkbox-core-xs-check-size, 0.75rem)}.gov-form-checkbox[size=s] .gov-form-checkbox__check{top:calc((var(--gov-form-checkbox-core-s-indicator-size, 1.375rem) - var(--gov-form-checkbox-core-s-check-size, 0.825rem)) / 2);left:calc((var(--gov-form-checkbox-core-s-indicator-size, 1.375rem) - var(--gov-form-checkbox-core-s-check-size, 0.825rem)) / 2);width:var(--gov-form-checkbox-core-s-check-size, 0.825rem);height:var(--gov-form-checkbox-core-s-check-size, 0.825rem)}.gov-form-checkbox[size=m] .gov-form-checkbox__check{top:calc((var(--gov-form-checkbox-core-m-indicator-size, 1.5rem) - var(--gov-form-checkbox-core-m-check-size, 0.9rem)) / 2);left:calc((var(--gov-form-checkbox-core-m-indicator-size, 1.5rem) - var(--gov-form-checkbox-core-m-check-size, 0.9rem)) / 2);width:var(--gov-form-checkbox-core-m-check-size, 0.9rem);height:var(--gov-form-checkbox-core-m-check-size, 0.9rem)}.gov-form-checkbox[size=l] .gov-form-checkbox__check{top:calc((var(--gov-form-checkbox-core-l-indicator-size, 2rem) - var(--gov-form-checkbox-core-l-check-size, 1.2rem)) / 2);left:calc((var(--gov-form-checkbox-core-l-indicator-size, 2rem) - var(--gov-form-checkbox-core-l-check-size, 1.2rem)) / 2);width:var(--gov-form-checkbox-core-l-check-size, 1.2rem);height:var(--gov-form-checkbox-core-l-check-size, 1.2rem)}';const x=class{constructor(r){o(this,r);this.govFocus=e(this,"gov-focus",7);this.govBlur=e(this,"gov-blur",7);this.govChange=e(this,"gov-change",7);this.value=undefined;this.checked=false;this.required=false;this.disabled=undefined;this.name=undefined;this.size="m";this.identifier=undefined;this.noLabel=false;this.invalid=undefined;this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.checkboxId=a("GovCheckbox");this.h=n(this.host);this.f=s(this.h)}validateSize(o){t(v,o,h.root)}componentWillLoad(){this.f.passAttrToControl("type","checkbox")}async componentDidRender(){this.f.passAttrToLabel("identifier",this.identifier||this.checkboxId);this.f.passAttrToLabel("required",String(this.required));if(f()){await d(500);await this.validateWcag()}}render(){const o=o=>{if(this.noLabel){return r("label",null,o)}return o};return r(c,{class:h.root,checked:this.checked,size:this.size,invalid:g(this.invalid)},o(r(k,null,r("input",{id:this.identifier||this.checkboxId,type:"checkbox",value:this.value,name:this.name,checked:this.checked,onClick:this.onClickHandler.bind(this),onChange:this.onChangeHandler.bind(this),onFocus:this.onFocusHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,ref:o=>this.inputRef=o,"aria-checked":m(this.checked),"aria-required":g(this.required),"aria-invalid":g(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-disabled":g(this.disabled)}),r("span",null,r("slot",{name:"label"}),r("gov-icon",{class:h.check,name:"check-lg"})))))}onFocusHandler(o){o.stopPropagation();this.govFocus.emit({component:h.root,value:this.value,checked:this.checked,originalEvent:o})}onBlurHandler(o){o.stopPropagation();this.govBlur.emit({component:h.root,value:this.value,checked:this.checked,originalEvent:o})}onClickHandler(o){o.stopPropagation()}onChangeHandler(o){this.checked=o.target.checked;o.stopPropagation();this.govChange.emit({component:h.root,value:this.value,checked:this.checked,originalEvent:o})}async getRef(){return this.inputRef}async validateWcag(){l(this.wcagDescribedBy,"wcag-described-by",h.root);l(this.wcagLabelledBy,"wcag-labelled-by",h.root);b(this.identifier||this.checkboxId,this.wcagLabelledBy,h.root)}get host(){return i(this)}static get watchers(){return{size:["validateSize"]}}};x.style=p;export{x as gov_form_checkbox};
2
+ //# sourceMappingURL=p-8bb1ad43.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../packages/core/src/components/gov-form/checkbox/gov-form-checkbox.scss?tag=gov-form-checkbox","../../../packages/core/src/components/gov-form/checkbox/gov-form-checkbox.tsx"],"names":["govFormCheckboxCss","GovFormCheckbox","[object Object]","hostRef","this","checkboxId","createID","h","govHost","host","f","govForm","newValue","validateProp","FormCheckboxSizes","FormCheckboxClass","root","passAttrToControl","passAttrToLabel","identifier","String","required","canValidateWcagOnRender","delay","validateWcag","wrapCheckbox","children","noLabel","Host","class","checked","size","invalid","toBoolAttrIfDefined","Fragment","id","type","value","name","onClick","onClickHandler","bind","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","ref","el","inputRef","aria-checked","toBoolAttr","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","disabled","check","e","stopPropagation","govFocus","emit","component","originalEvent","govBlur","target","govChange","validateWcagRef","validateWcagLabelFor"],"mappings":"iiBAAA,MAAMA,EAAqB,u6PCmBdC,EAAe,MAO3BC,YAAAC,2JAekD,oBAKb,4DAaW,2CAQa,0FAxC5DC,KAAKC,WAAaC,EAAS,eAE3BF,KAAKG,EAAIC,EAAQJ,KAAKK,MACtBL,KAAKM,EAAIC,EAAQP,KAAKG,GAgEvBL,aAAaU,GACZC,EAAaC,EAAmBF,EAAUG,EAAkBC,MAG7Dd,oBACCE,KAAKM,EAAEO,kBAAkB,OAAQ,YAGlCf,2BACCE,KAAKM,EAAEQ,gBAAgB,aAAcd,KAAKe,YAAcf,KAAKC,YAC7DD,KAAKM,EAAEQ,gBAAgB,WAAYE,OAAOhB,KAAKiB,WAC/C,GAAIC,IAA2B,OACxBC,EAAM,WACNnB,KAAKoB,gBAIbtB,SACC,MAAMuB,EAAgBC,IACrB,GAAItB,KAAKuB,QAAS,CACjB,OACCpB,EAAA,QAAA,KACEmB,GAIJ,OAAOA,GAGR,OACCnB,EAACqB,EAAI,CAACC,MAAOd,EAAkBC,KAAMc,QAAS1B,KAAK0B,QAASC,KAAM3B,KAAK2B,KAAMC,QAASC,EAAoB7B,KAAK4B,UAC7GP,EACAlB,EAAC2B,EAAQ,KACR3B,E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BACCqE,EAAgBnE,KAAKoD,gBAAiB,oBAAqBzC,EAAkBC,MAC7EuD,EAAgBnE,KAAKsD,eAAgB,mBAAoB3C,EAAkBC,MAC3EwD,EAAqBpE,KAAKe,YAAcf,KAAKC,WAAYD,KAAKsD,eAAgB3C,EAAkBC","sourcesContent":["/*\n * Checkbox\n */\n\n@import \"../checkbox/gov-form-checkbox-core.scss\";\n$class: \".gov-form-checkbox\";\n\n#{$class} {\n\t@extend %form-checkbox-core;\n\tinput + span {\n\t\t&::before {\n\t\t\tborder-radius: $border-radius;\n\t\t}\n\t}\n\t&__check {\n\t\tposition: absolute;\n\t\tcolor: $form-checkbox-check-color;\n\t\topacity: 0;\n\t\ttransition: $t linear opacity;\n\t}\n\n\t// STATES\n\tinput:checked + span::before {\n\t\tbackground: $form-checkbox-indicator-bg;\n\t}\n\tinput:checked + span &__check {\n\t\topacity: 1;\n\t}\n\t@include parameter(\"invalid\") {\n\t\tinput:checked + span::before {\n\t\t\tbackground: $form-state-color-error;\n\t\t}\n\t}\n\t@include parameter(\"disabled\") {\n\t\tinput:checked + span::before {\n\t\t\tborder-color: $form-state-bg-disabled;\n\t\t\tbackground-color: $form-state-bg-disabled;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $form-checkbox-core-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__check {\n\t\t\t\t\ttop: calc((get(\"indicator-size\", $definitions) - get(\"check-size\", $definitions)) / 2);\n\t\t\t\t\tleft: calc((get(\"indicator-size\", $definitions) - get(\"check-size\", $definitions)) / 2);\n\t\t\t\t\twidth: get(\"check-size\", $definitions);\n\t\t\t\t\theight: get(\"check-size\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Host, h, Prop, Event, EventEmitter, Element, Watch, Method } from \"@stencil/core\"\nimport { createID } from \"../../../utils/string.utils\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { FormCheckboxClass, FormCheckboxSizes, FormCheckboxSizesType } from \"./constants\"\nimport { toBoolAttrIfDefined } from \"../../../helpers/Dom/template\"\nimport { validateWcagLabelFor, validateWcagRef } from \"../../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { GovForm } from \"../../../helpers/Dom/form.types\"\nimport { govHost, toBoolAttr } from \"../../../helpers/Dom/template\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport Fragment from \"../../../helpers/Fragment\"\nimport { FormCheckboxEvent } from \"./gov-form-checkbox.types\"\n\n@Component({\n\ttag: \"gov-form-checkbox\",\n\tstyleUrl: \"gov-form-checkbox.scss\",\n})\nexport class GovFormCheckbox {\n\tprivate readonly h: GovHost\n\tprivate f: GovForm\n\tprivate inputRef?: HTMLInputElement\n\n\tprivate readonly checkboxId: string\n\n\tconstructor() {\n\t\tthis.checkboxId = createID(\"GovCheckbox\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormCheckboxElement\n\t/**\n\t * Value of checkbox\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * Checkbox default state\n\t */\n\t@Prop({ reflect: true, mutable: true }) checked = 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 checkbox component disabled.\n\t * This prevents users from being able to interact with the checkbox, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Name of the checkbox.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Checkboxes size.\n\t */\n\t@Prop() readonly size?: FormCheckboxSizesType = \"m\"\n\t/**\n\t * Custom checkbox identifier.\n\t */\n\t@Prop({ attribute: \"identifier\" }) readonly identifier: string\n\t/**\n\t * When you can't use the form label.\n\t */\n\t@Prop({ attribute: \"no-label\" }) readonly noLabel: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the checkbox has focus.\n\t */\n\t@Event({ eventName: \"gov-focus\" }) govFocus: EventEmitter<FormCheckboxEvent>\n\t/**\n\t * Emitted when the checkbox loses focus.\n\t */\n\t@Event({ eventName: \"gov-blur\" }) govBlur: EventEmitter<FormCheckboxEvent>\n\t/**\n\t * Emitted when the checkbox change value.\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<FormCheckboxEvent>\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormCheckboxSizes, newValue, FormCheckboxClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToControl(\"type\", \"checkbox\")\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel(\"identifier\", this.identifier || this.checkboxId)\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst wrapCheckbox = (children) => {\n\t\t\tif (this.noLabel) {\n\t\t\t\treturn (\n\t\t\t\t\t<label>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</label>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\n\t\treturn (\n\t\t\t<Host class={FormCheckboxClass.root} checked={this.checked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t{wrapCheckbox(\n\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid={this.identifier || this.checkboxId}\n\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tchecked={this.checked}\n\t\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\t\taria-checked={toBoolAttr(this.checked)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<slot name=\"label\" />\n\t\t\t\t\t\t\t<gov-icon class={FormCheckboxClass.check} name=\"check-lg\"></gov-icon>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Fragment>,\n\t\t\t\t)}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormCheckboxClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\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: FormCheckboxClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onClickHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.checked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormCheckboxClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\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 * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormCheckboxClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormCheckboxClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.checkboxId, this.wcagLabelledBy, FormCheckboxClass.root)\n\t}\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import{r as o,c as s,h as i,H as a}from"./p-4af5e4f4.js";import{F as r}from"./p-3464136c.js";import"./p-03990da5.js";import"./p-55500e5a.js";const e=".gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-label{position:relative;display:flex;width:100%}.gov-form-label__label{display:inline-block;color:var(--gov-form-label-color, #686868);cursor:pointer;box-sizing:border-box}";const t=class{constructor(i){o(this,i);this.govClick=s(this,"gov-click",7);this.identifier=undefined;this.size="m";this.required=false;this.legend=false}render(){const o=this.legend?"legend":"label";return i(a,{class:r.root,size:this.size},i(o,{class:r.label,htmlFor:this.identifier,onClick:()=>this.govClick.emit()},i("slot",null),this.required?i("span",{class:"gov-color--danger-500"},"*"):null))}};t.style=e;export{t as gov_form_label};
2
+ //# sourceMappingURL=p-96a59983.entry.js.map