Dashboard sipadu mbip
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DropdownButton.js 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
  3. import React from 'react';
  4. import PropTypes from 'prop-types';
  5. import Dropdown from './Dropdown';
  6. var propTypes = {
  7. /**
  8. * An html id attribute for the Toggle button, necessary for assistive technologies, such as screen readers.
  9. * @type {string|number}
  10. * @required
  11. */
  12. id: PropTypes.any,
  13. /** An `href` passed to the Toggle component */
  14. href: PropTypes.string,
  15. /** An `onClick` handler passed to the Toggle component */
  16. onClick: PropTypes.func,
  17. /** The content of the non-toggle Button. */
  18. title: PropTypes.node.isRequired,
  19. /** Disables both Buttons */
  20. disabled: PropTypes.bool,
  21. /** An ARIA accessible role applied to the Menu component. When set to 'menu', The dropdown */
  22. menuRole: PropTypes.string,
  23. /**
  24. * Which event when fired outside the component will cause it to be closed.
  25. *
  26. * _see [DropdownMenu](#menu-props) for more details_
  27. */
  28. rootCloseEvent: PropTypes.string,
  29. /** @ignore */
  30. bsPrefix: PropTypes.string,
  31. /** @ignore */
  32. variant: PropTypes.string,
  33. /** @ignore */
  34. size: PropTypes.string
  35. };
  36. /**
  37. * A convenience component for simple or general use dropdowns. Renders a `Button` toggle and all `children`
  38. * are passed directly to the default `Dropdown.Menu`.
  39. *
  40. * _All unknown props are passed through to the `Dropdown` component._ Only
  41. * the Button `variant`, `size` and `bsPrefix` props are passed to the toggle,
  42. * along with menu related props are passed to the `Dropdown.Menu`
  43. */
  44. var DropdownButton = React.forwardRef(function (_ref, ref) {
  45. var title = _ref.title,
  46. children = _ref.children,
  47. bsPrefix = _ref.bsPrefix,
  48. rootCloseEvent = _ref.rootCloseEvent,
  49. variant = _ref.variant,
  50. size = _ref.size,
  51. menuRole = _ref.menuRole,
  52. disabled = _ref.disabled,
  53. href = _ref.href,
  54. id = _ref.id,
  55. props = _objectWithoutPropertiesLoose(_ref, ["title", "children", "bsPrefix", "rootCloseEvent", "variant", "size", "menuRole", "disabled", "href", "id"]);
  56. return React.createElement(Dropdown, _extends({
  57. ref: ref
  58. }, props), React.createElement(Dropdown.Toggle, {
  59. id: id,
  60. href: href,
  61. size: size,
  62. variant: variant,
  63. disabled: disabled,
  64. childBsPrefix: bsPrefix
  65. }, title), React.createElement(Dropdown.Menu, {
  66. role: menuRole,
  67. rootCloseEvent: rootCloseEvent
  68. }, children));
  69. });
  70. DropdownButton.displayName = 'DropdownButton';
  71. DropdownButton.propTypes = propTypes;
  72. export default DropdownButton;