@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,337 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { Skeleton } from './skeleton';
3
- import { componentDescription } from '../stories/docs/element-controls';
4
-
5
- const meta = {
6
- title: 'Solid (Advanced)/Primitives/Skeleton',
7
- component: Skeleton,
8
- tags: ['autodocs'],
9
- parameters: {
10
- layout: 'padded',
11
- docs: {
12
- controls: { exclude: ['use:eventListener'] },
13
- description: componentDescription([
14
- 'A pulsing **placeholder** block used to indicate loading content. It has no shape of its own — size and rounding come from the `class` you pass.',
15
- '**When to use:** while content (messages, lists, cards, tool output) is loading, to preserve layout and signal progress without a spinner.',
16
- '**How to use:** compose one or more `Skeleton` elements and set width/height/rounding via utility classes (e.g. `class="h-4 w-3/4"`). Build skeletons that mirror the real layout they replace.',
17
- '**Placement:** message bubbles, conversation lists, code blocks, tool calls, input areas, and full-page loading states.',
18
- ]),
19
- },
20
- },
21
- argTypes: {
22
- class: {
23
- control: 'text',
24
- description: 'Utility classes that set the size and rounding of the placeholder.',
25
- },
26
- },
27
- args: {
28
- class: 'h-4 w-64',
29
- },
30
- render: (args) => <Skeleton {...args} />,
31
- } satisfies Meta<typeof Skeleton>;
32
-
33
- export default meta;
34
- type Story = StoryObj<typeof meta>;
35
-
36
- const IMPORT = `import { Skeleton } from '@kitn.ai/ui';`;
37
- const src = (code: string) => ({
38
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
39
- });
40
-
41
- /** Interactive playground — edit `class` to resize the placeholder. */
42
- export const Playground: Story = {
43
- ...src(`<Skeleton class="h-4 w-64" />`),
44
- };
45
-
46
- export const Basic: Story = {
47
- render: () => (
48
- <div class="space-y-3 w-80">
49
- <Skeleton class="h-4 w-full" />
50
- <Skeleton class="h-4 w-3/4" />
51
- <Skeleton class="h-4 w-1/2" />
52
- </div>
53
- ),
54
- ...src(`<div class="space-y-3 w-80">
55
- <Skeleton class="h-4 w-full" />
56
- <Skeleton class="h-4 w-3/4" />
57
- <Skeleton class="h-4 w-1/2" />
58
- </div>`),
59
- };
60
-
61
- export const MessageBubble: Story = {
62
- name: 'Message Bubble',
63
- render: () => (
64
- <div class="space-y-6 w-full max-w-2xl">
65
- {/* User message skeleton */}
66
- <div class="flex justify-end">
67
- <Skeleton class="h-12 w-64 rounded-3xl" />
68
- </div>
69
-
70
- {/* Assistant message skeleton */}
71
- <div class="flex gap-3 items-start">
72
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
73
- <div class="flex-1 space-y-2">
74
- <Skeleton class="h-4 w-full" />
75
- <Skeleton class="h-4 w-full" />
76
- <Skeleton class="h-4 w-5/6" />
77
- <Skeleton class="h-4 w-2/3" />
78
- </div>
79
- </div>
80
- </div>
81
- ),
82
- ...src(`<div class="space-y-6 w-full max-w-2xl">
83
- <div class="flex justify-end">
84
- <Skeleton class="h-12 w-64 rounded-3xl" />
85
- </div>
86
- <div class="flex gap-3 items-start">
87
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
88
- <div class="flex-1 space-y-2">
89
- <Skeleton class="h-4 w-full" />
90
- <Skeleton class="h-4 w-full" />
91
- <Skeleton class="h-4 w-5/6" />
92
- <Skeleton class="h-4 w-2/3" />
93
- </div>
94
- </div>
95
- </div>`),
96
- };
97
-
98
- export const MessageWithCode: Story = {
99
- name: 'Message with Code Block',
100
- render: () => (
101
- <div class="flex gap-3 items-start w-full max-w-2xl">
102
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
103
- <div class="flex-1 space-y-3">
104
- <div class="space-y-2">
105
- <Skeleton class="h-4 w-full" />
106
- <Skeleton class="h-4 w-4/5" />
107
- </div>
108
- {/* Code block skeleton */}
109
- <Skeleton class="h-32 w-full rounded-xl" />
110
- <div class="space-y-2">
111
- <Skeleton class="h-4 w-full" />
112
- <Skeleton class="h-4 w-3/5" />
113
- </div>
114
- </div>
115
- </div>
116
- ),
117
- ...src(`<div class="flex gap-3 items-start w-full max-w-2xl">
118
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
119
- <div class="flex-1 space-y-3">
120
- <div class="space-y-2">
121
- <Skeleton class="h-4 w-full" />
122
- <Skeleton class="h-4 w-4/5" />
123
- </div>
124
- <Skeleton class="h-32 w-full rounded-xl" />
125
- <div class="space-y-2">
126
- <Skeleton class="h-4 w-full" />
127
- <Skeleton class="h-4 w-3/5" />
128
- </div>
129
- </div>
130
- </div>`),
131
- };
132
-
133
- export const ConversationList: Story = {
134
- name: 'Conversation List',
135
- render: () => (
136
- <div class="w-64 space-y-1">
137
- {/* Section header */}
138
- <Skeleton class="h-3 w-12 mb-2" />
139
- {[1, 2, 3].map(() => (
140
- <div class="flex items-center gap-2 px-2 py-2">
141
- <Skeleton class="h-4 w-4 rounded shrink-0" />
142
- <Skeleton class="h-4 flex-1" />
143
- </div>
144
- ))}
145
- {/* Section header */}
146
- <Skeleton class="h-3 w-16 mt-4 mb-2" />
147
- {[1, 2].map(() => (
148
- <div class="flex items-center gap-2 px-2 py-2">
149
- <Skeleton class="h-4 w-4 rounded shrink-0" />
150
- <Skeleton class="h-4 flex-1" />
151
- </div>
152
- ))}
153
- </div>
154
- ),
155
- ...src(`<div class="w-64 space-y-1">
156
- <Skeleton class="h-3 w-12 mb-2" />
157
- {[1, 2, 3].map(() => (
158
- <div class="flex items-center gap-2 px-2 py-2">
159
- <Skeleton class="h-4 w-4 rounded shrink-0" />
160
- <Skeleton class="h-4 flex-1" />
161
- </div>
162
- ))}
163
- </div>`),
164
- };
165
-
166
- export const ToolCall: Story = {
167
- name: 'Tool Call',
168
- render: () => (
169
- <div class="w-full max-w-2xl">
170
- <div class="border border-border rounded-xl overflow-hidden">
171
- {/* Tool header */}
172
- <div class="flex items-center gap-2 px-3 py-2.5">
173
- <Skeleton class="h-4 w-4 rounded-full" />
174
- <Skeleton class="h-4 w-32" />
175
- <Skeleton class="h-5 w-20 rounded-full" />
176
- </div>
177
- {/* Tool body */}
178
- <div class="border-t border-border p-3 space-y-3">
179
- <div>
180
- <Skeleton class="h-3 w-10 mb-2" />
181
- <Skeleton class="h-20 w-full rounded" />
182
- </div>
183
- <div>
184
- <Skeleton class="h-3 w-12 mb-2" />
185
- <Skeleton class="h-16 w-full rounded" />
186
- </div>
187
- </div>
188
- </div>
189
- </div>
190
- ),
191
- ...src(`<div class="w-full max-w-2xl">
192
- <div class="border border-border rounded-xl overflow-hidden">
193
- <div class="flex items-center gap-2 px-3 py-2.5">
194
- <Skeleton class="h-4 w-4 rounded-full" />
195
- <Skeleton class="h-4 w-32" />
196
- <Skeleton class="h-5 w-20 rounded-full" />
197
- </div>
198
- <div class="border-t border-border p-3 space-y-3">
199
- <Skeleton class="h-3 w-10 mb-2" />
200
- <Skeleton class="h-20 w-full rounded" />
201
- </div>
202
- </div>
203
- </div>`),
204
- };
205
-
206
- export const Card: Story = {
207
- name: 'Content Card',
208
- render: () => (
209
- <div class="w-72">
210
- <Skeleton class="h-40 w-full rounded-xl mb-3" />
211
- <div class="flex gap-3">
212
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
213
- <div class="flex-1 space-y-2">
214
- <Skeleton class="h-4 w-full" />
215
- <Skeleton class="h-3 w-24" />
216
- <Skeleton class="h-3 w-32" />
217
- </div>
218
- </div>
219
- </div>
220
- ),
221
- ...src(`<div class="w-72">
222
- <Skeleton class="h-40 w-full rounded-xl mb-3" />
223
- <div class="flex gap-3">
224
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
225
- <div class="flex-1 space-y-2">
226
- <Skeleton class="h-4 w-full" />
227
- <Skeleton class="h-3 w-24" />
228
- <Skeleton class="h-3 w-32" />
229
- </div>
230
- </div>
231
- </div>`),
232
- };
233
-
234
- export const InputArea: Story = {
235
- name: 'Input Area',
236
- render: () => (
237
- <div class="w-full max-w-2xl">
238
- <div class="border border-border rounded-2xl p-3 space-y-3">
239
- <Skeleton class="h-10 w-full rounded-lg" />
240
- <div class="flex items-center justify-between">
241
- <div class="flex gap-2">
242
- <Skeleton class="h-8 w-8 rounded-full" />
243
- <Skeleton class="h-8 w-8 rounded-full" />
244
- <Skeleton class="h-8 w-8 rounded-full" />
245
- </div>
246
- <Skeleton class="h-8 w-8 rounded-full" />
247
- </div>
248
- </div>
249
- </div>
250
- ),
251
- ...src(`<div class="w-full max-w-2xl">
252
- <div class="border border-border rounded-2xl p-3 space-y-3">
253
- <Skeleton class="h-10 w-full rounded-lg" />
254
- <div class="flex items-center justify-between">
255
- <div class="flex gap-2">
256
- <Skeleton class="h-8 w-8 rounded-full" />
257
- <Skeleton class="h-8 w-8 rounded-full" />
258
- <Skeleton class="h-8 w-8 rounded-full" />
259
- </div>
260
- <Skeleton class="h-8 w-8 rounded-full" />
261
- </div>
262
- </div>
263
- </div>`),
264
- };
265
-
266
- export const FullChat: Story = {
267
- name: 'Full Chat Layout',
268
- render: () => (
269
- <div class="flex w-full max-w-4xl h-96 border border-border rounded-xl overflow-hidden">
270
- {/* Sidebar */}
271
- <div class="w-56 border-r border-border p-3 space-y-3 shrink-0">
272
- <Skeleton class="h-8 w-full rounded-lg" />
273
- <div class="space-y-1 mt-4">
274
- <Skeleton class="h-3 w-12 mb-2" />
275
- {[1, 2, 3].map(() => (
276
- <Skeleton class="h-8 w-full rounded-lg" />
277
- ))}
278
- <Skeleton class="h-3 w-16 mt-3 mb-2" />
279
- {[1, 2].map(() => (
280
- <Skeleton class="h-8 w-full rounded-lg" />
281
- ))}
282
- </div>
283
- </div>
284
-
285
- {/* Main */}
286
- <div class="flex-1 flex flex-col">
287
- {/* Header */}
288
- <div class="flex items-center justify-between px-4 py-3 border-b border-border">
289
- <Skeleton class="h-4 w-48" />
290
- <div class="flex gap-2">
291
- <Skeleton class="h-8 w-28 rounded-lg" />
292
- <Skeleton class="h-8 w-8 rounded-full" />
293
- </div>
294
- </div>
295
-
296
- {/* Messages */}
297
- <div class="flex-1 p-4 space-y-6 overflow-hidden">
298
- <div class="flex justify-end">
299
- <Skeleton class="h-10 w-52 rounded-3xl" />
300
- </div>
301
- <div class="flex gap-3 items-start">
302
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
303
- <div class="flex-1 space-y-2">
304
- <Skeleton class="h-4 w-full" />
305
- <Skeleton class="h-4 w-5/6" />
306
- <Skeleton class="h-4 w-2/3" />
307
- </div>
308
- </div>
309
- </div>
310
-
311
- {/* Input */}
312
- <div class="p-3">
313
- <Skeleton class="h-14 w-full rounded-2xl" />
314
- </div>
315
- </div>
316
- </div>
317
- ),
318
- ...src(`<div class="flex w-full max-w-4xl h-96 border rounded-xl overflow-hidden">
319
- <div class="w-56 border-r p-3 space-y-3 shrink-0">
320
- <Skeleton class="h-8 w-full rounded-lg" />
321
- </div>
322
- <div class="flex-1 flex flex-col">
323
- <div class="flex-1 p-4 space-y-6">
324
- <div class="flex gap-3 items-start">
325
- <Skeleton class="h-8 w-8 rounded-full shrink-0" />
326
- <div class="flex-1 space-y-2">
327
- <Skeleton class="h-4 w-full" />
328
- <Skeleton class="h-4 w-5/6" />
329
- </div>
330
- </div>
331
- </div>
332
- <div class="p-3">
333
- <Skeleton class="h-14 w-full rounded-2xl" />
334
- </div>
335
- </div>
336
- </div>`),
337
- };
@@ -1,51 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { fn } from 'storybook/test';
3
- import { Switch, type SwitchProps } from './switch';
4
- import { componentDescription } from '../stories/docs/element-controls';
5
-
6
- const meta = {
7
- title: 'Solid (Advanced)/Primitives/Switch',
8
- component: Switch,
9
- tags: ['autodocs'],
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- description: componentDescription([
14
- 'A toggle **switch** (`role="switch"`) for an immediate on/off setting, built on a native `<button>`.',
15
- '**When to use:** a preference that applies the moment it flips — "Temporary chat", notifications, a feature flag. For a labelled choice submitted with a form, prefer a checkbox.',
16
- '**How to use:** uncontrolled via `defaultChecked`, or controlled via `checked` + `onChange`. Operable with Space/Enter. Pass `label` for the accessible name.',
17
- '**Placement:** settings rows, preference panels, and popover menus such as a chat header model menu.',
18
- ]),
19
- },
20
- },
21
- argTypes: {
22
- checked: { control: 'boolean', description: 'Controlled checked state. Drive it from `onChange`.' },
23
- defaultChecked: { control: 'boolean', description: 'Initial state when uncontrolled.' },
24
- disabled: { control: 'boolean', description: 'Disable interaction.' },
25
- label: { control: 'text', description: 'Accessible label.' },
26
- },
27
- args: { label: 'Temporary chat', onChange: fn() },
28
- } satisfies Meta<typeof Switch>;
29
-
30
- export default meta;
31
- type Story = StoryObj<typeof meta>;
32
-
33
- /** Off by default; click or press Space to toggle. */
34
- export const Playground: Story = {};
35
-
36
- /** Starts on via `defaultChecked`. */
37
- export const On: Story = { args: { defaultChecked: true } };
38
-
39
- /** Non-interactive. */
40
- export const Disabled: Story = { args: { disabled: true } };
41
-
42
- /** The common shape: a labelled settings row with the switch trailing. */
43
- export const SettingsRow: Story = {
44
- name: 'In a settings row',
45
- render: (args: SwitchProps) => (
46
- <div style={{ display: 'flex', 'align-items': 'center', 'justify-content': 'space-between', gap: '2rem', width: '18rem' }}>
47
- <span style={{ 'font-size': '14px' }}>Temporary chat</span>
48
- <Switch {...args} />
49
- </div>
50
- ),
51
- };
@@ -1,59 +0,0 @@
1
- import { describe, it, expect, vi, afterEach } from 'vitest';
2
- import '@testing-library/jest-dom/vitest';
3
- import { render, cleanup, fireEvent } from '@solidjs/testing-library';
4
- import { Switch } from './switch';
5
-
6
- afterEach(cleanup);
7
-
8
- describe('Switch', () => {
9
- it('renders a switch role, off by default', () => {
10
- const { getByRole } = render(() => <Switch label="Temporary chat" />);
11
- const sw = getByRole('switch');
12
- expect(sw).toHaveAttribute('aria-checked', 'false');
13
- expect(sw).toHaveAttribute('aria-label', 'Temporary chat');
14
- });
15
-
16
- it('honours defaultChecked for the initial (uncontrolled) state', () => {
17
- const { getByRole } = render(() => <Switch defaultChecked />);
18
- expect(getByRole('switch')).toHaveAttribute('aria-checked', 'true');
19
- });
20
-
21
- it('toggles on click and reports the new state', () => {
22
- const onChange = vi.fn();
23
- const { getByRole } = render(() => <Switch onChange={onChange} />);
24
- const sw = getByRole('switch');
25
- fireEvent.click(sw);
26
- expect(sw).toHaveAttribute('aria-checked', 'true');
27
- expect(onChange).toHaveBeenCalledWith(true);
28
- fireEvent.click(sw);
29
- expect(sw).toHaveAttribute('aria-checked', 'false');
30
- expect(onChange).toHaveBeenLastCalledWith(false);
31
- });
32
-
33
- it('toggles with the keyboard (Space / Enter)', () => {
34
- const onChange = vi.fn();
35
- const { getByRole } = render(() => <Switch onChange={onChange} />);
36
- fireEvent.keyDown(getByRole('switch'), { key: ' ' });
37
- expect(onChange).toHaveBeenCalledWith(true);
38
- });
39
-
40
- it('is controlled when `checked` is set — defers state to the parent', () => {
41
- const onChange = vi.fn();
42
- const { getByRole } = render(() => <Switch checked={false} onChange={onChange} />);
43
- const sw = getByRole('switch');
44
- fireEvent.click(sw);
45
- expect(onChange).toHaveBeenCalledWith(true);
46
- // controlled: stays off until the parent flips `checked`
47
- expect(sw).toHaveAttribute('aria-checked', 'false');
48
- });
49
-
50
- it('does not toggle when disabled', () => {
51
- const onChange = vi.fn();
52
- const { getByRole } = render(() => <Switch disabled onChange={onChange} />);
53
- const sw = getByRole('switch');
54
- fireEvent.click(sw);
55
- expect(onChange).not.toHaveBeenCalled();
56
- expect(sw).toHaveAttribute('aria-checked', 'false');
57
- expect(sw).toBeDisabled();
58
- });
59
- });
@@ -1,76 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import type { JSX } from 'solid-js';
3
- import { Textarea } from './textarea';
4
- import { componentDescription } from '../stories/docs/element-controls';
5
-
6
- const meta = {
7
- title: 'Solid (Advanced)/Primitives/Textarea',
8
- component: Textarea,
9
- tags: ['autodocs'],
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- description: componentDescription([
14
- 'A single-line-by-default textarea that auto-grows with its content up to an optional `maxHeight`, after which it scrolls. It is **transparent and borderless by design** — it is meant to drop into a composed input frame that owns the visual boundary and focus ring (the demos below wrap it exactly the way `PromptInput` / `<kai-prompt-input>` does, with `focus-within` on the frame). This is the editable surface behind `PromptInput`.',
15
- '**When to use:** free-text entry that may span multiple lines — a chat composer, a comment box, an editable note.',
16
- '**How to use:** drop it inside a framed container and use it like a native `<textarea>` (`value`, `placeholder`, `onInput`, …). Auto-resize is on by default; set `maxHeight` (px) to cap growth, or `autoResize={false}` for a fixed-height field.',
17
- ]),
18
- },
19
- },
20
- argTypes: {
21
- placeholder: { control: 'text', description: 'Placeholder text.' },
22
- maxHeight: { control: 'number', description: 'Max height (px) before the field scrolls instead of growing.' },
23
- autoResize: { control: 'boolean', description: 'Grow with content. Default true.' },
24
- class: { control: 'text', description: 'Extra classes.' },
25
- },
26
- args: {
27
- placeholder: 'Ask anything… (Shift+Enter for a newline)',
28
- maxHeight: 200,
29
- },
30
- render: (args) => (
31
- <Frame>
32
- <Textarea {...args} class="focus-visible:ring-0" />
33
- </Frame>
34
- ),
35
- } satisfies Meta<typeof Textarea>;
36
-
37
- /**
38
- * The composed input frame, mirroring how `PromptInput` wraps the textarea: the
39
- * FRAME owns the boundary + focus ring (`focus-within`), and the transparent
40
- * textarea inside has its own ring neutralized so there's no nested box.
41
- */
42
- function Frame(props: { children: JSX.Element }) {
43
- return (
44
- <div class="w-96 cursor-text rounded-xl border border-border bg-muted/40 p-3 shadow-xs transition-shadow focus-within:border-ring focus-within:ring-2 focus-within:ring-ring">
45
- {props.children}
46
- </div>
47
- );
48
- }
49
-
50
- export default meta;
51
- type Story = StoryObj<typeof meta>;
52
-
53
- const IMPORT = `import { Textarea } from '@kitn.ai/ui';`;
54
- const src = (code: string) => ({
55
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
56
- });
57
-
58
- /** Type several lines — the field grows until `maxHeight`, then scrolls. Focus the field: the ring is on the frame, not a nested box. */
59
- export const Playground: Story = {
60
- ...src(`{/* The frame owns the focus ring; the textarea's own ring is neutralized. */}
61
- <div class="cursor-text rounded-xl border bg-muted/40 p-3 focus-within:ring-2 focus-within:ring-ring">
62
- <Textarea placeholder="Ask anything…" maxHeight={200} class="focus-visible:ring-0" />
63
- </div>`),
64
- };
65
-
66
- /** A fixed-height field (auto-resize disabled). */
67
- export const FixedHeight: Story = {
68
- render: () => (
69
- <Frame>
70
- <Textarea autoResize={false} rows={4} placeholder="Fixed at 4 rows…" class="focus-visible:ring-0" />
71
- </Frame>
72
- ),
73
- ...src(`<div class="cursor-text rounded-xl border bg-muted/40 p-3 focus-within:ring-2 focus-within:ring-ring">
74
- <Textarea autoResize={false} rows={4} placeholder="Fixed at 4 rows…" class="focus-visible:ring-0" />
75
- </div>`),
76
- };
@@ -1,74 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { Tooltip } from './tooltip';
3
- import { Button } from './button';
4
- import { componentDescription } from '../stories/docs/element-controls';
5
-
6
- const meta = {
7
- title: 'Solid (Advanced)/Primitives/Tooltip',
8
- component: Tooltip,
9
- tags: ['autodocs'],
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- description: componentDescription([
14
- 'A small floating label that appears on hover/focus of its trigger element, built with a DIY overlay-core implementation (no third-party dependency, no arrow).',
15
- '**When to use:** to clarify the purpose of icon-only buttons or terse controls — short, supplementary hints that are not essential to complete the action.',
16
- '**How to use:** wrap a single interactive `children` element and set `content` to the hint text. The child becomes the trigger.',
17
- '**Placement:** toolbars, message action rows, and any compact icon control where a label would not otherwise fit.',
18
- ]),
19
- controls: { exclude: ['use:eventListener'] },
20
- },
21
- },
22
- argTypes: {
23
- content: {
24
- control: 'text',
25
- description: 'Text shown inside the tooltip bubble.',
26
- },
27
- children: {
28
- control: false,
29
- description: 'The trigger element the tooltip is attached to.',
30
- },
31
- class: {
32
- control: 'text',
33
- description: 'Extra classes applied to the tooltip content bubble.',
34
- },
35
- },
36
- args: {
37
- content: 'This is a tooltip',
38
- children: <Button variant="outline">Hover me</Button>,
39
- },
40
- render: (args) => <Tooltip {...args} />,
41
- } satisfies Meta<typeof Tooltip>;
42
-
43
- export default meta;
44
- type Story = StoryObj<typeof meta>;
45
-
46
- const IMPORT = `import { Tooltip } from '@kitn.ai/ui';`;
47
- const src = (code: string) => ({
48
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
49
- });
50
-
51
- /** Interactive playground — set the tooltip text and hover the trigger. */
52
- export const Playground: Story = {
53
- ...src(`<Tooltip content="This is a tooltip">
54
- <Button variant="outline">Hover me</Button>
55
- </Tooltip>`),
56
- };
57
-
58
- export const OnIconButton: Story = {
59
- render: () => (
60
- <Tooltip content="Add new item">
61
- <Button variant="ghost" size="icon-sm" aria-label="Add new item">
62
- <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
63
- <line x1="12" y1="5" x2="12" y2="19" />
64
- <line x1="5" y1="12" x2="19" y2="12" />
65
- </svg>
66
- </Button>
67
- </Tooltip>
68
- ),
69
- ...src(`<Tooltip content="Add new item">
70
- <Button variant="ghost" size="icon-sm">
71
- <PlusIcon />
72
- </Button>
73
- </Tooltip>`),
74
- };