'use strict';

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

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _Overlay = require('../Overlay');

var _Overlay2 = _interopRequireDefault(_Overlay);

var _Button = require('../Button');

var _Button2 = _interopRequireDefault(_Button);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);

var _pxModal = require('./px-modal.scss');

var _pxModal2 = _interopRequireDefault(_pxModal);

var _styledComponents = require('styled-components');

var _styledComponents2 = _interopRequireDefault(_styledComponents);

var _flex = require('../../flex');

var _flex2 = _interopRequireDefault(_flex);

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

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

exports.default = function (_ref) {
  var _React$createElement;

  var style = _ref.style,
      headerText = _ref.headerText,
      rejectText = _ref.rejectText,
      onBtnModalNegativeClick = _ref.onBtnModalNegativeClick,
      acceptText = _ref.acceptText,
      onBtnModalPositiveClick = _ref.onBtnModalPositiveClick,
      visible = _ref.visible,
      opened = _ref.opened,
      onBackdropClick = _ref.onBackdropClick,
      _ref$btnModalPositive = _ref.btnModalPositiveDisabled,
      btnModalPositiveDisabled = _ref$btnModalPositive === undefined ? false : _ref$btnModalPositive,
      children = _ref.children;


  var modalClassnames = (0, _classnames2.default)('modal', 'flex', 'flex--middle', 'flex--center', 'full-height', { 'invisible': !opened });

  return _react2.default.createElement(
    'div',
    { className: 'px-modal' },
    _react2.default.createElement(_Overlay2.default, { opened: opened, onOverlayClick: function onOverlayClick(e) {
        return onBackdropClick(e);
      } }),
    _react2.default.createElement(
      'div',
      { className: modalClassnames, role: 'dialog' },
      _react2.default.createElement(
        'section',
        { className: 'modal__content', role: 'region' },
        _react2.default.createElement(
          'h3',
          { className: 'modal__title epsilon weight--normal' },
          headerText
        ),
        _react2.default.createElement(
          'div',
          null,
          children
        ),
        _react2.default.createElement(
          'div',
          { className: 'modal__buttons flex flex--right' },
          _react2.default.createElement(
            _flex2.default,
            { right: true },
            rejectText && _react2.default.createElement(
              _Button2.default,
              { id: 'btnModalNegative',
                onClick: onBtnModalNegativeClick },
              rejectText
            ),
            acceptText && _react2.default.createElement(
              _Button2.default,
              (_React$createElement = { primary: true,
                id: 'btnModalPositive'
              }, _defineProperty(_React$createElement, 'primary', true), _defineProperty(_React$createElement, 'disabled', btnModalPositiveDisabled), _defineProperty(_React$createElement, 'onClick', onBtnModalPositiveClick), _React$createElement),
              acceptText
            )
          )
        )
      )
    )
  );
};