import{jsxs as V,jsx as e}from"react/jsx-runtime";import v from"./text.js";import{Flex as c,Circle as y,Box as P}from"@styled/jsx";import{flex as R}from"@styled/patterns";import{createContext as k,forwardRef as S,useContext as j,useRef as w,useCallback as u}from"react";import{useHover as F,useFocusRing as I,usePress as N,VisuallyHidden as W,mergeProps as z}from"react-aria";const m=k({selectedValue:void 0,setSelectedValue:()=>{}}),p=i=>{const{children:s,onChange:t,selectedValue:o,vertical:r}=i,n=u(a=>{t(a)},[t]);return e(c,{direction:r?"column":"row",gap:r?5:10,role:"radiogroup",children:e(m.Provider,{value:{selectedValue:o,setSelectedValue:n},children:s})})},h=S((i,s)=>{const{label:t,value:o}=i,r=j(m),n=w(null),a=s||n,b=u(()=>{r.setSelectedValue(o)},[r,o]),{hoverProps:f}=F({}),{focusProps:x,isFocusVisible:d}=I(),{pressProps:g}=N({onPress:b}),l=r.selectedValue===o,C=l?0:-1;return V("label",{className:R({alignItems:"center"}),children:[e(W,{children:e("input",{...z(g,x,f),ref:a,type:"radio",checked:l,tabIndex:C,readOnly:!0})}),e(c,{justifyContent:"center",alignItems:"center",borderWidth:"thick",borderColor:d||l?"brand.base":"text.tertiary",transition:"border-color 0.2s ease",outlineColor:"brand.base",outlineStyle:d?"solid":"none",outlineWidth:"thick",outlineOffset:.5,_hover:{borderColor:"brand.base"},cursor:"pointer",w:6,h:6,rounded:"full","aria-hidden":"true",children:l&&e(y,{size:3,bg:"brand.base"})}),e(P,{ml:3,children:e(v,{size:"lg",fontWeight:"medium",children:t})})]})});p.displayName="RadioGroup",h.displayName="Radio";export{h as Radio,p as RadioGroup};
//# sourceMappingURL=radio.js.map
