import * as React from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import { Tree } from './tree'; const treeData = [ { key: 'src', title: 'src', children: [ { key: 'components', title: 'components', children: [ { key: 'button', title: 'button.tsx' }, { key: 'input', title: 'input.tsx' }, { key: 'table', title: 'data-table.tsx' }, ], }, { key: 'styles', title: 'styles', children: [ { key: 'tokens', title: 'tokens.css' }, { key: 'theme', title: 'theme.css' }, ], }, { key: 'index', title: 'index.ts' }, ], }, { key: 'docs', title: 'docs', children: [ { key: 'intro', title: 'Introduction.mdx' }, { key: 'tokensdoc', title: 'DesignTokens.mdx', disabled: true }, ], }, ]; const meta = { title: 'Components/Tree', component: Tree, parameters: { layout: 'centered', docs: { description: { component: 'Hierarchical list with expand, select and optional checkboxes. The keyboard contract is the demanding part and is implemented in full — arrow keys that move *and* expand, Home/End, `*` to open a whole level, type-ahead, and a single tab stop. Checkbox state propagates both ways: checking a branch checks everything under it, and a branch reads as indeterminate when only some descendants are checked.', }, }, }, tags: ['autodocs'], args: { treeData, defaultExpandAll: true }, decorators: [(Story) =>
Checked: {checked.length ? checked.join(', ') : '—'}