8 lines
709 B
JavaScript
8 lines
709 B
JavaScript
import * as React from 'react';
|
|
export default function isMuiElement(element, muiNames) {
|
|
var _muiName, _element$type;
|
|
return /*#__PURE__*/React.isValidElement(element) && muiNames.indexOf( // For server components `muiName` is avaialble in element.type._payload.value.muiName
|
|
// relevant info - https://github.com/facebook/react/blob/2807d781a08db8e9873687fccc25c0f12b4fb3d4/packages/react/src/ReactLazy.js#L45
|
|
// eslint-disable-next-line no-underscore-dangle
|
|
(_muiName = element.type.muiName) != null ? _muiName : (_element$type = element.type) == null || (_element$type = _element$type._payload) == null || (_element$type = _element$type.value) == null ? void 0 : _element$type.muiName) !== -1;
|
|
} |