All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.FileUploadForm-eb2a90b9.js Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
import{u as v,r as j,j as l,B as u,F as L}from"./index-0cda761d.js";import{F as f}from"./FileUpload-2469f593.js";import{C as U}from"./CodeEditor-781232a0.js";import{M as D,a as R}from"./Modal-ea09312d.js";const y=({id:t,onChange:r,helpText:x="common-help:helpFileUpload",unWrap:d=!1,language:g,extension:C,...o})=>{const{t:n}=v(),c={value:"",filename:"",isLoading:!1,modal:!1},[e,a]=j.useState(c),p=()=>a({...e,modal:!1}),m=(s,F)=>{a({...e,filename:F.name})},i=s=>{a({...e,value:s}),r(s)},h=()=>{a({...e,modal:!0})};return l.jsxs(l.Fragment,{children:[e.modal&&l.jsx(D,{variant:R.small,title:n("clearFile"),isOpen:!0,onClose:p,actions:[l.jsx(u,{variant:"primary","data-testid":"clear-button",onClick:()=>{a(c),r("")},children:n("clear")},"confirm"),l.jsx(u,{"data-testid":"cancel",variant:"link",onClick:p,children:n("cancel")},"cancel")],children:n("clearFileExplain")}),d&&l.jsx(f,{id:t,...o,type:"text",value:e.value,filename:e.filename,onFileInputChange:m,onDataChange:i,onTextChange:i,onClearClick:h,onReadStarted:()=>a({...e,isLoading:!0}),onReadFinished:()=>a({...e,isLoading:!1}),isLoading:e.isLoading,dropzoneProps:{accept:{"application/text":[C]}}}),!d&&l.jsx(L,{label:n("resourceFile"),fieldId:t,helperText:n(x),children:l.jsx(f,{"data-testid":t,id:t,...o,type:"text",value:e.value,filename:e.filename,onFileInputChange:m,onDataChange:i,onTextChange:i,onClearClick:h,onReadStarted:()=>a({...e,isLoading:!0}),onReadFinished:()=>a({...e,isLoading:!1}),isLoading:e.isLoading,hideDefaultPreview:!0,children:!o.hideDefaultPreview&&l.jsx(U,{isLineNumbersVisible:!0,code:e.value,language:g,height:"128px",onChange:i,isReadOnly:!o.allowEditingUploadedText})})})]})};export{y as F};
//# sourceMappingURL=FileUploadForm-eb2a90b9.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy