import { defineComponent as y, useSlots as k, computed as g, createElementBlock as o, openBlock as l, normalizeClass as d, createCommentVNode as r, createVNode as V, createElementVNode as B, createBlock as x, toDisplayString as a, unref as i, withCtx as c, renderSlot as C, Fragment as _, renderList as w, withKeys as $ } from "vue";
/* empty css                  */
import E from "../PlTooltip/PlTooltip.vue.js";
import K from "../../utils/InnerBorder.vue.js";
import { getErrorMessage as N } from "../../helpers/error.js";
const S = { key: 0 }, z = ["tabindex", "onKeydown", "onClick"], M = {
  key: 1,
  class: "pl-btn-group__helper"
}, D = {
  key: 2,
  class: "pl-btn-group__error"
}, F = {
  name: "PlBtnGroup"
}, q = /* @__PURE__ */ y({
  ...F,
  props: {
    modelValue: {},
    label: {},
    options: {},
    disabled: { type: Boolean },
    compact: { type: Boolean },
    helper: {},
    error: {}
  },
  emits: ["update:modelValue"],
  setup(e, { emit: u }) {
    const m = k(), p = u, s = (t) => p("update:modelValue", t), b = e, v = g(
      () => b.options.map((t) => ({
        label: "label" in t ? t.label : t.text,
        value: t.value
      }))
    );
    return (t, G) => (l(), o("div", {
      class: d(["pl-btn-group", { disabled: e.disabled, compact: e.compact }])
    }, [
      e.label ? (l(), o("label", S, [
        B("span", null, a(e.label), 1),
        i(m).tooltip ? (l(), x(i(E), {
          key: 0,
          class: "info",
          position: "top"
        }, {
          tooltip: c(() => [
            C(t.$slots, "tooltip")
          ]),
          _: 3
        })) : r("", !0)
      ])) : r("", !0),
      V(K, { class: "pl-btn-group__container" }, {
        default: c(() => [
          (l(!0), o(_, null, w(v.value, (n, f) => (l(), o("div", {
            key: f,
            class: d(["pl-btn-group__option text-s", { active: e.modelValue === n.value }]),
            tabindex: e.modelValue === n.value || e.disabled ? void 0 : 0,
            onKeydown: $((h) => s(n.value), ["enter"]),
            onClick: (h) => s(n.value)
          }, a(n.label), 43, z))), 128))
        ]),
        _: 1
      }),
      e.helper ? (l(), o("div", M, a(e.helper), 1)) : e.error ? (l(), o("div", D, a(i(N)(e.error)), 1)) : r("", !0)
    ], 2));
  }
});
export {
  q as default
};
//# sourceMappingURL=PlBtnGroup.vue.js.map
