@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) • 2.6 kB
JavaScript
import{s as w,c as t,S as s,m as u,i as c,n as x,t as p}from"./define-CNSKFZCd.js";import{c as g}from"./cn-CU7UAWzk.js";import{B as h}from"./button-DBDZebGr.js";import{r as y}from"./icon-CAyRqVrg.js";var b=p('<span class="min-w-0 flex-1">'),f=p('<span class="text-foreground/70 whitespace-pre-wrap">'),z=p('<span class="text-primary font-medium whitespace-pre-wrap">');function k(i){const[r,a]=w(i,["children","variant","size","class","icon","highlight","block","list"]),o=()=>t(s,{get when(){return r.icon},get children(){return y(r.icon,{class:"size-3.5 shrink-0"})}}),d=()=>r.highlight!==void 0&&r.highlight.trim()!=="",n=()=>typeof r.children=="string"?r.children:"";return t(s,{get when(){return d()},get fallback(){return t(s,{get when(){return r.list},get fallback(){return t(s,{get when(){return r.block},get fallback(){return t(h,u({get variant(){return r.variant??"outline"},size:"lg",get class(){return g("rounded-full",r.class)}},a,{get children(){return[t(o,{}),x(()=>r.children)]}}))},get children(){return t(h,u({get variant(){return r.variant??"outline"},size:"md",get class(){return g("h-auto w-full cursor-pointer justify-start rounded-xl px-4 py-2.5","text-left text-sm leading-snug whitespace-normal text-pretty",r.class)}},a,{get children(){return r.children}}))}})},get children(){return t(h,u({get variant(){return r.variant??"ghost"},size:"md",get class(){return g("group h-auto w-full cursor-pointer items-center justify-start gap-2.5 rounded-xl px-3",r.size==="lg"?"py-3.5":"py-2.5","text-left text-sm leading-snug whitespace-normal text-pretty","hover:bg-accent",r.class)}},a,{get children(){return[t(o,{}),(()=>{var l=b();return c(l,()=>r.children),l})()]}}))}})},get children(){return t(s,{get when(){return n()},get fallback(){return t(h,u({get variant(){return r.variant??"ghost"},size:"sm",get class(){return g("w-full cursor-pointer justify-start rounded-xl py-2","hover:bg-accent",r.class)}},a,{get children(){return r.children}}))},get children(){return t(h,u({get variant(){return r.variant??"ghost"},size:"sm",get class(){return g("w-full cursor-pointer justify-start gap-0 rounded-xl py-2","hover:bg-accent",r.class)}},a,{get children(){return j(n(),r.highlight)}}))}})}})}function j(i,r){const a=r.trim(),o=i.toLowerCase(),d=a.toLowerCase(),n=o.indexOf(d);if(n===-1)return(()=>{var e=f();return c(e,i),e})();const l=i.substring(0,n),m=i.substring(n,n+d.length),v=i.substring(n+m.length);return[t(s,{when:l,get children(){var e=f();return c(e,l),e}}),(()=>{var e=z();return c(e,m),e})(),t(s,{when:v,get children(){var e=f();return c(e,v),e}})]}export{k as P};