-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve accessibility for sortable table columns (#5780)
- Loading branch information
Showing
25 changed files
with
144 additions
and
149 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
84 changes: 84 additions & 0 deletions
84
packages/samples/react/src/components/table/column-alignment.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,84 @@ | ||
import React, { FC } from 'react'; | ||
|
||
import { KolTable, KolHeading } from '@public-ui/react'; | ||
import { SampleDescription } from '../SampleDescription'; | ||
|
||
const DATA = [{ left: 'Left Example', center: 'Center Example', right: 'Right Example' }]; | ||
type Data = (typeof DATA)[0]; | ||
const genericNonSorter = (data: Data[]): Data[] => data; | ||
|
||
export const TableColumnAlignment: FC = () => ( | ||
<> | ||
<SampleDescription>Table with columns headers and data in different text alignments.</SampleDescription> | ||
|
||
<KolHeading _label="Simple table" _level={3}></KolHeading> | ||
<KolTable | ||
_label="Table for demonstration purposes with different text align properties" | ||
_headers={{ | ||
horizontal: [ | ||
[ | ||
{ label: 'left', key: 'left', textAlign: 'left' }, | ||
{ label: 'center', key: 'center', textAlign: 'center' }, | ||
{ label: 'right', key: 'right', textAlign: 'right' }, | ||
], | ||
], | ||
}} | ||
_data={DATA} | ||
className="block" | ||
style={{ maxWidth: '600px' }} | ||
/> | ||
|
||
<KolHeading _label="Table with sortable columns" _level={3} className="block mt-6"></KolHeading> | ||
<KolTable | ||
_label="Table for demonstration purposes with sortable columns" | ||
_headers={{ | ||
horizontal: [ | ||
[ | ||
{ label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter }, | ||
{ label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter }, | ||
{ label: 'right', key: 'right', textAlign: 'right', sort: genericNonSorter }, | ||
], | ||
], | ||
}} | ||
_data={DATA} | ||
className="block" | ||
style={{ maxWidth: '600px' }} | ||
/> | ||
|
||
<KolHeading _label="Table some sortable columns" _level={3} className="block mt-6"></KolHeading> | ||
<KolTable | ||
_label="Table for demonstration purposes with some but not all columns sortable" | ||
_headers={{ | ||
horizontal: [ | ||
[ | ||
{ label: 'left', key: 'left', textAlign: 'left', sort: genericNonSorter }, | ||
{ label: 'center', key: 'center', textAlign: 'center', sort: genericNonSorter }, | ||
{ label: 'right', key: 'right', textAlign: 'right' }, | ||
], | ||
], | ||
}} | ||
_data={DATA} | ||
className="block" | ||
style={{ maxWidth: '600px' }} | ||
/> | ||
|
||
<KolHeading _label="Table with vertical heading" _level={3} className="block mt-6"></KolHeading> | ||
<KolTable | ||
_label="Table for demonstration purposes with vertical heading" | ||
_headers={{ | ||
horizontal: [ | ||
[ | ||
{ label: '', asTd: true }, | ||
{ label: 'left', key: 'left', textAlign: 'left' }, | ||
{ label: 'center', key: 'center', textAlign: 'center' }, | ||
{ label: 'right', key: 'right', textAlign: 'right' }, | ||
], | ||
], | ||
vertical: [[{ label: 'Vertical' }]], | ||
}} | ||
_data={DATA} | ||
className="block" | ||
style={{ maxWidth: '600px' }} | ||
/> | ||
</> | ||
); |
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 |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { Routes } from '../../shares/types'; | ||
|
||
import { TableBadgeSize } from './badge-size'; | ||
|
||
import { TableColumnAlignment } from './column-alignment'; | ||
import { TableRenderCell } from './render-cell'; | ||
|
||
import { TableSortTable } from './sort-date'; | ||
import { TableSortData } from './sort-data'; | ||
import { TableWithPagination } from './with-pagination'; | ||
|
||
export const TABLE_ROUTES: Routes = { | ||
table: { | ||
'badge-size': TableBadgeSize, | ||
'column-alignment': TableColumnAlignment, | ||
'render-cell': TableRenderCell, | ||
'sort-data': TableSortTable, | ||
'sort-data': TableSortData, | ||
'with-pagination': TableWithPagination, | ||
}, | ||
}; |
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
Binary file modified
BIN
-2.65 KB
(99%)
...s/bmf/snapshots/theme-bmf/snapshot-for-scenarios-complex-form-firefox-linux.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
+47.6 KB
...s/bmf/snapshots/theme-bmf/snapshot-for-table-column-alignment-firefox-linux.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 modified
BIN
-283 Bytes
(100%)
...s/themes/bmf/snapshots/theme-bmf/snapshot-for-table-sort-data-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Binary file added
BIN
+67.1 KB
...st/snapshots/theme-bzstv1/snapshot-for-table-column-alignment-firefox-linux.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
+69.3 KB
...t/snapshots/theme-default/snapshot-for-table-column-alignment-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.