UNPKG

@engie-group/fluid-design-system-react

Version:

Fluid Design System React

21 lines (18 loc) 857 B
import { jsx } from 'react/jsx-runtime'; import React__default from 'react'; import { Utils } from '../../utils/util.js'; const Component = ({ children, as, scale, isNotInvertible = false, isMono = false, variant, className, ...htmlProps }, ref) => { const Wrapper = as ?? 'p'; const classNames = Utils.classNames('nj-text', { [`nj-text--${scale}`]: !!scale, [`nj-text--${variant}`]: !!variant, [`nj-text--not-invertible`]: isNotInvertible, [`nj-text--monospace`]: isMono }, className); return (jsx(Wrapper, { ...htmlProps, ref: ref, className: classNames, children: children })); }; /** Generic type with forwardRef * (cf. https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref) */ const NJText = React__default.forwardRef(Component); export { NJText };