@usefragments/ui 1.1.1 → 1.3.0

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 (148) hide show
  1. package/dist/assets/ui.css +327 -274
  2. package/dist/components/Checkbox/Checkbox.module.scss.cjs +11 -11
  3. package/dist/components/Checkbox/Checkbox.module.scss.js +11 -11
  4. package/dist/components/Chip/Chip.module.scss.cjs +15 -15
  5. package/dist/components/Chip/Chip.module.scss.js +15 -15
  6. package/dist/components/Combobox/index.cjs +106 -9
  7. package/dist/components/Combobox/index.d.ts.map +1 -1
  8. package/dist/components/Combobox/index.js +106 -9
  9. package/dist/components/DataTable/DataTable.module.scss.cjs +37 -34
  10. package/dist/components/DataTable/DataTable.module.scss.js +37 -34
  11. package/dist/components/DataTable/index.d.ts.map +1 -1
  12. package/dist/components/Main/Main.module.scss.cjs +26 -0
  13. package/dist/components/Main/Main.module.scss.js +26 -0
  14. package/dist/components/Main/index.cjs +128 -0
  15. package/dist/components/Main/index.d.ts +22 -0
  16. package/dist/components/Main/index.d.ts.map +1 -0
  17. package/dist/components/Main/index.js +111 -0
  18. package/dist/components/Table/Table.module.scss.cjs +19 -19
  19. package/dist/components/Table/Table.module.scss.js +19 -19
  20. package/dist/components/TableOfContents/TableOfContents.module.scss.cjs +15 -15
  21. package/dist/components/TableOfContents/TableOfContents.module.scss.js +15 -15
  22. package/dist/components/TableOfContents/index.cjs +22 -42
  23. package/dist/components/TableOfContents/index.d.ts +3 -3
  24. package/dist/components/TableOfContents/index.d.ts.map +1 -1
  25. package/dist/components/TableOfContents/index.js +22 -42
  26. package/dist/{components/DataTable/DataTable.virtual.cjs → data-table-virtual.cjs} +1 -1
  27. package/dist/{components/DataTable/DataTable.virtual.js → data-table-virtual.js} +1 -1
  28. package/dist/data-table.cjs +27 -9
  29. package/dist/data-table.js +19 -1
  30. package/dist/index.cjs +87 -88
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +2 -3
  34. package/fragments.json +1 -1
  35. package/package.json +57 -2
  36. package/src/components/Checkbox/Checkbox.contract.json +5 -24
  37. package/src/components/Checkbox/Checkbox.module.scss +4 -2
  38. package/src/components/Chip/Chip.contract.json +11 -28
  39. package/src/components/Chip/Chip.module.scss +21 -45
  40. package/src/components/Combobox/Combobox.contract.json +6 -24
  41. package/src/components/Combobox/index.tsx +132 -6
  42. package/src/components/DataTable/DataTable.module.scss +31 -8
  43. package/src/components/DataTable/index.tsx +44 -16
  44. package/src/components/Main/Main.contract.json +79 -0
  45. package/src/components/Main/Main.module.scss +31 -0
  46. package/src/components/Main/index.tsx +124 -0
  47. package/src/components/Table/Table.module.scss +22 -5
  48. package/src/components/TableOfContents/TableOfContents.contract.json +6 -16
  49. package/src/components/TableOfContents/TableOfContents.module.scss +10 -13
  50. package/src/components/TableOfContents/index.tsx +27 -38
  51. package/src/index.ts +11 -9
  52. package/src/styles/styles.d.ts +8 -0
  53. package/src/tokens/_component-properties.scss +1 -0
  54. package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts +0 -33
  55. package/dist/components/Cloud/DashboardLayoutPrototypes.shared.d.ts.map +0 -1
  56. package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts +0 -11
  57. package/dist/components/Cloud/DashboardLayoutPrototypes.shell.d.ts.map +0 -1
  58. package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts +0 -5
  59. package/dist/components/Cloud/PullRequestsPrototypes.content.d.ts.map +0 -1
  60. package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts +0 -4
  61. package/dist/components/Cloud/PullRequestsPrototypes.detail-panels.d.ts.map +0 -1
  62. package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts +0 -3
  63. package/dist/components/Cloud/PullRequestsPrototypes.detail.d.ts.map +0 -1
  64. package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts +0 -86
  65. package/dist/components/Cloud/PullRequestsPrototypes.id-data.d.ts.map +0 -1
  66. package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts +0 -2
  67. package/dist/components/Cloud/PullRequestsPrototypes.id-page.d.ts.map +0 -1
  68. package/src/components/Accordion/Accordion.stories.tsx +0 -106
  69. package/src/components/Alert/Alert.stories.tsx +0 -119
  70. package/src/components/AppShell/AppShell.stories.tsx +0 -156
  71. package/src/components/Avatar/Avatar.stories.tsx +0 -74
  72. package/src/components/Badge/Badge.stories.tsx +0 -92
  73. package/src/components/BentoGrid/BentoGrid.stories.tsx +0 -98
  74. package/src/components/Box/Box.stories.tsx +0 -150
  75. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -87
  76. package/src/components/Button/Button.stories.tsx +0 -103
  77. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +0 -97
  78. package/src/components/Card/Card.stories.tsx +0 -144
  79. package/src/components/Chart/Chart.stories.tsx +0 -119
  80. package/src/components/Checkbox/Checkbox.stories.tsx +0 -68
  81. package/src/components/Chip/Chip.stories.tsx +0 -70
  82. package/src/components/Cloud/CloudGovernanceShell.module.scss +0 -88
  83. package/src/components/Cloud/CloudGovernanceShell.stories.tsx +0 -446
  84. package/src/components/Cloud/ControlSizing.module.scss +0 -49
  85. package/src/components/Cloud/ControlSizing.stories.tsx +0 -238
  86. package/src/components/Cloud/DashboardLayoutPrototypes.module.scss +0 -462
  87. package/src/components/Cloud/DashboardLayoutPrototypes.shared.tsx +0 -375
  88. package/src/components/Cloud/DashboardLayoutPrototypes.shell.tsx +0 -147
  89. package/src/components/Cloud/DashboardLayoutPrototypes.stories.tsx +0 -328
  90. package/src/components/Cloud/PullRequestsPrototypes.content.tsx +0 -283
  91. package/src/components/Cloud/PullRequestsPrototypes.detail-panels.tsx +0 -381
  92. package/src/components/Cloud/PullRequestsPrototypes.detail.tsx +0 -204
  93. package/src/components/Cloud/PullRequestsPrototypes.id-data.ts +0 -395
  94. package/src/components/Cloud/PullRequestsPrototypes.id-page.tsx +0 -349
  95. package/src/components/Cloud/PullRequestsPrototypes.stories.tsx +0 -81
  96. package/src/components/CodeBlock/CodeBlock.stories.tsx +0 -147
  97. package/src/components/Collapsible/Collapsible.stories.tsx +0 -94
  98. package/src/components/ColorPicker/ColorPicker.stories.tsx +0 -74
  99. package/src/components/Combobox/Combobox.stories.tsx +0 -133
  100. package/src/components/Command/Command.stories.tsx +0 -102
  101. package/src/components/ConversationList/ConversationList.stories.tsx +0 -93
  102. package/src/components/DataTable/DataTable.stories.tsx +0 -129
  103. package/src/components/DatePicker/DatePicker.stories.tsx +0 -129
  104. package/src/components/Dialog/Dialog.stories.tsx +0 -154
  105. package/src/components/Drawer/Drawer.stories.tsx +0 -144
  106. package/src/components/Editor/Editor.stories.tsx +0 -99
  107. package/src/components/EmptyState/EmptyState.stories.tsx +0 -97
  108. package/src/components/Field/Field.stories.tsx +0 -109
  109. package/src/components/Fieldset/Fieldset.stories.tsx +0 -116
  110. package/src/components/Form/Form.stories.tsx +0 -142
  111. package/src/components/Grid/Grid.stories.tsx +0 -125
  112. package/src/components/Header/Header.stories.tsx +0 -133
  113. package/src/components/Icon/Icon.stories.tsx +0 -80
  114. package/src/components/IconButton/IconButton.stories.tsx +0 -78
  115. package/src/components/Image/Image.stories.tsx +0 -109
  116. package/src/components/Input/Input.stories.tsx +0 -104
  117. package/src/components/Link/Link.stories.tsx +0 -67
  118. package/src/components/List/List.stories.tsx +0 -95
  119. package/src/components/Listbox/Listbox.stories.tsx +0 -81
  120. package/src/components/Loading/Loading.stories.tsx +0 -69
  121. package/src/components/Markdown/Markdown.stories.tsx +0 -75
  122. package/src/components/Menu/Menu.stories.tsx +0 -113
  123. package/src/components/Message/Message.stories.tsx +0 -85
  124. package/src/components/NavigationMenu/NavigationMenu.stories.tsx +0 -161
  125. package/src/components/Pagination/Pagination.stories.tsx +0 -81
  126. package/src/components/Popover/Popover.stories.tsx +0 -152
  127. package/src/components/Progress/Progress.stories.tsx +0 -64
  128. package/src/components/Prompt/Prompt.stories.tsx +0 -93
  129. package/src/components/RadioGroup/RadioGroup.stories.tsx +0 -107
  130. package/src/components/ScrollArea/ScrollArea.stories.tsx +0 -97
  131. package/src/components/Select/Select.stories.tsx +0 -127
  132. package/src/components/Separator/Separator.stories.tsx +0 -84
  133. package/src/components/Sidebar/Sidebar.stories.tsx +0 -122
  134. package/src/components/Skeleton/Skeleton.stories.tsx +0 -80
  135. package/src/components/Slider/Slider.stories.tsx +0 -73
  136. package/src/components/Stack/Stack.stories.tsx +0 -73
  137. package/src/components/Switch/Switch.stories.tsx +0 -59
  138. package/src/components/Table/Table.stories.tsx +0 -219
  139. package/src/components/TableOfContents/TableOfContents.stories.tsx +0 -120
  140. package/src/components/Tabs/Tabs.stories.tsx +0 -136
  141. package/src/components/Text/Text.stories.tsx +0 -133
  142. package/src/components/Textarea/Textarea.stories.tsx +0 -107
  143. package/src/components/Theme/Theme.stories.tsx +0 -95
  144. package/src/components/ThinkingIndicator/ThinkingIndicator.stories.tsx +0 -85
  145. package/src/components/Toast/Toast.stories.tsx +0 -91
  146. package/src/components/ToggleGroup/ToggleGroup.stories.tsx +0 -114
  147. package/src/components/Tooltip/Tooltip.stories.tsx +0 -95
  148. package/src/components/VisuallyHidden/VisuallyHidden.stories.tsx +0 -78
@@ -1,80 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Skeleton } from '.';
3
-
4
- /**
5
- * Skeleton is a placeholder loading state for content. Semantic variants
6
- * auto-size to common shapes, while width/height allow custom dimensions.
7
- * Includes Skeleton.Text and Skeleton.Circle subcomponents.
8
- */
9
- const meta = {
10
- title: 'Feedback/Skeleton',
11
- component: Skeleton,
12
- tags: ['autodocs'],
13
- parameters: {
14
- docs: {
15
- description: {
16
- component: 'Placeholder loading state for content.',
17
- },
18
- },
19
- },
20
- argTypes: {
21
- variant: {
22
- control: 'select',
23
- options: ['text', 'heading', 'avatar', 'button', 'input', 'rect'],
24
- description: 'Semantic variant that auto-sizes',
25
- },
26
- size: {
27
- control: 'select',
28
- options: ['sm', 'md', 'lg'],
29
- description: 'Size for avatar/button variants',
30
- },
31
- radius: {
32
- control: 'select',
33
- options: ['sm', 'md', 'lg', 'none', 'full'],
34
- description: 'Border radius override',
35
- },
36
- fill: { control: 'boolean', description: 'Fill parent container' },
37
- static: { control: 'boolean', description: 'Disable skeleton animation' },
38
- },
39
- args: { variant: 'rect', width: 200, height: 20 },
40
- } satisfies Meta<typeof Skeleton>;
41
-
42
- export default meta;
43
-
44
- type Story = StoryObj<typeof meta>;
45
-
46
- export const Default: Story = {
47
- args: { variant: 'rect', width: 200, height: 20 },
48
- };
49
-
50
- export const Heading: Story = {
51
- args: { variant: 'heading', width: 200 },
52
- };
53
-
54
- export const TextLines: Story = {
55
- render: () => <Skeleton.Text lines={3} />,
56
- };
57
-
58
- export const Avatars: Story = {
59
- render: () => (
60
- <div style={{ display: 'flex', gap: 'var(--fui-space-1)', alignItems: 'center' }}>
61
- <Skeleton.Circle size="sm" />
62
- <Skeleton.Circle size="md" />
63
- <Skeleton.Circle size="lg" />
64
- </div>
65
- ),
66
- };
67
-
68
- export const Card: Story = {
69
- render: () => (
70
- <div style={{ width: 300 }}>
71
- <Skeleton variant="rect" height={120} radius="md" />
72
- <div style={{ marginTop: 'var(--fui-space-2)' }}>
73
- <Skeleton variant="heading" width="60%" />
74
- </div>
75
- <div style={{ marginTop: 'var(--fui-space-1)' }}>
76
- <Skeleton.Text lines={2} />
77
- </div>
78
- </div>
79
- ),
80
- };
@@ -1,73 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Slider } from '.';
3
-
4
- /**
5
- * Slider is a range input control for selecting a numeric value within a
6
- * defined range. It supports a label, value display, a custom step interval,
7
- * and a value suffix for units.
8
- */
9
- const meta = {
10
- title: 'Forms/Slider',
11
- component: Slider,
12
- tags: ['autodocs'],
13
- parameters: {
14
- docs: {
15
- description: {
16
- component: 'Range input control for selecting a numeric value within a defined range.',
17
- },
18
- },
19
- },
20
- argTypes: {
21
- showValue: { control: 'boolean', description: 'Display current value' },
22
- showValueOnDrag: {
23
- control: 'boolean',
24
- description: 'Show a floating value bubble while dragging',
25
- },
26
- error: { control: 'boolean', description: 'Show error styling' },
27
- disabled: { control: 'boolean', description: 'Disable the slider' },
28
- },
29
- args: { label: 'Volume', defaultValue: 50, min: 0, max: 100, step: 1 },
30
- render: (args) => (
31
- <div style={{ width: 300 }}>
32
- <Slider {...args} />
33
- </div>
34
- ),
35
- } satisfies Meta<typeof Slider>;
36
-
37
- export default meta;
38
-
39
- type Story = StoryObj<typeof meta>;
40
-
41
- export const Default: Story = {
42
- args: { label: 'Volume', defaultValue: 50 },
43
- };
44
-
45
- export const WithValue: Story = {
46
- args: { label: 'Brightness', defaultValue: 75, showValue: true, valueSuffix: '%' },
47
- };
48
-
49
- export const CustomRange: Story = {
50
- args: {
51
- label: 'Temperature',
52
- min: 60,
53
- max: 80,
54
- step: 1,
55
- defaultValue: 72,
56
- showValue: true,
57
- valueSuffix: '°F',
58
- },
59
- };
60
-
61
- export const WithHelperText: Story = {
62
- args: {
63
- label: 'Quality',
64
- defaultValue: 80,
65
- showValue: true,
66
- valueSuffix: '%',
67
- helperText: 'Higher quality increases file size',
68
- },
69
- };
70
-
71
- export const Disabled: Story = {
72
- args: { label: 'Locked setting', defaultValue: 30, showValue: true, disabled: true },
73
- };
@@ -1,73 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Stack } from '.';
3
-
4
- /**
5
- * Stack is a flexbox layout primitive for arranging children in rows or
6
- * columns with consistent spacing. Direction and gap accept tokens, numbers,
7
- * or responsive objects.
8
- */
9
- const meta = {
10
- title: 'Layout/Stack',
11
- component: Stack,
12
- tags: ['autodocs', 'canonical'],
13
- parameters: {
14
- docs: {
15
- description: {
16
- component: 'Flexbox layout component for arranging children in rows or columns.',
17
- },
18
- },
19
- },
20
- argTypes: {
21
- align: {
22
- control: 'select',
23
- options: ['start', 'center', 'end', 'stretch', 'baseline'],
24
- description: 'Cross-axis alignment',
25
- },
26
- justify: {
27
- control: 'select',
28
- options: ['start', 'center', 'end', 'between'],
29
- description: 'Main-axis alignment',
30
- },
31
- as: {
32
- control: 'select',
33
- options: ['div', 'section', 'nav', 'article', 'aside', 'header', 'footer', 'main', 'ul', 'ol'],
34
- description: 'HTML element to render',
35
- },
36
- wrap: { control: 'boolean', description: 'Allow items to wrap' },
37
- },
38
- args: {
39
- direction: 'column',
40
- gap: 'md',
41
- children: (
42
- <>
43
- <div style={{ padding: 8, background: 'var(--fui-bg-secondary)' }}>Item 1</div>
44
- <div style={{ padding: 8, background: 'var(--fui-bg-secondary)' }}>Item 2</div>
45
- <div style={{ padding: 8, background: 'var(--fui-bg-secondary)' }}>Item 3</div>
46
- </>
47
- ),
48
- },
49
- } satisfies Meta<typeof Stack>;
50
-
51
- export default meta;
52
-
53
- type Story = StoryObj<typeof meta>;
54
-
55
- export const Vertical: Story = {
56
- args: { direction: 'column', gap: 'sm' },
57
- };
58
-
59
- export const Horizontal: Story = {
60
- args: { direction: 'row', gap: 'sm' },
61
- };
62
-
63
- export const NumericGap: Story = {
64
- args: { direction: 'row', gap: 4 },
65
- };
66
-
67
- export const WithSeparator: Story = {
68
- args: { direction: 'column', gap: 'md', separator: true },
69
- };
70
-
71
- export const SemanticElement: Story = {
72
- args: { as: 'nav', direction: 'row', gap: 'md' },
73
- };
@@ -1,59 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Switch } from '.';
3
-
4
- /**
5
- * Switch is a binary on/off control for settings and preferences. It supports
6
- * controlled and uncontrolled checked state, an optional label, helper text,
7
- * and three sizes.
8
- */
9
- const meta = {
10
- title: 'Forms/Switch',
11
- component: Switch,
12
- tags: ['autodocs', 'canonical'],
13
- parameters: {
14
- docs: {
15
- description: {
16
- component: 'Binary on/off switch for settings and preferences.',
17
- },
18
- },
19
- },
20
- argTypes: {
21
- size: {
22
- control: 'select',
23
- options: ['sm', 'md', 'lg'],
24
- description: 'Size variant',
25
- },
26
- disabled: { control: 'boolean', description: 'Disable the switch' },
27
- readOnly: { control: 'boolean', description: 'Prevent the user from toggling' },
28
- required: { control: 'boolean', description: 'Mark the switch as required' },
29
- defaultChecked: { control: 'boolean', description: 'Default checked state (uncontrolled)' },
30
- },
31
- args: { label: 'Enable notifications', size: 'md', defaultChecked: false },
32
- } satisfies Meta<typeof Switch>;
33
-
34
- export default meta;
35
-
36
- type Story = StoryObj<typeof meta>;
37
-
38
- export const Default: Story = {
39
- args: { label: 'Enable notifications' },
40
- };
41
-
42
- export const Checked: Story = {
43
- args: { label: 'Auto-save', defaultChecked: true },
44
- };
45
-
46
- export const WithHelperText: Story = {
47
- args: {
48
- label: 'Marketing emails',
49
- helperText: 'Receive occasional product updates and offers.',
50
- },
51
- };
52
-
53
- export const Small: Story = {
54
- args: { label: 'Compact mode', size: 'sm', defaultChecked: true },
55
- };
56
-
57
- export const Disabled: Story = {
58
- args: { label: 'Locked setting', disabled: true, defaultChecked: true },
59
- };
@@ -1,219 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { Table } from '.';
3
-
4
- /**
5
- * Table is the canonical semantic-HTML table primitive. Reach for it whenever
6
- * you need to render static tabular data with headers, rows, and footers —
7
- * agents should compose `Table.Head`/`Table.Body`/`Table.Row` rather than
8
- * hand-rolling `<table>` markup. For sorting and selection, use DataTable.
9
- */
10
- const meta = {
11
- title: 'Display/Table',
12
- component: Table,
13
- tags: ['autodocs', 'canonical'],
14
- parameters: {
15
- docs: {
16
- description: {
17
- component:
18
- 'Semantic HTML table with a compound API. Prefer this over a raw <table>; use DataTable when you need sorting or selection.',
19
- },
20
- },
21
- },
22
- argTypes: {
23
- size: {
24
- control: 'select',
25
- options: ['sm', 'md'],
26
- description: 'Table density',
27
- },
28
- striped: { control: 'boolean', description: 'Show alternating row backgrounds' },
29
- bordered: { control: 'boolean', description: 'Wrap table in a bordered container' },
30
- },
31
- args: {
32
- size: 'md',
33
- striped: false,
34
- bordered: false,
35
- },
36
- } satisfies Meta<typeof Table>;
37
-
38
- export default meta;
39
-
40
- type Story = StoryObj<typeof meta>;
41
-
42
- export const Default: Story = {
43
- render: (args) => (
44
- <Table {...args} aria-label="Team members">
45
- <Table.Head>
46
- <Table.Row>
47
- <Table.HeaderCell>Name</Table.HeaderCell>
48
- <Table.HeaderCell>Role</Table.HeaderCell>
49
- <Table.HeaderCell>Status</Table.HeaderCell>
50
- </Table.Row>
51
- </Table.Head>
52
- <Table.Body>
53
- <Table.Row>
54
- <Table.Cell>Alice Johnson</Table.Cell>
55
- <Table.Cell>Engineer</Table.Cell>
56
- <Table.Cell>Active</Table.Cell>
57
- </Table.Row>
58
- <Table.Row>
59
- <Table.Cell>Bob Smith</Table.Cell>
60
- <Table.Cell>Designer</Table.Cell>
61
- <Table.Cell>Active</Table.Cell>
62
- </Table.Row>
63
- <Table.Row>
64
- <Table.Cell>Carol Williams</Table.Cell>
65
- <Table.Cell>PM</Table.Cell>
66
- <Table.Cell>Away</Table.Cell>
67
- </Table.Row>
68
- </Table.Body>
69
- </Table>
70
- ),
71
- };
72
-
73
- export const Striped: Story = {
74
- args: { striped: true },
75
- render: (args) => (
76
- <Table {...args} aria-label="Inventory">
77
- <Table.Head>
78
- <Table.Row>
79
- <Table.HeaderCell>Item</Table.HeaderCell>
80
- <Table.HeaderCell>Category</Table.HeaderCell>
81
- <Table.HeaderCell>Qty</Table.HeaderCell>
82
- </Table.Row>
83
- </Table.Head>
84
- <Table.Body>
85
- <Table.Row>
86
- <Table.Cell>Widget A</Table.Cell>
87
- <Table.Cell>Hardware</Table.Cell>
88
- <Table.Cell>120</Table.Cell>
89
- </Table.Row>
90
- <Table.Row>
91
- <Table.Cell>Widget B</Table.Cell>
92
- <Table.Cell>Software</Table.Cell>
93
- <Table.Cell>85</Table.Cell>
94
- </Table.Row>
95
- <Table.Row>
96
- <Table.Cell>Widget C</Table.Cell>
97
- <Table.Cell>Hardware</Table.Cell>
98
- <Table.Cell>200</Table.Cell>
99
- </Table.Row>
100
- </Table.Body>
101
- </Table>
102
- ),
103
- };
104
-
105
- export const Bordered: Story = {
106
- args: { bordered: true },
107
- render: (args) => (
108
- <Table {...args} aria-label="Pricing">
109
- <Table.Head>
110
- <Table.Row>
111
- <Table.HeaderCell>Plan</Table.HeaderCell>
112
- <Table.HeaderCell>Price</Table.HeaderCell>
113
- <Table.HeaderCell>Features</Table.HeaderCell>
114
- </Table.Row>
115
- </Table.Head>
116
- <Table.Body>
117
- <Table.Row>
118
- <Table.Cell>Basic</Table.Cell>
119
- <Table.Cell>$9/mo</Table.Cell>
120
- <Table.Cell>5 projects</Table.Cell>
121
- </Table.Row>
122
- <Table.Row>
123
- <Table.Cell>Pro</Table.Cell>
124
- <Table.Cell>$29/mo</Table.Cell>
125
- <Table.Cell>Unlimited</Table.Cell>
126
- </Table.Row>
127
- </Table.Body>
128
- </Table>
129
- ),
130
- };
131
-
132
- export const Compact: Story = {
133
- args: { size: 'sm' },
134
- render: (args) => (
135
- <Table {...args} aria-label="Shortcuts">
136
- <Table.Head>
137
- <Table.Row>
138
- <Table.HeaderCell>Key</Table.HeaderCell>
139
- <Table.HeaderCell>Action</Table.HeaderCell>
140
- </Table.Row>
141
- </Table.Head>
142
- <Table.Body>
143
- <Table.Row>
144
- <Table.Cell>Ctrl+S</Table.Cell>
145
- <Table.Cell>Save</Table.Cell>
146
- </Table.Row>
147
- <Table.Row>
148
- <Table.Cell>Ctrl+Z</Table.Cell>
149
- <Table.Cell>Undo</Table.Cell>
150
- </Table.Row>
151
- <Table.Row>
152
- <Table.Cell>Ctrl+C</Table.Cell>
153
- <Table.Cell>Copy</Table.Cell>
154
- </Table.Row>
155
- </Table.Body>
156
- </Table>
157
- ),
158
- };
159
-
160
- export const WithCaption: Story = {
161
- render: (args) => (
162
- <Table {...args} aria-label="Q1 results">
163
- <Table.Caption>Quarterly Results (Q1 2026)</Table.Caption>
164
- <Table.Head>
165
- <Table.Row>
166
- <Table.HeaderCell>Metric</Table.HeaderCell>
167
- <Table.HeaderCell>Value</Table.HeaderCell>
168
- <Table.HeaderCell>Change</Table.HeaderCell>
169
- </Table.Row>
170
- </Table.Head>
171
- <Table.Body>
172
- <Table.Row>
173
- <Table.Cell>Revenue</Table.Cell>
174
- <Table.Cell>$1.2M</Table.Cell>
175
- <Table.Cell>+15%</Table.Cell>
176
- </Table.Row>
177
- <Table.Row>
178
- <Table.Cell>Users</Table.Cell>
179
- <Table.Cell>24,500</Table.Cell>
180
- <Table.Cell>+8%</Table.Cell>
181
- </Table.Row>
182
- </Table.Body>
183
- </Table>
184
- ),
185
- };
186
-
187
- export const WithFooter: Story = {
188
- args: { bordered: true },
189
- render: (args) => (
190
- <Table {...args} aria-label="Expenses">
191
- <Table.Head>
192
- <Table.Row>
193
- <Table.HeaderCell>Category</Table.HeaderCell>
194
- <Table.HeaderCell>Amount</Table.HeaderCell>
195
- </Table.Row>
196
- </Table.Head>
197
- <Table.Body>
198
- <Table.Row>
199
- <Table.Cell>Marketing</Table.Cell>
200
- <Table.Cell>$12,000</Table.Cell>
201
- </Table.Row>
202
- <Table.Row>
203
- <Table.Cell>Engineering</Table.Cell>
204
- <Table.Cell>$45,000</Table.Cell>
205
- </Table.Row>
206
- <Table.Row>
207
- <Table.Cell>Operations</Table.Cell>
208
- <Table.Cell>$8,000</Table.Cell>
209
- </Table.Row>
210
- </Table.Body>
211
- <Table.Footer>
212
- <Table.Row>
213
- <Table.Cell>Total</Table.Cell>
214
- <Table.Cell>$65,000</Table.Cell>
215
- </Table.Row>
216
- </Table.Footer>
217
- </Table>
218
- ),
219
- };
@@ -1,120 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { TableOfContents } from '.';
3
-
4
- /**
5
- * TableOfContents is the canonical in-page navigation primitive — a sticky
6
- * sidebar of heading links with a continuous hierarchy rail and active-segment
7
- * highlighting. Use it for docs, long-form content, or filterable grouped
8
- * lists; agents should compose `TableOfContents.Item`/`TableOfContents.Group`
9
- * rather than hand-rolling a nav landmark.
10
- */
11
- const meta = {
12
- title: 'Navigation/TableOfContents',
13
- component: TableOfContents,
14
- tags: ['autodocs', 'canonical'],
15
- parameters: {
16
- docs: {
17
- description: {
18
- component:
19
- 'Sticky sidebar navigation for long-form content or filterable lists. Prefer this over a hand-rolled in-page nav.',
20
- },
21
- },
22
- },
23
- argTypes: {
24
- title: { control: 'text', description: 'Visible title above the list' },
25
- label: { control: 'text', description: 'Accessible label for the nav landmark' },
26
- hideTitle: { control: 'boolean', description: 'Hide the visible title' },
27
- },
28
- args: {
29
- title: 'On This Page',
30
- children: (
31
- <>
32
- <TableOfContents.Item id="introduction">Introduction</TableOfContents.Item>
33
- <TableOfContents.Item id="getting-started">Getting Started</TableOfContents.Item>
34
- <TableOfContents.Item id="api-reference">API Reference</TableOfContents.Item>
35
- </>
36
- ),
37
- },
38
- } satisfies Meta<typeof TableOfContents>;
39
-
40
- export default meta;
41
-
42
- type Story = StoryObj<typeof meta>;
43
-
44
- export const Default: Story = {
45
- render: (args) => (
46
- <TableOfContents {...args}>
47
- <TableOfContents.Item id="introduction">Introduction</TableOfContents.Item>
48
- <TableOfContents.Item id="getting-started">Getting Started</TableOfContents.Item>
49
- <TableOfContents.Item id="installation" indent>
50
- Installation
51
- </TableOfContents.Item>
52
- <TableOfContents.Item id="configuration" indent>
53
- Configuration
54
- </TableOfContents.Item>
55
- <TableOfContents.Item id="api-reference">API Reference</TableOfContents.Item>
56
- <TableOfContents.Item id="examples">Examples</TableOfContents.Item>
57
- </TableOfContents>
58
- ),
59
- };
60
-
61
- export const NestedGroups: Story = {
62
- render: () => (
63
- <TableOfContents title="Components">
64
- <TableOfContents.Item id="all" active>
65
- All
66
- </TableOfContents.Item>
67
- <TableOfContents.Group label="Primitives" trailing={<span>3</span>}>
68
- <TableOfContents.Item id="button">Button</TableOfContents.Item>
69
- <TableOfContents.Item id="card">Card</TableOfContents.Item>
70
- <TableOfContents.Item id="input">Input</TableOfContents.Item>
71
- </TableOfContents.Group>
72
- <TableOfContents.Group label="Custom" defaultOpen={false}>
73
- <TableOfContents.Item id="features">Features</TableOfContents.Item>
74
- <TableOfContents.Item id="plans">Plans</TableOfContents.Item>
75
- </TableOfContents.Group>
76
- </TableOfContents>
77
- ),
78
- };
79
-
80
- export const WithActiveItem: Story = {
81
- render: () => (
82
- <TableOfContents>
83
- <TableOfContents.Item id="overview">Overview</TableOfContents.Item>
84
- <TableOfContents.Item id="setup" active>
85
- Setup
86
- </TableOfContents.Item>
87
- <TableOfContents.Item id="usage" indent>
88
- Basic Usage
89
- </TableOfContents.Item>
90
- <TableOfContents.Item id="advanced" indent>
91
- Advanced
92
- </TableOfContents.Item>
93
- <TableOfContents.Item id="props">Props</TableOfContents.Item>
94
- <TableOfContents.Item id="accessibility">Accessibility</TableOfContents.Item>
95
- </TableOfContents>
96
- ),
97
- };
98
-
99
- export const CustomTitle: Story = {
100
- render: () => (
101
- <TableOfContents title="Contents">
102
- <TableOfContents.Item id="chapter-1">Chapter 1: The Beginning</TableOfContents.Item>
103
- <TableOfContents.Item id="chapter-2">Chapter 2: The Middle</TableOfContents.Item>
104
- <TableOfContents.Item id="chapter-3">Chapter 3: The End</TableOfContents.Item>
105
- </TableOfContents>
106
- ),
107
- };
108
-
109
- export const NoTitle: Story = {
110
- args: { hideTitle: true },
111
- render: (args) => (
112
- <TableOfContents {...args}>
113
- <TableOfContents.Item id="section-a">Section A</TableOfContents.Item>
114
- <TableOfContents.Item id="section-b" active>
115
- Section B
116
- </TableOfContents.Item>
117
- <TableOfContents.Item id="section-c">Section C</TableOfContents.Item>
118
- </TableOfContents>
119
- ),
120
- };