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

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

There is a newer version: 26.0.7
Show newest version
import{jsxs as u,Fragment as L,jsx as l}from"react/jsx-runtime";import{useState as T}from"react";import{F as f}from"./FileUpload-CumNwlWc.js";import{a as U,M as b,q as D,i as g,ac as k,dy as y,b_ as I,b$ as R}from"./main-C7ps2lmX.js";import{C as w}from"./CodeEditor-C-nZkUJx.js";const S=({id:t,onChange:d,helpText:C="helpFileUpload",unWrap:s=!1,language:F,extension:x,...o})=>{const{t:i}=U(),c={value:"",filename:"",isLoading:!1,modal:!1},[e,a]=T(c),m=()=>a({...e,modal:!1}),p=(r,v)=>{a({...e,filename:v.name})},n=r=>{a({...e,value:r}),d(r)},h=()=>{a({...e,modal:!0})};return u(L,{children:[e.modal&&l(b,{variant:D.small,title:i("clearFile"),isOpen:!0,onClose:m,actions:[l(g,{variant:"primary","data-testid":"clear-button",onClick:()=>{a(c),d("")},children:i("clear")},"confirm"),l(g,{"data-testid":"cancel",variant:"link",onClick:m,children:i("cancel")},"cancel")],children:i("clearFileExplain")}),s&&l(f,{id:t,...o,type:"text",value:e.value,filename:e.filename,onFileInputChange:p,onDataChange:n,onTextChange:n,onClearClick:h,onReadStarted:()=>a({...e,isLoading:!0}),onReadFinished:()=>a({...e,isLoading:!1}),isLoading:e.isLoading,dropzoneProps:{accept:{"application/text":[x]}}}),!s&&u(k,{label:i("resourceFile"),fieldId:t,children:[l(f,{"data-testid":t,id:t,...o,type:"text",value:e.value,filename:e.filename,onFileInputChange:p,onDataChange:n,onTextChange:n,onClearClick:h,onReadStarted:()=>a({...e,isLoading:!0}),onReadFinished:()=>a({...e,isLoading:!1}),isLoading:e.isLoading,hideDefaultPreview:!0,children:!o.hideDefaultPreview&&l(w,{isLineNumbersVisible:!0,code:e.value,language:F,height:"128px",onChange:n,isReadOnly:!o.allowEditingUploadedText})}),l(y,{children:l(I,{children:l(R,{children:i(C)})})})]})]})};export{S as F};
//# sourceMappingURL=FileUploadForm-BgyzQxBE.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy