UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

45 lines 1.16 kB
import React from 'react'; import clsx from 'clsx'; import { warn } from "../../shared/component-helper.js"; import StatValueContext from "./StatValueContext.js"; import StatRootContext from "./StatRootContext.js"; import { TextInternal as Text } from "./Text.js"; import { jsx as _jsx } from "react/jsx-runtime"; const infoContextValue = { useBasisSize: true, defaultMainWeight: 'regular' }; function Info(props) { const { inRoot } = React.useContext(StatRootContext); const { children, id = null, element: Element = 'span', className = null, style = null, variant = 'subtle', skeleton = null, ...rest } = props; if (!inRoot) { warn('Stat.Info should be used inside Stat.Root'); } return _jsx(Text, { ...rest, id: id, element: Element, className: clsx(`dnb-stat dnb-stat__info dnb-stat__info--${variant}`, className), style: style, skeleton: skeleton, textClassName: false, children: _jsx(StatValueContext, { value: infoContextValue, children: children }) }); } Info._supportsSpacingProps = true; export default Info; //# sourceMappingURL=Info.js.map