@swisspost/design-system-components 1.6.3 → 1.7.0

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 (310) hide show
  1. package/dist/cjs/{check-non-empty-ae713942.js → check-non-empty-eeaa8f77.js} +4 -4
  2. package/dist/cjs/check-non-empty-eeaa8f77.js.map +1 -0
  3. package/dist/cjs/index-8c288b1a.js +45 -0
  4. package/dist/cjs/index-8c288b1a.js.map +1 -0
  5. package/dist/cjs/{index-b619e205.js → index-c07c0cdb.js} +94 -64
  6. package/dist/cjs/index-c07c0cdb.js.map +1 -0
  7. package/dist/cjs/index.cjs.js +17 -12
  8. package/dist/cjs/index.cjs.js.map +1 -1
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/package-cd0e9960.js +7 -0
  11. package/dist/cjs/package-cd0e9960.js.map +1 -0
  12. package/dist/cjs/post-accordion-f2e00198.js +87 -0
  13. package/dist/cjs/post-accordion-f2e00198.js.map +1 -0
  14. package/dist/cjs/post-accordion.cjs.entry.js +4 -80
  15. package/dist/cjs/post-accordion.cjs.entry.js.map +1 -1
  16. package/dist/cjs/post-alert-6d0b5e58.js +101 -0
  17. package/dist/cjs/{post-alert-b46943e0.js.map → post-alert-6d0b5e58.js.map} +1 -1
  18. package/dist/cjs/post-alert.cjs.entry.js +5 -6
  19. package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
  20. package/dist/cjs/{post-collapsible-04364cda.js → post-collapsible-0b8dce97.js} +69 -69
  21. package/dist/cjs/{post-collapsible-04364cda.js.map → post-collapsible-0b8dce97.js.map} +1 -1
  22. package/dist/cjs/post-collapsible.cjs.entry.js +4 -5
  23. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
  24. package/dist/cjs/post-components.cjs.js +3 -3
  25. package/dist/cjs/post-components.cjs.js.map +1 -1
  26. package/dist/cjs/post-icon-3dbb7728.js +105 -0
  27. package/dist/cjs/post-icon-3dbb7728.js.map +1 -0
  28. package/dist/cjs/post-icon.cjs.entry.js +5 -6
  29. package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
  30. package/dist/cjs/post-popover-ea22d235.js +118 -0
  31. package/dist/cjs/post-popover-ea22d235.js.map +1 -0
  32. package/dist/cjs/post-popover.cjs.entry.js +13 -0
  33. package/dist/cjs/post-popover.cjs.entry.js.map +1 -0
  34. package/dist/cjs/post-popovercontainer-42e4ab15.js +1878 -0
  35. package/dist/cjs/post-popovercontainer-42e4ab15.js.map +1 -0
  36. package/dist/cjs/post-popovercontainer.cjs.entry.js +13 -0
  37. package/dist/cjs/post-popovercontainer.cjs.entry.js.map +1 -0
  38. package/dist/cjs/post-tab-header-09074905.js +33 -0
  39. package/dist/cjs/{post-tab-header-805c0a52.js.map → post-tab-header-09074905.js.map} +1 -1
  40. package/dist/cjs/post-tab-header.cjs.entry.js +4 -4
  41. package/dist/cjs/post-tab-panel-9547b9ac.js +27 -0
  42. package/dist/cjs/{post-tab-panel-caa44a77.js.map → post-tab-panel-9547b9ac.js.map} +1 -1
  43. package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
  44. package/dist/cjs/post-tabs-2ec2778e.js +153 -0
  45. package/dist/cjs/post-tabs-2ec2778e.js.map +1 -0
  46. package/dist/cjs/post-tabs.cjs.entry.js +3 -3
  47. package/dist/cjs/{post-tooltip-32a9c549.js → post-tooltip-c802c51f.js} +78 -1754
  48. package/dist/cjs/post-tooltip-c802c51f.js.map +1 -0
  49. package/dist/cjs/post-tooltip.cjs.entry.js +3 -4
  50. package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
  51. package/dist/collection/animations/collapse.js +5 -5
  52. package/dist/collection/animations/collapse.js.map +1 -1
  53. package/dist/collection/collection-manifest.json +5 -3
  54. package/dist/collection/components/post-accordion/post-accordion.js +167 -166
  55. package/dist/collection/components/post-accordion/post-accordion.js.map +1 -1
  56. package/dist/collection/components/post-alert/post-alert.css +2 -2
  57. package/dist/collection/components/post-alert/post-alert.js +246 -246
  58. package/dist/collection/components/post-alert/post-alert.js.map +1 -1
  59. package/dist/collection/components/post-collapsible/post-collapsible.js +169 -168
  60. package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
  61. package/dist/collection/components/post-icon/post-icon.css +1 -1
  62. package/dist/collection/components/post-icon/post-icon.js +250 -250
  63. package/dist/collection/components/post-icon/post-icon.js.map +1 -1
  64. package/dist/collection/components/post-popover/post-popover.css +3 -0
  65. package/dist/collection/components/post-popover/post-popover.js +267 -0
  66. package/dist/collection/components/post-popover/post-popover.js.map +1 -0
  67. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -0
  68. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +288 -0
  69. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js.map +1 -0
  70. package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
  71. package/dist/collection/components/post-tab-header/post-tab-header.js +62 -62
  72. package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
  73. package/dist/collection/components/post-tab-panel/post-tab-panel.js +50 -50
  74. package/dist/collection/components/post-tab-panel/post-tab-panel.js.map +1 -1
  75. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  76. package/dist/collection/components/post-tabs/post-tabs.js +224 -223
  77. package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
  78. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  79. package/dist/collection/components/post-tooltip/post-tooltip.js +192 -325
  80. package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
  81. package/dist/collection/index.js +3 -0
  82. package/dist/collection/index.js.map +1 -1
  83. package/dist/collection/utils/is-motion-reduced.js +1 -1
  84. package/dist/collection/utils/is-motion-reduced.js.map +1 -1
  85. package/dist/collection/utils/property-checkers/check-non-empty.js +3 -3
  86. package/dist/collection/utils/property-checkers/check-non-empty.js.map +1 -1
  87. package/dist/collection/utils/property-checkers/check-one-of.js +2 -2
  88. package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -1
  89. package/dist/collection/utils/property-checkers/check-pattern.js +2 -2
  90. package/dist/collection/utils/property-checkers/check-pattern.js.map +1 -1
  91. package/dist/collection/utils/property-checkers/check-type.js +10 -10
  92. package/dist/collection/utils/property-checkers/check-type.js.map +1 -1
  93. package/dist/collection/utils/property-checkers/empty-or.js +5 -5
  94. package/dist/collection/utils/property-checkers/empty-or.js.map +1 -1
  95. package/dist/components/check-non-empty.js +3 -3
  96. package/dist/components/check-non-empty.js.map +1 -1
  97. package/dist/components/index.js +3 -0
  98. package/dist/components/index.js.map +1 -1
  99. package/dist/components/index2.js +22 -18
  100. package/dist/components/index2.js.map +1 -1
  101. package/dist/components/package.js +1 -1
  102. package/dist/components/post-accordion.d.ts +2 -2
  103. package/dist/components/post-accordion.js +1 -101
  104. package/dist/components/post-accordion.js.map +1 -1
  105. package/dist/components/post-accordion2.js +105 -0
  106. package/dist/components/post-accordion2.js.map +1 -0
  107. package/dist/components/post-alert.d.ts +2 -2
  108. package/dist/components/post-alert2.js +119 -119
  109. package/dist/components/post-alert2.js.map +1 -1
  110. package/dist/components/post-collapsible.d.ts +2 -2
  111. package/dist/components/post-collapsible2.js +90 -90
  112. package/dist/components/post-collapsible2.js.map +1 -1
  113. package/dist/components/post-icon.d.ts +2 -2
  114. package/dist/components/post-icon2.js +118 -118
  115. package/dist/components/post-icon2.js.map +1 -1
  116. package/dist/components/post-popover.d.ts +11 -0
  117. package/dist/components/post-popover.js +8 -0
  118. package/dist/components/post-popover.js.map +1 -0
  119. package/dist/components/post-popover2.js +144 -0
  120. package/dist/components/post-popover2.js.map +1 -0
  121. package/dist/components/post-popovercontainer.d.ts +11 -0
  122. package/dist/components/post-popovercontainer.js +8 -0
  123. package/dist/components/post-popovercontainer.js.map +1 -0
  124. package/dist/components/post-popovercontainer2.js +1897 -0
  125. package/dist/components/post-popovercontainer2.js.map +1 -0
  126. package/dist/components/post-tab-header.d.ts +2 -2
  127. package/dist/components/post-tab-header2.js +38 -38
  128. package/dist/components/post-tab-header2.js.map +1 -1
  129. package/dist/components/post-tab-panel.d.ts +2 -2
  130. package/dist/components/post-tab-panel2.js +30 -30
  131. package/dist/components/post-tab-panel2.js.map +1 -1
  132. package/dist/components/post-tabs.d.ts +2 -2
  133. package/dist/components/post-tabs2.js +147 -147
  134. package/dist/components/post-tabs2.js.map +1 -1
  135. package/dist/components/post-tooltip.d.ts +2 -2
  136. package/dist/components/post-tooltip2.js +100 -1774
  137. package/dist/components/post-tooltip2.js.map +1 -1
  138. package/dist/docs.d.ts +1 -21
  139. package/dist/docs.json +604 -77
  140. package/dist/esm/check-non-empty-58bd6b17.js +11 -0
  141. package/dist/esm/{check-non-empty-09c39561.js.map → check-non-empty-58bd6b17.js.map} +1 -1
  142. package/dist/esm/index-1427953c.js +40 -0
  143. package/dist/esm/index-1427953c.js.map +1 -0
  144. package/dist/esm/{index-4eff5fc5.js → index-35998e08.js} +94 -64
  145. package/dist/esm/index-35998e08.js.map +1 -0
  146. package/dist/esm/index.js +14 -12
  147. package/dist/esm/index.js.map +1 -1
  148. package/dist/esm/loader.js +3 -3
  149. package/dist/esm/package-337354c3.js +5 -0
  150. package/dist/esm/package-337354c3.js.map +1 -0
  151. package/dist/esm/post-accordion-c2013bb3.js +85 -0
  152. package/dist/esm/post-accordion-c2013bb3.js.map +1 -0
  153. package/dist/esm/post-accordion.entry.js +3 -83
  154. package/dist/esm/post-accordion.entry.js.map +1 -1
  155. package/dist/esm/post-alert-7254a70f.js +99 -0
  156. package/dist/esm/{post-alert-e457e249.js.map → post-alert-7254a70f.js.map} +1 -1
  157. package/dist/esm/post-alert.entry.js +5 -6
  158. package/dist/esm/post-alert.entry.js.map +1 -1
  159. package/dist/esm/{post-collapsible-c0a826b2.js → post-collapsible-4464cc98.js} +69 -69
  160. package/dist/esm/{post-collapsible-c0a826b2.js.map → post-collapsible-4464cc98.js.map} +1 -1
  161. package/dist/esm/post-collapsible.entry.js +4 -5
  162. package/dist/esm/post-collapsible.entry.js.map +1 -1
  163. package/dist/esm/post-components.js +4 -4
  164. package/dist/esm/post-components.js.map +1 -1
  165. package/dist/esm/post-icon-e0bbf0f5.js +103 -0
  166. package/dist/esm/post-icon-e0bbf0f5.js.map +1 -0
  167. package/dist/esm/post-icon.entry.js +5 -6
  168. package/dist/esm/post-icon.entry.js.map +1 -1
  169. package/dist/esm/post-popover-25eb3f76.js +116 -0
  170. package/dist/esm/post-popover-25eb3f76.js.map +1 -0
  171. package/dist/esm/post-popover.entry.js +5 -0
  172. package/dist/esm/post-popover.entry.js.map +1 -0
  173. package/dist/esm/post-popovercontainer-54117eea.js +1876 -0
  174. package/dist/esm/post-popovercontainer-54117eea.js.map +1 -0
  175. package/dist/esm/post-popovercontainer.entry.js +5 -0
  176. package/dist/esm/post-popovercontainer.entry.js.map +1 -0
  177. package/dist/esm/post-tab-header-1684b507.js +31 -0
  178. package/dist/esm/{post-tab-header-f0c355d6.js.map → post-tab-header-1684b507.js.map} +1 -1
  179. package/dist/esm/post-tab-header.entry.js +4 -4
  180. package/dist/esm/post-tab-panel-add26fe5.js +25 -0
  181. package/dist/esm/{post-tab-panel-46f02247.js.map → post-tab-panel-add26fe5.js.map} +1 -1
  182. package/dist/esm/post-tab-panel.entry.js +3 -3
  183. package/dist/esm/post-tabs-d738e61f.js +151 -0
  184. package/dist/esm/post-tabs-d738e61f.js.map +1 -0
  185. package/dist/esm/post-tabs.entry.js +3 -3
  186. package/dist/esm/{post-tooltip-fa7b4a0a.js → post-tooltip-57928808.js} +78 -1754
  187. package/dist/esm/post-tooltip-57928808.js.map +1 -0
  188. package/dist/esm/post-tooltip.entry.js +3 -4
  189. package/dist/esm/post-tooltip.entry.js.map +1 -1
  190. package/dist/post-components/index.esm.js +1 -1
  191. package/dist/post-components/p-05e85f2b.entry.js +2 -0
  192. package/dist/post-components/p-08abd53e.entry.js +2 -0
  193. package/dist/post-components/p-09892ad1.js +2 -0
  194. package/dist/post-components/{p-fffce1d7.js.map → p-09892ad1.js.map} +1 -1
  195. package/dist/post-components/p-1e9ec4a9.entry.js +2 -0
  196. package/dist/post-components/p-1f55663e.js +2 -0
  197. package/dist/post-components/p-1f55663e.js.map +1 -0
  198. package/dist/post-components/p-30c60b6c.entry.js +2 -0
  199. package/dist/post-components/p-38d97f62.entry.js +2 -0
  200. package/dist/post-components/p-4c188911.entry.js +2 -0
  201. package/dist/post-components/p-568bb469.entry.js +2 -0
  202. package/dist/post-components/p-65c8bd5c.entry.js +2 -0
  203. package/dist/post-components/p-6e3158e8.js +2 -0
  204. package/dist/post-components/{p-ca1e407c.js.map → p-6e3158e8.js.map} +1 -1
  205. package/dist/post-components/p-7d32dfb7.js +2 -0
  206. package/dist/post-components/{p-8b6fe20d.js.map → p-7d32dfb7.js.map} +1 -1
  207. package/dist/post-components/p-81591ad0.js +3 -0
  208. package/dist/post-components/p-81591ad0.js.map +1 -0
  209. package/dist/post-components/p-96f4ebc4.js +2 -0
  210. package/dist/post-components/p-96f4ebc4.js.map +1 -0
  211. package/dist/post-components/p-9bd5f824.js +2 -0
  212. package/dist/post-components/p-9bd5f824.js.map +1 -0
  213. package/dist/post-components/{p-b531475e.js → p-b095519d.js} +1 -1
  214. package/dist/post-components/p-b4b4f59a.js +2 -0
  215. package/dist/post-components/p-bd032124.js +2 -0
  216. package/dist/post-components/p-bd032124.js.map +1 -0
  217. package/dist/post-components/p-c5858d52.entry.js +2 -0
  218. package/dist/post-components/p-c5858d52.entry.js.map +1 -0
  219. package/dist/post-components/{p-7b8797c6.entry.js → p-dbd07f20.js} +2 -2
  220. package/dist/post-components/p-de493e36.js +2 -0
  221. package/dist/post-components/p-de493e36.js.map +1 -0
  222. package/dist/post-components/{p-3604be27.js → p-eaddd6cc.js} +2 -2
  223. package/dist/post-components/p-ed73d4c0.entry.js +2 -0
  224. package/dist/post-components/p-ed73d4c0.entry.js.map +1 -0
  225. package/dist/post-components/p-f994dce8.js +9 -0
  226. package/dist/post-components/p-f994dce8.js.map +1 -0
  227. package/dist/post-components/post-components.esm.js +1 -1
  228. package/dist/post-components/post-components.esm.js.map +1 -1
  229. package/dist/types/components/post-accordion/post-accordion.d.ts +26 -26
  230. package/dist/types/components/post-alert/post-alert.d.ts +45 -45
  231. package/dist/types/components/post-collapsible/post-collapsible.d.ts +31 -31
  232. package/dist/types/components/post-icon/post-icon.d.ts +43 -43
  233. package/dist/types/components/post-popover/post-popover.d.ts +53 -0
  234. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +62 -0
  235. package/dist/types/components/post-tab-header/post-tab-header.d.ts +9 -9
  236. package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +8 -8
  237. package/dist/types/components/post-tabs/post-tabs.d.ts +32 -32
  238. package/dist/types/components/post-tooltip/post-tooltip.d.ts +35 -62
  239. package/dist/types/components.d.ts +115 -10
  240. package/dist/types/index.d.ts +3 -0
  241. package/dist/types/stencil-public-runtime.d.ts +8 -0
  242. package/package.json +15 -13
  243. package/dist/cjs/check-non-empty-ae713942.js.map +0 -1
  244. package/dist/cjs/check-one-of-27ad3154.js +0 -10
  245. package/dist/cjs/check-one-of-27ad3154.js.map +0 -1
  246. package/dist/cjs/index-b38a23e0.js +0 -41
  247. package/dist/cjs/index-b38a23e0.js.map +0 -1
  248. package/dist/cjs/index-b619e205.js.map +0 -1
  249. package/dist/cjs/package-4e9ab85c.js +0 -7
  250. package/dist/cjs/package-4e9ab85c.js.map +0 -1
  251. package/dist/cjs/post-alert-b46943e0.js +0 -101
  252. package/dist/cjs/post-icon-5b36814e.js +0 -105
  253. package/dist/cjs/post-icon-5b36814e.js.map +0 -1
  254. package/dist/cjs/post-tab-header-805c0a52.js +0 -33
  255. package/dist/cjs/post-tab-panel-caa44a77.js +0 -27
  256. package/dist/cjs/post-tabs-29d4dc70.js +0 -153
  257. package/dist/cjs/post-tabs-29d4dc70.js.map +0 -1
  258. package/dist/cjs/post-tooltip-32a9c549.js.map +0 -1
  259. package/dist/components/check-one-of.js +0 -8
  260. package/dist/components/check-one-of.js.map +0 -1
  261. package/dist/esm/check-non-empty-09c39561.js +0 -11
  262. package/dist/esm/check-one-of-74750af9.js +0 -8
  263. package/dist/esm/check-one-of-74750af9.js.map +0 -1
  264. package/dist/esm/index-35921354.js +0 -36
  265. package/dist/esm/index-35921354.js.map +0 -1
  266. package/dist/esm/index-4eff5fc5.js.map +0 -1
  267. package/dist/esm/package-b9b10dd3.js +0 -5
  268. package/dist/esm/package-b9b10dd3.js.map +0 -1
  269. package/dist/esm/post-alert-e457e249.js +0 -99
  270. package/dist/esm/post-icon-b34da686.js +0 -103
  271. package/dist/esm/post-icon-b34da686.js.map +0 -1
  272. package/dist/esm/post-tab-header-f0c355d6.js +0 -31
  273. package/dist/esm/post-tab-panel-46f02247.js +0 -25
  274. package/dist/esm/post-tabs-5dd55290.js +0 -151
  275. package/dist/esm/post-tabs-5dd55290.js.map +0 -1
  276. package/dist/esm/post-tooltip-fa7b4a0a.js.map +0 -1
  277. package/dist/post-components/p-1339f8cd.js +0 -2
  278. package/dist/post-components/p-1339f8cd.js.map +0 -1
  279. package/dist/post-components/p-195b8c88.entry.js +0 -2
  280. package/dist/post-components/p-3225e008.entry.js +0 -2
  281. package/dist/post-components/p-61ffffa9.entry.js +0 -2
  282. package/dist/post-components/p-88262544.js +0 -2
  283. package/dist/post-components/p-8b6fe20d.js +0 -2
  284. package/dist/post-components/p-9f71d450.js +0 -2
  285. package/dist/post-components/p-a7649277.js +0 -3
  286. package/dist/post-components/p-a7649277.js.map +0 -1
  287. package/dist/post-components/p-a7c78dea.entry.js +0 -2
  288. package/dist/post-components/p-b2c3ed97.entry.js +0 -2
  289. package/dist/post-components/p-ba9aba3a.entry.js +0 -2
  290. package/dist/post-components/p-bd293ff3.entry.js +0 -2
  291. package/dist/post-components/p-ca1e407c.js +0 -2
  292. package/dist/post-components/p-d407b1c3.js +0 -2
  293. package/dist/post-components/p-d407b1c3.js.map +0 -1
  294. package/dist/post-components/p-dfe29f7f.js +0 -2
  295. package/dist/post-components/p-dfe29f7f.js.map +0 -1
  296. package/dist/post-components/p-fd7015ae.js +0 -9
  297. package/dist/post-components/p-fd7015ae.js.map +0 -1
  298. package/dist/post-components/p-fffce1d7.js +0 -2
  299. /package/dist/post-components/{p-195b8c88.entry.js.map → p-05e85f2b.entry.js.map} +0 -0
  300. /package/dist/post-components/{p-3225e008.entry.js.map → p-08abd53e.entry.js.map} +0 -0
  301. /package/dist/post-components/{p-61ffffa9.entry.js.map → p-1e9ec4a9.entry.js.map} +0 -0
  302. /package/dist/post-components/{p-88262544.js.map → p-30c60b6c.entry.js.map} +0 -0
  303. /package/dist/post-components/{p-a7c78dea.entry.js.map → p-38d97f62.entry.js.map} +0 -0
  304. /package/dist/post-components/{p-b2c3ed97.entry.js.map → p-4c188911.entry.js.map} +0 -0
  305. /package/dist/post-components/{p-ba9aba3a.entry.js.map → p-568bb469.entry.js.map} +0 -0
  306. /package/dist/post-components/{p-bd293ff3.entry.js.map → p-65c8bd5c.entry.js.map} +0 -0
  307. /package/dist/post-components/{p-b531475e.js.map → p-b095519d.js.map} +0 -0
  308. /package/dist/post-components/{p-9f71d450.js.map → p-b4b4f59a.js.map} +0 -0
  309. /package/dist/post-components/{p-7b8797c6.entry.js.map → p-dbd07f20.js.map} +0 -0
  310. /package/dist/post-components/{p-3604be27.js.map → p-eaddd6cc.js.map} +0 -0
@@ -4,254 +4,254 @@ import { fadeOut } from "../../animations";
4
4
  import { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from "../../utils";
5
5
  import { ALERT_TYPES } from "./alert-types";
6
6
  export class PostAlert {
7
- constructor() {
8
- this.alertId = crypto.randomUUID();
9
- this.classes = undefined;
10
- this.hasActions = undefined;
11
- this.hasHeading = undefined;
12
- this.onDismissButtonClick = () => this.dismiss();
13
- this.dismissible = false;
14
- this.dismissLabel = undefined;
15
- this.fixed = false;
16
- this.icon = undefined;
17
- this.type = 'primary';
18
- }
19
- validateDismissible(isDismissible = this.dismissible) {
20
- checkType(isDismissible, 'boolean', 'The post-alert "dismissible" prop should be a boolean.');
21
- setTimeout(() => this.validateDismissLabel());
22
- }
23
- validateDismissLabel(dismissLabel = this.dismissLabel) {
24
- if (this.dismissible) {
25
- checkNonEmpty(dismissLabel, 'Dismissible post-alert\'s require a "dismiss-label" prop.');
7
+ constructor() {
8
+ this.alertId = crypto.randomUUID();
9
+ this.classes = undefined;
10
+ this.hasActions = undefined;
11
+ this.hasHeading = undefined;
12
+ this.onDismissButtonClick = () => this.dismiss();
13
+ this.dismissible = false;
14
+ this.dismissLabel = undefined;
15
+ this.fixed = false;
16
+ this.icon = undefined;
17
+ this.type = 'primary';
26
18
  }
27
- }
28
- validateFixed(isFixed = this.fixed) {
29
- checkType(isFixed, 'boolean', 'The post-alert "fixed" prop should be a boolean.');
30
- }
31
- validateIcon(icon = this.icon) {
32
- checkEmptyOrPattern(icon, /\d{4}|none/, 'The post-alert "icon" prop should be a 4-digits string.');
33
- }
34
- validateType(type = this.type) {
35
- checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);
36
- }
37
- connectedCallback() {
38
- this.validateDismissible();
39
- this.validateFixed();
40
- this.validateIcon();
41
- this.validateType();
42
- }
43
- componentWillRender() {
44
- var _a;
45
- this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;
46
- this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;
47
- this.classes = `alert alert-${(_a = this.type) !== null && _a !== void 0 ? _a : 'primary'}`;
48
- if (this.dismissible)
49
- this.classes += ' alert-dismissible';
50
- if (this.hasActions)
51
- this.classes += ' alert-action';
52
- if (this.fixed)
53
- this.classes += ' alert-fixed-bottom';
54
- if (this.icon === 'none')
55
- this.classes += ' no-icon';
56
- }
57
- /**
58
- * Triggers alert dismissal programmatically (same as clicking on the close button (×)).
59
- */
60
- async dismiss() {
61
- const dismissal = fadeOut(this.host);
62
- await dismissal.finished;
63
- this.host.remove();
64
- this.dismissed.emit();
65
- }
66
- render() {
67
- const defaultAlertContent = [
68
- this.hasHeading && (h("div", { key: `${this.alertId}-heading`, class: "alert-heading" }, h("slot", { name: "heading" }))),
69
- h("slot", { key: `${this.alertId}-message` })
70
- ];
71
- const actionAlertContent = [
72
- h("div", { key: `${this.alertId}-content`, class: "alert-content" }, defaultAlertContent),
73
- h("div", { key: `${this.alertId}-buttons`, class: "alert-buttons" }, h("slot", { name: "actions" })),
74
- ];
75
- return (h(Host, { "data-version": version }, h("div", { role: "alert", class: this.classes }, this.dismissible && (h("button", { class: "btn-close", onClick: this.onDismissButtonClick }, h("span", { class: "visually-hidden" }, this.dismissLabel))), this.icon && this.icon !== 'none' && (h("post-icon", { key: `${this.alertId}-icon`, name: this.icon })), this.hasActions
76
- ? actionAlertContent
77
- : defaultAlertContent)));
78
- }
79
- static get is() { return "post-alert"; }
80
- static get encapsulation() { return "shadow"; }
81
- static get originalStyleUrls() {
82
- return {
83
- "$": ["post-alert.scss"]
84
- };
85
- }
86
- static get styleUrls() {
87
- return {
88
- "$": ["post-alert.css"]
89
- };
90
- }
91
- static get properties() {
92
- return {
93
- "dismissible": {
94
- "type": "boolean",
95
- "mutable": false,
96
- "complexType": {
97
- "original": "boolean",
98
- "resolved": "boolean",
99
- "references": {}
100
- },
101
- "required": false,
102
- "optional": false,
103
- "docs": {
104
- "tags": [],
105
- "text": "If `true`, a close button (\u00D7) is displayed and the alert can be dismissed by the user."
106
- },
107
- "attribute": "dismissible",
108
- "reflect": false,
109
- "defaultValue": "false"
110
- },
111
- "dismissLabel": {
112
- "type": "string",
113
- "mutable": false,
114
- "complexType": {
115
- "original": "string",
116
- "resolved": "string",
117
- "references": {}
118
- },
119
- "required": false,
120
- "optional": false,
121
- "docs": {
122
- "tags": [],
123
- "text": "The label to use for the close button of a dismissible alert."
124
- },
125
- "attribute": "dismiss-label",
126
- "reflect": false
127
- },
128
- "fixed": {
129
- "type": "boolean",
130
- "mutable": false,
131
- "complexType": {
132
- "original": "boolean",
133
- "resolved": "boolean",
134
- "references": {}
135
- },
136
- "required": false,
137
- "optional": false,
138
- "docs": {
139
- "tags": [],
140
- "text": "If `true`, the alert is positioned at the bottom of the window, from edge to edge."
141
- },
142
- "attribute": "fixed",
143
- "reflect": false,
144
- "defaultValue": "false"
145
- },
146
- "icon": {
147
- "type": "string",
148
- "mutable": false,
149
- "complexType": {
150
- "original": "string",
151
- "resolved": "string",
152
- "references": {}
153
- },
154
- "required": false,
155
- "optional": false,
156
- "docs": {
157
- "tags": [],
158
- "text": "The icon to display in the alert. By default, the icon depends on the alert type.\n\nIf `none`, no icon is displayed."
159
- },
160
- "attribute": "icon",
161
- "reflect": false
162
- },
163
- "type": {
164
- "type": "string",
165
- "mutable": false,
166
- "complexType": {
167
- "original": "AlertType",
168
- "resolved": "\"danger\" | \"gray\" | \"info\" | \"primary\" | \"success\" | \"warning\"",
169
- "references": {
170
- "AlertType": {
171
- "location": "import",
172
- "path": "./alert-types",
173
- "id": "src/components/post-alert/alert-types.ts::AlertType"
174
- }
175
- }
176
- },
177
- "required": false,
178
- "optional": false,
179
- "docs": {
180
- "tags": [],
181
- "text": "The type of the alert."
182
- },
183
- "attribute": "type",
184
- "reflect": false,
185
- "defaultValue": "'primary'"
186
- }
187
- };
188
- }
189
- static get states() {
190
- return {
191
- "alertId": {},
192
- "classes": {},
193
- "hasActions": {},
194
- "hasHeading": {},
195
- "onDismissButtonClick": {}
196
- };
197
- }
198
- static get events() {
199
- return [{
200
- "method": "dismissed",
201
- "name": "dismissed",
202
- "bubbles": true,
203
- "cancelable": true,
204
- "composed": true,
205
- "docs": {
206
- "tags": [],
207
- "text": "An event emitted when the alert element is dismissed, after the transition.\nIt has no payload and only relevant for dismissible alerts."
208
- },
209
- "complexType": {
210
- "original": "void",
211
- "resolved": "void",
212
- "references": {}
19
+ validateDismissible(isDismissible = this.dismissible) {
20
+ checkType(isDismissible, 'boolean', 'The post-alert "dismissible" prop should be a boolean.');
21
+ setTimeout(() => this.validateDismissLabel());
22
+ }
23
+ validateDismissLabel(dismissLabel = this.dismissLabel) {
24
+ if (this.dismissible) {
25
+ checkNonEmpty(dismissLabel, 'Dismissible post-alert\'s require a "dismiss-label" prop.');
213
26
  }
214
- }];
215
- }
216
- static get methods() {
217
- return {
218
- "dismiss": {
219
- "complexType": {
220
- "signature": "() => Promise<void>",
221
- "parameters": [],
222
- "references": {
223
- "Promise": {
224
- "location": "global",
225
- "id": "global::Promise"
27
+ }
28
+ validateFixed(isFixed = this.fixed) {
29
+ checkType(isFixed, 'boolean', 'The post-alert "fixed" prop should be a boolean.');
30
+ }
31
+ validateIcon(icon = this.icon) {
32
+ checkEmptyOrPattern(icon, /\d{4}|none/, 'The post-alert "icon" prop should be a 4-digits string.');
33
+ }
34
+ validateType(type = this.type) {
35
+ checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);
36
+ }
37
+ connectedCallback() {
38
+ this.validateDismissible();
39
+ this.validateFixed();
40
+ this.validateIcon();
41
+ this.validateType();
42
+ }
43
+ componentWillRender() {
44
+ var _a;
45
+ this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;
46
+ this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;
47
+ this.classes = `alert alert-${(_a = this.type) !== null && _a !== void 0 ? _a : 'primary'}`;
48
+ if (this.dismissible)
49
+ this.classes += ' alert-dismissible';
50
+ if (this.hasActions)
51
+ this.classes += ' alert-action';
52
+ if (this.fixed)
53
+ this.classes += ' alert-fixed-bottom';
54
+ if (this.icon === 'none')
55
+ this.classes += ' no-icon';
56
+ }
57
+ /**
58
+ * Triggers alert dismissal programmatically (same as clicking on the close button (×)).
59
+ */
60
+ async dismiss() {
61
+ const dismissal = fadeOut(this.host);
62
+ await dismissal.finished;
63
+ this.host.remove();
64
+ this.dismissed.emit();
65
+ }
66
+ render() {
67
+ const defaultAlertContent = [
68
+ this.hasHeading && (h("div", { key: `${this.alertId}-heading`, class: "alert-heading" }, h("slot", { name: "heading" }))),
69
+ h("slot", { key: `${this.alertId}-message` })
70
+ ];
71
+ const actionAlertContent = [
72
+ h("div", { key: `${this.alertId}-content`, class: "alert-content" }, defaultAlertContent),
73
+ h("div", { key: `${this.alertId}-buttons`, class: "alert-buttons" }, h("slot", { name: "actions" })),
74
+ ];
75
+ return (h(Host, { "data-version": version }, h("div", { role: "alert", class: this.classes }, this.dismissible && (h("button", { class: "btn-close", onClick: this.onDismissButtonClick }, h("span", { class: "visually-hidden" }, this.dismissLabel))), this.icon && this.icon !== 'none' && (h("post-icon", { key: `${this.alertId}-icon`, name: this.icon })), this.hasActions
76
+ ? actionAlertContent
77
+ : defaultAlertContent)));
78
+ }
79
+ static get is() { return "post-alert"; }
80
+ static get encapsulation() { return "shadow"; }
81
+ static get originalStyleUrls() {
82
+ return {
83
+ "$": ["post-alert.scss"]
84
+ };
85
+ }
86
+ static get styleUrls() {
87
+ return {
88
+ "$": ["post-alert.css"]
89
+ };
90
+ }
91
+ static get properties() {
92
+ return {
93
+ "dismissible": {
94
+ "type": "boolean",
95
+ "mutable": false,
96
+ "complexType": {
97
+ "original": "boolean",
98
+ "resolved": "boolean",
99
+ "references": {}
100
+ },
101
+ "required": false,
102
+ "optional": false,
103
+ "docs": {
104
+ "tags": [],
105
+ "text": "If `true`, a close button (\u00D7) is displayed and the alert can be dismissed by the user."
106
+ },
107
+ "attribute": "dismissible",
108
+ "reflect": false,
109
+ "defaultValue": "false"
110
+ },
111
+ "dismissLabel": {
112
+ "type": "string",
113
+ "mutable": false,
114
+ "complexType": {
115
+ "original": "string",
116
+ "resolved": "string",
117
+ "references": {}
118
+ },
119
+ "required": false,
120
+ "optional": false,
121
+ "docs": {
122
+ "tags": [],
123
+ "text": "The label to use for the close button of a dismissible alert."
124
+ },
125
+ "attribute": "dismiss-label",
126
+ "reflect": false
127
+ },
128
+ "fixed": {
129
+ "type": "boolean",
130
+ "mutable": false,
131
+ "complexType": {
132
+ "original": "boolean",
133
+ "resolved": "boolean",
134
+ "references": {}
135
+ },
136
+ "required": false,
137
+ "optional": false,
138
+ "docs": {
139
+ "tags": [],
140
+ "text": "If `true`, the alert is positioned at the bottom of the window, from edge to edge."
141
+ },
142
+ "attribute": "fixed",
143
+ "reflect": false,
144
+ "defaultValue": "false"
145
+ },
146
+ "icon": {
147
+ "type": "string",
148
+ "mutable": false,
149
+ "complexType": {
150
+ "original": "string",
151
+ "resolved": "string",
152
+ "references": {}
153
+ },
154
+ "required": false,
155
+ "optional": false,
156
+ "docs": {
157
+ "tags": [],
158
+ "text": "The icon to display in the alert. By default, the icon depends on the alert type.\n\nIf `none`, no icon is displayed."
159
+ },
160
+ "attribute": "icon",
161
+ "reflect": false
162
+ },
163
+ "type": {
164
+ "type": "string",
165
+ "mutable": false,
166
+ "complexType": {
167
+ "original": "AlertType",
168
+ "resolved": "\"danger\" | \"gray\" | \"info\" | \"primary\" | \"success\" | \"warning\"",
169
+ "references": {
170
+ "AlertType": {
171
+ "location": "import",
172
+ "path": "./alert-types",
173
+ "id": "src/components/post-alert/alert-types.ts::AlertType"
174
+ }
175
+ }
176
+ },
177
+ "required": false,
178
+ "optional": false,
179
+ "docs": {
180
+ "tags": [],
181
+ "text": "The type of the alert."
182
+ },
183
+ "attribute": "type",
184
+ "reflect": false,
185
+ "defaultValue": "'primary'"
226
186
  }
227
- },
228
- "return": "Promise<void>"
229
- },
230
- "docs": {
231
- "text": "Triggers alert dismissal programmatically (same as clicking on the close button (\u00D7)).",
232
- "tags": []
233
- }
234
- }
235
- };
236
- }
237
- static get elementRef() { return "host"; }
238
- static get watchers() {
239
- return [{
240
- "propName": "dismissible",
241
- "methodName": "validateDismissible"
242
- }, {
243
- "propName": "dismissLabel",
244
- "methodName": "validateDismissLabel"
245
- }, {
246
- "propName": "fixed",
247
- "methodName": "validateFixed"
248
- }, {
249
- "propName": "icon",
250
- "methodName": "validateIcon"
251
- }, {
252
- "propName": "type",
253
- "methodName": "validateType"
254
- }];
255
- }
187
+ };
188
+ }
189
+ static get states() {
190
+ return {
191
+ "alertId": {},
192
+ "classes": {},
193
+ "hasActions": {},
194
+ "hasHeading": {},
195
+ "onDismissButtonClick": {}
196
+ };
197
+ }
198
+ static get events() {
199
+ return [{
200
+ "method": "dismissed",
201
+ "name": "dismissed",
202
+ "bubbles": true,
203
+ "cancelable": true,
204
+ "composed": true,
205
+ "docs": {
206
+ "tags": [],
207
+ "text": "An event emitted when the alert element is dismissed, after the transition.\nIt has no payload and only relevant for dismissible alerts."
208
+ },
209
+ "complexType": {
210
+ "original": "void",
211
+ "resolved": "void",
212
+ "references": {}
213
+ }
214
+ }];
215
+ }
216
+ static get methods() {
217
+ return {
218
+ "dismiss": {
219
+ "complexType": {
220
+ "signature": "() => Promise<void>",
221
+ "parameters": [],
222
+ "references": {
223
+ "Promise": {
224
+ "location": "global",
225
+ "id": "global::Promise"
226
+ }
227
+ },
228
+ "return": "Promise<void>"
229
+ },
230
+ "docs": {
231
+ "text": "Triggers alert dismissal programmatically (same as clicking on the close button (\u00D7)).",
232
+ "tags": []
233
+ }
234
+ }
235
+ };
236
+ }
237
+ static get elementRef() { return "host"; }
238
+ static get watchers() {
239
+ return [{
240
+ "propName": "dismissible",
241
+ "methodName": "validateDismissible"
242
+ }, {
243
+ "propName": "dismissLabel",
244
+ "methodName": "validateDismissLabel"
245
+ }, {
246
+ "propName": "fixed",
247
+ "methodName": "validateFixed"
248
+ }, {
249
+ "propName": "icon",
250
+ "methodName": "validateIcon"
251
+ }, {
252
+ "propName": "type",
253
+ "methodName": "validateType"
254
+ }];
255
+ }
256
256
  }
257
257
  //# sourceMappingURL=post-alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"post-alert.js","sourceRoot":"","sources":["../../../../src/components/post-alert/post-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,OAAO,EAAE,MAAM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xC,CAAC;IAEF,MAAM,kBAAkB,GAAG;MACzB,WAAK,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,UAAU,EAAE,KAAK,EAAC,eAAe,IACvD,mBAAmB,CAChB;MACN,WAAK,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,UAAU,EAAE,KAAK,EAAC,eAAe;QACxD,YAAM,IAAI,EAAC,SAAS,GAAE,CAClB;KACP,CAAC;IAEF,OAAO,CACL,EAAC,IAAI,oBAAe,OAAO;MACzB,WAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,OAAO;QAClC,IAAI,CAAC,WAAW,IAAI,CACnB,cAAQ,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB;UAC1D,YAAM,KAAK,EAAC,iBAAiB,IAAE,IAAI,CAAC,YAAY,CAAQ,CACjD,CACV;QAEA,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CACpC,iBAAW,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CAC5D;QAEA,IAAI,CAAC,UAAU;UACd,CAAC,CAAC,kBAAkB;UACpB,CAAC,CAAC,mBAAmB,CAEnB,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeOut } from '../../animations';\nimport { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from '../../utils';\nimport { ALERT_TYPES, AlertType } from './alert-types';\n\n@Component({\n tag: 'post-alert',\n styleUrl: 'post-alert.scss',\n shadow: true,\n})\nexport class PostAlert {\n @Element() host: HTMLPostAlertElement;\n\n @State() alertId = crypto.randomUUID();\n @State() classes: string;\n @State() hasActions: boolean;\n @State() hasHeading: boolean;\n @State() onDismissButtonClick = () => this.dismiss();\n\n /**\n * If `true`, a close button (×) is displayed and the alert can be dismissed by the user.\n */\n @Prop() readonly dismissible: boolean = false;\n\n @Watch('dismissible')\n validateDismissible(isDismissible = this.dismissible) {\n checkType(isDismissible, 'boolean', 'The post-alert \"dismissible\" prop should be a boolean.');\n setTimeout(() => this.validateDismissLabel());\n }\n\n /**\n * The label to use for the close button of a dismissible alert.\n */\n @Prop() readonly dismissLabel: string;\n\n @Watch('dismissLabel')\n validateDismissLabel(dismissLabel = this.dismissLabel) {\n if (this.dismissible) {\n checkNonEmpty(dismissLabel, 'Dismissible post-alert\\'s require a \"dismiss-label\" prop.');\n }\n }\n\n /**\n * If `true`, the alert is positioned at the bottom of the window, from edge to edge.\n */\n @Prop() readonly fixed: boolean = false;\n\n @Watch('fixed')\n validateFixed(isFixed = this.fixed) {\n checkType(isFixed, 'boolean', 'The post-alert \"fixed\" prop should be a boolean.');\n }\n\n /**\n * The icon to display in the alert. By default, the icon depends on the alert type.\n *\n * If `none`, no icon is displayed.\n */\n @Prop() readonly icon: string;\n\n @Watch('icon')\n validateIcon(icon = this.icon) {\n checkEmptyOrPattern(icon, /\\d{4}|none/, 'The post-alert \"icon\" prop should be a 4-digits string.');\n }\n\n /**\n * The type of the alert.\n */\n @Prop() readonly type: AlertType = 'primary';\n\n @Watch('type')\n validateType(type = this.type) {\n checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);\n }\n\n /**\n * An event emitted when the alert element is dismissed, after the transition.\n * It has no payload and only relevant for dismissible alerts.\n */\n @Event() dismissed: EventEmitter<void>;\n\n connectedCallback() {\n this.validateDismissible();\n this.validateFixed();\n this.validateIcon();\n this.validateType();\n }\n\n componentWillRender() {\n this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;\n this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;\n\n this.classes = `alert alert-${this.type ?? 'primary'}`;\n if (this.dismissible) this.classes += ' alert-dismissible';\n if (this.hasActions) this.classes += ' alert-action';\n if (this.fixed) this.classes += ' alert-fixed-bottom';\n if (this.icon === 'none') this.classes += ' no-icon';\n }\n\n /**\n * Triggers alert dismissal programmatically (same as clicking on the close button (×)).\n */\n @Method()\n async dismiss() {\n const dismissal = fadeOut(this.host);\n\n await dismissal.finished;\n\n this.host.remove();\n this.dismissed.emit();\n }\n\n render() {\n const defaultAlertContent = [\n this.hasHeading && (\n <div key={`${this.alertId}-heading`} class=\"alert-heading\">\n <slot name=\"heading\"/>\n </div>\n ),\n <slot key={`${this.alertId}-message`}/>\n ];\n\n const actionAlertContent = [\n <div key={`${this.alertId}-content`} class=\"alert-content\">\n {defaultAlertContent}\n </div>,\n <div key={`${this.alertId}-buttons`} class=\"alert-buttons\">\n <slot name=\"actions\"/>\n </div>,\n ];\n\n return (\n <Host data-version={version}>\n <div role=\"alert\" class={this.classes}>\n {this.dismissible && (\n <button class=\"btn-close\" onClick={this.onDismissButtonClick}>\n <span class=\"visually-hidden\">{this.dismissLabel}</span>\n </button>\n )}\n\n {this.icon && this.icon !== 'none' && (\n <post-icon key={`${this.alertId}-icon`} name={this.icon} />\n )}\n\n {this.hasActions\n ? actionAlertContent\n : defaultAlertContent\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
1
+ {"version":3,"file":"post-alert.js","sourceRoot":"","sources":["../../../../src/components/post-alert/post-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,OAAO,EAAE,MAA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SACxC,CAAC;QAEF,MAAM,kBAAkB,GAAG;YACzB,WAAK,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,UAAU,EAAE,KAAK,EAAC,eAAe,IACvD,mBAAmB,CAChB;YACN,WAAK,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,UAAU,EAAE,KAAK,EAAC,eAAe;gBACxD,YAAM,IAAI,EAAC,SAAS,GAAE,CAClB;SACP,CAAC;QAEF,OAAO,CACL,EAAC,IAAI,oBAAe,OAAO;YACzB,WAAK,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,OAAO;gBAClC,IAAI,CAAC,WAAW,IAAI,CACnB,cAAQ,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,IAAI,CAAC,oBAAoB;oBAC1D,YAAM,KAAK,EAAC,iBAAiB,IAAE,IAAI,CAAC,YAAY,CAAQ,CACjD,CACV;gBAEA,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CACpC,iBAAW,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CAC5D;gBAEA,IAAI,CAAC,UAAU;oBACd,CAAC,CAAC,kBAAkB;oBACpB,CAAC,CAAC,mBAAmB,CAEnB,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeOut } from '../../animations';\nimport { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from '../../utils';\nimport { ALERT_TYPES, AlertType } from './alert-types';\n\n@Component({\n tag: 'post-alert',\n styleUrl: 'post-alert.scss',\n shadow: true,\n})\nexport class PostAlert {\n @Element() host: HTMLPostAlertElement;\n\n @State() alertId = crypto.randomUUID();\n @State() classes: string;\n @State() hasActions: boolean;\n @State() hasHeading: boolean;\n @State() onDismissButtonClick = () => this.dismiss();\n\n /**\n * If `true`, a close button (×) is displayed and the alert can be dismissed by the user.\n */\n @Prop() readonly dismissible: boolean = false;\n\n @Watch('dismissible')\n validateDismissible(isDismissible = this.dismissible) {\n checkType(isDismissible, 'boolean', 'The post-alert \"dismissible\" prop should be a boolean.');\n setTimeout(() => this.validateDismissLabel());\n }\n\n /**\n * The label to use for the close button of a dismissible alert.\n */\n @Prop() readonly dismissLabel: string;\n\n @Watch('dismissLabel')\n validateDismissLabel(dismissLabel = this.dismissLabel) {\n if (this.dismissible) {\n checkNonEmpty(dismissLabel, 'Dismissible post-alert\\'s require a \"dismiss-label\" prop.');\n }\n }\n\n /**\n * If `true`, the alert is positioned at the bottom of the window, from edge to edge.\n */\n @Prop() readonly fixed: boolean = false;\n\n @Watch('fixed')\n validateFixed(isFixed = this.fixed) {\n checkType(isFixed, 'boolean', 'The post-alert \"fixed\" prop should be a boolean.');\n }\n\n /**\n * The icon to display in the alert. By default, the icon depends on the alert type.\n *\n * If `none`, no icon is displayed.\n */\n @Prop() readonly icon: string;\n\n @Watch('icon')\n validateIcon(icon = this.icon) {\n checkEmptyOrPattern(icon, /\\d{4}|none/, 'The post-alert \"icon\" prop should be a 4-digits string.');\n }\n\n /**\n * The type of the alert.\n */\n @Prop() readonly type: AlertType = 'primary';\n\n @Watch('type')\n validateType(type = this.type) {\n checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);\n }\n\n /**\n * An event emitted when the alert element is dismissed, after the transition.\n * It has no payload and only relevant for dismissible alerts.\n */\n @Event() dismissed: EventEmitter<void>;\n\n connectedCallback() {\n this.validateDismissible();\n this.validateFixed();\n this.validateIcon();\n this.validateType();\n }\n\n componentWillRender() {\n this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;\n this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;\n\n this.classes = `alert alert-${this.type ?? 'primary'}`;\n if (this.dismissible) this.classes += ' alert-dismissible';\n if (this.hasActions) this.classes += ' alert-action';\n if (this.fixed) this.classes += ' alert-fixed-bottom';\n if (this.icon === 'none') this.classes += ' no-icon';\n }\n\n /**\n * Triggers alert dismissal programmatically (same as clicking on the close button (×)).\n */\n @Method()\n async dismiss() {\n const dismissal = fadeOut(this.host);\n\n await dismissal.finished;\n\n this.host.remove();\n this.dismissed.emit();\n }\n\n render() {\n const defaultAlertContent = [\n this.hasHeading && (\n <div key={`${this.alertId}-heading`} class=\"alert-heading\">\n <slot name=\"heading\"/>\n </div>\n ),\n <slot key={`${this.alertId}-message`}/>\n ];\n\n const actionAlertContent = [\n <div key={`${this.alertId}-content`} class=\"alert-content\">\n {defaultAlertContent}\n </div>,\n <div key={`${this.alertId}-buttons`} class=\"alert-buttons\">\n <slot name=\"actions\"/>\n </div>,\n ];\n\n return (\n <Host data-version={version}>\n <div role=\"alert\" class={this.classes}>\n {this.dismissible && (\n <button class=\"btn-close\" onClick={this.onDismissButtonClick}>\n <span class=\"visually-hidden\">{this.dismissLabel}</span>\n </button>\n )}\n\n {this.icon && this.icon !== 'none' && (\n <post-icon key={`${this.alertId}-icon`} name={this.icon} />\n )}\n\n {this.hasActions\n ? actionAlertContent\n : defaultAlertContent\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}