@swisspost/design-system-components 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/check-non-empty-ae713942.js +13 -0
- package/dist/cjs/check-non-empty-ae713942.js.map +1 -0
- package/dist/cjs/{check-one-of-4c2e8b2e.js → check-one-of-27ad3154.js} +1 -1
- package/dist/cjs/check-one-of-27ad3154.js.map +1 -0
- package/dist/cjs/constants-238701d3.js +7 -0
- package/dist/cjs/constants-238701d3.js.map +1 -0
- package/dist/cjs/fade-35a3633a.js +12 -0
- package/dist/cjs/fade-35a3633a.js.map +1 -0
- package/dist/cjs/index-b38a23e0.js +41 -0
- package/dist/cjs/index-b38a23e0.js.map +1 -0
- package/dist/cjs/{index-12cc37c9.js → index-b619e205.js} +245 -41
- package/dist/cjs/index-b619e205.js.map +1 -0
- package/dist/cjs/index.cjs.js +26 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +3 -12
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/package-7c4db872.js +7 -0
- package/dist/cjs/package-7c4db872.js.map +1 -0
- package/dist/cjs/post-accordion.cjs.entry.js +89 -0
- package/dist/cjs/post-accordion.cjs.entry.js.map +1 -0
- package/dist/cjs/post-alert-c037e6a3.js +101 -0
- package/dist/cjs/post-alert-c037e6a3.js.map +1 -0
- package/dist/cjs/post-alert.cjs.entry.js +9 -97
- package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/post-collapsible-7c9d23a2.js +93 -0
- package/dist/cjs/post-collapsible-7c9d23a2.js.map +1 -0
- package/dist/cjs/post-collapsible.cjs.entry.js +7 -119
- package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
- package/dist/cjs/post-components.cjs.js +3 -6
- package/dist/cjs/post-components.cjs.js.map +1 -1
- package/dist/cjs/post-icon-f418f76a.js +105 -0
- package/dist/cjs/post-icon-f418f76a.js.map +1 -0
- package/dist/cjs/post-icon.cjs.entry.js +8 -100
- package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-header-e08c2a42.js +33 -0
- package/dist/cjs/post-tab-header-e08c2a42.js.map +1 -0
- package/dist/cjs/post-tab-header.cjs.entry.js +6 -26
- package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tab-panel-721f7f32.js +27 -0
- package/dist/cjs/post-tab-panel-721f7f32.js.map +1 -0
- package/dist/cjs/post-tab-panel.cjs.entry.js +4 -20
- package/dist/cjs/post-tab-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tabs-4bcc867b.js +153 -0
- package/dist/cjs/post-tabs-4bcc867b.js.map +1 -0
- package/dist/cjs/post-tabs.cjs.entry.js +5 -127
- package/dist/cjs/post-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/post-tooltip-261c5cda.js +5095 -0
- package/dist/cjs/post-tooltip-261c5cda.js.map +1 -0
- package/dist/cjs/post-tooltip.cjs.entry.js +5 -5088
- package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
- package/dist/collection/animations/collapse.js +13 -0
- package/dist/collection/animations/collapse.js.map +1 -0
- package/dist/collection/animations/fade.js +4 -4
- package/dist/collection/animations/fade.js.map +1 -1
- package/dist/collection/collection-manifest.json +10 -9
- package/dist/collection/components/post-accordion/post-accordion.css +1 -0
- package/dist/collection/components/post-accordion/post-accordion.js +178 -0
- package/dist/collection/components/post-accordion/post-accordion.js.map +1 -0
- package/dist/collection/components/post-alert/post-alert.css +6 -534
- package/dist/collection/components/post-alert/post-alert.js +10 -9
- package/dist/collection/components/post-alert/post-alert.js.map +1 -1
- package/dist/collection/components/post-collapsible/heading-levels.js +2 -0
- package/dist/collection/components/post-collapsible/heading-levels.js.map +1 -0
- package/dist/collection/components/post-collapsible/post-collapsible.css +1 -261
- package/dist/collection/components/post-collapsible/post-collapsible.js +65 -63
- package/dist/collection/components/post-collapsible/post-collapsible.js.map +1 -1
- package/dist/collection/components/post-icon/post-icon.css +1 -102
- package/dist/collection/components/post-icon/post-icon.js +5 -4
- package/dist/collection/components/post-icon/post-icon.js.map +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.css +3 -337
- package/dist/collection/components/post-tab-header/post-tab-header.js +6 -5
- package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
- package/dist/collection/components/post-tab-panel/post-tab-panel.css +1 -3
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +2 -2
- package/dist/collection/components/post-tabs/post-tabs.css +1 -148
- package/dist/collection/components/post-tabs/post-tabs.js +36 -13
- package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.css +1 -194
- package/dist/collection/components/post-tooltip/post-tooltip.js +22 -15
- package/dist/collection/components/post-tooltip/post-tooltip.js.map +1 -1
- package/dist/collection/index.js +8 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/utils/index.js +1 -3
- package/dist/collection/utils/index.js.map +1 -1
- package/dist/collection/utils/is-motion-reduced.js +4 -0
- package/dist/collection/utils/is-motion-reduced.js.map +1 -0
- package/dist/collection/utils/property-checkers/check-non-empty.js +1 -1
- package/dist/collection/utils/property-checkers/empty-or.js +1 -1
- package/dist/collection/utils/property-checkers/index.js +4 -4
- package/dist/components/check-non-empty.js +2 -2
- package/dist/components/check-non-empty.js.map +1 -1
- package/dist/components/check-one-of.js.map +1 -1
- package/dist/components/constants.js +5 -0
- package/dist/components/constants.js.map +1 -0
- package/dist/components/fade.js +4 -4
- package/dist/components/fade.js.map +1 -1
- package/dist/components/index.d.ts +6 -0
- package/dist/components/index.js +8 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/index2.js +36 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion.d.ts +11 -0
- package/dist/components/post-accordion.js +108 -0
- package/dist/components/post-accordion.js.map +1 -0
- package/dist/components/post-alert.js +1 -129
- package/dist/components/post-alert.js.map +1 -1
- package/dist/components/post-alert2.js +138 -0
- package/dist/components/post-alert2.js.map +1 -0
- package/dist/components/post-collapsible.js +1 -146
- package/dist/components/post-collapsible.js.map +1 -1
- package/dist/components/post-collapsible2.js +117 -0
- package/dist/components/post-collapsible2.js.map +1 -0
- package/dist/components/post-icon2.js +12 -22
- package/dist/components/post-icon2.js.map +1 -1
- package/dist/components/post-tab-header.js +1 -45
- package/dist/components/post-tab-header.js.map +1 -1
- package/dist/components/post-tab-header2.js +51 -0
- package/dist/components/post-tab-header2.js.map +1 -0
- package/dist/components/post-tab-panel.js +1 -39
- package/dist/components/post-tab-panel.js.map +1 -1
- package/dist/components/post-tab-panel2.js +43 -0
- package/dist/components/post-tab-panel2.js.map +1 -0
- package/dist/components/post-tabs.js +1 -146
- package/dist/components/post-tabs.js.map +1 -1
- package/dist/components/post-tabs2.js +169 -0
- package/dist/components/post-tabs2.js.map +1 -0
- package/dist/components/post-tooltip.js +1 -5111
- package/dist/components/post-tooltip.js.map +1 -1
- package/dist/components/post-tooltip2.js +5117 -0
- package/dist/components/post-tooltip2.js.map +1 -0
- package/dist/docs.d.ts +334 -235
- package/dist/docs.json +458 -14
- package/dist/esm/check-non-empty-09c39561.js +11 -0
- package/dist/esm/check-non-empty-09c39561.js.map +1 -0
- package/dist/esm/{check-one-of-ded5e15e.js → check-one-of-74750af9.js} +1 -1
- package/dist/esm/check-one-of-74750af9.js.map +1 -0
- package/dist/esm/constants-8d548297.js +5 -0
- package/dist/esm/constants-8d548297.js.map +1 -0
- package/dist/esm/fade-7fd71785.js +9 -0
- package/dist/esm/fade-7fd71785.js.map +1 -0
- package/dist/esm/index-35921354.js +36 -0
- package/dist/esm/index-35921354.js.map +1 -0
- package/dist/esm/{index-5611074b.js → index-4eff5fc5.js} +245 -41
- package/dist/esm/index-4eff5fc5.js.map +1 -0
- package/dist/esm/index.js +14 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +4 -13
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/package-3bbdb32c.js +5 -0
- package/dist/esm/package-3bbdb32c.js.map +1 -0
- package/dist/esm/post-accordion.entry.js +85 -0
- package/dist/esm/post-accordion.entry.js.map +1 -0
- package/dist/esm/post-alert-5dd43c8b.js +99 -0
- package/dist/esm/post-alert-5dd43c8b.js.map +1 -0
- package/dist/esm/post-alert.entry.js +8 -100
- package/dist/esm/post-alert.entry.js.map +1 -1
- package/dist/esm/post-collapsible-26dc2340.js +91 -0
- package/dist/esm/post-collapsible-26dc2340.js.map +1 -0
- package/dist/esm/post-collapsible.entry.js +6 -122
- package/dist/esm/post-collapsible.entry.js.map +1 -1
- package/dist/esm/post-components.js +4 -7
- package/dist/esm/post-components.js.map +1 -1
- package/dist/esm/post-icon-fb0eb8aa.js +103 -0
- package/dist/esm/post-icon-fb0eb8aa.js.map +1 -0
- package/dist/esm/post-icon.entry.js +7 -103
- package/dist/esm/post-icon.entry.js.map +1 -1
- package/dist/esm/post-tab-header-deebc551.js +31 -0
- package/dist/esm/post-tab-header-deebc551.js.map +1 -0
- package/dist/esm/post-tab-header.entry.js +5 -29
- package/dist/esm/post-tab-header.entry.js.map +1 -1
- package/dist/esm/post-tab-panel-4b820f71.js +25 -0
- package/dist/esm/post-tab-panel-4b820f71.js.map +1 -0
- package/dist/esm/post-tab-panel.entry.js +3 -23
- package/dist/esm/post-tab-panel.entry.js.map +1 -1
- package/dist/esm/post-tabs-2d8d6a33.js +151 -0
- package/dist/esm/post-tabs-2d8d6a33.js.map +1 -0
- package/dist/esm/post-tabs.entry.js +4 -130
- package/dist/esm/post-tabs.entry.js.map +1 -1
- package/dist/esm/post-tooltip-811309c5.js +5093 -0
- package/dist/esm/post-tooltip-811309c5.js.map +1 -0
- package/dist/esm/post-tooltip.entry.js +4 -5091
- package/dist/esm/post-tooltip.entry.js.map +1 -1
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/{p-2b6ab354.entry.js → p-01e8dfe6.js} +3 -3
- package/dist/post-components/p-01e8dfe6.js.map +1 -0
- package/dist/post-components/p-0a49c1a3.entry.js +2 -0
- package/dist/post-components/{p-bcc705f1.js → p-1339f8cd.js} +1 -1
- package/dist/post-components/p-1339f8cd.js.map +1 -0
- package/dist/post-components/p-1a8a8ef2.js +2 -0
- package/dist/post-components/p-1a8a8ef2.js.map +1 -0
- package/dist/post-components/p-27092ac3.entry.js +2 -0
- package/dist/post-components/p-27092ac3.entry.js.map +1 -0
- package/dist/post-components/{p-e5306504.js → p-2737eaf5.js} +1 -1
- package/dist/post-components/p-2737eaf5.js.map +1 -0
- package/dist/post-components/p-332eef46.js +2 -0
- package/dist/post-components/p-332eef46.js.map +1 -0
- package/dist/post-components/p-440193f4.js +2 -0
- package/dist/post-components/p-440193f4.js.map +1 -0
- package/dist/post-components/p-541142fd.js +2 -0
- package/dist/post-components/p-541142fd.js.map +1 -0
- package/dist/post-components/p-574acdb0.js +2 -0
- package/dist/post-components/p-574acdb0.js.map +1 -0
- package/dist/post-components/p-66460e3f.entry.js +2 -0
- package/dist/post-components/p-66460e3f.entry.js.map +1 -0
- package/dist/post-components/p-810ee105.entry.js +2 -0
- package/dist/post-components/p-810ee105.entry.js.map +1 -0
- package/dist/post-components/p-939df031.entry.js +2 -0
- package/dist/post-components/p-939df031.entry.js.map +1 -0
- package/dist/post-components/p-94b3f291.entry.js +2 -0
- package/dist/post-components/p-94b3f291.entry.js.map +1 -0
- package/dist/post-components/p-97000cb6.js +2 -0
- package/dist/post-components/p-97000cb6.js.map +1 -0
- package/dist/post-components/p-a7649277.js +3 -0
- package/dist/post-components/p-a7649277.js.map +1 -0
- package/dist/post-components/p-abd149b3.entry.js +2 -0
- package/dist/post-components/p-abd149b3.entry.js.map +1 -0
- package/dist/post-components/p-b531475e.js +2 -0
- package/dist/post-components/p-b531475e.js.map +1 -0
- package/dist/post-components/p-c6b73d6e.js +2 -0
- package/dist/post-components/p-c6b73d6e.js.map +1 -0
- package/dist/post-components/{p-29535fea.entry.js → p-d4fb9f16.js} +2 -2
- package/dist/post-components/p-d4fb9f16.js.map +1 -0
- package/dist/post-components/p-dfe29f7f.js +2 -0
- package/dist/post-components/p-dfe29f7f.js.map +1 -0
- package/dist/post-components/p-e9dc9039.entry.js +2 -0
- package/dist/post-components/p-e9dc9039.entry.js.map +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/post-components/post-components.esm.js.map +1 -1
- package/dist/types/animations/collapse.d.ts +2 -0
- package/dist/types/components/post-accordion/post-accordion.d.ts +28 -0
- package/dist/types/components/post-alert/post-alert.d.ts +1 -1
- package/dist/types/components/post-collapsible/heading-levels.d.ts +2 -0
- package/dist/types/components/post-collapsible/post-collapsible.d.ts +16 -12
- package/dist/types/components/post-tabs/post-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +79 -3
- package/dist/types/index.d.ts +7 -0
- package/dist/types/stencil-public-runtime.d.ts +38 -5
- package/dist/types/utils/index.d.ts +1 -3
- package/dist/types/utils/is-motion-reduced.d.ts +1 -0
- package/loader/index.d.ts +1 -1
- package/package.json +8 -8
- package/dist/cjs/check-non-empty-35b4d0b5.js +0 -14
- package/dist/cjs/check-non-empty-35b4d0b5.js.map +0 -1
- package/dist/cjs/check-one-of-4c2e8b2e.js.map +0 -1
- package/dist/cjs/check-type-508a21a5.js +0 -18
- package/dist/cjs/check-type-508a21a5.js.map +0 -1
- package/dist/cjs/fade-8c6d4fa7.js +0 -12
- package/dist/cjs/fade-8c6d4fa7.js.map +0 -1
- package/dist/cjs/index-12cc37c9.js.map +0 -1
- package/dist/cjs/index-f8f6f146.js +0 -28
- package/dist/cjs/index-f8f6f146.js.map +0 -1
- package/dist/cjs/package-67091813.js +0 -7
- package/dist/cjs/package-67091813.js.map +0 -1
- package/dist/collection/utils/get-element-height.js +0 -12
- package/dist/collection/utils/get-element-height.js.map +0 -1
- package/dist/collection/utils/on-transition-end.js +0 -15
- package/dist/collection/utils/on-transition-end.js.map +0 -1
- package/dist/collection/utils/should-reduce-motion.js +0 -4
- package/dist/collection/utils/should-reduce-motion.js.map +0 -1
- package/dist/components/check-type.js +0 -16
- package/dist/components/check-type.js.map +0 -1
- package/dist/esm/check-non-empty-554bdf88.js +0 -11
- package/dist/esm/check-non-empty-554bdf88.js.map +0 -1
- package/dist/esm/check-one-of-ded5e15e.js.map +0 -1
- package/dist/esm/check-type-18ebb4e7.js +0 -16
- package/dist/esm/check-type-18ebb4e7.js.map +0 -1
- package/dist/esm/fade-671f1489.js +0 -9
- package/dist/esm/fade-671f1489.js.map +0 -1
- package/dist/esm/index-5611074b.js.map +0 -1
- package/dist/esm/index-7f723686.js +0 -24
- package/dist/esm/index-7f723686.js.map +0 -1
- package/dist/esm/package-f5cb3167.js +0 -5
- package/dist/esm/package-f5cb3167.js.map +0 -1
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/post-components/p-12046db8.entry.js +0 -2
- package/dist/post-components/p-12046db8.entry.js.map +0 -1
- package/dist/post-components/p-15fc087f.js +0 -2
- package/dist/post-components/p-15fc087f.js.map +0 -1
- package/dist/post-components/p-24b07f64.js +0 -2
- package/dist/post-components/p-29535fea.entry.js.map +0 -1
- package/dist/post-components/p-296af738.entry.js +0 -2
- package/dist/post-components/p-296af738.entry.js.map +0 -1
- package/dist/post-components/p-2b6ab354.entry.js.map +0 -1
- package/dist/post-components/p-75a7b352.js +0 -2
- package/dist/post-components/p-75a7b352.js.map +0 -1
- package/dist/post-components/p-a14ec7bb.entry.js +0 -2
- package/dist/post-components/p-a14ec7bb.entry.js.map +0 -1
- package/dist/post-components/p-bcc705f1.js.map +0 -1
- package/dist/post-components/p-c7497ecb.entry.js +0 -2
- package/dist/post-components/p-c7497ecb.entry.js.map +0 -1
- package/dist/post-components/p-c8efe0ae.js +0 -2
- package/dist/post-components/p-c8efe0ae.js.map +0 -1
- package/dist/post-components/p-cc6e4eb8.entry.js +0 -2
- package/dist/post-components/p-cc6e4eb8.entry.js.map +0 -1
- package/dist/post-components/p-d94db268.js +0 -3
- package/dist/post-components/p-d94db268.js.map +0 -1
- package/dist/post-components/p-e5306504.js.map +0 -1
- package/dist/types/utils/get-element-height.d.ts +0 -3
- package/dist/types/utils/on-transition-end.d.ts +0 -1
- package/dist/types/utils/should-reduce-motion.d.ts +0 -1
- /package/dist/post-components/{p-24b07f64.js.map → p-0a49c1a3.entry.js.map} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-4eff5fc5.js';
|
|
2
|
+
import { v as version } from './package-3bbdb32c.js';
|
|
3
|
+
|
|
4
|
+
const postTabPanelCss = ":host{display:none}";
|
|
5
|
+
|
|
6
|
+
const PostTabPanel = class {
|
|
7
|
+
constructor(hostRef) {
|
|
8
|
+
registerInstance(this, hostRef);
|
|
9
|
+
this.panelId = undefined;
|
|
10
|
+
this.name = undefined;
|
|
11
|
+
}
|
|
12
|
+
componentWillLoad() {
|
|
13
|
+
// get the id set on the host element or use a random id by default
|
|
14
|
+
this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
return (h(Host, { "data-version": version }, h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, h("slot", null))));
|
|
18
|
+
}
|
|
19
|
+
get host() { return getElement(this); }
|
|
20
|
+
};
|
|
21
|
+
PostTabPanel.style = postTabPanelCss;
|
|
22
|
+
|
|
23
|
+
export { PostTabPanel as P };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=post-tab-panel-4b820f71.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"post-tab-panel-4b820f71.js","mappings":";;;AAAA,MAAM,eAAe,GAAG,qBAAqB;;MCQhC,YAAY;;;;;;EAUvB,iBAAiB;;IAEf,IAAI,CAAC,OAAO,GAAG,SAAS,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;GAC/D;EAED,MAAM;IACJ,QACE,EAAC,IAAI,oBAAe,OAAO,IACzB,WACE,KAAK,EAAC,UAAU,EAChB,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,IAAI,EAAC,UAAU,IAEf,eAAO,CACH,CACD,EACP;GACH;;;;;;;","names":[],"sources":["src/components/post-tab-panel/post-tab-panel.scss?tag=post-tab-panel&encapsulation=shadow","src/components/post-tab-panel/post-tab-panel.tsx"],"sourcesContent":[":host {\n display: none;\n}\n","import { Component, Element, h, Host, Prop, State } from '@stencil/core';\nimport { version } from '../../../package.json';\n\n@Component({\n tag: 'post-tab-panel',\n styleUrl: 'post-tab-panel.scss',\n shadow: true,\n})\nexport class PostTabPanel {\n @Element() host: HTMLPostTabPanelElement;\n\n @State() panelId: string;\n\n /**\n * The name of the panel, used to associate it with a tab header.\n */\n @Prop() readonly name: string;\n\n componentWillLoad() {\n // get the id set on the host element or use a random id by default\n this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div\n class=\"tab-pane\"\n id={this.panelId}\n role=\"tabpanel\"\n >\n <slot/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const postTabPanelCss = ":host{display:none}";
|
|
5
|
-
|
|
6
|
-
const PostTabPanel = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
registerInstance(this, hostRef);
|
|
9
|
-
this.panelId = undefined;
|
|
10
|
-
this.name = undefined;
|
|
11
|
-
}
|
|
12
|
-
componentWillLoad() {
|
|
13
|
-
// get the id set on the host element or use a random id by default
|
|
14
|
-
this.panelId = `panel-${this.host.id || crypto.randomUUID()}`;
|
|
15
|
-
}
|
|
16
|
-
render() {
|
|
17
|
-
return (h(Host, { "data-version": version }, h("div", { class: "tab-pane", id: this.panelId, role: "tabpanel" }, h("slot", null))));
|
|
18
|
-
}
|
|
19
|
-
get host() { return getElement(this); }
|
|
20
|
-
};
|
|
21
|
-
PostTabPanel.style = postTabPanelCss;
|
|
22
|
-
|
|
23
|
-
export { PostTabPanel as post_tab_panel };
|
|
1
|
+
export { P as post_tab_panel } from './post-tab-panel-4b820f71.js';
|
|
2
|
+
import './index-4eff5fc5.js';
|
|
3
|
+
import './package-3bbdb32c.js';
|
|
24
4
|
|
|
25
5
|
//# sourceMappingURL=post-tab-panel.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"post-tab-panel.entry.js","mappings":"
|
|
1
|
+
{"file":"post-tab-panel.entry.js","mappings":";;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-4eff5fc5.js';
|
|
2
|
+
import { v as version } from './package-3bbdb32c.js';
|
|
3
|
+
import { f as fadeOut, a as fadeIn } from './fade-7fd71785.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:#ccc}.tabs-wrapper .tabs{background-color:rgba(0,0,0,0) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tabs-wrapper::after{background-color:ButtonBorder}}.tabs{margin:0;padding:0;list-style:none;display:flex;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;white-space:nowrap}.tabs::after{content:\"\";display:block;flex:1 0 auto;width:1rem}.tab-content{padding-top:1rem;padding-bottom:1rem}.bg-yellow .tabs-wrapper{background-color:#fc0}.bg-light .tabs-wrapper{background-color:#faf9f8}.bg-gray .tabs-wrapper{background-color:#f4f3f1}.bg-dark .tabs-wrapper{background-color:#333}.bg-primary .tabs-wrapper{background-color:#333}.bg-white .tabs-wrapper{background-color:#fff}.bg-black .tabs-wrapper{background-color:#000}.bg-success .tabs-wrapper{background-color:#2c911c}.bg-info .tabs-wrapper{background-color:#cce4ee}.bg-warning .tabs-wrapper{background-color:#f49e00}.bg-danger .tabs-wrapper{background-color:#a51728}.bg-nightblue .tabs-wrapper{background-color:#004976}.bg-nightblue-bright .tabs-wrapper{background-color:#0076a8}.bg-petrol .tabs-wrapper{background-color:#006d68}.bg-petrol-bright .tabs-wrapper{background-color:#00968f}.bg-coral .tabs-wrapper{background-color:#9e2a2f}.bg-coral-bright .tabs-wrapper{background-color:#e03c31}.bg-olive .tabs-wrapper{background-color:#716135}.bg-olive-bright .tabs-wrapper{background-color:#aa9d2e}.bg-purple .tabs-wrapper{background-color:#80276c}.bg-purple-bright .tabs-wrapper{background-color:#c5299b}.bg-aubergine .tabs-wrapper{background-color:#523178}.bg-aubergine-bright .tabs-wrapper{background-color:#7566a0}:host{display:block}";
|
|
6
|
+
|
|
7
|
+
const PostTabs = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
registerInstance(this, hostRef);
|
|
10
|
+
this.tabChange = createEvent(this, "tabChange", 7);
|
|
11
|
+
this.isLoaded = false;
|
|
12
|
+
this.activePanel = undefined;
|
|
13
|
+
}
|
|
14
|
+
get tabs() {
|
|
15
|
+
return this.host.querySelectorAll('post-tab-header');
|
|
16
|
+
}
|
|
17
|
+
componentDidLoad() {
|
|
18
|
+
this.moveMisplacedTabs();
|
|
19
|
+
this.enableTabs();
|
|
20
|
+
const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;
|
|
21
|
+
void this.show(initiallyActivePanel);
|
|
22
|
+
this.isLoaded = true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Shows the panel with the given name and selects its associated tab.
|
|
26
|
+
* Any other panel that was previously shown becomes hidden and its associated tab is unselected.
|
|
27
|
+
*/
|
|
28
|
+
async show(panelName) {
|
|
29
|
+
var _a;
|
|
30
|
+
// do nothing if the tab is already active
|
|
31
|
+
if (panelName === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const previousTab = this.activeTab;
|
|
35
|
+
const newTab = this.host.querySelector(`post-tab-header[panel=${panelName}]`);
|
|
36
|
+
this.activateTab(newTab);
|
|
37
|
+
// if a panel is currently being displayed, remove it from the view and complete the associated animation
|
|
38
|
+
if (this.showing) {
|
|
39
|
+
this.showing.effect['target'].style.display = 'none';
|
|
40
|
+
this.showing.finish();
|
|
41
|
+
}
|
|
42
|
+
// hide the currently visible panel only if no other animation is running
|
|
43
|
+
if (previousTab && !this.showing && !this.hiding) {
|
|
44
|
+
this.hidePanel(previousTab.panel);
|
|
45
|
+
}
|
|
46
|
+
// wait for any hiding animation to complete before showing the selected tab
|
|
47
|
+
if (this.hiding) {
|
|
48
|
+
await this.hiding.finished;
|
|
49
|
+
}
|
|
50
|
+
this.showSelectedPanel();
|
|
51
|
+
// wait for any display animation to complete for the returned promise to fully resolve
|
|
52
|
+
if (this.showing) {
|
|
53
|
+
await this.showing.finished;
|
|
54
|
+
}
|
|
55
|
+
this.tabChange.emit(this.activeTab.panel);
|
|
56
|
+
}
|
|
57
|
+
moveMisplacedTabs() {
|
|
58
|
+
if (!this.tabs)
|
|
59
|
+
return;
|
|
60
|
+
this.tabs.forEach(tab => {
|
|
61
|
+
if (tab.getAttribute('slot') === 'tabs')
|
|
62
|
+
return;
|
|
63
|
+
tab.setAttribute('slot', 'tabs');
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
enableTabs() {
|
|
67
|
+
if (!this.tabs)
|
|
68
|
+
return;
|
|
69
|
+
this.tabs.forEach(async (tab) => {
|
|
70
|
+
await tab.componentOnReady();
|
|
71
|
+
const tabTitle = tab.shadowRoot.querySelector('.tab-title');
|
|
72
|
+
// if the tab has an "aria-controls" attribute it was already linked to its panel: do nothing
|
|
73
|
+
if (tabTitle.getAttribute('aria-controls'))
|
|
74
|
+
return;
|
|
75
|
+
const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');
|
|
76
|
+
tabTitle.setAttribute('aria-controls', tabPanel.id);
|
|
77
|
+
tabPanel.setAttribute('aria-labelledby', tabTitle.id);
|
|
78
|
+
tab.addEventListener('click', () => {
|
|
79
|
+
void this.show(tab.panel);
|
|
80
|
+
});
|
|
81
|
+
tab.addEventListener('keydown', ({ key }) => {
|
|
82
|
+
if (key === 'ArrowRight' || key === 'ArrowLeft')
|
|
83
|
+
this.navigateTabs(tab, key);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
// if the currently active tab was removed from the DOM then select the first one
|
|
87
|
+
if (this.activeTab && !this.activeTab.isConnected) {
|
|
88
|
+
void this.show(this.tabs.item(0).panel);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
activateTab(tab) {
|
|
92
|
+
if (this.activeTab) {
|
|
93
|
+
const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');
|
|
94
|
+
tabTitle.setAttribute('aria-selected', 'false');
|
|
95
|
+
tabTitle.setAttribute('tabindex', '-1');
|
|
96
|
+
tabTitle.classList.remove('active');
|
|
97
|
+
}
|
|
98
|
+
const tabTitle = tab.shadowRoot.querySelector('.tab-title');
|
|
99
|
+
tabTitle.setAttribute('aria-selected', 'true');
|
|
100
|
+
tabTitle.removeAttribute('tabindex');
|
|
101
|
+
tabTitle.classList.add('active');
|
|
102
|
+
this.activeTab = tab;
|
|
103
|
+
}
|
|
104
|
+
hidePanel(panelName) {
|
|
105
|
+
const previousPanel = this.getPanel(panelName);
|
|
106
|
+
if (!previousPanel)
|
|
107
|
+
return;
|
|
108
|
+
this.hiding = fadeOut(previousPanel);
|
|
109
|
+
this.hiding.onfinish = () => {
|
|
110
|
+
previousPanel.style.display = 'none';
|
|
111
|
+
this.hiding = null;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
showSelectedPanel() {
|
|
115
|
+
const panel = this.getPanel(this.activeTab.panel);
|
|
116
|
+
panel.style.display = 'block';
|
|
117
|
+
// prevent the initially selected panel from fading in
|
|
118
|
+
if (!this.isLoaded)
|
|
119
|
+
return;
|
|
120
|
+
this.showing = fadeIn(panel);
|
|
121
|
+
this.showing.onfinish = () => {
|
|
122
|
+
this.showing = null;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
getPanel(name) {
|
|
126
|
+
return this.host.querySelector(`post-tab-panel[name=${name}]`);
|
|
127
|
+
}
|
|
128
|
+
navigateTabs(tab, key) {
|
|
129
|
+
const activeTabIndex = Array.from(this.tabs).indexOf(tab);
|
|
130
|
+
let nextTab;
|
|
131
|
+
if (key === 'ArrowRight') {
|
|
132
|
+
nextTab = this.tabs[activeTabIndex + 1] || this.tabs[0];
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];
|
|
136
|
+
}
|
|
137
|
+
if (!nextTab)
|
|
138
|
+
return;
|
|
139
|
+
const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title');
|
|
140
|
+
nextTabTitle.focus();
|
|
141
|
+
}
|
|
142
|
+
render() {
|
|
143
|
+
return (h(Host, { "data-version": version }, h("div", { class: "tabs-wrapper" }, h("div", { class: "tabs", role: "tablist" }, h("slot", { name: "tabs", onSlotchange: () => this.enableTabs() }))), h("div", { class: "tab-content" }, h("slot", { onSlotchange: () => this.moveMisplacedTabs() }))));
|
|
144
|
+
}
|
|
145
|
+
get host() { return getElement(this); }
|
|
146
|
+
};
|
|
147
|
+
PostTabs.style = postTabsCss;
|
|
148
|
+
|
|
149
|
+
export { PostTabs as P };
|
|
150
|
+
|
|
151
|
+
//# sourceMappingURL=post-tabs-2d8d6a33.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"post-tabs-2d8d6a33.js","mappings":";;;;AAAA,MAAM,WAAW,GAAG,yzDAAyzD;;MCSh0D,QAAQ;;;;IAIX,aAAQ,GAAG,KAAK,CAAC;;;EAEzB,IAAY,IAAI;IACd,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,iBAAi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AK,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,IAC9B,YAAM,IAAI,EAAC,MAAM,EAAC,YAAY,EAAE,MAAM,IAAI,CAAC,UAAU,EAAE,GAAI,CACvD,CACF,EACN,WAAK,KAAK,EAAC,aAAa,IACtB,YAAM,YAAY,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,GAAI,CAClD,CACD,EACP;GACH;;;;;;;","names":[],"sources":["src/components/post-tabs/post-tabs.scss?tag=post-tabs&encapsulation=shadow","src/components/post-tabs/post-tabs.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tabs-wrapper';\n\n:host {\n display: block;\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeIn, fadeOut } from '../../animations';\n\n@Component({\n tag: 'post-tabs',\n styleUrl: 'post-tabs.scss',\n shadow: true,\n})\nexport class PostTabs {\n private activeTab: HTMLPostTabHeaderElement;\n private showing: Animation;\n private hiding: Animation;\n private isLoaded = false;\n\n private get tabs(): NodeListOf<HTMLPostTabHeaderElement> {\n return this.host.querySelectorAll('post-tab-header');\n }\n\n @Element() host: HTMLPostTabsElement;\n\n /**\n * The name of the panel that is initially shown.\n * If not specified, it defaults to the panel associated with the first tab.\n *\n * **Changing this value after initialization has no effect.**\n */\n @Prop() readonly activePanel: HTMLPostTabPanelElement['name'];\n\n /**\n * An event emitted after the active tab changes, when the fade in transition of its associated panel is finished.\n * The payload is the name of the newly shown panel.\n */\n @Event() tabChange: EventEmitter<HTMLPostTabPanelElement['name']>;\n\n componentDidLoad() {\n this.moveMisplacedTabs();\n this.enableTabs();\n\n const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;\n void this.show(initiallyActivePanel);\n\n this.isLoaded = true;\n }\n\n /**\n * Shows the panel with the given name and selects its associated tab.\n * Any other panel that was previously shown becomes hidden and its associated tab is unselected.\n */\n @Method()\n async show(panelName: string) {\n // do nothing if the tab is already active\n if (panelName === this.activeTab?.panel) {\n return;\n }\n\n const previousTab = this.activeTab;\n const newTab: HTMLPostTabHeaderElement = this.host.querySelector(\n `post-tab-header[panel=${panelName}]`,\n );\n this.activateTab(newTab);\n\n // if a panel is currently being displayed, remove it from the view and complete the associated animation\n if (this.showing) {\n this.showing.effect['target'].style.display = 'none';\n this.showing.finish();\n }\n\n // hide the currently visible panel only if no other animation is running\n if (previousTab && !this.showing && !this.hiding) {\n this.hidePanel(previousTab.panel);\n }\n\n // wait for any hiding animation to complete before showing the selected tab\n if (this.hiding) {\n await this.hiding.finished;\n }\n\n this.showSelectedPanel();\n\n // wait for any display animation to complete for the returned promise to fully resolve\n if (this.showing) {\n await this.showing.finished;\n }\n\n this.tabChange.emit(this.activeTab.panel);\n }\n\n private moveMisplacedTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(tab => {\n if (tab.getAttribute('slot') === 'tabs') return;\n tab.setAttribute('slot', 'tabs');\n });\n }\n\n private enableTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(async tab => {\n await tab.componentOnReady();\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n\n // if the tab has an \"aria-controls\" attribute it was already linked to its panel: do nothing\n if (tabTitle.getAttribute('aria-controls')) return;\n\n const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');\n tabTitle.setAttribute('aria-controls', tabPanel.id);\n tabPanel.setAttribute('aria-labelledby', tabTitle.id);\n\n tab.addEventListener('click', () => {\n void this.show(tab.panel);\n });\n\n tab.addEventListener('keydown', ({ key }) => {\n if (key === 'ArrowRight' || key === 'ArrowLeft') this.navigateTabs(tab, key);\n });\n });\n\n // if the currently active tab was removed from the DOM then select the first one\n if (this.activeTab && !this.activeTab.isConnected) {\n void this.show(this.tabs.item(0).panel);\n }\n }\n\n private activateTab(tab: HTMLPostTabHeaderElement) {\n if (this.activeTab) {\n const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'false');\n tabTitle.setAttribute('tabindex', '-1');\n tabTitle.classList.remove('active');\n }\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'true');\n tabTitle.removeAttribute('tabindex');\n tabTitle.classList.add('active');\n\n this.activeTab = tab;\n }\n\n private hidePanel(panelName: HTMLPostTabPanelElement['name']) {\n const previousPanel = this.getPanel(panelName);\n\n if (!previousPanel) return;\n\n this.hiding = fadeOut(previousPanel);\n this.hiding.onfinish = () => {\n previousPanel.style.display = 'none';\n this.hiding = null;\n };\n }\n\n private showSelectedPanel() {\n const panel = this.getPanel(this.activeTab.panel);\n panel.style.display = 'block';\n\n // prevent the initially selected panel from fading in\n if (!this.isLoaded) return;\n\n this.showing = fadeIn(panel);\n this.showing.onfinish = () => {\n this.showing = null;\n };\n }\n\n private getPanel(name: string): HTMLPostTabPanelElement {\n return this.host.querySelector(`post-tab-panel[name=${name}]`);\n }\n\n private navigateTabs(tab: HTMLPostTabHeaderElement, key: 'ArrowRight' | 'ArrowLeft') {\n const activeTabIndex = Array.from(this.tabs).indexOf(tab);\n\n let nextTab: HTMLPostTabHeaderElement;\n if (key === 'ArrowRight') {\n nextTab = this.tabs[activeTabIndex + 1] || this.tabs[0];\n } else {\n nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];\n }\n\n if (!nextTab) return;\n\n const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title') as HTMLAnchorElement;\n nextTabTitle.focus();\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div class=\"tabs-wrapper\">\n <div class=\"tabs\" role=\"tablist\">\n <slot name=\"tabs\" onSlotchange={() => this.enableTabs()} />\n </div>\n </div>\n <div class=\"tab-content\">\n <slot onSlotchange={() => this.moveMisplacedTabs()} />\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,132 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 = class {
|
|
8
|
-
constructor(hostRef) {
|
|
9
|
-
registerInstance(this, hostRef);
|
|
10
|
-
this.tabChange = createEvent(this, "tabChange", 7);
|
|
11
|
-
this.isLoaded = false;
|
|
12
|
-
this.activePanel = undefined;
|
|
13
|
-
}
|
|
14
|
-
get tabs() {
|
|
15
|
-
return this.host.querySelectorAll('post-tab-header');
|
|
16
|
-
}
|
|
17
|
-
componentDidLoad() {
|
|
18
|
-
this.moveMisplacedTabs();
|
|
19
|
-
this.enableTabs();
|
|
20
|
-
const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;
|
|
21
|
-
this.show(initiallyActivePanel);
|
|
22
|
-
this.isLoaded = true;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Shows the panel with the given name and selects its associated tab.
|
|
26
|
-
* Any other panel that was previously shown becomes hidden and its associated tab is unselected.
|
|
27
|
-
*/
|
|
28
|
-
async show(panelName) {
|
|
29
|
-
var _a;
|
|
30
|
-
// do nothing if the tab is already active
|
|
31
|
-
if (panelName === ((_a = this.activeTab) === null || _a === void 0 ? void 0 : _a.panel)) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const previousTab = this.activeTab;
|
|
35
|
-
const newTab = this.host.querySelector(`post-tab-header[panel=${panelName}]`);
|
|
36
|
-
this.activateTab(newTab);
|
|
37
|
-
// if a panel is currently being displayed, remove it from the view and complete the associated animation
|
|
38
|
-
if (this.showing) {
|
|
39
|
-
this.showing.effect['target'].style.display = 'none';
|
|
40
|
-
this.showing.finish();
|
|
41
|
-
}
|
|
42
|
-
// hide the currently visible panel only if no other animation is running
|
|
43
|
-
if (previousTab && !this.showing && !this.hiding) {
|
|
44
|
-
this.hidePanel(previousTab.panel);
|
|
45
|
-
}
|
|
46
|
-
// wait for any hiding animation to complete before showing the selected tab
|
|
47
|
-
if (this.hiding) {
|
|
48
|
-
await this.hiding.finished;
|
|
49
|
-
}
|
|
50
|
-
this.showSelectedPanel();
|
|
51
|
-
// wait for any display animation to complete for the returned promise to fully resolve
|
|
52
|
-
if (this.showing) {
|
|
53
|
-
await this.showing.finished;
|
|
54
|
-
}
|
|
55
|
-
this.tabChange.emit(this.activeTab.panel);
|
|
56
|
-
}
|
|
57
|
-
moveMisplacedTabs() {
|
|
58
|
-
if (!this.tabs)
|
|
59
|
-
return;
|
|
60
|
-
this.tabs.forEach(tab => {
|
|
61
|
-
if (tab.getAttribute('slot') === 'tabs')
|
|
62
|
-
return;
|
|
63
|
-
tab.setAttribute('slot', 'tabs');
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
enableTabs() {
|
|
67
|
-
if (!this.tabs)
|
|
68
|
-
return;
|
|
69
|
-
this.tabs.forEach(async (tab) => {
|
|
70
|
-
await tab.componentOnReady();
|
|
71
|
-
const tabTitle = tab.shadowRoot.querySelector('.tab-title');
|
|
72
|
-
// if the tab has an "aria-controls" attribute it was already linked to its panel: do nothing
|
|
73
|
-
if (tabTitle.getAttribute('aria-controls'))
|
|
74
|
-
return;
|
|
75
|
-
const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');
|
|
76
|
-
tabTitle.setAttribute('aria-controls', tabPanel.id);
|
|
77
|
-
tabPanel.setAttribute('aria-labelledby', tabTitle.id);
|
|
78
|
-
tab.addEventListener('click', e => {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
this.show(tab.panel);
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
// if the currently active tab was removed from the DOM then select the first one
|
|
84
|
-
if (this.activeTab && !this.activeTab.isConnected) {
|
|
85
|
-
this.show(this.tabs.item(0).panel);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
activateTab(tab) {
|
|
89
|
-
if (this.activeTab) {
|
|
90
|
-
const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');
|
|
91
|
-
tabTitle.setAttribute('aria-selected', 'false');
|
|
92
|
-
tabTitle.classList.remove('active');
|
|
93
|
-
}
|
|
94
|
-
const tabTitle = tab.shadowRoot.querySelector('.tab-title');
|
|
95
|
-
tabTitle.setAttribute('aria-selected', 'true');
|
|
96
|
-
tabTitle.classList.add('active');
|
|
97
|
-
this.activeTab = tab;
|
|
98
|
-
}
|
|
99
|
-
hidePanel(panelName) {
|
|
100
|
-
const previousPanel = this.getPanel(panelName);
|
|
101
|
-
if (!previousPanel)
|
|
102
|
-
return;
|
|
103
|
-
this.hiding = fadeOut(previousPanel);
|
|
104
|
-
this.hiding.onfinish = () => {
|
|
105
|
-
previousPanel.style.display = 'none';
|
|
106
|
-
this.hiding = null;
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
showSelectedPanel() {
|
|
110
|
-
const panel = this.getPanel(this.activeTab.panel);
|
|
111
|
-
panel.style.display = 'block';
|
|
112
|
-
// prevent the initially selected panel from fading in
|
|
113
|
-
if (!this.isLoaded)
|
|
114
|
-
return;
|
|
115
|
-
this.showing = fadeIn(panel);
|
|
116
|
-
this.showing.onfinish = () => {
|
|
117
|
-
this.showing = null;
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
getPanel(name) {
|
|
121
|
-
return this.host.querySelector(`post-tab-panel[name=${name}]`);
|
|
122
|
-
}
|
|
123
|
-
render() {
|
|
124
|
-
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() }))));
|
|
125
|
-
}
|
|
126
|
-
get host() { return getElement(this); }
|
|
127
|
-
};
|
|
128
|
-
PostTabs.style = postTabsCss;
|
|
129
|
-
|
|
130
|
-
export { PostTabs as post_tabs };
|
|
1
|
+
export { P as post_tabs } from './post-tabs-2d8d6a33.js';
|
|
2
|
+
import './index-4eff5fc5.js';
|
|
3
|
+
import './package-3bbdb32c.js';
|
|
4
|
+
import './fade-7fd71785.js';
|
|
131
5
|
|
|
132
6
|
//# sourceMappingURL=post-tabs.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"post-tabs.entry.js","mappings":"
|
|
1
|
+
{"file":"post-tabs.entry.js","mappings":";;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|