paradiego
This commit is contained in:
5
node_modules/@mui/system/compose/compose.d.ts
generated
vendored
Normal file
5
node_modules/@mui/system/compose/compose.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { ComposedStyleFunction, StyleFunction } from '../Box';
|
||||
|
||||
export default function compose<T extends Array<StyleFunction<any>>>(
|
||||
...args: T
|
||||
): ComposedStyleFunction<T>;
|
||||
24
node_modules/@mui/system/compose/compose.js
generated
vendored
Normal file
24
node_modules/@mui/system/compose/compose.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import merge from "../merge/index.js";
|
||||
function compose(...styles) {
|
||||
const handlers = styles.reduce((acc, style) => {
|
||||
style.filterProps.forEach(prop => {
|
||||
acc[prop] = style;
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
// false positive
|
||||
// eslint-disable-next-line react/function-component-definition
|
||||
const fn = props => {
|
||||
return Object.keys(props).reduce((acc, prop) => {
|
||||
if (handlers[prop]) {
|
||||
return merge(acc, handlers[prop](props));
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
fn.propTypes = process.env.NODE_ENV !== 'production' ? styles.reduce((acc, style) => Object.assign(acc, style.propTypes), {}) : {};
|
||||
fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []);
|
||||
return fn;
|
||||
}
|
||||
export default compose;
|
||||
1
node_modules/@mui/system/compose/index.d.ts
generated
vendored
Normal file
1
node_modules/@mui/system/compose/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from './compose';
|
||||
1
node_modules/@mui/system/compose/index.js
generated
vendored
Normal file
1
node_modules/@mui/system/compose/index.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export { default } from "./compose.js";
|
||||
6
node_modules/@mui/system/compose/package.json
generated
vendored
Normal file
6
node_modules/@mui/system/compose/package.json
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"sideEffects": false,
|
||||
"module": "./index.js",
|
||||
"main": "../node/compose/index.js",
|
||||
"types": "./index.d.ts"
|
||||
}
|
||||
Reference in New Issue
Block a user