From 3732e11b7002683c47d58f485058a5d0b022475b Mon Sep 17 00:00:00 2001 From: Sebastian Silbermann Date: Thu, 26 Mar 2020 21:01:29 +0100 Subject: [PATCH] [core] Fix Checkbox and Radio type propType --- docs/pages/api-docs/checkbox.md | 1 - docs/pages/api-docs/radio.md | 1 - packages/material-ui/src/Checkbox/Checkbox.d.ts | 6 +++++- packages/material-ui/src/Checkbox/Checkbox.js | 4 ---- packages/material-ui/src/Radio/Radio.d.ts | 2 +- packages/material-ui/src/Radio/Radio.js | 4 ---- packages/material-ui/src/internal/SwitchBase.d.ts | 3 ++- 7 files changed, 8 insertions(+), 13 deletions(-) diff --git a/docs/pages/api-docs/checkbox.md b/docs/pages/api-docs/checkbox.md index f329cb79dd68d5..f22263ccac7d42 100644 --- a/docs/pages/api-docs/checkbox.md +++ b/docs/pages/api-docs/checkbox.md @@ -39,7 +39,6 @@ You can learn more about the difference by [reading this guide](/guides/minimizi | onChange | func | | Callback fired when the state is changed.

**Signature:**
`function(event: object) => void`
*event:* The event source of the callback. You can pull out the new checked state by accessing `event.target.checked` (boolean). | | required | bool | | If `true`, the `input` element will be required. | | size | 'small'
| 'medium'
| 'medium' | The size of the checkbox. `small` is equivalent to the dense checkbox styling. | -| type | string | | The input component prop `type`. | | value | any | | 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. diff --git a/docs/pages/api-docs/radio.md b/docs/pages/api-docs/radio.md index 7b21d6747dbfe2..3aad42036f7602 100644 --- a/docs/pages/api-docs/radio.md +++ b/docs/pages/api-docs/radio.md @@ -38,7 +38,6 @@ You can learn more about the difference by [reading this guide](/guides/minimizi | onChange | func | | Callback fired when the state is changed.

**Signature:**
`function(event: object) => void`
*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). | | required | bool | | If `true`, the `input` element will be required. | | size | 'small'
| 'medium'
| 'medium' | The size of the radio. `small` is equivalent to the dense radio styling. | -| type | string | | The input component prop `type`. | | value | any | | The value of the component. The DOM API casts this to a string. | The `ref` is forwarded to the root element. diff --git a/packages/material-ui/src/Checkbox/Checkbox.d.ts b/packages/material-ui/src/Checkbox/Checkbox.d.ts index e5a28ca4fb5c17..2de30e2ba2e930 100644 --- a/packages/material-ui/src/Checkbox/Checkbox.d.ts +++ b/packages/material-ui/src/Checkbox/Checkbox.d.ts @@ -3,7 +3,11 @@ import { StandardProps } from '..'; import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase'; export interface CheckboxProps - extends StandardProps { + extends StandardProps< + SwitchBaseProps, + CheckboxClassKey, + 'checkedIcon' | 'color' | 'icon' | 'type' + > { checkedIcon?: React.ReactNode; color?: 'primary' | 'secondary' | 'default'; icon?: React.ReactNode; diff --git a/packages/material-ui/src/Checkbox/Checkbox.js b/packages/material-ui/src/Checkbox/Checkbox.js index f4eb3675791e0e..ceff0e119b2e32 100644 --- a/packages/material-ui/src/Checkbox/Checkbox.js +++ b/packages/material-ui/src/Checkbox/Checkbox.js @@ -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. diff --git a/packages/material-ui/src/Radio/Radio.d.ts b/packages/material-ui/src/Radio/Radio.d.ts index 5e339a4ad2ba37..9984793dc2945d 100644 --- a/packages/material-ui/src/Radio/Radio.d.ts +++ b/packages/material-ui/src/Radio/Radio.d.ts @@ -3,7 +3,7 @@ import { StandardProps } from '..'; import { SwitchBaseProps, SwitchBaseClassKey } from '../internal/SwitchBase'; export interface RadioProps - extends StandardProps { + extends StandardProps { checkedIcon?: React.ReactNode; color?: 'primary' | 'secondary' | 'default'; icon?: React.ReactNode; diff --git a/packages/material-ui/src/Radio/Radio.js b/packages/material-ui/src/Radio/Radio.js index b4da14f8789445..37c9f2b40919fa 100644 --- a/packages/material-ui/src/Radio/Radio.js +++ b/packages/material-ui/src/Radio/Radio.js @@ -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. */ diff --git a/packages/material-ui/src/internal/SwitchBase.d.ts b/packages/material-ui/src/internal/SwitchBase.d.ts index de1a62e26f7170..0040f91047d324 100644 --- a/packages/material-ui/src/internal/SwitchBase.d.ts +++ b/packages/material-ui/src/internal/SwitchBase.d.ts @@ -3,7 +3,7 @@ import { StandardProps } from '..'; import { IconButtonProps } from '../IconButton'; export interface SwitchBaseProps - extends StandardProps { + extends StandardProps { autoFocus?: boolean; checked?: boolean; checkedIcon: React.ReactNode; @@ -18,6 +18,7 @@ export interface SwitchBaseProps readOnly?: boolean; required?: boolean; tabIndex?: number; + type?: React.InputHTMLAttributes['type']; value?: unknown; }