@oslokommune/punkt-elements
Version:
Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo
47 lines (46 loc) • 1.5 kB
JavaScript
import { P as c, x as k, n as o, a as f } from "./element-CgEWt74-.js";
import { o as h } from "./if-defined-CmuO4Vz9.js";
var b = Object.defineProperty, u = Object.getOwnPropertyDescriptor, s = (t, r, i, l) => {
for (var e = l > 1 ? void 0 : l ? u(r, i) : r, n = t.length - 1, p; n >= 0; n--)
(p = t[n]) && (e = (l ? p(r, i, e) : p(e)) || e);
return l && e && b(r, i, e), e;
};
let a = class extends c {
constructor() {
super(...arguments), this.href = "", this.text = "Forsiden", this.ariaLabel = "";
}
// Lifecycle
attributeChangedCallback(t, r, i) {
t === "arialabel" && this.removeAttribute("arialabel"), t === "href" && this.removeAttribute("href"), t === "text" && this.removeAttribute("text"), super.attributeChangedCallback(t, r, i);
}
render() {
return k`<nav
class="pkt-back-link"
aria-label=${this.ariaLabel || "Gå tilbake til forrige side"}
>
<a href=${h(this.href || "/")} class="pkt-link pkt-link--icon-left"
><pkt-icon
class="pkt-back-link__icon pkt-icon pkt-link__icon"
name="chevron-thin-left"
aria-hidden="true"
></pkt-icon
><span class="pkt-back-link__text">${this.text}</span></a
>
</nav>`;
}
};
s([
o({ type: String, reflect: !0 })
], a.prototype, "href", 2);
s([
o({ type: String, reflect: !0 })
], a.prototype, "text", 2);
s([
o({ type: String, reflect: !0 })
], a.prototype, "ariaLabel", 2);
a = s([
f("pkt-backlink")
], a);
export {
a as P
};