"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.default = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose")); var _react = _interopRequireDefault(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _Dropdown = _interopRequireDefault(require("./Dropdown")); var propTypes = { /** * An html id attribute for the Toggle button, necessary for assistive technologies, such as screen readers. * @type {string|number} * @required */ id: _propTypes.default.any, /** An `href` passed to the Toggle component */ href: _propTypes.default.string, /** An `onClick` handler passed to the Toggle component */ onClick: _propTypes.default.func, /** The content of the non-toggle Button. */ title: _propTypes.default.node.isRequired, /** Disables both Buttons */ disabled: _propTypes.default.bool, /** An ARIA accessible role applied to the Menu component. When set to 'menu', The dropdown */ menuRole: _propTypes.default.string, /** * Which event when fired outside the component will cause it to be closed. * * _see [DropdownMenu](#menu-props) for more details_ */ rootCloseEvent: _propTypes.default.string, /** @ignore */ bsPrefix: _propTypes.default.string, /** @ignore */ variant: _propTypes.default.string, /** @ignore */ size: _propTypes.default.string }; /** * A convenience component for simple or general use dropdowns. Renders a `Button` toggle and all `children` * are passed directly to the default `Dropdown.Menu`. * * _All unknown props are passed through to the `Dropdown` component._ Only * the Button `variant`, `size` and `bsPrefix` props are passed to the toggle, * along with menu related props are passed to the `Dropdown.Menu` */ var DropdownButton = _react.default.forwardRef(function (_ref, ref) { var title = _ref.title, children = _ref.children, bsPrefix = _ref.bsPrefix, rootCloseEvent = _ref.rootCloseEvent, variant = _ref.variant, size = _ref.size, menuRole = _ref.menuRole, disabled = _ref.disabled, href = _ref.href, id = _ref.id, props = (0, _objectWithoutPropertiesLoose2.default)(_ref, ["title", "children", "bsPrefix", "rootCloseEvent", "variant", "size", "menuRole", "disabled", "href", "id"]); return _react.default.createElement(_Dropdown.default, (0, _extends2.default)({ ref: ref }, props), _react.default.createElement(_Dropdown.default.Toggle, { id: id, href: href, size: size, variant: variant, disabled: disabled, childBsPrefix: bsPrefix }, title), _react.default.createElement(_Dropdown.default.Menu, { role: menuRole, rootCloseEvent: rootCloseEvent }, children)); }); DropdownButton.displayName = 'DropdownButton'; DropdownButton.propTypes = propTypes; var _default = DropdownButton; exports.default = _default; module.exports = exports["default"];