-
Notifications
You must be signed in to change notification settings - Fork 829
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storybook] Add stories for more components (EuiTable components) (#7755
- Loading branch information
Showing
46 changed files
with
726 additions
and
6 deletions.
There are no files selected for viewing
Binary file added
BIN
+4.79 KB
...i/reference/chrome_desktop_Tabular_Content_EuiTable_EuiTableBody_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.17 KB
...sktop_Tabular_Content_EuiTable_EuiTableFooter_EuiTableFooterCell_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.61 KB
...e_desktop_Tabular_Content_EuiTable_EuiTableFooter_EuiTableFooter_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.51 KB
...bular_Content_EuiTable_EuiTableHeader_EuiTableHeaderCellCheckbox_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.13 KB
...sktop_Tabular_Content_EuiTable_EuiTableHeader_EuiTableHeaderCell_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.28 KB
...e_desktop_Tabular_Content_EuiTable_EuiTableHeader_EuiTableHeader_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.58 KB
...rence/chrome_desktop_Tabular_Content_EuiTable_EuiTablePagination_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.43 KB
...top_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCellCheckbox_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.34 KB
...chrome_desktop_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCell_Actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.41 KB
...hrome_desktop_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCell_Expander.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.9 KB
...ome_desktop_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCell_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.92 KB
.../chrome_desktop_Tabular_Content_EuiTable_EuiTableRow_EuiTableRow_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.92 KB
...bular_Content_EuiTable_Mobile_subcomponents_EuiTableHeaderMobile_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.75 KB
...lar_Content_EuiTable_Mobile_subcomponents_EuiTableSortMobileItem_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.56 KB
...Tabular_Content_EuiTable_Mobile_subcomponents_EuiTableSortMobile_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.98 KB
...ki/reference/chrome_mobile_Tabular_Content_EuiTable_EuiTableBody_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.06 KB
...obile_Tabular_Content_EuiTable_EuiTableFooter_EuiTableFooterCell_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+6.59 KB
...me_mobile_Tabular_Content_EuiTable_EuiTableFooter_EuiTableFooter_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.91 KB
...bular_Content_EuiTable_EuiTableHeader_EuiTableHeaderCellCheckbox_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.19 KB
...obile_Tabular_Content_EuiTable_EuiTableHeader_EuiTableHeaderCell_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.28 KB
...me_mobile_Tabular_Content_EuiTable_EuiTableHeader_EuiTableHeader_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.19 KB
...erence/chrome_mobile_Tabular_Content_EuiTable_EuiTablePagination_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.77 KB
...ile_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCellCheckbox_Playground.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.53 KB
.../chrome_mobile_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCell_Actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.76 KB
...chrome_mobile_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCell_Expander.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.09 KB
...rome_mobile_Tabular_Content_EuiTable_EuiTableRow_EuiTableRowCell_Playground.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...e/chrome_mobile_Tabular_Content_EuiTable_EuiTableRow_EuiTableRow_Playground.png
Oops, something went wrong.
Binary file added
BIN
+6.04 KB
...bular_Content_EuiTable_Mobile_subcomponents_EuiTableHeaderMobile_Playground.png
Oops, something went wrong.
Binary file added
BIN
+3.44 KB
...lar_Content_EuiTable_Mobile_subcomponents_EuiTableSortMobileItem_Playground.png
Oops, something went wrong.
Binary file added
BIN
+3.23 KB
...Tabular_Content_EuiTable_Mobile_subcomponents_EuiTableSortMobile_Playground.png
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
packages/eui/src/components/table/mobile/table_header_mobile.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { EuiTable } from '../index'; | ||
import { EuiTableHeaderMobile } from './table_header_mobile'; | ||
|
||
type EuiTableHeaderMobileProps = typeof EuiTableHeaderMobile; | ||
|
||
const meta: Meta<EuiTableHeaderMobileProps> = { | ||
title: 'Tabular Content/EuiTable/Mobile subcomponents/EuiTableHeaderMobile', | ||
component: EuiTableHeaderMobile, | ||
decorators: [ | ||
(Story, { args }) => ( | ||
<EuiTable> | ||
<Story {...args} /> | ||
</EuiTable> | ||
), | ||
], | ||
argTypes: { | ||
responsiveBreakpoint: { | ||
// @ts-ignore - adding not resolved type | ||
type: 'boolean | EuiBreakpointSize', | ||
description: | ||
'Named breakpoint. Above this size, the header will not be rendered. Pass `false` to never render or inversely, `true` to always render the header', | ||
control: 'object', | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiTableHeaderMobileProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
// show component always for testing and VRT | ||
responsiveBreakpoint: true, | ||
children: 'mobile header content', | ||
}, | ||
}; |
57 changes: 57 additions & 0 deletions
57
packages/eui/src/components/table/mobile/table_sort_mobile.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
import { EuiTable } from '../index'; | ||
import { EuiTableHeaderMobile } from './table_header_mobile'; | ||
import { | ||
EuiTableSortMobile, | ||
EuiTableSortMobileProps, | ||
} from './table_sort_mobile'; | ||
|
||
const meta: Meta<EuiTableSortMobileProps> = { | ||
title: 'Tabular Content/EuiTable/Mobile subcomponents/EuiTableSortMobile', | ||
component: EuiTableSortMobile, | ||
decorators: [ | ||
(Story, { args }) => ( | ||
<EuiTable> | ||
<EuiTableHeaderMobile responsiveBreakpoint={true}> | ||
<Story {...args} /> | ||
</EuiTableHeaderMobile> | ||
</EuiTable> | ||
), | ||
], | ||
args: { | ||
anchorPosition: 'downRight', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiTableSortMobileProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
items: [ | ||
{ | ||
name: 'sort item 1', | ||
onSort: () => action('onSort')('sort item 1'), | ||
isSorted: true, | ||
isSortAscending: true, | ||
}, | ||
{ | ||
name: 'sort item 2', | ||
onSort: () => action('onSort')('sort item 2'), | ||
isSorted: false, | ||
isSortAscending: false, | ||
}, | ||
], | ||
}, | ||
}; |
58 changes: 58 additions & 0 deletions
58
packages/eui/src/components/table/mobile/table_sort_mobile_item.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { | ||
enableFunctionToggleControls, | ||
hideStorybookControls, | ||
} from '../../../../.storybook/utils'; | ||
import { EuiTable } from '../index'; | ||
import { EuiTableHeaderMobile } from './table_header_mobile'; | ||
import { | ||
EuiTableSortMobileItem, | ||
EuiTableSortMobileItemProps, | ||
} from './table_sort_mobile_item'; | ||
|
||
const meta: Meta<EuiTableSortMobileItemProps> = { | ||
title: 'Tabular Content/EuiTable/Mobile subcomponents/EuiTableSortMobileItem', | ||
component: EuiTableSortMobileItem, | ||
decorators: [ | ||
(Story, { args }) => ( | ||
<EuiTable> | ||
<EuiTableHeaderMobile responsiveBreakpoint={true}> | ||
<Story {...args} /> | ||
</EuiTableHeaderMobile> | ||
</EuiTable> | ||
), | ||
], | ||
argTypes: { | ||
children: { | ||
// @ts-ignore - add not resolved type | ||
type: 'ReactNode', | ||
control: 'text', | ||
}, | ||
}, | ||
args: { | ||
// set up for easier testing/QA | ||
isSorted: false, | ||
isSortAscending: false, | ||
}, | ||
}; | ||
hideStorybookControls(meta, ['aria-label']); | ||
enableFunctionToggleControls(meta, ['onSort']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiTableSortMobileItemProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: 'sort item', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { | ||
disableStorybookControls, | ||
hideStorybookControls, | ||
} from '../../../.storybook/utils'; | ||
import { EuiTable, EuiTableRow, EuiTableRowCell } from './index'; | ||
import { EuiTableBody, EuiTableBodyProps } from './table_body'; | ||
|
||
const meta: Meta<EuiTableBodyProps> = { | ||
title: 'Tabular Content/EuiTable/EuiTableBody', | ||
component: EuiTableBody, | ||
decorators: [ | ||
(Story, { args }) => ( | ||
<EuiTable> | ||
<Story {...args} /> | ||
</EuiTable> | ||
), | ||
], | ||
}; | ||
disableStorybookControls(meta, ['bodyRef']); | ||
hideStorybookControls(meta, ['aria-label']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiTableBodyProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<EuiTableRow> | ||
<EuiTableRowCell>Row 1, Cell 1</EuiTableRowCell> | ||
<EuiTableRowCell>Row 1, Cell 2</EuiTableRowCell> | ||
<EuiTableRowCell>Row 1, Cell 3</EuiTableRowCell> | ||
</EuiTableRow> | ||
</> | ||
), | ||
}, | ||
}; |
46 changes: 46 additions & 0 deletions
46
packages/eui/src/components/table/table_footer.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { hideStorybookControls } from '../../../.storybook/utils'; | ||
import { EuiTable, EuiTableFooterCell } from './index'; | ||
import { EuiTableFooter } from './table_footer'; | ||
|
||
type EuiTableFooterProps = typeof EuiTableFooter; | ||
|
||
const meta: Meta<EuiTableFooterProps> = { | ||
title: 'Tabular Content/EuiTable/EuiTableFooter/EuiTableFooter', | ||
component: EuiTableFooter, | ||
decorators: [ | ||
(Story, { args }) => ( | ||
<EuiTable responsiveBreakpoint={false}> | ||
<Story {...args} /> | ||
</EuiTable> | ||
), | ||
], | ||
}; | ||
hideStorybookControls(meta, ['aria-label']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiTableFooterProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<EuiTableFooterCell>Cell 1</EuiTableFooterCell> | ||
<EuiTableFooterCell>Cell 2</EuiTableFooterCell> | ||
<EuiTableFooterCell> | ||
Long text that will truncate, because footer cells default to that | ||
</EuiTableFooterCell> | ||
</> | ||
), | ||
}, | ||
}; |
55 changes: 55 additions & 0 deletions
55
packages/eui/src/components/table/table_footer_cell.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { hideStorybookControls } from '../../../.storybook/utils'; | ||
import { | ||
LEFT_ALIGNMENT, | ||
CENTER_ALIGNMENT, | ||
RIGHT_ALIGNMENT, | ||
} from '../../services'; | ||
import { EuiTable, EuiTableFooter } from './index'; | ||
import { | ||
EuiTableFooterCell, | ||
EuiTableFooterCellProps, | ||
} from './table_footer_cell'; | ||
|
||
const meta: Meta<EuiTableFooterCellProps> = { | ||
title: 'Tabular Content/EuiTable/EuiTableFooter/EuiTableFooterCell', | ||
component: EuiTableFooterCell, | ||
decorators: [ | ||
(Story, { args }) => ( | ||
<EuiTable responsiveBreakpoint={false}> | ||
<EuiTableFooter> | ||
<Story {...args} /> | ||
</EuiTableFooter> | ||
</EuiTable> | ||
), | ||
], | ||
argTypes: { | ||
align: { | ||
control: 'radio', | ||
options: [LEFT_ALIGNMENT, CENTER_ALIGNMENT, RIGHT_ALIGNMENT], | ||
}, | ||
}, | ||
args: { | ||
align: LEFT_ALIGNMENT, | ||
}, | ||
}; | ||
hideStorybookControls(meta, ['aria-label']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiTableFooterCellProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: 'Footer cell content', | ||
}, | ||
}; |
47 changes: 47 additions & 0 deletions
47
packages/eui/src/components/table/table_header.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { hideStorybookControls } from '../../../.storybook/utils'; | ||
import { EuiTable, EuiTableHeaderCell } from './index'; | ||
import { EuiTableHeader, EuiTableHeaderProps } from './table_header'; | ||
|
||
const meta: Meta<EuiTableHeaderProps> = { | ||
title: 'Tabular Content/EuiTable/EuiTableHeader/EuiTableHeader', | ||
component: EuiTableHeader, | ||
decorators: [ | ||
(Story, { args }) => ( | ||
<EuiTable responsiveBreakpoint={false}> | ||
<Story {...args} /> | ||
</EuiTable> | ||
), | ||
], | ||
args: { | ||
wrapWithTableRow: true, | ||
}, | ||
}; | ||
hideStorybookControls(meta, ['aria-label']); | ||
|
||
export default meta; | ||
type Story = StoryObj<EuiTableHeaderProps>; | ||
|
||
export const Playground: Story = { | ||
args: { | ||
children: ( | ||
<> | ||
<EuiTableHeaderCell>Column 1</EuiTableHeaderCell> | ||
<EuiTableHeaderCell>Column 2</EuiTableHeaderCell> | ||
<EuiTableHeaderCell> | ||
Long text that will truncate, because header cells default to that | ||
</EuiTableHeaderCell> | ||
</> | ||
), | ||
}, | ||
}; |
Oops, something went wrong.