@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
53 lines • 1.48 kB
JavaScript
import React from 'react';
import clsx from 'clsx';
import { removeUndefinedProps } from "../../../../shared/component-helper.js";
import SummaryListContext from "./SummaryListContext.js";
import Dl from "../../../../elements/Dl.js";
import ValueProvider from "../Provider/ValueProvider.js";
import { useVerifyChildren } from "./useVerifyChildren.js";
import withComponentMarkers from "../../../../shared/helpers/withComponentMarkers.js";
import { jsx as _jsx } from "react/jsx-runtime";
function SummaryList(props) {
const {
className,
children,
layout = 'vertical',
transformLabel,
inheritVisibility,
inheritLabel,
...rest
} = props;
const valueProviderProps = removeUndefinedProps({
transformLabel,
inheritVisibility,
inheritLabel
});
const {
verifyChild
} = useVerifyChildren({
children,
message: 'Value.SummaryList accepts only Value.* components!',
messageInfo: props,
ignoreTypes: ['Visibility', 'ValueBlock', 'CompositionValue']
});
return _jsx(SummaryListContext, {
value: {
layout,
verifyChild
},
children: _jsx(Dl, {
className: clsx('dnb-forms-summary-list', className),
layout: layout,
...rest,
children: _jsx(ValueProvider, {
...valueProviderProps,
children: children
})
})
});
}
withComponentMarkers(SummaryList, {
_supportsSpacingProps: true
});
export default SummaryList;
//# sourceMappingURL=SummaryList.js.map