@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,175 +4,176 @@ import { collapse, expand } from "../../animations/collapse";
4
4
  import { checkEmptyOrOneOf, checkEmptyOrType, isMotionReduced } from "../../utils";
5
5
  import { HEADING_LEVELS } from "./heading-levels";
6
6
  export class PostCollapsible {
7
- constructor() {
8
- this.isLoaded = false;
9
- this.id = undefined;
10
- this.isOpen = true;
11
- this.hasHeader = undefined;
12
- this.headingTag = undefined;
13
- this.collapsed = false;
14
- this.headingLevel = 2;
15
- }
16
- validateCollapsed(newValue = this.collapsed) {
17
- checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');
18
- }
19
- validateHeadingLevel(newValue = this.headingLevel) {
20
- checkEmptyOrOneOf(newValue, HEADING_LEVELS, 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.');
21
- }
22
- connectedCallback() {
23
- this.validateCollapsed();
24
- this.validateHeadingLevel();
25
- }
26
- componentWillRender() {
27
- var _a;
28
- this.id = this.host.id || `c${crypto.randomUUID()}`;
29
- this.hasHeader = this.host.querySelectorAll('[slot="header"]').length > 0;
30
- this.headingTag = `h${(_a = this.headingLevel) !== null && _a !== void 0 ? _a : 2}`;
31
- }
32
- componentDidLoad() {
33
- if (this.collapsed)
34
- void this.toggle(false);
35
- this.isLoaded = true;
36
- }
37
- /**
38
- * Triggers the collapse programmatically.
39
- *
40
- * If there is a collapsing transition running already, it will be reversed.
41
- */
42
- async toggle(open = !this.isOpen) {
43
- if (open === this.isOpen)
44
- return open;
45
- this.isOpen = !this.isOpen;
46
- if (this.isLoaded)
47
- this.collapseChange.emit();
48
- const animation = open ? expand(this.collapsible) : collapse(this.collapsible);
49
- if (!this.isLoaded || isMotionReduced())
50
- animation.finish();
51
- await animation.finished;
52
- animation.commitStyles();
53
- return this.isOpen;
54
- }
55
- render() {
56
- const collapse = (h("div", { "aria-labelledby": this.hasHeader ? `${this.id}--header` : undefined, class: `collapse${this.hasHeader ? ' accordion-collapse' : ''}`, id: `${this.id}--collapse`, ref: el => (this.collapsible = el) }, this.hasHeader ? (h("div", { class: "accordion-body" }, h("slot", null))) : (h("slot", null))));
57
- return (h(Host, { id: this.id, "data-version": version }, this.hasHeader ? (h("div", { part: "accordion-item", class: "accordion-item" }, h(this.headingTag, { class: "accordion-header", id: `${this.id}--header` }, h("button", { "aria-controls": `${this.id}--collapse`, "aria-expanded": `${this.isOpen}`, class: `accordion-button${this.isOpen ? '' : ' collapsed'}`, onClick: () => this.toggle(), type: "button" }, h("slot", { name: "header" }))), collapse)) : (collapse)));
58
- }
59
- static get is() { return "post-collapsible"; }
60
- static get encapsulation() { return "shadow"; }
61
- static get originalStyleUrls() {
62
- return {
63
- "$": ["post-collapsible.scss"]
64
- };
65
- }
66
- static get styleUrls() {
67
- return {
68
- "$": ["post-collapsible.css"]
69
- };
70
- }
71
- static get properties() {
72
- return {
73
- "collapsed": {
74
- "type": "boolean",
75
- "mutable": false,
76
- "complexType": {
77
- "original": "boolean",
78
- "resolved": "boolean",
79
- "references": {}
80
- },
81
- "required": false,
82
- "optional": true,
83
- "docs": {
84
- "tags": [],
85
- "text": "If `true`, the element is initially collapsed otherwise it is displayed."
86
- },
87
- "attribute": "collapsed",
88
- "reflect": false,
89
- "defaultValue": "false"
90
- },
91
- "headingLevel": {
92
- "type": "number",
93
- "mutable": false,
94
- "complexType": {
95
- "original": "HeadingLevel",
96
- "resolved": "1 | 2 | 3 | 4 | 5 | 6",
97
- "references": {
98
- "HeadingLevel": {
99
- "location": "import",
100
- "path": "./heading-levels",
101
- "id": "src/components/post-collapsible/heading-levels.ts::HeadingLevel"
7
+ constructor() {
8
+ this.isLoaded = false;
9
+ this.id = undefined;
10
+ this.isOpen = true;
11
+ this.hasHeader = undefined;
12
+ this.headingTag = undefined;
13
+ this.collapsed = false;
14
+ this.headingLevel = 2;
15
+ }
16
+ validateCollapsed(newValue = this.collapsed) {
17
+ checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');
18
+ }
19
+ validateHeadingLevel(newValue = this.headingLevel) {
20
+ checkEmptyOrOneOf(newValue, HEADING_LEVELS, 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.');
21
+ }
22
+ connectedCallback() {
23
+ this.validateCollapsed();
24
+ this.validateHeadingLevel();
25
+ }
26
+ componentWillRender() {
27
+ var _a;
28
+ this.id = this.host.id || `c${crypto.randomUUID()}`;
29
+ this.hasHeader = this.host.querySelectorAll('[slot="header"]').length > 0;
30
+ this.headingTag = `h${(_a = this.headingLevel) !== null && _a !== void 0 ? _a : 2}`;
31
+ }
32
+ componentDidLoad() {
33
+ if (this.collapsed)
34
+ void this.toggle(false);
35
+ this.isLoaded = true;
36
+ }
37
+ /**
38
+ * Triggers the collapse programmatically.
39
+ *
40
+ * If there is a collapsing transition running already, it will be reversed.
41
+ */
42
+ async toggle(open = !this.isOpen) {
43
+ if (open === this.isOpen)
44
+ return open;
45
+ this.isOpen = !this.isOpen;
46
+ if (this.isLoaded)
47
+ this.collapseChange.emit();
48
+ const animation = open ? expand(this.collapsible) : collapse(this.collapsible);
49
+ if (!this.isLoaded || isMotionReduced())
50
+ animation.finish();
51
+ await animation.finished;
52
+ animation.commitStyles();
53
+ return this.isOpen;
54
+ }
55
+ render() {
56
+ const collapse = (h("div", { "aria-labelledby": this.hasHeader ? `${this.id}--header` : undefined, class: `collapse${this.hasHeader ? ' accordion-collapse' : ''}`, id: `${this.id}--collapse`, ref: el => (this.collapsible = el) }, this.hasHeader ? (h("div", { class: "accordion-body" }, h("slot", null))) : (h("slot", null))));
57
+ return (h(Host, { id: this.id, "data-version": version }, this.hasHeader ? (h("div", { part: "accordion-item", class: "accordion-item" }, h(this.headingTag, { class: "accordion-header", id: `${this.id}--header` }, h("button", { "aria-controls": `${this.id}--collapse`, "aria-expanded": `${this.isOpen}`, class: `accordion-button${this.isOpen ? '' : ' collapsed'}`, onClick: () => this.toggle(), type: "button" }, h("slot", { name: "header" }))), collapse)) : (collapse)));
58
+ }
59
+ static get is() { return "post-collapsible"; }
60
+ static get encapsulation() { return "shadow"; }
61
+ static get originalStyleUrls() {
62
+ return {
63
+ "$": ["post-collapsible.scss"]
64
+ };
65
+ }
66
+ static get styleUrls() {
67
+ return {
68
+ "$": ["post-collapsible.css"]
69
+ };
70
+ }
71
+ static get properties() {
72
+ return {
73
+ "collapsed": {
74
+ "type": "boolean",
75
+ "mutable": false,
76
+ "complexType": {
77
+ "original": "boolean",
78
+ "resolved": "boolean",
79
+ "references": {}
80
+ },
81
+ "required": false,
82
+ "optional": true,
83
+ "docs": {
84
+ "tags": [],
85
+ "text": "If `true`, the element is initially collapsed otherwise it is displayed."
86
+ },
87
+ "attribute": "collapsed",
88
+ "reflect": false,
89
+ "defaultValue": "false"
90
+ },
91
+ "headingLevel": {
92
+ "type": "number",
93
+ "mutable": false,
94
+ "complexType": {
95
+ "original": "HeadingLevel",
96
+ "resolved": "1 | 2 | 3 | 4 | 5 | 6",
97
+ "references": {
98
+ "HeadingLevel": {
99
+ "location": "import",
100
+ "path": "./heading-levels",
101
+ "id": "src/components/post-collapsible/heading-levels.ts::HeadingLevel"
102
+ }
103
+ }
104
+ },
105
+ "required": false,
106
+ "optional": true,
107
+ "docs": {
108
+ "tags": [],
109
+ "text": "Defines the hierarchical level of the collapsible header within the headings structure."
110
+ },
111
+ "attribute": "heading-level",
112
+ "reflect": false,
113
+ "defaultValue": "2"
102
114
  }
103
- }
104
- },
105
- "required": false,
106
- "optional": true,
107
- "docs": {
108
- "tags": [],
109
- "text": "Defines the hierarchical level of the collapsible header within the headings structure."
110
- },
111
- "attribute": "heading-level",
112
- "reflect": false,
113
- "defaultValue": "2"
114
- }
115
- };
116
- }
117
- static get states() {
118
- return {
119
- "id": {},
120
- "isOpen": {},
121
- "hasHeader": {},
122
- "headingTag": {}
123
- };
124
- }
125
- static get events() {
126
- return [{
127
- "method": "collapseChange",
128
- "name": "collapseChange",
129
- "bubbles": true,
130
- "cancelable": true,
131
- "composed": true,
132
- "docs": {
133
- "tags": [],
134
- "text": "An event emitted when the collapse element is shown or hidden, before the transition. It has no payload."
135
- },
136
- "complexType": {
137
- "original": "void",
138
- "resolved": "void",
139
- "references": {}
140
- }
141
- }];
142
- }
143
- static get methods() {
144
- return {
145
- "toggle": {
146
- "complexType": {
147
- "signature": "(open?: boolean) => Promise<boolean>",
148
- "parameters": [{
149
- "tags": [],
150
- "text": ""
151
- }],
152
- "references": {
153
- "Promise": {
154
- "location": "global",
155
- "id": "global::Promise"
115
+ };
116
+ }
117
+ static get states() {
118
+ return {
119
+ "id": {},
120
+ "isOpen": {},
121
+ "hasHeader": {},
122
+ "headingTag": {}
123
+ };
124
+ }
125
+ static get events() {
126
+ return [{
127
+ "method": "collapseChange",
128
+ "name": "collapseChange",
129
+ "bubbles": true,
130
+ "cancelable": true,
131
+ "composed": true,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": "An event emitted when the collapse element is shown or hidden, before the transition. It has no payload."
135
+ },
136
+ "complexType": {
137
+ "original": "void",
138
+ "resolved": "void",
139
+ "references": {}
140
+ }
141
+ }];
142
+ }
143
+ static get methods() {
144
+ return {
145
+ "toggle": {
146
+ "complexType": {
147
+ "signature": "(open?: boolean) => Promise<boolean>",
148
+ "parameters": [{
149
+ "name": "open",
150
+ "type": "boolean",
151
+ "docs": ""
152
+ }],
153
+ "references": {
154
+ "Promise": {
155
+ "location": "global",
156
+ "id": "global::Promise"
157
+ }
158
+ },
159
+ "return": "Promise<boolean>"
160
+ },
161
+ "docs": {
162
+ "text": "Triggers the collapse programmatically.\n\nIf there is a collapsing transition running already, it will be reversed.",
163
+ "tags": []
164
+ }
156
165
  }
157
- },
158
- "return": "Promise<boolean>"
159
- },
160
- "docs": {
161
- "text": "Triggers the collapse programmatically.\n\nIf there is a collapsing transition running already, it will be reversed.",
162
- "tags": []
163
- }
164
- }
165
- };
166
- }
167
- static get elementRef() { return "host"; }
168
- static get watchers() {
169
- return [{
170
- "propName": "collapsed",
171
- "methodName": "validateCollapsed"
172
- }, {
173
- "propName": "headingLevel",
174
- "methodName": "validateHeadingLevel"
175
- }];
176
- }
166
+ };
167
+ }
168
+ static get elementRef() { return "host"; }
169
+ static get watchers() {
170
+ return [{
171
+ "propName": "collapsed",
172
+ "methodName": "validateCollapsed"
173
+ }, {
174
+ "propName": "headingLevel",
175
+ "methodName": "validateHeadingLevel"
176
+ }];
177
+ }
177
178
  }
178
179
  //# sourceMappingURL=post-collapsible.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"post-collapsible.js","sourceRoot":"","sources":["../../../../src/components/post-collapsible/post-collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,M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AC,EAAE,EAAE,IAAI,CAAC,EAAE,kBAAgB,OAAO,IACrC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAChB,WAAK,IAAI,EAAC,gBAAgB,EAAC,KAAK,EAAC,gBAAgB;MAC/C,EAAC,IAAI,CAAC,UAAU,IAAC,KAAK,EAAC,kBAAkB,EAAC,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,UAAU;QAChE,+BACiB,GAAG,IAAI,CAAC,EAAE,YAAY,mBACtB,GAAG,IAAI,CAAC,MAAM,EAAE,EAC/B,KAAK,EAAE,mBAAmB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,EAAE,EAC3D,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC5B,IAAI,EAAC,QAAQ;UAEb,YAAM,IAAI,EAAC,QAAQ,GAAG,CACf,CACO;MAEjB,QAAQ,CACL,CACP,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,CACI,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { collapse, expand } from '../../animations/collapse';\nimport { checkEmptyOrOneOf, checkEmptyOrType, isMotionReduced } from '../../utils';\nimport { HEADING_LEVELS, HeadingLevel } from './heading-levels';\n\n@Component({\n tag: 'post-collapsible',\n styleUrl: 'post-collapsible.scss',\n shadow: true,\n})\nexport class PostCollapsible {\n private isLoaded = false;\n private collapsible: HTMLElement;\n\n @Element() host: HTMLPostCollapsibleElement;\n\n @State() id: string;\n @State() isOpen = true;\n @State() hasHeader: boolean;\n @State() headingTag: string;\n\n /**\n * If `true`, the element is initially collapsed otherwise it is displayed.\n */\n @Prop() readonly collapsed?: boolean = false;\n\n @Watch('collapsed')\n validateCollapsed(newValue = this.collapsed) {\n checkEmptyOrType(\n newValue,\n 'boolean',\n 'The `collapsed` property of the `post-collapsible` must be a boolean.',\n );\n }\n\n /**\n * Defines the hierarchical level of the collapsible header within the headings structure.\n */\n @Prop() readonly headingLevel?: HeadingLevel = 2;\n\n @Watch('headingLevel')\n validateHeadingLevel(newValue = this.headingLevel) {\n checkEmptyOrOneOf(\n newValue,\n HEADING_LEVELS,\n 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.',\n );\n }\n\n /**\n * An event emitted when the collapse element is shown or hidden, before the transition. It has no payload.\n */\n @Event() collapseChange: EventEmitter<void>;\n\n connectedCallback() {\n this.validateCollapsed();\n this.validateHeadingLevel();\n }\n\n componentWillRender() {\n this.id = this.host.id || `c${crypto.randomUUID()}`;\n this.hasHeader = this.host.querySelectorAll('[slot=\"header\"]').length > 0;\n this.headingTag = `h${this.headingLevel ?? 2}`;\n }\n\n componentDidLoad() {\n if (this.collapsed) void this.toggle(false);\n this.isLoaded = true;\n }\n\n /**\n * Triggers the collapse programmatically.\n *\n * If there is a collapsing transition running already, it will be reversed.\n */\n @Method()\n async toggle(open = !this.isOpen): Promise<boolean> {\n if (open === this.isOpen) return open;\n\n this.isOpen = !this.isOpen;\n if (this.isLoaded) this.collapseChange.emit();\n\n const animation = open ? expand(this.collapsible) : collapse(this.collapsible);\n\n if (!this.isLoaded || isMotionReduced()) animation.finish();\n\n await animation.finished;\n\n animation.commitStyles();\n\n return this.isOpen;\n }\n\n render() {\n const collapse = (\n <div\n aria-labelledby={this.hasHeader ? `${this.id}--header` : undefined}\n class={`collapse${this.hasHeader ? ' accordion-collapse' : ''}`}\n id={`${this.id}--collapse`}\n ref={el => (this.collapsible = el)}\n >\n {this.hasHeader ? (\n <div class=\"accordion-body\">\n <slot />\n </div>\n ) : (\n <slot />\n )}\n </div>\n );\n\n return (\n <Host id={this.id} data-version={version}>\n {this.hasHeader ? (\n <div part=\"accordion-item\" class=\"accordion-item\">\n <this.headingTag class=\"accordion-header\" id={`${this.id}--header`}>\n <button\n aria-controls={`${this.id}--collapse`}\n aria-expanded={`${this.isOpen}`}\n class={`accordion-button${this.isOpen ? '' : ' collapsed'}`}\n onClick={() => this.toggle()}\n type=\"button\"\n >\n <slot name=\"header\" />\n </button>\n </this.headingTag>\n\n {collapse}\n </div>\n ) : (\n collapse\n )}\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"post-collapsible.js","sourceRoot":"","sources":["../../../../src/components/post-collapsible/post-collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAAE,cAAc,EAAgB,MAAM,kBAAkB,CAAC;AAOhE,MAAM,OAAO,eAAe;;QAClB,aAAQ,GAAG,KAAK,CAAC;;sBAMP,IAAI;;;yBAOiB,KAAK;4BAcG,CAAC;;IAXhD,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS;QACzC,gBAAgB,CACd,QAAQ,EACR,SAAS,EACT,uEAAuE,CACxE,CAAC;IACJ,CAAC;IAQD,oBAAoB,CAAC,QAAQ,GAAG,IAAI,CAAC,YAAY;QAC/C,iBAAiB,CACf,QAAQ,EACR,cAAc,EACd,yFAAyF,CAC1F,CAAC;IACJ,CAAC;IAOD,iBAAiB;QACf,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,oBAAoB,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n h,\n Host,\n Method,\n Prop,\n State,\n Watch,\n} from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { collapse, expand } from '../../animations/collapse';\nimport { checkEmptyOrOneOf, checkEmptyOrType, isMotionReduced } from '../../utils';\nimport { HEADING_LEVELS, HeadingLevel } from './heading-levels';\n\n@Component({\n tag: 'post-collapsible',\n styleUrl: 'post-collapsible.scss',\n shadow: true,\n})\nexport class PostCollapsible {\n private isLoaded = false;\n private collapsible: HTMLElement;\n\n @Element() host: HTMLPostCollapsibleElement;\n\n @State() id: string;\n @State() isOpen = true;\n @State() hasHeader: boolean;\n @State() headingTag: string;\n\n /**\n * If `true`, the element is initially collapsed otherwise it is displayed.\n */\n @Prop() readonly collapsed?: boolean = false;\n\n @Watch('collapsed')\n validateCollapsed(newValue = this.collapsed) {\n checkEmptyOrType(\n newValue,\n 'boolean',\n 'The `collapsed` property of the `post-collapsible` must be a boolean.',\n );\n }\n\n /**\n * Defines the hierarchical level of the collapsible header within the headings structure.\n */\n @Prop() readonly headingLevel?: HeadingLevel = 2;\n\n @Watch('headingLevel')\n validateHeadingLevel(newValue = this.headingLevel) {\n checkEmptyOrOneOf(\n newValue,\n HEADING_LEVELS,\n 'The `headingLevel` property of the `post-collapsible` must be a number between 1 and 6.',\n );\n }\n\n /**\n * An event emitted when the collapse element is shown or hidden, before the transition. It has no payload.\n */\n @Event() collapseChange: EventEmitter<void>;\n\n connectedCallback() {\n this.validateCollapsed();\n this.validateHeadingLevel();\n }\n\n componentWillRender() {\n this.id = this.host.id || `c${crypto.randomUUID()}`;\n this.hasHeader = this.host.querySelectorAll('[slot=\"header\"]').length > 0;\n this.headingTag = `h${this.headingLevel ?? 2}`;\n }\n\n componentDidLoad() {\n if (this.collapsed) void this.toggle(false);\n this.isLoaded = true;\n }\n\n /**\n * Triggers the collapse programmatically.\n *\n * If there is a collapsing transition running already, it will be reversed.\n */\n @Method()\n async toggle(open = !this.isOpen): Promise<boolean> {\n if (open === this.isOpen) return open;\n\n this.isOpen = !this.isOpen;\n if (this.isLoaded) this.collapseChange.emit();\n\n const animation = open ? expand(this.collapsible) : collapse(this.collapsible);\n\n if (!this.isLoaded || isMotionReduced()) animation.finish();\n\n await animation.finished;\n\n animation.commitStyles();\n\n return this.isOpen;\n }\n\n render() {\n const collapse = (\n <div\n aria-labelledby={this.hasHeader ? `${this.id}--header` : undefined}\n class={`collapse${this.hasHeader ? ' accordion-collapse' : ''}`}\n id={`${this.id}--collapse`}\n ref={el => (this.collapsible = el)}\n >\n {this.hasHeader ? (\n <div class=\"accordion-body\">\n <slot />\n </div>\n ) : (\n <slot />\n )}\n </div>\n );\n\n return (\n <Host id={this.id} data-version={version}>\n {this.hasHeader ? (\n <div part=\"accordion-item\" class=\"accordion-item\">\n <this.headingTag class=\"accordion-header\" id={`${this.id}--header`}>\n <button\n aria-controls={`${this.id}--collapse`}\n aria-expanded={`${this.isOpen}`}\n class={`accordion-button${this.isOpen ? '' : ' collapsed'}`}\n onClick={() => this.toggle()}\n type=\"button\"\n >\n <slot name=\"header\" />\n </button>\n </this.headingTag>\n\n {collapse}\n </div>\n ) : (\n collapse\n )}\n </Host>\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- :host{display:inline-block;width:1em;vertical-align:-0.15em}svg{display:block;width:100%;height:100%;fill:currentColor;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}
1
+ :host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}