Spaces:
Sleeping
Sleeping
pythonic-rag-FastAPIReact / frontend /node_modules /@mui /system /esm /styleFunctionSx /extendSxProp.js
Download frontend/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js from sepidnes/pythonic-rag-FastAPIReact: direct link, hf CLI and curl.
- Browser
- Download file 1.47 kB
-
https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/system/esm/styleFunctionSx/extendSxProp.js
- Command line
-
hf download hf://spaces/sepidnes/pythonic-rag-FastAPIReact@56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js
-
curl -L -o extendSxProp.js https://huggingface.co/spaces/sepidnes/pythonic-rag-FastAPIReact/resolve/56fda741e84da791ee2e6198479f1d5630989f6c/frontend/node_modules/%40mui/system/esm/styleFunctionSx/extendSxProp.js
1.47 kB
| import _extends from "@babel/runtime/helpers/esm/extends"; | |
| import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; | |
| const _excluded = ["sx"]; | |
| import { isPlainObject } from '@mui/utils/deepmerge'; | |
| import defaultSxConfig from './defaultSxConfig'; | |
| const splitProps = props => { | |
| var _props$theme$unstable, _props$theme; | |
| const result = { | |
| systemProps: {}, | |
| otherProps: {} | |
| }; | |
| const config = (_props$theme$unstable = props == null || (_props$theme = props.theme) == null ? void 0 : _props$theme.unstable_sxConfig) != null ? _props$theme$unstable : defaultSxConfig; | |
| Object.keys(props).forEach(prop => { | |
| if (config[prop]) { | |
| result.systemProps[prop] = props[prop]; | |
| } else { | |
| result.otherProps[prop] = props[prop]; | |
| } | |
| }); | |
| return result; | |
| }; | |
| export default function extendSxProp(props) { | |
| const { | |
| sx: inSx | |
| } = props, | |
| other = _objectWithoutPropertiesLoose(props, _excluded); | |
| const { | |
| systemProps, | |
| otherProps | |
| } = splitProps(other); | |
| let finalSx; | |
| if (Array.isArray(inSx)) { | |
| finalSx = [systemProps, ...inSx]; | |
| } else if (typeof inSx === 'function') { | |
| finalSx = (...args) => { | |
| const result = inSx(...args); | |
| if (!isPlainObject(result)) { | |
| return systemProps; | |
| } | |
| return _extends({}, systemProps, result); | |
| }; | |
| } else { | |
| finalSx = _extends({}, systemProps, inSx); | |
| } | |
| return _extends({}, otherProps, { | |
| sx: finalSx | |
| }); | |
| } |