UNPKG

@postnord/web-components

Version:

PostNord Web Components

6 lines 7.37 kB
/*! * Built with Stencil * By PostNord. */ import{r as a,c as e,g as n,h as t,a as r}from"./p-43660913.js";import{a as i}from"./p-d82ef4a1.js";import{o as c}from"./p-773aa70a.js";import{u as d,r as o}from"./p-c511b4fb.js";const p='pn-card{position:relative;display:block}pn-card .pn-card{position:relative;background-color:#ffffff;color:#2d2013;border-radius:0.5em;display:flex;flex-direction:column;height:100%;overflow:hidden;box-shadow:0em 0.0625em 0.125em 0em rgba(20, 20, 20, 0.11), 0em 0.1875em 0.4375em 0em rgba(0, 0, 0, 0.13);outline:0.2rem solid transparent;outline-offset:0.2rem;transition-property:background-color, outline-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1);}pn-card .pn-card[data-link]:hover{background-color:#e0f8ff}pn-card .pn-card[data-link][data-focus]{outline-color:#005d92}pn-card .pn-card[data-link] .pn-card-navigation>[slot=navigation]{display:none}pn-card .pn-card[data-horizontal]{flex-direction:row}pn-card .pn-card[data-horizontal][data-reverse]{flex-direction:row-reverse}pn-card .pn-card[data-horizontal][data-reverse] .pn-card-picture{clip-path:ellipse(100% 175% at right center)}pn-card .pn-card[data-horizontal] .pn-card-content{flex:1 1 50%}pn-card .pn-card[data-horizontal] .pn-card-image{flex:1 1 50%;flex-direction:row}pn-card .pn-card[data-horizontal] .pn-card-picture{width:100%;clip-path:ellipse(100% 175% at left center)}pn-card .pn-card[data-reverse]{flex-direction:column-reverse}pn-card .pn-card[data-reverse] .pn-card-picture{clip-path:ellipse(175% 100% at bottom center)}pn-card .pn-card-header{display:flex;flex-direction:column;gap:clamp(0.5em, 5vw, 0.75em)}pn-card .pn-card-label{font-size:clamp(1.125em, 5vw, 1.5em);font-weight:700;margin:0}pn-card .pn-card-label-overline{color:#5e554a;font-size:0.875em;font-weight:400;margin:0}pn-card .pn-card-link{display:inline-flex;align-items:center;gap:0.25em;color:#005d92;text-decoration-color:transparent;-webkit-tap-highlight-color:transparent;transition-property:color, text-decoration-color;transition-duration:0.2s;transition-timing-function:cubic-bezier(0.7, 0, 0.3, 1)}pn-card .pn-card-link:hover{color:#0d234b;text-decoration-color:#0d234b}pn-card .pn-card-link:hover>pn-icon>.pn-icon-svg>path{fill:#0d234b}pn-card .pn-card-link:focus{outline:0;color:#0d234b;text-decoration-color:#0d234b}pn-card .pn-card-link:focus>pn-icon>.pn-icon-svg>path{fill:#0d234b}pn-card .pn-card-link:before{content:"";position:absolute;top:0;left:0;width:100%;height:100%}pn-card .pn-card-content{display:flex;flex-direction:column;flex-wrap:nowrap;flex:1;gap:clamp(0.5em, 5vw, 0.75em);padding:clamp(0.75em, 5vw, 1.5em) clamp(0.75em, 5vw, 1.5em)}pn-card .pn-card-section{display:flex;flex-direction:column;gap:0.5em;color:#5e554a}pn-card .pn-card-section-paragraph,pn-card .pn-card-section p{margin:0 0 0.25em}pn-card .pn-card-section-paragraph:last-child,pn-card .pn-card-section p:last-child{margin:0em}pn-card .pn-card-navigation{margin-top:auto;padding-top:clamp(0.5em, 5vw, 0.75em);display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:0.5em}pn-card .pn-card-navigation>pn-button{flex:1 1 12em}pn-card .pn-card-navigation:empty{display:none}pn-card .pn-card-image{position:relative;display:flex;flex-direction:column}pn-card .pn-card-picture{margin:0;padding:0;display:block;overflow:hidden;clip-path:ellipse(175% 100% at top center);aspect-ratio:var(--pn-card-aspect-ratio)}pn-card .pn-card-picture:empty{display:none}pn-card .pn-card-picture>*[slot=image]{display:block;height:100%;width:100%;object-fit:cover}pn-card .pn-card-tags{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:0.5em}pn-card .pn-card-tags:empty{display:none}pn-card .pn-card>.pn-ripple{animation:ripple 0.4s cubic-bezier(0.7, 0, 0.3, 1);position:absolute;border-radius:50%;background-color:#005d92;transform:translate(-50%, -50%) scale(0);opacity:0.1;pointer-events:none;z-index:3}@keyframes ripple{to{transform:translate(-50%, -50%) scale(1);opacity:0}}';const s=p;const l=class{constructor(n){a(this,n);this.pnCard=e(this,"pnCard",7);this.visibleOutline=false;this.label=undefined;this.labelTag="h3";this.overline=undefined;this.text=undefined;this.cardId=null;this.horizontal=false;this.reverse=false;this.aspectRatio="";this.href=undefined;this.hrefLabel=undefined;this.target=undefined;this.rel="noopener noreferrer";this.icon=null}id=`pn-card-${d()}`;idTitle=`${this.id}-title`;get hostElement(){return n(this)}watchCardId(){const a=this.cardId||this.id;this.idTitle=`${a}-title`}pnCard;componentWillLoad(){this.watchCardId()}isExternal(){return this.target==="_blank"}showTitle(){return!!this.label}showHref(){return!!this.href&&(this.hrefLabel||this.showTitle())}getTitleId(){return this.hrefLabel?null:this.idTitle}getLabelledby(){return this.hrefLabel?null:this.showTitle()?this.idTitle:null}getIcon(){if(!!this.icon)return this.icon;return this.isExternal()?c:i}getHeadingTag(){const a=["h2","h3","h4","h5","h6","p"];return a.includes(this.labelTag)?this.labelTag:"h3"}handleFocus({type:a,target:e}){this.visibleOutline=a==="focus"&&e.matches(":focus-visible")}handleClick(a){o(a,this.hostElement,".pn-card");this.pnCard.emit({click:a})}render(){const a=this.getHeadingTag();return t(r,{key:"5059ced25e86a6fe205d470bf3591cd971adf8f1"},t("article",{key:"f1135d78ed76c1bbd4c2f4064d83d0df93aca339",id:this.cardId,class:"pn-card","data-link":!!this.href,"data-horizontal":this.horizontal,"data-reverse":this.reverse,"data-focus":this.visibleOutline},t("div",{key:"c2ee9fa9314c19d40ad7725866dddfdd41bde019",class:"pn-card-image"},t("picture",{key:"75b53ffaf62275459085540c4670801f20c943b5",class:"pn-card-picture",style:{"--pn-card-aspect-ratio":this.aspectRatio||"unset"}},t("slot",{key:"83a17d8a5c675d0b6e22a6683c697fce689a901c",name:"image"}))),t("div",{key:"8939d981a52f0802fd39e2fec5e9b430aa0d0d7e",class:"pn-card-content"},t("header",{key:"ba23d81d3f9d1770a94625db39ef10b79f52e588",class:"pn-card-header"},t("div",{key:"4ac22c93173cde6cee1bd05557322733e6a1a358",class:"pn-card-tags"},t("slot",{key:"a9764743f78b34dbe4762ab5e7f7df5812bff9a0",name:"tags"})),!!this.overline&&t("p",{key:"5b931af9c1d702439c3d7044549a8a0b721d0732",class:"pn-card-label-overline"},this.overline),!!this.label&&t(a,{key:"f431c3b6a7f0864ad12d0b585d6014657bda8163",id:this.getTitleId(),class:"pn-card-label"},this.label),t("slot",{key:"9500f8d69acd614b628fe97a8a1a3fe36ee0e64e",name:"header"})),t("section",{key:"8ace8af3b532dadaf129ffe12d6159a6e9c4820e",class:"pn-card-section"},!!this.text&&t("p",{key:"ac162dbd6fd940e3a1b87b38ffa1acdb8dbfab76",class:"pn-card-section-paragraph"},this.text),t("slot",{key:"814238314b9b5e77e6f7eb1c044016eb59f0d23b"})),t("nav",{key:"22cd78b16c68c5a0449223ad12c3bf756642928a",class:"pn-card-navigation"},this.showHref()&&t("a",{key:"6fbfd640bdc555f272fb1cf72b27525fbb0e0e8f",class:"pn-card-link",href:this.href,target:this.target,rel:this.rel,"aria-labelledby":this.getLabelledby(),onClick:a=>this.handleClick(a),onFocus:a=>this.handleFocus(a),onBlur:a=>this.handleFocus(a)},this.hrefLabel,t("pn-icon",{key:"263e2160a76fc5258a44aa40bc6d52df8ec25086",color:"blue700",icon:this.getIcon()})),t("slot",{key:"edfeca3a4eb44e246a199985577355f570356258",name:"navigation"})))))}static get watchers(){return{cardId:["watchCardId"]}}};l.style=s;export{l as pn_card}; //# sourceMappingURL=p-383164c7.entry.js.map