@swisspost/design-system-components 1.5.0 → 1.5.1

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 (88) hide show
  1. package/dist/cjs/package-112e1698.js +7 -0
  2. package/dist/cjs/package-112e1698.js.map +1 -0
  3. package/dist/cjs/post-alert.cjs.entry.js +3 -4
  4. package/dist/cjs/post-alert.cjs.entry.js.map +1 -1
  5. package/dist/cjs/post-collapsible.cjs.entry.js +2 -2
  6. package/dist/cjs/post-collapsible.cjs.entry.js.map +1 -1
  7. package/dist/cjs/post-icon.cjs.entry.js +2 -2
  8. package/dist/cjs/post-icon.cjs.entry.js.map +1 -1
  9. package/dist/cjs/post-tab-header.cjs.entry.js +3 -3
  10. package/dist/cjs/post-tab-header.cjs.entry.js.map +1 -1
  11. package/dist/cjs/post-tab-panel.cjs.entry.js +1 -1
  12. package/dist/cjs/post-tabs.cjs.entry.js +27 -8
  13. package/dist/cjs/post-tabs.cjs.entry.js.map +1 -1
  14. package/dist/cjs/post-tooltip.cjs.entry.js +2 -2
  15. package/dist/cjs/post-tooltip.cjs.entry.js.map +1 -1
  16. package/dist/collection/components/post-alert/post-alert.css +6 -534
  17. package/dist/collection/components/post-alert/post-alert.js +1 -2
  18. package/dist/collection/components/post-alert/post-alert.js.map +1 -1
  19. package/dist/collection/components/post-collapsible/post-collapsible.css +2 -234
  20. package/dist/collection/components/post-icon/post-icon.css +1 -102
  21. package/dist/collection/components/post-tab-header/post-tab-header.css +3 -337
  22. package/dist/collection/components/post-tab-header/post-tab-header.js +1 -1
  23. package/dist/collection/components/post-tab-header/post-tab-header.js.map +1 -1
  24. package/dist/collection/components/post-tab-panel/post-tab-panel.css +1 -3
  25. package/dist/collection/components/post-tabs/post-tabs.css +1 -148
  26. package/dist/collection/components/post-tabs/post-tabs.js +26 -7
  27. package/dist/collection/components/post-tabs/post-tabs.js.map +1 -1
  28. package/dist/collection/components/post-tooltip/post-tooltip.css +1 -194
  29. package/dist/components/package.js +1 -1
  30. package/dist/components/post-alert.js +2 -3
  31. package/dist/components/post-alert.js.map +1 -1
  32. package/dist/components/post-collapsible.js +1 -1
  33. package/dist/components/post-collapsible.js.map +1 -1
  34. package/dist/components/post-icon2.js +1 -1
  35. package/dist/components/post-icon2.js.map +1 -1
  36. package/dist/components/post-tab-header.js +2 -2
  37. package/dist/components/post-tab-header.js.map +1 -1
  38. package/dist/components/post-tabs.js +26 -7
  39. package/dist/components/post-tabs.js.map +1 -1
  40. package/dist/components/post-tooltip.js +1 -1
  41. package/dist/components/post-tooltip.js.map +1 -1
  42. package/dist/docs.json +1 -1
  43. package/dist/esm/package-331628f1.js +5 -0
  44. package/dist/esm/package-331628f1.js.map +1 -0
  45. package/dist/esm/post-alert.entry.js +3 -4
  46. package/dist/esm/post-alert.entry.js.map +1 -1
  47. package/dist/esm/post-collapsible.entry.js +2 -2
  48. package/dist/esm/post-collapsible.entry.js.map +1 -1
  49. package/dist/esm/post-icon.entry.js +2 -2
  50. package/dist/esm/post-icon.entry.js.map +1 -1
  51. package/dist/esm/post-tab-header.entry.js +3 -3
  52. package/dist/esm/post-tab-header.entry.js.map +1 -1
  53. package/dist/esm/post-tab-panel.entry.js +1 -1
  54. package/dist/esm/post-tabs.entry.js +27 -8
  55. package/dist/esm/post-tabs.entry.js.map +1 -1
  56. package/dist/esm/post-tooltip.entry.js +2 -2
  57. package/dist/esm/post-tooltip.entry.js.map +1 -1
  58. package/dist/post-components/p-0d37fe44.entry.js +2 -0
  59. package/dist/post-components/p-0d37fe44.entry.js.map +1 -0
  60. package/dist/post-components/p-123bb6fb.entry.js +2 -0
  61. package/dist/post-components/p-123bb6fb.entry.js.map +1 -0
  62. package/dist/post-components/{p-29535fea.entry.js → p-65a9d1c2.entry.js} +2 -2
  63. package/dist/post-components/p-7240ae7b.entry.js +2 -0
  64. package/dist/post-components/{p-cc6e4eb8.entry.js.map → p-7240ae7b.entry.js.map} +1 -1
  65. package/dist/post-components/{p-2b6ab354.entry.js → p-8c386036.entry.js} +3 -3
  66. package/dist/post-components/{p-2b6ab354.entry.js.map → p-8c386036.entry.js.map} +1 -1
  67. package/dist/post-components/p-97a064da.entry.js +2 -0
  68. package/dist/post-components/{p-12046db8.entry.js.map → p-97a064da.entry.js.map} +1 -1
  69. package/dist/post-components/p-ccae1c68.entry.js +2 -0
  70. package/dist/post-components/{p-a14ec7bb.entry.js.map → p-ccae1c68.entry.js.map} +1 -1
  71. package/dist/post-components/p-eb3ff4dc.js +2 -0
  72. package/dist/post-components/post-components.esm.js +1 -1
  73. package/dist/types/components/post-tabs/post-tabs.d.ts +1 -0
  74. package/package.json +2 -2
  75. package/dist/cjs/package-67091813.js +0 -7
  76. package/dist/cjs/package-67091813.js.map +0 -1
  77. package/dist/esm/package-f5cb3167.js +0 -5
  78. package/dist/esm/package-f5cb3167.js.map +0 -1
  79. package/dist/post-components/p-12046db8.entry.js +0 -2
  80. package/dist/post-components/p-24b07f64.js +0 -2
  81. package/dist/post-components/p-296af738.entry.js +0 -2
  82. package/dist/post-components/p-296af738.entry.js.map +0 -1
  83. package/dist/post-components/p-a14ec7bb.entry.js +0 -2
  84. package/dist/post-components/p-c7497ecb.entry.js +0 -2
  85. package/dist/post-components/p-c7497ecb.entry.js.map +0 -1
  86. package/dist/post-components/p-cc6e4eb8.entry.js +0 -2
  87. /package/dist/post-components/{p-29535fea.entry.js.map → p-65a9d1c2.entry.js.map} +0 -0
  88. /package/dist/post-components/{p-24b07f64.js.map → p-eb3ff4dc.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{r as o,h as t,H as r,g as a}from"./p-d94db268.js";import{v as b}from"./p-eb3ff4dc.js";import{c as e}from"./p-c8efe0ae.js";const c='.tab-title[role=tab]{display:inline-block;position:relative;box-sizing:border-box;padding:1rem;transition:background-color 100ms;border-right:1px solid rgba(0,0,0,0);border-left:1px solid rgba(0,0,0,0);outline-color:currentColor;opacity:.7;color:var(--post-contrast-color);text-decoration:none}.tab-title[role=tab]:focus{background-color:unset;color:var(--post-contrast-color)}.tab-title[role=tab]:hover{opacity:1;background-color:#fff;color:var(--post-contrast-color)}.tab-title[role=tab]:focus-visible{outline:rgba(0,0,0,0);opacity:1;background-color:#fff;color:var(--post-contrast-color);box-shadow:none}.tab-title[role=tab]:focus-visible::after{content:"";display:block;position:absolute;top:2px;right:1px;bottom:0;left:1px;box-shadow:0 0 0 1px #fff,0 0 0 2px #333}.tab-title[role=tab].active{z-index:1;border-right-color:#ccc;border-left-color:#ccc;opacity:1;background-color:#fff;color:var(--post-contrast-color);font-weight:700}.tab-title[role=tab].active::before{content:"";display:block;position:absolute;top:0;right:-1px;left:-1px;height:.25rem;background-color:#fc0}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:hover{background-color:rgba(255,255,255,.2)}:is(.bg-dark,.bg-primary,.bg-black,.bg-danger,.bg-nightblue,.bg-nightblue-bright,.bg-petrol,.bg-coral,.bg-olive,.bg-purple,.bg-purple-bright,.bg-aubergine,.bg-aubergine-bright) .tab-title[role=tab]:focus-visible{background-color:rgba(255,255,255,.2)}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tab-title[role=tab]{opacity:1;border-left-color:Canvas;border-right-color:Canvas;color:LinkText}.tab-title[role=tab]:hover,.tab-title[role=tab]:focus,.tab-title[role=tab]:focus-within,.tab-title[role=tab]:focus-visible{outline:2px solid Highlight;outline-offset:-0.25rem}.tab-title[role=tab].active{border-left-color:ButtonText;border-right-color:ButtonText;color:Highlight}.tab-title[role=tab].active::before{background-color:Highlight}}.bg-yellow .tab-title{background-color:#fc0}.bg-yellow .tab-title.active{background-color:#fc0}.bg-yellow .nav-item{background-color:#fc0}.bg-light .tab-title{background-color:#faf9f8}.bg-light .tab-title.active{background-color:#faf9f8}.bg-light .nav-item{background-color:#faf9f8}.bg-gray .tab-title{background-color:#f4f3f1}.bg-gray .tab-title.active{background-color:#f4f3f1}.bg-gray .nav-item{background-color:#f4f3f1}.bg-dark .tab-title{background-color:#333}.bg-dark .tab-title.active{background-color:#333}.bg-dark .nav-item{background-color:#333}.bg-primary .tab-title{background-color:#333}.bg-primary .tab-title.active{background-color:#333}.bg-primary .nav-item{background-color:#333}.bg-white .tab-title{background-color:#fff}.bg-white .tab-title.active{background-color:#fff}.bg-white .nav-item{background-color:#fff}.bg-black .tab-title{background-color:#000}.bg-black .tab-title.active{background-color:#000}.bg-black .nav-item{background-color:#000}.bg-success .tab-title{background-color:#2c911c}.bg-success .tab-title.active{background-color:#2c911c}.bg-success .nav-item{background-color:#2c911c}.bg-info .tab-title{background-color:#cce4ee}.bg-info .tab-title.active{background-color:#cce4ee}.bg-info .nav-item{background-color:#cce4ee}.bg-warning .tab-title{background-color:#f49e00}.bg-warning .tab-title.active{background-color:#f49e00}.bg-warning .nav-item{background-color:#f49e00}.bg-danger .tab-title{background-color:#a51728}.bg-danger .tab-title.active{background-color:#a51728}.bg-danger .nav-item{background-color:#a51728}.bg-nightblue .tab-title{background-color:#004976}.bg-nightblue .tab-title.active{background-color:#004976}.bg-nightblue .nav-item{background-color:#004976}.bg-nightblue-bright .tab-title{background-color:#0076a8}.bg-nightblue-bright .tab-title.active{background-color:#0076a8}.bg-nightblue-bright .nav-item{background-color:#0076a8}.bg-petrol .tab-title{background-color:#006d68}.bg-petrol .tab-title.active{background-color:#006d68}.bg-petrol .nav-item{background-color:#006d68}.bg-petrol-bright .tab-title{background-color:#00968f}.bg-petrol-bright .tab-title.active{background-color:#00968f}.bg-petrol-bright .nav-item{background-color:#00968f}.bg-coral .tab-title{background-color:#9e2a2f}.bg-coral .tab-title.active{background-color:#9e2a2f}.bg-coral .nav-item{background-color:#9e2a2f}.bg-coral-bright .tab-title{background-color:#e03c31}.bg-coral-bright .tab-title.active{background-color:#e03c31}.bg-coral-bright .nav-item{background-color:#e03c31}.bg-olive .tab-title{background-color:#716135}.bg-olive .tab-title.active{background-color:#716135}.bg-olive .nav-item{background-color:#716135}.bg-olive-bright .tab-title{background-color:#aa9d2e}.bg-olive-bright .tab-title.active{background-color:#aa9d2e}.bg-olive-bright .nav-item{background-color:#aa9d2e}.bg-purple .tab-title{background-color:#80276c}.bg-purple .tab-title.active{background-color:#80276c}.bg-purple .nav-item{background-color:#80276c}.bg-purple-bright .tab-title{background-color:#c5299b}.bg-purple-bright .tab-title.active{background-color:#c5299b}.bg-purple-bright .nav-item{background-color:#c5299b}.bg-aubergine .tab-title{background-color:#523178}.bg-aubergine .tab-title.active{background-color:#523178}.bg-aubergine .nav-item{background-color:#523178}.bg-aubergine-bright .tab-title{background-color:#7566a0}.bg-aubergine-bright .tab-title.active{background-color:#7566a0}.bg-aubergine-bright .nav-item{background-color:#7566a0}[class*=bg-] .tab-title.active:focus::after{background-color:rgba(255,255,255,.2)}@supports selector(*:focus-visible){[class*=bg-] .tab-title.active:focus::after{background-color:unset}[class*=bg-] .tab-title.active:focus-visible::after{background-color:rgba(255,255,255,.2)}}/*!\n * Copyright 2021 by Swiss Post, Information Technology\n */:host{display:block}.tab-title{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;user-select:none;appearance:button}';const l=class{constructor(t){o(this,t);this.tabId=undefined;this.panel=undefined}validateFor(o){e(o,'The "panel" prop is required for the post-tab-header.')}componentWillLoad(){this.tabId=`tab-${this.host.id||crypto.randomUUID()}`}render(){return t(r,{"data-version":b},t("button",{"aria-selected":"false",class:"tab-title",id:this.tabId,role:"tab",tabindex:"-1",type:"button"},t("slot",null)))}get host(){return a(this)}static get watchers(){return{panel:["validateFor"]}}};l.style=c;export{l as post_tab_header};
2
+ //# sourceMappingURL=p-0d37fe44.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["postTabHeaderCss","PostTabHeader","validateFor","newValue","checkNonEmpty","componentWillLoad","this","tabId","host","id","crypto","randomUUID","render","h","Host","version","class","role","tabindex","type"],"sources":["./src/components/post-tab-header/post-tab-header.scss?tag=post-tab-header&encapsulation=shadow","./src/components/post-tab-header/post-tab-header.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tab-title';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n}\n\n.tab-title {\n @include post.reset-button;\n}\n","import { Component, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { checkNonEmpty } from '../../utils';\n\n@Component({\n tag: 'post-tab-header',\n styleUrl: 'post-tab-header.scss',\n shadow: true,\n})\nexport class PostTabHeader {\n @Element() host: HTMLPostTabHeaderElement;\n\n @State() tabId: string;\n\n /**\n * The name of the panel controlled by the tab header.\n */\n @Prop() readonly panel: HTMLPostTabPanelElement['name'];\n\n @Watch('panel')\n validateFor(newValue: HTMLPostTabPanelElement['name']) {\n checkNonEmpty(newValue, 'The \"panel\" prop is required for the post-tab-header.');\n }\n\n componentWillLoad() {\n this.tabId = `tab-${this.host.id || crypto.randomUUID()}`;\n }\n\n render() {\n return (\n <Host data-version={version}>\n <button aria-selected=\"false\" class=\"tab-title\" id={this.tabId} role=\"tab\" tabindex=\"-1\" type=\"button\">\n <slot />\n </button>\n </Host>\n );\n }\n}\n"],"mappings":"iIAAA,MAAMA,EAAmB,46L,MCSZC,EAAa,M,mEAWxBC,YAAYC,GACVC,EAAcD,EAAU,wD,CAG1BE,oBACEC,KAAKC,MAAQ,OAAOD,KAAKE,KAAKC,IAAMC,OAAOC,c,CAG7CC,SACE,OACEC,EAACC,EAAI,gBAAeC,GAClBF,EAAA,0BAAsB,QAAQG,MAAM,YAAYP,GAAIH,KAAKC,MAAOU,KAAK,MAAMC,SAAS,KAAKC,KAAK,UAC5FN,EAAA,c"}
@@ -0,0 +1,2 @@
1
+ import{r as t,c as a,h as r,H as o,g as s}from"./p-d94db268.js";import{v as e}from"./p-eb3ff4dc.js";import{f as i,a as b}from"./p-e5306504.js";const c='.tabs-wrapper{position:relative;padding-top:1rem;border:0;background-color:#faf9f8}.tabs-wrapper::after{content:"";position:absolute;bottom:0;width:100%;height:1px;background-color:#ccc}.tabs-wrapper .tabs{background-color:rgba(0,0,0,0) !important}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.tabs-wrapper::after{background-color:ButtonBorder}}.tabs{margin:0;padding:0;list-style:none;display:flex;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;white-space:nowrap}.tabs::after{content:"";display:block;flex:1 0 auto;width:1rem}.tab-content{padding-top:1rem;padding-bottom:1rem}.bg-yellow .tabs-wrapper{background-color:#fc0}.bg-light .tabs-wrapper{background-color:#faf9f8}.bg-gray .tabs-wrapper{background-color:#f4f3f1}.bg-dark .tabs-wrapper{background-color:#333}.bg-primary .tabs-wrapper{background-color:#333}.bg-white .tabs-wrapper{background-color:#fff}.bg-black .tabs-wrapper{background-color:#000}.bg-success .tabs-wrapper{background-color:#2c911c}.bg-info .tabs-wrapper{background-color:#cce4ee}.bg-warning .tabs-wrapper{background-color:#f49e00}.bg-danger .tabs-wrapper{background-color:#a51728}.bg-nightblue .tabs-wrapper{background-color:#004976}.bg-nightblue-bright .tabs-wrapper{background-color:#0076a8}.bg-petrol .tabs-wrapper{background-color:#006d68}.bg-petrol-bright .tabs-wrapper{background-color:#00968f}.bg-coral .tabs-wrapper{background-color:#9e2a2f}.bg-coral-bright .tabs-wrapper{background-color:#e03c31}.bg-olive .tabs-wrapper{background-color:#716135}.bg-olive-bright .tabs-wrapper{background-color:#aa9d2e}.bg-purple .tabs-wrapper{background-color:#80276c}.bg-purple-bright .tabs-wrapper{background-color:#c5299b}.bg-aubergine .tabs-wrapper{background-color:#523178}.bg-aubergine-bright .tabs-wrapper{background-color:#7566a0}:host{display:block}';const n=class{constructor(r){t(this,r);this.tabChange=a(this,"tabChange",7);this.isLoaded=false;this.activePanel=undefined}get tabs(){return this.host.querySelectorAll("post-tab-header")}componentDidLoad(){this.moveMisplacedTabs();this.enableTabs();const t=this.activePanel||this.tabs.item(0).panel;void this.show(t);this.isLoaded=true}async show(t){var a;if(t===((a=this.activeTab)===null||a===void 0?void 0:a.panel)){return}const r=this.activeTab;const o=this.host.querySelector(`post-tab-header[panel=${t}]`);this.activateTab(o);if(this.showing){this.showing.effect["target"].style.display="none";this.showing.finish()}if(r&&!this.showing&&!this.hiding){this.hidePanel(r.panel)}if(this.hiding){await this.hiding.finished}this.showSelectedPanel();if(this.showing){await this.showing.finished}this.tabChange.emit(this.activeTab.panel)}moveMisplacedTabs(){if(!this.tabs)return;this.tabs.forEach((t=>{if(t.getAttribute("slot")==="tabs")return;t.setAttribute("slot","tabs")}))}enableTabs(){if(!this.tabs)return;this.tabs.forEach((async t=>{await t.componentOnReady();const a=t.shadowRoot.querySelector(".tab-title");if(a.getAttribute("aria-controls"))return;const r=this.getPanel(t.panel).shadowRoot.querySelector(".tab-pane");a.setAttribute("aria-controls",r.id);r.setAttribute("aria-labelledby",a.id);t.addEventListener("click",(()=>{void this.show(t.panel)}));t.addEventListener("keydown",(({key:a})=>{if(a==="ArrowRight"||a==="ArrowLeft")this.navigateTabs(t,a)}))}));if(this.activeTab&&!this.activeTab.isConnected){void this.show(this.tabs.item(0).panel)}}activateTab(t){if(this.activeTab){const t=this.activeTab.shadowRoot.querySelector(".tab-title");t.setAttribute("aria-selected","false");t.setAttribute("tabindex","-1");t.classList.remove("active")}const a=t.shadowRoot.querySelector(".tab-title");a.setAttribute("aria-selected","true");a.removeAttribute("tabindex");a.classList.add("active");this.activeTab=t}hidePanel(t){const a=this.getPanel(t);if(!a)return;this.hiding=i(a);this.hiding.onfinish=()=>{a.style.display="none";this.hiding=null}}showSelectedPanel(){const t=this.getPanel(this.activeTab.panel);t.style.display="block";if(!this.isLoaded)return;this.showing=b(t);this.showing.onfinish=()=>{this.showing=null}}getPanel(t){return this.host.querySelector(`post-tab-panel[name=${t}]`)}navigateTabs(t,a){const r=Array.from(this.tabs).indexOf(t);let o;if(a==="ArrowRight"){o=this.tabs[r+1]||this.tabs[0]}else{o=this.tabs[r-1]||this.tabs[this.tabs.length-1]}if(!o)return;const s=o.shadowRoot.querySelector(".tab-title");s.focus()}render(){return r(o,{"data-version":e},r("div",{class:"tabs-wrapper"},r("div",{class:"tabs",role:"tablist"},r("slot",{name:"tabs",onSlotchange:()=>this.enableTabs()}))),r("div",{class:"tab-content"},r("slot",{onSlotchange:()=>this.moveMisplacedTabs()})))}get host(){return s(this)}};n.style=c;export{n as post_tabs};
2
+ //# sourceMappingURL=p-123bb6fb.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["postTabsCss","PostTabs","this","isLoaded","tabs","host","querySelectorAll","componentDidLoad","moveMisplacedTabs","enableTabs","initiallyActivePanel","activePanel","item","panel","show","async","panelName","_a","activeTab","previousTab","newTab","querySelector","activateTab","showing","effect","style","display","finish","hiding","hidePanel","finished","showSelectedPanel","tabChange","emit","forEach","tab","getAttribute","setAttribute","componentOnReady","tabTitle","shadowRoot","tabPanel","getPanel","id","addEventListener","key","navigateTabs","isConnected","classList","remove","removeAttribute","add","previousPanel","fadeOut","onfinish","fadeIn","name","activeTabIndex","Array","from","indexOf","nextTab","length","nextTabTitle","focus","render","h","Host","version","class","role","onSlotchange"],"sources":["./src/components/post-tabs/post-tabs.scss?tag=post-tabs&encapsulation=shadow","./src/components/post-tabs/post-tabs.tsx"],"sourcesContent":["@use '@swisspost/design-system-styles/components/tabs/tabs-wrapper';\n\n:host {\n display: block;\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeIn, fadeOut } from '../../animations';\n\n@Component({\n tag: 'post-tabs',\n styleUrl: 'post-tabs.scss',\n shadow: true,\n})\nexport class PostTabs {\n private activeTab: HTMLPostTabHeaderElement;\n private showing: Animation;\n private hiding: Animation;\n private isLoaded = false;\n\n private get tabs(): NodeListOf<HTMLPostTabHeaderElement> {\n return this.host.querySelectorAll('post-tab-header');\n }\n\n @Element() host: HTMLPostTabsElement;\n\n /**\n * The name of the panel that is initially shown.\n * If not specified, it defaults to the panel associated with the first tab.\n *\n * **Changing this value after initialization has no effect.**\n */\n @Prop() readonly activePanel: HTMLPostTabPanelElement['name'];\n\n /**\n * An event emitted after the active tab changes, when the fade in transition of its associated panel is finished.\n * The payload is the name of the newly shown panel.\n */\n @Event() tabChange: EventEmitter<HTMLPostTabPanelElement['name']>;\n\n componentDidLoad() {\n this.moveMisplacedTabs();\n this.enableTabs();\n\n const initiallyActivePanel = this.activePanel || this.tabs.item(0).panel;\n void this.show(initiallyActivePanel);\n\n this.isLoaded = true;\n }\n\n /**\n * Shows the panel with the given name and selects its associated tab.\n * Any other panel that was previously shown becomes hidden and its associated tab is unselected.\n */\n @Method()\n async show(panelName: string) {\n // do nothing if the tab is already active\n if (panelName === this.activeTab?.panel) {\n return;\n }\n\n const previousTab = this.activeTab;\n const newTab: HTMLPostTabHeaderElement = this.host.querySelector(\n `post-tab-header[panel=${panelName}]`,\n );\n this.activateTab(newTab);\n\n // if a panel is currently being displayed, remove it from the view and complete the associated animation\n if (this.showing) {\n this.showing.effect['target'].style.display = 'none';\n this.showing.finish();\n }\n\n // hide the currently visible panel only if no other animation is running\n if (previousTab && !this.showing && !this.hiding) {\n this.hidePanel(previousTab.panel);\n }\n\n // wait for any hiding animation to complete before showing the selected tab\n if (this.hiding) {\n await this.hiding.finished;\n }\n\n this.showSelectedPanel();\n\n // wait for any display animation to complete for the returned promise to fully resolve\n if (this.showing) {\n await this.showing.finished;\n }\n\n this.tabChange.emit(this.activeTab.panel);\n }\n\n private moveMisplacedTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(tab => {\n if (tab.getAttribute('slot') === 'tabs') return;\n tab.setAttribute('slot', 'tabs');\n });\n }\n\n private enableTabs() {\n if (!this.tabs) return;\n\n this.tabs.forEach(async tab => {\n await tab.componentOnReady();\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n\n // if the tab has an \"aria-controls\" attribute it was already linked to its panel: do nothing\n if (tabTitle.getAttribute('aria-controls')) return;\n\n const tabPanel = this.getPanel(tab.panel).shadowRoot.querySelector('.tab-pane');\n tabTitle.setAttribute('aria-controls', tabPanel.id);\n tabPanel.setAttribute('aria-labelledby', tabTitle.id);\n\n tab.addEventListener('click', () => {\n void this.show(tab.panel);\n });\n\n tab.addEventListener('keydown', ({ key }) => {\n if (key === 'ArrowRight' || key === 'ArrowLeft') this.navigateTabs(tab, key);\n });\n });\n\n // if the currently active tab was removed from the DOM then select the first one\n if (this.activeTab && !this.activeTab.isConnected) {\n void this.show(this.tabs.item(0).panel);\n }\n }\n\n private activateTab(tab: HTMLPostTabHeaderElement) {\n if (this.activeTab) {\n const tabTitle = this.activeTab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'false');\n tabTitle.setAttribute('tabindex', '-1');\n tabTitle.classList.remove('active');\n }\n\n const tabTitle = tab.shadowRoot.querySelector('.tab-title');\n tabTitle.setAttribute('aria-selected', 'true');\n tabTitle.removeAttribute('tabindex');\n tabTitle.classList.add('active');\n\n this.activeTab = tab;\n }\n\n private hidePanel(panelName: HTMLPostTabPanelElement['name']) {\n const previousPanel = this.getPanel(panelName);\n\n if (!previousPanel) return;\n\n this.hiding = fadeOut(previousPanel);\n this.hiding.onfinish = () => {\n previousPanel.style.display = 'none';\n this.hiding = null;\n };\n }\n\n private showSelectedPanel() {\n const panel = this.getPanel(this.activeTab.panel);\n panel.style.display = 'block';\n\n // prevent the initially selected panel from fading in\n if (!this.isLoaded) return;\n\n this.showing = fadeIn(panel);\n this.showing.onfinish = () => {\n this.showing = null;\n };\n }\n\n private getPanel(name: string): HTMLPostTabPanelElement {\n return this.host.querySelector(`post-tab-panel[name=${name}]`);\n }\n\n private navigateTabs(tab: HTMLPostTabHeaderElement, key: 'ArrowRight' | 'ArrowLeft') {\n const activeTabIndex = Array.from(this.tabs).indexOf(tab);\n\n let nextTab: HTMLPostTabHeaderElement;\n if (key === 'ArrowRight') {\n nextTab = this.tabs[activeTabIndex + 1] || this.tabs[0];\n } else {\n nextTab = this.tabs[activeTabIndex - 1] || this.tabs[this.tabs.length - 1];\n }\n\n if (!nextTab) return;\n\n const nextTabTitle = nextTab.shadowRoot.querySelector('.tab-title') as HTMLAnchorElement;\n nextTabTitle.focus();\n }\n\n render() {\n return (\n <Host data-version={version}>\n <div class=\"tabs-wrapper\">\n <div class=\"tabs\" role=\"tablist\">\n <slot name=\"tabs\" onSlotchange={() => this.enableTabs()} />\n </div>\n </div>\n <div class=\"tab-content\">\n <slot onSlotchange={() => this.moveMisplacedTabs()} />\n </div>\n </Host>\n );\n }\n}\n"],"mappings":"+IAAA,MAAMA,EAAc,szD,MCSPC,EAAQ,M,8DAIXC,KAAAC,SAAW,M,2BAEPC,WACV,OAAOF,KAAKG,KAAKC,iBAAiB,kB,CAmBpCC,mBACEL,KAAKM,oBACLN,KAAKO,aAEL,MAAMC,EAAuBR,KAAKS,aAAeT,KAAKE,KAAKQ,KAAK,GAAGC,WAC9DX,KAAKY,KAAKJ,GAEfR,KAAKC,SAAW,I,CAQlBY,WAAWC,G,MAET,GAAIA,MAAcC,EAAAf,KAAKgB,aAAS,MAAAD,SAAA,SAAAA,EAAEJ,OAAO,CACvC,M,CAGF,MAAMM,EAAcjB,KAAKgB,UACzB,MAAME,EAAmClB,KAAKG,KAAKgB,cACjD,yBAAyBL,MAE3Bd,KAAKoB,YAAYF,GAGjB,GAAIlB,KAAKqB,QAAS,CAChBrB,KAAKqB,QAAQC,OAAO,UAAUC,MAAMC,QAAU,OAC9CxB,KAAKqB,QAAQI,Q,CAIf,GAAIR,IAAgBjB,KAAKqB,UAAYrB,KAAK0B,OAAQ,CAChD1B,KAAK2B,UAAUV,EAAYN,M,CAI7B,GAAIX,KAAK0B,OAAQ,OACT1B,KAAK0B,OAAOE,Q,CAGpB5B,KAAK6B,oBAGL,GAAI7B,KAAKqB,QAAS,OACVrB,KAAKqB,QAAQO,Q,CAGrB5B,KAAK8B,UAAUC,KAAK/B,KAAKgB,UAAUL,M,CAG7BL,oBACN,IAAKN,KAAKE,KAAM,OAEhBF,KAAKE,KAAK8B,SAAQC,IAChB,GAAIA,EAAIC,aAAa,UAAY,OAAQ,OACzCD,EAAIE,aAAa,OAAQ,OAAO,G,CAI5B5B,aACN,IAAKP,KAAKE,KAAM,OAEhBF,KAAKE,KAAK8B,SAAQnB,MAAMoB,UAChBA,EAAIG,mBAEV,MAAMC,EAAWJ,EAAIK,WAAWnB,cAAc,cAG9C,GAAIkB,EAASH,aAAa,iBAAkB,OAE5C,MAAMK,EAAWvC,KAAKwC,SAASP,EAAItB,OAAO2B,WAAWnB,cAAc,aACnEkB,EAASF,aAAa,gBAAiBI,EAASE,IAChDF,EAASJ,aAAa,kBAAmBE,EAASI,IAElDR,EAAIS,iBAAiB,SAAS,UACvB1C,KAAKY,KAAKqB,EAAItB,MAAM,IAG3BsB,EAAIS,iBAAiB,WAAW,EAAGC,UACjC,GAAIA,IAAQ,cAAgBA,IAAQ,YAAa3C,KAAK4C,aAAaX,EAAKU,EAAI,GAC5E,IAIJ,GAAI3C,KAAKgB,YAAchB,KAAKgB,UAAU6B,YAAa,MAC5C7C,KAAKY,KAAKZ,KAAKE,KAAKQ,KAAK,GAAGC,M,EAI7BS,YAAYa,GAClB,GAAIjC,KAAKgB,UAAW,CAClB,MAAMqB,EAAWrC,KAAKgB,UAAUsB,WAAWnB,cAAc,cACzDkB,EAASF,aAAa,gBAAiB,SACvCE,EAASF,aAAa,WAAY,MAClCE,EAASS,UAAUC,OAAO,S,CAG5B,MAAMV,EAAWJ,EAAIK,WAAWnB,cAAc,cAC9CkB,EAASF,aAAa,gBAAiB,QACvCE,EAASW,gBAAgB,YACzBX,EAASS,UAAUG,IAAI,UAEvBjD,KAAKgB,UAAYiB,C,CAGXN,UAAUb,GAChB,MAAMoC,EAAgBlD,KAAKwC,SAAS1B,GAEpC,IAAKoC,EAAe,OAEpBlD,KAAK0B,OAASyB,EAAQD,GACtBlD,KAAK0B,OAAO0B,SAAW,KACrBF,EAAc3B,MAAMC,QAAU,OAC9BxB,KAAK0B,OAAS,IAAI,C,CAIdG,oBACN,MAAMlB,EAAQX,KAAKwC,SAASxC,KAAKgB,UAAUL,OAC3CA,EAAMY,MAAMC,QAAU,QAGtB,IAAKxB,KAAKC,SAAU,OAEpBD,KAAKqB,QAAUgC,EAAO1C,GACtBX,KAAKqB,QAAQ+B,SAAW,KACtBpD,KAAKqB,QAAU,IAAI,C,CAIfmB,SAASc,GACf,OAAOtD,KAAKG,KAAKgB,cAAc,uBAAuBmC,K,CAGhDV,aAAaX,EAA+BU,GAClD,MAAMY,EAAiBC,MAAMC,KAAKzD,KAAKE,MAAMwD,QAAQzB,GAErD,IAAI0B,EACJ,GAAIhB,IAAQ,aAAc,CACxBgB,EAAU3D,KAAKE,KAAKqD,EAAiB,IAAMvD,KAAKE,KAAK,E,KAChD,CACLyD,EAAU3D,KAAKE,KAAKqD,EAAiB,IAAMvD,KAAKE,KAAKF,KAAKE,KAAK0D,OAAS,E,CAG1E,IAAKD,EAAS,OAEd,MAAME,EAAeF,EAAQrB,WAAWnB,cAAc,cACtD0C,EAAaC,O,CAGfC,SACE,OACEC,EAACC,EAAI,gBAAeC,GAClBF,EAAA,OAAKG,MAAM,gBACTH,EAAA,OAAKG,MAAM,OAAOC,KAAK,WACrBJ,EAAA,QAAMV,KAAK,OAAOe,aAAc,IAAMrE,KAAKO,iBAG/CyD,EAAA,OAAKG,MAAM,eACTH,EAAA,QAAMK,aAAc,IAAMrE,KAAKM,uB"}
@@ -1,2 +1,2 @@
1
- import{r as s,h as t,H as n,g as o}from"./p-d94db268.js";import{v as a}from"./p-24b07f64.js";const e=":host{display:none}";const r=class{constructor(t){s(this,t);this.panelId=undefined;this.name=undefined}componentWillLoad(){this.panelId=`panel-${this.host.id||crypto.randomUUID()}`}render(){return t(n,{"data-version":a},t("div",{class:"tab-pane",id:this.panelId,role:"tabpanel"},t("slot",null)))}get host(){return o(this)}};r.style=e;export{r as post_tab_panel};
2
- //# sourceMappingURL=p-29535fea.entry.js.map
1
+ import{r as s,h as t,H as n,g as o}from"./p-d94db268.js";import{v as e}from"./p-eb3ff4dc.js";const a=":host{display:none}";const r=class{constructor(t){s(this,t);this.panelId=undefined;this.name=undefined}componentWillLoad(){this.panelId=`panel-${this.host.id||crypto.randomUUID()}`}render(){return t(n,{"data-version":e},t("div",{class:"tab-pane",id:this.panelId,role:"tabpanel"},t("slot",null)))}get host(){return o(this)}};r.style=a;export{r as post_tab_panel};
2
+ //# sourceMappingURL=p-65a9d1c2.entry.js.map
@@ -0,0 +1,2 @@
1
+ import{r as t,c as o,h as e,H as i,g as r}from"./p-d94db268.js";import{v as a}from"./p-eb3ff4dc.js";import{f as s}from"./p-e5306504.js";import{c as n,a as l}from"./p-15fc087f.js";import{c}from"./p-75a7b352.js";import{c as g}from"./p-c8efe0ae.js";import"./p-bcc705f1.js";const p=["primary","success","danger","warning","info","gray"];const h="/*!\n * Bootstrap Utilities v5.1.3 (https://getbootstrap.com/)\n * Copyright 2011-2021 The Bootstrap Authors\n * Copyright 2011-2021 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n\n * The MIT License (MIT)\n\n * Copyright (c) 2011-2020 Twitter, Inc.\n * Copyright (c) 2011-2020 The Bootstrap Authors\n\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */.alert-primary,.alert-success,.alert-danger,.alert-warning,.alert-info,.alert-gray,.alert-notification,.alert-error{background-color:rgb(var(--post-bg-rgb)) !important;color:var(--post-contrast-color) !important}.alert-success,.alert-warning,.alert-info,.alert-gray{--post-contrast-color:#000;--post-contrast-color-inverted:#fff;--post-gray-10:hsl(0, 0%, 90%);--post-gray-20:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-60:hsl(0, 0%, 40%);--post-gray-80:hsl(0, 0%, 20%);--post-yellow:#fc0;--post-light:#faf9f8;--post-gray:#f4f3f1;--post-dark:hsl(0, 0%, 20%);--post-primary:hsl(0, 0%, 20%);--post-white:#fff;--post-black:#000;--post-success:#2c911c;--post-info:#cce4ee;--post-warning:#f49e00;--post-danger:#a51728;--post-nightblue:#004976;--post-nightblue-bright:#0076a8;--post-petrol:#006d68;--post-petrol-bright:#00968f;--post-coral:#9e2a2f;--post-coral-bright:#e03c31;--post-olive:#716135;--post-olive-bright:#aa9d2e;--post-purple:#80276c;--post-purple-bright:#c5299b;--post-aubergine:#523178;--post-aubergine-bright:#7566a0;--post-contrast-color-rgb:0, 0, 0;--post-contrast-color-inverted-rgb:255, 255, 255;--post-gray-10-rgb:230, 230, 230;--post-gray-20-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-60-rgb:102, 102, 102;--post-gray-80-rgb:51, 51, 51;--post-yellow-rgb:255, 204, 0;--post-light-rgb:250, 249, 248;--post-gray-rgb:244, 243, 241;--post-dark-rgb:51, 51, 51;--post-primary-rgb:51, 51, 51;--post-white-rgb:255, 255, 255;--post-black-rgb:0, 0, 0;--post-success-rgb:44, 145, 28;--post-info-rgb:204, 228, 238;--post-warning-rgb:244, 158, 0;--post-danger-rgb:165, 23, 40;--post-nightblue-rgb:0, 73, 118;--post-nightblue-bright-rgb:0, 118, 168;--post-petrol-rgb:0, 109, 104;--post-petrol-bright-rgb:0, 150, 143;--post-coral-rgb:158, 42, 47;--post-coral-bright-rgb:224, 60, 49;--post-olive-rgb:113, 97, 53;--post-olive-bright-rgb:170, 157, 46;--post-purple-rgb:128, 39, 108;--post-purple-bright-rgb:197, 41, 155;--post-aubergine-rgb:82, 49, 120;--post-aubergine-bright-rgb:117, 102, 160}.alert-primary,.alert-danger,.alert-notification,.alert-error{--post-contrast-color:#fff;--post-contrast-color-inverted:#000;--post-dark:#faf9f8;--post-light:hsl(0, 0%, 20%);--post-gray-80:hsl(0, 0%, 90%);--post-gray-60:hsl(0, 0%, 80%);--post-gray-40:hsl(0, 0%, 60%);--post-gray-20:hsl(0, 0%, 40%);--post-gray-10:hsl(0, 0%, 20%);--post-contrast-color-rgb:255, 255, 255;--post-contrast-color-inverted-rgb:0, 0, 0;--post-dark-rgb:250, 249, 248;--post-light-rgb:51, 51, 51;--post-gray-80-rgb:230, 230, 230;--post-gray-60-rgb:204, 204, 204;--post-gray-40-rgb:153, 153, 153;--post-gray-20-rgb:102, 102, 102;--post-gray-10-rgb:51, 51, 51}.alert{position:relative;box-sizing:border-box;min-height:5rem;box-shadow:0 2px 4px 0 rgba(0,0,0,.2);border-radius:4px;padding:1rem 1.25rem;padding-inline-start:5.5rem;margin-block-end:1rem;font-size:1rem;font-weight:300}.alert.no-icon{min-height:3.5rem;padding-inline-start:1.25rem}.alert[class^=pi-],.alert[class*=\" pi-\"]{background-size:3rem;background-position:1.25rem 1rem;background-repeat:no-repeat}.alert[class^=pi-].no-icon,.alert[class*=\" pi-\"].no-icon{background-image:none}.alert::before{content:\"\";display:block}.alert::before,.alert>post-icon{position:absolute;height:3rem;width:3rem;left:1.25rem;top:1rem}.alert.no-icon::before,.alert[class^=pi-]::before,.alert[class*=\" pi-\"]::before{content:unset}.alert.no-icon>post-icon,.alert[class^=pi-]>post-icon,.alert[class*=\" pi-\"]>post-icon{display:none}@media (forced-colors: active),(-ms-high-contrast: active),(-ms-high-contrast: white-on-black){.alert{filter:none !important;background-color:rgba(0,0,0,0) !important;border:2px solid WindowText}}.alert:not(.alert-action){display:flex;flex-direction:column;justify-content:center;gap:.25rem}.alert:not(.alert-action) a{font-weight:400}.alert:not(.alert-action) hr{margin-block:.5rem .75rem !important}.alert:not(.alert-action)>:only-child,.alert:not(.alert-action)>post-icon:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert:not(.alert-action)>*{margin:0}.alert-heading{font-size:1.0625rem;font-weight:700}.alert-dismissible{pointer-events:auto;position:relative;padding-inline-end:4rem}.alert-dismissible>.btn-close{position:absolute;inset-block-start:1rem;inset-inline-end:1.25rem}.alert-dismissible>.btn-close:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert-action{display:flex;flex-direction:row;align-items:center;gap:1.25rem}.alert-action>.alert-content{flex:1 1 auto;display:flex;flex-direction:column;justify-content:center;gap:.25rem}.alert-action>.alert-content a{font-weight:400}.alert-action>.alert-content hr{margin-block:.5rem .75rem !important}.alert-action>.alert-content>:only-child,.alert-action>.alert-content>post-icon:first-child+:last-child{font-size:1.0625rem;font-weight:700}.alert-action>.alert-content>*{margin:0}.alert-action>.alert-buttons{flex:0 0 auto;display:flex;align-items:center;gap:.5rem}@media (min-width: 780px){.alert-action.alert-dismissible>.btn-close{inset-block-start:calc(50% - 0.75rem)}}@media (max-width: 779.98px){.alert-action{flex-direction:column;align-items:stretch;padding-inline:1.25rem}.alert-action>.alert-content{padding-inline-start:4.25rem;padding-inline-end:2.75rem}.alert-action>.alert-buttons{display:flex}.alert-action>.alert-buttons>.btn{flex:1 0 0;width:100%}.alert-action>.alert-buttons>.btn:first-child{margin-inline-start:0}}.alert-fixed-bottom{position:fixed;inset-block-end:0;inset-inline-start:0;inset-inline-end:0;margin-bottom:0;border-radius:0;z-index:1030}@media (min-width: 1441px){.alert-fixed-bottom{padding-inline-end:calc((100% - 1440px) / 2 + 120px + 1.25rem);padding-inline-start:calc(\n (100% - 1440px) / 2 + 120px + 1.25rem + 3rem + 1.25rem\n );background-position-x:calc((100% - 1440px) / 2 + 120px + 1.25rem + 1.5rem)}.alert-fixed-bottom::before{left:calc((100% - 1440px) / 2 + 120px + 1.25rem)}.alert-fixed-bottom.no-icon{padding-inline-start:calc((100% - 1440px) / 2 + 120px + 1.25rem)}.alert-fixed-bottom.alert-dismissible{padding-inline-end:calc(\n (100% - 1440px) / 2 + 120px + 1.25rem + 1.25rem + 1.5rem\n )}.alert-fixed-bottom.alert-dismissible>.btn-close{inset-inline-end:calc((100% - 1440px) / 2 + 120px + 1.25rem)}}.alert-primary{--post-bg-rgb:51, 51, 51}.alert-primary:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%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%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-primary>post-icon{background-color:#333}.alert-success{--post-bg-rgb:44, 145, 28}.alert-success:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%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/g%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%3Cg id='icon'%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/g%3E%3C/svg%3E\");background-color:currentColor}.alert-success>post-icon{background-color:#2c911c}.alert-danger{--post-bg-rgb:165, 23, 40}.alert-danger:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%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%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-danger>post-icon{background-color:#a51728}.alert-warning{--post-bg-rgb:244, 158, 0}.alert-warning:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%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%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-warning>post-icon{background-color:#f49e00}.alert-info{--post-bg-rgb:204, 228, 238}.alert-info:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M17.333 25.333v-16h-4.667V12h2v13.333h-2V28h6.667v-2.667zM14.667 4h2.667v2.667h-2.667V4z'/%3E%3C/g%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%3Cg id='icon'%3E%3Cpath d='M17.333 25.333v-16h-4.667V12h2v13.333h-2V28h6.667v-2.667zM14.667 4h2.667v2.667h-2.667V4z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-info>post-icon{background-color:#cce4ee}.alert-gray{--post-bg-rgb:244, 243, 241}.alert-gray:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.241 5.241 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.241 5.241 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-.27zM16 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.325 6.325 0 0 0-.325 1.997 6.598 6.598 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.667zM11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0c0-.735.599-1.333 1.334-1.333s1.333.598 1.333 1.333-.598 1.334-1.333 1.334-1.334-.598-1.334-1.334zm13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-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.333zm-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335zm7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0zm-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM28.93 18.548a13.19 13.19 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.266zm-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.647 11.647 0 0 0 2.359-.888.668.668 0 0 1 .896.294zM4 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.798 11.798 0 0 0 4 15.92z'/%3E%3C/g%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xml:space='preserve' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M31.986 15.73c-.503.16-1.03.27-1.586.27a5.241 5.241 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.241 5.241 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-.27zM16 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.325 6.325 0 0 0-.325 1.997 6.598 6.598 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.667zM11.352 14.17a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-4 0c0-.735.599-1.333 1.334-1.333s1.333.598 1.333 1.333-.598 1.334-1.333 1.334-1.334-.598-1.334-1.334zm13.981 8.496a2.667 2.667 0 1 0-5.333 0 2.667 2.667 0 0 0 5.333 0zm-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.333zm-7.276-1.829a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.667a.667.667 0 1 1 .002-1.335.667.667 0 0 1-.002 1.335zm7.772-6a2 2 0 1 0-4 0 2 2 0 0 0 4 0zm-2 .666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM11.505 5.505a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm0 2.666a.667.667 0 1 1 .001-1.334.667.667 0 0 1-.001 1.334zM28.93 18.548a13.19 13.19 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.266zm-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.647 11.647 0 0 0 2.359-.888.668.668 0 0 1 .896.294zM4 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.798 11.798 0 0 0 4 15.92z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-gray>post-icon{background-color:#f4f3f1}.alert-notification{--post-bg-rgb:51, 51, 51}.alert-notification:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%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%3Cg id='icon'%3E%3Cpath d='M30.533 26.933c-3.333-4.8-5.867-12.667-5.867-18.267 0-4.8-3.867-8.667-8.667-8.667S7.332 3.866 7.332 8.666c0 5.6-2.533 13.467-5.867 18.267L1.998 28h11.333v4h5.333v-4h11.333l.533-1.067zm-13.2 3.734h-2.667V28h2.667v2.667zm-14.133-4c3.2-5.067 5.467-12.533 5.467-18 0-4 3.333-7.333 7.333-7.333s7.333 3.333 7.333 7.333c0 5.467 2.267 12.933 5.467 18H3.2z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-notification>post-icon{background-color:#333}.alert-error{--post-bg-rgb:165, 23, 40}.alert-error:not(.no-icon,[class^=pi-],[class*=\" pi-\"])::before{-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%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%3Cg id='icon'%3E%3Cpath d='M14.667 4h2.667v18.667h-2.667V4zm0 21.333h2.667V28h-2.667v-2.667z'/%3E%3C/g%3E%3C/svg%3E\");background-color:currentColor}.alert-error>post-icon{background-color:#a51728}.btn-close{padding:0;overflow:visible;border:0;background:none;color:inherit;font:inherit;user-select:none;appearance:button;outline:none;outline-offset:2px;border-radius:4px;color:var(--post-gray-80);transition:opacity 250ms,border-color 250ms,background-color 250ms,color 250ms}.btn-close:is(:focus-visible,:focus-within,.pretend-focus){outline:2px solid var(--post-contrast-color)}.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%3Cg id='icon'%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/g%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%3Cg id='icon'%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/g%3E%3C/svg%3E\");background-color:currentColor;content:\"\";display:block;height:1.5rem;width:1.5rem}.btn-close:focus,.btn-close:not(:disabled):hover,.pretend-hover.btn-close{color:var(--post-contrast-color)}.btn-close:disabled{color:var(--post-gray-40)}.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}.alert-heading>::slotted(h1){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h2){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h3){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h4){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h5){font-size:inherit !important;font-weight:inherit !important}.alert-heading>::slotted(h6){font-size:inherit !important;font-weight:inherit !important}";const m=class{constructor(e){t(this,e);this.dismissed=o(this,"dismissed",7);this.alertId=crypto.randomUUID();this.classes=undefined;this.hasActions=undefined;this.hasHeading=undefined;this.onDismissButtonClick=()=>this.dismiss();this.dismissible=false;this.dismissLabel=undefined;this.fixed=false;this.icon=undefined;this.type="primary"}validateDismissible(t=this.dismissible){c(t,"boolean",'The post-alert "dismissible" prop should be a boolean.');setTimeout((()=>this.validateDismissLabel()))}validateDismissLabel(t=this.dismissLabel){if(this.dismissible){g(t,'Dismissible post-alert\'s require a "dismiss-label" prop.')}}validateFixed(t=this.fixed){c(t,"boolean",'The post-alert "fixed" prop should be a boolean.')}validateIcon(t=this.icon){n(t,/\d{4}|none/,'The post-alert "icon" prop should be a 4-digits string.')}validateType(t=this.type){l(t,p,`The post-alert requires a type form: ${p.join(", ")}`)}connectedCallback(){this.validateDismissible();this.validateFixed();this.validateIcon();this.validateType()}componentWillRender(){var t;this.hasHeading=this.host.querySelectorAll("[slot=heading]").length>0;this.hasActions=this.host.querySelectorAll("[slot=actions]").length>0;this.classes=`alert alert-${(t=this.type)!==null&&t!==void 0?t:"primary"}`;if(this.dismissible)this.classes+=" alert-dismissible";if(this.hasActions)this.classes+=" alert-action";if(this.fixed)this.classes+=" alert-fixed-bottom";if(this.icon==="none")this.classes+=" no-icon"}async dismiss(){const t=s(this.host);await t.finished;this.host.remove();this.dismissed.emit()}render(){const t=[this.hasHeading&&e("div",{key:`${this.alertId}-heading`,class:"alert-heading"},e("slot",{name:"heading"})),e("slot",{key:`${this.alertId}-message`})];const o=[e("div",{key:`${this.alertId}-content`,class:"alert-content"},t),e("div",{key:`${this.alertId}-buttons`,class:"alert-buttons"},e("slot",{name:"actions"}))];return e(i,{"data-version":a},e("div",{role:"alert",class:this.classes},this.dismissible&&e("button",{class:"btn-close",onClick:this.onDismissButtonClick},e("span",{class:"visually-hidden"},this.dismissLabel)),this.icon&&this.icon!=="none"&&e("post-icon",{key:`${this.alertId}-icon`,name:this.icon}),this.hasActions?o:t))}get host(){return r(this)}static get watchers(){return{dismissible:["validateDismissible"],dismissLabel:["validateDismissLabel"],fixed:["validateFixed"],icon:["validateIcon"],type:["validateType"]}}};m.style=h;export{m as post_alert};
2
+ //# sourceMappingURL=p-7240ae7b.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ALERT_TYPES","postAlertCss","PostAlert","crypto","randomUUID","this","dismiss","validateDismissible","isDismissible","dismissible","checkType","setTimeout","validateDismissLabel","dismissLabel","checkNonEmpty","validateFixed","isFixed","fixed","validateIcon","icon","checkEmptyOrPattern","validateType","type","checkEmptyOrOneOf","join","connectedCallback","componentWillRender","hasHeading","host","querySelectorAll","length","hasActions","classes","_a","async","dismissal","fadeOut","finished","remove","dismissed","emit","render","defaultAlertContent","h","key","alertId","name","class","actionAlertContent","Host","version","role","onClick","onDismissButtonClick"],"sources":["./src/components/post-alert/alert-types.ts","./src/components/post-alert/post-alert.scss?tag=post-alert&encapsulation=shadow","./src/components/post-alert/post-alert.tsx"],"sourcesContent":["export const ALERT_TYPES = ['primary', 'success', 'danger', 'warning', 'info', 'gray'] as const;\n\nexport type AlertType = typeof ALERT_TYPES[number];\n","@use '@swisspost/design-system-styles/components/alert';\n@use '@swisspost/design-system-styles/components/close';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n\n ::slotted(*) {\n margin: 0 !important;\n }\n}\n\n.visually-hidden {\n @include post.visually-hidden();\n}\n\n@for $i from 1 through 6 {\n .alert-heading > ::slotted(h#{$i}) {\n font-size: inherit !important;\n font-weight: inherit !important;\n }\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeOut } from '../../animations';\nimport { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from '../../utils';\nimport { ALERT_TYPES, AlertType } from './alert-types';\n\n@Component({\n tag: 'post-alert',\n styleUrl: 'post-alert.scss',\n shadow: true,\n})\nexport class PostAlert {\n @Element() host: HTMLPostAlertElement;\n\n @State() alertId = crypto.randomUUID();\n @State() classes: string;\n @State() hasActions: boolean;\n @State() hasHeading: boolean;\n @State() onDismissButtonClick = () => this.dismiss();\n\n /**\n * If `true`, a close button (×) is displayed and the alert can be dismissed by the user.\n */\n @Prop() readonly dismissible: boolean = false;\n\n @Watch('dismissible')\n validateDismissible(isDismissible = this.dismissible) {\n checkType(isDismissible, 'boolean', 'The post-alert \"dismissible\" prop should be a boolean.');\n setTimeout(() => this.validateDismissLabel());\n }\n\n /**\n * The label to use for the close button of a dismissible alert.\n */\n @Prop() readonly dismissLabel: string;\n\n @Watch('dismissLabel')\n validateDismissLabel(dismissLabel = this.dismissLabel) {\n if (this.dismissible) {\n checkNonEmpty(dismissLabel, 'Dismissible post-alert\\'s require a \"dismiss-label\" prop.');\n }\n }\n\n /**\n * If `true`, the alert is positioned at the bottom of the window, from edge to edge.\n */\n @Prop() readonly fixed: boolean = false;\n\n @Watch('fixed')\n validateFixed(isFixed = this.fixed) {\n checkType(isFixed, 'boolean', 'The post-alert \"fixed\" prop should be a boolean.');\n }\n\n /**\n * The icon to display in the alert. By default, the icon depends on the alert type.\n *\n * If `none`, no icon is displayed.\n */\n @Prop() readonly icon: string;\n\n @Watch('icon')\n validateIcon(icon = this.icon) {\n checkEmptyOrPattern(icon, /\\d{4}|none/, 'The post-alert \"icon\" prop should be a 4-digits string.');\n }\n\n /**\n * The type of the alert.\n */\n @Prop() readonly type: AlertType = 'primary';\n\n @Watch('type')\n validateType(type = this.type) {\n checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);\n }\n\n /**\n * An event emitted when the alert element is dismissed, after the transition.\n * It has no payload and only relevant for dismissible alerts.\n */\n @Event() dismissed: EventEmitter<void>;\n\n connectedCallback() {\n this.validateDismissible();\n this.validateFixed();\n this.validateIcon();\n this.validateType();\n }\n\n componentWillRender() {\n this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;\n this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;\n\n this.classes = `alert alert-${this.type ?? 'primary'}`;\n if (this.dismissible) this.classes += ' alert-dismissible';\n if (this.hasActions) this.classes += ' alert-action';\n if (this.fixed) this.classes += ' alert-fixed-bottom';\n if (this.icon === 'none') this.classes += ' no-icon';\n }\n\n /**\n * Triggers alert dismissal programmatically (same as clicking on the close button (×)).\n */\n @Method()\n async dismiss() {\n const dismissal = fadeOut(this.host);\n\n await dismissal.finished;\n\n this.host.remove();\n this.dismissed.emit();\n }\n\n render() {\n const defaultAlertContent = [\n this.icon && this.icon !== 'none' && (\n <post-icon key={`${this.alertId}-icon`} name={this.icon} />\n ),\n this.hasHeading && (\n <div key={`${this.alertId}-heading`} class=\"alert-heading\">\n <slot name=\"heading\"/>\n </div>\n ),\n <slot key={`${this.alertId}-message`}/>\n ];\n\n const actionAlertContent = [\n <div key={`${this.alertId}-content`} class=\"alert-content\">\n {defaultAlertContent}\n </div>,\n <div key={`${this.alertId}-buttons`} class=\"alert-buttons\">\n <slot name=\"actions\"/>\n </div>,\n ];\n\n return (\n <Host data-version={version}>\n <div role=\"alert\" class={this.classes}>\n {this.dismissible && (\n <button class=\"btn-close\" onClick={this.onDismissButtonClick}>\n <span class=\"visually-hidden\">{this.dismissLabel}</span>\n </button>\n )}\n\n {this.hasActions\n ? actionAlertContent\n : defaultAlertContent\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"mappings":"8QAAO,MAAMA,EAAc,CAAC,UAAW,UAAW,SAAU,UAAW,OAAQ,QCA/E,MAAMC,EAAe,ggmB,MCWRC,EAAS,M,2EAGDC,OAAOC,a,qGAIM,IAAMC,KAAKC,U,iBAKH,M,uCAuBN,M,8BAsBC,S,CA1CnCC,oBAAoBC,EAAgBH,KAAKI,aACvCC,EAAUF,EAAe,UAAW,0DACpCG,YAAW,IAAMN,KAAKO,wB,CASxBA,qBAAqBC,EAAeR,KAAKQ,cACvC,GAAIR,KAAKI,YAAa,CACpBK,EAAcD,EAAc,4D,EAUhCE,cAAcC,EAAUX,KAAKY,OAC3BP,EAAUM,EAAS,UAAW,mD,CAWhCE,aAAaC,EAAOd,KAAKc,MACvBC,EAAoBD,EAAM,aAAc,0D,CAS1CE,aAAaC,EAAOjB,KAAKiB,MACvBC,EAAkBD,EAAMtB,EAAa,wCAAwCA,EAAYwB,KAAK,Q,CAShGC,oBACEpB,KAAKE,sBACLF,KAAKU,gBACLV,KAAKa,eACLb,KAAKgB,c,CAGPK,sB,MACErB,KAAKsB,WAAatB,KAAKuB,KAAKC,iBAAiB,kBAAkBC,OAAS,EACxEzB,KAAK0B,WAAa1B,KAAKuB,KAAKC,iBAAiB,kBAAkBC,OAAS,EAExEzB,KAAK2B,QAAU,gBAAeC,EAAA5B,KAAKiB,QAAI,MAAAW,SAAA,EAAAA,EAAI,YAC3C,GAAI5B,KAAKI,YAAaJ,KAAK2B,SAAW,qBACtC,GAAI3B,KAAK0B,WAAY1B,KAAK2B,SAAW,gBACrC,GAAI3B,KAAKY,MAAOZ,KAAK2B,SAAW,sBAChC,GAAI3B,KAAKc,OAAS,OAAQd,KAAK2B,SAAW,U,CAO5CE,gBACE,MAAMC,EAAYC,EAAQ/B,KAAKuB,YAEzBO,EAAUE,SAEhBhC,KAAKuB,KAAKU,SACVjC,KAAKkC,UAAUC,M,CAGjBC,SACE,MAAMC,EAAsB,CAC1BrC,KAAKc,MAAQd,KAAKc,OAAS,QACzBwB,EAAA,aAAWC,IAAK,GAAGvC,KAAKwC,eAAgBC,KAAMzC,KAAKc,OAErDd,KAAKsB,YACHgB,EAAA,OAAKC,IAAK,GAAGvC,KAAKwC,kBAAmBE,MAAM,iBACzCJ,EAAA,QAAMG,KAAK,aAGfH,EAAA,QAAMC,IAAK,GAAGvC,KAAKwC,qBAGrB,MAAMG,EAAqB,CACzBL,EAAA,OAAKC,IAAK,GAAGvC,KAAKwC,kBAAmBE,MAAM,iBACxCL,GAEHC,EAAA,OAAKC,IAAK,GAAGvC,KAAKwC,kBAAmBE,MAAM,iBACzCJ,EAAA,QAAMG,KAAK,cAIf,OACEH,EAACM,EAAI,gBAAeC,GAClBP,EAAA,OAAKQ,KAAK,QAAQJ,MAAO1C,KAAK2B,SAC3B3B,KAAKI,aACJkC,EAAA,UAAQI,MAAM,YAAYK,QAAS/C,KAAKgD,sBACtCV,EAAA,QAAMI,MAAM,mBAAmB1C,KAAKQ,eAIvCR,KAAK0B,WACFiB,EACAN,G"}
1
+ {"version":3,"names":["ALERT_TYPES","postAlertCss","PostAlert","crypto","randomUUID","this","dismiss","validateDismissible","isDismissible","dismissible","checkType","setTimeout","validateDismissLabel","dismissLabel","checkNonEmpty","validateFixed","isFixed","fixed","validateIcon","icon","checkEmptyOrPattern","validateType","type","checkEmptyOrOneOf","join","connectedCallback","componentWillRender","hasHeading","host","querySelectorAll","length","hasActions","classes","_a","async","dismissal","fadeOut","finished","remove","dismissed","emit","render","defaultAlertContent","h","key","alertId","class","name","actionAlertContent","Host","version","role","onClick","onDismissButtonClick"],"sources":["./src/components/post-alert/alert-types.ts","./src/components/post-alert/post-alert.scss?tag=post-alert&encapsulation=shadow","./src/components/post-alert/post-alert.tsx"],"sourcesContent":["export const ALERT_TYPES = ['primary', 'success', 'danger', 'warning', 'info', 'gray'] as const;\n\nexport type AlertType = typeof ALERT_TYPES[number];\n","@use '@swisspost/design-system-styles/components/alert';\n@use '@swisspost/design-system-styles/components/close';\n@use '@swisspost/design-system-styles/core' as post;\n\n:host {\n display: block;\n\n ::slotted(*) {\n margin: 0 !important;\n }\n}\n\n.visually-hidden {\n @include post.visually-hidden();\n}\n\n@for $i from 1 through 6 {\n .alert-heading > ::slotted(h#{$i}) {\n font-size: inherit !important;\n font-weight: inherit !important;\n }\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from '@stencil/core';\nimport { version } from '../../../package.json';\nimport { fadeOut } from '../../animations';\nimport { checkEmptyOrOneOf, checkEmptyOrPattern, checkNonEmpty, checkType } from '../../utils';\nimport { ALERT_TYPES, AlertType } from './alert-types';\n\n@Component({\n tag: 'post-alert',\n styleUrl: 'post-alert.scss',\n shadow: true,\n})\nexport class PostAlert {\n @Element() host: HTMLPostAlertElement;\n\n @State() alertId = crypto.randomUUID();\n @State() classes: string;\n @State() hasActions: boolean;\n @State() hasHeading: boolean;\n @State() onDismissButtonClick = () => this.dismiss();\n\n /**\n * If `true`, a close button (×) is displayed and the alert can be dismissed by the user.\n */\n @Prop() readonly dismissible: boolean = false;\n\n @Watch('dismissible')\n validateDismissible(isDismissible = this.dismissible) {\n checkType(isDismissible, 'boolean', 'The post-alert \"dismissible\" prop should be a boolean.');\n setTimeout(() => this.validateDismissLabel());\n }\n\n /**\n * The label to use for the close button of a dismissible alert.\n */\n @Prop() readonly dismissLabel: string;\n\n @Watch('dismissLabel')\n validateDismissLabel(dismissLabel = this.dismissLabel) {\n if (this.dismissible) {\n checkNonEmpty(dismissLabel, 'Dismissible post-alert\\'s require a \"dismiss-label\" prop.');\n }\n }\n\n /**\n * If `true`, the alert is positioned at the bottom of the window, from edge to edge.\n */\n @Prop() readonly fixed: boolean = false;\n\n @Watch('fixed')\n validateFixed(isFixed = this.fixed) {\n checkType(isFixed, 'boolean', 'The post-alert \"fixed\" prop should be a boolean.');\n }\n\n /**\n * The icon to display in the alert. By default, the icon depends on the alert type.\n *\n * If `none`, no icon is displayed.\n */\n @Prop() readonly icon: string;\n\n @Watch('icon')\n validateIcon(icon = this.icon) {\n checkEmptyOrPattern(icon, /\\d{4}|none/, 'The post-alert \"icon\" prop should be a 4-digits string.');\n }\n\n /**\n * The type of the alert.\n */\n @Prop() readonly type: AlertType = 'primary';\n\n @Watch('type')\n validateType(type = this.type) {\n checkEmptyOrOneOf(type, ALERT_TYPES, `The post-alert requires a type form: ${ALERT_TYPES.join(', ')}`);\n }\n\n /**\n * An event emitted when the alert element is dismissed, after the transition.\n * It has no payload and only relevant for dismissible alerts.\n */\n @Event() dismissed: EventEmitter<void>;\n\n connectedCallback() {\n this.validateDismissible();\n this.validateFixed();\n this.validateIcon();\n this.validateType();\n }\n\n componentWillRender() {\n this.hasHeading = this.host.querySelectorAll('[slot=heading]').length > 0;\n this.hasActions = this.host.querySelectorAll('[slot=actions]').length > 0;\n\n this.classes = `alert alert-${this.type ?? 'primary'}`;\n if (this.dismissible) this.classes += ' alert-dismissible';\n if (this.hasActions) this.classes += ' alert-action';\n if (this.fixed) this.classes += ' alert-fixed-bottom';\n if (this.icon === 'none') this.classes += ' no-icon';\n }\n\n /**\n * Triggers alert dismissal programmatically (same as clicking on the close button (×)).\n */\n @Method()\n async dismiss() {\n const dismissal = fadeOut(this.host);\n\n await dismissal.finished;\n\n this.host.remove();\n this.dismissed.emit();\n }\n\n render() {\n const defaultAlertContent = [\n this.hasHeading && (\n <div key={`${this.alertId}-heading`} class=\"alert-heading\">\n <slot name=\"heading\"/>\n </div>\n ),\n <slot key={`${this.alertId}-message`}/>\n ];\n\n const actionAlertContent = [\n <div key={`${this.alertId}-content`} class=\"alert-content\">\n {defaultAlertContent}\n </div>,\n <div key={`${this.alertId}-buttons`} class=\"alert-buttons\">\n <slot name=\"actions\"/>\n </div>,\n ];\n\n return (\n <Host data-version={version}>\n <div role=\"alert\" class={this.classes}>\n {this.dismissible && (\n <button class=\"btn-close\" onClick={this.onDismissButtonClick}>\n <span class=\"visually-hidden\">{this.dismissLabel}</span>\n </button>\n )}\n\n {this.icon && this.icon !== 'none' && (\n <post-icon key={`${this.alertId}-icon`} name={this.icon} />\n )}\n\n {this.hasActions\n ? actionAlertContent\n : defaultAlertContent\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"mappings":"8QAAO,MAAMA,EAAc,CAAC,UAAW,UAAW,SAAU,UAAW,OAAQ,QCA/E,MAAMC,EAAe,y8lB,MCWRC,EAAS,M,2EAGDC,OAAOC,a,qGAIM,IAAMC,KAAKC,U,iBAKH,M,uCAuBN,M,8BAsBC,S,CA1CnCC,oBAAoBC,EAAgBH,KAAKI,aACvCC,EAAUF,EAAe,UAAW,0DACpCG,YAAW,IAAMN,KAAKO,wB,CASxBA,qBAAqBC,EAAeR,KAAKQ,cACvC,GAAIR,KAAKI,YAAa,CACpBK,EAAcD,EAAc,4D,EAUhCE,cAAcC,EAAUX,KAAKY,OAC3BP,EAAUM,EAAS,UAAW,mD,CAWhCE,aAAaC,EAAOd,KAAKc,MACvBC,EAAoBD,EAAM,aAAc,0D,CAS1CE,aAAaC,EAAOjB,KAAKiB,MACvBC,EAAkBD,EAAMtB,EAAa,wCAAwCA,EAAYwB,KAAK,Q,CAShGC,oBACEpB,KAAKE,sBACLF,KAAKU,gBACLV,KAAKa,eACLb,KAAKgB,c,CAGPK,sB,MACErB,KAAKsB,WAAatB,KAAKuB,KAAKC,iBAAiB,kBAAkBC,OAAS,EACxEzB,KAAK0B,WAAa1B,KAAKuB,KAAKC,iBAAiB,kBAAkBC,OAAS,EAExEzB,KAAK2B,QAAU,gBAAeC,EAAA5B,KAAKiB,QAAI,MAAAW,SAAA,EAAAA,EAAI,YAC3C,GAAI5B,KAAKI,YAAaJ,KAAK2B,SAAW,qBACtC,GAAI3B,KAAK0B,WAAY1B,KAAK2B,SAAW,gBACrC,GAAI3B,KAAKY,MAAOZ,KAAK2B,SAAW,sBAChC,GAAI3B,KAAKc,OAAS,OAAQd,KAAK2B,SAAW,U,CAO5CE,gBACE,MAAMC,EAAYC,EAAQ/B,KAAKuB,YAEzBO,EAAUE,SAEhBhC,KAAKuB,KAAKU,SACVjC,KAAKkC,UAAUC,M,CAGjBC,SACE,MAAMC,EAAsB,CAC1BrC,KAAKsB,YACHgB,EAAA,OAAKC,IAAK,GAAGvC,KAAKwC,kBAAmBC,MAAM,iBACzCH,EAAA,QAAMI,KAAK,aAGfJ,EAAA,QAAMC,IAAK,GAAGvC,KAAKwC,qBAGrB,MAAMG,EAAqB,CACzBL,EAAA,OAAKC,IAAK,GAAGvC,KAAKwC,kBAAmBC,MAAM,iBACxCJ,GAEHC,EAAA,OAAKC,IAAK,GAAGvC,KAAKwC,kBAAmBC,MAAM,iBACzCH,EAAA,QAAMI,KAAK,cAIf,OACEJ,EAACM,EAAI,gBAAeC,GAClBP,EAAA,OAAKQ,KAAK,QAAQL,MAAOzC,KAAK2B,SAC3B3B,KAAKI,aACJkC,EAAA,UAAQG,MAAM,YAAYM,QAAS/C,KAAKgD,sBACtCV,EAAA,QAAMG,MAAM,mBAAmBzC,KAAKQ,eAIvCR,KAAKc,MAAQd,KAAKc,OAAS,QAC1BwB,EAAA,aAAWC,IAAK,GAAGvC,KAAKwC,eAAgBE,KAAM1C,KAAKc,OAGpDd,KAAK0B,WACFiB,EACAN,G"}