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

theme.keycloak.v2.admin.resources.assets.FileUploadForm-DXJKFbGA.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-T43Q4AfB.js";import{a as U,M as b,q as D,h as g,ac as k,dy as y,bZ as I,b_ as R}from"./index-C1LIsRX7.js";import{C as w}from"./CodeEditor-CIeIZGz7.js";const S=({id:t,onChange:d,helpText:C="helpFileUpload",unWrap:s=!1,language:F,extension:x,...o})=>{const{t:n}=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})},i=r=>{a({...e,value:r}),d(r)},h=()=>{a({...e,modal:!0})};return u(L,{children:[e.modal&&l(b,{variant:D.small,title:n("clearFile"),isOpen:!0,onClose:m,actions:[l(g,{variant:"primary","data-testid":"clear-button",onClick:()=>{a(c),d("")},children:n("clear")},"confirm"),l(g,{"data-testid":"cancel",variant:"link",onClick:m,children:n("cancel")},"cancel")],children:n("clearFileExplain")}),s&&l(f,{id:t,...o,type:"text",value:e.value,filename:e.filename,onFileInputChange:p,onDataChange:i,onTextChange:i,onClearClick:h,onReadStarted:()=>a({...e,isLoading:!0}),onReadFinished:()=>a({...e,isLoading:!1}),isLoading:e.isLoading,dropzoneProps:{accept:{"application/text":[x]}}}),!s&&u(k,{label:n("resourceFile"),fieldId:t,children:[l(f,{"data-testid":t,id:t,...o,type:"text",value:e.value,filename:e.filename,onFileInputChange:p,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(w,{isLineNumbersVisible:!0,code:e.value,language:F,height:"128px",onChange:i,isReadOnly:!o.allowEditingUploadedText})}),l(y,{children:l(I,{children:l(R,{children:n(C)})})})]})]})};export{S as F};
//# sourceMappingURL=FileUploadForm-DXJKFbGA.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy