'use strict';

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

var vue = require('vue');
var iconsVue = require('@ant-design/icons-vue');
require('../../../utils/index.cjs');
require('../../../vue-components/index.cjs');
require('../../../hooks/index.cjs');
require('../../../theme/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var index$2 = require('../../progress/index.cjs');
var index$3 = require('../../tooltip/index.cjs');
var index = require('../style/index.cjs');
var props = require('./props.cjs');
var initDefaultProps = require('../../../utils/vue/initDefaultProps.cjs');
var internal = require('../../../theme/token/internal.cjs');
var index$1 = require('../../../hooks/use-breakpoint/index.cjs');
var _class = require('../../../utils/dom/class.cjs');
var Steps = require('../../../vue-components/vc-steps/src/Steps.cjs');
var omit = require('../../../utils/lang/omit.cjs');

var ASteps = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "ASteps",
  inheritAttrs: false,
  props: initDefaultProps.initDefaultProps(props.stepsProps(), {
    current: 0,
    responsive: true,
    labelPlacement: "horizontal"
  }),
  slots: Object,
  // emits: ['update:current', 'change'],
  setup(props, {
    attrs,
    slots,
    emit
  }) {
    const {
      prefixCls,
      direction: rtlDirection,
      configProvider
    } = useConfigInject.default("steps", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const [, token] = internal.useToken();
    const screens = index$1.useBreakpoint();
    const direction = vue.computed(() => props.responsive && screens.value.xs ? "vertical" : props.direction);
    const iconPrefix = vue.computed(() => configProvider.getPrefixCls("", props.iconPrefix));
    const handleChange = (current) => {
      emit("update:current", current);
      emit("change", current);
    };
    const isInline = vue.computed(() => props.type === "inline");
    const mergedPercent = vue.computed(() => isInline.value ? void 0 : props.percent);
    const stepIconRender = ({
      node,
      status
    }) => {
      if (status === "process" && props.percent !== void 0) {
        const progressWidth = props.size === "small" ? token.value.controlHeight : token.value.controlHeightLG;
        const iconWithProgress = vue.createVNode("div", {
          "class": `${prefixCls.value}-progress-icon`
        }, [vue.createVNode(index$2.Progress, {
          "type": "circle",
          "percent": mergedPercent.value,
          "size": progressWidth,
          "strokeWidth": 4,
          "format": () => null
        }, null), node]);
        return iconWithProgress;
      }
      return node;
    };
    const icons = vue.computed(() => ({
      finish: vue.createVNode(iconsVue.CheckOutlined, {
        "class": `${prefixCls.value}-finish-icon`
      }, null),
      error: vue.createVNode(iconsVue.CloseOutlined, {
        "class": `${prefixCls.value}-error-icon`
      }, null)
    }));
    return () => {
      const stepsClassName = _class.classNames({
        [`${prefixCls.value}-rtl`]: rtlDirection.value === "rtl",
        [`${prefixCls.value}-with-progress`]: mergedPercent.value !== void 0
      }, attrs.class, hashId.value);
      const itemRender = (item, stepItem) => item.description ? vue.createVNode(index$3.Tooltip, {
        "title": item.description
      }, {
        default: () => [stepItem]
      }) : stepItem;
      return wrapSSR(vue.createVNode(Steps.default, {
        "icons": icons.value,
        ...attrs,
        ...omit.omit(props, ["percent", "responsive"]),
        "items": props.items,
        "direction": direction.value,
        "prefixCls": prefixCls.value,
        "iconPrefix": iconPrefix.value,
        "class": stepsClassName,
        "onChange": handleChange,
        "isInline": isInline.value,
        "itemRender": isInline.value ? itemRender : void 0
      }, {
        stepIcon: stepIconRender,
        ...slots
      }));
    };
  }
});

exports.default = ASteps;
//# sourceMappingURL=Steps.cjs.map
