@swisspost/design-system-components 10.0.0-next.51 → 10.0.0-next.52
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/focusable-D6snQLqS.js +5020 -0
- package/dist/cjs/get-focusable-children-Bx63XUQg.js +67 -0
- package/dist/cjs/{index-CpDyH7Ww.js → index-Cb8CTrOz.js} +13 -9
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{package-D1eOXW8H.js → package-B7Ni5Tuu.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +3 -3
- package/dist/cjs/post-avatar.cjs.entry.js +2 -2
- package/dist/cjs/post-back-to-top.cjs.entry.js +3 -3
- package/dist/cjs/post-banner.cjs.entry.js +2 -2
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +4 -4
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +12 -11
- package/dist/cjs/post-card-control.cjs.entry.js +2 -2
- package/dist/cjs/post-closebutton_15.cjs.entry.js +128 -110
- package/dist/cjs/post-collapsible_2.cjs.entry.js +2 -2
- package/dist/cjs/post-components.cjs.js +2 -2
- package/dist/cjs/post-footer.cjs.entry.js +2 -2
- package/dist/cjs/post-linkarea.cjs.entry.js +2 -2
- package/dist/cjs/post-popover-trigger.cjs.entry.js +109 -0
- package/dist/cjs/post-popover.cjs.entry.js +22 -104
- package/dist/cjs/post-rating.cjs.entry.js +4 -8
- package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
- package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
- package/dist/cjs/post-tabs.cjs.entry.js +3 -3
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +6 -5022
- package/dist/cjs/post-tooltip.cjs.entry.js +3 -3
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/post-accordion-item/post-accordion-item.js +1 -1
- package/dist/collection/components/post-back-to-top/post-back-to-top.js +1 -1
- package/dist/collection/components/post-breadcrumb-item/post-breadcrumb-item.js +1 -1
- package/dist/collection/components/post-breadcrumbs/post-breadcrumbs.js +34 -13
- package/dist/collection/components/post-closebutton/post-closebutton.css +1 -1
- package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +9 -2
- package/dist/collection/components/post-megadropdown-trigger/post-megadropdown-trigger.js +1 -1
- package/dist/collection/components/post-menu/post-menu.js +29 -33
- package/dist/collection/components/post-menu-item/post-menu-item.js +1 -1
- package/dist/collection/components/post-menu-trigger/post-menu-trigger.js +1 -1
- package/dist/collection/components/post-popover/post-popover.js +21 -77
- package/dist/collection/components/post-popover-trigger/post-popover-trigger.css +1 -0
- package/dist/collection/components/post-popover-trigger/post-popover-trigger.js +145 -0
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +153 -32
- package/dist/collection/components/post-rating/post-rating.js +4 -9
- 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 +1 -1
- package/dist/collection/components/post-togglebutton/post-togglebutton.js +1 -1
- package/dist/collection/components/post-tooltip/post-tooltip.js +2 -2
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.css +1 -1
- package/dist/collection/components/post-tooltip-trigger/post-tooltip-trigger.js +1 -1
- package/dist/collection/utils/get-focusable-children.js +34 -5
- package/dist/component-names.json +1 -0
- package/dist/components/focusable.js +5018 -0
- package/dist/components/get-focusable-children.js +35 -6
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +1 -0
- package/dist/components/package.js +1 -1
- package/dist/components/post-accordion-item2.js +1 -1
- package/dist/components/post-back-to-top.js +1 -1
- package/dist/components/post-breadcrumb-item2.js +1 -1
- package/dist/components/post-breadcrumbs.js +14 -11
- package/dist/components/post-closebutton2.js +1 -1
- package/dist/components/post-mainnavigation.js +1 -1
- package/dist/components/post-megadropdown-trigger.js +1 -1
- package/dist/components/post-megadropdown.js +10 -3
- package/dist/components/post-menu-item2.js +1 -1
- package/dist/components/post-menu-trigger2.js +1 -1
- package/dist/components/post-menu2.js +27 -31
- package/dist/components/post-popover-trigger.d.ts +11 -0
- package/dist/components/post-popover-trigger.js +132 -0
- package/dist/components/post-popover.js +17 -99
- package/dist/components/post-popovercontainer2.js +82 -32
- package/dist/components/post-rating.js +2 -6
- package/dist/components/post-tab-header.js +1 -1
- package/dist/components/post-tab-panel.js +1 -1
- package/dist/components/post-tabs.js +1 -1
- package/dist/components/post-togglebutton.js +1 -1
- package/dist/components/post-tooltip-trigger.js +6 -5022
- package/dist/components/post-tooltip.js +1 -1
- package/dist/components/react/index.js +1 -1
- package/dist/components/react/{p-BVVgwjV0.js → p-B35HsBxh.js} +83 -33
- package/dist/components/react/{p-BnCGzVcR.js → p-BL8WEb6K.js} +3 -3
- package/dist/components/react/p-BVXiQdHq.js +64 -0
- package/dist/components/react/{p-BsuTiCyd.js → p-By7jk8fL.js} +1 -1
- package/dist/components/react/{p-BIslNfKd.js → p-C4zJkcAb.js} +2 -2
- package/dist/components/react/{p-D7N0KPNm.js → p-CQhnMei5.js} +2 -2
- package/dist/components/react/{p-Cpz7bn7D.js → p-CrEdcwed.js} +5 -5
- package/dist/components/react/{p-DC3aZ-Qt.js → p-Dl8clYLV.js} +3 -3
- package/dist/components/react/{p-WA0BpGMu.js → p-DnhWNGb-.js} +1 -1
- package/dist/components/react/{p-BcpJoB81.js → p-DnqwBx5e.js} +1 -1
- package/dist/components/react/{p-BRBszIzq.js → p-Due3yZDR.js} +30 -34
- package/dist/components/react/p-HygIVKXC.js +5018 -0
- package/dist/components/react/p-kxuZ8mOU.js +3 -0
- package/dist/components/react/{p-2qJcvMt7.js → p-lC8Sp5tg.js} +1 -1
- package/dist/components/react/post-accordion-item.js +1 -1
- package/dist/components/react/post-accordion.js +1 -1
- package/dist/components/react/post-avatar.js +1 -1
- package/dist/components/react/post-back-to-top.js +3 -3
- package/dist/components/react/post-banner.js +1 -1
- package/dist/components/react/post-breadcrumb-item.js +1 -1
- package/dist/components/react/post-breadcrumbs.js +21 -18
- package/dist/components/react/post-card-control.js +2 -2
- package/dist/components/react/post-closebutton.js +1 -1
- package/dist/components/react/post-collapsible-trigger.js +1 -1
- package/dist/components/react/post-collapsible.js +1 -1
- package/dist/components/react/post-footer.js +6 -6
- package/dist/components/react/post-header.js +2 -2
- package/dist/components/react/post-icon.js +1 -1
- package/dist/components/react/post-language-option.js +1 -1
- package/dist/components/react/post-language-switch.js +5 -5
- package/dist/components/react/post-linkarea.js +1 -1
- package/dist/components/react/post-list-item.js +1 -1
- package/dist/components/react/post-list.js +1 -1
- package/dist/components/react/post-logo.js +1 -1
- package/dist/components/react/post-mainnavigation.js +3 -3
- package/dist/components/react/post-megadropdown-trigger.js +2 -2
- package/dist/components/react/post-megadropdown.js +12 -5
- package/dist/components/react/post-menu-item.js +1 -1
- package/dist/components/react/post-menu-trigger.js +1 -1
- package/dist/components/react/post-menu.js +1 -1
- package/dist/components/react/post-popover-trigger.d.ts +11 -0
- package/dist/components/react/post-popover-trigger.js +133 -0
- package/dist/components/react/post-popover.js +21 -103
- package/dist/components/react/post-popovercontainer.js +1 -1
- package/dist/components/react/post-rating.js +4 -8
- package/dist/components/react/post-tab-header.js +2 -2
- package/dist/components/react/post-tab-panel.js +2 -2
- package/dist/components/react/post-tabs.js +2 -2
- package/dist/components/react/post-togglebutton.js +2 -2
- package/dist/components/react/post-tooltip-trigger.js +4 -5020
- package/dist/components/react/post-tooltip.js +3 -3
- package/dist/docs.json +206 -42
- package/dist/esm/focusable-HygIVKXC.js +5018 -0
- package/dist/esm/get-focusable-children-D9ZHp2FP.js +64 -0
- package/dist/esm/{index-C8a0ddDa.js → index-CFNKgUjL.js} +13 -9
- package/dist/esm/loader.js +3 -3
- package/dist/esm/package-kxuZ8mOU.js +3 -0
- package/dist/esm/post-accordion_2.entry.js +3 -3
- package/dist/esm/post-avatar.entry.js +2 -2
- package/dist/esm/post-back-to-top.entry.js +3 -3
- package/dist/esm/post-banner.entry.js +2 -2
- package/dist/esm/post-breadcrumb-item_2.entry.js +4 -4
- package/dist/esm/post-breadcrumbs.entry.js +13 -12
- package/dist/esm/post-card-control.entry.js +2 -2
- package/dist/esm/post-closebutton_15.entry.js +125 -107
- package/dist/esm/post-collapsible_2.entry.js +2 -2
- package/dist/esm/post-components.js +3 -3
- package/dist/esm/post-footer.entry.js +2 -2
- package/dist/esm/post-linkarea.entry.js +2 -2
- package/dist/esm/post-popover-trigger.entry.js +107 -0
- package/dist/esm/post-popover.entry.js +19 -101
- package/dist/esm/post-rating.entry.js +4 -8
- package/dist/esm/post-tab-header.entry.js +3 -3
- package/dist/esm/post-tab-panel.entry.js +3 -3
- package/dist/esm/post-tabs.entry.js +3 -3
- package/dist/esm/post-tooltip-trigger.entry.js +5 -5021
- package/dist/esm/post-tooltip.entry.js +3 -3
- package/dist/post-components/{p-2440cba5.entry.js → p-1096ed89.entry.js} +1 -1
- package/dist/post-components/{p-b871aa1b.entry.js → p-12183522.entry.js} +1 -1
- package/dist/post-components/{p-ef38c78d.entry.js → p-173dcaab.entry.js} +1 -1
- package/dist/post-components/p-1d7418ce.entry.js +1 -0
- package/dist/post-components/p-244a47db.entry.js +1 -0
- package/dist/post-components/p-264c5f97.entry.js +1 -0
- package/dist/post-components/{p-2b003617.entry.js → p-290ea78f.entry.js} +1 -1
- package/dist/post-components/p-2f8cad6c.entry.js +1 -0
- package/dist/post-components/p-47e43863.entry.js +1 -0
- package/dist/post-components/{p-509ae720.entry.js → p-50a5c57f.entry.js} +1 -1
- package/dist/post-components/p-6d8f95de.entry.js +1 -0
- package/dist/post-components/p-72e56701.entry.js +1 -0
- package/dist/post-components/p-81d78878.entry.js +1 -0
- package/dist/post-components/p-8a6467b4.entry.js +1 -0
- package/dist/post-components/{p-759510e5.entry.js → p-9e461598.entry.js} +1 -1
- package/dist/post-components/p-CFNKgUjL.js +2 -0
- package/dist/post-components/p-D9ZHp2FP.js +1 -0
- package/dist/post-components/p-HygIVKXC.js +1 -0
- package/dist/post-components/p-a92b241a.entry.js +1 -0
- package/dist/post-components/{p-e764835b.entry.js → p-c84e7f02.entry.js} +1 -1
- package/dist/post-components/{p-0b1143d4.entry.js → p-e37d9a31.entry.js} +1 -1
- package/dist/post-components/p-f62f52d7.entry.js +1 -0
- package/dist/post-components/p-kxuZ8mOU.js +1 -0
- package/dist/post-components/post-components.css +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-breadcrumbs/post-breadcrumbs.d.ts +6 -1
- package/dist/types/components/post-menu/post-menu.d.ts +4 -3
- package/dist/types/components/post-popover/post-popover.d.ts +5 -10
- package/dist/types/components/post-popover-trigger/post-popover-trigger.d.ts +37 -0
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +34 -5
- package/dist/types/components.d.ts +66 -13
- package/dist/types/utils/get-focusable-children.d.ts +1 -0
- package/hydrate/index.js +6707 -6594
- package/hydrate/index.mjs +6707 -6594
- package/package.json +7 -7
- package/dist/components/react/p-C35MCWIp.js +0 -35
- package/dist/components/react/p-DgSkXfqW.js +0 -3
- package/dist/esm/package-DgSkXfqW.js +0 -3
- package/dist/post-components/p-017fbd63.entry.js +0 -1
- package/dist/post-components/p-2c1e0e21.entry.js +0 -1
- package/dist/post-components/p-C8a0ddDa.js +0 -2
- package/dist/post-components/p-DgSkXfqW.js +0 -1
- package/dist/post-components/p-a9d4dc7f.entry.js +0 -1
- package/dist/post-components/p-d0fea1d7.entry.js +0 -1
- package/dist/post-components/p-d25fc2d8.entry.js +0 -1
- package/dist/post-components/p-d377069a.entry.js +0 -1
- package/dist/post-components/p-ea71d9fd.entry.js +0 -1
- package/dist/post-components/p-efa44b64.entry.js +0 -1
- package/dist/post-components/p-f86fb192.entry.js +0 -1
- package/dist/post-components/p-feed36d6.entry.js +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../../types/components";
|
|
2
|
+
|
|
3
|
+
interface PostPopoverTrigger extends Components.PostPopoverTrigger, HTMLElement {}
|
|
4
|
+
export const PostPopoverTrigger: {
|
|
5
|
+
prototype: PostPopoverTrigger;
|
|
6
|
+
new (): PostPopoverTrigger;
|
|
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 { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
+
import { v as version } from './p-kxuZ8mOU.js';
|
|
3
|
+
import { i as isFocusable } from './p-HygIVKXC.js';
|
|
4
|
+
import { c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
5
|
+
import './p-CJ80BZ06.js';
|
|
6
|
+
|
|
7
|
+
const postPopoverTriggerCss = ":host{cursor:pointer}";
|
|
8
|
+
|
|
9
|
+
const PostPopoverTrigger$1 = /*@__PURE__*/ proxyCustomElement(class PostPopoverTrigger extends H {
|
|
10
|
+
syncAriaExpanded(newValue) {
|
|
11
|
+
this.ariaExpanded = newValue;
|
|
12
|
+
if (this.trigger) {
|
|
13
|
+
this.trigger.setAttribute('aria-expanded', String(newValue));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Watch for changes to the `for` property to validate its type and ensure it is a string.
|
|
18
|
+
* @param forValue - The new value of the `for` property.
|
|
19
|
+
*/
|
|
20
|
+
validateFor() {
|
|
21
|
+
checkRequiredAndType(this, 'for', 'string');
|
|
22
|
+
}
|
|
23
|
+
// Gets the associated popover element to the trigger based on 'for'
|
|
24
|
+
get popover() {
|
|
25
|
+
const ref = document.getElementById(this.for);
|
|
26
|
+
return ref?.localName === 'post-popover' ? ref : null;
|
|
27
|
+
}
|
|
28
|
+
setupTrigger() {
|
|
29
|
+
this.trigger = this.host.querySelector('*');
|
|
30
|
+
if (this.trigger) {
|
|
31
|
+
this.trigger.setAttribute('aria-expanded', this.ariaExpanded.toString());
|
|
32
|
+
// check if its not focusable and add aria role and tabindex
|
|
33
|
+
if (!isFocusable(this.trigger)) {
|
|
34
|
+
this.trigger.setAttribute('tabindex', '0');
|
|
35
|
+
this.trigger.setAttribute('role', 'button');
|
|
36
|
+
}
|
|
37
|
+
// Set aria attributes
|
|
38
|
+
this.trigger.setAttribute('aria-haspopup', 'true');
|
|
39
|
+
this.trigger.setAttribute('aria-controls', this.for);
|
|
40
|
+
this.trigger.addEventListener('click', this.boundHandleToggle);
|
|
41
|
+
this.trigger.addEventListener('keydown', this.boundHandleKeyDown);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.error('No content found in the post-popover-trigger slot. Please insert a focusable element or content that can receive focus.');
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
handleToggle() {
|
|
48
|
+
const popoverEl = this.popover;
|
|
49
|
+
if (popoverEl) {
|
|
50
|
+
popoverEl.toggle(this.trigger);
|
|
51
|
+
this.focusTrigger();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
console.warn(`No post-popover found with ID: ${this.for}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
focusTrigger() {
|
|
58
|
+
// Restores focus to the trigger
|
|
59
|
+
if (!this.popoverOpen && this.trigger) {
|
|
60
|
+
this.trigger.focus();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
constructor() {
|
|
64
|
+
super();
|
|
65
|
+
this.__registerHost();
|
|
66
|
+
this.__attachShadow();
|
|
67
|
+
/**
|
|
68
|
+
* Manages the accessibility attribute `aria-expanded` to indicate whether the associated popover is expanded or collapsed.
|
|
69
|
+
*/
|
|
70
|
+
this.ariaExpanded = false;
|
|
71
|
+
/**
|
|
72
|
+
* Holds the state of the popover toggle
|
|
73
|
+
*/
|
|
74
|
+
this.popoverOpen = false;
|
|
75
|
+
this.handleKeyDown = (e) => {
|
|
76
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
this.handleToggle();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
this.boundHandleToggle = this.handleToggle.bind(this);
|
|
82
|
+
this.boundHandleKeyDown = this.handleKeyDown.bind(this);
|
|
83
|
+
this.boundHandlePostToggle = (event) => {
|
|
84
|
+
this.popoverOpen = event.detail.isOpen;
|
|
85
|
+
this.focusTrigger();
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
componentDidLoad() {
|
|
89
|
+
this.validateFor();
|
|
90
|
+
this.setupTrigger();
|
|
91
|
+
this.popover?.addEventListener('postToggle', this.boundHandlePostToggle);
|
|
92
|
+
}
|
|
93
|
+
disconnectedCallback() {
|
|
94
|
+
this.trigger.removeEventListener('click', this.boundHandleToggle);
|
|
95
|
+
this.trigger.removeEventListener('keydown', this.boundHandleKeyDown);
|
|
96
|
+
this.popover?.removeEventListener('postToggle', this.boundHandlePostToggle);
|
|
97
|
+
}
|
|
98
|
+
render() {
|
|
99
|
+
return (h(Host, { key: 'd7467aa400f407d76df06e8bbc84210e5f016073', "data-version": version }, h("slot", { key: '618f3d14fb89b3ad3c101a58f8519c337d9f1721', onSlotchange: () => this.setupTrigger() })));
|
|
100
|
+
}
|
|
101
|
+
get host() { return this; }
|
|
102
|
+
static get watchers() { return {
|
|
103
|
+
"popoverOpen": ["syncAriaExpanded"],
|
|
104
|
+
"for": ["validateFor"]
|
|
105
|
+
}; }
|
|
106
|
+
static get style() { return postPopoverTriggerCss; }
|
|
107
|
+
}, [1, "post-popover-trigger", {
|
|
108
|
+
"for": [513],
|
|
109
|
+
"ariaExpanded": [32],
|
|
110
|
+
"popoverOpen": [32]
|
|
111
|
+
}, undefined, {
|
|
112
|
+
"popoverOpen": ["syncAriaExpanded"],
|
|
113
|
+
"for": ["validateFor"]
|
|
114
|
+
}]);
|
|
115
|
+
function defineCustomElement$1() {
|
|
116
|
+
if (typeof customElements === "undefined") {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const components = ["post-popover-trigger"];
|
|
120
|
+
components.forEach(tagName => { switch (tagName) {
|
|
121
|
+
case "post-popover-trigger":
|
|
122
|
+
if (!customElements.get(tagName)) {
|
|
123
|
+
customElements.define(tagName, PostPopoverTrigger$1);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
} });
|
|
127
|
+
}
|
|
128
|
+
defineCustomElement$1();
|
|
129
|
+
|
|
130
|
+
const PostPopoverTrigger = PostPopoverTrigger$1;
|
|
131
|
+
const defineCustomElement = defineCustomElement$1;
|
|
132
|
+
|
|
133
|
+
export { PostPopoverTrigger, defineCustomElement };
|
|
@@ -1,71 +1,19 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
-
import { d as defineCustomElement$2, a as PLACEMENT_TYPES } from './p-
|
|
3
|
-
import { v as version } from './p-
|
|
4
|
-
import {
|
|
2
|
+
import { d as defineCustomElement$2, a as PLACEMENT_TYPES } from './p-B35HsBxh.js';
|
|
3
|
+
import { v as version } from './p-kxuZ8mOU.js';
|
|
4
|
+
import { a as getDeepFocusableChildren } from './p-BVXiQdHq.js';
|
|
5
5
|
import { d as checkEmptyOrOneOf, c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
6
|
-
import
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
|
|
9
|
-
function getAttributeObserver(attribute, handler) {
|
|
10
|
-
/**
|
|
11
|
-
* Handle attribute changes and childList changes from the observer
|
|
12
|
-
* @param {MutationRecord[]} mutationList
|
|
13
|
-
*/
|
|
14
|
-
function observerHandler(mutationList) {
|
|
15
|
-
mutationList.forEach(mutation => {
|
|
16
|
-
if (mutation.type === 'attributes' && mutation.attributeName === attribute) {
|
|
17
|
-
handler(mutation.target);
|
|
18
|
-
}
|
|
19
|
-
if (mutation.type === 'childList') {
|
|
20
|
-
mutation.addedNodes.forEach(node => {
|
|
21
|
-
if (node.nodeType === Node.ELEMENT_NODE &&
|
|
22
|
-
node.hasAttribute(attribute)) {
|
|
23
|
-
handler(node);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
// Initialize a mutation observer for patching accessibility features
|
|
30
|
-
return IS_BROWSER ? new MutationObserver(observerHandler) : null;
|
|
31
|
-
}
|
|
6
|
+
import './p-CJ80BZ06.js';
|
|
7
|
+
import { d as defineCustomElement$4 } from './p-BL8WEb6K.js';
|
|
8
|
+
import { d as defineCustomElement$3 } from './p-DnqwBx5e.js';
|
|
32
9
|
|
|
33
10
|
const postPopoverCss = "*{box-sizing:border-box}:host{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{color:var(--post-current-fg);background-color:var(--post-current-bg);display:flex;align-items:self-start;padding:.5em;min-width:160px;max-width:min(var(--post-popover-max-width, 280px),100vw)}.popover-content{padding:.5em;flex-grow:1}";
|
|
34
11
|
|
|
35
|
-
/**
|
|
36
|
-
* @slot default - Slot for placing content inside the popover.
|
|
37
|
-
*/
|
|
38
|
-
let popoverInstances = 0;
|
|
39
|
-
const popoverTargetAttribute = 'data-popover-target';
|
|
40
|
-
const globalToggleHandler = (e) => {
|
|
41
|
-
let currentElement = e.target;
|
|
42
|
-
// Traverse up the DOM tree to find if any parent has the popover target attribute
|
|
43
|
-
while (currentElement && !currentElement.getAttribute(popoverTargetAttribute)) {
|
|
44
|
-
if (currentElement === document.body || !currentElement.parentElement)
|
|
45
|
-
break;
|
|
46
|
-
currentElement = currentElement.parentElement;
|
|
47
|
-
}
|
|
48
|
-
const popoverTarget = currentElement?.getAttribute(popoverTargetAttribute);
|
|
49
|
-
if (!popoverTarget || ('key' in e && e.key !== 'Enter'))
|
|
50
|
-
return;
|
|
51
|
-
const popover = document.getElementById(popoverTarget);
|
|
52
|
-
popover?.toggle(currentElement);
|
|
53
|
-
};
|
|
54
12
|
const PostPopover$1 = /*@__PURE__*/ proxyCustomElement(class PostPopover extends H {
|
|
55
|
-
validatePlacement() {
|
|
56
|
-
checkEmptyOrOneOf(this, 'placement', PLACEMENT_TYPES);
|
|
57
|
-
}
|
|
58
|
-
validateCloseButtonCaption() {
|
|
59
|
-
checkRequiredAndType(this, 'closeButtonCaption', 'string');
|
|
60
|
-
}
|
|
61
13
|
constructor() {
|
|
62
14
|
super();
|
|
63
15
|
this.__registerHost();
|
|
64
16
|
this.__attachShadow();
|
|
65
|
-
// Initialize a mutation observer for patching accessibility features
|
|
66
|
-
this.triggerObserver = IS_BROWSER
|
|
67
|
-
? getAttributeObserver(popoverTargetAttribute, this.patchAccessibilityFeatures)
|
|
68
|
-
: null;
|
|
69
17
|
/**
|
|
70
18
|
* Defines the position of the popover relative to its trigger.
|
|
71
19
|
* Popovers are automatically flipped to the opposite side if there is not enough available space and are shifted towards the viewport if they would overlap edge boundaries.
|
|
@@ -77,76 +25,46 @@ const PostPopover$1 = /*@__PURE__*/ proxyCustomElement(class PostPopover extends
|
|
|
77
25
|
*/
|
|
78
26
|
// eslint-disable-next-line @stencil-community/ban-default-true
|
|
79
27
|
this.arrow = true;
|
|
80
|
-
this.localBeforeToggleHandler = this.beforeToggleHandler.bind(this);
|
|
81
28
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
this.triggerObserver?.observe(document.body, {
|
|
88
|
-
subtree: true,
|
|
89
|
-
childList: true,
|
|
90
|
-
attributeFilter: [popoverTargetAttribute],
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
popoverInstances++;
|
|
94
|
-
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
29
|
+
validatePlacement() {
|
|
30
|
+
checkEmptyOrOneOf(this, 'placement', PLACEMENT_TYPES);
|
|
31
|
+
}
|
|
32
|
+
validateCloseButtonCaption() {
|
|
33
|
+
checkRequiredAndType(this, 'closeButtonCaption', 'string');
|
|
95
34
|
}
|
|
96
35
|
componentDidLoad() {
|
|
97
36
|
this.validatePlacement();
|
|
98
37
|
this.validateCloseButtonCaption();
|
|
99
|
-
this.popoverRef.addEventListener('beforetoggle', this.localBeforeToggleHandler);
|
|
100
|
-
}
|
|
101
|
-
disconnectedCallback() {
|
|
102
|
-
popoverInstances--;
|
|
103
|
-
// Remove listeners and observer after the last popover has been destructed
|
|
104
|
-
if (popoverInstances === 0) {
|
|
105
|
-
window.removeEventListener('click', globalToggleHandler);
|
|
106
|
-
window.removeEventListener('keydown', globalToggleHandler);
|
|
107
|
-
this.triggerObserver?.disconnect();
|
|
108
|
-
}
|
|
109
|
-
this.popoverRef.removeEventListener('beforetoggle', this.localBeforeToggleHandler);
|
|
110
|
-
this.triggers.forEach(trigger => trigger.removeAttribute('aria-expanded'));
|
|
111
38
|
}
|
|
112
39
|
/**
|
|
113
40
|
* Programmatically display the popover
|
|
114
|
-
* @param target
|
|
41
|
+
* @param target A focusable element inside the <post-popover-trigger> component that controls the popover
|
|
115
42
|
*/
|
|
116
43
|
async show(target) {
|
|
117
44
|
this.popoverRef.show(target);
|
|
118
|
-
console.log(this.popoverRef);
|
|
119
|
-
target.setAttribute('aria-expanded', 'true');
|
|
120
45
|
}
|
|
121
46
|
/**
|
|
122
47
|
* Programmatically hide this popover
|
|
123
48
|
*/
|
|
124
49
|
async hide() {
|
|
125
50
|
this.popoverRef.hide();
|
|
126
|
-
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
127
51
|
}
|
|
128
52
|
/**
|
|
129
53
|
* Toggle popover display
|
|
130
|
-
* @param target
|
|
54
|
+
* @param target A focusable element inside the <post-popover-trigger> component that controls the popover
|
|
131
55
|
* @param force Pass true to always show or false to always hide
|
|
132
56
|
*/
|
|
133
57
|
async toggle(target, force) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
beforeToggleHandler() {
|
|
142
|
-
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
143
|
-
}
|
|
144
|
-
patchAccessibilityFeatures(trigger) {
|
|
145
|
-
const force = trigger.hasAttribute(popoverTargetAttribute);
|
|
146
|
-
trigger.setAttribute('aria-expanded', force ? 'false' : null);
|
|
58
|
+
await this.popoverRef.toggle(target, force);
|
|
59
|
+
const focusableChildren = getDeepFocusableChildren(this.host);
|
|
60
|
+
// find first focusable element
|
|
61
|
+
const firstFocusable = focusableChildren[0];
|
|
62
|
+
if (firstFocusable) {
|
|
63
|
+
firstFocusable.focus();
|
|
64
|
+
}
|
|
147
65
|
}
|
|
148
66
|
render() {
|
|
149
|
-
return (h(Host, { key: '
|
|
67
|
+
return (h(Host, { key: '82f8d89013b8ddb37fb924c9608ba394c669f35a', "data-version": version }, h("post-popovercontainer", { key: 'cf276e5faf65ae27bc0d8e51779de5470a1e49a3', arrow: this.arrow, placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '9ab455b2ee7d7f082dc6fc588d519d7a362cad8c', class: "popover-container" }, h("div", { key: 'b3b468da2ff7ccb2a47d69a1841488359763e927', class: "popover-content" }, h("slot", { key: 'a32099475baaca02ce41350e36d363614a6f83ef' })), h("post-closebutton", { key: 'eac806bd1e6652cacce58fb7e915d66e82c24980', onClick: () => this.hide() }, this.closeButtonCaption)))));
|
|
150
68
|
}
|
|
151
69
|
get host() { return this; }
|
|
152
70
|
static get watchers() { return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PostPopovercontainer$1, d as defineCustomElement$1 } from './p-
|
|
1
|
+
import { P as PostPopovercontainer$1, d as defineCustomElement$1 } from './p-B35HsBxh.js';
|
|
2
2
|
|
|
3
3
|
const PostPopovercontainer = PostPopovercontainer$1;
|
|
4
4
|
const defineCustomElement = defineCustomElement$1;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-kxuZ8mOU.js';
|
|
3
3
|
import { c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
4
4
|
import './p-CJ80BZ06.js';
|
|
5
|
-
import { d as defineCustomElement$2 } from './p-
|
|
5
|
+
import { d as defineCustomElement$2 } from './p-DnqwBx5e.js';
|
|
6
6
|
|
|
7
7
|
const postRatingCss = ":host{display:inline-block}.rating{display:flex;flex-wrap:wrap;overflow:hidden;margin:0 calc(var(--post-core-dimension-4)*-1);border-radius:4px}.rating .star{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fff;position:relative;width:2rem;height:2rem;cursor:pointer}.rating .star .stroke,.rating .star .fill{display:block;width:100%;height:100%;transition:all ease 100ms}.rating .star .stroke{position:absolute;inset:auto;z-index:1;color:var(--post-rating-star-stroke)}.rating .star .fill{margin:1px;width:calc(100% - 2px);height:calc(100% - 2px);color:var(--post-rating-star-fill)}.rating .star.before-hover{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fc0}.rating .star.active{--post-rating-star-stroke:hsl(0, 0%, 20%);--post-rating-star-fill:#fc0}.rating .star.hover{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:#fc0}.rating .star.after-active{--post-rating-star-stroke:hsl(0, 0%, 40%);--post-rating-star-fill:hsl(0, 0%, 80%)}.rating :focus{outline:none}.rating:focus-visible{outline-offset:var(--post-core-dimension-2);outline:var(--post-core-dimension-2) solid #1976c8}.rating[aria-readonly=true] .star,.rating[aria-disabled=true] .star{cursor:default}.rating[aria-disabled=true] .star{--post-rating-star-stroke:hsl(0, 0%, 60%);--post-rating-star-fill:#fff}.rating[aria-disabled=true] .star.active{cursor:default;--post-rating-star-stroke:hsl(0, 0%, 60%);--post-rating-star-fill:hsl(0, 0%, 90%)}";
|
|
8
8
|
|
|
@@ -28,10 +28,6 @@ const PostRating$1 = /*@__PURE__*/ proxyCustomElement(class PostRating extends H
|
|
|
28
28
|
this.postInput = createEvent(this, "postInput");
|
|
29
29
|
this.postChange = createEvent(this, "postChange");
|
|
30
30
|
this.hasChanged = false;
|
|
31
|
-
/**
|
|
32
|
-
* Defines a hidden label for the component.
|
|
33
|
-
*/
|
|
34
|
-
this.label = 'Rating';
|
|
35
31
|
/**
|
|
36
32
|
* Defines the total amount of stars rendered in the component.
|
|
37
33
|
*/
|
|
@@ -101,13 +97,13 @@ const PostRating$1 = /*@__PURE__*/ proxyCustomElement(class PostRating extends H
|
|
|
101
97
|
}
|
|
102
98
|
}
|
|
103
99
|
render() {
|
|
104
|
-
return (h(Host, { key: '
|
|
100
|
+
return (h(Host, { key: '9089061145d80c4791a56580d107d6fab88f1d6d', "data-version": version }, h("div", { key: '81f0ba286541aecf6ddfd2e2fa113526a02abdcd', role: "slider", class: "rating", tabindex: "0", "aria-label": this.label, "aria-valuemin": "0", "aria-valuemax": this.stars, "aria-valuenow": this.currentRating, "aria-valuetext": `${this.currentRating} / ${this.stars}`, "aria-readonly": this.readonly ? 'true' : 'false', onKeyDown: this.keydownHandler, onBlur: this.blurHandler }, Array.from({ length: this.stars }).map((v, i) => (h("div", { key: `star-${v}`, "aria-hidden": "true", class: {
|
|
105
101
|
'star': true,
|
|
106
102
|
'before-hover': i < this.hoveredIndex,
|
|
107
103
|
'active': i < Math.round(this.currentRating),
|
|
108
104
|
'hover': i === this.hoveredIndex,
|
|
109
105
|
'after-active': i > this.hoveredIndex && i < this.currentRating,
|
|
110
|
-
}, onClick: () => this.update(i + 1), onMouseEnter: e => this.hoverHandler(i, e), onMouseLeave: e => this.hoverHandler(i, e) }, h("post-icon", { name: "
|
|
106
|
+
}, onClick: () => this.update(i + 1), onMouseEnter: e => this.hoverHandler(i, e), onMouseLeave: e => this.hoverHandler(i, e) }, h("post-icon", { name: "favoritestar", class: "stroke" }), h("post-icon", { name: "favoritestar-solid", class: "fill" })))))));
|
|
111
107
|
}
|
|
112
108
|
get host() { return this; }
|
|
113
109
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-kxuZ8mOU.js';
|
|
3
3
|
import { c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
4
4
|
import './p-CJ80BZ06.js';
|
|
5
5
|
import { n as nanoid } from './p-BLchVpF6.js';
|
|
@@ -19,7 +19,7 @@ const PostTabHeader$1 = /*@__PURE__*/ proxyCustomElement(class PostTabHeader ext
|
|
|
19
19
|
this.tabId = `tab-${this.host.id || nanoid(6)}`;
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
|
-
return (h(Host, { key: '
|
|
22
|
+
return (h(Host, { key: '5d9cfad4e62285e8b64a5f597e3d38d451dd493f', id: this.tabId, role: "tab", "data-version": version, "aria-selected": "false", tabindex: "-1", class: "tab-title", slot: "tabs" }, h("slot", { key: '679874586fb55510af17838ef73403c8b7a33ddc' })));
|
|
23
23
|
}
|
|
24
24
|
get host() { return this; }
|
|
25
25
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-kxuZ8mOU.js';
|
|
3
3
|
import { n as nanoid } from './p-BLchVpF6.js';
|
|
4
4
|
import { c as checkRequiredAndType } from './p-CV7fm1rW.js';
|
|
5
5
|
import './p-CJ80BZ06.js';
|
|
@@ -21,7 +21,7 @@ const PostTabPanel$1 = /*@__PURE__*/ proxyCustomElement(class PostTabPanel exten
|
|
|
21
21
|
this.panelId = `panel-${this.host.id || nanoid(6)}`;
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
|
-
return (h(Host, { key: '
|
|
24
|
+
return (h(Host, { key: '5d6c56e41ac61b10dd2560482bc5e4edab394742', "data-version": version, id: this.panelId, role: "tabpanel" }, h("slot", { key: 'ec7be772a0d3f883388742460c825dce0f0e44e8' })));
|
|
25
25
|
}
|
|
26
26
|
get host() { return this; }
|
|
27
27
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, c as createEvent, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-kxuZ8mOU.js';
|
|
3
3
|
import { f as fadeOut, a as fadeIn } from './p-SbIC4aZX.js';
|
|
4
4
|
import './p-CJ80BZ06.js';
|
|
5
5
|
|
|
@@ -167,7 +167,7 @@ const PostTabs$1 = /*@__PURE__*/ proxyCustomElement(class PostTabs extends H {
|
|
|
167
167
|
nextTab.focus();
|
|
168
168
|
}
|
|
169
169
|
render() {
|
|
170
|
-
return (h(Host, { key: '
|
|
170
|
+
return (h(Host, { key: '3e352bc059be99242f612a49bdea71fd065d67b0', "data-version": version }, h("div", { key: '34d608d7af834fd4fb3106ac3fb90100a9b73138', class: "tabs-wrapper", part: "tabs" }, h("div", { key: '102e75b53d3e485a185d391f84755142d8690de6', class: "tabs", role: "tablist" }, h("slot", { key: '03624f2944dfd37d3eb3403772d430a6e053e676', name: "tabs", onSlotchange: () => this.enableTabs() }))), h("div", { key: '8c7c956b831ef19fb093122ca35c14b5a015dad3', class: "tab-content", part: "content" }, h("slot", { key: '8fad35a2a6d26814f513c422b4fcbe98aae7bd22', onSlotchange: () => this.moveMisplacedTabs() }))));
|
|
171
171
|
}
|
|
172
172
|
get host() { return this; }
|
|
173
173
|
static get style() { return postTabsCss; }
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h, a as Host } from './index.js';
|
|
2
|
-
import { v as version } from './p-
|
|
2
|
+
import { v as version } from './p-kxuZ8mOU.js';
|
|
3
3
|
|
|
4
4
|
const postTogglebuttonCss = ":host{cursor:pointer;outline-offset:var(--post-device-spacing-padding-2) !important;outline:var(--post-scheme-color-interactive-focus-stroke) none var(--post-device-border-width-focus) !important}:host(:focus-visible){outline-style:var(--post-core-border-style-solid) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){:host(:focus-visible){outline-color:Highlight !important}}:host([aria-pressed=true]) ::slotted([data-showwhen=untoggled]){display:none}:host([aria-pressed=false]) ::slotted([data-showwhen=toggled]){display:none}";
|
|
5
5
|
|
|
@@ -29,7 +29,7 @@ const PostTogglebutton$1 = /*@__PURE__*/ proxyCustomElement(class PostTogglebutt
|
|
|
29
29
|
this.host.addEventListener('keydown', (e) => this.handleKeydown(e));
|
|
30
30
|
}
|
|
31
31
|
render() {
|
|
32
|
-
return (h(Host, { key: '
|
|
32
|
+
return (h(Host, { key: 'f56832bfbfacc23923ac06d8455fffcdafa8a7ec', "data-version": version, role: "button", tabindex: "0", "aria-pressed": this.toggled.toString() }, h("slot", { key: '7adc9ed579b6badeb08c7599ceb95892d68f027f' })));
|
|
33
33
|
}
|
|
34
34
|
get host() { return this; }
|
|
35
35
|
static get style() { return postTogglebuttonCss; }
|