UNPKG

@attivio/suit

Version:

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

85 lines (73 loc) 2.98 kB
var _class, _temp; 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; } import React from 'react'; import { Modal, Button } from 'react-bootstrap'; /** * 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 React.createElement( Modal, { show: show, onHide: onCancel }, React.createElement( Modal.Header, null, React.createElement( Modal.Title, null, title ) ), React.createElement( Modal.Body, null, React.createElement( 'div', null, children ) ), React.createElement( Modal.Footer, null, React.createElement( Button, { onClick: onCancel }, cancelButtonLabel ), React.createElement( Button, { onClick: onConfirm, bsStyle: okButtonStyle, disabled: confirmButtonDisabled }, confirmButtonLabel ) ) ); }; return ConfirmationDialog; }(React.Component), _class.defaultProps = { cancelButtonLabel: 'Cancel', confirmButtonDisabled: false, confirmButtonLabel: 'OK', dangerous: false, show: false }, _class.displayName = 'ConfirmationDialog', _temp); export { ConfirmationDialog as default };