ReactMaterial3/dist/focusable-CDJoU7XD.mjs

48 lines
1.2 KiB
JavaScript

import { _ as h, n as x } from "./class-map-CwiboTfb.mjs";
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const s = Symbol("isFocusable"), r = Symbol("privateIsFocusable"), a = Symbol("externalTabIndex"), n = Symbol("isUpdatingTabIndex"), i = Symbol("updateTabIndex");
function m(l) {
var b, o, c;
class u extends l {
constructor() {
super(...arguments), this[b] = !0, this[o] = null, this[c] = !1;
}
get [s]() {
return this[r];
}
set [s](t) {
this[s] !== t && (this[r] = t, this[i]());
}
connectedCallback() {
super.connectedCallback(), this[i]();
}
attributeChangedCallback(t, e, d) {
if (t !== "tabindex") {
super.attributeChangedCallback(t, e, d);
return;
}
if (this.requestUpdate("tabIndex", Number(e ?? -1)), !this[n]) {
if (!this.hasAttribute("tabindex")) {
this[a] = null, this[i]();
return;
}
this[a] = this.tabIndex;
}
}
[(b = r, o = a, c = n, i)]() {
const t = this[s] ? 0 : -1, e = this[a] ?? t;
this[n] = !0, this.tabIndex = e, this[n] = !1;
}
}
return h([
x({ noAccessor: !0 })
], u.prototype, "tabIndex", void 0), u;
}
export {
m
};