1 | import _extends from "@babel/runtime/helpers/esm/extends";
|
2 | import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
3 |
|
4 | var __rest = this && this.__rest || function (s, e) {
|
5 | var t = {};
|
6 |
|
7 | for (var p in s) {
|
8 | if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
9 | }
|
10 |
|
11 | if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
12 | if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
13 | }
|
14 | return t;
|
15 | };
|
16 |
|
17 | import * as React from 'react';
|
18 | import classNames from 'classnames';
|
19 | import { ConfigConsumer } from '../config-provider';
|
20 | import UnreachableException from '../_util/unreachableException';
|
21 |
|
22 | var ButtonGroup = function ButtonGroup(props) {
|
23 | return React.createElement(ConfigConsumer, null, function (_ref) {
|
24 | var _classNames;
|
25 |
|
26 | var getPrefixCls = _ref.getPrefixCls,
|
27 | direction = _ref.direction;
|
28 |
|
29 | var customizePrefixCls = props.prefixCls,
|
30 | size = props.size,
|
31 | className = props.className,
|
32 | others = __rest(props, ["prefixCls", "size", "className"]);
|
33 |
|
34 | var prefixCls = getPrefixCls('btn-group', customizePrefixCls);
|
35 |
|
36 |
|
37 | var sizeCls = '';
|
38 |
|
39 | switch (size) {
|
40 | case 'large':
|
41 | sizeCls = 'lg';
|
42 | break;
|
43 |
|
44 | case 'small':
|
45 | sizeCls = 'sm';
|
46 | break;
|
47 |
|
48 | case 'middle':
|
49 | case undefined:
|
50 | break;
|
51 |
|
52 | default:
|
53 |
|
54 | console.warn(new UnreachableException(size));
|
55 | }
|
56 |
|
57 | var classes = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(sizeCls), sizeCls), _defineProperty(_classNames, "".concat(prefixCls, "-rtl"), direction === 'rtl'), _classNames), className);
|
58 | return React.createElement("div", _extends({}, others, {
|
59 | className: classes
|
60 | }));
|
61 | });
|
62 | };
|
63 |
|
64 | export default ButtonGroup; |
\ | No newline at end of file |