import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"classnames";import a,{forwardRef as i,useRef as o,useCallback as s,useMemo as l}from"react";import r from"../../hooks/useMergeRef.js";import n from"../Text/Text.js";import d from"../Tooltip/Tooltip.js";import{getTestId as c,ComponentDefaultTestId as m}from"../../tests/testIds.js";import u from"./RadioButton.module.scss.js";import{ComponentVibeId as p}from"../../tests/constants.js";import b from"../../../components/clickable/dist/Clickable/Clickable.js";var f=i((function(i,f){var v=i.className,T=i.text,N=void 0===T?"":T,C=i.value,k=void 0===C?"":C,O=i.name,h=void 0===O?"":O,j=i.labelClassName,B=i.radioButtonClassName,E=i.disabled,R=void 0!==E&&E,_=i.autoFocus,x=i.disabledReason,A=i.defaultChecked,I=void 0!==A&&A,y=i.children,D=i.onSelect,L=i.checked,g=i.retainChildClick,U=void 0===g||g,F=i.childrenTabIndex,P=void 0===F?"0":F,H=i.noLabelAnimation,M=void 0!==H&&H,S=i.ariaLabel,q=i.ariaDescribedby,w=i.id,z=i["data-testid"],G=o(),J=r(f,G),K=s((function(){!R&&U&&(G.current&&(G.current.checked=!0),D&&D(null))}),[D,G,R,U]),Q=l((function(){return void 0!==L?{checked:L}:{defaultChecked:I}}),[L,I]);return a.createElement(d,{content:R?x:null},a.createElement("label",{"data-testid":z||c(m.RADIO_BUTTON,w),"data-vibe":p.RADIO_BUTTON,className:t(u.radioButton,v,e(e({},u.disabled,R),"disabled",R))},a.createElement("span",{className:t(u.inputContainer)},a.createElement("input",Object.assign({className:t(u.input),type:"radio",value:k,name:h,autoFocus:_,disabled:R},Q,{"aria-label":S,"aria-describedby":q,onChange:D,ref:J})),a.createElement("span",{"data-testid":c(m.RADIO_BUTTON_CONTROL,w),className:t(u.control,B,e({},u.labelAnimation,!M))})),N&&a.createElement(n,{element:"span",type:"text2",className:j,"data-testid":c(m.RADIO_BUTTON_LABEL,w)},N),y&&a.createElement(b,{onClick:K,tabIndex:P},y)))}));export{f as default};
//# sourceMappingURL=RadioButton.js.map
