UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

75 lines (74 loc) 1.8 kB
import { returnFirstEl as e } from "../../common/utils/index.js"; import { t } from "../../_plugin-vue_export-helper-BTgDAbhb.js"; import n from "../../common/mixins/modal.js"; import { createElementBlock as r, normalizeClass as i, openBlock as a, renderSlot as o, vShow as s, withDirectives as c } from "vue"; //#region components/tab/tab_panel.vue var l = { compatConfig: { MODE: 3 }, name: "DtTabPanel", mixins: [n], inject: ["groupContext"], props: { id: { type: String, required: !0 }, tabId: { type: String, required: !0 }, hidden: { type: Boolean, default: !1 }, tabPanelClass: { type: [ String, Array, Object ], default: "" } }, data() { return { isFirstElementFocusable: !1 }; }, computed: { hidePanel() { return this.groupContext.selected !== this.id || this.hidden; } }, async mounted() { let t = await this.getFirstFocusableElement(e(this.$el)); t ? this.isFirstElementFocusable = this.isFirstElementOfPanel(t) : this.isFirstElementFocusable = !1; }, methods: { isFirstElementOfPanel(t) { let n = t, r = !0; for (; n;) { if (n.previousElementSibling !== null) { r = !1; break; } n = n.parentNode === e(this.$el) ? null : n.parentNode; } return r; } } }, u = [ "id", "tabindex", "aria-labelledby", "aria-hidden" ]; function d(e, t, n, l, d, f) { return c((a(), r("div", { id: `dt-panel-${n.id}`, role: "tabpanel", tabindex: d.isFirstElementFocusable ? -1 : 0, "aria-labelledby": `dt-tab-${n.tabId}`, "aria-hidden": `${f.hidePanel}`, class: i(n.tabPanelClass), "data-qa": "dt-tab-panel" }, [o(e.$slots, "default")], 10, u)), [[s, !f.hidePanel]]); } var f = /* @__PURE__ */ t(l, [["render", d]]); //#endregion export { f as default }; //# sourceMappingURL=tab-panel.js.map