@swisspost/design-system-components 10.0.0-next.53 → 10.0.0-next.54
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/{package-CTyJAQzZ.js → package-CvZxvdTJ.js} +1 -1
- package/dist/cjs/post-accordion_2.cjs.entry.js +1 -1
- package/dist/cjs/post-avatar.cjs.entry.js +1 -1
- package/dist/cjs/post-back-to-top.cjs.entry.js +1 -1
- package/dist/cjs/post-banner.cjs.entry.js +2 -2
- package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +1 -1
- package/dist/cjs/post-breadcrumbs.cjs.entry.js +1 -1
- package/dist/cjs/post-card-control.cjs.entry.js +1 -1
- package/dist/cjs/post-closebutton_15.cjs.entry.js +58 -20
- package/dist/cjs/post-collapsible_2.cjs.entry.js +1 -1
- package/dist/cjs/post-footer.cjs.entry.js +1 -1
- package/dist/cjs/post-linkarea.cjs.entry.js +1 -1
- package/dist/cjs/post-popover-trigger.cjs.entry.js +1 -1
- package/dist/cjs/post-popover.cjs.entry.js +1 -1
- package/dist/cjs/post-rating.cjs.entry.js +1 -1
- package/dist/cjs/post-tab-header.cjs.entry.js +1 -1
- package/dist/cjs/post-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/post-tabs.cjs.entry.js +1 -1
- package/dist/cjs/post-tooltip-trigger.cjs.entry.js +1 -1
- package/dist/cjs/post-tooltip.cjs.entry.js +1 -1
- package/dist/collection/components/post-banner/post-banner.css +1 -1
- package/dist/collection/components/post-megadropdown/post-megadropdown.js +4 -2
- package/dist/collection/components/post-menu/post-menu.js +7 -5
- package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +50 -12
- package/dist/components/package.js +1 -1
- package/dist/components/post-banner.js +1 -1
- package/dist/components/post-megadropdown.js +4 -2
- package/dist/components/post-menu2.js +7 -5
- package/dist/components/post-popovercontainer2.js +46 -12
- package/dist/components/react/{p-vCHPi-c4.js → p-2U_BGLjc.js} +1 -1
- package/dist/components/react/{p-CEP4VRNR.js → p-BK474oMI.js} +1 -1
- package/dist/components/react/{p-DZ_1ljyU.js → p-BUxAs8N5.js} +1 -1
- package/dist/components/react/p-BXRsHuTS.js +3 -0
- package/dist/components/react/{p-CJocYMQ7.js → p-BfLuYwf7.js} +1 -1
- package/dist/components/react/{p-ClCCjdRt.js → p-Ccgu_WOx.js} +2 -2
- package/dist/components/react/{p-oXx3C5kr.js → p-D3CFjhAf.js} +2 -2
- package/dist/components/react/{p-DC1SzgZS.js → p-D4NSCxrX.js} +1 -1
- package/dist/components/react/{p-D_8kJXLe.js → p-DVxZMuPW.js} +1 -1
- package/dist/components/react/{p-RFewkSE5.js → p-Dj7qWba5.js} +4 -4
- package/dist/components/react/{p-ClNlUIJm.js → p-mENtrn2l.js} +47 -13
- package/dist/components/react/{p-BB-k_ccz.js → p-nSFSgY-P.js} +9 -7
- 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 +2 -2
- package/dist/components/react/post-banner.js +2 -2
- package/dist/components/react/post-breadcrumb-item.js +1 -1
- package/dist/components/react/post-breadcrumbs.js +7 -7
- 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 +1 -1
- 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 +2 -2
- package/dist/components/react/post-megadropdown-trigger.js +1 -1
- package/dist/components/react/post-megadropdown.js +5 -3
- 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.js +1 -1
- package/dist/components/react/post-popover.js +4 -4
- package/dist/components/react/post-popovercontainer.js +1 -1
- package/dist/components/react/post-rating.js +2 -2
- package/dist/components/react/post-tab-header.js +1 -1
- package/dist/components/react/post-tab-panel.js +1 -1
- package/dist/components/react/post-tabs.js +1 -1
- package/dist/components/react/post-togglebutton.js +1 -1
- package/dist/components/react/post-tooltip-trigger.js +1 -1
- package/dist/components/react/post-tooltip.js +2 -2
- package/dist/docs.json +5 -1
- package/dist/esm/package-BXRsHuTS.js +3 -0
- package/dist/esm/post-accordion_2.entry.js +1 -1
- package/dist/esm/post-avatar.entry.js +1 -1
- package/dist/esm/post-back-to-top.entry.js +1 -1
- package/dist/esm/post-banner.entry.js +2 -2
- package/dist/esm/post-breadcrumb-item_2.entry.js +1 -1
- package/dist/esm/post-breadcrumbs.entry.js +1 -1
- package/dist/esm/post-card-control.entry.js +1 -1
- package/dist/esm/post-closebutton_15.entry.js +58 -20
- package/dist/esm/post-collapsible_2.entry.js +1 -1
- package/dist/esm/post-footer.entry.js +1 -1
- package/dist/esm/post-linkarea.entry.js +1 -1
- package/dist/esm/post-popover-trigger.entry.js +1 -1
- package/dist/esm/post-popover.entry.js +1 -1
- package/dist/esm/post-rating.entry.js +1 -1
- package/dist/esm/post-tab-header.entry.js +1 -1
- package/dist/esm/post-tab-panel.entry.js +1 -1
- package/dist/esm/post-tabs.entry.js +1 -1
- package/dist/esm/post-tooltip-trigger.entry.js +1 -1
- package/dist/esm/post-tooltip.entry.js +1 -1
- package/dist/post-components/{p-ff13396a.entry.js → p-02ea3ec5.entry.js} +1 -1
- package/dist/post-components/{p-240d3470.entry.js → p-0e92dbef.entry.js} +1 -1
- package/dist/post-components/{p-43ea9ba0.entry.js → p-0ec2bdd7.entry.js} +1 -1
- package/dist/post-components/{p-b3bc89ad.entry.js → p-11c204e0.entry.js} +1 -1
- package/dist/post-components/{p-ce396597.entry.js → p-197a0f25.entry.js} +1 -1
- package/dist/post-components/{p-f1a6e07a.entry.js → p-261b1452.entry.js} +1 -1
- package/dist/post-components/{p-6b73114c.entry.js → p-3274ab81.entry.js} +1 -1
- package/dist/post-components/{p-f4aac83e.entry.js → p-658b1ccc.entry.js} +1 -1
- package/dist/post-components/{p-ac1f1ebb.entry.js → p-77e43032.entry.js} +1 -1
- package/dist/post-components/{p-3f9554e1.entry.js → p-8f0fc02a.entry.js} +1 -1
- package/dist/post-components/{p-6de34182.entry.js → p-96750e25.entry.js} +1 -1
- package/dist/post-components/p-BXRsHuTS.js +1 -0
- package/dist/post-components/p-b5b5e4b9.entry.js +1 -0
- package/dist/post-components/p-b8059ba1.entry.js +1 -0
- package/dist/post-components/{p-4d84bb4a.entry.js → p-bf41fe56.entry.js} +1 -1
- package/dist/post-components/{p-be376a2b.entry.js → p-d6134e24.entry.js} +1 -1
- package/dist/post-components/p-e7029b9e.entry.js +1 -0
- package/dist/post-components/{p-d288a9b1.entry.js → p-e90688ab.entry.js} +1 -1
- package/dist/post-components/{p-efdaa2ad.entry.js → p-ea5da614.entry.js} +1 -1
- package/dist/post-components/{p-5a9885dd.entry.js → p-f1b815b6.entry.js} +1 -1
- package/dist/post-components/post-components.esm.js +1 -1
- package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +5 -0
- package/hydrate/index.js +59 -21
- package/hydrate/index.mjs +59 -21
- package/package.json +4 -4
- package/dist/components/react/p-DeqIcjvO.js +0 -3
- package/dist/esm/package-DeqIcjvO.js +0 -3
- package/dist/post-components/p-5450bd15.entry.js +0 -1
- package/dist/post-components/p-5b53b042.entry.js +0 -1
- package/dist/post-components/p-87d9de40.entry.js +0 -1
- package/dist/post-components/p-DeqIcjvO.js +0 -1
|
@@ -56,7 +56,9 @@ export class PostMegadropdown {
|
|
|
56
56
|
if (PostMegadropdown.activeDropdown === this) {
|
|
57
57
|
PostMegadropdown.activeDropdown = null;
|
|
58
58
|
}
|
|
59
|
-
this.defaultSlotObserver
|
|
59
|
+
if (this.defaultSlotObserver) {
|
|
60
|
+
this.defaultSlotObserver.disconnect();
|
|
61
|
+
}
|
|
60
62
|
}
|
|
61
63
|
/**
|
|
62
64
|
* Toggles the dropdown visibility based on its current state.
|
|
@@ -223,7 +225,7 @@ export class PostMegadropdown {
|
|
|
223
225
|
}
|
|
224
226
|
render() {
|
|
225
227
|
const containerStyle = this.isVisible ? {} : { display: 'none' };
|
|
226
|
-
return (h(Host, { key: '
|
|
228
|
+
return (h(Host, { key: 'd111d8d93a9b64018f3df88813da8f6d1c65759e', version: version }, h("div", { key: 'd7cb2b98624c9241108bc66cc11c15c0a2e7acf3', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: '9f0280b6f28f19ee7f9ba4707209b64b38759927', class: "megadropdown" }, h("slot", { key: '71f2521e1ab13406dd986c18a7c52e171148b0b0', name: "megadropdown-title" }), h("slot", { key: '148de1446aade76b074e155d07b70e775fc9612c', name: "megadropdown-overview-link" }), h("div", { key: '269c1e1db66acb7c274c720a9f715d29e875ef54', class: "megadropdown-content" }, h("slot", { key: '444040337c57e64bcc57f56415c4c40513ef0a5b' })), h("div", { key: 'f97d8c578ee19b5ba7d593e5d110e3b283255087', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: 'dc04da3a42714e2e8742ab8ed25bcc288a236294', name: "back-button" })), h("div", { key: '354eca51a5aef76d483a30e595bedfa95792d7ce', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: '28693622360c0da91f3051426be545852c5ec337', name: "close-button" }))))));
|
|
227
229
|
}
|
|
228
230
|
static get is() { return "post-megadropdown"; }
|
|
229
231
|
static get originalStyleUrls() {
|
|
@@ -70,10 +70,12 @@ export class PostMenu {
|
|
|
70
70
|
this.toggleMenu.emit(this.isVisible);
|
|
71
71
|
if (this.isVisible) {
|
|
72
72
|
this.lastFocusedElement = this.root?.activeElement;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
menuItems
|
|
76
|
-
|
|
73
|
+
requestAnimationFrame(() => {
|
|
74
|
+
const menuItems = this.getSlottedItems();
|
|
75
|
+
if (menuItems.length > 0) {
|
|
76
|
+
menuItems[0].focus();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
77
79
|
}
|
|
78
80
|
else if (this.lastFocusedElement) {
|
|
79
81
|
this.lastFocusedElement.focus();
|
|
@@ -189,7 +191,7 @@ export class PostMenu {
|
|
|
189
191
|
.flatMap(el => Array.from(getFocusableChildren(el))));
|
|
190
192
|
}
|
|
191
193
|
render() {
|
|
192
|
-
return (h(Host, { key: '
|
|
194
|
+
return (h(Host, { key: 'eef3d3cdf2553c2627ddf580a95c70f00c02d388', "data-version": version }, h("post-popovercontainer", { key: '27c3341bec9d4ee98b59f70e902913f03954c32c', onPostShow: this.handlePostShown, onPostToggle: this.handlePostToggled, placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: 'ef6c0ab8b6de380c23f6562a3d0ba34d9eaace98', part: "menu" }, h("slot", { key: 'edca1d3e9ab11d016ba18baf9f8d6aa65bb71958', name: "header" }), h("slot", { key: '40596847f9bac957a5992364997f0bcd8fd6a704' })))));
|
|
193
195
|
}
|
|
194
196
|
static get is() { return "post-menu"; }
|
|
195
197
|
static get encapsulation() { return "shadow"; }
|
|
@@ -34,6 +34,7 @@ export class PostPopovercontainer {
|
|
|
34
34
|
* Whether or not the popovercontainer should close when user clicks outside of it
|
|
35
35
|
*/
|
|
36
36
|
this.manualClose = false;
|
|
37
|
+
this.currentAnimation = null;
|
|
37
38
|
}
|
|
38
39
|
validatePlacement() {
|
|
39
40
|
checkEmptyOrOneOf(this, 'placement', PLACEMENT_TYPES);
|
|
@@ -75,8 +76,6 @@ export class PostPopovercontainer {
|
|
|
75
76
|
if (this.toggleTimeoutId)
|
|
76
77
|
return;
|
|
77
78
|
this.eventTarget = target;
|
|
78
|
-
if (this.toggleTimeoutId)
|
|
79
|
-
return;
|
|
80
79
|
this.calculatePosition();
|
|
81
80
|
this.host.showPopover();
|
|
82
81
|
}
|
|
@@ -87,17 +86,19 @@ export class PostPopovercontainer {
|
|
|
87
86
|
const content = this.host.querySelector('.popover-content');
|
|
88
87
|
this.startAutoupdates();
|
|
89
88
|
if (content) {
|
|
90
|
-
|
|
91
|
-
if (animation
|
|
89
|
+
// Only run animation and emit related events if animation is defined
|
|
90
|
+
if (this.animation === null) {
|
|
91
|
+
// No animation case
|
|
92
92
|
this.postBeforeToggle.emit({ willOpen: true });
|
|
93
93
|
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
94
|
-
}
|
|
95
|
-
animation?.finished.then(() => {
|
|
96
94
|
this.postToggle.emit({ isOpen: true });
|
|
97
95
|
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
98
96
|
if (this.hasOpenedOnce)
|
|
99
97
|
this.hasOpenedOnce = false;
|
|
100
|
-
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
this.runOpenAnimation(content);
|
|
101
|
+
}
|
|
101
102
|
}
|
|
102
103
|
if (this.safeSpace) {
|
|
103
104
|
window.addEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
@@ -113,17 +114,50 @@ export class PostPopovercontainer {
|
|
|
113
114
|
if (this.safeSpace) {
|
|
114
115
|
window.removeEventListener('mousemove', this.mouseTrackingHandler.bind(this));
|
|
115
116
|
}
|
|
117
|
+
// Cancel any running animation
|
|
118
|
+
if (this.animation !== null && this.currentAnimation) {
|
|
119
|
+
this.currentAnimation.cancel();
|
|
120
|
+
this.currentAnimation = null;
|
|
121
|
+
}
|
|
122
|
+
this.postBeforeToggle.emit({ willOpen: false });
|
|
116
123
|
this.postToggle.emit({ isOpen: false });
|
|
117
124
|
this.postHide.emit();
|
|
118
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Runs the animation and emits the toggle/show/hide events in the correct timing
|
|
128
|
+
*/
|
|
129
|
+
async runOpenAnimation(element) {
|
|
130
|
+
let animation;
|
|
131
|
+
try {
|
|
132
|
+
animation = popIn(element);
|
|
133
|
+
this.currentAnimation = animation;
|
|
134
|
+
if (animation.playState === 'running') {
|
|
135
|
+
this.postBeforeToggle.emit({ willOpen: true });
|
|
136
|
+
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
137
|
+
}
|
|
138
|
+
await animation.finished;
|
|
139
|
+
this.postToggle.emit({ isOpen: true });
|
|
140
|
+
this.postShow.emit({ first: this.hasOpenedOnce });
|
|
141
|
+
this.hasOpenedOnce = true;
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
console.warn('Animation failed or was interrupted:', err);
|
|
145
|
+
// Reset all states to closing
|
|
146
|
+
this.postBeforeToggle.emit({ willOpen: false });
|
|
147
|
+
this.postBeforeShow.emit({ first: this.hasOpenedOnce });
|
|
148
|
+
this.postToggle.emit({ isOpen: false });
|
|
149
|
+
}
|
|
150
|
+
finally {
|
|
151
|
+
if (this.currentAnimation === animation) {
|
|
152
|
+
this.currentAnimation = null;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
119
156
|
/**
|
|
120
157
|
* Programmatically hide the popovercontainer
|
|
121
158
|
*/
|
|
122
159
|
async hide() {
|
|
123
160
|
if (!this.toggleTimeoutId) {
|
|
124
|
-
if (this.eventTarget && this.eventTarget instanceof HTMLElement) {
|
|
125
|
-
this.eventTarget.focus();
|
|
126
|
-
}
|
|
127
161
|
this.eventTarget = null;
|
|
128
162
|
this.host.hidePopover();
|
|
129
163
|
this.postHide.emit();
|
|
@@ -289,9 +323,9 @@ export class PostPopovercontainer {
|
|
|
289
323
|
}
|
|
290
324
|
}
|
|
291
325
|
render() {
|
|
292
|
-
return (h(Host, { key: '
|
|
326
|
+
return (h(Host, { key: 'ec57bb478a7fe7d6449ef1ed4d91db4d0835ea4e', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: '2969b3c6ef9441d06b9c913f47bb64e84006dbe4', class: "popover-content" }, this.arrow && (h("span", { key: '03b8addd0bee91d9358e9554f2d507b9a349e0db', class: "arrow", ref: el => {
|
|
293
327
|
this.arrowRef = el;
|
|
294
|
-
} })), h("slot", { key: '
|
|
328
|
+
} })), h("slot", { key: '2fb25dce5ea9e5f1044cde4839df61af34c8b667' }))));
|
|
295
329
|
}
|
|
296
330
|
static get is() { return "post-popovercontainer"; }
|
|
297
331
|
static get originalStyleUrls() {
|
|
@@ -549,6 +583,10 @@ export class PostPopovercontainer {
|
|
|
549
583
|
"Promise": {
|
|
550
584
|
"location": "global",
|
|
551
585
|
"id": "global::Promise"
|
|
586
|
+
},
|
|
587
|
+
"HTMLElement": {
|
|
588
|
+
"location": "global",
|
|
589
|
+
"id": "global::HTMLElement"
|
|
552
590
|
}
|
|
553
591
|
},
|
|
554
592
|
"return": "Promise<void>"
|