@kitnai/chat 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/custom-elements.json +2494 -0
- package/dist/kitn-chat.es.js +52 -39
- package/dist/llms/llms-full.txt +667 -0
- package/dist/llms/llms.txt +104 -0
- package/dist/theme.tokens.css +133 -0
- package/frameworks/react/index.tsx +530 -0
- package/frameworks/react/runtime.tsx +94 -0
- package/llms-full.txt +667 -0
- package/llms.txt +104 -0
- package/package.json +34 -5
- package/src/components/attachments.tsx +4 -2
- package/src/components/chain-of-thought.tsx +1 -1
- package/src/components/chat-scope-picker.tsx +2 -2
- package/src/components/checkpoint.tsx +7 -3
- package/src/components/context.tsx +14 -18
- package/src/components/conversation-item.tsx +1 -1
- package/src/components/conversation-list.tsx +5 -4
- package/src/components/message-skills.tsx +1 -1
- package/src/components/message.tsx +1 -0
- package/src/components/model-switcher.tsx +3 -3
- package/src/components/prompt-input.tsx +15 -2
- package/src/components/reasoning.tsx +2 -2
- package/src/components/scroll-button.tsx +1 -0
- package/src/components/slash-command.tsx +17 -8
- package/src/components/source.tsx +2 -2
- package/src/components/thinking-bar.tsx +2 -2
- package/src/components/tool.tsx +17 -6
- package/src/components/voice-input.tsx +5 -1
- package/src/elements/attachments.tsx +132 -0
- package/src/elements/chain-of-thought.tsx +45 -0
- package/src/elements/chat-scope-picker.tsx +36 -0
- package/src/elements/chat.tsx +51 -7
- package/src/elements/checkpoint.tsx +43 -0
- package/src/elements/code-block.tsx +42 -0
- package/src/elements/compiled.css +1 -1
- package/src/elements/context-meter.tsx +71 -0
- package/src/elements/conversation-list.tsx +6 -0
- package/src/elements/default-input.tsx +22 -1
- package/src/elements/define.tsx +97 -11
- package/src/elements/element-types.d.ts +404 -0
- package/src/elements/empty.tsx +29 -0
- package/src/elements/feedback-bar.tsx +33 -0
- package/src/elements/file-upload.tsx +44 -0
- package/src/elements/image.tsx +32 -0
- package/src/elements/kitn-attachments.stories.tsx +181 -0
- package/src/elements/kitn-chain-of-thought.stories.tsx +75 -0
- package/src/elements/kitn-chat-scope-picker.stories.tsx +72 -0
- package/src/elements/kitn-checkpoint.stories.tsx +71 -0
- package/src/elements/kitn-code-block.stories.tsx +82 -0
- package/src/elements/kitn-context-meter.stories.tsx +85 -0
- package/src/elements/kitn-empty.stories.tsx +110 -0
- package/src/elements/kitn-feedback-bar.stories.tsx +73 -0
- package/src/elements/kitn-file-upload.stories.tsx +81 -0
- package/src/elements/kitn-image.stories.tsx +70 -0
- package/src/elements/kitn-loader.stories.tsx +87 -0
- package/src/elements/kitn-markdown.stories.tsx +75 -0
- package/src/elements/kitn-message-skills.stories.tsx +74 -0
- package/src/elements/kitn-message.stories.tsx +105 -0
- package/src/elements/kitn-model-switcher.stories.tsx +80 -0
- package/src/elements/kitn-prompt-input.stories.tsx +74 -16
- package/src/elements/kitn-prompt-suggestions.stories.tsx +157 -0
- package/src/elements/kitn-reasoning.stories.tsx +76 -0
- package/src/elements/kitn-response-stream.stories.tsx +79 -0
- package/src/elements/kitn-source-list.stories.tsx +77 -0
- package/src/elements/kitn-source.stories.tsx +87 -0
- package/src/elements/kitn-text-shimmer.stories.tsx +63 -0
- package/src/elements/kitn-thinking-bar.stories.tsx +72 -0
- package/src/elements/kitn-tool.stories.tsx +88 -0
- package/src/elements/kitn-voice-input.stories.tsx +87 -0
- package/src/elements/loader.tsx +25 -0
- package/src/elements/markdown.tsx +38 -0
- package/src/elements/message-skills.tsx +22 -0
- package/src/elements/message.tsx +125 -0
- package/src/elements/model-switcher.tsx +35 -0
- package/src/elements/prompt-input.tsx +83 -7
- package/src/elements/prompt-suggestions.tsx +58 -0
- package/src/elements/reasoning.tsx +50 -0
- package/src/elements/register.ts +31 -0
- package/src/elements/response-stream.tsx +40 -0
- package/src/elements/source.tsx +67 -0
- package/src/elements/text-shimmer.tsx +28 -0
- package/src/elements/thinking-bar.tsx +34 -0
- package/src/elements/tool.tsx +23 -0
- package/src/elements/voice-input.tsx +41 -0
- package/src/index.ts +0 -1
- package/src/primitives/chat-config.tsx +2 -2
- package/src/stories/docs/Accessibility.mdx +119 -0
- package/src/stories/docs/ForAIAgents.mdx +93 -0
- package/src/stories/docs/GettingStarted.mdx +2 -2
- package/src/stories/docs/Installation.mdx +2 -2
- package/src/stories/docs/Integrations.mdx +415 -15
- package/src/stories/docs/Introduction.mdx +5 -5
- package/src/stories/docs/Theming.mdx +1 -1
- package/src/stories/typography.stories.tsx +78 -0
- package/src/ui/button.tsx +1 -1
- package/src/ui/collapsible.tsx +119 -8
- package/src/ui/dropdown.tsx +177 -12
- package/src/ui/hover-card.tsx +147 -26
- package/src/ui/overlay.tsx +151 -0
- package/src/ui/textarea.tsx +1 -1
- package/src/ui/tooltip.stories.tsx +1 -1
- package/src/ui/tooltip.tsx +59 -13
- package/src/utils/cn.ts +19 -1
- package/theme.css +72 -43
- package/src/ui/dialog.tsx +0 -21
package/src/elements/define.tsx
CHANGED
|
@@ -1,7 +1,29 @@
|
|
|
1
1
|
import { customElement } from 'solid-element';
|
|
2
2
|
import { ChatConfig } from '../primitives/chat-config';
|
|
3
3
|
import { KITN_CSS } from './css';
|
|
4
|
-
import { createSignal, onCleanup, type JSX } from 'solid-js';
|
|
4
|
+
import { createSignal, onCleanup, onMount, Show, type JSX } from 'solid-js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Shared constructable stylesheet, built once and adopted by every element's
|
|
8
|
+
* shadow root. This avoids duplicating the full compiled kit CSS (~77 KB) as an
|
|
9
|
+
* inline `<style>` in each instance — important now that composing many small
|
|
10
|
+
* elements on a page is a supported pattern. Falls back to `null` where
|
|
11
|
+
* Constructable Stylesheets aren't available, in which case the facade renders
|
|
12
|
+
* an inline `<style>` instead (see below).
|
|
13
|
+
*/
|
|
14
|
+
let sharedSheet: CSSStyleSheet | null | undefined;
|
|
15
|
+
function getSharedSheet(): CSSStyleSheet | null {
|
|
16
|
+
if (sharedSheet !== undefined) return sharedSheet;
|
|
17
|
+
try {
|
|
18
|
+
if (typeof CSSStyleSheet === 'undefined') throw new Error('no CSSStyleSheet');
|
|
19
|
+
const sheet = new CSSStyleSheet();
|
|
20
|
+
sheet.replaceSync(KITN_CSS);
|
|
21
|
+
sharedSheet = sheet;
|
|
22
|
+
} catch {
|
|
23
|
+
sharedSheet = null;
|
|
24
|
+
}
|
|
25
|
+
return sharedSheet;
|
|
26
|
+
}
|
|
5
27
|
|
|
6
28
|
/** Resolve whether the element should render dark, given its `theme` and the
|
|
7
29
|
* system preference. `auto` (the default) follows `prefers-color-scheme`. */
|
|
@@ -20,15 +42,45 @@ function createDarkMode(getTheme: () => string | undefined) {
|
|
|
20
42
|
};
|
|
21
43
|
}
|
|
22
44
|
|
|
23
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Context handed to every element facade. `E` is the element's event map —
|
|
47
|
+
* `{ eventName: detailType }` — which types `dispatch` so a facade can only fire
|
|
48
|
+
* its declared events with the right `detail` shape.
|
|
49
|
+
*/
|
|
50
|
+
export interface KitnElementContext<E = Record<string, unknown>> {
|
|
24
51
|
/** The custom-element host node. */
|
|
25
52
|
element: HTMLElement;
|
|
26
53
|
/** Fire a non-bubbling, non-composed CustomEvent off the host. Consumers
|
|
27
|
-
* listen directly on the element (`el.addEventListener(...)`).
|
|
28
|
-
|
|
54
|
+
* listen directly on the element (`el.addEventListener(...)`). Typed by the
|
|
55
|
+
* element's event map `E`. */
|
|
56
|
+
dispatch: <K extends keyof E & string>(type: K, detail?: E[K]) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a boolean flag from a prop the way HTML authors expect.
|
|
59
|
+
*
|
|
60
|
+
* `component-register` parses a *bare* boolean attribute (`<el removable>`) to
|
|
61
|
+
* `undefined`, not `true` — so a facade can't rely on the prop value alone.
|
|
62
|
+
* `flag('removable')` returns ON when the property is `true`, OR when the
|
|
63
|
+
* matching attribute is present and not explicitly `="false"`. So all of
|
|
64
|
+
* `<el removable>`, `<el removable="true">`, and `el.removable = true` turn it
|
|
65
|
+
* on; `<el removable="false">`, absent, and `el.removable = false` turn it off.
|
|
66
|
+
*
|
|
67
|
+
* `name` is the camelCase prop name; the matching kebab attribute is derived.
|
|
68
|
+
*/
|
|
69
|
+
flag: (name: string) => boolean;
|
|
29
70
|
}
|
|
30
71
|
|
|
31
|
-
|
|
72
|
+
/** camelCase prop name → kebab-case attribute (`hoverCard` → `hover-card`). */
|
|
73
|
+
function toAttr(name: string): string {
|
|
74
|
+
return name.replace(/([A-Z])/g, '-$1').toLowerCase();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Underlying flag resolution; see `KitnElementContext.flag`. */
|
|
78
|
+
function resolveFlag(element: HTMLElement, value: unknown, attribute: string): boolean {
|
|
79
|
+
if (value === true) return true;
|
|
80
|
+
return element.hasAttribute(attribute) && element.getAttribute(attribute) !== 'false';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
type FacadeComponent<P, E> = (props: P, ctx: KitnElementContext<E>) => JSX.Element;
|
|
32
84
|
|
|
33
85
|
/**
|
|
34
86
|
* Register a Solid facade as a Shadow-DOM custom element.
|
|
@@ -42,13 +94,30 @@ type FacadeComponent<P> = (props: P, ctx: KitnElementContext) => JSX.Element;
|
|
|
42
94
|
* the element, so bubbling/composed would only cause consumer collisions).
|
|
43
95
|
* - Idempotent: redefining an already-registered tag is a no-op.
|
|
44
96
|
*/
|
|
45
|
-
export function defineKitnElement<P extends Record<string, unknown>>(
|
|
97
|
+
export function defineKitnElement<P extends Record<string, unknown>, E = Record<string, unknown>>(
|
|
46
98
|
tag: string,
|
|
47
99
|
propDefaults: P,
|
|
48
|
-
Facade: FacadeComponent<P>,
|
|
100
|
+
Facade: FacadeComponent<P, E>,
|
|
49
101
|
): void {
|
|
50
102
|
if (typeof customElements !== 'undefined' && customElements.get(tag)) return;
|
|
51
103
|
|
|
104
|
+
// Guard against prop names that collide with global reflected HTMLElement IDL
|
|
105
|
+
// attributes. component-register sets `this[prop] = undefined` in the element
|
|
106
|
+
// constructor; for these, the native setter coerces undefined → "undefined"
|
|
107
|
+
// and reflects it to an attribute — which is illegal in a CE constructor and
|
|
108
|
+
// throws a cryptic "result must not have attributes". Fail loud and early with
|
|
109
|
+
// a name + fix instead. (Use a prefixed attribute, e.g. `bar-title`/`headline`.)
|
|
110
|
+
const RESERVED = ['title', 'id', 'slot', 'lang'];
|
|
111
|
+
for (const key of Object.keys(propDefaults)) {
|
|
112
|
+
if (RESERVED.includes(key)) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
`defineKitnElement(${tag}): prop "${key}" collides with a global HTMLElement ` +
|
|
115
|
+
`attribute and will break the element constructor. Rename it (e.g. ` +
|
|
116
|
+
`"bar-title" → barTitle, a source title → headline).`,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
52
121
|
// Every element gets a `theme` property/attribute: 'light' | 'dark' | 'auto'
|
|
53
122
|
// (default 'auto' = follow the OS `prefers-color-scheme`). It drives a `.dark`
|
|
54
123
|
// class on an inner wrapper, which the injected kit CSS already styles — so dark
|
|
@@ -59,16 +128,33 @@ export function defineKitnElement<P extends Record<string, unknown>>(
|
|
|
59
128
|
const element = options.element as HTMLElement;
|
|
60
129
|
let portalNode!: HTMLDivElement;
|
|
61
130
|
|
|
62
|
-
const dispatch = (type: string, detail?: unknown) =>
|
|
131
|
+
const dispatch = ((type: string, detail?: unknown) =>
|
|
63
132
|
element.dispatchEvent(
|
|
64
133
|
new CustomEvent(type, { detail, bubbles: false, composed: false }),
|
|
65
|
-
);
|
|
134
|
+
)) as KitnElementContext<E>['dispatch'];
|
|
135
|
+
|
|
136
|
+
// Reads `props[name]` (reactive) and falls back to attribute presence so
|
|
137
|
+
// bare boolean attributes behave like normal HTML. See KitnElementContext.
|
|
138
|
+
const flag = (name: string) =>
|
|
139
|
+
resolveFlag(element, (props as Record<string, unknown>)[name], toAttr(name));
|
|
66
140
|
|
|
67
141
|
const isDark = createDarkMode(() => props.theme as string | undefined);
|
|
68
142
|
|
|
143
|
+
// Prefer a single shared stylesheet adopted into this shadow root; only emit
|
|
144
|
+
// an inline <style> when Constructable Stylesheets aren't supported.
|
|
145
|
+
const sheet = getSharedSheet();
|
|
146
|
+
onMount(() => {
|
|
147
|
+
const root = element.shadowRoot;
|
|
148
|
+
if (sheet && root && 'adoptedStyleSheets' in root) {
|
|
149
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
69
153
|
return (
|
|
70
154
|
<>
|
|
71
|
-
<
|
|
155
|
+
<Show when={!sheet}>
|
|
156
|
+
<style>{KITN_CSS}</style>
|
|
157
|
+
</Show>
|
|
72
158
|
{/* display:contents — no layout box; carries the .dark token scope and
|
|
73
159
|
re-roots the inherited `color` to the active mode's foreground, so text
|
|
74
160
|
without an explicit color class (e.g. attachment filename labels) follows
|
|
@@ -76,7 +162,7 @@ export function defineKitnElement<P extends Record<string, unknown>>(
|
|
|
76
162
|
<div classList={{ dark: isDark() }} style={{ display: 'contents', color: 'var(--color-foreground)' }}>
|
|
77
163
|
<div ref={portalNode} />
|
|
78
164
|
<ChatConfig portalMount={portalNode}>
|
|
79
|
-
{Facade(props as unknown as P, { element, dispatch })}
|
|
165
|
+
{Facade(props as unknown as P, { element, dispatch, flag })}
|
|
80
166
|
</ChatConfig>
|
|
81
167
|
</div>
|
|
82
168
|
</>
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
// AUTO-GENERATED by scripts/gen-element-api.mjs — do not edit by hand.
|
|
2
|
+
// Typed custom-element interfaces + HTMLElementTagNameMap augmentation, so
|
|
3
|
+
// `document.querySelector('kitn-message')` is typed and gets prop autocomplete.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
// Re-exports for `import { … } from '@kitnai/chat/elements'`.
|
|
7
|
+
export type { ChatMessage, ChatMessageAction } from './chat-types';
|
|
8
|
+
export { configureCodeHighlighting, isCodeHighlightingEnabled } from '../primitives/highlighter';
|
|
9
|
+
export type { CodeHighlightingOptions } from '../primitives/highlighter';
|
|
10
|
+
|
|
11
|
+
export interface KitnAttachmentsElement extends HTMLElement {
|
|
12
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
13
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
14
|
+
/** The attachments to render. Set as a JS property (array). */
|
|
15
|
+
items: { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[];
|
|
16
|
+
/** Layout: `grid` = visual tiles, `inline` = icon + label chips, `list` = rows. */
|
|
17
|
+
variant?: "grid" | "inline" | "list";
|
|
18
|
+
/** Wrap each item in a hover card that previews its details. */
|
|
19
|
+
hoverCard?: boolean;
|
|
20
|
+
/** Show a remove button per item; clicking it fires a `remove` event. */
|
|
21
|
+
removable?: boolean;
|
|
22
|
+
/** Also show the media type beneath the filename (non-grid variants). */
|
|
23
|
+
showMediaType?: boolean;
|
|
24
|
+
/** Text shown when `items` is empty. */
|
|
25
|
+
emptyText?: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface KitnChainOfThoughtElement extends HTMLElement {
|
|
29
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
30
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
31
|
+
/** The reasoning steps. Set as a JS property. Compound sub-parts collapse to this one data model (Route 1). */
|
|
32
|
+
steps: { label: string; content?: undefined | string }[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface KitnChatElement extends HTMLElement {
|
|
36
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
37
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
38
|
+
/** The full message thread to render, newest last. Each entry carries its role, content, and optional reasoning/tools/attachments/actions. Set as a JS property (`el.messages = [...]`). */
|
|
39
|
+
messages: { id: string; role: "user" | "assistant"; content: string; reasoning?: undefined | { text: string; label?: undefined | string }; tools?: undefined | { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: undefined | Record<string, unknown>; output?: undefined | Record<string, unknown>; toolCallId?: undefined | string; errorText?: undefined | string }[]; attachments?: undefined | { id: string; type: "file" | "source-document"; filename?: undefined | string; mediaType?: undefined | string; url?: undefined | string; title?: undefined | string }[]; actions?: undefined | ("copy" | "like" | "dislike" | "regenerate" | "edit")[] }[];
|
|
40
|
+
/** Controlled value of the input. When set, the host owns the input text and must update it on `valuechange`; leave unset for uncontrolled behavior. */
|
|
41
|
+
value?: string;
|
|
42
|
+
/** Placeholder text shown in the empty input. */
|
|
43
|
+
placeholder?: string;
|
|
44
|
+
/** When true, shows the loading/streaming state and disables submit (use while awaiting the assistant's reply). */
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
/** Starter prompts shown above the input when the thread is empty. Clicking one follows `suggestionMode`. Set as a JS property. */
|
|
47
|
+
suggestions?: string[];
|
|
48
|
+
/** What clicking a suggestion does: `'submit'` (default) sends it immediately as if typed and submitted; `'fill'` just places it in the input. */
|
|
49
|
+
suggestionMode?: "submit" | "fill";
|
|
50
|
+
/** Body/prose font scale for rendered markdown (`'xs' | 'sm' | 'base' | 'lg'`). Defaults to `'sm'`. */
|
|
51
|
+
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
52
|
+
/** Shiki theme name for syntax-highlighted code blocks (e.g. `'github-dark-dimmed'`). */
|
|
53
|
+
codeTheme?: string;
|
|
54
|
+
/** Enable Shiki syntax highlighting in code blocks. Turn off to render plain `<pre>` blocks (lighter, no highlighter load). Default true. */
|
|
55
|
+
codeHighlight?: boolean;
|
|
56
|
+
/** Optional header title shown on the left of the header. */
|
|
57
|
+
chatTitle?: string;
|
|
58
|
+
/** Optional model list. When set (>1 model) a ModelSwitcher is shown in the header and a `modelchange` event fires on selection. */
|
|
59
|
+
models?: { id: string; name: string; provider?: string }[];
|
|
60
|
+
/** The currently selected model id (pairs with `models`). */
|
|
61
|
+
currentModel?: string;
|
|
62
|
+
/** Optional context-window token usage. When set, a Context token meter is shown in the header. */
|
|
63
|
+
context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; estimatedCost?: number };
|
|
64
|
+
/** Show the scroll-to-bottom button inside the scroll area. Default true. */
|
|
65
|
+
scrollButton?: boolean;
|
|
66
|
+
/** Show a Search (Globe) button in the input toolbar; fires a `search` event. */
|
|
67
|
+
search?: boolean;
|
|
68
|
+
/** Show a Voice (Mic) button in the input toolbar; fires a `voice` event. */
|
|
69
|
+
voice?: boolean;
|
|
70
|
+
/** Slash commands — when set, typing `/` in the input opens the command palette and fires `slashselect`. Set as a JS property. */
|
|
71
|
+
slashCommands?: { id: string; label: string; description?: string; category?: string }[];
|
|
72
|
+
/** Command ids to highlight as active in the palette. */
|
|
73
|
+
slashActiveIds?: string[];
|
|
74
|
+
/** Single-line palette rows. */
|
|
75
|
+
slashCompact?: boolean;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface KitnChatScopePickerElement extends HTMLElement {
|
|
79
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
80
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
81
|
+
/** Authors to offer as scope filters. Set as a JS property. */
|
|
82
|
+
availableAuthors: string[];
|
|
83
|
+
/** Tags to offer as scope filters. Set as a JS property. */
|
|
84
|
+
availableTags: string[];
|
|
85
|
+
/** The label shown on the trigger for the active scope. */
|
|
86
|
+
currentLabel?: string;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface KitnCheckpointElement extends HTMLElement {
|
|
90
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
91
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
92
|
+
/** Optional text beside the icon. */
|
|
93
|
+
label?: string;
|
|
94
|
+
/** Tooltip on hover. */
|
|
95
|
+
tooltip?: string;
|
|
96
|
+
/** Visual button style. */
|
|
97
|
+
variant?: "ghost" | "default" | "outline";
|
|
98
|
+
/** Button size (use an `icon*` size for an icon-only checkpoint). */
|
|
99
|
+
size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface KitnCodeBlockElement extends HTMLElement {
|
|
103
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
104
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
105
|
+
/** The source code to render. */
|
|
106
|
+
code: string;
|
|
107
|
+
/** Language grammar (e.g. `js`, `python`). Defaults to `tsx`. */
|
|
108
|
+
language?: string;
|
|
109
|
+
/** Shiki theme name. */
|
|
110
|
+
codeTheme?: string;
|
|
111
|
+
/** Disable syntax highlighting (renders plain text, no Shiki). */
|
|
112
|
+
codeHighlight?: boolean;
|
|
113
|
+
/** Code text sizing. */
|
|
114
|
+
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface KitnContextMeterElement extends HTMLElement {
|
|
118
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
119
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
120
|
+
/** Token-usage data. Set as a JS property. */
|
|
121
|
+
context?: { usedTokens: number; maxTokens: number; inputTokens?: number; outputTokens?: number; reasoningTokens?: number; cacheTokens?: number; estimatedCost?: number };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface KitnConversationListElement extends HTMLElement {
|
|
125
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
126
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
127
|
+
/** Pre-bucketed conversation groups (e.g. "Today", "Yesterday"), each with its own conversations. Use this when you want to control the grouping/headers yourself; otherwise pass a flat `conversations` array. Set as a JS property. */
|
|
128
|
+
groups: { id: string; userId?: undefined | string; teamId?: undefined | string; name: string; sortOrder: number; createdAt: string }[];
|
|
129
|
+
/** A flat list of conversation summaries; the component buckets them by recency for you. Ignored when `groups` is provided. Set as a JS property. */
|
|
130
|
+
conversations: { id: string; title: string; groupId?: undefined | string; scope: { type: "document" | "collection"; documentId?: undefined | string; filters?: undefined | { tags?: undefined | string[]; authors?: undefined | string[]; contentType?: undefined | "transcript" | "markdown"; dateRange?: undefined | { from: string; to: string } } }; messageCount: number; lastMessageAt: string; updatedAt: string }[];
|
|
131
|
+
/** The id of the currently-open conversation, highlighted in the list. */
|
|
132
|
+
activeId?: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface KitnEmptyElement extends HTMLElement {
|
|
136
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
137
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
138
|
+
/** Title text. Attribute: `empty-title` (`title` is a global HTML attribute). */
|
|
139
|
+
emptyTitle?: string;
|
|
140
|
+
/** Description text. */
|
|
141
|
+
description?: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface KitnFeedbackBarElement extends HTMLElement {
|
|
145
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
146
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
147
|
+
/** The banner label (e.g. "Was this helpful?"). Attribute: `bar-title` (`title` is avoided — it's a global HTML attribute). */
|
|
148
|
+
barTitle?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface KitnFileUploadElement extends HTMLElement {
|
|
152
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
153
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
154
|
+
/** Allow selecting multiple files (default true). */
|
|
155
|
+
multiple?: boolean;
|
|
156
|
+
/** `accept` attribute for the file picker (e.g. `image/*`). */
|
|
157
|
+
accept?: string;
|
|
158
|
+
/** Disable the dropzone — no clicking, no drag-and-drop. */
|
|
159
|
+
disabled?: boolean;
|
|
160
|
+
/** Default dropzone label (overridable via the default slot). */
|
|
161
|
+
label?: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface KitnImageElement extends HTMLElement {
|
|
165
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
166
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
167
|
+
/** Base64-encoded image data (pair with `media-type`). */
|
|
168
|
+
base64?: string;
|
|
169
|
+
/** Raw image bytes (set as a JS property). */
|
|
170
|
+
bytes?: Uint8Array;
|
|
171
|
+
/** Alt text. */
|
|
172
|
+
alt?: string;
|
|
173
|
+
/** MIME type (default `image/png`). */
|
|
174
|
+
mediaType?: string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface KitnLoaderElement extends HTMLElement {
|
|
178
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
179
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
180
|
+
/** The animation style: `'circular' | 'classic' | 'pulse' | 'pulse-dot' | 'dots' | 'typing' | 'wave' | 'bars' | 'terminal' | 'text-blink' | 'text-shimmer' | 'loading-dots'`. Defaults to `'circular'`. */
|
|
181
|
+
variant?: "circular" | "classic" | "pulse" | "pulse-dot" | "dots" | "typing" | "wave" | "bars" | "terminal" | "text-blink" | "text-shimmer" | "loading-dots";
|
|
182
|
+
/** Loader size: `'sm' | 'md' | 'lg'`. Defaults to `'md'`. */
|
|
183
|
+
size?: "sm" | "lg" | "md";
|
|
184
|
+
/** Label for the text-based variants. */
|
|
185
|
+
text?: string;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export interface KitnMarkdownElement extends HTMLElement {
|
|
189
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
190
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
191
|
+
/** The markdown source to render. */
|
|
192
|
+
content: string;
|
|
193
|
+
/** Text/markdown sizing. */
|
|
194
|
+
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
195
|
+
/** Shiki theme for fenced code blocks. */
|
|
196
|
+
codeTheme?: string;
|
|
197
|
+
/** Disable syntax highlighting (no Shiki loads). */
|
|
198
|
+
codeHighlight?: boolean;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface KitnMessageElement extends HTMLElement {
|
|
202
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
203
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
204
|
+
/** The full message object. Set as a JS property. */
|
|
205
|
+
message?: { id: string; role: "user" | "assistant"; content: string; reasoning?: { text: string; label?: string }; tools?: { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; output?: Record<string, unknown>; toolCallId?: string; errorText?: string }[]; attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[]; actions?: ("copy" | "like" | "dislike" | "regenerate" | "edit")[] };
|
|
206
|
+
/** Convenience for simple cases when not passing a `message` object. */
|
|
207
|
+
role?: "user" | "assistant";
|
|
208
|
+
/** Convenience content (used when `message` is not set). */
|
|
209
|
+
content?: string;
|
|
210
|
+
/** Force markdown on/off. Defaults to on for assistant, off for user. */
|
|
211
|
+
markdown?: boolean;
|
|
212
|
+
/** Text/markdown sizing for the message body. */
|
|
213
|
+
proseSize?: "xs" | "sm" | "base" | "lg";
|
|
214
|
+
/** Shiki theme name used for fenced code blocks in the content. */
|
|
215
|
+
codeTheme?: string;
|
|
216
|
+
/** Disable syntax highlighting for code blocks (no Shiki loads). */
|
|
217
|
+
codeHighlight?: boolean;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export interface KitnMessageSkillsElement extends HTMLElement {
|
|
221
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
222
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
223
|
+
/** The active skills to badge. Set as a JS property. */
|
|
224
|
+
skills: { id: string; name: string }[];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface KitnModelSwitcherElement extends HTMLElement {
|
|
228
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
229
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
230
|
+
/** The selectable models. Set as a JS property (array). */
|
|
231
|
+
models: { id: string; name: string; provider?: undefined | string }[];
|
|
232
|
+
/** The currently-selected model id. Defaults to the first model. */
|
|
233
|
+
currentModel?: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export interface KitnPromptInputElement extends HTMLElement {
|
|
237
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
238
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
239
|
+
/** Controlled value of the input. When set, the host owns the text and must update it on `valuechange`; leave unset for uncontrolled behavior. */
|
|
240
|
+
value?: string;
|
|
241
|
+
/** Placeholder text shown in the empty input. */
|
|
242
|
+
placeholder?: string;
|
|
243
|
+
/** Disable the input and submit button entirely (non-interactive). */
|
|
244
|
+
disabled?: boolean;
|
|
245
|
+
/** Show the loading/streaming state and block submit (use while awaiting a reply). */
|
|
246
|
+
loading?: boolean;
|
|
247
|
+
/** Starter prompts shown above the input. Clicking one follows `suggestionMode`. Set as a JS property. */
|
|
248
|
+
suggestions?: string[];
|
|
249
|
+
/** What clicking a suggestion does: `'submit'` (default) sends it immediately as if typed and submitted; `'fill'` just places it in the input. */
|
|
250
|
+
suggestionMode?: "submit" | "fill";
|
|
251
|
+
/** Slash commands — when set, typing `/` opens the command palette. Set as a JS property. */
|
|
252
|
+
slashCommands?: { id: string; label: string; description?: string; category?: string }[];
|
|
253
|
+
/** Command ids to highlight as active. */
|
|
254
|
+
slashActiveIds?: string[];
|
|
255
|
+
/** Single-line palette rows. */
|
|
256
|
+
slashCompact?: boolean;
|
|
257
|
+
/** Show a Search (Globe) button in the left toolbar; clicking it fires a `search` event. */
|
|
258
|
+
search?: boolean;
|
|
259
|
+
/** Show a Voice (Mic) button in the left toolbar; clicking it fires a `voice` event. */
|
|
260
|
+
voice?: boolean;
|
|
261
|
+
/** Attachments to seed the input with (so a consumer can pre-populate staged files without an upload). Set as a JS property; the element then manages its own attachment state from there (add via the paperclip, remove per chip). */
|
|
262
|
+
attachments?: { id: string; type: "file" | "source-document"; filename?: string; mediaType?: string; url?: string; title?: string }[];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface KitnPromptSuggestionsElement extends HTMLElement {
|
|
266
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
267
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
268
|
+
/** The suggestions. Strings, or `{ label, value }` when the displayed text and the emitted value differ. Set as a JS property. */
|
|
269
|
+
suggestions: (string | { label: string; value?: undefined | string })[];
|
|
270
|
+
/** Chip style: `'outline'` (default), `'ghost'`, or `'default'` (filled). */
|
|
271
|
+
variant?: "ghost" | "default" | "outline";
|
|
272
|
+
/** Size preset for each chip. Defaults to the pill default (`'lg'`); pass `'sm'` for smaller pills (or `'md'`). */
|
|
273
|
+
size?: "sm" | "lg" | "md" | "icon" | "icon-sm";
|
|
274
|
+
/** Full-width left-aligned rows instead of pills. */
|
|
275
|
+
block?: boolean;
|
|
276
|
+
/** Substring to highlight within each suggestion. */
|
|
277
|
+
highlight?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface KitnReasoningElement extends HTMLElement {
|
|
281
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
282
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
283
|
+
/** The reasoning text to display. */
|
|
284
|
+
text: string;
|
|
285
|
+
/** Trigger label. */
|
|
286
|
+
label?: string;
|
|
287
|
+
/** Controlled open state — set as a property (`el.open = true`). Omit for uncontrolled (the trigger toggles it). */
|
|
288
|
+
open?: boolean;
|
|
289
|
+
/** While true, auto-expands (and re-collapses when it flips false). */
|
|
290
|
+
streaming?: boolean;
|
|
291
|
+
/** Render `text` as markdown. */
|
|
292
|
+
markdown?: boolean;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
export interface KitnResponseStreamElement extends HTMLElement {
|
|
296
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
297
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
298
|
+
/** Text to stream. A string, or an `AsyncIterable<string>` (set as a JS property — async iterables can't be HTML attributes). */
|
|
299
|
+
text?: string | AsyncIterable<string>;
|
|
300
|
+
/** Reveal animation. */
|
|
301
|
+
mode?: "typewriter" | "fade";
|
|
302
|
+
/** Characters/segments per tick. */
|
|
303
|
+
speed?: number;
|
|
304
|
+
/** Element tag to render as. */
|
|
305
|
+
as?: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export interface KitnSourceElement extends HTMLElement {
|
|
309
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
310
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
311
|
+
/** The URL this citation links to (the domain also seeds the default label/favicon). */
|
|
312
|
+
href?: string;
|
|
313
|
+
/** Trigger label (defaults to the domain). */
|
|
314
|
+
label?: string;
|
|
315
|
+
/** Hover-card headline. Attribute: `headline` (`title` is avoided — it's a global HTML attribute that reflects in a CE constructor and breaks it). */
|
|
316
|
+
headline?: string;
|
|
317
|
+
/** Hover-card body text describing the source. */
|
|
318
|
+
description?: string;
|
|
319
|
+
/** Show the source's favicon next to the trigger label. */
|
|
320
|
+
showFavicon?: boolean;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface KitnSourceListElement extends HTMLElement {
|
|
324
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
325
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
326
|
+
/** The sources to render. Set as a JS property. */
|
|
327
|
+
sources: { href: string; title?: undefined | string; description?: undefined | string; label?: undefined | string; showFavicon?: undefined | boolean }[];
|
|
328
|
+
/** Show favicons on all items (per-item `showFavicon` overrides). */
|
|
329
|
+
showFavicon?: boolean;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export interface KitnTextShimmerElement extends HTMLElement {
|
|
333
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
334
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
335
|
+
/** The text to shimmer. */
|
|
336
|
+
text?: string;
|
|
337
|
+
/** Element tag to render as (default `span`). */
|
|
338
|
+
as?: string;
|
|
339
|
+
/** Animation duration in seconds. */
|
|
340
|
+
duration?: number;
|
|
341
|
+
/** Gradient spread (5–45). */
|
|
342
|
+
spread?: number;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface KitnThinkingBarElement extends HTMLElement {
|
|
346
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
347
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
348
|
+
/** The shimmering label, e.g. "Thinking…". */
|
|
349
|
+
text?: string;
|
|
350
|
+
/** When true, show a "stop" affordance that fires a `stop` event. */
|
|
351
|
+
stoppable?: boolean;
|
|
352
|
+
/** Label for the stop affordance. */
|
|
353
|
+
stopLabel?: string;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export interface KitnToolElement extends HTMLElement {
|
|
357
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
358
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
359
|
+
/** The tool-call to display. Set as a JS property. */
|
|
360
|
+
tool?: { type: string; state: "input-streaming" | "input-available" | "output-available" | "output-error"; input?: Record<string, unknown>; output?: Record<string, unknown>; toolCallId?: string; errorText?: string };
|
|
361
|
+
/** Start expanded. */
|
|
362
|
+
open?: boolean;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export interface KitnVoiceInputElement extends HTMLElement {
|
|
366
|
+
/** Color mode (`auto` follows prefers-color-scheme). */
|
|
367
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
368
|
+
/** Transcriber the host supplies — records audio, returns the text. This is a **function-valued property** (`el.transcribe = async blob => '...'`) because a value-returning callback can't be modelled as a fire-and-forget event. */
|
|
369
|
+
transcribe?: (audio: Blob) => Promise<string>;
|
|
370
|
+
/** Disable the mic button (non-interactive). */
|
|
371
|
+
disabled?: boolean;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
declare global {
|
|
375
|
+
interface HTMLElementTagNameMap {
|
|
376
|
+
'kitn-attachments': KitnAttachmentsElement;
|
|
377
|
+
'kitn-chain-of-thought': KitnChainOfThoughtElement;
|
|
378
|
+
'kitn-chat': KitnChatElement;
|
|
379
|
+
'kitn-chat-scope-picker': KitnChatScopePickerElement;
|
|
380
|
+
'kitn-checkpoint': KitnCheckpointElement;
|
|
381
|
+
'kitn-code-block': KitnCodeBlockElement;
|
|
382
|
+
'kitn-context-meter': KitnContextMeterElement;
|
|
383
|
+
'kitn-conversation-list': KitnConversationListElement;
|
|
384
|
+
'kitn-empty': KitnEmptyElement;
|
|
385
|
+
'kitn-feedback-bar': KitnFeedbackBarElement;
|
|
386
|
+
'kitn-file-upload': KitnFileUploadElement;
|
|
387
|
+
'kitn-image': KitnImageElement;
|
|
388
|
+
'kitn-loader': KitnLoaderElement;
|
|
389
|
+
'kitn-markdown': KitnMarkdownElement;
|
|
390
|
+
'kitn-message': KitnMessageElement;
|
|
391
|
+
'kitn-message-skills': KitnMessageSkillsElement;
|
|
392
|
+
'kitn-model-switcher': KitnModelSwitcherElement;
|
|
393
|
+
'kitn-prompt-input': KitnPromptInputElement;
|
|
394
|
+
'kitn-prompt-suggestions': KitnPromptSuggestionsElement;
|
|
395
|
+
'kitn-reasoning': KitnReasoningElement;
|
|
396
|
+
'kitn-response-stream': KitnResponseStreamElement;
|
|
397
|
+
'kitn-source': KitnSourceElement;
|
|
398
|
+
'kitn-source-list': KitnSourceListElement;
|
|
399
|
+
'kitn-text-shimmer': KitnTextShimmerElement;
|
|
400
|
+
'kitn-thinking-bar': KitnThinkingBarElement;
|
|
401
|
+
'kitn-tool': KitnToolElement;
|
|
402
|
+
'kitn-voice-input': KitnVoiceInputElement;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Show } from 'solid-js';
|
|
2
|
+
import { defineKitnElement } from './define';
|
|
3
|
+
import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from '../components/empty';
|
|
4
|
+
|
|
5
|
+
interface Props extends Record<string, unknown> {
|
|
6
|
+
/** Title text. Attribute: `empty-title` (`title` is a global HTML attribute). */
|
|
7
|
+
emptyTitle?: string;
|
|
8
|
+
/** Description text. */
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `<kitn-empty>` — an empty-state block. `empty-title`/`description` via
|
|
14
|
+
* attributes; slot your own icon into `slot="media"` and actions into the
|
|
15
|
+
* default slot (Route 2 slots).
|
|
16
|
+
*/
|
|
17
|
+
defineKitnElement<Props>('kitn-empty', {
|
|
18
|
+
emptyTitle: '',
|
|
19
|
+
description: '',
|
|
20
|
+
}, (props) => (
|
|
21
|
+
<Empty>
|
|
22
|
+
<EmptyHeader>
|
|
23
|
+
<EmptyMedia variant="icon"><slot name="media" /></EmptyMedia>
|
|
24
|
+
<Show when={props.emptyTitle}><EmptyTitle>{props.emptyTitle}</EmptyTitle></Show>
|
|
25
|
+
<Show when={props.description}><EmptyDescription>{props.description}</EmptyDescription></Show>
|
|
26
|
+
</EmptyHeader>
|
|
27
|
+
<EmptyContent><slot /></EmptyContent>
|
|
28
|
+
</Empty>
|
|
29
|
+
));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineKitnElement } from './define';
|
|
2
|
+
import { FeedbackBar } from '../components/feedback-bar';
|
|
3
|
+
|
|
4
|
+
interface Props extends Record<string, unknown> {
|
|
5
|
+
/** The banner label (e.g. "Was this helpful?"). Attribute: `bar-title`
|
|
6
|
+
* (`title` is avoided — it's a global HTML attribute). */
|
|
7
|
+
barTitle?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** Events fired by `<kitn-feedback-bar>`. */
|
|
11
|
+
interface Events {
|
|
12
|
+
/** The user clicked thumbs-up. */
|
|
13
|
+
helpful: void;
|
|
14
|
+
/** The user clicked thumbs-down. */
|
|
15
|
+
nothelpful: void;
|
|
16
|
+
/** The user dismissed the banner. */
|
|
17
|
+
close: void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* `<kitn-feedback-bar>` — an inline thumbs up/down feedback banner. Emits
|
|
22
|
+
* `helpful` / `nothelpful` / `close`.
|
|
23
|
+
*/
|
|
24
|
+
defineKitnElement<Props, Events>('kitn-feedback-bar', {
|
|
25
|
+
barTitle: 'Was this helpful?',
|
|
26
|
+
}, (props, { dispatch }) => (
|
|
27
|
+
<FeedbackBar
|
|
28
|
+
title={props.barTitle}
|
|
29
|
+
onHelpful={() => dispatch('helpful')}
|
|
30
|
+
onNotHelpful={() => dispatch('nothelpful')}
|
|
31
|
+
onClose={() => dispatch('close')}
|
|
32
|
+
/>
|
|
33
|
+
));
|