import { defineComponent as b, computed as r, ref as g, openBlock as l, createElementBlock as s, normalizeClass as p, Fragment as y, renderList as $, withModifiers as B, toDisplayString as h } from "vue";
import { uniqueId as C } from "es-toolkit/compat";
import { _ as k } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const G = ["data-test"], w = ["data-test", "disabled", "onClick"], D = {
  name: "ll-button-group"
}, N = /* @__PURE__ */ b({
  ...D,
  props: {
    groupName: { default: C() },
    options: {},
    fullWidth: { type: Boolean, default: !1 },
    disabled: { type: Boolean, default: !1 },
    allowDeactivate: { type: Boolean, default: !1 }
  },
  emits: ["input"],
  setup(v, { emit: f }) {
    const e = v, _ = f, u = r(() => e.options.length === 1), i = r(() => e.allowDeactivate || u.value), o = g(e.options.find((t) => t.active) || null);
    function m(t) {
      var n;
      i.value && ((n = o.value) == null ? void 0 : n.id) === t.id ? o.value = null : o.value = t, _("input", o.value);
    }
    return (t, n) => (l(), s("div", {
      class: p([
        "flex",
        t.$style.buttonGroup,
        { "w-full": e.fullWidth },
        { [t.$style.single]: u.value },
        { [t.$style["can-deactivate"]]: i.value }
      ]),
      "data-test": `button-group-${t.$props.groupName}`
    }, [
      (l(!0), s(y, null, $(e.options, (a) => {
        var c, d;
        return l(), s("button", {
          key: `${e.groupName}-${a.id}`,
          class: p([t.$style.button, { [t.$style.active]: ((c = o.value) == null ? void 0 : c.id) === a.id }]),
          "data-test": `${e.groupName}-button-${((d = o.value) == null ? void 0 : d.id) === a.id ? "active" : "inactive"}`,
          tabindex: 0,
          disabled: e.disabled,
          onClick: B((z) => m(a), ["prevent"])
        }, h(a.text), 11, w);
      }), 128))
    ], 10, G));
  }
}), M = "_buttonGroup_Tj8Un", I = "_button_yto9I", S = "_single_veCYB", W = "_active_B9oOX", j = {
  buttonGroup: M,
  button: I,
  single: S,
  active: W,
  "can-deactivate": "_can-deactivate_s93tv"
}, q = {
  $style: j
}, T = /* @__PURE__ */ k(N, [["__cssModules", q]]);
export {
  T as default
};
//# sourceMappingURL=ButtonGroup.js.map
