Skip to content

Commit

Permalink
reduce amount of breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 25, 2019
1 parent 0e01b47 commit 8dba7d2
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 29 deletions.
2 changes: 1 addition & 1 deletion docs/src/pages/demos/tables/EnhancedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class RawEnhancedTableHead extends React.Component {
<TableCell
key={row.id}
align={row.numeric ? 'right' : 'left'}
padding={row.disablePadding ? 'none' : 'normal'}
padding={row.disablePadding ? 'none' : 'default'}
sortDirection={orderBy === row.id ? order : false}
>
<Tooltip
Expand Down
7 changes: 1 addition & 6 deletions docs/src/pages/demos/tables/ReactVirtualizedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ class MuiVirtualizedTable extends React.PureComponent {
return (
<AutoSizer>
{({ height, width }) => (
<Table
height={height}
width={width}
{...tableProps}
rowClassName={this.getRowClassName}
>
<Table height={height} width={width} {...tableProps} rowClassName={this.getRowClassName}>
{columns.map(({ cellContentRenderer = null, className, dataKey, ...other }, index) => {
let renderer;
if (cellContentRenderer != null) {
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Table/Table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface TableProps extends StandardProps<TableBaseProps, TableClassKey>

export type TableBaseProps = React.TableHTMLAttributes<HTMLTableElement>;

export type Padding = 'normal' | 'checkbox' | 'none';
export type Padding = 'default' | 'checkbox' | 'none';

export type Size = 'normal' | 'small';

Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui/src/Table/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Table.propTypes = {
/**
* Allows TableCells to inherit padding of the Table.
*/
padding: PropTypes.oneOf(['normal', 'checkbox', 'none']),
padding: PropTypes.oneOf(['default', 'checkbox', 'none']),
/**
* Allows TableCells to inherit size of the Table.
*/
Expand All @@ -56,7 +56,7 @@ Table.propTypes = {

Table.defaultProps = {
component: 'table',
padding: 'normal',
padding: 'default',
size: 'normal',
};

Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Table/Table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe('<Table />', () => {

assert.deepStrictEqual(context, {
size: 'normal',
padding: 'normal',
padding: 'default',
});
});
});
8 changes: 4 additions & 4 deletions packages/material-ui/src/TableCell/TableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ function TableCell(props) {
if (!scope && tablelvl2 && tablelvl2.variant === 'head') {
scope = 'col';
}
const padding = paddingProp || (table && table.padding ? table.padding : 'normal');
const padding = paddingProp || (table && table.padding ? table.padding : 'default');
const size = sizeProp || (table && table.size ? table.size : 'normal');

let ariaSort = null;
Expand All @@ -147,7 +147,7 @@ function TableCell(props) {
? variant === 'footer'
: tablelvl2 && tablelvl2.variant === 'footer',
[classes[`align${capitalize(align)}`]]: align !== 'inherit',
[classes[`padding${capitalize(padding)}`]]: padding !== 'normal',
[classes[`padding${capitalize(padding)}`]]: padding !== 'default',
[classes[`size${capitalize(size)}`]]: size !== 'normal',
},
className,
Expand Down Expand Up @@ -191,14 +191,14 @@ TableCell.propTypes = {
* Sets the padding applied to the cell.
* By default, the Table parent component set the value.
*/
padding: PropTypes.oneOf(['normal', 'checkbox', 'none']),
padding: PropTypes.oneOf(['default', 'checkbox', 'none']),
/**
* Set scope attribute.
*/
scope: PropTypes.string,
/**
* Specify the size of the cell.
* By default, the Table parent component set the value.
* By default, the Table parent component set the value (`normal`).
*/
size: PropTypes.oneOf(['normal', 'small']),
/**
Expand Down
10 changes: 0 additions & 10 deletions packages/material-ui/src/TableRow/TableRow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { assert } from 'chai';
import { createMount, findOutermostIntrinsic, getClasses } from '@material-ui/core/test-utils';
import TableRow from './TableRow';
import TableContext from '../Table/TableContext';

describe('<TableRow />', () => {
let mount;
Expand Down Expand Up @@ -46,15 +45,6 @@ describe('<TableRow />', () => {
assert.strictEqual(findOutermostIntrinsic(wrapper).hasClass(classes.root), true);
});

it('should render with the dense class in dense tables', () => {
const wrapper = mountInTable(
<TableContext.Provider value={{ padding: 'dense' }}>
<TableRow />
</TableContext.Provider>,
);
assert.strictEqual(findOutermostIntrinsic(wrapper).hasClass(classes.dense), true);
});

it('should render children', () => {
const children = <td className="test" />;
const wrapper = mountInTable(<TableRow>{children}</TableRow>);
Expand Down
4 changes: 2 additions & 2 deletions pages/api/table-cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import TableCell from '@material-ui/core/TableCell';
| <span class="prop-name">children</span> | <span class="prop-type">node</span> |   | The table cell contents. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">element type</span> |   | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> |   | Sets the padding applied to the cell. By default, the Table parent component set the value. |
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'default'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> |   | Sets the padding applied to the cell. By default, the Table parent component set the value. |
| <span class="prop-name">scope</span> | <span class="prop-type">string</span> |   | Set scope attribute. |
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'small'<br></span> |   | Specify the size of the cell. By default, the Table parent component set the value. |
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'small'<br></span> |   | Specify the size of the cell. By default, the Table parent component set the value (`normal`). |
| <span class="prop-name">sortDirection</span> | <span class="prop-type">enum:&nbsp;'asc'&nbsp;&#124;<br>&nbsp;'desc'&nbsp;&#124;<br>&nbsp;false<br></span> |   | Set aria-sort direction. |
| <span class="prop-name">variant</span> | <span class="prop-type">enum:&nbsp;'head'&nbsp;&#124;<br>&nbsp;'body'&nbsp;&#124;<br>&nbsp;'footer'<br></span> |   | Specify the cell type. By default, the TableHead, TableBody or TableFooter parent component set the value. |

Expand Down
2 changes: 1 addition & 1 deletion pages/api/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Table from '@material-ui/core/Table';
| <span class="prop-name required">children *</span> | <span class="prop-type">node</span> |   | The content of the table, normally `TableHead` and `TableBody`. |
| <span class="prop-name">classes</span> | <span class="prop-type">object</span> |   | Override or extend the styles applied to the component. See [CSS API](#css) below for more details. |
| <span class="prop-name">component</span> | <span class="prop-type">element type</span> | <span class="prop-default">'table'</span> | The component used for the root node. Either a string to use a DOM element or a component. |
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> | <span class="prop-default">'normal'</span> | Allows TableCells to inherit padding of the Table. |
| <span class="prop-name">padding</span> | <span class="prop-type">enum:&nbsp;'default'&nbsp;&#124;<br>&nbsp;'checkbox'&nbsp;&#124;<br>&nbsp;'none'<br></span> | <span class="prop-default">'default'</span> | Allows TableCells to inherit padding of the Table. |
| <span class="prop-name">size</span> | <span class="prop-type">enum:&nbsp;'normal'&nbsp;&#124;<br>&nbsp;'small'<br></span> | <span class="prop-default">'normal'</span> | Allows TableCells to inherit size of the Table. |

Any other properties supplied will be spread to the root element (native element).
Expand Down
2 changes: 1 addition & 1 deletion test/regressions/tests/Table/PaddingTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function PaddingTable() {
<div>
<Grid container spacing={2}>
<Grid item xs={6}>
<MyTable padding="normal" />
<MyTable padding="default" />
</Grid>
<Grid item xs={6}>
<MyTable padding="none" />
Expand Down

0 comments on commit 8dba7d2

Please sign in to comment.