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"../Clickable/Clickable.js";import d from"../Text/Text.js";import c from"../Tooltip/Tooltip.js";import{getTestId as m,ComponentDefaultTestId as u}from"../../tests/testIds.js";import p from"./RadioButton.module.scss.js";import{ComponentVibeId as b}from"../../tests/constants.js";var f=i((function(i,f){var v=i.className,T=i.text,N=void 0===T?"":T,C=i.value,O=void 0===C?"":C,h=i.name,k=void 0===h?"":h,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(c,{content:R?x:null},a.createElement("label",{"data-testid":z||m(u.RADIO_BUTTON,w),"data-vibe":b.RADIO_BUTTON,className:t(p.radioButton,v,e(e({},p.disabled,R),"disabled",R))},a.createElement("span",{className:t(p.inputContainer)},a.createElement("input",Object.assign({className:t(p.input),type:"radio",value:O,name:k,autoFocus:_,disabled:R},Q,{"aria-label":S,"aria-describedby":q,onChange:D,ref:J})),a.createElement("span",{"data-testid":m(u.RADIO_BUTTON_CONTROL,w),className:t(p.control,B,e({},p.labelAnimation,!M))})),N&&a.createElement(d,{element:"span",type:"text2",className:j,"data-testid":m(u.RADIO_BUTTON_LABEL,w)},N),y&&a.createElement(n,{onClick:K,tabIndex:P},y)))}));export{f as default};
//# sourceMappingURL=RadioButton.js.map
