1 | import _objectWithoutPropertiesLoose from "@babel/runtime-corejs2/helpers/esm/objectWithoutPropertiesLoose";
|
2 | import _inheritsLoose from "@babel/runtime-corejs2/helpers/esm/inheritsLoose";
|
3 | import _extends from "@babel/runtime-corejs2/helpers/esm/extends";
|
4 | import React from 'react';
|
5 | import PropTypes from 'prop-types';
|
6 | import Button from './Button';
|
7 | import Dropdown from './Dropdown';
|
8 | import SplitToggle from './SplitToggle';
|
9 | import splitComponentProps from './utils/splitComponentProps';
|
10 |
|
11 | var propTypes = _extends({}, Dropdown.propTypes, {
|
12 |
|
13 | bsStyle: PropTypes.string,
|
14 | bsSize: PropTypes.string,
|
15 | href: PropTypes.string,
|
16 | onClick: PropTypes.func,
|
17 |
|
18 | |
19 |
|
20 |
|
21 | title: PropTypes.node.isRequired,
|
22 |
|
23 | |
24 |
|
25 |
|
26 | toggleLabel: PropTypes.string,
|
27 |
|
28 |
|
29 | |
30 |
|
31 |
|
32 | children: PropTypes.node
|
33 | });
|
34 |
|
35 | var SplitButton =
|
36 |
|
37 | function (_React$Component) {
|
38 | _inheritsLoose(SplitButton, _React$Component);
|
39 |
|
40 | function SplitButton() {
|
41 | return _React$Component.apply(this, arguments) || this;
|
42 | }
|
43 |
|
44 | var _proto = SplitButton.prototype;
|
45 |
|
46 | _proto.render = function render() {
|
47 | var _this$props = this.props,
|
48 | bsSize = _this$props.bsSize,
|
49 | bsStyle = _this$props.bsStyle,
|
50 | title = _this$props.title,
|
51 | toggleLabel = _this$props.toggleLabel,
|
52 | children = _this$props.children,
|
53 | props = _objectWithoutPropertiesLoose(_this$props, ["bsSize", "bsStyle", "title", "toggleLabel", "children"]);
|
54 |
|
55 | var _splitComponentProps = splitComponentProps(props, Dropdown.ControlledComponent),
|
56 | dropdownProps = _splitComponentProps[0],
|
57 | buttonProps = _splitComponentProps[1];
|
58 |
|
59 | return React.createElement(Dropdown, _extends({}, dropdownProps, {
|
60 | bsSize: bsSize,
|
61 | bsStyle: bsStyle
|
62 | }), React.createElement(Button, _extends({}, buttonProps, {
|
63 | disabled: props.disabled,
|
64 | bsSize: bsSize,
|
65 | bsStyle: bsStyle
|
66 | }), title), React.createElement(SplitToggle, {
|
67 | "aria-label": toggleLabel || title,
|
68 | bsSize: bsSize,
|
69 | bsStyle: bsStyle
|
70 | }), React.createElement(Dropdown.Menu, null, children));
|
71 | };
|
72 |
|
73 | return SplitButton;
|
74 | }(React.Component);
|
75 |
|
76 | SplitButton.propTypes = propTypes;
|
77 | SplitButton.Toggle = SplitToggle;
|
78 | export default SplitButton; |
\ | No newline at end of file |