import{jsxs as V,jsx as e}from"react/jsx-runtime";import y from"./text.js";import{cn as c}from"../../lib/cn.js";import{createContext as N,forwardRef as P,useContext as R,useRef as k,useCallback as u}from"react";import{useHover as w,useFocusRing as C,usePress as j,VisuallyHidden as S,mergeProps as F}from"react-aria";const m=N({selectedValue:void 0,setSelectedValue:()=>{}}),f=a=>{const{children:t,onChange:l,selectedValue:r,vertical:o}=a,i=u(d=>{l(d)},[l]);return e("div",{className:c("flex",o?"flex-col gap-5":"flex-row gap-10"),role:"radiogroup",children:e(m.Provider,{value:{selectedValue:r,setSelectedValue:i},children:t})})},p=P((a,t)=>{const{label:l,value:r}=a,o=R(m),i=k(null),d=t||i,b=u(()=>{o.setSelectedValue(r)},[o,r]),{hoverProps:h}=w({}),{focusProps:x,isFocusVisible:n}=C(),{pressProps:v}=j({onPress:b}),s=o.selectedValue===r,g=s?0:-1;return V("label",{className:"flex items-center",children:[e(S,{children:e("input",{...F(v,x,h),ref:d,type:"radio",checked:s,tabIndex:g,readOnly:!0})}),e("div",{className:c("flex justify-center items-center border-thick transition-colors duration-200 ease-in-out cursor-pointer w-6 h-6 rounded-full hover:border-brand-base",n||s?"border-brand-base":"border-text-tertiary",n?"outline outline-thick outline-brand-base outline-offset-[0.125rem]":"outline-none"),"aria-hidden":"true",children:s&&e("div",{className:"rounded-full w-3 h-3 bg-brand-base"})}),e("div",{className:"ml-3",children:e(y,{size:"lg",fontWeight:"medium",children:l})})]})});f.displayName="RadioGroup",p.displayName="Radio";export{p as Radio,f as RadioGroup};
//# sourceMappingURL=radio.js.map
