@useloops/design-system
Version:
The official React based Loops design system
2 lines (1 loc) • 1.25 kB
JavaScript
"use strict";var e=require("react/jsx-runtime"),r=require("@mui/material"),o=require("../../BrandCore/primitiveVariables.js"),t=require("./LikertContainer.js"),i=require("./LikertLabel.js"),a=require("./LikertRadio.js");module.exports=({options:n=[],disabled:s=!1,sizing:u="lg",onChange:l,internalChange:c,value:d})=>{const h=r.useTheme();function x(e){l(e.value),c&&c()}return e.jsx(r.Box,{children:e.jsx(t.default,{children:e.jsx(r.Grid,{container:!0,justifyContent:"space-between",children:n.map(t=>e.jsxs(r.Grid,{size:"grow",onClick:()=>x(t),sx:{...!s&&{cursor:"pointer"},textAlign:"center","&:hover":{"& .MuiButtonBase-root.MuiRadio-root":{"&:before":{...!s&&{backgroundColor:h.custom.palette.interaction.hover}}}},"&:active":{"& .MuiButtonBase-root.MuiRadio-root":{...!s&&{backgroundColor:h.custom.palette.input.default,borderColor:h.custom.palette.stroke.focus,boxShadow:h.custom.boxShadow.input.focus},"&:before":{...!s&&{backgroundColor:h.custom.palette.interaction.press}},"&.Mui-checked":{backgroundColor:h.custom.palette.purple[500]}}}},children:[e.jsx(a,{sizing:u,disabled:s,onChange:e=>x(t),checked:d===t.value},t.value),e.jsx(r.Box,{sx:{mt:o.margin.xs,width:"100%"},children:e.jsx(i,{disabled:s,children:t.label})})]},t.value))})})})};