@kitn.ai/ui 0.15.0 → 0.15.1

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.
Files changed (177) hide show
  1. package/dist/kitn-chat.es.js +1 -1
  2. package/package.json +6 -1
  3. package/src/elements/compiled.css +1 -1
  4. package/src/components/artifact.stories.tsx +0 -138
  5. package/src/components/attachments.stories.tsx +0 -303
  6. package/src/components/attachments.test.tsx +0 -64
  7. package/src/components/chain-of-thought.stories.tsx +0 -211
  8. package/src/components/chat-container.stories.tsx +0 -187
  9. package/src/components/chat-thread.test.tsx +0 -58
  10. package/src/components/checkpoint.stories.tsx +0 -102
  11. package/src/components/code-block.stories.tsx +0 -150
  12. package/src/components/confirm-card.stories.tsx +0 -74
  13. package/src/components/context.stories.tsx +0 -229
  14. package/src/components/context.test.tsx +0 -133
  15. package/src/components/conversation-item.stories.tsx +0 -125
  16. package/src/components/conversation-list.stories.tsx +0 -133
  17. package/src/components/default-input.test.tsx +0 -111
  18. package/src/components/empty.stories.tsx +0 -434
  19. package/src/components/feedback-bar.stories.tsx +0 -138
  20. package/src/components/feedback-bar.test.tsx +0 -103
  21. package/src/components/file-tree.stories.tsx +0 -73
  22. package/src/components/file-upload.stories.tsx +0 -156
  23. package/src/components/image.stories.tsx +0 -89
  24. package/src/components/loader.stories.tsx +0 -181
  25. package/src/components/markdown.stories.tsx +0 -180
  26. package/src/components/message-action-bar.test.tsx +0 -128
  27. package/src/components/message-narrow.stories.tsx +0 -329
  28. package/src/components/message-skills.stories.tsx +0 -211
  29. package/src/components/message.stories.tsx +0 -281
  30. package/src/components/model-switcher.stories.tsx +0 -123
  31. package/src/components/model-switcher.test.tsx +0 -65
  32. package/src/components/prompt-input.stories.tsx +0 -222
  33. package/src/components/prompt-suggestion.stories.tsx +0 -142
  34. package/src/components/reasoning.stories.tsx +0 -140
  35. package/src/components/resizable.test.tsx +0 -226
  36. package/src/components/scroll-button.stories.tsx +0 -100
  37. package/src/components/slash-command.stories.tsx +0 -163
  38. package/src/components/source-list.test.tsx +0 -152
  39. package/src/components/source.stories.tsx +0 -124
  40. package/src/components/tasks-card.stories.tsx +0 -78
  41. package/src/components/text-shimmer.stories.tsx +0 -87
  42. package/src/components/thinking-bar.stories.tsx +0 -87
  43. package/src/components/tool.stories.tsx +0 -153
  44. package/src/components/voice-input.stories.tsx +0 -83
  45. package/src/elements/artifact.stories.tsx +0 -506
  46. package/src/elements/attachments.stories.tsx +0 -190
  47. package/src/elements/card.stories.tsx +0 -113
  48. package/src/elements/cards.stories.tsx +0 -59
  49. package/src/elements/catalog.stories.tsx +0 -491
  50. package/src/elements/chain-of-thought.declarative.test.tsx +0 -153
  51. package/src/elements/chain-of-thought.stories.tsx +0 -113
  52. package/src/elements/chat-scope-picker.stories.tsx +0 -73
  53. package/src/elements/chat-workspace.stories.tsx +0 -288
  54. package/src/elements/chat.stories.tsx +0 -151
  55. package/src/elements/checkpoint.stories.tsx +0 -72
  56. package/src/elements/choice.stories.tsx +0 -240
  57. package/src/elements/code-block.stories.tsx +0 -83
  58. package/src/elements/composed-shell.stories.tsx +0 -316
  59. package/src/elements/confirm-card.stories.tsx +0 -227
  60. package/src/elements/context-meter.stories.tsx +0 -151
  61. package/src/elements/conversation-list.declarative.test.tsx +0 -137
  62. package/src/elements/conversation-list.stories.tsx +0 -243
  63. package/src/elements/embed.stories.tsx +0 -213
  64. package/src/elements/empty.stories.tsx +0 -111
  65. package/src/elements/feedback-bar.stories.tsx +0 -114
  66. package/src/elements/file-tree.stories.tsx +0 -134
  67. package/src/elements/file-upload.stories.tsx +0 -82
  68. package/src/elements/form.stories.tsx +0 -248
  69. package/src/elements/image.stories.tsx +0 -71
  70. package/src/elements/link-preview.stories.tsx +0 -209
  71. package/src/elements/loader.stories.tsx +0 -88
  72. package/src/elements/markdown.stories.tsx +0 -76
  73. package/src/elements/message-skills.declarative.test.tsx +0 -104
  74. package/src/elements/message-skills.stories.tsx +0 -114
  75. package/src/elements/message.stories.tsx +0 -218
  76. package/src/elements/model-switcher.declarative.test.tsx +0 -130
  77. package/src/elements/model-switcher.stories.tsx +0 -198
  78. package/src/elements/popover.stories.tsx +0 -80
  79. package/src/elements/prompt-input-slash-command.test.tsx +0 -128
  80. package/src/elements/prompt-input-stoppable.test.tsx +0 -88
  81. package/src/elements/prompt-input-toolbar-actions.test.tsx +0 -120
  82. package/src/elements/prompt-input.stories.tsx +0 -331
  83. package/src/elements/prompt-suggestions.declarative.test.tsx +0 -164
  84. package/src/elements/prompt-suggestions.stories.tsx +0 -213
  85. package/src/elements/reasoning.stories.tsx +0 -77
  86. package/src/elements/remote.stories.tsx +0 -314
  87. package/src/elements/resizable.stories.tsx +0 -426
  88. package/src/elements/response-stream.stories.tsx +0 -79
  89. package/src/elements/scroll-button.stories.tsx +0 -202
  90. package/src/elements/scroll-button.test.tsx +0 -148
  91. package/src/elements/source-list.stories.tsx +0 -143
  92. package/src/elements/source.stories.tsx +0 -88
  93. package/src/elements/switch.stories.tsx +0 -56
  94. package/src/elements/tasks.stories.tsx +0 -237
  95. package/src/elements/text-shimmer.stories.tsx +0 -64
  96. package/src/elements/thinking-bar.stories.tsx +0 -72
  97. package/src/elements/tool.stories.tsx +0 -89
  98. package/src/elements/voice-input.stories.tsx +0 -88
  99. package/src/primitives/controllable.test.ts +0 -47
  100. package/src/stories/chat-panel-layout.stories.tsx +0 -145
  101. package/src/stories/chat-scene.tsx +0 -571
  102. package/src/stories/checkpoint-restore.stories.tsx +0 -256
  103. package/src/stories/context-usage.stories.tsx +0 -212
  104. package/src/stories/conversation-with-reasoning.stories.tsx +0 -182
  105. package/src/stories/conversation-with-sources.stories.tsx +0 -471
  106. package/src/stories/docs/Accessibility.mdx +0 -119
  107. package/src/stories/docs/ChildElements.mdx +0 -269
  108. package/src/stories/docs/ForAIAgents.mdx +0 -162
  109. package/src/stories/docs/GettingStarted.mdx +0 -65
  110. package/src/stories/docs/Installation.mdx +0 -83
  111. package/src/stories/docs/Introduction.mdx +0 -50
  112. package/src/stories/docs/SolidJsAdvanced.mdx +0 -17
  113. package/src/stories/docs/Theming.mdx +0 -85
  114. package/src/stories/docs/element-controls.ts +0 -121
  115. package/src/stories/docs/frameworks/Angular.mdx +0 -245
  116. package/src/stories/docs/frameworks/Html.mdx +0 -227
  117. package/src/stories/docs/frameworks/Overview.mdx +0 -47
  118. package/src/stories/docs/frameworks/React.mdx +0 -227
  119. package/src/stories/docs/frameworks/Solid.mdx +0 -173
  120. package/src/stories/docs/frameworks/Svelte.mdx +0 -194
  121. package/src/stories/docs/frameworks/Vue.mdx +0 -238
  122. package/src/stories/docs/generative-ui-overview.mdx +0 -186
  123. package/src/stories/docs/recipes/SpeechToText.mdx +0 -7
  124. package/src/stories/docs/recipes/Streaming.mdx +0 -68
  125. package/src/stories/docs/recipes/TextToSpeech.mdx +0 -35
  126. package/src/stories/docs/theme-editor/canvas.tsx +0 -32
  127. package/src/stories/docs/theme-editor/inspector.tsx +0 -66
  128. package/src/stories/docs/theme-editor/presets.test.ts +0 -32
  129. package/src/stories/docs/theme-editor/presets.ts +0 -64
  130. package/src/stories/docs/theme-editor/theme-css.test.ts +0 -19
  131. package/src/stories/docs/theme-editor/theme-css.ts +0 -15
  132. package/src/stories/docs/theme-editor/theme-editor.tsx +0 -146
  133. package/src/stories/docs/theme-tokens.tsx +0 -174
  134. package/src/stories/examples/ChoosingComponents.mdx +0 -106
  135. package/src/stories/examples/sample-data.ts +0 -79
  136. package/src/stories/examples/usage/checkpoint-restore.ts +0 -156
  137. package/src/stories/examples/usage/context-usage.ts +0 -591
  138. package/src/stories/examples/usage/conversation-with-reasoning.ts +0 -224
  139. package/src/stories/examples/usage/conversation-with-sources.ts +0 -589
  140. package/src/stories/examples/usage/empty-state.ts +0 -144
  141. package/src/stories/examples/usage/full-chat-app.ts +0 -277
  142. package/src/stories/examples/usage/index.ts +0 -63
  143. package/src/stories/examples/usage/message-actions.ts +0 -704
  144. package/src/stories/examples/usage/pattern-centered-conversation.ts +0 -446
  145. package/src/stories/examples/usage/pattern-chat-panel-layout.ts +0 -442
  146. package/src/stories/examples/usage/pattern-docked-widget.ts +0 -479
  147. package/src/stories/examples/usage/prompt-input-variants.ts +0 -1356
  148. package/src/stories/examples/usage/streaming-response.ts +0 -687
  149. package/src/stories/examples/usage/types.ts +0 -33
  150. package/src/stories/full-chat.stories.tsx +0 -18
  151. package/src/stories/message-actions.stories.tsx +0 -230
  152. package/src/stories/pattern-centered-conversation.stories.tsx +0 -93
  153. package/src/stories/pattern-docked-widget.stories.tsx +0 -93
  154. package/src/stories/pattern-empty-state.stories.tsx +0 -76
  155. package/src/stories/prompt-input-variants.stories.tsx +0 -456
  156. package/src/stories/streaming-response.stories.tsx +0 -438
  157. package/src/stories/theme-editor.stories.tsx +0 -16
  158. package/src/stories/token-reference.stories.tsx +0 -18
  159. package/src/stories/typography.stories.tsx +0 -78
  160. package/src/ui/avatar.stories.tsx +0 -103
  161. package/src/ui/badge.stories.tsx +0 -86
  162. package/src/ui/button.stories.tsx +0 -145
  163. package/src/ui/collapsible.stories.tsx +0 -69
  164. package/src/ui/dropdown.stories.tsx +0 -59
  165. package/src/ui/hover-card.stories.tsx +0 -77
  166. package/src/ui/hover-card.test.tsx +0 -30
  167. package/src/ui/overlay.stories.tsx +0 -115
  168. package/src/ui/popover.stories.tsx +0 -81
  169. package/src/ui/popover.test.tsx +0 -99
  170. package/src/ui/resizable.stories.tsx +0 -236
  171. package/src/ui/scroll-area.stories.tsx +0 -50
  172. package/src/ui/separator.stories.tsx +0 -81
  173. package/src/ui/skeleton.stories.tsx +0 -337
  174. package/src/ui/switch.stories.tsx +0 -51
  175. package/src/ui/switch.test.tsx +0 -59
  176. package/src/ui/textarea.stories.tsx +0 -76
  177. package/src/ui/tooltip.stories.tsx +0 -74
@@ -1,33 +0,0 @@
1
- /**
2
- * Hand-authored "how you do this" code samples for the Examples / Patterns
3
- * stories' **Usage** tab. Each Example is a granular SolidJS composition; the
4
- * snippets teach how to do the same thing — the props you set and the events you
5
- * handle — in each framework. They are representative, NOT a literal copy of the
6
- * rendered demo.
7
- *
8
- * Keyed per **story** (variant): the Usage tab shows the entry for the story you
9
- * clicked (eyebrow = example name, title = story name). An example-level
10
- * `intro`/`snippets` is the fallback for any story without its own entry.
11
- *
12
- * Pure data (no imports) so it bundles cleanly into the Storybook manager addon.
13
- */
14
- export type FrameworkKey = 'html' | 'react' | 'svelte' | 'vue' | 'angular' | 'solid';
15
-
16
- /** One story's (or the example's) intro + per-framework snippets. */
17
- export interface StoryUsage {
18
- /** One-line "how you do this" framing (may use `inline code`). */
19
- intro: string;
20
- /** framework key → code snippet. Omit a framework to hide its tab. */
21
- snippets: Partial<Record<FrameworkKey, string>>;
22
- }
23
-
24
- export interface ExampleUsage extends StoryUsage {
25
- /** Storybook group title this attaches to, e.g. `'Examples/Message Actions'`. */
26
- title: string;
27
- /**
28
- * Per-story overrides, keyed by the story's display **name**
29
- * (e.g. `'Actions on Hover'`). A story without an entry falls back to the
30
- * example-level `intro`/`snippets`.
31
- */
32
- stories?: Record<string, StoryUsage>;
33
- }
@@ -1,18 +0,0 @@
1
- import type { Meta, StoryObj } from "storybook-solidjs-vite";
2
- import { ChatScene } from "./chat-scene";
3
-
4
- const meta: Meta = {
5
- title: "Examples/Full Chat App",
6
- parameters: {
7
- // Render inline in docs so the embedded example inherits the dark-mode
8
- // class (a non-inline iframe would stay light). Bounded to a sensible height.
9
- docs: { story: { inline: true, height: "640px" } },
10
- },
11
- };
12
-
13
- export default meta;
14
- type Story = StoryObj;
15
-
16
- export const Default: Story = {
17
- render: () => <ChatScene />,
18
- };
@@ -1,230 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { createSignal } from 'solid-js';
3
- import {
4
- Message, MessageAvatar, MessageContent, MessageActions,
5
- FeedbackBar, Button,
6
- } from '../index';
7
- import { Tooltip } from '../ui/tooltip';
8
- import { Copy, ThumbsUp, ThumbsDown, RefreshCw, Share, Bookmark, Check } from 'lucide-solid';
9
-
10
- const meta: Meta = {
11
- title: 'Examples/Message Actions',
12
- parameters: { layout: 'padded' },
13
- };
14
-
15
- export default meta;
16
- type Story = StoryObj;
17
-
18
- export const HoverActions: Story = {
19
- name: 'Actions on Hover',
20
- render: () => (
21
- <div class="space-y-6 max-w-2xl p-4">
22
- <p class="text-sm text-muted-foreground">Hover over the assistant message to see action buttons appear.</p>
23
-
24
- <Message>
25
- <MessageAvatar src="" fallback="U" alt="User" />
26
- <MessageContent>How do I handle errors in async Rust functions?</MessageContent>
27
- </Message>
28
-
29
- <Message>
30
- <MessageAvatar src="" fallback="AI" alt="Assistant" />
31
- <div class="group flex-1 space-y-2">
32
- <MessageContent markdown>
33
- {`In Rust, async functions return \`Result\` types just like sync functions. The \`?\` operator works seamlessly:
34
-
35
- \`\`\`rust
36
- async fn fetch_user(id: u64) -> Result<User, AppError> {
37
- let response = client.get(&format!("/users/{}", id))
38
- .send()
39
- .await?; // propagates reqwest::Error
40
- let user = response
41
- .json::<User>()
42
- .await?; // propagates deserialization error
43
- Ok(user)
44
- }
45
- \`\`\`
46
-
47
- Use \`anyhow::Result\` for applications and \`thiserror\` for libraries to define custom error types.`}
48
- </MessageContent>
49
- <MessageActions class="opacity-0 group-hover:opacity-100 transition-opacity">
50
- <Button variant="ghost" size="icon-sm" aria-label="Copy message"><Copy class="size-3.5" /></Button>
51
- <Button variant="ghost" size="icon-sm" aria-label="Good response"><ThumbsUp class="size-3.5" /></Button>
52
- <Button variant="ghost" size="icon-sm" aria-label="Bad response"><ThumbsDown class="size-3.5" /></Button>
53
- <Button variant="ghost" size="icon-sm" aria-label="Regenerate response"><RefreshCw class="size-3.5" /></Button>
54
- </MessageActions>
55
- </div>
56
- </Message>
57
- </div>
58
- ),
59
- };
60
-
61
- export const AlwaysVisible: Story = {
62
- name: 'Always Visible Actions',
63
- render: () => (
64
- <div class="space-y-6 max-w-2xl p-4">
65
- <Message>
66
- <MessageAvatar src="" fallback="AI" alt="Assistant" />
67
- <div class="flex-1 space-y-2">
68
- <MessageContent markdown>
69
- {`To install Tailwind CSS v4 in a Vite project:
70
-
71
- \`\`\`bash
72
- pnpm add tailwindcss @tailwindcss/vite
73
- \`\`\`
74
-
75
- Then add the plugin to your \`vite.config.ts\`:
76
-
77
- \`\`\`typescript
78
- import tailwindcss from '@tailwindcss/vite';
79
-
80
- export default defineConfig({
81
- plugins: [tailwindcss()],
82
- });
83
- \`\`\`
84
-
85
- Import Tailwind in your main CSS file:
86
-
87
- \`\`\`css
88
- @import "tailwindcss";
89
- \`\`\``}
90
- </MessageContent>
91
- <MessageActions>
92
- <Button variant="ghost" size="icon-sm" aria-label="Copy message"><Copy class="size-3.5" /></Button>
93
- <Button variant="ghost" size="icon-sm" aria-label="Good response"><ThumbsUp class="size-3.5" /></Button>
94
- <Button variant="ghost" size="icon-sm" aria-label="Bad response"><ThumbsDown class="size-3.5" /></Button>
95
- <Button variant="ghost" size="icon-sm" aria-label="Regenerate response"><RefreshCw class="size-3.5" /></Button>
96
- <Button variant="ghost" size="icon-sm" aria-label="Share"><Share class="size-3.5" /></Button>
97
- <Button variant="ghost" size="icon-sm" aria-label="Bookmark"><Bookmark class="size-3.5" /></Button>
98
- </MessageActions>
99
- </div>
100
- </Message>
101
- </div>
102
- ),
103
- };
104
-
105
- export const WithCopyConfirmation: Story = {
106
- name: 'Copy with Confirmation',
107
- render: () => {
108
- const [copied, setCopied] = createSignal(false);
109
-
110
- const handleCopy = () => {
111
- setCopied(true);
112
- setTimeout(() => setCopied(false), 2000);
113
- };
114
-
115
- return (
116
- <div class="space-y-6 max-w-2xl p-4">
117
- <Message>
118
- <MessageAvatar src="" fallback="AI" alt="Assistant" />
119
- <div class="flex-1 space-y-2">
120
- <MessageContent>
121
- The current LTS version of Node.js is 22.x, which includes built-in support for the fetch API, test runner, and watch mode.
122
- </MessageContent>
123
- <MessageActions>
124
- <Button variant="ghost" size="icon-sm" aria-label={copied() ? 'Copied' : 'Copy message'} onClick={handleCopy}>
125
- {copied() ? <Check class="size-3.5 text-green-500" /> : <Copy class="size-3.5" />}
126
- </Button>
127
- <Button variant="ghost" size="icon-sm" aria-label="Good response"><ThumbsUp class="size-3.5" /></Button>
128
- <Button variant="ghost" size="icon-sm" aria-label="Bad response"><ThumbsDown class="size-3.5" /></Button>
129
- </MessageActions>
130
- </div>
131
- </Message>
132
- </div>
133
- );
134
- },
135
- };
136
-
137
- export const WithFeedbackBar: Story = {
138
- name: 'Feedback Bar',
139
- render: () => {
140
- const [showFeedback, setShowFeedback] = createSignal(true);
141
-
142
- return (
143
- <div class="space-y-6 max-w-2xl p-4">
144
- <Message>
145
- <MessageAvatar src="" fallback="AI" alt="Assistant" />
146
- <div class="flex-1 space-y-3">
147
- <MessageContent markdown>
148
- {`Here are 3 ways to debounce in JavaScript:
149
-
150
- 1. **setTimeout approach** -- simple but manual cleanup
151
- 2. **lodash.debounce** -- battle-tested, configurable leading/trailing
152
- 3. **AbortController** -- modern, cancellable, works with fetch`}
153
- </MessageContent>
154
-
155
- {showFeedback() && (
156
- <FeedbackBar
157
- title="Was this response helpful?"
158
- collectDetail
159
- categories={['Inaccurate', 'Not helpful', 'Unsafe', 'Other']}
160
- onClose={() => setShowFeedback(false)}
161
- />
162
- )}
163
- </div>
164
- </Message>
165
- </div>
166
- );
167
- },
168
- };
169
-
170
- export const FullExample: Story = {
171
- name: 'Full Example',
172
- render: () => {
173
- const [copied, setCopied] = createSignal(false);
174
- const [showFeedback, setShowFeedback] = createSignal(true);
175
-
176
- const handleCopy = () => {
177
- setCopied(true);
178
- setTimeout(() => setCopied(false), 2000);
179
- };
180
-
181
- return (
182
- <div class="space-y-6 max-w-2xl p-4">
183
- <p class="text-sm text-muted-foreground">
184
- Everything combined — avatar, markdown, built-in copy/regenerate plus custom
185
- Share &amp; Bookmark (with copy→check confirmation), and a Feedback Bar below.
186
- </p>
187
-
188
- <Message>
189
- <MessageAvatar src="" fallback="AI" alt="Assistant" />
190
- <div class="flex-1 space-y-2">
191
- <MessageContent markdown>
192
- {`Use \`anyhow::Result\` for application code and \`thiserror\` for libraries:
193
-
194
- \`\`\`rust
195
- async fn fetch_user(id: u64) -> anyhow::Result<User> {
196
- let user = client.get(&format!("/users/{}", id)).send().await?.json().await?;
197
- Ok(user)
198
- }
199
- \`\`\`
200
-
201
- The \`?\` operator propagates errors from any \`Result\`-returning call.`}
202
- </MessageContent>
203
- <MessageActions>
204
- <Tooltip content={copied() ? 'Copied!' : 'Copy'}>
205
- <Button variant="ghost" size="icon-sm" aria-label={copied() ? 'Copied' : 'Copy message'} onClick={handleCopy}>
206
- {copied() ? <Check class="size-3.5 text-green-500" /> : <Copy class="size-3.5" />}
207
- </Button>
208
- </Tooltip>
209
- <Tooltip content="Regenerate">
210
- <Button variant="ghost" size="icon-sm" aria-label="Regenerate response"><RefreshCw class="size-3.5" /></Button>
211
- </Tooltip>
212
- <Tooltip content="Share">
213
- <Button variant="ghost" size="icon-sm" aria-label="Share"><Share class="size-3.5" /></Button>
214
- </Tooltip>
215
- <Tooltip content="Bookmark">
216
- <Button variant="ghost" size="icon-sm" aria-label="Bookmark"><Bookmark class="size-3.5" /></Button>
217
- </Tooltip>
218
- </MessageActions>
219
- {showFeedback() && (
220
- <FeedbackBar
221
- title="Was this response helpful?"
222
- onClose={() => setShowFeedback(false)}
223
- />
224
- )}
225
- </div>
226
- </Message>
227
- </div>
228
- );
229
- },
230
- };
@@ -1,93 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { createSignal } from 'solid-js';
3
- import {
4
- ChatConfig, ChatContainer, ChatContainerContent, ChatContainerScrollAnchor,
5
- Message, MessageContent, MessageActions,
6
- PromptInput, PromptInputTextarea, PromptInputActions,
7
- ModelSwitcher, Button,
8
- } from '../index';
9
- import type { ModelOption } from '../types';
10
- import { Copy, ThumbsUp, ArrowUp } from 'lucide-solid';
11
-
12
- const meta: Meta = {
13
- title: 'Patterns/Centered Conversation',
14
- parameters: {
15
- layout: 'centered',
16
- docs: {
17
- description: {
18
- component:
19
- 'A single, centered reading column with no sidebar (Claude.ai-style). The messages and composer share one `max-w` measure centered in the viewport — ideal for a focused, full-window chat. Contrast with **Chat Panel Layout** (a compact embedded panel) and the **Full Chat App** example (a resizable workspace).',
20
- },
21
- },
22
- },
23
- };
24
- export default meta;
25
- type Story = StoryObj;
26
-
27
- const models: ModelOption[] = [
28
- { id: 'claude-4', name: 'Claude 4 Opus', provider: 'Anthropic' },
29
- { id: 'gpt-4o', name: 'GPT-4o', provider: 'OpenAI' },
30
- ];
31
-
32
- const answer = `Sure — here's the gist:
33
-
34
- - **Signals** are fine-grained, so only the DOM that reads a signal updates.
35
- - **No re-renders** — components run once; reactive expressions do the work.
36
- - **No dependency arrays** — effects auto-track what they read.
37
-
38
- Want a code example next?`;
39
-
40
- export const Focused: Story = {
41
- render: () => {
42
- const [input, setInput] = createSignal('');
43
- const [model, setModel] = createSignal('claude-4');
44
- return (
45
- <ChatConfig proseSize="base">
46
- <div style={{ width: '860px', height: '680px' }} class="flex flex-col overflow-hidden rounded-xl border border-border bg-background">
47
- <header class="flex h-14 shrink-0 items-center justify-between border-b border-border px-5">
48
- <span class="text-sm font-semibold text-foreground">New conversation</span>
49
- <ModelSwitcher models={models} currentModelId={model()} onModelChange={setModel} />
50
- </header>
51
-
52
- <div class="relative flex-1 overflow-y-auto">
53
- <ChatContainer class="h-full">
54
- <ChatContainerContent class="space-y-6 px-5 py-6">
55
- <Message class="mx-auto flex w-full max-w-2xl flex-col items-end">
56
- <MessageContent class="bg-muted text-primary max-w-[85%] rounded-3xl px-5 py-2.5">
57
- In one paragraph, why is SolidJS reactivity fast?
58
- </MessageContent>
59
- </Message>
60
-
61
- <Message class="mx-auto flex w-full max-w-2xl flex-col items-start">
62
- <div class="group flex w-full flex-col">
63
- <MessageContent markdown class="bg-transparent p-0 text-foreground">
64
- {answer}
65
- </MessageContent>
66
- <MessageActions class="-ml-2.5 flex gap-0 opacity-0 transition-opacity duration-150 group-hover:opacity-100">
67
- <Button variant="ghost" size="icon-sm" class="rounded-full" aria-label="Copy message"><Copy class="size-3.5" /></Button>
68
- <Button variant="ghost" size="icon-sm" class="rounded-full" aria-label="Good response"><ThumbsUp class="size-3.5" /></Button>
69
- </MessageActions>
70
- </div>
71
- </Message>
72
- <ChatContainerScrollAnchor />
73
- </ChatContainerContent>
74
- </ChatContainer>
75
- </div>
76
-
77
- <div class="shrink-0 px-5 pb-5">
78
- <div class="mx-auto max-w-2xl">
79
- <PromptInput value={input()} onValueChange={setInput} onSubmit={() => setInput('')}>
80
- <PromptInputTextarea placeholder="Reply…" class="min-h-[44px] pt-3 pl-4" />
81
- <PromptInputActions class="mt-2 flex w-full items-center justify-end gap-2 px-3 pb-3">
82
- <Button size="icon-sm" class="rounded-full" disabled={!input().trim()} aria-label="Send message">
83
- <ArrowUp class="size-4" />
84
- </Button>
85
- </PromptInputActions>
86
- </PromptInput>
87
- </div>
88
- </div>
89
- </div>
90
- </ChatConfig>
91
- );
92
- },
93
- };
@@ -1,93 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { createSignal } from 'solid-js';
3
- import {
4
- ChatConfig, ChatContainer, ChatContainerContent, ChatContainerScrollAnchor,
5
- Message, MessageAvatar, MessageContent,
6
- PromptInput, PromptInputTextarea, PromptInputActions, Button,
7
- } from '../index';
8
- import { ArrowUp, X } from 'lucide-solid';
9
-
10
- const meta: Meta = {
11
- title: 'Patterns/Docked Widget',
12
- parameters: {
13
- layout: 'centered',
14
- docs: {
15
- description: {
16
- component:
17
- 'A support-assistant widget docked to the bottom-right corner of a host page. The same building blocks (`ChatContainer` + `Message` + `PromptInput`) shrink into a compact floating card — the kit\'s Shadow-DOM isolation means it can sit over any app without CSS bleed.',
18
- },
19
- },
20
- },
21
- };
22
- export default meta;
23
- type Story = StoryObj;
24
-
25
- export const SupportAssistant: Story = {
26
- render: () => {
27
- const [input, setInput] = createSignal('');
28
- return (
29
- <ChatConfig proseSize="sm">
30
- {/* Faux host page */}
31
- <div style={{ width: '920px', height: '680px' }} class="relative overflow-hidden rounded-xl border border-border bg-gradient-to-br from-muted/40 to-background">
32
- <div class="space-y-3 p-8">
33
- <div class="h-7 w-48 rounded-md bg-muted" />
34
- <div class="h-4 w-2/3 rounded bg-muted/70" />
35
- <div class="h-4 w-1/2 rounded bg-muted/70" />
36
- <div class="mt-6 grid grid-cols-3 gap-4">
37
- <div class="h-28 rounded-lg bg-muted/60" />
38
- <div class="h-28 rounded-lg bg-muted/60" />
39
- <div class="h-28 rounded-lg bg-muted/60" />
40
- </div>
41
- </div>
42
-
43
- {/* Docked chat widget */}
44
- <div style={{ width: '360px', height: '460px' }} class="absolute bottom-5 right-5 flex flex-col overflow-hidden rounded-2xl border border-border bg-card shadow-xl">
45
- <header class="flex shrink-0 items-center justify-between border-b border-border px-4 py-3">
46
- <div class="flex items-center gap-2">
47
- <span class="size-2 rounded-full bg-tool-green" />
48
- <span class="text-sm font-semibold text-foreground">Support</span>
49
- </div>
50
- <Button variant="ghost" size="icon-sm" aria-label="Close"><X class="size-4" /></Button>
51
- </header>
52
-
53
- <div class="relative flex-1 overflow-y-auto">
54
- <ChatContainer class="h-full">
55
- <ChatContainerContent class="space-y-3 px-3 py-3">
56
- <Message>
57
- <MessageAvatar src="" alt="AI" fallback="AI" />
58
- <MessageContent markdown class="bg-transparent p-0 pt-1">
59
- Hi! 👋 How can I help you today?
60
- </MessageContent>
61
- </Message>
62
- <Message class="flex-col items-end">
63
- <MessageContent class="bg-muted text-primary max-w-[85%] rounded-xl px-3.5 py-2">
64
- How do I reset my password?
65
- </MessageContent>
66
- </Message>
67
- <Message>
68
- <MessageAvatar src="" alt="AI" fallback="AI" />
69
- <MessageContent markdown class="bg-transparent p-0 pt-1">
70
- Head to **Settings → Security** and click **Reset password** — you'll get an email link.
71
- </MessageContent>
72
- </Message>
73
- <ChatContainerScrollAnchor />
74
- </ChatContainerContent>
75
- </ChatContainer>
76
- </div>
77
-
78
- <div class="shrink-0 px-3 pb-3">
79
- <PromptInput value={input()} onValueChange={setInput} onSubmit={() => setInput('')}>
80
- <PromptInputTextarea placeholder="Message support…" class="min-h-[40px] pt-2.5 pl-3.5" />
81
- <PromptInputActions class="mt-1.5 flex w-full items-center justify-end gap-2 px-2.5 pb-2.5">
82
- <Button size="icon-sm" class="rounded-full" disabled={!input().trim()} aria-label="Send message">
83
- <ArrowUp class="size-4" />
84
- </Button>
85
- </PromptInputActions>
86
- </PromptInput>
87
- </div>
88
- </div>
89
- </div>
90
- </ChatConfig>
91
- );
92
- },
93
- };
@@ -1,76 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { createSignal } from 'solid-js';
3
- import {
4
- ChatConfig, Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent,
5
- PromptSuggestion, PromptInput, PromptInputTextarea, PromptInputActions, Button,
6
- } from '../index';
7
- import { Sparkles, Plus, Globe, ArrowUp } from 'lucide-solid';
8
-
9
- const meta: Meta = {
10
- title: 'Patterns/Empty State',
11
- parameters: {
12
- layout: 'centered',
13
- docs: {
14
- description: {
15
- component:
16
- 'The new-chat zero state: a centered greeting with starter suggestions above the composer. Composed from `Empty` (+ `EmptyMedia`/`EmptyTitle`/`EmptyDescription`), `PromptSuggestion` chips, and `PromptInput`. Clicking a suggestion fills the composer.',
17
- },
18
- },
19
- },
20
- };
21
- export default meta;
22
- type Story = StoryObj;
23
-
24
- const SUGGESTIONS = [
25
- 'Summarize a document',
26
- 'Draft a product update',
27
- 'Explain a code snippet',
28
- 'Plan my week',
29
- ];
30
-
31
- export const NewChat: Story = {
32
- render: () => {
33
- const [input, setInput] = createSignal('');
34
- return (
35
- <ChatConfig proseSize="base">
36
- <div style={{ width: '760px', height: '640px' }} class="flex flex-col overflow-hidden rounded-xl border border-border bg-background">
37
- <Empty class="flex-1">
38
- <EmptyHeader>
39
- <EmptyMedia variant="icon">
40
- <Sparkles class="size-6" />
41
- </EmptyMedia>
42
- <EmptyTitle>How can I help today?</EmptyTitle>
43
- <EmptyDescription>
44
- Ask anything, or start from one of these.
45
- </EmptyDescription>
46
- </EmptyHeader>
47
- <EmptyContent>
48
- <div class="flex max-w-md flex-wrap justify-center gap-2">
49
- {SUGGESTIONS.map((s) => (
50
- <PromptSuggestion onClick={() => setInput(s)}>{s}</PromptSuggestion>
51
- ))}
52
- </div>
53
- </EmptyContent>
54
- </Empty>
55
-
56
- <div class="shrink-0 px-4 pb-4">
57
- <div class="mx-auto max-w-2xl">
58
- <PromptInput value={input()} onValueChange={setInput} onSubmit={() => setInput('')}>
59
- <PromptInputTextarea placeholder="Ask anything…" class="min-h-[44px] pt-3 pl-4" />
60
- <PromptInputActions class="mt-2 flex w-full items-center justify-between gap-2 px-3 pb-3">
61
- <div class="flex items-center gap-2">
62
- <Button variant="outline" size="icon-sm" class="rounded-full" aria-label="Add"><Plus class="size-4" /></Button>
63
- <Button variant="outline" size="sm" class="rounded-full gap-1" aria-label="Search the web"><Globe class="size-4" />Search</Button>
64
- </div>
65
- <Button size="icon-sm" class="rounded-full" disabled={!input().trim()} aria-label="Send message">
66
- <ArrowUp class="size-4" />
67
- </Button>
68
- </PromptInputActions>
69
- </PromptInput>
70
- </div>
71
- </div>
72
- </div>
73
- </ChatConfig>
74
- );
75
- },
76
- };