@swisspost/design-system-components 8.0.0 → 8.2.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/{index-a1440961.js → index-01f30442.js} +13 -0
- package/dist/cjs/{index-baad16da.js → index-c15bd800.js} +43 -5
- package/dist/cjs/index.cjs.js +19 -17
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-28cba29c.js → package-f9a656fd.js} +1 -1
- package/dist/cjs/{post-accordion-fc746a6f.js → post-accordion-30216884.js} +2 -2
- package/dist/cjs/{post-accordion-item-c0492b73.js → post-accordion-item-4eba14e6.js} +3 -3
- package/dist/cjs/post-accordion-item.cjs.entry.js +4 -4
- package/dist/cjs/post-accordion.cjs.entry.js +3 -3
- package/dist/cjs/{post-alert-0612ad51.js → post-alert-e305480e.js} +4 -4
- package/dist/cjs/post-alert.cjs.entry.js +4 -4
- package/dist/cjs/post-card-control-e63582f3.js +272 -0
- package/dist/cjs/post-card-control.cjs.entry.js +3 -3
- package/dist/cjs/{post-collapsible-trigger-8d39196e.js → post-collapsible-trigger-5d8b9047.js} +3 -3
- package/dist/cjs/post-collapsible_2.cjs.entry.js +4 -4
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/{post-icon-bd260560.js → post-icon-8ab009d4.js} +3 -3
- package/dist/cjs/post-icon.cjs.entry.js +4 -4
- package/dist/cjs/post-logo-9f4c551c.js +39 -0
- package/dist/cjs/post-logo.cjs.entry.js +14 -0
- package/dist/cjs/{post-popover-303e76ef.js → post-popover-3f14dab4.js} +3 -3
- package/dist/cjs/post-popover.cjs.entry.js +3 -3
- package/dist/cjs/{post-popovercontainer-c64bde39.js → post-popovercontainer-5f1717be.js} +4 -4
- package/dist/cjs/post-popovercontainer.cjs.entry.js +3 -3
- package/dist/cjs/{post-rating-dc7bd246.js → post-rating-b6ebb2d7.js} +3 -3
- package/dist/cjs/post-rating.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-header-06c40218.js → post-tab-header-ebd691dd.js} +3 -3
- package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
- package/dist/cjs/{post-tab-panel-54fbdb66.js → post-tab-panel-a15af8bb.js} +3 -3
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/{post-tabs-52b9d638.js → post-tabs-d3233bc8.js} +28 -7
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/{post-tag-4aba2155.js → post-tag-534251e7.js} +4 -4
- package/dist/cjs/post-tag.cjs.entry.js +3 -3
- package/dist/cjs/{post-tooltip-3c695f60.js → post-tooltip-a8399659.js} +4 -4
- package/dist/cjs/post-tooltip.cjs.entry.js +4 -4
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/post-alert/post-alert.css +1 -1
- package/dist/collection/components/post-card-control/post-card-control.css +1 -1
- package/dist/collection/components/post-card-control/post-card-control.js +23 -25
- package/dist/collection/components/post-logo/post-logo.css +1 -0
- package/dist/collection/components/post-logo/post-logo.js +73 -0
- package/dist/collection/components/post-popover/post-popover.js +1 -1
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +2 -2
- package/dist/collection/components/post-rating/post-rating.js +1 -1
- package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
- package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
- package/dist/collection/components/post-tabs/post-tabs.js +6 -5
- package/dist/collection/components/post-tag/post-tag.css +1 -1
- package/dist/collection/components/post-tag/post-tag.js +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/component-on-ready.js +20 -0
- package/dist/collection/utils/index.js +1 -0
- package/dist/collection/utils/property-checkers/check-url.js +10 -0
- package/dist/collection/utils/property-checkers/index.js +3 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +13 -1
- package/dist/components/package.js +1 -1
- package/dist/components/post-alert2.js +1 -1
- package/dist/components/post-card-control2.js +21 -64
- package/dist/components/post-logo.d.ts +11 -0
- package/dist/components/post-logo.js +6 -0
- package/dist/components/post-logo2.js +56 -0
- package/dist/components/post-popover2.js +1 -1
- package/dist/components/post-popovercontainer2.js +2 -2
- package/dist/components/post-rating2.js +1 -1
- package/dist/components/post-tab-header2.js +1 -1
- package/dist/components/post-tab-panel2.js +1 -1
- package/dist/components/post-tabs2.js +26 -5
- package/dist/components/post-tag2.js +2 -2
- package/dist/components/post-tooltip2.js +1 -1
- package/dist/docs.json +64 -5
- package/dist/esm/{index-189d3985.js → index-0b56fc28.js} +43 -5
- package/dist/esm/{index-d1eba94c.js → index-f41b763f.js} +13 -1
- package/dist/esm/index.js +18 -17
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{package-3e4546f5.js → package-f02beabb.js} +1 -1
- package/dist/esm/{post-accordion-1cbd089a.js → post-accordion-f850422a.js} +2 -2
- package/dist/esm/{post-accordion-item-316ee985.js → post-accordion-item-c2eaeaa7.js} +3 -3
- package/dist/esm/post-accordion-item.entry.js +4 -4
- package/dist/esm/post-accordion.entry.js +3 -3
- package/dist/esm/{post-alert-6fa442b9.js → post-alert-f17886df.js} +4 -4
- package/dist/esm/post-alert.entry.js +4 -4
- package/dist/esm/post-card-control-25bbcb80.js +270 -0
- package/dist/esm/post-card-control.entry.js +3 -3
- package/dist/esm/{post-collapsible-trigger-6f4ba350.js → post-collapsible-trigger-49da97d7.js} +3 -3
- package/dist/esm/post-collapsible_2.entry.js +4 -4
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/{post-icon-fe467f6a.js → post-icon-168d95b5.js} +3 -3
- package/dist/esm/post-icon.entry.js +4 -4
- package/dist/esm/post-logo-47744c24.js +37 -0
- package/dist/esm/post-logo.entry.js +6 -0
- package/dist/esm/{post-popover-c9998136.js → post-popover-594e9965.js} +3 -3
- package/dist/esm/post-popover.entry.js +3 -3
- package/dist/esm/{post-popovercontainer-62ced3d7.js → post-popovercontainer-89cee0fe.js} +4 -4
- package/dist/esm/post-popovercontainer.entry.js +3 -3
- package/dist/esm/{post-rating-49ace0e9.js → post-rating-b87dfbdc.js} +3 -3
- package/dist/esm/post-rating.entry.js +3 -3
- package/dist/esm/{post-tab-header-696a7aae.js → post-tab-header-2c59fd6e.js} +3 -3
- package/dist/esm/post-tab-header.entry.js +3 -3
- package/dist/esm/{post-tab-panel-c00910fb.js → post-tab-panel-40bf9d2d.js} +3 -3
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/{post-tabs-a7990c9e.js → post-tabs-264e5871.js} +28 -7
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/{post-tag-d9650103.js → post-tag-a7c63782.js} +4 -4
- package/dist/esm/post-tag.entry.js +3 -3
- package/dist/esm/{post-tooltip-cf07e816.js → post-tooltip-5d2d9e1f.js} +4 -4
- package/dist/esm/post-tooltip.entry.js +4 -4
- package/dist/post-components/index.esm.js +1 -1
- package/dist/post-components/p-04cb82f1.entry.js +1 -0
- package/dist/post-components/{p-69145fd2.js → p-057d7d3a.js} +1 -1
- package/dist/post-components/{p-5c4773cb.js → p-0cca56a8.js} +2 -2
- package/dist/post-components/p-12f3ce0c.entry.js +1 -0
- package/dist/post-components/p-176b59a8.entry.js +1 -0
- package/dist/post-components/p-1800787b.js +1 -0
- package/dist/post-components/{p-f732d73c.js → p-300eb394.js} +1 -1
- package/dist/post-components/{p-6c701d9f.js → p-517f2648.js} +1 -1
- package/dist/post-components/p-53eb6ca5.entry.js +1 -0
- package/dist/post-components/p-5607b941.js +1 -0
- package/dist/post-components/p-5b918e0f.entry.js +1 -0
- package/dist/post-components/p-6069d96e.entry.js +1 -0
- package/dist/post-components/p-6b8378bf.js +1 -0
- package/dist/post-components/p-71b8ba91.entry.js +1 -0
- package/dist/post-components/p-78806458.entry.js +1 -0
- package/dist/post-components/p-851ef572.entry.js +1 -0
- package/dist/post-components/{p-783e67bc.js → p-8b28c907.js} +1 -1
- package/dist/post-components/{p-660ecc23.js → p-90eec417.js} +1 -1
- package/dist/post-components/p-9f2fc85c.js +1 -0
- package/dist/post-components/{p-ab26873d.js → p-ac5a88be.js} +1 -1
- package/dist/post-components/{p-266adbdd.js → p-aca6ea02.js} +1 -1
- package/dist/post-components/p-b08e169f.entry.js +1 -0
- package/dist/post-components/p-b6b61f13.js +1 -0
- package/dist/post-components/{p-a4794190.js → p-b8c5020d.js} +1 -1
- package/dist/post-components/p-be553212.entry.js +1 -0
- package/dist/post-components/p-bf357eb3.entry.js +1 -0
- package/dist/post-components/{p-7095990e.js → p-c76880ff.js} +1 -1
- package/dist/post-components/p-d2f9de94.js +2 -0
- package/dist/post-components/p-d4163064.js +1 -0
- package/dist/post-components/p-ddab4c09.entry.js +1 -0
- package/dist/post-components/p-deb4131c.js +1 -0
- package/dist/post-components/p-e597a879.entry.js +1 -0
- package/dist/post-components/p-eafc65f6.entry.js +1 -0
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-card-control/post-card-control.d.ts +5 -7
- package/dist/types/components/post-logo/post-logo.d.ts +14 -0
- package/dist/types/components.d.ts +29 -8
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/component-on-ready.d.ts +6 -0
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/property-checkers/check-url.d.ts +1 -0
- package/dist/types/utils/property-checkers/index.d.ts +2 -0
- package/loaders/attribute-observer.js +25 -0
- package/loaders/check-non-empty.js +9 -0
- package/loaders/check-one-of.js +6 -0
- package/loaders/check-type.js +14 -0
- package/loaders/constants.js +3 -0
- package/loaders/fade.js +7 -0
- package/loaders/heading-levels.js +3 -0
- package/loaders/index.d.ts +68 -0
- package/loaders/index.js +18 -0
- package/loaders/index2.js +34 -0
- package/loaders/package.js +3 -0
- package/loaders/post-accordion-item.d.ts +11 -0
- package/loaders/post-accordion-item.js +86 -0
- package/loaders/post-accordion.d.ts +11 -0
- package/loaders/post-accordion.js +128 -0
- package/loaders/post-alert.d.ts +11 -0
- package/loaders/post-alert.js +139 -0
- package/loaders/post-card-control.d.ts +11 -0
- package/loaders/post-card-control.js +306 -0
- package/loaders/post-collapsible-trigger.d.ts +11 -0
- package/loaders/post-collapsible-trigger.js +6 -0
- package/loaders/post-collapsible-trigger2.js +144 -0
- package/loaders/post-collapsible.d.ts +11 -0
- package/loaders/post-collapsible.js +6 -0
- package/loaders/post-collapsible2.js +103 -0
- package/loaders/post-icon.d.ts +11 -0
- package/loaders/post-icon.js +6 -0
- package/loaders/post-icon2.js +136 -0
- package/loaders/post-logo.d.ts +11 -0
- package/loaders/post-logo.js +59 -0
- package/loaders/post-popover.d.ts +11 -0
- package/loaders/post-popover.js +133 -0
- package/loaders/post-popovercontainer.d.ts +11 -0
- package/loaders/post-popovercontainer.js +6 -0
- package/loaders/post-popovercontainer2.js +2204 -0
- package/loaders/post-rating.d.ts +11 -0
- package/loaders/post-rating.js +116 -0
- package/loaders/post-tab-header.d.ts +11 -0
- package/loaders/post-tab-header.js +53 -0
- package/loaders/post-tab-panel.d.ts +11 -0
- package/loaders/post-tab-panel.js +45 -0
- package/loaders/post-tabs.d.ts +11 -0
- package/loaders/post-tabs.js +192 -0
- package/loaders/post-tag.d.ts +11 -0
- package/loaders/post-tag.js +77 -0
- package/loaders/post-tooltip.d.ts +11 -0
- package/loaders/post-tooltip.js +5000 -0
- package/package.json +13 -12
- package/dist/cjs/post-card-control-2fd18624.js +0 -315
- package/dist/esm/post-card-control-41356aa4.js +0 -313
- package/dist/post-components/p-0aee269b.entry.js +0 -1
- package/dist/post-components/p-2240981f.entry.js +0 -1
- package/dist/post-components/p-27cb2e60.entry.js +0 -1
- package/dist/post-components/p-2c9277b1.entry.js +0 -1
- package/dist/post-components/p-3764a23a.entry.js +0 -1
- package/dist/post-components/p-382f85c4.js +0 -1
- package/dist/post-components/p-48ed21f0.entry.js +0 -1
- package/dist/post-components/p-496cee95.entry.js +0 -1
- package/dist/post-components/p-4ce46830.entry.js +0 -1
- package/dist/post-components/p-5135c965.entry.js +0 -1
- package/dist/post-components/p-6af42a67.entry.js +0 -1
- package/dist/post-components/p-7481e37a.entry.js +0 -1
- package/dist/post-components/p-8f0ee57c.entry.js +0 -1
- package/dist/post-components/p-90479234.js +0 -1
- package/dist/post-components/p-a4e13e9c.js +0 -1
- package/dist/post-components/p-b08aca79.entry.js +0 -1
- package/dist/post-components/p-beb27e06.js +0 -1
- package/dist/post-components/p-c0f265c8.js +0 -2
- package/dist/post-components/p-e024aa18.js +0 -1
- package/dist/post-components/p-ea063aae.entry.js +0 -1
- package/dist/post-components/p-f91c0e1b.js +0 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { v as version } from './package.js';
|
|
3
|
+
import { c as checkEmptyOrType } from './index2.js';
|
|
4
|
+
|
|
5
|
+
function isMotionReduced() {
|
|
6
|
+
return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const collapseDuration = 350;
|
|
10
|
+
const collapseEasing = 'ease';
|
|
11
|
+
const collapsedKeyframe = { height: '0', overflow: 'hidden' };
|
|
12
|
+
const animationOptions = {
|
|
13
|
+
duration: collapseDuration,
|
|
14
|
+
easing: collapseEasing,
|
|
15
|
+
fill: 'forwards',
|
|
16
|
+
};
|
|
17
|
+
const collapse = (el) => {
|
|
18
|
+
const expandedKeyframe = { height: window.getComputedStyle(el).height };
|
|
19
|
+
return el.animate([expandedKeyframe, collapsedKeyframe], animationOptions);
|
|
20
|
+
};
|
|
21
|
+
const expand = (el) => {
|
|
22
|
+
const expandedKeyframe = { height: `${el.scrollHeight}px`, offset: 1 };
|
|
23
|
+
const finalKeyframe = { height: 'auto' };
|
|
24
|
+
return el.animate([collapsedKeyframe, expandedKeyframe, finalKeyframe], animationOptions);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const postCollapsibleCss = ":host{display:block;overflow:hidden}";
|
|
28
|
+
const PostCollapsibleStyle0 = postCollapsibleCss;
|
|
29
|
+
|
|
30
|
+
const PostCollapsible = /*@__PURE__*/ proxyCustomElement(class PostCollapsible extends HTMLElement {
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
this.__registerHost();
|
|
34
|
+
this.__attachShadow();
|
|
35
|
+
this.postToggle = createEvent(this, "postToggle", 7);
|
|
36
|
+
this.isLoaded = false;
|
|
37
|
+
this.isOpen = true;
|
|
38
|
+
this.collapsed = false;
|
|
39
|
+
}
|
|
40
|
+
collapsedChange() {
|
|
41
|
+
checkEmptyOrType(this.collapsed, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');
|
|
42
|
+
void this.toggle(!this.collapsed);
|
|
43
|
+
}
|
|
44
|
+
componentDidLoad() {
|
|
45
|
+
this.collapsedChange();
|
|
46
|
+
this.isLoaded = true;
|
|
47
|
+
this.updateTriggers();
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Triggers the collapse programmatically.
|
|
51
|
+
*
|
|
52
|
+
* If there is a collapsing transition running already, it will be reversed.
|
|
53
|
+
*/
|
|
54
|
+
async toggle(open = !this.isOpen) {
|
|
55
|
+
if (open === this.isOpen)
|
|
56
|
+
return open;
|
|
57
|
+
this.isOpen = open;
|
|
58
|
+
this.collapsed = !open;
|
|
59
|
+
if (this.isLoaded)
|
|
60
|
+
this.postToggle.emit(open);
|
|
61
|
+
const animation = open ? expand(this.host) : collapse(this.host);
|
|
62
|
+
if (!this.isLoaded || isMotionReduced())
|
|
63
|
+
animation.finish();
|
|
64
|
+
await animation.finished;
|
|
65
|
+
animation.commitStyles();
|
|
66
|
+
return open;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Update all post-collapsible-trigger elements referring to the collapsible
|
|
70
|
+
*/
|
|
71
|
+
updateTriggers() {
|
|
72
|
+
const triggers = document.querySelectorAll(`post-collapsible-trigger[for=${this.host.id}]`);
|
|
73
|
+
triggers.forEach(trigger => trigger.update());
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
return (h(Host, { key: '47ab19bf719a505dce35955d6250462acea47eee', "data-version": version }, h("slot", { key: 'd7fe5746afe1c343e9ec4c02878d8dead9360c26' })));
|
|
77
|
+
}
|
|
78
|
+
get host() { return this; }
|
|
79
|
+
static get watchers() { return {
|
|
80
|
+
"collapsed": ["collapsedChange"]
|
|
81
|
+
}; }
|
|
82
|
+
static get style() { return PostCollapsibleStyle0; }
|
|
83
|
+
}, [1, "post-collapsible", {
|
|
84
|
+
"collapsed": [1028],
|
|
85
|
+
"toggle": [64]
|
|
86
|
+
}, undefined, {
|
|
87
|
+
"collapsed": ["collapsedChange"]
|
|
88
|
+
}]);
|
|
89
|
+
function defineCustomElement() {
|
|
90
|
+
if (typeof customElements === "undefined") {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const components = ["post-collapsible"];
|
|
94
|
+
components.forEach(tagName => { switch (tagName) {
|
|
95
|
+
case "post-collapsible":
|
|
96
|
+
if (!customElements.get(tagName)) {
|
|
97
|
+
customElements.define(tagName, PostCollapsible);
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
} });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { PostCollapsible as P, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface PostIcon extends Components.PostIcon, HTMLElement {}
|
|
4
|
+
export const PostIcon: {
|
|
5
|
+
prototype: PostIcon;
|
|
6
|
+
new (): PostIcon;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { a as checkEmptyOrOneOf, c as checkEmptyOrType } from './index2.js';
|
|
3
|
+
import { v as version } from './package.js';
|
|
4
|
+
import { c as checkNonEmpty } from './check-non-empty.js';
|
|
5
|
+
import { c as checkType } from './check-type.js';
|
|
6
|
+
|
|
7
|
+
const postIconCss = ":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";
|
|
8
|
+
const PostIconStyle0 = postIconCss;
|
|
9
|
+
|
|
10
|
+
const CDN_URL = 'https://unpkg.com/@swisspost/design-system-icons/public/post-icons';
|
|
11
|
+
const ANIMATION_NAMES = [
|
|
12
|
+
'cylon',
|
|
13
|
+
'cylon-vertical',
|
|
14
|
+
'spin',
|
|
15
|
+
'spin-reverse',
|
|
16
|
+
'fade',
|
|
17
|
+
'throb',
|
|
18
|
+
];
|
|
19
|
+
const ANIMATION_KEYS = [...ANIMATION_NAMES];
|
|
20
|
+
const PostIcon = /*@__PURE__*/ proxyCustomElement(class PostIcon extends HTMLElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.__registerHost();
|
|
24
|
+
this.__attachShadow();
|
|
25
|
+
this.svgStyles = undefined;
|
|
26
|
+
this.svgOutput = undefined;
|
|
27
|
+
this.animation = null;
|
|
28
|
+
this.base = null;
|
|
29
|
+
this.flipH = false;
|
|
30
|
+
this.flipV = false;
|
|
31
|
+
this.name = undefined;
|
|
32
|
+
this.rotate = null;
|
|
33
|
+
this.scale = null;
|
|
34
|
+
}
|
|
35
|
+
validateAnimation(newValue = this.animation) {
|
|
36
|
+
if (newValue !== undefined)
|
|
37
|
+
checkEmptyOrOneOf(newValue, ANIMATION_KEYS, `The post-icon "animation" prop requires one of the following values: ${ANIMATION_KEYS.join(', ')}.`);
|
|
38
|
+
}
|
|
39
|
+
validateBase(newValue = this.base) {
|
|
40
|
+
checkEmptyOrType(newValue, 'string', 'The post-icon "base" prop should be a string.');
|
|
41
|
+
}
|
|
42
|
+
validateFlipH(newValue = this.flipH) {
|
|
43
|
+
checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipH" prop should be a boolean.');
|
|
44
|
+
}
|
|
45
|
+
validateFlipV(newValue = this.flipV) {
|
|
46
|
+
checkEmptyOrType(newValue, 'boolean', 'The post-icon "flipV" prop should be a boolean.');
|
|
47
|
+
}
|
|
48
|
+
validateName(newValue = this.name) {
|
|
49
|
+
checkNonEmpty(newValue, 'The post-icon "name" prop is required!.');
|
|
50
|
+
checkType(newValue, 'string', 'The post-icon "name" prop should be a string.');
|
|
51
|
+
}
|
|
52
|
+
validateRotate(newValue = this.rotate) {
|
|
53
|
+
checkEmptyOrType(newValue, 'number', 'The post-icon "rotate" prop should be a number.');
|
|
54
|
+
}
|
|
55
|
+
validateScale(newValue = this.scale) {
|
|
56
|
+
checkEmptyOrType(newValue, 'number', 'The post-icon "scale" prop should be a number.');
|
|
57
|
+
}
|
|
58
|
+
componentWillLoad() {
|
|
59
|
+
this.validateBase();
|
|
60
|
+
this.validateName();
|
|
61
|
+
this.validateFlipH();
|
|
62
|
+
this.validateFlipV();
|
|
63
|
+
this.validateScale();
|
|
64
|
+
this.validateRotate();
|
|
65
|
+
this.validateAnimation();
|
|
66
|
+
}
|
|
67
|
+
componentWillRender() {
|
|
68
|
+
this.setPath();
|
|
69
|
+
}
|
|
70
|
+
setPath() {
|
|
71
|
+
var _a, _b, _c, _d;
|
|
72
|
+
// Construct icon path from different possible sources
|
|
73
|
+
const metaBase = (_b = (_a = document.head
|
|
74
|
+
.querySelector('meta[name="design-system-settings"][data-post-icon-base]')) === null || _a === void 0 ? void 0 : _a.getAttribute('data-post-icon-base')) !== null && _b !== void 0 ? _b : null;
|
|
75
|
+
const fileBase = `${(_d = (_c = this.base) !== null && _c !== void 0 ? _c : metaBase) !== null && _d !== void 0 ? _d : CDN_URL}/`.replace(/\/\/$/, '/');
|
|
76
|
+
const fileName = `${this.name}.svg`;
|
|
77
|
+
const filePath = `${fileBase}${fileName}`;
|
|
78
|
+
this.path = new URL(filePath, window.location.origin).toString();
|
|
79
|
+
}
|
|
80
|
+
render() {
|
|
81
|
+
// create inline styles for some properties
|
|
82
|
+
const svgStyles = Object.entries({
|
|
83
|
+
'-webkit-mask-image': `url('${this.path}')`,
|
|
84
|
+
'mask-image': `url('${this.path}')`,
|
|
85
|
+
'transform': (this.scale && !isNaN(Number(this.scale)) ? 'scale(' + this.scale + ')' : '') +
|
|
86
|
+
(this.rotate && !isNaN(Number(this.rotate)) ? ' rotate(' + this.rotate + 'deg)' : ''),
|
|
87
|
+
})
|
|
88
|
+
.filter(([_key, value]) => value !== null)
|
|
89
|
+
.reduce((styles, [key, value]) => Object.assign(styles, { [key]: value }), {});
|
|
90
|
+
return (h(Host, { key: '95fa0f7a09d3430bb5d621e01b57188742920eb4', "data-version": version }, h("span", { key: 'c824e3705dc83665bb6f7649381654e6d1e07dfb', style: svgStyles })));
|
|
91
|
+
}
|
|
92
|
+
get host() { return this; }
|
|
93
|
+
static get watchers() { return {
|
|
94
|
+
"animation": ["validateAnimation"],
|
|
95
|
+
"base": ["validateBase"],
|
|
96
|
+
"flipH": ["validateFlipH"],
|
|
97
|
+
"flipV": ["validateFlipV"],
|
|
98
|
+
"name": ["validateName"],
|
|
99
|
+
"rotate": ["validateRotate"],
|
|
100
|
+
"scale": ["validateScale"]
|
|
101
|
+
}; }
|
|
102
|
+
static get style() { return PostIconStyle0; }
|
|
103
|
+
}, [1, "post-icon", {
|
|
104
|
+
"animation": [1],
|
|
105
|
+
"base": [1],
|
|
106
|
+
"flipH": [4, "flip-h"],
|
|
107
|
+
"flipV": [4, "flip-v"],
|
|
108
|
+
"name": [1],
|
|
109
|
+
"rotate": [2],
|
|
110
|
+
"scale": [2],
|
|
111
|
+
"svgStyles": [32],
|
|
112
|
+
"svgOutput": [32]
|
|
113
|
+
}, undefined, {
|
|
114
|
+
"animation": ["validateAnimation"],
|
|
115
|
+
"base": ["validateBase"],
|
|
116
|
+
"flipH": ["validateFlipH"],
|
|
117
|
+
"flipV": ["validateFlipV"],
|
|
118
|
+
"name": ["validateName"],
|
|
119
|
+
"rotate": ["validateRotate"],
|
|
120
|
+
"scale": ["validateScale"]
|
|
121
|
+
}]);
|
|
122
|
+
function defineCustomElement() {
|
|
123
|
+
if (typeof customElements === "undefined") {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const components = ["post-icon"];
|
|
127
|
+
components.forEach(tagName => { switch (tagName) {
|
|
128
|
+
case "post-icon":
|
|
129
|
+
if (!customElements.get(tagName)) {
|
|
130
|
+
customElements.define(tagName, PostIcon);
|
|
131
|
+
}
|
|
132
|
+
break;
|
|
133
|
+
} });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { PostIcon as P, defineCustomElement as d };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface PostLogo extends Components.PostLogo, HTMLElement {}
|
|
4
|
+
export const PostLogo: {
|
|
5
|
+
prototype: PostLogo;
|
|
6
|
+
new (): PostLogo;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { v as version } from './package.js';
|
|
3
|
+
import { d as checkEmptyOrUrl } from './index2.js';
|
|
4
|
+
|
|
5
|
+
const postLogoCss = ":host,.logo{display:inline-block}:host,:host .logo>svg,.logo,.logo .logo>svg{height:100%}.description{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}";
|
|
6
|
+
const PostLogoStyle0 = postLogoCss;
|
|
7
|
+
|
|
8
|
+
const PostLogo$1 = /*@__PURE__*/ proxyCustomElement(class PostLogo extends HTMLElement {
|
|
9
|
+
constructor() {
|
|
10
|
+
super();
|
|
11
|
+
this.__registerHost();
|
|
12
|
+
this.__attachShadow();
|
|
13
|
+
this.url = undefined;
|
|
14
|
+
}
|
|
15
|
+
validateUrl() {
|
|
16
|
+
checkEmptyOrUrl(this.url, 'The "url" property of the post-logo is invalid');
|
|
17
|
+
}
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
this.validateUrl();
|
|
20
|
+
this.checkDescription();
|
|
21
|
+
}
|
|
22
|
+
checkDescription() {
|
|
23
|
+
if (!this.host.textContent) {
|
|
24
|
+
console.warn('Be sure to add descriptive text in the post-logo to ensure good accessibility of the component.');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
render() {
|
|
28
|
+
const logoLink = this.url && (typeof this.url === 'string' ? this.url : this.url.href);
|
|
29
|
+
const LogoTag = logoLink ? 'a' : 'span';
|
|
30
|
+
return (h(Host, { key: 'c1d583f828a1f35ed482f1d1894354a503d8010e', "data-version": version }, h(LogoTag, Object.assign({ key: '61886ad3e388a6286e86b49a8ab150774e9e3d19', class: "logo" }, (logoLink ? { href: logoLink } : {})), h("span", { key: '88c01bbd0e146157ff2897300199717e8da1b2f0', class: "description" }, h("slot", { key: 'dccdd781dd6b6c78d9c8775a3f91765c6c4a8449', onSlotchange: () => this.checkDescription() })), h("svg", { key: '3f66dab4ca898d245759249828508adfa0ac92ea', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 72 72", "aria-hidden": "true" }, h("g", { key: 'bb5bb34aa56362a8805f6f97562825448d4ffac7', id: "Logo" }, h("rect", { key: '8bbee198611c558653cac3b31683beb9bc17c196', fill: "#ffcc00", x: "0", y: "0", width: "72", height: "72" }), h("polygon", { key: '2ca797bd9ad0861b81b953e04626abb2d5cb7323', fill: "#ff0000", points: "34,32.3 34,19 19.7,19 19.7,29.1 10,29.1 10,42.9 19.7,42.9 19.7,53 34,53 34,39.7 30.6,39.7 30.6,49.8 23.1,49.8 23.1,39.7 13.4,39.7 13.4,32.3 23.1,32.3 23.1,22.2 30.6,22.2 30.6,32.3" }), h("path", { key: 'eefa701f5f04ba0f0c04eb51748e62209e33ff06', d: "M53.56234,31.10526c0,2.41272-1.99154,4.29475-4.51723,4.29475H45.2v-8.3h3.84511C51.66802,27.1,53.56234,28.78889,53.56234,31.10526z M50.69666,19H36v34h9.2V42.9h5.49666c6.75131,0,11.9971-5.15137,11.9971-11.8057C62.69376,24.39136,57.35099,19,50.69666,19z" }))))));
|
|
31
|
+
}
|
|
32
|
+
get host() { return this; }
|
|
33
|
+
static get watchers() { return {
|
|
34
|
+
"url": ["validateUrl"]
|
|
35
|
+
}; }
|
|
36
|
+
static get style() { return PostLogoStyle0; }
|
|
37
|
+
}, [1, "post-logo", {
|
|
38
|
+
"url": [1]
|
|
39
|
+
}, undefined, {
|
|
40
|
+
"url": ["validateUrl"]
|
|
41
|
+
}]);
|
|
42
|
+
function defineCustomElement$1() {
|
|
43
|
+
if (typeof customElements === "undefined") {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const components = ["post-logo"];
|
|
47
|
+
components.forEach(tagName => { switch (tagName) {
|
|
48
|
+
case "post-logo":
|
|
49
|
+
if (!customElements.get(tagName)) {
|
|
50
|
+
customElements.define(tagName, PostLogo$1);
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
} });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const PostLogo = PostLogo$1;
|
|
57
|
+
const defineCustomElement = defineCustomElement$1;
|
|
58
|
+
|
|
59
|
+
export { PostLogo, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface PostPopover extends Components.PostPopover, HTMLElement {}
|
|
4
|
+
export const PostPopover: {
|
|
5
|
+
prototype: PostPopover;
|
|
6
|
+
new (): PostPopover;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { v as version } from './package.js';
|
|
3
|
+
import { g as getAttributeObserver } from './attribute-observer.js';
|
|
4
|
+
import { d as defineCustomElement$2 } from './post-popovercontainer2.js';
|
|
5
|
+
|
|
6
|
+
const postPopoverCss = "/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n *//*!\n * Copyright 2021 by Swiss Post, Information Technology\n */.btn-close{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;border-radius:4px;color:var(--post-gray-80);transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;cursor:pointer}.btn-close{outline-style:none !important;outline-offset:2px !important;outline-width:2px !important;outline-color:var(--post-focus-color) !important}.btn-close:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:solid !important;border-radius:4px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-close:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn-close:is(:focus-visible,:focus-within,.pretend-focus){outline-style:solid !important;border-radius:4px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-close:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.btn-close::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;content:\"\";display:block;height:1.5rem;width:1.5rem}:where(.bg-dark,.bg-black,.bg-primary,.bg-secondary,.bg-success,.bg-error,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright,.alert-primary,post-alert[type=primary],.alert-success,post-alert[type=success],.alert-danger,post-alert[type=danger],.alert-notification,post-alert[type=notification],.alert-error,post-alert[type=error]) .btn-close{color:var(--post-contrast-color)}.btn-close:focus,.btn-close:not(:disabled):hover,.pretend-hover.btn-close{color:var(--post-contrast-color)}.btn-close:disabled{color:var(--post-gray-40)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-close{color:CanvasText;forced-color-adjust:none}.btn-close:focus,.btn-close:not(:disabled):hover,.pretend-hover.btn-close{color:Highlight}}.btn-close-white{color:#e6e6e6}.btn-close-white:focus,.btn-close-white:not(:disabled):hover,.btn-close-white.pretend-hover{color:#fff}.btn-close-white:disabled{color:#999}*{box-sizing:border-box}:host{--post-contrast-color:#fff;--post-bg-rgb:51, 51, 51;display:block}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);border:0}.popover-container{display:flex;align-items:self-start;padding:.5em;min-width:160px;max-width:280px}@media (max-width: 599.98px){.popover-container{max-width:100%}}.popover-content{padding:.5em;flex-grow:1}.btn-close{color:inherit}";
|
|
7
|
+
const PostPopoverStyle0 = postPopoverCss;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @slot default - Slot for placing content inside the popover.
|
|
11
|
+
*/
|
|
12
|
+
let popoverInstances = 0;
|
|
13
|
+
const popoverTargetAttribute = 'data-popover-target';
|
|
14
|
+
const globalToggleHandler = (e) => {
|
|
15
|
+
const target = e.target;
|
|
16
|
+
if (!target || !('getAttribute' in target))
|
|
17
|
+
return;
|
|
18
|
+
const popoverTarget = target.getAttribute(popoverTargetAttribute);
|
|
19
|
+
if (!popoverTarget || ('key' in e && e.key !== 'Enter'))
|
|
20
|
+
return;
|
|
21
|
+
const popover = document.getElementById(popoverTarget);
|
|
22
|
+
popover === null || popover === void 0 ? void 0 : popover.toggle(target);
|
|
23
|
+
};
|
|
24
|
+
// Initialize a mutation observer for patching accessibility features
|
|
25
|
+
const triggerObserver = getAttributeObserver(popoverTargetAttribute, trigger => {
|
|
26
|
+
const force = trigger.hasAttribute(popoverTargetAttribute);
|
|
27
|
+
trigger.setAttribute('aria-expanded', force ? 'false' : null);
|
|
28
|
+
});
|
|
29
|
+
const PostPopover$1 = /*@__PURE__*/ proxyCustomElement(class PostPopover extends HTMLElement {
|
|
30
|
+
constructor() {
|
|
31
|
+
super();
|
|
32
|
+
this.__registerHost();
|
|
33
|
+
this.__attachShadow();
|
|
34
|
+
this.placement = 'top';
|
|
35
|
+
this.closeButtonCaption = undefined;
|
|
36
|
+
this.arrow = true;
|
|
37
|
+
this.localBeforeToggleHandler = this.beforeToggleHandler.bind(this);
|
|
38
|
+
}
|
|
39
|
+
connectedCallback() {
|
|
40
|
+
// Set up accessibility patcher and event listeners for the first component
|
|
41
|
+
if (popoverInstances === 0) {
|
|
42
|
+
window.addEventListener('pointerup', globalToggleHandler);
|
|
43
|
+
window.addEventListener('keydown', globalToggleHandler);
|
|
44
|
+
triggerObserver.observe(document.body, {
|
|
45
|
+
subtree: true,
|
|
46
|
+
childList: true,
|
|
47
|
+
attributeFilter: [popoverTargetAttribute],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
popoverInstances++;
|
|
51
|
+
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
52
|
+
}
|
|
53
|
+
componentDidLoad() {
|
|
54
|
+
this.popoverRef.addEventListener('beforetoggle', this.localBeforeToggleHandler);
|
|
55
|
+
}
|
|
56
|
+
disconnectedCallback() {
|
|
57
|
+
popoverInstances--;
|
|
58
|
+
// Remove listeners and observer after the last popover has been destructed
|
|
59
|
+
if (popoverInstances === 0) {
|
|
60
|
+
window.removeEventListener('click', globalToggleHandler);
|
|
61
|
+
window.removeEventListener('keydown', globalToggleHandler);
|
|
62
|
+
triggerObserver.disconnect();
|
|
63
|
+
}
|
|
64
|
+
this.popoverRef.removeEventListener('beforetoggle', this.localBeforeToggleHandler);
|
|
65
|
+
this.triggers.forEach(trigger => trigger.removeAttribute('aria-expanded'));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Programmatically display the popover
|
|
69
|
+
* @param target An element with [data-popover-target="id"] where the popover should be shown
|
|
70
|
+
*/
|
|
71
|
+
async show(target) {
|
|
72
|
+
this.popoverRef.show(target);
|
|
73
|
+
target.setAttribute('aria-expanded', 'true');
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Programmatically hide this popover
|
|
77
|
+
*/
|
|
78
|
+
async hide() {
|
|
79
|
+
this.popoverRef.hide();
|
|
80
|
+
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Toggle popover display
|
|
84
|
+
* @param target An element with [data-popover-target="id"] where the popover should be anchored to
|
|
85
|
+
* @param force Pass true to always show or false to always hide
|
|
86
|
+
*/
|
|
87
|
+
async toggle(target, force) {
|
|
88
|
+
const newState = await this.popoverRef.toggle(target, force);
|
|
89
|
+
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
90
|
+
target.setAttribute('aria-expanded', `${newState}`);
|
|
91
|
+
}
|
|
92
|
+
get triggers() {
|
|
93
|
+
return document.querySelectorAll(`[${popoverTargetAttribute}="${this.host.id}"]`);
|
|
94
|
+
}
|
|
95
|
+
beforeToggleHandler() {
|
|
96
|
+
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
97
|
+
}
|
|
98
|
+
render() {
|
|
99
|
+
return (h(Host, { key: '6fe379d071ec88a76f99cc10f0fdce0b2f079fbd', "data-version": version }, h("post-popovercontainer", { key: '3a5e2896e87e3f2d32c0ad9b1d80327cc585f289', arrow: this.arrow, placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '46834ef6a3893fe8823776d8feb20a2fb328e3bc', class: "popover-container" }, h("div", { key: '9d61b678c2613e84efc0df805cbb67fbe3d06991', class: "popover-content" }, h("slot", { key: '1cfef5daaea3f6370869a3ae648ff36e2dddd82a' })), h("button", { key: 'c7a2e12ece46ee63d8004d99427c8c6febc2dc17', class: "btn-close", onClick: () => this.hide() }, h("span", { key: '1aee8ffe06b5c4c9bade0185a8832328410fbe4a', class: "visually-hidden" }, this.closeButtonCaption))))));
|
|
100
|
+
}
|
|
101
|
+
get host() { return this; }
|
|
102
|
+
static get style() { return PostPopoverStyle0; }
|
|
103
|
+
}, [1, "post-popover", {
|
|
104
|
+
"placement": [1],
|
|
105
|
+
"closeButtonCaption": [1, "close-button-caption"],
|
|
106
|
+
"arrow": [4],
|
|
107
|
+
"show": [64],
|
|
108
|
+
"hide": [64],
|
|
109
|
+
"toggle": [64]
|
|
110
|
+
}]);
|
|
111
|
+
function defineCustomElement$1() {
|
|
112
|
+
if (typeof customElements === "undefined") {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const components = ["post-popover", "post-popovercontainer"];
|
|
116
|
+
components.forEach(tagName => { switch (tagName) {
|
|
117
|
+
case "post-popover":
|
|
118
|
+
if (!customElements.get(tagName)) {
|
|
119
|
+
customElements.define(tagName, PostPopover$1);
|
|
120
|
+
}
|
|
121
|
+
break;
|
|
122
|
+
case "post-popovercontainer":
|
|
123
|
+
if (!customElements.get(tagName)) {
|
|
124
|
+
defineCustomElement$2();
|
|
125
|
+
}
|
|
126
|
+
break;
|
|
127
|
+
} });
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const PostPopover = PostPopover$1;
|
|
131
|
+
const defineCustomElement = defineCustomElement$1;
|
|
132
|
+
|
|
133
|
+
export { PostPopover, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface PostPopovercontainer extends Components.PostPopovercontainer, HTMLElement {}
|
|
4
|
+
export const PostPopovercontainer: {
|
|
5
|
+
prototype: PostPopovercontainer;
|
|
6
|
+
new (): PostPopovercontainer;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { P as PostPopovercontainer$1, d as defineCustomElement$1 } from './post-popovercontainer2.js';
|
|
2
|
+
|
|
3
|
+
const PostPopovercontainer = PostPopovercontainer$1;
|
|
4
|
+
const defineCustomElement = defineCustomElement$1;
|
|
5
|
+
|
|
6
|
+
export { PostPopovercontainer, defineCustomElement };
|