@corva/ui 0.36.0-5 → 0.36.0-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import m from"prop-types";import p from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import d from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as v}from"@material-ui/core";import I from"@material-ui/core/colors/grey";import x from"../Avatar/index.js";import y from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import E from"../FailedFileUploading.js";import S from"../UserMention/index.js";import U from"../FilePreview/index.js";import N from"../IconButton/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as B}from"../../utils/nativeMessages.js";import{patchFeedItemComment as w}from"../../clients/jsonApi/index.js";import L from"./styles.css.js";import{jsxs as P,jsx as T}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(m,c);var r=z(m);function m(n){var i,a,c;return e(this,m),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,w(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(B(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(m,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:t?M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.url:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[T("div",{style:D.chatAvatarWrapper,children:T(x,{displayName:i,size:24,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),T(f,{className:this.props.classes.paperRoot,children:T(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:S,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return t.setState({isInputFocused:!0})},onBlur:function(){return t.setState({isInputFocused:!1})}},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&T(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:d(L.cCommentInputIconContainer,L.cCommentInputIconUpload),children:T(y,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],inputId:"comment-attachment-".concat(this.props.editCommentId)})})}),T(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:L.cCommentInputIconContainer,children:T(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:I[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&T(E,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&T(U,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),(this.state.isInputFocused||this.state.attachmentUrl||this.state.comment)&&P("div",{className:L.cCommentInputSendContainer,children:[T("div",{className:L.cCommentInputSendContainerCancel,children:T(v,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),P("div",{className:L.cCommentInputSendContainerSend,children:[P(v,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",T(v,{variant:"caption",color:"primary",className:d(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),T(N,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:T(k,{})})]})]})]})}}]),m}();_.propTypes={inputRef:m.shape({current:m.shape({focus:m.shape({})})}),editFeedItemId:m.number,editCommentId:m.number,editComment:m.string,editAttachment:m.shape({url:m.string}),spaceAround:m.bool,postComment:m.func.isRequired,postCommentCallback:m.func,patchCommentCallback:m.func,exitEditMode:m.func,setIsPosting:m.func,setIsEditting:m.func,onMount:m.func,autoFocus:m.bool,disabled:m.bool,classes:m.shape({}).isRequired,currentUser:m.shape(),isNative:m.bool,companyId:m.number},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:p,setIsEditting:p,onMount:p,autoFocus:void 0,disabled:!1,patchCommentCallback:p,postCommentCallback:p,exitEditMode:p,companyId:null,currentUser:{},isNative:R};var O=u((function(t){return{paperRoot:{width:"calc(100% - 40px)",marginLeft:40,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"8px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}}}}))(_);export{O as default};
|
|
1
|
+
import t from"@babel/runtime/helpers/asyncToGenerator";import e from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/assertThisInitialized";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import r from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{PureComponent as c}from"react";import p from"prop-types";import m from"lodash/noop";import{withStyles as u}from"@material-ui/core/styles";import d from"classnames";import{get as h}from"lodash";import{Paper as f,TextField as C,InputAdornment as g,Tooltip as b,Typography as I}from"@material-ui/core";import v from"@material-ui/core/colors/grey";import x from"../Avatar/index.js";import y from"../FileUploadIconButton.js";import F from"../EmojiIconButton.js";import E from"../FailedFileUploading.js";import S from"../UserMention/index.js";import U from"../FilePreview/index.js";import N from"../IconButton/index.js";import k from"../Icons/SendIcon.js";import{isSuggestionsListOpened as A}from"../UserMention/utils/index.js";import M from"../../utils/main.js";import{isNativeDetected as R}from"../../utils/mobileDetect.js";import{notifyCommentEdit as j,notifyCommentPost as B}from"../../utils/nativeMessages.js";import{patchFeedItemComment as w}from"../../clients/jsonApi/index.js";import L from"./styles.css.js";import{jsxs as P,jsx as T}from"react/jsx-runtime";function z(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=r(t);if(e){var i=r(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return a(this,n)}}var D={chatAvatarWrapper:{display:"flex",alignItems:"center",position:"absolute",left:0,height:32},commentTextFieldContainer:{position:"relative",margin:"0"},commentTextFieldContainerSpaceAround:{position:"relative",margin:"20px 10px"}},_=function(a){i(p,c);var r=z(p);function p(n){var i,a,c;return e(this,p),i=r.call(this,n),s(o(i),"handleSelectEmoji",(function(t){return i.setState((function(e){var n=e.comment;return{comment:"".concat(n).concat(t.native)}}))})),s(o(i),"postComment",(a=t(l.mark((function t(e){var n;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,i.props.postComment(e);case 3:n=t.sent,t.next=9;break;case 6:t.prev=6,t.t0=t.catch(0),console.error(t.t0.message);case 9:return t.abrupt("return",n);case 10:case"end":return t.stop()}}),t,null,[[0,6]])}))),function(t){return a.apply(this,arguments)})),s(o(i),"patchComment",(c=t(l.mark((function t(e){var n,o,a,r;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=i.props,o=n.editFeedItemId,a=n.editCommentId,t.prev=1,t.next=4,w(o,a,e);case 4:r=t.sent,t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),console.error(t.t0.message);case 10:return t.abrupt("return",r);case 11:case"end":return t.stop()}}),t,null,[[1,7]])}))),function(t){return c.apply(this,arguments)})),s(o(i),"clearCommentField",(function(t){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},(function(){i.focusOnRef(),t&&"function"==typeof t&&t()}))})),s(o(i),"handleKeyDown",(function(t){var e=t.key;"Escape"===e&&i.props.exitEditMode(),"Enter"===e&&(A()||(t.preventDefault(),i.handleSendComment()))})),s(o(i),"handleAttachmentLoadingError",(function(t){i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:t})})),s(o(i),"handleFileUpload",(function(t,e,n){i.setState({attachmentUrl:t,attachmentName:e,attachmentSize:n,attachmentLoadingError:null})})),s(o(i),"handleNativeFileUpload",(function(){var t=i.state.comment;i.isEditMode?(j(t),i.clearCommentField(i.props.exitEditMode)):(B(t),i.clearCommentField())})),s(o(i),"handleFileDelete",(function(){return i.setState({attachmentUrl:null,attachmentName:null,attachmentSize:null})})),s(o(i),"handleSendComment",t(l.mark((function t(){var e,n,o;return l.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if((e=i.state.comment?i.state.comment.trim():null)||i.state.attachmentUrl){t.next=3;break}return t.abrupt("return");case 3:if(n={comment:{body:e,attachment:{url:i.state.attachmentUrl,size:i.state.attachmentSize,file_name:i.state.attachmentName}}},!i.isEditMode){t.next=16;break}return i.props.setIsEditting(!0),t.next=8,i.patchComment(n);case 8:return o=t.sent,t.next=11,i.props.patchCommentCallback(o);case 11:i.props.setIsEditting(!1),i.clearCommentField(),i.props.exitEditMode(),t.next=24;break;case 16:return i.props.setIsPosting(!0),t.next=19,i.postComment(n);case 19:return o=t.sent,t.next=22,i.props.postCommentCallback(o);case 22:i.props.setIsPosting(!1),i.clearCommentField();case 24:case"end":return t.stop()}}),t)})))),s(o(i),"handleCancelClick",(function(){i.setState({comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null},i.props.exitEditMode())})),i.state={comment:"",attachmentUrl:null,attachmentName:null,attachmentSize:null,attachmentLoadingError:null,isInputFocused:!1},i}return n(p,[{key:"componentDidMount",value:function(){this.isEditMode&&this.setInitialCommentValue()}},{key:"componentDidUpdate",value:function(t){(this.isEditMode&&!t.editFeedItemId||this.props.editCommentId&&this.props.editCommentId!==t.editCommentId)&&this.setInitialCommentValue()}},{key:"isEditMode",get:function(){return!!this.props.editFeedItemId}},{key:"setInitialCommentValue",value:function(){var t=this.props.editAttachment?this.props.editAttachment.url:null;this.setState({comment:this.props.editComment,attachmentUrl:t,attachmentName:this.props.editAttachment?this.props.editAttachment.file_name||M.getFileNameWithExtensionFromPath(t):null,attachmentSize:this.props.editAttachment?this.props.editAttachment.size:null})}},{key:"focusOnRef",value:function(){this.props.inputRef&&this.props.inputRef.current.focus()}},{key:"render",value:function(){var t=this,e=this.props,n=e.classes,o=e.currentUser,i="".concat(h(o,["attributes","first_name"])," ").concat(h(o,["attributes","last_name"]));return P("div",{style:this.props.spaceAround?D.commentTextFieldContainerSpaceAround:D.commentTextFieldContainer,children:[T("div",{style:D.chatAvatarWrapper,children:T(x,{displayName:i,size:24,imgSrc:this.props.currentUser&&this.props.currentUser.profile_photo})}),T(f,{className:this.props.classes.paperRoot,children:T(C,{"data-testid":"".concat("commentInput","_input"),placeholder:"Add Comment...",FormHelperTextProps:{component:"div",margin:"dense"},InputProps:{inputComponent:S,inputProps:{onChange:function(e){return t.setState({comment:e})},singleLine:!0,value:this.state.comment||"",inputRef:this.props.inputRef,withLightTheme:!1,onMount:this.props.onMount,companyId:this.props.companyId,autoFocus:this.props.autoFocus,disabled:this.props.disabled,onFocus:function(){return t.setState({isInputFocused:!0})},onBlur:function(){return t.setState({isInputFocused:!1})}},endAdornment:!this.props.isNative&&P(g,{position:"end",className:this.props.classes.iconsContainer,children:[!this.state.attachmentUrl&&T(b,{title:"Attach File",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:d(L.cCommentInputIconContainer,L.cCommentInputIconUpload),children:T(y,{openPreviewDialogOnUpload:!1,disableRipple:!0,onFinish:this.handleFileUpload,onError:this.handleAttachmentLoadingError,fileUploadIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],inputId:"comment-attachment-".concat(this.props.editCommentId||this.props.parentId)})})}),T(b,{title:"Add Emoji",placement:"bottom",classes:{tooltip:n.iconTooltip},children:T("div",{className:L.cCommentInputIconContainer,children:T(F,{"data-testid":"".concat("commentInput","_emojiButton"),handleSelectEmoji:this.handleSelectEmoji,emojiIconClassName:this.props.classes.additionalActionButton,htmlColor:v[400],disableRipple:!0})})})]}),disableUnderline:!0,classes:{root:this.props.classes.inputRoot,input:this.props.classes.inputEl}},className:this.props.classes.input,onKeyDown:this.handleKeyDown})}),this.state.attachmentLoadingError&&T(E,{errorMessage:this.state.attachmentLoadingError,className:this.props.classes.fileUploadingError}),this.state.attachmentUrl&&T(U,{fileName:this.state.attachmentName,fileUrl:this.state.attachmentUrl,handleFileDelete:this.handleFileDelete,classes:this.props.classes}),(this.state.isInputFocused||this.state.attachmentUrl||this.state.comment)&&P("div",{className:L.cCommentInputSendContainer,children:[T("div",{className:L.cCommentInputSendContainerCancel,children:T(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.cancelText,this.props.classes.highlightedLabel),component:"div",gutterBottom:!0,onClick:this.handleCancelClick,children:"Cancel"})}),P("div",{className:L.cCommentInputSendContainerSend,children:[P(I,{variant:"caption",className:d(this.props.classes.inputMain,this.props.classes.inputHelper),component:"div",gutterBottom:!0,children:["Press ",T(I,{variant:"caption",color:"primary",className:d(this.props.classes.inputMain,this.props.classes.highlightedLabel),children:"Enter"})," to send"]}),T(N,{size:"large",tooltipProps:{title:"Send"},"data-testid":"".concat("commentInput","_sendButton"),onClick:this.handleSendComment,classes:{root:this.props.classes.sendButton},children:T(k,{})})]})]})]})}}]),p}();_.propTypes={inputRef:p.shape({current:p.shape({focus:p.shape({})})}),editFeedItemId:p.number,editCommentId:p.number,editComment:p.string,editAttachment:p.shape({url:p.string,size:p.number,file_name:p.string}),spaceAround:p.bool,postComment:p.func.isRequired,postCommentCallback:p.func,patchCommentCallback:p.func,exitEditMode:p.func,setIsPosting:p.func,setIsEditting:p.func,onMount:p.func,autoFocus:p.bool,disabled:p.bool,classes:p.shape({}).isRequired,currentUser:p.shape(),isNative:p.bool,companyId:p.number,parentId:p.string},_.defaultProps={inputRef:null,editFeedItemId:null,editCommentId:null,parentId:null,editComment:null,editAttachment:{},spaceAround:!1,setIsPosting:m,setIsEditting:m,onMount:m,autoFocus:void 0,disabled:!1,patchCommentCallback:m,postCommentCallback:m,exitEditMode:m,companyId:null,currentUser:{},isNative:R};var O=u((function(t){return{paperRoot:{width:"calc(100% - 40px)",marginLeft:40,display:"inline-block",height:32,border:"0","&:focus-within":{boxShadow:"inset 0 0 0 2px ".concat(t.palette.primary.main)},boxShadow:"none"},input:{paddingLeft:5,width:"100%"},inputRoot:{height:32,paddingRight:"10px",lineHeight:"29px",paddingLeft:"10px"},inputEl:{padding:"0 0 0 6px",height:"100%"},additionalActionButton:{padding:"8px","&:hover":{backgroundColor:"transparent"}},nativeActionButton:{margin:"5px 10px",cursor:"pointer"},fileUploadingError:{marginTop:10,marginLeft:24},inputMain:{marginBottom:0,fontSize:"11px",color:t.palette.primary.text8},inputHelper:{display:"flex",paddingRight:5},cancelText:{cursor:"pointer"},highlightedLabel:{color:t.palette.primary.main},iconsContainer:{marginRight:"8px"},iconTooltip:{marginTop:"3px"},sendButton:{"&:hover":{backgroundColor:"rgba(3,188,212, 0.1)"},"&.MuiButtonBase-root":{padding:7}}}}))(_);export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useRef as t}from"react";import r from"prop-types";import n from"lodash/noop";import m from"moment";import{makeStyles as i,Button as s,Typography as a}from"@material-ui/core";import
|
|
1
|
+
import e from"@babel/runtime/helpers/slicedToArray";import{useState as o,useRef as t}from"react";import r from"prop-types";import n from"lodash/noop";import m from"moment";import{makeStyles as i,Button as s,Typography as a}from"@material-ui/core";import c from"../../Comment/index.js";import p from"../../CommentLoader.js";import d from"../../CommentInput/index.js";import{postFeedItemComment as u}from"../../../clients/jsonApi/index.js";import{isNativeDetected as l}from"../../../utils/mobileDetect.js";import{jsxs as f,jsx as C}from"react/jsx-runtime";var h=i({showMoreButtonRoot:{textTransform:"none",backgroundColor:"transparent!important"},feedCommentsContainer:{padding:"0 24px 0 32px"}});function x(r){var i,x=r.openCommentInput,I=r.feedItem,v=r.currentUser,y=o(!1),b=e(y,2),j=b[0],R=b[1],g=o(3),k=e(g,2),w=k[0],U=k[1],_=t(),q=h(),M=I.comments.length,T=M>w;return f("div",{className:(x||!!M)&&q.feedCommentsContainer,children:[x&&!l&&C(d,{inputRef:_,postComment:function(e){u(I.id,e)},setIsPosting:R,companyId:I.company_id,autoFocus:!1,currentUser:v,parentId:"".concat(I.id,"-").concat(null===(i=I.comments)||void 0===i?void 0:i.size)}),T&&C(s,{"data-testid":"".concat("FeedComments","_viewMoreComments"),classes:q.showMoreButtonRoot,onClick:function(){U((function(e){return 3===e?e+7:e+10}))},children:C(a,{variant:"caption",color:"primary",children:"View more comments"})}),I.comments.sort((function(e){return-m(e.created_at).unix()})).slice(0,w).reverse().map((function(e){return C(c,{comment:e,handleDeleteCallback:n,patchCommentCallback:n,companyId:I.company_id,currentUser:v},e.id)})),j&&C(p,{})]})}x.propTypes={openCommentInput:r.bool.isRequired,feedItem:r.shape().isRequired,currentUser:r.shape().isRequired};export{x as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corva/ui",
|
|
3
|
-
"version": "0.36.0-
|
|
3
|
+
"version": "0.36.0-6",
|
|
4
4
|
"description": "Shared components/utils for Corva ui projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"corva-ui"
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"test-watch": "jest --watch",
|
|
22
22
|
"generate-css-themes": "node ./scripts/generateCssThemesVariables.mjs",
|
|
23
23
|
"build-storybook": "IS_STORYBOOK_BUILD=true build-storybook -c storybook --no-dll",
|
|
24
|
-
"storybook": "IS_STORYBOOK_BUILD=true start-storybook -p 6006 -c storybook --no-dll"
|
|
24
|
+
"storybook": "IS_STORYBOOK_BUILD=true start-storybook -p 6006 -c storybook --no-dll",
|
|
25
|
+
"check-duplications": "jscpd src"
|
|
25
26
|
},
|
|
26
27
|
"config": {
|
|
27
28
|
"commitizen": {
|
|
@@ -118,6 +119,7 @@
|
|
|
118
119
|
"image-extensions": "1.1.0",
|
|
119
120
|
"immutable": "3.8.2",
|
|
120
121
|
"jest": "^26.4.1",
|
|
122
|
+
"jscpd": "^3.4.5",
|
|
121
123
|
"jsona": "1.5.1",
|
|
122
124
|
"lodash": "4.17.20",
|
|
123
125
|
"mapbox.js": "3.2.1",
|