@kitn.ai/ui 0.14.1 → 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 (179) hide show
  1. package/dist/kitn-chat.es.js +1 -1
  2. package/package.json +6 -1
  3. package/src/components/component-meta.json +10 -10
  4. package/src/elements/compiled.css +1 -1
  5. package/src/remote/host-embed.ts +1 -1
  6. package/src/components/artifact.stories.tsx +0 -138
  7. package/src/components/attachments.stories.tsx +0 -303
  8. package/src/components/attachments.test.tsx +0 -64
  9. package/src/components/chain-of-thought.stories.tsx +0 -211
  10. package/src/components/chat-container.stories.tsx +0 -187
  11. package/src/components/chat-thread.test.tsx +0 -58
  12. package/src/components/checkpoint.stories.tsx +0 -102
  13. package/src/components/code-block.stories.tsx +0 -150
  14. package/src/components/confirm-card.stories.tsx +0 -74
  15. package/src/components/context.stories.tsx +0 -229
  16. package/src/components/context.test.tsx +0 -133
  17. package/src/components/conversation-item.stories.tsx +0 -125
  18. package/src/components/conversation-list.stories.tsx +0 -133
  19. package/src/components/default-input.test.tsx +0 -111
  20. package/src/components/empty.stories.tsx +0 -434
  21. package/src/components/feedback-bar.stories.tsx +0 -138
  22. package/src/components/feedback-bar.test.tsx +0 -103
  23. package/src/components/file-tree.stories.tsx +0 -73
  24. package/src/components/file-upload.stories.tsx +0 -156
  25. package/src/components/image.stories.tsx +0 -89
  26. package/src/components/loader.stories.tsx +0 -181
  27. package/src/components/markdown.stories.tsx +0 -180
  28. package/src/components/message-action-bar.test.tsx +0 -128
  29. package/src/components/message-narrow.stories.tsx +0 -329
  30. package/src/components/message-skills.stories.tsx +0 -211
  31. package/src/components/message.stories.tsx +0 -281
  32. package/src/components/model-switcher.stories.tsx +0 -123
  33. package/src/components/model-switcher.test.tsx +0 -65
  34. package/src/components/prompt-input.stories.tsx +0 -222
  35. package/src/components/prompt-suggestion.stories.tsx +0 -142
  36. package/src/components/reasoning.stories.tsx +0 -140
  37. package/src/components/resizable.test.tsx +0 -226
  38. package/src/components/scroll-button.stories.tsx +0 -100
  39. package/src/components/slash-command.stories.tsx +0 -163
  40. package/src/components/source-list.test.tsx +0 -152
  41. package/src/components/source.stories.tsx +0 -124
  42. package/src/components/tasks-card.stories.tsx +0 -78
  43. package/src/components/text-shimmer.stories.tsx +0 -87
  44. package/src/components/thinking-bar.stories.tsx +0 -87
  45. package/src/components/tool.stories.tsx +0 -153
  46. package/src/components/voice-input.stories.tsx +0 -83
  47. package/src/elements/artifact.stories.tsx +0 -506
  48. package/src/elements/attachments.stories.tsx +0 -190
  49. package/src/elements/card.stories.tsx +0 -113
  50. package/src/elements/cards.stories.tsx +0 -59
  51. package/src/elements/catalog.stories.tsx +0 -491
  52. package/src/elements/chain-of-thought.declarative.test.tsx +0 -153
  53. package/src/elements/chain-of-thought.stories.tsx +0 -113
  54. package/src/elements/chat-scope-picker.stories.tsx +0 -73
  55. package/src/elements/chat-workspace.stories.tsx +0 -288
  56. package/src/elements/chat.stories.tsx +0 -151
  57. package/src/elements/checkpoint.stories.tsx +0 -72
  58. package/src/elements/choice.stories.tsx +0 -240
  59. package/src/elements/code-block.stories.tsx +0 -83
  60. package/src/elements/composed-shell.stories.tsx +0 -316
  61. package/src/elements/confirm-card.stories.tsx +0 -227
  62. package/src/elements/context-meter.stories.tsx +0 -151
  63. package/src/elements/conversation-list.declarative.test.tsx +0 -137
  64. package/src/elements/conversation-list.stories.tsx +0 -243
  65. package/src/elements/embed.stories.tsx +0 -213
  66. package/src/elements/empty.stories.tsx +0 -111
  67. package/src/elements/feedback-bar.stories.tsx +0 -114
  68. package/src/elements/file-tree.stories.tsx +0 -134
  69. package/src/elements/file-upload.stories.tsx +0 -82
  70. package/src/elements/form.stories.tsx +0 -248
  71. package/src/elements/image.stories.tsx +0 -71
  72. package/src/elements/link-preview.stories.tsx +0 -209
  73. package/src/elements/loader.stories.tsx +0 -88
  74. package/src/elements/markdown.stories.tsx +0 -76
  75. package/src/elements/message-skills.declarative.test.tsx +0 -104
  76. package/src/elements/message-skills.stories.tsx +0 -114
  77. package/src/elements/message.stories.tsx +0 -218
  78. package/src/elements/model-switcher.declarative.test.tsx +0 -130
  79. package/src/elements/model-switcher.stories.tsx +0 -198
  80. package/src/elements/popover.stories.tsx +0 -80
  81. package/src/elements/prompt-input-slash-command.test.tsx +0 -128
  82. package/src/elements/prompt-input-stoppable.test.tsx +0 -88
  83. package/src/elements/prompt-input-toolbar-actions.test.tsx +0 -120
  84. package/src/elements/prompt-input.stories.tsx +0 -331
  85. package/src/elements/prompt-suggestions.declarative.test.tsx +0 -164
  86. package/src/elements/prompt-suggestions.stories.tsx +0 -213
  87. package/src/elements/reasoning.stories.tsx +0 -77
  88. package/src/elements/remote.stories.tsx +0 -314
  89. package/src/elements/resizable.stories.tsx +0 -426
  90. package/src/elements/response-stream.stories.tsx +0 -79
  91. package/src/elements/scroll-button.stories.tsx +0 -202
  92. package/src/elements/scroll-button.test.tsx +0 -148
  93. package/src/elements/source-list.stories.tsx +0 -143
  94. package/src/elements/source.stories.tsx +0 -88
  95. package/src/elements/switch.stories.tsx +0 -56
  96. package/src/elements/tasks.stories.tsx +0 -237
  97. package/src/elements/text-shimmer.stories.tsx +0 -64
  98. package/src/elements/thinking-bar.stories.tsx +0 -72
  99. package/src/elements/tool.stories.tsx +0 -89
  100. package/src/elements/voice-input.stories.tsx +0 -88
  101. package/src/primitives/controllable.test.ts +0 -47
  102. package/src/stories/chat-panel-layout.stories.tsx +0 -145
  103. package/src/stories/chat-scene.tsx +0 -571
  104. package/src/stories/checkpoint-restore.stories.tsx +0 -256
  105. package/src/stories/context-usage.stories.tsx +0 -212
  106. package/src/stories/conversation-with-reasoning.stories.tsx +0 -182
  107. package/src/stories/conversation-with-sources.stories.tsx +0 -471
  108. package/src/stories/docs/Accessibility.mdx +0 -119
  109. package/src/stories/docs/ChildElements.mdx +0 -269
  110. package/src/stories/docs/ForAIAgents.mdx +0 -162
  111. package/src/stories/docs/GettingStarted.mdx +0 -65
  112. package/src/stories/docs/Installation.mdx +0 -83
  113. package/src/stories/docs/Introduction.mdx +0 -50
  114. package/src/stories/docs/SolidJsAdvanced.mdx +0 -17
  115. package/src/stories/docs/Theming.mdx +0 -85
  116. package/src/stories/docs/element-controls.ts +0 -121
  117. package/src/stories/docs/frameworks/Angular.mdx +0 -245
  118. package/src/stories/docs/frameworks/Html.mdx +0 -227
  119. package/src/stories/docs/frameworks/Overview.mdx +0 -47
  120. package/src/stories/docs/frameworks/React.mdx +0 -227
  121. package/src/stories/docs/frameworks/Solid.mdx +0 -173
  122. package/src/stories/docs/frameworks/Svelte.mdx +0 -194
  123. package/src/stories/docs/frameworks/Vue.mdx +0 -238
  124. package/src/stories/docs/generative-ui-overview.mdx +0 -186
  125. package/src/stories/docs/recipes/SpeechToText.mdx +0 -7
  126. package/src/stories/docs/recipes/Streaming.mdx +0 -68
  127. package/src/stories/docs/recipes/TextToSpeech.mdx +0 -35
  128. package/src/stories/docs/theme-editor/canvas.tsx +0 -32
  129. package/src/stories/docs/theme-editor/inspector.tsx +0 -66
  130. package/src/stories/docs/theme-editor/presets.test.ts +0 -32
  131. package/src/stories/docs/theme-editor/presets.ts +0 -64
  132. package/src/stories/docs/theme-editor/theme-css.test.ts +0 -19
  133. package/src/stories/docs/theme-editor/theme-css.ts +0 -15
  134. package/src/stories/docs/theme-editor/theme-editor.tsx +0 -146
  135. package/src/stories/docs/theme-tokens.tsx +0 -174
  136. package/src/stories/examples/ChoosingComponents.mdx +0 -106
  137. package/src/stories/examples/sample-data.ts +0 -79
  138. package/src/stories/examples/usage/checkpoint-restore.ts +0 -156
  139. package/src/stories/examples/usage/context-usage.ts +0 -591
  140. package/src/stories/examples/usage/conversation-with-reasoning.ts +0 -224
  141. package/src/stories/examples/usage/conversation-with-sources.ts +0 -589
  142. package/src/stories/examples/usage/empty-state.ts +0 -144
  143. package/src/stories/examples/usage/full-chat-app.ts +0 -277
  144. package/src/stories/examples/usage/index.ts +0 -63
  145. package/src/stories/examples/usage/message-actions.ts +0 -704
  146. package/src/stories/examples/usage/pattern-centered-conversation.ts +0 -446
  147. package/src/stories/examples/usage/pattern-chat-panel-layout.ts +0 -442
  148. package/src/stories/examples/usage/pattern-docked-widget.ts +0 -479
  149. package/src/stories/examples/usage/prompt-input-variants.ts +0 -1356
  150. package/src/stories/examples/usage/streaming-response.ts +0 -687
  151. package/src/stories/examples/usage/types.ts +0 -33
  152. package/src/stories/full-chat.stories.tsx +0 -18
  153. package/src/stories/message-actions.stories.tsx +0 -230
  154. package/src/stories/pattern-centered-conversation.stories.tsx +0 -93
  155. package/src/stories/pattern-docked-widget.stories.tsx +0 -93
  156. package/src/stories/pattern-empty-state.stories.tsx +0 -76
  157. package/src/stories/prompt-input-variants.stories.tsx +0 -456
  158. package/src/stories/streaming-response.stories.tsx +0 -438
  159. package/src/stories/theme-editor.stories.tsx +0 -16
  160. package/src/stories/token-reference.stories.tsx +0 -18
  161. package/src/stories/typography.stories.tsx +0 -78
  162. package/src/ui/avatar.stories.tsx +0 -103
  163. package/src/ui/badge.stories.tsx +0 -86
  164. package/src/ui/button.stories.tsx +0 -145
  165. package/src/ui/collapsible.stories.tsx +0 -69
  166. package/src/ui/dropdown.stories.tsx +0 -59
  167. package/src/ui/hover-card.stories.tsx +0 -77
  168. package/src/ui/hover-card.test.tsx +0 -30
  169. package/src/ui/overlay.stories.tsx +0 -115
  170. package/src/ui/popover.stories.tsx +0 -81
  171. package/src/ui/popover.test.tsx +0 -99
  172. package/src/ui/resizable.stories.tsx +0 -236
  173. package/src/ui/scroll-area.stories.tsx +0 -50
  174. package/src/ui/separator.stories.tsx +0 -81
  175. package/src/ui/skeleton.stories.tsx +0 -337
  176. package/src/ui/switch.stories.tsx +0 -51
  177. package/src/ui/switch.test.tsx +0 -59
  178. package/src/ui/textarea.stories.tsx +0 -76
  179. package/src/ui/tooltip.stories.tsx +0 -74
@@ -1,73 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { createSignal } from 'solid-js';
3
- import { FileTree, type FileTreeFile } from './file-tree';
4
- import { componentDescription } from '../stories/docs/element-controls';
5
-
6
- const FILES: FileTreeFile[] = [
7
- { path: 'index.html', type: 'html' },
8
- { path: 'about.html', type: 'html' },
9
- { path: 'css/site.css', type: 'other', language: 'css' },
10
- { path: 'src/app.ts', type: 'other', language: 'ts' },
11
- { path: 'src/lib/format.ts', type: 'other', language: 'ts' },
12
- { path: 'src/lib/parse.ts', type: 'other', language: 'ts' },
13
- { path: 'assets/logo.svg', type: 'image' },
14
- { path: 'assets/report.pdf', type: 'pdf' },
15
- ];
16
-
17
- const meta = {
18
- title: 'Solid (Advanced)/Elements/FileTree',
19
- component: FileTree,
20
- tags: ['autodocs'],
21
- parameters: {
22
- layout: 'padded',
23
- docs: {
24
- description: componentDescription([
25
- 'A collapsible, keyboard-navigable file explorer built from a flat list of `/`-delimited paths — nested folders are derived automatically. ARIA `tree`/`treeitem`.',
26
- '**When to use:** any file/folder tree — the Code tab of `Artifact` uses it, and it is exported for standalone reuse (project explorers, attachment browsers, doc outlines).',
27
- '**How to use:** pass `files` (`{ path, url?, code?, language?, type? }[]`); folders come from `/` in each path and `type` picks the icon. Control highlight via `activeFile`, initial open folders via `defaultExpanded`, and handle `onSelect(path, file)`. Arrow keys navigate; Enter/Space selects or toggles.',
28
- '**Placement:** a sidebar/explorer column.',
29
- ]),
30
- },
31
- },
32
- argTypes: {
33
- files: { control: false },
34
- activeFile: { control: 'text' },
35
- },
36
- args: { files: FILES, activeFile: 'src/app.ts' },
37
- render: (args) => (
38
- <div class="w-64 h-80 overflow-auto rounded-lg border border-border scrollbar-thin">
39
- <FileTree files={args.files} activeFile={args.activeFile} />
40
- </div>
41
- ),
42
- } satisfies Meta<typeof FileTree>;
43
-
44
- export default meta;
45
- type Story = StoryObj<typeof meta>;
46
-
47
- const IMPORT = `import { FileTree } from '@kitn.ai/ui';`;
48
- const src = (code: string) => ({
49
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
50
- });
51
-
52
- export const Playground: Story = {
53
- ...src(`<FileTree files={files} activeFile="src/app.ts" onSelect={(p) => set(p)} />`),
54
- };
55
-
56
- /** Drives selection from `onSelect` — the controlled pattern. */
57
- export const Interactive: Story = {
58
- render: () => {
59
- const [active, setActive] = createSignal('src/lib/format.ts');
60
- return (
61
- <div class="flex flex-col gap-2">
62
- <div class="w-64 h-80 overflow-auto rounded-lg border border-border scrollbar-thin">
63
- <FileTree files={FILES} activeFile={active()} onSelect={(p) => setActive(p)} />
64
- </div>
65
- <span class="text-sm text-muted-foreground">
66
- Selected: <code>{active()}</code>
67
- </span>
68
- </div>
69
- );
70
- },
71
- ...src(`const [active, setActive] = createSignal('src/lib/format.ts');
72
- <FileTree files={files} activeFile={active()} onSelect={setActive} />`),
73
- };
@@ -1,156 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { fn } from 'storybook/test';
3
- import { createSignal, For } from 'solid-js';
4
- import { FileUpload, FileUploadTrigger, FileUploadContent } from './file-upload';
5
- import { Upload } from 'lucide-solid';
6
- import { componentDescription } from '../stories/docs/element-controls';
7
-
8
- const meta = {
9
- title: 'Solid (Advanced)/Elements/FileUpload',
10
- component: FileUpload,
11
- tags: ['autodocs'],
12
- parameters: {
13
- layout: 'padded',
14
- docs: {
15
- controls: { exclude: ['use:eventListener'] },
16
- description: componentDescription([
17
- 'A headless file-upload root that handles window-wide drag-and-drop plus a hidden file input, composed with `FileUploadTrigger` (opens the picker) and `FileUploadContent` (full-screen drop overlay).',
18
- '**When to use:** to let users attach files to a chat — via a button click or by dragging files anywhere onto the page.',
19
- '**How to use:** wrap a `FileUploadTrigger` and optional `FileUploadContent` in `FileUpload`, and read selected files from `onFilesAdded`. Set `multiple`, `accept`, or `disabled` as needed.',
20
- '**Placement:** in the prompt input area or composer toolbar where attachments are added.',
21
- ]),
22
- },
23
- },
24
- argTypes: {
25
- multiple: {
26
- control: 'boolean',
27
- description: 'Allow selecting / dropping more than one file.',
28
- table: { defaultValue: { summary: 'true' } },
29
- },
30
- accept: {
31
- control: 'text',
32
- description: 'Accepted file types, forwarded to the file input (e.g. `image/*`).',
33
- },
34
- disabled: {
35
- control: 'boolean',
36
- description: 'Disables the file input and suppresses the drop overlay.',
37
- },
38
- onFilesAdded: {
39
- action: 'filesAdded',
40
- description: 'Fired with the selected/dropped `File[]` (capped to one when `multiple` is false).',
41
- table: { category: 'Events' },
42
- },
43
- children: {
44
- control: false,
45
- description: 'Trigger and overlay composition (`FileUploadTrigger`, `FileUploadContent`).',
46
- },
47
- },
48
- args: {
49
- multiple: true,
50
- onFilesAdded: fn(),
51
- },
52
- render: (args) => (
53
- <FileUpload {...args}>
54
- <FileUploadTrigger class="inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground hover:bg-primary/90">
55
- <Upload class="size-4" />
56
- Upload files
57
- </FileUploadTrigger>
58
- <FileUploadContent class="flex flex-col items-center gap-2">
59
- <Upload class="size-12 text-muted-foreground" />
60
- <p class="text-lg font-medium">Drop files here</p>
61
- </FileUploadContent>
62
- </FileUpload>
63
- ),
64
- } satisfies Meta<typeof FileUpload>;
65
-
66
- export default meta;
67
- type Story = StoryObj<typeof meta>;
68
-
69
- const IMPORT = `import { FileUpload, FileUploadTrigger, FileUploadContent } from '@kitn.ai/ui';`;
70
- const src = (code: string) => ({
71
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
72
- });
73
-
74
- /** Interactive playground — toggle multiple/disabled and watch the `filesAdded` action. */
75
- export const Playground: Story = {
76
- ...src(`<FileUpload onFilesAdded={(files) => console.log(files)}>
77
- <FileUploadTrigger class="...">
78
- <Upload class="size-4" /> Upload files
79
- </FileUploadTrigger>
80
- <FileUploadContent class="...">
81
- <Upload class="size-12" />
82
- <p>Drop files here</p>
83
- </FileUploadContent>
84
- </FileUpload>`),
85
- };
86
-
87
- /** Multi-file upload with a live list of selected files (showcase). */
88
- export const Default: Story = {
89
- render: () => {
90
- const [files, setFiles] = createSignal<File[]>([]);
91
- return (
92
- <div class="space-y-4">
93
- <FileUpload onFilesAdded={(f) => setFiles((prev) => [...prev, ...f])}>
94
- <FileUploadTrigger class="inline-flex items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground hover:bg-primary/90">
95
- <Upload class="size-4" />
96
- Upload files
97
- </FileUploadTrigger>
98
- <FileUploadContent class="flex flex-col items-center gap-2">
99
- <Upload class="size-12 text-muted-foreground" />
100
- <p class="text-lg font-medium">Drop files here</p>
101
- </FileUploadContent>
102
- </FileUpload>
103
- <div class="space-y-1">
104
- <For each={files()}>
105
- {(file) => (
106
- <div class="text-sm text-muted-foreground">
107
- {file.name} ({(file.size / 1024).toFixed(1)} KB)
108
- </div>
109
- )}
110
- </For>
111
- </div>
112
- </div>
113
- );
114
- },
115
- ...src(`<FileUpload onFilesAdded={(f) => setFiles((prev) => [...prev, ...f])}>
116
- <FileUploadTrigger class="...">
117
- <Upload class="size-4" /> Upload files
118
- </FileUploadTrigger>
119
- <FileUploadContent class="...">
120
- <Upload class="size-12" />
121
- <p>Drop files here</p>
122
- </FileUploadContent>
123
- </FileUpload>`),
124
- };
125
-
126
- /** Single-file, image-only upload (showcase). */
127
- export const SingleFile: Story = {
128
- render: () => {
129
- const [file, setFile] = createSignal<File | null>(null);
130
- return (
131
- <div class="space-y-4">
132
- <FileUpload
133
- onFilesAdded={(f) => setFile(f[0] ?? null)}
134
- multiple={false}
135
- accept="image/*"
136
- >
137
- <FileUploadTrigger class="rounded-md bg-muted px-4 py-2 text-sm hover:bg-muted/80">
138
- Choose image
139
- </FileUploadTrigger>
140
- <FileUploadContent>
141
- <p class="text-lg font-medium">Drop an image here</p>
142
- </FileUploadContent>
143
- </FileUpload>
144
- <div class="text-sm text-muted-foreground">
145
- {file() ? `Selected: ${file()!.name}` : 'No file selected'}
146
- </div>
147
- </div>
148
- );
149
- },
150
- ...src(`<FileUpload onFilesAdded={(f) => setFile(f[0] ?? null)} multiple={false} accept="image/*">
151
- <FileUploadTrigger class="...">Choose image</FileUploadTrigger>
152
- <FileUploadContent>
153
- <p>Drop an image here</p>
154
- </FileUploadContent>
155
- </FileUpload>`),
156
- };
@@ -1,89 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { Image } from './image';
3
- import { componentDescription } from '../stories/docs/element-controls';
4
-
5
- // Compact SVG chat typing icon as base64
6
- const chatIconBase64 =
7
- 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0OCIgaGVpZ2h0PSI0OCIgdmlld0JveD0iMCAwIDQ4IDQ4Ij48cmVjdCB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHJ4PSIxMCIgZmlsbD0iIzdjM2FlZCIvPjxjaXJjbGUgY3g9IjE2IiBjeT0iMjQiIHI9IjQiIGZpbGw9IiNmZmYiLz48Y2lyY2xlIGN4PSIyNCIgY3k9IjI0IiByPSI0IiBmaWxsPSIjZmZmIi8+PGNpcmNsZSBjeD0iMzIiIGN5PSIyNCIgcj0iNCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==';
8
-
9
- const meta = {
10
- title: 'Solid (Advanced)/Elements/Image',
11
- component: Image,
12
- tags: ['autodocs'],
13
- parameters: {
14
- layout: 'padded',
15
- docs: {
16
- controls: { exclude: ['use:eventListener'] },
17
- description: componentDescription([
18
- 'Renders an image from a `base64` string or a `uint8Array`, building a data URL or object URL automatically; shows a pulsing placeholder until a source is available.',
19
- '**When to use:** to display model-generated or attached images supplied as raw bytes / base64 (the `GeneratedImageLike` shape) rather than a remote URL.',
20
- '**How to use:** pass `base64` + `mediaType` (or `uint8Array` + `mediaType`) and an `alt` description; size and style via `class`.',
21
- '**Placement:** inside assistant messages, attachment previews, or anywhere a generated image needs to be shown.',
22
- ]),
23
- },
24
- },
25
- argTypes: {
26
- base64: {
27
- control: 'text',
28
- description: 'Base64-encoded image data. Combined with `mediaType` to form a data URL.',
29
- },
30
- uint8Array: {
31
- control: 'object',
32
- description: 'Raw image bytes. Combined with `mediaType` to form an object URL.',
33
- },
34
- mediaType: {
35
- control: 'text',
36
- description: 'MIME type of the image data, e.g. `image/png` or `image/svg+xml`.',
37
- table: { defaultValue: { summary: 'image/png' } },
38
- },
39
- alt: {
40
- control: 'text',
41
- description: 'Alternative text describing the image (also used on the placeholder).',
42
- },
43
- class: {
44
- control: 'text',
45
- description: 'Additional CSS classes for the image / placeholder element.',
46
- },
47
- },
48
- args: {
49
- base64: chatIconBase64,
50
- mediaType: 'image/svg+xml',
51
- alt: 'Compact gradient chat icon',
52
- class: 'h-24 w-24 rounded-md',
53
- },
54
- render: (args) => <Image {...args} />,
55
- } satisfies Meta<typeof Image>;
56
-
57
- export default meta;
58
- type Story = StoryObj<typeof meta>;
59
-
60
- const IMPORT = `import { Image } from '@kitn.ai/ui';`;
61
- const src = (code: string) => ({
62
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
63
- });
64
-
65
- /** Interactive playground — swap the base64 data, media type, and sizing classes. */
66
- export const Playground: Story = {
67
- ...src(`<Image
68
- base64={chatIconBase64}
69
- mediaType="image/svg+xml"
70
- alt="Compact gradient chat icon"
71
- class="h-24 w-24 rounded-md"
72
- />`),
73
- };
74
-
75
- export const Basic: Story = {
76
- args: { class: 'h-24 w-24 rounded-md' },
77
- ...src(`<Image base64={chatIconBase64} mediaType="image/svg+xml" alt="Compact gradient chat icon" class="h-24 w-24 rounded-md" />`),
78
- };
79
-
80
- export const CustomSize: Story = {
81
- args: { alt: 'Large preview', class: 'h-64 w-64 rounded-lg' },
82
- ...src(`<Image base64={chatIconBase64} mediaType="image/svg+xml" alt="Large preview" class="h-64 w-64 rounded-lg" />`),
83
- };
84
-
85
- /** Placeholder state shown while no `base64`/`uint8Array` source is available (showcase). */
86
- export const Placeholder: Story = {
87
- render: () => <Image alt="Loading image" class="h-24 w-24 rounded-md" />,
88
- ...src(`<Image alt="Loading image" class="h-24 w-24 rounded-md" />`),
89
- };
@@ -1,181 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { For } from 'solid-js';
3
- import { Loader, type LoaderVariant, type LoaderSize } from './loader';
4
- import { componentDescription } from '../stories/docs/element-controls';
5
-
6
- const meta = {
7
- title: 'Solid (Advanced)/Elements/Loader',
8
- component: Loader,
9
- tags: ['autodocs'],
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- controls: { exclude: ['use:eventListener'] },
14
- description: componentDescription([
15
- 'A loading indicator with twelve animated **variants** (spinners, dots, bars, terminal, and text-based) in three **sizes**.',
16
- '**When to use:** while waiting on an async operation — a streaming response, a tool call, or any pending state.',
17
- '**How to use:** pick a `variant` and `size`. Text variants (`text-blink`, `text-shimmer`, `loading-dots`) display the `text` prop (defaults to "Thinking").',
18
- '**Placement:** inside assistant message bubbles, send-button states, empty states, or anywhere an in-progress signal is needed.',
19
- ]),
20
- },
21
- },
22
- argTypes: {
23
- variant: {
24
- control: 'select',
25
- options: [
26
- 'circular', 'classic', 'pulse', 'pulse-dot', 'dots', 'typing',
27
- 'wave', 'bars', 'terminal', 'text-blink', 'text-shimmer', 'loading-dots',
28
- ],
29
- description: 'Animation style of the loader.',
30
- table: { defaultValue: { summary: 'circular' } },
31
- },
32
- size: {
33
- control: 'select',
34
- options: ['sm', 'md', 'lg'],
35
- description: 'Loader size preset.',
36
- table: { defaultValue: { summary: 'md' } },
37
- },
38
- text: {
39
- control: 'text',
40
- description: 'Label shown by the text variants (`text-blink`, `text-shimmer`, `loading-dots`).',
41
- table: { defaultValue: { summary: 'Thinking' } },
42
- },
43
- class: {
44
- control: 'text',
45
- description: 'Additional CSS classes for the loader element.',
46
- },
47
- },
48
- args: {
49
- variant: 'circular',
50
- size: 'md',
51
- text: 'Thinking',
52
- },
53
- render: (args) => <Loader {...args} />,
54
- } satisfies Meta<typeof Loader>;
55
-
56
- export default meta;
57
- type Story = StoryObj<typeof meta>;
58
-
59
- const IMPORT = `import { Loader } from '@kitn.ai/ui';`;
60
- const src = (code: string) => ({
61
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
62
- });
63
-
64
- /** Interactive playground — switch variant, size, and text to explore every loader. */
65
- export const Playground: Story = {
66
- ...src(`<Loader variant="circular" size="md" />`),
67
- };
68
-
69
- export const Classic: Story = {
70
- args: { variant: 'classic' },
71
- ...src(`<Loader variant="classic" size="md" />`),
72
- };
73
-
74
- export const Pulse: Story = {
75
- args: { variant: 'pulse' },
76
- ...src(`<Loader variant="pulse" size="md" />`),
77
- };
78
-
79
- export const PulseDot: Story = {
80
- args: { variant: 'pulse-dot' },
81
- ...src(`<Loader variant="pulse-dot" size="md" />`),
82
- };
83
-
84
- export const Dots: Story = {
85
- args: { variant: 'dots' },
86
- ...src(`<Loader variant="dots" size="md" />`),
87
- };
88
-
89
- export const Typing: Story = {
90
- args: { variant: 'typing' },
91
- ...src(`<Loader variant="typing" size="md" />`),
92
- };
93
-
94
- export const Wave: Story = {
95
- args: { variant: 'wave' },
96
- ...src(`<Loader variant="wave" size="md" />`),
97
- };
98
-
99
- export const Bars: Story = {
100
- args: { variant: 'bars' },
101
- ...src(`<Loader variant="bars" size="md" />`),
102
- };
103
-
104
- export const Terminal: Story = {
105
- args: { variant: 'terminal' },
106
- ...src(`<Loader variant="terminal" size="md" />`),
107
- };
108
-
109
- export const TextBlink: Story = {
110
- args: { variant: 'text-blink', text: 'Thinking' },
111
- ...src(`<Loader variant="text-blink" text="Thinking" size="md" />`),
112
- };
113
-
114
- export const TextShimmer: Story = {
115
- args: { variant: 'text-shimmer', text: 'Analyzing' },
116
- ...src(`<Loader variant="text-shimmer" text="Analyzing" size="md" />`),
117
- };
118
-
119
- export const LoadingDots: Story = {
120
- args: { variant: 'loading-dots', text: 'Processing' },
121
- ...src(`<Loader variant="loading-dots" text="Processing" size="md" />`),
122
- };
123
-
124
- const allVariants: LoaderVariant[] = [
125
- 'circular', 'classic', 'pulse', 'pulse-dot', 'dots', 'typing',
126
- 'wave', 'bars', 'terminal', 'text-blink', 'text-shimmer', 'loading-dots',
127
- ];
128
-
129
- const allSizes: LoaderSize[] = ['sm', 'md', 'lg'];
130
-
131
- /** Every variant across every size (showcase — not driven by controls). */
132
- export const AllVariantsGrid: Story = {
133
- render: () => (
134
- <div class="space-y-6">
135
- <For each={allVariants}>
136
- {(variant) => (
137
- <div class="flex items-center gap-6">
138
- <span class="w-28 text-sm text-muted-foreground font-mono">{variant}</span>
139
- <For each={allSizes}>
140
- {(size) => (
141
- <div class="flex items-center justify-center w-24 h-10">
142
- <Loader
143
- variant={variant}
144
- size={size}
145
- text={['text-blink', 'text-shimmer', 'loading-dots'].includes(variant) ? 'Loading' : undefined}
146
- />
147
- </div>
148
- )}
149
- </For>
150
- </div>
151
- )}
152
- </For>
153
- </div>
154
- ),
155
- ...src(`<Loader variant="circular" size="sm" />
156
- <Loader variant="circular" size="md" />
157
- <Loader variant="circular" size="lg" />`),
158
- };
159
-
160
- /** A single variant rendered at all three sizes (showcase). */
161
- export const AllSizes: Story = {
162
- render: () => (
163
- <div class="flex items-end gap-6">
164
- <div class="text-center space-y-2">
165
- <Loader variant="circular" size="sm" />
166
- <p class="text-xs text-muted-foreground">Small</p>
167
- </div>
168
- <div class="text-center space-y-2">
169
- <Loader variant="circular" size="md" />
170
- <p class="text-xs text-muted-foreground">Medium</p>
171
- </div>
172
- <div class="text-center space-y-2">
173
- <Loader variant="circular" size="lg" />
174
- <p class="text-xs text-muted-foreground">Large</p>
175
- </div>
176
- </div>
177
- ),
178
- ...src(`<Loader variant="circular" size="sm" />
179
- <Loader variant="circular" size="md" />
180
- <Loader variant="circular" size="lg" />`),
181
- };
@@ -1,180 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { Markdown } from './markdown';
3
- import { componentDescription } from '../stories/docs/element-controls';
4
-
5
- const meta = {
6
- title: 'Solid (Advanced)/Elements/Markdown',
7
- component: Markdown,
8
- tags: ['autodocs'],
9
- parameters: {
10
- layout: 'padded',
11
- docs: {
12
- controls: { exclude: ['use:eventListener'] },
13
- description: componentDescription([
14
- 'Renders a Markdown string to styled HTML (GFM enabled — tables, lists, blockquotes), splitting fenced code into highlighted `CodeBlock`s.',
15
- '**When to use:** to display assistant message content, documentation, or any rich text authored in Markdown.',
16
- '**How to use:** pass the Markdown string as `content`; optionally set `codeTheme` for code fences and `class` for the prose container. Prose sizing follows the surrounding `ChatConfig`.',
17
- '**Placement:** inside `MessageContent`, response panels, or anywhere formatted text is shown.',
18
- ]),
19
- },
20
- },
21
- argTypes: {
22
- content: {
23
- control: 'text',
24
- description: 'The Markdown source string to render.',
25
- },
26
- id: {
27
- control: 'text',
28
- description: 'Optional stable id used for block keys (auto-generated if omitted).',
29
- },
30
- codeTheme: {
31
- control: 'text',
32
- description: 'Shiki theme name applied to fenced code blocks (falls back to the chat config theme).',
33
- },
34
- class: {
35
- control: 'text',
36
- description: 'Additional CSS classes for the prose container.',
37
- },
38
- },
39
- args: {
40
- content: 'This is a simple paragraph of text rendered through the **Markdown** component.',
41
- },
42
- render: (args) => <Markdown {...args} />,
43
- } satisfies Meta<typeof Markdown>;
44
-
45
- export default meta;
46
- type Story = StoryObj<typeof meta>;
47
-
48
- const IMPORT = `import { Markdown } from '@kitn.ai/ui';`;
49
- const src = (code: string) => ({
50
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
51
- });
52
-
53
- /** Interactive playground — edit the `content` control to render any Markdown. */
54
- export const Playground: Story = {
55
- ...src(`<Markdown content="This is a simple paragraph of **Markdown** text." />`),
56
- };
57
-
58
- export const PlainText: Story = {
59
- args: {
60
- content: 'This is a simple paragraph of text rendered through the Markdown component.',
61
- },
62
- ...src(`<Markdown content="This is a simple paragraph of text rendered through the Markdown component." />`),
63
- };
64
-
65
- export const Headings: Story = {
66
- args: {
67
- content: `# Heading 1
68
- ## Heading 2
69
- ### Heading 3
70
- #### Heading 4
71
-
72
- Some text below the headings.`,
73
- },
74
- ...src(`<Markdown content={\`# Heading 1
75
- ## Heading 2
76
- ### Heading 3
77
-
78
- Some text below the headings.\`} />`),
79
- };
80
-
81
- export const CodeBlocks: Story = {
82
- args: {
83
- content: `Here is some inline \`code\` in a paragraph.
84
-
85
- \`\`\`typescript
86
- const x: number = 42;
87
- console.log(x);
88
- \`\`\`
89
-
90
- And another block:
91
-
92
- \`\`\`python
93
- print("hello world")
94
- \`\`\``,
95
- },
96
- ...src(`<Markdown content={\`Here is some inline \\\`code\\\` in a paragraph.
97
-
98
- \\\`\\\`\\\`typescript
99
- const x: number = 42;
100
- console.log(x);
101
- \\\`\\\`\\\`\`} />`),
102
- };
103
-
104
- export const Lists: Story = {
105
- args: {
106
- content: `### Unordered List
107
- - First item
108
- - Second item
109
- - Nested item
110
- - Another nested
111
- - Third item
112
-
113
- ### Ordered List
114
- 1. Step one
115
- 2. Step two
116
- 3. Step three`,
117
- },
118
- ...src(`<Markdown content={\`### Unordered List
119
- - First item
120
- - Second item
121
- - Nested item
122
-
123
- ### Ordered List
124
- 1. Step one
125
- 2. Step two\`} />`),
126
- };
127
-
128
- export const GFMTable: Story = {
129
- args: {
130
- content: `### Comparison Table
131
-
132
- | Feature | SolidJS | React | Svelte |
133
- |---------|---------|-------|--------|
134
- | Reactivity | Fine-grained | Virtual DOM | Compiler |
135
- | Bundle Size | ~7KB | ~40KB | ~2KB |
136
- | Performance | Excellent | Good | Excellent |
137
- | Learning Curve | Moderate | Moderate | Easy |`,
138
- },
139
- ...src(`<Markdown content={\`| Feature | SolidJS | React |
140
- |---------|---------|-------|
141
- | Reactivity | Fine-grained | Virtual DOM |
142
- | Bundle Size | ~7KB | ~40KB |\`} />`),
143
- };
144
-
145
- export const RichContent: Story = {
146
- args: {
147
- class: 'max-w-2xl',
148
- content: `# Project Overview
149
-
150
- This is a **comprehensive** guide to building modern web applications.
151
-
152
- ## Key Technologies
153
-
154
- - **SolidJS** -- Reactive UI framework
155
- - **TypeScript** -- Type-safe JavaScript
156
- - **Tailwind CSS** -- Utility-first styling
157
-
158
- ## Getting Started
159
-
160
- \`\`\`bash
161
- pnpm create solid
162
- cd my-app
163
- pnpm install
164
- pnpm dev
165
- \`\`\`
166
-
167
- > **Note:** Make sure you have Node.js 18+ installed.
168
-
169
- ## Architecture
170
-
171
- | Layer | Technology | Purpose |
172
- |-------|-----------|---------|
173
- | UI | SolidJS | Components |
174
- | State | Signals | Reactivity |
175
- | Styling | Tailwind | Design |
176
-
177
- For more info, visit [solidjs.com](https://solidjs.com).`,
178
- },
179
- ...src(`<Markdown class="max-w-2xl" content={richMarkdown} />`),
180
- };