@swisspost/design-system-components 1.6.3 → 1.7.1

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 (309) 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} +144 -65
  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-989e0b36.js +7 -0
  11. package/dist/cjs/package-989e0b36.js.map +1 -0
  12. package/dist/cjs/post-accordion-bc0c6f31.js +87 -0
  13. package/dist/cjs/post-accordion-bc0c6f31.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-39ac30a4.js +101 -0
  17. package/dist/cjs/{post-alert-b46943e0.js.map → post-alert-39ac30a4.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-85f8ace5.js} +69 -69
  21. package/dist/cjs/{post-collapsible-04364cda.js.map → post-collapsible-85f8ace5.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-53e50c15.js +105 -0
  27. package/dist/cjs/post-icon-53e50c15.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-5a75c1b2.js +118 -0
  31. package/dist/cjs/post-popover-5a75c1b2.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-84378594.js +1878 -0
  35. package/dist/cjs/post-popovercontainer-84378594.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-02c6e31e.js +33 -0
  39. package/dist/cjs/{post-tab-header-805c0a52.js.map → post-tab-header-02c6e31e.js.map} +1 -1
  40. package/dist/cjs/post-tab-header.cjs.entry.js +4 -4
  41. package/dist/cjs/post-tab-panel-3973b707.js +27 -0
  42. package/dist/cjs/{post-tab-panel-caa44a77.js.map → post-tab-panel-3973b707.js.map} +1 -1
  43. package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
  44. package/dist/cjs/post-tabs-7a4fead7.js +153 -0
  45. package/dist/cjs/post-tabs-7a4fead7.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-79a9c96d.js} +78 -1754
  48. package/dist/cjs/post-tooltip-79a9c96d.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} +144 -65
  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-e13ef9ad.js +5 -0
  150. package/dist/esm/package-e13ef9ad.js.map +1 -0
  151. package/dist/esm/post-accordion-8e96598a.js +85 -0
  152. package/dist/esm/post-accordion-8e96598a.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-5e352303.js +99 -0
  156. package/dist/esm/{post-alert-e457e249.js.map → post-alert-5e352303.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-3cc5dd87.js} +69 -69
  160. package/dist/esm/{post-collapsible-c0a826b2.js.map → post-collapsible-3cc5dd87.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-fdda3f99.js +103 -0
  166. package/dist/esm/post-icon-fdda3f99.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-ff2c259f.js +116 -0
  170. package/dist/esm/post-popover-ff2c259f.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-f4cd18cd.js +1876 -0
  174. package/dist/esm/post-popovercontainer-f4cd18cd.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-486b267b.js +31 -0
  178. package/dist/esm/{post-tab-header-f0c355d6.js.map → post-tab-header-486b267b.js.map} +1 -1
  179. package/dist/esm/post-tab-header.entry.js +4 -4
  180. package/dist/esm/post-tab-panel-13940300.js +25 -0
  181. package/dist/esm/{post-tab-panel-46f02247.js.map → post-tab-panel-13940300.js.map} +1 -1
  182. package/dist/esm/post-tab-panel.entry.js +3 -3
  183. package/dist/esm/post-tabs-6f44ed1d.js +151 -0
  184. package/dist/esm/post-tabs-6f44ed1d.js.map +1 -0
  185. package/dist/esm/post-tabs.entry.js +3 -3
  186. package/dist/esm/{post-tooltip-fa7b4a0a.js → post-tooltip-1d99cd0c.js} +78 -1754
  187. package/dist/esm/post-tooltip-1d99cd0c.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-169b8ef7.entry.js +2 -0
  192. package/dist/post-components/p-28be44d7.js +2 -0
  193. package/dist/post-components/{p-8b6fe20d.js.map → p-28be44d7.js.map} +1 -1
  194. package/dist/post-components/p-3ef3a1d2.js +2 -0
  195. package/dist/post-components/p-3ef3a1d2.js.map +1 -0
  196. package/dist/post-components/p-4b94c2a1.entry.js +2 -0
  197. package/dist/post-components/p-4cbb5212.entry.js +2 -0
  198. package/dist/post-components/p-51ae6f46.entry.js +2 -0
  199. package/dist/post-components/p-668bf58c.entry.js +2 -0
  200. package/dist/post-components/p-67d0a4fa.entry.js +2 -0
  201. package/dist/post-components/p-6b3a5063.entry.js +2 -0
  202. package/dist/post-components/{p-3604be27.js → p-6cdc82c6.js} +2 -2
  203. package/dist/post-components/p-723336f2.js +2 -0
  204. package/dist/post-components/{p-ca1e407c.js.map → p-723336f2.js.map} +1 -1
  205. package/dist/post-components/p-7d08e4f1.js +2 -0
  206. package/dist/post-components/p-7d08e4f1.js.map +1 -0
  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-9b1b6e06.entry.js +2 -0
  212. package/dist/post-components/{p-9f71d450.js → p-a5a23448.js} +2 -2
  213. package/dist/post-components/p-aca6e9c1.js +2 -0
  214. package/dist/post-components/{p-fffce1d7.js.map → p-aca6e9c1.js.map} +1 -1
  215. package/dist/post-components/{p-b531475e.js → p-b095519d.js} +1 -1
  216. package/dist/post-components/p-bc27f061.js +9 -0
  217. package/dist/post-components/p-bc27f061.js.map +1 -0
  218. package/dist/post-components/p-bd1d0117.js +2 -0
  219. package/dist/post-components/p-bd1d0117.js.map +1 -0
  220. package/dist/post-components/p-d3ed113e.js +2 -0
  221. package/dist/post-components/p-d3ed113e.js.map +1 -0
  222. package/dist/post-components/p-d8365401.entry.js +2 -0
  223. package/dist/post-components/p-d8365401.entry.js.map +1 -0
  224. package/dist/post-components/p-e78d158d.entry.js +2 -0
  225. package/dist/post-components/p-e78d158d.entry.js.map +1 -0
  226. package/dist/post-components/{p-7b8797c6.entry.js → p-f695aab4.js} +2 -2
  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-a7649277.js +0 -3
  285. package/dist/post-components/p-a7649277.js.map +0 -1
  286. package/dist/post-components/p-a7c78dea.entry.js +0 -2
  287. package/dist/post-components/p-b2c3ed97.entry.js +0 -2
  288. package/dist/post-components/p-ba9aba3a.entry.js +0 -2
  289. package/dist/post-components/p-bd293ff3.entry.js +0 -2
  290. package/dist/post-components/p-ca1e407c.js +0 -2
  291. package/dist/post-components/p-d407b1c3.js +0 -2
  292. package/dist/post-components/p-d407b1c3.js.map +0 -1
  293. package/dist/post-components/p-dfe29f7f.js +0 -2
  294. package/dist/post-components/p-dfe29f7f.js.map +0 -1
  295. package/dist/post-components/p-fd7015ae.js +0 -9
  296. package/dist/post-components/p-fd7015ae.js.map +0 -1
  297. package/dist/post-components/p-fffce1d7.js +0 -2
  298. /package/dist/post-components/{p-195b8c88.entry.js.map → p-169b8ef7.entry.js.map} +0 -0
  299. /package/dist/post-components/{p-3225e008.entry.js.map → p-4b94c2a1.entry.js.map} +0 -0
  300. /package/dist/post-components/{p-61ffffa9.entry.js.map → p-4cbb5212.entry.js.map} +0 -0
  301. /package/dist/post-components/{p-88262544.js.map → p-51ae6f46.entry.js.map} +0 -0
  302. /package/dist/post-components/{p-a7c78dea.entry.js.map → p-668bf58c.entry.js.map} +0 -0
  303. /package/dist/post-components/{p-b2c3ed97.entry.js.map → p-67d0a4fa.entry.js.map} +0 -0
  304. /package/dist/post-components/{p-ba9aba3a.entry.js.map → p-6b3a5063.entry.js.map} +0 -0
  305. /package/dist/post-components/{p-3604be27.js.map → p-6cdc82c6.js.map} +0 -0
  306. /package/dist/post-components/{p-bd293ff3.entry.js.map → p-9b1b6e06.entry.js.map} +0 -0
  307. /package/dist/post-components/{p-9f71d450.js.map → p-a5a23448.js.map} +0 -0
  308. /package/dist/post-components/{p-b531475e.js.map → p-b095519d.js.map} +0 -0
  309. /package/dist/post-components/{p-7b8797c6.entry.js.map → p-f695aab4.js.map} +0 -0
@@ -4,38 +4,38 @@ import { v as version } from './package.js';
4
4
  const postTabPanelCss = ":host{display:none}";
5
5
 
6
6
  const PostTabPanel = /*@__PURE__*/ proxyCustomElement(class PostTabPanel extends HTMLElement {
7
- constructor() {
8
- super();
9
- this.__registerHost();
10
- this.__attachShadow();
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 (h(Host, { "data-version": version }, h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, h("slot", null))));
20
- }
21
- get host() { return this; }
22
- static get style() { return postTabPanelCss; }
7
+ constructor() {
8
+ super();
9
+ this.__registerHost();
10
+ this.__attachShadow();
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 (h(Host, { "data-version": version }, h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, h("slot", null))));
20
+ }
21
+ get host() { return this; }
22
+ static get style() { return postTabPanelCss; }
23
23
  }, [1, "post-tab-panel", {
24
- "name": [1],
25
- "panelId": [32]
26
- }]);
24
+ "name": [1],
25
+ "panelId": [32]
26
+ }]);
27
27
  function defineCustomElement() {
28
- if (typeof customElements === "undefined") {
29
- return;
30
- }
31
- const components = ["post-tab-panel"];
32
- components.forEach(tagName => { switch (tagName) {
33
- case "post-tab-panel":
34
- if (!customElements.get(tagName)) {
35
- customElements.define(tagName, PostTabPanel);
36
- }
37
- break;
38
- } });
28
+ if (typeof customElements === "undefined") {
29
+ return;
30
+ }
31
+ const components = ["post-tab-panel"];
32
+ components.forEach(tagName => { switch (tagName) {
33
+ case "post-tab-panel":
34
+ if (!customElements.get(tagName)) {
35
+ customElements.define(tagName, PostTabPanel);
36
+ }
37
+ break;
38
+ } });
39
39
  }
40
40
 
41
41
  export { PostTabPanel as P, defineCustomElement as d };
@@ -1 +1 @@
1
- {"file":"post-tab-panel2.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,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU,IAEf,eAAO,CACH,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;","names":[],"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-panel2.js","mappings":";;;AAAA,MAAM,eAAe,GAAG,qBAAqB;;MCQhC,YAAY;;;;;;;;IAUvB,iBAAiB;;QAEf,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;KAC/D;IAED,MAAM;QACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU,IAEf,eAAO,CACH,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;","names":[],"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,8 +2,8 @@ import type { Components, JSX } from "../types/components";
2
2
 
3
3
  interface PostTabs extends Components.PostTabs, HTMLElement {}
4
4
  export const PostTabs: {
5
- prototype: PostTabs;
6
- new (): PostTabs;
5
+ prototype: PostTabs;
6
+ new (): PostTabs;
7
7
  };
8
8
  /**
9
9
  * Used to define this component and all nested components recursively.
@@ -2,166 +2,166 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
2
2
  import { v as version } from './package.js';
3
3
  import { f as fadeOut, a as fadeIn } from './fade.js';
4
4
 
5
- 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-info .tabs-wrapper{background-color:#cce4ee}.bg-success .tabs-wrapper{background-color:#2c911c}.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}.bg-success-green .tabs-wrapper{background-color:#2c871d}.bg-error-red .tabs-wrapper{background-color:#a51728}.bg-warning-orange .tabs-wrapper{background-color:#f49e00}.bg-success-background .tabs-wrapper{background-color:#c0debb}.bg-error-background .tabs-wrapper{background-color:#ffdade}.bg-warning-background .tabs-wrapper{background-color:#fce2b2}:host{display:block}";
5
+ 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{margin-block: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-info .tabs-wrapper{background-color:#cce4ee}.bg-success .tabs-wrapper{background-color:#2c911c}.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}.bg-success-green .tabs-wrapper{background-color:#2c871d}.bg-error-red .tabs-wrapper{background-color:#a51728}.bg-warning-orange .tabs-wrapper{background-color:#f49e00}.bg-success-background .tabs-wrapper{background-color:#c0debb}.bg-error-background .tabs-wrapper{background-color:#ffdade}.bg-warning-background .tabs-wrapper{background-color:#fce2b2}:host{display:block}";
6
6
 
7
7
  const PostTabs = /*@__PURE__*/ proxyCustomElement(class PostTabs extends HTMLElement {
8
- constructor() {
9
- super();
10
- this.__registerHost();
11
- this.__attachShadow();
12
- this.tabChange = 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;
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.tabChange = createEvent(this, "tabChange", 7);
13
+ this.isLoaded = false;
14
+ this.activePanel = undefined;
35
15
  }
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();
16
+ get tabs() {
17
+ return this.host.querySelectorAll('post-tab-header');
43
18
  }
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);
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;
47
25
  }
48
- // wait for any hiding animation to complete before showing the selected tab
49
- if (this.hiding) {
50
- await this.hiding.finished;
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);
51
58
  }
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;
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
+ });
56
67
  }
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);
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 = fadeOut(previousPanel);
111
+ this.hiding.onfinish = () => {
112
+ previousPanel.style.display = 'none';
113
+ this.hiding = null;
114
+ };
91
115
  }
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');
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 = fadeIn(panel);
123
+ this.showing.onfinish = () => {
124
+ this.showing = null;
125
+ };
99
126
  }
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 = 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 = 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];
127
+ getPanel(name) {
128
+ return this.host.querySelector(`post-tab-panel[name=${name}]`);
135
129
  }
136
- else {
137
- nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];
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();
138
143
  }
139
- if (!nextTab)
140
- return;
141
- const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title');
142
- nextTabTitle.focus();
143
- }
144
- render() {
145
- return (h(Host, { "data-version": version }, h("div", { class: "tabs-wrapper" }, h("div", { class: "tabs", role: "tablist" }, h("slot", { name: "tabs", onSlotchange: () => this.enableTabs() }))), h("div", { class: "tab-content" }, h("slot", { onSlotchange: () => this.moveMisplacedTabs() }))));
146
- }
147
- get host() { return this; }
148
- static get style() { return postTabsCss; }
144
+ render() {
145
+ return (h(Host, { "data-version": version }, h("div", { class: "tabs-wrapper" }, h("div", { class: "tabs", role: "tablist" }, h("slot", { name: "tabs", onSlotchange: () => this.enableTabs() }))), h("div", { class: "tab-content" }, h("slot", { onSlotchange: () => this.moveMisplacedTabs() }))));
146
+ }
147
+ get host() { return this; }
148
+ static get style() { return postTabsCss; }
149
149
  }, [1, "post-tabs", {
150
- "activePanel": [1, "active-panel"],
151
- "show": [64]
152
- }]);
150
+ "activePanel": [1, "active-panel"],
151
+ "show": [64]
152
+ }]);
153
153
  function defineCustomElement() {
154
- if (typeof customElements === "undefined") {
155
- return;
156
- }
157
- const components = ["post-tabs"];
158
- components.forEach(tagName => { switch (tagName) {
159
- case "post-tabs":
160
- if (!customElements.get(tagName)) {
161
- customElements.define(tagName, PostTabs);
162
- }
163
- break;
164
- } });
154
+ if (typeof customElements === "undefined") {
155
+ return;
156
+ }
157
+ const components = ["post-tabs"];
158
+ components.forEach(tagName => { switch (tagName) {
159
+ case "post-tabs":
160
+ if (!customElements.get(tagName)) {
161
+ customElements.define(tagName, PostTabs);
162
+ }
163
+ break;
164
+ } });
165
165
  }
166
166
 
167
167
  export { PostTabs as P, defineCustomElement as d };
@@ -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B,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAsB,CAAC;IACzF,YAAY,CAAC,KAAK,EAAE,CAAC;GACtB;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WAAK,KAAK,EAAC,cAAc,IACvB,WAAK,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,IAC9B,YAAM,IAAI,EAAC,MAAM,EAAC,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,GAAI,CACvD,CACF,EACN,WAAK,KAAK,EAAC,aAAa,IACtB,YAAM,YAAY,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAI,CAClD,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;","names":[],"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-tabs2.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,soEAAsoE;;MCS7oE,QAAQ;;;;;;QAIX,aAAQ,GAAG,KAAK,CAAC;;;IAEzB,IAAY,IAAI;QACd,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;KACtD;IAkBD,gBAAgB;QACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACzE,KAAK,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;KACtB;;;;;IAOD,MAAM,IAAI,CAAC,SAAiB;;;QAE1B,IAAI,SAAS,MAAK,MAAA,IAAI,CAAC,SAAS,0CAAE,KAAK,CAAA,EAAE;YACvC,OAAO;SACR;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC;QACnC,MAAM,MAAM,GAA6B,IAAI,CAAC,IAAI,CAAC,aAAa,CAC9D,yBAAyB,SAAS,GAAG,CACtC,CAAC;QACF,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;;QAGzB,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;YACrD,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;SACvB;;QAGD,IAAI,WAAW,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,I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,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SAC5E;QAED,IAAI,CAAC,OAAO;YAAE,OAAO;QAErB,MAAM,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,YAAY,CAAsB,CAAC;QACzF,YAAY,CAAC,KAAK,EAAE,CAAC;KACtB;IAED,MAAM;QACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WAAK,KAAK,EAAC,cAAc,IACvB,WAAK,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,IAC9B,YAAM,IAAI,EAAC,MAAM,EAAC,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,GAAI,CACvD,CACF,EACN,WAAK,KAAK,EAAC,aAAa,IACtB,YAAM,YAAY,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAI,CAClD,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;","names":[],"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,8 +2,8 @@ import type { Components, JSX } from "../types/components";
2
2
 
3
3
  interface PostTooltip extends Components.PostTooltip, HTMLElement {}
4
4
  export const PostTooltip: {
5
- prototype: PostTooltip;
6
- new (): PostTooltip;
5
+ prototype: PostTooltip;
6
+ new (): PostTooltip;
7
7
  };
8
8
  /**
9
9
  * Used to define this component and all nested components recursively.