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.32 kB
import{s as d,c as r,m as g,n as h,S as c,F as u,t as n,f as p}from"./chunks/define-CNSKFZCd.js";import{c as v}from"./chunks/cn-CU7UAWzk.js";import{D as b,a as f,b as o,c as m}from"./chunks/dropdown-wgs8xCJZ.js";import{B as x}from"./chunks/button-DBDZebGr.js";import{w}from"./chunks/disclosure-BcBs--Jf.js";var A=n('<div class="px-2 py-1 text-[10px] uppercase tracking-wider text-muted-foreground">Authors'),C=n('<div class="px-2 py-1 text-[10px] uppercase tracking-wider text-muted-foreground">Tags'),k=n('<svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polygon points="22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3">'),S=n('<svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2><polyline points="6 9 12 15 18 9">');function T(a){const[e]=d(a,["currentLabel","onScopeChange","availableAuthors","availableTags","class","defaultOpen","disabled","controllerRef"]);return r(m,{get defaultOpen(){return e.defaultOpen},get disabled(){return e.disabled},get controllerRef(){return e.controllerRef},get children(){return[r(b,{as:t=>r(x,g({variant:"ghost",size:"sm",get class(){return v("gap-1 text-xs",e.class)}},t,{get children(){return[k(),h(()=>e.currentLabel),S()]}}))}),r(f,{class:"min-w-[180px]",get children(){return[r(o,{onSelect:()=>e.onScopeChange(void 0),children:"All Content"}),r(c,{get when(){var t;return(t=e.availableAuthors)==null?void 0:t.length},get children(){return[A(),r(u,{get each(){return e.availableAuthors},children:t=>r(o,{onSelect:()=>e.onScopeChange({authors:[t]}),children:t})})]}}),r(c,{get when(){var t;return(t=e.availableTags)==null?void 0:t.length},get children(){return[C(),r(u,{get each(){return e.availableTags},children:t=>r(o,{onSelect:()=>e.onScopeChange({tags:[t]}),children:t})})]}})]}})]}})}p("kai-scope-picker",{availableAuthors:[],availableTags:[],currentLabel:"All Content",open:void 0,defaultOpen:void 0,disabled:void 0},(a,e)=>{const{dispatch:t,flag:s}=e;let i;return w(e,()=>i,()=>a.open),r(T,{get currentLabel(){return a.currentLabel??"All Content"},get availableAuthors(){return a.availableAuthors},get availableTags(){return a.availableTags},onScopeChange:l=>t("kai-scope-change",{filters:l}),get defaultOpen(){return s("defaultOpen")},get disabled(){return s("disabled")},controllerRef:l=>i=l})});