UNPKG

@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) 2.72 kB
import{jsx as r,jsxs as t}from"react/jsx-runtime";import e from"@mui/material/Box";import o from"@mui/material/Button";import i from"@mui/material/Grid2";import a from"@mui/material/Link";import n from"@mui/material/Popover";import l from"@mui/material/Stack";import m from"@mui/material/Tooltip";import s from"@mui/material/Typography";import c from"@mui/icons-material/ArrowForward";import p from"@mui/icons-material/FolderOpenOutlined";import d from"@mui/material/CircularProgress";import{styles as u}from"./AppSwitcher.styles.js";import{useTranslate as h}from"../locales/index.js";import g from"./locale.json.js";import f from"./NexusX.svg.js";import{openLink as x}from"../util/functions/index.js";const b="NexusAppSwitcher",y=o=>{const{name:i,target:n,url:l,logoSrc:c,"data-testid":p}=o,d=void 0===c||"string"==typeof c,h=r(e,{sx:u.logo,children:d?r(e,{loading:"lazy",sx:u.img,component:"img",src:c}):c});return r(m,{title:r("div",{translate:"no",children:i}),children:t(a,{underline:"none",sx:u.item,onClick:r=>{r.preventDefault(),x(l,n)},href:l,target:n,"data-testid":p||"AppSwitcher-appItem",children:[h,r(s,{variant:"caption",sx:u.title,translate:"no",children:i})]})})},j=({children:t})=>r(l,{alignItems:"center",justifyContent:"center",sx:{height:40,width:40,borderRadius:3,backgroundColor:"common.black"},children:t}),k=({solutions:m,moreProductsUrl:s,myProjectsUrl:k="https://nexus.hexagon.com/platform/",homeUrl:w="https://nexus.hexagon.com/home/",loading:v=!1,...S})=>{const C=h(g),N=[{name:C("Home"),logoSrc:r(j,{children:r("img",{src:f,height:22,width:"auto",style:{display:"block"},alt:"Nexus X icon"})}),url:w,target:"_blank"},{name:C("My Projects"),logoSrc:r(j,{children:r(p,{sx:{fontSize:24,color:"common.white"}})}),url:k,target:"_blank"}];return t(n,{anchorOrigin:{vertical:"bottom",horizontal:"left"},...S,children:[t(e,{className:`${b}-root`,sx:u.solutions,children:[r(i,{container:!0,rowSpacing:6,columnSpacing:4,role:"menu","aria-label":"App switcher",children:N.concat(m).map(((t,e)=>r(i,{size:4,className:`${b}-appItem`,role:"menuitem",children:r(y,{...t})},e)))}),r(l,{sx:u.more,direction:"row",justifyContent:"left",children:r(o,{size:"small",component:a,onClick:r=>{r.preventDefault(),x(s)},href:s,target:"_blank",rel:"noopener noreferrer",variant:"text",color:"primary",endIcon:r(c,{}),"data-testid":`${b}-more`,className:`${b}-more`,"aria-label":C("More Products"),children:C("More Products")})})]}),v&&r(l,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,bgcolor:r=>`rgba(${r.vars.palette.background.paperChannel} / 0.75)`},alignItems:"center",justifyContent:"center","data-testid":`${b}-loading`,className:`${b}-loading`,children:r(d,{})})]})};export{y as AppItem,k as default};