import type { Meta, StoryObj } from 'storybook-solidjs-vite'; import { Skeleton } from './skeleton'; import { componentDescription } from '../stories/docs/element-controls'; const meta = { title: 'Solid (Advanced)/Primitives/Skeleton', component: Skeleton, tags: ['autodocs'], parameters: { layout: 'padded', docs: { controls: { exclude: ['use:eventListener'] }, description: componentDescription([ '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.', '**When to use:** while content (messages, lists, cards, tool output) is loading, to preserve layout and signal progress without a spinner.', '**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.', '**Placement:** message bubbles, conversation lists, code blocks, tool calls, input areas, and full-page loading states.', ]), }, }, argTypes: { class: { control: 'text', description: 'Utility classes that set the size and rounding of the placeholder.', }, }, args: { class: 'h-4 w-64', }, render: (args) => , } satisfies Meta; export default meta; type Story = StoryObj; const IMPORT = `import { Skeleton } from '@kitn.ai/chat';`; const src = (code: string) => ({ parameters: { docs: { source: { code: `${IMPORT}\n\n${code}`, language: 'tsx' } } }, }); /** Interactive playground — edit `class` to resize the placeholder. */ export const Playground: Story = { ...src(``), }; export const Basic: Story = { render: () => (
), ...src(`
`), }; export const MessageBubble: Story = { name: 'Message Bubble', render: () => (
{/* User message skeleton */}
{/* Assistant message skeleton */}
), ...src(`
`), }; export const MessageWithCode: Story = { name: 'Message with Code Block', render: () => (
{/* Code block skeleton */}
), ...src(`
`), }; export const ConversationList: Story = { name: 'Conversation List', render: () => (
{/* Section header */} {[1, 2, 3].map(() => (
))} {/* Section header */} {[1, 2].map(() => (
))}
), ...src(`
{[1, 2, 3].map(() => (
))}
`), }; export const ToolCall: Story = { name: 'Tool Call', render: () => (
{/* Tool header */}
{/* Tool body */}
), ...src(`
`), }; export const Card: Story = { name: 'Content Card', render: () => (
), ...src(`
`), }; export const InputArea: Story = { name: 'Input Area', render: () => (
), ...src(`
`), }; export const FullChat: Story = { name: 'Full Chat Layout', render: () => (
{/* Sidebar */}
{[1, 2, 3].map(() => ( ))} {[1, 2].map(() => ( ))}
{/* Main */}
{/* Header */}
{/* Messages */}
{/* Input */}
), ...src(`
`), };