UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

39 lines (38 loc) 1.24 kB
"use client"; import React, { useContext } from 'react'; import clsx from 'clsx'; import FlexItem from "../flex/Item.js"; import { ListContext } from "./ListContext.js"; import { createSkeletonClass } from "../skeleton/SkeletonHelper.js"; import Context from "../../shared/Context.js"; import { jsx as _jsx } from "react/jsx-runtime"; function ItemOverline({ className, fontSize = 'x-small', fontWeight = 'medium', skeleton, children, ...rest }) { const context = useContext(Context); const inheritedSkeleton = useContext(ListContext)?.skeleton; const appliedSkeleton = skeleton !== null && skeleton !== void 0 ? skeleton : inheritedSkeleton; const content = _jsx(FlexItem, { className: clsx('dnb-list__item__overline', className, fontSize && `dnb-t__size--${fontSize}`, appliedSkeleton && createSkeletonClass('font', true), fontWeight === 'medium' && 'dnb-t__weight--medium'), ...rest, children: children }); if (appliedSkeleton) { return _jsx(Context, { value: { ...context, skeleton: appliedSkeleton }, children: content }); } return content; } ItemOverline._supportsSpacingProps = true; export default ItemOverline; //# sourceMappingURL=ItemOverline.js.map