import{defineProperty as a}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";import{forwardRef as o,useRef as e,useCallback as c,useMemo as t}from"react";import r from"classnames";import s from"../../hooks/useMergeRefs.js";import d from"../Clickable/Clickable.js";import{backwardCompatibilityForProperties as l}from"../../helpers/backwardCompatibilityForProperties.js";import{baseClassName as p}from"./RadioButtonConstants.js";import m from"../Tooltip/Tooltip.js";import"./RadioButton.scss.js";var _=o((function(o,_){var u=o.className,b=o.componentClassName,f=o.text,h=void 0===f?"":f,v=o.value,j=void 0===v?"":v,k=o.name,g=void 0===k?"":k,C=o.disabled,N=void 0!==C&&C,O=o.disabledReason,z=o.defaultChecked,x=void 0!==z&&z,w=o.children,y=o.onSelect,R=o.checked,B=o.retainChildClick,P=void 0===B||B,T=o.childrenTabIndex,I=void 0===T?"0":T,A=o.noLabelAnimation,F=void 0!==A&&A,H=o.kind,L=void 0===H?"primary":H,M=o.size,S=void 0===M?"large":M,q=o.description,D=e(),E=s({refs:[_,D]}),G=l([u,b]),J=c((function(){!N&&P&&(D.current&&(D.current.checked=!0),y&&y(null))}),[y,D,N,P]),K=t((function(){return void 0!==R?{checked:R}:{defaultChecked:x}}),[R,x]);return i(m,Object.assign({content:N?O:null},{children:n("div",Object.assign({className:r("wrapper",q&&"wrapper--size-".concat(S))},{children:[n("label",Object.assign({className:r(p,G,{disabled:N})},{children:[n("span",Object.assign({className:r("".concat(p,"__radio-input-container"),"".concat(p,"__radio-input-container--kind-").concat(L))},{children:[i("input",Object.assign({className:"".concat(p,"__radio-input-container__radio-input"),type:"radio",value:j,name:g,disabled:N},K,{onChange:y,ref:E})),i("span",{className:r("".concat(p,"__radio-input-container__radio-control"),"".concat(p,"__radio-input-container__radio-control--size-").concat(S),a({},"".concat(p,"__radio-input-container__radio-control--label-animation"),!F),a({},"".concat(p,"__radio-input-container__radio-control--label-animation--size-").concat(S),!F))})]})),h&&i("span",Object.assign({className:r("".concat(p,"__radio-label"),"".concat(p,"__radio-label--kind-").concat(L),"".concat(p,"__radio-label--size-").concat(S))},{children:h})),w&&i(d,Object.assign({className:"radio-children-wrapper",onClick:J,tabIndex:I},{children:w}))]})),q&&i("span",Object.assign({className:r("".concat(p,"__description"),"".concat(p,"__description--size-").concat(S),"".concat(p,"__description--kind-").concat(L))},{children:q}))]}))}))}));export{_ as default};
