Spaces:
Sleeping
Sleeping
pythonic-rag-FastAPIReact / frontend /node_modules /@mui /utils /legacy /elementAcceptingRef /elementAcceptingRef.js
Download frontend/node_modules/@mui/utils/legacy/elementAcceptingRef/elementAcceptingRef.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/utils/legacy/elementAcceptingRef/elementAcceptingRef.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/@mui/utils/legacy/elementAcceptingRef/elementAcceptingRef.js
-
curl -L -o elementAcceptingRef.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/utils/legacy/elementAcceptingRef/elementAcceptingRef.js
1.91 kB
| import PropTypes from 'prop-types'; | |
| import chainPropTypes from '../chainPropTypes'; | |
| function isClassComponent(elementType) { | |
| // elementType.prototype?.isReactComponent | |
| var _elementType$prototyp = elementType.prototype, | |
| prototype = _elementType$prototyp === void 0 ? {} : _elementType$prototyp; | |
| return Boolean(prototype.isReactComponent); | |
| } | |
| function acceptingRef(props, propName, componentName, location, propFullName) { | |
| var element = props[propName]; | |
| var safePropName = propFullName || propName; | |
| if (element == null || | |
| // When server-side rendering React doesn't warn either. | |
| // This is not an accurate check for SSR. | |
| // This is only in place for Emotion compat. | |
| // TODO: Revisit once https://github.com/facebook/react/issues/20047 is resolved. | |
| typeof window === 'undefined') { | |
| return null; | |
| } | |
| var warningHint; | |
| var elementType = element.type; | |
| /** | |
| * Blacklisting instead of whitelisting | |
| * | |
| * Blacklisting will miss some components, such as React.Fragment. Those will at least | |
| * trigger a warning in React. | |
| * We can't whitelist because there is no safe way to detect React.forwardRef | |
| * or class components. "Safe" means there's no public API. | |
| * | |
| */ | |
| if (typeof elementType === 'function' && !isClassComponent(elementType)) { | |
| warningHint = 'Did you accidentally use a plain function component for an element instead?'; | |
| } | |
| if (warningHint !== undefined) { | |
| return new Error("Invalid ".concat(location, " `").concat(safePropName, "` supplied to `").concat(componentName, "`. ") + "Expected an element that can hold a ref. ".concat(warningHint, " ") + 'For more information see https://mui.com/r/caveat-with-refs-guide'); | |
| } | |
| return null; | |
| } | |
| var elementAcceptingRef = chainPropTypes(PropTypes.element, acceptingRef); | |
| elementAcceptingRef.isRequired = chainPropTypes(PropTypes.element.isRequired, acceptingRef); | |
| export default elementAcceptingRef; |