UNPKG

@kitn.ai/ui

Version:

Framework-agnostic, Shadow-DOM web components for building AI chat interfaces — works in React, Vue, Angular, Svelte, or plain HTML. Authored in SolidJS.

2 lines (1 loc) 943 B
import{p as s,s as a,u,k as l,m as f,t as g}from"./define-CNSKFZCd.js";import{c as m}from"./cn-CU7UAWzk.js";function c(i={}){let e;function r(){if(!e)return;e.style.height="auto";const t=e.scrollHeight;i.maxHeight&&t>i.maxHeight?(e.style.height=`${i.maxHeight}px`,e.style.overflowY="auto"):(e.style.height=`${t}px`,e.style.overflowY="hidden")}function n(t){e=t,t.addEventListener("input",r),requestAnimationFrame(r),s(()=>t.removeEventListener("input",r))}return{ref:n,resize:r}}var h=g("<textarea rows=1>");function d(i){const[e,r]=a(i,["class","maxHeight","autoResize"]),{ref:n}=c({maxHeight:e.maxHeight});return(()=>{var t=h(),o=e.autoResize!==!1?n:void 0;return typeof o=="function"&&u(o,t),l(t,f({get class(){return m("w-full resize-none rounded-md bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",e.class)}},r),!1,!1),t})()}export{d as T};