Jesus sucks
This commit is contained in:
47
backend/frontend/node_modules/@mui/system/modern/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
47
backend/frontend/node_modules/@mui/system/modern/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
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 => {
|
||||
const result = {
|
||||
systemProps: {},
|
||||
otherProps: {}
|
||||
};
|
||||
const config = props?.theme?.unstable_sxConfig ?? 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
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user