Skip to content

Commit a9309bb

Browse files
[Select] Accept boolean (#12429)
1 parent 63b23ee commit a9309bb

File tree

10 files changed

+12
-10
lines changed

10 files changed

+12
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface NativeSelectProps
99
Pick<NativeSelectInputProps, 'onChange'> {
1010
IconComponent?: React.ReactType;
1111
input?: React.ReactNode;
12-
value?: string | number;
12+
value?: string | number | boolean;
1313
}
1414

1515
export type NativeSelectClassKey = 'root' | 'select' | 'selectMenu' | 'disabled' | 'icon';

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ NativeSelect.propTypes = {
120120
/**
121121
* The input value.
122122
*/
123-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
123+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
124124
};
125125

126126
NativeSelect.defaultProps = {

packages/material-ui/src/NativeSelect/NativeSelectInput.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface NativeSelectInputProps {
88
) => void;
99
name?: string;
1010
onChange?: (event: React.ChangeEvent<HTMLSelectElement>, child: React.ReactNode) => void;
11-
value?: string | number;
11+
value?: string | number | boolean;
1212
}
1313

1414
declare const NativeSelectInput: React.ComponentType<NativeSelectInputProps>;

packages/material-ui/src/NativeSelect/NativeSelectInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ NativeSelectInput.propTypes = {
8484
/**
8585
* The input value.
8686
*/
87-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
87+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
8888
};
8989

9090
export default NativeSelectInput;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface SelectProps
1919
open?: boolean;
2020
renderValue?: (value: SelectProps['value']) => React.ReactNode;
2121
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
22-
value?: Array<string | number> | string | number;
22+
value?: Array<string | number | boolean> | string | number | boolean;
2323
}
2424

2525
export type SelectClassKey = 'root' | 'select' | 'selectMenu' | 'disabled' | 'icon';

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ Select.propTypes = {
162162
value: PropTypes.oneOfType([
163163
PropTypes.string,
164164
PropTypes.number,
165-
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
165+
PropTypes.bool,
166+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool])),
166167
]),
167168
};
168169

packages/material-ui/src/Select/SelectInput.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface SelectInputProps {
2323
renderValue?: (value: SelectInputProps['value']) => React.ReactNode;
2424
SelectDisplayProps?: React.HTMLAttributes<HTMLDivElement>;
2525
tabIndex?: number;
26-
value?: string | number | Array<string | number>;
26+
value?: string | number | boolean | Array<string | number | boolean>;
2727
}
2828

2929
declare const SelectInput: React.ComponentType<SelectInputProps>;

packages/material-ui/src/Select/SelectInput.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ SelectInput.propTypes = {
439439
value: PropTypes.oneOfType([
440440
PropTypes.string,
441441
PropTypes.number,
442-
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])),
442+
PropTypes.bool,
443+
PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool])),
443444
]).isRequired,
444445
};
445446

pages/api/native-select.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ An alternative to `<Select native />` with a much smaller dependency graph.
2121
| <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`. |
2222
| <span class="prop-name">inputProps</span> | <span class="prop-type">object |   | Attributes applied to the `select` element. |
2323
| <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`. |
24-
| <span class="prop-name">value</span> | <span class="prop-type">union:&nbsp;string&nbsp;&#124;<br>&nbsp;number<br> |   | The input value. |
24+
| <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. |
2525

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

pages/api/select.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ title: Select API
3131
| <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). |
3232
| <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. |
3333
| <span class="prop-name">SelectDisplayProps</span> | <span class="prop-type">object |   | Properties applied to the clickable div element. |
34-
| <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). |
34+
| <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). |
3535

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

0 commit comments

Comments
 (0)