UNPKG

@wolf-scope/wolf-ui

Version:

UI library for web applications using Lit

57 lines (56 loc) 1.61 kB
import { property as r } from "lit/decorators.js"; import { unsafeCSS as a, LitElement as f, html as h } from "lit"; import "../icon/register.mjs"; import "../icon/icon.mjs"; import "lit/directives/style-map.js"; import "../../chain-filter-963a1f6f.js"; const m = `:host{display:flex;cursor:pointer;align-items:center;justify-content:center;padding:var(--wolf-spacing-md) calc(var(--wolf-spacing-md) * 2)} `; var d = Object.defineProperty, u = Object.getOwnPropertyDescriptor, i = (s, e, c, n) => { for (var t = n > 1 ? void 0 : n ? u(e, c) : e, l = s.length - 1, p; l >= 0; l--) (p = s[l]) && (t = (n ? p(e, c, t) : p(t)) || t); return n && t && d(e, c, t), t; }; const C = "wolf-icon-button"; class o extends f { constructor() { super(...arguments), this.size = 24, this.icon = "", this.color = "var(--wolf-color-text)", this.href = "", this.external = !1; } handleClick() { if (this.href) if (this.external) location.href = this.href; else { const e = document.createElement("a"); e.href = this.href, document.body.appendChild(e), e.click(), document.body.removeChild(e); } } render() { return h`<wolf-icon @click=${this.handleClick} color=${this.color} size=${this.size} icon=${this.icon} ></wolf-icon>`; } } o.styles = a(m); i([ r({ type: Number }) ], o.prototype, "size", 2); i([ r() ], o.prototype, "icon", 2); i([ r() ], o.prototype, "color", 2); i([ r() ], o.prototype, "href", 2); i([ r({ type: Boolean }) ], o.prototype, "external", 2); export { o as WolfIconButton, C as tagName };