import{r as s}from"./index-NdkWRN8K.js";import{u as S}from"./OdysseyThemeProvider-Bh0Bu-2o.js";import{M as v}from"./Typography-Cz6D417Y.js";import{u as z}from"./useUniqueId-Bsgqe1tm.js";import{H as D}from"./Hint-DoJneNg9.js";import{j as t}from"./jsx-runtime-CnH95YSl.js";import{F as N}from"./FormControlLabel-0BBemR80.js";import{R as $}from"./Radio-B4gVvwps.js";import{F as q}from"./FormHelperText-CsNAE1E3.js";const L=({hint:r,id:f,inputRef:p,isChecked:x,isDisabled:a,isInvalid:k,label:m,name:b,testId:u,translate:l,value:M,isReadOnly:e,onChange:n,onBlur:i,onClick:j})=>{const d=s.useRef(null),g=S(),h=z(f),c=r?`${h}-hint`:void 0;s.useImperativeHandle(p,()=>({focus:()=>{var o;(o=d.current)==null||o.focus()}}),[]);const T=s.useMemo(()=>t.jsx(v,{component:"span",children:m}),[m]),y=s.useCallback((o,E)=>{e?o.preventDefault():n==null||n(o,E)},[n,e]),C=s.useCallback(o=>{e&&(o.stopPropagation(),o.preventDefault())},[e]),F=s.useCallback(o=>{i==null||i(o)},[i]),I=s.useMemo(()=>({...e&&{cursor:"default","& .MuiTypography-root":{cursor:"default"}},...r&&{":not(:last-child)":{marginBlockEnd:"0"}}}),[r,e]),H=s.useMemo(()=>({"aria-describedby":c,"aria-disabled":a||e,"data-se":u,readOnly:e,tabIndex:e?0:void 0}),[c,a,e,u]);return t.jsxs(t.Fragment,{children:[t.jsx(N,{checked:x,className:k?"Mui-error":"",control:t.jsx($,{disabled:a,inputProps:H,inputRef:d,onChange:y,onClick:j||C}),disabled:a,label:T,name:b,onBlur:F,sx:I,translate:l,value:M}),r&&t.jsx(D,{odysseyDesignTokens:g,children:t.jsx(q,{id:c,translate:l,children:r})})]})},U=s.memo(L);U.displayName="Radio";export{U as M};
