Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Select] Accept boolean #12429

Merged
merged 1 commit into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/material-ui/src/NativeSelect/NativeSelect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface NativeSelectProps
Pick<NativeSelectInputProps, 'onChange'> {
IconComponent?: React.ReactType;
input?: React.ReactNode;
value?: string | number;
value?: string | number | boolean;
}

export type NativeSelectClassKey = 'root' | 'select' | 'selectMenu' | 'disabled' | 'icon';
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/NativeSelect/NativeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ NativeSelect.propTypes = {
/**
* The input value.
*/
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
};

NativeSelect.defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface NativeSelectInputProps {
) => void;
name?: string;
onChange?: (event: React.ChangeEvent<HTMLSelectElement>, child: React.ReactNode) => void;
value?: string | number;
value?: string | number | boolean;
}

declare const NativeSelectInput: React.ComponentType<NativeSelectInputProps>;
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/NativeSelect/NativeSelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ NativeSelectInput.propTypes = {
/**
* The input value.
*/
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
};

export default NativeSelectInput;
2 changes: 1 addition & 1 deletion packages/material-ui/src/Select/Select.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface SelectProps
open?: boolean;
renderValue?: (value: SelectProps['value']) => React.ReactNode;
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
value?: Array<string | number> | string | number;
value?: Array<string | number | boolean> | string | number | boolean;
}

export type SelectClassKey = 'root' | 'select' | 'selectMenu' | 'disabled' | 'icon';
Expand Down
3 changes: 2 additions & 1 deletion packages/material-ui/src/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ Select.propTypes = {
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
PropTypes.bool,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool])),
]),
};

Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Select/SelectInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface SelectInputProps {
renderValue?: (value: SelectInputProps['value']) => React.ReactNode;
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
tabIndex?: number;
value?: string | number | Array<string | number>;
value?: string | number | boolean | Array<string | number | boolean>;
}

declare const SelectInput: React.ComponentType<SelectInputProps>;
Expand Down
3 changes: 2 additions & 1 deletion packages/material-ui/src/Select/SelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ SelectInput.propTypes = {
value: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
PropTypes.bool,
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool])),
]).isRequired,
};

Expand Down
2 changes: 1 addition & 1 deletion pages/api/native-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ An alternative to `<Select native />` with a much smaller dependency graph.
| <span class="prop-name">input</span> | <span class="prop-type">element | <span class="prop-default">&lt;Input /></span> | An `Input` element; does not have to be a material-ui specific `Input`. |
| <span class="prop-name">inputProps</span> | <span class="prop-type">object |   | Attributes applied to the `select` element. |
| <span class="prop-name">onChange</span> | <span class="prop-type">func |   | Callback function fired when a menu item is selected.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new value by accessing `event.target.value`. |
| <span class="prop-name">value</span> | <span class="prop-type">union:&nbsp;string&nbsp;&#124;<br>&nbsp;number<br> |   | The input value. |
| <span class="prop-name">value</span> | <span class="prop-type">union:&nbsp;string&nbsp;&#124;<br>&nbsp;number&nbsp;&#124;<br>&nbsp;bool<br> |   | The input value. |

Any other properties supplied will be spread to the root element ([Input](/api/input)).

Expand Down
2 changes: 1 addition & 1 deletion pages/api/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ title: Select API
| <span class="prop-name">open</span> | <span class="prop-type">bool |   | Control `select` open state. You can only use it when the `native` property is `false` (default). |
| <span class="prop-name">renderValue</span> | <span class="prop-type">func |   | Render the selected value. You can only use it when the `native` property is `false` (default).<br><br>**Signature:**<br>`function(value: any) => ReactElement`<br>*value:* The `value` provided to the component. |
| <span class="prop-name">SelectDisplayProps</span> | <span class="prop-type">object |   | Properties applied to the clickable div element. |
| <span class="prop-name">value</span> | <span class="prop-type">union:&nbsp;string&nbsp;&#124;<br>&nbsp;number&nbsp;&#124;<br>&nbsp;arrayOf<br> |   | The input value. This property is required when the `native` property is `false` (default). |
| <span class="prop-name">value</span> | <span class="prop-type">union:&nbsp;string&nbsp;&#124;<br>&nbsp;number&nbsp;&#124;<br>&nbsp;bool&nbsp;&#124;<br>&nbsp;arrayOf<br> |   | The input value. This property is required when the `native` property is `false` (default). |

Any other properties supplied will be spread to the root element ([Input](/api/input)).

Expand Down