@shohojdhara/atomix 0.3.14 → 0.4.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.
- package/CHANGELOG.md +20 -0
- package/build-tools/EXAMPLES.md +372 -0
- package/build-tools/README.md +242 -0
- package/build-tools/__tests__/error-handler.test.js +230 -0
- package/build-tools/__tests__/index.test.js +141 -0
- package/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/build-tools/__tests__/utils.test.js +161 -0
- package/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/build-tools/error-handler.js +308 -0
- package/build-tools/index.d.ts +44 -0
- package/build-tools/index.js +88 -0
- package/build-tools/package.json +50 -0
- package/build-tools/rollup-plugin.js +236 -0
- package/build-tools/types.d.ts +163 -0
- package/build-tools/utils.js +203 -0
- package/build-tools/vite-plugin.js +161 -0
- package/build-tools/webpack-loader.js +123 -0
- package/dist/atomix.css +21044 -2618
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +77 -3
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/EXAMPLES.md +372 -0
- package/dist/build-tools/README.md +242 -0
- package/dist/build-tools/__tests__/error-handler.test.js +230 -0
- package/dist/build-tools/__tests__/index.test.js +141 -0
- package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
- package/dist/build-tools/__tests__/utils.test.js +161 -0
- package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
- package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
- package/dist/build-tools/error-handler.js +308 -0
- package/dist/build-tools/index.d.ts +44 -0
- package/dist/build-tools/index.js +88 -0
- package/dist/build-tools/package.json +50 -0
- package/dist/build-tools/rollup-plugin.js +236 -0
- package/dist/build-tools/types.d.ts +163 -0
- package/dist/build-tools/utils.js +203 -0
- package/dist/build-tools/vite-plugin.js +161 -0
- package/dist/build-tools/webpack-loader.js +123 -0
- package/dist/charts.d.ts +1 -1
- package/dist/charts.js +86 -57
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +136 -112
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +2 -5
- package/dist/forms.js +140 -128
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +1 -1
- package/dist/heavy.js +136 -112
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +152 -78
- package/dist/index.esm.js +346 -340
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +359 -353
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.js.map +1 -1
- package/dist/theme.d.ts +9 -9
- package/dist/theme.js.map +1 -1
- package/package.json +23 -8
- package/scripts/atomix-cli.js +170 -73
- package/scripts/cli/__tests__/README.md +81 -0
- package/scripts/cli/__tests__/basic.test.js +115 -0
- package/scripts/cli/__tests__/component-generator.test.js +332 -0
- package/scripts/cli/__tests__/integration.test.js +327 -0
- package/scripts/cli/__tests__/test-setup.js +133 -0
- package/scripts/cli/__tests__/token-manager.test.js +251 -0
- package/scripts/cli/__tests__/utils.test.js +161 -0
- package/scripts/cli/component-generator.js +253 -299
- package/scripts/cli/dependency-checker.js +355 -0
- package/scripts/cli/interactive-init.js +46 -5
- package/scripts/cli/template-manager.js +0 -2
- package/scripts/cli/templates/common-templates.js +636 -0
- package/scripts/cli/templates/composable-templates.js +148 -126
- package/scripts/cli/templates/index.js +23 -16
- package/scripts/cli/templates/project-templates.js +151 -23
- package/scripts/cli/templates/react-templates.js +280 -210
- package/scripts/cli/templates/scss-templates.js +90 -91
- package/scripts/cli/templates/testing-templates.js +206 -27
- package/scripts/cli/templates/testing-utils.js +278 -0
- package/scripts/cli/templates/types-templates.js +70 -56
- package/scripts/cli/theme-bridge.js +8 -2
- package/scripts/cli/token-manager.js +318 -206
- package/scripts/cli/utils.js +0 -1
- package/src/components/Accordion/Accordion.stories.tsx +358 -850
- package/src/components/Accordion/Accordion.test.tsx +70 -50
- package/src/components/Accordion/Accordion.tsx +99 -94
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
- package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
- package/src/components/AtomixGlass/glass-utils.ts +6 -5
- package/src/components/AtomixGlass/shader-utils.ts +133 -52
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +51 -36
- package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
- package/src/components/Avatar/Avatar.stories.tsx +195 -0
- package/src/components/Avatar/Avatar.tsx +58 -56
- package/src/components/Badge/Badge.stories.tsx +122 -352
- package/src/components/Badge/Badge.test.tsx +41 -41
- package/src/components/Badge/Badge.tsx +64 -62
- package/src/components/Block/Block.stories.tsx +30 -11
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +142 -23
- package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
- package/src/components/Button/Button.stories.tsx +454 -1126
- package/src/components/Button/Button.test.tsx +123 -0
- package/src/components/Button/Button.tsx +88 -60
- package/src/components/Button/ButtonGroup.stories.tsx +376 -215
- package/src/components/Button/ButtonGroup.tsx +4 -15
- package/src/components/Callout/Callout.stories.tsx +316 -568
- package/src/components/Card/Card.stories.tsx +292 -81
- package/src/components/Card/Card.tsx +30 -14
- package/src/components/Chart/AreaChart.tsx +1 -1
- package/src/components/Chart/CandlestickChart.tsx +23 -16
- package/src/components/Chart/Chart.stories.tsx +153 -16
- package/src/components/Chart/Chart.tsx +40 -44
- package/src/components/Chart/ChartRenderer.tsx +39 -12
- package/src/components/Chart/ChartToolbar.tsx +21 -5
- package/src/components/Chart/DonutChart.tsx +1 -1
- package/src/components/Chart/FunnelChart.tsx +4 -1
- package/src/components/Chart/GaugeChart.tsx +3 -1
- package/src/components/Chart/HeatmapChart.tsx +50 -37
- package/src/components/Chart/LineChart.tsx +3 -2
- package/src/components/Chart/MultiAxisChart.tsx +24 -16
- package/src/components/Chart/RadarChart.tsx +19 -17
- package/src/components/Chart/ScatterChart.tsx +29 -21
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +152 -66
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
- package/src/components/Countdown/Countdown.stories.tsx +114 -7
- package/src/components/DataTable/DataTable.stories.tsx +349 -144
- package/src/components/DataTable/DataTable.test.tsx +26 -148
- package/src/components/DataTable/DataTable.tsx +485 -456
- package/src/components/DatePicker/DatePicker.stories.tsx +310 -1066
- package/src/components/DatePicker/DatePicker.tsx +31 -26
- package/src/components/Dropdown/Dropdown.stories.tsx +153 -36
- package/src/components/Dropdown/Dropdown.tsx +313 -299
- package/src/components/EdgePanel/EdgePanel.stories.tsx +221 -25
- package/src/components/EdgePanel/EdgePanel.tsx +1 -3
- package/src/components/Footer/Footer.stories.tsx +396 -327
- package/src/components/Footer/Footer.tsx +130 -128
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Form/Checkbox.stories.tsx +140 -6
- package/src/components/Form/Checkbox.test.tsx +63 -0
- package/src/components/Form/Checkbox.tsx +122 -78
- package/src/components/Form/Form.stories.tsx +110 -19
- package/src/components/Form/FormGroup.stories.tsx +127 -4
- package/src/components/Form/Input.stories.tsx +22 -39
- package/src/components/Form/Input.test.tsx +38 -44
- package/src/components/Form/Radio.stories.tsx +146 -17
- package/src/components/Form/Radio.tsx +68 -66
- package/src/components/Form/Select.stories.tsx +140 -8
- package/src/components/Form/Select.tsx +184 -182
- package/src/components/Form/Textarea.stories.tsx +149 -6
- package/src/components/Form/Textarea.test.tsx +27 -32
- package/src/components/Hero/Hero.stories.tsx +372 -38
- package/src/components/Hero/Hero.tsx +201 -55
- package/src/components/Icon/index.ts +7 -1
- package/src/components/List/List.stories.tsx +141 -3
- package/src/components/List/List.tsx +19 -23
- package/src/components/Modal/Modal.stories.tsx +183 -43
- package/src/components/Modal/Modal.tsx +130 -127
- package/src/components/Navigation/Menu/MegaMenu.tsx +70 -70
- package/src/components/Navigation/Nav/NavDropdown.tsx +1 -5
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +128 -28
- package/src/components/Navigation/SideMenu/SideMenu.tsx +5 -7
- package/src/components/Navigation/SideMenu/SideMenuItem.tsx +4 -5
- package/src/components/Pagination/Pagination.stories.tsx +7 -4
- package/src/components/Pagination/Pagination.tsx +199 -202
- package/src/components/PhotoViewer/PhotoViewer.tsx +4 -1
- package/src/components/Popover/Popover.stories.tsx +354 -97
- package/src/components/Popover/Popover.tsx +41 -37
- package/src/components/Progress/Progress.stories.tsx +160 -7
- package/src/components/River/River.stories.tsx +3 -2
- package/src/components/SectionIntro/SectionIntro.stories.tsx +239 -47
- package/src/components/Slider/Slider.stories.tsx +12 -4
- package/src/components/Spinner/Spinner.stories.tsx +104 -8
- package/src/components/Spinner/Spinner.test.tsx +23 -23
- package/src/components/Spinner/Spinner.tsx +43 -46
- package/src/components/Steps/Steps.stories.tsx +173 -42
- package/src/components/Tabs/Tabs.stories.tsx +141 -12
- package/src/components/Tabs/Tabs.tsx +74 -72
- package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
- package/src/components/Todo/Todo.stories.tsx +198 -9
- package/src/components/Toggle/Toggle.stories.tsx +137 -36
- package/src/components/Toggle/Toggle.test.tsx +65 -70
- package/src/components/Toggle/Toggle.tsx +4 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +194 -100
- package/src/components/Tooltip/Tooltip.tsx +104 -106
- package/src/components/Upload/Upload.stories.tsx +241 -150
- package/src/components/Upload/Upload.tsx +287 -283
- package/src/components/VideoPlayer/VideoPlayer.tsx +6 -1
- package/src/components/index.ts +13 -2
- package/src/layouts/Grid/Grid.stories.tsx +9 -3
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +5 -1
- package/src/lib/README.md +2 -2
- package/src/lib/__tests__/theme-tools.test.ts +219 -0
- package/src/lib/composables/index.ts +2 -2
- package/src/lib/composables/shared-mouse-tracker.ts +13 -14
- package/src/lib/composables/useAtomixGlass.ts +126 -97
- package/src/lib/composables/useChartExport.ts +3 -8
- package/src/lib/composables/useDataTable.ts +72 -43
- package/src/lib/composables/useHero.ts +58 -14
- package/src/lib/composables/useHeroBackgroundSlider.ts +2 -9
- package/src/lib/composables/useInput.ts +10 -8
- package/src/lib/composables/useSideMenu.ts +6 -5
- package/src/lib/composables/useTooltip.ts +1 -2
- package/src/lib/composables/useVideoPlayer.ts +44 -35
- package/src/lib/config/index.ts +154 -154
- package/src/lib/constants/components.ts +9 -32
- package/src/lib/constants/cssVariables.ts +29 -29
- package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +2 -6
- package/src/lib/hooks/index.ts +1 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -17
- package/src/lib/hooks/usePerformanceMonitor.ts +6 -7
- package/src/lib/patterns/__tests__/slots.test.ts +1 -1
- package/src/lib/patterns/index.ts +1 -1
- package/src/lib/patterns/slots.tsx +8 -13
- package/src/lib/storybook/InteractiveDemo.tsx +13 -18
- package/src/lib/storybook/PreviewContainer.tsx +1 -1
- package/src/lib/storybook/VariantsGrid.tsx +3 -7
- package/src/lib/storybook/index.ts +1 -1
- package/src/lib/theme/adapters/cssVariableMapper.ts +47 -74
- package/src/lib/theme/adapters/index.ts +3 -9
- package/src/lib/theme/adapters/themeAdapter.ts +41 -26
- package/src/lib/theme/config/index.ts +1 -1
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +10 -5
- package/src/lib/theme/constants/constants.ts +2 -2
- package/src/lib/theme/constants/index.ts +1 -2
- package/src/lib/theme/core/__tests__/createTheme.test.ts +20 -22
- package/src/lib/theme/core/composeTheme.ts +32 -26
- package/src/lib/theme/core/createTheme.ts +1 -1
- package/src/lib/theme/core/createThemeObject.ts +308 -301
- package/src/lib/theme/core/index.ts +3 -3
- package/src/lib/theme/devtools/CLI.ts +107 -105
- package/src/lib/theme/devtools/Comparator.tsx +50 -32
- package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +50 -48
- package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +257 -63
- package/src/lib/theme/devtools/Inspector.tsx +75 -60
- package/src/lib/theme/devtools/LiveEditor.tsx +97 -76
- package/src/lib/theme/devtools/Preview.tsx +150 -106
- package/src/lib/theme/devtools/ThemeValidator.ts +29 -21
- package/src/lib/theme/devtools/index.ts +3 -9
- package/src/lib/theme/devtools/useHistory.ts +23 -21
- package/src/lib/theme/errors/errors.ts +12 -11
- package/src/lib/theme/errors/index.ts +2 -7
- package/src/lib/theme/generators/generateCSS.ts +9 -13
- package/src/lib/theme/generators/generateCSSNested.ts +1 -6
- package/src/lib/theme/generators/generateCSSVariables.ts +673 -630
- package/src/lib/theme/generators/index.ts +1 -4
- package/src/lib/theme/i18n/index.ts +1 -1
- package/src/lib/theme/i18n/rtl.ts +13 -13
- package/src/lib/theme/index.ts +7 -16
- package/src/lib/theme/runtime/ThemeApplicator.ts +4 -4
- package/src/lib/theme/runtime/ThemeContext.tsx +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +19 -23
- package/src/lib/theme/runtime/ThemeProvider.tsx +230 -239
- package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +1 -1
- package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +24 -29
- package/src/lib/theme/runtime/index.ts +2 -5
- package/src/lib/theme/runtime/useTheme.ts +18 -18
- package/src/lib/theme/runtime/useThemeTokens.ts +22 -22
- package/src/lib/theme/test/testTheme.ts +15 -16
- package/src/lib/theme/tokens/index.ts +2 -7
- package/src/lib/theme/tokens/tokens.ts +25 -24
- package/src/lib/theme/types.ts +428 -411
- package/src/lib/theme/utils/__tests__/themeValidation.test.ts +3 -3
- package/src/lib/theme/utils/componentTheming.ts +18 -18
- package/src/lib/theme/utils/domUtils.ts +277 -289
- package/src/lib/theme/utils/index.ts +1 -2
- package/src/lib/theme/utils/injectCSS.ts +10 -14
- package/src/lib/theme/utils/naming.ts +20 -16
- package/src/lib/theme/utils/themeHelpers.ts +10 -12
- package/src/lib/theme/utils/themeUtils.ts +85 -86
- package/src/lib/theme/utils/themeValidation.ts +82 -33
- package/src/lib/theme-tools.ts +8 -6
- package/src/lib/types/components.ts +172 -71
- package/src/lib/types/partProps.ts +1 -1
- package/src/lib/utils/__tests__/csv.test.ts +45 -0
- package/src/lib/utils/componentUtils.ts +8 -12
- package/src/lib/utils/csv.ts +19 -0
- package/src/lib/utils/dataTableExport.ts +2 -15
- package/src/lib/utils/fontPreloader.ts +10 -19
- package/src/lib/utils/icons.ts +4 -1
- package/src/lib/utils/index.ts +2 -6
- package/src/lib/utils/memoryMonitor.ts +10 -8
- package/src/lib/utils/themeNaming.ts +2 -2
- package/src/styles/01-settings/_index.scss +1 -1
- package/src/styles/01-settings/_settings.accordion.scss +28 -7
- package/src/styles/01-settings/_settings.colors.scss +11 -11
- package/src/styles/01-settings/_settings.design-tokens.scss +61 -50
- package/src/styles/01-settings/_settings.navbar.scss +1 -1
- package/src/styles/01-settings/_settings.spacing.scss +3 -4
- package/src/styles/01-settings/_settings.tooltip.scss +1 -1
- package/src/styles/01-settings/_settings.typography.scss +4 -4
- package/src/styles/02-tools/_tools.button.scss +51 -21
- package/src/styles/02-tools/_tools.utility-api.scss +38 -12
- package/src/styles/03-generic/_generic.root.scss +4 -3
- package/src/styles/06-components/_components.accordion.scss +56 -14
- package/src/styles/06-components/_components.atomix-glass.scss +13 -9
- package/src/styles/06-components/_components.button.scss +16 -4
- package/src/styles/06-components/_components.callout.scss +27 -21
- package/src/styles/06-components/_components.card.scss +5 -14
- package/src/styles/06-components/_components.chart.scss +22 -19
- package/src/styles/06-components/_components.checkbox.scss +25 -17
- package/src/styles/06-components/_components.color-mode-toggle.scss +3 -1
- package/src/styles/06-components/_components.edge-panel.scss +9 -2
- package/src/styles/06-components/_components.footer.scss +1 -1
- package/src/styles/06-components/_components.side-menu.scss +5 -5
- package/src/styles/06-components/_components.toggle.scss +18 -0
- package/src/styles/06-components/_index.scss +1 -1
- package/src/styles/06-components/old.chart.styles.scss +0 -2
- package/src/styles/99-utilities/_index.scss +2 -0
- package/src/styles/99-utilities/_utilities.border.scss +69 -27
- package/src/styles/99-utilities/_utilities.display.scss +1 -1
- package/src/styles/99-utilities/_utilities.opacity.scss +10 -0
- package/src/styles/99-utilities/_utilities.position.scss +16 -9
- package/src/styles/99-utilities/_utilities.scss +2 -0
- package/src/styles/99-utilities/_utilities.sizes.scss +47 -18
- package/src/styles/99-utilities/_utilities.spacing.scss +118 -66
- package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
- package/src/styles/99-utilities/_utilities.text.scss +67 -46
- package/themes/dark-complementary/README.md +98 -0
- package/themes/dark-complementary/index.scss +158 -0
- package/themes/default-light/README.md +81 -0
- package/themes/default-light/index.scss +154 -0
- package/themes/high-contrast/README.md +105 -0
- package/themes/high-contrast/index.scss +172 -0
- package/themes/test-theme/README.md +38 -0
- package/themes/test-theme/index.scss +47 -0
- package/scripts/cli/templates-original-backup.js +0 -1655
- package/scripts/cli/templates_backup.js +0 -684
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
- package/src/lib/composables/useButton.ts +0 -93
- package/src/lib/composables/useCheckbox.ts +0 -70
|
@@ -1,33 +1,184 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
2
3
|
import { useState } from 'react';
|
|
3
4
|
import { DataTableColumn } from '../../lib/types/components';
|
|
4
5
|
import { DataTable } from './DataTable';
|
|
5
6
|
|
|
6
|
-
const meta = {
|
|
7
|
+
const meta: Meta<typeof DataTable> = {
|
|
7
8
|
title: 'Components/DataTable',
|
|
8
9
|
component: DataTable,
|
|
9
10
|
parameters: {
|
|
10
11
|
layout: 'padded',
|
|
11
12
|
docs: {
|
|
12
13
|
description: {
|
|
13
|
-
component:
|
|
14
|
-
|
|
14
|
+
component: `
|
|
15
|
+
# DataTable
|
|
16
|
+
|
|
17
|
+
## Overview
|
|
18
|
+
|
|
19
|
+
DataTable provides a powerful and flexible way to display structured data in rows and columns. It supports sorting, filtering, pagination, selection, and various display options. DataTables are ideal for displaying large datasets, user lists, product catalogs, or any tabular information requiring advanced data manipulation.
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Sorting capability for columns
|
|
24
|
+
- Filtering functionality
|
|
25
|
+
- Pagination with configurable page size
|
|
26
|
+
- Row selection options
|
|
27
|
+
- Custom cell rendering
|
|
28
|
+
- Responsive design
|
|
29
|
+
- Loading states
|
|
30
|
+
- Empty state handling
|
|
31
|
+
|
|
32
|
+
## Accessibility
|
|
33
|
+
|
|
34
|
+
- Keyboard support: Navigate with arrow keys, select with Space/Enter
|
|
35
|
+
- Screen reader: Table headers and data cells announced properly
|
|
36
|
+
- ARIA support: Appropriate roles and properties for tables
|
|
37
|
+
- Focus management: Maintains focus within the table controls
|
|
38
|
+
|
|
39
|
+
## Usage Examples
|
|
40
|
+
|
|
41
|
+
### Basic Usage
|
|
42
|
+
|
|
43
|
+
\`\`\`tsx
|
|
44
|
+
<DataTable
|
|
45
|
+
data={data}
|
|
46
|
+
columns={columns}
|
|
47
|
+
/>
|
|
48
|
+
\`\`\`
|
|
49
|
+
|
|
50
|
+
### With Pagination
|
|
51
|
+
|
|
52
|
+
\`\`\`tsx
|
|
53
|
+
<DataTable
|
|
54
|
+
data={data}
|
|
55
|
+
columns={columns}
|
|
56
|
+
paginated={true}
|
|
57
|
+
pageSize={10}
|
|
58
|
+
/>
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
## API Reference
|
|
62
|
+
|
|
63
|
+
### Props
|
|
64
|
+
|
|
65
|
+
| Prop | Type | Default | Description |
|
|
66
|
+
| ---- | ---- | ------- | ----------- |
|
|
67
|
+
| data | T[] | [] | Array of data objects to display |
|
|
68
|
+
| columns | DataTableColumn[] | [] | Column definitions for the table |
|
|
69
|
+
| sortable | boolean | false | Whether columns are sortable |
|
|
70
|
+
| filterable | boolean | false | Whether the table is filterable |
|
|
71
|
+
| paginated | boolean | false | Whether to enable pagination |
|
|
72
|
+
| pageSize | number | 10 | Number of rows per page |
|
|
73
|
+
| striped | boolean | false | Whether to apply striped row styling |
|
|
74
|
+
| bordered | boolean | false | Whether to show table borders |
|
|
75
|
+
| dense | boolean | false | Whether to use dense row spacing |
|
|
76
|
+
| loading | boolean | false | Whether the table is in loading state |
|
|
77
|
+
| emptyMessage | string | 'No records found' | Message to display when table is empty |
|
|
78
|
+
| onRowClick | (row: T) => void | - | Callback when a row is clicked |
|
|
79
|
+
| onSelectionChange | (selected: T[]) => void | - | Callback when selection changes |
|
|
80
|
+
`,
|
|
15
81
|
},
|
|
16
82
|
},
|
|
17
83
|
},
|
|
18
84
|
tags: ['autodocs'],
|
|
19
85
|
argTypes: {
|
|
20
|
-
data: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
86
|
+
data: {
|
|
87
|
+
control: 'object',
|
|
88
|
+
description: 'Array of data objects to display',
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: 'T[]' },
|
|
91
|
+
defaultValue: { summary: '[]' },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
columns: {
|
|
95
|
+
control: 'object',
|
|
96
|
+
description: 'Column definitions for the table',
|
|
97
|
+
table: {
|
|
98
|
+
type: { summary: 'DataTableColumn[]' },
|
|
99
|
+
defaultValue: { summary: '[]' },
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
sortable: {
|
|
103
|
+
control: 'boolean',
|
|
104
|
+
description: 'Whether columns are sortable',
|
|
105
|
+
table: {
|
|
106
|
+
type: { summary: 'boolean' },
|
|
107
|
+
defaultValue: { summary: 'false' },
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
filterable: {
|
|
111
|
+
control: 'boolean',
|
|
112
|
+
description: 'Whether the table is filterable',
|
|
113
|
+
table: {
|
|
114
|
+
type: { summary: 'boolean' },
|
|
115
|
+
defaultValue: { summary: 'false' },
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
paginated: {
|
|
119
|
+
control: 'boolean',
|
|
120
|
+
description: 'Whether to enable pagination',
|
|
121
|
+
table: {
|
|
122
|
+
type: { summary: 'boolean' },
|
|
123
|
+
defaultValue: { summary: 'false' },
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
pageSize: {
|
|
127
|
+
control: 'number',
|
|
128
|
+
description: 'Number of rows per page',
|
|
129
|
+
table: {
|
|
130
|
+
type: { summary: 'number' },
|
|
131
|
+
defaultValue: { summary: '10' },
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
striped: {
|
|
135
|
+
control: 'boolean',
|
|
136
|
+
description: 'Whether to apply striped row styling',
|
|
137
|
+
table: {
|
|
138
|
+
type: { summary: 'boolean' },
|
|
139
|
+
defaultValue: { summary: 'false' },
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
bordered: {
|
|
143
|
+
control: 'boolean',
|
|
144
|
+
description: 'Whether to show table borders',
|
|
145
|
+
table: {
|
|
146
|
+
type: { summary: 'boolean' },
|
|
147
|
+
defaultValue: { summary: 'false' },
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
dense: {
|
|
151
|
+
control: 'boolean',
|
|
152
|
+
description: 'Whether to use dense row spacing',
|
|
153
|
+
table: {
|
|
154
|
+
type: { summary: 'boolean' },
|
|
155
|
+
defaultValue: { summary: 'false' },
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
loading: {
|
|
159
|
+
control: 'boolean',
|
|
160
|
+
description: 'Whether the table is in loading state',
|
|
161
|
+
table: {
|
|
162
|
+
type: { summary: 'boolean' },
|
|
163
|
+
defaultValue: { summary: 'false' },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
emptyMessage: {
|
|
167
|
+
control: 'text',
|
|
168
|
+
description: 'Message to display when table is empty',
|
|
169
|
+
table: {
|
|
170
|
+
type: { summary: 'string' },
|
|
171
|
+
defaultValue: { summary: 'No records found' },
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
onRowClick: {
|
|
175
|
+
action: 'row clicked',
|
|
176
|
+
description: 'Callback when a row is clicked',
|
|
177
|
+
},
|
|
178
|
+
onSelectionChange: {
|
|
179
|
+
action: 'selection changed',
|
|
180
|
+
description: 'Callback when selection changes',
|
|
181
|
+
},
|
|
31
182
|
},
|
|
32
183
|
} satisfies Meta<typeof DataTable>;
|
|
33
184
|
|
|
@@ -78,170 +229,166 @@ const columns: DataTableColumn[] = [
|
|
|
78
229
|
title: 'Status',
|
|
79
230
|
sortable: true,
|
|
80
231
|
render: (value, row) => {
|
|
81
|
-
let
|
|
232
|
+
let statusClass = '';
|
|
82
233
|
switch (value) {
|
|
83
234
|
case 'Active':
|
|
84
|
-
|
|
235
|
+
statusClass = 'u-text-success';
|
|
85
236
|
break;
|
|
86
237
|
case 'Inactive':
|
|
87
|
-
|
|
238
|
+
statusClass = 'u-text-error';
|
|
88
239
|
break;
|
|
89
240
|
case 'Pending':
|
|
90
|
-
|
|
241
|
+
statusClass = 'u-text-warning';
|
|
91
242
|
break;
|
|
92
243
|
case 'Suspended':
|
|
93
|
-
|
|
244
|
+
statusClass = 'u-text-gray';
|
|
94
245
|
break;
|
|
246
|
+
default:
|
|
247
|
+
statusClass = 'u-text-gray';
|
|
95
248
|
}
|
|
96
|
-
return <span
|
|
249
|
+
return <span className={statusClass}>{value}</span>;
|
|
97
250
|
},
|
|
98
251
|
},
|
|
99
252
|
];
|
|
100
253
|
|
|
101
|
-
//
|
|
102
|
-
|
|
254
|
+
// ========================================
|
|
255
|
+
// BASIC USAGE STORIES
|
|
256
|
+
// ========================================
|
|
257
|
+
|
|
258
|
+
export const BasicUsage: Story = {
|
|
103
259
|
args: {
|
|
104
260
|
data: users,
|
|
105
|
-
columns,
|
|
261
|
+
columns: columns,
|
|
262
|
+
},
|
|
263
|
+
parameters: {
|
|
264
|
+
docs: {
|
|
265
|
+
description: {
|
|
266
|
+
story: 'Basic DataTable component with sample user data.',
|
|
267
|
+
},
|
|
268
|
+
},
|
|
106
269
|
},
|
|
107
270
|
};
|
|
108
271
|
|
|
109
|
-
//
|
|
110
|
-
|
|
272
|
+
// ========================================
|
|
273
|
+
// VARIANTS & STATES STORIES
|
|
274
|
+
// ========================================
|
|
275
|
+
|
|
276
|
+
export const LoadingState: Story = {
|
|
111
277
|
args: {
|
|
112
278
|
data: users,
|
|
113
279
|
columns,
|
|
114
|
-
|
|
280
|
+
loading: true,
|
|
115
281
|
},
|
|
116
282
|
};
|
|
117
283
|
|
|
118
|
-
|
|
119
|
-
export const Filterable: Story = {
|
|
284
|
+
export const EmptyState: Story = {
|
|
120
285
|
args: {
|
|
121
|
-
data:
|
|
286
|
+
data: [],
|
|
122
287
|
columns,
|
|
123
|
-
|
|
288
|
+
emptyMessage: 'No users found',
|
|
124
289
|
},
|
|
125
290
|
};
|
|
126
291
|
|
|
127
|
-
|
|
128
|
-
export const Paginated: Story = {
|
|
292
|
+
export const WithStripedRows: Story = {
|
|
129
293
|
args: {
|
|
130
294
|
data: users,
|
|
131
|
-
columns,
|
|
132
|
-
|
|
133
|
-
pageSize: 5,
|
|
295
|
+
columns: columns,
|
|
296
|
+
striped: true,
|
|
134
297
|
},
|
|
135
298
|
parameters: {
|
|
136
299
|
docs: {
|
|
137
300
|
description: {
|
|
138
|
-
story: '
|
|
301
|
+
story: 'DataTable with striped row styling for improved readability.',
|
|
139
302
|
},
|
|
140
303
|
},
|
|
141
304
|
},
|
|
142
305
|
};
|
|
143
306
|
|
|
144
|
-
|
|
145
|
-
export const PaginatedLargeDataset: Story = {
|
|
307
|
+
export const WithBorderedTable: Story = {
|
|
146
308
|
args: {
|
|
147
|
-
data:
|
|
309
|
+
data: users,
|
|
148
310
|
columns,
|
|
149
|
-
|
|
150
|
-
pageSize: 10,
|
|
151
|
-
},
|
|
152
|
-
parameters: {
|
|
153
|
-
docs: {
|
|
154
|
-
description: {
|
|
155
|
-
story:
|
|
156
|
-
'Pagination with a large dataset (100 items) demonstrating first/last buttons and ellipsis.',
|
|
157
|
-
},
|
|
158
|
-
},
|
|
311
|
+
bordered: true,
|
|
159
312
|
},
|
|
160
313
|
};
|
|
161
314
|
|
|
162
|
-
|
|
163
|
-
export const CompleteFeatures: Story = {
|
|
315
|
+
export const DenseSpacing: Story = {
|
|
164
316
|
args: {
|
|
165
|
-
data:
|
|
317
|
+
data: users,
|
|
166
318
|
columns,
|
|
167
319
|
sortable: true,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
320
|
+
dense: true,
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
// ========================================
|
|
325
|
+
// SORTING & FILTERING STORIES
|
|
326
|
+
// ========================================
|
|
327
|
+
|
|
328
|
+
export const WithSorting: Story = {
|
|
329
|
+
args: {
|
|
330
|
+
data: users,
|
|
331
|
+
columns: columns,
|
|
332
|
+
sortable: true,
|
|
173
333
|
},
|
|
174
334
|
parameters: {
|
|
175
335
|
docs: {
|
|
176
336
|
description: {
|
|
177
|
-
story: '
|
|
337
|
+
story: 'DataTable with column sorting functionality enabled.',
|
|
178
338
|
},
|
|
179
339
|
},
|
|
180
340
|
},
|
|
181
341
|
};
|
|
182
342
|
|
|
183
|
-
|
|
184
|
-
export const Styled: Story = {
|
|
343
|
+
export const WithFiltering: Story = {
|
|
185
344
|
args: {
|
|
186
345
|
data: users,
|
|
187
346
|
columns,
|
|
188
|
-
|
|
189
|
-
striped: true,
|
|
190
|
-
bordered: true,
|
|
347
|
+
filterable: true,
|
|
191
348
|
},
|
|
192
349
|
};
|
|
193
350
|
|
|
194
|
-
|
|
195
|
-
export const Dense: Story = {
|
|
351
|
+
export const WithColumnFilters: Story = {
|
|
196
352
|
args: {
|
|
197
353
|
data: users,
|
|
198
|
-
columns
|
|
354
|
+
columns: columns.map(col => ({
|
|
355
|
+
...col,
|
|
356
|
+
filterable: ['name', 'role', 'email'].includes(col.key),
|
|
357
|
+
})),
|
|
358
|
+
columnFilters: true,
|
|
199
359
|
sortable: true,
|
|
200
|
-
dense: true,
|
|
201
360
|
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
emptyMessage: 'No users found',
|
|
361
|
+
parameters: {
|
|
362
|
+
docs: {
|
|
363
|
+
description: {
|
|
364
|
+
story:
|
|
365
|
+
'DataTable with column-specific filters. Each filterable column has its own filter input.',
|
|
366
|
+
},
|
|
367
|
+
},
|
|
210
368
|
},
|
|
211
369
|
};
|
|
212
370
|
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
data: users,
|
|
217
|
-
columns,
|
|
218
|
-
loading: true,
|
|
219
|
-
},
|
|
220
|
-
};
|
|
371
|
+
// ========================================
|
|
372
|
+
// ROW SELECTION STORIES
|
|
373
|
+
// ========================================
|
|
221
374
|
|
|
222
|
-
|
|
223
|
-
export const Interactive: Story = {
|
|
375
|
+
export const WithRowSelectionSingle: Story = {
|
|
224
376
|
render: args => {
|
|
225
|
-
const [
|
|
226
|
-
|
|
227
|
-
const handleRowClick = (row: any) => {
|
|
228
|
-
setSelectedUser(row);
|
|
229
|
-
};
|
|
377
|
+
const [selectedRow, setSelectedRow] = useState<any>(null);
|
|
230
378
|
|
|
231
379
|
return (
|
|
232
380
|
<div>
|
|
233
|
-
<DataTable
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
<
|
|
244
|
-
<pre>{JSON.stringify(selectedUser, null, 2)}</pre>
|
|
381
|
+
<DataTable
|
|
382
|
+
{...args}
|
|
383
|
+
data={args.data || users}
|
|
384
|
+
columns={args.columns || columns}
|
|
385
|
+
selectionMode="single"
|
|
386
|
+
onSelectionChange={rows => setSelectedRow(rows[0] || null)}
|
|
387
|
+
/>
|
|
388
|
+
{selectedRow && (
|
|
389
|
+
<div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
|
|
390
|
+
<strong>Selected:</strong>
|
|
391
|
+
<pre className="u-mt-2 u-text-xs">{JSON.stringify(selectedRow, null, 2)}</pre>
|
|
245
392
|
</div>
|
|
246
393
|
)}
|
|
247
394
|
</div>
|
|
@@ -252,10 +399,16 @@ export const Interactive: Story = {
|
|
|
252
399
|
columns,
|
|
253
400
|
sortable: true,
|
|
254
401
|
},
|
|
402
|
+
parameters: {
|
|
403
|
+
docs: {
|
|
404
|
+
description: {
|
|
405
|
+
story: 'DataTable with single row selection enabled. Select a row using radio buttons.',
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
},
|
|
255
409
|
};
|
|
256
410
|
|
|
257
|
-
|
|
258
|
-
export const RowSelectionMultiple: Story = {
|
|
411
|
+
export const WithRowSelectionMultiple: Story = {
|
|
259
412
|
render: args => {
|
|
260
413
|
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
261
414
|
|
|
@@ -263,14 +416,20 @@ export const RowSelectionMultiple: Story = {
|
|
|
263
416
|
<div>
|
|
264
417
|
<DataTable
|
|
265
418
|
{...args}
|
|
419
|
+
data={args.data || users}
|
|
420
|
+
columns={args.columns || columns}
|
|
266
421
|
selectionMode="multiple"
|
|
267
422
|
onSelectionChange={(rows, ids) => setSelectedRows(rows)}
|
|
268
423
|
/>
|
|
269
424
|
{selectedRows.length > 0 && (
|
|
270
|
-
<div
|
|
425
|
+
<div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
|
|
271
426
|
<strong>Selected: {selectedRows.length} row(s)</strong>
|
|
272
|
-
<pre
|
|
273
|
-
{JSON.stringify(
|
|
427
|
+
<pre className="u-mt-2 u-text-xs">
|
|
428
|
+
{JSON.stringify(
|
|
429
|
+
selectedRows.map(r => r.name),
|
|
430
|
+
null,
|
|
431
|
+
2
|
|
432
|
+
)}
|
|
274
433
|
</pre>
|
|
275
434
|
</div>
|
|
276
435
|
)}
|
|
@@ -291,24 +450,30 @@ export const RowSelectionMultiple: Story = {
|
|
|
291
450
|
},
|
|
292
451
|
};
|
|
293
452
|
|
|
294
|
-
//
|
|
295
|
-
|
|
453
|
+
// ========================================
|
|
454
|
+
// ADVANCED FEATURES STORIES
|
|
455
|
+
// ========================================
|
|
456
|
+
|
|
457
|
+
export const WithInteractiveRows: Story = {
|
|
296
458
|
render: args => {
|
|
297
|
-
const [
|
|
459
|
+
const [selectedUser, setSelectedUser] = useState<any>(null);
|
|
460
|
+
|
|
461
|
+
const handleRowClick = (row: any) => {
|
|
462
|
+
setSelectedUser(row);
|
|
463
|
+
};
|
|
298
464
|
|
|
299
465
|
return (
|
|
300
466
|
<div>
|
|
301
467
|
<DataTable
|
|
302
468
|
{...args}
|
|
303
|
-
|
|
304
|
-
|
|
469
|
+
data={args.data || users}
|
|
470
|
+
columns={args.columns || columns}
|
|
471
|
+
onRowClick={handleRowClick}
|
|
305
472
|
/>
|
|
306
|
-
{
|
|
307
|
-
<div
|
|
308
|
-
<
|
|
309
|
-
<pre
|
|
310
|
-
{JSON.stringify(selectedRow, null, 2)}
|
|
311
|
-
</pre>
|
|
473
|
+
{selectedUser && (
|
|
474
|
+
<div className="u-mt-4 u-p-4 u-border u-border-gray-300 u-rounded u-bg-white">
|
|
475
|
+
<h3 className="u-m-0">Selected User:</h3>
|
|
476
|
+
<pre className="u-m-0">{JSON.stringify(selectedUser, null, 2)}</pre>
|
|
312
477
|
</div>
|
|
313
478
|
)}
|
|
314
479
|
</div>
|
|
@@ -319,37 +484,50 @@ export const RowSelectionSingle: Story = {
|
|
|
319
484
|
columns,
|
|
320
485
|
sortable: true,
|
|
321
486
|
},
|
|
487
|
+
};
|
|
488
|
+
|
|
489
|
+
// ========================================
|
|
490
|
+
// PAGINATION STORIES
|
|
491
|
+
// ========================================
|
|
492
|
+
|
|
493
|
+
export const WithPagination: Story = {
|
|
494
|
+
args: {
|
|
495
|
+
data: largeDataSet,
|
|
496
|
+
columns: columns,
|
|
497
|
+
paginated: true,
|
|
498
|
+
pageSize: 5,
|
|
499
|
+
},
|
|
322
500
|
parameters: {
|
|
323
501
|
docs: {
|
|
324
502
|
description: {
|
|
325
|
-
story: 'DataTable with
|
|
503
|
+
story: 'DataTable with pagination enabled to handle large datasets.',
|
|
326
504
|
},
|
|
327
505
|
},
|
|
328
506
|
},
|
|
329
507
|
};
|
|
330
508
|
|
|
331
|
-
|
|
332
|
-
export const ColumnFilters: Story = {
|
|
509
|
+
export const WithPaginationLargeDataset: Story = {
|
|
333
510
|
args: {
|
|
334
|
-
data:
|
|
335
|
-
columns
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
})),
|
|
339
|
-
columnFilters: true,
|
|
340
|
-
sortable: true,
|
|
511
|
+
data: largeDataSet,
|
|
512
|
+
columns,
|
|
513
|
+
paginated: true,
|
|
514
|
+
pageSize: 10,
|
|
341
515
|
},
|
|
342
516
|
parameters: {
|
|
343
517
|
docs: {
|
|
344
518
|
description: {
|
|
345
|
-
story:
|
|
519
|
+
story:
|
|
520
|
+
'Pagination with a large dataset (100 items) demonstrating first/last buttons and ellipsis.',
|
|
346
521
|
},
|
|
347
522
|
},
|
|
348
523
|
},
|
|
349
524
|
};
|
|
350
525
|
|
|
351
|
-
//
|
|
352
|
-
|
|
526
|
+
// ========================================
|
|
527
|
+
// COLUMN CONFIGURATION STORIES
|
|
528
|
+
// ========================================
|
|
529
|
+
|
|
530
|
+
export const WithResizableColumns: Story = {
|
|
353
531
|
args: {
|
|
354
532
|
data: users,
|
|
355
533
|
columns: columns.map(col => ({
|
|
@@ -369,8 +547,7 @@ export const ResizableColumns: Story = {
|
|
|
369
547
|
},
|
|
370
548
|
};
|
|
371
549
|
|
|
372
|
-
|
|
373
|
-
export const ReorderableColumns: Story = {
|
|
550
|
+
export const WithReorderableColumns: Story = {
|
|
374
551
|
args: {
|
|
375
552
|
data: users,
|
|
376
553
|
columns,
|
|
@@ -386,8 +563,7 @@ export const ReorderableColumns: Story = {
|
|
|
386
563
|
},
|
|
387
564
|
};
|
|
388
565
|
|
|
389
|
-
|
|
390
|
-
export const ColumnVisibility: Story = {
|
|
566
|
+
export const WithColumnVisibilityToggle: Story = {
|
|
391
567
|
args: {
|
|
392
568
|
data: users,
|
|
393
569
|
columns,
|
|
@@ -397,14 +573,18 @@ export const ColumnVisibility: Story = {
|
|
|
397
573
|
parameters: {
|
|
398
574
|
docs: {
|
|
399
575
|
description: {
|
|
400
|
-
story:
|
|
576
|
+
story:
|
|
577
|
+
'DataTable with column visibility toggle. Use the Columns button to show/hide columns.',
|
|
401
578
|
},
|
|
402
579
|
},
|
|
403
580
|
},
|
|
404
581
|
};
|
|
405
582
|
|
|
406
|
-
//
|
|
407
|
-
|
|
583
|
+
// ========================================
|
|
584
|
+
// EXPORT & CUSTOMIZATION STORIES
|
|
585
|
+
// ========================================
|
|
586
|
+
|
|
587
|
+
export const WithExportFunctionality: Story = {
|
|
408
588
|
args: {
|
|
409
589
|
data: users,
|
|
410
590
|
columns,
|
|
@@ -422,8 +602,7 @@ export const Exportable: Story = {
|
|
|
422
602
|
},
|
|
423
603
|
};
|
|
424
604
|
|
|
425
|
-
|
|
426
|
-
export const StickyHeaders: Story = {
|
|
605
|
+
export const WithStickyHeaders: Story = {
|
|
427
606
|
args: {
|
|
428
607
|
data: largeDataSet,
|
|
429
608
|
columns,
|
|
@@ -442,7 +621,30 @@ export const StickyHeaders: Story = {
|
|
|
442
621
|
},
|
|
443
622
|
};
|
|
444
623
|
|
|
445
|
-
//
|
|
624
|
+
// ========================================
|
|
625
|
+
// COMPREHENSIVE EXAMPLES
|
|
626
|
+
// ========================================
|
|
627
|
+
|
|
628
|
+
export const CompleteFeatures: Story = {
|
|
629
|
+
args: {
|
|
630
|
+
data: largeDataSet,
|
|
631
|
+
columns,
|
|
632
|
+
sortable: true,
|
|
633
|
+
filterable: true,
|
|
634
|
+
paginated: true,
|
|
635
|
+
pageSize: 10,
|
|
636
|
+
striped: true,
|
|
637
|
+
bordered: true,
|
|
638
|
+
},
|
|
639
|
+
parameters: {
|
|
640
|
+
docs: {
|
|
641
|
+
description: {
|
|
642
|
+
story: 'A complete data table with sorting, filtering, and pagination enabled.',
|
|
643
|
+
},
|
|
644
|
+
},
|
|
645
|
+
},
|
|
646
|
+
};
|
|
647
|
+
|
|
446
648
|
export const AllAdvancedFeatures: Story = {
|
|
447
649
|
render: args => {
|
|
448
650
|
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
@@ -451,11 +653,13 @@ export const AllAdvancedFeatures: Story = {
|
|
|
451
653
|
<div>
|
|
452
654
|
<DataTable
|
|
453
655
|
{...args}
|
|
656
|
+
data={args.data || largeDataSet}
|
|
657
|
+
columns={args.columns || columns}
|
|
454
658
|
selectionMode="multiple"
|
|
455
|
-
onSelectionChange={
|
|
659
|
+
onSelectionChange={rows => setSelectedRows(rows)}
|
|
456
660
|
/>
|
|
457
661
|
{selectedRows.length > 0 && (
|
|
458
|
-
<div
|
|
662
|
+
<div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded">
|
|
459
663
|
<strong>Selected: {selectedRows.length} row(s)</strong>
|
|
460
664
|
</div>
|
|
461
665
|
)}
|
|
@@ -486,7 +690,8 @@ export const AllAdvancedFeatures: Story = {
|
|
|
486
690
|
parameters: {
|
|
487
691
|
docs: {
|
|
488
692
|
description: {
|
|
489
|
-
story:
|
|
693
|
+
story:
|
|
694
|
+
'DataTable with all advanced features enabled: selection, filtering, resizing, reordering, visibility toggle, export, and sticky headers.',
|
|
490
695
|
},
|
|
491
696
|
},
|
|
492
697
|
},
|