@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
55 lines (53 loc) • 1.87 kB
JavaScript
import { P as f, x as c, n, a as h } from "./element-CgEWt74-.js";
import { e as k, n as m } from "./ref-BBYSqgeW.js";
import { P as u } from "./pkt-slot-controller-BPGj-LC5.js";
import "./icon-CC1js8eR.js";
var _ = Object.defineProperty, d = Object.getOwnPropertyDescriptor, r = (l, i, s, o) => {
for (var e = o > 1 ? void 0 : o ? d(i, s) : i, a = l.length - 1, p; a >= 0; a--)
(p = l[a]) && (e = (o ? p(i, s, e) : p(e)) || e);
return o && e && _(i, s, e), e;
};
let t = class extends f {
constructor() {
super(), this.defaultSlot = k(), this.title = "", this.href = "#", this.iconName = "", this.external = !1, this.openInNewTab = !1, this.skin = "normal", this.slotController = new u(this, this.defaultSlot);
}
render() {
const l = ["pkt-linkcard", this.skin && `pkt-linkcard--${this.skin}`].filter(Boolean).join(" "), i = ["pkt-linkcard__title", this.external && "pkt-link pkt-link--external"].filter(Boolean).join(" ");
return c`
<a
href=${this.href}
class=${l}
target=${this.openInNewTab ? "_blank" : "_self"}
rel=${this.openInNewTab ?? "noopener noreferrer"}
>
${this.iconName && c`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
${this.title && c`<div class=${i}>${this.title}</div>`}
<div class="pkt-linkcard__text" ${m(this.defaultSlot)}></div>
</a>
`;
}
};
r([
n({ type: String, reflect: !0 })
], t.prototype, "title", 2);
r([
n({ type: String, reflect: !0 })
], t.prototype, "href", 2);
r([
n({ type: String, reflect: !0 })
], t.prototype, "iconName", 2);
r([
n({ type: Boolean, reflect: !0 })
], t.prototype, "external", 2);
r([
n({ type: Boolean, reflect: !0 })
], t.prototype, "openInNewTab", 2);
r([
n({ type: String, reflect: !0 })
], t.prototype, "skin", 2);
t = r([
h("pkt-linkcard")
], t);
export {
t as P
};