@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.
Files changed (129) hide show
  1. package/dist/cjs/{package-CTyJAQzZ.js → package-CvZxvdTJ.js} +1 -1
  2. package/dist/cjs/post-accordion_2.cjs.entry.js +1 -1
  3. package/dist/cjs/post-avatar.cjs.entry.js +1 -1
  4. package/dist/cjs/post-back-to-top.cjs.entry.js +1 -1
  5. package/dist/cjs/post-banner.cjs.entry.js +2 -2
  6. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +1 -1
  7. package/dist/cjs/post-breadcrumbs.cjs.entry.js +1 -1
  8. package/dist/cjs/post-card-control.cjs.entry.js +1 -1
  9. package/dist/cjs/post-closebutton_15.cjs.entry.js +58 -20
  10. package/dist/cjs/post-collapsible_2.cjs.entry.js +1 -1
  11. package/dist/cjs/post-footer.cjs.entry.js +1 -1
  12. package/dist/cjs/post-linkarea.cjs.entry.js +1 -1
  13. package/dist/cjs/post-popover-trigger.cjs.entry.js +1 -1
  14. package/dist/cjs/post-popover.cjs.entry.js +1 -1
  15. package/dist/cjs/post-rating.cjs.entry.js +1 -1
  16. package/dist/cjs/post-tab-header.cjs.entry.js +1 -1
  17. package/dist/cjs/post-tab-panel.cjs.entry.js +1 -1
  18. package/dist/cjs/post-tabs.cjs.entry.js +1 -1
  19. package/dist/cjs/post-tooltip-trigger.cjs.entry.js +1 -1
  20. package/dist/cjs/post-tooltip.cjs.entry.js +1 -1
  21. package/dist/collection/components/post-banner/post-banner.css +1 -1
  22. package/dist/collection/components/post-megadropdown/post-megadropdown.js +4 -2
  23. package/dist/collection/components/post-menu/post-menu.js +7 -5
  24. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +50 -12
  25. package/dist/components/package.js +1 -1
  26. package/dist/components/post-banner.js +1 -1
  27. package/dist/components/post-megadropdown.js +4 -2
  28. package/dist/components/post-menu2.js +7 -5
  29. package/dist/components/post-popovercontainer2.js +46 -12
  30. package/dist/components/react/{p-vCHPi-c4.js → p-2U_BGLjc.js} +1 -1
  31. package/dist/components/react/{p-CEP4VRNR.js → p-BK474oMI.js} +1 -1
  32. package/dist/components/react/{p-DZ_1ljyU.js → p-BUxAs8N5.js} +1 -1
  33. package/dist/components/react/p-BXRsHuTS.js +3 -0
  34. package/dist/components/react/{p-CJocYMQ7.js → p-BfLuYwf7.js} +1 -1
  35. package/dist/components/react/{p-ClCCjdRt.js → p-Ccgu_WOx.js} +2 -2
  36. package/dist/components/react/{p-oXx3C5kr.js → p-D3CFjhAf.js} +2 -2
  37. package/dist/components/react/{p-DC1SzgZS.js → p-D4NSCxrX.js} +1 -1
  38. package/dist/components/react/{p-D_8kJXLe.js → p-DVxZMuPW.js} +1 -1
  39. package/dist/components/react/{p-RFewkSE5.js → p-Dj7qWba5.js} +4 -4
  40. package/dist/components/react/{p-ClNlUIJm.js → p-mENtrn2l.js} +47 -13
  41. package/dist/components/react/{p-BB-k_ccz.js → p-nSFSgY-P.js} +9 -7
  42. package/dist/components/react/post-accordion-item.js +1 -1
  43. package/dist/components/react/post-accordion.js +1 -1
  44. package/dist/components/react/post-avatar.js +1 -1
  45. package/dist/components/react/post-back-to-top.js +2 -2
  46. package/dist/components/react/post-banner.js +2 -2
  47. package/dist/components/react/post-breadcrumb-item.js +1 -1
  48. package/dist/components/react/post-breadcrumbs.js +7 -7
  49. package/dist/components/react/post-card-control.js +2 -2
  50. package/dist/components/react/post-closebutton.js +1 -1
  51. package/dist/components/react/post-collapsible-trigger.js +1 -1
  52. package/dist/components/react/post-collapsible.js +1 -1
  53. package/dist/components/react/post-footer.js +6 -6
  54. package/dist/components/react/post-header.js +1 -1
  55. package/dist/components/react/post-icon.js +1 -1
  56. package/dist/components/react/post-language-option.js +1 -1
  57. package/dist/components/react/post-language-switch.js +5 -5
  58. package/dist/components/react/post-linkarea.js +1 -1
  59. package/dist/components/react/post-list-item.js +1 -1
  60. package/dist/components/react/post-list.js +1 -1
  61. package/dist/components/react/post-logo.js +1 -1
  62. package/dist/components/react/post-mainnavigation.js +2 -2
  63. package/dist/components/react/post-megadropdown-trigger.js +1 -1
  64. package/dist/components/react/post-megadropdown.js +5 -3
  65. package/dist/components/react/post-menu-item.js +1 -1
  66. package/dist/components/react/post-menu-trigger.js +1 -1
  67. package/dist/components/react/post-menu.js +1 -1
  68. package/dist/components/react/post-popover-trigger.js +1 -1
  69. package/dist/components/react/post-popover.js +4 -4
  70. package/dist/components/react/post-popovercontainer.js +1 -1
  71. package/dist/components/react/post-rating.js +2 -2
  72. package/dist/components/react/post-tab-header.js +1 -1
  73. package/dist/components/react/post-tab-panel.js +1 -1
  74. package/dist/components/react/post-tabs.js +1 -1
  75. package/dist/components/react/post-togglebutton.js +1 -1
  76. package/dist/components/react/post-tooltip-trigger.js +1 -1
  77. package/dist/components/react/post-tooltip.js +2 -2
  78. package/dist/docs.json +5 -1
  79. package/dist/esm/package-BXRsHuTS.js +3 -0
  80. package/dist/esm/post-accordion_2.entry.js +1 -1
  81. package/dist/esm/post-avatar.entry.js +1 -1
  82. package/dist/esm/post-back-to-top.entry.js +1 -1
  83. package/dist/esm/post-banner.entry.js +2 -2
  84. package/dist/esm/post-breadcrumb-item_2.entry.js +1 -1
  85. package/dist/esm/post-breadcrumbs.entry.js +1 -1
  86. package/dist/esm/post-card-control.entry.js +1 -1
  87. package/dist/esm/post-closebutton_15.entry.js +58 -20
  88. package/dist/esm/post-collapsible_2.entry.js +1 -1
  89. package/dist/esm/post-footer.entry.js +1 -1
  90. package/dist/esm/post-linkarea.entry.js +1 -1
  91. package/dist/esm/post-popover-trigger.entry.js +1 -1
  92. package/dist/esm/post-popover.entry.js +1 -1
  93. package/dist/esm/post-rating.entry.js +1 -1
  94. package/dist/esm/post-tab-header.entry.js +1 -1
  95. package/dist/esm/post-tab-panel.entry.js +1 -1
  96. package/dist/esm/post-tabs.entry.js +1 -1
  97. package/dist/esm/post-tooltip-trigger.entry.js +1 -1
  98. package/dist/esm/post-tooltip.entry.js +1 -1
  99. package/dist/post-components/{p-ff13396a.entry.js → p-02ea3ec5.entry.js} +1 -1
  100. package/dist/post-components/{p-240d3470.entry.js → p-0e92dbef.entry.js} +1 -1
  101. package/dist/post-components/{p-43ea9ba0.entry.js → p-0ec2bdd7.entry.js} +1 -1
  102. package/dist/post-components/{p-b3bc89ad.entry.js → p-11c204e0.entry.js} +1 -1
  103. package/dist/post-components/{p-ce396597.entry.js → p-197a0f25.entry.js} +1 -1
  104. package/dist/post-components/{p-f1a6e07a.entry.js → p-261b1452.entry.js} +1 -1
  105. package/dist/post-components/{p-6b73114c.entry.js → p-3274ab81.entry.js} +1 -1
  106. package/dist/post-components/{p-f4aac83e.entry.js → p-658b1ccc.entry.js} +1 -1
  107. package/dist/post-components/{p-ac1f1ebb.entry.js → p-77e43032.entry.js} +1 -1
  108. package/dist/post-components/{p-3f9554e1.entry.js → p-8f0fc02a.entry.js} +1 -1
  109. package/dist/post-components/{p-6de34182.entry.js → p-96750e25.entry.js} +1 -1
  110. package/dist/post-components/p-BXRsHuTS.js +1 -0
  111. package/dist/post-components/p-b5b5e4b9.entry.js +1 -0
  112. package/dist/post-components/p-b8059ba1.entry.js +1 -0
  113. package/dist/post-components/{p-4d84bb4a.entry.js → p-bf41fe56.entry.js} +1 -1
  114. package/dist/post-components/{p-be376a2b.entry.js → p-d6134e24.entry.js} +1 -1
  115. package/dist/post-components/p-e7029b9e.entry.js +1 -0
  116. package/dist/post-components/{p-d288a9b1.entry.js → p-e90688ab.entry.js} +1 -1
  117. package/dist/post-components/{p-efdaa2ad.entry.js → p-ea5da614.entry.js} +1 -1
  118. package/dist/post-components/{p-5a9885dd.entry.js → p-f1b815b6.entry.js} +1 -1
  119. package/dist/post-components/post-components.esm.js +1 -1
  120. package/dist/types/components/post-popovercontainer/post-popovercontainer.d.ts +5 -0
  121. package/hydrate/index.js +59 -21
  122. package/hydrate/index.mjs +59 -21
  123. package/package.json +4 -4
  124. package/dist/components/react/p-DeqIcjvO.js +0 -3
  125. package/dist/esm/package-DeqIcjvO.js +0 -3
  126. package/dist/post-components/p-5450bd15.entry.js +0 -1
  127. package/dist/post-components/p-5b53b042.entry.js +0 -1
  128. package/dist/post-components/p-87d9de40.entry.js +0 -1
  129. 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.disconnect();
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: '341ea7fd69a095bc0f18b0f73c3ac5247784dd33', version: version }, h("div", { key: '078435c707ec6b2e0d51f8adad5502729513af63', class: `megadropdown-container ${this.animationClass || ''}`, style: containerStyle, onAnimationEnd: () => this.handleAnimationEnd() }, h("div", { key: 'ad92234d06bccbc60a2e1a6cc63634535646c4f7', class: "megadropdown" }, h("slot", { key: 'f9779e130c7709912c12d30b554ff8f478840628', name: "megadropdown-title" }), h("slot", { key: 'e079e0381a0ce7e3ab7efd974cdf36e6938a378d', name: "megadropdown-overview-link" }), h("div", { key: '508d4e9bddb727e960aa6f2dc15515f1718aa2b9', class: "megadropdown-content" }, h("slot", { key: '442bb0b169824ed66ae5e7da9acd6bb7d759b6f5' })), h("div", { key: 'cc278c0b5680019270206fbde4ce7a83341a029a', onClick: () => this.hide(true), class: "back-button" }, h("slot", { key: '9c42fa29e89f60af62ab5d04d01e1764b36ebec4', name: "back-button" })), h("div", { key: '62bcc5bcc348cb45289ded98273804ab547471ef', onClick: () => this.hide(true), class: "close-button" }, h("slot", { key: '2cdf1d72f62a162bfb1596507063315430953096', name: "close-button" }))))));
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
- const menuItems = this.getSlottedItems();
74
- if (menuItems.length > 0) {
75
- menuItems[0].focus();
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: '092a180331d50cfe701ad440569e0e6bd4bcd0c8', "data-version": version }, h("post-popovercontainer", { key: '96f33df1a47d2fb1f6f862a7d7f97def5fd8b642', onPostShow: this.handlePostShown, onPostToggle: this.handlePostToggled, placement: this.placement, ref: e => (this.popoverRef = e) }, h("div", { key: '5d23d1059dd1cf68ac817acc8227129267a3c5a4', part: "menu" }, h("slot", { key: '020fbf8912393d85cd5a6fd9f65fdf264f2ba6f6', name: "header" }), h("slot", { key: '07cd9cb978ec85dd7fbbaed527520b97484e2030' })))));
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
- const animation = popIn(content);
91
- if (animation?.playState === 'running') {
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: 'cdb25a25fbd5e411e380175a8d3789cec83e2755', "data-version": version, popover: this.manualClose ? 'manual' : 'auto' }, h("div", { key: 'e99bcc4d5123b335b4b8be7044a80b2913ab6fce', class: "popover-content" }, this.arrow && (h("span", { key: '3c228829cc7e5bd83d7f1759ef163407ebcd10c5', class: "arrow", ref: el => {
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: '6a213deed5ccfec47d4dee903c7544d30a3f5748' }))));
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>"
@@ -1,3 +1,3 @@
1
- const version = "10.0.0-next.53";
1
+ const version = "10.0.0-next.54";
2
2
 
3
3
  export { version as v };