import { defineComponent as C, ref as k, isVNode as S, h as n, watch as x, openBlock as i, createElementBlock as r, normalizeClass as m, unref as o, createVNode as b, withCtx as V, Fragment as w, renderList as B, normalizeStyle as N, createBlock as z, resolveDynamicComponent as F } from "vue";
import { Flex as L } from "@aplus-frontend/antdv";
import "../../config-provider/index.mjs";
import "../../hooks/index.mjs";
import A from "./style/index.mjs";
import { useNamespace as D } from "../../config-provider/hooks/use-namespace.mjs";
import { useControllableValue as E } from "../../hooks/useControllableValue.mjs";
const G = ["onClick"], M = /* @__PURE__ */ C({
  name: "ApRadioGroup",
  __name: "ap-radio-group",
  props: {
    value: { default: "" },
    delay: { default: 0 },
    options: { default: () => [] },
    optionStyle: { default: () => ({
      height: 28,
      gap: 8
    }) }
  },
  emits: ["update:value", "change"],
  setup(t, { emit: d }) {
    const { b: f, e: s } = D("ap-radio-group"), h = A("ap-radio-group"), u = t, c = d, { value: p, updateValue: g } = E(
      u,
      c
    ), l = k(p.value), y = (e) => S(e) ? n(e) : typeof e == "function" ? n("span", e()) : n("span", e);
    x(
      () => p.value,
      (e) => {
        e !== l.value && (l.value = e);
      }
    );
    const v = (e) => {
      l.value = e, setTimeout(() => {
        g(e), c("change", e);
      }, u.delay);
    };
    return (e, H) => (i(), r("div", {
      class: m([o(f)(), o(h)])
    }, [
      b(o(L), {
        gap: t.optionStyle?.gap,
        wrap: "wrap"
      }, {
        default: V(() => [
          (i(!0), r(w, null, B(t.options.filter((a) => a.visible !== !1), (a) => (i(), r("div", {
            key: a.value,
            class: m([
              o(s)("item"),
              l.value === a.value ? o(s)("item--active") : ""
            ]),
            style: N({
              height: t.optionStyle?.height + "px",
              lineHeight: t.optionStyle?.height + "px",
              color: t.optionStyle?.color
            }),
            onClick: (I) => v(a.value)
          }, [
            (i(), z(F(y(a.label))))
          ], 14, G))), 128))
        ]),
        _: 1
      }, 8, ["gap"])
    ], 2));
  }
});
export {
  M as default
};
