UNPKG

@navinc/base-react-components

Version:
9 lines 542 B
import { jsx as _jsx } from "react/jsx-runtime"; import { forwardRef } from 'react'; import { cn } from './cn.js'; import { styledBackwardsCompatibility } from './styled-backwards-compatibility.js'; export const addClassNameTo = (Component, className, defaultProps) => { const AnyComponent = Component; return styledBackwardsCompatibility(forwardRef((props, ref) => (_jsx(AnyComponent, Object.assign({ ref: ref }, defaultProps, props, { className: cn(className, props.className) }))))); }; //# sourceMappingURL=add-classname-to.js.map