@swisspost/design-system-components 1.3.10 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/cjs/check-non-empty-35b4d0b5.js +14 -0
  2. package/dist/cjs/check-non-empty-35b4d0b5.js.map +1 -0
  3. package/dist/cjs/check-one-of-4c2e8b2e.js +10 -0
  4. package/dist/cjs/check-one-of-4c2e8b2e.js.map +1 -0
  5. package/dist/cjs/{package-f6bb523d.js → check-type-508a21a5.js} +1 -10
  6. package/dist/cjs/check-type-508a21a5.js.map +1 -0
  7. package/dist/cjs/fade-8c6d4fa7.js +12 -0
  8. package/dist/cjs/fade-8c6d4fa7.js.map +1 -0
  9. package/dist/cjs/{index-272283b3.js → index-12cc37c9.js} +121 -5
  10. package/dist/{post-components/p-0096c140.js.map → cjs/index-12cc37c9.js.map} +1 -1
  11. package/dist/cjs/index-f8f6f146.js +28 -0
  12. package/dist/cjs/index-f8f6f146.js.map +1 -0
  13. package/dist/cjs/loader.cjs.js +2 -2
  14. package/dist/cjs/package-67091813.js +7 -0
  15. package/dist/cjs/package-67091813.js.map +1 -0
  16. package/dist/cjs/post-alert.cjs.entry.js +106 -0
  17. package/dist/cjs/post-alert.cjs.entry.js.map +1 -0
  18. package/dist/cjs/post-collapsible.cjs.entry.js +6 -4
  19. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
  20. package/dist/cjs/post-components.cjs.js +2 -2
  21. package/dist/cjs/post-icon.cjs.entry.js +14 -29
  22. package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
  23. package/dist/cjs/post-tab-header.cjs.entry.js +35 -0
  24. package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -0
  25. package/dist/cjs/post-tab-panel.cjs.entry.js +29 -0
  26. package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -0
  27. package/dist/cjs/post-tabs.cjs.entry.js +136 -0
  28. package/dist/cjs/post-tabs.cjs.entry.js.map +1 -0
  29. package/dist/cjs/post-tooltip.cjs.entry.js +5097 -0
  30. package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -0
  31. package/dist/collection/animations/fade.js +6 -0
  32. package/dist/collection/animations/fade.js.map +1 -0
  33. package/dist/collection/animations/index.js +2 -0
  34. package/dist/collection/animations/index.js.map +1 -0
  35. package/dist/collection/collection-manifest.json +6 -1
  36. package/dist/collection/components/post-alert/alert-types.js +2 -0
  37. package/dist/collection/components/post-alert/alert-types.js.map +1 -0
  38. package/dist/collection/components/post-alert/post-alert.css +563 -0
  39. package/dist/collection/components/post-alert/post-alert.js +256 -0
  40. package/dist/collection/components/post-alert/post-alert.js.map +1 -0
  41. package/dist/collection/components/post-collapsible/post-collapsible.css +7 -0
  42. package/dist/collection/components/post-tab-header/post-tab-header.css +337 -0
  43. package/dist/collection/components/post-tab-header/post-tab-header.js +68 -0
  44. package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -0
  45. package/dist/collection/components/post-tab-panel/post-tab-panel.css +3 -0
  46. package/dist/collection/components/post-tab-panel/post-tab-panel.js +55 -0
  47. package/dist/collection/components/post-tab-panel/post-tab-panel.js.map +1 -0
  48. package/dist/collection/components/post-tabs/post-tabs.css +148 -0
  49. package/dist/collection/components/post-tabs/post-tabs.js +208 -0
  50. package/dist/collection/components/post-tabs/post-tabs.js.map +1 -0
  51. package/dist/collection/components/post-tooltip/post-tooltip.css +194 -0
  52. package/dist/collection/components/post-tooltip/post-tooltip.js +338 -0
  53. package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -0
  54. package/dist/collection/components/post-tooltip/types.js +2 -0
  55. package/dist/collection/components/post-tooltip/types.js.map +1 -0
  56. package/dist/collection/utils/property-checkers/check-one-of.js.map +1 -1
  57. package/dist/collection/utils/property-checkers/check-pattern.js +5 -0
  58. package/dist/collection/utils/property-checkers/check-pattern.js.map +1 -0
  59. package/dist/collection/utils/property-checkers/index.js +3 -0
  60. package/dist/collection/utils/property-checkers/index.js.map +1 -1
  61. package/dist/components/check-non-empty.js +11 -0
  62. package/dist/components/check-non-empty.js.map +1 -0
  63. package/dist/components/check-one-of.js +8 -0
  64. package/dist/components/check-one-of.js.map +1 -0
  65. package/dist/{esm/package-bcf00737.js → components/check-type.js} +2 -9
  66. package/dist/components/check-type.js.map +1 -0
  67. package/dist/components/fade.js +9 -0
  68. package/dist/components/fade.js.map +1 -0
  69. package/dist/components/package.js +2 -20
  70. package/dist/components/package.js.map +1 -1
  71. package/dist/components/post-alert.d.ts +11 -0
  72. package/dist/components/post-alert.js +136 -0
  73. package/dist/components/post-alert.js.map +1 -0
  74. package/dist/components/post-collapsible.js +3 -1
  75. package/dist/components/post-collapsible.js.map +1 -1
  76. package/dist/components/post-icon.js +1 -141
  77. package/dist/components/post-icon.js.map +1 -1
  78. package/dist/components/post-icon2.js +146 -0
  79. package/dist/components/post-icon2.js.map +1 -0
  80. package/dist/components/post-tab-header.d.ts +11 -0
  81. package/dist/components/post-tab-header.js +52 -0
  82. package/dist/components/post-tab-header.js.map +1 -0
  83. package/dist/components/post-tab-panel.d.ts +11 -0
  84. package/dist/components/post-tab-panel.js +46 -0
  85. package/dist/components/post-tab-panel.js.map +1 -0
  86. package/dist/components/post-tabs.d.ts +11 -0
  87. package/dist/components/post-tabs.js +153 -0
  88. package/dist/components/post-tabs.js.map +1 -0
  89. package/dist/components/post-tooltip.d.ts +11 -0
  90. package/dist/components/post-tooltip.js +5118 -0
  91. package/dist/components/post-tooltip.js.map +1 -0
  92. package/dist/docs.json +441 -1
  93. package/dist/esm/check-non-empty-554bdf88.js +11 -0
  94. package/dist/esm/check-non-empty-554bdf88.js.map +1 -0
  95. package/dist/esm/check-one-of-ded5e15e.js +8 -0
  96. package/dist/esm/check-one-of-ded5e15e.js.map +1 -0
  97. package/dist/esm/check-type-18ebb4e7.js +16 -0
  98. package/dist/esm/check-type-18ebb4e7.js.map +1 -0
  99. package/dist/esm/fade-671f1489.js +9 -0
  100. package/dist/esm/fade-671f1489.js.map +1 -0
  101. package/dist/esm/{index-60a84798.js → index-5611074b.js} +121 -6
  102. package/dist/esm/index-5611074b.js.map +1 -0
  103. package/dist/esm/index-7f723686.js +24 -0
  104. package/dist/esm/index-7f723686.js.map +1 -0
  105. package/dist/esm/loader.js +3 -3
  106. package/dist/esm/package-f5cb3167.js +5 -0
  107. package/dist/esm/package-f5cb3167.js.map +1 -0
  108. package/dist/esm/post-alert.entry.js +102 -0
  109. package/dist/esm/post-alert.entry.js.map +1 -0
  110. package/dist/esm/post-collapsible.entry.js +4 -2
  111. package/dist/esm/post-collapsible.entry.js.map +1 -1
  112. package/dist/esm/post-components.js +3 -3
  113. package/dist/esm/post-icon.entry.js +6 -21
  114. package/dist/esm/post-icon.entry.js.map +1 -1
  115. package/dist/esm/post-tab-header.entry.js +31 -0
  116. package/dist/esm/post-tab-header.entry.js.map +1 -0
  117. package/dist/esm/post-tab-panel.entry.js +25 -0
  118. package/dist/esm/post-tab-panel.entry.js.map +1 -0
  119. package/dist/esm/post-tabs.entry.js +132 -0
  120. package/dist/esm/post-tabs.entry.js.map +1 -0
  121. package/dist/esm/post-tooltip.entry.js +5093 -0
  122. package/dist/esm/post-tooltip.entry.js.map +1 -0
  123. package/dist/post-components/p-12046db8.entry.js +2 -0
  124. package/dist/post-components/{p-99ccf0cf.entry.js.map → p-12046db8.entry.js.map} +1 -1
  125. package/dist/post-components/p-15fc087f.js +2 -0
  126. package/dist/post-components/p-15fc087f.js.map +1 -0
  127. package/dist/post-components/p-24b07f64.js +2 -0
  128. package/dist/post-components/p-24b07f64.js.map +1 -0
  129. package/dist/post-components/p-29535fea.entry.js +2 -0
  130. package/dist/post-components/p-29535fea.entry.js.map +1 -0
  131. package/dist/post-components/p-296af738.entry.js +2 -0
  132. package/dist/post-components/p-296af738.entry.js.map +1 -0
  133. package/dist/post-components/p-2b6ab354.entry.js +9 -0
  134. package/dist/post-components/p-2b6ab354.entry.js.map +1 -0
  135. package/dist/post-components/p-75a7b352.js +2 -0
  136. package/dist/post-components/p-75a7b352.js.map +1 -0
  137. package/dist/post-components/p-a14ec7bb.entry.js +2 -0
  138. package/dist/post-components/p-a14ec7bb.entry.js.map +1 -0
  139. package/dist/post-components/p-bcc705f1.js +2 -0
  140. package/dist/post-components/p-bcc705f1.js.map +1 -0
  141. package/dist/post-components/p-c7497ecb.entry.js +2 -0
  142. package/dist/post-components/p-c7497ecb.entry.js.map +1 -0
  143. package/dist/post-components/p-c8efe0ae.js +2 -0
  144. package/dist/post-components/p-c8efe0ae.js.map +1 -0
  145. package/dist/post-components/p-cc6e4eb8.entry.js +2 -0
  146. package/dist/post-components/p-cc6e4eb8.entry.js.map +1 -0
  147. package/dist/post-components/p-d94db268.js +3 -0
  148. package/dist/post-components/p-d94db268.js.map +1 -0
  149. package/dist/post-components/p-e5306504.js +2 -0
  150. package/dist/post-components/p-e5306504.js.map +1 -0
  151. package/dist/post-components/post-components.esm.js +1 -1
  152. package/dist/post-components/post-components.esm.js.map +1 -1
  153. package/dist/types/animations/fade.d.ts +2 -0
  154. package/dist/types/animations/index.d.ts +1 -0
  155. package/dist/types/components/post-alert/alert-types.d.ts +2 -0
  156. package/dist/types/components/post-alert/post-alert.d.ts +49 -0
  157. package/dist/types/components/post-tab-header/post-tab-header.d.ts +11 -0
  158. package/dist/types/components/post-tab-panel/post-tab-panel.d.ts +10 -0
  159. package/dist/types/components/post-tabs/post-tabs.d.ts +34 -0
  160. package/dist/types/components/post-tooltip/post-tooltip.d.ts +66 -0
  161. package/dist/types/components/post-tooltip/types.d.ts +2 -0
  162. package/dist/types/components.d.ts +190 -0
  163. package/dist/types/utils/property-checkers/check-one-of.d.ts +1 -1
  164. package/dist/types/utils/property-checkers/check-pattern.d.ts +1 -0
  165. package/dist/types/utils/property-checkers/index.d.ts +3 -1
  166. package/package.json +13 -9
  167. package/dist/cjs/index-272283b3.js.map +0 -1
  168. package/dist/cjs/package-f6bb523d.js.map +0 -1
  169. package/dist/esm/index-60a84798.js.map +0 -1
  170. package/dist/esm/package-bcf00737.js.map +0 -1
  171. package/dist/post-components/p-0096c140.js +0 -3
  172. package/dist/post-components/p-4a3ff4c0.js +0 -2
  173. package/dist/post-components/p-4a3ff4c0.js.map +0 -1
  174. package/dist/post-components/p-99ccf0cf.entry.js +0 -2
  175. package/dist/post-components/p-cafa0281.entry.js +0 -2
  176. package/dist/post-components/p-cafa0281.entry.js.map +0 -1
@@ -0,0 +1,52 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version } from './package.js';
3
+ import { c as checkNonEmpty } from './check-non-empty.js';
4
+
5
+ const postTabHeaderCss = ".tab-title{display:inline-block;position:relative;box-sizing:border-box;padding:1rem;transition:background-color 100ms;border-right:1px solid transparent;border-left:1px solid transparent;outline-color:currentColor;opacity:0.7;color:var(--post-contrast-color);text-decoration:none}.tab-title:focus{background-color:unset;color:var(--post-contrast-color)}.tab-title:hover{opacity:1;background-color:#fff;color:var(--post-contrast-color)}.tab-title:focus-visible{outline:transparent;opacity:1;background-color:#fff;color:var(--post-contrast-color);box-shadow:none}.tab-title:focus-visible::after{content:\"\";display:block;position:absolute;top:2px;right:1px;bottom:0;left:1px;box-shadow:0 0 0 1px #fff, 0 0 0 2px hsl(0, 0%, 20%)}.tab-title.active{z-index:1;border-right-color:hsl(0, 0%, 80%);border-left-color:hsl(0, 0%, 80%);opacity:1;background-color:#fff;color:var(--post-contrast-color);font-weight:700}.tab-title.active::before{content:\"\";display:block;position:absolute;top:0;right:-1px;left:-1px;height:0.25rem;background-color:#fc0}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title:hover{background-color:rgba(255, 255, 255, 0.2)}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title:focus-visible{background-color:rgba(255, 255, 255, 0.2)}@media (forced-colors: active), (-ms-high-contrast: active), (-ms-high-contrast: white-on-black){.tab-title{opacity:1;border-left-color:Canvas;border-right-color:Canvas;color:LinkText}.tab-title:hover,.tab-title:focus,.tab-title:focus-within,.tab-title:focus-visible{outline:2px solid Highlight;outline-offset:-0.25rem}.tab-title.active{border-left-color:ButtonText;border-right-color:ButtonText;color:Highlight}.tab-title.active::before{background-color:Highlight}}.bg-yellow .tab-title{background-color:#fc0}.bg-yellow .tab-title.active{background-color:#fc0}.bg-yellow .nav-item{background-color:#fc0}.bg-light .tab-title{background-color:#faf9f8}.bg-light .tab-title.active{background-color:#faf9f8}.bg-light .nav-item{background-color:#faf9f8}.bg-gray .tab-title{background-color:#f4f3f1}.bg-gray .tab-title.active{background-color:#f4f3f1}.bg-gray .nav-item{background-color:#f4f3f1}.bg-dark .tab-title{background-color:hsl(0, 0%, 20%)}.bg-dark .tab-title.active{background-color:hsl(0, 0%, 20%)}.bg-dark .nav-item{background-color:hsl(0, 0%, 20%)}.bg-primary .tab-title{background-color:hsl(0, 0%, 20%)}.bg-primary .tab-title.active{background-color:hsl(0, 0%, 20%)}.bg-primary .nav-item{background-color:hsl(0, 0%, 20%)}.bg-white .tab-title{background-color:#fff}.bg-white .tab-title.active{background-color:#fff}.bg-white .nav-item{background-color:#fff}.bg-black .tab-title{background-color:#000}.bg-black .tab-title.active{background-color:#000}.bg-black .nav-item{background-color:#000}.bg-success .tab-title{background-color:#2c911c}.bg-success .tab-title.active{background-color:#2c911c}.bg-success .nav-item{background-color:#2c911c}.bg-info .tab-title{background-color:#cce4ee}.bg-info .tab-title.active{background-color:#cce4ee}.bg-info .nav-item{background-color:#cce4ee}.bg-warning .tab-title{background-color:#f49e00}.bg-warning .tab-title.active{background-color:#f49e00}.bg-warning .nav-item{background-color:#f49e00}.bg-danger .tab-title{background-color:#a51728}.bg-danger .tab-title.active{background-color:#a51728}.bg-danger .nav-item{background-color:#a51728}.bg-nightblue .tab-title{background-color:#004976}.bg-nightblue .tab-title.active{background-color:#004976}.bg-nightblue .nav-item{background-color:#004976}.bg-nightblue-bright .tab-title{background-color:#0076a8}.bg-nightblue-bright .tab-title.active{background-color:#0076a8}.bg-nightblue-bright .nav-item{background-color:#0076a8}.bg-petrol .tab-title{background-color:#006d68}.bg-petrol .tab-title.active{background-color:#006d68}.bg-petrol .nav-item{background-color:#006d68}.bg-petrol-bright .tab-title{background-color:#00968f}.bg-petrol-bright .tab-title.active{background-color:#00968f}.bg-petrol-bright .nav-item{background-color:#00968f}.bg-coral .tab-title{background-color:#9e2a2f}.bg-coral .tab-title.active{background-color:#9e2a2f}.bg-coral .nav-item{background-color:#9e2a2f}.bg-coral-bright .tab-title{background-color:#e03c31}.bg-coral-bright .tab-title.active{background-color:#e03c31}.bg-coral-bright .nav-item{background-color:#e03c31}.bg-olive .tab-title{background-color:#716135}.bg-olive .tab-title.active{background-color:#716135}.bg-olive .nav-item{background-color:#716135}.bg-olive-bright .tab-title{background-color:#aa9d2e}.bg-olive-bright .tab-title.active{background-color:#aa9d2e}.bg-olive-bright .nav-item{background-color:#aa9d2e}.bg-purple .tab-title{background-color:#80276c}.bg-purple .tab-title.active{background-color:#80276c}.bg-purple .nav-item{background-color:#80276c}.bg-purple-bright .tab-title{background-color:#c5299b}.bg-purple-bright .tab-title.active{background-color:#c5299b}.bg-purple-bright .nav-item{background-color:#c5299b}.bg-aubergine .tab-title{background-color:#523178}.bg-aubergine .tab-title.active{background-color:#523178}.bg-aubergine .nav-item{background-color:#523178}.bg-aubergine-bright .tab-title{background-color:#7566a0}.bg-aubergine-bright .tab-title.active{background-color:#7566a0}.bg-aubergine-bright .nav-item{background-color:#7566a0}[class*=bg-] .tab-title.active:focus::after{background-color:rgba(255, 255, 255, 0.2)}@supports selector(*:focus-visible){[class*=bg-] .tab-title.active:focus::after{background-color:unset}[class*=bg-] .tab-title.active:focus-visible::after{background-color:rgba(255, 255, 255, 0.2)}}:host{display:block}";
6
+
7
+ const PostTabHeader$1 = /*@__PURE__*/ proxyCustomElement(class PostTabHeader extends HTMLElement {
8
+ constructor() {
9
+ super();
10
+ this.__registerHost();
11
+ this.__attachShadow();
12
+ this.tabId = undefined;
13
+ this.panel = undefined;
14
+ }
15
+ validateFor(newValue) {
16
+ checkNonEmpty(newValue, 'The "panel" prop is required for the post-tab-header.');
17
+ }
18
+ componentWillLoad() {
19
+ this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;
20
+ }
21
+ render() {
22
+ return (h(Host, { "data-version": version }, h("li", { class: "nav-item" }, h("a", { "aria-selected": "false", class: "tab-title nav-link", href: "#", id: this.tabId, role: "tab" }, h("slot", null)))));
23
+ }
24
+ get host() { return this; }
25
+ static get watchers() { return {
26
+ "panel": ["validateFor"]
27
+ }; }
28
+ static get style() { return postTabHeaderCss; }
29
+ }, [1, "post-tab-header", {
30
+ "panel": [1],
31
+ "tabId": [32]
32
+ }]);
33
+ function defineCustomElement$1() {
34
+ if (typeof customElements === "undefined") {
35
+ return;
36
+ }
37
+ const components = ["post-tab-header"];
38
+ components.forEach(tagName => { switch (tagName) {
39
+ case "post-tab-header":
40
+ if (!customElements.get(tagName)) {
41
+ customElements.define(tagName, PostTabHeader$1);
42
+ }
43
+ break;
44
+ } });
45
+ }
46
+
47
+ const PostTabHeader = PostTabHeader$1;
48
+ const defineCustomElement = defineCustomElement$1;
49
+
50
+ export { PostTabHeader, defineCustomElement };
51
+
52
+ //# sourceMappingURL=post-tab-header.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tab-header.js","mappings":";;;;AAAA,MAAM,gBAAgB,GAAG,msLAAmsL;;MCS/sLA,eAAa;;;;;;;;EAWxB,WAAW,CAAC,QAAyC;IACnD,aAAa,CAAC,QAAQ,EAAE,uDAAuD,CAAC,CAAC;GAClF;EAED,iBAAiB;IACf,IAAI,CAAC,KAAK,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC3D;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,UAAI,KAAK,EAAC,UAAU,IAClB,0BACgB,OAAO,EACrB,KAAK,EAAC,oBAAoB,EAC1B,IAAI,EAAC,GAAG,EACR,EAAE,EAAE,IAAI,CAAC,KAAK,EACd,IAAI,EAAC,KAAK,IAEV,eAAO,CACL,CACD,CACA,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PostTabHeader"],"sources":["./src/components/post-tab-header/post-tab-header.scss?tag=post-tab-header&encapsulation=shadow","./src/components/post-tab-header/post-tab-header.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tab-title';\n\n:host {\n display: block;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { checkNonEmpty } from '../../utils';\n\n@Component({\n tag: 'post-tab-header',\n styleUrl: 'post-tab-header.scss',\n shadow: true,\n})\nexport class PostTabHeader {\n @Element() host: HTMLPostTabHeaderElement;\n\n @State() tabId: string;\n\n /**\n * The name of the panel controlled by the tab header.\n */\n @Prop() readonly panel: HTMLPostTabPanelElement['name'];\n\n @Watch('panel')\n validateFor(newValue: HTMLPostTabPanelElement['name']) {\n checkNonEmpty(newValue, 'The \"panel\" prop is required for the post-tab-header.');\n }\n\n componentWillLoad() {\n this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <li class=\"nav-item\">\n <a\n aria-selected=\"false\"\n class=\"tab-title nav-link\"\n href=\"#\"\n id={this.tabId}\n role=\"tab\"\n >\n <slot/>\n </a>\n </li>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PostTabPanel extends Components.PostTabPanel, HTMLElement {}
4
+ export const PostTabPanel: {
5
+ prototype: PostTabPanel;
6
+ new (): PostTabPanel;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,46 @@
1
+ import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version } from './package.js';
3
+
4
+ const postTabPanelCss = ":host{display:none}";
5
+
6
+ const PostTabPanel$1 = /*@__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; }
23
+ }, [1, "post-tab-panel", {
24
+ "name": [1],
25
+ "panelId": [32]
26
+ }]);
27
+ function defineCustomElement$1() {
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$1);
36
+ }
37
+ break;
38
+ } });
39
+ }
40
+
41
+ const PostTabPanel = PostTabPanel$1;
42
+ const defineCustomElement = defineCustomElement$1;
43
+
44
+ export { PostTabPanel, defineCustomElement };
45
+
46
+ //# sourceMappingURL=post-tab-panel.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tab-panel.js","mappings":";;;AAAA,MAAM,eAAe,GAAG,qBAAqB;;MCQhCA,cAAY;;;;;;;;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":["PostTabPanel"],"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}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PostTabs extends Components.PostTabs, HTMLElement {}
4
+ export const PostTabs: {
5
+ prototype: PostTabs;
6
+ new (): PostTabs;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;
@@ -0,0 +1,153 @@
1
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
2
+ import { v as version } from './package.js';
3
+ import { f as fadeOut, a as fadeIn } from './fade.js';
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:hsl(0, 0%, 80%)}.tabs-wrapper .tabs{background-color:transparent !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:hsl(0, 0%, 20%)}.bg-primary .tabs-wrapper{background-color:hsl(0, 0%, 20%)}.bg-white .tabs-wrapper{background-color:#fff}.bg-black .tabs-wrapper{background-color:#000}.bg-success .tabs-wrapper{background-color:#2c911c}.bg-info .tabs-wrapper{background-color:#cce4ee}.bg-warning .tabs-wrapper{background-color:#f49e00}.bg-danger .tabs-wrapper{background-color:#a51728}.bg-nightblue .tabs-wrapper{background-color:#004976}.bg-nightblue-bright .tabs-wrapper{background-color:#0076a8}.bg-petrol .tabs-wrapper{background-color:#006d68}.bg-petrol-bright .tabs-wrapper{background-color:#00968f}.bg-coral .tabs-wrapper{background-color:#9e2a2f}.bg-coral-bright .tabs-wrapper{background-color:#e03c31}.bg-olive .tabs-wrapper{background-color:#716135}.bg-olive-bright .tabs-wrapper{background-color:#aa9d2e}.bg-purple .tabs-wrapper{background-color:#80276c}.bg-purple-bright .tabs-wrapper{background-color:#c5299b}.bg-aubergine .tabs-wrapper{background-color:#523178}.bg-aubergine-bright .tabs-wrapper{background-color:#7566a0}:host{display:block}";
6
+
7
+ const PostTabs$1 = /*@__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
+ this.show(initiallyActivePanel);
24
+ this.isLoaded = true;
25
+ }
26
+ /**
27
+ * Shows the panel with the given name and selects its associated tab.
28
+ * Any other panel that was previously shown becomes hidden and its associated tab is unselected.
29
+ */
30
+ async show(panelName) {
31
+ var _a;
32
+ // do nothing if the tab is already active
33
+ if (panelName === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)) {
34
+ return;
35
+ }
36
+ const previousTab = this.activeTab;
37
+ const newTab = this.host.querySelector(`post-tab-header[panel=${panelName}]`);
38
+ this.activateTab(newTab);
39
+ // if a panel is currently being displayed, remove it from the view and complete the associated animation
40
+ if (this.showing) {
41
+ this.showing.effect['target'].style.display = 'none';
42
+ this.showing.finish();
43
+ }
44
+ // hide the currently visible panel only if no other animation is running
45
+ if (previousTab && !this.showing && !this.hiding) {
46
+ this.hidePanel(previousTab.panel);
47
+ }
48
+ // wait for any hiding animation to complete before showing the selected tab
49
+ if (this.hiding) {
50
+ await this.hiding.finished;
51
+ }
52
+ this.showSelectedPanel();
53
+ // wait for any display animation to complete for the returned promise to fully resolve
54
+ if (this.showing) {
55
+ await this.showing.finished;
56
+ }
57
+ this.tabChange.emit(this.activeTab.panel);
58
+ }
59
+ moveMisplacedTabs() {
60
+ if (!this.tabs)
61
+ return;
62
+ this.tabs.forEach(tab => {
63
+ if (tab.getAttribute('slot') === 'tabs')
64
+ return;
65
+ tab.setAttribute('slot', 'tabs');
66
+ });
67
+ }
68
+ enableTabs() {
69
+ if (!this.tabs)
70
+ return;
71
+ this.tabs.forEach(async (tab) => {
72
+ await tab.componentOnReady();
73
+ const tabTitle = tab.shadowRoot.querySelector('.tab-title');
74
+ // if the tab has an "aria-controls" attribute it was already linked to its panel: do nothing
75
+ if (tabTitle.getAttribute('aria-controls'))
76
+ return;
77
+ const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');
78
+ tabTitle.setAttribute('aria-controls', tabPanel.id);
79
+ tabPanel.setAttribute('aria-labelledby', tabTitle.id);
80
+ tab.addEventListener('click', e => {
81
+ e.preventDefault();
82
+ this.show(tab.panel);
83
+ });
84
+ });
85
+ // if the currently active tab was removed from the DOM then select the first one
86
+ if (this.activeTab && !this.activeTab.isConnected) {
87
+ this.show(this.tabs.item(0).panel);
88
+ }
89
+ }
90
+ activateTab(tab) {
91
+ if (this.activeTab) {
92
+ const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');
93
+ tabTitle.setAttribute('aria-selected', 'false');
94
+ tabTitle.classList.remove('active');
95
+ }
96
+ const tabTitle = tab.shadowRoot.querySelector('.tab-title');
97
+ tabTitle.setAttribute('aria-selected', 'true');
98
+ tabTitle.classList.add('active');
99
+ this.activeTab = tab;
100
+ }
101
+ hidePanel(panelName) {
102
+ const previousPanel = this.getPanel(panelName);
103
+ if (!previousPanel)
104
+ return;
105
+ this.hiding = fadeOut(previousPanel);
106
+ this.hiding.onfinish = () => {
107
+ previousPanel.style.display = 'none';
108
+ this.hiding = null;
109
+ };
110
+ }
111
+ showSelectedPanel() {
112
+ const panel = this.getPanel(this.activeTab.panel);
113
+ panel.style.display = 'block';
114
+ // prevent the initially selected panel from fading in
115
+ if (!this.isLoaded)
116
+ return;
117
+ this.showing = fadeIn(panel);
118
+ this.showing.onfinish = () => {
119
+ this.showing = null;
120
+ };
121
+ }
122
+ getPanel(name) {
123
+ return this.host.querySelector(`post-tab-panel[name=${name}]`);
124
+ }
125
+ render() {
126
+ return (h(Host, { "data-version": version }, h("div", { class: "tabs-wrapper" }, h("ul", { class: "tabs nav", role: "tablist" }, h("slot", { name: "tabs", onSlotchange: () => this.enableTabs() }))), h("div", { class: "tab-content" }, h("slot", { onSlotchange: () => this.moveMisplacedTabs() }))));
127
+ }
128
+ get host() { return this; }
129
+ static get style() { return postTabsCss; }
130
+ }, [1, "post-tabs", {
131
+ "activePanel": [1, "active-panel"],
132
+ "show": [64]
133
+ }]);
134
+ function defineCustomElement$1() {
135
+ if (typeof customElements === "undefined") {
136
+ return;
137
+ }
138
+ const components = ["post-tabs"];
139
+ components.forEach(tagName => { switch (tagName) {
140
+ case "post-tabs":
141
+ if (!customElements.get(tagName)) {
142
+ customElements.define(tagName, PostTabs$1);
143
+ }
144
+ break;
145
+ } });
146
+ }
147
+
148
+ const PostTabs = PostTabs$1;
149
+ const defineCustomElement = defineCustomElement$1;
150
+
151
+ export { PostTabs, defineCustomElement };
152
+
153
+ //# sourceMappingURL=post-tabs.js.map
@@ -0,0 +1 @@
1
+ {"file":"post-tabs.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,01DAA01D;;MCSj2DA,UAAQ;;;;;;IAIX,aAAQ,GAAG,KAAK,CAAC;;;EAEzB,IAAY,IAAI;IACd,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;GACtD;EAkBD,gBAAgB;IACd,IAAI,CAAC,iBAAiB,EAAE,CAAC;IACzB,IAAI,CAAC,UAAU,EAAE,CAAC;IAElB,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACzE,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAEhC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;GACtB;;;;;EAOD,MAAM,IAAI,CAAC,SAAiB;;;IAE1B,IAAI,SAAS,MAAK,MAAA,IAAI,CAAC,SAAS,0CAAE,KAAK,CAAA,EAAE;MACvC,OAAO;KACR;IAED,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC;IACnC,MAAM,MAAM,GAA8B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,yBAAyB,SAAS,GAAG,CA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"],"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, Host, h, Element, Method, Event, EventEmitter, 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 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(`post-tab-header[panel=${panelName}]`);\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 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', e => {\n e.preventDefault();\n this.show(tab.panel);\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 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.classList.remove('active');\n }\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'true');\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(\n `post-tab-panel[name=${name}]`\n );\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div class=\"tabs-wrapper\">\n <ul class=\"tabs nav\" role=\"tablist\">\n <slot name=\"tabs\" onSlotchange={() => this.enableTabs()} />\n </ul>\n </div>\n <div class=\"tab-content\">\n <slot onSlotchange={() => this.moveMisplacedTabs()} />\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -0,0 +1,11 @@
1
+ import type { Components, JSX } from "../types/components";
2
+
3
+ interface PostTooltip extends Components.PostTooltip, HTMLElement {}
4
+ export const PostTooltip: {
5
+ prototype: PostTooltip;
6
+ new (): PostTooltip;
7
+ };
8
+ /**
9
+ * Used to define this component and all nested components recursively.
10
+ */
11
+ export const defineCustomElement: () => void;