UNPKG

@attivio/suit

Version:

Attivio SUIT, the Search UI Toolkit, is a library for creating search clients for searching the Attivio platform.

94 lines (79 loc) 3.44 kB
'use strict'; exports.__esModule = true; exports.default = undefined; var _class, _temp; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactBootstrap = require('react-bootstrap'); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** * Component to display a dialog box asking for confirmation from the user. */ var ConfirmationDialog = (_temp = _class = function (_React$Component) { _inherits(ConfirmationDialog, _React$Component); function ConfirmationDialog() { _classCallCheck(this, ConfirmationDialog); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } ConfirmationDialog.prototype.render = function render() { var _props = this.props, cancelButtonLabel = _props.cancelButtonLabel, children = _props.children, confirmButtonDisabled = _props.confirmButtonDisabled, confirmButtonLabel = _props.confirmButtonLabel, dangerous = _props.dangerous, onCancel = _props.onCancel, onConfirm = _props.onConfirm, show = _props.show, title = _props.title; var okButtonStyle = dangerous ? 'danger' : 'primary'; return _react2.default.createElement( _reactBootstrap.Modal, { show: show, onHide: onCancel }, _react2.default.createElement( _reactBootstrap.Modal.Header, null, _react2.default.createElement( _reactBootstrap.Modal.Title, null, title ) ), _react2.default.createElement( _reactBootstrap.Modal.Body, null, _react2.default.createElement( 'div', null, children ) ), _react2.default.createElement( _reactBootstrap.Modal.Footer, null, _react2.default.createElement( _reactBootstrap.Button, { onClick: onCancel }, cancelButtonLabel ), _react2.default.createElement( _reactBootstrap.Button, { onClick: onConfirm, bsStyle: okButtonStyle, disabled: confirmButtonDisabled }, confirmButtonLabel ) ) ); }; return ConfirmationDialog; }(_react2.default.Component), _class.defaultProps = { cancelButtonLabel: 'Cancel', confirmButtonDisabled: false, confirmButtonLabel: 'OK', dangerous: false, show: false }, _class.displayName = 'ConfirmationDialog', _temp); exports.default = ConfirmationDialog; module.exports = exports['default'];