@swisspost/design-system-components 9.0.0-next.2 → 9.0.0-next.21

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 (538) hide show
  1. package/dist/.config/bindings.angular.js +4 -0
  2. package/dist/cjs/{attribute-observer-10f08c04.js → attribute-observer-6d8b886b.js} +4 -4
  3. package/dist/cjs/check-non-empty-bd99d236.js +15 -0
  4. package/dist/cjs/check-one-of-75d270b5.js +13 -0
  5. package/dist/cjs/check-type-cdbf6d29.js +21 -0
  6. package/dist/cjs/check-url-220a286c.js +19 -0
  7. package/dist/cjs/debounce-158fd76f.js +13 -0
  8. package/dist/cjs/fade-72d5ef55.js +14 -0
  9. package/dist/cjs/get-root-7a3498ef.js +11 -0
  10. package/dist/cjs/index-23e36ff7.js +37 -0
  11. package/dist/cjs/{index-c15bd800.js → index-5acef487.js} +54 -17
  12. package/dist/cjs/index.browser-2f65f583.js +15 -0
  13. package/dist/cjs/index.cjs.js +56 -27
  14. package/dist/cjs/loader.cjs.js +2 -2
  15. package/dist/cjs/{package-a7150f64.js → package-c6bc9e82.js} +1 -1
  16. package/dist/cjs/{post-accordion-62d2fd79.js → post-accordion-d1345784.js} +9 -8
  17. package/dist/cjs/post-accordion-item-a796d803.js +64 -0
  18. package/dist/cjs/post-accordion-item.cjs.entry.js +8 -5
  19. package/dist/cjs/post-accordion.cjs.entry.js +4 -4
  20. package/dist/cjs/post-avatar-b4e96354.js +144 -0
  21. package/dist/cjs/post-avatar.cjs.entry.js +13 -0
  22. package/dist/cjs/post-back-to-top-fc541c6b.js +76 -0
  23. package/dist/cjs/post-back-to-top.cjs.entry.js +15 -0
  24. package/dist/cjs/post-banner-46522b4f.js +96 -0
  25. package/dist/cjs/post-banner.cjs.entry.js +19 -0
  26. package/dist/cjs/post-breadcrumb-799d34da.js +112 -0
  27. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +17 -0
  28. package/dist/cjs/post-breadcrumb.cjs.entry.js +13 -0
  29. package/dist/cjs/post-card-control-7bf7d3f2.js +283 -0
  30. package/dist/cjs/post-card-control.cjs.entry.js +5 -5
  31. package/dist/cjs/post-closebutton_15.cjs.entry.js +34 -0
  32. package/dist/cjs/{post-collapsible-trigger-9dca8493.js → post-collapsible-trigger-0568e3ec.js} +50 -56
  33. package/dist/cjs/post-collapsible_2.cjs.entry.js +10 -6
  34. package/dist/cjs/post-components.cjs.js +2 -2
  35. package/dist/cjs/post-footer-f87a556b.js +88 -0
  36. package/dist/cjs/post-footer.cjs.entry.js +11 -0
  37. package/dist/cjs/post-linkarea-0ccf93fc.js +30 -0
  38. package/dist/cjs/post-linkarea.cjs.entry.js +11 -0
  39. package/dist/cjs/post-menu-item-eba24c40.js +68 -0
  40. package/dist/cjs/post-popover-35f679f6.js +106 -0
  41. package/dist/cjs/post-popover.cjs.entry.js +4 -4
  42. package/dist/cjs/{post-rating-db5a397a.js → post-rating-d12fa214.js} +16 -6
  43. package/dist/cjs/post-rating.cjs.entry.js +3 -3
  44. package/dist/cjs/post-tab-header-89dca04b.js +33 -0
  45. package/dist/cjs/post-tab-header.cjs.entry.js +5 -4
  46. package/dist/cjs/{post-tab-panel-d59cf1ec.js → post-tab-panel-ad1ab180.js} +6 -5
  47. package/dist/cjs/post-tab-panel.cjs.entry.js +4 -3
  48. package/dist/cjs/{post-tabs-7afae61a.js → post-tabs-0db75745.js} +23 -16
  49. package/dist/cjs/post-tabs.cjs.entry.js +4 -4
  50. package/dist/cjs/post-tag-396a46c9.js +47 -0
  51. package/dist/cjs/post-tag.cjs.entry.js +3 -3
  52. package/dist/cjs/post-togglebutton-69983699.js +3861 -0
  53. package/dist/cjs/{post-tooltip-432852c7.js → post-tooltip-7174ea97.js} +38 -25
  54. package/dist/cjs/post-tooltip.cjs.entry.js +8 -6
  55. package/dist/cjs/slide-8ae17ee4.js +28 -0
  56. package/dist/collection/animations/collapse.js +5 -5
  57. package/dist/collection/animations/fade.js +6 -2
  58. package/dist/collection/animations/slide.js +23 -0
  59. package/dist/collection/collection-manifest.json +22 -3
  60. package/dist/collection/components/post-accordion/post-accordion.css +1 -1
  61. package/dist/collection/components/post-accordion/post-accordion.js +5 -3
  62. package/dist/collection/components/post-accordion-item/post-accordion-item.css +1 -1
  63. package/dist/collection/components/post-accordion-item/post-accordion-item.js +29 -11
  64. package/dist/collection/components/post-avatar/post-avatar.css +3 -0
  65. package/dist/collection/components/post-avatar/post-avatar.js +234 -0
  66. package/dist/collection/components/post-back-to-top/post-back-to-top.css +1 -0
  67. package/dist/collection/components/post-back-to-top/post-back-to-top.js +109 -0
  68. package/dist/collection/components/post-banner/banner-types.js +1 -0
  69. package/dist/collection/components/post-banner/post-banner.css +3 -0
  70. package/dist/collection/components/{post-alert/post-alert.js → post-banner/post-banner.js} +51 -73
  71. package/dist/collection/components/post-breadcrumb/post-breadcrumb.css +3 -0
  72. package/dist/collection/components/post-breadcrumb/post-breadcrumb.js +163 -0
  73. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.css +1 -0
  74. package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +98 -0
  75. package/dist/collection/components/post-card-control/post-card-control.css +1 -1
  76. package/dist/collection/components/post-card-control/post-card-control.js +55 -43
  77. package/dist/collection/components/post-closebutton/post-closebutton.js +13 -0
  78. package/dist/collection/components/post-collapsible/post-collapsible.css +1 -1
  79. package/dist/collection/components/post-collapsible/post-collapsible.js +15 -6
  80. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +21 -20
  81. package/dist/collection/components/post-footer/post-footer.css +1 -0
  82. package/dist/collection/components/post-footer/post-footer.js +76 -0
  83. package/dist/collection/components/post-header/post-header.css +1 -0
  84. package/dist/collection/components/post-header/post-header.js +267 -0
  85. package/dist/collection/components/post-icon/post-icon.js +80 -47
  86. package/dist/collection/components/post-language-option/post-language-option.css +3 -0
  87. package/dist/collection/components/post-language-option/post-language-option.js +224 -0
  88. package/dist/collection/components/post-language-switch/post-language-switch.css +1 -0
  89. package/dist/collection/components/post-language-switch/post-language-switch.js +164 -0
  90. package/dist/collection/components/post-language-switch/switch-variants.js +1 -0
  91. package/dist/collection/components/post-linkarea/post-linkarea.css +1 -0
  92. package/dist/collection/components/post-linkarea/post-linkarea.js +30 -0
  93. package/dist/collection/components/post-list/post-list.css +3 -0
  94. package/dist/collection/components/post-list/post-list.js +90 -0
  95. package/dist/collection/components/post-list-item/post-list-item.css +1 -0
  96. package/dist/collection/components/post-list-item/post-list-item.js +26 -0
  97. package/dist/collection/components/post-logo/post-logo.css +1 -1
  98. package/dist/collection/components/post-logo/post-logo.js +4 -3
  99. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -0
  100. package/dist/collection/components/post-mainnavigation/post-mainnavigation.js +255 -0
  101. package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -0
  102. package/dist/collection/components/post-megadropdown/post-megadropdown.js +268 -0
  103. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.css +1 -0
  104. package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +127 -0
  105. package/dist/collection/components/post-menu/post-menu.css +3 -0
  106. package/dist/collection/components/post-menu/post-menu.js +297 -0
  107. package/dist/collection/components/post-menu-item/post-menu-item.js +8 -0
  108. package/dist/collection/components/post-menu-trigger/post-menu-trigger.css +1 -0
  109. package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +122 -0
  110. package/dist/collection/components/post-popover/post-popover.css +1 -1
  111. package/dist/collection/components/post-popover/post-popover.js +6 -3
  112. package/dist/collection/components/post-popovercontainer/post-popovercontainer.css +1 -1
  113. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +193 -38
  114. package/dist/collection/components/post-rating/post-rating.css +1 -1
  115. package/dist/collection/components/post-rating/post-rating.js +13 -2
  116. package/dist/collection/components/post-tab-header/post-tab-header.css +2 -2
  117. package/dist/collection/components/post-tab-header/post-tab-header.js +6 -4
  118. package/dist/collection/components/post-tab-panel/post-tab-panel.js +4 -2
  119. package/dist/collection/components/post-tabs/post-tabs.css +1 -1
  120. package/dist/collection/components/post-tabs/post-tabs.js +17 -14
  121. package/dist/collection/components/post-tag/post-tag.css +1 -1
  122. package/dist/collection/components/post-tag/post-tag.js +3 -2
  123. package/dist/collection/components/post-togglebutton/post-togglebutton.css +1 -0
  124. package/dist/collection/components/post-togglebutton/post-togglebutton.js +75 -0
  125. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -1
  126. package/dist/collection/components/post-tooltip/post-tooltip.js +35 -17
  127. package/dist/collection/index.js +21 -2
  128. package/dist/collection/utils/attribute-observer.js +4 -4
  129. package/dist/collection/utils/breakpoints.js +50 -0
  130. package/dist/collection/utils/component-on-ready.js +4 -4
  131. package/dist/collection/utils/debounce.js +2 -1
  132. package/dist/collection/utils/get-focusable-children.js +33 -0
  133. package/dist/collection/utils/property-checkers/check-non-empty.js +6 -2
  134. package/dist/collection/utils/property-checkers/check-one-of.js +8 -3
  135. package/dist/collection/utils/property-checkers/check-pattern.js +8 -3
  136. package/dist/collection/utils/property-checkers/check-type.js +11 -6
  137. package/dist/collection/utils/property-checkers/check-url.js +11 -6
  138. package/dist/collection/utils/property-checkers/empty-or.js +5 -2
  139. package/dist/collection/utils/sass-export.js +8 -5
  140. package/dist/components/attribute-observer.js +4 -4
  141. package/dist/components/check-non-empty.js +6 -2
  142. package/dist/components/check-one-of.js +8 -3
  143. package/dist/components/check-type.js +11 -6
  144. package/dist/components/debounce.js +11 -0
  145. package/dist/components/fade.js +6 -2
  146. package/dist/components/get-focusable-children.js +35 -0
  147. package/dist/components/get-root.js +9 -0
  148. package/dist/components/index.browser.js +13 -0
  149. package/dist/components/index.js +21 -2
  150. package/dist/components/index2.js +25 -12
  151. package/dist/components/index3.js +135 -0
  152. package/dist/components/package.js +1 -1
  153. package/dist/components/post-accordion-item2.js +36 -16
  154. package/dist/components/post-accordion2.js +6 -5
  155. package/dist/components/post-avatar.d.ts +11 -0
  156. package/dist/components/post-avatar.js +6 -0
  157. package/dist/components/post-avatar2.js +169 -0
  158. package/dist/components/post-back-to-top.d.ts +11 -0
  159. package/dist/components/post-back-to-top.js +6 -0
  160. package/dist/components/post-back-to-top2.js +101 -0
  161. package/dist/components/post-banner.d.ts +11 -0
  162. package/dist/components/post-banner.js +6 -0
  163. package/dist/components/post-banner2.js +131 -0
  164. package/dist/components/post-breadcrumb-item.d.ts +11 -0
  165. package/dist/components/post-breadcrumb-item.js +6 -0
  166. package/dist/components/post-breadcrumb-item2.js +82 -0
  167. package/dist/components/post-breadcrumb.d.ts +11 -0
  168. package/dist/components/post-breadcrumb.js +6 -0
  169. package/dist/components/post-breadcrumb2.js +169 -0
  170. package/dist/components/post-card-control2.js +50 -39
  171. package/dist/components/post-closebutton.d.ts +11 -0
  172. package/dist/components/post-closebutton.js +6 -0
  173. package/dist/components/post-closebutton2.js +34 -0
  174. package/dist/components/post-collapsible-trigger2.js +23 -38
  175. package/dist/components/post-collapsible2.js +22 -14
  176. package/dist/components/post-footer.d.ts +11 -0
  177. package/dist/components/post-footer.js +6 -0
  178. package/dist/components/post-footer2.js +128 -0
  179. package/dist/components/post-header.d.ts +11 -0
  180. package/dist/components/post-header.js +6 -0
  181. package/dist/components/post-header2.js +217 -0
  182. package/dist/components/post-icon2.js +82 -46
  183. package/dist/components/post-language-option.d.ts +11 -0
  184. package/dist/components/post-language-option.js +6 -0
  185. package/dist/components/post-language-option2.js +102 -0
  186. package/dist/components/post-language-switch.d.ts +11 -0
  187. package/dist/components/post-language-switch.js +6 -0
  188. package/dist/components/post-language-switch2.js +135 -0
  189. package/dist/components/post-linkarea.d.ts +11 -0
  190. package/dist/components/post-linkarea.js +6 -0
  191. package/dist/components/post-linkarea2.js +42 -0
  192. package/dist/components/post-list-item.d.ts +11 -0
  193. package/dist/components/post-list-item.js +6 -0
  194. package/dist/components/post-list-item2.js +35 -0
  195. package/dist/components/{post-alert.d.ts → post-list.d.ts} +4 -4
  196. package/dist/components/post-list.js +6 -0
  197. package/dist/components/post-list2.js +55 -0
  198. package/dist/components/post-logo2.js +5 -5
  199. package/dist/components/post-mainnavigation.d.ts +11 -0
  200. package/dist/components/post-mainnavigation.js +6 -0
  201. package/dist/components/post-mainnavigation2.js +258 -0
  202. package/dist/components/post-megadropdown-trigger.d.ts +11 -0
  203. package/dist/components/post-megadropdown-trigger.js +6 -0
  204. package/dist/components/post-megadropdown-trigger2.js +113 -0
  205. package/dist/components/post-megadropdown.d.ts +11 -0
  206. package/dist/components/post-megadropdown.js +6 -0
  207. package/dist/components/post-megadropdown2.js +186 -0
  208. package/dist/components/post-menu-item.d.ts +11 -0
  209. package/dist/components/post-menu-item.js +6 -0
  210. package/dist/components/post-menu-item2.js +27 -0
  211. package/dist/components/post-menu-trigger.d.ts +11 -0
  212. package/dist/components/post-menu-trigger.js +6 -0
  213. package/dist/components/post-menu-trigger2.js +109 -0
  214. package/dist/components/post-menu.d.ts +11 -0
  215. package/dist/components/post-menu.js +6 -0
  216. package/dist/components/post-menu2.js +193 -0
  217. package/dist/components/post-popover2.js +6 -4
  218. package/dist/components/post-popovercontainer2.js +227 -59
  219. package/dist/components/post-rating2.js +14 -4
  220. package/dist/components/post-tab-header2.js +7 -6
  221. package/dist/components/post-tab-panel2.js +4 -3
  222. package/dist/components/post-tabs2.js +20 -13
  223. package/dist/components/post-tag2.js +3 -3
  224. package/dist/components/post-togglebutton.d.ts +11 -0
  225. package/dist/components/post-togglebutton.js +6 -0
  226. package/dist/components/post-togglebutton2.js +61 -0
  227. package/dist/components/post-tooltip2.js +35 -22
  228. package/dist/components/slide.js +25 -0
  229. package/dist/docs.json +1956 -270
  230. package/dist/esm/{attribute-observer-37fa950a.js → attribute-observer-2f203993.js} +4 -4
  231. package/dist/esm/check-non-empty-258a56b3.js +13 -0
  232. package/dist/esm/check-one-of-0bee20f5.js +11 -0
  233. package/dist/esm/check-type-37d5d307.js +19 -0
  234. package/dist/esm/check-url-17962bc8.js +17 -0
  235. package/dist/esm/debounce-e54c7131.js +11 -0
  236. package/dist/esm/fade-1f3cacf4.js +11 -0
  237. package/dist/esm/get-root-7af2e0d1.js +9 -0
  238. package/dist/esm/{index-0b56fc28.js → index-40846676.js} +54 -17
  239. package/dist/esm/index-8f8fe5b0.js +32 -0
  240. package/dist/esm/index.browser-51485f85.js +13 -0
  241. package/dist/esm/index.js +32 -22
  242. package/dist/esm/loader.js +3 -3
  243. package/dist/esm/package-5614c98b.js +3 -0
  244. package/dist/esm/{post-accordion-6f4d2b9a.js → post-accordion-f6d1834d.js} +9 -8
  245. package/dist/esm/post-accordion-item-7cb93300.js +62 -0
  246. package/dist/esm/post-accordion-item.entry.js +8 -5
  247. package/dist/esm/post-accordion.entry.js +4 -4
  248. package/dist/esm/post-avatar-96108967.js +142 -0
  249. package/dist/esm/post-avatar.entry.js +5 -0
  250. package/dist/esm/post-back-to-top-7f8a61c8.js +74 -0
  251. package/dist/esm/post-back-to-top.entry.js +7 -0
  252. package/dist/esm/post-banner-bb69bce8.js +94 -0
  253. package/dist/esm/post-banner.entry.js +11 -0
  254. package/dist/esm/post-breadcrumb-9d9efa4e.js +110 -0
  255. package/dist/esm/post-breadcrumb-item_2.entry.js +8 -0
  256. package/dist/esm/post-breadcrumb.entry.js +5 -0
  257. package/dist/esm/post-card-control-fdced7d5.js +281 -0
  258. package/dist/esm/post-card-control.entry.js +5 -5
  259. package/dist/esm/post-closebutton_15.entry.js +12 -0
  260. package/dist/esm/{post-collapsible-trigger-85c2064a.js → post-collapsible-trigger-17b2f067.js} +49 -55
  261. package/dist/esm/post-collapsible_2.entry.js +10 -6
  262. package/dist/esm/post-components.js +3 -3
  263. package/dist/esm/post-footer-2dcd8159.js +86 -0
  264. package/dist/esm/post-footer.entry.js +3 -0
  265. package/dist/esm/post-linkarea-06c5144d.js +28 -0
  266. package/dist/esm/post-linkarea.entry.js +3 -0
  267. package/dist/esm/post-menu-item-e917bf99.js +65 -0
  268. package/dist/esm/post-popover-67a3cbf2.js +104 -0
  269. package/dist/esm/post-popover.entry.js +4 -4
  270. package/dist/esm/{post-rating-d9fc0b40.js → post-rating-9613bee8.js} +16 -6
  271. package/dist/esm/post-rating.entry.js +3 -3
  272. package/dist/esm/post-tab-header-dff3a025.js +31 -0
  273. package/dist/esm/post-tab-header.entry.js +5 -4
  274. package/dist/esm/{post-tab-panel-926439f4.js → post-tab-panel-2b3f82a8.js} +6 -5
  275. package/dist/esm/post-tab-panel.entry.js +4 -3
  276. package/dist/esm/{post-tabs-13b2d9a6.js → post-tabs-46d1165f.js} +23 -16
  277. package/dist/esm/post-tabs.entry.js +4 -4
  278. package/dist/esm/post-tag-4176268e.js +45 -0
  279. package/dist/esm/post-tag.entry.js +3 -3
  280. package/dist/esm/post-togglebutton-5892c5bd.js +3845 -0
  281. package/dist/esm/{post-tooltip-3cde6b53.js → post-tooltip-5a45a569.js} +38 -25
  282. package/dist/esm/post-tooltip.entry.js +8 -6
  283. package/dist/esm/slide-62768431.js +25 -0
  284. package/dist/post-components/index.esm.js +1 -1
  285. package/dist/post-components/p-017dc6c7.js +1 -0
  286. package/dist/post-components/p-0227b899.js +1 -0
  287. package/dist/post-components/p-04895a54.js +1 -0
  288. package/dist/post-components/p-04c38bfe.entry.js +1 -0
  289. package/dist/post-components/p-07a0a626.js +1 -0
  290. package/dist/post-components/p-12573893.js +1 -0
  291. package/dist/post-components/p-1289b0a7.entry.js +1 -0
  292. package/dist/post-components/p-12a11565.js +1 -0
  293. package/dist/post-components/p-1542a80e.entry.js +1 -0
  294. package/dist/post-components/p-181c73d5.js +1 -0
  295. package/dist/post-components/p-254a9bd2.entry.js +1 -0
  296. package/dist/post-components/p-28500934.entry.js +1 -0
  297. package/dist/post-components/p-2b1281af.js +1 -0
  298. package/dist/post-components/p-2c69e7f2.entry.js +1 -0
  299. package/dist/post-components/p-30132b19.entry.js +1 -0
  300. package/dist/post-components/p-30af1d48.js +1 -0
  301. package/dist/post-components/p-3bdeb686.entry.js +1 -0
  302. package/dist/post-components/p-47cb31dd.js +1 -0
  303. package/dist/post-components/p-4af6dbed.js +1 -0
  304. package/dist/post-components/p-4f41f63e.js +1 -0
  305. package/dist/post-components/p-52790b8b.js +1 -0
  306. package/dist/post-components/p-5959f2bd.js +1 -0
  307. package/dist/post-components/{p-82dcf8c6.js → p-59ca0a13.js} +3 -3
  308. package/dist/post-components/p-5aaa5703.entry.js +1 -0
  309. package/dist/post-components/p-64e3de38.js +1 -0
  310. package/dist/post-components/p-67a45f16.js +1 -0
  311. package/dist/post-components/p-6d8ac9bd.entry.js +1 -0
  312. package/dist/post-components/p-7709c14a.js +1 -0
  313. package/dist/post-components/p-77cc2a5e.entry.js +1 -0
  314. package/dist/post-components/p-79c552fb.js +1 -0
  315. package/dist/post-components/p-7dd05e6d.entry.js +1 -0
  316. package/dist/post-components/p-803b7598.js +1 -0
  317. package/dist/post-components/p-85fdc2d3.js +1 -0
  318. package/dist/post-components/p-9748a355.js +1 -0
  319. package/dist/post-components/p-98fcf90b.entry.js +1 -0
  320. package/dist/post-components/p-994fae4c.entry.js +1 -0
  321. package/dist/post-components/p-a805515a.entry.js +1 -0
  322. package/dist/post-components/p-b5b48f66.entry.js +1 -0
  323. package/dist/post-components/p-b9bf5a5f.js +1 -0
  324. package/dist/post-components/p-c6b3a926.js +1 -0
  325. package/dist/post-components/p-c9dd3cdb.entry.js +1 -0
  326. package/dist/post-components/p-cb5e4a06.js +1 -0
  327. package/dist/post-components/p-d45df336.js +1 -0
  328. package/dist/post-components/p-dd4a5c0a.entry.js +1 -0
  329. package/dist/post-components/p-e1baac59.js +1 -0
  330. package/dist/post-components/p-e585c6fe.js +1 -0
  331. package/dist/post-components/p-e6d54838.entry.js +1 -0
  332. package/dist/post-components/p-f4b0cc7d.js +1 -0
  333. package/dist/post-components/p-fc91cbc2.js +1 -0
  334. package/dist/post-components/p-fe8c300c.js +1 -0
  335. package/dist/post-components/p-ff95dcd3.js +2 -0
  336. package/dist/post-components/post-components.esm.js +1 -1
  337. package/dist/types/animations/collapse.d.ts +2 -2
  338. package/dist/types/animations/fade.d.ts +2 -2
  339. package/dist/types/animations/slide.d.ts +2 -0
  340. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +8 -2
  341. package/dist/types/components/post-avatar/post-avatar.d.ts +51 -0
  342. package/dist/types/components/post-back-to-top/post-back-to-top.d.ts +19 -0
  343. package/dist/types/components/post-banner/banner-types.d.ts +2 -0
  344. package/dist/types/components/post-banner/post-banner.d.ts +49 -0
  345. package/dist/types/components/post-breadcrumb/post-breadcrumb.d.ts +30 -0
  346. package/dist/types/components/post-breadcrumb-item/post-breadcrumb-item.d.ts +20 -0
  347. package/dist/types/components/post-card-control/post-card-control.d.ts +9 -9
  348. package/dist/types/components/post-closebutton/post-closebutton.d.ts +7 -0
  349. package/dist/types/components/post-footer/post-footer.d.ts +23 -0
  350. package/dist/types/components/post-header/post-header.d.ts +45 -0
  351. package/dist/types/components/post-icon/post-icon.d.ts +14 -12
  352. package/dist/types/components/post-language-option/post-language-option.d.ts +45 -0
  353. package/dist/types/components/post-language-switch/post-language-switch.d.ts +31 -0
  354. package/dist/types/components/post-language-switch/switch-variants.d.ts +2 -0
  355. package/dist/types/components/post-linkarea/post-linkarea.d.ts +5 -0
  356. package/dist/types/components/post-list/post-list.d.ts +24 -0
  357. package/dist/types/components/post-list-item/post-list-item.d.ts +8 -0
  358. package/dist/types/components/post-logo/post-logo.d.ts +1 -1
  359. package/dist/types/components/post-mainnavigation/post-mainnavigation.d.ts +70 -0
  360. package/dist/types/components/post-megadropdown/post-megadropdown.d.ts +57 -0
  361. package/dist/types/components/post-megadropdown-trigger/post-megadropdown-trigger.d.ts +31 -0
  362. package/dist/types/components/post-menu/post-menu.d.ts +48 -0
  363. package/dist/types/components/post-menu-item/post-menu-item.d.ts +3 -0
  364. package/dist/types/components/post-menu-trigger/post-menu-trigger.d.ts +28 -0
  365. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +23 -1
  366. package/dist/types/components/post-tab-header/post-tab-header.d.ts +1 -1
  367. package/dist/types/components/post-tabs/post-tabs.d.ts +1 -1
  368. package/dist/types/components/post-tag/post-tag.d.ts +1 -1
  369. package/dist/types/components/post-togglebutton/post-togglebutton.d.ts +15 -0
  370. package/dist/types/components.d.ts +609 -48
  371. package/dist/types/home/runner/work/design-system/design-system/packages/components/.stencil/.config/bindings.angular.d.ts +2 -0
  372. package/dist/types/index.d.ts +22 -3
  373. package/dist/types/utils/attribute-observer.d.ts +1 -1
  374. package/dist/types/utils/breakpoints.d.ts +12 -0
  375. package/dist/types/utils/component-on-ready.d.ts +1 -1
  376. package/dist/types/utils/get-focusable-children.d.ts +1 -0
  377. package/dist/types/utils/get-root.d.ts +1 -1
  378. package/dist/types/utils/property-checkers/check-non-empty.d.ts +3 -1
  379. package/dist/types/utils/property-checkers/check-one-of.d.ts +3 -1
  380. package/dist/types/utils/property-checkers/check-pattern.d.ts +3 -1
  381. package/dist/types/utils/property-checkers/check-type.d.ts +3 -1
  382. package/dist/types/utils/property-checkers/check-url.d.ts +3 -1
  383. package/dist/types/utils/property-checkers/index.d.ts +12 -4
  384. package/dist/types/utils/sass-export.d.ts +5 -1
  385. package/loaders/attribute-observer.js +4 -4
  386. package/loaders/check-non-empty.js +6 -2
  387. package/loaders/check-one-of.js +8 -3
  388. package/loaders/check-type.js +11 -6
  389. package/loaders/debounce.js +11 -0
  390. package/loaders/fade.js +6 -2
  391. package/loaders/get-focusable-children.js +35 -0
  392. package/loaders/get-root.js +9 -0
  393. package/loaders/index.browser.js +13 -0
  394. package/loaders/index.d.ts +40 -2
  395. package/loaders/index.js +21 -2
  396. package/loaders/index2.js +25 -12
  397. package/loaders/index3.js +135 -0
  398. package/loaders/package.js +1 -1
  399. package/loaders/post-accordion-item.js +1 -81
  400. package/loaders/post-accordion-item2.js +103 -0
  401. package/loaders/post-accordion.js +6 -5
  402. package/loaders/post-avatar.d.ts +11 -0
  403. package/loaders/post-avatar.js +172 -0
  404. package/loaders/post-back-to-top.d.ts +11 -0
  405. package/loaders/post-back-to-top.js +104 -0
  406. package/loaders/post-banner.d.ts +11 -0
  407. package/loaders/post-banner.js +134 -0
  408. package/loaders/post-breadcrumb-item.d.ts +11 -0
  409. package/loaders/post-breadcrumb-item.js +6 -0
  410. package/loaders/post-breadcrumb-item2.js +82 -0
  411. package/loaders/post-breadcrumb.d.ts +11 -0
  412. package/loaders/post-breadcrumb.js +172 -0
  413. package/loaders/post-card-control.js +50 -39
  414. package/loaders/post-closebutton.d.ts +11 -0
  415. package/loaders/post-closebutton.js +37 -0
  416. package/loaders/post-collapsible-trigger2.js +23 -38
  417. package/loaders/post-collapsible2.js +21 -13
  418. package/loaders/post-footer.d.ts +11 -0
  419. package/loaders/post-footer.js +131 -0
  420. package/loaders/post-header.d.ts +11 -0
  421. package/loaders/post-header.js +220 -0
  422. package/loaders/post-icon2.js +82 -46
  423. package/loaders/post-language-option.d.ts +11 -0
  424. package/loaders/post-language-option.js +105 -0
  425. package/loaders/post-language-switch.d.ts +11 -0
  426. package/loaders/post-language-switch.js +138 -0
  427. package/loaders/post-linkarea.d.ts +11 -0
  428. package/loaders/post-linkarea.js +45 -0
  429. package/loaders/post-list-item.d.ts +11 -0
  430. package/loaders/post-list-item.js +38 -0
  431. package/loaders/{post-alert.d.ts → post-list.d.ts} +4 -4
  432. package/loaders/post-list.js +58 -0
  433. package/loaders/post-logo.js +6 -6
  434. package/loaders/post-mainnavigation.d.ts +11 -0
  435. package/loaders/post-mainnavigation.js +261 -0
  436. package/loaders/post-megadropdown-trigger.d.ts +11 -0
  437. package/loaders/post-megadropdown-trigger.js +116 -0
  438. package/loaders/post-megadropdown.d.ts +11 -0
  439. package/loaders/post-megadropdown.js +189 -0
  440. package/loaders/post-menu-item.d.ts +11 -0
  441. package/loaders/post-menu-item.js +6 -0
  442. package/loaders/post-menu-item2.js +27 -0
  443. package/loaders/post-menu-trigger.d.ts +11 -0
  444. package/loaders/post-menu-trigger.js +6 -0
  445. package/loaders/post-menu-trigger2.js +109 -0
  446. package/loaders/post-menu.d.ts +11 -0
  447. package/loaders/post-menu.js +6 -0
  448. package/loaders/post-menu2.js +193 -0
  449. package/loaders/post-popover.js +6 -4
  450. package/loaders/post-popovercontainer2.js +227 -59
  451. package/loaders/post-rating.js +14 -4
  452. package/loaders/post-tab-header.js +7 -6
  453. package/loaders/post-tab-panel.js +4 -3
  454. package/loaders/post-tabs.js +20 -13
  455. package/loaders/post-tag.js +3 -3
  456. package/loaders/post-togglebutton.d.ts +11 -0
  457. package/loaders/post-togglebutton.js +64 -0
  458. package/loaders/post-tooltip.js +34 -21
  459. package/loaders/slide.js +25 -0
  460. package/package.json +26 -20
  461. package/dist/cjs/check-non-empty-eeaa8f77.js +0 -11
  462. package/dist/cjs/check-one-of-f4f5d0c0.js +0 -8
  463. package/dist/cjs/fade-35a3633a.js +0 -10
  464. package/dist/cjs/index-01f30442.js +0 -52
  465. package/dist/cjs/post-accordion-item-7b348fa5.js +0 -51
  466. package/dist/cjs/post-alert-fca3a4a3.js +0 -98
  467. package/dist/cjs/post-alert.cjs.entry.js +0 -16
  468. package/dist/cjs/post-card-control-b4e4b4d5.js +0 -272
  469. package/dist/cjs/post-icon-3934be0b.js +0 -104
  470. package/dist/cjs/post-icon.cjs.entry.js +0 -15
  471. package/dist/cjs/post-logo-c3603fc7.js +0 -39
  472. package/dist/cjs/post-logo.cjs.entry.js +0 -14
  473. package/dist/cjs/post-popover-15f9620a.js +0 -104
  474. package/dist/cjs/post-popovercontainer-7d536276.js +0 -2186
  475. package/dist/cjs/post-popovercontainer.cjs.entry.js +0 -11
  476. package/dist/cjs/post-tab-header-29b8d4e1.js +0 -32
  477. package/dist/cjs/post-tag-b7d0bbff.js +0 -47
  478. package/dist/collection/components/post-alert/alert-types.js +0 -1
  479. package/dist/collection/components/post-alert/post-alert.css +0 -7
  480. package/dist/components/post-alert.js +0 -6
  481. package/dist/components/post-alert2.js +0 -136
  482. package/dist/esm/check-non-empty-58bd6b17.js +0 -9
  483. package/dist/esm/check-one-of-6b3ef8eb.js +0 -6
  484. package/dist/esm/fade-7fd71785.js +0 -7
  485. package/dist/esm/index-f41b763f.js +0 -46
  486. package/dist/esm/package-3d758f77.js +0 -3
  487. package/dist/esm/post-accordion-item-6b5a65ad.js +0 -49
  488. package/dist/esm/post-alert-f19db551.js +0 -96
  489. package/dist/esm/post-alert.entry.js +0 -8
  490. package/dist/esm/post-card-control-1b5df6cb.js +0 -270
  491. package/dist/esm/post-icon-40929043.js +0 -102
  492. package/dist/esm/post-icon.entry.js +0 -7
  493. package/dist/esm/post-logo-c6351ba8.js +0 -37
  494. package/dist/esm/post-logo.entry.js +0 -6
  495. package/dist/esm/post-popover-58149de7.js +0 -102
  496. package/dist/esm/post-popovercontainer-8bde9fc3.js +0 -2184
  497. package/dist/esm/post-popovercontainer.entry.js +0 -3
  498. package/dist/esm/post-tab-header-ae8feb19.js +0 -30
  499. package/dist/esm/post-tag-887d5fbe.js +0 -45
  500. package/dist/post-components/p-0b71bf5a.js +0 -1
  501. package/dist/post-components/p-0e09dc41.js +0 -1
  502. package/dist/post-components/p-19e54be9.js +0 -1
  503. package/dist/post-components/p-1e8f0f36.js +0 -1
  504. package/dist/post-components/p-22257eff.entry.js +0 -1
  505. package/dist/post-components/p-249ac168.entry.js +0 -1
  506. package/dist/post-components/p-2737eaf5.js +0 -1
  507. package/dist/post-components/p-2b10e265.js +0 -1
  508. package/dist/post-components/p-3325086e.js +0 -1
  509. package/dist/post-components/p-3b823fee.entry.js +0 -1
  510. package/dist/post-components/p-45f4c803.entry.js +0 -1
  511. package/dist/post-components/p-47935dbb.js +0 -1
  512. package/dist/post-components/p-486fbbce.entry.js +0 -1
  513. package/dist/post-components/p-4a7fb0f3.entry.js +0 -1
  514. package/dist/post-components/p-5f231c2c.js +0 -1
  515. package/dist/post-components/p-611b3c41.js +0 -1
  516. package/dist/post-components/p-6a28f8b9.js +0 -1
  517. package/dist/post-components/p-6adeaa6c.js +0 -1
  518. package/dist/post-components/p-6ed3497a.entry.js +0 -1
  519. package/dist/post-components/p-820c5c19.entry.js +0 -1
  520. package/dist/post-components/p-8aeb549f.entry.js +0 -1
  521. package/dist/post-components/p-92aeec3c.js +0 -1
  522. package/dist/post-components/p-9a99cfc7.js +0 -1
  523. package/dist/post-components/p-aa8a08dc.entry.js +0 -1
  524. package/dist/post-components/p-b095519d.js +0 -1
  525. package/dist/post-components/p-b99fdec3.js +0 -1
  526. package/dist/post-components/p-ba40b28a.entry.js +0 -1
  527. package/dist/post-components/p-c62de925.js +0 -1
  528. package/dist/post-components/p-d2101b8a.entry.js +0 -1
  529. package/dist/post-components/p-d2f9de94.js +0 -2
  530. package/dist/post-components/p-d7a44f45.js +0 -1
  531. package/dist/post-components/p-db4b8ea1.entry.js +0 -1
  532. package/dist/post-components/p-deb4131c.js +0 -1
  533. package/dist/post-components/p-eedc6ae8.entry.js +0 -1
  534. package/dist/post-components/p-f217f420.js +0 -1
  535. package/dist/post-components/p-f707d163.entry.js +0 -1
  536. package/dist/types/components/post-alert/alert-types.d.ts +0 -2
  537. package/dist/types/components/post-alert/post-alert.d.ts +0 -54
  538. package/loaders/post-alert.js +0 -139
@@ -0,0 +1,267 @@
1
+ import { h, Host, } from "@stencil/core";
2
+ import { throttle } from "throttle-debounce";
3
+ import { version } from "../../../../package";
4
+ import { slideDown, slideUp } from "../../animations/slide";
5
+ import { getFocusableChildren } from "../../utils/get-focusable-children";
6
+ /**
7
+ * @slot post-logo - Should be used together with the `<post-logo>` component.
8
+ * @slot meta-navigation - Holds an `<ul>` with meta navigation links.
9
+ * @slot post-togglebutton - Holds the mobile menu toggler.
10
+ * @slot post-language-switch - Should be used with the `<post-language-switch>` component.
11
+ * @slot title - Holds the application title.
12
+ * @slot default - Custom controls or content, right aligned in the local header.
13
+ * @slot post-mainnavigation - Has a default slot because it's only meant to be used in the `<post-header>`.
14
+ */
15
+ export class PostHeader {
16
+ constructor() {
17
+ this.device = null;
18
+ this.mobileMenuExtended = false;
19
+ }
20
+ firstFocusableEl;
21
+ lastFocusableEl;
22
+ scrollParent = null;
23
+ mobileMenu;
24
+ mobileMenuAnimation;
25
+ throttledScroll = () => this.handleScrollEvent();
26
+ throttledResize = throttle(50, () => this.handleResize());
27
+ componentWillRender() {
28
+ this.scrollParent = this.getScrollParent(this.host);
29
+ this.scrollParent.addEventListener('scroll', this.throttledScroll, { passive: true });
30
+ window.addEventListener('resize', this.throttledResize, { passive: true });
31
+ this.handleResize();
32
+ this.handleScrollEvent();
33
+ this.getFocusableElements();
34
+ }
35
+ componentDidLoad() {
36
+ this.updateLocalHeaderHeight();
37
+ }
38
+ // Clean up possible side effects when post-header is disconnected
39
+ disconnectedCallback() {
40
+ this.mobileMenuExtended = false;
41
+ document.body.style.overflow = '';
42
+ this.host.removeEventListener('keydown', e => {
43
+ this.keyboardHandler(e);
44
+ });
45
+ }
46
+ host;
47
+ frozeBody(isMobileMenuExtended) {
48
+ document.body.style.overflow = isMobileMenuExtended ? 'hidden' : '';
49
+ if (isMobileMenuExtended) {
50
+ this.host.addEventListener('keydown', e => {
51
+ this.keyboardHandler(e);
52
+ });
53
+ }
54
+ else {
55
+ this.host.removeEventListener('keydown', e => {
56
+ this.keyboardHandler(e);
57
+ });
58
+ }
59
+ }
60
+ /**
61
+ * An event emitted when the device has changed
62
+ */
63
+ postUpdateDevice;
64
+ /**
65
+ * Toggles the mobile navigation.
66
+ */
67
+ async toggleMobileMenu() {
68
+ if (this.device === 'desktop')
69
+ return;
70
+ this.mobileMenuAnimation = this.mobileMenuExtended
71
+ ? slideUp(this.mobileMenu)
72
+ : slideDown(this.mobileMenu);
73
+ // Update the state of the toggle button
74
+ const menuButton = this.host.querySelector('post-togglebutton');
75
+ menuButton.toggled = !this.mobileMenuExtended;
76
+ // Toggle menu visibility before it slides down and after it slides back up
77
+ if (this.mobileMenuExtended)
78
+ await this.mobileMenuAnimation.finished;
79
+ this.mobileMenuExtended = !this.mobileMenuExtended;
80
+ if (!this.mobileMenuExtended)
81
+ await this.mobileMenuAnimation.finished;
82
+ }
83
+ // Get all the focusable elements in the post-header mobile menu
84
+ getFocusableElements() {
85
+ // Get elements in the correct order (different as the DOM order)
86
+ const focusableEls = [
87
+ ...Array.from(this.host.querySelectorAll('.list-inline:not([slot="meta-navigation"]) > li')),
88
+ ...Array.from(this.host.querySelectorAll('nav > post-list > div > post-list-item, post-mainnavigation > .back-button, post-megadropdown-trigger')),
89
+ ...Array.from(this.host.querySelectorAll('.list-inline[slot="meta-navigation"] > li, post-language-option')),
90
+ ];
91
+ // Add the main toggle menu button to the list of focusable children
92
+ const focusableChildren = [
93
+ this.host.querySelector('post-togglebutton'),
94
+ ...focusableEls.flatMap(el => Array.from(getFocusableChildren(el))),
95
+ ];
96
+ this.firstFocusableEl = focusableChildren[0];
97
+ this.lastFocusableEl = focusableChildren[focusableChildren.length - 1];
98
+ }
99
+ keyboardHandler(e) {
100
+ if (e.key === 'Tab' && this.mobileMenuExtended) {
101
+ if (e.shiftKey && document.activeElement === this.firstFocusableEl) {
102
+ // If back tab (Tab + Shift) and first element is focused, focus goes to the last element of the megadropdown
103
+ e.preventDefault();
104
+ this.lastFocusableEl.focus();
105
+ }
106
+ else if (!e.shiftKey && document.activeElement === this.lastFocusableEl) {
107
+ // If Tab and last element is focused, focus goes back to the first element of the megadropdown
108
+ e.preventDefault();
109
+ this.firstFocusableEl.focus();
110
+ }
111
+ }
112
+ }
113
+ handleScrollEvent() {
114
+ // Credits: "https://github.com/qeremy/so/blob/master/so.dom.js#L426"
115
+ const st = Math.max(0, this.scrollParent instanceof Document
116
+ ? this.scrollParent.documentElement.scrollTop
117
+ : this.scrollParent.scrollTop);
118
+ this.host.style.setProperty('--header-scroll-top', `${st}px`);
119
+ }
120
+ getScrollParent(node) {
121
+ let currentParent = node.parentElement;
122
+ while (currentParent) {
123
+ if (currentParent.nodeName === 'BODY') {
124
+ return document;
125
+ }
126
+ if (this.isScrollable(currentParent)) {
127
+ return currentParent;
128
+ }
129
+ currentParent = currentParent.parentElement;
130
+ }
131
+ return document;
132
+ }
133
+ isScrollable(node) {
134
+ if (!(node instanceof HTMLElement || node instanceof SVGElement)) {
135
+ return false;
136
+ }
137
+ const style = getComputedStyle(node);
138
+ return ['overflow', 'overflow-x', 'overflow-y'].some(propertyName => {
139
+ const value = style.getPropertyValue(propertyName);
140
+ return value === 'auto' || value === 'scroll';
141
+ });
142
+ }
143
+ updateLocalHeaderHeight() {
144
+ requestAnimationFrame(() => {
145
+ const mhh = this.host.shadowRoot.querySelector('.local-header')?.clientHeight || 0;
146
+ this.host.style.setProperty('--local-header-height', `${mhh}px`);
147
+ });
148
+ }
149
+ handleResize() {
150
+ const previousDevice = this.device;
151
+ let newDevice;
152
+ const width = window?.innerWidth;
153
+ if (width >= 1024) {
154
+ newDevice = 'desktop';
155
+ }
156
+ else if (width >= 600) {
157
+ newDevice = 'tablet';
158
+ }
159
+ else {
160
+ newDevice = 'mobile';
161
+ }
162
+ // Close any open mobile menu
163
+ if (newDevice === 'desktop' && this.mobileMenuExtended) {
164
+ this.toggleMobileMenu();
165
+ this.mobileMenuAnimation.finish(); // no animation
166
+ }
167
+ this.updateLocalHeaderHeight();
168
+ // Apply only on change for doing work only when necessary
169
+ if (newDevice !== previousDevice) {
170
+ this.device = newDevice;
171
+ this.postUpdateDevice.emit(this.device);
172
+ window.requestAnimationFrame(() => {
173
+ this.switchLanguageSwitchMode();
174
+ });
175
+ }
176
+ }
177
+ switchLanguageSwitchMode() {
178
+ const variant = this.device === 'desktop' ? 'menu' : 'list';
179
+ Array.from(this.host.querySelectorAll('post-language-switch')).forEach(languageSwitch => {
180
+ languageSwitch?.setAttribute('variant', variant);
181
+ });
182
+ }
183
+ renderNavigation() {
184
+ const navigationClasses = ['navigation'];
185
+ if (this.mobileMenuExtended) {
186
+ navigationClasses.push('extended');
187
+ }
188
+ return (h("div", { ref: el => (this.mobileMenu = el), class: navigationClasses.join(' ') }, h("slot", { name: "post-mainnavigation" }), (this.device === 'mobile' || this.device === 'tablet') && (h("div", { class: "navigation-footer" }, h("slot", { name: "meta-navigation" }), h("slot", { name: "post-language-switch" })))));
189
+ }
190
+ render() {
191
+ return (h(Host, { key: '45452d2c2f6ac9a067ce71330ea898a797040cca', version: version }, h("div", { key: 'c50478141de45d0a718b18c0edc416eb9c832fde', class: "global-header" }, h("div", { key: 'a2ddc2de9a94fb3b16928fe9c1ac3b3ae61ff9bf', class: "global-sub" }, h("div", { key: '30083683ff7683202118471473f2a0ed98a1c920', class: "logo" }, h("slot", { key: '028bd4a8f03a228378b09a80dce8654d52c30e5c', name: "post-logo" }))), h("div", { key: '853bcf2e6c8a95d88f62795cef8d8e58c8996811', class: "global-sub" }, this.device === 'desktop' && h("slot", { key: '40e3027a4e4358b7a614558ed7e1f59fa65ed312', name: "meta-navigation" }), h("slot", { key: '31c141cc45aa12441557d9b817630328df3d3778', name: "global-controls" }), this.device === 'desktop' && h("slot", { key: 'afe4b2c3123a89c1a4390578c22e89dfff7be655', name: "post-language-switch" }), h("div", { key: 'aea74d0c7f25288afa18b5aeb3e557216d695ec3', onClick: () => this.toggleMobileMenu(), class: "mobile-toggle" }, h("slot", { key: '1efed8b7c823ef49b89120ed2e23f151c64b9c0e', name: "post-togglebutton" })))), h("div", { key: 'e09df2136d01c0516d0166f505055615cf1d70d3', class: 'local-header ' + (this.mobileMenuExtended ? 'local-header-mobile-extended' : '') }, h("slot", { key: '491f9bbcb2743519f544b24ae6f00405be85e589', name: "title" }), h("div", { key: 'e85c0a76597832a6966e989111b4508579fb9c4d', class: "local-sub" }, h("slot", { key: 'f2d504ea6a3d7592a15551e6be8cb0c1ba220fbc', name: "local-controls" }), h("slot", { key: 'e0dd0f9c12e0c6bf5d5d66cb29139af59f7c0b4d' })), this.device === 'desktop' && this.renderNavigation()), this.device !== 'desktop' && this.renderNavigation()));
192
+ }
193
+ static get is() { return "post-header"; }
194
+ static get encapsulation() { return "shadow"; }
195
+ static get originalStyleUrls() {
196
+ return {
197
+ "$": ["./post-header.scss"]
198
+ };
199
+ }
200
+ static get styleUrls() {
201
+ return {
202
+ "$": ["post-header.css"]
203
+ };
204
+ }
205
+ static get states() {
206
+ return {
207
+ "device": {},
208
+ "mobileMenuExtended": {}
209
+ };
210
+ }
211
+ static get events() {
212
+ return [{
213
+ "method": "postUpdateDevice",
214
+ "name": "postUpdateDevice",
215
+ "bubbles": true,
216
+ "cancelable": true,
217
+ "composed": true,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "An event emitted when the device has changed"
221
+ },
222
+ "complexType": {
223
+ "original": "DEVICE_SIZE",
224
+ "resolved": "\"desktop\" | \"mobile\" | \"tablet\"",
225
+ "references": {
226
+ "DEVICE_SIZE": {
227
+ "location": "local",
228
+ "path": "/home/runner/work/design-system/design-system/packages/components/src/components/post-header/post-header.tsx",
229
+ "id": "src/components/post-header/post-header.tsx::DEVICE_SIZE"
230
+ }
231
+ }
232
+ }
233
+ }];
234
+ }
235
+ static get methods() {
236
+ return {
237
+ "toggleMobileMenu": {
238
+ "complexType": {
239
+ "signature": "() => Promise<void>",
240
+ "parameters": [],
241
+ "references": {
242
+ "Promise": {
243
+ "location": "global",
244
+ "id": "global::Promise"
245
+ },
246
+ "HTMLPostTogglebuttonElement": {
247
+ "location": "global",
248
+ "id": "global::HTMLPostTogglebuttonElement"
249
+ }
250
+ },
251
+ "return": "Promise<void>"
252
+ },
253
+ "docs": {
254
+ "text": "Toggles the mobile navigation.",
255
+ "tags": []
256
+ }
257
+ }
258
+ };
259
+ }
260
+ static get elementRef() { return "host"; }
261
+ static get watchers() {
262
+ return [{
263
+ "propName": "mobileMenuExtended",
264
+ "methodName": "frozeBody"
265
+ }];
266
+ }
267
+ }
@@ -1,7 +1,7 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import { checkNonEmpty, checkType, checkEmptyOrType, checkEmptyOrOneOf } from "../../utils/index";
3
3
  import { version } from "../../../../package";
4
- const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';
4
+ const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons/';
5
5
  const ANIMATION_NAMES = [
6
6
  'cylon',
7
7
  'cylon-vertical',
@@ -16,8 +16,6 @@ const ANIMATION_KEYS = [...ANIMATION_NAMES];
16
16
  */
17
17
  export class PostIcon {
18
18
  constructor() {
19
- this.svgStyles = undefined;
20
- this.svgOutput = undefined;
21
19
  this.animation = null;
22
20
  this.base = null;
23
21
  this.flipH = false;
@@ -26,30 +24,93 @@ export class PostIcon {
26
24
  this.rotate = null;
27
25
  this.scale = null;
28
26
  }
27
+ isSSR = typeof window === 'undefined';
28
+ host;
29
29
  validateAnimation(newValue = this.animation) {
30
30
  if (newValue !== undefined)
31
- checkEmptyOrOneOf(newValue, ANIMATION_KEYS, `The post-icon "animation" prop requires one of the following values: ${ANIMATION_KEYS.join(', ')}.`);
31
+ checkEmptyOrOneOf(this, 'animation', ANIMATION_KEYS);
32
32
  }
33
- validateBase(newValue = this.base) {
34
- checkEmptyOrType(newValue, 'string', 'The post-icon "base" prop should be a string.');
33
+ validateBase() {
34
+ checkEmptyOrType(this, 'base', 'string');
35
35
  }
36
- validateFlipH(newValue = this.flipH) {
37
- checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipH" prop should be a boolean.');
36
+ validateFlipH() {
37
+ checkEmptyOrType(this, 'flipH', 'boolean');
38
38
  }
39
- validateFlipV(newValue = this.flipV) {
40
- checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipV" prop should be a boolean.');
39
+ validateFlipV() {
40
+ checkEmptyOrType(this, 'flipV', 'boolean');
41
41
  }
42
- validateName(newValue = this.name) {
43
- checkNonEmpty(newValue, 'The post-icon "name" prop is required!.');
44
- checkType(newValue, 'string', 'The post-icon "name" prop should be a string.');
42
+ validateName() {
43
+ checkNonEmpty(this, 'name');
44
+ checkType(this, 'name', 'string');
45
45
  }
46
- validateRotate(newValue = this.rotate) {
47
- checkEmptyOrType(newValue, 'number', 'The post-icon "rotate" prop should be a number.');
46
+ validateRotate() {
47
+ checkEmptyOrType(this, 'rotate', 'number');
48
48
  }
49
- validateScale(newValue = this.scale) {
50
- checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
49
+ validateScale() {
50
+ checkEmptyOrType(this, 'scale', 'number');
51
51
  }
52
- componentWillLoad() {
52
+ // Construct the icon url from different possible sources
53
+ getUrl() {
54
+ let url;
55
+ const file = `${this.name}.svg`;
56
+ // the first definition object which defines a domain, will be used to set the domain of the file url
57
+ // the first definition object which defines a slug, will be used to set the slug of the file url
58
+ const urlDefinitions = [this.getUrlDefinition(this.base, 'both')];
59
+ if (!this.isSSR) {
60
+ urlDefinitions.push(this.getUrlDefinition(document.head
61
+ .querySelector('meta[name="design-system-settings"][data-post-icon-base]')
62
+ ?.getAttribute('data-post-icon-base'), 'relative'));
63
+ urlDefinitions.push(this.getUrlDefinition(document.querySelector('base[href]')?.getAttribute('href'), 'both'));
64
+ }
65
+ // in case no definition defines a domain, a relative url is used to load the icon
66
+ const origin = urlDefinitions.find(d => d.definesDomain)?.url?.origin;
67
+ // in case no definition defines a slug either, the cdn url is used as a fallback
68
+ const slug = urlDefinitions.find(d => d.definesSlug)?.url?.pathname;
69
+ if (origin && slug) {
70
+ url = `${origin}${slug}${file}`;
71
+ }
72
+ else if (!origin && slug) {
73
+ url = `${slug}${file}`;
74
+ }
75
+ else {
76
+ url = `${CDN_URL}${file}`;
77
+ }
78
+ return url;
79
+ }
80
+ getUrlDefinition(url, allow) {
81
+ return {
82
+ url: this.getUrlObject(url),
83
+ definesDomain: allow !== 'relative' ? this.definesDomain(url) : false,
84
+ definesSlug: allow !== 'absolute' ? this.definesSlug(url) : false,
85
+ };
86
+ }
87
+ getUrlObject(url) {
88
+ if (url) {
89
+ url = url?.endsWith('/') ? url : `${url}/`;
90
+ return new URL(url, 'https://url.base');
91
+ }
92
+ else {
93
+ return null;
94
+ }
95
+ }
96
+ definesDomain(url) {
97
+ return url ? /^https?:\/\//.test(url) : false;
98
+ }
99
+ definesSlug(url) {
100
+ return Boolean(/^\/.+/.test(this.getUrlObject(url)?.pathname));
101
+ }
102
+ getStyles() {
103
+ const url = this.getUrl();
104
+ return Object.entries({
105
+ '-webkit-mask-image': `url(${url})`,
106
+ 'mask-image': `url('${url}')`,
107
+ 'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
108
+ (this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
109
+ })
110
+ .filter(([_key, value]) => value !== null)
111
+ .reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
112
+ }
113
+ componentDidLoad() {
53
114
  this.validateBase();
54
115
  this.validateName();
55
116
  this.validateFlipH();
@@ -58,30 +119,8 @@ export class PostIcon {
58
119
  this.validateRotate();
59
120
  this.validateAnimation();
60
121
  }
61
- componentWillRender() {
62
- this.setPath();
63
- }
64
- setPath() {
65
- var _a, _b, _c, _d;
66
- // Construct icon path from different possible sources
67
- const metaBase = (_b = (_a = document.head
68
- .querySelector('meta[name="design-system-settings"][data-post-icon-base]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-post-icon-base')) !== null && _b !== void 0 ? _b : null;
69
- const fileBase = `${(_d = (_c = this.base) !== null && _c !== void 0 ? _c : metaBase) !== null && _d !== void 0 ? _d : CDN_URL}/`.replace(/\/\/$/, '/');
70
- const fileName = `${this.name}.svg`;
71
- const filePath = `${fileBase}${fileName}`;
72
- this.path = new URL(filePath, window.location.origin).toString();
73
- }
74
122
  render() {
75
- // create inline styles for some properties
76
- const svgStyles = Object.entries({
77
- '-webkit-mask-image': `url('${this.path}')`,
78
- 'mask-image': `url('${this.path}')`,
79
- 'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
80
- (this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
81
- })
82
- .filter(([_key, value]) => value !== null)
83
- .reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
84
- return (h(Host, { key: '95fa0f7a09d3430bb5d621e01b57188742920eb4', "data-version": version }, h("span", { key: 'c824e3705dc83665bb6f7649381654e6d1e07dfb', style: svgStyles })));
123
+ return (h(Host, { key: 'c80aaf693f730902c4ae57ca78360eee5dedf624', "data-version": version }, h("span", { key: '7e01e1cf7e4fec380e8f054d3cc8fa5404c7a829', style: this.getStyles() })));
85
124
  }
86
125
  static get is() { return "post-icon"; }
87
126
  static get encapsulation() { return "shadow"; }
@@ -229,12 +268,6 @@ export class PostIcon {
229
268
  }
230
269
  };
231
270
  }
232
- static get states() {
233
- return {
234
- "svgStyles": {},
235
- "svgOutput": {}
236
- };
237
- }
238
271
  static get elementRef() { return "host"; }
239
272
  static get watchers() {
240
273
  return [{
@@ -0,0 +1,3 @@
1
+ /*!
2
+ * Copyright 2021 by Swiss Post, Information Technology
3
+ */post-language-option{display:inline-block}post-language-option button{padding:0;overflow:visible;border:0;background:none;color:var(--post-scheme-color-interactive-button-secondary-enabled-fg);font:inherit;-webkit-user-select:none;user-select:none;appearance:button}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option button{background-color:ButtonFace !important}post-language-option button:hover{background-color:Highlight !important}}post-language-option a{color:inherit;text-decoration:none}post-language-option :is(a,button){cursor:pointer;display:flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:2px;text-transform:uppercase}post-language-option :is(a,button){outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important}@media(forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){post-language-option :is(a,button):is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}post-language-option:where([variant=list]) :is(a,button){padding-inline:0;width:40px;height:40px;border-radius:2px}post-language-option:where([variant=list]) :is(a,button):hover{color:#504f4b}post-language-option:where([variant=list]):not([active=false]) :is(a,button){background-color:#050400 !important;color:#fff;pointer-events:none}post-language-option:where([variant=list]):not([active=false]) :hover{color:#fff}post-language-option:where([variant=menu]){width:100%}post-language-option:where([variant=menu]):not([active=false]){display:none}post-language-option:where([variant=menu]) :is(a,button){padding-block:13px;padding-inline:24px;box-sizing:border-box;position:relative;width:100%}post-language-option:where([variant=menu]) :is(a,button):hover{color:#fff;background-color:#504f4b}
@@ -0,0 +1,224 @@
1
+ import { Host, h, } from "@stencil/core";
2
+ import { checkEmptyOrType, checkType } from "../../utils/index";
3
+ import { version } from "../../../../package";
4
+ /**
5
+ * @slot default - Slot for placing the content inside the anchor or button.
6
+ */
7
+ export class PostLanguageOption {
8
+ constructor() {
9
+ this.code = undefined;
10
+ this.active = undefined;
11
+ this.variant = undefined;
12
+ this.name = undefined;
13
+ this.url = undefined;
14
+ }
15
+ host;
16
+ validateCode() {
17
+ checkType(this, 'code', 'string');
18
+ }
19
+ validateActiveProp() {
20
+ checkEmptyOrType(this, 'active', 'boolean');
21
+ }
22
+ validateName() {
23
+ checkEmptyOrType(this, 'name', 'string');
24
+ }
25
+ validateUrl() {
26
+ checkEmptyOrType(this, 'url', 'string');
27
+ }
28
+ componentDidLoad() {
29
+ this.validateCode();
30
+ this.validateActiveProp();
31
+ this.validateName();
32
+ this.validateUrl();
33
+ if (!this.name && this.isNameRequired()) {
34
+ throw new Error('The "name" property of the post-language-option component is required when the full language name is not displayed.');
35
+ }
36
+ }
37
+ /**
38
+ * An event emitted when the language option is clicked. The payload is the ISO 639 code of the language.
39
+ */
40
+ postChange;
41
+ /**
42
+ * Selects the language option programmatically.
43
+ */
44
+ async select() {
45
+ this.active = true;
46
+ this.emitChange();
47
+ }
48
+ emitChange() {
49
+ this.postChange.emit(this.code);
50
+ }
51
+ isNameRequired() {
52
+ return this.host.textContent.toLowerCase() === this.code.toLowerCase();
53
+ }
54
+ render() {
55
+ const lang = this.code.toLowerCase();
56
+ const emitOnKeyDown = (e) => {
57
+ if (e.key === 'Enter' || e.key === ' ') {
58
+ this.emitChange();
59
+ }
60
+ };
61
+ return (h(Host, { key: 'f987cfc18bb86866781e0668516e86f89be6241b', "data-version": version, role: this.variant ? `${this.variant}item` : null }, this.url ? (h("a", { "aria-current": this.active ? 'page' : undefined, "aria-label": this.name, href: this.url, hrefLang: lang, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null))) : (h("button", { "aria-current": this.active ? 'true' : undefined, "aria-label": this.name, lang: lang, onClick: () => this.emitChange(), onKeyDown: emitOnKeyDown }, h("slot", null)))));
62
+ }
63
+ static get is() { return "post-language-option"; }
64
+ static get originalStyleUrls() {
65
+ return {
66
+ "$": ["post-language-option.scss"]
67
+ };
68
+ }
69
+ static get styleUrls() {
70
+ return {
71
+ "$": ["post-language-option.css"]
72
+ };
73
+ }
74
+ static get properties() {
75
+ return {
76
+ "code": {
77
+ "type": "string",
78
+ "mutable": false,
79
+ "complexType": {
80
+ "original": "string",
81
+ "resolved": "string",
82
+ "references": {}
83
+ },
84
+ "required": true,
85
+ "optional": false,
86
+ "docs": {
87
+ "tags": [],
88
+ "text": "The ISO 639 language code, formatted according to [RFC 5646 (also known as BCP 47)](https://datatracker.ietf.org/doc/html/rfc5646). For example, \"de\"."
89
+ },
90
+ "attribute": "code",
91
+ "reflect": false
92
+ },
93
+ "active": {
94
+ "type": "boolean",
95
+ "mutable": true,
96
+ "complexType": {
97
+ "original": "boolean",
98
+ "resolved": "boolean",
99
+ "references": {}
100
+ },
101
+ "required": false,
102
+ "optional": false,
103
+ "docs": {
104
+ "tags": [],
105
+ "text": "If set to `true`, the language option is considered the current language for the page."
106
+ },
107
+ "attribute": "active",
108
+ "reflect": true
109
+ },
110
+ "variant": {
111
+ "type": "string",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "SwitchVariant | null",
115
+ "resolved": "\"list\" | \"menu\"",
116
+ "references": {
117
+ "SwitchVariant": {
118
+ "location": "import",
119
+ "path": "../post-language-switch/switch-variants",
120
+ "id": "src/components/post-language-switch/switch-variants.ts::SwitchVariant"
121
+ }
122
+ }
123
+ },
124
+ "required": false,
125
+ "optional": true,
126
+ "docs": {
127
+ "tags": [],
128
+ "text": "To communicate the variant prop from the parent (post-language-switch) component to the child (post-language-option) component. See parent docs for a description about the property itself."
129
+ },
130
+ "attribute": "variant",
131
+ "reflect": false
132
+ },
133
+ "name": {
134
+ "type": "string",
135
+ "mutable": false,
136
+ "complexType": {
137
+ "original": "string",
138
+ "resolved": "string",
139
+ "references": {}
140
+ },
141
+ "required": false,
142
+ "optional": false,
143
+ "docs": {
144
+ "tags": [],
145
+ "text": "The full name of the language. For example, \"Deutsch\"."
146
+ },
147
+ "attribute": "name",
148
+ "reflect": false
149
+ },
150
+ "url": {
151
+ "type": "string",
152
+ "mutable": false,
153
+ "complexType": {
154
+ "original": "string",
155
+ "resolved": "string",
156
+ "references": {}
157
+ },
158
+ "required": false,
159
+ "optional": false,
160
+ "docs": {
161
+ "tags": [],
162
+ "text": "The URL used for the href attribute of the internal anchor.\nThis field is optional; if not provided, a button will be used internally instead of an anchor."
163
+ },
164
+ "attribute": "url",
165
+ "reflect": false
166
+ }
167
+ };
168
+ }
169
+ static get events() {
170
+ return [{
171
+ "method": "postChange",
172
+ "name": "postChange",
173
+ "bubbles": true,
174
+ "cancelable": true,
175
+ "composed": true,
176
+ "docs": {
177
+ "tags": [],
178
+ "text": "An event emitted when the language option is clicked. The payload is the ISO 639 code of the language."
179
+ },
180
+ "complexType": {
181
+ "original": "string",
182
+ "resolved": "string",
183
+ "references": {}
184
+ }
185
+ }];
186
+ }
187
+ static get methods() {
188
+ return {
189
+ "select": {
190
+ "complexType": {
191
+ "signature": "() => Promise<void>",
192
+ "parameters": [],
193
+ "references": {
194
+ "Promise": {
195
+ "location": "global",
196
+ "id": "global::Promise"
197
+ }
198
+ },
199
+ "return": "Promise<void>"
200
+ },
201
+ "docs": {
202
+ "text": "Selects the language option programmatically.",
203
+ "tags": []
204
+ }
205
+ }
206
+ };
207
+ }
208
+ static get elementRef() { return "host"; }
209
+ static get watchers() {
210
+ return [{
211
+ "propName": "code",
212
+ "methodName": "validateCode"
213
+ }, {
214
+ "propName": "active",
215
+ "methodName": "validateActiveProp"
216
+ }, {
217
+ "propName": "name",
218
+ "methodName": "validateName"
219
+ }, {
220
+ "propName": "url",
221
+ "methodName": "validateUrl"
222
+ }];
223
+ }
224
+ }