import{jsx as r,jsxs as D}from"react/jsx-runtime";import{Children as b,cloneElement as x,forwardRef as E,useRef as F}from"react";import{cn as w}from"../../lib/cn.js";import"../feedback/callout.js";import{LoadingSpinner as L}from"../feedback/loading-spinner.js";import"./checkbox.js";import"./dropdown-selector.js";import"./popover.js";import"./radio.js";import"./segmented-control.js";import"./switch.js";import"./text.js";import"./portal.js";import"../../hooks/useToast.js";import"../feedback/tooltip.js";import{button as T}from"../../recipes/button.js";import{createSlot as N,createHost as W}from"create-slots";import{useButton as $,useHover as k,useFocusRing as q,mergeProps as M}from"react-aria";const j=N(({children:e,...i})=>r("div",{className:"flex items-center justify-center",children:b.map(e,t=>x(t,i))})),z=N(({children:e,...i})=>r("div",{className:"flex items-center justify-center",children:b.map(e,t=>x(t,i))})),V=({variant:e="primary",size:i="md"})=>{const t=e==="primary"||e==="negative",l=e==="neutral"||e==="tertiary";return r(L,{size:{sm:20,md:24,lg:28}[i],strokeWidth:2.5,inverted:t,neutral:l})},S=E((e,i)=>{const{label:t,variant:l="primary",textStyle:P,size:m="md",disabled:p,expand:c,validating:d,iconSize:C,onHover:u,centerContent:f}=e,a=C||(m==="sm"?16:24),h=t&&c&&!f,o=T({variant:l,textStyle:P,expand:c,size:m,validating:d,iconOnly:!t}),H=F(null),v=i||H,{buttonProps:R}=$({...e,isDisabled:p??!1},v),{hoverProps:B}=k({isDisabled:p??!1}),{isFocusVisible:I,focusProps:O}=q();return W(e.children,g=>{const n=g.get(j),s=g.get(z),y=a/4;return r("button",{className:w(o.button,"group",!t&&o.iconContainer,I&&o.focus),ref:v,...M(R,B,O),"aria-disabled":p,onMouseEnter:u,onTouchStart:u,children:d?r(V,{variant:l,size:m}):D("div",{className:w("flex flex-row items-center w-full gap-2",t&&(n||s)&&!f?"justify-between":"justify-center"),children:[n&&{...n,props:{className:n.props.color?void 0:o.icon,width:a,height:a,...n.props}},s&&h&&r("div",{style:{width:`${y*.25}rem`}}),t&&r("span",{className:o.label,children:t}),n&&h&&r("div",{style:{width:`${y*.25}rem`}}),s&&{...s,props:{className:s.props.color?void 0:o.icon,width:a,height:a,...s.props}}]})})})}),A=Object.assign(S,{LeadingIcon:j,TrailingIcon:z});S.displayName="Button";export{A as default};
//# sourceMappingURL=button.js.map
