@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
74 lines (73 loc) • 1.96 kB
JavaScript
import { t as e } from "../../_plugin-vue_export-helper-BTgDAbhb.js";
import { DialtoneLocalization as t } from "../../localization/index.js";
import n from "../button/button.js";
import r from "../../shared/sr_only_close_button.js";
import { createBlock as i, createCommentVNode as a, createElementBlock as o, createVNode as s, openBlock as c, renderSlot as l, resolveComponent as u, withCtx as d } from "vue";
import { DtIconClose as f } from "@dialpad/dialtone-icons/vue3";
//#region components/notice/notice_action.vue
var p = {
compatConfig: { MODE: 3 },
name: "DtNoticeAction",
components: {
DtIconClose: f,
DtButton: n,
SrOnlyCloseButton: r
},
props: {
hideClose: {
type: Boolean,
default: !1
},
hideAction: {
type: Boolean,
default: !1
}
},
emits: ["close"],
data() {
return { i18n: new t() };
},
computed: { closeButtonTitle() {
return this.i18n.$t("DIALTONE_CLOSE_BUTTON");
} },
mounted() {
this.hideClose || (this.lastFocusedElement = document.activeElement);
},
beforeUnmount() {
this.lastFocusedElement?.focus();
},
methods: { close() {
this.$emit("close");
} }
}, m = {
class: "d-notice__actions",
"data-qa": "notice-content-actions"
};
function h(e, t, n, r, f, p) {
let h = u("dt-icon-close"), g = u("dt-button"), _ = u("sr-only-close-button");
return c(), o("div", m, [n.hideAction ? a("", !0) : l(e.$slots, "default", { key: 0 }), n.hideClose ? (c(), i(_, {
key: 2,
onClose: p.close
}, null, 8, ["onClose"])) : (c(), i(g, {
key: 1,
ref: "closeButton",
circle: !0,
"data-qa": "dt-notice-action-close-button",
importance: "clear",
size: "sm",
"aria-label": p.closeButtonTitle,
title: p.closeButtonTitle,
onClick: p.close
}, {
icon: d(() => [s(h, { size: "200" })]),
_: 1
}, 8, [
"aria-label",
"title",
"onClick"
]))]);
}
var g = /* @__PURE__ */ e(p, [["render", h]]);
//#endregion
export { g as default };
//# sourceMappingURL=notice-action.js.map