@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
56 lines (54 loc) • 1.77 kB
JavaScript
import { c as e, d as t, r as n, s as r } from "./element-cZ85T_aa.js";
import { n as i, t as a } from "./element-with-slot-4J2o3SeU.js";
import "./icon-Co72KtgF.js";
import { t as o } from "./if-defined-Cjj8qN-Z.js";
//#region src/components/linkcard/linkcard.ts
var s = class extends a {
constructor(...e) {
super(...e), this.title = "", this.href = "#", this.iconName = "", this.external = !1, this.openInNewTab = !1, this.skin = "normal";
}
render() {
let e = ["pkt-linkcard", this.skin && `pkt-linkcard--${this.skin}`].filter(Boolean).join(" "), n = ["pkt-linkcard__title", this.external && "pkt-link pkt-link--external"].filter(Boolean).join(" ");
return t`
<a
href=${this.href}
class=${e}
target=${this.openInNewTab ? "_blank" : "_self"}
rel=${o(this.openInNewTab ? "noopener noreferrer" : void 0)}
>
${this.iconName && t`<pkt-icon class="pkt-link__icon" name="${this.iconName}" />`}
${this.title && t`<div class=${n}>${this.title}</div>`}
<div class="pkt-linkcard__text">${i(this)}</div>
</a>
`;
}
};
n([r({
type: String,
reflect: !0
})], s.prototype, "title", void 0), n([r({
type: String,
reflect: !0
})], s.prototype, "href", void 0), n([r({
type: String,
reflect: !0
})], s.prototype, "iconName", void 0), n([r({
type: Boolean,
reflect: !0
})], s.prototype, "external", void 0), n([r({
type: Boolean,
reflect: !0
})], s.prototype, "openInNewTab", void 0), n([r({
type: String,
reflect: !0
})], s.prototype, "skin", void 0);
try {
e("pkt-linkcard")(s);
} catch {
console.warn("Forsøker å definere <pkt-linkcard>, men den er allerede definert");
}
//#endregion
//#region src/components/linkcard/index.ts
var c = s;
//#endregion
export { s as n, c as t };