tiramisu-react-form
Version:
form component for reactjs
43 lines (31 loc) • 945 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = function (parentProps) {
var lng = parentProps.lng,
children = parentProps.children,
onChange = parentProps.onChange,
classNames = parentProps.classNames,
errors = parentProps.errors,
width = parentProps.width,
values = parentProps.values;
var props = {
lng: lng,
onChange: onChange,
classNames: classNames,
errors: errors,
values: values
};
var childrenWithProps = _react2.default.Children.map(children, function (child) {
if (typeof child.type !== 'function') {
return _react2.default.cloneElement(child, {});
} else {
return _react2.default.cloneElement(child, props);
}
});
return childrenWithProps;
};
;