@ansible/ansible-ui-framework 2.4.620 → 2.4.621

Sign up to get free protection for your applications and to get access to all the features.
package/index.js CHANGED
@@ -45577,7 +45577,7 @@ function eAe(e) {
45577
45577
  children: d
45578
45578
  }
45579
45579
  ) }),
45580
- e.footer ? e.footer : /* @__PURE__ */ v.jsx(Xn, { variant: "light", isFilled: !1, children: /* @__PURE__ */ v.jsxs(QTe, { children: [
45580
+ e.footer ? e.footer : /* @__PURE__ */ v.jsx(Xn, { variant: "light", isFilled: !1, className: "bg-lighten border-top", children: /* @__PURE__ */ v.jsxs(QTe, { children: [
45581
45581
  /* @__PURE__ */ v.jsx(S$, { children: e.submitText }),
45582
45582
  e.additionalActionText ? /* @__PURE__ */ v.jsx(Re, { "aria-label": e.additionalActionText, type: "submit", variant: "secondary", children: e.additionalActionText }) : null,
45583
45583
  e.onCancel && /* @__PURE__ */ v.jsx(ZTe, { onCancel: e.onCancel, children: e.cancelText ?? c.cancelText })
package/index.umd.cjs CHANGED
@@ -523,7 +523,7 @@ ${o}${y}`}else m=`${p}${s}${h.join(" ")}${s}${y}`;return e&&(m+=uo(m,o,c(e)),a&&
523
523
  && {
524
524
  margin-block-start: unset;
525
525
  }
526
- `;function Fb(e,t){const n=_6({defaultValues:e??{}}),{handleSubmit:r,setError:i}=n,[a,o]=x.useState(null);return{form:n,handleSubmit:r,error:a,setError:o,handleSubmitError:s=>{const{genericErrors:c,fieldErrors:u}=t(s);c.length>0?o(c.map(f=>f.message)):o(null),u.length>0&&u.forEach(f=>{i(f.name,{message:typeof f.message=="string"?f.message:void 0})})},setFieldError:i}}function p3(e){const{errorAdapter:t=h3}=e,{form:n,handleSubmit:r,error:i,setError:a,handleSubmitError:o,setFieldError:l}=Fb(e.defaultValue,t),[s]=x.useContext(Ta),[c]=Ot(),u=ln("md"),f=e.isVertical?!1:s.formLayout==="horizontal";let d=e.children;return e.disableGrid!==!0&&(d=v.jsx(g3,{isVertical:e.isVertical,singleColumn:e.singleColumn,children:e.children})),v.jsx(e6,{...n,children:v.jsxs(T.Form,{onSubmit:r(async(h,m)=>{var y,_;a(null);let p=!1;m!==void 0&&((y=m==null?void 0:m.nativeEvent)!=null&&y.submitter)&&(p=((_=m.nativeEvent.submitter)==null?void 0:_.innerHTML)===e.additionalActionText);try{await e.onSubmit(h,b=>a(b),l,p?n:void 0)}catch(b){o(b)}}),isHorizontal:f,autoComplete:e.autoComplete,style:{display:"flex",flexDirection:"column",flexGrow:1,height:"100%",maxHeight:"100%",overflow:"hidden",gap:0},children:[i&&v.jsx(t3,{error:i,isMd:u,onCancel:e.onCancel}),v.jsx(Ji,{children:v.jsx(Bxe,{variant:"light",isFilled:!0,isWidthLimited:!0,padding:{default:e.disablePadding?"noPadding":"padding"},children:d})}),e.footer?e.footer:v.jsx(T.PageSection,{variant:"light",isFilled:!1,children:v.jsxs(Wxe,{children:[v.jsx($b,{children:e.submitText}),e.additionalActionText?v.jsx(T.Button,{"aria-label":e.additionalActionText,type:"submit",variant:"secondary",children:e.additionalActionText}):null,e.onCancel&&v.jsx(m3,{onCancel:e.onCancel,children:e.cancelText??c.cancelText})]})})]})})}function g3(e){const[t]=x.useContext(Ta),n=e.isVertical?!1:t.formLayout==="horizontal",r=e.singleColumn?!1:t.formColumns==="multiple",i=12,a=r?n?12:6:12,o=r?6:12,l=r?6:12,s=r?4:12;return v.jsx(T.Grid,{hasGutter:!0,span:12,sm:i,md:a,lg:o,xl:l,xl2:s,children:e.children})}function Vxe(e){const{errorAdapter:t=h3}=e,{form:n,handleSubmit:r,error:i,setError:a,handleSubmitError:o,setFieldError:l}=Fb(e.defaultValue,t),[s]=x.useContext(Ta),c=ln("md"),u=e.isVertical?!1:s.formLayout==="horizontal";return v.jsx(e6,{...n,children:v.jsxs(T.Form,{onSubmit:r(async f=>{a(null);try{await e.onSubmit(f,d=>a(d),l,void 0)}catch(d){o(d)}}),isHorizontal:u,autoComplete:e.autoComplete,children:[i&&v.jsx(t3,{error:i,isMd:c,onCancel:e.onCancel}),e.children]})})}const IOe="",Nb=x.createContext({isOpen:!1,setState:()=>({})});function Xh(){return x.useContext(Nb)}function v3(e){const t=ln("xl"),[n,r]=x.useState(()=>t),i=x.useCallback(a=>{a.isOpen!==void 0&&r(a.isOpen)},[]);return x.useEffect(()=>i({isOpen:t}),[t,i]),v.jsx(Nb.Provider,{value:{isOpen:n,setState:i},children:e.children})}function y3(){const e=Xt.useNavigate(),t=ln("xl"),n=Xh();return x.useCallback(i=>{e(i),t||n.setState({isOpen:!n.isOpen})},[e,t,n])}function b3(e){return v.jsx(h5,{children:v.jsx(A5,{children:v.jsx(x5,{children:v.jsx(y5,{children:v.jsx(v3,{children:e.children})})})})})}function Hxe(e){const t=Xt.useNavigate();return e.breadcrumbs?v.jsx(T.Breadcrumb,{style:e.style,children:e.breadcrumbs.map((n,r)=>n.label?v.jsx(T.BreadcrumbItem,{"data-cy":n.label,id:n.id,component:n.component,isActive:n.to===void 0,children:n.to?v.jsx("a",{href:n.to,"data-cy":n.label,onClick:i=>{i.preventDefault(),n.to&&t(n.to)},children:n.label}):n.label},n.id??n.label??r):v.jsx(x.Fragment,{},r))}):v.jsx(x.Fragment,{})}function _3(e){const{breadcrumbs:t,title:n,description:r,controls:i,headerActions:a,footer:o}=e,l=ln("lg"),s=ln("xl"),c=ln("md"),[u]=Ot();return v.jsx(T.PageSection,{variant:T.PageSectionVariants.light,className:"bg-lighten border-bottom",style:{paddingTop:s?16:12,paddingBottom:s?16:12},children:v.jsxs(T.Stack,{hasGutter:!0,children:[v.jsxs(T.Flex,{flexWrap:{default:"nowrap"},alignItems:{default:"alignItemsStretch"},children:[v.jsxs(T.FlexItem,{grow:{default:"grow"},children:[t&&v.jsx(Hxe,{breadcrumbs:t,style:{paddingBottom:l?6:4}}),n?e.titleHelp?v.jsx(T.Popover,{headerContent:e.titleHelpTitle,bodyContent:v.jsxs(T.Stack,{hasGutter:!0,children:[typeof e.titleHelp=="string"?v.jsx(T.StackItem,{children:e.titleHelp}):e.titleHelp.map((f,d)=>v.jsx(T.StackItem,{children:f},d)),e.titleDocLink&&v.jsx(T.StackItem,{children:v.jsx(T.Button,{icon:v.jsx(Ae.ExternalLinkAltIcon,{}),variant:"link",onClick:()=>window.open(e.titleDocLink,"_blank"),isInline:!0,children:u.documentation})})]}),position:"bottom-start",children:v.jsxs(T.Title,{"data-cy":"page-title",headingLevel:"h1",children:[n,v.jsx(T.Button,{variant:"link",style:{padding:0,marginTop:1,marginLeft:8,verticalAlign:"top"},children:v.jsx(Ae.OutlinedQuestionCircleIcon,{})})]})}):v.jsx(T.Title,{"data-cy":"page-title",headingLevel:"h1",children:n}):v.jsx(T.Title,{headingLevel:"h1",children:v.jsx(T.Skeleton,{width:"160px"})}),c&&r&&v.jsx(T.Text,{"data-cy":"app-description",component:"p",style:{paddingTop:s?4:2,opacity:.8},children:typeof r=="string"?v.jsx(T.Truncate,{content:r}):v.jsx(T.Stack,{children:r.map(f=>v.jsx(T.StackItem,{children:f},f))})})]}),n&&(a||i)&&v.jsxs(T.Flex,{"data-cy":"manage-view",direction:{default:"column"},spaceItems:{default:"spaceItemsSm",xl:"spaceItemsMd"},justifyContent:{default:"justifyContentCenter"},children:[i&&v.jsx(T.FlexItem,{grow:{default:"grow"},children:i}),a&&v.jsx(T.FlexItem,{children:a})]})]}),o]})})}function x3(e){const[t]=Ot();return v.jsx(b5,{message:t.errorText,children:v.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",maxHeight:"100%",backgroundColor:"var(--pf-v5-global--BackgroundColor--100)"},children:e.children})})}function Uxe(e){const t=ln("sm"),n=ln("md");return v.jsxs(T.Masthead,{display:{default:"inline"},style:{borderBottom:"1px solid #fff4",paddingRight:0},children:[v.jsx(S3,{}),t&&v.jsx(T.MastheadMain,{children:v.jsx(T.MastheadBrand,{component:"a",children:e.icon})}),v.jsx(T.MastheadContent,{style:{marginLeft:0,minHeight:0},children:v.jsx(T.Toolbar,{id:"toolbar","data-cy":"toolbar",inset:{default:"insetNone"},style:{padding:0},children:v.jsxs(T.ToolbarContent,{children:[n&&v.jsx(T.ToolbarItem,{children:v.jsxs(T.Stack,{style:{color:"white",cursor:"default",marginTop:-2,marginBottom:-2},children:[e.brand&&v.jsx(T.Text,{style:{marginTop:-6},children:v.jsx(T.Truncate,{content:e.brand,style:{minWidth:0}})}),v.jsx(T.Title,{headingLevel:"h1",style:{lineHeight:1},children:v.jsx(T.Truncate,{content:e.title,style:{minWidth:0}})})]})}),e.children]})})})]})}function S3(){const e=Xh();return v.jsx(T.MastheadToggle,{onClick:()=>e.setState({isOpen:!e.isOpen}),children:v.jsx(T.PageToggleButton,{"data-cy":"nav-toggle",variant:"plain","aria-label":"Global navigation",children:v.jsx(Ae.BarsIcon,{})})})}function Gxe(e){const{t}=xt(),n=Xt.useNavigate(),{dashboardUrl:r}=e;return React.createElement(T.EmptyState,{isFullHeight:!0},React.createElement(T.EmptyStateHeader,{titleText:React.createElement(React.Fragment,null,t("Page not found")),icon:React.createElement(T.EmptyStateIcon,{icon:Ae.ExclamationCircleIcon}),headingLevel:"h2"}),React.createElement(T.EmptyStateBody,null,t("We could not find that page.")),React.createElement(T.EmptyStateFooter,null,React.createElement(T.EmptyStateActions,null,React.createElement(T.Stack,{hasGutter:!0},React.createElement(T.Button,{onClick:()=>n(-1)},t("Return to previous page")),React.createElement(T.Button,{component:i=>React.createElement(Xt.Link,{to:r,...i})},t("Return to dashboard"))))))}const LOe="";function w3(e){const{navigation:t}=e,n=Xh();return v.jsx(v.Fragment,{children:v.jsx(T.PageSidebar,{isSidebarOpen:n.isOpen,className:"bg-lighten",children:v.jsx(T.PageSidebarBody,{children:v.jsx(T.Nav,{"data-cy":"page-navigation",className:"side-nav",children:v.jsx(T.NavList,{children:v.jsx(Zh,{baseRoute:"",items:t})})})})})})}function Zh(e){return v.jsx(v.Fragment,{children:e.items.map((t,n)=>v.jsx(qxe,{item:t,baseRoute:e.baseRoute},n))})}function qxe(e){var c;const{item:t}=e,[n,r]=x.useState(()=>localStorage.getItem((t.id??t.label)+"-expanded")!=="false"),i=u=>{r(u),localStorage.setItem((t.id??t.label)+"-expanded",u?"true":"false")};let a;if("id"in e.item)a=e.item.id;else if("children"in e.item){const u=e.item.children.find(f=>f.path==="");u&&"id"in u&&(a=u.id)}const o=y3();let l=e.baseRoute+"/"+t.path;if(l=l.replace("//","/"),t.path==="/"&&"children"in t)return v.jsx(Zh,{items:t.children,baseRoute:""});const s="children"in t&&((c=t.children)==null?void 0:c.find(u=>u.label));if(!s&&"label"in t){const u=location.pathname.startsWith(l);return v.jsx(T.NavItem,{id:a,href:l,isActive:u,className:u?"bg-lighten":void 0,onClick:()=>o(l),"data-cy":a,children:t.label})}return!s||t.label===void 0?null:t.label?v.jsx(T.NavExpandable,{title:t.label,isActive:location.pathname.startsWith(l),isExpanded:n,onExpand:(u,f)=>i(f),children:v.jsx(Zh,{items:t.children,baseRoute:l})}):v.jsx(Zh,{items:t.children,baseRoute:l})}const C3=x.createContext({});function Yxe(){return x.useContext(C3)}function Kxe(e){const t=x.useMemo(()=>O3("",e.navigation),[e.navigation]);return v.jsx(C3.Provider,{value:t,children:e.children})}function O3(e,t){const n={};return t.forEach(r=>{const i=(e+"/"+r.path).replace("//","/");"id"in r&&typeof r.id=="string"&&(n[r.id]=i),"children"in r&&Object.assign(n,O3(i,r.children))}),n}function Xxe(e){const{navigation:t,basename:n,masthead:r}=e,i=x.useMemo(()=>[{path:"",element:v.jsx(b3,{children:v.jsx(Xt.Outlet,{})}),children:[{path:"login",element:e.login},{path:"",element:e.root??v.jsx(v.Fragment,{}),children:[{path:"",element:v.jsx(T.Page,{header:r,sidebar:v.jsx(w3,{navigation:t}),children:v.jsx(x3,{children:v.jsx(Xt.Outlet,{})})}),children:t}]},{path:"*",element:v.jsx(Gxe,{})}]}],[r,t,e.login,e.root]),a=x.useMemo(()=>Xt.createBrowserRouter(i,{basename:n}),[n,i]);return v.jsx(Kxe,{navigation:t,children:v.jsx(Xt.RouterProvider,{router:a})})}function Zxe(e){return e.replace(/^\//,"")}function T3(e,t){for(const n of e){if("id"in n&&n.id===t)return n;if("children"in n){const r=T3(n.children,t);if(r)return r}}}function E3(e,t){for(let n=0;n<e.length;n++){const r=e[n];if("id"in r&&r.id===t)return e.splice(n,1),r;if("children"in r){const i=E3(r.children,t);if(i)return i}}}function A3(e,t,n){for(const r of e)if("id"in r&&r.id===t){const i=r;"children"in r||(i.children=[]),i.children.push(n);return}else"children"in r&&A3(r.children,t,n)}function k3(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if("id"in i&&i.id===t){e.splice(r+1,0,n);return}else"children"in i&&k3(i.children,t,n)}}function P3(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if("id"in i&&i.id===t){e.splice(r,0,n);return}else"children"in i&&P3(i.children,t,n)}}function j3(){const e=Yxe();return x.useCallback((t,n)=>{let r=e[t]??"";const i=n==null?void 0:n.params,a=n==null?void 0:n.query;return r?(i&&(r=Object.keys(i).reduce((o,l)=>{let s=i[l];return s===void 0?o:(s=encodeURIComponent(s.toString()),o.replace(`:${l}`,s))},r)),a&&(r=`${r}?${Object.keys(a).map(o=>{let l=a[o];return l===void 0?"":(l=encodeURIComponent(l.toString()),`${o}=${l}`)}).join("&").replace("/&&/g","&")}`)):console.error(`Page id ${t} not found`),r},[e])}function Jxe(){const e=Xt.useNavigate(),t=j3();return(n,r)=>{const i=t(n,r);i&&e(i)}}function D3(e){const{loading:t}=e,[n,r]=x.useState((e==null?void 0:e.initialTabIndex)??0),i=x.useCallback((s,c)=>r(c),[r]),a=x.Children.toArray(e.children),o=a.map((s,c)=>{if(x.isValidElement(s)&&s.type===Rb){const u=s.props.label;return v.jsx(T.Tab,{title:u||v.jsx(T.Skeleton,{width:"60px"}),eventKey:c},u??c)}return s}),l=a[n];return t?v.jsx(D3,{children:v.jsx(Rb,{children:v.jsx(T.PageSection,{variant:"light",children:v.jsx(T.Skeleton,{})})})}):v.jsxs(v.Fragment,{children:[v.jsx(T.Tabs,{activeKey:n,onSelect:i,inset:{default:"insetSm"},isBox:!0,style:{backgroundColor:"var(--pf-v5-c-tabs__link--BackgroundColor)"},children:o}),l]})}function Rb(e){return v.jsx(v.Fragment,{children:e.children})}const $Oe="",M3=x.createContext({});function Fc(){return x.useContext(M3)}function Qxe(e){const[t,n]=x.useState(!1),[r,i]=x.useState(null),[a,o]=x.useState({}),[l,s]=x.useState(e.defaultValue??{}),[c,u]=x.useState({}),f=x.useMemo(()=>{function d(h,m){return h.hidden&&h.hidden(m)?null:h}return e.steps.filter(h=>d(h,a))},[e.steps,a]);return x.useEffect(()=>{!r&&f.length>0&&i(f[0])},[r,f]),v.jsx(M3.Provider,{value:{wizardData:a,setWizardData:o,stepData:l,setStepData:s,steps:f,activeStep:r,setActiveStep:i,stepError:c,setStepError:u,isToggleExpanded:t,setToggleExpanded:n},children:e.children})}function I3(e){const{t}=xt(),{activeStep:n,steps:r}=Fc(),i=(n==null?void 0:n.id)===r[r.length-1].id,a=t(i?"Finish":"Next"),o=(n==null?void 0:n.id)===r[0].id,l=o?"pf-v5-c-button pf-m-disabled":"pf-v5-c-button pf-m-secondary";return v.jsxs("footer",{className:"pf-v5-c-wizard__footer border-top bg-lighten","data-cy":"wizard-footer",children:[n!==null&&"inputs"in n?v.jsx($b,{style:{minWidth:10},children:a}):v.jsx("button",{"data-cy":"wizard-next",className:"pf-v5-c-button pf-m-primary",type:"submit",onClick:e.onNext,children:a}),v.jsx("button",{type:"button","data-cy":"wizard-back",className:l,disabled:o,onClick:e.onBack,children:t("Back")}),v.jsx("div",{"data-cy":"wizard-cancel",className:"pf-v5-c-wizard__footer-cancel",children:v.jsx("button",{className:"pf-v5-c-button pf-m-link",type:"button",onClick:e.onCancel,children:t("Cancel")})})]})}function e1e(e){const t=Xt.useNavigate(),{onSubmit:n,onCancel:r,errorAdapter:i}=e,{activeStep:a,steps:o,stepData:l,wizardData:s,setWizardData:c,setStepData:u,setActiveStep:f}=Fc(),d=x.useCallback(()=>{r?r():t(-1)},[t,r]),h=x.useCallback(p=>{if(a!==null){if((a==null?void 0:a.id)===o[o.length-1].id)return n(s);const _=o.findIndex(S=>S.id===(a==null?void 0:a.id)),b=o[_+1];c(S=>({...S,...p})),u(S=>({...S,[a==null?void 0:a.id]:p})),f(b)}return Promise.resolve()},[a,s,n,o,c,u,f]),m=x.useCallback(()=>{const p=o.findIndex(_=>_.id===(a==null?void 0:a.id)),y=o[p-1];f(y)},[a,o,f]);return v.jsx(v.Fragment,{children:a!==null&&("inputs"in a?v.jsxs(p3,{onSubmit:h,footer:v.jsx(I3,{onBack:m,onCancel:d}),defaultValue:l[a.id],errorAdapter:i,children:[v.jsx(t1e,{}),a.inputs]},a.id):v.jsxs("div",{"data-cy":`wizard-section-${a.id}`,style:{display:"flex",flexDirection:"column",height:"100%"},children:[v.jsx(T.PageSection,{variant:"light",isFilled:!0,hasOverflowScroll:!0,children:a==null?void 0:a.element}),v.jsx(I3,{onNext:()=>void h({}),onBack:m,onCancel:d})]}))})}function t1e(){const{activeStep:e,setStepError:t}=Fc(),{errors:n}=Uy(),r=JSON.stringify(n);return x.useEffect(()=>{Object.keys(n).length===0?t({}):e&&t({[e.id]:n})},[n,e,t,r]),null}function n1e(){const{activeStep:e,steps:t,isToggleExpanded:n,setActiveStep:r,stepError:i}=Fc(),a=n?"pf-v5-c-wizard__nav pf-m-expanded":"pf-v5-c-wizard__nav bg-lighten",o=l=>{const s=t[l];s&&r(s)};if(e)return v.jsx("nav",{className:a,"aria-label":"Steps","data-cy":"wizard-nav",children:v.jsx("ol",{className:"pf-v5-c-wizard__nav-list",children:t.map((l,s)=>{const c=t.findIndex(d=>d.id===e.id),u=s>c,f="pf-v5-c-wizard__nav-link"+(e.id===l.id?" pf-m-current":"")+(u?" pf-m-disabled":"");return v.jsx("li",{className:"pf-v5-c-wizard__nav-item","data-cy":`wizard-nav-item-${l.id}`,children:v.jsxs("button",{className:f,onClick:()=>o(s),disabled:u,children:[" ",l.label,i[l.id]&&e.id===l.id&&v.jsx("span",{style:{marginLeft:"8px"},children:v.jsx(Ae.ExclamationCircleIcon,{color:"#C9190B"})})]})},l.id)})})})}function r1e(){const{t:e}=xt(),{activeStep:t,isToggleExpanded:n,setToggleExpanded:r}=Fc(),i=x.useCallback(()=>r(a=>!a),[r]);return v.jsxs("button",{onClick:i,className:ae(ts.wizardToggle,n&&"pf-m-expanded"),"aria-label":e("Wizard toggle"),"aria-expanded":n,"data-cy":"wizard-toggle",children:[v.jsx("span",{className:ae(ts.wizardToggleList),children:v.jsxs("span",{className:ae(ts.wizardToggleListItem),children:[v.jsx("span",{className:ae(ts.wizardToggleNum),children:1})," ",t==null?void 0:t.label]})}),v.jsx("span",{className:ae(ts.wizardToggleIcon),children:v.jsx(Ae.CaretDownIcon,{"aria-hidden":"true"})})]})}function i1e(e){return v.jsx(Qxe,{steps:e.steps,defaultValue:e.defaultValue,children:v.jsxs("div",{className:"pf-v5-c-wizard","data-cy":"wizard",style:{display:"flex",flexDirection:"column",height:"100%",maxHeight:"100%",overflow:"hidden"},children:[v.jsx(r1e,{}),v.jsxs("div",{className:"pf-v5-c-wizard__outer-wrap",style:{display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[v.jsx(n1e,{}),v.jsx(e1e,{errorAdapter:e.errorAdapter,onCancel:e.onCancel,onSubmit:e.onSubmit})]})]})})}function a1e(){return v.jsx(T.PageSection,{isFilled:!0,variant:"light",children:v.jsx(T.Bullseye,{children:v.jsx(T.Spinner,{})})})}function o1e(e){return v.jsxs(x.Fragment,{children:[v.jsx(_3,{breadcrumbs:e.breadcrumbs?[{label:v.jsx(T.Skeleton,{width:"150px"})}]:void 0,title:v.jsx(T.Skeleton,{width:"200px"})}),e.tabs&&v.jsx(T.PageSection,{variant:"light",style:{paddingTop:8,paddingBottom:8},children:v.jsx(T.Skeleton,{width:"150px"})}),v.jsx(T.Divider,{}),v.jsx(a1e,{})]})}const l1e=vD`
526
+ `;function Fb(e,t){const n=_6({defaultValues:e??{}}),{handleSubmit:r,setError:i}=n,[a,o]=x.useState(null);return{form:n,handleSubmit:r,error:a,setError:o,handleSubmitError:s=>{const{genericErrors:c,fieldErrors:u}=t(s);c.length>0?o(c.map(f=>f.message)):o(null),u.length>0&&u.forEach(f=>{i(f.name,{message:typeof f.message=="string"?f.message:void 0})})},setFieldError:i}}function p3(e){const{errorAdapter:t=h3}=e,{form:n,handleSubmit:r,error:i,setError:a,handleSubmitError:o,setFieldError:l}=Fb(e.defaultValue,t),[s]=x.useContext(Ta),[c]=Ot(),u=ln("md"),f=e.isVertical?!1:s.formLayout==="horizontal";let d=e.children;return e.disableGrid!==!0&&(d=v.jsx(g3,{isVertical:e.isVertical,singleColumn:e.singleColumn,children:e.children})),v.jsx(e6,{...n,children:v.jsxs(T.Form,{onSubmit:r(async(h,m)=>{var y,_;a(null);let p=!1;m!==void 0&&((y=m==null?void 0:m.nativeEvent)!=null&&y.submitter)&&(p=((_=m.nativeEvent.submitter)==null?void 0:_.innerHTML)===e.additionalActionText);try{await e.onSubmit(h,b=>a(b),l,p?n:void 0)}catch(b){o(b)}}),isHorizontal:f,autoComplete:e.autoComplete,style:{display:"flex",flexDirection:"column",flexGrow:1,height:"100%",maxHeight:"100%",overflow:"hidden",gap:0},children:[i&&v.jsx(t3,{error:i,isMd:u,onCancel:e.onCancel}),v.jsx(Ji,{children:v.jsx(Bxe,{variant:"light",isFilled:!0,isWidthLimited:!0,padding:{default:e.disablePadding?"noPadding":"padding"},children:d})}),e.footer?e.footer:v.jsx(T.PageSection,{variant:"light",isFilled:!1,className:"bg-lighten border-top",children:v.jsxs(Wxe,{children:[v.jsx($b,{children:e.submitText}),e.additionalActionText?v.jsx(T.Button,{"aria-label":e.additionalActionText,type:"submit",variant:"secondary",children:e.additionalActionText}):null,e.onCancel&&v.jsx(m3,{onCancel:e.onCancel,children:e.cancelText??c.cancelText})]})})]})})}function g3(e){const[t]=x.useContext(Ta),n=e.isVertical?!1:t.formLayout==="horizontal",r=e.singleColumn?!1:t.formColumns==="multiple",i=12,a=r?n?12:6:12,o=r?6:12,l=r?6:12,s=r?4:12;return v.jsx(T.Grid,{hasGutter:!0,span:12,sm:i,md:a,lg:o,xl:l,xl2:s,children:e.children})}function Vxe(e){const{errorAdapter:t=h3}=e,{form:n,handleSubmit:r,error:i,setError:a,handleSubmitError:o,setFieldError:l}=Fb(e.defaultValue,t),[s]=x.useContext(Ta),c=ln("md"),u=e.isVertical?!1:s.formLayout==="horizontal";return v.jsx(e6,{...n,children:v.jsxs(T.Form,{onSubmit:r(async f=>{a(null);try{await e.onSubmit(f,d=>a(d),l,void 0)}catch(d){o(d)}}),isHorizontal:u,autoComplete:e.autoComplete,children:[i&&v.jsx(t3,{error:i,isMd:c,onCancel:e.onCancel}),e.children]})})}const IOe="",Nb=x.createContext({isOpen:!1,setState:()=>({})});function Xh(){return x.useContext(Nb)}function v3(e){const t=ln("xl"),[n,r]=x.useState(()=>t),i=x.useCallback(a=>{a.isOpen!==void 0&&r(a.isOpen)},[]);return x.useEffect(()=>i({isOpen:t}),[t,i]),v.jsx(Nb.Provider,{value:{isOpen:n,setState:i},children:e.children})}function y3(){const e=Xt.useNavigate(),t=ln("xl"),n=Xh();return x.useCallback(i=>{e(i),t||n.setState({isOpen:!n.isOpen})},[e,t,n])}function b3(e){return v.jsx(h5,{children:v.jsx(A5,{children:v.jsx(x5,{children:v.jsx(y5,{children:v.jsx(v3,{children:e.children})})})})})}function Hxe(e){const t=Xt.useNavigate();return e.breadcrumbs?v.jsx(T.Breadcrumb,{style:e.style,children:e.breadcrumbs.map((n,r)=>n.label?v.jsx(T.BreadcrumbItem,{"data-cy":n.label,id:n.id,component:n.component,isActive:n.to===void 0,children:n.to?v.jsx("a",{href:n.to,"data-cy":n.label,onClick:i=>{i.preventDefault(),n.to&&t(n.to)},children:n.label}):n.label},n.id??n.label??r):v.jsx(x.Fragment,{},r))}):v.jsx(x.Fragment,{})}function _3(e){const{breadcrumbs:t,title:n,description:r,controls:i,headerActions:a,footer:o}=e,l=ln("lg"),s=ln("xl"),c=ln("md"),[u]=Ot();return v.jsx(T.PageSection,{variant:T.PageSectionVariants.light,className:"bg-lighten border-bottom",style:{paddingTop:s?16:12,paddingBottom:s?16:12},children:v.jsxs(T.Stack,{hasGutter:!0,children:[v.jsxs(T.Flex,{flexWrap:{default:"nowrap"},alignItems:{default:"alignItemsStretch"},children:[v.jsxs(T.FlexItem,{grow:{default:"grow"},children:[t&&v.jsx(Hxe,{breadcrumbs:t,style:{paddingBottom:l?6:4}}),n?e.titleHelp?v.jsx(T.Popover,{headerContent:e.titleHelpTitle,bodyContent:v.jsxs(T.Stack,{hasGutter:!0,children:[typeof e.titleHelp=="string"?v.jsx(T.StackItem,{children:e.titleHelp}):e.titleHelp.map((f,d)=>v.jsx(T.StackItem,{children:f},d)),e.titleDocLink&&v.jsx(T.StackItem,{children:v.jsx(T.Button,{icon:v.jsx(Ae.ExternalLinkAltIcon,{}),variant:"link",onClick:()=>window.open(e.titleDocLink,"_blank"),isInline:!0,children:u.documentation})})]}),position:"bottom-start",children:v.jsxs(T.Title,{"data-cy":"page-title",headingLevel:"h1",children:[n,v.jsx(T.Button,{variant:"link",style:{padding:0,marginTop:1,marginLeft:8,verticalAlign:"top"},children:v.jsx(Ae.OutlinedQuestionCircleIcon,{})})]})}):v.jsx(T.Title,{"data-cy":"page-title",headingLevel:"h1",children:n}):v.jsx(T.Title,{headingLevel:"h1",children:v.jsx(T.Skeleton,{width:"160px"})}),c&&r&&v.jsx(T.Text,{"data-cy":"app-description",component:"p",style:{paddingTop:s?4:2,opacity:.8},children:typeof r=="string"?v.jsx(T.Truncate,{content:r}):v.jsx(T.Stack,{children:r.map(f=>v.jsx(T.StackItem,{children:f},f))})})]}),n&&(a||i)&&v.jsxs(T.Flex,{"data-cy":"manage-view",direction:{default:"column"},spaceItems:{default:"spaceItemsSm",xl:"spaceItemsMd"},justifyContent:{default:"justifyContentCenter"},children:[i&&v.jsx(T.FlexItem,{grow:{default:"grow"},children:i}),a&&v.jsx(T.FlexItem,{children:a})]})]}),o]})})}function x3(e){const[t]=Ot();return v.jsx(b5,{message:t.errorText,children:v.jsx("div",{style:{display:"flex",flexDirection:"column",height:"100%",maxHeight:"100%",backgroundColor:"var(--pf-v5-global--BackgroundColor--100)"},children:e.children})})}function Uxe(e){const t=ln("sm"),n=ln("md");return v.jsxs(T.Masthead,{display:{default:"inline"},style:{borderBottom:"1px solid #fff4",paddingRight:0},children:[v.jsx(S3,{}),t&&v.jsx(T.MastheadMain,{children:v.jsx(T.MastheadBrand,{component:"a",children:e.icon})}),v.jsx(T.MastheadContent,{style:{marginLeft:0,minHeight:0},children:v.jsx(T.Toolbar,{id:"toolbar","data-cy":"toolbar",inset:{default:"insetNone"},style:{padding:0},children:v.jsxs(T.ToolbarContent,{children:[n&&v.jsx(T.ToolbarItem,{children:v.jsxs(T.Stack,{style:{color:"white",cursor:"default",marginTop:-2,marginBottom:-2},children:[e.brand&&v.jsx(T.Text,{style:{marginTop:-6},children:v.jsx(T.Truncate,{content:e.brand,style:{minWidth:0}})}),v.jsx(T.Title,{headingLevel:"h1",style:{lineHeight:1},children:v.jsx(T.Truncate,{content:e.title,style:{minWidth:0}})})]})}),e.children]})})})]})}function S3(){const e=Xh();return v.jsx(T.MastheadToggle,{onClick:()=>e.setState({isOpen:!e.isOpen}),children:v.jsx(T.PageToggleButton,{"data-cy":"nav-toggle",variant:"plain","aria-label":"Global navigation",children:v.jsx(Ae.BarsIcon,{})})})}function Gxe(e){const{t}=xt(),n=Xt.useNavigate(),{dashboardUrl:r}=e;return React.createElement(T.EmptyState,{isFullHeight:!0},React.createElement(T.EmptyStateHeader,{titleText:React.createElement(React.Fragment,null,t("Page not found")),icon:React.createElement(T.EmptyStateIcon,{icon:Ae.ExclamationCircleIcon}),headingLevel:"h2"}),React.createElement(T.EmptyStateBody,null,t("We could not find that page.")),React.createElement(T.EmptyStateFooter,null,React.createElement(T.EmptyStateActions,null,React.createElement(T.Stack,{hasGutter:!0},React.createElement(T.Button,{onClick:()=>n(-1)},t("Return to previous page")),React.createElement(T.Button,{component:i=>React.createElement(Xt.Link,{to:r,...i})},t("Return to dashboard"))))))}const LOe="";function w3(e){const{navigation:t}=e,n=Xh();return v.jsx(v.Fragment,{children:v.jsx(T.PageSidebar,{isSidebarOpen:n.isOpen,className:"bg-lighten",children:v.jsx(T.PageSidebarBody,{children:v.jsx(T.Nav,{"data-cy":"page-navigation",className:"side-nav",children:v.jsx(T.NavList,{children:v.jsx(Zh,{baseRoute:"",items:t})})})})})})}function Zh(e){return v.jsx(v.Fragment,{children:e.items.map((t,n)=>v.jsx(qxe,{item:t,baseRoute:e.baseRoute},n))})}function qxe(e){var c;const{item:t}=e,[n,r]=x.useState(()=>localStorage.getItem((t.id??t.label)+"-expanded")!=="false"),i=u=>{r(u),localStorage.setItem((t.id??t.label)+"-expanded",u?"true":"false")};let a;if("id"in e.item)a=e.item.id;else if("children"in e.item){const u=e.item.children.find(f=>f.path==="");u&&"id"in u&&(a=u.id)}const o=y3();let l=e.baseRoute+"/"+t.path;if(l=l.replace("//","/"),t.path==="/"&&"children"in t)return v.jsx(Zh,{items:t.children,baseRoute:""});const s="children"in t&&((c=t.children)==null?void 0:c.find(u=>u.label));if(!s&&"label"in t){const u=location.pathname.startsWith(l);return v.jsx(T.NavItem,{id:a,href:l,isActive:u,className:u?"bg-lighten":void 0,onClick:()=>o(l),"data-cy":a,children:t.label})}return!s||t.label===void 0?null:t.label?v.jsx(T.NavExpandable,{title:t.label,isActive:location.pathname.startsWith(l),isExpanded:n,onExpand:(u,f)=>i(f),children:v.jsx(Zh,{items:t.children,baseRoute:l})}):v.jsx(Zh,{items:t.children,baseRoute:l})}const C3=x.createContext({});function Yxe(){return x.useContext(C3)}function Kxe(e){const t=x.useMemo(()=>O3("",e.navigation),[e.navigation]);return v.jsx(C3.Provider,{value:t,children:e.children})}function O3(e,t){const n={};return t.forEach(r=>{const i=(e+"/"+r.path).replace("//","/");"id"in r&&typeof r.id=="string"&&(n[r.id]=i),"children"in r&&Object.assign(n,O3(i,r.children))}),n}function Xxe(e){const{navigation:t,basename:n,masthead:r}=e,i=x.useMemo(()=>[{path:"",element:v.jsx(b3,{children:v.jsx(Xt.Outlet,{})}),children:[{path:"login",element:e.login},{path:"",element:e.root??v.jsx(v.Fragment,{}),children:[{path:"",element:v.jsx(T.Page,{header:r,sidebar:v.jsx(w3,{navigation:t}),children:v.jsx(x3,{children:v.jsx(Xt.Outlet,{})})}),children:t}]},{path:"*",element:v.jsx(Gxe,{})}]}],[r,t,e.login,e.root]),a=x.useMemo(()=>Xt.createBrowserRouter(i,{basename:n}),[n,i]);return v.jsx(Kxe,{navigation:t,children:v.jsx(Xt.RouterProvider,{router:a})})}function Zxe(e){return e.replace(/^\//,"")}function T3(e,t){for(const n of e){if("id"in n&&n.id===t)return n;if("children"in n){const r=T3(n.children,t);if(r)return r}}}function E3(e,t){for(let n=0;n<e.length;n++){const r=e[n];if("id"in r&&r.id===t)return e.splice(n,1),r;if("children"in r){const i=E3(r.children,t);if(i)return i}}}function A3(e,t,n){for(const r of e)if("id"in r&&r.id===t){const i=r;"children"in r||(i.children=[]),i.children.push(n);return}else"children"in r&&A3(r.children,t,n)}function k3(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if("id"in i&&i.id===t){e.splice(r+1,0,n);return}else"children"in i&&k3(i.children,t,n)}}function P3(e,t,n){for(let r=0;r<e.length;r++){const i=e[r];if("id"in i&&i.id===t){e.splice(r,0,n);return}else"children"in i&&P3(i.children,t,n)}}function j3(){const e=Yxe();return x.useCallback((t,n)=>{let r=e[t]??"";const i=n==null?void 0:n.params,a=n==null?void 0:n.query;return r?(i&&(r=Object.keys(i).reduce((o,l)=>{let s=i[l];return s===void 0?o:(s=encodeURIComponent(s.toString()),o.replace(`:${l}`,s))},r)),a&&(r=`${r}?${Object.keys(a).map(o=>{let l=a[o];return l===void 0?"":(l=encodeURIComponent(l.toString()),`${o}=${l}`)}).join("&").replace("/&&/g","&")}`)):console.error(`Page id ${t} not found`),r},[e])}function Jxe(){const e=Xt.useNavigate(),t=j3();return(n,r)=>{const i=t(n,r);i&&e(i)}}function D3(e){const{loading:t}=e,[n,r]=x.useState((e==null?void 0:e.initialTabIndex)??0),i=x.useCallback((s,c)=>r(c),[r]),a=x.Children.toArray(e.children),o=a.map((s,c)=>{if(x.isValidElement(s)&&s.type===Rb){const u=s.props.label;return v.jsx(T.Tab,{title:u||v.jsx(T.Skeleton,{width:"60px"}),eventKey:c},u??c)}return s}),l=a[n];return t?v.jsx(D3,{children:v.jsx(Rb,{children:v.jsx(T.PageSection,{variant:"light",children:v.jsx(T.Skeleton,{})})})}):v.jsxs(v.Fragment,{children:[v.jsx(T.Tabs,{activeKey:n,onSelect:i,inset:{default:"insetSm"},isBox:!0,style:{backgroundColor:"var(--pf-v5-c-tabs__link--BackgroundColor)"},children:o}),l]})}function Rb(e){return v.jsx(v.Fragment,{children:e.children})}const $Oe="",M3=x.createContext({});function Fc(){return x.useContext(M3)}function Qxe(e){const[t,n]=x.useState(!1),[r,i]=x.useState(null),[a,o]=x.useState({}),[l,s]=x.useState(e.defaultValue??{}),[c,u]=x.useState({}),f=x.useMemo(()=>{function d(h,m){return h.hidden&&h.hidden(m)?null:h}return e.steps.filter(h=>d(h,a))},[e.steps,a]);return x.useEffect(()=>{!r&&f.length>0&&i(f[0])},[r,f]),v.jsx(M3.Provider,{value:{wizardData:a,setWizardData:o,stepData:l,setStepData:s,steps:f,activeStep:r,setActiveStep:i,stepError:c,setStepError:u,isToggleExpanded:t,setToggleExpanded:n},children:e.children})}function I3(e){const{t}=xt(),{activeStep:n,steps:r}=Fc(),i=(n==null?void 0:n.id)===r[r.length-1].id,a=t(i?"Finish":"Next"),o=(n==null?void 0:n.id)===r[0].id,l=o?"pf-v5-c-button pf-m-disabled":"pf-v5-c-button pf-m-secondary";return v.jsxs("footer",{className:"pf-v5-c-wizard__footer border-top bg-lighten","data-cy":"wizard-footer",children:[n!==null&&"inputs"in n?v.jsx($b,{style:{minWidth:10},children:a}):v.jsx("button",{"data-cy":"wizard-next",className:"pf-v5-c-button pf-m-primary",type:"submit",onClick:e.onNext,children:a}),v.jsx("button",{type:"button","data-cy":"wizard-back",className:l,disabled:o,onClick:e.onBack,children:t("Back")}),v.jsx("div",{"data-cy":"wizard-cancel",className:"pf-v5-c-wizard__footer-cancel",children:v.jsx("button",{className:"pf-v5-c-button pf-m-link",type:"button",onClick:e.onCancel,children:t("Cancel")})})]})}function e1e(e){const t=Xt.useNavigate(),{onSubmit:n,onCancel:r,errorAdapter:i}=e,{activeStep:a,steps:o,stepData:l,wizardData:s,setWizardData:c,setStepData:u,setActiveStep:f}=Fc(),d=x.useCallback(()=>{r?r():t(-1)},[t,r]),h=x.useCallback(p=>{if(a!==null){if((a==null?void 0:a.id)===o[o.length-1].id)return n(s);const _=o.findIndex(S=>S.id===(a==null?void 0:a.id)),b=o[_+1];c(S=>({...S,...p})),u(S=>({...S,[a==null?void 0:a.id]:p})),f(b)}return Promise.resolve()},[a,s,n,o,c,u,f]),m=x.useCallback(()=>{const p=o.findIndex(_=>_.id===(a==null?void 0:a.id)),y=o[p-1];f(y)},[a,o,f]);return v.jsx(v.Fragment,{children:a!==null&&("inputs"in a?v.jsxs(p3,{onSubmit:h,footer:v.jsx(I3,{onBack:m,onCancel:d}),defaultValue:l[a.id],errorAdapter:i,children:[v.jsx(t1e,{}),a.inputs]},a.id):v.jsxs("div",{"data-cy":`wizard-section-${a.id}`,style:{display:"flex",flexDirection:"column",height:"100%"},children:[v.jsx(T.PageSection,{variant:"light",isFilled:!0,hasOverflowScroll:!0,children:a==null?void 0:a.element}),v.jsx(I3,{onNext:()=>void h({}),onBack:m,onCancel:d})]}))})}function t1e(){const{activeStep:e,setStepError:t}=Fc(),{errors:n}=Uy(),r=JSON.stringify(n);return x.useEffect(()=>{Object.keys(n).length===0?t({}):e&&t({[e.id]:n})},[n,e,t,r]),null}function n1e(){const{activeStep:e,steps:t,isToggleExpanded:n,setActiveStep:r,stepError:i}=Fc(),a=n?"pf-v5-c-wizard__nav pf-m-expanded":"pf-v5-c-wizard__nav bg-lighten",o=l=>{const s=t[l];s&&r(s)};if(e)return v.jsx("nav",{className:a,"aria-label":"Steps","data-cy":"wizard-nav",children:v.jsx("ol",{className:"pf-v5-c-wizard__nav-list",children:t.map((l,s)=>{const c=t.findIndex(d=>d.id===e.id),u=s>c,f="pf-v5-c-wizard__nav-link"+(e.id===l.id?" pf-m-current":"")+(u?" pf-m-disabled":"");return v.jsx("li",{className:"pf-v5-c-wizard__nav-item","data-cy":`wizard-nav-item-${l.id}`,children:v.jsxs("button",{className:f,onClick:()=>o(s),disabled:u,children:[" ",l.label,i[l.id]&&e.id===l.id&&v.jsx("span",{style:{marginLeft:"8px"},children:v.jsx(Ae.ExclamationCircleIcon,{color:"#C9190B"})})]})},l.id)})})})}function r1e(){const{t:e}=xt(),{activeStep:t,isToggleExpanded:n,setToggleExpanded:r}=Fc(),i=x.useCallback(()=>r(a=>!a),[r]);return v.jsxs("button",{onClick:i,className:ae(ts.wizardToggle,n&&"pf-m-expanded"),"aria-label":e("Wizard toggle"),"aria-expanded":n,"data-cy":"wizard-toggle",children:[v.jsx("span",{className:ae(ts.wizardToggleList),children:v.jsxs("span",{className:ae(ts.wizardToggleListItem),children:[v.jsx("span",{className:ae(ts.wizardToggleNum),children:1})," ",t==null?void 0:t.label]})}),v.jsx("span",{className:ae(ts.wizardToggleIcon),children:v.jsx(Ae.CaretDownIcon,{"aria-hidden":"true"})})]})}function i1e(e){return v.jsx(Qxe,{steps:e.steps,defaultValue:e.defaultValue,children:v.jsxs("div",{className:"pf-v5-c-wizard","data-cy":"wizard",style:{display:"flex",flexDirection:"column",height:"100%",maxHeight:"100%",overflow:"hidden"},children:[v.jsx(r1e,{}),v.jsxs("div",{className:"pf-v5-c-wizard__outer-wrap",style:{display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[v.jsx(n1e,{}),v.jsx(e1e,{errorAdapter:e.errorAdapter,onCancel:e.onCancel,onSubmit:e.onSubmit})]})]})})}function a1e(){return v.jsx(T.PageSection,{isFilled:!0,variant:"light",children:v.jsx(T.Bullseye,{children:v.jsx(T.Spinner,{})})})}function o1e(e){return v.jsxs(x.Fragment,{children:[v.jsx(_3,{breadcrumbs:e.breadcrumbs?[{label:v.jsx(T.Skeleton,{width:"150px"})}]:void 0,title:v.jsx(T.Skeleton,{width:"200px"})}),e.tabs&&v.jsx(T.PageSection,{variant:"light",style:{paddingTop:8,paddingBottom:8},children:v.jsx(T.Skeleton,{width:"150px"})}),v.jsx(T.Divider,{}),v.jsx(a1e,{})]})}const l1e=vD`
527
527
  from {
528
528
  transform: rotate(0);
529
529
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ansible/ansible-ui-framework",
3
3
  "description": "A framework for building applications using PatternFly.",
4
- "version": "2.4.620",
4
+ "version": "2.4.621",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",