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) 2.57 kB
import{c as i,m as p,g as b,i as o,S as c,a as k,d as w,b as $,t as l,e as S,f as z,q as u}from"./chunks/define-CNSKFZCd.js";import{c as d}from"./chunks/cn-CU7UAWzk.js";import{r as D}from"./chunks/icon-CAyRqVrg.js";import{c as _}from"./chunks/circle-check-CJV-3Rem.js";import{I as q}from"./chunks/Icon-C2LTALdM.js";import{i as v}from"./chunks/info-DBQl-m6e.js";import{t as C}from"./chunks/triangle-alert-B07fX3Q8.js";import{x as A}from"./chunks/x-Ckwicf6g.js";var I=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],N=r=>i(q,p(r,{name:"CircleAlert",iconNode:I})),j=N,E=l('<button type=button aria-label=Dismiss class="-my-1 -mr-1.5 shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground">'),O=l('<div><div class="flex-1 leading-snug text-muted-foreground">');const P={neutral:v,info:v,warning:C,error:j,success:_},h={neutral:"text-muted-foreground",info:"text-tool-blue",warning:"text-tool-amber",error:"text-tool-red",success:"text-tool-green"};function x(r,s){if(s==="none")return null;if(s)return D(s,{class:d("size-4 shrink-0",h[r])});const a=P[r];return i(a,{get class(){return d("size-4 shrink-0",h[r])},"aria-hidden":"true"})}function R(r){const[s,a]=b(!0),e=()=>r.severity??"neutral",y=()=>{var t;a(!1),(t=r.onDismiss)==null||t.call(r)};return i(c,{get when(){return s()},get children(){var t=O(),m=t.firstChild;return o(t,i(c,{get when(){return r.iconSlot},get fallback(){return x(e(),r.icon)},get children(){return r.iconSlot}}),m),o(m,()=>r.children),o(t,i(c,{get when(){return r.action},get children(){return r.action}}),null),o(t,i(c,{get when(){return r.dismissible},get children(){var n=E();return n.$$click=y,o(n,i(A,{class:"size-3.5","aria-hidden":"true"})),n}}),null),k(n=>{var g=e()==="error"?"alert":"status",f=d("flex items-center gap-2.5 rounded-lg bg-surface px-3.5 py-2.5 text-sm",r.class);return g!==n.e&&w(t,"role",n.e=g),f!==n.t&&$(t,n.t=f),n},{e:void 0,t:void 0}),t}})}S(["click"]);var T=l("<slot>"),V=l("<slot name=icon>"),W=l("<slot name=action>");z("kai-notice",{severity:"neutral",icon:void 0,dismissible:!1},(r,{dispatch:s,flag:a})=>i(R,{get severity(){return r.severity??"neutral"},get iconSlot(){return(()=>{var e=V();return e._$owner=u(),o(e,()=>x(r.severity??"neutral",r.icon)),e})()},get dismissible(){return a("dismissible")},onDismiss:()=>s("kai-dismiss"),get action(){return(()=>{var e=W();return e._$owner=u(),e})()},get children(){var e=T();return e._$owner=u(),e}}));