@alifd/meet-react
Version:
Fusion Mobile React UI System Component
26 lines • 1.29 kB
JavaScript
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import { __rest } from "tslib";
import React, { createElement, forwardRef, Children, cloneElement } from "react";
import classNames from 'classnames';
import View from '../view';
var ButtonGroup = function ButtonGroup(props, ref) {
var _props$prefix = props.prefix,
prefix = _props$prefix === void 0 ? 'mt-' : _props$prefix,
size = props.size,
model = props.model,
className = props.className,
children = props.children,
other = __rest(props, ["prefix", "size", "model", "className", "children"]);
return /*#__PURE__*/React.createElement(View, _extends({
ref: ref,
className: classNames("".concat(prefix, "button-group"), className)
}, other), Children.map(children, function (child, index) {
return cloneElement(child, {
key: "mt_button_".concat(index),
model: model,
size: size
});
}));
};
ButtonGroup.displayName = 'Button.Group';
export default /*#__PURE__*/forwardRef(ButtonGroup);