@swisspost/design-system-components 1.5.1 → 1.6.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 (294) hide show
  1. package/dist/cjs/check-non-empty-ae713942.js +13 -0
  2. package/dist/cjs/check-non-empty-ae713942.js.map +1 -0
  3. package/dist/cjs/{check-one-of-4c2e8b2e.js → check-one-of-27ad3154.js} +1 -1
  4. package/dist/cjs/check-one-of-27ad3154.js.map +1 -0
  5. package/dist/cjs/constants-238701d3.js +7 -0
  6. package/dist/cjs/constants-238701d3.js.map +1 -0
  7. package/dist/cjs/fade-35a3633a.js +12 -0
  8. package/dist/cjs/fade-35a3633a.js.map +1 -0
  9. package/dist/cjs/index-b38a23e0.js +41 -0
  10. package/dist/cjs/index-b38a23e0.js.map +1 -0
  11. package/dist/cjs/{index-12cc37c9.js → index-b619e205.js} +245 -41
  12. package/dist/cjs/index-b619e205.js.map +1 -0
  13. package/dist/cjs/index.cjs.js +26 -0
  14. package/dist/cjs/index.cjs.js.map +1 -1
  15. package/dist/cjs/loader.cjs.js +3 -12
  16. package/dist/cjs/loader.cjs.js.map +1 -1
  17. package/dist/cjs/package-7c4db872.js +7 -0
  18. package/dist/cjs/package-7c4db872.js.map +1 -0
  19. package/dist/cjs/post-accordion.cjs.entry.js +89 -0
  20. package/dist/cjs/post-accordion.cjs.entry.js.map +1 -0
  21. package/dist/cjs/post-alert-c037e6a3.js +101 -0
  22. package/dist/{post-components/p-7240ae7b.entry.js.map → cjs/post-alert-c037e6a3.js.map} +1 -1
  23. package/dist/cjs/post-alert.cjs.entry.js +9 -96
  24. package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
  25. package/dist/cjs/post-collapsible-7c9d23a2.js +93 -0
  26. package/dist/cjs/post-collapsible-7c9d23a2.js.map +1 -0
  27. package/dist/cjs/post-collapsible.cjs.entry.js +7 -119
  28. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
  29. package/dist/cjs/post-components.cjs.js +3 -6
  30. package/dist/cjs/post-components.cjs.js.map +1 -1
  31. package/dist/cjs/post-icon-f418f76a.js +105 -0
  32. package/dist/cjs/post-icon-f418f76a.js.map +1 -0
  33. package/dist/cjs/post-icon.cjs.entry.js +8 -100
  34. package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
  35. package/dist/cjs/post-tab-header-e08c2a42.js +33 -0
  36. package/dist/cjs/post-tab-header-e08c2a42.js.map +1 -0
  37. package/dist/cjs/post-tab-header.cjs.entry.js +6 -26
  38. package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -1
  39. package/dist/cjs/post-tab-panel-721f7f32.js +27 -0
  40. package/dist/cjs/post-tab-panel-721f7f32.js.map +1 -0
  41. package/dist/cjs/post-tab-panel.cjs.entry.js +4 -20
  42. package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -1
  43. package/dist/cjs/post-tabs-4bcc867b.js +153 -0
  44. package/dist/cjs/post-tabs-4bcc867b.js.map +1 -0
  45. package/dist/cjs/post-tabs.cjs.entry.js +5 -146
  46. package/dist/cjs/post-tabs.cjs.entry.js.map +1 -1
  47. package/dist/cjs/post-tooltip-261c5cda.js +5095 -0
  48. package/dist/cjs/post-tooltip-261c5cda.js.map +1 -0
  49. package/dist/cjs/post-tooltip.cjs.entry.js +5 -5088
  50. package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
  51. package/dist/collection/animations/collapse.js +13 -0
  52. package/dist/collection/animations/collapse.js.map +1 -0
  53. package/dist/collection/animations/fade.js +4 -4
  54. package/dist/collection/animations/fade.js.map +1 -1
  55. package/dist/collection/collection-manifest.json +10 -9
  56. package/dist/collection/components/post-accordion/post-accordion.css +1 -0
  57. package/dist/collection/components/post-accordion/post-accordion.js +178 -0
  58. package/dist/collection/components/post-accordion/post-accordion.js.map +1 -0
  59. package/dist/collection/components/post-alert/post-alert.css +1 -1
  60. package/dist/collection/components/post-alert/post-alert.js +9 -7
  61. package/dist/collection/components/post-alert/post-alert.js.map +1 -1
  62. package/dist/collection/components/post-collapsible/heading-levels.js +2 -0
  63. package/dist/collection/components/post-collapsible/heading-levels.js.map +1 -0
  64. package/dist/collection/components/post-collapsible/post-collapsible.css +1 -29
  65. package/dist/collection/components/post-collapsible/post-collapsible.js +65 -63
  66. package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
  67. package/dist/collection/components/post-icon/post-icon.js +5 -4
  68. package/dist/collection/components/post-icon/post-icon.js.map +1 -1
  69. package/dist/collection/components/post-tab-header/post-tab-header.css +1 -1
  70. package/dist/collection/components/post-tab-header/post-tab-header.js +5 -4
  71. package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
  72. package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -2
  73. package/dist/collection/components/post-tabs/post-tabs.js +11 -7
  74. package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
  75. package/dist/collection/components/post-tooltip/post-tooltip.js +22 -15
  76. package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
  77. package/dist/collection/index.js +8 -1
  78. package/dist/collection/index.js.map +1 -1
  79. package/dist/collection/utils/index.js +1 -3
  80. package/dist/collection/utils/index.js.map +1 -1
  81. package/dist/collection/utils/is-motion-reduced.js +4 -0
  82. package/dist/collection/utils/is-motion-reduced.js.map +1 -0
  83. package/dist/collection/utils/property-checkers/check-non-empty.js +1 -1
  84. package/dist/collection/utils/property-checkers/empty-or.js +1 -1
  85. package/dist/collection/utils/property-checkers/index.js +4 -4
  86. package/dist/components/check-non-empty.js +2 -2
  87. package/dist/components/check-non-empty.js.map +1 -1
  88. package/dist/components/check-one-of.js.map +1 -1
  89. package/dist/components/constants.js +5 -0
  90. package/dist/components/constants.js.map +1 -0
  91. package/dist/components/fade.js +4 -4
  92. package/dist/components/fade.js.map +1 -1
  93. package/dist/components/index.d.ts +6 -0
  94. package/dist/components/index.js +8 -1
  95. package/dist/components/index.js.map +1 -1
  96. package/dist/components/index2.js +36 -0
  97. package/dist/components/index2.js.map +1 -0
  98. package/dist/components/package.js +1 -1
  99. package/dist/components/post-accordion.d.ts +11 -0
  100. package/dist/components/post-accordion.js +108 -0
  101. package/dist/components/post-accordion.js.map +1 -0
  102. package/dist/components/post-alert.js +1 -128
  103. package/dist/components/post-alert.js.map +1 -1
  104. package/dist/components/post-alert2.js +138 -0
  105. package/dist/components/post-alert2.js.map +1 -0
  106. package/dist/components/post-collapsible.js +1 -146
  107. package/dist/components/post-collapsible.js.map +1 -1
  108. package/dist/components/post-collapsible2.js +117 -0
  109. package/dist/components/post-collapsible2.js.map +1 -0
  110. package/dist/components/post-icon2.js +11 -21
  111. package/dist/components/post-icon2.js.map +1 -1
  112. package/dist/components/post-tab-header.js +1 -45
  113. package/dist/components/post-tab-header.js.map +1 -1
  114. package/dist/components/post-tab-header2.js +51 -0
  115. package/dist/components/post-tab-header2.js.map +1 -0
  116. package/dist/components/post-tab-panel.js +1 -39
  117. package/dist/components/post-tab-panel.js.map +1 -1
  118. package/dist/components/post-tab-panel2.js +43 -0
  119. package/dist/components/post-tab-panel2.js.map +1 -0
  120. package/dist/components/post-tabs.js +1 -165
  121. package/dist/components/post-tabs.js.map +1 -1
  122. package/dist/components/post-tabs2.js +169 -0
  123. package/dist/components/post-tabs2.js.map +1 -0
  124. package/dist/components/post-tooltip.js +1 -5111
  125. package/dist/components/post-tooltip.js.map +1 -1
  126. package/dist/components/post-tooltip2.js +5117 -0
  127. package/dist/components/post-tooltip2.js.map +1 -0
  128. package/dist/docs.d.ts +334 -235
  129. package/dist/docs.json +458 -14
  130. package/dist/esm/check-non-empty-09c39561.js +11 -0
  131. package/dist/esm/check-non-empty-09c39561.js.map +1 -0
  132. package/dist/esm/{check-one-of-ded5e15e.js → check-one-of-74750af9.js} +1 -1
  133. package/dist/esm/check-one-of-74750af9.js.map +1 -0
  134. package/dist/esm/constants-8d548297.js +5 -0
  135. package/dist/esm/constants-8d548297.js.map +1 -0
  136. package/dist/esm/fade-7fd71785.js +9 -0
  137. package/dist/esm/fade-7fd71785.js.map +1 -0
  138. package/dist/esm/index-35921354.js +36 -0
  139. package/dist/esm/index-35921354.js.map +1 -0
  140. package/dist/esm/{index-5611074b.js → index-4eff5fc5.js} +245 -41
  141. package/dist/esm/index-4eff5fc5.js.map +1 -0
  142. package/dist/esm/index.js +14 -1
  143. package/dist/esm/index.js.map +1 -1
  144. package/dist/esm/loader.js +4 -13
  145. package/dist/esm/loader.js.map +1 -1
  146. package/dist/esm/package-3bbdb32c.js +5 -0
  147. package/dist/esm/package-3bbdb32c.js.map +1 -0
  148. package/dist/esm/post-accordion.entry.js +85 -0
  149. package/dist/esm/post-accordion.entry.js.map +1 -0
  150. package/dist/{post-components/p-7240ae7b.entry.js → esm/post-alert-5dd43c8b.js} +99 -2
  151. package/dist/esm/post-alert-5dd43c8b.js.map +1 -0
  152. package/dist/esm/post-alert.entry.js +8 -99
  153. package/dist/esm/post-alert.entry.js.map +1 -1
  154. package/dist/esm/post-collapsible-26dc2340.js +91 -0
  155. package/dist/esm/post-collapsible-26dc2340.js.map +1 -0
  156. package/dist/esm/post-collapsible.entry.js +6 -122
  157. package/dist/esm/post-collapsible.entry.js.map +1 -1
  158. package/dist/esm/post-components.js +4 -7
  159. package/dist/esm/post-components.js.map +1 -1
  160. package/dist/esm/post-icon-fb0eb8aa.js +103 -0
  161. package/dist/esm/post-icon-fb0eb8aa.js.map +1 -0
  162. package/dist/esm/post-icon.entry.js +7 -103
  163. package/dist/esm/post-icon.entry.js.map +1 -1
  164. package/dist/esm/post-tab-header-deebc551.js +31 -0
  165. package/dist/esm/post-tab-header-deebc551.js.map +1 -0
  166. package/dist/esm/post-tab-header.entry.js +5 -29
  167. package/dist/esm/post-tab-header.entry.js.map +1 -1
  168. package/dist/esm/post-tab-panel-4b820f71.js +25 -0
  169. package/dist/esm/post-tab-panel-4b820f71.js.map +1 -0
  170. package/dist/esm/post-tab-panel.entry.js +3 -23
  171. package/dist/esm/post-tab-panel.entry.js.map +1 -1
  172. package/dist/esm/post-tabs-2d8d6a33.js +151 -0
  173. package/dist/esm/post-tabs-2d8d6a33.js.map +1 -0
  174. package/dist/esm/post-tabs.entry.js +4 -149
  175. package/dist/esm/post-tabs.entry.js.map +1 -1
  176. package/dist/esm/post-tooltip-811309c5.js +5093 -0
  177. package/dist/esm/post-tooltip-811309c5.js.map +1 -0
  178. package/dist/esm/post-tooltip.entry.js +4 -5091
  179. package/dist/esm/post-tooltip.entry.js.map +1 -1
  180. package/dist/post-components/index.esm.js +1 -1
  181. package/dist/post-components/{p-8c386036.entry.js → p-01e8dfe6.js} +3 -3
  182. package/dist/post-components/p-01e8dfe6.js.map +1 -0
  183. package/dist/post-components/p-0a49c1a3.entry.js +2 -0
  184. package/dist/post-components/{p-bcc705f1.js → p-1339f8cd.js} +1 -1
  185. package/dist/post-components/p-1339f8cd.js.map +1 -0
  186. package/dist/post-components/{p-123bb6fb.entry.js → p-1a8a8ef2.js} +2 -2
  187. package/dist/post-components/p-1a8a8ef2.js.map +1 -0
  188. package/dist/post-components/p-27092ac3.entry.js +2 -0
  189. package/dist/post-components/p-27092ac3.entry.js.map +1 -0
  190. package/dist/post-components/{p-e5306504.js → p-2737eaf5.js} +1 -1
  191. package/dist/post-components/p-2737eaf5.js.map +1 -0
  192. package/dist/post-components/p-332eef46.js +2 -0
  193. package/dist/post-components/p-332eef46.js.map +1 -0
  194. package/dist/post-components/p-440193f4.js +2 -0
  195. package/dist/post-components/p-440193f4.js.map +1 -0
  196. package/dist/post-components/p-541142fd.js +2 -0
  197. package/dist/post-components/p-541142fd.js.map +1 -0
  198. package/dist/post-components/{p-0d37fe44.entry.js → p-574acdb0.js} +2 -2
  199. package/dist/post-components/p-574acdb0.js.map +1 -0
  200. package/dist/post-components/p-66460e3f.entry.js +2 -0
  201. package/dist/post-components/p-66460e3f.entry.js.map +1 -0
  202. package/dist/post-components/p-810ee105.entry.js +2 -0
  203. package/dist/post-components/p-810ee105.entry.js.map +1 -0
  204. package/dist/post-components/p-939df031.entry.js +2 -0
  205. package/dist/post-components/p-939df031.entry.js.map +1 -0
  206. package/dist/post-components/p-94b3f291.entry.js +2 -0
  207. package/dist/post-components/p-94b3f291.entry.js.map +1 -0
  208. package/dist/post-components/p-97000cb6.js +2 -0
  209. package/dist/post-components/p-97000cb6.js.map +1 -0
  210. package/dist/post-components/p-a7649277.js +3 -0
  211. package/dist/post-components/p-a7649277.js.map +1 -0
  212. package/dist/post-components/p-abd149b3.entry.js +2 -0
  213. package/dist/post-components/p-abd149b3.entry.js.map +1 -0
  214. package/dist/post-components/p-b531475e.js +2 -0
  215. package/dist/post-components/p-b531475e.js.map +1 -0
  216. package/dist/post-components/p-c6b73d6e.js +2 -0
  217. package/dist/post-components/p-c6b73d6e.js.map +1 -0
  218. package/dist/post-components/p-d4fb9f16.js +2 -0
  219. package/dist/post-components/p-d4fb9f16.js.map +1 -0
  220. package/dist/post-components/p-dfe29f7f.js +2 -0
  221. package/dist/post-components/p-dfe29f7f.js.map +1 -0
  222. package/dist/post-components/p-e9dc9039.entry.js +2 -0
  223. package/dist/post-components/p-e9dc9039.entry.js.map +1 -0
  224. package/dist/post-components/post-components.esm.js +1 -1
  225. package/dist/post-components/post-components.esm.js.map +1 -1
  226. package/dist/types/animations/collapse.d.ts +2 -0
  227. package/dist/types/components/post-accordion/post-accordion.d.ts +28 -0
  228. package/dist/types/components/post-alert/post-alert.d.ts +1 -1
  229. package/dist/types/components/post-collapsible/heading-levels.d.ts +2 -0
  230. package/dist/types/components/post-collapsible/post-collapsible.d.ts +16 -12
  231. package/dist/types/components.d.ts +79 -3
  232. package/dist/types/index.d.ts +7 -0
  233. package/dist/types/stencil-public-runtime.d.ts +38 -5
  234. package/dist/types/utils/index.d.ts +1 -3
  235. package/dist/types/utils/is-motion-reduced.d.ts +1 -0
  236. package/loader/index.d.ts +1 -1
  237. package/package.json +8 -8
  238. package/dist/cjs/check-non-empty-35b4d0b5.js +0 -14
  239. package/dist/cjs/check-non-empty-35b4d0b5.js.map +0 -1
  240. package/dist/cjs/check-one-of-4c2e8b2e.js.map +0 -1
  241. package/dist/cjs/check-type-508a21a5.js +0 -18
  242. package/dist/cjs/check-type-508a21a5.js.map +0 -1
  243. package/dist/cjs/fade-8c6d4fa7.js +0 -12
  244. package/dist/cjs/fade-8c6d4fa7.js.map +0 -1
  245. package/dist/cjs/index-12cc37c9.js.map +0 -1
  246. package/dist/cjs/index-f8f6f146.js +0 -28
  247. package/dist/cjs/index-f8f6f146.js.map +0 -1
  248. package/dist/cjs/package-112e1698.js +0 -7
  249. package/dist/cjs/package-112e1698.js.map +0 -1
  250. package/dist/collection/utils/get-element-height.js +0 -12
  251. package/dist/collection/utils/get-element-height.js.map +0 -1
  252. package/dist/collection/utils/on-transition-end.js +0 -15
  253. package/dist/collection/utils/on-transition-end.js.map +0 -1
  254. package/dist/collection/utils/should-reduce-motion.js +0 -4
  255. package/dist/collection/utils/should-reduce-motion.js.map +0 -1
  256. package/dist/components/check-type.js +0 -16
  257. package/dist/components/check-type.js.map +0 -1
  258. package/dist/esm/check-non-empty-554bdf88.js +0 -11
  259. package/dist/esm/check-non-empty-554bdf88.js.map +0 -1
  260. package/dist/esm/check-one-of-ded5e15e.js.map +0 -1
  261. package/dist/esm/check-type-18ebb4e7.js +0 -16
  262. package/dist/esm/check-type-18ebb4e7.js.map +0 -1
  263. package/dist/esm/fade-671f1489.js +0 -9
  264. package/dist/esm/fade-671f1489.js.map +0 -1
  265. package/dist/esm/index-5611074b.js.map +0 -1
  266. package/dist/esm/index-7f723686.js +0 -24
  267. package/dist/esm/index-7f723686.js.map +0 -1
  268. package/dist/esm/package-331628f1.js +0 -5
  269. package/dist/esm/package-331628f1.js.map +0 -1
  270. package/dist/esm/polyfills/css-shim.js +0 -1
  271. package/dist/post-components/p-0d37fe44.entry.js.map +0 -1
  272. package/dist/post-components/p-123bb6fb.entry.js.map +0 -1
  273. package/dist/post-components/p-15fc087f.js +0 -2
  274. package/dist/post-components/p-15fc087f.js.map +0 -1
  275. package/dist/post-components/p-65a9d1c2.entry.js +0 -2
  276. package/dist/post-components/p-65a9d1c2.entry.js.map +0 -1
  277. package/dist/post-components/p-75a7b352.js +0 -2
  278. package/dist/post-components/p-75a7b352.js.map +0 -1
  279. package/dist/post-components/p-8c386036.entry.js.map +0 -1
  280. package/dist/post-components/p-97a064da.entry.js +0 -2
  281. package/dist/post-components/p-97a064da.entry.js.map +0 -1
  282. package/dist/post-components/p-bcc705f1.js.map +0 -1
  283. package/dist/post-components/p-c8efe0ae.js +0 -2
  284. package/dist/post-components/p-c8efe0ae.js.map +0 -1
  285. package/dist/post-components/p-ccae1c68.entry.js +0 -2
  286. package/dist/post-components/p-ccae1c68.entry.js.map +0 -1
  287. package/dist/post-components/p-d94db268.js +0 -3
  288. package/dist/post-components/p-d94db268.js.map +0 -1
  289. package/dist/post-components/p-e5306504.js.map +0 -1
  290. package/dist/post-components/p-eb3ff4dc.js +0 -2
  291. package/dist/types/utils/get-element-height.d.ts +0 -3
  292. package/dist/types/utils/on-transition-end.d.ts +0 -1
  293. package/dist/types/utils/should-reduce-motion.d.ts +0 -1
  294. /package/dist/post-components/{p-eb3ff4dc.js.map → p-0a49c1a3.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"file":"post-icon.entry.cjs.js","mappings":";;;;;;;;;;;AAAA,MAAM,WAAW,GAAG,u+CAAu+C;;ACI3/C,MAAM,OAAO,GAAG,oEAAoE,CAAC;AACrF,MAAM,eAAe,GAAG;EACtB,OAAO;EACP,gBAAgB;EAChB,MAAM;EACN,cAAc;EACd,MAAM;EACN,OAAO;CACC,CAAC;AACX,MAAM,cAAc,GAAG,CAAC,GAAG,eAAe,CAAC,CAAC;MAY/B,QAAQ;;;;;qBAW6B,IAAI;gBAiBZ,IAAI;iBAUT,KAAK;iBAUL,KAAK;;kBAqBE,IAAI;iBAUL,IAAI;;EAjE7C,iBAAiB,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS;IACzC,IAAI,QAAQ,KAAK,SAAS;MACxBA,yBAAiB,CACf,QAAQ,EACR,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AE,CAAC,EAAE,EAAE,CAAC,CAAC;IAEjF,QACEG,QAACC,UAAI,oBAAeC,gBAAO,IACzBF,iBAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW,EAAC,KAAK,EAAE,SAAS,GACtE,CACD,EACP;GACH;;;;;;;;;;;;;;;;","names":["checkEmptyOrOneOf","checkEmptyOrType","checkNonEmpty","checkType","h","Host","version"],"sources":["./src/components/post-icon/post-icon.scss?tag=post-icon&encapsulation=shadow","./src/components/post-icon/post-icon.tsx"],"sourcesContent":["@use 'sass:map';\n\n$post-icon-animations: (\n 'cylon': icon-animation-cylon 0.75s ease-in-out infinite alternate,\n 'cylon-vertical': icon-animation-cylon-vertical 0.75s ease-in-out infinite alternate,\n 'spin': icon-animation-spin 2s linear infinite normal,\n 'spin-reverse': icon-animation-spin 2s linear infinite reverse,\n 'fade': icon-animation-fade 0.75s ease-in-out infinite alternate,\n 'throb': icon-animation-throb 0.75s ease-in-out infinite alternate,\n);\n\n:host {\n display: inline-block;\n width: 1em;\n vertical-align: -0.15em;\n}\n\nsvg {\n display: block;\n width: 100%;\n height: 100%;\n fill: currentColor;\n background-color: currentColor;\n -webkit-mask-position: center center;\n mask-position: center center;\n -webkit-mask-repeat: no-repeat;\n mask-repeat: no-repeat;\n -webkit-mask-size: 100%;\n mask-size: 100%;\n}\n\n// flip\n\n:host([flip-h]:not([flip-h='false'])) {\n scale: -1 1;\n}\n\n:host([flip-v]:not([flip-v='false'])) {\n scale: 1 -1;\n}\n\n:host([flip-h][flip-v]:not([flip-h='false'], [flip-v='false'])) {\n scale: -1;\n}\n\n// scale\n// done with inline styling\n\n// rotate\n// done with inline styling\n\n// animation\n\n:host([animation]) {\n transform-origin: center;\n}\n\n@each $key, $value in $post-icon-animations {\n :host([animation='#{$key}']) {\n animation: $value;\n }\n}\n\n@keyframes icon-animation-cylon {\n from {\n transform: translateX(-25%);\n }\n to {\n transform: translateX(25%);\n }\n}\n\n@keyframes icon-animation-cylon-vertical {\n from {\n transform: translateY(25%);\n }\n to {\n transform: translateY(-25%);\n }\n}\n\n@keyframes icon-animation-fade {\n from {\n opacity: 0.1;\n }\n to {\n opacity: 1;\n }\n}\n\n@keyframes icon-animation-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(359deg);\n }\n}\n\n@keyframes icon-animation-throb {\n from {\n opacity: 0.5;\n transform: scale(0.5);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n}\n","import { Component, Element, Host, h, Prop, State, Watch } from '@stencil/core';\nimport { checkNonEmpty, checkType, checkEmptyOrType, checkEmptyOrOneOf } from '../../utils';\nimport { version } from '../../../package.json';\n\nconst CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';\nconst ANIMATION_NAMES = [\n 'cylon',\n 'cylon-vertical',\n 'spin',\n 'spin-reverse',\n 'fade',\n 'throb',\n] as const;\nconst ANIMATION_KEYS = [...ANIMATION_NAMES];\n\ntype Animation = (typeof ANIMATION_NAMES)[number];\n\n/**\n * @class PostIcon - representing a stencil component\n */\n@Component({\n tag: 'post-icon',\n styleUrl: 'post-icon.scss',\n shadow: true,\n})\nexport class PostIcon {\n private path: string;\n\n @Element() host: HTMLPostIconElement;\n\n @State() svgStyles: string;\n @State() svgOutput: string;\n\n /**\n * The name of the animation.\n */\n @Prop() readonly animation?: Animation | null = null;\n\n @Watch('animation')\n validateAnimation(newValue = this.animation) {\n if (newValue !== undefined)\n checkEmptyOrOneOf(\n newValue,\n ANIMATION_KEYS,\n `The post-icon \"animation\" prop requires one of the following values: ${ANIMATION_KEYS.join(\n ', ',\n )}.`,\n );\n }\n\n /**\n * The base path, where the icons are located (must be a public url).<br/>Leave this field empty to use the default cdn url.\n */\n @Prop() readonly base?: string | null = null;\n\n @Watch('base')\n validateBase(newValue = this.base) {\n checkEmptyOrType(newValue, 'string', 'The post-icon \"base\" prop should be a string.');\n }\n\n /**\n * When set to `true`, the icon will be flipped horizontally.\n */\n @Prop() readonly flipH?: boolean = false;\n\n @Watch('flipH')\n validateFlipH(newValue = this.flipH) {\n checkEmptyOrType(newValue, 'boolean', 'The post-icon \"flipH\" prop should be a boolean.');\n }\n\n /**\n * When set to `true`, the icon will be flipped vertically.\n */\n @Prop() readonly flipV?: boolean = false;\n\n @Watch('flipV')\n validateFlipV(newValue = this.flipV) {\n checkEmptyOrType(newValue, 'boolean', 'The post-icon \"flipV\" prop should be a boolean.');\n }\n\n /**\n * The name/id of the icon (e.g. 1000, 1001, ...).\n */\n @Prop() readonly name!: string;\n\n @Watch('name')\n validateName(newValue = this.name) {\n checkNonEmpty(newValue, 'The post-icon \"name\" prop is required!.');\n checkType(newValue, 'string', 'The post-icon \"name\" prop should be a string.');\n }\n\n /**\n * The number of degree for the css rotate transformation.\n */\n @Prop() readonly rotate?: number | null = null;\n\n @Watch('rotate')\n validateRotate(newValue = this.rotate) {\n checkEmptyOrType(newValue, 'number', 'The post-icon \"rotate\" prop should be a number.');\n }\n\n /**\n * The number for the css scale transformation.\n */\n @Prop() readonly scale?: number | null = null;\n\n @Watch('scale')\n validateScale(newValue = this.scale) {\n checkEmptyOrType(newValue, 'number', 'The post-icon \"scale\" prop should be a number.');\n }\n\n componentWillLoad() {\n this.validateBase();\n this.validateName();\n this.validateFlipH();\n this.validateFlipV();\n this.validateScale();\n this.validateRotate();\n this.validateAnimation();\n }\n\n componentWillRender() {\n this.setPath();\n }\n\n private setPath() {\n // Construct icon path from different possible sources\n const metaBase =\n document.head\n .querySelector('meta[name=\"design-system-settings\"][data-post-icon-base]')\n ?.getAttribute('data-post-icon-base') ?? null;\n\n const fileBase = `${this.base ?? metaBase ?? CDN_URL}/`.replace(/\\/\\/$/, '/');\n const fileName = `${this.name}.svg#icon`;\n const filePath = `${fileBase}${fileName}`;\n\n this.path = new URL(filePath, window.location.origin).toString();\n }\n\n render() {\n // create inline styles for some properties\n const svgStyles = Object.entries({\n '-webkit-mask-image': `url('${this.path}')`,\n 'mask-image': `url('${this.path}')`,\n 'scale': this.scale && !isNaN(Number(this.scale)) ? `${this.scale}` : null,\n 'rotate': this.rotate && !isNaN(Number(this.rotate)) ? `${this.rotate}deg` : null,\n })\n .filter(([_key, value]) => value !== null)\n .reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});\n\n return (\n <Host data-version={version}>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\" style={svgStyles}>\n </svg>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"post-icon.entry.cjs.js","mappings":";;;;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-b619e205.js');
4
+ const _package = require('./package-7c4db872.js');
5
+ const checkNonEmpty = require('./check-non-empty-ae713942.js');
6
+
7
+ const postTabHeaderCss = ".tab-title[role=tab]{display:inline-block;position:relative;box-sizing:border-box;padding:1rem;transition:background-color 100ms;border-right:1px solid rgba(0,0,0,0);border-left:1px solid rgba(0,0,0,0);outline-color:currentColor;opacity:.7;color:var(--post-contrast-color);text-decoration:none}.tab-title[role=tab]:focus{background-color:unset;color:var(--post-contrast-color)}.tab-title[role=tab]:hover{opacity:1;background-color:#fff;color:var(--post-contrast-color)}.tab-title[role=tab]:focus-visible{outline:rgba(0,0,0,0);opacity:1;background-color:#fff;color:var(--post-contrast-color);box-shadow:none}.tab-title[role=tab]:focus-visible::after{content:\"\";display:block;position:absolute;top:2px;right:1px;bottom:0;left:1px;box-shadow:0 0 0 1px #fff,0 0 0 2px #333}.tab-title[role=tab].active{z-index:1;border-right-color:#ccc;border-left-color:#ccc;opacity:1;background-color:#fff;color:var(--post-contrast-color);font-weight:700}.tab-title[role=tab].active::before{content:\"\";display:block;position:absolute;top:0;right:-1px;left:-1px;height:.25rem;background-color:#fc0}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:hover{background-color:rgba(255,255,255,.2)}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:focus-visible{background-color:rgba(255,255,255,.2)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tab-title[role=tab]{opacity:1;border-left-color:Canvas;border-right-color:Canvas;color:LinkText}.tab-title[role=tab]:hover,.tab-title[role=tab]:focus,.tab-title[role=tab]:focus-within,.tab-title[role=tab]:focus-visible{outline:2px solid Highlight;outline-offset:-0.25rem}.tab-title[role=tab].active{border-left-color:ButtonText;border-right-color:ButtonText;color:Highlight}.tab-title[role=tab].active::before{background-color:Highlight}}.bg-yellow .tab-title{background-color:#fc0}.bg-yellow .tab-title.active{background-color:#fc0}.bg-yellow .nav-item{background-color:#fc0}.bg-light .tab-title{background-color:#faf9f8}.bg-light .tab-title.active{background-color:#faf9f8}.bg-light .nav-item{background-color:#faf9f8}.bg-gray .tab-title{background-color:#f4f3f1}.bg-gray .tab-title.active{background-color:#f4f3f1}.bg-gray .nav-item{background-color:#f4f3f1}.bg-dark .tab-title{background-color:#333}.bg-dark .tab-title.active{background-color:#333}.bg-dark .nav-item{background-color:#333}.bg-primary .tab-title{background-color:#333}.bg-primary .tab-title.active{background-color:#333}.bg-primary .nav-item{background-color:#333}.bg-white .tab-title{background-color:#fff}.bg-white .tab-title.active{background-color:#fff}.bg-white .nav-item{background-color:#fff}.bg-black .tab-title{background-color:#000}.bg-black .tab-title.active{background-color:#000}.bg-black .nav-item{background-color:#000}.bg-success .tab-title{background-color:#2c911c}.bg-success .tab-title.active{background-color:#2c911c}.bg-success .nav-item{background-color:#2c911c}.bg-info .tab-title{background-color:#cce4ee}.bg-info .tab-title.active{background-color:#cce4ee}.bg-info .nav-item{background-color:#cce4ee}.bg-warning .tab-title{background-color:#f49e00}.bg-warning .tab-title.active{background-color:#f49e00}.bg-warning .nav-item{background-color:#f49e00}.bg-danger .tab-title{background-color:#a51728}.bg-danger .tab-title.active{background-color:#a51728}.bg-danger .nav-item{background-color:#a51728}.bg-nightblue .tab-title{background-color:#004976}.bg-nightblue .tab-title.active{background-color:#004976}.bg-nightblue .nav-item{background-color:#004976}.bg-nightblue-bright .tab-title{background-color:#0076a8}.bg-nightblue-bright .tab-title.active{background-color:#0076a8}.bg-nightblue-bright .nav-item{background-color:#0076a8}.bg-petrol .tab-title{background-color:#006d68}.bg-petrol .tab-title.active{background-color:#006d68}.bg-petrol .nav-item{background-color:#006d68}.bg-petrol-bright .tab-title{background-color:#00968f}.bg-petrol-bright .tab-title.active{background-color:#00968f}.bg-petrol-bright .nav-item{background-color:#00968f}.bg-coral .tab-title{background-color:#9e2a2f}.bg-coral .tab-title.active{background-color:#9e2a2f}.bg-coral .nav-item{background-color:#9e2a2f}.bg-coral-bright .tab-title{background-color:#e03c31}.bg-coral-bright .tab-title.active{background-color:#e03c31}.bg-coral-bright .nav-item{background-color:#e03c31}.bg-olive .tab-title{background-color:#716135}.bg-olive .tab-title.active{background-color:#716135}.bg-olive .nav-item{background-color:#716135}.bg-olive-bright .tab-title{background-color:#aa9d2e}.bg-olive-bright .tab-title.active{background-color:#aa9d2e}.bg-olive-bright .nav-item{background-color:#aa9d2e}.bg-purple .tab-title{background-color:#80276c}.bg-purple .tab-title.active{background-color:#80276c}.bg-purple .nav-item{background-color:#80276c}.bg-purple-bright .tab-title{background-color:#c5299b}.bg-purple-bright .tab-title.active{background-color:#c5299b}.bg-purple-bright .nav-item{background-color:#c5299b}.bg-aubergine .tab-title{background-color:#523178}.bg-aubergine .tab-title.active{background-color:#523178}.bg-aubergine .nav-item{background-color:#523178}.bg-aubergine-bright .tab-title{background-color:#7566a0}.bg-aubergine-bright .tab-title.active{background-color:#7566a0}.bg-aubergine-bright .nav-item{background-color:#7566a0}[class*=bg-] .tab-title.active:focus::after{background-color:rgba(255,255,255,.2)}@supports selector(*:focus-visible){[class*=bg-] .tab-title.active:focus::after{background-color:unset}[class*=bg-] .tab-title.active:focus-visible::after{background-color:rgba(255,255,255,.2)}}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}.tab-title{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;-webkit-appearance:button;appearance:button}";
8
+
9
+ const PostTabHeader = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.tabId = undefined;
13
+ this.panel = undefined;
14
+ }
15
+ validateFor(newValue) {
16
+ checkNonEmpty.checkNonEmpty(newValue, 'The "panel" prop is required for the post-tab-header.');
17
+ }
18
+ componentWillLoad() {
19
+ this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;
20
+ }
21
+ render() {
22
+ return (index.h(index.Host, { "data-version": _package.version }, index.h("button", { "aria-selected": "false", class: "tab-title", id: this.tabId, role: "tab", tabindex: "-1", type: "button" }, index.h("slot", null))));
23
+ }
24
+ get host() { return index.getElement(this); }
25
+ static get watchers() { return {
26
+ "panel": ["validateFor"]
27
+ }; }
28
+ };
29
+ PostTabHeader.style = postTabHeaderCss;
30
+
31
+ exports.PostTabHeader = PostTabHeader;
32
+
33
+ //# sourceMappingURL=post-tab-header-e08c2a42.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tab-header-e08c2a42.js","mappings":";;;;;;AAAA,MAAM,gBAAgB,GAAG,k+LAAk+L;;MCS9+L,aAAa;;;;;;EAWxB,WAAW,CAAC,QAAyC;IACnDA,2BAAa,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;GAClF;EAED,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC3D;EAED,MAAM;IACJ,QACEC,QAACC,UAAI,oBAAeC,gBAAO,IACzBF,qCAAsB,OAAO,EAAC,KAAK,EAAC,WAAW,EAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,IACpGA,qBAAQ,CACD,CACJ,EACP;GACH;;;;;;;;;;","names":["checkNonEmpty","h","Host","version"],"sources":["src/components/post-tab-header/post-tab-header.scss?tag=post-tab-header&encapsulation=shadow","src/components/post-tab-header/post-tab-header.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tab-title';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n}\n\n.tab-title {\n @include post.reset-button;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { checkNonEmpty } from '../../utils';\n\n@Component({\n tag: 'post-tab-header',\n styleUrl: 'post-tab-header.scss',\n shadow: true,\n})\nexport class PostTabHeader {\n @Element() host: HTMLPostTabHeaderElement;\n\n @State() tabId: string;\n\n /**\n * The name of the panel controlled by the tab header.\n */\n @Prop() readonly panel: HTMLPostTabPanelElement['name'];\n\n @Watch('panel')\n validateFor(newValue: HTMLPostTabPanelElement['name']) {\n checkNonEmpty(newValue, 'The \"panel\" prop is required for the post-tab-header.');\n }\n\n componentWillLoad() {\n this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <button aria-selected=\"false\" class=\"tab-title\" id={this.tabId} role=\"tab\" tabindex=\"-1\" type=\"button\">\n <slot />\n </button>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -2,34 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-12cc37c9.js');
6
- const _package = require('./package-112e1698.js');
7
- const checkNonEmpty = require('./check-non-empty-35b4d0b5.js');
5
+ const postTabHeader = require('./post-tab-header-e08c2a42.js');
6
+ require('./index-b619e205.js');
7
+ require('./package-7c4db872.js');
8
+ require('./check-non-empty-ae713942.js');
9
+ require('./constants-238701d3.js');
8
10
 
9
- const postTabHeaderCss = ".tab-title[role=tab]{display:inline-block;position:relative;box-sizing:border-box;padding:1rem;transition:background-color 100ms;border-right:1px solid rgba(0,0,0,0);border-left:1px solid rgba(0,0,0,0);outline-color:currentColor;opacity:.7;color:var(--post-contrast-color);text-decoration:none}.tab-title[role=tab]:focus{background-color:unset;color:var(--post-contrast-color)}.tab-title[role=tab]:hover{opacity:1;background-color:#fff;color:var(--post-contrast-color)}.tab-title[role=tab]:focus-visible{outline:rgba(0,0,0,0);opacity:1;background-color:#fff;color:var(--post-contrast-color);box-shadow:none}.tab-title[role=tab]:focus-visible::after{content:\"\";display:block;position:absolute;top:2px;right:1px;bottom:0;left:1px;box-shadow:0 0 0 1px #fff,0 0 0 2px #333}.tab-title[role=tab].active{z-index:1;border-right-color:#ccc;border-left-color:#ccc;opacity:1;background-color:#fff;color:var(--post-contrast-color);font-weight:700}.tab-title[role=tab].active::before{content:\"\";display:block;position:absolute;top:0;right:-1px;left:-1px;height:.25rem;background-color:#fc0}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:hover{background-color:rgba(255,255,255,.2)}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:focus-visible{background-color:rgba(255,255,255,.2)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tab-title[role=tab]{opacity:1;border-left-color:Canvas;border-right-color:Canvas;color:LinkText}.tab-title[role=tab]:hover,.tab-title[role=tab]:focus,.tab-title[role=tab]:focus-within,.tab-title[role=tab]:focus-visible{outline:2px solid Highlight;outline-offset:-0.25rem}.tab-title[role=tab].active{border-left-color:ButtonText;border-right-color:ButtonText;color:Highlight}.tab-title[role=tab].active::before{background-color:Highlight}}.bg-yellow .tab-title{background-color:#fc0}.bg-yellow .tab-title.active{background-color:#fc0}.bg-yellow .nav-item{background-color:#fc0}.bg-light .tab-title{background-color:#faf9f8}.bg-light .tab-title.active{background-color:#faf9f8}.bg-light .nav-item{background-color:#faf9f8}.bg-gray .tab-title{background-color:#f4f3f1}.bg-gray .tab-title.active{background-color:#f4f3f1}.bg-gray .nav-item{background-color:#f4f3f1}.bg-dark .tab-title{background-color:#333}.bg-dark .tab-title.active{background-color:#333}.bg-dark .nav-item{background-color:#333}.bg-primary .tab-title{background-color:#333}.bg-primary .tab-title.active{background-color:#333}.bg-primary .nav-item{background-color:#333}.bg-white .tab-title{background-color:#fff}.bg-white .tab-title.active{background-color:#fff}.bg-white .nav-item{background-color:#fff}.bg-black .tab-title{background-color:#000}.bg-black .tab-title.active{background-color:#000}.bg-black .nav-item{background-color:#000}.bg-success .tab-title{background-color:#2c911c}.bg-success .tab-title.active{background-color:#2c911c}.bg-success .nav-item{background-color:#2c911c}.bg-info .tab-title{background-color:#cce4ee}.bg-info .tab-title.active{background-color:#cce4ee}.bg-info .nav-item{background-color:#cce4ee}.bg-warning .tab-title{background-color:#f49e00}.bg-warning .tab-title.active{background-color:#f49e00}.bg-warning .nav-item{background-color:#f49e00}.bg-danger .tab-title{background-color:#a51728}.bg-danger .tab-title.active{background-color:#a51728}.bg-danger .nav-item{background-color:#a51728}.bg-nightblue .tab-title{background-color:#004976}.bg-nightblue .tab-title.active{background-color:#004976}.bg-nightblue .nav-item{background-color:#004976}.bg-nightblue-bright .tab-title{background-color:#0076a8}.bg-nightblue-bright .tab-title.active{background-color:#0076a8}.bg-nightblue-bright .nav-item{background-color:#0076a8}.bg-petrol .tab-title{background-color:#006d68}.bg-petrol .tab-title.active{background-color:#006d68}.bg-petrol .nav-item{background-color:#006d68}.bg-petrol-bright .tab-title{background-color:#00968f}.bg-petrol-bright .tab-title.active{background-color:#00968f}.bg-petrol-bright .nav-item{background-color:#00968f}.bg-coral .tab-title{background-color:#9e2a2f}.bg-coral .tab-title.active{background-color:#9e2a2f}.bg-coral .nav-item{background-color:#9e2a2f}.bg-coral-bright .tab-title{background-color:#e03c31}.bg-coral-bright .tab-title.active{background-color:#e03c31}.bg-coral-bright .nav-item{background-color:#e03c31}.bg-olive .tab-title{background-color:#716135}.bg-olive .tab-title.active{background-color:#716135}.bg-olive .nav-item{background-color:#716135}.bg-olive-bright .tab-title{background-color:#aa9d2e}.bg-olive-bright .tab-title.active{background-color:#aa9d2e}.bg-olive-bright .nav-item{background-color:#aa9d2e}.bg-purple .tab-title{background-color:#80276c}.bg-purple .tab-title.active{background-color:#80276c}.bg-purple .nav-item{background-color:#80276c}.bg-purple-bright .tab-title{background-color:#c5299b}.bg-purple-bright .tab-title.active{background-color:#c5299b}.bg-purple-bright .nav-item{background-color:#c5299b}.bg-aubergine .tab-title{background-color:#523178}.bg-aubergine .tab-title.active{background-color:#523178}.bg-aubergine .nav-item{background-color:#523178}.bg-aubergine-bright .tab-title{background-color:#7566a0}.bg-aubergine-bright .tab-title.active{background-color:#7566a0}.bg-aubergine-bright .nav-item{background-color:#7566a0}[class*=bg-] .tab-title.active:focus::after{background-color:rgba(255,255,255,.2)}@supports selector(*:focus-visible){[class*=bg-] .tab-title.active:focus::after{background-color:unset}[class*=bg-] .tab-title.active:focus-visible::after{background-color:rgba(255,255,255,.2)}}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}.tab-title{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;user-select:none;appearance:button}";
10
11
 
11
- const PostTabHeader = class {
12
- constructor(hostRef) {
13
- index.registerInstance(this, hostRef);
14
- this.tabId = undefined;
15
- this.panel = undefined;
16
- }
17
- validateFor(newValue) {
18
- checkNonEmpty.checkNonEmpty(newValue, 'The "panel" prop is required for the post-tab-header.');
19
- }
20
- componentWillLoad() {
21
- this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;
22
- }
23
- render() {
24
- return (index.h(index.Host, { "data-version": _package.version }, index.h("button", { "aria-selected": "false", class: "tab-title", id: this.tabId, role: "tab", tabindex: "-1", type: "button" }, index.h("slot", null))));
25
- }
26
- get host() { return index.getElement(this); }
27
- static get watchers() { return {
28
- "panel": ["validateFor"]
29
- }; }
30
- };
31
- PostTabHeader.style = postTabHeaderCss;
32
12
 
33
- exports.post_tab_header = PostTabHeader;
13
+ exports.post_tab_header = postTabHeader.PostTabHeader;
34
14
 
35
15
  //# sourceMappingURL=post-tab-header.cjs.entry.js.map
@@ -1 +1 @@
1
- {"file":"post-tab-header.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,gBAAgB,GAAG,+6LAA+6L;;MCS37L,aAAa;;;;;;EAWxB,WAAW,CAAC,QAAyC;IACnDA,2BAAa,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;GAClF;EAED,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC3D;EAED,MAAM;IACJ,QACEC,QAACC,UAAI,oBAAeC,gBAAO,IACzBF,qCAAsB,OAAO,EAAC,KAAK,EAAC,WAAW,EAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAC,QAAQ,IACpGA,qBAAQ,CACD,CACJ,EACP;GACH;;;;;;;;;;","names":["checkNonEmpty","h","Host","version"],"sources":["./src/components/post-tab-header/post-tab-header.scss?tag=post-tab-header&encapsulation=shadow","./src/components/post-tab-header/post-tab-header.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tab-title';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n}\n\n.tab-title {\n @include post.reset-button;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { checkNonEmpty } from '../../utils';\n\n@Component({\n tag: 'post-tab-header',\n styleUrl: 'post-tab-header.scss',\n shadow: true,\n})\nexport class PostTabHeader {\n @Element() host: HTMLPostTabHeaderElement;\n\n @State() tabId: string;\n\n /**\n * The name of the panel controlled by the tab header.\n */\n @Prop() readonly panel: HTMLPostTabPanelElement['name'];\n\n @Watch('panel')\n validateFor(newValue: HTMLPostTabPanelElement['name']) {\n checkNonEmpty(newValue, 'The \"panel\" prop is required for the post-tab-header.');\n }\n\n componentWillLoad() {\n this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <button aria-selected=\"false\" class=\"tab-title\" id={this.tabId} role=\"tab\" tabindex=\"-1\" type=\"button\">\n <slot />\n </button>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"post-tab-header.entry.cjs.js","mappings":";;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-b619e205.js');
4
+ const _package = require('./package-7c4db872.js');
5
+
6
+ const postTabPanelCss = ":host{display:none}";
7
+
8
+ const PostTabPanel = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ this.panelId = undefined;
12
+ this.name = undefined;
13
+ }
14
+ componentWillLoad() {
15
+ // get the id set on the host element or use a random id by default
16
+ this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;
17
+ }
18
+ render() {
19
+ return (index.h(index.Host, { "data-version": _package.version }, index.h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, index.h("slot", null))));
20
+ }
21
+ get host() { return index.getElement(this); }
22
+ };
23
+ PostTabPanel.style = postTabPanelCss;
24
+
25
+ exports.PostTabPanel = PostTabPanel;
26
+
27
+ //# sourceMappingURL=post-tab-panel-721f7f32.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tab-panel-721f7f32.js","mappings":";;;;;AAAA,MAAM,eAAe,GAAG,qBAAqB;;MCQhC,YAAY;;;;;;EAUvB,iBAAiB;;IAEf,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC/D;EAED,MAAM;IACJ,QACEA,QAACC,UAAI,oBAAeC,gBAAO,IACzBF,iBACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU,IAEfA,qBAAO,CACH,CACD,EACP;GACH;;;;;;;","names":["h","Host","version"],"sources":["src/components/post-tab-panel/post-tab-panel.scss?tag=post-tab-panel&encapsulation=shadow","src/components/post-tab-panel/post-tab-panel.tsx"],"sourcesContent":[":host {\n display: none;\n}\n","import { Component, Element, h, Host, Prop, State } from '@stencil/core';\nimport { version } from '../../../package.json';\n\n@Component({\n tag: 'post-tab-panel',\n styleUrl: 'post-tab-panel.scss',\n shadow: true,\n})\nexport class PostTabPanel {\n @Element() host: HTMLPostTabPanelElement;\n\n @State() panelId: string;\n\n /**\n * The name of the panel, used to associate it with a tab header.\n */\n @Prop() readonly name: string;\n\n componentWillLoad() {\n // get the id set on the host element or use a random id by default\n this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div\n class=\"tab-pane\"\n id={this.panelId}\n role=\"tabpanel\"\n >\n <slot/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -2,28 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-12cc37c9.js');
6
- const _package = require('./package-112e1698.js');
5
+ const postTabPanel = require('./post-tab-panel-721f7f32.js');
6
+ require('./index-b619e205.js');
7
+ require('./package-7c4db872.js');
7
8
 
8
- const postTabPanelCss = ":host{display:none}";
9
9
 
10
- const PostTabPanel = class {
11
- constructor(hostRef) {
12
- index.registerInstance(this, hostRef);
13
- this.panelId = undefined;
14
- this.name = undefined;
15
- }
16
- componentWillLoad() {
17
- // get the id set on the host element or use a random id by default
18
- this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;
19
- }
20
- render() {
21
- return (index.h(index.Host, { "data-version": _package.version }, index.h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, index.h("slot", null))));
22
- }
23
- get host() { return index.getElement(this); }
24
- };
25
- PostTabPanel.style = postTabPanelCss;
26
10
 
27
- exports.post_tab_panel = PostTabPanel;
11
+ exports.post_tab_panel = postTabPanel.PostTabPanel;
28
12
 
29
13
  //# sourceMappingURL=post-tab-panel.cjs.entry.js.map
@@ -1 +1 @@
1
- {"file":"post-tab-panel.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,qBAAqB;;MCQhC,YAAY;;;;;;EAUvB,iBAAiB;;IAEf,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC/D;EAED,MAAM;IACJ,QACEA,QAACC,UAAI,oBAAeC,gBAAO,IACzBF,iBACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU,IAEfA,qBAAO,CACH,CACD,EACP;GACH;;;;;;;","names":["h","Host","version"],"sources":["./src/components/post-tab-panel/post-tab-panel.scss?tag=post-tab-panel&encapsulation=shadow","./src/components/post-tab-panel/post-tab-panel.tsx"],"sourcesContent":[":host {\n display: none;\n}\n","import { Component, Element, h, Host, Prop, State } from '@stencil/core';\nimport { version } from '../../../package.json';\n\n@Component({\n tag: 'post-tab-panel',\n styleUrl: 'post-tab-panel.scss',\n shadow: true,\n})\nexport class PostTabPanel {\n @Element() host: HTMLPostTabPanelElement;\n\n @State() panelId: string;\n\n /**\n * The name of the panel, used to associate it with a tab header.\n */\n @Prop() readonly name: string;\n\n componentWillLoad() {\n // get the id set on the host element or use a random id by default\n this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div\n class=\"tab-pane\"\n id={this.panelId}\n role=\"tabpanel\"\n >\n <slot/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"post-tab-panel.entry.cjs.js","mappings":";;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
@@ -0,0 +1,153 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-b619e205.js');
4
+ const _package = require('./package-7c4db872.js');
5
+ const fade = require('./fade-35a3633a.js');
6
+
7
+ const postTabsCss = ".tabs-wrapper{position:relative;padding-top:1rem;border:0;background-color:#faf9f8}.tabs-wrapper::after{content:\"\";position:absolute;bottom:0;width:100%;height:1px;background-color:#ccc}.tabs-wrapper .tabs{background-color:rgba(0,0,0,0) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tabs-wrapper::after{background-color:ButtonBorder}}.tabs{margin:0;padding:0;list-style:none;display:flex;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;white-space:nowrap}.tabs::after{content:\"\";display:block;flex:1 0 auto;width:1rem}.tab-content{padding-top:1rem;padding-bottom:1rem}.bg-yellow .tabs-wrapper{background-color:#fc0}.bg-light .tabs-wrapper{background-color:#faf9f8}.bg-gray .tabs-wrapper{background-color:#f4f3f1}.bg-dark .tabs-wrapper{background-color:#333}.bg-primary .tabs-wrapper{background-color:#333}.bg-white .tabs-wrapper{background-color:#fff}.bg-black .tabs-wrapper{background-color:#000}.bg-success .tabs-wrapper{background-color:#2c911c}.bg-info .tabs-wrapper{background-color:#cce4ee}.bg-warning .tabs-wrapper{background-color:#f49e00}.bg-danger .tabs-wrapper{background-color:#a51728}.bg-nightblue .tabs-wrapper{background-color:#004976}.bg-nightblue-bright .tabs-wrapper{background-color:#0076a8}.bg-petrol .tabs-wrapper{background-color:#006d68}.bg-petrol-bright .tabs-wrapper{background-color:#00968f}.bg-coral .tabs-wrapper{background-color:#9e2a2f}.bg-coral-bright .tabs-wrapper{background-color:#e03c31}.bg-olive .tabs-wrapper{background-color:#716135}.bg-olive-bright .tabs-wrapper{background-color:#aa9d2e}.bg-purple .tabs-wrapper{background-color:#80276c}.bg-purple-bright .tabs-wrapper{background-color:#c5299b}.bg-aubergine .tabs-wrapper{background-color:#523178}.bg-aubergine-bright .tabs-wrapper{background-color:#7566a0}:host{display:block}";
8
+
9
+ const PostTabs = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.tabChange = index.createEvent(this, "tabChange", 7);
13
+ this.isLoaded = false;
14
+ this.activePanel = undefined;
15
+ }
16
+ get tabs() {
17
+ return this.host.querySelectorAll('post-tab-header');
18
+ }
19
+ componentDidLoad() {
20
+ this.moveMisplacedTabs();
21
+ this.enableTabs();
22
+ const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;
23
+ void this.show(initiallyActivePanel);
24
+ this.isLoaded = true;
25
+ }
26
+ /**
27
+ * Shows the panel with the given name and selects its associated tab.
28
+ * Any other panel that was previously shown becomes hidden and its associated tab is unselected.
29
+ */
30
+ async show(panelName) {
31
+ var _a;
32
+ // do nothing if the tab is already active
33
+ if (panelName === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)) {
34
+ return;
35
+ }
36
+ const previousTab = this.activeTab;
37
+ const newTab = this.host.querySelector(`post-tab-header[panel=${panelName}]`);
38
+ this.activateTab(newTab);
39
+ // if a panel is currently being displayed, remove it from the view and complete the associated animation
40
+ if (this.showing) {
41
+ this.showing.effect['target'].style.display = 'none';
42
+ this.showing.finish();
43
+ }
44
+ // hide the currently visible panel only if no other animation is running
45
+ if (previousTab && !this.showing && !this.hiding) {
46
+ this.hidePanel(previousTab.panel);
47
+ }
48
+ // wait for any hiding animation to complete before showing the selected tab
49
+ if (this.hiding) {
50
+ await this.hiding.finished;
51
+ }
52
+ this.showSelectedPanel();
53
+ // wait for any display animation to complete for the returned promise to fully resolve
54
+ if (this.showing) {
55
+ await this.showing.finished;
56
+ }
57
+ this.tabChange.emit(this.activeTab.panel);
58
+ }
59
+ moveMisplacedTabs() {
60
+ if (!this.tabs)
61
+ return;
62
+ this.tabs.forEach(tab => {
63
+ if (tab.getAttribute('slot') === 'tabs')
64
+ return;
65
+ tab.setAttribute('slot', 'tabs');
66
+ });
67
+ }
68
+ enableTabs() {
69
+ if (!this.tabs)
70
+ return;
71
+ this.tabs.forEach(async (tab) => {
72
+ await tab.componentOnReady();
73
+ const tabTitle = tab.shadowRoot.querySelector('.tab-title');
74
+ // if the tab has an "aria-controls" attribute it was already linked to its panel: do nothing
75
+ if (tabTitle.getAttribute('aria-controls'))
76
+ return;
77
+ const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');
78
+ tabTitle.setAttribute('aria-controls', tabPanel.id);
79
+ tabPanel.setAttribute('aria-labelledby', tabTitle.id);
80
+ tab.addEventListener('click', () => {
81
+ void this.show(tab.panel);
82
+ });
83
+ tab.addEventListener('keydown', ({ key }) => {
84
+ if (key === 'ArrowRight' || key === 'ArrowLeft')
85
+ this.navigateTabs(tab, key);
86
+ });
87
+ });
88
+ // if the currently active tab was removed from the DOM then select the first one
89
+ if (this.activeTab && !this.activeTab.isConnected) {
90
+ void this.show(this.tabs.item(0).panel);
91
+ }
92
+ }
93
+ activateTab(tab) {
94
+ if (this.activeTab) {
95
+ const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');
96
+ tabTitle.setAttribute('aria-selected', 'false');
97
+ tabTitle.setAttribute('tabindex', '-1');
98
+ tabTitle.classList.remove('active');
99
+ }
100
+ const tabTitle = tab.shadowRoot.querySelector('.tab-title');
101
+ tabTitle.setAttribute('aria-selected', 'true');
102
+ tabTitle.removeAttribute('tabindex');
103
+ tabTitle.classList.add('active');
104
+ this.activeTab = tab;
105
+ }
106
+ hidePanel(panelName) {
107
+ const previousPanel = this.getPanel(panelName);
108
+ if (!previousPanel)
109
+ return;
110
+ this.hiding = fade.fadeOut(previousPanel);
111
+ this.hiding.onfinish = () => {
112
+ previousPanel.style.display = 'none';
113
+ this.hiding = null;
114
+ };
115
+ }
116
+ showSelectedPanel() {
117
+ const panel = this.getPanel(this.activeTab.panel);
118
+ panel.style.display = 'block';
119
+ // prevent the initially selected panel from fading in
120
+ if (!this.isLoaded)
121
+ return;
122
+ this.showing = fade.fadeIn(panel);
123
+ this.showing.onfinish = () => {
124
+ this.showing = null;
125
+ };
126
+ }
127
+ getPanel(name) {
128
+ return this.host.querySelector(`post-tab-panel[name=${name}]`);
129
+ }
130
+ navigateTabs(tab, key) {
131
+ const activeTabIndex = Array.from(this.tabs).indexOf(tab);
132
+ let nextTab;
133
+ if (key === 'ArrowRight') {
134
+ nextTab = this.tabs[activeTabIndex + 1] || this.tabs[0];
135
+ }
136
+ else {
137
+ nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];
138
+ }
139
+ if (!nextTab)
140
+ return;
141
+ const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title');
142
+ nextTabTitle.focus();
143
+ }
144
+ render() {
145
+ return (index.h(index.Host, { "data-version": _package.version }, index.h("div", { class: "tabs-wrapper" }, index.h("div", { class: "tabs", role: "tablist" }, index.h("slot", { name: "tabs", onSlotchange: () => this.enableTabs() }))), index.h("div", { class: "tab-content" }, index.h("slot", { onSlotchange: () => this.moveMisplacedTabs() }))));
146
+ }
147
+ get host() { return index.getElement(this); }
148
+ };
149
+ PostTabs.style = postTabsCss;
150
+
151
+ exports.PostTabs = PostTabs;
152
+
153
+ //# sourceMappingURL=post-tabs-4bcc867b.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tabs-4bcc867b.js","mappings":";;;;;;AAAA,MAAM,WAAW,GAAG,yzDAAyzD;;MCSh0D,QAAQ;;;;IAIX,aAAQ,GAAG,KAAK,CAAC;;;EAEzB,IAAY,IAAI;IACd,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,iB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Ac,IACvBA,iBAAK,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,IAC9BA,kBAAM,IAAI,EAAC,MAAM,EAAC,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,GAAI,CACvD,CACF,EACNA,iBAAK,KAAK,EAAC,aAAa,IACtBA,kBAAM,YAAY,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAI,CAClD,CACD,EACP;GACH;;;;;;;","names":["fadeOut","fadeIn","h","Host","version"],"sources":["src/components/post-tabs/post-tabs.scss?tag=post-tabs&encapsulation=shadow","src/components/post-tabs/post-tabs.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tabs-wrapper';\n\n:host {\n display: block;\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeIn, fadeOut } from '../../animations';\n\n@Component({\n tag: 'post-tabs',\n styleUrl: 'post-tabs.scss',\n shadow: true,\n})\nexport class PostTabs {\n private activeTab: HTMLPostTabHeaderElement;\n private showing: Animation;\n private hiding: Animation;\n private isLoaded = false;\n\n private get tabs(): NodeListOf<HTMLPostTabHeaderElement> {\n return this.host.querySelectorAll('post-tab-header');\n }\n\n @Element() host: HTMLPostTabsElement;\n\n /**\n * The name of the panel that is initially shown.\n * If not specified, it defaults to the panel associated with the first tab.\n *\n * **Changing this value after initialization has no effect.**\n */\n @Prop() readonly activePanel: HTMLPostTabPanelElement['name'];\n\n /**\n * An event emitted after the active tab changes, when the fade in transition of its associated panel is finished.\n * The payload is the name of the newly shown panel.\n */\n @Event() tabChange: EventEmitter<HTMLPostTabPanelElement['name']>;\n\n componentDidLoad() {\n this.moveMisplacedTabs();\n this.enableTabs();\n\n const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;\n void this.show(initiallyActivePanel);\n\n this.isLoaded = true;\n }\n\n /**\n * Shows the panel with the given name and selects its associated tab.\n * Any other panel that was previously shown becomes hidden and its associated tab is unselected.\n */\n @Method()\n async show(panelName: string) {\n // do nothing if the tab is already active\n if (panelName === this.activeTab?.panel) {\n return;\n }\n\n const previousTab = this.activeTab;\n const newTab: HTMLPostTabHeaderElement = this.host.querySelector(\n `post-tab-header[panel=${panelName}]`,\n );\n this.activateTab(newTab);\n\n // if a panel is currently being displayed, remove it from the view and complete the associated animation\n if (this.showing) {\n this.showing.effect['target'].style.display = 'none';\n this.showing.finish();\n }\n\n // hide the currently visible panel only if no other animation is running\n if (previousTab && !this.showing && !this.hiding) {\n this.hidePanel(previousTab.panel);\n }\n\n // wait for any hiding animation to complete before showing the selected tab\n if (this.hiding) {\n await this.hiding.finished;\n }\n\n this.showSelectedPanel();\n\n // wait for any display animation to complete for the returned promise to fully resolve\n if (this.showing) {\n await this.showing.finished;\n }\n\n this.tabChange.emit(this.activeTab.panel);\n }\n\n private moveMisplacedTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(tab => {\n if (tab.getAttribute('slot') === 'tabs') return;\n tab.setAttribute('slot', 'tabs');\n });\n }\n\n private enableTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(async tab => {\n await tab.componentOnReady();\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n\n // if the tab has an \"aria-controls\" attribute it was already linked to its panel: do nothing\n if (tabTitle.getAttribute('aria-controls')) return;\n\n const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');\n tabTitle.setAttribute('aria-controls', tabPanel.id);\n tabPanel.setAttribute('aria-labelledby', tabTitle.id);\n\n tab.addEventListener('click', () => {\n void this.show(tab.panel);\n });\n\n tab.addEventListener('keydown', ({ key }) => {\n if (key === 'ArrowRight' || key === 'ArrowLeft') this.navigateTabs(tab, key);\n });\n });\n\n // if the currently active tab was removed from the DOM then select the first one\n if (this.activeTab && !this.activeTab.isConnected) {\n void this.show(this.tabs.item(0).panel);\n }\n }\n\n private activateTab(tab: HTMLPostTabHeaderElement) {\n if (this.activeTab) {\n const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'false');\n tabTitle.setAttribute('tabindex', '-1');\n tabTitle.classList.remove('active');\n }\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'true');\n tabTitle.removeAttribute('tabindex');\n tabTitle.classList.add('active');\n\n this.activeTab = tab;\n }\n\n private hidePanel(panelName: HTMLPostTabPanelElement['name']) {\n const previousPanel = this.getPanel(panelName);\n\n if (!previousPanel) return;\n\n this.hiding = fadeOut(previousPanel);\n this.hiding.onfinish = () => {\n previousPanel.style.display = 'none';\n this.hiding = null;\n };\n }\n\n private showSelectedPanel() {\n const panel = this.getPanel(this.activeTab.panel);\n panel.style.display = 'block';\n\n // prevent the initially selected panel from fading in\n if (!this.isLoaded) return;\n\n this.showing = fadeIn(panel);\n this.showing.onfinish = () => {\n this.showing = null;\n };\n }\n\n private getPanel(name: string): HTMLPostTabPanelElement {\n return this.host.querySelector(`post-tab-panel[name=${name}]`);\n }\n\n private navigateTabs(tab: HTMLPostTabHeaderElement, key: 'ArrowRight' | 'ArrowLeft') {\n const activeTabIndex = Array.from(this.tabs).indexOf(tab);\n\n let nextTab: HTMLPostTabHeaderElement;\n if (key === 'ArrowRight') {\n nextTab = this.tabs[activeTabIndex + 1] || this.tabs[0];\n } else {\n nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];\n }\n\n if (!nextTab) return;\n\n const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title') as HTMLAnchorElement;\n nextTabTitle.focus();\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div class=\"tabs-wrapper\">\n <div class=\"tabs\" role=\"tablist\">\n <slot name=\"tabs\" onSlotchange={() => this.enableTabs()} />\n </div>\n </div>\n <div class=\"tab-content\">\n <slot onSlotchange={() => this.moveMisplacedTabs()} />\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -2,154 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-12cc37c9.js');
6
- const _package = require('./package-112e1698.js');
7
- const fade = require('./fade-8c6d4fa7.js');
5
+ const postTabs = require('./post-tabs-4bcc867b.js');
6
+ require('./index-b619e205.js');
7
+ require('./package-7c4db872.js');
8
+ require('./fade-35a3633a.js');
8
9
 
9
- const postTabsCss = ".tabs-wrapper{position:relative;padding-top:1rem;border:0;background-color:#faf9f8}.tabs-wrapper::after{content:\"\";position:absolute;bottom:0;width:100%;height:1px;background-color:#ccc}.tabs-wrapper .tabs{background-color:rgba(0,0,0,0) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tabs-wrapper::after{background-color:ButtonBorder}}.tabs{margin:0;padding:0;list-style:none;display:flex;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;white-space:nowrap}.tabs::after{content:\"\";display:block;flex:1 0 auto;width:1rem}.tab-content{padding-top:1rem;padding-bottom:1rem}.bg-yellow .tabs-wrapper{background-color:#fc0}.bg-light .tabs-wrapper{background-color:#faf9f8}.bg-gray .tabs-wrapper{background-color:#f4f3f1}.bg-dark .tabs-wrapper{background-color:#333}.bg-primary .tabs-wrapper{background-color:#333}.bg-white .tabs-wrapper{background-color:#fff}.bg-black .tabs-wrapper{background-color:#000}.bg-success .tabs-wrapper{background-color:#2c911c}.bg-info .tabs-wrapper{background-color:#cce4ee}.bg-warning .tabs-wrapper{background-color:#f49e00}.bg-danger .tabs-wrapper{background-color:#a51728}.bg-nightblue .tabs-wrapper{background-color:#004976}.bg-nightblue-bright .tabs-wrapper{background-color:#0076a8}.bg-petrol .tabs-wrapper{background-color:#006d68}.bg-petrol-bright .tabs-wrapper{background-color:#00968f}.bg-coral .tabs-wrapper{background-color:#9e2a2f}.bg-coral-bright .tabs-wrapper{background-color:#e03c31}.bg-olive .tabs-wrapper{background-color:#716135}.bg-olive-bright .tabs-wrapper{background-color:#aa9d2e}.bg-purple .tabs-wrapper{background-color:#80276c}.bg-purple-bright .tabs-wrapper{background-color:#c5299b}.bg-aubergine .tabs-wrapper{background-color:#523178}.bg-aubergine-bright .tabs-wrapper{background-color:#7566a0}:host{display:block}";
10
10
 
11
- const PostTabs = class {
12
- constructor(hostRef) {
13
- index.registerInstance(this, hostRef);
14
- this.tabChange = index.createEvent(this, "tabChange", 7);
15
- this.isLoaded = false;
16
- this.activePanel = undefined;
17
- }
18
- get tabs() {
19
- return this.host.querySelectorAll('post-tab-header');
20
- }
21
- componentDidLoad() {
22
- this.moveMisplacedTabs();
23
- this.enableTabs();
24
- const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;
25
- void this.show(initiallyActivePanel);
26
- this.isLoaded = true;
27
- }
28
- /**
29
- * Shows the panel with the given name and selects its associated tab.
30
- * Any other panel that was previously shown becomes hidden and its associated tab is unselected.
31
- */
32
- async show(panelName) {
33
- var _a;
34
- // do nothing if the tab is already active
35
- if (panelName === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)) {
36
- return;
37
- }
38
- const previousTab = this.activeTab;
39
- const newTab = this.host.querySelector(`post-tab-header[panel=${panelName}]`);
40
- this.activateTab(newTab);
41
- // if a panel is currently being displayed, remove it from the view and complete the associated animation
42
- if (this.showing) {
43
- this.showing.effect['target'].style.display = 'none';
44
- this.showing.finish();
45
- }
46
- // hide the currently visible panel only if no other animation is running
47
- if (previousTab && !this.showing && !this.hiding) {
48
- this.hidePanel(previousTab.panel);
49
- }
50
- // wait for any hiding animation to complete before showing the selected tab
51
- if (this.hiding) {
52
- await this.hiding.finished;
53
- }
54
- this.showSelectedPanel();
55
- // wait for any display animation to complete for the returned promise to fully resolve
56
- if (this.showing) {
57
- await this.showing.finished;
58
- }
59
- this.tabChange.emit(this.activeTab.panel);
60
- }
61
- moveMisplacedTabs() {
62
- if (!this.tabs)
63
- return;
64
- this.tabs.forEach(tab => {
65
- if (tab.getAttribute('slot') === 'tabs')
66
- return;
67
- tab.setAttribute('slot', 'tabs');
68
- });
69
- }
70
- enableTabs() {
71
- if (!this.tabs)
72
- return;
73
- this.tabs.forEach(async (tab) => {
74
- await tab.componentOnReady();
75
- const tabTitle = tab.shadowRoot.querySelector('.tab-title');
76
- // if the tab has an "aria-controls" attribute it was already linked to its panel: do nothing
77
- if (tabTitle.getAttribute('aria-controls'))
78
- return;
79
- const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');
80
- tabTitle.setAttribute('aria-controls', tabPanel.id);
81
- tabPanel.setAttribute('aria-labelledby', tabTitle.id);
82
- tab.addEventListener('click', () => {
83
- void this.show(tab.panel);
84
- });
85
- tab.addEventListener('keydown', ({ key }) => {
86
- if (key === 'ArrowRight' || key === 'ArrowLeft')
87
- this.navigateTabs(tab, key);
88
- });
89
- });
90
- // if the currently active tab was removed from the DOM then select the first one
91
- if (this.activeTab && !this.activeTab.isConnected) {
92
- void this.show(this.tabs.item(0).panel);
93
- }
94
- }
95
- activateTab(tab) {
96
- if (this.activeTab) {
97
- const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');
98
- tabTitle.setAttribute('aria-selected', 'false');
99
- tabTitle.setAttribute('tabindex', '-1');
100
- tabTitle.classList.remove('active');
101
- }
102
- const tabTitle = tab.shadowRoot.querySelector('.tab-title');
103
- tabTitle.setAttribute('aria-selected', 'true');
104
- tabTitle.removeAttribute('tabindex');
105
- tabTitle.classList.add('active');
106
- this.activeTab = tab;
107
- }
108
- hidePanel(panelName) {
109
- const previousPanel = this.getPanel(panelName);
110
- if (!previousPanel)
111
- return;
112
- this.hiding = fade.fadeOut(previousPanel);
113
- this.hiding.onfinish = () => {
114
- previousPanel.style.display = 'none';
115
- this.hiding = null;
116
- };
117
- }
118
- showSelectedPanel() {
119
- const panel = this.getPanel(this.activeTab.panel);
120
- panel.style.display = 'block';
121
- // prevent the initially selected panel from fading in
122
- if (!this.isLoaded)
123
- return;
124
- this.showing = fade.fadeIn(panel);
125
- this.showing.onfinish = () => {
126
- this.showing = null;
127
- };
128
- }
129
- getPanel(name) {
130
- return this.host.querySelector(`post-tab-panel[name=${name}]`);
131
- }
132
- navigateTabs(tab, key) {
133
- const activeTabIndex = Array.from(this.tabs).indexOf(tab);
134
- let nextTab;
135
- if (key === 'ArrowRight') {
136
- nextTab = this.tabs[activeTabIndex + 1] || this.tabs[0];
137
- }
138
- else {
139
- nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];
140
- }
141
- if (!nextTab)
142
- return;
143
- const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title');
144
- nextTabTitle.focus();
145
- }
146
- render() {
147
- return (index.h(index.Host, { "data-version": _package.version }, index.h("div", { class: "tabs-wrapper" }, index.h("div", { class: "tabs", role: "tablist" }, index.h("slot", { name: "tabs", onSlotchange: () => this.enableTabs() }))), index.h("div", { class: "tab-content" }, index.h("slot", { onSlotchange: () => this.moveMisplacedTabs() }))));
148
- }
149
- get host() { return index.getElement(this); }
150
- };
151
- PostTabs.style = postTabsCss;
152
11
 
153
- exports.post_tabs = PostTabs;
12
+ exports.post_tabs = postTabs.PostTabs;
154
13
 
155
14
  //# sourceMappingURL=post-tabs.cjs.entry.js.map
@@ -1 +1 @@
1
- {"file":"post-tabs.entry.cjs.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,yzDAAyzD;;MCSh0D,QAAQ;;;;IAIX,aAAQ,GAAG,KAAK,CAAC;;;EAEzB,IAAY,IAAI;IACd,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;GACtD;EAkBD,gBAAgB;IACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACzB,IAAI,CAAC,UAAU,EAAE,CAAC;IAElB,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACzE,KAAK,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAErC,IAAI,CAAC,QAA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version"],"sources":["./src/components/post-tabs/post-tabs.scss?tag=post-tabs&encapsulation=shadow","./src/components/post-tabs/post-tabs.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tabs-wrapper';\n\n:host {\n display: block;\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeIn, fadeOut } from '../../animations';\n\n@Component({\n tag: 'post-tabs',\n styleUrl: 'post-tabs.scss',\n shadow: true,\n})\nexport class PostTabs {\n private activeTab: HTMLPostTabHeaderElement;\n private showing: Animation;\n private hiding: Animation;\n private isLoaded = false;\n\n private get tabs(): NodeListOf<HTMLPostTabHeaderElement> {\n return this.host.querySelectorAll('post-tab-header');\n }\n\n @Element() host: HTMLPostTabsElement;\n\n /**\n * The name of the panel that is initially shown.\n * If not specified, it defaults to the panel associated with the first tab.\n *\n * **Changing this value after initialization has no effect.**\n */\n @Prop() readonly activePanel: HTMLPostTabPanelElement['name'];\n\n /**\n * An event emitted after the active tab changes, when the fade in transition of its associated panel is finished.\n * The payload is the name of the newly shown panel.\n */\n @Event() tabChange: EventEmitter<HTMLPostTabPanelElement['name']>;\n\n componentDidLoad() {\n this.moveMisplacedTabs();\n this.enableTabs();\n\n const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;\n void this.show(initiallyActivePanel);\n\n this.isLoaded = true;\n }\n\n /**\n * Shows the panel with the given name and selects its associated tab.\n * Any other panel that was previously shown becomes hidden and its associated tab is unselected.\n */\n @Method()\n async show(panelName: string) {\n // do nothing if the tab is already active\n if (panelName === this.activeTab?.panel) {\n return;\n }\n\n const previousTab = this.activeTab;\n const newTab: HTMLPostTabHeaderElement = this.host.querySelector(\n `post-tab-header[panel=${panelName}]`,\n );\n this.activateTab(newTab);\n\n // if a panel is currently being displayed, remove it from the view and complete the associated animation\n if (this.showing) {\n this.showing.effect['target'].style.display = 'none';\n this.showing.finish();\n }\n\n // hide the currently visible panel only if no other animation is running\n if (previousTab && !this.showing && !this.hiding) {\n this.hidePanel(previousTab.panel);\n }\n\n // wait for any hiding animation to complete before showing the selected tab\n if (this.hiding) {\n await this.hiding.finished;\n }\n\n this.showSelectedPanel();\n\n // wait for any display animation to complete for the returned promise to fully resolve\n if (this.showing) {\n await this.showing.finished;\n }\n\n this.tabChange.emit(this.activeTab.panel);\n }\n\n private moveMisplacedTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(tab => {\n if (tab.getAttribute('slot') === 'tabs') return;\n tab.setAttribute('slot', 'tabs');\n });\n }\n\n private enableTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(async tab => {\n await tab.componentOnReady();\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n\n // if the tab has an \"aria-controls\" attribute it was already linked to its panel: do nothing\n if (tabTitle.getAttribute('aria-controls')) return;\n\n const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');\n tabTitle.setAttribute('aria-controls', tabPanel.id);\n tabPanel.setAttribute('aria-labelledby', tabTitle.id);\n\n tab.addEventListener('click', () => {\n void this.show(tab.panel);\n });\n\n tab.addEventListener('keydown', ({ key }) => {\n if (key === 'ArrowRight' || key === 'ArrowLeft') this.navigateTabs(tab, key);\n });\n });\n\n // if the currently active tab was removed from the DOM then select the first one\n if (this.activeTab && !this.activeTab.isConnected) {\n void this.show(this.tabs.item(0).panel);\n }\n }\n\n private activateTab(tab: HTMLPostTabHeaderElement) {\n if (this.activeTab) {\n const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'false');\n tabTitle.setAttribute('tabindex', '-1');\n tabTitle.classList.remove('active');\n }\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'true');\n tabTitle.removeAttribute('tabindex');\n tabTitle.classList.add('active');\n\n this.activeTab = tab;\n }\n\n private hidePanel(panelName: HTMLPostTabPanelElement['name']) {\n const previousPanel = this.getPanel(panelName);\n\n if (!previousPanel) return;\n\n this.hiding = fadeOut(previousPanel);\n this.hiding.onfinish = () => {\n previousPanel.style.display = 'none';\n this.hiding = null;\n };\n }\n\n private showSelectedPanel() {\n const panel = this.getPanel(this.activeTab.panel);\n panel.style.display = 'block';\n\n // prevent the initially selected panel from fading in\n if (!this.isLoaded) return;\n\n this.showing = fadeIn(panel);\n this.showing.onfinish = () => {\n this.showing = null;\n };\n }\n\n private getPanel(name: string): HTMLPostTabPanelElement {\n return this.host.querySelector(`post-tab-panel[name=${name}]`);\n }\n\n private navigateTabs(tab: HTMLPostTabHeaderElement, key: 'ArrowRight' | 'ArrowLeft') {\n const activeTabIndex = Array.from(this.tabs).indexOf(tab);\n\n let nextTab: HTMLPostTabHeaderElement;\n if (key === 'ArrowRight') {\n nextTab = this.tabs[activeTabIndex + 1] || this.tabs[0];\n } else {\n nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];\n }\n\n if (!nextTab) return;\n\n const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title') as HTMLAnchorElement;\n nextTabTitle.focus();\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div class=\"tabs-wrapper\">\n <div class=\"tabs\" role=\"tablist\">\n <slot name=\"tabs\" onSlotchange={() => this.enableTabs()} />\n </div>\n </div>\n <div class=\"tab-content\">\n <slot onSlotchange={() => this.moveMisplacedTabs()} />\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"post-tabs.entry.cjs.js","mappings":";;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}