/* @flow */ import React, { Component } from 'react'; import { connect } from 'react-redux'; import { setToolbarHovered } from '../actions'; import ToolbarButton from './ToolbarButton'; /** * Implements a toolbar in React/Web. It is a strip that contains a set of * toolbar items such as buttons. Toolbar is commonly placed inside of a * Toolbox. * * @class Toolbar * @extends Component */ class Toolbar extends Component { _renderToolbarButton: Function; /** * Base toolbar component's property types. * * @static */ static propTypes = { /** * Handler for mouse out event. */ _onMouseOut: React.PropTypes.func, /** * Handler for mouse over event. */ _onMouseOver: React.PropTypes.func, /** * Children of current React component. */ children: React.PropTypes.element, /** * Toolbar's class name. */ className: React.PropTypes.string, /** * Map with toolbar buttons. */ toolbarButtons: React.PropTypes.instanceOf(Map), /** * Indicates the position of the tooltip. */ tooltipPosition: React.PropTypes.oneOf([ 'bottom', 'left', 'right', 'top' ]) }; /** * Constructor of Primary toolbar class. * * @param {Object} props - Object containing React component properties. */ constructor(props) { super(props); // Bind callbacks to preverse this. this._renderToolbarButton = this._renderToolbarButton.bind(this); } /** * Implements React's {@link Component#render()}. * * @inheritdoc * @returns {ReactElement} */ render(): ReactElement<*> { const { className } = this.props; return (