groundfloor-react-ui 1.3.76 → 1.3.78
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.
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1972,7 +1972,7 @@ cursor: ${({isDisabled:e})=>e?"not-allowed":"pointer"};
|
|
|
1972
1972
|
`,hi=m.div`
|
|
1973
1973
|
width: 100%;
|
|
1974
1974
|
margin-left: 16px;
|
|
1975
|
-
`,Ci=({commentsArray:e,customStyles:l,myInfoAvatarProps:i,loading:c,viewOnly:a,textInputProps:r,fileUploadProps:n,saveBtnProps:s,cancelBtnProps:d,loadMore:p,avatarProps:m,message:u,filePreviewer:f,showUploadButton:g})=>{const
|
|
1975
|
+
`,Ci=({commentsArray:e,customStyles:l,myInfoAvatarProps:i,loading:c,viewOnly:a,textInputProps:r,fileUploadProps:n,saveBtnProps:s,cancelBtnProps:d,loadMore:p,avatarProps:m,message:u,filePreviewer:f,showUploadButton:g,allowedFileTypes:h=["jpg","png","pdf","docx"],maxFileSizeMB:C=10})=>{const y=b()||Z,[x,v]=o(!1),[w,A]=o(e||[]),[S,k]=o("");o("");const V=async e=>{let t;t="post"===e?await s.callback():await p.callback(),A((e=>[...e,...t]))},E={width:"100px",height:"100px",border:"1px solid #ccc",borderRadius:"8px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontSize:"12px",backgroundColor:"#f9f9f9"};return t.createElement(di,{commentWrapperStyle:l?.commentWrapperStyle,theme:y},w.map(((e,i)=>{const{name:o,date:c,comment:a,image:r}=e;return t.createElement(pi,{key:i,commentBodyStyle:l?.commentBodyStyle,theme:y},t.createElement(mi,{commentHeadStyle:l?.commentHeadStyle},t.createElement(Pe,H({user:{fullName:o,userName:o,url:r},toggleName:!0,size:"LG",customStylesName:{color:y.additional["text-color"]}},m)),t.createElement(bi,{dateTimeStyle:l?.dateTimeStyle,theme:y},c)),t.createElement(ui,{commentDivStyle:l?.commentDivStyle},a,f(e)))})),!c&&0===w.length&&u,c&&t.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",marginBottom:"24px"}},t.createElement(fe,{size:25})),!c&&p.showLoadMore&&t.createElement("div",{className:"load-more"},t.createElement(Ce,{onClick:()=>V("load")},"Load more")),!a&&t.createElement(fi,{theme:y,inputWrapperStyle:l?.inputWrapperStyle},t.createElement(Pe,H({toggleName:!1,customStylesImage:{height:"36px",width:"36px"},customStylesContainer:{marginTop:"7px"}},i)),t.createElement(hi,null,t.createElement(Ql,H({onChange:e=>{r.setInputValue(e.target.value)},isValid:!0,onFocus:e=>v(!0)},r)),x&&t.createElement(gi,null,g&&t.createElement(Ce,{as:"label",htmlFor:"file-upload",size:"sm",style:{padding:"0px",marginRight:"12px"}},t.createElement(ee,{icon:"file-upload",customstyles:{marginRight:"5px"},title:"Upload File",hoverColor:y.variant["primary-2"]})," ","Upload File"),t.createElement("input",{type:"file",id:"file-upload",multiple:!0,style:{display:"none"},onChange:e=>{let t=Array.from(e.target.files);const l=t.filter((e=>{const t=e.name.split(".").pop().toLowerCase(),l=!h||h.includes(t),i=!C||e.size<=1024*C*1024;return l&&i})),i=t.filter((e=>!l.includes(e))).map((e=>({name:e.name,error:h?.includes(e.name.split(".").pop().toLowerCase())?"File too large":"Invalid file type"})));if(i.length>0){let e=`Some file(s) were rejected:\n${i.map((e=>`• ${e.name}: ${e.error}`)).join("\n")}`;k(e)}n?.setRejectedFiles(i),n?.setUploadedFiles((e=>[...e,...Array.from(l)]))}}),t.createElement(ve,H({onClick:()=>{V("post"),r.setInputValue(""),n?.setUploadedFiles([]),n.setRejectedFiles([])}},s),s.text),t.createElement(Ce,H({disabled:!(!d?.isLoading&&!s?.isLoading),onClick:()=>{v(!1),r.setInputValue(""),r.setValidValue({isValid:!0,errMsg:""}),n.setUploadedFiles([]),n.setRejectedFiles([])},btnStyle:{color:y.variant["neutral-1"]}},d),d.text)),n?.rejectedFiles?.length>0&&t.createElement("div",{style:{color:"#DD0000",marginTop:"5px",fontSize:"14px"}},S),t.createElement("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",marginTop:"12px"}},n?.uploadedFiles.map(((e,l)=>{const i=e.type,o=i.startsWith("image/"),c="application/pdf"===i,a="application/msword"===i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===i;return t.createElement("div",{key:l,style:{position:"relative",marginRight:"8px"}},o?t.createElement("img",{src:URL.createObjectURL(e),alt:"preview",style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"8px"}}):c?t.createElement("div",{style:E},t.createElement(ee,{icon:"pdf",size:40,customstyles:{marginRight:"5px"}})):a?t.createElement("div",{style:E},t.createElement(ee,{icon:"doc-icon",size:40,customstyles:{marginRight:"5px"}})):t.createElement("div",{style:E},t.createElement(ee,{icon:"file-icon",size:40,customstyles:{marginRight:"5px"}})),t.createElement("button",{onClick:()=>n.handleRemoveFile(l),style:{position:"absolute",top:4,right:4,background:"#DD0000",color:"#fff",borderRadius:"50%",width:20,height:20,border:"none",cursor:"pointer"}},"×"))}))))))};Ci.propTypes={commentsArray:e.array,customStyles:e.object,myInfoAvatarProps:e.object,viewOnly:e.bool,textInputProps:e.object,saveBtnProps:e.object,cancelBtnProps:e.object,loadMore:e.object,avatarProps:e.object,message:e.element,filePreviewer:e.func,showUploadButton:e.bool,fileUploadProps:e.object,allowedFileTypes:e.array,maxFileSizeMB:10},Ci.defaultProps={commentsArray:[],customStyles:{commentBodyStyle:{},commentWrapperStyle:{},commentHeadStyle:{},dateTimeStyle:{},commentDivStyle:{},inputWrapperStyle:{}},myInfoAvatarProps:{},loading:!1,viewOnly:!1,textInputProps:{},saveBtnProps:{size:"sm",text:"Save"},cancelBtnProps:{size:"sm",text:"Cancel"},filePreviewer:()=>{},loadMore:{showLoadMore:!1,callback:()=>{}},avatarProps:{},message:t.createElement("span",{style:{textAlign:"center",display:"block",marginBottom:"16px"}},"No comments yet"),showUploadButton:!1,allowedFileTypes:["jpg","png","pdf","docx"],maxFileSizeMB:10};const yi=m.div`
|
|
1976
1976
|
//Set the styles from the default styles object
|
|
1977
1977
|
${({theme:e,type:t})=>T(e,t)}
|
|
1978
1978
|
@media (max-width: 980px) {
|
package/dist/index.js
CHANGED
|
@@ -1972,7 +1972,7 @@ cursor: ${({isDisabled:e})=>e?"not-allowed":"pointer"};
|
|
|
1972
1972
|
`,ma=C.default.div`
|
|
1973
1973
|
width: 100%;
|
|
1974
1974
|
margin-left: 16px;
|
|
1975
|
-
`,ba=({commentsArray:e,customStyles:a,myInfoAvatarProps:o,loading:i,viewOnly:r,textInputProps:c,fileUploadProps:n,saveBtnProps:d,cancelBtnProps:s,loadMore:p,avatarProps:u,message:f,filePreviewer:m,showUploadButton:b})=>{const
|
|
1975
|
+
`,ba=({commentsArray:e,customStyles:a,myInfoAvatarProps:o,loading:i,viewOnly:r,textInputProps:c,fileUploadProps:n,saveBtnProps:d,cancelBtnProps:s,loadMore:p,avatarProps:u,message:f,filePreviewer:m,showUploadButton:b,allowedFileTypes:g=["jpg","png","pdf","docx"],maxFileSizeMB:C=10})=>{const y=l.useTheme()||R,[x,v]=t.useState(!1),[w,A]=t.useState(e||[]),[S,k]=t.useState("");t.useState("");const E=async e=>{let t;t="post"===e?await d.callback():await p.callback(),A((e=>[...e,...t]))},V={width:"100px",height:"100px",border:"1px solid #ccc",borderRadius:"8px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontSize:"12px",backgroundColor:"#f9f9f9"};return h.default.createElement(ca,{commentWrapperStyle:a?.commentWrapperStyle,theme:y},w.map(((e,t)=>{const{name:l,date:o,comment:i,image:r}=e;return h.default.createElement(na,{key:t,commentBodyStyle:a?.commentBodyStyle,theme:y},h.default.createElement(da,{commentHeadStyle:a?.commentHeadStyle},h.default.createElement(Be,M({user:{fullName:l,userName:l,url:r},toggleName:!0,size:"LG",customStylesName:{color:y.additional["text-color"]}},u)),h.default.createElement(sa,{dateTimeStyle:a?.dateTimeStyle,theme:y},o)),h.default.createElement(pa,{commentDivStyle:a?.commentDivStyle},i,m(e)))})),!i&&0===w.length&&f,i&&h.default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",marginBottom:"24px"}},h.default.createElement(ue,{size:25})),!i&&p.showLoadMore&&h.default.createElement("div",{className:"load-more"},h.default.createElement(be,{onClick:()=>E("load")},"Load more")),!r&&h.default.createElement(ua,{theme:y,inputWrapperStyle:a?.inputWrapperStyle},h.default.createElement(Be,M({toggleName:!1,customStylesImage:{height:"36px",width:"36px"},customStylesContainer:{marginTop:"7px"}},o)),h.default.createElement(ma,null,h.default.createElement(Ul,M({onChange:e=>{c.setInputValue(e.target.value)},isValid:!0,onFocus:e=>v(!0)},c)),x&&h.default.createElement(fa,null,b&&h.default.createElement(be,{as:"label",htmlFor:"file-upload",size:"sm",style:{padding:"0px",marginRight:"12px"}},h.default.createElement($,{icon:"file-upload",customstyles:{marginRight:"5px"},title:"Upload File",hoverColor:y.variant["primary-2"]})," ","Upload File"),h.default.createElement("input",{type:"file",id:"file-upload",multiple:!0,style:{display:"none"},onChange:e=>{let t=Array.from(e.target.files);const l=t.filter((e=>{const t=e.name.split(".").pop().toLowerCase(),l=!g||g.includes(t),a=!C||e.size<=1024*C*1024;return l&&a})),a=t.filter((e=>!l.includes(e))).map((e=>({name:e.name,error:g?.includes(e.name.split(".").pop().toLowerCase())?"File too large":"Invalid file type"})));if(a.length>0){let e=`Some file(s) were rejected:\n${a.map((e=>`• ${e.name}: ${e.error}`)).join("\n")}`;k(e)}n?.setRejectedFiles(a),n?.setUploadedFiles((e=>[...e,...Array.from(l)]))}}),h.default.createElement(Ce,M({onClick:()=>{E("post"),c.setInputValue(""),n?.setUploadedFiles([]),n.setRejectedFiles([])}},d),d.text),h.default.createElement(be,M({disabled:!(!s?.isLoading&&!d?.isLoading),onClick:()=>{v(!1),c.setInputValue(""),c.setValidValue({isValid:!0,errMsg:""}),n.setUploadedFiles([]),n.setRejectedFiles([])},btnStyle:{color:y.variant["neutral-1"]}},s),s.text)),n?.rejectedFiles?.length>0&&h.default.createElement("div",{style:{color:"#DD0000",marginTop:"5px",fontSize:"14px"}},S),h.default.createElement("div",{style:{display:"flex",gap:"12px",flexWrap:"wrap",marginTop:"12px"}},n?.uploadedFiles.map(((e,t)=>{const l=e.type,a=l.startsWith("image/"),o="application/pdf"===l,i="application/msword"===l||"application/vnd.openxmlformats-officedocument.wordprocessingml.document"===l;return h.default.createElement("div",{key:t,style:{position:"relative",marginRight:"8px"}},a?h.default.createElement("img",{src:URL.createObjectURL(e),alt:"preview",style:{width:"100px",height:"100px",objectFit:"cover",borderRadius:"8px"}}):o?h.default.createElement("div",{style:V},h.default.createElement($,{icon:"pdf",size:40,customstyles:{marginRight:"5px"}})):i?h.default.createElement("div",{style:V},h.default.createElement($,{icon:"doc-icon",size:40,customstyles:{marginRight:"5px"}})):h.default.createElement("div",{style:V},h.default.createElement($,{icon:"file-icon",size:40,customstyles:{marginRight:"5px"}})),h.default.createElement("button",{onClick:()=>n.handleRemoveFile(t),style:{position:"absolute",top:4,right:4,background:"#DD0000",color:"#fff",borderRadius:"50%",width:20,height:20,border:"none",cursor:"pointer"}},"×"))}))))))};ba.propTypes={commentsArray:g.default.array,customStyles:g.default.object,myInfoAvatarProps:g.default.object,viewOnly:g.default.bool,textInputProps:g.default.object,saveBtnProps:g.default.object,cancelBtnProps:g.default.object,loadMore:g.default.object,avatarProps:g.default.object,message:g.default.element,filePreviewer:g.default.func,showUploadButton:g.default.bool,fileUploadProps:g.default.object,allowedFileTypes:g.default.array,maxFileSizeMB:10},ba.defaultProps={commentsArray:[],customStyles:{commentBodyStyle:{},commentWrapperStyle:{},commentHeadStyle:{},dateTimeStyle:{},commentDivStyle:{},inputWrapperStyle:{}},myInfoAvatarProps:{},loading:!1,viewOnly:!1,textInputProps:{},saveBtnProps:{size:"sm",text:"Save"},cancelBtnProps:{size:"sm",text:"Cancel"},filePreviewer:()=>{},loadMore:{showLoadMore:!1,callback:()=>{}},avatarProps:{},message:h.default.createElement("span",{style:{textAlign:"center",display:"block",marginBottom:"16px"}},"No comments yet"),showUploadButton:!1,allowedFileTypes:["jpg","png","pdf","docx"],maxFileSizeMB:10};const ga=C.default.div`
|
|
1976
1976
|
//Set the styles from the default styles object
|
|
1977
1977
|
${({theme:e,type:t})=>T(e,t)}
|
|
1978
1978
|
@media (max-width: 980px) {
|