@engie-group/fluid-design-system-react
Version:
Fluid Design System React
21 lines (18 loc) • 920 B
JavaScript
import { jsx } from 'react/jsx-runtime';
import { SEMANTIC_BY_SCALE } from '../../packages/types/dist/index.js';
import React__default from 'react';
import { Utils } from '../../utils/util.js';
const Component = ({ children, as, scale, isNotInvertible = false, variant, className, ...htmlProps }, ref) => {
const Wrapper = as ?? SEMANTIC_BY_SCALE[scale ?? 'lg'];
const classNames = Utils.classNames('nj-heading', {
[`nj-heading--${scale}`]: !!scale,
[`nj-heading--${variant}`]: !!variant,
[`nj-heading--not-invertible`]: isNotInvertible
}, 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 NJHeading = React__default.forwardRef(Component);
export { NJHeading };