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