'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var index = require('../_util/props-util/index.js');
var internal = require('../theme/internal.js');
var devWarning = require('../vc-util/devWarning.js');
require('../hooks/index.js');
var createContext = require('../hooks/createContext.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');

const buttonGroupProps = () => ({
  prefixCls: String,
  size: {
    type: String
  }
});
const GroupSizeContext = createContext.createContext();
var ButtonGroup = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "AButtonGroup",
  props: buttonGroupProps(),
  setup(props, {
    slots
  }) {
    const {
      prefixCls,
      direction
    } = useConfigInject.default("btn-group", props);
    const [, , hashId] = internal.useToken();
    GroupSizeContext.useProvide(vue.reactive({
      size: vue.computed(() => props.size)
    }));
    const classes = vue.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.default(!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 vue.createVNode("div", {
        "class": classes.value
      }, [index.flattenChildren((_a = slots.default) == null ? void 0 : _a.call(slots))]);
    };
  }
});

exports.GroupSizeContext = GroupSizeContext;
exports.buttonGroupProps = buttonGroupProps;
exports.default = ButtonGroup;
//# sourceMappingURL=button-group.js.map
