"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index.cjs38.js"),t=require("react"),y=require("./index.cjs40.js"),b=require("./index.cjs48.js"),f=require("./index.cjs49.js"),E=require("./index.cjs11.js"),M=require("./index.cjs50.js"),k=t.forwardRef(({tags:i,maxVisible:s=5,tagProps:C,overflowTagProps:n,collapseTagProps:u,collapseText:I="Свернуть",size:c,variant:r,className:R,...o},q)=>{const[a,j]=t.useState(!1),{visibleTags:G,hiddenCount:l}=t.useMemo(()=>i.length<=s||a?{visibleTags:i,hiddenCount:0}:{visibleTags:i.slice(0,s),hiddenCount:i.length-s},[i,s,a]),x=t.useCallback(()=>j(!0),[]),h=t.useCallback(()=>j(!1),[]),D=t.useCallback(e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),x())},[x]),N=t.useCallback(e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),h())},[h]),m=t.useMemo(()=>({...C,...c&&{size:c},...r&&{variant:r}}),[C,c,r]);return d.jsxRuntimeExports.jsxs("div",{ref:q,"data-atme-ui":!0,className:y(b.default.tagGroup,R),...o,children:[G.map((e,K)=>d.jsxRuntimeExports.jsx(f.TagGroupItemView,{tag:e,baseTagProps:m},K)),!a&&l>0&&d.jsxRuntimeExports.jsxs(E.Tag,{...m,...n,onClick:x,onKeyDown:D,role:"button",tabIndex:0,"aria-label":`Показать еще ${l} тегов`,className:y(b.default.tagInteractive,n==null?void 0:n.className),style:n==null?void 0:n.style,children:["+",l]}),a&&d.jsxRuntimeExports.jsx(E.Tag,{...m,...u,onClick:h,onKeyDown:N,role:"button",tabIndex:0,"aria-label":I,className:y(b.default.tagInteractive,u==null?void 0:u.className),style:u==null?void 0:u.style,children:d.jsxRuntimeExports.jsx(M.ChevronUpIcon,{decorative:!0,width:16,height:16})})]})});k.displayName="TagGroup";exports.TagGroup=k;
//# sourceMappingURL=index.cjs12.js.map
