Skip to content

Commit

Permalink
Detailed proptypes
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Jul 13, 2019
1 parent 3ab27a1 commit 5ba34d0
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 17 deletions.
31 changes: 27 additions & 4 deletions docs/src/pages/components/autocomplete/IntegrationDownshift.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,22 @@ function renderInput(inputProps) {
}

renderInput.propTypes = {
classes: PropTypes.object.isRequired,
classes: PropTypes.shape({
chip: PropTypes.string.isRequired,
container: PropTypes.string.isRequired,
divider: PropTypes.string.isRequired,
inputInput: PropTypes.string.isRequired,
inputRoot: PropTypes.string.isRequired,
paper: PropTypes.string.isRequired,
root: PropTypes.string.isRequired,
}).isRequired,
InputProps: PropTypes.object,
ref: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),

This comment has been minimized.

Copy link
@eps1lon

eps1lon Jul 13, 2019

Member

ref doesn't need prop validations. react handles this separately.

ref: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.object]).isRequired,
}),
]),
};

function renderSuggestion(suggestionProps) {
Expand Down Expand Up @@ -95,7 +108,9 @@ renderSuggestion.propTypes = {
index: PropTypes.number.isRequired,
itemProps: PropTypes.object.isRequired,
selectedItem: PropTypes.string.isRequired,
suggestion: PropTypes.object.isRequired,
suggestion: PropTypes.shape({
label: PropTypes.string.isRequired,
}).isRequired,
};

function getSuggestions(value, { showEmpty = false } = {}) {
Expand Down Expand Up @@ -216,7 +231,15 @@ function DownshiftMultiple(props) {
}

DownshiftMultiple.propTypes = {
classes: PropTypes.object.isRequired,
classes: PropTypes.shape({
chip: PropTypes.string.isRequired,
container: PropTypes.string.isRequired,
divider: PropTypes.string.isRequired,
inputInput: PropTypes.string.isRequired,
inputRoot: PropTypes.string.isRequired,
paper: PropTypes.string.isRequired,
root: PropTypes.string.isRequired,
}).isRequired,
};

const useStyles = makeStyles(theme => ({
Expand Down
44 changes: 36 additions & 8 deletions docs/src/pages/components/autocomplete/IntegrationReactSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ function inputComponent({ inputRef, ...props }) {
}

inputComponent.propTypes = {
inputRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
inputRef: PropTypes.oneOfType([
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
}),
]),
};

function Control(props) {
Expand Down Expand Up @@ -166,9 +171,16 @@ Control.propTypes = {
/**
* The mouse down event and the innerRef to pass down to the controller element.
*/
innerProps: PropTypes.object.isRequired,
innerRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.func, PropTypes.object])
.isRequired,
innerProps: PropTypes.shape({
onMouseDown: PropTypes.func.isRequired,
}).isRequired,
innerRef: PropTypes.oneOfType([
PropTypes.oneOf([null]),
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
}),
]).isRequired,
selectProps: PropTypes.object.isRequired,
};

Expand Down Expand Up @@ -196,12 +208,24 @@ Option.propTypes = {
/**
* props passed to the wrapping element for the group.
*/
innerProps: PropTypes.object.isRequired,
innerProps: PropTypes.shape({
id: PropTypes.string.isRequired,
key: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
onMouseMove: PropTypes.func.isRequired,
onMouseOver: PropTypes.func.isRequired,
tabIndex: PropTypes.number.isRequired,
}).isRequired,
/**
* Inner ref to DOM Node
*/
innerRef: PropTypes.oneOfType([PropTypes.oneOf([null]), PropTypes.func, PropTypes.object])
.isRequired,
innerRef: PropTypes.oneOfType([
PropTypes.oneOf([null]),
PropTypes.func,
PropTypes.shape({
current: PropTypes.any.isRequired,
}),
]).isRequired,
/**
* Whether the option is focused.
*/
Expand Down Expand Up @@ -285,7 +309,11 @@ function MultiValue(props) {
MultiValue.propTypes = {
children: PropTypes.node,
isFocused: PropTypes.bool.isRequired,
removeProps: PropTypes.object.isRequired,
removeProps: PropTypes.shape({
onClick: PropTypes.func.isRequired,
onMouseDown: PropTypes.func.isRequired,
onTouchEnd: PropTypes.func.isRequired,
}).isRequired,
selectProps: PropTypes.object.isRequired,
};

Expand Down
6 changes: 5 additions & 1 deletion docs/src/pages/components/breadcrumbs/RouterBreadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ class RouterBreadcrumbs extends React.Component {
}

RouterBreadcrumbs.propTypes = {
classes: PropTypes.object.isRequired,
classes: PropTypes.shape({
lists: PropTypes.string.isRequired,
nested: PropTypes.string.isRequired,
root: PropTypes.string.isRequired,
}).isRequired,
};

export default withStyles(styles)(RouterBreadcrumbs);
4 changes: 3 additions & 1 deletion docs/src/pages/components/snackbars/ConsecutiveSnackbars.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ class ConsecutiveSnackbars extends React.Component {
}

ConsecutiveSnackbars.propTypes = {
classes: PropTypes.object.isRequired,
classes: PropTypes.shape({
close: PropTypes.string.isRequired,
}).isRequired,
};

export default withStyles(styles)(ConsecutiveSnackbars);
17 changes: 15 additions & 2 deletions docs/src/pages/components/tables/ReactVirtualizedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,21 @@ class MuiVirtualizedTable extends React.PureComponent {
}

MuiVirtualizedTable.propTypes = {
classes: PropTypes.object.isRequired,
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
classes: PropTypes.shape({
flexContainer: PropTypes.string.isRequired,
noClick: PropTypes.string.isRequired,
tableCell: PropTypes.string.isRequired,
tableRow: PropTypes.string.isRequired,
tableRowHover: PropTypes.string.isRequired,
}).isRequired,
columns: PropTypes.arrayOf(
PropTypes.shape({
dataKey: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
numeric: PropTypes.bool,
width: PropTypes.number.isRequired,
}),
).isRequired,
headerHeight: PropTypes.number,
onRowClick: PropTypes.func,
rowHeight: PropTypes.number,
Expand Down
4 changes: 3 additions & 1 deletion docs/src/pages/styles/basics/HigherOrderComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ function HigherOrderComponent(props) {
}

HigherOrderComponent.propTypes = {
classes: PropTypes.object.isRequired,
classes: PropTypes.shape({
root: PropTypes.string.isRequired,
}).isRequired,
};

export default withStyles(styles)(HigherOrderComponent);

0 comments on commit 5ba34d0

Please sign in to comment.