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