@gov-design-system-ce/components 0.0.18 → 0.0.20

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 (239) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/gov-accordion-item.cjs.entry.js +12 -4
  3. package/dist/cjs/gov-accordion-item.cjs.entry.js.map +1 -1
  4. package/dist/cjs/gov-accordion.cjs.entry.js +0 -2
  5. package/dist/cjs/gov-accordion.cjs.entry.js.map +1 -1
  6. package/dist/cjs/gov-alert.cjs.entry.js +39 -7
  7. package/dist/cjs/gov-alert.cjs.entry.js.map +1 -1
  8. package/dist/cjs/gov-app.cjs.entry.js +8 -1
  9. package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
  10. package/dist/cjs/gov-button.cjs.entry.js +1 -1
  11. package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
  12. package/dist/cjs/gov-form-checkbox.cjs.entry.js +1 -1
  13. package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
  14. package/dist/cjs/gov-form-control.cjs.entry.js +1 -1
  15. package/dist/cjs/gov-form-control.cjs.entry.js.map +1 -1
  16. package/dist/cjs/gov-form-input.cjs.entry.js +1 -1
  17. package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
  18. package/dist/cjs/gov-form-label.cjs.entry.js +1 -1
  19. package/dist/cjs/gov-form-label.cjs.entry.js.map +1 -1
  20. package/dist/cjs/gov-form-multi-select.cjs.entry.js +1 -1
  21. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  22. package/dist/cjs/gov-form-radio.cjs.entry.js +1 -1
  23. package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
  24. package/dist/cjs/gov-form-select.cjs.entry.js +1 -1
  25. package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
  26. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  27. package/dist/cjs/gov-layout-column.cjs.entry.js +1 -1
  28. package/dist/cjs/gov-layout-column.cjs.entry.js.map +1 -1
  29. package/dist/cjs/gov-modal.cjs.entry.js +9 -11
  30. package/dist/cjs/gov-modal.cjs.entry.js.map +1 -1
  31. package/dist/cjs/gov-prompt.cjs.entry.js +9 -11
  32. package/dist/cjs/gov-prompt.cjs.entry.js.map +1 -1
  33. package/dist/cjs/loader.cjs.js +1 -1
  34. package/dist/collection/components/gov-accordion/gov-accordion-item.js +15 -7
  35. package/dist/collection/components/gov-accordion/gov-accordion-item.js.map +1 -1
  36. package/dist/collection/components/gov-accordion/gov-accordion.js +0 -2
  37. package/dist/collection/components/gov-accordion/gov-accordion.js.map +1 -1
  38. package/dist/collection/components/gov-alert/constants.js +1 -0
  39. package/dist/collection/components/gov-alert/constants.js.map +1 -1
  40. package/dist/collection/components/gov-alert/gov-alert.css +13 -0
  41. package/dist/collection/components/gov-alert/gov-alert.js +107 -16
  42. package/dist/collection/components/gov-alert/gov-alert.js.map +1 -1
  43. package/dist/collection/components/gov-alert/gov-alert.types.js +2 -0
  44. package/dist/collection/components/gov-alert/gov-alert.types.js.map +1 -0
  45. package/dist/collection/components/gov-button/gov-button.css +14 -11
  46. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.css +1 -0
  47. package/dist/collection/components/gov-form/control/gov-form-control.css +2 -2
  48. package/dist/collection/components/gov-form/input/gov-form-input.css +1 -0
  49. package/dist/collection/components/gov-form/label/gov-form-label.css +0 -35
  50. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.css +1 -0
  51. package/dist/collection/components/gov-form/radio/gov-form-radio.css +1 -0
  52. package/dist/collection/components/gov-form/select/gov-form-select.css +1 -0
  53. package/dist/collection/components/gov-icon/list.js +3 -0
  54. package/dist/collection/components/gov-icon/list.js.map +1 -1
  55. package/dist/collection/components/gov-layout/gov-layout-column.css +1 -0
  56. package/dist/collection/components/gov-modal/gov-modal.js +13 -20
  57. package/dist/collection/components/gov-modal/gov-modal.js.map +1 -1
  58. package/dist/collection/components/gov-promp/gov-prompt.js +13 -20
  59. package/dist/collection/components/gov-promp/gov-prompt.js.map +1 -1
  60. package/dist/collection/pages/Alert.js +8 -1
  61. package/dist/collection/pages/Alert.js.map +1 -1
  62. package/dist/components/gov-accordion-item.js +15 -7
  63. package/dist/components/gov-accordion-item.js.map +1 -1
  64. package/dist/components/gov-accordion.js +0 -2
  65. package/dist/components/gov-accordion.js.map +1 -1
  66. package/dist/components/gov-alert.js +45 -10
  67. package/dist/components/gov-alert.js.map +1 -1
  68. package/dist/components/gov-app.js +8 -1
  69. package/dist/components/gov-app.js.map +1 -1
  70. package/dist/components/gov-attachments2.js +1 -1
  71. package/dist/components/gov-button2.js +2 -2
  72. package/dist/components/gov-button2.js.map +1 -1
  73. package/dist/components/gov-form-checkbox.js +2 -2
  74. package/dist/components/gov-form-checkbox.js.map +1 -1
  75. package/dist/components/gov-form-control.js +1 -1
  76. package/dist/components/gov-form-control.js.map +1 -1
  77. package/dist/components/gov-form-file.js +1 -1
  78. package/dist/components/gov-form-input2.js +2 -2
  79. package/dist/components/gov-form-input2.js.map +1 -1
  80. package/dist/components/gov-form-label.js +1 -1
  81. package/dist/components/gov-form-label.js.map +1 -1
  82. package/dist/components/gov-form-multi-select.js +2 -2
  83. package/dist/components/gov-form-multi-select.js.map +1 -1
  84. package/dist/components/gov-form-radio.js +2 -2
  85. package/dist/components/gov-form-radio.js.map +1 -1
  86. package/dist/components/gov-form-select2.js +2 -2
  87. package/dist/components/gov-form-select2.js.map +1 -1
  88. package/dist/components/gov-form-switch.js +1 -1
  89. package/dist/components/gov-icon2.js +1 -1
  90. package/dist/components/gov-layout-column.js +1 -1
  91. package/dist/components/gov-layout-column.js.map +1 -1
  92. package/dist/components/gov-modal.js +12 -15
  93. package/dist/components/gov-modal.js.map +1 -1
  94. package/dist/components/gov-pagination.js +1 -1
  95. package/dist/components/gov-prompt.js +12 -15
  96. package/dist/components/gov-prompt.js.map +1 -1
  97. package/dist/components/gov-tabs.js +1 -1
  98. package/dist/components/wcag.js +1 -1
  99. package/dist/core/core.esm.js +1 -1
  100. package/dist/core/core.esm.js.map +1 -1
  101. package/dist/core/{p-26260897.entry.js → p-034c40ab.entry.js} +2 -2
  102. package/dist/core/p-0800095f.entry.js +2 -0
  103. package/dist/core/p-0800095f.entry.js.map +1 -0
  104. package/dist/core/{p-f0a4439e.entry.js → p-207ba616.entry.js} +2 -2
  105. package/dist/core/{p-429850b9.entry.js → p-3699c1b3.entry.js} +2 -2
  106. package/dist/core/{p-d79d0f7a.entry.js → p-3cd5b6cb.entry.js} +2 -2
  107. package/dist/core/p-3da88ddb.entry.js +2 -0
  108. package/dist/core/p-3da88ddb.entry.js.map +1 -0
  109. package/dist/core/{p-aba39622.entry.js → p-3e1a1bd4.entry.js} +2 -2
  110. package/dist/core/{p-5a1c8d48.entry.js → p-42db4603.entry.js} +2 -2
  111. package/dist/core/p-4ce15026.entry.js +2 -0
  112. package/dist/core/{p-8b2a6f87.entry.js.map → p-4ce15026.entry.js.map} +1 -1
  113. package/dist/core/{p-7bfa06b1.entry.js → p-50e94566.entry.js} +2 -2
  114. package/dist/core/p-50e94566.entry.js.map +1 -0
  115. package/dist/core/p-5176fad8.entry.js +2 -0
  116. package/dist/core/p-5176fad8.entry.js.map +1 -0
  117. package/dist/core/{p-540e79c4.entry.js → p-54b17f4d.entry.js} +2 -2
  118. package/dist/core/{p-ef393836.entry.js → p-5e865538.entry.js} +2 -2
  119. package/dist/core/{p-364b4792.js → p-670b4f93.js} +2 -2
  120. package/dist/core/{p-f73d482b.entry.js → p-742e37e4.entry.js} +2 -2
  121. package/dist/core/p-742e37e4.entry.js.map +1 -0
  122. package/dist/core/p-75a4c838.entry.js +2 -0
  123. package/dist/core/p-75a4c838.entry.js.map +1 -0
  124. package/dist/core/p-7b890c55.entry.js +2 -0
  125. package/dist/core/{p-3a50ac4c.entry.js.map → p-7b890c55.entry.js.map} +1 -1
  126. package/dist/core/p-7c55677b.entry.js +2 -0
  127. package/dist/core/{p-c970a479.entry.js.map → p-7c55677b.entry.js.map} +1 -1
  128. package/dist/core/{p-e51baf04.entry.js → p-8925ef42.entry.js} +2 -2
  129. package/dist/core/p-8925ef42.entry.js.map +1 -0
  130. package/dist/core/p-96a59983.entry.js +2 -0
  131. package/dist/core/p-96a59983.entry.js.map +1 -0
  132. package/dist/core/p-99f198b9.entry.js +2 -0
  133. package/dist/core/{p-8feb8960.entry.js.map → p-99f198b9.entry.js.map} +1 -1
  134. package/dist/core/p-a8b628ed.entry.js +2 -0
  135. package/dist/core/{p-b9b80796.entry.js.map → p-a8b628ed.entry.js.map} +1 -1
  136. package/dist/core/{p-724921e7.entry.js → p-a8ef7292.entry.js} +2 -2
  137. package/dist/core/{p-24877419.entry.js → p-a9c57f72.entry.js} +2 -2
  138. package/dist/core/{p-52f2f67c.entry.js → p-acfd00a2.entry.js} +2 -2
  139. package/dist/core/{p-a37ef1b2.entry.js → p-ccb44728.entry.js} +2 -2
  140. package/dist/core/p-d83b4bdc.entry.js +2 -0
  141. package/dist/core/p-d83b4bdc.entry.js.map +1 -0
  142. package/dist/core/{p-5e5e925d.entry.js → p-f555fce1.entry.js} +2 -2
  143. package/dist/core/p-f555fce1.entry.js.map +1 -0
  144. package/dist/core/{p-f6e2f2f0.entry.js → p-f7275b59.entry.js} +2 -2
  145. package/dist/custom-elements/index.js +1 -1
  146. package/dist/custom-elements/index.js.map +1 -1
  147. package/dist/esm/core.js +1 -1
  148. package/dist/esm/gov-accordion-item.entry.js +13 -5
  149. package/dist/esm/gov-accordion-item.entry.js.map +1 -1
  150. package/dist/esm/gov-accordion.entry.js +1 -3
  151. package/dist/esm/gov-accordion.entry.js.map +1 -1
  152. package/dist/esm/gov-alert.entry.js +41 -9
  153. package/dist/esm/gov-alert.entry.js.map +1 -1
  154. package/dist/esm/gov-app.entry.js +8 -1
  155. package/dist/esm/gov-app.entry.js.map +1 -1
  156. package/dist/esm/gov-attachments_3.entry.js +1 -1
  157. package/dist/esm/gov-backdrop.entry.js +1 -1
  158. package/dist/esm/gov-breadcrumbs.entry.js +1 -1
  159. package/dist/esm/gov-button.entry.js +2 -2
  160. package/dist/esm/gov-button.entry.js.map +1 -1
  161. package/dist/esm/gov-card.entry.js +1 -1
  162. package/dist/esm/gov-form-checkbox.entry.js +2 -2
  163. package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
  164. package/dist/esm/gov-form-control.entry.js +1 -1
  165. package/dist/esm/gov-form-control.entry.js.map +1 -1
  166. package/dist/esm/gov-form-file.entry.js +1 -1
  167. package/dist/esm/gov-form-input.entry.js +2 -2
  168. package/dist/esm/gov-form-input.entry.js.map +1 -1
  169. package/dist/esm/gov-form-label.entry.js +1 -1
  170. package/dist/esm/gov-form-label.entry.js.map +1 -1
  171. package/dist/esm/gov-form-multi-select.entry.js +2 -2
  172. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  173. package/dist/esm/gov-form-radio.entry.js +2 -2
  174. package/dist/esm/gov-form-radio.entry.js.map +1 -1
  175. package/dist/esm/gov-form-select.entry.js +2 -2
  176. package/dist/esm/gov-form-select.entry.js.map +1 -1
  177. package/dist/esm/gov-form-switch.entry.js +1 -1
  178. package/dist/esm/gov-icon.entry.js +1 -1
  179. package/dist/esm/gov-layout-column.entry.js +1 -1
  180. package/dist/esm/gov-layout-column.entry.js.map +1 -1
  181. package/dist/esm/gov-modal.entry.js +10 -12
  182. package/dist/esm/gov-modal.entry.js.map +1 -1
  183. package/dist/esm/gov-nav.entry.js +1 -1
  184. package/dist/esm/gov-pagination.entry.js +1 -1
  185. package/dist/esm/gov-prompt.entry.js +10 -12
  186. package/dist/esm/gov-prompt.entry.js.map +1 -1
  187. package/dist/esm/gov-side-nav.entry.js +1 -1
  188. package/dist/esm/gov-skeleton.entry.js +1 -1
  189. package/dist/esm/gov-tabs.entry.js +1 -1
  190. package/dist/esm/gov-wizzard.entry.js +1 -1
  191. package/dist/esm/loader.js +1 -1
  192. package/dist/esm/{wcag-3792d4bb.js → wcag-d588d144.js} +2 -2
  193. package/dist/esm/{wcag-3792d4bb.js.map → wcag-d588d144.js.map} +1 -1
  194. package/dist/hydrate/index.js +95 -56
  195. package/dist/stencil.config.js +0 -9
  196. package/dist/stencil.config.js.map +1 -1
  197. package/dist/types/components/gov-accordion/gov-accordion-item.d.ts +3 -2
  198. package/dist/types/components/gov-alert/constants.d.ts +1 -0
  199. package/dist/types/components/gov-alert/gov-alert.d.ts +21 -4
  200. package/dist/types/components/gov-alert/gov-alert.types.d.ts +4 -0
  201. package/dist/types/components/gov-modal/gov-modal.d.ts +3 -4
  202. package/dist/types/components/gov-promp/gov-prompt.d.ts +3 -4
  203. package/dist/types/components.d.ts +34 -13
  204. package/package.json +1 -1
  205. package/dist/core/p-3a50ac4c.entry.js +0 -2
  206. package/dist/core/p-3f92f3bf.entry.js +0 -2
  207. package/dist/core/p-3f92f3bf.entry.js.map +0 -1
  208. package/dist/core/p-5e5e925d.entry.js.map +0 -1
  209. package/dist/core/p-61103476.entry.js +0 -2
  210. package/dist/core/p-61103476.entry.js.map +0 -1
  211. package/dist/core/p-7bfa06b1.entry.js.map +0 -1
  212. package/dist/core/p-8b2a6f87.entry.js +0 -2
  213. package/dist/core/p-8feb8960.entry.js +0 -2
  214. package/dist/core/p-b2d1dd2a.entry.js +0 -2
  215. package/dist/core/p-b2d1dd2a.entry.js.map +0 -1
  216. package/dist/core/p-b9b80796.entry.js +0 -2
  217. package/dist/core/p-be799dfa.entry.js +0 -2
  218. package/dist/core/p-be799dfa.entry.js.map +0 -1
  219. package/dist/core/p-c970a479.entry.js +0 -2
  220. package/dist/core/p-cba27477.entry.js +0 -2
  221. package/dist/core/p-cba27477.entry.js.map +0 -1
  222. package/dist/core/p-d5c2db32.entry.js +0 -2
  223. package/dist/core/p-d5c2db32.entry.js.map +0 -1
  224. package/dist/core/p-e51baf04.entry.js.map +0 -1
  225. package/dist/core/p-f73d482b.entry.js.map +0 -1
  226. /package/dist/core/{p-26260897.entry.js.map → p-034c40ab.entry.js.map} +0 -0
  227. /package/dist/core/{p-f0a4439e.entry.js.map → p-207ba616.entry.js.map} +0 -0
  228. /package/dist/core/{p-429850b9.entry.js.map → p-3699c1b3.entry.js.map} +0 -0
  229. /package/dist/core/{p-d79d0f7a.entry.js.map → p-3cd5b6cb.entry.js.map} +0 -0
  230. /package/dist/core/{p-aba39622.entry.js.map → p-3e1a1bd4.entry.js.map} +0 -0
  231. /package/dist/core/{p-5a1c8d48.entry.js.map → p-42db4603.entry.js.map} +0 -0
  232. /package/dist/core/{p-540e79c4.entry.js.map → p-54b17f4d.entry.js.map} +0 -0
  233. /package/dist/core/{p-ef393836.entry.js.map → p-5e865538.entry.js.map} +0 -0
  234. /package/dist/core/{p-364b4792.js.map → p-670b4f93.js.map} +0 -0
  235. /package/dist/core/{p-724921e7.entry.js.map → p-a8ef7292.entry.js.map} +0 -0
  236. /package/dist/core/{p-24877419.entry.js.map → p-a9c57f72.entry.js.map} +0 -0
  237. /package/dist/core/{p-52f2f67c.entry.js.map → p-acfd00a2.entry.js.map} +0 -0
  238. /package/dist/core/{p-a37ef1b2.entry.js.map → p-ccb44728.entry.js.map} +0 -0
  239. /package/dist/core/{p-f6e2f2f0.entry.js.map → p-f7275b59.entry.js.map} +0 -0
@@ -1,8 +1,11 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
2
  import { v as validateProp } from './props.js';
3
3
  import { V as Variants } from './variants.js';
4
- import { p as pick } from './utils.js';
5
- import { g as govHost } from './template.js';
4
+ import { p as pick, d as delay } from './utils.js';
5
+ import { g as govHost, a as toBoolAttr } from './template.js';
6
+ import { F as Fragment } from './Fragment.js';
7
+ import { a as validateWcagProp } from './wcag.js';
8
+ import { c as canValidateWcagOnRender } from './win.js';
6
9
  import { d as defineCustomElement$3 } from './gov-button2.js';
7
10
  import { d as defineCustomElement$2 } from './gov-icon2.js';
8
11
 
@@ -12,20 +15,24 @@ const AlertClass = {
12
15
  section: 'gov-alert__section',
13
16
  icon: 'gov-alert__icon',
14
17
  content: 'gov-alert__content',
18
+ headline: 'gov-alert__headline',
15
19
  close: 'gov-alert__close',
16
20
  };
17
21
 
18
- const govAlertCss = ".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-alert{position:relative;display:block;width:100%}.gov-alert__section{display:block;width:100%;max-width:calc(var(--gov-container-width, 73.75rem) + 2 * var(--gov-container-padding, 2.5rem));margin-right:auto;margin-left:auto;padding-right:var(--gov-container-padding-mobile, 1.25rem);padding-left:var(--gov-container-padding-mobile, 1.25rem);display:flex;gap:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 48em){.gov-alert__section{padding-right:var(--gov-container-padding, 2.5rem);padding-left:var(--gov-container-padding, 2.5rem)}}.gov-alert__icon{flex:0 0 auto}.gov-alert__icon>*{width:1.25rem;height:1.25rem}.gov-alert__content{padding-right:3.25rem}.gov-alert__content>*:last-child{margin-bottom:0}.gov-alert__content p{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-alert__content a{color:inherit}@media not all and (pointer: coarse){.gov-alert__content a:hover{color:inherit}}.gov-alert__close{position:absolute;top:0.625rem;right:1rem}.gov-alert[variant=warning]{background-color:var(--gov-alert-warning-bg-color, var(--gov-color-warning))}.gov-alert[variant=warning] .gov-alert__icon{color:var(--gov-alert-warning-icon-color, var(--gov-color-secondary))}.gov-alert[variant=warning] .gov-alert__content{color:var(--gov-alert-warning-text-color, var(--gov-color-secondary))}.gov-alert[variant=warning][inverse=\"\"],.gov-alert[variant=warning][inverse=true i],.gov-alert[variant=warning][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=warning][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=warning][inverse=true i] .gov-alert__icon,.gov-alert[variant=warning][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-warning-bg-color, var(--gov-color-warning))}.gov-alert[variant=warning][inverse=\"\"] .gov-alert__content,.gov-alert[variant=warning][inverse=true i] .gov-alert__content,.gov-alert[variant=warning][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=error]{background-color:var(--gov-alert-error-bg-color, var(--gov-color-error))}.gov-alert[variant=error] .gov-alert__icon{color:var(--gov-alert-error-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=error] .gov-alert__content{color:var(--gov-alert-error-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=error][inverse=\"\"],.gov-alert[variant=error][inverse=true i],.gov-alert[variant=error][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=error][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=error][inverse=true i] .gov-alert__icon,.gov-alert[variant=error][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-error-bg-color, var(--gov-color-error))}.gov-alert[variant=error][inverse=\"\"] .gov-alert__content,.gov-alert[variant=error][inverse=true i] .gov-alert__content,.gov-alert[variant=error][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=secondary]{background-color:var(--gov-alert-secondary-bg-color, var(--gov-color-secondary))}.gov-alert[variant=secondary] .gov-alert__icon{color:var(--gov-alert-secondary-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=secondary] .gov-alert__content{color:var(--gov-alert-secondary-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=secondary][inverse=\"\"],.gov-alert[variant=secondary][inverse=true i],.gov-alert[variant=secondary][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=secondary][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=secondary][inverse=true i] .gov-alert__icon,.gov-alert[variant=secondary][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-secondary-bg-color, var(--gov-color-secondary))}.gov-alert[variant=secondary][inverse=\"\"] .gov-alert__content,.gov-alert[variant=secondary][inverse=true i] .gov-alert__content,.gov-alert[variant=secondary][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=success]{background-color:var(--gov-alert-success-bg-color, var(--gov-color-success-500))}.gov-alert[variant=success] .gov-alert__icon{color:var(--gov-alert-success-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=success] .gov-alert__content{color:var(--gov-alert-success-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=success][inverse=\"\"],.gov-alert[variant=success][inverse=true i],.gov-alert[variant=success][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=success][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=success][inverse=true i] .gov-alert__icon,.gov-alert[variant=success][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-success-bg-color, var(--gov-color-success-500))}.gov-alert[variant=success][inverse=\"\"] .gov-alert__content,.gov-alert[variant=success][inverse=true i] .gov-alert__content,.gov-alert[variant=success][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=primary]{background-color:var(--gov-alert-primary-bg-color, var(--gov-color-primary))}.gov-alert[variant=primary] .gov-alert__icon{color:var(--gov-alert-primary-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=primary] .gov-alert__content{color:var(--gov-alert-primary-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=primary][inverse=\"\"],.gov-alert[variant=primary][inverse=true i],.gov-alert[variant=primary][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=primary][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=primary][inverse=true i] .gov-alert__icon,.gov-alert[variant=primary][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-primary-bg-color, var(--gov-color-primary))}.gov-alert[variant=primary][inverse=\"\"] .gov-alert__content,.gov-alert[variant=primary][inverse=true i] .gov-alert__content,.gov-alert[variant=primary][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}@media (min-width: 75em){.gov-alert__content{padding-right:2rem}}";
22
+ const govAlertCss = ".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-alert{position:relative;display:block;width:100%}.gov-alert__section{display:block;width:100%;max-width:calc(var(--gov-container-width, 73.75rem) + 2 * var(--gov-container-padding, 2.5rem));margin-right:auto;margin-left:auto;padding-right:var(--gov-container-padding-mobile, 1.25rem);padding-left:var(--gov-container-padding-mobile, 1.25rem);display:flex;gap:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 48em){.gov-alert__section{padding-right:var(--gov-container-padding, 2.5rem);padding-left:var(--gov-container-padding, 2.5rem)}}.gov-alert__icon{flex:0 0 auto}.gov-alert__icon>*{width:1.25rem;height:1.25rem}.gov-alert__headline{display:flex;gap:1rem}.gov-alert__headline+div{margin-top:0.5rem}.gov-alert__headline p{margin-bottom:0}.gov-alert__headline gov-button{margin-top:-0.25rem}.gov-alert__content{padding-right:3.25rem}.gov-alert__content>*:last-child{margin-bottom:0}.gov-alert__content p{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-alert__content a{color:inherit}@media not all and (pointer: coarse){.gov-alert__content a:hover{color:inherit}}.gov-alert__close{position:absolute;top:0.625rem;right:1rem}.gov-alert[variant=warning]{background-color:var(--gov-alert-warning-bg-color, var(--gov-color-warning))}.gov-alert[variant=warning] .gov-alert__icon{color:var(--gov-alert-warning-icon-color, var(--gov-color-secondary))}.gov-alert[variant=warning] .gov-alert__content{color:var(--gov-alert-warning-text-color, var(--gov-color-secondary))}.gov-alert[variant=warning][inverse=\"\"],.gov-alert[variant=warning][inverse=true i],.gov-alert[variant=warning][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=warning][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=warning][inverse=true i] .gov-alert__icon,.gov-alert[variant=warning][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-warning-bg-color, var(--gov-color-warning))}.gov-alert[variant=warning][inverse=\"\"] .gov-alert__content,.gov-alert[variant=warning][inverse=true i] .gov-alert__content,.gov-alert[variant=warning][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=error]{background-color:var(--gov-alert-error-bg-color, var(--gov-color-error))}.gov-alert[variant=error] .gov-alert__icon{color:var(--gov-alert-error-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=error] .gov-alert__content{color:var(--gov-alert-error-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=error][inverse=\"\"],.gov-alert[variant=error][inverse=true i],.gov-alert[variant=error][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=error][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=error][inverse=true i] .gov-alert__icon,.gov-alert[variant=error][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-error-bg-color, var(--gov-color-error))}.gov-alert[variant=error][inverse=\"\"] .gov-alert__content,.gov-alert[variant=error][inverse=true i] .gov-alert__content,.gov-alert[variant=error][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=secondary]{background-color:var(--gov-alert-secondary-bg-color, var(--gov-color-secondary))}.gov-alert[variant=secondary] .gov-alert__icon{color:var(--gov-alert-secondary-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=secondary] .gov-alert__content{color:var(--gov-alert-secondary-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=secondary][inverse=\"\"],.gov-alert[variant=secondary][inverse=true i],.gov-alert[variant=secondary][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=secondary][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=secondary][inverse=true i] .gov-alert__icon,.gov-alert[variant=secondary][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-secondary-bg-color, var(--gov-color-secondary))}.gov-alert[variant=secondary][inverse=\"\"] .gov-alert__content,.gov-alert[variant=secondary][inverse=true i] .gov-alert__content,.gov-alert[variant=secondary][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=success]{background-color:var(--gov-alert-success-bg-color, var(--gov-color-success-500))}.gov-alert[variant=success] .gov-alert__icon{color:var(--gov-alert-success-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=success] .gov-alert__content{color:var(--gov-alert-success-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=success][inverse=\"\"],.gov-alert[variant=success][inverse=true i],.gov-alert[variant=success][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=success][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=success][inverse=true i] .gov-alert__icon,.gov-alert[variant=success][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-success-bg-color, var(--gov-color-success-500))}.gov-alert[variant=success][inverse=\"\"] .gov-alert__content,.gov-alert[variant=success][inverse=true i] .gov-alert__content,.gov-alert[variant=success][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}.gov-alert[variant=primary]{background-color:var(--gov-alert-primary-bg-color, var(--gov-color-primary))}.gov-alert[variant=primary] .gov-alert__icon{color:var(--gov-alert-primary-icon-color, var(--gov-color-neutral-white))}.gov-alert[variant=primary] .gov-alert__content{color:var(--gov-alert-primary-text-color, var(--gov-color-neutral-white))}.gov-alert[variant=primary][inverse=\"\"],.gov-alert[variant=primary][inverse=true i],.gov-alert[variant=primary][inverse=\"1\"]{border-bottom:var(--gov-alert-border, 0.0625rem solid var(--gov-color-secondary-400));background-color:var(--gov-alert-inverse-bg, var(--gov-color-neutral-white))}.gov-alert[variant=primary][inverse=\"\"] .gov-alert__icon,.gov-alert[variant=primary][inverse=true i] .gov-alert__icon,.gov-alert[variant=primary][inverse=\"1\"] .gov-alert__icon{color:var(--gov-alert-primary-bg-color, var(--gov-color-primary))}.gov-alert[variant=primary][inverse=\"\"] .gov-alert__content,.gov-alert[variant=primary][inverse=true i] .gov-alert__content,.gov-alert[variant=primary][inverse=\"1\"] .gov-alert__content{color:var(--gov-alert-inverse-color, var(--gov-color-secondary-800))}@media (min-width: 75em){.gov-alert__content{padding-right:2rem}}";
19
23
 
20
24
  const GovAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
21
25
  constructor() {
22
26
  super();
23
27
  this.__registerHost();
24
28
  this.govClose = createEvent(this, "gov-close", 7);
25
- this.variant = 'primary';
29
+ this.headline = undefined;
30
+ this.variant = "primary";
26
31
  this.inverse = false;
27
32
  this.wcagCloseLabel = undefined;
33
+ this.wcagToggleLabel = undefined;
28
34
  this.closable = false;
35
+ this.toggleContent = false;
29
36
  this.h = govHost(this.host);
30
37
  }
31
38
  validateVariant(newValue) {
@@ -34,15 +41,39 @@ const GovAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
34
41
  componentWillLoad() {
35
42
  this.validateVariant(this.variant);
36
43
  }
44
+ async componentDidRender() {
45
+ if (canValidateWcagOnRender()) {
46
+ await delay(500);
47
+ await this.validateWcag();
48
+ }
49
+ }
37
50
  render() {
38
51
  let inverse = !this.inverse;
39
- let variant = this.inverse ? 'secondary' : this.variant;
40
- if (this.variant == 'warning') {
52
+ let variant = this.inverse ? "secondary" : this.variant;
53
+ if (this.variant == "warning") {
41
54
  inverse = false;
42
- variant = 'secondary';
55
+ variant = "secondary";
56
+ }
57
+ const closeButton = (h("div", { class: AlertClass.close }, h("gov-button", { size: "s", "aria-label": this.wcagCloseLabel, type: "base", variant: variant, inverse: inverse, "on-gov-click": this.onCloseHandler.bind(this) }, h("gov-icon", { name: "x-lg" }))));
58
+ return (h(Host, { class: this.h.classes(AlertClass.root), variant: this.variant }, h("section", { class: AlertClass.section, role: "alert" }, this.h.hasSlot("icon") && (h("div", { class: AlertClass.icon }, h("slot", { name: "icon" }))), h("div", { class: AlertClass.content }, this.headline ? (h(Fragment, null, h("div", { class: AlertClass.headline }, h("p", null, this.headline), h("gov-button", { size: "s", "aria-label": this.wcagToggleLabel, type: "base", variant: variant, inverse: inverse, "on-gov-click": () => this.toggleContent = !this.toggleContent }, h("gov-icon", { name: this.toggleContent ? 'chevron-up' : 'chevron-down' }))), h("div", { hidden: !this.toggleContent, "aria-hidden": toBoolAttr(this.toggleContent) }, h("slot", null)))) : (h("slot", null)))), this.closable && closeButton));
59
+ }
60
+ onCloseHandler(e) {
61
+ this.govClose.emit({
62
+ component: AlertClass.root,
63
+ ref: this.host,
64
+ originalEvent: e,
65
+ });
66
+ }
67
+ /**
68
+ * Validate the WCAG attributes of the component
69
+ */
70
+ async validateWcag() {
71
+ if (this.closable) {
72
+ validateWcagProp(this.wcagCloseLabel, 'wcag-close-label', AlertClass.root);
73
+ }
74
+ if (this.headline) {
75
+ validateWcagProp(this.wcagToggleLabel, 'wcag-toggle-label', AlertClass.root);
43
76
  }
44
- const closeButton = (h("div", { class: AlertClass.close }, h("gov-button", { size: "s", "aria-label": this.wcagCloseLabel, type: "base", variant: variant, inverse: inverse, onClick: (e) => this.govClose.emit(e) }, h("gov-icon", { name: "x-lg" }))));
45
- return (h(Host, { class: this.h.classes(AlertClass.root), variant: this.variant }, h("section", { class: AlertClass.section, role: "alert" }, this.h.hasSlot('icon') && (h("div", { class: AlertClass.icon }, h("slot", { name: "icon" }))), h("div", { class: AlertClass.content }, h("slot", null))), this.closable && closeButton));
46
77
  }
47
78
  get host() { return this; }
48
79
  static get watchers() { return {
@@ -50,10 +81,14 @@ const GovAlert$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
50
81
  }; }
51
82
  static get style() { return govAlertCss; }
52
83
  }, [4, "gov-alert", {
84
+ "headline": [1],
53
85
  "variant": [1],
54
86
  "inverse": [4],
55
87
  "wcagCloseLabel": [1, "wcag-close-label"],
56
- "closable": [4]
88
+ "wcagToggleLabel": [1, "wcag-toggle-label"],
89
+ "closable": [4],
90
+ "toggleContent": [32],
91
+ "validateWcag": [64]
57
92
  }]);
58
93
  function defineCustomElement$1() {
59
94
  if (typeof customElements === "undefined") {
@@ -1 +1 @@
1
- {"file":"gov-alert.js","mappings":";;;;;;;;AAIO,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,CAAA;AAG7F,MAAM,UAAU,GAAG;EACzB,IA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AAO,IAClE,eAAS,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,IAAI,EAAC,OAAO,IAC9C,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KACtB,WAAK,KAAK,EAAE,UAAU,CAAC,IAAI,IAC1B,YAAM,IAAI,EAAC,MAAM,GAAG,CACf,CACN,EAED,WAAK,KAAK,EAAE,UAAU,CAAC,OAAO,IAC7B,eAAQ,CACH,CACG,EACT,IAAI,CAAC,QAAQ,IAAI,WAAW,CACvB,EACP;GACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovAlert"],"sources":["../../../packages/core/src/components/gov-alert/constants.ts","../../../packages/core/src/components/gov-alert/gov-alert.scss?tag=gov-alert","../../../packages/core/src/components/gov-alert/gov-alert.tsx"],"sourcesContent":["import { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const AlertVariants = pick(Variants, ['PRIMARY', 'SECONDARY', 'WARNING', 'ERROR', 'SUCCESS'])\nexport type VariantType = `${ValueOf<typeof AlertVariants>}`\n\nexport const AlertClass = {\n\troot: 'gov-alert',\n\tsection: 'gov-alert__section',\n\ticon: 'gov-alert__icon',\n\tcontent: 'gov-alert__content',\n\tclose: 'gov-alert__close',\n}\n","/*\n * Alert\n */\n\n$class: \".gov-alert\";\n\n#{$class} {\n\t@include base();\n\t&__section {\n\t\t@include container();\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tpadding-top: rem-calc(16);\n\t\tpadding-bottom: rem-calc(16);\n\t}\n\t&__icon {\n\t\tflex: 0 0 auto;\n\t\t& > * {\n\t\t\twidth: rem-calc(20);\n\t\t\theight: rem-calc(20);\n\t\t}\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t\tpadding-right: rem-calc(52);\n\t\tp {\n\t\t\t@include typography($font-size-m);\n\t\t}\n\t\ta {\n\t\t\tcolor: inherit;\n\t\t\t@include hover() {\n\t\t\t\tcolor: inherit;\n\t\t\t}\n\t\t}\n\t}\n\t&__close {\n\t\tposition: absolute;\n\t\ttop: rem-calc(10);\n\t\tright: rem-calc(16);\n\t}\n\n\t// VARIANTS\n\t@each $variant, $definitions in $alert-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\tbackground-color: get(\"bg-color\", $definitions);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tcolor: get(\"icon-color\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tcolor: get(\"text-color\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t\t@if deep-map-check($definitions, \"border\") {\n\t\t\t\tborder-bottom: $alert-border;\n\t\t\t}\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"inverse\") {\n\t\t\t\tborder-bottom: $alert-border;\n\t\t\t\tbackground-color: $alert-inverse-bg;\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__icon {\n\t\t\t\t\t\tcolor: get(\"bg-color\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t\t&__content {\n\t\t\t\t\t\tcolor: $alert-inverse-color;\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($from: xl) {\n\t\t&__content {\n\t\t\tpadding-right: rem-calc(32);\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport { AlertClass, AlertVariants, VariantType } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-alert',\n\tstyleUrl: 'gov-alert.scss',\n})\nexport class GovAlert {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovAlertElement\n\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant: VariantType = 'primary'\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 * Aria label for the closing button. It is mandatory if the alert is closable\n\t */\n\t@Prop({ attribute: 'wcag-close-label' }) readonly wcagCloseLabel: string\n\t/**\n\t * Called when the close button is clicked\n\t */\n\t@Event({ eventName: 'gov-close' }) govClose: EventEmitter<PointerEvent>\n\t/**\n\t * Displays the option to close the alert\n\t */\n\t@Prop() readonly closable?: boolean = false\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(AlertVariants, newValue, AlertClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\trender() {\n\t\tlet inverse = !this.inverse\n\t\tlet variant = this.inverse ? 'secondary' : this.variant\n\n\t\tif (this.variant == 'warning') {\n\t\t\tinverse = false\n\t\t\tvariant = 'secondary'\n\t\t}\n\n\t\tconst closeButton = (\n\t\t\t<div class={AlertClass.close}>\n\t\t\t\t<gov-button\n\t\t\t\t\tsize=\"s\"\n\t\t\t\t\taria-label={this.wcagCloseLabel}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tvariant={variant}\n\t\t\t\t\tinverse={inverse}\n\t\t\t\t\tonClick={(e: PointerEvent) => this.govClose.emit(e)}\n\t\t\t\t>\n\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t</gov-button>\n\t\t\t</div>\n\t\t)\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(AlertClass.root)} variant={this.variant}>\n\t\t\t\t<section class={AlertClass.section} role=\"alert\">\n\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t<div class={AlertClass.icon}>\n\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t<div class={AlertClass.content}>\n\t\t\t\t\t\t<slot />\n\t\t\t\t\t</div>\n\t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CACG,EACT,IAAI,CAAC,QAAQ,IAAI,WAAW,CACvB,EACP;GACD;EAED,cAAc,CAAC,CAA2B;IACzC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;MAClB,SAAS,EAAE,UAAU,CAAC,IAAI;MAC1B,GAAG,EAAE,IAAI,CAAC,IAAI;MACd,aAAa,EAAE,CAAC;KAChB,CAAC,CAAA;GACF;;;;EAMD,MAAM,YAAY;IACjB,IAAI,IAAI,CAAC,QAAQ,EAAE;MAClB,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;KAC1E;IACD,IAAI,IAAI,CAAC,QAAQ,EAAE;MAClB,gBAAgB,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;KAC5E;GACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["GovAlert"],"sources":["../../../packages/core/src/components/gov-alert/constants.ts","../../../packages/core/src/components/gov-alert/gov-alert.scss?tag=gov-alert","../../../packages/core/src/components/gov-alert/gov-alert.tsx"],"sourcesContent":["import { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const AlertVariants = pick(Variants, ['PRIMARY', 'SECONDARY', 'WARNING', 'ERROR', 'SUCCESS'])\nexport type VariantType = `${ValueOf<typeof AlertVariants>}`\n\nexport const AlertClass = {\n\troot: 'gov-alert',\n\tsection: 'gov-alert__section',\n\ticon: 'gov-alert__icon',\n\tcontent: 'gov-alert__content',\n\theadline: 'gov-alert__headline',\n\tclose: 'gov-alert__close',\n}\n","/*\n * Alert\n */\n\n$class: \".gov-alert\";\n\n#{$class} {\n\t@include base();\n\t&__section {\n\t\t@include container();\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\tpadding-top: rem-calc(16);\n\t\tpadding-bottom: rem-calc(16);\n\t}\n\t&__icon {\n\t\tflex: 0 0 auto;\n\t\t& > * {\n\t\t\twidth: rem-calc(20);\n\t\t\theight: rem-calc(20);\n\t\t}\n\t}\n\t&__headline {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\n\t\t+ div {\n\t\t\tmargin-top: rem-calc(8);\n\t\t}\n\n\t\tp {\n\t\t\tmargin-bottom: 0;\n\t\t}\n\n\t\tgov-button {\n\t\t\tmargin-top: rem-calc(-4);\n\t\t}\n\t}\n\t&__content {\n\t\t@include reset-last-margin();\n\t\tpadding-right: rem-calc(52);\n\t\tp {\n\t\t\t@include typography($font-size-m);\n\t\t}\n\t\ta {\n\t\t\tcolor: inherit;\n\t\t\t@include hover() {\n\t\t\t\tcolor: inherit;\n\t\t\t}\n\t\t}\n\t}\n\t&__close {\n\t\tposition: absolute;\n\t\ttop: rem-calc(10);\n\t\tright: rem-calc(16);\n\t}\n\n\t// VARIANTS\n\t@each $variant, $definitions in $alert-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\tbackground-color: get(\"bg-color\", $definitions);\n\t\t\t#{$class} {\n\t\t\t\t&__icon {\n\t\t\t\t\tcolor: get(\"icon-color\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__content {\n\t\t\t\t\tcolor: get(\"text-color\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t\t@if deep-map-check($definitions, \"border\") {\n\t\t\t\tborder-bottom: $alert-border;\n\t\t\t}\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"inverse\") {\n\t\t\t\tborder-bottom: $alert-border;\n\t\t\t\tbackground-color: $alert-inverse-bg;\n\t\t\t\t#{$class} {\n\t\t\t\t\t&__icon {\n\t\t\t\t\t\tcolor: get(\"bg-color\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t\t&__content {\n\t\t\t\t\t\tcolor: $alert-inverse-color;\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($from: xl) {\n\t\t&__content {\n\t\t\tpadding-right: rem-calc(32);\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from \"@stencil/core\"\nimport { validateProp } from \"../../helpers/Validate/props\"\nimport { AlertClass, AlertVariants, VariantType } from \"./constants\"\nimport { govHost, toBoolAttr } from \"../../helpers/Dom/template\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport { AlertEvent } from \"./gov-alert.types\"\nimport { ButtonEvent } from \"../gov-button/gov-button.types\"\nimport Fragment from \"../../helpers/Fragment\"\nimport { validateWcagProp } from \"../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\n\n@Component({\n\ttag: \"gov-alert\",\n\tstyleUrl: \"gov-alert.scss\",\n})\nexport class GovAlert {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovAlertElement\n\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly headline: string\n\t/**\n\t * Style variation of the button.\n\t */\n\t@Prop() readonly variant: VariantType = \"primary\"\n\t/**\n\t * Determine if component should have inverse colors to be used on dark background\n\t */\n\t@Prop() readonly inverse: boolean = false\n\t/**\n\t * Aria label for the closing button. It is mandatory if the alert is closable\n\t */\n\t@Prop({ attribute: \"wcag-close-label\" }) readonly wcagCloseLabel: string\n\t/**\n\t * Aria label for the toggle button. It is mandatory if the alert has headline\n\t */\n\t@Prop({ attribute: \"wcag-toggle-label\" }) readonly wcagToggleLabel: string\n\t/**\n\t * Called when the close button is clicked\n\t */\n\t@Event({ eventName: \"gov-close\" }) govClose: EventEmitter<AlertEvent>\n\t/**\n\t * Displays the option to close the alert\n\t */\n\t@Prop() readonly closable?: boolean = false\n\n\t@State() toggleContent = false\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(AlertVariants, newValue, AlertClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tlet inverse = !this.inverse\n\t\tlet variant = this.inverse ? \"secondary\" : this.variant\n\n\t\tif (this.variant == \"warning\") {\n\t\t\tinverse = false\n\t\t\tvariant = \"secondary\"\n\t\t}\n\n\t\tconst closeButton = (\n\t\t\t<div class={AlertClass.close}>\n\t\t\t\t<gov-button\n\t\t\t\t\tsize=\"s\"\n\t\t\t\t\taria-label={this.wcagCloseLabel}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tvariant={variant}\n\t\t\t\t\tinverse={inverse}\n\t\t\t\t\ton-gov-click={this.onCloseHandler.bind(this)}\n\t\t\t\t>\n\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t</gov-button>\n\t\t\t</div>\n\t\t)\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(AlertClass.root)} variant={this.variant}>\n\t\t\t\t<section class={AlertClass.section} role=\"alert\">\n\t\t\t\t\t{this.h.hasSlot(\"icon\") && (\n\t\t\t\t\t\t<div class={AlertClass.icon}>\n\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<div class={AlertClass.content}>\n\t\t\t\t\t\t{this.headline ? (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t<div class={AlertClass.headline}>\n\t\t\t\t\t\t\t\t\t<p>{this.headline}</p>\n\t\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\t\taria-label={this.wcagToggleLabel}\n\t\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\t\t\t\tinverse={inverse}\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.toggleContent = !this.toggleContent}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<gov-icon name={this.toggleContent ? 'chevron-up' : 'chevron-down'}></gov-icon>\n\t\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div hidden={!this.toggleContent} aria-hidden={toBoolAttr(this.toggleContent)}>\n\t\t\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</section>\n\t\t\t\t{this.closable && closeButton}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tonCloseHandler(e: CustomEvent<ButtonEvent>) {\n\t\tthis.govClose.emit({\n\t\t\tcomponent: AlertClass.root,\n\t\t\tref: this.host,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tif (this.closable) {\n\t\t\tvalidateWcagProp(this.wcagCloseLabel, 'wcag-close-label', AlertClass.root)\n\t\t}\n\t\tif (this.headline) {\n\t\t\tvalidateWcagProp(this.wcagToggleLabel, 'wcag-toggle-label', AlertClass.root)\n\t\t}\n\t}\n}\n"],"version":3}
@@ -3253,7 +3253,14 @@ class AlertPage extends HTMLElement {
3253
3253
  connectedCallback() {
3254
3254
  this.innerHTML = `
3255
3255
  <h2>Alert</h2>
3256
-
3256
+
3257
+ <gov-alert variant="secondary" headline="Tohle bude super nadpis pro všechno" closable>
3258
+ <gov-icon name="info" slot="icon"></gov-icon>
3259
+ <p>
3260
+ Secondary - Od 20. 12. 2020 do 14:00 h do 20.&nbsp;12. 2020 do 15:00 h bude provedena plánovaná odstávka serverů. V&nbsp;uvedeném termínu bude nedostupné přihlášení k&nbsp;Portálu občana prostřednictvím datové schránky. Více informací <a href="#">zde</a>.
3261
+ </p>
3262
+ </gov-alert>
3263
+ <br>
3257
3264
  <gov-alert variant="secondary" closable>
3258
3265
  <gov-icon name="info" slot="icon"></gov-icon>
3259
3266
  <p>