您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

OverflowToggleButton.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // @flow
  2. import { translate } from '../../../base/i18n';
  3. import { IconHorizontalPoints } from '../../../base/icons';
  4. import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
  5. /**
  6. * The type of the React {@code Component} props of {@link OverflowToggleButton}.
  7. */
  8. type Props = AbstractButtonProps & {
  9. /**
  10. * Whether the more options menu is open.
  11. */
  12. isOpen: boolean,
  13. /**
  14. * External handler for key down action.
  15. */
  16. onKeyDown: Function,
  17. };
  18. /**
  19. * Implementation of a button for toggling the overflow menu.
  20. */
  21. class OverflowToggleButton extends AbstractButton<Props, *> {
  22. accessibilityLabel = 'toolbar.accessibilityLabel.moreActions';
  23. icon = IconHorizontalPoints;
  24. label = 'toolbar.moreActions';
  25. toggledLabel = 'toolbar.moreActions';
  26. /**
  27. * Retrieves tooltip dynamically.
  28. */
  29. get tooltip() {
  30. return 'toolbar.moreActions';
  31. }
  32. /**
  33. * Required by linter due to AbstractButton overwritten prop being writable.
  34. *
  35. * @param {string} _value - The value.
  36. */
  37. set tooltip(_value) {
  38. // Unused.
  39. }
  40. /**
  41. * Indicates whether this button is in toggled state or not.
  42. *
  43. * @override
  44. * @protected
  45. * @returns {boolean}
  46. */
  47. _isToggled() {
  48. return this.props.isOpen;
  49. }
  50. /**
  51. * Indicates whether a key was pressed.
  52. *
  53. * @override
  54. * @protected
  55. * @returns {boolean}
  56. */
  57. _onKeyDown() {
  58. this.props.onKeyDown();
  59. }
  60. }
  61. export default translate(OverflowToggleButton);