@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) • 1.12 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("@mui/material/Chip"),t=require("@mui/material/Tooltip"),a=require("@mui/material/styles"),o=require("./StatusBadge.styles.js"),s=require("../util/functions/index.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=l(r),u=l(t);const n="NexusStatusBadge",d=["error","info","success","warning"];exports.StatusBadgeComponent=r=>{const{color:t="info",tooltip:l,sx:c,...p}=r,y=a.useTheme(),g=s.standardizeColorToHex(y,t),m=e.jsx(i.default,{"data-testid":`${n}-root`,className:`${n}-root`,size:"small",sx:[o.styles.root,d.includes(t)?o.styles[t]:{backgroundColor:g??y.vars.palette.grey[50],color:g?s.getContrastTextColor(y,t):"common.black",...y.applyStyles("dark",{backgroundColor:g??y.vars.palette.grey[50]}),"&.MuiChip-clickable:hover":{backgroundColor:g?a.darken(g,.15):y.vars.palette.grey[200],...y.applyStyles("dark",{backgroundColor:g?a.darken(g,.15):y.vars.palette.grey[200]})}},...Array.isArray(c)?c:[c]],...p});return l?e.jsx(u.default,{title:l,arrow:!0,children:m}):m};