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

theme.keycloak.v2.admin.resources.assets.ScopeForm-1a884a11.js Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
import{u as k,e as B,c as G,ac as _,r as h,Q as v,ad as o,y as $,j as e,F as a,h as l,V as c,f as z,ae as H,C as i,S as C,B as F,L as Q,a2 as W}from"./index-f33eb656.js";import{g as J}from"./utils-49fe564a.js";import{D as M}from"./SwitchControl-a1cad449.js";import{b as O,d as U}from"./ClientScopeTypes-517b1596.js";import{F as X}from"./FormAccess-29b78a4e.js";import{K as Y}from"./KeycloakTextArea-b4f2aa51.js";import{K as b}from"./KeycloakTextInput-e2751b88.js";import{u as Z,F as ee}from"./useIsFeatureEnabled-4167e6f3.js";import{S as V,a as L,b as ne}from"./Select-802cd710.js";import{A as se}from"./Form-6c170f69.js";const xe=({clientScope:d,save:D})=>{const{t:n}=k("client-scopes"),{t:E}=k("clients"),m=B({mode:"onChange"}),{register:u,control:r,handleSubmit:q,setValue:f,formState:{errors:p,isDirty:A,isValid:P}}=m,{realm:R}=G(),g=_(),j=Z()(ee.DynamicScopes),[K,y]=h.useState(!1),[N,S]=h.useState(!1),I=v({control:r,name:o("attributes.display.on.consent.screen"),defaultValue:d?.attributes?.["display.on.consent.screen"]??"true"}),w=v({control:r,name:o("attributes.is.dynamic.scope"),defaultValue:"false"}),T=(s,t)=>f(o("attributes.dynamic.scope.regexp"),t?`${s}:*`:s);return h.useEffect(()=>{$(d??{},f)},[d]),e.jsxs(X,{role:"manage-clients",onSubmit:q(D),isHorizontal:!0,children:[e.jsx(a,{label:n("common:name"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:name"),fieldLabelId:"name"}),fieldId:"kc-name",validated:p.name?c.error:c.default,helperTextInvalid:n("common:required"),isRequired:!0,children:e.jsx(b,{id:"kc-name",validated:p.name?c.error:c.default,isRequired:!0,...u("name",{required:!0,onChange:s=>{j&&T(s.target.value,!0)}})})}),j&&e.jsxs(z,{...m,children:[e.jsx(M,{name:o("attributes.is.dynamic.scope"),label:n("dynamicScope"),labelIcon:n("client-scopes-help:dynamicScope"),onChange:s=>{T(s&&m.getValues("name")||"",s)},stringify:!0}),w==="true"&&e.jsx(H,{name:o("attributes.dynamic.scope.regexp"),label:n("dynamicScopeFormat"),labelIcon:n("client-scopes-help:dynamicScopeFormat"),isDisabled:!0})]}),e.jsx(a,{label:n("common:description"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:description"),fieldLabelId:"description"}),fieldId:"kc-description",validated:p.description?c.error:c.default,helperTextInvalid:n("common:maxLength",{length:255}),children:e.jsx(b,{id:"kc-description",validated:p.description?c.error:c.default,...u("description",{maxLength:255})})}),e.jsx(a,{label:n("type"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:type"),fieldLabelId:"client-scopes:type"}),fieldId:"kc-type",children:e.jsx(i,{name:"type",defaultValue:O[0],control:r,render:({field:s})=>e.jsx(V,{toggleId:"kc-type",variant:L.single,isOpen:N,selections:s.value,onToggle:S,onSelect:(t,x)=>{s.onChange(x),S(!1)},children:U(n,O)})})}),!d&&e.jsx(a,{label:n("protocol"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:protocol"),fieldLabelId:"client-scopes:protocol"}),fieldId:"kc-protocol",children:e.jsx(i,{name:"protocol",defaultValue:g[0],control:r,render:({field:s})=>e.jsx(V,{toggleId:"kc-protocol",onToggle:y,onSelect:(t,x)=>{s.onChange(x),y(!1)},selections:s.value,variant:L.single,isOpen:K,children:g.map(t=>e.jsx(ne,{selected:t===s.value,value:t,"data-testid":`option-${t}`,children:J(E,t)},t))})})}),e.jsx(a,{hasNoPaddingTop:!0,label:n("displayOnConsentScreen"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:displayOnConsentScreen"),fieldLabelId:"client-scopes:displayOnConsentScreen"}),fieldId:"kc-display-on-consent-screen",children:e.jsx(i,{name:o("attributes.display.on.consent.screen"),control:r,defaultValue:I,render:({field:s})=>e.jsx(C,{id:"kc-display-on-consent-screen",label:n("common:on"),labelOff:n("common:off"),isChecked:s.value==="true",onChange:t=>s.onChange(t.toString())})})}),I==="true"&&e.jsx(a,{label:n("consentScreenText"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:consentScreenText"),fieldLabelId:"client-scopes:consentScreenText"}),fieldId:"kc-consent-screen-text",children:e.jsx(Y,{id:"kc-consent-screen-text",...u(o("attributes.consent.screen.text"))})}),e.jsx(a,{hasNoPaddingTop:!0,label:n("includeInTokenScope"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:includeInTokenScope"),fieldLabelId:"client-scopes:includeInTokenScope"}),fieldId:"kc-include-in-token-scope",children:e.jsx(i,{name:o("attributes.include.in.token.scope"),control:r,defaultValue:"true",render:({field:s})=>e.jsx(C,{id:"kc-include-in-token-scope",label:n("common:on"),labelOff:n("common:off"),isChecked:s.value==="true",onChange:t=>s.onChange(t.toString())})})}),e.jsx(a,{label:n("guiOrder"),labelIcon:e.jsx(l,{helpText:n("client-scopes-help:guiOrder"),fieldLabelId:"client-scopes:guiOrder"}),fieldId:"kc-gui-order",children:e.jsx(i,{name:o("attributes.gui.order"),defaultValue:"",control:r,render:({field:s})=>e.jsx(b,{id:"kc-gui-order",type:"number",value:s.value,min:0,onChange:s.onChange})})}),e.jsxs(se,{children:[e.jsx(F,{variant:"primary",type:"submit",isDisabled:!A||!P,children:n("common:save")}),e.jsx(F,{variant:"link",component:s=>e.jsx(Q,{...s,to:W({realm:R})}),children:n("common:cancel")})]})]})};export{xe as S};
//# sourceMappingURL=ScopeForm-1a884a11.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy