react-filerobot-image-editor
Version:
React component version of filerobot image editor (FIE).
1 lines • 1.56 kB
JavaScript
import React from"react";import{Button,ModalContent}from"@scaleflex/ui/core";import{StyledModal,StyledModalTitle,StyledModalActions}from"./Modal.styled";var Modal=function(a){var b=a.title,c=a.hint,d=a.Icon,f=a.onDone,g=a.onCancel,h=a.doneLabel,i=void 0===h?"Yes":h,j=a.cancelLabel,k=void 0===j?"No":j,l=a.isOpened,m=a.doneButtonStyle,n=a.doneButtonColor,o=void 0===n?"basic":n,p=a.cancelButtonColor,q=void 0===p?"basic":p,r=a.children,s=a.areButtonsDisabled,t=void 0!==s&&s,u=a.zIndex,v=a.className,w=a.width,x=a.isWarning,y=void 0!==x&&x,z=a.isError;return React.createElement(StyledModal,{"data-testid":"FIE-modal-container",className:v,open:void 0!==l&&l,onClose:g,style:{zIndex:u},onKeyUp:function(a){return"Enter"===a.key?(a.preventDefault(),a.stopPropagation(),void f(a)):void("Escape"===a.key&&(a.preventDefault(),a.stopPropagation(),g(a)))},width:w,role:"dialog",tabIndex:-1,"aria-modal":"true","aria-label":b},React.createElement(StyledModalTitle,{"data-testid":"FIE-modal-title",icon:React.createElement(d,{size:25}),iconShadow:!0,isWarning:y,isError:void 0!==z&&z,onClose:g,primary:b,secondary:c,variant:"with-icon"}),r&&React.createElement(ModalContent,{"data-testid":"FIE-modal-content"},r),React.createElement(StyledModalActions,{"data-testid":"FIE-modal-actions",align:"center"},React.createElement(Button,{"data-testid":"FIE-modal-cancel-button",color:q,onClick:g,size:"md",disabled:t},k),React.createElement(Button,{"data-testid":"FIE-modal-confirm-button",color:o,onClick:f,size:"md",warning:y,style:m,disabled:t},i)))};export default Modal;