@nexusui/components
Version:
These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.
2 lines (1 loc) • 3.17 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@mui/material/Box"),r=require("@mui/material/Button"),a=require("@mui/material/Grid2"),i=require("@mui/material/Link"),l=require("@mui/material/Popover"),o=require("@mui/material/Stack"),s=require("@mui/material/Tooltip"),n=require("@mui/material/Typography"),u=require("@mui/icons-material/ArrowForward"),c=require("@mui/icons-material/FolderOpenOutlined"),d=require("@mui/material/CircularProgress"),m=require("./AppSwitcher.styles.js"),p=require("../locales/index.js"),x=require("./locale.json.js"),f=require("./NexusX.svg.js"),h=require("../util/functions/index.js");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=j(t),y=j(r),b=j(a),q=j(i),k=j(l),v=j(o),w=j(s),S=j(n),C=j(u),P=j(c),N=j(d);const $="NexusAppSwitcher",A=t=>{const{name:r,target:a,url:i,logoSrc:l,"data-testid":o}=t,s=void 0===l||"string"==typeof l,n=e.jsx(g.default,{sx:m.styles.logo,children:s?e.jsx(g.default,{loading:"lazy",sx:m.styles.img,component:"img",src:l}):l});return e.jsx(w.default,{title:e.jsx("div",{translate:"no",children:r}),children:e.jsxs(q.default,{underline:"none",sx:m.styles.item,onClick:e=>{e.preventDefault(),h.openLink(i,a)},href:i,target:a,"data-testid":o||"AppSwitcher-appItem",children:[n,e.jsx(S.default,{variant:"caption",sx:m.styles.title,translate:"no",children:r})]})})},I=({children:t})=>e.jsx(v.default,{alignItems:"center",justifyContent:"center",sx:{height:40,width:40,borderRadius:3,backgroundColor:"common.black"},children:t});exports.AppItem=A,exports.default=({solutions:t,moreProductsUrl:r,myProjectsUrl:a="https://nexus.hexagon.com/platform/",homeUrl:i="https://nexus.hexagon.com/home/",loading:l=!1,...o})=>{const s=p.useTranslate(x.default),n=[{name:s("Home"),logoSrc:e.jsx(I,{children:e.jsx("img",{src:f.default,height:22,width:"auto",style:{display:"block"},alt:"Nexus X icon"})}),url:i,target:"_blank"},{name:s("My Projects"),logoSrc:e.jsx(I,{children:e.jsx(P.default,{sx:{fontSize:24,color:"common.white"}})}),url:a,target:"_blank"}];return e.jsxs(k.default,{anchorOrigin:{vertical:"bottom",horizontal:"left"},...o,children:[e.jsxs(g.default,{className:`${$}-root`,sx:m.styles.solutions,children:[e.jsx(b.default,{container:!0,rowSpacing:6,columnSpacing:4,role:"menu","aria-label":"App switcher",children:n.concat(t).map(((t,r)=>e.jsx(b.default,{size:4,className:`${$}-appItem`,role:"menuitem",children:e.jsx(A,{...t})},r)))}),e.jsx(v.default,{sx:m.styles.more,direction:"row",justifyContent:"left",children:e.jsx(y.default,{size:"small",component:q.default,onClick:e=>{e.preventDefault(),h.openLink(r)},href:r,target:"_blank",rel:"noopener noreferrer",variant:"text",color:"primary",endIcon:e.jsx(C.default,{}),"data-testid":`${$}-more`,className:`${$}-more`,"aria-label":s("More Products"),children:s("More Products")})})]}),l&&e.jsx(v.default,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,bgcolor:e=>`rgba(${e.vars.palette.background.paperChannel} / 0.75)`},alignItems:"center",justifyContent:"center","data-testid":`${$}-loading`,className:`${$}-loading`,children:e.jsx(N.default,{})})]})};