import{c as e,i as t}from"./preload-helper-B45gAKPr.js";import{pn as n,t as r}from"./iframe-CMLjY6eW.js";import{a as i,i as a}from"./utils-PcgESe3m.js";import{t as o,tt as s}from"./formatters-CvqCBcOp.js";import{n as c,t as l}from"./popover-Cok2orIz.js";var u,d,f=t((()=>{u=r(),d=({text:e,highlight:t})=>t?e.split(RegExp(`(${t})`,`gi`)).map((e,n)=>e.toLowerCase()===t.toLowerCase()?(0,u.jsx)(`mark`,{children:e},n):e):e})),p,m,h,g,_,v,y,b,x=t((()=>{p=e(n(),1),a(),m=r(),h={primary:`content0`,secondary:`content1`,muted:`content2`,info:`statusInfo`,success:`statusSuccess`,warning:`statusWarning`,error:`statusError`},g={xs:`fontSizeXs`,sm:`fontSizeSm`,md:`fontSizeMd`,lg:`fontSizeLg`,xl:`fontSizeXl`},_={lighter:`fontLighter`,light:`fontLight`,regular:`fontRegular`,medium:`fontMedium`,bold:`fontBold`,bolder:`fontBolder`},v={wrap:`textWrap`,noWrap:`textNoWrap`},y=({size:e,color:t,weight:n,italic:r,uppercase:a,wrap:o,className:s})=>(0,p.useMemo)(()=>{let c=[];return e&&c.push(g[e]),n&&c.push(_[n]),o&&c.push(v[o]),r&&c.push(`fontItalic`),a&&c.push(`textUppercase`),t&&c.push(h[t]),i(...c,s)},[e,n,t,r,a,o,s]),b=({children:e,as:t,style:n,...r})=>{let i=y(r);return(0,m.jsx)(t||`span`,{className:i,style:n,children:e})},b.__docgenInfo={description:``,methods:[],displayName:`Text`,props:{size:{required:!1,tsType:{name:`union`,raw:`"xs" | "sm" | "md" | "lg" | "xl"`,elements:[{name:`literal`,value:`"xs"`},{name:`literal`,value:`"sm"`},{name:`literal`,value:`"md"`},{name:`literal`,value:`"lg"`},{name:`literal`,value:`"xl"`}]},description:``},color:{required:!1,tsType:{name:`union`,raw:`"primary" | "secondary" | "muted" | "error" | "warning" | "success" | "info"`,elements:[{name:`literal`,value:`"primary"`},{name:`literal`,value:`"secondary"`},{name:`literal`,value:`"muted"`},{name:`literal`,value:`"error"`},{name:`literal`,value:`"warning"`},{name:`literal`,value:`"success"`},{name:`literal`,value:`"info"`}]},description:``},weight:{required:!1,tsType:{name:`union`,raw:`"lighter" | "light" | "regular" | "medium" | "bold" | "bolder"`,elements:[{name:`literal`,value:`"lighter"`},{name:`literal`,value:`"light"`},{name:`literal`,value:`"regular"`},{name:`literal`,value:`"medium"`},{name:`literal`,value:`"bold"`},{name:`literal`,value:`"bolder"`}]},description:``},italic:{required:!1,tsType:{name:`boolean`},description:``},uppercase:{required:!1,tsType:{name:`boolean`},description:``},wrap:{required:!1,tsType:{name:`union`,raw:`"wrap" | "noWrap"`,elements:[{name:`literal`,value:`"wrap"`},{name:`literal`,value:`"noWrap"`}]},description:``},className:{required:!1,tsType:{name:`string`},description:``},style:{required:!1,tsType:{name:`CSSProperties`},description:``},children:{required:!0,tsType:{name:`ReactReactNode`,raw:`React.ReactNode`},description:``},as:{required:!1,tsType:{name:`union`,raw:`"code" | "span" | "p" | "div" | "h2" | "h3" | "h4" | "h5" | "h6"`,elements:[{name:`literal`,value:`"code"`},{name:`literal`,value:`"span"`},{name:`literal`,value:`"p"`},{name:`literal`,value:`"div"`},{name:`literal`,value:`"h2"`},{name:`literal`,value:`"h3"`},{name:`literal`,value:`"h4"`},{name:`literal`,value:`"h5"`},{name:`literal`,value:`"h6"`}]},description:``}}}}));function S({maxChar:e,placement:t=`left`,closeDelay:n=0,maxWidth:r,children:i,block:a,state:o,textWrap:l,textWrapProps:u}){let d=s(i);if(!d.length||e&&d.length<e)return(0,C.jsx)(`span`,{children:d});let f=l??`div`,p={style:{display:a?`block`:`inline-block`,width:e?`${e-3}ch`:`auto`},className:`textOverflow`};return(0,C.jsx)(c,{state:o,placement:t,openOnHover:!0,content:d,closeDelay:n,maxWidth:r,children:(0,C.jsx)(f,{...u,...p,style:{...u?.style,...p.style},className:[u?.className,p.className].filter(Boolean).join(` `),children:d})})}var C,w=t((()=>{o(),l(),C=r(),S.__docgenInfo={description:``,methods:[],displayName:`TextOverflow`,props:{children:{required:!0,tsType:{name:`string`},description:``},maxChar:{required:!1,tsType:{name:`number`},description:``},maxWidth:{required:!1,tsType:{name:`number`},description:`Максимальная ширина тултипа в em.`},placement:{required:!1,tsType:{name:`Placement`},description:``,defaultValue:{value:`"left"`,computed:!1}},closeDelay:{required:!1,tsType:{name:`number`},description:``,defaultValue:{value:`0`,computed:!1}},block:{required:!1,tsType:{name:`literal`,value:`true`},description:`Для работы text-overflow элемент обязан быть блочным или inline-block.
Если в качестве обёртки передается инлайновый компонент, то он будет
перезаписан через стили на display: block или inline-block в зависимости
от установки данного пропса.`},state:{required:!1,tsType:{name:`union`,raw:`"information" | "error" | "warning" | "success" | "negative"`,elements:[{name:`literal`,value:`"information"`},{name:`literal`,value:`"error"`},{name:`literal`,value:`"warning"`},{name:`literal`,value:`"success"`},{name:`literal`,value:`"negative"`}]},description:``},textWrap:{required:!1,tsType:{name:`T`},description:``},textWrapProps:{required:!1,tsType:{name:`Omit`,elements:[{name:`ComponentProps`,elements:[{name:`T`}],raw:`ComponentProps<T>`},{name:`literal`,value:`"children"`}],raw:`Omit<ComponentProps<T>, "children">`},description:``}}}})),T=t((()=>{f(),x(),w()}));export{x as a,b as i,S as n,d as o,w as r,f as s,T as t};