import { defineComponent, reactive, computed, createVNode } from 'vue';
import { flattenChildren } from '../_util/props-util/index.mjs';
import { useToken } from '../theme/internal.mjs';
import devWarning from '../vc-util/devWarning.mjs';
import '../hooks/index.mjs';
import { createContext } from '../hooks/createContext.mjs';
import useConfigInject from '../config-provider/hooks/useConfigInject.mjs';

const buttonGroupProps = () => ({
  prefixCls: String,
  size: {
    type: String
  }
});
const GroupSizeContext = createContext();
var ButtonGroup = /* @__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 { GroupSizeContext, buttonGroupProps, ButtonGroup as default };
//# sourceMappingURL=button-group.mjs.map
