@shohojdhara/atomix 0.3.15 → 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/build-tools/index.d.ts +31 -30
- package/build-tools/package.json +4 -21
- package/dist/atomix.css +20924 -2611
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +76 -2
- package/dist/atomix.min.css.map +1 -1
- package/dist/build-tools/index.d.ts +31 -30
- package/dist/build-tools/package.json +4 -21
- package/dist/charts.js.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +144 -18
- package/dist/index.esm.js +110 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +110 -55
- 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 +1 -1
- package/src/components/Accordion/Accordion.stories.tsx +32 -23
- 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/GlassFilter.tsx +9 -16
- package/src/components/AtomixGlass/glass-utils.ts +4 -3
- package/src/components/AtomixGlass/shader-utils.ts +128 -52
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +1 -1
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +45 -62
- package/src/components/Avatar/Avatar.tsx +58 -56
- package/src/components/Badge/Badge.stories.tsx +20 -9
- package/src/components/Badge/Badge.test.tsx +41 -41
- package/src/components/Badge/Badge.tsx +64 -62
- package/src/components/Block/Block.stories.tsx +14 -4
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +9 -8
- package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
- package/src/components/Button/Button.stories.tsx +13 -22
- package/src/components/Button/Button.test.tsx +97 -81
- package/src/components/Button/Button.tsx +46 -14
- package/src/components/Button/ButtonGroup.stories.tsx +37 -32
- package/src/components/Button/ButtonGroup.tsx +4 -15
- package/src/components/Callout/Callout.stories.tsx +109 -16
- package/src/components/Card/Card.stories.tsx +67 -36
- 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 +4 -9
- 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 +6 -2
- package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
- package/src/components/Countdown/Countdown.stories.tsx +7 -7
- package/src/components/DataTable/DataTable.stories.tsx +43 -38
- package/src/components/DataTable/DataTable.test.tsx +26 -148
- package/src/components/DataTable/DataTable.tsx +485 -456
- package/src/components/DatePicker/DatePicker.stories.tsx +32 -47
- package/src/components/DatePicker/DatePicker.tsx +31 -26
- package/src/components/Dropdown/Dropdown.stories.tsx +2 -5
- package/src/components/Dropdown/Dropdown.tsx +313 -299
- package/src/components/EdgePanel/EdgePanel.stories.tsx +6 -19
- package/src/components/EdgePanel/EdgePanel.tsx +1 -3
- package/src/components/Footer/Footer.stories.tsx +21 -16
- package/src/components/Footer/Footer.tsx +130 -128
- package/src/components/Footer/FooterLink.tsx +2 -2
- package/src/components/Form/Checkbox.test.tsx +49 -49
- package/src/components/Form/Checkbox.tsx +108 -100
- package/src/components/Form/Form.stories.tsx +2 -10
- 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 +6 -12
- package/src/components/Form/Radio.tsx +68 -66
- package/src/components/Form/Select.tsx +184 -182
- package/src/components/Form/Textarea.test.tsx +27 -32
- package/src/components/Hero/Hero.stories.tsx +56 -23
- package/src/components/Hero/Hero.tsx +201 -55
- package/src/components/Icon/index.ts +7 -1
- package/src/components/List/List.tsx +19 -23
- package/src/components/Modal/Modal.stories.tsx +2 -1
- 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 +99 -192
- package/src/components/Popover/Popover.tsx +41 -37
- package/src/components/Progress/Progress.stories.tsx +35 -44
- package/src/components/River/River.stories.tsx +2 -1
- package/src/components/SectionIntro/SectionIntro.stories.tsx +71 -71
- package/src/components/Slider/Slider.stories.tsx +12 -4
- package/src/components/Spinner/Spinner.stories.tsx +3 -1
- package/src/components/Spinner/Spinner.test.tsx +23 -23
- package/src/components/Spinner/Spinner.tsx +43 -46
- package/src/components/Steps/Steps.stories.tsx +8 -6
- package/src/components/Tabs/Tabs.stories.tsx +12 -9
- package/src/components/Tabs/Tabs.tsx +74 -72
- package/src/components/Toggle/Toggle.stories.tsx +27 -13
- package/src/components/Toggle/Toggle.test.tsx +65 -70
- package/src/components/Toggle/Toggle.tsx +4 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +24 -20
- package/src/components/Tooltip/Tooltip.tsx +104 -106
- package/src/components/Upload/Upload.stories.tsx +129 -127
- 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/__tests__/theme-tools.test.ts +32 -6
- package/src/lib/composables/shared-mouse-tracker.ts +13 -14
- package/src/lib/composables/useAtomixGlass.ts +106 -49
- package/src/lib/composables/useChartExport.ts +1 -1
- package/src/lib/composables/useDataTable.ts +29 -17
- 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/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 +106 -104
- 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 +1 -1
- package/src/lib/utils/componentUtils.ts +8 -12
- package/src/lib/utils/csv.ts +3 -1
- package/src/lib/utils/dataTableExport.ts +1 -5
- 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 +0 -1
- package/src/styles/01-settings/_settings.colors.scss +8 -8
- 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 +1 -1
- package/src/styles/02-tools/_tools.button.scss +51 -21
- package/src/styles/02-tools/_tools.utility-api.scss +30 -18
- package/src/styles/03-generic/_generic.root.scss +4 -3
- 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 +3 -1
- 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/_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 +1 -1
- 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 +30 -30
- package/src/styles/99-utilities/_utilities.text.scss +67 -46
|
@@ -157,13 +157,25 @@ export const ColorModeToggle: React.FC<ColorModeToggleProps> = ({
|
|
|
157
157
|
const title = showTooltip ? `Switch to ${nextMode} mode` : undefined;
|
|
158
158
|
|
|
159
159
|
const defaultLightIcon = (
|
|
160
|
-
<svg
|
|
160
|
+
<svg
|
|
161
|
+
viewBox="0 0 24 24"
|
|
162
|
+
width={iconSize}
|
|
163
|
+
height={iconSize}
|
|
164
|
+
fill="currentColor"
|
|
165
|
+
aria-hidden="true"
|
|
166
|
+
>
|
|
161
167
|
<path d="M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49zM12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z" />
|
|
162
168
|
</svg>
|
|
163
169
|
);
|
|
164
170
|
|
|
165
171
|
const defaultDarkIcon = (
|
|
166
|
-
<svg
|
|
172
|
+
<svg
|
|
173
|
+
viewBox="0 0 24 24"
|
|
174
|
+
width={iconSize}
|
|
175
|
+
height={iconSize}
|
|
176
|
+
fill="currentColor"
|
|
177
|
+
aria-hidden="true"
|
|
178
|
+
>
|
|
167
179
|
<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41.39.39 1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41.39.39 1.03.39 1.41 0l1.06-1.06z" />
|
|
168
180
|
</svg>
|
|
169
181
|
);
|
|
@@ -179,7 +191,7 @@ export const ColorModeToggle: React.FC<ColorModeToggleProps> = ({
|
|
|
179
191
|
title={title}
|
|
180
192
|
style={style}
|
|
181
193
|
>
|
|
182
|
-
{colorMode === 'light' ?
|
|
194
|
+
{colorMode === 'light' ? lightIcon || defaultLightIcon : darkIcon || defaultDarkIcon}
|
|
183
195
|
</button>
|
|
184
196
|
);
|
|
185
197
|
};
|
|
@@ -66,8 +66,8 @@ The Countdown component displays a countdown timer to a specified target date. I
|
|
|
66
66
|
},
|
|
67
67
|
tags: ['autodocs'],
|
|
68
68
|
argTypes: {
|
|
69
|
-
target: {
|
|
70
|
-
control: 'date',
|
|
69
|
+
target: {
|
|
70
|
+
control: 'date',
|
|
71
71
|
description: 'Target date/time for the countdown',
|
|
72
72
|
table: {
|
|
73
73
|
type: { summary: 'Date | number | string' },
|
|
@@ -82,16 +82,16 @@ The Countdown component displays a countdown timer to a specified target date. I
|
|
|
82
82
|
defaultValue: { summary: "['days', 'hours', 'minutes', 'seconds']" },
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
|
-
separator: {
|
|
86
|
-
control: 'text',
|
|
85
|
+
separator: {
|
|
86
|
+
control: 'text',
|
|
87
87
|
description: 'Separator string',
|
|
88
88
|
table: {
|
|
89
89
|
type: { summary: 'string' },
|
|
90
90
|
defaultValue: { summary: ':' },
|
|
91
91
|
},
|
|
92
92
|
},
|
|
93
|
-
focused: {
|
|
94
|
-
control: 'boolean',
|
|
93
|
+
focused: {
|
|
94
|
+
control: 'boolean',
|
|
95
95
|
description: 'Focused style',
|
|
96
96
|
table: {
|
|
97
97
|
type: { summary: 'boolean' },
|
|
@@ -150,4 +150,4 @@ export const CustomSeparator: Story = {
|
|
|
150
150
|
},
|
|
151
151
|
},
|
|
152
152
|
},
|
|
153
|
-
};
|
|
153
|
+
};
|
|
@@ -83,88 +83,88 @@ DataTable provides a powerful and flexible way to display structured data in row
|
|
|
83
83
|
},
|
|
84
84
|
tags: ['autodocs'],
|
|
85
85
|
argTypes: {
|
|
86
|
-
data: {
|
|
87
|
-
control: 'object',
|
|
86
|
+
data: {
|
|
87
|
+
control: 'object',
|
|
88
88
|
description: 'Array of data objects to display',
|
|
89
89
|
table: {
|
|
90
90
|
type: { summary: 'T[]' },
|
|
91
91
|
defaultValue: { summary: '[]' },
|
|
92
92
|
},
|
|
93
93
|
},
|
|
94
|
-
columns: {
|
|
95
|
-
control: 'object',
|
|
94
|
+
columns: {
|
|
95
|
+
control: 'object',
|
|
96
96
|
description: 'Column definitions for the table',
|
|
97
97
|
table: {
|
|
98
98
|
type: { summary: 'DataTableColumn[]' },
|
|
99
99
|
defaultValue: { summary: '[]' },
|
|
100
100
|
},
|
|
101
101
|
},
|
|
102
|
-
sortable: {
|
|
103
|
-
control: 'boolean',
|
|
102
|
+
sortable: {
|
|
103
|
+
control: 'boolean',
|
|
104
104
|
description: 'Whether columns are sortable',
|
|
105
105
|
table: {
|
|
106
106
|
type: { summary: 'boolean' },
|
|
107
107
|
defaultValue: { summary: 'false' },
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
|
-
filterable: {
|
|
111
|
-
control: 'boolean',
|
|
110
|
+
filterable: {
|
|
111
|
+
control: 'boolean',
|
|
112
112
|
description: 'Whether the table is filterable',
|
|
113
113
|
table: {
|
|
114
114
|
type: { summary: 'boolean' },
|
|
115
115
|
defaultValue: { summary: 'false' },
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
|
-
paginated: {
|
|
119
|
-
control: 'boolean',
|
|
118
|
+
paginated: {
|
|
119
|
+
control: 'boolean',
|
|
120
120
|
description: 'Whether to enable pagination',
|
|
121
121
|
table: {
|
|
122
122
|
type: { summary: 'boolean' },
|
|
123
123
|
defaultValue: { summary: 'false' },
|
|
124
124
|
},
|
|
125
125
|
},
|
|
126
|
-
pageSize: {
|
|
127
|
-
control: 'number',
|
|
126
|
+
pageSize: {
|
|
127
|
+
control: 'number',
|
|
128
128
|
description: 'Number of rows per page',
|
|
129
129
|
table: {
|
|
130
130
|
type: { summary: 'number' },
|
|
131
131
|
defaultValue: { summary: '10' },
|
|
132
132
|
},
|
|
133
133
|
},
|
|
134
|
-
striped: {
|
|
135
|
-
control: 'boolean',
|
|
134
|
+
striped: {
|
|
135
|
+
control: 'boolean',
|
|
136
136
|
description: 'Whether to apply striped row styling',
|
|
137
137
|
table: {
|
|
138
138
|
type: { summary: 'boolean' },
|
|
139
139
|
defaultValue: { summary: 'false' },
|
|
140
140
|
},
|
|
141
141
|
},
|
|
142
|
-
bordered: {
|
|
143
|
-
control: 'boolean',
|
|
142
|
+
bordered: {
|
|
143
|
+
control: 'boolean',
|
|
144
144
|
description: 'Whether to show table borders',
|
|
145
145
|
table: {
|
|
146
146
|
type: { summary: 'boolean' },
|
|
147
147
|
defaultValue: { summary: 'false' },
|
|
148
148
|
},
|
|
149
149
|
},
|
|
150
|
-
dense: {
|
|
151
|
-
control: 'boolean',
|
|
150
|
+
dense: {
|
|
151
|
+
control: 'boolean',
|
|
152
152
|
description: 'Whether to use dense row spacing',
|
|
153
153
|
table: {
|
|
154
154
|
type: { summary: 'boolean' },
|
|
155
155
|
defaultValue: { summary: 'false' },
|
|
156
156
|
},
|
|
157
157
|
},
|
|
158
|
-
loading: {
|
|
159
|
-
control: 'boolean',
|
|
158
|
+
loading: {
|
|
159
|
+
control: 'boolean',
|
|
160
160
|
description: 'Whether the table is in loading state',
|
|
161
161
|
table: {
|
|
162
162
|
type: { summary: 'boolean' },
|
|
163
163
|
defaultValue: { summary: 'false' },
|
|
164
164
|
},
|
|
165
165
|
},
|
|
166
|
-
emptyMessage: {
|
|
167
|
-
control: 'text',
|
|
166
|
+
emptyMessage: {
|
|
167
|
+
control: 'text',
|
|
168
168
|
description: 'Message to display when table is empty',
|
|
169
169
|
table: {
|
|
170
170
|
type: { summary: 'string' },
|
|
@@ -361,7 +361,8 @@ export const WithColumnFilters: Story = {
|
|
|
361
361
|
parameters: {
|
|
362
362
|
docs: {
|
|
363
363
|
description: {
|
|
364
|
-
story:
|
|
364
|
+
story:
|
|
365
|
+
'DataTable with column-specific filters. Each filterable column has its own filter input.',
|
|
365
366
|
},
|
|
366
367
|
},
|
|
367
368
|
},
|
|
@@ -372,7 +373,7 @@ export const WithColumnFilters: Story = {
|
|
|
372
373
|
// ========================================
|
|
373
374
|
|
|
374
375
|
export const WithRowSelectionSingle: Story = {
|
|
375
|
-
render:
|
|
376
|
+
render: args => {
|
|
376
377
|
const [selectedRow, setSelectedRow] = useState<any>(null);
|
|
377
378
|
|
|
378
379
|
return (
|
|
@@ -382,14 +383,12 @@ export const WithRowSelectionSingle: Story = {
|
|
|
382
383
|
data={args.data || users}
|
|
383
384
|
columns={args.columns || columns}
|
|
384
385
|
selectionMode="single"
|
|
385
|
-
onSelectionChange={
|
|
386
|
+
onSelectionChange={rows => setSelectedRow(rows[0] || null)}
|
|
386
387
|
/>
|
|
387
388
|
{selectedRow && (
|
|
388
389
|
<div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
|
|
389
390
|
<strong>Selected:</strong>
|
|
390
|
-
<pre className="u-mt-2 u-text-xs">
|
|
391
|
-
{JSON.stringify(selectedRow, null, 2)}
|
|
392
|
-
</pre>
|
|
391
|
+
<pre className="u-mt-2 u-text-xs">{JSON.stringify(selectedRow, null, 2)}</pre>
|
|
393
392
|
</div>
|
|
394
393
|
)}
|
|
395
394
|
</div>
|
|
@@ -410,7 +409,7 @@ export const WithRowSelectionSingle: Story = {
|
|
|
410
409
|
};
|
|
411
410
|
|
|
412
411
|
export const WithRowSelectionMultiple: Story = {
|
|
413
|
-
render:
|
|
412
|
+
render: args => {
|
|
414
413
|
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
415
414
|
|
|
416
415
|
return (
|
|
@@ -426,7 +425,11 @@ export const WithRowSelectionMultiple: Story = {
|
|
|
426
425
|
<div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
|
|
427
426
|
<strong>Selected: {selectedRows.length} row(s)</strong>
|
|
428
427
|
<pre className="u-mt-2 u-text-xs">
|
|
429
|
-
{JSON.stringify(
|
|
428
|
+
{JSON.stringify(
|
|
429
|
+
selectedRows.map(r => r.name),
|
|
430
|
+
null,
|
|
431
|
+
2
|
|
432
|
+
)}
|
|
430
433
|
</pre>
|
|
431
434
|
</div>
|
|
432
435
|
)}
|
|
@@ -452,7 +455,7 @@ export const WithRowSelectionMultiple: Story = {
|
|
|
452
455
|
// ========================================
|
|
453
456
|
|
|
454
457
|
export const WithInteractiveRows: Story = {
|
|
455
|
-
render:
|
|
458
|
+
render: args => {
|
|
456
459
|
const [selectedUser, setSelectedUser] = useState<any>(null);
|
|
457
460
|
|
|
458
461
|
const handleRowClick = (row: any) => {
|
|
@@ -461,11 +464,11 @@ export const WithInteractiveRows: Story = {
|
|
|
461
464
|
|
|
462
465
|
return (
|
|
463
466
|
<div>
|
|
464
|
-
<DataTable
|
|
465
|
-
{...args}
|
|
467
|
+
<DataTable
|
|
468
|
+
{...args}
|
|
466
469
|
data={args.data || users}
|
|
467
470
|
columns={args.columns || columns}
|
|
468
|
-
onRowClick={handleRowClick}
|
|
471
|
+
onRowClick={handleRowClick}
|
|
469
472
|
/>
|
|
470
473
|
{selectedUser && (
|
|
471
474
|
<div className="u-mt-4 u-p-4 u-border u-border-gray-300 u-rounded u-bg-white">
|
|
@@ -570,7 +573,8 @@ export const WithColumnVisibilityToggle: Story = {
|
|
|
570
573
|
parameters: {
|
|
571
574
|
docs: {
|
|
572
575
|
description: {
|
|
573
|
-
story:
|
|
576
|
+
story:
|
|
577
|
+
'DataTable with column visibility toggle. Use the Columns button to show/hide columns.',
|
|
574
578
|
},
|
|
575
579
|
},
|
|
576
580
|
},
|
|
@@ -642,7 +646,7 @@ export const CompleteFeatures: Story = {
|
|
|
642
646
|
};
|
|
643
647
|
|
|
644
648
|
export const AllAdvancedFeatures: Story = {
|
|
645
|
-
render:
|
|
649
|
+
render: args => {
|
|
646
650
|
const [selectedRows, setSelectedRows] = useState<any[]>([]);
|
|
647
651
|
|
|
648
652
|
return (
|
|
@@ -652,7 +656,7 @@ export const AllAdvancedFeatures: Story = {
|
|
|
652
656
|
data={args.data || largeDataSet}
|
|
653
657
|
columns={args.columns || columns}
|
|
654
658
|
selectionMode="multiple"
|
|
655
|
-
onSelectionChange={
|
|
659
|
+
onSelectionChange={rows => setSelectedRows(rows)}
|
|
656
660
|
/>
|
|
657
661
|
{selectedRows.length > 0 && (
|
|
658
662
|
<div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded">
|
|
@@ -686,7 +690,8 @@ export const AllAdvancedFeatures: Story = {
|
|
|
686
690
|
parameters: {
|
|
687
691
|
docs: {
|
|
688
692
|
description: {
|
|
689
|
-
story:
|
|
693
|
+
story:
|
|
694
|
+
'DataTable with all advanced features enabled: selection, filtering, resizing, reordering, visibility toggle, export, and sticky headers.',
|
|
690
695
|
},
|
|
691
696
|
},
|
|
692
697
|
},
|
|
@@ -20,7 +20,9 @@ vi.mock('../Pagination/Pagination', () => ({
|
|
|
20
20
|
Pagination: ({ currentPage, totalPages, onPageChange }: any) => (
|
|
21
21
|
<div data-testid="pagination">
|
|
22
22
|
<button onClick={() => onPageChange(currentPage - 1)}>Prev</button>
|
|
23
|
-
<span>
|
|
23
|
+
<span>
|
|
24
|
+
{currentPage} / {totalPages}
|
|
25
|
+
</span>
|
|
24
26
|
<button onClick={() => onPageChange(currentPage + 1)}>Next</button>
|
|
25
27
|
</div>
|
|
26
28
|
),
|
|
@@ -100,25 +102,13 @@ describe('DataTable Component', () => {
|
|
|
100
102
|
});
|
|
101
103
|
|
|
102
104
|
it('displays empty message when no data', () => {
|
|
103
|
-
render(
|
|
104
|
-
<DataTable
|
|
105
|
-
data={[]}
|
|
106
|
-
columns={sampleColumns}
|
|
107
|
-
emptyMessage="No records found"
|
|
108
|
-
/>
|
|
109
|
-
);
|
|
105
|
+
render(<DataTable data={[]} columns={sampleColumns} emptyMessage="No records found" />);
|
|
110
106
|
|
|
111
107
|
expect(screen.getByText('No records found')).toBeInTheDocument();
|
|
112
108
|
});
|
|
113
109
|
|
|
114
110
|
it('displays loading state', () => {
|
|
115
|
-
render(
|
|
116
|
-
<DataTable
|
|
117
|
-
data={sampleData}
|
|
118
|
-
columns={sampleColumns}
|
|
119
|
-
loading={true}
|
|
120
|
-
/>
|
|
121
|
-
);
|
|
111
|
+
render(<DataTable data={sampleData} columns={sampleColumns} loading={true} />);
|
|
122
112
|
|
|
123
113
|
expect(screen.getByTestId('spinner')).toBeInTheDocument();
|
|
124
114
|
});
|
|
@@ -126,13 +116,7 @@ describe('DataTable Component', () => {
|
|
|
126
116
|
|
|
127
117
|
describe('Sorting', () => {
|
|
128
118
|
it('renders sortable columns when sortable is enabled', () => {
|
|
129
|
-
render(
|
|
130
|
-
<DataTable
|
|
131
|
-
data={sampleData}
|
|
132
|
-
columns={sampleColumns}
|
|
133
|
-
sortable={true}
|
|
134
|
-
/>
|
|
135
|
-
);
|
|
119
|
+
render(<DataTable data={sampleData} columns={sampleColumns} sortable={true} />);
|
|
136
120
|
|
|
137
121
|
const nameHeader = screen.getByText('Name').closest('th');
|
|
138
122
|
expect(nameHeader).toHaveClass('c-data-table__header-cell--sortable');
|
|
@@ -141,12 +125,7 @@ describe('DataTable Component', () => {
|
|
|
141
125
|
it('calls onSort when column header is clicked', () => {
|
|
142
126
|
const handleSort = vi.fn();
|
|
143
127
|
render(
|
|
144
|
-
<DataTable
|
|
145
|
-
data={sampleData}
|
|
146
|
-
columns={sampleColumns}
|
|
147
|
-
sortable={true}
|
|
148
|
-
onSort={handleSort}
|
|
149
|
-
/>
|
|
128
|
+
<DataTable data={sampleData} columns={sampleColumns} sortable={true} onSort={handleSort} />
|
|
150
129
|
);
|
|
151
130
|
|
|
152
131
|
const nameHeader = screen.getByText('Name').closest('th');
|
|
@@ -163,26 +142,14 @@ describe('DataTable Component', () => {
|
|
|
163
142
|
|
|
164
143
|
describe('Filtering', () => {
|
|
165
144
|
it('renders search input when filterable is enabled', () => {
|
|
166
|
-
render(
|
|
167
|
-
<DataTable
|
|
168
|
-
data={sampleData}
|
|
169
|
-
columns={sampleColumns}
|
|
170
|
-
filterable={true}
|
|
171
|
-
/>
|
|
172
|
-
);
|
|
145
|
+
render(<DataTable data={sampleData} columns={sampleColumns} filterable={true} />);
|
|
173
146
|
|
|
174
147
|
const searchInput = screen.getByPlaceholderText('Search...');
|
|
175
148
|
expect(searchInput).toBeInTheDocument();
|
|
176
149
|
});
|
|
177
150
|
|
|
178
151
|
it('filters data when search query is entered', async () => {
|
|
179
|
-
render(
|
|
180
|
-
<DataTable
|
|
181
|
-
data={sampleData}
|
|
182
|
-
columns={sampleColumns}
|
|
183
|
-
filterable={true}
|
|
184
|
-
/>
|
|
185
|
-
);
|
|
152
|
+
render(<DataTable data={sampleData} columns={sampleColumns} filterable={true} />);
|
|
186
153
|
|
|
187
154
|
const searchInput = screen.getByPlaceholderText('Search...');
|
|
188
155
|
fireEvent.change(searchInput, { target: { value: 'John' } });
|
|
@@ -194,13 +161,7 @@ describe('DataTable Component', () => {
|
|
|
194
161
|
});
|
|
195
162
|
|
|
196
163
|
it('renders column filters when columnFilters is enabled', () => {
|
|
197
|
-
render(
|
|
198
|
-
<DataTable
|
|
199
|
-
data={sampleData}
|
|
200
|
-
columns={sampleColumns}
|
|
201
|
-
columnFilters={true}
|
|
202
|
-
/>
|
|
203
|
-
);
|
|
164
|
+
render(<DataTable data={sampleData} columns={sampleColumns} columnFilters={true} />);
|
|
204
165
|
|
|
205
166
|
const columnFilters = screen.getAllByPlaceholderText('Filter...');
|
|
206
167
|
expect(columnFilters.length).toBeGreaterThan(0);
|
|
@@ -209,26 +170,13 @@ describe('DataTable Component', () => {
|
|
|
209
170
|
|
|
210
171
|
describe('Pagination', () => {
|
|
211
172
|
it('renders pagination when paginated is enabled', () => {
|
|
212
|
-
render(
|
|
213
|
-
<DataTable
|
|
214
|
-
data={sampleData}
|
|
215
|
-
columns={sampleColumns}
|
|
216
|
-
paginated={true}
|
|
217
|
-
pageSize={2}
|
|
218
|
-
/>
|
|
219
|
-
);
|
|
173
|
+
render(<DataTable data={sampleData} columns={sampleColumns} paginated={true} pageSize={2} />);
|
|
220
174
|
|
|
221
175
|
expect(screen.getByTestId('pagination')).toBeInTheDocument();
|
|
222
176
|
});
|
|
223
177
|
|
|
224
178
|
it('does not render pagination when paginated is false', () => {
|
|
225
|
-
render(
|
|
226
|
-
<DataTable
|
|
227
|
-
data={sampleData}
|
|
228
|
-
columns={sampleColumns}
|
|
229
|
-
paginated={false}
|
|
230
|
-
/>
|
|
231
|
-
);
|
|
179
|
+
render(<DataTable data={sampleData} columns={sampleColumns} paginated={false} />);
|
|
232
180
|
|
|
233
181
|
expect(screen.queryByTestId('pagination')).not.toBeInTheDocument();
|
|
234
182
|
});
|
|
@@ -236,26 +184,14 @@ describe('DataTable Component', () => {
|
|
|
236
184
|
|
|
237
185
|
describe('Row Selection', () => {
|
|
238
186
|
it('renders selection checkboxes when selectionMode is multiple', () => {
|
|
239
|
-
render(
|
|
240
|
-
<DataTable
|
|
241
|
-
data={sampleData}
|
|
242
|
-
columns={sampleColumns}
|
|
243
|
-
selectionMode="multiple"
|
|
244
|
-
/>
|
|
245
|
-
);
|
|
187
|
+
render(<DataTable data={sampleData} columns={sampleColumns} selectionMode="multiple" />);
|
|
246
188
|
|
|
247
189
|
const checkboxes = screen.getAllByTestId('checkbox');
|
|
248
190
|
expect(checkboxes.length).toBeGreaterThan(0);
|
|
249
191
|
});
|
|
250
192
|
|
|
251
193
|
it('renders select all checkbox in header for multiple selection', () => {
|
|
252
|
-
render(
|
|
253
|
-
<DataTable
|
|
254
|
-
data={sampleData}
|
|
255
|
-
columns={sampleColumns}
|
|
256
|
-
selectionMode="multiple"
|
|
257
|
-
/>
|
|
258
|
-
);
|
|
194
|
+
render(<DataTable data={sampleData} columns={sampleColumns} selectionMode="multiple" />);
|
|
259
195
|
|
|
260
196
|
const checkboxes = screen.getAllByTestId('checkbox');
|
|
261
197
|
// Should have at least one checkbox (select all)
|
|
@@ -285,13 +221,7 @@ describe('DataTable Component', () => {
|
|
|
285
221
|
describe('Row Click', () => {
|
|
286
222
|
it('calls onRowClick when row is clicked', () => {
|
|
287
223
|
const handleRowClick = vi.fn();
|
|
288
|
-
render(
|
|
289
|
-
<DataTable
|
|
290
|
-
data={sampleData}
|
|
291
|
-
columns={sampleColumns}
|
|
292
|
-
onRowClick={handleRowClick}
|
|
293
|
-
/>
|
|
294
|
-
);
|
|
224
|
+
render(<DataTable data={sampleData} columns={sampleColumns} onRowClick={handleRowClick} />);
|
|
295
225
|
|
|
296
226
|
const row = screen.getByText('John Doe').closest('tr');
|
|
297
227
|
fireEvent.click(row!);
|
|
@@ -302,26 +232,14 @@ describe('DataTable Component', () => {
|
|
|
302
232
|
|
|
303
233
|
describe('Export Functionality', () => {
|
|
304
234
|
it('renders export dropdown when exportable is enabled', () => {
|
|
305
|
-
render(
|
|
306
|
-
<DataTable
|
|
307
|
-
data={sampleData}
|
|
308
|
-
columns={sampleColumns}
|
|
309
|
-
exportable={true}
|
|
310
|
-
/>
|
|
311
|
-
);
|
|
235
|
+
render(<DataTable data={sampleData} columns={sampleColumns} exportable={true} />);
|
|
312
236
|
|
|
313
237
|
const exportButton = screen.getByText('Export');
|
|
314
238
|
expect(exportButton).toBeInTheDocument();
|
|
315
239
|
});
|
|
316
240
|
|
|
317
241
|
it('does not render export when exportable is false', () => {
|
|
318
|
-
render(
|
|
319
|
-
<DataTable
|
|
320
|
-
data={sampleData}
|
|
321
|
-
columns={sampleColumns}
|
|
322
|
-
exportable={false}
|
|
323
|
-
/>
|
|
324
|
-
);
|
|
242
|
+
render(<DataTable data={sampleData} columns={sampleColumns} exportable={false} />);
|
|
325
243
|
|
|
326
244
|
expect(screen.queryByText('Export')).not.toBeInTheDocument();
|
|
327
245
|
});
|
|
@@ -329,13 +247,7 @@ describe('DataTable Component', () => {
|
|
|
329
247
|
|
|
330
248
|
describe('Column Visibility', () => {
|
|
331
249
|
it('renders column visibility dropdown when showColumnVisibility is enabled', () => {
|
|
332
|
-
render(
|
|
333
|
-
<DataTable
|
|
334
|
-
data={sampleData}
|
|
335
|
-
columns={sampleColumns}
|
|
336
|
-
showColumnVisibility={true}
|
|
337
|
-
/>
|
|
338
|
-
);
|
|
250
|
+
render(<DataTable data={sampleData} columns={sampleColumns} showColumnVisibility={true} />);
|
|
339
251
|
|
|
340
252
|
const columnsButton = screen.getByText('Columns');
|
|
341
253
|
expect(columnsButton).toBeInTheDocument();
|
|
@@ -345,11 +257,7 @@ describe('DataTable Component', () => {
|
|
|
345
257
|
describe('Styling Variants', () => {
|
|
346
258
|
it('applies striped class when striped is enabled', () => {
|
|
347
259
|
const { container } = render(
|
|
348
|
-
<DataTable
|
|
349
|
-
data={sampleData}
|
|
350
|
-
columns={sampleColumns}
|
|
351
|
-
striped={true}
|
|
352
|
-
/>
|
|
260
|
+
<DataTable data={sampleData} columns={sampleColumns} striped={true} />
|
|
353
261
|
);
|
|
354
262
|
|
|
355
263
|
const table = container.querySelector('.c-data-table');
|
|
@@ -358,11 +266,7 @@ describe('DataTable Component', () => {
|
|
|
358
266
|
|
|
359
267
|
it('applies bordered class when bordered is enabled', () => {
|
|
360
268
|
const { container } = render(
|
|
361
|
-
<DataTable
|
|
362
|
-
data={sampleData}
|
|
363
|
-
columns={sampleColumns}
|
|
364
|
-
bordered={true}
|
|
365
|
-
/>
|
|
269
|
+
<DataTable data={sampleData} columns={sampleColumns} bordered={true} />
|
|
366
270
|
);
|
|
367
271
|
|
|
368
272
|
const table = container.querySelector('.c-data-table');
|
|
@@ -371,11 +275,7 @@ describe('DataTable Component', () => {
|
|
|
371
275
|
|
|
372
276
|
it('applies dense class when dense is enabled', () => {
|
|
373
277
|
const { container } = render(
|
|
374
|
-
<DataTable
|
|
375
|
-
data={sampleData}
|
|
376
|
-
columns={sampleColumns}
|
|
377
|
-
dense={true}
|
|
378
|
-
/>
|
|
278
|
+
<DataTable data={sampleData} columns={sampleColumns} dense={true} />
|
|
379
279
|
);
|
|
380
280
|
|
|
381
281
|
const table = container.querySelector('.c-data-table');
|
|
@@ -384,11 +284,7 @@ describe('DataTable Component', () => {
|
|
|
384
284
|
|
|
385
285
|
it('applies sticky header class when stickyHeader is enabled', () => {
|
|
386
286
|
const { container } = render(
|
|
387
|
-
<DataTable
|
|
388
|
-
data={sampleData}
|
|
389
|
-
columns={sampleColumns}
|
|
390
|
-
stickyHeader={true}
|
|
391
|
-
/>
|
|
287
|
+
<DataTable data={sampleData} columns={sampleColumns} stickyHeader={true} />
|
|
392
288
|
);
|
|
393
289
|
|
|
394
290
|
const table = container.querySelector('.c-data-table');
|
|
@@ -402,16 +298,11 @@ describe('DataTable Component', () => {
|
|
|
402
298
|
{
|
|
403
299
|
key: 'name',
|
|
404
300
|
title: 'Name',
|
|
405
|
-
render:
|
|
301
|
+
render: value => <strong>{value}</strong>,
|
|
406
302
|
},
|
|
407
303
|
];
|
|
408
304
|
|
|
409
|
-
render(
|
|
410
|
-
<DataTable
|
|
411
|
-
data={[{ name: 'John Doe' }]}
|
|
412
|
-
columns={columnsWithRender}
|
|
413
|
-
/>
|
|
414
|
-
);
|
|
305
|
+
render(<DataTable data={[{ name: 'John Doe' }]} columns={columnsWithRender} />);
|
|
415
306
|
|
|
416
307
|
const strongElement = screen.getByText('John Doe').closest('strong');
|
|
417
308
|
expect(strongElement).toBeInTheDocument();
|
|
@@ -420,13 +311,7 @@ describe('DataTable Component', () => {
|
|
|
420
311
|
|
|
421
312
|
describe('Accessibility', () => {
|
|
422
313
|
it('applies correct ARIA attributes for sortable columns', () => {
|
|
423
|
-
render(
|
|
424
|
-
<DataTable
|
|
425
|
-
data={sampleData}
|
|
426
|
-
columns={sampleColumns}
|
|
427
|
-
sortable={true}
|
|
428
|
-
/>
|
|
429
|
-
);
|
|
314
|
+
render(<DataTable data={sampleData} columns={sampleColumns} sortable={true} />);
|
|
430
315
|
|
|
431
316
|
const nameHeader = screen.getByText('Name').closest('th');
|
|
432
317
|
expect(nameHeader).toHaveAttribute('aria-sort');
|
|
@@ -434,17 +319,10 @@ describe('DataTable Component', () => {
|
|
|
434
319
|
|
|
435
320
|
it('applies role="button" to clickable rows', () => {
|
|
436
321
|
const handleRowClick = vi.fn();
|
|
437
|
-
render(
|
|
438
|
-
<DataTable
|
|
439
|
-
data={sampleData}
|
|
440
|
-
columns={sampleColumns}
|
|
441
|
-
onRowClick={handleRowClick}
|
|
442
|
-
/>
|
|
443
|
-
);
|
|
322
|
+
render(<DataTable data={sampleData} columns={sampleColumns} onRowClick={handleRowClick} />);
|
|
444
323
|
|
|
445
324
|
const row = screen.getByText('John Doe').closest('tr');
|
|
446
325
|
expect(row).toHaveAttribute('role', 'button');
|
|
447
326
|
});
|
|
448
327
|
});
|
|
449
328
|
});
|
|
450
|
-
|