'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _Modal = require('react-bootstrap/lib/Modal');

var _Modal2 = _interopRequireDefault(_Modal);

var _Action = require('../Actions/Action');

var _Action2 = _interopRequireDefault(_Action);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * @param {object} props react props
 * @example
<Dialog name="Hello world"></Dialog>
 */
function Dialog(props) {
	var modalProps = _extends({ bsSize: props.size, show: props.show }, props.bsDialogProps);
	return _react2.default.createElement(
		_Modal2.default,
		modalProps,
		props.header && _react2.default.createElement(
			_Modal2.default.Header,
			{ closeButton: true },
			_react2.default.createElement(
				_Modal2.default.Title,
				null,
				props.header
			)
		),
		_react2.default.createElement(
			_Modal2.default.Body,
			null,
			props.children
		),
		props.action && _react2.default.createElement(
			_Modal2.default.Footer,
			null,
			_react2.default.createElement(_Action2.default, props.action)
		)
	);
}

Dialog.propTypes = {
	header: _react.PropTypes.string,
	size: _react.PropTypes.oneOf(['small', 'large']),
	children: _react.PropTypes.element,
	show: _react.PropTypes.bool,
	action: _react.PropTypes.shape(_Action2.default.propTypes),
	bsDialogProps: _react.PropTypes.shape(_extends({}, _Modal2.default.propTypes, { manager: _react.PropTypes.object }))
};

exports.default = Dialog;