@alifd/next
Version:
A configurable component library for web built on React.
43 lines (35 loc) • 1.47 kB
JavaScript
import _extends from 'babel-runtime/helpers/extends';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import ConfigProvider from '../config-provider';
import Button from './view/button';
import ButtonGroup from './view/group';
Button.Group = ButtonGroup;
export default ConfigProvider.config(Button, {
transform: /* istanbul ignore next */function transform(props, deprecated) {
if ('shape' in props) {
deprecated('shape', 'text | warning | ghost', 'Button');
var _props = props,
shape = _props.shape,
type = _props.type,
others = _objectWithoutProperties(_props, ['shape', 'type']);
var newType = type;
if (type === 'light' || type === 'dark' || type === 'secondary' && shape === 'warning') {
newType = 'normal';
}
var ghost = void 0;
if (shape === 'ghost') {
ghost = {
primary: 'dark',
secondary: 'dark',
normal: 'light',
dark: 'dark',
light: 'light'
}[type || Button.defaultProps.type];
}
var text = shape === 'text';
var warning = shape === 'warning';
props = _extends({ type: newType, ghost: ghost, text: text, warning: warning }, others);
}
return props;
}
});