import { defineComponent as m, ref as n, onMounted as d, createBlock as f, openBlock as a, unref as u, createSlots as v, withCtx as p, createElementVNode as t, normalizeClass as h, createElementBlock as y, createCommentVNode as k, renderSlot as r, withModifiers as $, withKeys as C } from "vue";
/* empty css             */
import _ from "../PlTooltip/PlTooltip.vue.js";
const w = { class: "pl-chip__text" }, E = /* @__PURE__ */ m({
  __name: "PlChip",
  props: {
    closeable: { type: Boolean },
    small: { type: Boolean }
  },
  emits: ["close"],
  setup(s) {
    const o = n(), i = n(!1);
    return d(() => {
      var e;
      o.value && (i.value = ((e = o.value) == null ? void 0 : e.clientWidth) >= 256);
    }), (e, l) => (a(), f(u(_), {
      position: "top",
      class: "pl-chip-tooltip",
      delay: 500
    }, v({
      default: p(() => [
        t("div", {
          ref_key: "chip",
          ref: o,
          class: h(["pl-chip", { small: s.small }])
        }, [
          t("div", w, [
            r(e.$slots, "default")
          ]),
          s.closeable ? (a(), y("div", {
            key: 0,
            tabindex: "0",
            class: "pl-chip__close",
            onKeydown: l[0] || (l[0] = C((c) => e.$emit("close"), ["enter"])),
            onClick: l[1] || (l[1] = $((c) => e.$emit("close"), ["stop"]))
          }, [...l[2] || (l[2] = [
            t("div", { class: "pl-chip__close--icon" }, null, -1)
          ])], 32)) : k("", !0)
        ], 2)
      ]),
      _: 2
    }, [
      i.value ? {
        name: "tooltip",
        fn: p(() => [
          r(e.$slots, "default")
        ]),
        key: "0"
      } : void 0
    ]), 1024));
  }
});
export {
  E as default
};
//# sourceMappingURL=PlChip.vue.js.map
