@ansible/ansible-ui-framework 2.4.431 → 2.4.433
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function useGetPageUrl(): (id: string, options?: {
|
|
2
|
-
params?: Record<string, string | number>;
|
|
3
|
-
query?: Record<string, string | number>;
|
|
2
|
+
params?: Record<string, string | number | undefined>;
|
|
3
|
+
query?: Record<string, string | number | undefined>;
|
|
4
4
|
}) => string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function usePageNavigate(): (pageId: string, options?: {
|
|
2
|
-
params?: Record<string, string | number>;
|
|
3
|
-
query?: Record<string, string | number>;
|
|
2
|
+
params?: Record<string, string | number | undefined>;
|
|
3
|
+
query?: Record<string, string | number | undefined>;
|
|
4
4
|
}) => void;
|
package/index.js
CHANGED
|
@@ -43849,10 +43849,7 @@ function eAe() {
|
|
|
43849
43849
|
return (t, n) => {
|
|
43850
43850
|
let r = e[t] ?? "";
|
|
43851
43851
|
const a = n == null ? void 0 : n.params, i = n == null ? void 0 : n.query;
|
|
43852
|
-
return r ? (a && (r = Object.keys(a).reduce(
|
|
43853
|
-
(o, l) => o.replace(`:${l}`, (a[l] ?? "").toString()),
|
|
43854
|
-
r
|
|
43855
|
-
)), i && (r = `${r}?${Object.keys(i).map((o) => `${o}=${i[o]}`).join("&")}`)) : console.error(`Page id ${t} not found`), r;
|
|
43852
|
+
return r ? (a && (r = Object.keys(a).reduce((o, l) => a[l] === void 0 ? o : o.replace(`:${l}`, (a[l] ?? "").toString()), r)), i && (r = `${r}?${Object.keys(i).map((o) => i[o] === void 0 ? "" : `${o}=${i[o]}`).join("&").replace("/&&/g", "&")}`)) : console.error(`Page id ${t} not found`), r;
|
|
43856
43853
|
};
|
|
43857
43854
|
}
|
|
43858
43855
|
function eTe() {
|
package/index.umd.cjs
CHANGED
|
@@ -533,7 +533,7 @@ ${o}${y}`}else g=`${p}${s}${h.join(" ")}${s}${y}`;return e&&(g+=Ia(g,o,u(e)),a&&
|
|
|
533
533
|
flex-grow: 1;
|
|
534
534
|
`,Dxe=Me(C.Toolbar)`
|
|
535
535
|
padding: 0px;
|
|
536
|
-
`;function Ixe(e){return v.jsxs(C.Masthead,{children:[v.jsx(dP,{}),v.jsx(C.MastheadMain,{children:v.jsx(C.Title,{headingLevel:"h1",style:{fontWeight:"bold",lineHeight:1.2},children:e.title})}),v.jsx(Dxe,{id:"toolbar",children:v.jsxs(C.ToolbarContent,{children:[v.jsx(Mxe,{}),x.Children.toArray(e.children).map((t,n)=>v.jsx(C.ToolbarItem,{children:t},n))]})})]})}function dP(){const e=Js();return v.jsx(C.MastheadToggle,{onClick:()=>e.setState({isOpen:!e.isOpen}),children:v.jsx(C.PageToggleButton,{variant:"plain","aria-label":"Global navigation",children:v.jsx(Ce.BarsIcon,{})})})}function $xe(e){const{t}=yt(),n=Rt.useNavigate(),{dashboardUrl:r}=e;return React.createElement(C.Page,null,React.createElement(C.EmptyState,{variant:C.EmptyStateVariant.small,style:{paddingTop:48}},React.createElement(C.EmptyStateIcon,{icon:Ce.ExclamationCircleIcon}),React.createElement(C.Title,{headingLevel:"h2",size:"lg"},t("We could not find that page")),React.createElement(C.EmptyStateSecondaryActions,null,React.createElement(C.Stack,{hasGutter:!0},React.createElement(C.Button,{onClick:()=>n(-1)},t("Return to previous page")),React.createElement(C.Button,{component:i=>React.createElement(Rt.Link,{to:r,...i})},t("Return to dashboard"))))))}function hP(e){const{navigation:t}=e,n=Js();return v.jsx(C.PageSidebar,{isNavOpen:n.isOpen,nav:v.jsx(C.Nav,{children:v.jsx(C.NavList,{children:v.jsx(Jd,{baseRoute:"",items:t})})})})}function Jd(e){return v.jsx(v.Fragment,{children:e.items.map((t,n)=>v.jsx(Lxe,{item:t,baseRoute:e.baseRoute},n))})}function Lxe(e){let t;if("id"in e.item)t=e.item.id;else if("children"in e.item){const a=e.item.children.find(o=>o.path==="");a&&"id"in a&&(t=a.id)}const n=uP(),{item:r}=e;let i=e.baseRoute+"/"+r.path;return i=i.replace("//","/"),r.path==="/"&&"children"in r?v.jsx(Jd,{items:r.children,baseRoute:""}):"children"in r&&r.children.find(a=>a.label!==void 0)!==void 0?r.label===void 0?v.jsx(v.Fragment,{}):r.label===""?v.jsx(Jd,{items:r.children,baseRoute:i}):v.jsx(C.NavExpandable,{title:r.label,isActive:location.pathname.startsWith(i),isExpanded:!0,children:v.jsx(Jd,{items:r.children,baseRoute:i})}):"label"in r?v.jsx(C.NavItem,{id:t,isActive:location.pathname.startsWith(i),onClick:()=>n(i),"data-cy":t,children:r.label}):v.jsx(v.Fragment,{})}const mP=x.createContext({});function Fxe(){return x.useContext(mP)}function Nxe(e){const t=x.useMemo(()=>gP("",e.navigation),[e.navigation]);return v.jsx(mP.Provider,{value:t,children:e.children})}function gP(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,gP(i,r.children))}),n}function Bxe(e){const{navigation:t,basename:n,header:r}=e,i=x.useMemo(()=>[{path:"",element:v.jsx(cP,{children:v.jsx(Rt.Outlet,{})}),children:[{path:"login",element:e.login},{path:"",element:e.root??v.jsx(v.Fragment,{}),children:[{path:"",element:v.jsx(C.Page,{header:r,sidebar:v.jsx(hP,{navigation:t}),children:v.jsx(fP,{children:v.jsx(Rt.Outlet,{})})}),children:t}]},{path:"*",element:v.jsx($xe,{})}]}],[r,t,e.login,e.root]),a=x.useMemo(()=>Rt.createBrowserRouter(i,{basename:n}),[n,i]);return v.jsx(Nxe,{navigation:t,children:v.jsx(Rt.RouterProvider,{router:a})})}function Rxe(e){return e.replace(/^\//,"")}function pP(e,t){for(const n of e){if("id"in n&&n.id===t)return n;if("children"in n){const r=pP(n.children,t);if(r)return r}}}function vP(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=vP(r.children,t);if(i)return i}}}function yP(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&&yP(r.children,t,n)}function bP(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&&bP(i.children,t,n)}}function _P(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&&_P(i.children,t,n)}}function xP(){const e=Fxe();return(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)=>o.replace(`:${l}`,(i[l]??"").toString()),r)),a&&(r=`${r}?${Object.keys(a).map(o
|
|
536
|
+
`;function Ixe(e){return v.jsxs(C.Masthead,{children:[v.jsx(dP,{}),v.jsx(C.MastheadMain,{children:v.jsx(C.Title,{headingLevel:"h1",style:{fontWeight:"bold",lineHeight:1.2},children:e.title})}),v.jsx(Dxe,{id:"toolbar",children:v.jsxs(C.ToolbarContent,{children:[v.jsx(Mxe,{}),x.Children.toArray(e.children).map((t,n)=>v.jsx(C.ToolbarItem,{children:t},n))]})})]})}function dP(){const e=Js();return v.jsx(C.MastheadToggle,{onClick:()=>e.setState({isOpen:!e.isOpen}),children:v.jsx(C.PageToggleButton,{variant:"plain","aria-label":"Global navigation",children:v.jsx(Ce.BarsIcon,{})})})}function $xe(e){const{t}=yt(),n=Rt.useNavigate(),{dashboardUrl:r}=e;return React.createElement(C.Page,null,React.createElement(C.EmptyState,{variant:C.EmptyStateVariant.small,style:{paddingTop:48}},React.createElement(C.EmptyStateIcon,{icon:Ce.ExclamationCircleIcon}),React.createElement(C.Title,{headingLevel:"h2",size:"lg"},t("We could not find that page")),React.createElement(C.EmptyStateSecondaryActions,null,React.createElement(C.Stack,{hasGutter:!0},React.createElement(C.Button,{onClick:()=>n(-1)},t("Return to previous page")),React.createElement(C.Button,{component:i=>React.createElement(Rt.Link,{to:r,...i})},t("Return to dashboard"))))))}function hP(e){const{navigation:t}=e,n=Js();return v.jsx(C.PageSidebar,{isNavOpen:n.isOpen,nav:v.jsx(C.Nav,{children:v.jsx(C.NavList,{children:v.jsx(Jd,{baseRoute:"",items:t})})})})}function Jd(e){return v.jsx(v.Fragment,{children:e.items.map((t,n)=>v.jsx(Lxe,{item:t,baseRoute:e.baseRoute},n))})}function Lxe(e){let t;if("id"in e.item)t=e.item.id;else if("children"in e.item){const a=e.item.children.find(o=>o.path==="");a&&"id"in a&&(t=a.id)}const n=uP(),{item:r}=e;let i=e.baseRoute+"/"+r.path;return i=i.replace("//","/"),r.path==="/"&&"children"in r?v.jsx(Jd,{items:r.children,baseRoute:""}):"children"in r&&r.children.find(a=>a.label!==void 0)!==void 0?r.label===void 0?v.jsx(v.Fragment,{}):r.label===""?v.jsx(Jd,{items:r.children,baseRoute:i}):v.jsx(C.NavExpandable,{title:r.label,isActive:location.pathname.startsWith(i),isExpanded:!0,children:v.jsx(Jd,{items:r.children,baseRoute:i})}):"label"in r?v.jsx(C.NavItem,{id:t,isActive:location.pathname.startsWith(i),onClick:()=>n(i),"data-cy":t,children:r.label}):v.jsx(v.Fragment,{})}const mP=x.createContext({});function Fxe(){return x.useContext(mP)}function Nxe(e){const t=x.useMemo(()=>gP("",e.navigation),[e.navigation]);return v.jsx(mP.Provider,{value:t,children:e.children})}function gP(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,gP(i,r.children))}),n}function Bxe(e){const{navigation:t,basename:n,header:r}=e,i=x.useMemo(()=>[{path:"",element:v.jsx(cP,{children:v.jsx(Rt.Outlet,{})}),children:[{path:"login",element:e.login},{path:"",element:e.root??v.jsx(v.Fragment,{}),children:[{path:"",element:v.jsx(C.Page,{header:r,sidebar:v.jsx(hP,{navigation:t}),children:v.jsx(fP,{children:v.jsx(Rt.Outlet,{})})}),children:t}]},{path:"*",element:v.jsx($xe,{})}]}],[r,t,e.login,e.root]),a=x.useMemo(()=>Rt.createBrowserRouter(i,{basename:n}),[n,i]);return v.jsx(Nxe,{navigation:t,children:v.jsx(Rt.RouterProvider,{router:a})})}function Rxe(e){return e.replace(/^\//,"")}function pP(e,t){for(const n of e){if("id"in n&&n.id===t)return n;if("children"in n){const r=pP(n.children,t);if(r)return r}}}function vP(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=vP(r.children,t);if(i)return i}}}function yP(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&&yP(r.children,t,n)}function bP(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&&bP(i.children,t,n)}}function _P(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&&_P(i.children,t,n)}}function xP(){const e=Fxe();return(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)=>i[l]===void 0?o:o.replace(`:${l}`,(i[l]??"").toString()),r)),a&&(r=`${r}?${Object.keys(a).map(o=>a[o]===void 0?"":`${o}=${a[o]}`).join("&").replace("/&&/g","&")}`)):console.error(`Page id ${t} not found`),r}}function Wxe(){const e=Rt.useNavigate(),t=xP();return(n,r)=>{const i=t(n,r);i&&e(i)}}function SP(e){const{loading:t}=e,[n,r]=x.useState((e==null?void 0:e.initialTabIndex)??0),i=x.useCallback((s,u)=>r(u),[r]),a=x.Children.toArray(e.children),o=a.map((s,u)=>{if(x.isValidElement(s)&&s.type===Py){const c=s.props.label;return v.jsx(C.Tab,{title:c||v.jsx(C.Skeleton,{width:"60px"}),eventKey:u},c??u)}return s}),l=a[n];return t?v.jsx(SP,{children:v.jsx(Py,{children:v.jsx(C.PageSection,{variant:"light",children:v.jsx(C.Skeleton,{})})})}):v.jsxs(v.Fragment,{children:[v.jsx(C.PageSection,{type:C.PageSectionTypes.tabs,className:"border-bottom",children:v.jsxs(C.Flex,{spaceItems:{default:"spaceItemsNone"},children:[e.preComponents&&v.jsxs(v.Fragment,{children:[v.jsx(C.FlexItem,{children:e.preComponents}),v.jsx(C.Divider,{orientation:{default:"vertical"},component:"div"})]}),v.jsx(C.FlexItem,{grow:{default:"grow"},children:v.jsx(C.Tabs,{activeKey:n,onSelect:i,inset:e.preComponents?void 0:{default:"insetNone",sm:"insetNone",md:"insetNone",lg:"insetNone",xl:"insetSm","2xl":"insetSm"},hasBorderBottom:!1,children:o})}),e.postComponents&&v.jsxs(v.Fragment,{children:[v.jsx(C.Divider,{orientation:{default:"vertical"}}),v.jsx(C.FlexItem,{style:{paddingRight:16},children:e.postComponents})]})]})}),l]})}function Py(e){return v.jsx(v.Fragment,{children:e.children})}function zxe(e){const{activeKey:t,setActiveKey:n}=e,r=x.useCallback((i,a)=>n(a),[n]);return v.jsx(C.PageSection,{type:C.PageSectionTypes.tabs,style:{flexGrow:1},children:v.jsx(C.Tabs,{activeKey:t,onSelect:r,inset:{default:"insetNone",sm:"insetNone",md:"insetNone",lg:"insetNone",xl:"insetSm","2xl":"insetSm"},children:e.children})})}const Vxe=z3`
|
|
537
537
|
from {
|
|
538
538
|
transform: rotate(0);
|
|
539
539
|
}
|