Skip to content

Commit 534b9e9

Browse files
[Table] Move prop docs into IntelliSense (#21530)
1 parent ba9d3de commit 534b9e9

File tree

20 files changed

+176
-31
lines changed

20 files changed

+176
-31
lines changed

docs/pages/api-docs/table-container.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The `MuiTableContainer` name can be used for providing [default props](/customiz
2828

2929
| Name | Type | Default | Description |
3030
|:-----|:-----|:--------|:------------|
31-
| <span class="prop-name">children</span> | <span class="prop-type">node</span> | | The table itself, normally `<Table />` |
31+
| <span class="prop-name">children</span> | <span class="prop-type">node</span> | | The table itself, normally `<Table />`. |
3232
| <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. |
3333
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'div'</span> | The component used for the root node. Either a string to use a HTML element or a component. |
3434

docs/pages/api-docs/table-pagination.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The `MuiTablePagination` name can be used for providing [default props](/customi
4141
| <span class="prop-name">onChangeRowsPerPage</span> | <span class="prop-type">func</span> | | Callback fired when the number of rows per page is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. |
4242
| <span class="prop-name required">page<abbr title="required">*</abbr></span> | <span class="prop-type">number</span> | | The zero-based index of the current page. |
4343
| <span class="prop-name required">rowsPerPage<abbr title="required">*</abbr></span> | <span class="prop-type">number</span> | | The number of rows per page. |
44-
| <span class="prop-name">rowsPerPageOptions</span> | <span class="prop-type">array</span> | <span class="prop-default">[10, 25, 50, 100]</span> | Customizes the options of the rows per page select field. If less than two options are available, no select field will be displayed. |
44+
| <span class="prop-name">rowsPerPageOptions</span> | <span class="prop-type">Array&lt;number<br>&#124;&nbsp;{ label: string, value: number }&gt;</span> | <span class="prop-default">[10, 25, 50, 100]</span> | Customizes the options of the rows per page select field. If less than two options are available, no select field will be displayed. |
4545
| <span class="prop-name">SelectProps</span> | <span class="prop-type">object</span> | <span class="prop-default">{}</span> | Props applied to the rows per page [`Select`](/api/select/) element. |
4646
| <span class="prop-name">showFirstButton</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, show the first-page button. |
4747
| <span class="prop-name">showLastButton</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | If `true`, show the last-page button. |

docs/pages/api-docs/table.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ The `MuiTable` name can be used for providing [default props](/customization/glo
2828

2929
| Name | Type | Default | Description |
3030
|:-----|:-----|:--------|:------------|
31-
| <span class="prop-name required">children<abbr title="required">*</abbr></span> | <span class="prop-type">node</span> | | The content of the table, normally `TableHead` and `TableBody`. |
31+
| <span class="prop-name">children</span> | <span class="prop-type">node</span> | | The content of the table, normally `TableHead` and `TableBody`. |
3232
| <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. |
3333
| <span class="prop-name">component</span> | <span class="prop-type">elementType</span> | <span class="prop-default">'table'</span> | The component used for the root node. Either a string to use a HTML element or a component. |
34-
| <span class="prop-name">padding</span> | <span class="prop-type">'default'<br>&#124;&nbsp;'checkbox'<br>&#124;&nbsp;'none'</span> | <span class="prop-default">'default'</span> | Allows TableCells to inherit padding of the Table. |
35-
| <span class="prop-name">size</span> | <span class="prop-type">'small'<br>&#124;&nbsp;'medium'</span> | <span class="prop-default">'medium'</span> | Allows TableCells to inherit size of the Table. |
34+
| <span class="prop-name">padding</span> | <span class="prop-type">'checkbox'<br>&#124;&nbsp;'default'<br>&#124;&nbsp;'none'</span> | <span class="prop-default">'default'</span> | Allows TableCells to inherit padding of the Table. |
35+
| <span class="prop-name">size</span> | <span class="prop-type">'medium'<br>&#124;&nbsp;'small'</span> | <span class="prop-default">'medium'</span> | Allows TableCells to inherit size of the Table. |
3636
| <span class="prop-name">stickyHeader</span> | <span class="prop-type">bool</span> | <span class="prop-default">false</span> | Set the header sticky.<br>⚠️ It doesn't work with IE 11. |
3737

3838
The `ref` is forwarded to the root element.

packages/material-ui/src/Table/Table.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,23 @@ export type Size = 'small' | 'medium';
77

88
export interface TableTypeMap<P = {}, D extends React.ElementType = 'table'> {
99
props: P & {
10+
/**
11+
* The content of the table, normally `TableHead` and `TableBody`.
12+
*/
13+
children?: React.ReactNode;
14+
/**
15+
* Allows TableCells to inherit padding of the Table.
16+
*/
1017
padding?: Padding;
18+
/**
19+
* Allows TableCells to inherit size of the Table.
20+
*/
1121
size?: Size;
22+
/**
23+
* Set the header sticky.
24+
*
25+
* ⚠️ It doesn't work with IE 11.
26+
*/
1227
stickyHeader?: boolean;
1328
};
1429
defaultComponent: D;

packages/material-ui/src/Table/Table.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,19 @@ const Table = React.forwardRef(function Table(props, ref) {
5656
});
5757

5858
Table.propTypes = {
59+
// ----------------------------- Warning --------------------------------
60+
// | These PropTypes are generated from the TypeScript type definitions |
61+
// | To update them edit the d.ts file and run "yarn proptypes" |
62+
// ----------------------------------------------------------------------
5963
/**
6064
* The content of the table, normally `TableHead` and `TableBody`.
6165
*/
62-
children: PropTypes.node.isRequired,
66+
children: PropTypes.node,
6367
/**
6468
* Override or extend the styles applied to the component.
6569
* See [CSS API](#css) below for more details.
6670
*/
67-
classes: PropTypes.object.isRequired,
71+
classes: PropTypes.object,
6872
/**
6973
* @ignore
7074
*/
@@ -77,11 +81,11 @@ Table.propTypes = {
7781
/**
7882
* Allows TableCells to inherit padding of the Table.
7983
*/
80-
padding: PropTypes.oneOf(['default', 'checkbox', 'none']),
84+
padding: PropTypes.oneOf(['checkbox', 'default', 'none']),
8185
/**
8286
* Allows TableCells to inherit size of the Table.
8387
*/
84-
size: PropTypes.oneOf(['small', 'medium']),
88+
size: PropTypes.oneOf(['medium', 'small']),
8589
/**
8690
* Set the header sticky.
8791
*

packages/material-ui/src/TableBody/TableBody.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import * as React from 'react';
22
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
33

44
export interface TableBodyTypeMap<P = {}, D extends React.ElementType = 'tbody'> {
5-
props: P;
5+
props: P & {
6+
/**
7+
* The content of the component, normally `TableRow`.
8+
*/
9+
children?: React.ReactNode;
10+
};
611
defaultComponent: D;
712
classKey: TableBodyClassKey;
813
}

packages/material-ui/src/TableBody/TableBody.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ const TableBody = React.forwardRef(function TableBody(props, ref) {
3333
});
3434

3535
TableBody.propTypes = {
36+
// ----------------------------- Warning --------------------------------
37+
// | These PropTypes are generated from the TypeScript type definitions |
38+
// | To update them edit the d.ts file and run "yarn proptypes" |
39+
// ----------------------------------------------------------------------
3640
/**
3741
* The content of the component, normally `TableRow`.
3842
*/
@@ -41,7 +45,7 @@ TableBody.propTypes = {
4145
* Override or extend the styles applied to the component.
4246
* See [CSS API](#css) below for more details.
4347
*/
44-
classes: PropTypes.object.isRequired,
48+
classes: PropTypes.object,
4549
/**
4650
* @ignore
4751
*/

packages/material-ui/src/TableContainer/TableContainer.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import * as React from 'react';
22
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
33

44
export interface TableContainerTypeMap<P = {}, D extends React.ElementType = 'div'> {
5-
props: P;
5+
props: P & {
6+
/**
7+
* The table itself, normally `<Table />`.
8+
*/
9+
children?: React.ReactNode;
10+
};
611
defaultComponent: D;
712
classKey: TableContainerClassKey;
813
}

packages/material-ui/src/TableContainer/TableContainer.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ const TableContainer = React.forwardRef(function TableContainer(props, ref) {
1818
});
1919

2020
TableContainer.propTypes = {
21+
// ----------------------------- Warning --------------------------------
22+
// | These PropTypes are generated from the TypeScript type definitions |
23+
// | To update them edit the d.ts file and run "yarn proptypes" |
24+
// ----------------------------------------------------------------------
2125
/**
22-
* The table itself, normally `<Table />`
26+
* The table itself, normally `<Table />`.
2327
*/
2428
children: PropTypes.node,
2529
/**
2630
* Override or extend the styles applied to the component.
2731
* See [CSS API](#css) below for more details.
2832
*/
29-
classes: PropTypes.object.isRequired,
33+
classes: PropTypes.object,
3034
/**
3135
* @ignore
3236
*/

packages/material-ui/src/TableFooter/TableFooter.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import * as React from 'react';
22
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
33

44
export interface TableFooterTypeMap<P = {}, D extends React.ElementType = 'tfoot'> {
5-
props: P;
5+
props: P & {
6+
/**
7+
* The content of the component, normally `TableRow`.
8+
*/
9+
children?: React.ReactNode;
10+
};
611
defaultComponent: D;
712
classKey: TableFooterClassKey;
813
}

0 commit comments

Comments
 (0)