diff --git a/packages/material-ui-icons/src/utils/createSvgIcon.js b/packages/material-ui-icons/src/utils/createSvgIcon.js index 21e086a3ab170f..835cefe7767391 100644 --- a/packages/material-ui-icons/src/utils/createSvgIcon.js +++ b/packages/material-ui-icons/src/utils/createSvgIcon.js @@ -1,20 +1 @@ -import React from 'react'; -import SvgIcon from '@material-ui/core/SvgIcon'; - -export default function createSvgIcon(path, displayName) { - const Component = React.memo( - React.forwardRef((props, ref) => ( - - {path} - - )), - ); - - if (process.env.NODE_ENV !== 'production') { - Component.displayName = `${displayName}Icon`; - } - - Component.muiName = SvgIcon.muiName; - - return Component; -} +export { createSvgIcon as default } from '@material-ui/core/utils'; diff --git a/packages/material-ui-lab/src/internal/svg-icons/Add.js b/packages/material-ui-lab/src/internal/svg-icons/Add.js index dc223900a21568..4655d6f7ffcc2d 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/Add.js +++ b/packages/material-ui-lab/src/internal/svg-icons/Add.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/ArrowDropDown.js b/packages/material-ui-lab/src/internal/svg-icons/ArrowDropDown.js index 6deb6bd0a37aa2..fdaa9c00cb395f 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/ArrowDropDown.js +++ b/packages/material-ui-lab/src/internal/svg-icons/ArrowDropDown.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/Close.js b/packages/material-ui-lab/src/internal/svg-icons/Close.js index 942d756074f25d..cd47ee13c9db3f 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/Close.js +++ b/packages/material-ui-lab/src/internal/svg-icons/Close.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/ErrorOutline.js b/packages/material-ui-lab/src/internal/svg-icons/ErrorOutline.js index ca178ffe959c40..b582fdc0787059 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/ErrorOutline.js +++ b/packages/material-ui-lab/src/internal/svg-icons/ErrorOutline.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/FirstPage.js b/packages/material-ui-lab/src/internal/svg-icons/FirstPage.js index 27102f886182ff..f9f936b1bb447a 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/FirstPage.js +++ b/packages/material-ui-lab/src/internal/svg-icons/FirstPage.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/InfoOutlined.js b/packages/material-ui-lab/src/internal/svg-icons/InfoOutlined.js index b5e38004bcf43d..0c3ed4e8e19cc8 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/InfoOutlined.js +++ b/packages/material-ui-lab/src/internal/svg-icons/InfoOutlined.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/LastPage.js b/packages/material-ui-lab/src/internal/svg-icons/LastPage.js index 20d190e998cb01..d8038714c1b58f 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/LastPage.js +++ b/packages/material-ui-lab/src/internal/svg-icons/LastPage.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/NavigateBefore.js b/packages/material-ui-lab/src/internal/svg-icons/NavigateBefore.js index fc4ac139f53b96..21eaa25defa4df 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/NavigateBefore.js +++ b/packages/material-ui-lab/src/internal/svg-icons/NavigateBefore.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/NavigateNext.js b/packages/material-ui-lab/src/internal/svg-icons/NavigateNext.js index b35b7d1c89753a..4c8f04062ea688 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/NavigateNext.js +++ b/packages/material-ui-lab/src/internal/svg-icons/NavigateNext.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/ReportProblemOutlined.js b/packages/material-ui-lab/src/internal/svg-icons/ReportProblemOutlined.js index b82ed0671e5734..11b860048db4bd 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/ReportProblemOutlined.js +++ b/packages/material-ui-lab/src/internal/svg-icons/ReportProblemOutlined.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/Star.js b/packages/material-ui-lab/src/internal/svg-icons/Star.js index aa033c2e0d8426..511a39c75401ad 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/Star.js +++ b/packages/material-ui-lab/src/internal/svg-icons/Star.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui-lab/src/internal/svg-icons/SuccessOutlined.js b/packages/material-ui-lab/src/internal/svg-icons/SuccessOutlined.js index 4568f218fb05dc..bac970504d94a3 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/SuccessOutlined.js +++ b/packages/material-ui-lab/src/internal/svg-icons/SuccessOutlined.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import { createSvgIcon } from '@material-ui/core/utils'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/ArrowDownward.js b/packages/material-ui/src/internal/svg-icons/ArrowDownward.js index 68800536c9a77c..627c0ffc81f911 100644 --- a/packages/material-ui/src/internal/svg-icons/ArrowDownward.js +++ b/packages/material-ui/src/internal/svg-icons/ArrowDownward.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/ArrowDropDown.js b/packages/material-ui/src/internal/svg-icons/ArrowDropDown.js index 6deb6bd0a37aa2..2c6a702fc7ccf8 100644 --- a/packages/material-ui/src/internal/svg-icons/ArrowDropDown.js +++ b/packages/material-ui/src/internal/svg-icons/ArrowDropDown.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/Cancel.js b/packages/material-ui/src/internal/svg-icons/Cancel.js index 494617a88e5a18..c108adf4d6ab0e 100644 --- a/packages/material-ui/src/internal/svg-icons/Cancel.js +++ b/packages/material-ui/src/internal/svg-icons/Cancel.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/CheckBox.js b/packages/material-ui/src/internal/svg-icons/CheckBox.js index 3e7f5f58e73b91..8ad1bf344664b4 100644 --- a/packages/material-ui/src/internal/svg-icons/CheckBox.js +++ b/packages/material-ui/src/internal/svg-icons/CheckBox.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/CheckBoxOutlineBlank.js b/packages/material-ui/src/internal/svg-icons/CheckBoxOutlineBlank.js index bc8f424eec52a7..787cf408fc20a7 100644 --- a/packages/material-ui/src/internal/svg-icons/CheckBoxOutlineBlank.js +++ b/packages/material-ui/src/internal/svg-icons/CheckBoxOutlineBlank.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/CheckCircle.js b/packages/material-ui/src/internal/svg-icons/CheckCircle.js index 61c2cb61bbc28d..9368897aa24b30 100644 --- a/packages/material-ui/src/internal/svg-icons/CheckCircle.js +++ b/packages/material-ui/src/internal/svg-icons/CheckCircle.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/Close.js b/packages/material-ui/src/internal/svg-icons/Close.js index 942d756074f25d..a4459a8af1e117 100644 --- a/packages/material-ui/src/internal/svg-icons/Close.js +++ b/packages/material-ui/src/internal/svg-icons/Close.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/IndeterminateCheckBox.js b/packages/material-ui/src/internal/svg-icons/IndeterminateCheckBox.js index 7f68a2acbf4026..fa7ac9b644d19f 100644 --- a/packages/material-ui/src/internal/svg-icons/IndeterminateCheckBox.js +++ b/packages/material-ui/src/internal/svg-icons/IndeterminateCheckBox.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/KeyboardArrowLeft.js b/packages/material-ui/src/internal/svg-icons/KeyboardArrowLeft.js index 250b3f26376f4e..fbb4c9889df4b7 100644 --- a/packages/material-ui/src/internal/svg-icons/KeyboardArrowLeft.js +++ b/packages/material-ui/src/internal/svg-icons/KeyboardArrowLeft.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/KeyboardArrowRight.js b/packages/material-ui/src/internal/svg-icons/KeyboardArrowRight.js index dd661fc0adeb10..10737eb426bef0 100644 --- a/packages/material-ui/src/internal/svg-icons/KeyboardArrowRight.js +++ b/packages/material-ui/src/internal/svg-icons/KeyboardArrowRight.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/MoreHoriz.js b/packages/material-ui/src/internal/svg-icons/MoreHoriz.js index 42d76208275e9a..a2a9e61a9f8407 100644 --- a/packages/material-ui/src/internal/svg-icons/MoreHoriz.js +++ b/packages/material-ui/src/internal/svg-icons/MoreHoriz.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/Person.js b/packages/material-ui/src/internal/svg-icons/Person.js index a75080a35ac24d..ade5e396968bbf 100644 --- a/packages/material-ui/src/internal/svg-icons/Person.js +++ b/packages/material-ui/src/internal/svg-icons/Person.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/RadioButtonChecked.js b/packages/material-ui/src/internal/svg-icons/RadioButtonChecked.js index 6bb3ece001e588..c03337872b7bed 100644 --- a/packages/material-ui/src/internal/svg-icons/RadioButtonChecked.js +++ b/packages/material-ui/src/internal/svg-icons/RadioButtonChecked.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/RadioButtonUnchecked.js b/packages/material-ui/src/internal/svg-icons/RadioButtonUnchecked.js index 1f2b5745926628..780034ab5db976 100644 --- a/packages/material-ui/src/internal/svg-icons/RadioButtonUnchecked.js +++ b/packages/material-ui/src/internal/svg-icons/RadioButtonUnchecked.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/Warning.js b/packages/material-ui/src/internal/svg-icons/Warning.js index 2a5105aa8ab3f4..eccf1c6cae247f 100644 --- a/packages/material-ui/src/internal/svg-icons/Warning.js +++ b/packages/material-ui/src/internal/svg-icons/Warning.js @@ -1,5 +1,5 @@ import * as React from 'react'; -import createSvgIcon from './createSvgIcon'; +import createSvgIcon from '../../utils/createSvgIcon'; /** * @ignore - internal component. diff --git a/packages/material-ui/src/internal/svg-icons/createSvgIcon.js b/packages/material-ui/src/internal/svg-icons/createSvgIcon.js deleted file mode 100644 index adee28002f0b3d..00000000000000 --- a/packages/material-ui/src/internal/svg-icons/createSvgIcon.js +++ /dev/null @@ -1,20 +0,0 @@ -import * as React from 'react'; -import SvgIcon from '../../SvgIcon'; - -export default function createSvgIcon(path, displayName) { - const Component = React.memo( - React.forwardRef((props, ref) => ( - - {path} - - )), - ); - - if (process.env.NODE_ENV !== 'production') { - Component.displayName = `${displayName}Icon`; - } - - Component.muiName = SvgIcon.muiName; - - return Component; -} diff --git a/packages/material-ui-icons/src/utils/createSvgIcon.d.ts b/packages/material-ui/src/utils/createSvgIcon.d.ts similarity index 100% rename from packages/material-ui-icons/src/utils/createSvgIcon.d.ts rename to packages/material-ui/src/utils/createSvgIcon.d.ts diff --git a/packages/material-ui-lab/src/internal/svg-icons/createSvgIcon.js b/packages/material-ui/src/utils/createSvgIcon.js similarity index 76% rename from packages/material-ui-lab/src/internal/svg-icons/createSvgIcon.js rename to packages/material-ui/src/utils/createSvgIcon.js index e98c7442ea6d6b..b6bd06e520c03f 100644 --- a/packages/material-ui-lab/src/internal/svg-icons/createSvgIcon.js +++ b/packages/material-ui/src/utils/createSvgIcon.js @@ -1,6 +1,9 @@ -import * as React from 'react'; -import SvgIcon from '@material-ui/core/SvgIcon'; +import React from 'react'; +import SvgIcon from '../SvgIcon'; +/** + * Private module reserved for @material-ui/x packages. + */ export default function createSvgIcon(path, displayName) { const Component = React.memo( React.forwardRef((props, ref) => ( diff --git a/packages/material-ui/src/utils/index.js b/packages/material-ui/src/utils/index.js index 3bd4e09f1e476a..a8dbc9203cf0da 100644 --- a/packages/material-ui/src/utils/index.js +++ b/packages/material-ui/src/utils/index.js @@ -1,12 +1,13 @@ export { default as capitalize } from './capitalize'; export { default as deprecatedPropType } from './deprecatedPropType'; export { default as isMuiElement } from './isMuiElement'; +export { default as createSvgIcon } from './createSvgIcon'; export { default as ownerDocument } from './ownerDocument'; export { default as ownerWindow } from './ownerWindow'; export { default as requirePropFactory } from './requirePropFactory'; export { default as setRef } from './setRef'; export { default as unsupportedProp } from './unsupportedProp'; +export { default as useControlled } from './useControlled'; export { default as useEventCallback } from './useEventCallback'; export { default as useForkRef } from './useForkRef'; -export { default as useControlled } from './useControlled'; export { useIsFocusVisible } from './focusVisible';