groundfloor-react-ui 1.3.94 → 1.3.95
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
|
@@ -1421,7 +1421,7 @@ cursor: ${({isDisabled:e})=>e?"not-allowed":"pointer"};
|
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
1423
|
${({MainDivStyle:e})=>e};
|
|
1424
|
-
`,fl=({
|
|
1424
|
+
`,fl=({fileExtensions:e,image:l,setImage:a,WrapperDivStyle:r,MainDivStyle:n,IconWrapperStyle:s,iconSize:d,iconColor:p,isDisabled:m,id:b})=>{const[g,f]=o(),u=i(),h=C()||R,[x,y]=o(),[v,w]=o(!1);function A(e){e.preventDefault(),e.stopPropagation()}c((()=>{if(l&&v){const e=new FileReader;e.onloadend=()=>{f(e.result)},e.readAsDataURL(l)}else f(l)}),[l]);const L=e=>{e&&"image"===e.type.substr(0,5)?(w(!0),a(e)):w(!1)};return t.createElement(ml,{onDragLeave:function(e){A(e),y(!1)},onDragOver:function(e){A(e),y(!0)},onDrop:function(e){A(e);const{files:t}=e.dataTransfer;L(t[0])},WrapperDivStyle:r,isDisabled:m},t.createElement(gl,{isDisabled:m,theme:h,MainDivStyle:n,style:{backgroundImage:`url(${g})`},onClick:e=>{e.preventDefault(),u.current.click()}},!g&&t.createElement("div",{className:"icon-on-not-preview"},t.createElement(bl,{IconWrapperStyle:s,theme:h,isDisabled:m},t.createElement("img",{src:K,alt:"",height:"40px",width:"48px"}))),t.createElement("div",{className:"icon-on-preview"},t.createElement(bl,{IconWrapperStyle:s,isDisabled:m,theme:h},t.createElement(ee,{icon:"camera-icon",size:d,color:p||h.variant["primary-1"]})))),t.createElement(Cl,{id:b,type:"file",ref:u,accept:e.length>0?e.map((e=>`.${e}`)).join(","):void 0,onChange:e=>{w(!0),a(e.target.files[0])},disabled:m,isDisabled:m}))};fl.propTypes={image:e.any,setImage:e.func,WrapperDivStyle:e.object,MainDivStyle:e.object,IconWrapperStyle:e.object,iconSize:e.number},fl.defaultProps={image:null,setImage:()=>{},WrapperDivStyle:{},MainDivStyle:{},IconWrapperStyle:{},iconSize:28,id:"",isDisabled:!1,fileExtensions:["jpg","jpeg","webp","png"]};const ul=m.div`
|
|
1425
1425
|
border: 1px solid ${({theme:e})=>e.additional.border};
|
|
1426
1426
|
border-radius: 4px;
|
|
1427
1427
|
padding: 5.5px 12px;
|
package/dist/index.js
CHANGED
|
@@ -1421,7 +1421,7 @@ cursor: ${({isDisabled:e})=>e?"not-allowed":"pointer"};
|
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
1423
|
${({MainDivStyle:e})=>e};
|
|
1424
|
-
`,fl=({
|
|
1424
|
+
`,fl=({fileExtensions:e,image:a,setImage:o,WrapperDivStyle:i,MainDivStyle:r,IconWrapperStyle:c,iconSize:n,iconColor:d,isDisabled:s,id:p})=>{const[u,f]=t.useState(),m=t.useRef(),C=l.useTheme()||P,[b,h]=t.useState(),[x,y]=t.useState(!1);function v(e){e.preventDefault(),e.stopPropagation()}t.useEffect((()=>{if(a&&x){const e=new FileReader;e.onloadend=()=>{f(e.result)},e.readAsDataURL(a)}else f(a)}),[a]);const w=e=>{e&&"image"===e.type.substr(0,5)?(y(!0),o(e)):y(!1)};return g.default.createElement(dl,{onDragLeave:function(e){v(e),h(!1)},onDragOver:function(e){v(e),h(!0)},onDrop:function(e){v(e);const{files:t}=e.dataTransfer;w(t[0])},WrapperDivStyle:i,isDisabled:s},g.default.createElement(ul,{isDisabled:s,theme:C,MainDivStyle:r,style:{backgroundImage:`url(${u})`},onClick:e=>{e.preventDefault(),m.current.click()}},!u&&g.default.createElement("div",{className:"icon-on-not-preview"},g.default.createElement(pl,{IconWrapperStyle:c,theme:C,isDisabled:s},g.default.createElement("img",{src:N,alt:"",height:"40px",width:"48px"}))),g.default.createElement("div",{className:"icon-on-preview"},g.default.createElement(pl,{IconWrapperStyle:c,isDisabled:s,theme:C},g.default.createElement($,{icon:"camera-icon",size:n,color:d||C.variant["primary-1"]})))),g.default.createElement(sl,{id:p,type:"file",ref:m,accept:e.length>0?e.map((e=>`.${e}`)).join(","):void 0,onChange:e=>{y(!0),o(e.target.files[0])},disabled:s,isDisabled:s}))};fl.propTypes={image:b.default.any,setImage:b.default.func,WrapperDivStyle:b.default.object,MainDivStyle:b.default.object,IconWrapperStyle:b.default.object,iconSize:b.default.number},fl.defaultProps={image:null,setImage:()=>{},WrapperDivStyle:{},MainDivStyle:{},IconWrapperStyle:{},iconSize:28,id:"",isDisabled:!1,fileExtensions:["jpg","jpeg","webp","png"]};const ml=h.default.div`
|
|
1425
1425
|
border: 1px solid ${({theme:e})=>e.additional.border};
|
|
1426
1426
|
border-radius: 4px;
|
|
1427
1427
|
padding: 5.5px 12px;
|