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

[core] Fix Checkbox and Radio type propType #20293

Merged
merged 1 commit into from
Mar 26, 2020
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
1 change: 0 additions & 1 deletion docs/pages/api-docs/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the state is changed.<br><br>**Signature:**<br>`function(event: object) => void`<br>*event:* The event source of the callback. You can pull out the new checked state by accessing `event.target.checked` (boolean). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">size</span> | <span class="prop-type">'small'<br>&#124;&nbsp;'medium'</span> | <span class="prop-default">'medium'</span> | The size of the checkbox. `small` is equivalent to the dense checkbox styling. |
| <span class="prop-name">type</span> | <span class="prop-type">string</span> | | The input component prop `type`. |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the component. The DOM API casts this to a string. The browser uses "on" as the default value. |

The `ref` is forwarded to the root element.
Expand Down
1 change: 0 additions & 1 deletion docs/pages/api-docs/radio.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ You can learn more about the difference by [reading this guide](/guides/minimizi
| <span class="prop-name">onChange</span> | <span class="prop-type">func</span> | | Callback fired when the state is changed.<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` (string). You can pull out the new checked state by accessing `event.target.checked` (boolean). |
| <span class="prop-name">required</span> | <span class="prop-type">bool</span> | | If `true`, the `input` element will be required. |
| <span class="prop-name">size</span> | <span class="prop-type">'small'<br>&#124;&nbsp;'medium'</span> | <span class="prop-default">'medium'</span> | The size of the radio. `small` is equivalent to the dense radio styling. |
| <span class="prop-name">type</span> | <span class="prop-type">string</span> | | The input component prop `type`. |
| <span class="prop-name">value</span> | <span class="prop-type">any</span> | | The value of the component. The DOM API casts this to a string. |

The `ref` is forwarded to the root element.
Expand Down
6 changes: 5 additions & 1 deletion packages/material-ui/src/Checkbox/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { StandardProps } from '..';
import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase';

export interface CheckboxProps
extends StandardProps<SwitchBaseProps, CheckboxClassKey, 'checkedIcon' | 'color' | 'icon'> {
extends StandardProps<
SwitchBaseProps,
CheckboxClassKey,
'checkedIcon' | 'color' | 'icon' | 'type'
Copy link
Member Author

@eps1lon eps1lon Mar 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removes type from TS types (point 2)

> {
checkedIcon?: React.ReactNode;
color?: 'primary' | 'secondary' | 'default';
icon?: React.ReactNode;
Expand Down
4 changes: 0 additions & 4 deletions packages/material-ui/src/Checkbox/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,6 @@ Checkbox.propTypes = {
* `small` is equivalent to the dense checkbox styling.
*/
size: PropTypes.oneOf(['small', 'medium']),
/**
* The input component prop `type`.
*/
type: PropTypes.string,
/**
* The value of the component. The DOM API casts this to a string.
* The browser uses "on" as the default value.
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/Radio/Radio.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StandardProps } from '..';
import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase';

export interface RadioProps
extends StandardProps<SwitchBaseProps, RadioClassKey, 'checkedIcon' | 'color' | 'icon'> {
extends StandardProps<SwitchBaseProps, RadioClassKey, 'checkedIcon' | 'color' | 'icon' | 'type'> {
checkedIcon?: React.ReactNode;
color?: 'primary' | 'secondary' | 'default';
icon?: React.ReactNode;
Expand Down
4 changes: 0 additions & 4 deletions packages/material-ui/src/Radio/Radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ Radio.propTypes = {
* `small` is equivalent to the dense radio styling.
*/
size: PropTypes.oneOf(['small', 'medium']),
/**
* The input component prop `type`.
*/
type: PropTypes.string,
/**
* The value of the component. The DOM API casts this to a string.
*/
Expand Down
3 changes: 2 additions & 1 deletion packages/material-ui/src/internal/SwitchBase.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { StandardProps } from '..';
import { IconButtonProps } from '../IconButton';

export interface SwitchBaseProps
extends StandardProps<IconButtonProps, SwitchBaseClassKey, 'onChange' | 'value'> {
extends StandardProps<IconButtonProps, SwitchBaseClassKey, 'onChange' | 'type' | 'value'> {
autoFocus?: boolean;
checked?: boolean;
checkedIcon: React.ReactNode;
Expand All @@ -18,6 +18,7 @@ export interface SwitchBaseProps
readOnly?: boolean;
required?: boolean;
tabIndex?: number;
type?: React.InputHTMLAttributes<HTMLInputElement>['type'];
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes type type in SwitchBase (point 1)

value?: unknown;
}

Expand Down