import PropTypes from 'prop-types'; import React from 'react'; import DropdownContext from './DropdownContext'; var propTypes = { /** * A render prop that returns a Toggle element. The `props` * argument should spread through to **a component that can accept a ref**. Use * the `onToggle` argument to toggle the menu open or closed * * @type {Function ({ * show: boolean, * toggle: (show: boolean) => void, * props: { * ref: (?HTMLElement) => void, * aria-haspopup: true * aria-expanded: boolean * }, * }) => React.Element} */ children: PropTypes.func.isRequired }; function DropdownToggle(_ref) { var children = _ref.children; return React.createElement(DropdownContext.Consumer, null, function (_ref2) { var show = _ref2.show, toggle = _ref2.toggle, toggleRef = _ref2.toggleRef; return children({ show: show, toggle: toggle, props: { ref: toggleRef, 'aria-haspopup': true, 'aria-expanded': !!show } }); }); } DropdownToggle.displayName = 'ReactOverlaysDropdownToggle'; DropdownToggle.propTypes = propTypes; export default DropdownToggle;