@12-apps/ui 1.5.0 → 1.5.2
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.
- package/package.json +17 -9
- package/src/button/index.ts +1 -0
- package/src/social-login-button/index.ts +1 -0
- package/src/{social-login-button.tsx → social-login-button/social-login-button.tsx} +5 -5
- package/src/user-avatar/index.ts +1 -0
- package/src/{user-avatar.tsx → user-avatar/user-avatar.tsx} +4 -4
- package/eslint.config.js +0 -89
- package/src/__tests__/data-grid.test.tsx +0 -125
- package/src/__tests__/package-wiring.test.ts +0 -41
- package/src/__tests__/setup.ts +0 -1
- package/src/__tests__/social-login-button.test.tsx +0 -186
- package/src/__tests__/user-avatar.test.tsx +0 -195
- package/src/__tests__/viewport.test.ts +0 -50
- package/src/components/command/__tests__/command.test.tsx +0 -112
- package/src/components/data-display/Alert/Alert.stories.tsx +0 -559
- package/src/components/data-display/Alert/Alert.test.stories.tsx +0 -707
- package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +0 -362
- package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +0 -763
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +0 -230
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +0 -270
- package/src/components/data-display/Avatar/Avatar.stories.tsx +0 -721
- package/src/components/data-display/Avatar/Avatar.test.stories.tsx +0 -822
- package/src/components/data-display/Badge/Badge.stories.tsx +0 -1134
- package/src/components/data-display/Badge/Badge.test.stories.tsx +0 -1194
- package/src/components/data-display/Banner/Banner.stories.tsx +0 -528
- package/src/components/data-display/Banner/Banner.test.stories.tsx +0 -511
- package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
- package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -701
- package/src/components/data-display/Chart/Chart.stories.tsx +0 -568
- package/src/components/data-display/Chart/Chart.test.stories.tsx +0 -174
- package/src/components/data-display/Chart/SpecChart.stories.tsx +0 -150
- package/src/components/data-display/Chart/SpecChart.test.stories.tsx +0 -56
- package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +0 -60
- package/src/components/data-display/Chart/__tests__/chart-format.test.ts +0 -43
- package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +0 -119
- package/src/components/data-display/Chip/Chip.stories.tsx +0 -252
- package/src/components/data-display/Chip/Chip.test.stories.tsx +0 -266
- package/src/components/data-display/DataGrid/DataGrid.stories.tsx +0 -515
- package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +0 -653
- package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +0 -271
- package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +0 -134
- package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +0 -83
- package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +0 -115
- package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +0 -53
- package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +0 -114
- package/src/components/data-display/DataViews/base-card.stories.tsx +0 -136
- package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +0 -254
- package/src/components/data-display/EmptyState/EmptyState.stories.tsx +0 -282
- package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +0 -441
- package/src/components/data-display/ErrorState/ErrorState.stories.tsx +0 -110
- package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +0 -133
- package/src/components/data-display/HoverCard/HoverCard.stories.tsx +0 -650
- package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +0 -929
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +0 -411
- package/src/components/data-display/LazyImage/LazyImage.stories.tsx +0 -387
- package/src/components/data-display/Lightbox/Lightbox.stories.tsx +0 -315
- package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +0 -598
- package/src/components/data-display/LoadingState/LoadingState.stories.tsx +0 -124
- package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +0 -99
- package/src/components/data-display/MapPreview/MapPreview.stories.tsx +0 -458
- package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +0 -394
- package/src/components/data-display/Popover/Popover.stories.tsx +0 -295
- package/src/components/data-display/Popover/Popover.test.stories.tsx +0 -1162
- package/src/components/data-display/Progress/Progress.stories.tsx +0 -481
- package/src/components/data-display/Progress/Progress.test.stories.tsx +0 -2070
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +0 -160
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +0 -190
- package/src/components/data-display/Sheet/Sheet.stories.tsx +0 -883
- package/src/components/data-display/Sheet/Sheet.test.stories.tsx +0 -1105
- package/src/components/data-display/StatCard/StatCard.stories.tsx +0 -167
- package/src/components/data-display/StatCard/StatCard.test.stories.tsx +0 -240
- package/src/components/data-display/Stepper/Stepper.stories.tsx +0 -540
- package/src/components/data-display/Stepper/Stepper.test.stories.tsx +0 -600
- package/src/components/data-display/Table/Table.stories.tsx +0 -803
- package/src/components/data-display/Table/Table.test.stories.tsx +0 -369
- package/src/components/data-display/Timeline/Timeline.stories.tsx +0 -442
- package/src/components/data-display/Timeline/Timeline.test.stories.tsx +0 -930
- package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +0 -475
- package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +0 -734
- package/src/components/data-display/Tooltip/Tooltip.stories.tsx +0 -468
- package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +0 -1154
- package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +0 -146
- package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +0 -114
- package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +0 -288
- package/src/components/feedback/Dialog/Dialog.stories.tsx +0 -833
- package/src/components/feedback/Dialog/Dialog.test.stories.tsx +0 -964
- package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +0 -66
- package/src/components/feedback/Modal/Modal.stories.tsx +0 -765
- package/src/components/feedback/Modal/Modal.test.stories.tsx +0 -251
- package/src/components/feedback/Sonner/Sonner.stories.tsx +0 -698
- package/src/components/feedback/Sonner/Sonner.test.stories.tsx +0 -896
- package/src/components/feedback/StackedModal/StackedModal.stories.tsx +0 -1783
- package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +0 -973
- package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +0 -104
- package/src/components/feedback/Toast/Toast.stories.tsx +0 -548
- package/src/components/feedback/Toast/Toast.test.stories.tsx +0 -834
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +0 -691
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +0 -634
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +0 -665
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +0 -727
- package/src/components/form/Autocomplete/Autocomplete.stories.tsx +0 -715
- package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +0 -825
- package/src/components/form/Button/Button.stories.tsx +0 -365
- package/src/components/form/Button/Button.test.stories.tsx +0 -607
- package/src/components/form/Calendar/Calendar.stories.tsx +0 -349
- package/src/components/form/Calendar/Calendar.test.stories.tsx +0 -464
- package/src/components/form/CepField/CepField.stories.tsx +0 -138
- package/src/components/form/CepField/CepField.test.stories.tsx +0 -281
- package/src/components/form/Checkbox/Checkbox.stories.tsx +0 -265
- package/src/components/form/Checkbox/Checkbox.test.stories.tsx +0 -181
- package/src/components/form/CodeEditor/CodeEditor.stories.tsx +0 -871
- package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +0 -574
- package/src/components/form/Command/Command.stories.tsx +0 -580
- package/src/components/form/Command/Command.test.stories.tsx +0 -215
- package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +0 -112
- package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +0 -134
- package/src/components/form/Form/Form.stories.tsx +0 -687
- package/src/components/form/Form/Form.test.stories.tsx +0 -601
- package/src/components/form/Input/Input.stories.tsx +0 -260
- package/src/components/form/Input/Input.test.stories.tsx +0 -1191
- package/src/components/form/InputOTP/InputOTP.stories.tsx +0 -774
- package/src/components/form/InputOTP/InputOTP.test.stories.tsx +0 -588
- package/src/components/form/Label/Label.stories.tsx +0 -473
- package/src/components/form/Label/Label.test.stories.tsx +0 -915
- package/src/components/form/Menubar/Menubar.stories.tsx +0 -472
- package/src/components/form/Menubar/Menubar.test.stories.tsx +0 -584
- package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +0 -562
- package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +0 -327
- package/src/components/form/PhoneInput/PhoneInput.stories.tsx +0 -495
- package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +0 -666
- package/src/components/form/RadioGroup/RadioGroup.stories.tsx +0 -518
- package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +0 -685
- package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +0 -261
- package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +0 -491
- package/src/components/form/SearchPalette/SearchPalette.stories.tsx +0 -135
- package/src/components/form/Select/Select.stories.tsx +0 -364
- package/src/components/form/Select/Select.test.stories.tsx +0 -985
- package/src/components/form/Slider/Slider.stories.tsx +0 -418
- package/src/components/form/Slider/Slider.test.stories.tsx +0 -1042
- package/src/components/form/Switch/Switch.stories.tsx +0 -697
- package/src/components/form/Switch/Switch.test.stories.tsx +0 -597
- package/src/components/form/Textarea/Textarea.stories.tsx +0 -473
- package/src/components/form/Textarea/Textarea.test.stories.tsx +0 -702
- package/src/components/form/Toggle/Toggle.stories.tsx +0 -638
- package/src/components/form/Toggle/Toggle.test.stories.tsx +0 -1159
- package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +0 -617
- package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +0 -915
- package/src/components/form/UploadButton/UploadButton.stories.tsx +0 -367
- package/src/components/form/UploadButton/UploadButton.test.stories.tsx +0 -573
- package/src/components/form/total-form/total-form.test.tsx +0 -214
- package/src/components/layout/Accordion/Accordion.stories.tsx +0 -694
- package/src/components/layout/Accordion/Accordion.test.stories.tsx +0 -1344
- package/src/components/layout/Card/Card.stories.tsx +0 -591
- package/src/components/layout/Card/Card.test.stories.tsx +0 -1134
- package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +0 -92
- package/src/components/layout/Collapsible/Collapsible.stories.tsx +0 -180
- package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +0 -308
- package/src/components/layout/Container/Container.stories.tsx +0 -557
- package/src/components/layout/Container/Container.test.stories.tsx +0 -745
- package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +0 -129
- package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +0 -251
- package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +0 -39
- package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +0 -131
- package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +0 -99
- package/src/components/layout/Dashboard/Dashboard.stories.tsx +0 -104
- package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +0 -190
- package/src/components/layout/Drawer/Drawer.stories.tsx +0 -658
- package/src/components/layout/Drawer/Drawer.test.stories.tsx +0 -1343
- package/src/components/layout/Resizable/Resizable.stories.tsx +0 -1039
- package/src/components/layout/Resizable/Resizable.test.stories.tsx +0 -754
- package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +0 -651
- package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +0 -619
- package/src/components/layout/Separator/Separator.stories.tsx +0 -563
- package/src/components/layout/Separator/Separator.test.stories.tsx +0 -518
- package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +0 -192
- package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +0 -175
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -609
- package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +0 -1324
- package/src/components/layout/Skeleton/Skeleton.stories.tsx +0 -689
- package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +0 -521
- package/src/components/layout/Spacer/Spacer.stories.tsx +0 -502
- package/src/components/layout/Spacer/Spacer.test.stories.tsx +0 -474
- package/src/components/layout/TableFilter/TableFilter.stories.tsx +0 -82
- package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +0 -87
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +0 -638
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +0 -1008
- package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +0 -386
- package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +0 -435
- package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +0 -614
- package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +0 -845
- package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +0 -578
- package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +0 -660
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +0 -516
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +0 -935
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +0 -501
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +0 -453
- package/src/components/navigation/Pagination/Pagination.stories.tsx +0 -602
- package/src/components/navigation/Pagination/Pagination.test.stories.tsx +0 -520
- package/src/components/navigation/Tabs/Tabs.stories.tsx +0 -1004
- package/src/components/navigation/Tabs/Tabs.test.stories.tsx +0 -1225
- package/src/components/typography/Blockquote/Blockquote.stories.tsx +0 -359
- package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +0 -432
- package/src/components/typography/Code/Code.stories.tsx +0 -686
- package/src/components/typography/Code/Code.test.stories.tsx +0 -703
- package/src/components/typography/Heading/Heading.stories.tsx +0 -451
- package/src/components/typography/Heading/Heading.test.stories.tsx +0 -830
- package/src/components/typography/Paragraph/Paragraph.stories.tsx +0 -280
- package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +0 -231
- package/src/components/typography/Text/Text.stories.tsx +0 -359
- package/src/components/typography/Text/Text.test.stories.tsx +0 -759
- package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +0 -945
- package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +0 -603
- package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +0 -414
- package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +0 -859
- package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +0 -620
- package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +0 -361
- package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +0 -118
- package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +0 -83
- package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +0 -65
- package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +0 -271
- package/src/components/utility/Portal/Portal.stories.tsx +0 -340
- package/src/components/utility/Portal/Portal.test.stories.tsx +0 -2086
- package/src/components/utility/Transition/Transition.stories.tsx +0 -493
- package/src/components/utility/Transition/Transition.test.stories.tsx +0 -854
- package/src/components/utility/VirtualList/VirtualList.stories.tsx +0 -1073
- package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +0 -1085
- package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +0 -431
- package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +0 -364
- /package/src/{button.tsx → button/button.tsx} +0 -0
|
@@ -1,803 +0,0 @@
|
|
|
1
|
-
import DeleteIcon from '@mui/icons-material/Delete';
|
|
2
|
-
import EditIcon from '@mui/icons-material/Edit';
|
|
3
|
-
import StarIcon from '@mui/icons-material/Star';
|
|
4
|
-
import {
|
|
5
|
-
Avatar,
|
|
6
|
-
Box,
|
|
7
|
-
Button,
|
|
8
|
-
Chip,
|
|
9
|
-
IconButton,
|
|
10
|
-
Paper,
|
|
11
|
-
Stack,
|
|
12
|
-
TableBody,
|
|
13
|
-
TableCell,
|
|
14
|
-
TableContainer,
|
|
15
|
-
TableHead,
|
|
16
|
-
TableRow,
|
|
17
|
-
Typography,
|
|
18
|
-
} from '@mui/material';
|
|
19
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
20
|
-
import { useState } from 'react';
|
|
21
|
-
|
|
22
|
-
import { Table } from './Table';
|
|
23
|
-
import type { ColumnConfig, SortConfig } from './Table.types';
|
|
24
|
-
|
|
25
|
-
const meta: Meta<typeof Table> = {
|
|
26
|
-
title: 'DataDisplay/Table',
|
|
27
|
-
component: Table,
|
|
28
|
-
parameters: {
|
|
29
|
-
layout: 'padded',
|
|
30
|
-
},
|
|
31
|
-
tags: ['autodocs', 'component:Table'],
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default meta;
|
|
35
|
-
type Story = StoryObj<typeof meta>;
|
|
36
|
-
|
|
37
|
-
// Sample data
|
|
38
|
-
const sampleData = [
|
|
39
|
-
{
|
|
40
|
-
id: 1,
|
|
41
|
-
name: 'John Doe',
|
|
42
|
-
email: 'john@example.com',
|
|
43
|
-
role: 'Admin',
|
|
44
|
-
status: 'Active',
|
|
45
|
-
salary: 75000,
|
|
46
|
-
department: 'Engineering',
|
|
47
|
-
joinDate: '2020-01-15',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: 2,
|
|
51
|
-
name: 'Jane Smith',
|
|
52
|
-
email: 'jane@example.com',
|
|
53
|
-
role: 'User',
|
|
54
|
-
status: 'Active',
|
|
55
|
-
salary: 65000,
|
|
56
|
-
department: 'Design',
|
|
57
|
-
joinDate: '2021-03-22',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: 3,
|
|
61
|
-
name: 'Bob Johnson',
|
|
62
|
-
email: 'bob@example.com',
|
|
63
|
-
role: 'Editor',
|
|
64
|
-
status: 'Inactive',
|
|
65
|
-
salary: 55000,
|
|
66
|
-
department: 'Marketing',
|
|
67
|
-
joinDate: '2019-07-10',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
id: 4,
|
|
71
|
-
name: 'Alice Brown',
|
|
72
|
-
email: 'alice@example.com',
|
|
73
|
-
role: 'User',
|
|
74
|
-
status: 'Active',
|
|
75
|
-
salary: 70000,
|
|
76
|
-
department: 'Engineering',
|
|
77
|
-
joinDate: '2020-11-05',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
id: 5,
|
|
81
|
-
name: 'Charlie Wilson',
|
|
82
|
-
email: 'charlie@example.com',
|
|
83
|
-
role: 'Admin',
|
|
84
|
-
status: 'Active',
|
|
85
|
-
salary: 80000,
|
|
86
|
-
department: 'Engineering',
|
|
87
|
-
joinDate: '2018-09-12',
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: 6,
|
|
91
|
-
name: 'Diana Prince',
|
|
92
|
-
email: 'diana@example.com',
|
|
93
|
-
role: 'Editor',
|
|
94
|
-
status: 'Active',
|
|
95
|
-
salary: 60000,
|
|
96
|
-
department: 'Content',
|
|
97
|
-
joinDate: '2021-01-08',
|
|
98
|
-
},
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
// Generate large dataset for virtual scrolling
|
|
102
|
-
const generateLargeDataset = (size: number) => {
|
|
103
|
-
const departments = ['Engineering', 'Design', 'Marketing', 'Sales', 'HR', 'Finance'];
|
|
104
|
-
const roles = ['Admin', 'User', 'Editor', 'Manager'];
|
|
105
|
-
const statuses = ['Active', 'Inactive'];
|
|
106
|
-
|
|
107
|
-
return Array.from({ length: size }, (_, i) => ({
|
|
108
|
-
id: i + 1,
|
|
109
|
-
name: `User ${i + 1}`,
|
|
110
|
-
email: `user${i + 1}@example.com`,
|
|
111
|
-
role: roles[i % roles.length],
|
|
112
|
-
status: statuses[i % statuses.length],
|
|
113
|
-
salary: 50000 + ((i * 1000) % 50000),
|
|
114
|
-
department: departments[i % departments.length],
|
|
115
|
-
joinDate: `202${(i % 4) + 0}-0${(i % 9) + 1}-${10 + (i % 20)}`,
|
|
116
|
-
}));
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const largeDataset = generateLargeDataset(10000);
|
|
120
|
-
|
|
121
|
-
// Column configurations
|
|
122
|
-
const basicColumns: ColumnConfig[] = [
|
|
123
|
-
{ key: 'name', label: 'Name', sortable: true, priority: 1 },
|
|
124
|
-
{ key: 'email', label: 'Email', sortable: true, priority: 2 },
|
|
125
|
-
{ key: 'role', label: 'Role', sortable: true, priority: 3 },
|
|
126
|
-
{
|
|
127
|
-
key: 'status',
|
|
128
|
-
label: 'Status',
|
|
129
|
-
sortable: true,
|
|
130
|
-
priority: 4,
|
|
131
|
-
render: (value) => (
|
|
132
|
-
<Chip label={value} color={value === 'Active' ? 'success' : 'default'} size="small" />
|
|
133
|
-
),
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
|
|
137
|
-
const extendedColumns: ColumnConfig[] = [
|
|
138
|
-
{
|
|
139
|
-
key: 'avatar',
|
|
140
|
-
label: 'Avatar',
|
|
141
|
-
sortable: false,
|
|
142
|
-
priority: 1,
|
|
143
|
-
width: 60,
|
|
144
|
-
render: (_: unknown, rowData: Record<string, unknown>) => (
|
|
145
|
-
<Avatar sx={{ width: 32, height: 32 }}>{(rowData.name as string).charAt(0)}</Avatar>
|
|
146
|
-
),
|
|
147
|
-
},
|
|
148
|
-
{ key: 'name', label: 'Name', sortable: true, priority: 2 },
|
|
149
|
-
{ key: 'email', label: 'Email', sortable: true, priority: 3 },
|
|
150
|
-
{ key: 'department', label: 'Department', sortable: true, priority: 4 },
|
|
151
|
-
{ key: 'role', label: 'Role', sortable: true, priority: 5 },
|
|
152
|
-
{
|
|
153
|
-
key: 'salary',
|
|
154
|
-
label: 'Salary',
|
|
155
|
-
sortable: true,
|
|
156
|
-
priority: 6,
|
|
157
|
-
align: 'right' as const,
|
|
158
|
-
render: (value) => `$${value.toLocaleString()}`,
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
key: 'status',
|
|
162
|
-
label: 'Status',
|
|
163
|
-
sortable: true,
|
|
164
|
-
priority: 7,
|
|
165
|
-
render: (value) => (
|
|
166
|
-
<Chip label={value} color={value === 'Active' ? 'success' : 'default'} size="small" />
|
|
167
|
-
),
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
key: 'actions',
|
|
171
|
-
label: 'Actions',
|
|
172
|
-
sortable: false,
|
|
173
|
-
priority: 8,
|
|
174
|
-
width: 120,
|
|
175
|
-
render: () => (
|
|
176
|
-
<Stack direction="row" spacing={1}>
|
|
177
|
-
<IconButton size="small" color="primary">
|
|
178
|
-
<EditIcon fontSize="small" />
|
|
179
|
-
</IconButton>
|
|
180
|
-
<IconButton size="small" color="error">
|
|
181
|
-
<DeleteIcon fontSize="small" />
|
|
182
|
-
</IconButton>
|
|
183
|
-
</Stack>
|
|
184
|
-
),
|
|
185
|
-
},
|
|
186
|
-
];
|
|
187
|
-
|
|
188
|
-
export const Default: Story = {
|
|
189
|
-
render: () => (
|
|
190
|
-
<TableContainer component={Paper}>
|
|
191
|
-
<Table>
|
|
192
|
-
<TableHead>
|
|
193
|
-
<TableRow>
|
|
194
|
-
<TableCell>Name</TableCell>
|
|
195
|
-
<TableCell>Email</TableCell>
|
|
196
|
-
<TableCell>Role</TableCell>
|
|
197
|
-
<TableCell>Status</TableCell>
|
|
198
|
-
</TableRow>
|
|
199
|
-
</TableHead>
|
|
200
|
-
<TableBody>
|
|
201
|
-
{sampleData.map((row) => (
|
|
202
|
-
<TableRow key={row.id}>
|
|
203
|
-
<TableCell>{row.name}</TableCell>
|
|
204
|
-
<TableCell>{row.email}</TableCell>
|
|
205
|
-
<TableCell>{row.role}</TableCell>
|
|
206
|
-
<TableCell>
|
|
207
|
-
<Chip
|
|
208
|
-
label={row.status}
|
|
209
|
-
color={row.status === 'Active' ? 'success' : 'default'}
|
|
210
|
-
size="small"
|
|
211
|
-
/>
|
|
212
|
-
</TableCell>
|
|
213
|
-
</TableRow>
|
|
214
|
-
))}
|
|
215
|
-
</TableBody>
|
|
216
|
-
</Table>
|
|
217
|
-
</TableContainer>
|
|
218
|
-
),
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
export const DensityOptions: Story = {
|
|
222
|
-
render: () => (
|
|
223
|
-
<Stack spacing={4}>
|
|
224
|
-
<Box>
|
|
225
|
-
<Typography variant="h6" gutterBottom>
|
|
226
|
-
Compact Density
|
|
227
|
-
</Typography>
|
|
228
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} density="compact" />
|
|
229
|
-
</Box>
|
|
230
|
-
|
|
231
|
-
<Box>
|
|
232
|
-
<Typography variant="h6" gutterBottom>
|
|
233
|
-
Normal Density (Default)
|
|
234
|
-
</Typography>
|
|
235
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} density="normal" />
|
|
236
|
-
</Box>
|
|
237
|
-
|
|
238
|
-
<Box>
|
|
239
|
-
<Typography variant="h6" gutterBottom>
|
|
240
|
-
Comfortable Density
|
|
241
|
-
</Typography>
|
|
242
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} density="comfortable" />
|
|
243
|
-
</Box>
|
|
244
|
-
</Stack>
|
|
245
|
-
),
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
export const StickyHeader: Story = {
|
|
249
|
-
render: () => (
|
|
250
|
-
<Box height={300}>
|
|
251
|
-
<Table
|
|
252
|
-
columns={extendedColumns}
|
|
253
|
-
data={sampleData.concat(sampleData).concat(sampleData)} // Triple the data for scrolling
|
|
254
|
-
stickyHeader
|
|
255
|
-
variant="striped"
|
|
256
|
-
containerHeight={300}
|
|
257
|
-
/>
|
|
258
|
-
</Box>
|
|
259
|
-
),
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
export const RowSelection: Story = {
|
|
263
|
-
render: function RowSelectionTable() {
|
|
264
|
-
const [selectedRows, setSelectedRows] = useState<(string | number)[]>([1, 3]);
|
|
265
|
-
|
|
266
|
-
return (
|
|
267
|
-
<Box>
|
|
268
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
269
|
-
Selected rows: {selectedRows.join(', ') || 'None'}
|
|
270
|
-
</Typography>
|
|
271
|
-
<Table
|
|
272
|
-
columns={basicColumns}
|
|
273
|
-
data={sampleData}
|
|
274
|
-
selectable
|
|
275
|
-
selectedRows={selectedRows}
|
|
276
|
-
onSelectionChange={setSelectedRows}
|
|
277
|
-
variant="default"
|
|
278
|
-
/>
|
|
279
|
-
</Box>
|
|
280
|
-
);
|
|
281
|
-
},
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
export const ColumnSorting: Story = {
|
|
285
|
-
render: function SortableTable() {
|
|
286
|
-
const [sortConfig, setSortConfig] = useState<SortConfig>({ key: 'name', direction: 'asc' });
|
|
287
|
-
|
|
288
|
-
const sortedData = [...sampleData].sort((a, b) => {
|
|
289
|
-
if (sortConfig.direction === 'asc') {
|
|
290
|
-
return a[sortConfig.key as keyof typeof a] > b[sortConfig.key as keyof typeof b] ? 1 : -1;
|
|
291
|
-
} else {
|
|
292
|
-
return a[sortConfig.key as keyof typeof a] < b[sortConfig.key as keyof typeof b] ? 1 : -1;
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
return (
|
|
297
|
-
<Box>
|
|
298
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
299
|
-
Sorted by: {sortConfig.key} ({sortConfig.direction})
|
|
300
|
-
</Typography>
|
|
301
|
-
<Table
|
|
302
|
-
columns={extendedColumns}
|
|
303
|
-
data={sortedData}
|
|
304
|
-
sortable
|
|
305
|
-
sortConfig={sortConfig}
|
|
306
|
-
onSortChange={(key, direction) => setSortConfig({ key, direction })}
|
|
307
|
-
variant="gradient"
|
|
308
|
-
/>
|
|
309
|
-
</Box>
|
|
310
|
-
);
|
|
311
|
-
},
|
|
312
|
-
};
|
|
313
|
-
|
|
314
|
-
export const VirtualScrolling: Story = {
|
|
315
|
-
render: () => (
|
|
316
|
-
<Box>
|
|
317
|
-
<Typography variant="h6" gutterBottom>
|
|
318
|
-
Virtual Scrolling - 10,000 rows
|
|
319
|
-
</Typography>
|
|
320
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
321
|
-
Only visible rows are rendered for optimal performance
|
|
322
|
-
</Typography>
|
|
323
|
-
<Table
|
|
324
|
-
columns={extendedColumns}
|
|
325
|
-
data={largeDataset}
|
|
326
|
-
virtualScrolling
|
|
327
|
-
rowHeight={52}
|
|
328
|
-
containerHeight={400}
|
|
329
|
-
overscan={10}
|
|
330
|
-
variant="minimal"
|
|
331
|
-
/>
|
|
332
|
-
</Box>
|
|
333
|
-
),
|
|
334
|
-
};
|
|
335
|
-
|
|
336
|
-
export const ResponsiveDesign: Story = {
|
|
337
|
-
render: () => (
|
|
338
|
-
<Box>
|
|
339
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
340
|
-
Resize your window to see columns hide/show based on priority
|
|
341
|
-
</Typography>
|
|
342
|
-
<Table
|
|
343
|
-
columns={extendedColumns}
|
|
344
|
-
data={sampleData}
|
|
345
|
-
responsive
|
|
346
|
-
columnPriorities={[1, 2, 3, 4, 5, 6, 7, 8]} // Avatar and Name have highest priority
|
|
347
|
-
showColumnToggle
|
|
348
|
-
variant="glass"
|
|
349
|
-
/>
|
|
350
|
-
</Box>
|
|
351
|
-
),
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
export const AllFeaturesCombined: Story = {
|
|
355
|
-
render: function AdvancedTable() {
|
|
356
|
-
const [selectedRows, setSelectedRows] = useState<(string | number)[]>([]);
|
|
357
|
-
const [sortConfig, setSortConfig] = useState<SortConfig>({ key: 'name', direction: 'asc' });
|
|
358
|
-
|
|
359
|
-
const sortedData = [...sampleData].sort((a, b) => {
|
|
360
|
-
if (sortConfig.direction === 'asc') {
|
|
361
|
-
return a[sortConfig.key as keyof typeof a] > b[sortConfig.key as keyof typeof b] ? 1 : -1;
|
|
362
|
-
} else {
|
|
363
|
-
return a[sortConfig.key as keyof typeof a] < b[sortConfig.key as keyof typeof b] ? 1 : -1;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
return (
|
|
368
|
-
<Box>
|
|
369
|
-
<Typography variant="h6" gutterBottom>
|
|
370
|
-
Advanced Table - All Features Combined
|
|
371
|
-
</Typography>
|
|
372
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
373
|
-
Density: Comfortable | Selection | Sorting | Sticky Header | Responsive | Visual Effects
|
|
374
|
-
</Typography>
|
|
375
|
-
<Box height={400}>
|
|
376
|
-
<Table
|
|
377
|
-
columns={extendedColumns}
|
|
378
|
-
data={sortedData}
|
|
379
|
-
// Visual
|
|
380
|
-
variant="gradient"
|
|
381
|
-
glow
|
|
382
|
-
density="comfortable"
|
|
383
|
-
// Features
|
|
384
|
-
stickyHeader
|
|
385
|
-
selectable
|
|
386
|
-
selectedRows={selectedRows}
|
|
387
|
-
onSelectionChange={setSelectedRows}
|
|
388
|
-
sortable
|
|
389
|
-
sortConfig={sortConfig}
|
|
390
|
-
onSortChange={(key, direction) => setSortConfig({ key, direction })}
|
|
391
|
-
responsive
|
|
392
|
-
columnPriorities={[1, 2, 3, 4, 5, 6, 7, 8]}
|
|
393
|
-
// Interactions
|
|
394
|
-
hoverable
|
|
395
|
-
onRowClick={() => {}}
|
|
396
|
-
// Container
|
|
397
|
-
containerHeight={400}
|
|
398
|
-
/>
|
|
399
|
-
</Box>
|
|
400
|
-
</Box>
|
|
401
|
-
);
|
|
402
|
-
},
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
export const LoadingState: Story = {
|
|
406
|
-
render: () => <Table columns={basicColumns} data={[]} loading variant="default" />,
|
|
407
|
-
};
|
|
408
|
-
|
|
409
|
-
export const EmptyState: Story = {
|
|
410
|
-
render: () => (
|
|
411
|
-
<Table
|
|
412
|
-
columns={basicColumns}
|
|
413
|
-
data={[]}
|
|
414
|
-
variant="minimal"
|
|
415
|
-
emptyStateComponent={
|
|
416
|
-
<Box py={6} textAlign="center">
|
|
417
|
-
<StarIcon sx={{ fontSize: 48, color: 'text.disabled', mb: 2 }} />
|
|
418
|
-
<Typography variant="h6" color="text.secondary">
|
|
419
|
-
No users found
|
|
420
|
-
</Typography>
|
|
421
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
422
|
-
Try adjusting your search criteria
|
|
423
|
-
</Typography>
|
|
424
|
-
<Button variant="contained" size="small" sx={{ mt: 2 }}>
|
|
425
|
-
Add User
|
|
426
|
-
</Button>
|
|
427
|
-
</Box>
|
|
428
|
-
}
|
|
429
|
-
/>
|
|
430
|
-
),
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
export const Variants: Story = {
|
|
434
|
-
render: () => (
|
|
435
|
-
<Stack spacing={4}>
|
|
436
|
-
<Box>
|
|
437
|
-
<Typography variant="h6" gutterBottom>
|
|
438
|
-
Default
|
|
439
|
-
</Typography>
|
|
440
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} variant="default" />
|
|
441
|
-
</Box>
|
|
442
|
-
|
|
443
|
-
<Box>
|
|
444
|
-
<Typography variant="h6" gutterBottom>
|
|
445
|
-
Striped
|
|
446
|
-
</Typography>
|
|
447
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} variant="striped" />
|
|
448
|
-
</Box>
|
|
449
|
-
|
|
450
|
-
<Box>
|
|
451
|
-
<Typography variant="h6" gutterBottom>
|
|
452
|
-
Glass
|
|
453
|
-
</Typography>
|
|
454
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} variant="glass" />
|
|
455
|
-
</Box>
|
|
456
|
-
|
|
457
|
-
<Box>
|
|
458
|
-
<Typography variant="h6" gutterBottom>
|
|
459
|
-
Minimal
|
|
460
|
-
</Typography>
|
|
461
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} variant="minimal" />
|
|
462
|
-
</Box>
|
|
463
|
-
|
|
464
|
-
<Box>
|
|
465
|
-
<Typography variant="h6" gutterBottom>
|
|
466
|
-
Gradient
|
|
467
|
-
</Typography>
|
|
468
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} variant="gradient" />
|
|
469
|
-
</Box>
|
|
470
|
-
</Stack>
|
|
471
|
-
),
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
export const VisualEffects: Story = {
|
|
475
|
-
render: () => (
|
|
476
|
-
<Stack spacing={4}>
|
|
477
|
-
<Box>
|
|
478
|
-
<Typography variant="h6" gutterBottom>
|
|
479
|
-
With Glow
|
|
480
|
-
</Typography>
|
|
481
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} glow />
|
|
482
|
-
</Box>
|
|
483
|
-
|
|
484
|
-
<Box>
|
|
485
|
-
<Typography variant="h6" gutterBottom>
|
|
486
|
-
With Pulse
|
|
487
|
-
</Typography>
|
|
488
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} pulse variant="glass" />
|
|
489
|
-
</Box>
|
|
490
|
-
|
|
491
|
-
<Box>
|
|
492
|
-
<Typography variant="h6" gutterBottom>
|
|
493
|
-
Glow + Pulse
|
|
494
|
-
</Typography>
|
|
495
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} glow pulse />
|
|
496
|
-
</Box>
|
|
497
|
-
|
|
498
|
-
<Box>
|
|
499
|
-
<Typography variant="h6" gutterBottom>
|
|
500
|
-
Hoverable
|
|
501
|
-
</Typography>
|
|
502
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 3)} hoverable />
|
|
503
|
-
</Box>
|
|
504
|
-
</Stack>
|
|
505
|
-
),
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
export const CustomRendering: Story = {
|
|
509
|
-
render: () => (
|
|
510
|
-
<Table
|
|
511
|
-
columns={extendedColumns}
|
|
512
|
-
data={sampleData}
|
|
513
|
-
variant="striped"
|
|
514
|
-
renderCell={(value, column, rowData) => {
|
|
515
|
-
// Custom rendering for specific columns
|
|
516
|
-
if (column.key === 'name') {
|
|
517
|
-
return (
|
|
518
|
-
<Box display="flex" alignItems="center" gap={1}>
|
|
519
|
-
<Avatar sx={{ width: 24, height: 24, fontSize: '0.75rem' }}>{value.charAt(0)}</Avatar>
|
|
520
|
-
<Typography variant="body2" fontWeight="medium">
|
|
521
|
-
{value}
|
|
522
|
-
</Typography>
|
|
523
|
-
</Box>
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
// Fall back to column's render function or default
|
|
528
|
-
return column.render ? column.render(value, rowData) : value;
|
|
529
|
-
}}
|
|
530
|
-
/>
|
|
531
|
-
),
|
|
532
|
-
};
|
|
533
|
-
|
|
534
|
-
// Backward compatibility stories
|
|
535
|
-
export const BackwardCompatibility: Story = {
|
|
536
|
-
render: () => (
|
|
537
|
-
<Stack spacing={4}>
|
|
538
|
-
<Box>
|
|
539
|
-
<Typography variant="h6" gutterBottom>
|
|
540
|
-
Basic Usage (Backward Compatible)
|
|
541
|
-
</Typography>
|
|
542
|
-
<TableContainer component={Paper}>
|
|
543
|
-
<Table hoverable variant="striped">
|
|
544
|
-
<TableHead>
|
|
545
|
-
<TableRow>
|
|
546
|
-
<TableCell>Name</TableCell>
|
|
547
|
-
<TableCell>Email</TableCell>
|
|
548
|
-
<TableCell>Role</TableCell>
|
|
549
|
-
<TableCell>Status</TableCell>
|
|
550
|
-
</TableRow>
|
|
551
|
-
</TableHead>
|
|
552
|
-
<TableBody>
|
|
553
|
-
{sampleData.slice(0, 3).map((row) => (
|
|
554
|
-
<TableRow key={row.id}>
|
|
555
|
-
<TableCell>{row.name}</TableCell>
|
|
556
|
-
<TableCell>{row.email}</TableCell>
|
|
557
|
-
<TableCell>{row.role}</TableCell>
|
|
558
|
-
<TableCell>
|
|
559
|
-
<Chip
|
|
560
|
-
label={row.status}
|
|
561
|
-
color={row.status === 'Active' ? 'success' : 'default'}
|
|
562
|
-
size="small"
|
|
563
|
-
/>
|
|
564
|
-
</TableCell>
|
|
565
|
-
</TableRow>
|
|
566
|
-
))}
|
|
567
|
-
</TableBody>
|
|
568
|
-
</Table>
|
|
569
|
-
</TableContainer>
|
|
570
|
-
</Box>
|
|
571
|
-
</Stack>
|
|
572
|
-
),
|
|
573
|
-
};
|
|
574
|
-
|
|
575
|
-
// Required story exports for validation
|
|
576
|
-
export const AllVariants: Story = {
|
|
577
|
-
render: () => (
|
|
578
|
-
<Stack spacing={4}>
|
|
579
|
-
<Box>
|
|
580
|
-
<Typography variant="h6" gutterBottom>
|
|
581
|
-
All Table Variants
|
|
582
|
-
</Typography>
|
|
583
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
584
|
-
Default
|
|
585
|
-
</Typography>
|
|
586
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} variant="default" />
|
|
587
|
-
</Box>
|
|
588
|
-
|
|
589
|
-
<Box>
|
|
590
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
591
|
-
Striped
|
|
592
|
-
</Typography>
|
|
593
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} variant="striped" />
|
|
594
|
-
</Box>
|
|
595
|
-
|
|
596
|
-
<Box>
|
|
597
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
598
|
-
Glass
|
|
599
|
-
</Typography>
|
|
600
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} variant="glass" />
|
|
601
|
-
</Box>
|
|
602
|
-
|
|
603
|
-
<Box>
|
|
604
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
605
|
-
Minimal
|
|
606
|
-
</Typography>
|
|
607
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} variant="minimal" />
|
|
608
|
-
</Box>
|
|
609
|
-
|
|
610
|
-
<Box>
|
|
611
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
612
|
-
Gradient
|
|
613
|
-
</Typography>
|
|
614
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} variant="gradient" />
|
|
615
|
-
</Box>
|
|
616
|
-
</Stack>
|
|
617
|
-
),
|
|
618
|
-
};
|
|
619
|
-
|
|
620
|
-
export const AllSizes: Story = {
|
|
621
|
-
render: () => (
|
|
622
|
-
<Stack spacing={4}>
|
|
623
|
-
<Box>
|
|
624
|
-
<Typography variant="h6" gutterBottom>
|
|
625
|
-
All Table Sizes
|
|
626
|
-
</Typography>
|
|
627
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
628
|
-
Compact
|
|
629
|
-
</Typography>
|
|
630
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} density="compact" />
|
|
631
|
-
</Box>
|
|
632
|
-
|
|
633
|
-
<Box>
|
|
634
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
635
|
-
Normal
|
|
636
|
-
</Typography>
|
|
637
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} density="normal" />
|
|
638
|
-
</Box>
|
|
639
|
-
|
|
640
|
-
<Box>
|
|
641
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
642
|
-
Comfortable
|
|
643
|
-
</Typography>
|
|
644
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} density="comfortable" />
|
|
645
|
-
</Box>
|
|
646
|
-
</Stack>
|
|
647
|
-
),
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
export const AllStates: Story = {
|
|
651
|
-
render: () => (
|
|
652
|
-
<Stack spacing={4}>
|
|
653
|
-
<Box>
|
|
654
|
-
<Typography variant="h6" gutterBottom>
|
|
655
|
-
All Table States
|
|
656
|
-
</Typography>
|
|
657
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
658
|
-
Default State
|
|
659
|
-
</Typography>
|
|
660
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} />
|
|
661
|
-
</Box>
|
|
662
|
-
|
|
663
|
-
<Box>
|
|
664
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
665
|
-
Loading State
|
|
666
|
-
</Typography>
|
|
667
|
-
<Table columns={basicColumns} data={[]} loading />
|
|
668
|
-
</Box>
|
|
669
|
-
|
|
670
|
-
<Box>
|
|
671
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
672
|
-
Empty State
|
|
673
|
-
</Typography>
|
|
674
|
-
<Table columns={basicColumns} data={[]} />
|
|
675
|
-
</Box>
|
|
676
|
-
|
|
677
|
-
<Box>
|
|
678
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
679
|
-
With Selection
|
|
680
|
-
</Typography>
|
|
681
|
-
<Table columns={basicColumns} data={sampleData.slice(0, 2)} selectable selectedRows={[1]} />
|
|
682
|
-
</Box>
|
|
683
|
-
|
|
684
|
-
<Box>
|
|
685
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
686
|
-
With Sorting
|
|
687
|
-
</Typography>
|
|
688
|
-
<Table
|
|
689
|
-
columns={basicColumns}
|
|
690
|
-
data={sampleData.slice(0, 2)}
|
|
691
|
-
sortable
|
|
692
|
-
sortConfig={{ key: 'name', direction: 'asc' }}
|
|
693
|
-
/>
|
|
694
|
-
</Box>
|
|
695
|
-
</Stack>
|
|
696
|
-
),
|
|
697
|
-
};
|
|
698
|
-
|
|
699
|
-
export const InteractiveStates: Story = {
|
|
700
|
-
render: function InteractiveTable() {
|
|
701
|
-
const [selectedRows, setSelectedRows] = useState<(string | number)[]>([]);
|
|
702
|
-
const [sortConfig, setSortConfig] = useState<SortConfig>({ key: 'name', direction: 'asc' });
|
|
703
|
-
|
|
704
|
-
const sortedData = [...sampleData.slice(0, 4)].sort((a, b) => {
|
|
705
|
-
if (sortConfig.direction === 'asc') {
|
|
706
|
-
return a[sortConfig.key as keyof typeof a] > b[sortConfig.key as keyof typeof b] ? 1 : -1;
|
|
707
|
-
} else {
|
|
708
|
-
return a[sortConfig.key as keyof typeof a] < b[sortConfig.key as keyof typeof b] ? 1 : -1;
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
|
-
|
|
712
|
-
return (
|
|
713
|
-
<Box>
|
|
714
|
-
<Typography variant="h6" gutterBottom>
|
|
715
|
-
Interactive Table States
|
|
716
|
-
</Typography>
|
|
717
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
718
|
-
Click rows to select, click column headers to sort
|
|
719
|
-
</Typography>
|
|
720
|
-
<Table
|
|
721
|
-
columns={basicColumns}
|
|
722
|
-
data={sortedData}
|
|
723
|
-
hoverable
|
|
724
|
-
selectable
|
|
725
|
-
selectedRows={selectedRows}
|
|
726
|
-
onSelectionChange={setSelectedRows}
|
|
727
|
-
sortable
|
|
728
|
-
sortConfig={sortConfig}
|
|
729
|
-
onSortChange={(key, direction) => setSortConfig({ key, direction })}
|
|
730
|
-
variant="striped"
|
|
731
|
-
/>
|
|
732
|
-
</Box>
|
|
733
|
-
);
|
|
734
|
-
},
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
export const Responsive: Story = {
|
|
738
|
-
render: () => (
|
|
739
|
-
<Stack spacing={4}>
|
|
740
|
-
<Box>
|
|
741
|
-
<Typography variant="h6" gutterBottom>
|
|
742
|
-
Responsive Table
|
|
743
|
-
</Typography>
|
|
744
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
745
|
-
Mobile View (360px)
|
|
746
|
-
</Typography>
|
|
747
|
-
<Box
|
|
748
|
-
sx={{
|
|
749
|
-
width: 360,
|
|
750
|
-
overflow: 'auto',
|
|
751
|
-
border: '1px solid',
|
|
752
|
-
borderColor: 'divider',
|
|
753
|
-
borderRadius: 1,
|
|
754
|
-
}}
|
|
755
|
-
>
|
|
756
|
-
<Table
|
|
757
|
-
columns={extendedColumns}
|
|
758
|
-
data={sampleData.slice(0, 3)}
|
|
759
|
-
responsive
|
|
760
|
-
columnPriorities={[1, 2, 3, 4, 5, 6, 7, 8]}
|
|
761
|
-
variant="default"
|
|
762
|
-
/>
|
|
763
|
-
</Box>
|
|
764
|
-
</Box>
|
|
765
|
-
|
|
766
|
-
<Box>
|
|
767
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
768
|
-
Tablet View (768px)
|
|
769
|
-
</Typography>
|
|
770
|
-
<Box
|
|
771
|
-
sx={{
|
|
772
|
-
width: 768,
|
|
773
|
-
overflow: 'auto',
|
|
774
|
-
border: '1px solid',
|
|
775
|
-
borderColor: 'divider',
|
|
776
|
-
borderRadius: 1,
|
|
777
|
-
}}
|
|
778
|
-
>
|
|
779
|
-
<Table
|
|
780
|
-
columns={extendedColumns}
|
|
781
|
-
data={sampleData.slice(0, 3)}
|
|
782
|
-
responsive
|
|
783
|
-
columnPriorities={[1, 2, 3, 4, 5, 6, 7, 8]}
|
|
784
|
-
variant="default"
|
|
785
|
-
/>
|
|
786
|
-
</Box>
|
|
787
|
-
</Box>
|
|
788
|
-
|
|
789
|
-
<Box>
|
|
790
|
-
<Typography variant="body2" color="text.secondary" gutterBottom>
|
|
791
|
-
Desktop View (Full Width)
|
|
792
|
-
</Typography>
|
|
793
|
-
<Table
|
|
794
|
-
columns={extendedColumns}
|
|
795
|
-
data={sampleData.slice(0, 3)}
|
|
796
|
-
responsive
|
|
797
|
-
columnPriorities={[1, 2, 3, 4, 5, 6, 7, 8]}
|
|
798
|
-
variant="default"
|
|
799
|
-
/>
|
|
800
|
-
</Box>
|
|
801
|
-
</Stack>
|
|
802
|
-
),
|
|
803
|
-
};
|