1mpacto-react-ui 0.0.86 → 0.0.87
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.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -175,7 +175,7 @@ You should wrap it with \`css\` like this:
|
|
175
175
|
${h()?yn["isset-left-icon"]:""}
|
176
176
|
${g()?yn["isset-right-icon"]:""}
|
177
177
|
${u??""}`,ref:d,type:r,...c}),S.jsxs("div",{className:yn["end-icon"],children:[typeof a=="function"&&a(),x.isValidElement(a)&&a]})]}),o&&S.jsx("label",{className:`${yn["label-error"]}
|
178
|
-
${c.disabled?yn.disabled:""} ${l??""}`,children:o})]})});xh.displayName="InputNative";const JM="_container_1szxn_1",KM="_files_1szxn_4",QM="_file_1szxn_4",Wi={container:JM,files:KM,file:QM,"file-name-wrapper":"_file-name-wrapper_1szxn_10","file-name":"_file-name_1szxn_10","file-extension":"_file-extension_1szxn_13"},qM=({value:e,validateFile:t,classNameContainer:n,classNameButton:r,textUpload:i="Unggah Lampiran",buttonProps:a={},maxFile:o=1,maxSize:s=1,error:l,removeElement:u,onChange:c,handlerDownload:d})=>{const f={variants:"ghost-laba-blue-10",size:"small"},h=x.useRef(null),g=t||["image/png","image/jpeg","image/jpg"],[m,p]=x.useState(""),b=C=>{if(C!=null&&C.length){const w=Array.from(C).slice(0,o),I=w==null?void 0:w.filter(D=>!g.includes(D.type)),E=(w==null?void 0:w.reduce((D,$)=>D+$.size,0))/1024/1024;if(I.length>0)p("Berkas tidak didukung, silahkan pilih file kembali.");else if(E>s){const D=`${C.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${s}MB.`;p(D)}else{if(!(h!=null&&h.current))return;typeof c=="function"&&c(w),p(""),h.current.value=""}}},v=C=>{var w;C.preventDefault(),h!=null&&h.current&&((w=h.current)==null||w.click())};function y(C){if(typeof C!="string")throw new Error("Input harus berupa string");const w=C.split(".");if(w.length===1)return{filename:C,extension:""};const I="."+w[w.length-1];return{filename:w.slice(0,-1).join("."),extension:I}}return S.jsxs("div",{className:`${Wi.container} ${n??""}`,children:[S.jsx(Hn,{...f,...a,className:r??"",onClick:C=>v(C),children:i}),S.jsx(xh,{accept:g==null?void 0:g.join(", "),ref:h,type:"file",onChange:C=>b(C.target.files),error:l??m,multiple:o>1,hidden:!0}),S.jsx("div",{className:Wi.files,children:e==null?void 0:e.map((C,w)=>S.jsxs("div",{className:Wi.file,onClick:I=>{I.stopPropagation(),typeof d=="function"&&d(C)},children:[S.jsxs("div",{className:Wi["file-name-wrapper"],children:[S.jsx("span",{className:Wi["file-name"],children:y((C==null?void 0:C.name)??(C==null?void 0:C.originalName)??(C==null?void 0:C.fileName)??"").filename}),S.jsx("span",{className:Wi["file-extension"],children:y((C==null?void 0:C.name)??(C==null?void 0:C.originalName)??(C==null?void 0:C.fileName)??"").extension})]}),typeof u=="function"&&S.jsx(S.Fragment,{children:u(C)})]},w))})]})},p0={"error-payhere":"_error-payhere_1hkqz_1","error-laba":"_error-laba_1hkqz_5"},eB=({className:e,variants:t="laba",error:n})=>{const r={variants:{laba:p0["error-laba"],payhere:p0["error-payhere"]}};return S.jsx(S.Fragment,{children:n?S.jsx("span",{className:`${r.variants[t]} ${e??""}`,children:n}):S.jsx(S.Fragment,{})})},tB="_container_5yc5a_1",nB="_textarea_5yc5a_7",rB="_label_5yc5a_36",iB="_error_5yc5a_44",Jn={container:tB,"size-medium":"_size-medium_5yc5a_1","container-textarea":"_container-textarea_5yc5a_4",textarea:nB,"placeholder-shown":"_placeholder-shown_5yc5a_24",label:rB,error:iB,"label-error":"_label-error_5yc5a_60"},w3=x.forwardRef((e,t)=>{const{isRequired:n,classNameContainer:r,className:i,classNameLabel:a,classNameLabelError:o,name:s,id:l,label:u,error:c,height:d,minHeight:f=94,maxHeight:h=150,style:g,sizeInput:m="medium",translateLabel:p=20,autoTranslateLabel:b=!
|
178
|
+
${c.disabled?yn.disabled:""} ${l??""}`,children:o})]})});xh.displayName="InputNative";const JM="_container_1szxn_1",KM="_files_1szxn_4",QM="_file_1szxn_4",Wi={container:JM,files:KM,file:QM,"file-name-wrapper":"_file-name-wrapper_1szxn_10","file-name":"_file-name_1szxn_10","file-extension":"_file-extension_1szxn_13"},qM=({value:e,validateFile:t,classNameContainer:n,classNameButton:r,textUpload:i="Unggah Lampiran",buttonProps:a={},maxFile:o=1,maxSize:s=1,error:l,removeElement:u,onChange:c,handlerDownload:d})=>{const f={variants:"ghost-laba-blue-10",size:"small"},h=x.useRef(null),g=t||["image/png","image/jpeg","image/jpg"],[m,p]=x.useState(""),b=C=>{if(C!=null&&C.length){const w=Array.from(C).slice(0,o),I=w==null?void 0:w.filter(D=>!g.includes(D.type)),E=(w==null?void 0:w.reduce((D,$)=>D+$.size,0))/1024/1024;if(I.length>0)p("Berkas tidak didukung, silahkan pilih file kembali.");else if(E>s){const D=`${C.length>1?"Jumlah u":"U"}kuran berkas tidak boleh melebihi ${s}MB.`;p(D)}else{if(!(h!=null&&h.current))return;typeof c=="function"&&c(w),p(""),h.current.value=""}}},v=C=>{var w;C.preventDefault(),h!=null&&h.current&&((w=h.current)==null||w.click())};function y(C){if(typeof C!="string")throw new Error("Input harus berupa string");const w=C.split(".");if(w.length===1)return{filename:C,extension:""};const I="."+w[w.length-1];return{filename:w.slice(0,-1).join("."),extension:I}}return S.jsxs("div",{className:`${Wi.container} ${n??""}`,children:[S.jsx(Hn,{...f,...a,className:r??"",onClick:C=>v(C),children:i}),S.jsx(xh,{accept:g==null?void 0:g.join(", "),ref:h,type:"file",onChange:C=>b(C.target.files),error:l??m,multiple:o>1,hidden:!0}),S.jsx("div",{className:Wi.files,children:e==null?void 0:e.map((C,w)=>S.jsxs("div",{className:Wi.file,onClick:I=>{I.stopPropagation(),typeof d=="function"&&d(C)},children:[S.jsxs("div",{className:Wi["file-name-wrapper"],children:[S.jsx("span",{className:Wi["file-name"],children:y((C==null?void 0:C.name)??(C==null?void 0:C.originalName)??(C==null?void 0:C.fileName)??"").filename}),S.jsx("span",{className:Wi["file-extension"],children:y((C==null?void 0:C.name)??(C==null?void 0:C.originalName)??(C==null?void 0:C.fileName)??"").extension})]}),typeof u=="function"&&S.jsx(S.Fragment,{children:u(C)})]},w))})]})},p0={"error-payhere":"_error-payhere_1hkqz_1","error-laba":"_error-laba_1hkqz_5"},eB=({className:e,variants:t="laba",error:n})=>{const r={variants:{laba:p0["error-laba"],payhere:p0["error-payhere"]}};return S.jsx(S.Fragment,{children:n?S.jsx("span",{className:`${r.variants[t]} ${e??""}`,children:n}):S.jsx(S.Fragment,{})})},tB="_container_5yc5a_1",nB="_textarea_5yc5a_7",rB="_label_5yc5a_36",iB="_error_5yc5a_44",Jn={container:tB,"size-medium":"_size-medium_5yc5a_1","container-textarea":"_container-textarea_5yc5a_4",textarea:nB,"placeholder-shown":"_placeholder-shown_5yc5a_24",label:rB,error:iB,"label-error":"_label-error_5yc5a_60"},w3=x.forwardRef((e,t)=>{const{isRequired:n,classNameContainer:r,className:i,classNameLabel:a,classNameLabelError:o,name:s,id:l,label:u,error:c,height:d,minHeight:f=94,maxHeight:h=150,style:g,sizeInput:m="medium",translateLabel:p=20,autoTranslateLabel:b=!1,...v}=e,y=x.useRef(null),C=pf(y,t),w=x.useRef(null),I={...g??{},maxHeight:h,height:d??f,minHeight:f},[E,D]=x.useState(!1),[$,F]=x.useState(!1),[_,P]=x.useState(p),k={size:{medium:Jn["size-medium"]}},A=()=>{var V;v.value===""||((V=y.current)==null?void 0:V.value)===""?(F(!1),b&&setTimeout(()=>{var O,W;const H=((O=y.current)==null?void 0:O.offsetHeight)??0,L=((W=w.current)==null?void 0:W.offsetHeight)??0,Z=(H-L)/2;P(Z)},100)):F(!0)},B=function(V){var H;D(!0),A(),(H=e.onFocus)==null||H.call(e,V)},T=function(V){var H;D(!1),(H=e.onBlur)==null||H.call(e,V)},R=function(V){A();const H=(V==null?void 0:V.target)??y.current;H.style.height="0px",H.style.height=H.scrollHeight+"px"};return mf(()=>(E&&y.current?y.current.addEventListener("input",R):R(),()=>{var V;(V=y.current)==null||V.removeEventListener("input",R)}),[E]),S.jsxs("div",{className:`${Jn.container}
|
179
179
|
${k.size[m]}
|
180
180
|
${r??""}`,children:[S.jsxs("div",{className:`${Jn["container-textarea"]}`,children:[S.jsx("textarea",{id:l??s,className:`${$?"":Jn["placeholder-shown"]} ${c?Jn.error:""}
|
181
181
|
${Jn.textarea}
|