var _excluded = ["children", "className", "style"];

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React, { useContext } from 'react';
import cls from 'clsx';
import { Checked } from '@react-vant/icons';
import ConfigProviderContext from '../config-provider/ConfigProviderContext';

var Steps = function Steps(_ref) {
  var children = _ref.children,
      className = _ref.className,
      style = _ref.style,
      props = _objectWithoutPropertiesLoose(_ref, _excluded);

  var _useContext = useContext(ConfigProviderContext),
      prefixCls = _useContext.prefixCls,
      createNamespace = _useContext.createNamespace;

  var _createNamespace = createNamespace('steps', prefixCls),
      bem = _createNamespace[0];

  return /*#__PURE__*/React.createElement("div", {
    className: cls(className, bem([props.direction])),
    style: style
  }, /*#__PURE__*/React.createElement("div", {
    className: cls(bem('items'))
  }, React.Children.toArray(children).filter(Boolean).map(function (child, index) {
    return /*#__PURE__*/React.cloneElement(child, {
      index: index,
      parent: props
    });
  })));
};

Steps.defaultProps = {
  active: 0,
  direction: 'horizontal',
  activeIcon: /*#__PURE__*/React.createElement(Checked, null)
};
export default Steps;