import e,{forwardRef as i,useRef as o,useMemo as s,Fragment as a}from"react";import r from"classnames";import{noop as t}from"es-toolkit";import n from"../../hooks/useMergeRef.js";import d from"../Tooltip/Tooltip.js";import{Icon as c}from"@vibe/icon/mockedClassNames";import{AddSmall as l}from"@vibe/icons";import{getWidthHeight as m}from"./services/IconButton-helpers.js";import{withStaticProps as p}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import{getTestId as u}from"../../tests/testIds.js";import{ComponentDefaultTestId as f,ComponentVibeId as v}from"../../tests/constants.js";import{Button as b}from"@vibe/button/mockedClassNames";import{getStyle as C}from"../../helpers/typesciptCssModulesHelper.js";import g from"./IconButton.module.scss.js";var j=p(i((function(i,p){var j=i.className,N=i.wrapperClassName,y=i.iconClassName,k=i.id,h=i.icon,x=void 0===h?l:h,I=i.size,O=void 0===I?"medium":I,T=i.tooltipProps,B=void 0===T?{}:T,E=i.tooltipContent,P=i.ariaLabeledBy,w=i.ariaLabel,z=i.ariaHasPopup,L=i.ariaExpanded,S=i.ariaControls,F=i["aria-describedby"],H=i["aria-hidden"],M=i["aria-pressed"],R=i.hideTooltip,U=void 0!==R&&R,W=i.kind,_=void 0===W?"tertiary":W,q=i.active,A=i.disabled,D=void 0!==A&&A,G=i.disabledReason,J=i.onClick,K=void 0===J?t:J,Q=i.color,V=i["data-testid"],X=i.insetFocus,Y=void 0!==X&&X,Z=i.tabIndex,$=i.loading,ee=void 0!==$&&$,ie=o(null),oe=n(p,ie),se=s((function(){return(null==B?void 0:B.content)||E}),[null==B?void 0:B.content,E]),ae=s((function(){return w||("string"==typeof se?se:void 0)}),[w,se]),re=s((function(){switch(O){case"xxs":case"xs":return 16;case"small":case"medium":case"large":return 20;default:return 24}}),[O]),te=s((function(){var e={justifyContent:"center",alignItems:"center",padding:0};return O&&(e=Object.assign(Object.assign({},e),m(O))),e}),[O]),ne=s((function(){return U?null:D&&G?G:se||w}),[U,D,G,se,w]),de=N?"div":a,ce=s((function(){return N?{className:r(N,g.wrapper)}:{}}),[N]);return e.createElement(de,Object.assign({},ce),e.createElement(d,Object.assign({},B,{content:ne,referenceWrapperClassName:g.referenceWrapper}),e.createElement(b,{onClick:K,disabled:D,color:Q,kind:_,ariaLabeledBy:P,ariaLabel:ae,ariaHasPopup:z,ariaExpanded:L,ariaControls:S,"aria-describedby":F,"aria-hidden":H,"aria-pressed":M,ref:oe,id:k,"data-testid":V||u(f.ICON_BUTTON,k),"data-vibe":v.ICON_BUTTON,noSidePadding:!0,active:q,className:j,style:te,insetFocus:Y,tabIndex:Z,loading:ee,loaderClassName:r(g.loader,C(g,O))},e.createElement(c,{icon:x,iconType:"svg",iconSize:re,ignoreFocusStyle:!0,className:y}))))})),{sizes:b.sizes,kinds:b.kinds,colors:b.colors});export{j as default};
//# sourceMappingURL=IconButton.js.map
