@swisspost/design-system-components 10.0.0-next.51 → 10.0.0-next.53
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-CTyJAQzZ.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-BRBszIzq.js → p-BB-k_ccz.js} +30 -34
- package/dist/components/react/p-BVXiQdHq.js +64 -0
- package/dist/components/react/{p-BIslNfKd.js → p-CEP4VRNR.js} +2 -2
- package/dist/components/react/{p-BsuTiCyd.js → p-CJocYMQ7.js} +1 -1
- package/dist/components/react/{p-DC3aZ-Qt.js → p-ClCCjdRt.js} +3 -3
- package/dist/components/react/{p-BVVgwjV0.js → p-ClNlUIJm.js} +83 -33
- package/dist/components/react/{p-2qJcvMt7.js → p-DC1SzgZS.js} +1 -1
- package/dist/components/react/{p-D7N0KPNm.js → p-DZ_1ljyU.js} +2 -2
- package/dist/components/react/{p-WA0BpGMu.js → p-D_8kJXLe.js} +1 -1
- package/dist/components/react/p-DeqIcjvO.js +3 -0
- package/dist/components/react/p-HygIVKXC.js +5018 -0
- package/dist/components/react/{p-Cpz7bn7D.js → p-RFewkSE5.js} +5 -5
- package/dist/components/react/{p-BnCGzVcR.js → p-oXx3C5kr.js} +3 -3
- package/dist/components/react/{p-BcpJoB81.js → p-vCHPi-c4.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-DeqIcjvO.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-240d3470.entry.js +1 -0
- package/dist/post-components/{p-ef38c78d.entry.js → p-3f9554e1.entry.js} +1 -1
- package/dist/post-components/p-43ea9ba0.entry.js +1 -0
- package/dist/post-components/p-4d84bb4a.entry.js +1 -0
- package/dist/post-components/p-5450bd15.entry.js +1 -0
- package/dist/post-components/{p-2b003617.entry.js → p-5a9885dd.entry.js} +1 -1
- package/dist/post-components/{p-b871aa1b.entry.js → p-5b53b042.entry.js} +1 -1
- package/dist/post-components/p-6b73114c.entry.js +1 -0
- package/dist/post-components/{p-2440cba5.entry.js → p-6de34182.entry.js} +1 -1
- package/dist/post-components/p-87d9de40.entry.js +1 -0
- package/dist/post-components/p-CFNKgUjL.js +2 -0
- package/dist/post-components/p-D9ZHp2FP.js +1 -0
- package/dist/post-components/p-DeqIcjvO.js +1 -0
- package/dist/post-components/p-HygIVKXC.js +1 -0
- package/dist/post-components/p-ac1f1ebb.entry.js +1 -0
- package/dist/post-components/{p-759510e5.entry.js → p-b3bc89ad.entry.js} +1 -1
- package/dist/post-components/{p-e764835b.entry.js → p-be376a2b.entry.js} +1 -1
- package/dist/post-components/p-ce396597.entry.js +1 -0
- package/dist/post-components/{p-0b1143d4.entry.js → p-d288a9b1.entry.js} +1 -1
- package/dist/post-components/p-efdaa2ad.entry.js +1 -0
- package/dist/post-components/p-f1a6e07a.entry.js +1 -0
- package/dist/post-components/p-f4aac83e.entry.js +1 -0
- package/dist/post-components/{p-509ae720.entry.js → p-ff13396a.entry.js} +1 -1
- 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,107 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-CFNKgUjL.js';
|
|
2
|
+
import { v as version } from './package-DeqIcjvO.js';
|
|
3
|
+
import { i as isFocusable } from './focusable-HygIVKXC.js';
|
|
4
|
+
import { c as checkRequiredAndType } from './index-VmK3ABCB.js';
|
|
5
|
+
import './breakpoints-CJ80BZ06.js';
|
|
6
|
+
|
|
7
|
+
const postPopoverTriggerCss = ":host{cursor:pointer}";
|
|
8
|
+
|
|
9
|
+
const PostPopoverTrigger = class {
|
|
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(hostRef) {
|
|
64
|
+
registerInstance(this, hostRef);
|
|
65
|
+
/**
|
|
66
|
+
* Manages the accessibility attribute `aria-expanded` to indicate whether the associated popover is expanded or collapsed.
|
|
67
|
+
*/
|
|
68
|
+
this.ariaExpanded = false;
|
|
69
|
+
/**
|
|
70
|
+
* Holds the state of the popover toggle
|
|
71
|
+
*/
|
|
72
|
+
this.popoverOpen = false;
|
|
73
|
+
this.handleKeyDown = (e) => {
|
|
74
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
this.handleToggle();
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
this.boundHandleToggle = this.handleToggle.bind(this);
|
|
80
|
+
this.boundHandleKeyDown = this.handleKeyDown.bind(this);
|
|
81
|
+
this.boundHandlePostToggle = (event) => {
|
|
82
|
+
this.popoverOpen = event.detail.isOpen;
|
|
83
|
+
this.focusTrigger();
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
componentDidLoad() {
|
|
87
|
+
this.validateFor();
|
|
88
|
+
this.setupTrigger();
|
|
89
|
+
this.popover?.addEventListener('postToggle', this.boundHandlePostToggle);
|
|
90
|
+
}
|
|
91
|
+
disconnectedCallback() {
|
|
92
|
+
this.trigger.removeEventListener('click', this.boundHandleToggle);
|
|
93
|
+
this.trigger.removeEventListener('keydown', this.boundHandleKeyDown);
|
|
94
|
+
this.popover?.removeEventListener('postToggle', this.boundHandlePostToggle);
|
|
95
|
+
}
|
|
96
|
+
render() {
|
|
97
|
+
return (h(Host, { key: 'd7467aa400f407d76df06e8bbc84210e5f016073', "data-version": version }, h("slot", { key: '618f3d14fb89b3ad3c101a58f8519c337d9f1721', onSlotchange: () => this.setupTrigger() })));
|
|
98
|
+
}
|
|
99
|
+
get host() { return getElement(this); }
|
|
100
|
+
static get watchers() { return {
|
|
101
|
+
"popoverOpen": ["syncAriaExpanded"],
|
|
102
|
+
"for": ["validateFor"]
|
|
103
|
+
}; }
|
|
104
|
+
};
|
|
105
|
+
PostPopoverTrigger.style = postPopoverTriggerCss;
|
|
106
|
+
|
|
107
|
+
export { PostPopoverTrigger as post_popover_trigger };
|
|
@@ -1,67 +1,15 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, a as getElement } from './index-
|
|
1
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-CFNKgUjL.js';
|
|
2
2
|
import { P as PLACEMENT_TYPES } from './placement-DRiVosES.js';
|
|
3
|
-
import { v as version } from './package-
|
|
4
|
-
import {
|
|
3
|
+
import { v as version } from './package-DeqIcjvO.js';
|
|
4
|
+
import { g as getDeepFocusableChildren } from './get-focusable-children-D9ZHp2FP.js';
|
|
5
5
|
import { d as checkEmptyOrOneOf, c as checkRequiredAndType } from './index-VmK3ABCB.js';
|
|
6
|
-
|
|
7
|
-
function getAttributeObserver(attribute, handler) {
|
|
8
|
-
/**
|
|
9
|
-
* Handle attribute changes and childList changes from the observer
|
|
10
|
-
* @param {MutationRecord[]} mutationList
|
|
11
|
-
*/
|
|
12
|
-
function observerHandler(mutationList) {
|
|
13
|
-
mutationList.forEach(mutation => {
|
|
14
|
-
if (mutation.type === 'attributes' && mutation.attributeName === attribute) {
|
|
15
|
-
handler(mutation.target);
|
|
16
|
-
}
|
|
17
|
-
if (mutation.type === 'childList') {
|
|
18
|
-
mutation.addedNodes.forEach(node => {
|
|
19
|
-
if (node.nodeType === Node.ELEMENT_NODE &&
|
|
20
|
-
node.hasAttribute(attribute)) {
|
|
21
|
-
handler(node);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
// Initialize a mutation observer for patching accessibility features
|
|
28
|
-
return IS_BROWSER ? new MutationObserver(observerHandler) : null;
|
|
29
|
-
}
|
|
6
|
+
import './breakpoints-CJ80BZ06.js';
|
|
30
7
|
|
|
31
8
|
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}";
|
|
32
9
|
|
|
33
|
-
/**
|
|
34
|
-
* @slot default - Slot for placing content inside the popover.
|
|
35
|
-
*/
|
|
36
|
-
let popoverInstances = 0;
|
|
37
|
-
const popoverTargetAttribute = 'data-popover-target';
|
|
38
|
-
const globalToggleHandler = (e) => {
|
|
39
|
-
let currentElement = e.target;
|
|
40
|
-
// Traverse up the DOM tree to find if any parent has the popover target attribute
|
|
41
|
-
while (currentElement && !currentElement.getAttribute(popoverTargetAttribute)) {
|
|
42
|
-
if (currentElement === document.body || !currentElement.parentElement)
|
|
43
|
-
break;
|
|
44
|
-
currentElement = currentElement.parentElement;
|
|
45
|
-
}
|
|
46
|
-
const popoverTarget = currentElement?.getAttribute(popoverTargetAttribute);
|
|
47
|
-
if (!popoverTarget || ('key' in e && e.key !== 'Enter'))
|
|
48
|
-
return;
|
|
49
|
-
const popover = document.getElementById(popoverTarget);
|
|
50
|
-
popover?.toggle(currentElement);
|
|
51
|
-
};
|
|
52
10
|
const PostPopover = class {
|
|
53
|
-
validatePlacement() {
|
|
54
|
-
checkEmptyOrOneOf(this, 'placement', PLACEMENT_TYPES);
|
|
55
|
-
}
|
|
56
|
-
validateCloseButtonCaption() {
|
|
57
|
-
checkRequiredAndType(this, 'closeButtonCaption', 'string');
|
|
58
|
-
}
|
|
59
11
|
constructor(hostRef) {
|
|
60
12
|
registerInstance(this, hostRef);
|
|
61
|
-
// Initialize a mutation observer for patching accessibility features
|
|
62
|
-
this.triggerObserver = IS_BROWSER
|
|
63
|
-
? getAttributeObserver(popoverTargetAttribute, this.patchAccessibilityFeatures)
|
|
64
|
-
: null;
|
|
65
13
|
/**
|
|
66
14
|
* Defines the position of the popover relative to its trigger.
|
|
67
15
|
* 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.
|
|
@@ -73,76 +21,46 @@ const PostPopover = class {
|
|
|
73
21
|
*/
|
|
74
22
|
// eslint-disable-next-line @stencil-community/ban-default-true
|
|
75
23
|
this.arrow = true;
|
|
76
|
-
this.localBeforeToggleHandler = this.beforeToggleHandler.bind(this);
|
|
77
24
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.triggerObserver?.observe(document.body, {
|
|
84
|
-
subtree: true,
|
|
85
|
-
childList: true,
|
|
86
|
-
attributeFilter: [popoverTargetAttribute],
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
popoverInstances++;
|
|
90
|
-
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
25
|
+
validatePlacement() {
|
|
26
|
+
checkEmptyOrOneOf(this, 'placement', PLACEMENT_TYPES);
|
|
27
|
+
}
|
|
28
|
+
validateCloseButtonCaption() {
|
|
29
|
+
checkRequiredAndType(this, 'closeButtonCaption', 'string');
|
|
91
30
|
}
|
|
92
31
|
componentDidLoad() {
|
|
93
32
|
this.validatePlacement();
|
|
94
33
|
this.validateCloseButtonCaption();
|
|
95
|
-
this.popoverRef.addEventListener('beforetoggle', this.localBeforeToggleHandler);
|
|
96
|
-
}
|
|
97
|
-
disconnectedCallback() {
|
|
98
|
-
popoverInstances--;
|
|
99
|
-
// Remove listeners and observer after the last popover has been destructed
|
|
100
|
-
if (popoverInstances === 0) {
|
|
101
|
-
window.removeEventListener('click', globalToggleHandler);
|
|
102
|
-
window.removeEventListener('keydown', globalToggleHandler);
|
|
103
|
-
this.triggerObserver?.disconnect();
|
|
104
|
-
}
|
|
105
|
-
this.popoverRef.removeEventListener('beforetoggle', this.localBeforeToggleHandler);
|
|
106
|
-
this.triggers.forEach(trigger => trigger.removeAttribute('aria-expanded'));
|
|
107
34
|
}
|
|
108
35
|
/**
|
|
109
36
|
* Programmatically display the popover
|
|
110
|
-
* @param target
|
|
37
|
+
* @param target A focusable element inside the <post-popover-trigger> component that controls the popover
|
|
111
38
|
*/
|
|
112
39
|
async show(target) {
|
|
113
40
|
this.popoverRef.show(target);
|
|
114
|
-
console.log(this.popoverRef);
|
|
115
|
-
target.setAttribute('aria-expanded', 'true');
|
|
116
41
|
}
|
|
117
42
|
/**
|
|
118
43
|
* Programmatically hide this popover
|
|
119
44
|
*/
|
|
120
45
|
async hide() {
|
|
121
46
|
this.popoverRef.hide();
|
|
122
|
-
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
123
47
|
}
|
|
124
48
|
/**
|
|
125
49
|
* Toggle popover display
|
|
126
|
-
* @param target
|
|
50
|
+
* @param target A focusable element inside the <post-popover-trigger> component that controls the popover
|
|
127
51
|
* @param force Pass true to always show or false to always hide
|
|
128
52
|
*/
|
|
129
53
|
async toggle(target, force) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
beforeToggleHandler() {
|
|
138
|
-
this.triggers.forEach(trigger => trigger.setAttribute('aria-expanded', 'false'));
|
|
139
|
-
}
|
|
140
|
-
patchAccessibilityFeatures(trigger) {
|
|
141
|
-
const force = trigger.hasAttribute(popoverTargetAttribute);
|
|
142
|
-
trigger.setAttribute('aria-expanded', force ? 'false' : null);
|
|
54
|
+
await this.popoverRef.toggle(target, force);
|
|
55
|
+
const focusableChildren = getDeepFocusableChildren(this.host);
|
|
56
|
+
// find first focusable element
|
|
57
|
+
const firstFocusable = focusableChildren[0];
|
|
58
|
+
if (firstFocusable) {
|
|
59
|
+
firstFocusable.focus();
|
|
60
|
+
}
|
|
143
61
|
}
|
|
144
62
|
render() {
|
|
145
|
-
return (h(Host, { key: '
|
|
63
|
+
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)))));
|
|
146
64
|
}
|
|
147
65
|
get host() { return getElement(this); }
|
|
148
66
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-
|
|
2
|
-
import { v as version } from './package-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-CFNKgUjL.js';
|
|
2
|
+
import { v as version } from './package-DeqIcjvO.js';
|
|
3
3
|
import { c as checkRequiredAndType } from './index-VmK3ABCB.js';
|
|
4
4
|
import './breakpoints-CJ80BZ06.js';
|
|
5
5
|
|
|
@@ -25,10 +25,6 @@ const PostRating = class {
|
|
|
25
25
|
this.postInput = createEvent(this, "postInput");
|
|
26
26
|
this.postChange = createEvent(this, "postChange");
|
|
27
27
|
this.hasChanged = false;
|
|
28
|
-
/**
|
|
29
|
-
* Defines a hidden label for the component.
|
|
30
|
-
*/
|
|
31
|
-
this.label = 'Rating';
|
|
32
28
|
/**
|
|
33
29
|
* Defines the total amount of stars rendered in the component.
|
|
34
30
|
*/
|
|
@@ -98,13 +94,13 @@ const PostRating = class {
|
|
|
98
94
|
}
|
|
99
95
|
}
|
|
100
96
|
render() {
|
|
101
|
-
return (h(Host, { key: '
|
|
97
|
+
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: {
|
|
102
98
|
'star': true,
|
|
103
99
|
'before-hover': i < this.hoveredIndex,
|
|
104
100
|
'active': i < Math.round(this.currentRating),
|
|
105
101
|
'hover': i === this.hoveredIndex,
|
|
106
102
|
'after-active': i > this.hoveredIndex && i < this.currentRating,
|
|
107
|
-
}, onClick: () => this.update(i + 1), onMouseEnter: e => this.hoverHandler(i, e), onMouseLeave: e => this.hoverHandler(i, e) }, h("post-icon", { name: "
|
|
103
|
+
}, 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" })))))));
|
|
108
104
|
}
|
|
109
105
|
get host() { return getElement(this); }
|
|
110
106
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, a as getElement } from './index-
|
|
2
|
-
import { v as version } from './package-
|
|
1
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-CFNKgUjL.js';
|
|
2
|
+
import { v as version } from './package-DeqIcjvO.js';
|
|
3
3
|
import { c as checkRequiredAndType } from './index-VmK3ABCB.js';
|
|
4
4
|
import './breakpoints-CJ80BZ06.js';
|
|
5
5
|
import { n as nanoid } from './index.browser-BLchVpF6.js';
|
|
@@ -17,7 +17,7 @@ const PostTabHeader = class {
|
|
|
17
17
|
this.tabId = `tab-${this.host.id || nanoid(6)}`;
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h(Host, { key: '
|
|
20
|
+
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' })));
|
|
21
21
|
}
|
|
22
22
|
get host() { return getElement(this); }
|
|
23
23
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host, a as getElement } from './index-
|
|
2
|
-
import { v as version } from './package-
|
|
1
|
+
import { r as registerInstance, h, H as Host, a as getElement } from './index-CFNKgUjL.js';
|
|
2
|
+
import { v as version } from './package-DeqIcjvO.js';
|
|
3
3
|
import { n as nanoid } from './index.browser-BLchVpF6.js';
|
|
4
4
|
import { c as checkRequiredAndType } from './index-VmK3ABCB.js';
|
|
5
5
|
import './breakpoints-CJ80BZ06.js';
|
|
@@ -19,7 +19,7 @@ const PostTabPanel = class {
|
|
|
19
19
|
this.panelId = `panel-${this.host.id || nanoid(6)}`;
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
|
-
return (h(Host, { key: '
|
|
22
|
+
return (h(Host, { key: '5d6c56e41ac61b10dd2560482bc5e4edab394742', "data-version": version, id: this.panelId, role: "tabpanel" }, h("slot", { key: 'ec7be772a0d3f883388742460c825dce0f0e44e8' })));
|
|
23
23
|
}
|
|
24
24
|
get host() { return getElement(this); }
|
|
25
25
|
static get watchers() { return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-
|
|
2
|
-
import { v as version } from './package-
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-CFNKgUjL.js';
|
|
2
|
+
import { v as version } from './package-DeqIcjvO.js';
|
|
3
3
|
import { f as fadeOut, a as fadeIn } from './fade-SbIC4aZX.js';
|
|
4
4
|
import './breakpoints-CJ80BZ06.js';
|
|
5
5
|
|
|
@@ -165,7 +165,7 @@ const PostTabs = class {
|
|
|
165
165
|
nextTab.focus();
|
|
166
166
|
}
|
|
167
167
|
render() {
|
|
168
|
-
return (h(Host, { key: '
|
|
168
|
+
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() }))));
|
|
169
169
|
}
|
|
170
170
|
get host() { return getElement(this); }
|
|
171
171
|
};
|