import { defineComponent, reactive, computed, createVNode } from 'vue';
import '../../../utils/index.mjs';
import '../../../theme/index.mjs';
import useConfigInject from '../../config-provider/src/hooks/useConfigInject.mjs';
import { buttonGroupProps } from './props.mjs';
import { GroupSizeContext } from './context.mjs';
import { useToken } from '../../../theme/token/internal.mjs';
import { devWarning } from '../../../utils/log.mjs';
import { flattenChildren } from '../../../utils/vue/props.mjs';

var AButtonGroup = /* @__PURE__ */ defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "AButtonGroup",
  props: buttonGroupProps(),
  setup(props, {
    slots
  }) {
    const {
      prefixCls,
      direction
    } = useConfigInject("btn-group", props);
    const [, , hashId] = useToken();
    GroupSizeContext.useProvide(reactive({
      size: computed(() => props.size)
    }));
    const classes = computed(() => {
      const {
        size
      } = props;
      let sizeCls = "";
      switch (size) {
        case "large":
          sizeCls = "lg";
          break;
        case "small":
          sizeCls = "sm";
          break;
        case "middle":
        case void 0:
          break;
        default:
          devWarning(!size, "Button.Group", "Invalid prop `size`.");
      }
      return {
        [`${prefixCls.value}`]: true,
        [`${prefixCls.value}-${sizeCls}`]: sizeCls,
        [`${prefixCls.value}-rtl`]: direction.value === "rtl",
        [hashId.value]: true
      };
    });
    return () => {
      var _a;
      return createVNode("div", {
        "class": classes.value
      }, [flattenChildren((_a = slots.default) == null ? void 0 : _a.call(slots))]);
    };
  }
});

export { AButtonGroup as default };
//# sourceMappingURL=ButtonGroup.mjs.map
