import { DtIconClose as n } from "@dialpad/dialtone-icons/vue2";
import s from "../../shared/sr_only_close_button.js";
import { DialtoneLocalization as i } from "../../localization/index.js";
import { n as c } from "../../_plugin-vue2_normalizer-DSLOjnn3.js";
import l from "../button/button.js";
const r = {
  name: "DtNoticeAction",
  components: {
    DtIconClose: n,
    DtButton: l,
    SrOnlyCloseButton: s
  },
  props: {
    /**
     * Hides the close button from the notice
     * @values true, false
     */
    hideClose: {
      type: Boolean,
      default: !1
    },
    /**
     * Hides the action from the notice
     * @values true, false
     */
    hideAction: {
      type: Boolean,
      default: !1
    }
  },
  emits: [
    /**
     * Close button click event
     *
     * @event close
     */
    "close"
  ],
  data() {
    return {
      i18n: new i()
    };
  },
  computed: {
    noticeActionListeners() {
      return {
        ...this.$listeners,
        click: (e) => {
          this.close(), this.$emit("click", e);
        }
      };
    },
    closeButtonTitle() {
      return this.i18n.$t("DIALTONE_CLOSE_BUTTON");
    }
  },
  mounted() {
    this.hideClose || (this.lastFocusedElement = document.activeElement);
  },
  beforeDestroy() {
    var e;
    (e = this.lastFocusedElement) == null || e.focus();
  },
  methods: {
    close() {
      this.$emit("close");
    }
  }
};
var a = function() {
  var t = this, o = t._self._c;
  return o("div", { staticClass: "d-notice__actions", attrs: { "data-qa": "notice-content-actions" } }, [t.hideAction ? t._e() : t._t("default"), t.hideClose ? o("sr-only-close-button", { on: { close: t.close } }) : o("dt-button", t._g({ ref: "closeButton", attrs: { circle: "", "data-qa": "dt-notice-action-close-button", importance: "clear", size: "sm", "aria-label": t.closeButtonTitle, title: t.closeButtonTitle }, scopedSlots: t._u([{ key: "icon", fn: function() {
    return [o("dt-icon-close", { attrs: { size: "200" } })];
  }, proxy: !0 }], null, !1, 4156074325) }, t.noticeActionListeners))], 2);
}, m = [], u = /* @__PURE__ */ c(
  r,
  a,
  m
);
const B = u.exports;
export {
  B as default
};
//# sourceMappingURL=notice-action.js.map
