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