UNPKG

@iqmo/browser

Version:

Browser Stlite

2 lines (1 loc) 2.43 kB
import{c as s,r as b,R as p,b6 as h,bG as x,z as f,j as t,bE as k,bH as m,D as C,b4 as v}from"./index-C9lG8Cnd.js";const j=s("div",{target:"e11k5jya2"})(({containerWidth:r})=>({display:"flex",flexDirection:"column",width:r?"100%":"fit-content"}),""),L=s("a",{target:"e11k5jya1"})(({disabled:r,isCurrentPage:o,containerWidth:i,theme:e})=>({textDecoration:"none",width:i?"100%":"fit-content",display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-start",gap:e.spacing.sm,borderRadius:e.radii.default,paddingLeft:e.spacing.sm,paddingRight:e.spacing.sm,marginTop:e.spacing.threeXS,marginBottom:e.spacing.threeXS,lineHeight:e.lineHeights.menuItem,backgroundColor:o?e.colors.darkenedBgMix15:"transparent","&:hover":{backgroundColor:o?e.colors.darkenedBgMix25:e.colors.darkenedBgMix15},"&:active,&:visited,&:hover":{textDecoration:"none"},"&:focus":{outline:"none"},"&:focus-visible":{backgroundColor:e.colors.darkenedBgMix15},"@media print":{paddingLeft:e.spacing.none},...r?{borderColor:e.colors.borderColor,backgroundColor:e.colors.transparent,color:e.colors.fadedText40,cursor:"not-allowed","&:hover":{color:e.colors.fadedText40,backgroundColor:e.colors.transparent}}:{}}),""),w=s("span",{target:"e11k5jya0"})(({disabled:r,theme:o})=>({color:o.colors.bodyText,overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",display:"table-cell",...r?{borderColor:o.colors.borderColor,backgroundColor:o.colors.transparent,color:o.colors.fadedText40,cursor:"not-allowed"}:{}}),"");function T(r,o){return r===null&&o?!0:r===null&&!o?!1:r===!0}function y(r){const{onPageChange:o,currentPageScriptHash:i}=p.useContext(h),e=p.useContext(x),{colors:d}=f(),{disabled:n,element:a}=r,l=T(a.useContainerWidth,e),c=i===a.pageScriptHash,u=g=>{a.external?n&&g.preventDefault():(g.preventDefault(),n||o(a.pageScriptHash))};return t.jsx("div",{className:"stPageLink","data-testid":"stPageLink",children:t.jsx(k,{help:a.help,placement:m.TOP_RIGHT,containerWidth:l,children:t.jsx(j,{containerWidth:l,children:t.jsxs(L,{"data-testid":"stPageLink-NavLink",disabled:n,isCurrentPage:c,containerWidth:l,href:a.page,target:a.external?"_blank":"",rel:"noreferrer",onClick:u,children:[a.icon&&t.jsx(C,{size:"lg",color:n?d.fadedText40:d.bodyText,iconValue:a.icon}),t.jsx(w,{disabled:n,children:t.jsx(v,{source:a.label,allowHTML:!1,isLabel:!0,boldLabel:c,largerLabel:!0,disableLinks:!0})})]})})})})}const D=b.memo(y);export{D as default};