Buckets:
| ; | |
| var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; | |
| Object.defineProperty(exports, "__esModule", { | |
| value: true | |
| }); | |
| exports.default = extendSxProp; | |
| var _deepmerge = require("@mui/utils/deepmerge"); | |
| var _defaultSxConfig = _interopRequireDefault(require("./defaultSxConfig")); | |
| const splitProps = props => { | |
| const result = { | |
| systemProps: {}, | |
| otherProps: {} | |
| }; | |
| const config = props?.theme?.unstable_sxConfig ?? _defaultSxConfig.default; | |
| Object.keys(props).forEach(prop => { | |
| if (config[prop]) { | |
| result.systemProps[prop] = props[prop]; | |
| } else { | |
| result.otherProps[prop] = props[prop]; | |
| } | |
| }); | |
| return result; | |
| }; | |
| 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 (!(0, _deepmerge.isPlainObject)(result)) { | |
| return systemProps; | |
| } | |
| return { | |
| ...systemProps, | |
| ...result | |
| }; | |
| }; | |
| } else { | |
| finalSx = { | |
| ...systemProps, | |
| ...inSx | |
| }; | |
| } | |
| return { | |
| ...otherProps, | |
| sx: finalSx | |
| }; | |
| } |
Xet Storage Details
- Size:
- 1.33 kB
- Xet hash:
- 4a9b34d7e9874e6c695e091fb91001fcee08753f1a7c54da0cf09297d73a6e14
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.