UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

47 lines 1.39 kB
import _extends from "@babel/runtime-corejs3/helpers/esm/extends"; import React from 'react'; import classnames from 'classnames'; import { warn } from "../../shared/component-helper.js"; import StatValueContext from "./StatValueContext.js"; import StatRootContext from "./StatRootContext.js"; import { TextInternal as Text } from "./Text.js"; 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: variantProp = 'subtle', skeleton = null, ...rest } = props; let variant = variantProp; if (variant === 'default') { warn('Stat.Info variant="default" is deprecated. Use variant="plain" instead.'); variant = 'plain'; } if (!inRoot) { warn('Stat.Info should be used inside Stat.Root'); } return React.createElement(Text, _extends({}, rest, { id: id, element: Element, className: classnames(`dnb-stat dnb-stat__info dnb-stat__info--${variant}`, className), style: style, skeleton: skeleton, textClassName: false }), React.createElement(StatValueContext.Provider, { value: infoContextValue }, children)); } Info._supportsSpacingProps = true; export default Info; //# sourceMappingURL=Info.js.map