"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "Steps", {
    enumerable: true,
    get: function() {
        return Steps;
    }
});
var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
var _define_property = require("@swc/helpers/_/_define_property");
var _object_spread = require("@swc/helpers/_/_object_spread");
var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
var _react = /*#__PURE__*/ _interop_require_default._(require("react"));
var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
var _components = require("@tarojs/components");
var _context = require("./context");
var _typings = require("../../utils/typings");
var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
    direction: 'horizontal',
    layout: 'single',
    type: 'text',
    status: 'default',
    value: 0,
    icon: null
});
var Steps = function Steps(props) {
    var propSteps = (0, _object_spread._)({}, defaultProps, props);
    var direction = propSteps.direction, value = propSteps.value, layout = propSteps.layout, status = propSteps.status, type = propSteps.type, className = propSteps.className, children = propSteps.children, onStepClick = propSteps.onStepClick, restProps = (0, _object_without_properties._)(propSteps, [
        "direction",
        "value",
        "layout",
        "status",
        "type",
        "className",
        "children",
        "onStepClick"
    ]);
    var parentSteps = {
        propSteps: propSteps
    };
    var classPrefix = "nut-steps";
    var _obj;
    var classes = (0, _classnames.default)(classPrefix, (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(direction), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(direction, "-count-").concat(_react.default.Children.count(children)), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(direction, "-").concat(layout), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(direction, "-").concat(type), true), (0, _define_property._)(_obj, "".concat(classPrefix, "-").concat(direction, "-").concat(status), true), _obj), className);
    return /*#__PURE__*/ _react.default.createElement(_context.DataContext.Provider, {
        value: parentSteps
    }, /*#__PURE__*/ _react.default.createElement(_components.View, {
        className: classes
    }, _react.default.Children.map(children, function(child, index) {
        if (/*#__PURE__*/ _react.default.isValidElement(child)) {
            return /*#__PURE__*/ _react.default.cloneElement(child, {
                // @ts-ignore
                className: (0, _classnames.default)(child.props.className, {
                    'nut-step-last': index === _react.default.Children.count(children) - 1
                })
            });
        }
        return child;
    })));
};
Steps.displayName = 'NutSteps';
