import{slicedToArray as e,defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{camelCase as r}from"es-toolkit";import o from"classnames";import{getTestId as a,ComponentDefaultTestId as l}from"../../tests/testIds.js";import{getStyle as s}from"../../helpers/typesciptCssModulesHelper.js";import i,{forwardRef as n,useRef as m,useState as c,useMemo as p,useCallback as d,useEffect as f}from"react";import u from"../Text/Text.js";import b from"./Leg.js";import{LabelAllowedColor as v,LabelKind as j,mapSizesToTextSize as k}from"./LabelConstants.js";import{contentColors as E}from"../../utils/colors-vars-map.js";import{withStaticProps as L}from"../../types/withStaticProps.js";import{useClickableProps as y}from"@vibe/clickable/mockedClassNames";import g from"../../hooks/useMergeRef.js";import C from"./Label.module.scss.js";import x from"./LabelCelebrationAnimation.js";import{ComponentVibeId as N}from"../../tests/constants.js";var A=L(n((function(n,v){var j=n.className,L=n.labelClassName,A=n.kind,h=void 0===A?"fill":A,P=n.color,H=void 0===P?"primary":P,T=n.text,B=void 0===T?"":T,I=n.isLegIncluded,w=void 0!==I&&I,M=n.id,W=n["data-testid"],_=n.onClick,z=n.celebrationAnimation,D=n.size,O=void 0===D?"medium":D,R=m(null),S=g(v,R),q=c(z),F=e(q,2),G=F[0],J=F[1],K=!!_,Q=p((function(){return o(C.label,s(C,r("kind-"+h)),s(C,r("color-"+H)),t(t(t({},C.withLeg,w),C.clickable,K),C.small,"small"===O),L)}),[h,H,w,L,K,O]),U=p((function(){if(E.includes(H))return"line"===h?{color:"var(--color-".concat(H,")")}:{backgroundColor:"var(--color-".concat(H,")")}}),[H,h]),V=d((function(e){_&&(e.preventDefault(),_(e))}),[_]),X=y({onClick:V,id:M,ariaHidden:!1,ariaHasPopup:!1,ariaExpanded:!1},R);f((function(){J(z)}),[z]);var Y=p((function(){return i.createElement("span",Object.assign({},K&&X,{className:o(t({},C.clickableWrapper,K),j),"data-testid":W||a(l.LABEL,M),"data-vibe":N.LABEL,ref:S}),i.createElement(u,{style:U,element:"span",type:k[O],className:Q,color:"dark"===H?"onInverted":"onPrimary","data-celebration-text":G},i.createElement(u,{element:"span",type:k[O],color:"inherit",className:o(t({},C.smallText,"small"===O))},B),i.createElement("span",{className:o(C.legWrapper)},w?i.createElement(b,null):null)))}),[K,X,j,W,M,S,Q,G,B,w,O,U,H]);return G&&"line"===h?i.createElement(x,{onAnimationEnd:function(){return J(!1)}},Y):Y})),{colors:v,kinds:j});export{A as default};
//# sourceMappingURL=Label.js.map
