UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

38 lines (37 loc) 1.44 kB
"use client"; import _extends from "@babel/runtime-corejs3/helpers/esm/extends"; import React, { useContext } from 'react'; import classnames from 'classnames'; import FlexItem from "../flex/Item.js"; import { ListContext } from "./ListContext.js"; import { createSkeletonClass } from "../skeleton/SkeletonHelper.js"; import Context from "../../shared/Context.js"; function ItemSubline({ className, variant, fontSize = 'small', fontWeight = 'regular', skeleton, children, ...rest }) { var _useContext; const context = useContext(Context); const inheritedSkeleton = (_useContext = useContext(ListContext)) === null || _useContext === void 0 ? void 0 : _useContext.skeleton; const appliedSkeleton = skeleton !== null && skeleton !== void 0 ? skeleton : inheritedSkeleton; const content = React.createElement(FlexItem, _extends({ className: classnames('dnb-list__item__subline', className, variant && `dnb-list__item__subline--${variant}`, fontSize && `dnb-t__size--${fontSize}`, appliedSkeleton && createSkeletonClass('font', true), fontWeight === 'medium' && 'dnb-t__weight--medium') }, rest), children); if (appliedSkeleton) { return React.createElement(Context.Provider, { value: { ...context, skeleton: appliedSkeleton } }, content); } return content; } ItemSubline._supportsSpacingProps = true; export default ItemSubline; //# sourceMappingURL=ItemSubline.js.map