@kitnai/chat 0.1.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/LICENSE +21 -0
- package/README.md +314 -0
- package/dist/bash-InADTalH.js +6 -0
- package/dist/core-AYMC6_lb.js +5874 -0
- package/dist/engine-javascript-vq0WuIJl.js +2643 -0
- package/dist/github-dark-dimmed-DUshB20C.js +4 -0
- package/dist/github-light-JYsPkUQd.js +4 -0
- package/dist/javascript-C25yR2R2.js +6 -0
- package/dist/json-DxJze_jm.js +6 -0
- package/dist/kitn-chat.es.js +6632 -0
- package/dist/tsx-B8rCNbgL.js +6 -0
- package/dist/typescript-RycA9KXf.js +6 -0
- package/package.json +80 -0
- package/src/components/attachments.stories.tsx +304 -0
- package/src/components/attachments.tsx +394 -0
- package/src/components/chain-of-thought.stories.tsx +212 -0
- package/src/components/chain-of-thought.tsx +139 -0
- package/src/components/chat-container.stories.tsx +188 -0
- package/src/components/chat-container.tsx +78 -0
- package/src/components/chat-scope-picker.tsx +47 -0
- package/src/components/checkpoint.stories.tsx +103 -0
- package/src/components/checkpoint.tsx +81 -0
- package/src/components/code-block.stories.tsx +151 -0
- package/src/components/code-block.tsx +99 -0
- package/src/components/context.stories.tsx +180 -0
- package/src/components/context.tsx +323 -0
- package/src/components/conversation-item.stories.tsx +126 -0
- package/src/components/conversation-item.tsx +18 -0
- package/src/components/conversation-list.stories.tsx +134 -0
- package/src/components/conversation-list.tsx +100 -0
- package/src/components/empty.stories.tsx +435 -0
- package/src/components/empty.tsx +166 -0
- package/src/components/feedback-bar.stories.tsx +101 -0
- package/src/components/feedback-bar.tsx +58 -0
- package/src/components/file-upload.stories.tsx +157 -0
- package/src/components/file-upload.tsx +161 -0
- package/src/components/image.stories.tsx +90 -0
- package/src/components/image.tsx +67 -0
- package/src/components/loader.stories.tsx +182 -0
- package/src/components/loader.tsx +333 -0
- package/src/components/markdown.stories.tsx +181 -0
- package/src/components/markdown.tsx +81 -0
- package/src/components/message-narrow.stories.tsx +330 -0
- package/src/components/message-skills.stories.tsx +212 -0
- package/src/components/message-skills.tsx +36 -0
- package/src/components/message.stories.tsx +282 -0
- package/src/components/message.tsx +149 -0
- package/src/components/model-switcher.stories.tsx +98 -0
- package/src/components/model-switcher.tsx +36 -0
- package/src/components/prompt-input.stories.tsx +223 -0
- package/src/components/prompt-input.tsx +190 -0
- package/src/components/prompt-suggestion.stories.tsx +143 -0
- package/src/components/prompt-suggestion.tsx +115 -0
- package/src/components/reasoning.stories.tsx +141 -0
- package/src/components/reasoning.tsx +157 -0
- package/src/components/response-stream.tsx +103 -0
- package/src/components/scroll-button.stories.tsx +101 -0
- package/src/components/scroll-button.tsx +33 -0
- package/src/components/slash-command.stories.tsx +164 -0
- package/src/components/slash-command.tsx +223 -0
- package/src/components/source.stories.tsx +125 -0
- package/src/components/source.tsx +129 -0
- package/src/components/text-shimmer.stories.tsx +88 -0
- package/src/components/text-shimmer.tsx +37 -0
- package/src/components/thinking-bar.stories.tsx +88 -0
- package/src/components/thinking-bar.tsx +50 -0
- package/src/components/tool.stories.tsx +154 -0
- package/src/components/tool.tsx +173 -0
- package/src/components/voice-input.stories.tsx +84 -0
- package/src/components/voice-input.tsx +103 -0
- package/src/elements/chat-types.ts +14 -0
- package/src/elements/chat.tsx +111 -0
- package/src/elements/compiled.css +2 -0
- package/src/elements/conversation-list.tsx +26 -0
- package/src/elements/css.ts +5 -0
- package/src/elements/default-input.tsx +53 -0
- package/src/elements/define.tsx +54 -0
- package/src/elements/kitn-chat.stories.tsx +105 -0
- package/src/elements/kitn-conversation-list.stories.tsx +177 -0
- package/src/elements/kitn-prompt-input.stories.tsx +123 -0
- package/src/elements/prompt-input.tsx +39 -0
- package/src/elements/register.ts +9 -0
- package/src/elements/styles.css +12 -0
- package/src/index.ts +128 -0
- package/src/primitives/chat-config.tsx +76 -0
- package/src/primitives/highlighter.ts +150 -0
- package/src/primitives/use-auto-resize.ts +31 -0
- package/src/primitives/use-stick-to-bottom.ts +43 -0
- package/src/primitives/use-text-stream.ts +112 -0
- package/src/primitives/use-voice-recorder.ts +50 -0
- package/src/stories/chat-panel-layout.stories.tsx +144 -0
- package/src/stories/chat-scene.tsx +570 -0
- package/src/stories/checkpoint-restore.stories.tsx +224 -0
- package/src/stories/context-usage.stories.tsx +155 -0
- package/src/stories/conversation-with-reasoning.stories.tsx +151 -0
- package/src/stories/conversation-with-sources.stories.tsx +165 -0
- package/src/stories/docs/GettingStarted.mdx +76 -0
- package/src/stories/docs/Installation.mdx +48 -0
- package/src/stories/docs/Integrations.mdx +110 -0
- package/src/stories/docs/Introduction.mdx +29 -0
- package/src/stories/docs/Theming.mdx +87 -0
- package/src/stories/docs/theme-editor/canvas.tsx +32 -0
- package/src/stories/docs/theme-editor/inspector.tsx +66 -0
- package/src/stories/docs/theme-editor/presets.test.ts +32 -0
- package/src/stories/docs/theme-editor/presets.ts +64 -0
- package/src/stories/docs/theme-editor/theme-css.test.ts +19 -0
- package/src/stories/docs/theme-editor/theme-css.ts +15 -0
- package/src/stories/docs/theme-editor/theme-editor.tsx +145 -0
- package/src/stories/docs/theme-tokens.tsx +174 -0
- package/src/stories/full-chat.stories.tsx +18 -0
- package/src/stories/message-actions.stories.tsx +167 -0
- package/src/stories/prompt-input-variants.stories.tsx +179 -0
- package/src/stories/streaming-response.stories.tsx +234 -0
- package/src/stories/theme-editor.stories.tsx +16 -0
- package/src/stories/token-reference.stories.tsx +18 -0
- package/src/types.ts +41 -0
- package/src/ui/avatar.stories.tsx +104 -0
- package/src/ui/avatar.tsx +23 -0
- package/src/ui/badge.stories.tsx +87 -0
- package/src/ui/badge.tsx +21 -0
- package/src/ui/button.stories.tsx +146 -0
- package/src/ui/button.tsx +37 -0
- package/src/ui/collapsible.tsx +14 -0
- package/src/ui/dialog.tsx +21 -0
- package/src/ui/dropdown.tsx +26 -0
- package/src/ui/hover-card.tsx +48 -0
- package/src/ui/resizable.stories.tsx +171 -0
- package/src/ui/resizable.tsx +219 -0
- package/src/ui/scroll-area.tsx +13 -0
- package/src/ui/separator.stories.tsx +82 -0
- package/src/ui/separator.tsx +10 -0
- package/src/ui/skeleton.stories.tsx +338 -0
- package/src/ui/skeleton.tsx +16 -0
- package/src/ui/textarea.tsx +21 -0
- package/src/ui/tooltip.stories.tsx +75 -0
- package/src/ui/tooltip.tsx +22 -0
- package/src/utils/cn.ts +6 -0
- package/theme.css +115 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { splitProps, For, Show, createSignal, createMemo } from 'solid-js';
|
|
2
|
+
import { cn } from '../utils/cn';
|
|
3
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from '../ui/collapsible';
|
|
4
|
+
import { Button } from '../ui/button';
|
|
5
|
+
import { Badge } from '../ui/badge';
|
|
6
|
+
import { ScrollArea } from '../ui/scroll-area';
|
|
7
|
+
import { ConversationItem } from './conversation-item';
|
|
8
|
+
import type { ConversationSummary, ConversationGroup } from '../types';
|
|
9
|
+
|
|
10
|
+
export interface ConversationListProps {
|
|
11
|
+
groups: ConversationGroup[];
|
|
12
|
+
conversations: ConversationSummary[];
|
|
13
|
+
activeId?: string;
|
|
14
|
+
onSelect: (id: string) => void;
|
|
15
|
+
onNewChat: () => void;
|
|
16
|
+
onToggleSidebar?: () => void;
|
|
17
|
+
class?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function ConversationList(props: ConversationListProps) {
|
|
21
|
+
const [local] = splitProps(props, ['groups', 'conversations', 'activeId', 'onSelect', 'onNewChat', 'onToggleSidebar', 'class']);
|
|
22
|
+
const [searchQuery, setSearchQuery] = createSignal('');
|
|
23
|
+
|
|
24
|
+
const filteredConversations = createMemo(() => {
|
|
25
|
+
const q = searchQuery().toLowerCase();
|
|
26
|
+
if (!q) return local.conversations;
|
|
27
|
+
return local.conversations.filter((c) => c.title.toLowerCase().includes(q));
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const groupedConversations = createMemo(() => {
|
|
31
|
+
const grouped = new Map<string | undefined, ConversationSummary[]>();
|
|
32
|
+
for (const conv of filteredConversations()) {
|
|
33
|
+
const key = conv.groupId;
|
|
34
|
+
if (!grouped.has(key)) grouped.set(key, []);
|
|
35
|
+
grouped.get(key)!.push(conv);
|
|
36
|
+
}
|
|
37
|
+
return grouped;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const ungrouped = createMemo(() => groupedConversations().get(undefined) ?? []);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div class={cn('flex flex-col h-full bg-sidebar', local.class)}>
|
|
44
|
+
<div class="flex items-center justify-between p-3 pb-2">
|
|
45
|
+
<div class="flex items-center gap-2">
|
|
46
|
+
<Button variant="ghost" size="icon-sm" onClick={local.onToggleSidebar}>
|
|
47
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="18" x2="21" y2="18"/></svg>
|
|
48
|
+
</Button>
|
|
49
|
+
<span class="text-sm font-semibold text-foreground">Chats</span>
|
|
50
|
+
</div>
|
|
51
|
+
<Button variant="ghost" size="icon-sm" onClick={local.onNewChat}>
|
|
52
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
|
|
53
|
+
</Button>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="px-3 pb-2">
|
|
56
|
+
<div class="flex items-center gap-2 rounded-md bg-muted/40 px-2.5 py-1.5">
|
|
57
|
+
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="text-muted-foreground/60"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>
|
|
58
|
+
<input type="text" value={searchQuery()} onInput={(e) => setSearchQuery(e.currentTarget.value)} placeholder="Search chats..."
|
|
59
|
+
class="bg-transparent text-[13px] text-foreground placeholder:text-muted-foreground/60 focus:outline-none w-full" />
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<ScrollArea class="flex-1 px-2">
|
|
63
|
+
<For each={local.groups}>
|
|
64
|
+
{(group) => {
|
|
65
|
+
const convs = createMemo(() => groupedConversations().get(group.id) ?? []);
|
|
66
|
+
return (
|
|
67
|
+
<Show when={convs().length > 0}>
|
|
68
|
+
<GroupSection name={group.name} count={convs().length} conversations={convs()} activeId={local.activeId} onSelect={local.onSelect} />
|
|
69
|
+
</Show>
|
|
70
|
+
);
|
|
71
|
+
}}
|
|
72
|
+
</For>
|
|
73
|
+
<Show when={ungrouped().length > 0}>
|
|
74
|
+
<GroupSection name="Ungrouped" count={ungrouped().length} conversations={ungrouped()} activeId={local.activeId} onSelect={local.onSelect} />
|
|
75
|
+
</Show>
|
|
76
|
+
</ScrollArea>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function GroupSection(props: { name: string; count: number; conversations: ConversationSummary[]; activeId?: string; onSelect: (id: string) => void }) {
|
|
82
|
+
const [open, setOpen] = createSignal(true);
|
|
83
|
+
return (
|
|
84
|
+
<Collapsible open={open()} onOpenChange={setOpen}>
|
|
85
|
+
<CollapsibleTrigger class="flex items-center gap-1.5 w-full px-1.5 py-1 rounded-md bg-muted/30 text-[13px] text-muted-foreground font-medium hover:bg-muted/50 transition-colors cursor-pointer mt-1.5">
|
|
86
|
+
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
|
|
87
|
+
class={cn('transition-transform', !open() && '-rotate-90')}><polyline points="6 9 12 15 18 9"/></svg>
|
|
88
|
+
<span>{props.name}</span>
|
|
89
|
+
<Badge variant="count" class="ml-auto text-[11px]">{props.count}</Badge>
|
|
90
|
+
</CollapsibleTrigger>
|
|
91
|
+
<CollapsibleContent>
|
|
92
|
+
<div class="pl-2 mt-0.5 space-y-0.5">
|
|
93
|
+
<For each={props.conversations}>
|
|
94
|
+
{(conv) => <ConversationItem conversation={conv} isActive={conv.id === props.activeId} onSelect={props.onSelect} />}
|
|
95
|
+
</For>
|
|
96
|
+
</div>
|
|
97
|
+
</CollapsibleContent>
|
|
98
|
+
</Collapsible>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from 'storybook-solidjs-vite';
|
|
2
|
+
import { createSignal, For } from 'solid-js';
|
|
3
|
+
import {
|
|
4
|
+
Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent,
|
|
5
|
+
} from './empty';
|
|
6
|
+
import { Button } from '../ui/button';
|
|
7
|
+
import { Avatar } from '../ui/avatar';
|
|
8
|
+
import { PromptSuggestion } from './prompt-suggestion';
|
|
9
|
+
import { PromptInput, PromptInputTextarea, PromptInputActions } from './prompt-input';
|
|
10
|
+
import {
|
|
11
|
+
FolderPlus, MessageCircleQuestion, Inbox, Search, Sparkles, FileText, ArrowUp, Plus, Upload,
|
|
12
|
+
} from 'lucide-solid';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Story for the compound `Empty` family. `Empty` is the root container; the
|
|
16
|
+
* header/media/title/description/content subcomponents compose the layout. The
|
|
17
|
+
* only real enum prop is `EmptyMedia`'s `variant`, so the controls focus on the
|
|
18
|
+
* common composition, and the variation stories are compositional showcases.
|
|
19
|
+
*/
|
|
20
|
+
const meta = {
|
|
21
|
+
title: 'Components/Empty',
|
|
22
|
+
component: Empty,
|
|
23
|
+
tags: ['autodocs'],
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: 'padded',
|
|
26
|
+
docs: {
|
|
27
|
+
description: {
|
|
28
|
+
component: [
|
|
29
|
+
'A composable empty-state block (modeled on shadcn/ui `Empty`): a centered media tile, title, description, and a content slot for actions or suggestions. Token-driven styling; no border by default.',
|
|
30
|
+
'**When to use:** when a region has nothing to show yet — an empty list/inbox, no search results, a blank chat, or a drop zone — and you want to guide the user toward a next action.',
|
|
31
|
+
'**How to use:** compose `Empty > EmptyHeader (EmptyMedia + EmptyTitle + EmptyDescription)` and an optional `EmptyContent` for buttons or prompt suggestions. Set `EmptyMedia` `variant` to `icon` for a muted tile or `default` for a bare slot (avatar/illustration). Add `border border-dashed` via `class` for a card.',
|
|
32
|
+
'**Placement:** empty lists/sidebars, search-result panes, blank chat launch states, and file drop zones.',
|
|
33
|
+
].join('\n\n'),
|
|
34
|
+
},
|
|
35
|
+
controls: { exclude: ['use:eventListener'] },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
argTypes: {
|
|
39
|
+
title: {
|
|
40
|
+
control: 'text',
|
|
41
|
+
description: 'Demo control: the `EmptyTitle` text.',
|
|
42
|
+
},
|
|
43
|
+
description: {
|
|
44
|
+
control: 'text',
|
|
45
|
+
description: 'Demo control: the `EmptyDescription` text.',
|
|
46
|
+
},
|
|
47
|
+
mediaVariant: {
|
|
48
|
+
control: 'select',
|
|
49
|
+
options: ['default', 'icon'],
|
|
50
|
+
description: '`EmptyMedia` variant — `icon` is a muted rounded tile, `default` is a bare slot.',
|
|
51
|
+
table: { defaultValue: { summary: 'default' } },
|
|
52
|
+
},
|
|
53
|
+
actionLabel: {
|
|
54
|
+
control: 'text',
|
|
55
|
+
description: 'Demo control: label of the primary action button.',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
render: (args: {
|
|
59
|
+
title?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
mediaVariant?: 'default' | 'icon';
|
|
62
|
+
actionLabel?: string;
|
|
63
|
+
}) => (
|
|
64
|
+
<div class="w-[420px]">
|
|
65
|
+
<Empty>
|
|
66
|
+
<EmptyHeader>
|
|
67
|
+
<EmptyMedia variant={args.mediaVariant ?? 'icon'}><FolderPlus /></EmptyMedia>
|
|
68
|
+
<EmptyTitle>{args.title}</EmptyTitle>
|
|
69
|
+
<EmptyDescription>{args.description}</EmptyDescription>
|
|
70
|
+
</EmptyHeader>
|
|
71
|
+
<EmptyContent>
|
|
72
|
+
<Button><Plus class="size-4" /> {args.actionLabel}</Button>
|
|
73
|
+
</EmptyContent>
|
|
74
|
+
</Empty>
|
|
75
|
+
</div>
|
|
76
|
+
),
|
|
77
|
+
} satisfies Meta<typeof Empty>;
|
|
78
|
+
|
|
79
|
+
export default meta;
|
|
80
|
+
type Story = StoryObj<typeof meta>;
|
|
81
|
+
|
|
82
|
+
const IMPORT = `import {
|
|
83
|
+
Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent,
|
|
84
|
+
} from '@kitnai/chat';`;
|
|
85
|
+
const src = (code: string) => ({
|
|
86
|
+
parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
/** Interactive playground — edit the title, description, media variant, and action label. */
|
|
90
|
+
export const Playground: Story = {
|
|
91
|
+
args: {
|
|
92
|
+
title: 'No projects yet',
|
|
93
|
+
description: 'Get started by creating your first project.',
|
|
94
|
+
mediaVariant: 'icon',
|
|
95
|
+
actionLabel: 'Create project',
|
|
96
|
+
},
|
|
97
|
+
...src(`<Empty>
|
|
98
|
+
<EmptyHeader>
|
|
99
|
+
<EmptyMedia variant="icon"><FolderPlus /></EmptyMedia>
|
|
100
|
+
<EmptyTitle>No projects yet</EmptyTitle>
|
|
101
|
+
<EmptyDescription>Get started by creating your first project.</EmptyDescription>
|
|
102
|
+
</EmptyHeader>
|
|
103
|
+
<EmptyContent>
|
|
104
|
+
<Button><Plus class="size-4" /> Create project</Button>
|
|
105
|
+
</EmptyContent>
|
|
106
|
+
</Empty>`),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** A single primary action — the canonical empty state. */
|
|
110
|
+
export const Default: Story = {
|
|
111
|
+
render: () => (
|
|
112
|
+
<div class="w-[420px]">
|
|
113
|
+
<Empty>
|
|
114
|
+
<EmptyHeader>
|
|
115
|
+
<EmptyMedia variant="icon"><FolderPlus /></EmptyMedia>
|
|
116
|
+
<EmptyTitle>No projects yet</EmptyTitle>
|
|
117
|
+
<EmptyDescription>Get started by creating your first project.</EmptyDescription>
|
|
118
|
+
</EmptyHeader>
|
|
119
|
+
<EmptyContent>
|
|
120
|
+
<Button><Plus class="size-4" /> Create project</Button>
|
|
121
|
+
</EmptyContent>
|
|
122
|
+
</Empty>
|
|
123
|
+
</div>
|
|
124
|
+
),
|
|
125
|
+
...src(`<Empty>
|
|
126
|
+
<EmptyHeader>
|
|
127
|
+
<EmptyMedia variant="icon"><FolderPlus /></EmptyMedia>
|
|
128
|
+
<EmptyTitle>No projects yet</EmptyTitle>
|
|
129
|
+
<EmptyDescription>Get started by creating your first project.</EmptyDescription>
|
|
130
|
+
</EmptyHeader>
|
|
131
|
+
<EmptyContent>
|
|
132
|
+
<Button><Plus class="size-4" /> Create project</Button>
|
|
133
|
+
</EmptyContent>
|
|
134
|
+
</Empty>`),
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/** Two actions — a primary plus a secondary (outline). */
|
|
138
|
+
export const WithActions: Story = {
|
|
139
|
+
name: 'With Multiple Actions',
|
|
140
|
+
render: () => (
|
|
141
|
+
<div class="w-[420px]">
|
|
142
|
+
<Empty>
|
|
143
|
+
<EmptyHeader>
|
|
144
|
+
<EmptyMedia variant="icon"><Inbox /></EmptyMedia>
|
|
145
|
+
<EmptyTitle>Your inbox is empty</EmptyTitle>
|
|
146
|
+
<EmptyDescription>Import existing items or start from scratch.</EmptyDescription>
|
|
147
|
+
</EmptyHeader>
|
|
148
|
+
<EmptyContent>
|
|
149
|
+
<div class="flex gap-2">
|
|
150
|
+
<Button><Plus class="size-4" /> New item</Button>
|
|
151
|
+
<Button variant="outline"><Upload class="size-4" /> Import</Button>
|
|
152
|
+
</div>
|
|
153
|
+
</EmptyContent>
|
|
154
|
+
</Empty>
|
|
155
|
+
</div>
|
|
156
|
+
),
|
|
157
|
+
...src(`<Empty>
|
|
158
|
+
<EmptyHeader>
|
|
159
|
+
<EmptyMedia variant="icon"><Inbox /></EmptyMedia>
|
|
160
|
+
<EmptyTitle>Your inbox is empty</EmptyTitle>
|
|
161
|
+
<EmptyDescription>Import existing items or start from scratch.</EmptyDescription>
|
|
162
|
+
</EmptyHeader>
|
|
163
|
+
<EmptyContent>
|
|
164
|
+
<div class="flex gap-2">
|
|
165
|
+
<Button><Plus class="size-4" /> New item</Button>
|
|
166
|
+
<Button variant="outline"><Upload class="size-4" /> Import</Button>
|
|
167
|
+
</div>
|
|
168
|
+
</EmptyContent>
|
|
169
|
+
</Empty>`),
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/** The two `EmptyMedia` variants: an icon tile vs. a default (bare) slot
|
|
173
|
+
* holding an avatar or larger illustration. */
|
|
174
|
+
export const MediaVariants: Story = {
|
|
175
|
+
name: 'Media Variants (icon / default)',
|
|
176
|
+
render: () => (
|
|
177
|
+
<div class="flex gap-8">
|
|
178
|
+
<div class="w-[280px]">
|
|
179
|
+
<Empty>
|
|
180
|
+
<EmptyHeader>
|
|
181
|
+
<EmptyMedia variant="icon"><Search /></EmptyMedia>
|
|
182
|
+
<EmptyTitle>variant="icon"</EmptyTitle>
|
|
183
|
+
<EmptyDescription>Icon sits in a muted rounded tile.</EmptyDescription>
|
|
184
|
+
</EmptyHeader>
|
|
185
|
+
</Empty>
|
|
186
|
+
</div>
|
|
187
|
+
<div class="w-[280px]">
|
|
188
|
+
<Empty>
|
|
189
|
+
<EmptyHeader>
|
|
190
|
+
<EmptyMedia variant="default"><Avatar fallback="JA" size="lg" /></EmptyMedia>
|
|
191
|
+
<EmptyTitle>variant="default"</EmptyTitle>
|
|
192
|
+
<EmptyDescription>Bare slot for an avatar or illustration.</EmptyDescription>
|
|
193
|
+
</EmptyHeader>
|
|
194
|
+
</Empty>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
),
|
|
198
|
+
...src(`<Empty>
|
|
199
|
+
<EmptyHeader>
|
|
200
|
+
<EmptyMedia variant="icon"><Search /></EmptyMedia>
|
|
201
|
+
<EmptyTitle>Icon tile</EmptyTitle>
|
|
202
|
+
</EmptyHeader>
|
|
203
|
+
</Empty>
|
|
204
|
+
|
|
205
|
+
<Empty>
|
|
206
|
+
<EmptyHeader>
|
|
207
|
+
<EmptyMedia variant="default"><Avatar fallback="JA" size="lg" /></EmptyMedia>
|
|
208
|
+
<EmptyTitle>Bare slot</EmptyTitle>
|
|
209
|
+
</EmptyHeader>
|
|
210
|
+
</Empty>`),
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
/** Suggestions as pills (PromptSuggestion default) in a centered wrap —
|
|
214
|
+
* best for a handful of short prompts. */
|
|
215
|
+
export const SuggestionPills: Story = {
|
|
216
|
+
name: 'Suggestions — Pills',
|
|
217
|
+
render: () => (
|
|
218
|
+
<div class="w-[460px]">
|
|
219
|
+
<Empty>
|
|
220
|
+
<EmptyHeader>
|
|
221
|
+
<EmptyMedia variant="icon"><Sparkles /></EmptyMedia>
|
|
222
|
+
<EmptyTitle>Start a conversation</EmptyTitle>
|
|
223
|
+
<EmptyDescription>Pick a prompt or type your own.</EmptyDescription>
|
|
224
|
+
</EmptyHeader>
|
|
225
|
+
<EmptyContent>
|
|
226
|
+
<div class="flex flex-wrap justify-center gap-2">
|
|
227
|
+
<For each={['Summarize this', 'Key takeaways', 'Create an outline', 'Find risks']}>
|
|
228
|
+
{(s) => <PromptSuggestion>{s}</PromptSuggestion>}
|
|
229
|
+
</For>
|
|
230
|
+
</div>
|
|
231
|
+
</EmptyContent>
|
|
232
|
+
</Empty>
|
|
233
|
+
</div>
|
|
234
|
+
),
|
|
235
|
+
...src(`<Empty>
|
|
236
|
+
<EmptyHeader>
|
|
237
|
+
<EmptyMedia variant="icon"><Sparkles /></EmptyMedia>
|
|
238
|
+
<EmptyTitle>Start a conversation</EmptyTitle>
|
|
239
|
+
<EmptyDescription>Pick a prompt or type your own.</EmptyDescription>
|
|
240
|
+
</EmptyHeader>
|
|
241
|
+
<EmptyContent>
|
|
242
|
+
<div class="flex flex-wrap justify-center gap-2">
|
|
243
|
+
<For each={prompts}>{(s) => <PromptSuggestion>{s}</PromptSuggestion>}</For>
|
|
244
|
+
</div>
|
|
245
|
+
</EmptyContent>
|
|
246
|
+
</Empty>`),
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
/** Suggestions as a full-width list (PromptSuggestion `block`) — best for
|
|
250
|
+
* longer, sentence-length prompts. This is the report chat dock's pattern. */
|
|
251
|
+
export const SuggestionList: Story = {
|
|
252
|
+
name: 'Suggestions — List (block)',
|
|
253
|
+
render: () => (
|
|
254
|
+
<div class="w-[360px]">
|
|
255
|
+
<Empty>
|
|
256
|
+
<EmptyHeader>
|
|
257
|
+
<EmptyMedia variant="icon"><MessageCircleQuestion /></EmptyMedia>
|
|
258
|
+
<EmptyTitle>Hi Jordan</EmptyTitle>
|
|
259
|
+
<EmptyDescription>Ask me anything about your report.</EmptyDescription>
|
|
260
|
+
</EmptyHeader>
|
|
261
|
+
<EmptyContent class="max-w-none">
|
|
262
|
+
<For each={[
|
|
263
|
+
'What does being a Catalyst mean for how I work with others?',
|
|
264
|
+
'How do my Dominance and Influence styles play off each other?',
|
|
265
|
+
'Where might my lower Conscientiousness trip me up?',
|
|
266
|
+
]}>
|
|
267
|
+
{(s) => <PromptSuggestion block>{s}</PromptSuggestion>}
|
|
268
|
+
</For>
|
|
269
|
+
</EmptyContent>
|
|
270
|
+
</Empty>
|
|
271
|
+
</div>
|
|
272
|
+
),
|
|
273
|
+
...src(`<Empty>
|
|
274
|
+
<EmptyHeader>
|
|
275
|
+
<EmptyMedia variant="icon"><MessageCircleQuestion /></EmptyMedia>
|
|
276
|
+
<EmptyTitle>Hi Jordan</EmptyTitle>
|
|
277
|
+
<EmptyDescription>Ask me anything about your report.</EmptyDescription>
|
|
278
|
+
</EmptyHeader>
|
|
279
|
+
<EmptyContent class="max-w-none">
|
|
280
|
+
<For each={prompts}>{(s) => <PromptSuggestion block>{s}</PromptSuggestion>}</For>
|
|
281
|
+
</EmptyContent>
|
|
282
|
+
</Empty>`),
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
/** Suggestions organized into labeled groups (mirrors the Prompt Input
|
|
286
|
+
* Variants → WithSuggestions pattern), inside an empty block. */
|
|
287
|
+
export const GroupedSuggestions: Story = {
|
|
288
|
+
name: 'Suggestions — Grouped',
|
|
289
|
+
render: () => {
|
|
290
|
+
const groups = [
|
|
291
|
+
{ label: 'Get started', items: ['Summarize this document', 'What are the key takeaways?'] },
|
|
292
|
+
{ label: 'Go deeper', items: ['Compare with similar approaches', 'What are the tradeoffs?'] },
|
|
293
|
+
];
|
|
294
|
+
return (
|
|
295
|
+
<div class="w-[460px]">
|
|
296
|
+
<Empty>
|
|
297
|
+
<EmptyHeader>
|
|
298
|
+
<EmptyMedia variant="icon"><FileText /></EmptyMedia>
|
|
299
|
+
<EmptyTitle>Ask about this document</EmptyTitle>
|
|
300
|
+
<EmptyDescription>Choose a starting point.</EmptyDescription>
|
|
301
|
+
</EmptyHeader>
|
|
302
|
+
<EmptyContent class="max-w-none gap-4">
|
|
303
|
+
<For each={groups}>
|
|
304
|
+
{(group) => (
|
|
305
|
+
<div class="w-full space-y-2 text-center">
|
|
306
|
+
<span class="text-xs font-medium text-muted-foreground uppercase tracking-wider">
|
|
307
|
+
{group.label}
|
|
308
|
+
</span>
|
|
309
|
+
<div class="flex flex-wrap justify-center gap-2">
|
|
310
|
+
<For each={group.items}>{(item) => <PromptSuggestion>{item}</PromptSuggestion>}</For>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
)}
|
|
314
|
+
</For>
|
|
315
|
+
</EmptyContent>
|
|
316
|
+
</Empty>
|
|
317
|
+
</div>
|
|
318
|
+
);
|
|
319
|
+
},
|
|
320
|
+
...src(`<Empty>
|
|
321
|
+
<EmptyHeader>
|
|
322
|
+
<EmptyMedia variant="icon"><FileText /></EmptyMedia>
|
|
323
|
+
<EmptyTitle>Ask about this document</EmptyTitle>
|
|
324
|
+
<EmptyDescription>Choose a starting point.</EmptyDescription>
|
|
325
|
+
</EmptyHeader>
|
|
326
|
+
<EmptyContent class="max-w-none gap-4">
|
|
327
|
+
<For each={groups}>{(group) => (/* label + wrapped PromptSuggestions */)}</For>
|
|
328
|
+
</EmptyContent>
|
|
329
|
+
</Empty>`),
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
/** An empty block whose content is an input — the "blank chat" launch state. */
|
|
333
|
+
export const WithInput: Story = {
|
|
334
|
+
name: 'With Prompt Input',
|
|
335
|
+
render: () => {
|
|
336
|
+
const [value, setValue] = createSignal('');
|
|
337
|
+
return (
|
|
338
|
+
<div class="w-[460px]">
|
|
339
|
+
<Empty>
|
|
340
|
+
<EmptyHeader>
|
|
341
|
+
<EmptyMedia variant="icon"><Sparkles /></EmptyMedia>
|
|
342
|
+
<EmptyTitle>How can I help?</EmptyTitle>
|
|
343
|
+
<EmptyDescription>Ask anything to get started.</EmptyDescription>
|
|
344
|
+
</EmptyHeader>
|
|
345
|
+
<EmptyContent>
|
|
346
|
+
<PromptInput value={value()} onValueChange={setValue} onSubmit={() => setValue('')} class="w-full">
|
|
347
|
+
<PromptInputTextarea placeholder="Ask anything..." class="min-h-[44px] px-3 pt-2.5" />
|
|
348
|
+
<PromptInputActions class="justify-end px-2 pb-2">
|
|
349
|
+
<Button size="icon-sm" class="rounded-full" disabled={!value().trim()}>
|
|
350
|
+
<ArrowUp class="size-4" />
|
|
351
|
+
</Button>
|
|
352
|
+
</PromptInputActions>
|
|
353
|
+
</PromptInput>
|
|
354
|
+
</EmptyContent>
|
|
355
|
+
</Empty>
|
|
356
|
+
</div>
|
|
357
|
+
);
|
|
358
|
+
},
|
|
359
|
+
...src(`<Empty>
|
|
360
|
+
<EmptyHeader>
|
|
361
|
+
<EmptyMedia variant="icon"><Sparkles /></EmptyMedia>
|
|
362
|
+
<EmptyTitle>How can I help?</EmptyTitle>
|
|
363
|
+
<EmptyDescription>Ask anything to get started.</EmptyDescription>
|
|
364
|
+
</EmptyHeader>
|
|
365
|
+
<EmptyContent>
|
|
366
|
+
<PromptInput value={value()} onValueChange={setValue} onSubmit={() => setValue('')}>
|
|
367
|
+
<PromptInputTextarea placeholder="Ask anything..." />
|
|
368
|
+
<PromptInputActions class="justify-end">
|
|
369
|
+
<Button size="icon-sm" disabled={!value().trim()}><ArrowUp class="size-4" /></Button>
|
|
370
|
+
</PromptInputActions>
|
|
371
|
+
</PromptInput>
|
|
372
|
+
</EmptyContent>
|
|
373
|
+
</Empty>`),
|
|
374
|
+
};
|
|
375
|
+
|
|
376
|
+
/** A description can carry a link; styled underline + primary-on-hover. */
|
|
377
|
+
export const WithLink: Story = {
|
|
378
|
+
name: 'With Link in Description',
|
|
379
|
+
render: () => (
|
|
380
|
+
<div class="w-[420px]">
|
|
381
|
+
<Empty>
|
|
382
|
+
<EmptyHeader>
|
|
383
|
+
<EmptyMedia variant="icon"><Search /></EmptyMedia>
|
|
384
|
+
<EmptyTitle>No results found</EmptyTitle>
|
|
385
|
+
<EmptyDescription>
|
|
386
|
+
Try a different search, or <a href="#">browse all items</a> instead.
|
|
387
|
+
</EmptyDescription>
|
|
388
|
+
</EmptyHeader>
|
|
389
|
+
<EmptyContent>
|
|
390
|
+
<Button variant="outline">Clear filters</Button>
|
|
391
|
+
</EmptyContent>
|
|
392
|
+
</Empty>
|
|
393
|
+
</div>
|
|
394
|
+
),
|
|
395
|
+
...src(`<Empty>
|
|
396
|
+
<EmptyHeader>
|
|
397
|
+
<EmptyMedia variant="icon"><Search /></EmptyMedia>
|
|
398
|
+
<EmptyTitle>No results found</EmptyTitle>
|
|
399
|
+
<EmptyDescription>
|
|
400
|
+
Try a different search, or <a href="#">browse all items</a> instead.
|
|
401
|
+
</EmptyDescription>
|
|
402
|
+
</EmptyHeader>
|
|
403
|
+
<EmptyContent>
|
|
404
|
+
<Button variant="outline">Clear filters</Button>
|
|
405
|
+
</EmptyContent>
|
|
406
|
+
</Empty>`),
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
/** A bordered (dashed) card treatment — add `border border-dashed` via class. */
|
|
410
|
+
export const Bordered: Story = {
|
|
411
|
+
render: () => (
|
|
412
|
+
<div class="w-[420px]">
|
|
413
|
+
<Empty class="border border-dashed">
|
|
414
|
+
<EmptyHeader>
|
|
415
|
+
<EmptyMedia variant="icon"><FolderPlus /></EmptyMedia>
|
|
416
|
+
<EmptyTitle>Drop files here</EmptyTitle>
|
|
417
|
+
<EmptyDescription>Or click to browse from your computer.</EmptyDescription>
|
|
418
|
+
</EmptyHeader>
|
|
419
|
+
<EmptyContent>
|
|
420
|
+
<Button variant="outline"><Upload class="size-4" /> Choose files</Button>
|
|
421
|
+
</EmptyContent>
|
|
422
|
+
</Empty>
|
|
423
|
+
</div>
|
|
424
|
+
),
|
|
425
|
+
...src(`<Empty class="border border-dashed">
|
|
426
|
+
<EmptyHeader>
|
|
427
|
+
<EmptyMedia variant="icon"><FolderPlus /></EmptyMedia>
|
|
428
|
+
<EmptyTitle>Drop files here</EmptyTitle>
|
|
429
|
+
<EmptyDescription>Or click to browse from your computer.</EmptyDescription>
|
|
430
|
+
</EmptyHeader>
|
|
431
|
+
<EmptyContent>
|
|
432
|
+
<Button variant="outline"><Upload class="size-4" /> Choose files</Button>
|
|
433
|
+
</EmptyContent>
|
|
434
|
+
</Empty>`),
|
|
435
|
+
};
|