import { __rest } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import React, { useContext } from 'react';
import cls from 'clsx';
import { Checked } from '@react-vant/icons';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';

const Steps = _a => {
  var {
    children,
    className,
    style
  } = _a,
      props = __rest(_a, ["children", "className", "style"]);

  const {
    prefixCls,
    createNamespace
  } = useContext(ConfigProviderContext);
  const [bem] = createNamespace('steps', prefixCls);
  return _jsx("div", Object.assign({
    className: cls(className, bem([props.direction])),
    style: style
  }, {
    children: _jsx("div", Object.assign({
      className: cls(bem('items'))
    }, {
      children: React.Children.toArray(children).filter(Boolean).map((child, index) => React.cloneElement(child, {
        index,
        parent: props
      }))
    }))
  }));
};

Steps.defaultProps = {
  active: 0,
  direction: 'horizontal',
  activeIcon: _jsx(Checked, {})
};
export default Steps;