UNPKG

@talend/react-bootstrap

Version:

Bootstrap 3 components built with React

63 lines 1.72 kB
import React from 'react'; import PropTypes from 'prop-types'; import Button from './Button'; import Dropdown from './Dropdown'; import SplitToggle from './SplitToggle'; import splitComponentProps from './utils/splitComponentProps'; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; const propTypes = { ...Dropdown.propTypes, // Toggle props. bsStyle: PropTypes.string, bsSize: PropTypes.string, href: PropTypes.string, onClick: PropTypes.func, /** * The content of the split button. */ title: PropTypes.node.isRequired, /** * Accessible label for the toggle; the value of `title` if not specified. */ toggleLabel: PropTypes.string, // Override generated docs from <Dropdown>. /** * @private */ children: PropTypes.node }; class SplitButton extends React.Component { render() { const { bsSize, bsStyle, title, toggleLabel, children, ...props } = this.props; const [dropdownProps, buttonProps] = splitComponentProps(props, Dropdown.ControlledComponent); return /*#__PURE__*/_jsxs(Dropdown, { ...dropdownProps, bsSize: bsSize, bsStyle: bsStyle, children: [/*#__PURE__*/_jsx(Button, { ...buttonProps, disabled: props.disabled, bsSize: bsSize, bsStyle: bsStyle, children: title }), /*#__PURE__*/_jsx(SplitToggle, { "aria-label": toggleLabel || title, bsSize: bsSize, bsStyle: bsStyle }), /*#__PURE__*/_jsx(Dropdown.Menu, { children: children })] }); } } SplitButton.propTypes = propTypes; SplitButton.Toggle = SplitToggle; export default SplitButton; //# sourceMappingURL=SplitButton.js.map