import*as e from"react";import{useRadioGroupContext as s}from"./radio-group.js";import{useRadio as t}from"./use-radio.js";import{omitThemingProps as r}from"../../../system/dist/esm/system.utils.js";import{split as i}from"../../../utils/dist/esm/object.js";import{layoutPropNames as n}from"../../../styled-system/dist/esm/system.js";import{forwardRef as a}from"../../../system/dist/esm/forward-ref.js";import{useMultiStyleConfig as l}from"../../../system/dist/esm/use-style-config.js";import{callAll as o}from"../../../utils/dist/esm/function.js";import{chakra as m}from"../../../system/dist/esm/system.js";import{__DEV__ as c}from"../../../utils/dist/esm/assertion.js";function u(){return(u=Object.assign||function(e){for(var s=1;s<arguments.length;s++){var t=arguments[s];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}var d=a(((a,c)=>{var d,{onChange:p,value:f}=a,h=s(),g=l("Radio",u({},h,a)),y=r(a),{spacing:v="0.5rem",children:j,isFullWidth:_}=y,b=function(e,s){if(null==e)return{};var t,r,i={},n=Object.keys(e);for(r=0;r<n.length;r++)t=n[r],s.indexOf(t)>=0||(i[t]=e[t]);return i}(y,["spacing","children","isFullWidth"]),k=a.isChecked;null!=(null==h?void 0:h.value)&&null!=f&&(k=h.value===f);var C=p;null!=h&&h.onChange&&null!=f&&(C=o(h.onChange,p));var x=null!=(d=null==a?void 0:a.name)?d:null==h?void 0:h.name,{getInputProps:N,getCheckboxProps:O,getLabelProps:P,htmlProps:E}=t(u({},b,{isChecked:k,onChange:C,name:x})),[w,I]=i(E,n),S=O(I),F=N({},c),R=P(),W=u({width:_?"full":void 0,display:"inline-flex",alignItems:"center",verticalAlign:"top"},g.container),A=u({display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},g.control),L=u({userSelect:"none",marginStart:v},g.label);return e.createElement(m.label,u({className:"chakra-radio"},w,{__css:W}),e.createElement("input",u({className:"chakra-radio__input"},F)),e.createElement(m.span,u({className:"chakra-radio__control"},S,{__css:A})),j&&e.createElement(m.span,u({className:"chakra-radio__label"},R,{__css:L}),j))}));c&&(d.displayName="Radio");export{d as Radio};
//# sourceMappingURL=radio.js.map
