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

theme.keycloak.v2.admin.resources.assets.MultiLineInput-DiPNQ1LE.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsx as s,jsxs as d}from"react/jsx-runtime";import{useMemo as B,useEffect as F,Fragment as T}from"react";import{a as G,aj as $,ab as D,bb as E,bc as m,am as L,i as f,B as I,ap as P,as as S}from"./main-C7ps2lmX.js";function b(e){return typeof e=="string"?e.split("##"):[e||""]}function W(e){return e.join("##")}const z=({name:e,addButtonLabel:g,isDisabled:l=!1,defaultValue:o,stringify:i=!1,id:v,...C})=>{const{t:c}=G(),{register:p,setValue:M,control:V}=$(),n=D({name:e,control:V,defaultValue:o||""}),r=B(()=>{let t=i?b(Array.isArray(n)&&n.length===1?n[0]:n):n;return t=Array.isArray(t)&&t.length!==0?t:(i?b(o):o)||[""],t},[n]),j=t=>{u([...r.slice(0,t),...r.slice(t+1)])},k=()=>{u([...r,""])},y=(t,a)=>{u([...r.slice(0,t),a,...r.slice(t+1)])},u=t=>{const a=t.flatMap(h=>h);M(e,i?W(a):a,{shouldDirty:!0})};return F(()=>{p(e)},[p]),s("div",{id:v,children:r.map((t,a)=>d(T,{children:[d(E,{children:[s(m,{isFill:!0,children:s(L,{"data-testid":e+a,onChange:(h,A)=>y(a,A),name:`${e}.${a}.value`,value:t,isDisabled:l,...C})}),s(m,{children:s(f,{"data-testid":"remove"+a,variant:I.link,onClick:()=>j(a),tabIndex:-1,"aria-label":c("remove"),isDisabled:r.length===1||l,children:s(P,{})})})]}),a===r.length-1&&d(f,{variant:I.link,onClick:k,tabIndex:-1,"aria-label":c("add"),"data-testid":"addValue",isDisabled:!t||l,children:[s(S,{})," ",c(g||"add")]})]},a))})};export{z as M};
//# sourceMappingURL=MultiLineInput-DiPNQ1LE.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy