Files
wdi-dashboard/node_modules/@chakra-ui/theme-utils/dist/chunk-PE3QADR6.mjs
2024-08-16 15:06:52 +05:30

34 lines
816 B
JavaScript

import {
withDefaultColorScheme
} from "./chunk-7FV6Z5GW.mjs";
import {
withDefaultSize
} from "./chunk-5IM46G4H.mjs";
import {
withDefaultVariant
} from "./chunk-5UFXUR4J.mjs";
import {
mergeThemeOverride
} from "./chunk-LIR5QAZY.mjs";
// src/theme-extensions/with-default-props.ts
function pipe(...fns) {
return (v) => fns.reduce((a, b) => b(a), v);
}
function withDefaultProps({
defaultProps: { colorScheme, variant, size },
components
}) {
const identity = (t) => t;
const fns = [
colorScheme ? withDefaultColorScheme({ colorScheme, components }) : identity,
size ? withDefaultSize({ size, components }) : identity,
variant ? withDefaultVariant({ variant, components }) : identity
];
return (theme) => mergeThemeOverride(pipe(...fns)(theme));
}
export {
withDefaultProps
};