@swisspost/design-system-components 7.4.0 → 8.0.0

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 (175) hide show
  1. package/dist/cjs/{index-f32e5185.js → index-a1440961.js} +15 -2
  2. package/dist/cjs/{index-1cc8e4e1.js → index-baad16da.js} +8 -17
  3. package/dist/cjs/index.cjs.js +18 -20
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/cjs/{package-549b9aab.js → package-28cba29c.js} +1 -1
  6. package/dist/cjs/{post-accordion-e0a2c3c3.js → post-accordion-fc746a6f.js} +2 -2
  7. package/dist/cjs/{post-accordion-item-772332db.js → post-accordion-item-c0492b73.js} +6 -7
  8. package/dist/cjs/post-accordion-item.cjs.entry.js +4 -5
  9. package/dist/cjs/post-accordion.cjs.entry.js +3 -3
  10. package/dist/cjs/{post-alert-42220c7a.js → post-alert-0612ad51.js} +8 -9
  11. package/dist/cjs/post-alert.cjs.entry.js +4 -5
  12. package/dist/cjs/{post-card-control-45047568.js → post-card-control-2fd18624.js} +4 -4
  13. package/dist/cjs/post-card-control.cjs.entry.js +3 -3
  14. package/dist/cjs/post-collapsible-trigger-8d39196e.js +206 -0
  15. package/dist/cjs/{post-collapsible-trigger.cjs.entry.js → post-collapsible_2.cjs.entry.js} +7 -5
  16. package/dist/cjs/post-components.cjs.js +3 -3
  17. package/dist/cjs/{post-icon-d136be35.js → post-icon-bd260560.js} +5 -6
  18. package/dist/cjs/post-icon.cjs.entry.js +4 -5
  19. package/dist/cjs/{post-popover-1024d72f.js → post-popover-303e76ef.js} +3 -3
  20. package/dist/cjs/post-popover.cjs.entry.js +3 -3
  21. package/dist/cjs/{post-popovercontainer-f5dd6284.js → post-popovercontainer-c64bde39.js} +8 -9
  22. package/dist/cjs/post-popovercontainer.cjs.entry.js +3 -3
  23. package/dist/cjs/{post-rating-df981989.js → post-rating-dc7bd246.js} +3 -3
  24. package/dist/cjs/post-rating.cjs.entry.js +3 -3
  25. package/dist/cjs/{post-tab-header-17fe11d6.js → post-tab-header-06c40218.js} +3 -3
  26. package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
  27. package/dist/cjs/{post-tab-panel-a47c8cfe.js → post-tab-panel-54fbdb66.js} +3 -3
  28. package/dist/cjs/post-tab-panel.cjs.entry.js +3 -3
  29. package/dist/cjs/{post-tabs-766f8241.js → post-tabs-52b9d638.js} +3 -3
  30. package/dist/cjs/post-tabs.cjs.entry.js +3 -3
  31. package/dist/cjs/{post-tag-65ec8149.js → post-tag-4aba2155.js} +3 -3
  32. package/dist/cjs/post-tag.cjs.entry.js +3 -3
  33. package/dist/cjs/{post-tooltip-2efd6509.js → post-tooltip-3c695f60.js} +4 -4
  34. package/dist/cjs/post-tooltip.cjs.entry.js +4 -5
  35. package/dist/collection/collection-manifest.json +1 -1
  36. package/dist/collection/components/post-accordion-item/post-accordion-item.js +7 -9
  37. package/dist/collection/components/post-alert/post-alert.js +3 -3
  38. package/dist/collection/components/post-card-control/post-card-control.js +2 -2
  39. package/dist/collection/components/post-collapsible/post-collapsible.js +12 -14
  40. package/dist/collection/components/post-collapsible-trigger/post-collapsible-trigger.js +14 -19
  41. package/dist/collection/components/post-icon/post-icon.js +1 -1
  42. package/dist/collection/components/post-popover/post-popover.js +2 -2
  43. package/dist/collection/components/post-popovercontainer/post-popovercontainer.js +3 -3
  44. package/dist/collection/components/post-rating/post-rating.js +1 -1
  45. package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
  46. package/dist/collection/components/post-tab-panel/post-tab-panel.js +1 -1
  47. package/dist/collection/components/post-tabs/post-tabs.js +1 -1
  48. package/dist/collection/components/post-tag/post-tag.js +1 -1
  49. package/dist/collection/components/post-tooltip/post-tooltip.js +2 -2
  50. package/dist/collection/utils/get-root.js +7 -0
  51. package/dist/collection/utils/index.js +1 -0
  52. package/dist/components/package.js +1 -1
  53. package/dist/components/post-accordion-item2.js +13 -9
  54. package/dist/components/post-alert2.js +3 -3
  55. package/dist/components/post-card-control2.js +2 -2
  56. package/dist/components/post-collapsible-trigger2.js +22 -10
  57. package/dist/components/post-collapsible2.js +12 -14
  58. package/dist/components/post-icon2.js +1 -1
  59. package/dist/components/post-popover2.js +1 -1
  60. package/dist/components/post-popovercontainer2.js +6 -7
  61. package/dist/components/post-rating2.js +1 -1
  62. package/dist/components/post-tab-header2.js +1 -1
  63. package/dist/components/post-tab-panel2.js +1 -1
  64. package/dist/components/post-tabs2.js +1 -1
  65. package/dist/components/post-tag2.js +1 -1
  66. package/dist/components/post-tooltip2.js +1 -1
  67. package/dist/docs.json +23 -22
  68. package/dist/esm/{index-9ace3232.js → index-189d3985.js} +8 -17
  69. package/dist/esm/{index-29d17d6d.js → index-d1eba94c.js} +14 -2
  70. package/dist/esm/index.js +17 -19
  71. package/dist/esm/loader.js +3 -3
  72. package/dist/esm/{package-91140d77.js → package-3e4546f5.js} +1 -1
  73. package/dist/esm/{post-accordion-09978cd3.js → post-accordion-1cbd089a.js} +2 -2
  74. package/dist/esm/{post-accordion-item-4210d17f.js → post-accordion-item-316ee985.js} +6 -7
  75. package/dist/esm/post-accordion-item.entry.js +4 -5
  76. package/dist/esm/post-accordion.entry.js +3 -3
  77. package/dist/esm/{post-alert-64d34792.js → post-alert-6fa442b9.js} +6 -7
  78. package/dist/esm/post-alert.entry.js +4 -5
  79. package/dist/esm/{post-card-control-244f45f6.js → post-card-control-41356aa4.js} +4 -4
  80. package/dist/esm/post-card-control.entry.js +3 -3
  81. package/dist/esm/post-collapsible-trigger-6f4ba350.js +203 -0
  82. package/dist/esm/post-collapsible_2.entry.js +7 -0
  83. package/dist/esm/post-components.js +4 -4
  84. package/dist/esm/{post-icon-f05c6d37.js → post-icon-fe467f6a.js} +4 -5
  85. package/dist/esm/post-icon.entry.js +4 -5
  86. package/dist/esm/{post-popover-a094d059.js → post-popover-c9998136.js} +3 -3
  87. package/dist/esm/post-popover.entry.js +3 -3
  88. package/dist/esm/{post-popovercontainer-1faa005e.js → post-popovercontainer-62ced3d7.js} +8 -9
  89. package/dist/esm/post-popovercontainer.entry.js +3 -3
  90. package/dist/esm/{post-rating-62590a88.js → post-rating-49ace0e9.js} +3 -3
  91. package/dist/esm/post-rating.entry.js +3 -3
  92. package/dist/esm/{post-tab-header-1b88d56e.js → post-tab-header-696a7aae.js} +3 -3
  93. package/dist/esm/post-tab-header.entry.js +3 -3
  94. package/dist/esm/{post-tab-panel-fac73181.js → post-tab-panel-c00910fb.js} +3 -3
  95. package/dist/esm/post-tab-panel.entry.js +3 -3
  96. package/dist/esm/{post-tabs-4528a1a5.js → post-tabs-a7990c9e.js} +3 -3
  97. package/dist/esm/post-tabs.entry.js +3 -3
  98. package/dist/esm/{post-tag-8b82ff5c.js → post-tag-d9650103.js} +3 -3
  99. package/dist/esm/post-tag.entry.js +3 -3
  100. package/dist/esm/{post-tooltip-1156bdc7.js → post-tooltip-cf07e816.js} +4 -4
  101. package/dist/esm/post-tooltip.entry.js +4 -5
  102. package/dist/post-components/index.esm.js +1 -1
  103. package/dist/post-components/p-0aee269b.entry.js +1 -0
  104. package/dist/post-components/p-2240981f.entry.js +1 -0
  105. package/dist/post-components/{p-4dc0b726.js → p-266adbdd.js} +1 -1
  106. package/dist/post-components/p-27cb2e60.entry.js +1 -0
  107. package/dist/post-components/p-2c9277b1.entry.js +1 -0
  108. package/dist/post-components/p-3764a23a.entry.js +1 -0
  109. package/dist/post-components/{p-0df6bfe1.js → p-382f85c4.js} +1 -1
  110. package/dist/post-components/p-48ed21f0.entry.js +1 -0
  111. package/dist/post-components/p-496cee95.entry.js +1 -0
  112. package/dist/post-components/p-4ce46830.entry.js +1 -0
  113. package/dist/post-components/p-5135c965.entry.js +1 -0
  114. package/dist/post-components/{p-eff7cef8.js → p-5c4773cb.js} +2 -2
  115. package/dist/post-components/p-660ecc23.js +1 -0
  116. package/dist/post-components/p-69145fd2.js +1 -0
  117. package/dist/post-components/p-6af42a67.entry.js +1 -0
  118. package/dist/post-components/{p-21bdf1f3.js → p-6c701d9f.js} +1 -1
  119. package/dist/post-components/p-7095990e.js +1 -0
  120. package/dist/post-components/p-7481e37a.entry.js +1 -0
  121. package/dist/post-components/{p-04dc2d21.js → p-783e67bc.js} +1 -1
  122. package/dist/post-components/p-8f0ee57c.entry.js +1 -0
  123. package/dist/post-components/p-90479234.js +1 -0
  124. package/dist/post-components/p-a4794190.js +1 -0
  125. package/dist/post-components/{p-a8dc1aa1.js → p-a4e13e9c.js} +1 -1
  126. package/dist/post-components/{p-bdb6c1b8.js → p-ab26873d.js} +1 -1
  127. package/dist/post-components/p-b08aca79.entry.js +1 -0
  128. package/dist/post-components/p-beb27e06.js +1 -0
  129. package/dist/post-components/{p-8c7f0075.js → p-c0f265c8.js} +2 -2
  130. package/dist/post-components/{p-8e975b46.js → p-e024aa18.js} +1 -1
  131. package/dist/post-components/p-ea063aae.entry.js +1 -0
  132. package/dist/post-components/p-f732d73c.js +1 -0
  133. package/dist/post-components/p-f91c0e1b.js +1 -0
  134. package/dist/post-components/post-components.esm.js +1 -1
  135. package/dist/types/components/post-accordion-item/post-accordion-item.d.ts +2 -3
  136. package/dist/types/components/post-collapsible/post-collapsible.d.ts +3 -4
  137. package/dist/types/components/post-collapsible-trigger/post-collapsible-trigger.d.ts +6 -5
  138. package/dist/types/components.d.ts +4 -4
  139. package/dist/types/utils/get-root.d.ts +1 -0
  140. package/dist/types/utils/index.d.ts +1 -0
  141. package/package.json +10 -10
  142. package/dist/cjs/check-type-64af82a9.js +0 -16
  143. package/dist/cjs/post-collapsible-d71942e3.js +0 -87
  144. package/dist/cjs/post-collapsible-trigger-a7e32ead.js +0 -115
  145. package/dist/cjs/post-collapsible.cjs.entry.js +0 -15
  146. package/dist/esm/check-type-8828dbe4.js +0 -14
  147. package/dist/esm/post-collapsible-4ddc1db3.js +0 -85
  148. package/dist/esm/post-collapsible-trigger-b0100e8c.js +0 -113
  149. package/dist/esm/post-collapsible-trigger.entry.js +0 -6
  150. package/dist/esm/post-collapsible.entry.js +0 -7
  151. package/dist/post-components/p-10cd6860.entry.js +0 -1
  152. package/dist/post-components/p-158d0eee.entry.js +0 -1
  153. package/dist/post-components/p-1f9ddbd4.js +0 -1
  154. package/dist/post-components/p-2da9a13c.js +0 -1
  155. package/dist/post-components/p-39b6f635.entry.js +0 -1
  156. package/dist/post-components/p-3cb6b887.entry.js +0 -1
  157. package/dist/post-components/p-4a3f67ab.js +0 -1
  158. package/dist/post-components/p-5ef247ea.entry.js +0 -1
  159. package/dist/post-components/p-67d41a4b.entry.js +0 -1
  160. package/dist/post-components/p-78111d97.entry.js +0 -1
  161. package/dist/post-components/p-7f3045f5.entry.js +0 -1
  162. package/dist/post-components/p-80708279.entry.js +0 -1
  163. package/dist/post-components/p-8c9bd744.entry.js +0 -1
  164. package/dist/post-components/p-9170a653.js +0 -1
  165. package/dist/post-components/p-9656cf35.js +0 -1
  166. package/dist/post-components/p-9fa0742e.js +0 -1
  167. package/dist/post-components/p-ac500761.js +0 -1
  168. package/dist/post-components/p-b53753a0.js +0 -1
  169. package/dist/post-components/p-bd0695bf.js +0 -1
  170. package/dist/post-components/p-c297c7d1.entry.js +0 -1
  171. package/dist/post-components/p-c8fe8c37.js +0 -1
  172. package/dist/post-components/p-d1c71b7d.entry.js +0 -1
  173. package/dist/post-components/p-d9e5275c.entry.js +0 -1
  174. package/dist/post-components/p-f7101c7f.entry.js +0 -1
  175. package/dist/post-components/p-ffdd17d8.entry.js +0 -1
@@ -0,0 +1 @@
1
+ export{P as post_tab_header}from"./p-ab26873d.js";import"./p-c0f265c8.js";import"./p-90479234.js";import"./p-b095519d.js";import"./p-440193f4.js";
@@ -0,0 +1 @@
1
+ import{r as i,h as t,H as a,g as e}from"./p-c0f265c8.js";import{c as o,d as n,a as s}from"./p-f91c0e1b.js";import{v as r}from"./p-90479234.js";import{c as l}from"./p-b095519d.js";const m=["cylon","cylon-vertical","spin","spin-reverse","fade","throb"],c=class{constructor(t){i(this,t),this.svgStyles=void 0,this.svgOutput=void 0,this.animation=null,this.base=null,this.flipH=!1,this.flipV=!1,this.name=void 0,this.rotate=null,this.scale=null}validateAnimation(i=this.animation){void 0!==i&&o(i,m,`The post-icon "animation" prop requires one of the following values: ${m.join(", ")}.`)}validateBase(i=this.base){n(i,"string",'The post-icon "base" prop should be a string.')}validateFlipH(i=this.flipH){n(i,"boolean",'The post-icon "flipH" prop should be a boolean.')}validateFlipV(i=this.flipV){n(i,"boolean",'The post-icon "flipV" prop should be a boolean.')}validateName(i=this.name){l(i,'The post-icon "name" prop is required!.'),s(i,"string",'The post-icon "name" prop should be a string.')}validateRotate(i=this.rotate){n(i,"number",'The post-icon "rotate" prop should be a number.')}validateScale(i=this.scale){n(i,"number",'The post-icon "scale" prop should be a number.')}componentWillLoad(){this.validateBase(),this.validateName(),this.validateFlipH(),this.validateFlipV(),this.validateScale(),this.validateRotate(),this.validateAnimation()}componentWillRender(){this.setPath()}setPath(){var i,t,a,e;const o=null!==(t=null===(i=document.head.querySelector('meta[name="design-system-settings"][data-post-icon-base]'))||void 0===i?void 0:i.getAttribute("data-post-icon-base"))&&void 0!==t?t:null,n=`${null!==(e=null!==(a=this.base)&&void 0!==a?a:o)&&void 0!==e?e:"https://unpkg.com/@swisspost/design-system-icons/public/post-icons"}/`.replace(/\/\/$/,"/");this.path=new URL(`${n}${this.name}.svg`,window.location.origin).toString()}render(){const i=Object.entries({"-webkit-mask-image":`url('${this.path}')`,"mask-image":`url('${this.path}')`,transform:(this.scale&&!isNaN(Number(this.scale))?"scale("+this.scale+")":"")+(this.rotate&&!isNaN(Number(this.rotate))?" rotate("+this.rotate+"deg)":"")}).filter((([i,t])=>null!==t)).reduce(((i,[t,a])=>Object.assign(i,{[t]:a})),{});return t(a,{key:"95fa0f7a09d3430bb5d621e01b57188742920eb4","data-version":r},t("span",{key:"c824e3705dc83665bb6f7649381654e6d1e07dfb",style:i}))}get host(){return e(this)}static get watchers(){return{animation:["validateAnimation"],base:["validateBase"],flipH:["validateFlipH"],flipV:["validateFlipV"],name:["validateName"],rotate:["validateRotate"],scale:["validateScale"]}}};c.style=":host{display:inline-block;width:1em;height:1em;vertical-align:-0.15em}span{display:block;width:100%;height:100%;fill:currentColor;forced-color-adjust:preserve-parent-color;background-color:currentColor;-webkit-mask-position:center center;mask-position:center center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:100%;mask-size:100%}:host([flip-h]:not([flip-h=false])){scale:-1 1}:host([flip-v]:not([flip-v=false])){scale:1 -1}:host([flip-h][flip-v]:not([flip-h=false],[flip-v=false])){scale:-1}:host([animation]){transform-origin:center}:host([animation=cylon]){animation:icon-animation-cylon .75s ease-in-out infinite alternate}:host([animation=cylon-vertical]){animation:icon-animation-cylon-vertical .75s ease-in-out infinite alternate}:host([animation=spin]){animation:icon-animation-spin 2s linear infinite normal}:host([animation=spin-reverse]){animation:icon-animation-spin 2s linear infinite reverse}:host([animation=fade]){animation:icon-animation-fade .75s ease-in-out infinite alternate}:host([animation=throb]){animation:icon-animation-throb .75s ease-in-out infinite alternate}@keyframes icon-animation-cylon{from{transform:translateX(-25%)}to{transform:translateX(25%)}}@keyframes icon-animation-cylon-vertical{from{transform:translateY(25%)}to{transform:translateY(-25%)}}@keyframes icon-animation-fade{from{opacity:.1}to{opacity:1}}@keyframes icon-animation-spin{from{transform:rotate(0deg)}to{transform:rotate(359deg)}}@keyframes icon-animation-throb{from{opacity:.5;transform:scale(0.5)}to{opacity:1;transform:scale(1)}}";export{c as P}
@@ -0,0 +1 @@
1
+ import{E as r}from"./p-440193f4.js";import{c as o}from"./p-611b3c41.js";function t(o){return(...t)=>{const n=t[0];r.some((r=>r===n))||o(...t)}}function n(r,o,t){const n="array"===o,s=Array.isArray(r);if(n||s){if(s!==n)throw new Error(t)}else if(typeof r!==o)throw new Error(t)}const s=t(o),f=t((function(r,o,t){if("string"!=typeof r||!o.test(r))throw new Error(t)})),a=t(n);export{n as a,f as b,s as c,a as d}
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-8c7f0075.js";export{s as setNonce}from"./p-8c7f0075.js";import{g as l}from"./p-e1255160.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((async e=>(await l(),a([["p-d1c71b7d",[[1,"post-accordion-item",{collapsed:[4],headingLevel:[2,"heading-level"],id:[32],isOpen:[32],toggle:[64]},[[0,"postToggle","onCollapseToggle"]],{headingLevel:["validateHeadingLevel"]}]]],["p-c297c7d1",[[1,"post-alert",{dismissible:[4],dismissLabel:[1,"dismiss-label"],fixed:[4],icon:[1],type:[1],alertId:[32],classes:[32],hasActions:[32],hasHeading:[32],onDismissButtonClick:[32],dismiss:[64]},null,{dismissible:["validateDismissible"],dismissLabel:["validateDismissLabel"],fixed:["validateFixed"],icon:["validateIcon"],type:["validateType"]}]]],["p-67d41a4b",[[65,"post-card-control",{label:[1],description:[1],type:[1],name:[1],value:[1],checked:[1028],disabled:[1028],validity:[1025],icon:[1],focused:[32],reset:[64],groupReset:[64]},null,{label:["validateControlLabel"],type:["validateControlType"],checked:["updateControlChecked"],disabled:["updateControlDisbled"]}]]],["p-7f3045f5",[[4,"post-popovercontainer",{placement:[1],arrow:[4],show:[64],hide:[64],toggle:[64]}]]],["p-5ef247ea",[[1,"post-popover",{placement:[1],closeButtonCaption:[1,"close-button-caption"],arrow:[4],show:[64],hide:[64],toggle:[64]}]]],["p-10cd6860",[[1,"post-rating",{label:[1],stars:[2],currentRating:[1026,"current-rating"],readonly:[4],hoveredIndex:[32]}]]],["p-80708279",[[1,"post-tag",{variant:[1],size:[1],icon:[1],classes:[32]},null,{variant:["variantChanged"],size:["sizeChanged"]}]]],["p-158d0eee",[[1,"post-tooltip",{placement:[1],arrow:[4],delayed:[4],show:[64],hide:[64],toggle:[64]},null,{delayed:["validateDelayed"]}]]],["p-ffdd17d8",[[1,"post-accordion",{headingLevel:[2,"heading-level"],multiple:[4],toggle:[64],expandAll:[64],collapseAll:[64]},[[0,"postToggle","collapseToggleHandler"]],{headingLevel:["validateHeadingLevel"]}]]],["p-39b6f635",[[0,"post-collapsible-trigger",{for:[1],update:[64]},[[4,"postToggle","setAriaExpanded"]],{for:["setAriaAttributes"]}]]],["p-3cb6b887",[[1,"post-tab-header",{panel:[1],tabId:[32]},null,{panel:["validateFor"]}]]],["p-78111d97",[[1,"post-tab-panel",{name:[1],panelId:[32]}]]],["p-d9e5275c",[[1,"post-tabs",{activePanel:[1,"active-panel"],show:[64]}]]],["p-f7101c7f",[[1,"post-collapsible",{collapsed:[4],toggle:[64]},null,{collapsed:["validateCollapsed"]}]]],["p-8c9bd744",[[1,"post-icon",{animation:[1],base:[1],flipH:[4,"flip-h"],flipV:[4,"flip-v"],name:[1],rotate:[2],scale:[2],svgStyles:[32],svgOutput:[32]},null,{animation:["validateAnimation"],base:["validateBase"],flipH:["validateFlipH"],flipV:["validateFlipV"],name:["validateName"],rotate:["validateRotate"],scale:["validateScale"]}]]]],e))));
1
+ import{p as e,b as a}from"./p-c0f265c8.js";export{s as setNonce}from"./p-c0f265c8.js";import{g as l}from"./p-e1255160.js";(()=>{const a=import.meta.url,l={};return""!==a&&(l.resourcesUrl=new URL(".",a).href),e(l)})().then((async e=>(await l(),a([["p-4ce46830",[[1,"post-accordion-item",{collapsed:[1028],headingLevel:[2,"heading-level"],id:[32],toggle:[64]},[[2,"postToggle","onCollapseToggle"]],{headingLevel:["validateHeadingLevel"]}]]],["p-2c9277b1",[[1,"post-alert",{dismissible:[4],dismissLabel:[1,"dismiss-label"],fixed:[4],icon:[1],type:[1],alertId:[32],classes:[32],hasActions:[32],hasHeading:[32],onDismissButtonClick:[32],dismiss:[64]},null,{dismissible:["validateDismissible"],dismissLabel:["validateDismissLabel"],fixed:["validateFixed"],icon:["validateIcon"],type:["validateType"]}]]],["p-5135c965",[[65,"post-card-control",{label:[1],description:[1],type:[1],name:[1],value:[1],checked:[1028],disabled:[1028],validity:[1025],icon:[1],focused:[32],reset:[64],groupReset:[64]},null,{label:["validateControlLabel"],type:["validateControlType"],checked:["updateControlChecked"],disabled:["updateControlDisbled"]}]]],["p-48ed21f0",[[4,"post-popovercontainer",{placement:[1],arrow:[4],show:[64],hide:[64],toggle:[64]}]]],["p-2240981f",[[1,"post-popover",{placement:[1],closeButtonCaption:[1,"close-button-caption"],arrow:[4],show:[64],hide:[64],toggle:[64]}]]],["p-27cb2e60",[[1,"post-icon",{animation:[1],base:[1],flipH:[4,"flip-h"],flipV:[4,"flip-v"],name:[1],rotate:[2],scale:[2],svgStyles:[32],svgOutput:[32]},null,{animation:["validateAnimation"],base:["validateBase"],flipH:["validateFlipH"],flipV:["validateFlipV"],name:["validateName"],rotate:["validateRotate"],scale:["validateScale"]}]]],["p-6af42a67",[[1,"post-rating",{label:[1],stars:[2],currentRating:[1026,"current-rating"],readonly:[4],hoveredIndex:[32]}]]],["p-3764a23a",[[1,"post-tag",{variant:[1],size:[1],icon:[1],classes:[32]},null,{variant:["variantChanged"],size:["sizeChanged"]}]]],["p-b08aca79",[[1,"post-tooltip",{placement:[1],arrow:[4],delayed:[4],show:[64],hide:[64],toggle:[64]},null,{delayed:["validateDelayed"]}]]],["p-7481e37a",[[1,"post-accordion",{headingLevel:[2,"heading-level"],multiple:[4],toggle:[64],expandAll:[64],collapseAll:[64]},[[0,"postToggle","collapseToggleHandler"]],{headingLevel:["validateHeadingLevel"]}]]],["p-ea063aae",[[1,"post-tab-header",{panel:[1],tabId:[32]},null,{panel:["validateFor"]}]]],["p-0aee269b",[[1,"post-tab-panel",{name:[1],panelId:[32]}]]],["p-8f0ee57c",[[1,"post-tabs",{activePanel:[1,"active-panel"],show:[64]}]]],["p-496cee95",[[1,"post-collapsible",{collapsed:[1028],toggle:[64]},null,{collapsed:["collapsedChange"]}],[0,"post-collapsible-trigger",{for:[1],update:[64]},null,{for:["setAriaAttributes"]}]]]],e))));
@@ -7,11 +7,10 @@ export declare class PostAccordionItem {
7
7
  private collapsible;
8
8
  host: HTMLPostAccordionItemElement;
9
9
  id: string;
10
- isOpen: boolean;
11
10
  /**
12
- * If `true`, the element is initially collapsed otherwise it is displayed.
11
+ * If `true`, the element is collapsed otherwise it is displayed.
13
12
  */
14
- readonly collapsed?: boolean;
13
+ collapsed?: boolean;
15
14
  /**
16
15
  * Defines the hierarchical level of the accordion item header within the headings structure.
17
16
  * @deprecated set the `heading-level` property on the parent `post-accordion` instead.
@@ -7,17 +7,16 @@ export declare class PostCollapsible {
7
7
  private isOpen;
8
8
  host: HTMLPostCollapsibleElement;
9
9
  /**
10
- * If `true`, the element is initially collapsed otherwise it is displayed.
10
+ * If `true`, the element is collapsed otherwise it is displayed.
11
11
  */
12
- readonly collapsed?: boolean;
13
- validateCollapsed(newValue?: boolean): void;
12
+ collapsed?: boolean;
13
+ collapsedChange(): void;
14
14
  /**
15
15
  * An event emitted when the collapse element is shown or hidden, before the transition.
16
16
  *
17
17
  * The event payload is a boolean: `true` if the collapsible was opened, `false` if it was closed.
18
18
  */
19
19
  postToggle: EventEmitter<boolean>;
20
- connectedCallback(): void;
21
20
  componentDidLoad(): void;
22
21
  /**
23
22
  * Triggers the collapse programmatically.
@@ -1,7 +1,7 @@
1
- import { PostCollapsibleCustomEvent } from "../../components";
2
1
  export declare class PostCollapsibleTrigger {
3
2
  private trigger?;
4
3
  private observer;
4
+ private root?;
5
5
  host: HTMLPostCollapsibleTriggerElement;
6
6
  /**
7
7
  * Link the trigger to a post-collapsible with this id
@@ -15,6 +15,11 @@ export declare class PostCollapsibleTrigger {
15
15
  * Initiate a mutation observer that updates the trigger whenever necessary
16
16
  */
17
17
  connectedCallback(): void;
18
+ /**
19
+ * Attach a "postToggle" event listener to the root node
20
+ * to update the trigger's "aria-expanded" attribute whenever the controlled post-collapsible is toggled
21
+ */
22
+ componentWillLoad(): void;
18
23
  /**
19
24
  * Add the "data-version" to the host element and set the trigger
20
25
  */
@@ -23,10 +28,6 @@ export declare class PostCollapsibleTrigger {
23
28
  * Disconnect the mutation observer
24
29
  */
25
30
  disconnectedCallback(): void;
26
- /**
27
- * Update the "aria-expanded" attribute on the trigger anytime the controlled post-collapsible is toggled
28
- */
29
- setAriaExpanded(e: PostCollapsibleCustomEvent<boolean>): void;
30
31
  /**
31
32
  * Update the "aria-controls" and "aria-expanded" attributes on the trigger button
32
33
  */
@@ -36,7 +36,7 @@ export namespace Components {
36
36
  }
37
37
  interface PostAccordionItem {
38
38
  /**
39
- * If `true`, the element is initially collapsed otherwise it is displayed.
39
+ * If `true`, the element is collapsed otherwise it is displayed.
40
40
  */
41
41
  "collapsed"?: boolean;
42
42
  /**
@@ -126,7 +126,7 @@ export namespace Components {
126
126
  }
127
127
  interface PostCollapsible {
128
128
  /**
129
- * If `true`, the element is initially collapsed otherwise it is displayed.
129
+ * If `true`, the element is collapsed otherwise it is displayed.
130
130
  */
131
131
  "collapsed"?: boolean;
132
132
  /**
@@ -535,7 +535,7 @@ declare namespace LocalJSX {
535
535
  }
536
536
  interface PostAccordionItem {
537
537
  /**
538
- * If `true`, the element is initially collapsed otherwise it is displayed.
538
+ * If `true`, the element is collapsed otherwise it is displayed.
539
539
  */
540
540
  "collapsed"?: boolean;
541
541
  /**
@@ -621,7 +621,7 @@ declare namespace LocalJSX {
621
621
  }
622
622
  interface PostCollapsible {
623
623
  /**
624
- * If `true`, the element is initially collapsed otherwise it is displayed.
624
+ * If `true`, the element is collapsed otherwise it is displayed.
625
625
  */
626
626
  "collapsed"?: boolean;
627
627
  /**
@@ -0,0 +1 @@
1
+ export declare function getRoot(element: HTMLElement): Document | ShadowRoot;
@@ -1,5 +1,6 @@
1
1
  export * from './property-checkers';
2
2
  export * from './debounce';
3
+ export * from './get-root';
3
4
  export * from './is-motion-reduced';
4
5
  export * from './sass-export';
5
6
  export * from './timeout';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swisspost/design-system-components",
3
- "version": "7.4.0",
3
+ "version": "8.0.0",
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",
@@ -23,34 +23,34 @@
23
23
  "linkDirectory": true
24
24
  },
25
25
  "dependencies": {
26
- "@floating-ui/dom": "1.6.7",
26
+ "@floating-ui/dom": "1.6.8",
27
27
  "@oddbird/popover-polyfill": "0.3.7",
28
- "@swisspost/design-system-styles": "7.4.0",
28
+ "@swisspost/design-system-styles": "8.0.0",
29
29
  "ally.js": "1.4.1",
30
30
  "long-press-event": "2.5.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@percy/cli": "1.28.8",
33
+ "@percy/cli": "1.29.0",
34
34
  "@percy/cypress": "3.1.2",
35
35
  "@stencil-community/eslint-plugin": "0.7.2",
36
36
  "@stencil/angular-output-target": "0.8.4",
37
- "@stencil/core": "4.19.1",
37
+ "@stencil/core": "4.19.2",
38
38
  "@stencil/react-output-target": "0.5.3",
39
39
  "@stencil/sass": "3.0.12",
40
40
  "@types/jest": "29.5.12",
41
- "@types/node": "20.14.9",
41
+ "@types/node": "20.14.11",
42
42
  "@typescript-eslint/eslint-plugin": "5.62.0",
43
43
  "@typescript-eslint/parser": "5.62.0",
44
44
  "bootstrap": "5.3.3",
45
- "cypress": "13.13.0",
45
+ "cypress": "13.13.1",
46
46
  "cypress-axe": "1.5.0",
47
47
  "cypress-storybook": "1.0.0",
48
48
  "eslint": "8.57.0",
49
- "eslint-plugin-react": "7.34.3",
49
+ "eslint-plugin-react": "7.35.0",
50
50
  "rimraf": "6.0.1",
51
51
  "rollup-plugin-postcss": "4.0.2",
52
- "sass": "1.77.6",
53
- "ts-jest": "29.1.5",
52
+ "sass": "1.77.8",
53
+ "ts-jest": "29.2.3",
54
54
  "typescript": "5.3.3"
55
55
  },
56
56
  "keywords": [
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- function checkType(value, type, error) {
4
- const typeIsArray = type === 'array';
5
- const valueIsArray = Array.isArray(value);
6
- if (typeIsArray || valueIsArray) {
7
- if (valueIsArray !== typeIsArray)
8
- throw new Error(error);
9
- }
10
- else {
11
- if (typeof value !== type)
12
- throw new Error(error);
13
- }
14
- }
15
-
16
- exports.checkType = checkType;
@@ -1,87 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-1cc8e4e1.js');
4
- const _package = require('./package-549b9aab.js');
5
- const index$1 = require('./index-f32e5185.js');
6
-
7
- function isMotionReduced() {
8
- return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
9
- }
10
-
11
- const collapseDuration = 350;
12
- const collapseEasing = 'ease';
13
- const collapsedKeyframe = { height: '0', overflow: 'hidden' };
14
- const animationOptions = {
15
- duration: collapseDuration,
16
- easing: collapseEasing,
17
- fill: 'forwards',
18
- };
19
- const collapse = (el) => {
20
- const expandedKeyframe = { height: window.getComputedStyle(el).height };
21
- return el.animate([expandedKeyframe, collapsedKeyframe], animationOptions);
22
- };
23
- const expand = (el) => {
24
- const expandedKeyframe = { height: `${el.scrollHeight}px`, offset: 1 };
25
- const finalKeyframe = { height: 'auto' };
26
- return el.animate([collapsedKeyframe, expandedKeyframe, finalKeyframe], animationOptions);
27
- };
28
-
29
- const postCollapsibleCss = ":host{display:block;overflow:hidden}";
30
- const PostCollapsibleStyle0 = postCollapsibleCss;
31
-
32
- const PostCollapsible = class {
33
- constructor(hostRef) {
34
- index.registerInstance(this, hostRef);
35
- this.postToggle = index.createEvent(this, "postToggle", 7);
36
- this.isLoaded = false;
37
- this.isOpen = true;
38
- this.collapsed = false;
39
- }
40
- validateCollapsed(newValue = this.collapsed) {
41
- index$1.checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');
42
- }
43
- connectedCallback() {
44
- this.validateCollapsed();
45
- }
46
- componentDidLoad() {
47
- if (this.collapsed)
48
- void this.toggle(false);
49
- this.isLoaded = true;
50
- this.updateTriggers();
51
- }
52
- /**
53
- * Triggers the collapse programmatically.
54
- *
55
- * If there is a collapsing transition running already, it will be reversed.
56
- */
57
- async toggle(open = !this.isOpen) {
58
- if (open === this.isOpen)
59
- return open;
60
- this.isOpen = !this.isOpen;
61
- if (this.isLoaded)
62
- this.postToggle.emit(this.isOpen);
63
- const animation = open ? expand(this.host) : collapse(this.host);
64
- if (!this.isLoaded || isMotionReduced())
65
- animation.finish();
66
- await animation.finished;
67
- animation.commitStyles();
68
- return this.isOpen;
69
- }
70
- /**
71
- * Update all post-collapsible-trigger elements referring to the collapsible
72
- */
73
- updateTriggers() {
74
- const triggers = document.querySelectorAll(`post-collapsible-trigger[for=${this.host.id}]`);
75
- triggers.forEach(trigger => trigger.update());
76
- }
77
- render() {
78
- return (index.h(index.Host, { key: 'c24a0524427d6ec5a3a57e12300a5af4cc047a71', "data-version": _package.version }, index.h("slot", { key: '4d41b67a18ca43acfa0e9ef208c07fa7882baba2' })));
79
- }
80
- get host() { return index.getElement(this); }
81
- static get watchers() { return {
82
- "collapsed": ["validateCollapsed"]
83
- }; }
84
- };
85
- PostCollapsible.style = PostCollapsibleStyle0;
86
-
87
- exports.PostCollapsible = PostCollapsible;
@@ -1,115 +0,0 @@
1
- 'use strict';
2
-
3
- const index = require('./index-1cc8e4e1.js');
4
- const _package = require('./package-549b9aab.js');
5
- const checkType = require('./check-type-64af82a9.js');
6
- const checkNonEmpty = require('./check-non-empty-eeaa8f77.js');
7
-
8
- function debounce(callback, timeout = 200) {
9
- let id;
10
- return (...args) => {
11
- if (id)
12
- clearTimeout(id);
13
- id = setTimeout(callback, timeout, ...args);
14
- };
15
- }
16
-
17
- const PostCollapsibleTrigger = class {
18
- constructor(hostRef) {
19
- index.registerInstance(this, hostRef);
20
- this.observer = new MutationObserver(() => this.setTrigger());
21
- this.debouncedUpdate = debounce(() => {
22
- var _a;
23
- if (!this.trigger)
24
- return;
25
- // add the provided id to the aria-controls list
26
- const ariaControls = this.trigger.getAttribute('aria-controls');
27
- if (!(ariaControls === null || ariaControls === void 0 ? void 0 : ariaControls.includes(this.for))) {
28
- const newAriaControls = ariaControls ? `${ariaControls} ${this.for}` : this.for;
29
- this.trigger.setAttribute('aria-controls', newAriaControls);
30
- }
31
- // set the aria-expanded to `false` if the controlled collapsible is collapsed or undefined, set it to `true` otherwise
32
- const isCollapsed = (_a = this.collapsible) === null || _a === void 0 ? void 0 : _a.collapsed;
33
- const newAriaExpanded = isCollapsed !== undefined ? !isCollapsed : undefined;
34
- this.trigger.setAttribute('aria-expanded', `${newAriaExpanded}`);
35
- });
36
- this.for = undefined;
37
- }
38
- /**
39
- * Set the "aria-controls" and "aria-expanded" attributes on the trigger to match the state of the controlled post-collapsible
40
- */
41
- setAriaAttributes() {
42
- checkNonEmpty.checkNonEmpty(this.for, 'The post-collapsible-trigger "for" prop is required.');
43
- checkType.checkType(this.for, 'string', 'The post-collapsible-trigger "for" prop should be a id.');
44
- void this.update();
45
- }
46
- /**
47
- * Initiate a mutation observer that updates the trigger whenever necessary
48
- */
49
- connectedCallback() {
50
- this.observer.observe(this.host, { childList: true, subtree: true });
51
- }
52
- /**
53
- * Add the "data-version" to the host element and set the trigger
54
- */
55
- componentDidLoad() {
56
- this.host.setAttribute('data-version', _package.version);
57
- this.setTrigger();
58
- if (!this.trigger)
59
- console.warn('The post-collapsible-trigger must contain a button.');
60
- }
61
- /**
62
- * Disconnect the mutation observer
63
- */
64
- disconnectedCallback() {
65
- this.observer.disconnect();
66
- }
67
- /**
68
- * Update the "aria-expanded" attribute on the trigger anytime the controlled post-collapsible is toggled
69
- */
70
- setAriaExpanded(e) {
71
- if (!this.trigger || !e.target.isEqualNode(this.collapsible))
72
- return;
73
- this.trigger.setAttribute('aria-expanded', `${e.detail}`);
74
- }
75
- /**
76
- * Update the "aria-controls" and "aria-expanded" attributes on the trigger button
77
- */
78
- async update() {
79
- this.debouncedUpdate();
80
- }
81
- /**
82
- * Toggle the post-collapsible controlled by the trigger
83
- */
84
- async toggleCollapsible() {
85
- var _a;
86
- await ((_a = this.collapsible) === null || _a === void 0 ? void 0 : _a.toggle());
87
- }
88
- /**
89
- * Retrieve the post-collapsible controlled by the trigger
90
- */
91
- get collapsible() {
92
- const ref = document.getElementById(this.for);
93
- if (ref && ref.localName === 'post-collapsible') {
94
- return ref;
95
- }
96
- return null;
97
- }
98
- /**
99
- * Find the button and add the proper event listener and ARIA attributes to it
100
- */
101
- setTrigger() {
102
- const trigger = this.host.querySelector('button');
103
- if (!trigger || (this.trigger && trigger.isEqualNode(this.trigger)))
104
- return;
105
- this.trigger = trigger;
106
- this.trigger.addEventListener('click', () => this.toggleCollapsible());
107
- this.setAriaAttributes();
108
- }
109
- get host() { return index.getElement(this); }
110
- static get watchers() { return {
111
- "for": ["setAriaAttributes"]
112
- }; }
113
- };
114
-
115
- exports.PostCollapsibleTrigger = PostCollapsibleTrigger;
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const postCollapsible = require('./post-collapsible-d71942e3.js');
6
- require('./index-1cc8e4e1.js');
7
- require('./package-549b9aab.js');
8
- require('./index-f32e5185.js');
9
- require('./constants-238701d3.js');
10
- require('./check-one-of-f4f5d0c0.js');
11
- require('./check-type-64af82a9.js');
12
-
13
-
14
-
15
- exports.post_collapsible = postCollapsible.PostCollapsible;
@@ -1,14 +0,0 @@
1
- function checkType(value, type, error) {
2
- const typeIsArray = type === 'array';
3
- const valueIsArray = Array.isArray(value);
4
- if (typeIsArray || valueIsArray) {
5
- if (valueIsArray !== typeIsArray)
6
- throw new Error(error);
7
- }
8
- else {
9
- if (typeof value !== type)
10
- throw new Error(error);
11
- }
12
- }
13
-
14
- export { checkType as c };
@@ -1,85 +0,0 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-9ace3232.js';
2
- import { v as version } from './package-91140d77.js';
3
- import { b as checkEmptyOrType } from './index-29d17d6d.js';
4
-
5
- function isMotionReduced() {
6
- return window.matchMedia('(prefers-reduced-motion: reduce)').matches;
7
- }
8
-
9
- const collapseDuration = 350;
10
- const collapseEasing = 'ease';
11
- const collapsedKeyframe = { height: '0', overflow: 'hidden' };
12
- const animationOptions = {
13
- duration: collapseDuration,
14
- easing: collapseEasing,
15
- fill: 'forwards',
16
- };
17
- const collapse = (el) => {
18
- const expandedKeyframe = { height: window.getComputedStyle(el).height };
19
- return el.animate([expandedKeyframe, collapsedKeyframe], animationOptions);
20
- };
21
- const expand = (el) => {
22
- const expandedKeyframe = { height: `${el.scrollHeight}px`, offset: 1 };
23
- const finalKeyframe = { height: 'auto' };
24
- return el.animate([collapsedKeyframe, expandedKeyframe, finalKeyframe], animationOptions);
25
- };
26
-
27
- const postCollapsibleCss = ":host{display:block;overflow:hidden}";
28
- const PostCollapsibleStyle0 = postCollapsibleCss;
29
-
30
- const PostCollapsible = class {
31
- constructor(hostRef) {
32
- registerInstance(this, hostRef);
33
- this.postToggle = createEvent(this, "postToggle", 7);
34
- this.isLoaded = false;
35
- this.isOpen = true;
36
- this.collapsed = false;
37
- }
38
- validateCollapsed(newValue = this.collapsed) {
39
- checkEmptyOrType(newValue, 'boolean', 'The `collapsed` property of the `post-collapsible` must be a boolean.');
40
- }
41
- connectedCallback() {
42
- this.validateCollapsed();
43
- }
44
- componentDidLoad() {
45
- if (this.collapsed)
46
- void this.toggle(false);
47
- this.isLoaded = true;
48
- this.updateTriggers();
49
- }
50
- /**
51
- * Triggers the collapse programmatically.
52
- *
53
- * If there is a collapsing transition running already, it will be reversed.
54
- */
55
- async toggle(open = !this.isOpen) {
56
- if (open === this.isOpen)
57
- return open;
58
- this.isOpen = !this.isOpen;
59
- if (this.isLoaded)
60
- this.postToggle.emit(this.isOpen);
61
- const animation = open ? expand(this.host) : collapse(this.host);
62
- if (!this.isLoaded || isMotionReduced())
63
- animation.finish();
64
- await animation.finished;
65
- animation.commitStyles();
66
- return this.isOpen;
67
- }
68
- /**
69
- * Update all post-collapsible-trigger elements referring to the collapsible
70
- */
71
- updateTriggers() {
72
- const triggers = document.querySelectorAll(`post-collapsible-trigger[for=${this.host.id}]`);
73
- triggers.forEach(trigger => trigger.update());
74
- }
75
- render() {
76
- return (h(Host, { key: 'c24a0524427d6ec5a3a57e12300a5af4cc047a71', "data-version": version }, h("slot", { key: '4d41b67a18ca43acfa0e9ef208c07fa7882baba2' })));
77
- }
78
- get host() { return getElement(this); }
79
- static get watchers() { return {
80
- "collapsed": ["validateCollapsed"]
81
- }; }
82
- };
83
- PostCollapsible.style = PostCollapsibleStyle0;
84
-
85
- export { PostCollapsible as P };
@@ -1,113 +0,0 @@
1
- import { r as registerInstance, g as getElement } from './index-9ace3232.js';
2
- import { v as version } from './package-91140d77.js';
3
- import { c as checkType } from './check-type-8828dbe4.js';
4
- import { c as checkNonEmpty } from './check-non-empty-58bd6b17.js';
5
-
6
- function debounce(callback, timeout = 200) {
7
- let id;
8
- return (...args) => {
9
- if (id)
10
- clearTimeout(id);
11
- id = setTimeout(callback, timeout, ...args);
12
- };
13
- }
14
-
15
- const PostCollapsibleTrigger = class {
16
- constructor(hostRef) {
17
- registerInstance(this, hostRef);
18
- this.observer = new MutationObserver(() => this.setTrigger());
19
- this.debouncedUpdate = debounce(() => {
20
- var _a;
21
- if (!this.trigger)
22
- return;
23
- // add the provided id to the aria-controls list
24
- const ariaControls = this.trigger.getAttribute('aria-controls');
25
- if (!(ariaControls === null || ariaControls === void 0 ? void 0 : ariaControls.includes(this.for))) {
26
- const newAriaControls = ariaControls ? `${ariaControls} ${this.for}` : this.for;
27
- this.trigger.setAttribute('aria-controls', newAriaControls);
28
- }
29
- // set the aria-expanded to `false` if the controlled collapsible is collapsed or undefined, set it to `true` otherwise
30
- const isCollapsed = (_a = this.collapsible) === null || _a === void 0 ? void 0 : _a.collapsed;
31
- const newAriaExpanded = isCollapsed !== undefined ? !isCollapsed : undefined;
32
- this.trigger.setAttribute('aria-expanded', `${newAriaExpanded}`);
33
- });
34
- this.for = undefined;
35
- }
36
- /**
37
- * Set the "aria-controls" and "aria-expanded" attributes on the trigger to match the state of the controlled post-collapsible
38
- */
39
- setAriaAttributes() {
40
- checkNonEmpty(this.for, 'The post-collapsible-trigger "for" prop is required.');
41
- checkType(this.for, 'string', 'The post-collapsible-trigger "for" prop should be a id.');
42
- void this.update();
43
- }
44
- /**
45
- * Initiate a mutation observer that updates the trigger whenever necessary
46
- */
47
- connectedCallback() {
48
- this.observer.observe(this.host, { childList: true, subtree: true });
49
- }
50
- /**
51
- * Add the "data-version" to the host element and set the trigger
52
- */
53
- componentDidLoad() {
54
- this.host.setAttribute('data-version', version);
55
- this.setTrigger();
56
- if (!this.trigger)
57
- console.warn('The post-collapsible-trigger must contain a button.');
58
- }
59
- /**
60
- * Disconnect the mutation observer
61
- */
62
- disconnectedCallback() {
63
- this.observer.disconnect();
64
- }
65
- /**
66
- * Update the "aria-expanded" attribute on the trigger anytime the controlled post-collapsible is toggled
67
- */
68
- setAriaExpanded(e) {
69
- if (!this.trigger || !e.target.isEqualNode(this.collapsible))
70
- return;
71
- this.trigger.setAttribute('aria-expanded', `${e.detail}`);
72
- }
73
- /**
74
- * Update the "aria-controls" and "aria-expanded" attributes on the trigger button
75
- */
76
- async update() {
77
- this.debouncedUpdate();
78
- }
79
- /**
80
- * Toggle the post-collapsible controlled by the trigger
81
- */
82
- async toggleCollapsible() {
83
- var _a;
84
- await ((_a = this.collapsible) === null || _a === void 0 ? void 0 : _a.toggle());
85
- }
86
- /**
87
- * Retrieve the post-collapsible controlled by the trigger
88
- */
89
- get collapsible() {
90
- const ref = document.getElementById(this.for);
91
- if (ref && ref.localName === 'post-collapsible') {
92
- return ref;
93
- }
94
- return null;
95
- }
96
- /**
97
- * Find the button and add the proper event listener and ARIA attributes to it
98
- */
99
- setTrigger() {
100
- const trigger = this.host.querySelector('button');
101
- if (!trigger || (this.trigger && trigger.isEqualNode(this.trigger)))
102
- return;
103
- this.trigger = trigger;
104
- this.trigger.addEventListener('click', () => this.toggleCollapsible());
105
- this.setAriaAttributes();
106
- }
107
- get host() { return getElement(this); }
108
- static get watchers() { return {
109
- "for": ["setAriaAttributes"]
110
- }; }
111
- };
112
-
113
- export { PostCollapsibleTrigger as P };
@@ -1,6 +0,0 @@
1
- export { P as post_collapsible_trigger } from './post-collapsible-trigger-b0100e8c.js';
2
- import './index-9ace3232.js';
3
- import './package-91140d77.js';
4
- import './check-type-8828dbe4.js';
5
- import './check-non-empty-58bd6b17.js';
6
- import './constants-8d548297.js';