UNPKG

@elliemae/ds-wysiwygeditor

Version:

Ellie Mae - Dim Sum - WYSIWYG Editor

95 lines (79 loc) 3.73 kB
import _extends from '@babel/runtime/helpers/esm/extends'; import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck'; import _createClass from '@babel/runtime/helpers/esm/createClass'; import _assertThisInitialized from '@babel/runtime/helpers/esm/assertThisInitialized'; import _inherits from '@babel/runtime/helpers/esm/inherits'; import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn'; import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf'; import _defineProperty from '@babel/runtime/helpers/esm/defineProperty'; import React from 'react'; import DSImageLibraryModal from '@elliemae/ds-imagelibrarymodal'; import PropTypes from 'prop-types'; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } var ImageLibraryModal = /*#__PURE__*/function (_React$PureComponent) { _inherits(ImageLibraryModal, _React$PureComponent); var _super = _createSuper(ImageLibraryModal); function ImageLibraryModal(props) { var _this; _classCallCheck(this, ImageLibraryModal); _this = _super.call(this, props); _defineProperty(_assertThisInitialized(_this), "onSelect", function (selectedImage) { _this.setState({ selectedImage: selectedImage }); }); _defineProperty(_assertThisInitialized(_this), "onConfirm", function () { var selectedImage = _this.state.selectedImage; var _this$props = _this.props, onConfirm = _this$props.onConfirm, onClose = _this$props.onClose; onConfirm(selectedImage); onClose(); }); _this.state = { selectedImage: undefined }; return _this; } _createClass(ImageLibraryModal, [{ key: "render", value: function render() { return /*#__PURE__*/React.createElement(DSImageLibraryModal, _extends({}, this.props, { onConfirm: this.onConfirm, onSelect: this.onSelect })); } }]); return ImageLibraryModal; }(React.PureComponent); _defineProperty(ImageLibraryModal, "propTypes", { onConfirm: PropTypes.func.isRequired, onClose: PropTypes.func.isRequired, onReject: PropTypes.func, imagesData: PropTypes.arrayOf(PropTypes.shape({ id: PropTypes.string, url: PropTypes.string.isRequired, name: PropTypes.string.isRequired, description: PropTypes.string, createdBy: PropTypes.string.isRequired, createdDate: PropTypes.string.isRequired })), isOpen: PropTypes.bool.isRequired }); _defineProperty(ImageLibraryModal, "defaultProps", { onReject: undefined, imagesData: [{ url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png', name: 'no image', createdBy: 'user:John Doe', createdDate: '0000-01-01 00:00 AM UTC' }, { url: 'https://asset-service-bucket-int.s3.us-west-2.amazonaws.com/bd527d8c-472f-4dff-b8c5-1c90d5bae01e', name: 'no image 2', createdBy: 'user:Jane Doe', createdDate: '0000-01-01 00:00 AM UTC' }] }); export default ImageLibraryModal; //# sourceMappingURL=ImageLibraryModal.js.map