@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,55 @@
1
+ import { h, Host } from '@stencil/core';
2
+ import { version } from '../../../package.json';
3
+ export class PostTabPanel {
4
+ constructor() {
5
+ this.panelId = undefined;
6
+ this.name = undefined;
7
+ }
8
+ componentWillLoad() {
9
+ // get the id set on the host element or use a random id by default
10
+ this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;
11
+ }
12
+ render() {
13
+ return (h(Host, { "data-version": version }, h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, h("slot", null))));
14
+ }
15
+ static get is() { return "post-tab-panel"; }
16
+ static get encapsulation() { return "shadow"; }
17
+ static get originalStyleUrls() {
18
+ return {
19
+ "$": ["post-tab-panel.scss"]
20
+ };
21
+ }
22
+ static get styleUrls() {
23
+ return {
24
+ "$": ["post-tab-panel.css"]
25
+ };
26
+ }
27
+ static get properties() {
28
+ return {
29
+ "name": {
30
+ "type": "string",
31
+ "mutable": false,
32
+ "complexType": {
33
+ "original": "string",
34
+ "resolved": "string",
35
+ "references": {}
36
+ },
37
+ "required": false,
38
+ "optional": false,
39
+ "docs": {
40
+ "tags": [],
41
+ "text": "The name of the panel, used to associate it with a tab header."
42
+ },
43
+ "attribute": "name",
44
+ "reflect": false
45
+ }
46
+ };
47
+ }
48
+ static get states() {
49
+ return {
50
+ "panelId": {}
51
+ };
52
+ }
53
+ static get elementRef() { return "host"; }
54
+ }
55
+ //# sourceMappingURL=post-tab-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-tab-panel.js","sourceRoot":"","sources":["../../../../src/components/post-tab-panel/post-tab-panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAOhD,MAAM,OAAO,YAAY;;;;;EAUvB,iBAAiB;IACf,mEAAmE;IACnE,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;EAChE,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,oBAAe,OAAO;MACzB,WACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU;QAEf,eAAO,CACH,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Colors used by the post style guide
3
+ */
4
+ /**
5
+ * Maps. Allow maps to have custom colors from the project
6
+ * by always merging into a default empty map
7
+ */
8
+ .tabs-wrapper {
9
+ position: relative;
10
+ padding-top: 1rem;
11
+ border: 0;
12
+ background-color: #faf9f8;
13
+ }
14
+ .tabs-wrapper::after {
15
+ content: "";
16
+ position: absolute;
17
+ bottom: 0;
18
+ width: 100%;
19
+ height: 1px;
20
+ background-color: hsl(0, 0%, 80%);
21
+ }
22
+ .tabs-wrapper .tabs {
23
+ background-color: transparent !important;
24
+ }
25
+ @media (forced-colors: active), (-ms-high-contrast: active), (-ms-high-contrast: white-on-black) {
26
+ .tabs-wrapper::after {
27
+ background-color: ButtonBorder;
28
+ }
29
+ }
30
+
31
+ .tabs {
32
+ margin: 0;
33
+ padding: 0;
34
+ list-style: none;
35
+ display: flex;
36
+ flex-wrap: nowrap;
37
+ overflow-x: auto;
38
+ /* prevent scroll chaining on x scroll */
39
+ overscroll-behavior-x: contain;
40
+ white-space: nowrap;
41
+ }
42
+ .tabs::after {
43
+ content: "";
44
+ display: block;
45
+ flex: 1 0 auto;
46
+ width: 1rem;
47
+ }
48
+
49
+ .tab-content {
50
+ padding-top: 1rem;
51
+ padding-bottom: 1rem;
52
+ }
53
+
54
+ .bg-yellow .tabs-wrapper {
55
+ background-color: #fc0;
56
+ }
57
+
58
+ .bg-light .tabs-wrapper {
59
+ background-color: #faf9f8;
60
+ }
61
+
62
+ .bg-gray .tabs-wrapper {
63
+ background-color: #f4f3f1;
64
+ }
65
+
66
+ .bg-dark .tabs-wrapper {
67
+ background-color: hsl(0, 0%, 20%);
68
+ }
69
+
70
+ .bg-primary .tabs-wrapper {
71
+ background-color: hsl(0, 0%, 20%);
72
+ }
73
+
74
+ .bg-white .tabs-wrapper {
75
+ background-color: #fff;
76
+ }
77
+
78
+ .bg-black .tabs-wrapper {
79
+ background-color: #000;
80
+ }
81
+
82
+ .bg-success .tabs-wrapper {
83
+ background-color: #2c911c;
84
+ }
85
+
86
+ .bg-info .tabs-wrapper {
87
+ background-color: #cce4ee;
88
+ }
89
+
90
+ .bg-warning .tabs-wrapper {
91
+ background-color: #f49e00;
92
+ }
93
+
94
+ .bg-danger .tabs-wrapper {
95
+ background-color: #a51728;
96
+ }
97
+
98
+ .bg-nightblue .tabs-wrapper {
99
+ background-color: #004976;
100
+ }
101
+
102
+ .bg-nightblue-bright .tabs-wrapper {
103
+ background-color: #0076a8;
104
+ }
105
+
106
+ .bg-petrol .tabs-wrapper {
107
+ background-color: #006d68;
108
+ }
109
+
110
+ .bg-petrol-bright .tabs-wrapper {
111
+ background-color: #00968f;
112
+ }
113
+
114
+ .bg-coral .tabs-wrapper {
115
+ background-color: #9e2a2f;
116
+ }
117
+
118
+ .bg-coral-bright .tabs-wrapper {
119
+ background-color: #e03c31;
120
+ }
121
+
122
+ .bg-olive .tabs-wrapper {
123
+ background-color: #716135;
124
+ }
125
+
126
+ .bg-olive-bright .tabs-wrapper {
127
+ background-color: #aa9d2e;
128
+ }
129
+
130
+ .bg-purple .tabs-wrapper {
131
+ background-color: #80276c;
132
+ }
133
+
134
+ .bg-purple-bright .tabs-wrapper {
135
+ background-color: #c5299b;
136
+ }
137
+
138
+ .bg-aubergine .tabs-wrapper {
139
+ background-color: #523178;
140
+ }
141
+
142
+ .bg-aubergine-bright .tabs-wrapper {
143
+ background-color: #7566a0;
144
+ }
145
+
146
+ :host {
147
+ display: block;
148
+ }
@@ -0,0 +1,208 @@
1
+ import { Host, h } from '@stencil/core';
2
+ import { version } from '../../../package.json';
3
+ import { fadeIn, fadeOut } from '../../animations';
4
+ export class PostTabs {
5
+ constructor() {
6
+ this.isLoaded = false;
7
+ this.activePanel = undefined;
8
+ }
9
+ get tabs() {
10
+ return this.host.querySelectorAll('post-tab-header');
11
+ }
12
+ componentDidLoad() {
13
+ this.moveMisplacedTabs();
14
+ this.enableTabs();
15
+ const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;
16
+ this.show(initiallyActivePanel);
17
+ this.isLoaded = true;
18
+ }
19
+ /**
20
+ * Shows the panel with the given name and selects its associated tab.
21
+ * Any other panel that was previously shown becomes hidden and its associated tab is unselected.
22
+ */
23
+ async show(panelName) {
24
+ var _a;
25
+ // do nothing if the tab is already active
26
+ if (panelName === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)) {
27
+ return;
28
+ }
29
+ const previousTab = this.activeTab;
30
+ const newTab = this.host.querySelector(`post-tab-header[panel=${panelName}]`);
31
+ this.activateTab(newTab);
32
+ // if a panel is currently being displayed, remove it from the view and complete the associated animation
33
+ if (this.showing) {
34
+ this.showing.effect['target'].style.display = 'none';
35
+ this.showing.finish();
36
+ }
37
+ // hide the currently visible panel only if no other animation is running
38
+ if (previousTab && !this.showing && !this.hiding) {
39
+ this.hidePanel(previousTab.panel);
40
+ }
41
+ // wait for any hiding animation to complete before showing the selected tab
42
+ if (this.hiding) {
43
+ await this.hiding.finished;
44
+ }
45
+ this.showSelectedPanel();
46
+ // wait for any display animation to complete for the returned promise to fully resolve
47
+ if (this.showing) {
48
+ await this.showing.finished;
49
+ }
50
+ this.tabChange.emit(this.activeTab.panel);
51
+ }
52
+ moveMisplacedTabs() {
53
+ if (!this.tabs)
54
+ return;
55
+ this.tabs.forEach(tab => {
56
+ if (tab.getAttribute('slot') === 'tabs')
57
+ return;
58
+ tab.setAttribute('slot', 'tabs');
59
+ });
60
+ }
61
+ enableTabs() {
62
+ if (!this.tabs)
63
+ return;
64
+ this.tabs.forEach(async (tab) => {
65
+ await tab.componentOnReady();
66
+ const tabTitle = tab.shadowRoot.querySelector('.tab-title');
67
+ // if the tab has an "aria-controls" attribute it was already linked to its panel: do nothing
68
+ if (tabTitle.getAttribute('aria-controls'))
69
+ return;
70
+ const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');
71
+ tabTitle.setAttribute('aria-controls', tabPanel.id);
72
+ tabPanel.setAttribute('aria-labelledby', tabTitle.id);
73
+ tab.addEventListener('click', e => {
74
+ e.preventDefault();
75
+ this.show(tab.panel);
76
+ });
77
+ });
78
+ // if the currently active tab was removed from the DOM then select the first one
79
+ if (this.activeTab && !this.activeTab.isConnected) {
80
+ this.show(this.tabs.item(0).panel);
81
+ }
82
+ }
83
+ activateTab(tab) {
84
+ if (this.activeTab) {
85
+ const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');
86
+ tabTitle.setAttribute('aria-selected', 'false');
87
+ tabTitle.classList.remove('active');
88
+ }
89
+ const tabTitle = tab.shadowRoot.querySelector('.tab-title');
90
+ tabTitle.setAttribute('aria-selected', 'true');
91
+ tabTitle.classList.add('active');
92
+ this.activeTab = tab;
93
+ }
94
+ hidePanel(panelName) {
95
+ const previousPanel = this.getPanel(panelName);
96
+ if (!previousPanel)
97
+ return;
98
+ this.hiding = fadeOut(previousPanel);
99
+ this.hiding.onfinish = () => {
100
+ previousPanel.style.display = 'none';
101
+ this.hiding = null;
102
+ };
103
+ }
104
+ showSelectedPanel() {
105
+ const panel = this.getPanel(this.activeTab.panel);
106
+ panel.style.display = 'block';
107
+ // prevent the initially selected panel from fading in
108
+ if (!this.isLoaded)
109
+ return;
110
+ this.showing = fadeIn(panel);
111
+ this.showing.onfinish = () => {
112
+ this.showing = null;
113
+ };
114
+ }
115
+ getPanel(name) {
116
+ return this.host.querySelector(`post-tab-panel[name=${name}]`);
117
+ }
118
+ render() {
119
+ 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() }))));
120
+ }
121
+ static get is() { return "post-tabs"; }
122
+ static get encapsulation() { return "shadow"; }
123
+ static get originalStyleUrls() {
124
+ return {
125
+ "$": ["post-tabs.scss"]
126
+ };
127
+ }
128
+ static get styleUrls() {
129
+ return {
130
+ "$": ["post-tabs.css"]
131
+ };
132
+ }
133
+ static get properties() {
134
+ return {
135
+ "activePanel": {
136
+ "type": "string",
137
+ "mutable": false,
138
+ "complexType": {
139
+ "original": "HTMLPostTabPanelElement['name']",
140
+ "resolved": "string",
141
+ "references": {
142
+ "HTMLPostTabPanelElement": {
143
+ "location": "global"
144
+ }
145
+ }
146
+ },
147
+ "required": false,
148
+ "optional": false,
149
+ "docs": {
150
+ "tags": [],
151
+ "text": "The name of the panel that is initially shown.\nIf not specified, it defaults to the panel associated with the first tab.\n\n**Changing this value after initialization has no effect.**"
152
+ },
153
+ "attribute": "active-panel",
154
+ "reflect": false
155
+ }
156
+ };
157
+ }
158
+ static get events() {
159
+ return [{
160
+ "method": "tabChange",
161
+ "name": "tabChange",
162
+ "bubbles": true,
163
+ "cancelable": true,
164
+ "composed": true,
165
+ "docs": {
166
+ "tags": [],
167
+ "text": "An event emitted after the active tab changes, when the fade in transition of its associated panel is finished.\nThe payload is the name of the newly shown panel."
168
+ },
169
+ "complexType": {
170
+ "original": "HTMLPostTabPanelElement['name']",
171
+ "resolved": "string",
172
+ "references": {
173
+ "HTMLPostTabPanelElement": {
174
+ "location": "global"
175
+ }
176
+ }
177
+ }
178
+ }];
179
+ }
180
+ static get methods() {
181
+ return {
182
+ "show": {
183
+ "complexType": {
184
+ "signature": "(panelName: string) => Promise<void>",
185
+ "parameters": [{
186
+ "tags": [],
187
+ "text": ""
188
+ }],
189
+ "references": {
190
+ "Promise": {
191
+ "location": "global"
192
+ },
193
+ "HTMLPostTabHeaderElement": {
194
+ "location": "global"
195
+ }
196
+ },
197
+ "return": "Promise<void>"
198
+ },
199
+ "docs": {
200
+ "text": "Shows the panel with the given name and selects its associated tab.\nAny other panel that was previously shown becomes hidden and its associated tab is unselected.",
201
+ "tags": []
202
+ }
203
+ }
204
+ };
205
+ }
206
+ static get elementRef() { return "host"; }
207
+ }
208
+ //# sourceMappingURL=post-tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-tabs.js","sourceRoot":"","sources":["../../../../src/components/post-tabs/post-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO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,EAAE;MAC1B,aAAa,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;MACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC,CAAC;EACJ,CAAC;EAEO,iBAAiB;IACvB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAClD,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC;IAE9B,sDAAsD;IACtD,IAAI,CAAC,IAAI,CAAC,QAAQ;MAAE,OAAO;IAE3B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,EAAE;MAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC,CAAC;EACJ,CAAC;EAEO,QAAQ,CAAC,IAAY;IAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,aAAa,CAC5B,uBAAuB,IAAI,GAAG,CAC/B,CAAC;EACJ,CAAC;EAED,MAAM;IACJ,OAAO,CACL,EAAC,IAAI,oBAAe,OAAO;MACzB,WAAK,KAAK,EAAC,cAAc;QACvB,UAAI,KAAK,EAAC,UAAU,EAAC,IAAI,EAAC,SAAS;UACjC,YAAM,IAAI,EAAC,MAAM,EAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,GAAI,CACxD,CACD;MACN,WAAK,KAAK,EAAC,aAAa;QACtB,YAAM,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAI,CAClD,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * Colors used by the post style guide
3
+ */
4
+ /**
5
+ * Maps. Allow maps to have custom colors from the project
6
+ * by always merging into a default empty map
7
+ */
8
+ :host, .bg-yellow {
9
+ --post-bg-opacity: 1;
10
+ background-color: rgba(var(--post-bg-rgb), var(--post-bg-opacity)) !important;
11
+ color: var(--post-contrast-color) !important;
12
+ }
13
+
14
+ .bg-yellow {
15
+ --post-contrast-color: #000;
16
+ --post-contrast-color-inverted: #fff;
17
+ --post-gray-10: hsl(0, 0%, 90%);
18
+ --post-gray-20: hsl(0, 0%, 80%);
19
+ --post-gray-40: hsl(0, 0%, 60%);
20
+ --post-gray-60: hsl(0, 0%, 40%);
21
+ --post-gray-80: hsl(0, 0%, 20%);
22
+ --post-yellow: #fc0;
23
+ --post-light: #faf9f8;
24
+ --post-gray: #f4f3f1;
25
+ --post-dark: hsl(0, 0%, 20%);
26
+ --post-primary: hsl(0, 0%, 20%);
27
+ --post-white: #fff;
28
+ --post-black: #000;
29
+ --post-success: #2c911c;
30
+ --post-info: #cce4ee;
31
+ --post-warning: #f49e00;
32
+ --post-danger: #a51728;
33
+ --post-nightblue: #004976;
34
+ --post-nightblue-bright: #0076a8;
35
+ --post-petrol: #006d68;
36
+ --post-petrol-bright: #00968f;
37
+ --post-coral: #9e2a2f;
38
+ --post-coral-bright: #e03c31;
39
+ --post-olive: #716135;
40
+ --post-olive-bright: #aa9d2e;
41
+ --post-purple: #80276c;
42
+ --post-purple-bright: #c5299b;
43
+ --post-aubergine: #523178;
44
+ --post-aubergine-bright: #7566a0;
45
+ --post-contrast-color-rgb: 0, 0, 0;
46
+ --post-contrast-color-inverted-rgb: 255, 255, 255;
47
+ --post-gray-10-rgb: 230, 230, 230;
48
+ --post-gray-20-rgb: 204, 204, 204;
49
+ --post-gray-40-rgb: 153, 153, 153;
50
+ --post-gray-60-rgb: 102, 102, 102;
51
+ --post-gray-80-rgb: 51, 51, 51;
52
+ --post-yellow-rgb: 255, 204, 0;
53
+ --post-light-rgb: 250, 249, 248;
54
+ --post-gray-rgb: 244, 243, 241;
55
+ --post-dark-rgb: 51, 51, 51;
56
+ --post-primary-rgb: 51, 51, 51;
57
+ --post-white-rgb: 255, 255, 255;
58
+ --post-black-rgb: 0, 0, 0;
59
+ --post-success-rgb: 44, 145, 28;
60
+ --post-info-rgb: 204, 228, 238;
61
+ --post-warning-rgb: 244, 158, 0;
62
+ --post-danger-rgb: 165, 23, 40;
63
+ --post-nightblue-rgb: 0, 73, 118;
64
+ --post-nightblue-bright-rgb: 0, 118, 168;
65
+ --post-petrol-rgb: 0, 109, 104;
66
+ --post-petrol-bright-rgb: 0, 150, 143;
67
+ --post-coral-rgb: 158, 42, 47;
68
+ --post-coral-bright-rgb: 224, 60, 49;
69
+ --post-olive-rgb: 113, 97, 53;
70
+ --post-olive-bright-rgb: 170, 157, 46;
71
+ --post-purple-rgb: 128, 39, 108;
72
+ --post-purple-bright-rgb: 197, 41, 155;
73
+ --post-aubergine-rgb: 82, 49, 120;
74
+ --post-aubergine-bright-rgb: 117, 102, 160;
75
+ }
76
+
77
+ :host {
78
+ --post-contrast-color: #fff;
79
+ --post-contrast-color-inverted: #000;
80
+ --post-dark: #faf9f8;
81
+ --post-light: hsl(0, 0%, 20%);
82
+ --post-gray-80: hsl(0, 0%, 90%);
83
+ --post-gray-60: hsl(0, 0%, 80%);
84
+ --post-gray-40: hsl(0, 0%, 60%);
85
+ --post-gray-20: hsl(0, 0%, 40%);
86
+ --post-gray-10: hsl(0, 0%, 20%);
87
+ --post-contrast-color-rgb: 255, 255, 255;
88
+ --post-contrast-color-inverted-rgb: 0, 0, 0;
89
+ --post-dark-rgb: 250, 249, 248;
90
+ --post-light-rgb: 51, 51, 51;
91
+ --post-gray-80-rgb: 230, 230, 230;
92
+ --post-gray-60-rgb: 204, 204, 204;
93
+ --post-gray-40-rgb: 153, 153, 153;
94
+ --post-gray-20-rgb: 102, 102, 102;
95
+ --post-gray-10-rgb: 51, 51, 51;
96
+ }
97
+
98
+ @layer polyfill {
99
+ [popover] {
100
+ position: fixed;
101
+ z-index: 2147483647;
102
+ inset: 0;
103
+ padding: 0.25em;
104
+ width: fit-content;
105
+ height: fit-content;
106
+ border-width: initial;
107
+ border-color: initial;
108
+ border-image: initial;
109
+ border-style: solid;
110
+ background-color: canvas;
111
+ color: canvastext;
112
+ overflow: auto;
113
+ margin: auto;
114
+ }
115
+ [popover]:not(.\:popover-open) {
116
+ display: none;
117
+ }
118
+ [popover]:is(dialog[open]) {
119
+ display: revert;
120
+ }
121
+ [anchor].\:popover-open {
122
+ inset: auto;
123
+ }
124
+ @supports selector([popover]:open) {
125
+ [popover]:not(.\:popover-open, dialog[open]) {
126
+ display: revert;
127
+ }
128
+ [anchor]:is(:open) {
129
+ inset: auto;
130
+ }
131
+ }
132
+ @supports selector([popover]:popover-open) {
133
+ [popover]:not(.\:popover-open, dialog[open]) {
134
+ display: revert;
135
+ }
136
+ [anchor]:is(:popover-open) {
137
+ inset: auto;
138
+ }
139
+ }
140
+ @supports not (background-color: canvas) {
141
+ [popover] {
142
+ background-color: white;
143
+ color: black;
144
+ }
145
+ }
146
+ @supports (width: -moz-fit-content) {
147
+ [popover] {
148
+ width: -moz-fit-content;
149
+ height: -moz-fit-content;
150
+ }
151
+ }
152
+ @supports not (inset: 0) {
153
+ [popover] {
154
+ top: 0;
155
+ left: 0;
156
+ right: 0;
157
+ bottom: 0;
158
+ }
159
+ }
160
+ }
161
+ :host {
162
+ --post-bg-rgb: 51, 51, 51;
163
+ }
164
+
165
+ div {
166
+ position: absolute;
167
+ z-index: 1070;
168
+ width: max-content;
169
+ max-width: 30ch;
170
+ margin: 0;
171
+ padding: 0.25rem 0.5rem;
172
+ color: inherit;
173
+ background-color: inherit;
174
+ border-color: transparent;
175
+ border-radius: 4px;
176
+ overflow: visible;
177
+ pointer-events: none;
178
+ }
179
+
180
+ .arrow {
181
+ position: absolute;
182
+ width: 0.7071067812rem;
183
+ aspect-ratio: 1/1;
184
+ background-color: inherit;
185
+ rotate: 45deg;
186
+ pointer-events: none;
187
+ z-index: -1;
188
+ border-right: 2px solid transparent;
189
+ border-bottom: 2px solid transparent;
190
+ }
191
+
192
+ .bg-yellow {
193
+ --post-bg-rgb: 255, 204, 0;
194
+ }