From 407fa48761e789e59853aa5027416c2f4893232b Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Tue, 18 Jan 2022 10:06:02 +0100 Subject: [PATCH 1/5] add missing Proptypes.string for OverridableStringUnion fields --- packages/mui-joy/src/Button/Button.tsx | 21 +++++++++++++------ packages/mui-joy/src/Switch/Switch.tsx | 10 +++++++-- .../src/LoadingButton/LoadingButton.js | 5 ++++- .../mui-material/src/ImageList/ImageList.js | 5 ++++- packages/mui-material/src/Slider/Slider.js | 5 ++++- 5 files changed, 35 insertions(+), 11 deletions(-) diff --git a/packages/mui-joy/src/Button/Button.tsx b/packages/mui-joy/src/Button/Button.tsx index 7b494c24ed6775..1e25117c91b89e 100644 --- a/packages/mui-joy/src/Button/Button.tsx +++ b/packages/mui-joy/src/Button/Button.tsx @@ -171,7 +171,10 @@ Button.propTypes /* remove-proptypes */ = { * The color of the component. It supports those theme colors that make sense for this component. * @default 'primary' */ - color: PropTypes.oneOf(['context', 'danger', 'info', 'neutral', 'primary', 'success', 'warning']), + color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['context', 'danger', 'info', 'neutral', 'primary', 'success', 'warning']), + PropTypes.string, + ]), /** * The component used for the root node. * Either a string to use a HTML element or a component. @@ -185,12 +188,18 @@ Button.propTypes /* remove-proptypes */ = { /** * The size of the component. */ - size: PropTypes.oneOf(['sm', 'md', 'lg']), + size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['sm', 'md', 'lg']), + PropTypes.string, + ]), /** - * The variant to use. - * @default 'contained' - */ - variant: PropTypes.oneOf(['contained', 'light', 'outlined', 'text']), + * The variant to use. + * @default 'text' + */ + variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['contained', 'light', 'outlined', 'text']), + PropTypes.string, + ]), } as any; export default Button; diff --git a/packages/mui-joy/src/Switch/Switch.tsx b/packages/mui-joy/src/Switch/Switch.tsx index cf6288c69f4c87..d7186c96a14e18 100644 --- a/packages/mui-joy/src/Switch/Switch.tsx +++ b/packages/mui-joy/src/Switch/Switch.tsx @@ -219,7 +219,10 @@ Switch.propTypes /* remove-proptypes */ = { * The color of the component. It supports those theme colors that make sense for this component. * @default 'primary' */ - color: PropTypes.oneOf(['danger', 'info', 'primary', 'success', 'warning']), + color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['danger', 'info', 'primary', 'success', 'warning']), + PropTypes.string, + ]), /** * The component used for the Root slot. * Either a string to use a HTML element or a component. @@ -278,7 +281,10 @@ Switch.propTypes /* remove-proptypes */ = { * The size of the component. * @default 'md' */ - size: PropTypes.oneOf(['sm', 'md', 'lg']), + size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['sm', 'md', 'lg']), + PropTypes.string, + ]), } as any; export default Switch; diff --git a/packages/mui-lab/src/LoadingButton/LoadingButton.js b/packages/mui-lab/src/LoadingButton/LoadingButton.js index 0a7616f608c9d6..c42a19adb1988d 100644 --- a/packages/mui-lab/src/LoadingButton/LoadingButton.js +++ b/packages/mui-lab/src/LoadingButton/LoadingButton.js @@ -266,7 +266,10 @@ LoadingButton.propTypes /* remove-proptypes */ = { * The variant to use. * @default 'text' */ - variant: PropTypes.oneOf(['contained', 'outlined', 'text']), + variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['contained', 'outlined', 'text']), + PropTypes.string, + ]), }; export default LoadingButton; diff --git a/packages/mui-material/src/ImageList/ImageList.js b/packages/mui-material/src/ImageList/ImageList.js index ce21f4c7f53f45..2a4f1e9e956c33 100644 --- a/packages/mui-material/src/ImageList/ImageList.js +++ b/packages/mui-material/src/ImageList/ImageList.js @@ -153,7 +153,10 @@ ImageList.propTypes /* remove-proptypes */ = { * The variant to use. * @default 'standard' */ - variant: PropTypes.oneOf(['masonry', 'quilted', 'standard', 'woven']), + variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['masonry', 'quilted', 'standard', 'woven']), + PropTypes.string, + ]), }; export default ImageList; diff --git a/packages/mui-material/src/Slider/Slider.js b/packages/mui-material/src/Slider/Slider.js index d4d0ba660d8b1a..97f2836750d135 100644 --- a/packages/mui-material/src/Slider/Slider.js +++ b/packages/mui-material/src/Slider/Slider.js @@ -716,7 +716,10 @@ Slider.propTypes /* remove-proptypes */ = { * The size of the slider. * @default 'medium' */ - size: PropTypes.oneOf(['small', 'medium']), + size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ + PropTypes.oneOf(['small', 'medium']), + PropTypes.string, + ]), /** * The granularity with which the slider can step through values. (A "discrete" slider.) * The `min` prop serves as the origin for the valid values. From f361725fe0dac6a13da08b8f6d819cfbe580b3dc Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Tue, 18 Jan 2022 10:34:20 +0100 Subject: [PATCH 2/5] prettier fix --- packages/mui-joy/src/Button/Button.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mui-joy/src/Button/Button.tsx b/packages/mui-joy/src/Button/Button.tsx index 1e25117c91b89e..396fb9ee14a82a 100644 --- a/packages/mui-joy/src/Button/Button.tsx +++ b/packages/mui-joy/src/Button/Button.tsx @@ -193,9 +193,9 @@ Button.propTypes /* remove-proptypes */ = { PropTypes.string, ]), /** - * The variant to use. - * @default 'text' - */ + * The variant to use. + * @default 'text' + */ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ PropTypes.oneOf(['contained', 'light', 'outlined', 'text']), PropTypes.string, From cb7e28a9db2ce8ac1dfdadeadb22547ed73aebc9 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Tue, 18 Jan 2022 10:41:10 +0100 Subject: [PATCH 3/5] chore: missing proptypes comment --- packages/mui-joy/src/Button/Button.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mui-joy/src/Button/Button.tsx b/packages/mui-joy/src/Button/Button.tsx index 396fb9ee14a82a..2e0161f7f08bbf 100644 --- a/packages/mui-joy/src/Button/Button.tsx +++ b/packages/mui-joy/src/Button/Button.tsx @@ -194,7 +194,7 @@ Button.propTypes /* remove-proptypes */ = { ]), /** * The variant to use. - * @default 'text' + * @default 'contained' */ variant: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ PropTypes.oneOf(['contained', 'light', 'outlined', 'text']), From c72d5c5ac3c3813f493bbe19d44d9ec7a77cf0a5 Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Tue, 18 Jan 2022 12:06:13 +0100 Subject: [PATCH 4/5] chore: docs:api --- docs/pages/api-docs/image-list.json | 4 ++-- docs/pages/api-docs/loading-button.json | 4 ++-- docs/pages/api-docs/slider.json | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/pages/api-docs/image-list.json b/docs/pages/api-docs/image-list.json index 665a8a6afc2685..a8ee1ba4bc3d69 100644 --- a/docs/pages/api-docs/image-list.json +++ b/docs/pages/api-docs/image-list.json @@ -17,8 +17,8 @@ }, "variant": { "type": { - "name": "enum", - "description": "'masonry'
| 'quilted'
| 'standard'
| 'woven'" + "name": "union", + "description": "'masonry'
| 'quilted'
| 'standard'
| 'woven'
| string" }, "default": "'standard'" } diff --git a/docs/pages/api-docs/loading-button.json b/docs/pages/api-docs/loading-button.json index 9c3703166ca093..6a581a2b3af3aa 100644 --- a/docs/pages/api-docs/loading-button.json +++ b/docs/pages/api-docs/loading-button.json @@ -23,8 +23,8 @@ }, "variant": { "type": { - "name": "enum", - "description": "'contained'
| 'outlined'
| 'text'" + "name": "union", + "description": "'contained'
| 'outlined'
| 'text'
| string" }, "default": "'text'" } diff --git a/docs/pages/api-docs/slider.json b/docs/pages/api-docs/slider.json index 73291bff59aff0..56696c13db2951 100644 --- a/docs/pages/api-docs/slider.json +++ b/docs/pages/api-docs/slider.json @@ -51,7 +51,10 @@ }, "scale": { "type": { "name": "func" }, "default": "(x) => x" }, "size": { - "type": { "name": "enum", "description": "'small'
| 'medium'" }, + "type": { + "name": "union", + "description": "'small'
| 'medium'
| string" + }, "default": "'medium'" }, "step": { "type": { "name": "number" }, "default": "1" }, From c1108f675b5dfa24a6f066ba1d76b789534e0b3e Mon Sep 17 00:00:00 2001 From: Paul Hachmang Date: Wed, 26 Jan 2022 16:33:46 +0100 Subject: [PATCH 5/5] fix: remvoe size from slider in framer motion --- framer/Material-UI.framerfx/code/Slider.tsx | 7 ------- framer/scripts/framerConfig.js | 1 + 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/framer/Material-UI.framerfx/code/Slider.tsx b/framer/Material-UI.framerfx/code/Slider.tsx index 12d51ef7562f03..0967116bb0fabf 100644 --- a/framer/Material-UI.framerfx/code/Slider.tsx +++ b/framer/Material-UI.framerfx/code/Slider.tsx @@ -8,7 +8,6 @@ interface Props { max?: number; min?: number; orientation?: 'horizontal' | 'vertical'; - size: 'small' | 'medium'; step?: number; tabIndex?: number; track?: 'inverted' | 'normal' | false; @@ -23,7 +22,6 @@ export function Slider(props: Props): JSX.Element { } Slider.defaultProps = { - size: 'medium' as 'medium', width: 160, height: 24, }; @@ -50,11 +48,6 @@ addPropertyControls(Slider, { title: 'Orientation', options: ['horizontal', 'vertical'], }, - size: { - type: ControlType.Enum, - title: 'Size', - options: ['small', 'medium'], - }, step: { type: ControlType.Number, title: 'Step', diff --git a/framer/scripts/framerConfig.js b/framer/scripts/framerConfig.js index c80bc20147e1d3..b70e90f278fb36 100644 --- a/framer/scripts/framerConfig.js +++ b/framer/scripts/framerConfig.js @@ -311,6 +311,7 @@ export const componentSettings = { 'sx', // FIXME: `Union` 'color', + 'size', ], propValues: { width: 160,