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

theme.keycloak.v2.admin.resources.assets.FormAccess-BcY70QlP.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsxs as R,jsx as N,Fragment as z}from"react/jsx-runtime";import*as e from"react";import{Children as V,isValidElement as X,cloneElement as g}from"react";import{_ as k,I as Y,h as I,l as u,m as Z,dn as q,cf as W,am as J,ds as K,a as M,A as G,b3 as Q,r as ee,ae as te,aZ as ae,ac as ne,bv as ie,bu as oe,aX as se,aY as re}from"./index-C1LIsRX7.js";import{C as pe}from"./copy-icon-DOS8MmN7.js";const c={button:"pf-v5-c-button",clipboardCopy:"pf-v5-c-clipboard-copy",clipboardCopyActions:"pf-v5-c-clipboard-copy__actions",clipboardCopyActionsItem:"pf-v5-c-clipboard-copy__actions-item",clipboardCopyExpandableContent:"pf-v5-c-clipboard-copy__expandable-content",clipboardCopyGroup:"pf-v5-c-clipboard-copy__group",clipboardCopyText:"pf-v5-c-clipboard-copy__text",clipboardCopyToggleIcon:"pf-v5-c-clipboard-copy__toggle-icon",dirRtl:"pf-v5-m-dir-rtl",modifiers:{expanded:"pf-m-expanded",inline:"pf-m-inline",block:"pf-m-block",code:"pf-m-code"},themeDark:"pf-v5-theme-dark"},D=i=>{var{onClick:o,exitDelay:s=0,entryDelay:a=300,maxWidth:n="100px",position:p="top","aria-label":l="Copyable input",id:r,textId:m,children:C,variant:y="control",onTooltipHidden:t=()=>{},className:h}=i,x=k(i,["onClick","exitDelay","entryDelay","maxWidth","position","aria-label","id","textId","children","variant","onTooltipHidden","className"]);const b=e.createRef();return e.createElement(Y,{trigger:"mouseenter focus click",triggerRef:b,exitDelay:s,entryDelay:a,maxWidth:n,position:p,"aria-live":"polite",aria:"none",content:e.createElement("div",null,C),onTooltipHidden:t},e.createElement(I,Object.assign({type:"button",variant:y,onClick:o,"aria-label":l,className:h,id:r,"aria-labelledby":`${r} ${m}`},x,{ref:b}),e.createElement(pe,null)))};D.displayName="ClipboardCopyButton";const F=i=>{var{onClick:o,id:s,textId:a,contentId:n,isExpanded:p=!1}=i,l=k(i,["onClick","id","textId","contentId","isExpanded"]);return e.createElement(I,Object.assign({type:"button",variant:"control",onClick:o,id:s,"aria-labelledby":`${s} ${a}`,"aria-controls":n,"aria-expanded":p},l),e.createElement("div",{className:u(c.clipboardCopyToggleIcon)},e.createElement(Z,{"aria-hidden":"true"})))};F.displayName="ClipboardCopyToggle";class $ extends e.Component{constructor(o){super(o)}render(){const o=this.props,{className:s,children:a,onChange:n,isReadOnly:p,isCode:l}=o,r=k(o,["className","children","onChange","isReadOnly","isCode"]);return e.createElement("div",Object.assign({suppressContentEditableWarning:!0,className:u(c.clipboardCopyExpandableContent,s),onInput:m=>n(m,m.target.innerText),contentEditable:!p},r),l?e.createElement("pre",{dir:"ltr"},a):a)}}$.displayName="ClipboardCopyExpanded";$.defaultProps={onChange:()=>{},className:"",isReadOnly:!1,isCode:!1};const le=(i,o)=>{try{navigator.clipboard.writeText(o.toString())}catch(s){console.warn("Clipboard API not found, this copy function will not work. This is likely because you're using an",`unsupported browser or you're not using HTTPS. 

If you're a developer building an application which needs`,"to support copying to the clipboard without the clipboard API, you'll have to create your own copy","function and pass it to the ClipboardCopy component as the onCopy prop. For more information see","https://developer.mozilla.org/en-US/docs/Web/API/Navigator/clipboard"),console.error(s)}};var O;(function(i){i.inline="inline",i.expansion="expansion",i.inlineCompact="inline-compact"})(O||(O={}));class E extends e.Component{constructor(o){super(o),this.timer=null,this.componentDidUpdate=(a,n)=>{if(a.children!==this.props.children){const p=this.props.children;this.setState({text:p,textWhenExpanded:p})}},this.componentWillUnmount=()=>{this.timer&&window.clearTimeout(this.timer)},this.expandContent=a=>{this.setState(n=>({expanded:!n.expanded}))},this.updateText=(a,n)=>{this.setState({text:n}),this.props.onChange(a,n)},this.updateTextWhenExpanded=(a,n)=>{this.setState({textWhenExpanded:n}),this.props.onChange(a,n)},this.render=()=>{const a=this.props,{isExpanded:n,onChange:p,isReadOnly:l,isCode:r,isBlock:m,exitDelay:C,maxWidth:y,entryDelay:t,onCopy:h,hoverTip:x,clickTip:b,textAriaLabel:v,toggleAriaLabel:j,variant:T,position:_,className:w,additionalActions:S,ouiaId:P,ouiaSafe:L}=a,B=k(a,["isExpanded","onChange","isReadOnly","isCode","isBlock","exitDelay","maxWidth","entryDelay","onCopy","hoverTip","clickTip","textAriaLabel","toggleAriaLabel","variant","position","className","additionalActions","ouiaId","ouiaSafe"]),A="text-input-",H="toggle-",U="content-";return e.createElement("div",Object.assign({className:u(c.clipboardCopy,T==="inline-compact"&&c.modifiers.inline,m&&c.modifiers.block,this.state.expanded&&c.modifiers.expanded,w)},B,q(E.displayName,P,L)),T==="inline-compact"&&e.createElement(W,{prefix:""},d=>e.createElement(e.Fragment,null,!r&&e.createElement("span",{className:u(c.clipboardCopyText),id:`${A}${d}`},this.state.text),r&&e.createElement("code",{className:u(c.clipboardCopyText,c.modifiers.code),id:`${A}${d}`},this.state.text),e.createElement("span",{className:u(c.clipboardCopyActions)},e.createElement("span",{className:u(c.clipboardCopyActionsItem)},e.createElement(D,{variant:"plain",exitDelay:C,entryDelay:t,maxWidth:y,position:_,id:`copy-button-${d}`,textId:`text-input-${d}`,"aria-label":x,onClick:f=>{h(f,this.state.text),this.setState({copied:!0})},onTooltipHidden:()=>this.setState({copied:!1})},this.state.copied?b:x)),S&&S))),T!=="inline-compact"&&e.createElement(W,{prefix:""},d=>e.createElement(e.Fragment,null,e.createElement("div",{className:u(c.clipboardCopyGroup)},T==="expansion"&&e.createElement(F,{isExpanded:this.state.expanded,onClick:f=>{this.expandContent(f),this.state.expanded?this.setState({text:this.state.textWhenExpanded}):this.setState({textWhenExpanded:this.state.text})},id:`${H}${d}`,textId:`${A}${d}`,contentId:`${U}${d}`,"aria-label":j}),e.createElement(J,Object.assign({readOnlyVariant:l||this.state.expanded?"default":void 0,onChange:this.updateText,value:this.state.expanded?this.state.textWhenExpanded:this.state.text,id:`text-input-${d}`,"aria-label":v},r&&{dir:"ltr"})),e.createElement(D,{exitDelay:C,entryDelay:t,maxWidth:y,position:_,id:`copy-button-${d}`,textId:`text-input-${d}`,"aria-label":x,onClick:f=>{h(f,this.state.expanded?this.state.textWhenExpanded:this.state.text),this.setState({copied:!0})},onTooltipHidden:()=>this.setState({copied:!1})},this.state.copied?b:x)),this.state.expanded&&e.createElement($,{isReadOnly:l,isCode:r,id:`content-${d}`,onChange:this.updateTextWhenExpanded},this.state.text))))};const s=Array.isArray(this.props.children)?this.props.children.join(""):this.props.children;this.state={text:s,expanded:this.props.isExpanded,copied:!1,textWhenExpanded:s}}}E.displayName="ClipboardCopy";E.defaultProps={hoverTip:"Copy to clipboard",clickTip:"Successfully copied to clipboard!",isReadOnly:!1,isExpanded:!1,isCode:!1,variant:"inline",position:K.top,maxWidth:"150px",exitDelay:1500,entryDelay:300,onCopy:le,onChange:()=>{},textAriaLabel:"Copyable input",toggleAriaLabel:"Show content",additionalActions:null,ouiaSafe:!0};const de="_buttonGroup_1gajx_1",ce={buttonGroup:de},me=({name:i,save:o,reset:s,isSubmit:a=!1,isActive:n=!0,children:p,...l})=>{const{t:r}=M();return R(G,{className:ce.buttonGroup,...l,children:[(o||a)&&N(I,{isDisabled:!n,"data-testid":`${i}-save`,onClick:()=>o?.(),type:a?"submit":"button",children:r("save")}),s&&N(I,{isDisabled:!n,"data-testid":`${i}-revert`,variant:"link",onClick:()=>s(),children:r("revert")}),p]})},be=({children:i,role:o,fineGrainedAccess:s=!1,isReadOnly:a=!1,unWrap:n=!1,...p})=>{const{hasAccess:l}=Q(),r=(C,y)=>V.map(C,t=>{if(!X(t))return t;if(t.props){const h=t;if(t.type===te)return g(t,{...h.props,render:b=>{const v=h.props.render(b);return g(v,{...v.props,...y})}});const x=r(h.props.children,y);switch(t.type){case me:return g(t,{isActive:!y.isDisabled,children:x});case ae:return g(t,{readOnly:y.isDisabled,children:x})}return g(t,t.type===ne||t.type===ie||t.type===oe||t.type===G||t.type===E||t.type===se||t.type===re?{children:x}:{...y,children:x})}return t}),m=a||!l(o)&&!s;return R(z,{children:[!n&&N(ee,{...p,className:"keycloak__form "+(p.className||""),children:r(i,m?{isDisabled:m}:{})}),n&&r(i,m?{isDisabled:m}:{})]})};export{D as C,be as F,me as a,E as b};
//# sourceMappingURL=FormAccess-BcY70QlP.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy