import{defineProperty as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import t from"classnames";import a,{forwardRef as o,useRef as i,useCallback as s,useMemo as l}from"react";import r from"../../hooks/useMergeRef.js";import{Clickable as n}from"@vibe/clickable/mockedClassNames";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=o((function(o,f){var v=o.className,N=o.text,T=void 0===N?"":N,C=o.value,O=void 0===C?"":C,h=o.name,k=void 0===h?"":h,B=o.labelClassName,j=o.radioButtonClassName,E=o.disabled,R=void 0!==E&&E,_=o.autoFocus,x=o.disabledReason,A=o.defaultChecked,I=void 0!==A&&A,y=o.children,D=o.onSelect,L=o.checked,g=o.retainChildClick,U=void 0===g||g,F=o.childrenTabIndex,P=void 0===F?"0":F,H=o.noLabelAnimation,M=void 0!==H&&H,S=o.ariaLabel,q=o.ariaDescribedby,w=o.id,z=o["data-testid"],G=i(),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,j,e({},p.labelAnimation,!M))})),T&&a.createElement(d,{element:"span",type:"text2",className:B,"data-testid":m(u.RADIO_BUTTON_LABEL,w)},T),y&&a.createElement(n,{onClick:K,tabIndex:P},y)))}));export{f as default};
//# sourceMappingURL=RadioButton.js.map
