@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
31 lines (30 loc) • 839 B
JavaScript
"use client";
import { createContext, useContext } from 'react';
import { clsx } from 'clsx';
import Typography from "./Typography.js";
import withComponentMarkers from "../../shared/helpers/withComponentMarkers.js";
import { jsx as _jsx } from "react/jsx-runtime";
function P(props) {
const {
element = 'p',
className,
...rest
} = props;
const paragraphContext = useContext(ParagraphContext);
return _jsx(ParagraphContext, {
value: {
isNested: true
},
children: _jsx(Typography, {
element: element === 'p' && paragraphContext?.isNested ? 'span' : element,
className: clsx('dnb-p', className),
...rest
})
});
}
withComponentMarkers(P, {
_supportsSpacingProps: true
});
export default P;
export const ParagraphContext = createContext(undefined);
//# sourceMappingURL=P.js.map