dap-design-system
Version:
Official design system for the DÁP (dap.gov.hu)
39 lines (38 loc) • 1.21 kB
JavaScript
import { property as n } from "../../node_modules/@lit/reactive-element/decorators/property.js";
var c = Object.defineProperty, u = (o, t, l, e) => {
for (var s = void 0, r = o.length - 1, i; r >= 0; r--)
(i = o[r]) && (s = i(t, l, s) || s);
return s && c(t, l, s), s;
};
function p(o) {
class t extends o {
constructor() {
super(...arguments), this.disabled = !1, this.autofocus = !1;
}
get focusElement() {
throw new Error("Must implement focusElement getter!");
}
focus(e) {
this.disabled || !this.focusElement || (this.focusElement !== this ? this.focusElement.focus(e) : HTMLElement.prototype.focus.apply(this, [e]));
}
blur() {
const e = this.focusElement || this;
e !== this ? e.blur() : HTMLElement.prototype.blur.apply(this);
}
click() {
if (this.disabled)
return;
const e = this.focusElement || this;
e !== this ? e.click() : HTMLElement.prototype.click.apply(this);
}
}
return u([
n({ type: Boolean, reflect: !0 })
], t.prototype, "disabled"), u([
n({ type: Boolean })
], t.prototype, "autofocus"), t;
}
export {
p as FocusableMixin
};
//# sourceMappingURL=focusableMixin.js.map