worked on GarageApp stuff
This commit is contained in:
parent
60aaf17af3
commit
eb606572b0
51919 changed files with 2168177 additions and 18 deletions
51
node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
51
node_modules/@mui/system/esm/styleFunctionSx/extendSxProp.js
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import { isPlainObject } from '@mui/utils/deepmerge';
|
||||
import defaultSxConfig from "./defaultSxConfig.js";
|
||||
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,
|
||||
...other
|
||||
} = props;
|
||||
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 {
|
||||
...systemProps,
|
||||
...result
|
||||
};
|
||||
};
|
||||
} else {
|
||||
finalSx = {
|
||||
...systemProps,
|
||||
...inSx
|
||||
};
|
||||
}
|
||||
return {
|
||||
...otherProps,
|
||||
sx: finalSx
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue