@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,99 +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 { Popover } from './popover';
5
-
6
- afterEach(cleanup);
7
-
8
- // createPresence unmounts on a microtask when there is no exit animation (jsdom),
9
- // so flush the queue before asserting a closed popover has left the DOM.
10
- const tick = () => new Promise((r) => setTimeout(r, 0));
11
-
12
- describe('Popover', () => {
13
- it('renders the trigger and hides the content until opened', () => {
14
- const { getByText, queryByText } = render(() => (
15
- <Popover trigger={<button>Open menu</button>}>
16
- <div>Panel body</div>
17
- </Popover>
18
- ));
19
- expect(getByText('Open menu')).toBeInTheDocument();
20
- expect(queryByText('Panel body')).not.toBeInTheDocument();
21
- });
22
-
23
- it('opens on trigger click and calls onOpenChange(true)', () => {
24
- const onOpenChange = vi.fn();
25
- const { getByText, queryByText } = render(() => (
26
- <Popover trigger={<button>Open menu</button>} onOpenChange={onOpenChange}>
27
- <div>Panel body</div>
28
- </Popover>
29
- ));
30
- fireEvent.click(getByText('Open menu'));
31
- expect(queryByText('Panel body')).toBeInTheDocument();
32
- expect(onOpenChange).toHaveBeenCalledWith(true);
33
- });
34
-
35
- it('toggles closed on a second trigger click and calls onOpenChange(false)', async () => {
36
- const onOpenChange = vi.fn();
37
- const { getByText, queryByText } = render(() => (
38
- <Popover trigger={<button>Open menu</button>} onOpenChange={onOpenChange}>
39
- <div>Panel body</div>
40
- </Popover>
41
- ));
42
- const trigger = getByText('Open menu');
43
- fireEvent.click(trigger);
44
- expect(queryByText('Panel body')).toBeInTheDocument();
45
- fireEvent.click(trigger);
46
- await tick();
47
- expect(queryByText('Panel body')).not.toBeInTheDocument();
48
- expect(onOpenChange).toHaveBeenLastCalledWith(false);
49
- });
50
-
51
- it('closes on Escape', async () => {
52
- const { getByText, queryByText } = render(() => (
53
- <Popover trigger={<button>Open menu</button>}>
54
- <div>Panel body</div>
55
- </Popover>
56
- ));
57
- fireEvent.click(getByText('Open menu'));
58
- expect(queryByText('Panel body')).toBeInTheDocument();
59
- fireEvent.keyDown(document, { key: 'Escape' });
60
- await tick();
61
- expect(queryByText('Panel body')).not.toBeInTheDocument();
62
- });
63
-
64
- it('stays open when clicking inside the panel, closes on an outside pointerdown', async () => {
65
- const { getByText, queryByText } = render(() => (
66
- <Popover trigger={<button>Open menu</button>}>
67
- <div>Panel body</div>
68
- </Popover>
69
- ));
70
- fireEvent.click(getByText('Open menu'));
71
- fireEvent.pointerDown(getByText('Panel body'));
72
- expect(queryByText('Panel body')).toBeInTheDocument();
73
- fireEvent.pointerDown(document.body);
74
- await tick();
75
- expect(queryByText('Panel body')).not.toBeInTheDocument();
76
- });
77
-
78
- it('respects the controlled open prop', () => {
79
- const { queryByText } = render(() => (
80
- <Popover open trigger={<button>Open menu</button>}>
81
- <div>Panel body</div>
82
- </Popover>
83
- ));
84
- expect(queryByText('Panel body')).toBeInTheDocument();
85
- });
86
-
87
- it('does not change its own state when controlled — defers to onOpenChange', () => {
88
- const onOpenChange = vi.fn();
89
- const { getByText, queryByText } = render(() => (
90
- <Popover open={false} trigger={<button>Open menu</button>} onOpenChange={onOpenChange}>
91
- <div>Panel body</div>
92
- </Popover>
93
- ));
94
- fireEvent.click(getByText('Open menu'));
95
- // controlled: stays closed until the parent flips `open`
96
- expect(queryByText('Panel body')).not.toBeInTheDocument();
97
- expect(onOpenChange).toHaveBeenCalledWith(true);
98
- });
99
- });
@@ -1,236 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { fn } from 'storybook/test';
3
- import { ResizablePanelGroup, ResizablePanel, ResizableHandle, Resizable } from './resizable';
4
- import { componentDescription } from '../stories/docs/element-controls';
5
-
6
- const meta = {
7
- title: 'Solid (Advanced)/Primitives/Resizable',
8
- component: ResizablePanelGroup,
9
- tags: ['autodocs'],
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- controls: { exclude: ['use:eventListener'] },
14
- description: componentDescription([
15
- 'A **resizable split layout**: `ResizablePanelGroup` lays out `ResizablePanel` children along an axis, divided by a draggable `ResizableHandle`.',
16
- '**When to use:** to let users adjust the relative size of two or more regions — e.g. a collapsible sidebar next to the main chat, or a chat pane next to an inspector.',
17
- '**How to use:** wrap panels in `ResizablePanelGroup` and set `orientation` (`horizontal` row / `vertical` column). Give panels a `defaultSize` (percent) and optional `minSize`/`maxSize`; min/max are read from `data-min-size`/`data-max-size` attributes at drag time. Place a `ResizableHandle` (add `withHandle` for a visible grip) between panels. The group needs a sized container (height/width).',
18
- '**Placement:** app shells — sidebar + conversation, conversation + context/inspector panels, or stacked editor/preview regions.',
19
- ]),
20
- },
21
- },
22
- argTypes: {
23
- orientation: {
24
- control: 'select',
25
- options: ['horizontal', 'vertical'],
26
- description: 'Axis the panels are laid out along.',
27
- table: { defaultValue: { summary: 'horizontal' } },
28
- },
29
- },
30
- args: {
31
- orientation: 'horizontal',
32
- },
33
- render: (args) => (
34
- <div class="h-48 w-full max-w-2xl rounded-lg border border-border overflow-hidden">
35
- <ResizablePanelGroup {...args}>
36
- <ResizablePanel defaultSize={30} data-min-size="100" data-max-size="400">
37
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
38
- <span class="text-sm text-muted-foreground">Sidebar</span>
39
- </div>
40
- </ResizablePanel>
41
- <ResizableHandle withHandle />
42
- <ResizablePanel>
43
- <div class="flex h-full items-center justify-center p-4">
44
- <span class="text-sm text-muted-foreground">Content</span>
45
- </div>
46
- </ResizablePanel>
47
- </ResizablePanelGroup>
48
- </div>
49
- ),
50
- } satisfies Meta<typeof ResizablePanelGroup>;
51
-
52
- export default meta;
53
- type Story = StoryObj<typeof meta>;
54
-
55
- const IMPORT = `import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from '@kitn.ai/ui';`;
56
- const src = (code: string) => ({
57
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
58
- });
59
-
60
- /** Interactive playground — flip the orientation, then drag the handle. */
61
- export const Playground: Story = {
62
- ...src(`<ResizablePanelGroup orientation="horizontal">
63
- <ResizablePanel defaultSize={30} data-min-size="100" data-max-size="400">
64
- Sidebar
65
- </ResizablePanel>
66
- <ResizableHandle withHandle />
67
- <ResizablePanel>Content</ResizablePanel>
68
- </ResizablePanelGroup>`),
69
- };
70
-
71
- export const Horizontal: Story = {
72
- args: { orientation: 'horizontal' },
73
- ...src(`<ResizablePanelGroup orientation="horizontal">
74
- <ResizablePanel defaultSize={30} data-min-size="100" data-max-size="400">
75
- Sidebar
76
- </ResizablePanel>
77
- <ResizableHandle withHandle />
78
- <ResizablePanel>Content</ResizablePanel>
79
- </ResizablePanelGroup>`),
80
- };
81
-
82
- /** Stacked top/bottom split (showcase). */
83
- export const Vertical: Story = {
84
- render: () => (
85
- <div class="h-96 w-full max-w-md rounded-lg border border-border overflow-hidden">
86
- <ResizablePanelGroup orientation="vertical">
87
- <ResizablePanel defaultSize={40} data-min-size="60" data-max-size="300">
88
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
89
- <span class="text-sm text-muted-foreground">Top</span>
90
- </div>
91
- </ResizablePanel>
92
- <ResizableHandle withHandle />
93
- <ResizablePanel>
94
- <div class="flex h-full items-center justify-center p-4">
95
- <span class="text-sm text-muted-foreground">Bottom</span>
96
- </div>
97
- </ResizablePanel>
98
- </ResizablePanelGroup>
99
- </div>
100
- ),
101
- ...src(`<ResizablePanelGroup orientation="vertical">
102
- <ResizablePanel defaultSize={40} data-min-size="60" data-max-size="300">
103
- Top
104
- </ResizablePanel>
105
- <ResizableHandle withHandle />
106
- <ResizablePanel>Bottom</ResizablePanel>
107
- </ResizablePanelGroup>`),
108
- };
109
-
110
- /** Three panels with two handles (showcase). */
111
- export const ThreePanels: Story = {
112
- name: 'Three Panels',
113
- render: () => (
114
- <div class="h-48 w-full max-w-2xl rounded-lg border border-border overflow-hidden">
115
- <ResizablePanelGroup orientation="horizontal">
116
- <ResizablePanel defaultSize={25} data-min-size="80" data-max-size="300">
117
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
118
- <span class="text-sm text-muted-foreground">Left</span>
119
- </div>
120
- </ResizablePanel>
121
- <ResizableHandle />
122
- <ResizablePanel>
123
- <div class="flex h-full items-center justify-center p-4">
124
- <span class="text-sm text-muted-foreground">Center</span>
125
- </div>
126
- </ResizablePanel>
127
- <ResizableHandle />
128
- <ResizablePanel defaultSize={25} data-min-size="80" data-max-size="300">
129
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
130
- <span class="text-sm text-muted-foreground">Right</span>
131
- </div>
132
- </ResizablePanel>
133
- </ResizablePanelGroup>
134
- </div>
135
- ),
136
- ...src(`<ResizablePanelGroup orientation="horizontal">
137
- <ResizablePanel defaultSize={25} data-min-size="80" data-max-size="300">Left</ResizablePanel>
138
- <ResizableHandle />
139
- <ResizablePanel>Center</ResizablePanel>
140
- <ResizableHandle />
141
- <ResizablePanel defaultSize={25} data-min-size="80" data-max-size="300">Right</ResizablePanel>
142
- </ResizablePanelGroup>`),
143
- };
144
-
145
- /** Handle without a visible grip; reports drag deltas via `onPanelResize` (showcase). */
146
- export const NoHandle: Story = {
147
- name: 'Without Handle',
148
- render: () => (
149
- <div class="h-48 w-full max-w-2xl rounded-lg border border-border overflow-hidden">
150
- <ResizablePanelGroup orientation="horizontal">
151
- <ResizablePanel defaultSize={40}>
152
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
153
- <span class="text-sm text-muted-foreground">Panel A</span>
154
- </div>
155
- </ResizablePanel>
156
- <ResizableHandle onPanelResize={fn()} />
157
- <ResizablePanel>
158
- <div class="flex h-full items-center justify-center p-4">
159
- <span class="text-sm text-muted-foreground">Panel B</span>
160
- </div>
161
- </ResizablePanel>
162
- </ResizablePanelGroup>
163
- </div>
164
- ),
165
- ...src(`<ResizablePanelGroup orientation="horizontal">
166
- <ResizablePanel defaultSize={40}>Panel A</ResizablePanel>
167
- <ResizableHandle onPanelResize={(delta) => console.log(delta)} />
168
- <ResizablePanel>Panel B</ResizablePanel>
169
- </ResizablePanelGroup>`),
170
- };
171
-
172
- /**
173
- * The `Resizable` convenience: pass `ResizablePanel` children and it
174
- * auto-inserts a handle between each visible pair. A `locked` panel makes its
175
- * neighbouring handle a static (non-draggable) divider; a `hidden` panel drops
176
- * its divider entirely.
177
- */
178
- export const ConvenienceGroup: Story = {
179
- name: 'Resizable (convenience)',
180
- render: () => (
181
- <div class="h-48 w-full max-w-2xl rounded-lg border border-border overflow-hidden">
182
- <Resizable orientation="horizontal" withHandle onChange={(sizes) => console.log('sizes', sizes)}>
183
- <ResizablePanel defaultSize="240px" locked>
184
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
185
- <span class="text-sm text-muted-foreground">Locked sidebar (240px)</span>
186
- </div>
187
- </ResizablePanel>
188
- <ResizablePanel>
189
- <div class="flex h-full items-center justify-center p-4">
190
- <span class="text-sm text-muted-foreground">Chat</span>
191
- </div>
192
- </ResizablePanel>
193
- <ResizablePanel defaultSize="30%" minSize="160px">
194
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
195
- <span class="text-sm text-muted-foreground">Preview</span>
196
- </div>
197
- </ResizablePanel>
198
- </Resizable>
199
- </div>
200
- ),
201
- ...src(`<Resizable orientation="horizontal" withHandle onChange={(sizes) => console.log(sizes)}>
202
- <ResizablePanel defaultSize="240px" locked>Locked sidebar</ResizablePanel>
203
- <ResizablePanel>Chat</ResizablePanel>
204
- <ResizablePanel defaultSize="30%" minSize="160px">Preview</ResizablePanel>
205
- </Resizable>`),
206
- };
207
-
208
- /**
209
- * Min/max + keyboard: focus the handle (Tab) and use ←/→ to nudge, Home/End to
210
- * jump to the panel's min/max. Sizes accept px or %.
211
- */
212
- export const MinMaxKeyboard: Story = {
213
- name: 'Min/Max + Keyboard',
214
- render: () => (
215
- <div class="h-48 w-full max-w-2xl rounded-lg border border-border overflow-hidden">
216
- <ResizablePanelGroup orientation="horizontal">
217
- <ResizablePanel defaultSize="30%" minSize="120px" maxSize="50%">
218
- <div class="flex h-full items-center justify-center bg-muted/30 p-4">
219
- <span class="text-sm text-muted-foreground">min 120px · max 50%</span>
220
- </div>
221
- </ResizablePanel>
222
- <ResizableHandle withHandle />
223
- <ResizablePanel minSize="160px">
224
- <div class="flex h-full items-center justify-center p-4">
225
- <span class="text-sm text-muted-foreground">Content (min 160px)</span>
226
- </div>
227
- </ResizablePanel>
228
- </ResizablePanelGroup>
229
- </div>
230
- ),
231
- ...src(`<ResizablePanelGroup orientation="horizontal">
232
- <ResizablePanel defaultSize="30%" minSize="120px" maxSize="50%">Sidebar</ResizablePanel>
233
- <ResizableHandle withHandle />
234
- <ResizablePanel minSize="160px">Content</ResizablePanel>
235
- </ResizablePanelGroup>`),
236
- };
@@ -1,50 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { For } from 'solid-js';
3
- import { ScrollArea } from './scroll-area';
4
- import { componentDescription } from '../stories/docs/element-controls';
5
-
6
- const meta = {
7
- title: 'Solid (Advanced)/Primitives/ScrollArea',
8
- component: ScrollArea,
9
- tags: ['autodocs'],
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- description: componentDescription([
14
- 'A vertically scrollable container with thin, themed scrollbars (`scrollbar-thin` + muted thumb, transparent track). A thin styling layer over native overflow — no custom scroll hijacking, so momentum, keyboard, and accessibility behave exactly like the platform expects. Constrain it with a height (or let a flex parent bound it) and overflow content scrolls.',
15
- '**When to use:** any bounded region whose content can exceed its height — the conversation/history sidebar, a long menu, a tall card body.',
16
- '**How to use:** set a height via `class` and drop the scrollable content inside. All other div props (e.g. `aria-label`) are forwarded.',
17
- ]),
18
- },
19
- },
20
- render: () => (
21
- <ScrollArea class="h-56 w-72 rounded-lg border border-border p-2">
22
- <ul class="space-y-1">
23
- <For each={Array.from({ length: 24 }, (_, i) => i + 1)}>
24
- {(n) => (
25
- <li class="rounded-md px-3 py-2 text-sm text-foreground hover:bg-muted">
26
- Conversation {n}
27
- </li>
28
- )}
29
- </For>
30
- </ul>
31
- </ScrollArea>
32
- ),
33
- } satisfies Meta<typeof ScrollArea>;
34
-
35
- export default meta;
36
- type Story = StoryObj<typeof meta>;
37
-
38
- const IMPORT = `import { ScrollArea } from '@kitn.ai/ui';`;
39
-
40
- /** A bounded list that scrolls. Note macOS hides overlay scrollbars until you scroll. */
41
- export const Playground: Story = {
42
- parameters: {
43
- docs: {
44
- source: {
45
- code: `${IMPORT}\n\n<ScrollArea class="h-56 w-72 rounded-lg border p-2">\n <For each={conversations}>{(c) => <Row {...c} />}</For>\n</ScrollArea>`,
46
- language: 'tsx',
47
- },
48
- },
49
- },
50
- };
@@ -1,81 +0,0 @@
1
- import type { Meta, StoryObj } from 'storybook-solidjs-vite';
2
- import { Separator } from './separator';
3
- import { componentDescription } from '../stories/docs/element-controls';
4
-
5
- const meta = {
6
- title: 'Solid (Advanced)/Primitives/Separator',
7
- component: Separator,
8
- tags: ['autodocs'],
9
- parameters: {
10
- layout: 'padded',
11
- docs: {
12
- controls: { exclude: ['use:eventListener'] },
13
- description: componentDescription([
14
- 'A thin **divider** line (a `role="separator"` element) that visually splits content either horizontally or vertically.',
15
- '**When to use:** to separate stacked sections, group items in a menu/list, or divide inline controls in a toolbar.',
16
- '**How to use:** set `orientation` to `horizontal` (full-width line) or `vertical` (full-height line). For a vertical separator, give the parent a height so the line has something to fill.',
17
- '**Placement:** between message groups, in dropdown/menu sections, header toolbars, and between sidebar regions.',
18
- ]),
19
- },
20
- },
21
- argTypes: {
22
- orientation: {
23
- control: 'select',
24
- options: ['horizontal', 'vertical'],
25
- description: 'Direction of the divider line.',
26
- table: { defaultValue: { summary: 'horizontal' } },
27
- },
28
- },
29
- args: {
30
- orientation: 'horizontal',
31
- },
32
- render: (args) => (
33
- <div class="w-64 p-4">
34
- <p class="text-sm text-foreground mb-3">Above</p>
35
- <Separator {...args} />
36
- <p class="text-sm text-foreground mt-3">Below</p>
37
- </div>
38
- ),
39
- } satisfies Meta<typeof Separator>;
40
-
41
- export default meta;
42
- type Story = StoryObj<typeof meta>;
43
-
44
- const IMPORT = `import { Separator } from '@kitn.ai/ui';`;
45
- const src = (code: string) => ({
46
- parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } },
47
- });
48
-
49
- /** Interactive playground — flip the orientation. */
50
- export const Playground: Story = {
51
- ...src(`<Separator orientation="horizontal" />`),
52
- };
53
-
54
- export const Horizontal: Story = {
55
- args: { orientation: 'horizontal' },
56
- ...src(`<div class="w-64 p-4">
57
- <p class="text-sm mb-3">Above</p>
58
- <Separator />
59
- <p class="text-sm mt-3">Below</p>
60
- </div>`),
61
- };
62
-
63
- /** Vertical divider — needs a parent with a fixed height (showcase). */
64
- export const Vertical: Story = {
65
- render: () => (
66
- <div class="flex items-center gap-3 p-4">
67
- <span class="text-sm text-foreground">Left</span>
68
- <div class="h-6">
69
- <Separator orientation="vertical" />
70
- </div>
71
- <span class="text-sm text-foreground">Right</span>
72
- </div>
73
- ),
74
- ...src(`<div class="flex items-center gap-3 p-4">
75
- <span class="text-sm">Left</span>
76
- <div class="h-6">
77
- <Separator orientation="vertical" />
78
- </div>
79
- <span class="text-sm">Right</span>
80
- </div>`),
81
- };