From 088666173b750e1d1b2f4acdefc46904f11c6dd8 Mon Sep 17 00:00:00 2001 From: BreakBB Date: Wed, 11 Oct 2023 08:41:17 +0200 Subject: [PATCH 1/3] Add 'error', 'info', 'success', 'warning' as allowed values for color-prop --- packages/mui-material/src/AppBar/AppBar.d.ts | 2 +- packages/mui-material/src/AppBar/AppBar.js | 2 +- packages/mui-material/src/AppBar/AppBar.spec.tsx | 11 +++++++++++ packages/mui-material/src/AppBar/appBarClasses.ts | 12 ++++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/packages/mui-material/src/AppBar/AppBar.d.ts b/packages/mui-material/src/AppBar/AppBar.d.ts index 63ddf41f938249..cc04030317c434 100644 --- a/packages/mui-material/src/AppBar/AppBar.d.ts +++ b/packages/mui-material/src/AppBar/AppBar.d.ts @@ -19,7 +19,7 @@ export interface AppBarOwnProps { * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors). * @default 'primary' */ - color?: OverridableStringUnion; + color?: OverridableStringUnion; /** * If true, the `color` prop is applied in dark mode. * @default false diff --git a/packages/mui-material/src/AppBar/AppBar.js b/packages/mui-material/src/AppBar/AppBar.js index 155db817253e76..ee57217226f6bf 100644 --- a/packages/mui-material/src/AppBar/AppBar.js +++ b/packages/mui-material/src/AppBar/AppBar.js @@ -199,7 +199,7 @@ AppBar.propTypes /* remove-proptypes */ = { * @default 'primary' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent']), + PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string, ]), /** diff --git a/packages/mui-material/src/AppBar/AppBar.spec.tsx b/packages/mui-material/src/AppBar/AppBar.spec.tsx index aab2a964510a0c..ea270a89439dd3 100644 --- a/packages/mui-material/src/AppBar/AppBar.spec.tsx +++ b/packages/mui-material/src/AppBar/AppBar.spec.tsx @@ -26,3 +26,14 @@ function AppBarTest() { ); } + +// `color` +; +; +; +; +; +; +; +; +; diff --git a/packages/mui-material/src/AppBar/appBarClasses.ts b/packages/mui-material/src/AppBar/appBarClasses.ts index 95a4a82a5eefff..63913c28da09a6 100644 --- a/packages/mui-material/src/AppBar/appBarClasses.ts +++ b/packages/mui-material/src/AppBar/appBarClasses.ts @@ -24,6 +24,14 @@ export interface AppBarClasses { colorInherit: string; /** Styles applied to the root element if `color="transparent"`. */ colorTransparent: string; + /** Styles applied to the root element if `color="error"`. */ + colorError: string; + /** Styles applied to the root element if `color="info"`. */ + colorInfo: string; + /** Styles applied to the root element if `color="success"`. */ + colorSuccess: string; + /** Styles applied to the root element if `color="warning"`. */ + colorWarning: string; } export type AppBarClassKey = keyof AppBarClasses; @@ -44,6 +52,10 @@ const appBarClasses: AppBarClasses = generateUtilityClasses('MuiAppBar', [ 'colorSecondary', 'colorInherit', 'colorTransparent', + 'colorError', + 'colorInfo', + 'colorSuccess', + 'colorWarning', ]); export default appBarClasses; From 711bcb324d6bb8109ebd8a9a07c7775fdc875933 Mon Sep 17 00:00:00 2001 From: BreakBB Date: Wed, 11 Oct 2023 08:41:30 +0200 Subject: [PATCH 2/3] Update docs for new color-prop values --- docs/pages/material-ui/api/app-bar.json | 8 ++++++-- .../api-docs/app-bar/app-bar.json | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/docs/pages/material-ui/api/app-bar.json b/docs/pages/material-ui/api/app-bar.json index 7dda5775e44d32..f38c5b829a18b9 100644 --- a/docs/pages/material-ui/api/app-bar.json +++ b/docs/pages/material-ui/api/app-bar.json @@ -5,7 +5,7 @@ "color": { "type": { "name": "union", - "description": "'default'
| 'inherit'
| 'primary'
| 'secondary'
| 'transparent'
| string" + "description": "'default'
| 'inherit'
| 'primary'
| 'secondary'
| 'transparent'
| 'error'
| 'info'
| 'success'
| 'warning'
| string" }, "default": "'primary'" }, @@ -42,7 +42,11 @@ "colorPrimary", "colorSecondary", "colorInherit", - "colorTransparent" + "colorTransparent", + "colorError", + "colorInfo", + "colorSuccess", + "colorWarning" ], "globalClasses": {}, "name": "MuiAppBar" diff --git a/docs/translations/api-docs/app-bar/app-bar.json b/docs/translations/api-docs/app-bar/app-bar.json index 1ad00c58625615..32d2ff8e1f4eda 100644 --- a/docs/translations/api-docs/app-bar/app-bar.json +++ b/docs/translations/api-docs/app-bar/app-bar.json @@ -67,6 +67,26 @@ "description": "Styles applied to {{nodeName}} if {{conditions}}.", "nodeName": "the root element", "conditions": "color=\"transparent\"" + }, + "colorError": { + "description": "Styles applied to {{nodeName}} if {{conditions}}.", + "nodeName": "the root element", + "conditions": "color=\"error\"" + }, + "colorInfo": { + "description": "Styles applied to {{nodeName}} if {{conditions}}.", + "nodeName": "the root element", + "conditions": "color=\"info\"" + }, + "colorSuccess": { + "description": "Styles applied to {{nodeName}} if {{conditions}}.", + "nodeName": "the root element", + "conditions": "color=\"success\"" + }, + "colorWarning": { + "description": "Styles applied to {{nodeName}} if {{conditions}}.", + "nodeName": "the root element", + "conditions": "color=\"warning\"" } } } From aa9daaca8516bfb4febbfcf0cef1ec7f8622a444 Mon Sep 17 00:00:00 2001 From: BreakBB Date: Wed, 11 Oct 2023 08:42:33 +0200 Subject: [PATCH 3/3] Run prettier --- packages/mui-material/src/AppBar/AppBar.d.ts | 5 ++++- packages/mui-material/src/AppBar/AppBar.js | 12 +++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/mui-material/src/AppBar/AppBar.d.ts b/packages/mui-material/src/AppBar/AppBar.d.ts index cc04030317c434..db9f4c75fbcee9 100644 --- a/packages/mui-material/src/AppBar/AppBar.d.ts +++ b/packages/mui-material/src/AppBar/AppBar.d.ts @@ -19,7 +19,10 @@ export interface AppBarOwnProps { * [palette customization guide](https://mui.com/material-ui/customization/palette/#custom-colors). * @default 'primary' */ - color?: OverridableStringUnion; + color?: OverridableStringUnion< + PropTypes.Color | 'transparent' | 'error' | 'info' | 'success' | 'warning', + AppBarPropsColorOverrides + >; /** * If true, the `color` prop is applied in dark mode. * @default false diff --git a/packages/mui-material/src/AppBar/AppBar.js b/packages/mui-material/src/AppBar/AppBar.js index ee57217226f6bf..e3df0d192b00ab 100644 --- a/packages/mui-material/src/AppBar/AppBar.js +++ b/packages/mui-material/src/AppBar/AppBar.js @@ -199,7 +199,17 @@ AppBar.propTypes /* remove-proptypes */ = { * @default 'primary' */ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([ - PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), + PropTypes.oneOf([ + 'default', + 'inherit', + 'primary', + 'secondary', + 'transparent', + 'error', + 'info', + 'success', + 'warning', + ]), PropTypes.string, ]), /**