@swisspost/design-system-components 9.0.0-next.10 → 9.0.0-next.12

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 (174) hide show
  1. package/dist/cjs/index.cjs.js +19 -19
  2. package/dist/cjs/{package-aaec3cba.js → package-0bd6fb0d.js} +1 -1
  3. package/dist/cjs/{post-accordion-85bf5e0a.js → post-accordion-7aadd881.js} +1 -1
  4. package/dist/cjs/{post-accordion-item-957b3464.js → post-accordion-item-bd033c7f.js} +4 -4
  5. package/dist/cjs/post-accordion-item.cjs.entry.js +2 -2
  6. package/dist/cjs/post-accordion.cjs.entry.js +2 -2
  7. package/dist/cjs/{post-avatar-58540591.js → post-avatar-5dbdf70d.js} +1 -1
  8. package/dist/cjs/post-avatar.cjs.entry.js +2 -2
  9. package/dist/cjs/{post-back-to-top-db5c7d01.js → post-back-to-top-71bc912c.js} +1 -1
  10. package/dist/cjs/post-back-to-top.cjs.entry.js +2 -2
  11. package/dist/cjs/post-banner-d4e0c73c.js +91 -0
  12. package/dist/cjs/post-banner.cjs.entry.js +2 -2
  13. package/dist/cjs/{post-breadcrumb-cacca682.js → post-breadcrumb-531c4f79.js} +1 -1
  14. package/dist/cjs/post-breadcrumb-item_2.cjs.entry.js +2 -2
  15. package/dist/cjs/post-breadcrumb.cjs.entry.js +2 -2
  16. package/dist/cjs/post-card-control-332f6f1f.js +272 -0
  17. package/dist/cjs/post-card-control.cjs.entry.js +2 -2
  18. package/dist/cjs/post-closebutton_15.cjs.entry.js +2 -2
  19. package/dist/cjs/{post-collapsible-trigger-067d1f4c.js → post-collapsible-trigger-02924200.js} +2 -2
  20. package/dist/cjs/post-collapsible_2.cjs.entry.js +2 -2
  21. package/dist/cjs/{post-footer-beeb36c8.js → post-footer-96d7bd47.js} +1 -1
  22. package/dist/cjs/post-footer.cjs.entry.js +2 -2
  23. package/dist/cjs/{post-menu-item-e0e214b9.js → post-menu-item-3f73fb4d.js} +1 -1
  24. package/dist/cjs/{post-popover-7acbdf17.js → post-popover-64195ffd.js} +2 -2
  25. package/dist/cjs/post-popover.cjs.entry.js +2 -2
  26. package/dist/cjs/{post-rating-ac1b9b3c.js → post-rating-bd27ebfc.js} +1 -1
  27. package/dist/cjs/post-rating.cjs.entry.js +2 -2
  28. package/dist/cjs/{post-tab-header-a3d28719.js → post-tab-header-1f057694.js} +1 -1
  29. package/dist/cjs/post-tab-header.cjs.entry.js +2 -2
  30. package/dist/cjs/{post-tab-panel-4562e265.js → post-tab-panel-3eedcd19.js} +1 -1
  31. package/dist/cjs/post-tab-panel.cjs.entry.js +2 -2
  32. package/dist/cjs/{post-tabs-80f65e1d.js → post-tabs-ea94b243.js} +1 -1
  33. package/dist/cjs/post-tabs.cjs.entry.js +2 -2
  34. package/dist/cjs/{post-tag-5741a78d.js → post-tag-1d75024b.js} +1 -1
  35. package/dist/cjs/post-tag.cjs.entry.js +2 -2
  36. package/dist/cjs/{post-togglebutton-245e33f1.js → post-togglebutton-876f7892.js} +89 -25
  37. package/dist/cjs/{post-tooltip-cefce5e1.js → post-tooltip-e4ef3c7e.js} +1 -1
  38. package/dist/cjs/post-tooltip.cjs.entry.js +2 -2
  39. package/dist/collection/components/post-accordion-item/post-accordion-item.js +3 -3
  40. package/dist/collection/components/post-banner/post-banner.css +1 -1
  41. package/dist/collection/components/post-card-control/post-card-control.css +1 -1
  42. package/dist/collection/components/post-collapsible/post-collapsible.css +1 -1
  43. package/dist/collection/components/post-logo/post-logo.css +1 -1
  44. package/dist/collection/components/post-logo/post-logo.js +1 -1
  45. package/dist/collection/components/post-mainnavigation/post-mainnavigation.css +1 -1
  46. package/dist/collection/components/post-menu/post-menu.js +1 -1
  47. package/dist/collection/components/post-popover/post-popover.css +1 -1
  48. package/dist/collection/components/post-popover/post-popover.js +1 -1
  49. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +1 -1
  50. package/dist/collection/components/post-tooltip/post-tooltip.js +1 -1
  51. package/dist/components/package.js +1 -1
  52. package/dist/components/post-accordion-item2.js +3 -3
  53. package/dist/components/post-banner2.js +1 -1
  54. package/dist/components/post-card-control2.js +1 -1
  55. package/dist/components/post-collapsible2.js +1 -1
  56. package/dist/components/post-logo2.js +2 -2
  57. package/dist/components/post-mainnavigation2.js +1 -1
  58. package/dist/components/post-popover2.js +1 -1
  59. package/dist/components/post-popovercontainer2.js +85 -21
  60. package/dist/docs.json +7 -7
  61. package/dist/esm/index.js +19 -19
  62. package/dist/esm/package-f8f7bb40.js +3 -0
  63. package/dist/esm/{post-accordion-3bf30525.js → post-accordion-ca48eb18.js} +1 -1
  64. package/dist/esm/{post-accordion-item-6683fbed.js → post-accordion-item-a461f2a7.js} +4 -4
  65. package/dist/esm/post-accordion-item.entry.js +2 -2
  66. package/dist/esm/post-accordion.entry.js +2 -2
  67. package/dist/esm/{post-avatar-3ddb4c79.js → post-avatar-0da1a2e8.js} +1 -1
  68. package/dist/esm/post-avatar.entry.js +2 -2
  69. package/dist/esm/{post-back-to-top-15ee2771.js → post-back-to-top-77471a90.js} +1 -1
  70. package/dist/esm/post-back-to-top.entry.js +2 -2
  71. package/dist/esm/post-banner-b0af5bd3.js +89 -0
  72. package/dist/esm/post-banner.entry.js +2 -2
  73. package/dist/esm/{post-breadcrumb-6252b112.js → post-breadcrumb-85ffd02f.js} +1 -1
  74. package/dist/esm/post-breadcrumb-item_2.entry.js +2 -2
  75. package/dist/esm/post-breadcrumb.entry.js +2 -2
  76. package/dist/esm/post-card-control-3225eb57.js +270 -0
  77. package/dist/esm/post-card-control.entry.js +2 -2
  78. package/dist/esm/post-closebutton_15.entry.js +2 -2
  79. package/dist/esm/{post-collapsible-trigger-b727bf7e.js → post-collapsible-trigger-883db3bf.js} +2 -2
  80. package/dist/esm/post-collapsible_2.entry.js +2 -2
  81. package/dist/esm/{post-footer-7a03a9bb.js → post-footer-7b0eb067.js} +1 -1
  82. package/dist/esm/post-footer.entry.js +2 -2
  83. package/dist/esm/{post-menu-item-3e168ecd.js → post-menu-item-37f637a3.js} +1 -1
  84. package/dist/esm/{post-popover-bff5cffd.js → post-popover-c24ecd38.js} +2 -2
  85. package/dist/esm/post-popover.entry.js +2 -2
  86. package/dist/esm/{post-rating-ce595a65.js → post-rating-e1c66e5c.js} +1 -1
  87. package/dist/esm/post-rating.entry.js +2 -2
  88. package/dist/esm/{post-tab-header-c864586f.js → post-tab-header-6a9b0153.js} +1 -1
  89. package/dist/esm/post-tab-header.entry.js +2 -2
  90. package/dist/esm/{post-tab-panel-800425b8.js → post-tab-panel-73b56a16.js} +1 -1
  91. package/dist/esm/post-tab-panel.entry.js +2 -2
  92. package/dist/esm/{post-tabs-e5aa8b08.js → post-tabs-02e523b8.js} +1 -1
  93. package/dist/esm/post-tabs.entry.js +2 -2
  94. package/dist/esm/{post-tag-fc3df50a.js → post-tag-43aba068.js} +1 -1
  95. package/dist/esm/post-tag.entry.js +2 -2
  96. package/dist/esm/{post-togglebutton-101dd3bd.js → post-togglebutton-c2231709.js} +89 -25
  97. package/dist/esm/{post-tooltip-e8484aea.js → post-tooltip-8271950c.js} +1 -1
  98. package/dist/esm/post-tooltip.entry.js +2 -2
  99. package/dist/post-components/index.esm.js +1 -1
  100. package/dist/post-components/{p-02bb5231.js → p-025688e5.js} +1 -1
  101. package/dist/post-components/p-08b51b35.entry.js +1 -0
  102. package/dist/post-components/{p-27ad2d1f.js → p-24c92608.js} +1 -1
  103. package/dist/post-components/p-25a57971.js +1 -0
  104. package/dist/post-components/{p-3de1151e.js → p-2cb4a8f1.js} +1 -1
  105. package/dist/post-components/{p-86a1ad40.js → p-33b64e0c.js} +1 -1
  106. package/dist/post-components/{p-fc09ac69.js → p-34d70cd5.js} +1 -1
  107. package/dist/post-components/p-350f3900.entry.js +1 -0
  108. package/dist/post-components/{p-eed26f43.js → p-35bc4554.js} +1 -1
  109. package/dist/post-components/p-38b259a4.entry.js +1 -0
  110. package/dist/post-components/p-3c6cef1e.entry.js +1 -0
  111. package/dist/post-components/{p-a3694196.js → p-4a713cf8.js} +1 -1
  112. package/dist/post-components/p-4b5e2b24.js +1 -0
  113. package/dist/post-components/p-54e58fc2.entry.js +1 -0
  114. package/dist/post-components/p-637759d6.js +1 -0
  115. package/dist/post-components/{p-bec07e51.js → p-7589a19f.js} +1 -1
  116. package/dist/post-components/p-7cce7342.entry.js +1 -0
  117. package/dist/post-components/p-819e19de.js +1 -0
  118. package/dist/post-components/p-82d48128.js +1 -0
  119. package/dist/post-components/{p-f35d5d4a.entry.js → p-85171893.entry.js} +1 -1
  120. package/dist/post-components/p-882fdd0c.entry.js +1 -0
  121. package/dist/post-components/{p-d1d9c9a5.js → p-94399c69.js} +1 -1
  122. package/dist/post-components/p-9a02b162.entry.js +1 -0
  123. package/dist/post-components/{p-9e287cb5.js → p-b1f5bc26.js} +1 -1
  124. package/dist/post-components/p-b2f239a1.entry.js +1 -0
  125. package/dist/post-components/{p-24476696.js → p-b571e5c8.js} +1 -1
  126. package/dist/post-components/{p-1d3acbfd.js → p-ba530822.js} +1 -1
  127. package/dist/post-components/p-bae1c85f.entry.js +1 -0
  128. package/dist/post-components/p-bdabdec5.js +1 -0
  129. package/dist/post-components/p-c1225174.entry.js +1 -0
  130. package/dist/post-components/p-c372a141.entry.js +1 -0
  131. package/dist/post-components/{p-6e6e5447.entry.js → p-c510d968.entry.js} +1 -1
  132. package/dist/post-components/p-c87c5d59.entry.js +1 -0
  133. package/dist/post-components/p-d04c1b7f.entry.js +1 -0
  134. package/dist/post-components/p-da300843.entry.js +1 -0
  135. package/dist/post-components/{p-faf15ec1.js → p-e2f886ab.js} +1 -1
  136. package/dist/post-components/p-fec04a15.entry.js +1 -0
  137. package/dist/post-components/post-components.esm.js +1 -1
  138. package/loaders/package.js +1 -1
  139. package/loaders/post-accordion-item2.js +3 -3
  140. package/loaders/post-banner.js +1 -1
  141. package/loaders/post-card-control.js +1 -1
  142. package/loaders/post-collapsible2.js +1 -1
  143. package/loaders/post-logo.js +2 -2
  144. package/loaders/post-mainnavigation.js +1 -1
  145. package/loaders/post-popover.js +1 -1
  146. package/loaders/post-popovercontainer2.js +85 -21
  147. package/package.json +10 -10
  148. package/dist/cjs/post-banner-727866d5.js +0 -91
  149. package/dist/cjs/post-card-control-f5d72ddc.js +0 -272
  150. package/dist/esm/package-2ee42825.js +0 -3
  151. package/dist/esm/post-banner-fc407f6e.js +0 -89
  152. package/dist/esm/post-card-control-cb3dfc60.js +0 -270
  153. package/dist/post-components/p-11880d55.js +0 -1
  154. package/dist/post-components/p-1489d777.entry.js +0 -1
  155. package/dist/post-components/p-19707347.entry.js +0 -1
  156. package/dist/post-components/p-25f6efab.entry.js +0 -1
  157. package/dist/post-components/p-29626238.entry.js +0 -1
  158. package/dist/post-components/p-339488ba.entry.js +0 -1
  159. package/dist/post-components/p-413d1fff.js +0 -1
  160. package/dist/post-components/p-47095b84.entry.js +0 -1
  161. package/dist/post-components/p-5b0703a4.entry.js +0 -1
  162. package/dist/post-components/p-618b8929.js +0 -1
  163. package/dist/post-components/p-66c8d0a2.entry.js +0 -1
  164. package/dist/post-components/p-80b282a2.js +0 -1
  165. package/dist/post-components/p-97647d03.entry.js +0 -1
  166. package/dist/post-components/p-98f1d284.js +0 -1
  167. package/dist/post-components/p-adc79d26.entry.js +0 -1
  168. package/dist/post-components/p-bcf94111.entry.js +0 -1
  169. package/dist/post-components/p-bd87a2b5.entry.js +0 -1
  170. package/dist/post-components/p-bec09df9.entry.js +0 -1
  171. package/dist/post-components/p-db2ac0a2.entry.js +0 -1
  172. package/dist/post-components/p-e93a4bd0.entry.js +0 -1
  173. package/dist/post-components/p-fa6c79b8.entry.js +0 -1
  174. package/dist/post-components/p-ffcd735f.js +0 -1
@@ -1156,6 +1156,9 @@ const size$1 = function (options) {
1156
1156
  };
1157
1157
  };
1158
1158
 
1159
+ function hasWindow() {
1160
+ return typeof window !== 'undefined';
1161
+ }
1159
1162
  function getNodeName(node) {
1160
1163
  if (isNode(node)) {
1161
1164
  return (node.nodeName || '').toLowerCase();
@@ -1174,17 +1177,25 @@ function getDocumentElement(node) {
1174
1177
  return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1175
1178
  }
1176
1179
  function isNode(value) {
1180
+ if (!hasWindow()) {
1181
+ return false;
1182
+ }
1177
1183
  return value instanceof Node || value instanceof getWindow(value).Node;
1178
1184
  }
1179
1185
  function isElement(value) {
1186
+ if (!hasWindow()) {
1187
+ return false;
1188
+ }
1180
1189
  return value instanceof Element || value instanceof getWindow(value).Element;
1181
1190
  }
1182
1191
  function isHTMLElement(value) {
1192
+ if (!hasWindow()) {
1193
+ return false;
1194
+ }
1183
1195
  return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1184
1196
  }
1185
1197
  function isShadowRoot(value) {
1186
- // Browsers without `ShadowRoot` support.
1187
- if (typeof ShadowRoot === 'undefined') {
1198
+ if (!hasWindow() || typeof ShadowRoot === 'undefined') {
1188
1199
  return false;
1189
1200
  }
1190
1201
  return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
@@ -1215,7 +1226,8 @@ function isContainingBlock(elementOrCss) {
1215
1226
  const css = isElement(elementOrCss) ? getComputedStyle(elementOrCss) : elementOrCss;
1216
1227
 
1217
1228
  // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1218
- return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1229
+ // https://drafts.csswg.org/css-transforms-2/#individual-transforms
1230
+ return ['transform', 'translate', 'scale', 'rotate', 'perspective'].some(value => css[value] ? css[value] !== 'none' : false) || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'translate', 'scale', 'rotate', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1219
1231
  }
1220
1232
  function getContainingBlock(element) {
1221
1233
  let currentNode = getParentNode(element);
@@ -1288,10 +1300,14 @@ function getOverflowAncestors(node, list, traverseIframes) {
1288
1300
  const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1289
1301
  const win = getWindow(scrollableAncestor);
1290
1302
  if (isBody) {
1291
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []);
1303
+ const frameElement = getFrameElement(win);
1304
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1292
1305
  }
1293
1306
  return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1294
1307
  }
1308
+ function getFrameElement(win) {
1309
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1310
+ }
1295
1311
 
1296
1312
  function getCssDimensions(element) {
1297
1313
  const css = getComputedStyle(element);
@@ -1395,7 +1411,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1395
1411
  const win = getWindow(domElement);
1396
1412
  const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1397
1413
  let currentWin = win;
1398
- let currentIFrame = currentWin.frameElement;
1414
+ let currentIFrame = getFrameElement(currentWin);
1399
1415
  while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1400
1416
  const iframeScale = getScale(currentIFrame);
1401
1417
  const iframeRect = currentIFrame.getBoundingClientRect();
@@ -1409,7 +1425,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1409
1425
  x += left;
1410
1426
  y += top;
1411
1427
  currentWin = getWindow(currentIFrame);
1412
- currentIFrame = currentWin.frameElement;
1428
+ currentIFrame = getFrameElement(currentWin);
1413
1429
  }
1414
1430
  }
1415
1431
  return rectToClientRect({
@@ -1420,6 +1436,31 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetPar
1420
1436
  });
1421
1437
  }
1422
1438
 
1439
+ // If <html> has a CSS width greater than the viewport, then this will be
1440
+ // incorrect for RTL.
1441
+ function getWindowScrollBarX(element, rect) {
1442
+ const leftScroll = getNodeScroll(element).scrollLeft;
1443
+ if (!rect) {
1444
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1445
+ }
1446
+ return rect.left + leftScroll;
1447
+ }
1448
+
1449
+ function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
1450
+ if (ignoreScrollbarX === void 0) {
1451
+ ignoreScrollbarX = false;
1452
+ }
1453
+ const htmlRect = documentElement.getBoundingClientRect();
1454
+ const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 :
1455
+ // RTL <body> scrollbar.
1456
+ getWindowScrollBarX(documentElement, htmlRect));
1457
+ const y = htmlRect.top + scroll.scrollTop;
1458
+ return {
1459
+ x,
1460
+ y
1461
+ };
1462
+ }
1463
+
1423
1464
  function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1424
1465
  let {
1425
1466
  elements,
@@ -1451,11 +1492,12 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1451
1492
  offsets.y = offsetRect.y + offsetParent.clientTop;
1452
1493
  }
1453
1494
  }
1495
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
1454
1496
  return {
1455
1497
  width: rect.width * scale.x,
1456
1498
  height: rect.height * scale.y,
1457
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
1458
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
1499
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1500
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1459
1501
  };
1460
1502
  }
1461
1503
 
@@ -1463,12 +1505,6 @@ function getClientRects(element) {
1463
1505
  return Array.from(element.getClientRects());
1464
1506
  }
1465
1507
 
1466
- function getWindowScrollBarX(element) {
1467
- // If <html> has a CSS width greater than the viewport, then this will be
1468
- // incorrect for RTL.
1469
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
1470
- }
1471
-
1472
1508
  // Gets the entire size of the scrollable document area, even extending outside
1473
1509
  // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
1474
1510
  function getDocumentRect(element) {
@@ -1543,9 +1579,10 @@ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy)
1543
1579
  } else {
1544
1580
  const visualOffsets = getVisualOffsets(element);
1545
1581
  rect = {
1546
- ...clippingAncestor,
1547
1582
  x: clippingAncestor.x - visualOffsets.x,
1548
- y: clippingAncestor.y - visualOffsets.y
1583
+ y: clippingAncestor.y - visualOffsets.y,
1584
+ width: clippingAncestor.width,
1585
+ height: clippingAncestor.height
1549
1586
  };
1550
1587
  }
1551
1588
  return rectToClientRect(rect);
@@ -1650,11 +1687,14 @@ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1650
1687
  offsets.x = offsetRect.x + offsetParent.clientLeft;
1651
1688
  offsets.y = offsetRect.y + offsetParent.clientTop;
1652
1689
  } else if (documentElement) {
1690
+ // If the <body> scrollbar appears on the left (e.g. RTL systems). Use
1691
+ // Firefox with layout.scrollbar.side = 3 in about:config to test this.
1653
1692
  offsets.x = getWindowScrollBarX(documentElement);
1654
1693
  }
1655
1694
  }
1656
- const x = rect.left + scroll.scrollLeft - offsets.x;
1657
- const y = rect.top + scroll.scrollTop - offsets.y;
1695
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1696
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1697
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1658
1698
  return {
1659
1699
  x,
1660
1700
  y,
@@ -1674,7 +1714,16 @@ function getTrueOffsetParent(element, polyfill) {
1674
1714
  if (polyfill) {
1675
1715
  return polyfill(element);
1676
1716
  }
1677
- return element.offsetParent;
1717
+ let rawOffsetParent = element.offsetParent;
1718
+
1719
+ // Firefox returns the <html> element as the offsetParent if it's non-static,
1720
+ // while Chrome and Safari return the <body> element. The <body> element must
1721
+ // be used to perform the correct calculations even if the <html> element is
1722
+ // non-static.
1723
+ if (getDocumentElement(element) === rawOffsetParent) {
1724
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1725
+ }
1726
+ return rawOffsetParent;
1678
1727
  }
1679
1728
 
1680
1729
  // Gets the closest ancestor positioned element. Handles some edge cases,
@@ -1736,6 +1785,10 @@ const platform = {
1736
1785
  isRTL
1737
1786
  };
1738
1787
 
1788
+ function rectsAreEqual(a, b) {
1789
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1790
+ }
1791
+
1739
1792
  // https://samthor.au/2021/observing-dom/
1740
1793
  function observeMove(element, onMove) {
1741
1794
  let io = null;
@@ -1755,12 +1808,13 @@ function observeMove(element, onMove) {
1755
1808
  threshold = 1;
1756
1809
  }
1757
1810
  cleanup();
1811
+ const elementRectForRootMargin = element.getBoundingClientRect();
1758
1812
  const {
1759
1813
  left,
1760
1814
  top,
1761
1815
  width,
1762
1816
  height
1763
- } = element.getBoundingClientRect();
1817
+ } = elementRectForRootMargin;
1764
1818
  if (!skip) {
1765
1819
  onMove();
1766
1820
  }
@@ -1793,6 +1847,16 @@ function observeMove(element, onMove) {
1793
1847
  refresh(false, ratio);
1794
1848
  }
1795
1849
  }
1850
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1851
+ // It's possible that even though the ratio is reported as 1, the
1852
+ // element is not actually fully within the IntersectionObserver's root
1853
+ // area anymore. This can happen under performance constraints. This may
1854
+ // be a bug in the browser's IntersectionObserver implementation. To
1855
+ // work around this, we compare the element's bounding rect now with
1856
+ // what it was at the time we created the IntersectionObserver. If they
1857
+ // are not equal then the element moved, so we refresh.
1858
+ refresh();
1859
+ }
1796
1860
  isFirstUpdate = false;
1797
1861
  }
1798
1862
 
@@ -1870,7 +1934,7 @@ function autoUpdate(reference, floating, update, options) {
1870
1934
  }
1871
1935
  function frameLoop() {
1872
1936
  const nextRefRect = getBoundingClientRect(reference);
1873
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
1937
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
1874
1938
  update();
1875
1939
  }
1876
1940
  prevRefRect = nextRefRect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swisspost/design-system-components",
3
- "version": "9.0.0-next.10",
3
+ "version": "9.0.0-next.12",
4
4
  "description": "A collection of web components built with Stencil JS for the Swiss Post Design System.",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.cjs.js",
@@ -24,37 +24,37 @@
24
24
  "linkDirectory": true
25
25
  },
26
26
  "dependencies": {
27
- "@floating-ui/dom": "1.6.8",
27
+ "@floating-ui/dom": "1.6.13",
28
28
  "@oddbird/popover-polyfill": "0.3.7",
29
- "@swisspost/design-system-icons": "9.0.0-next.10",
30
- "@swisspost/design-system-styles": "9.0.0-next.10",
29
+ "@swisspost/design-system-icons": "9.0.0-next.12",
30
+ "@swisspost/design-system-styles": "9.0.0-next.12",
31
31
  "ally.js": "1.4.1",
32
32
  "long-press-event": "2.5.0",
33
33
  "nanoid": "5.0.9"
34
34
  },
35
35
  "devDependencies": {
36
- "@percy/cli": "1.29.1",
36
+ "@percy/cli": "1.30.6",
37
37
  "@percy/cypress": "3.1.2",
38
38
  "@stencil-community/eslint-plugin": "0.8.0",
39
39
  "@stencil/angular-output-target": "0.8.4",
40
40
  "@stencil/core": "4.19.2",
41
41
  "@stencil/react-output-target": "0.5.3",
42
42
  "@stencil/sass": "3.0.12",
43
- "@types/jest": "29.5.12",
44
- "@types/node": "20.14.14",
43
+ "@types/jest": "29.5.14",
44
+ "@types/node": "22.10.5",
45
45
  "@typescript-eslint/eslint-plugin": "7.18.0",
46
46
  "@typescript-eslint/parser": "7.18.0",
47
47
  "bootstrap": "5.3.3",
48
48
  "cypress": "13.13.2",
49
49
  "cypress-axe": "1.5.0",
50
50
  "cypress-storybook": "1.0.0",
51
- "eslint": "8.57.0",
52
- "eslint-plugin-react": "7.35.0",
51
+ "eslint": "8.57.1",
52
+ "eslint-plugin-react": "7.37.3",
53
53
  "rimraf": "6.0.1",
54
54
  "rollup-plugin-postcss": "4.0.2",
55
55
  "sass": "1.78.0",
56
56
  "throttle-debounce": "5.0.2",
57
- "ts-jest": "29.2.4",
57
+ "ts-jest": "29.2.5",
58
58
  "typescript": "5.5.4"
59
59
  },
60
60
  "keywords": [
@@ -1,91 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-f1b08cdb.js');
4
- const _package = require('./package-aaec3cba.js');
5
- const fade = require('./fade-35a3633a.js');
6
- const index$1 = require('./index-5d4e0aed.js');
7
- const index_browser = require('./index.browser-2f65f583.js');
8
- const checkType = require('./check-type-64af82a9.js');
9
- const checkNonEmpty = require('./check-non-empty-eeaa8f77.js');
10
-
11
- const BANNER_TYPES = ['neutral', 'success', 'warning', 'danger', 'info'];
12
-
13
- const postBannerCss = ".banner,.alert{min-height:calc(var(--post-device-sizing-notification-icon-2) + (2 * var(--post-device-spacing-padding-10)));box-sizing:border-box;box-shadow:var(--post-device-elevation-100);border-radius:var(--post-device-border-radius-2);padding:var(--post-device-spacing-padding-10) var(--post-device-spacing-padding-10);padding-inline-start:calc(var(--post-device-spacing-padding-10) + var(--post-device-sizing-notification-icon-2) + var(--post-device-spacing-gap-inline-6));font-weight:400;border-style:var(--post-core-border-style-solid);border-width:var(--post-device-border-width-default);position:relative;color:var(--post-scheme-color-surface-default-fg);background-color:var(--post-scheme-color-signal-neutral);border-color:var(--post-scheme-color-signal-neutral-dark);color-scheme:var(--post-core-bg-scheme-light)}.banner:not(.no-icon)::before,.alert:not(.no-icon)::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.24 5.24 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.24 5.24 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27M16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.3 6.3 0 0 0-.325 1.997 6.6 6.6 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667M11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 1 1 1.334 1.334 1.336 1.336 0 0 1-1.334-1.334m13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333m-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335m7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0m-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M28.93 18.548a13.2 13.2 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266m-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.7 11.7 0 0 0 2.359-.888.67.67 0 0 1 .896.294M4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.8 11.8 0 0 0 4 15.92'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.24 5.24 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.24 5.24 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27M16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.3 6.3 0 0 0-.325 1.997 6.6 6.6 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667M11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 1 1 1.334 1.334 1.336 1.336 0 0 1-1.334-1.334m13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333m-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335m7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0m-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M28.93 18.548a13.2 13.2 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266m-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.7 11.7 0 0 0 2.359-.888.67.67 0 0 1 .896.294M4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.8 11.8 0 0 0 4 15.92'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;color:var(--post-scheme-color-signal-neutral-dark)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner:not(.no-icon)::before,.alert:not(.no-icon)::before{color:CanvasText}}.banner:has(>post-icon)::before,.alert:has(>post-icon)::before{content:none}.banner>post-icon,.alert>post-icon{background-color:var(--post-scheme-color-signal-neutral);color:var(--post-scheme-color-signal-neutral-dark)}.banner::before,.alert::before{content:\"\";display:block}.banner::before,.banner>post-icon,.alert::before,.alert>post-icon{position:absolute;height:var(--post-device-sizing-notification-icon-2);width:var(--post-device-sizing-notification-icon-2);left:var(--post-device-spacing-padding-10);top:var(--post-device-spacing-padding-10)}.banner.no-icon,.alert.no-icon{min-height:calc(2*var(--post-device-spacing-padding-10) + var(--post-core-dimension-24));padding-inline-start:var(--post-device-spacing-padding-10)}.banner.no-icon::before,.alert.no-icon::before{content:unset}.banner.no-icon>post-icon,.alert.no-icon>post-icon{display:none}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner,.alert{filter:none !important;border:2px solid CanvasText}}.banner:not(.banner-action):not(.alert-action),.alert:not(.banner-action):not(.alert-action){display:flex;flex-direction:column;justify-content:center;gap:var(--post-core-dimension-4)}.banner:not(.banner-action):not(.alert-action) a,.alert:not(.banner-action):not(.alert-action) a{font-weight:400}.banner:not(.banner-action):not(.alert-action) hr,.alert:not(.banner-action):not(.alert-action) hr{margin-block:var(--post-core-dimension-8) var(--post-core-dimension-12) !important}.banner:not(.banner-action):not(.alert-action)>*,.alert:not(.banner-action):not(.alert-action)>*{margin:0}.banner-container{border:unset;background-color:rgba(0,0,0,0)}.banner-dismissible,.alert-dismissible{pointer-events:auto;position:relative}.banner-dismissible:not(.banner-action):not(.alert-action),.alert-dismissible:not(.banner-action):not(.alert-action){padding-inline-end:calc(var(--post-device-spacing-padding-10) + var(--post-device-spacing-gap-inline-6) + var(--post-core-dimension-24))}.banner-dismissible>.btn-close,.alert-dismissible>.btn-close{position:absolute;inset-block-start:1rem;inset-inline-end:var(--post-device-spacing-padding-10)}.banner-buttons,.alert-buttons{display:flex;align-items:center;justify-content:flex-start;flex-direction:row-reverse;margin-block-start:var(--post-device-spacing-padding-block-10);gap:var(--post-device-spacing-gap-1)}@media (max-width: 779.98px){.banner-buttons,.alert-buttons{flex-direction:column}}.banner-action>.banner-content,.banner-action>.alert-content,.alert-action>.banner-content,.alert-action>.alert-content{display:flex;flex-direction:column;justify-content:center;gap:var(--post-core-dimension-4)}.banner-action>.banner-content a,.banner-action>.alert-content a,.alert-action>.banner-content a,.alert-action>.alert-content a{font-weight:400}.banner-action>.banner-content hr,.banner-action>.alert-content hr,.alert-action>.banner-content hr,.alert-action>.alert-content hr{margin-block:var(--post-core-dimension-8) var(--post-core-dimension-12) !important}.banner-action>.banner-content>*,.banner-action>.alert-content>*,.alert-action>.banner-content>*,.alert-action>.alert-content>*{margin:0}@media (max-width: 779.98px){.banner-action,.alert-action{flex-direction:column;align-items:stretch}.banner-action>.banner-content,.banner-action>.alert-content,.alert-action>.banner-content,.alert-action>.alert-content{padding-inline-start:var(--post-device-spacing-gap-inline-6)var(--post-device-sizing-notification-icon-2);padding-inline-end:var(--post-device-spacing-gap-inline-6)var(--post-core-dimension-24)}.banner-action.no-icon>.banner-content,.banner-action.no-icon>.alert-content,.alert-action.no-icon>.banner-content,.alert-action.no-icon>.alert-content{padding-inline-start:0}.banner-action>.banner-buttons,.banner-action>.alert-buttons,.alert-action>.banner-buttons,.alert-action>.alert-buttons{display:flex}.banner-action>.banner-buttons>.btn,.banner-action>.banner-buttons>::slotted(.btn),.banner-action>.alert-buttons>.btn,.banner-action>.alert-buttons>::slotted(.btn),.alert-action>.banner-buttons>.btn,.alert-action>.banner-buttons>::slotted(.btn),.alert-action>.alert-buttons>.btn,.alert-action>.alert-buttons>::slotted(.btn){flex:1 0 0;width:100%}.banner-action>.banner-buttons>.btn:first-child,.banner-action>.banner-buttons>::slotted(.btn:first-child),.banner-action>.alert-buttons>.btn:first-child,.banner-action>.alert-buttons>::slotted(.btn:first-child),.alert-action>.banner-buttons>.btn:first-child,.alert-action>.banner-buttons>::slotted(.btn:first-child),.alert-action>.alert-buttons>.btn:first-child,.alert-action>.alert-buttons>::slotted(.btn:first-child){margin-inline-start:0}}.banner-neutral,.alert-neutral{background-color:var(--post-scheme-color-signal-neutral);border-color:var(--post-scheme-color-signal-neutral-dark);color-scheme:var(--post-core-bg-scheme-light)}.banner-neutral:not(.no-icon)::before,.alert-neutral:not(.no-icon)::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.24 5.24 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.24 5.24 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27M16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.3 6.3 0 0 0-.325 1.997 6.6 6.6 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667M11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 1 1 1.334 1.334 1.336 1.336 0 0 1-1.334-1.334m13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333m-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335m7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0m-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M28.93 18.548a13.2 13.2 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266m-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.7 11.7 0 0 0 2.359-.888.67.67 0 0 1 .896.294M4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.8 11.8 0 0 0 4 15.92'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.24 5.24 0 0 1-4.43-2.448c-.73.382-1.547.62-2.427.62a5.257 5.257 0 0 1-5.257-5.258c0-.88.237-1.698.62-2.427a5.24 5.24 0 0 1-2.449-4.43c0-.714.145-1.393.403-2.014C16.574.028 16.29 0 16 0 7.163 0 0 7.163 0 16s7.163 16 16 16 16-7.163 16-16c0-.091-.012-.18-.014-.27M16 30.667c-8.087 0-14.667-6.58-14.667-14.667 0-7.806 6.13-14.207 13.828-14.643a6.54 6.54 0 0 0 2.116 5.56 6.3 6.3 0 0 0-.325 1.997 6.6 6.6 0 0 0 6.59 6.59c.677 0 1.346-.108 1.998-.324a6.54 6.54 0 0 0 5.067 2.15C29.933 24.796 23.639 30.667 16 30.667M11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 1 1 1.334 1.334 1.336 1.336 0 0 1-1.334-1.334m13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0m-4 0a1.335 1.335 0 0 1 2.667 0c0 .735-.598 1.333-1.333 1.333a1.335 1.335 0 0 1-1.334-1.333m-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335m7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0m-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4m0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334M28.93 18.548a13.2 13.2 0 0 1-4.335 7.357.663.663 0 0 1-.94-.073.666.666 0 0 1 .073-.94 11.84 11.84 0 0 0 3.894-6.61.668.668 0 0 1 1.307.266m-6.668 8.212a.667.667 0 0 1-.295.896c-.837.423-1.722.757-2.63.99a.665.665 0 1 1-.33-1.292 11.7 11.7 0 0 0 2.359-.888.67.67 0 0 1 .896.294M4 15.921a.666.666 0 1 1-1.333 0 13.13 13.13 0 0 1 4.597-9.984.666.666 0 1 1 .867 1.013A11.8 11.8 0 0 0 4 15.92'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;color:var(--post-scheme-color-signal-neutral-dark)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner-neutral:not(.no-icon)::before,.alert-neutral:not(.no-icon)::before{color:CanvasText}}.banner-neutral:has(>post-icon)::before,.alert-neutral:has(>post-icon)::before{content:none}.banner-neutral>post-icon,.alert-neutral>post-icon{background-color:var(--post-scheme-color-signal-neutral);color:var(--post-scheme-color-signal-neutral-dark)}.banner-success,.alert-success{background-color:var(--post-scheme-color-interactive-notification-success-bg);border-color:var(--post-scheme-color-interactive-notification-success-stroke);color-scheme:var(--post-core-bg-scheme-light)}.banner-success:not(.no-icon)::before,.alert-success:not(.no-icon)::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12.667 24.533-7.6-7.6 1.867-1.867 5.733 5.733 12.4-12.4 1.867 1.867z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m12.667 24.533-7.6-7.6 1.867-1.867 5.733 5.733 12.4-12.4 1.867 1.867z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;color:var(--post-scheme-color-interactive-notification-success-icon)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner-success:not(.no-icon)::before,.alert-success:not(.no-icon)::before{color:CanvasText}}.banner-success:has(>post-icon)::before,.alert-success:has(>post-icon)::before{content:none}.banner-success>post-icon,.alert-success>post-icon{background-color:var(--post-scheme-color-interactive-notification-success-bg);color:var(--post-scheme-color-interactive-notification-success-icon)}.banner-warning,.alert-warning{background-color:var(--post-scheme-color-interactive-notification-warning-bg);border-color:var(--post-scheme-color-interactive-notification-warning-stroke);color-scheme:var(--post-core-bg-scheme-light)}.banner-warning:not(.no-icon)::before,.alert-warning:not(.no-icon)::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.67 4h2.67v18.67h-2.67zm0 21.33h2.67V28h-2.67z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.67 4h2.67v18.67h-2.67zm0 21.33h2.67V28h-2.67z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;color:var(--post-scheme-color-interactive-notification-warning-icon)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner-warning:not(.no-icon)::before,.alert-warning:not(.no-icon)::before{color:CanvasText}}.banner-warning:has(>post-icon)::before,.alert-warning:has(>post-icon)::before{content:none}.banner-warning>post-icon,.alert-warning>post-icon{background-color:var(--post-scheme-color-interactive-notification-warning-bg);color:var(--post-scheme-color-interactive-notification-warning-icon)}.banner-error,.alert-error{background-color:var(--post-scheme-color-interactive-notification-error-bg);border-color:var(--post-scheme-color-interactive-notification-error-stroke);color-scheme:var(--post-core-bg-scheme-light)}.banner-error:not(.no-icon)::before,.alert-error:not(.no-icon)::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.67 4h2.67v18.67h-2.67zm0 21.33h2.67V28h-2.67z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.67 4h2.67v18.67h-2.67zm0 21.33h2.67V28h-2.67z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;color:var(--post-scheme-color-interactive-notification-error-icon)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner-error:not(.no-icon)::before,.alert-error:not(.no-icon)::before{color:CanvasText}}.banner-error:has(>post-icon)::before,.alert-error:has(>post-icon)::before{content:none}.banner-error>post-icon,.alert-error>post-icon{background-color:var(--post-scheme-color-interactive-notification-error-bg);color:var(--post-scheme-color-interactive-notification-error-icon)}.banner-info,.alert-info{background-color:var(--post-scheme-color-interactive-notification-info-bg);border-color:var(--post-scheme-color-interactive-notification-info-stroke);color-scheme:var(--post-core-bg-scheme-light)}.banner-info:not(.no-icon)::before,.alert-info:not(.no-icon)::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.33 25.33v-16h-4.67V12h2v13.33h-2V28h6.67v-2.67zM14.67 4h2.67v2.67h-2.67z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M17.33 25.33v-16h-4.67V12h2v13.33h-2V28h6.67v-2.67zM14.67 4h2.67v2.67h-2.67z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;color:var(--post-scheme-color-interactive-notification-info-icon)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner-info:not(.no-icon)::before,.alert-info:not(.no-icon)::before{color:CanvasText}}.banner-info:has(>post-icon)::before,.alert-info:has(>post-icon)::before{content:none}.banner-info>post-icon,.alert-info>post-icon{background-color:var(--post-scheme-color-interactive-notification-info-bg);color:var(--post-scheme-color-interactive-notification-info-icon)}.banner-danger,.alert-danger{background-color:var(--post-scheme-color-interactive-notification-error-bg);border-color:var(--post-scheme-color-interactive-notification-error-stroke);color-scheme:var(--post-core-bg-scheme-light)}.banner-danger:not(.no-icon)::before,.alert-danger:not(.no-icon)::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.67 4h2.67v18.67h-2.67zm0 21.33h2.67V28h-2.67z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.67 4h2.67v18.67h-2.67zm0 21.33h2.67V28h-2.67z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;color:var(--post-scheme-color-interactive-notification-error-icon)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.banner-danger:not(.no-icon)::before,.alert-danger:not(.no-icon)::before{color:CanvasText}}.banner-danger:has(>post-icon)::before,.alert-danger:has(>post-icon)::before{content:none}.banner-danger>post-icon,.alert-danger>post-icon{background-color:var(--post-scheme-color-interactive-notification-error-bg);color:var(--post-scheme-color-interactive-notification-error-icon)}.btn-close{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;-webkit-user-select:none;user-select:none;appearance:button;border-radius:var(--post-device-border-radius-round);color:#000;transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms;cursor:pointer}.btn-close{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}.btn-close:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;border-radius:4px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-close:is(:focus-visible,:has(:focus-visible),.pretend-focus){outline-color:Highlight !important}}@supports not selector(:has(:focus-visible)){.btn-close:is(:focus-visible,:focus-within,.pretend-focus){outline-style:var(--post-core-border-style-solid) !important;border-radius:4px}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-close:is(:focus-visible,:focus-within,.pretend-focus){outline-color:Highlight !important}}}.btn-close::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m16.267 16.667 6.667-6.533-.933-1.067-6.667 6.667-6.667-6.667-.933 1.067 6.667 6.533-6.667 6.667 1.067.933 6.533-6.667 6.667 6.667.933-1.067z'/%3E%3C/svg%3E\");background-color:currentColor;color:currentColor;forced-color-adjust:preserve-parent-color;content:\"\";display:block;height:var(--post-core-dimension-24);width:var(--post-core-dimension-24)}.btn-close:focus,.btn-close:not(:disabled):hover,.pretend-hover.btn-close{color:#000}.btn-close:disabled{color:var(--post-gray-40)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.btn-close{color:CanvasText;forced-color-adjust:none}.btn-close:focus,.btn-close:not(:disabled):hover,.pretend-hover.btn-close{color:Highlight}}.btn-close-white{color:#e6e6e6}.btn-close-white:focus,.btn-close-white:not(:disabled):hover,.btn-close-white.pretend-hover{color:#fff}.btn-close-white:disabled{color:#999}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}:host ::slotted(*){margin:0 !important}.visually-hidden{width:1px !important;height:1px !important;padding:0 !important;margin:-1px !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;white-space:nowrap !important;border:0 !important}.visually-hidden:not(caption){position:absolute !important}";
14
- const PostBannerStyle0 = postBannerCss;
15
-
16
- const PostBanner = class {
17
- constructor(hostRef) {
18
- index.registerInstance(this, hostRef);
19
- this.postDismissed = index.createEvent(this, "postDismissed", 7);
20
- this.bannerId = `p${index_browser.nanoid(6)}`;
21
- this.classes = undefined;
22
- this.hasActions = undefined;
23
- this.hasHeading = undefined;
24
- this.onDismissButtonClick = () => this.dismiss();
25
- this.dismissible = false;
26
- this.dismissLabel = undefined;
27
- this.icon = undefined;
28
- this.type = 'neutral';
29
- }
30
- validateDismissible(isDismissible = this.dismissible) {
31
- checkType.checkType(isDismissible, 'boolean', 'The post-banner "dismissible" prop should be a boolean.');
32
- setTimeout(() => this.validateDismissLabel());
33
- }
34
- validateDismissLabel(dismissLabel = this.dismissLabel) {
35
- if (this.dismissible) {
36
- checkNonEmpty.checkNonEmpty(dismissLabel, 'Dismissible post-banner\'s require a "dismiss-label" prop.');
37
- }
38
- }
39
- validateIcon(icon = this.icon) {
40
- index$1.checkEmptyOrPattern(icon, /\d{4}|none/, 'The post-banner "icon" prop should be a 4-digits string.');
41
- }
42
- validateType(type = this.type) {
43
- index$1.checkEmptyOrOneOf(type, BANNER_TYPES, `The post-banner requires a type form: ${BANNER_TYPES.join(', ')}`);
44
- }
45
- componentDidLoad() {
46
- this.validateDismissible();
47
- this.validateIcon();
48
- this.validateType();
49
- }
50
- componentWillRender() {
51
- this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;
52
- this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;
53
- this.classes = `banner ${this.type ? 'banner-' + this.type : ''}`;
54
- if (this.dismissible)
55
- this.classes += ' banner-dismissible';
56
- if (this.hasActions)
57
- this.classes += ' banner-action';
58
- if (this.icon === 'none')
59
- this.classes += ' no-icon';
60
- }
61
- /**
62
- * Triggers banner dismissal programmatically (same as clicking on the close button (×)).
63
- */
64
- async dismiss() {
65
- const dismissal = fade.fadeOut(this.host);
66
- await dismissal.finished;
67
- this.host.remove();
68
- this.postDismissed.emit();
69
- }
70
- render() {
71
- const defaultBannerContent = [
72
- this.hasHeading && (index.h("div", { key: `${this.bannerId}-heading`, class: "banner-heading" }, index.h("slot", { key: 'ac8774db27af4057a85f04f5864534c14f387cd7', name: "heading" }))),
73
- index.h("slot", { key: `${this.bannerId}-message` }),
74
- ];
75
- const actionBannerContent = [
76
- index.h("div", { key: `${this.bannerId}-content`, class: "banner-content" }, defaultBannerContent),
77
- index.h("div", { key: `${this.bannerId}-buttons`, class: "banner-buttons" }, index.h("slot", { key: 'e3652af90a4b54bf1297e4c78a32d64305674ff7', name: "actions" })),
78
- ];
79
- return (index.h(index.Host, { key: '21bfb98ce6f38c03dca18877cd99d5ac2ebbafaf', "data-version": _package.version }, index.h("div", { key: '728c307293908b86d6951d9edc420d8cf9074bc8', role: "alert", class: this.classes, part: this.classes }, this.dismissible && (index.h("button", { key: '6ac2f33805ae8dfc8f4a9444fa98153ce5009c72', class: "btn-close", onClick: this.onDismissButtonClick }, index.h("span", { key: 'ad9dd25cc1c43555115192ec04ce05ec54b793d4', class: "visually-hidden" }, this.dismissLabel))), this.icon && this.icon !== 'none' && (index.h("post-icon", { key: `${this.bannerId}-icon`, name: this.icon })), this.hasActions ? actionBannerContent : defaultBannerContent)));
80
- }
81
- get host() { return index.getElement(this); }
82
- static get watchers() { return {
83
- "dismissible": ["validateDismissible"],
84
- "dismissLabel": ["validateDismissLabel"],
85
- "icon": ["validateIcon"],
86
- "type": ["validateType"]
87
- }; }
88
- };
89
- PostBanner.style = PostBannerStyle0;
90
-
91
- exports.PostBanner = PostBanner;