import { defineComponent, ref, computed, provide, createVNode } from 'vue';
import getPrefixCls from '../_util/getPrefixCls';
import { useNormalModel } from '../_util/use/useModel';
import { useTheme } from '../_theme/useTheme';
import { COMPONENT_NAME, PROVIDE_KEY } from './const';

const prefixCls = getPrefixCls('steps');
const stepsProps = {
  current: {
    type: Number
  },
  status: {
    type: String,
    default: 'process'
  },
  type: {
    type: String,
    default: 'default'
  },
  vertical: {
    type: Boolean,
    default: false
  },
  initial: {
    type: Number,
    default: 1
  }
};
var steps = defineComponent({
  name: COMPONENT_NAME.STEPS,
  props: stepsProps,
  setup(props, _ref) {
    let {
      slots,
      emit
    } = _ref;
    useTheme();
    const parentDomRef = ref();
    const [current, updateCurrent] = useNormalModel(props, emit, {
      prop: 'current'
    });
    const classList = computed(() => [prefixCls, `is-${props.type}`, props.vertical && 'is-vertical'].filter(Boolean).join(' '));
    const count = ref(0);
    const onUpdate = () => {
      count.value += 1;
    };
    provide(PROVIDE_KEY, {
      current,
      updateCurrent,
      props,
      parentDomRef,
      count,
      onUpdate
    });
    return () => {
      var _slots$default;
      return createVNode("div", {
        "ref": parentDomRef,
        "class": classList.value
      }, [(_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)]);
    };
  }
});

export { steps as default, stepsProps };
