@kubit-ui-web/react-components
Version:
Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience
23 lines • 2.76 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { ButtonType } from '../../button/types/type';
import { ElementOrIcon } from '../../elementOrIcon/elementOrIcon';
import { useContent } from '../hooks/useContent';
import { ListEmptyExpandedContentItem, ListItemExpandedStyled, ListItemStyled, ListRowContainerStyled, ListRowStyled, TableExpandedButton, } from '../table.styled';
import { ListDivider } from './listDivider';
export const ListRowPriority = (props) => {
const { divider, dividerValue, getExpandedAria, getValue, handleShowExpandedContent, hasExpandedContentRow, showExpandedContent, rowVariant, } = useContent({ ...props });
return (_jsxs(ListRowContainerStyled, { hasDivider: !!dividerValue(), lineSeparatorLineStyles: props.lineSeparatorLineStyles, styles: props.styles, children: [_jsx(ListDivider, { divider: dividerValue(), dividerStyles: props.styles.divider }), _jsxs(ListRowStyled, { formatSideBySideInList: props.formatSideBySideInList, styles: props.styles, children: [props.headers
.filter(headerValue => headerValue.id !== divider?.id)
.map((headerValue, indexHeader) => {
const hasExpandedIcon = indexHeader === 0;
return (_jsxs(ListItemStyled, { "data-testid": `${props.dataTestId}-item-list-${indexHeader}`, hasSomeExpandedContent: hasExpandedIcon && props.hasSomeExpandedContent && hasExpandedContentRow, styles: props.styles, children: [hasExpandedIcon &&
props.hasSomeExpandedContent &&
(hasExpandedContentRow ? (_jsx(TableExpandedButton, { "aria-label": getExpandedAria(), styles: props.styles.bodyRows?.[rowVariant], type: ButtonType.BUTTON, onClick: () => {
props.onExpandedContentOpen?.(!showExpandedContent, getValue(headerValue), indexHeader);
handleShowExpandedContent(!showExpandedContent);
}, children: _jsx(ElementOrIcon, { customIconStyles: props.styles.bodyRows?.[rowVariant]?.accordionIcon, rotate: showExpandedContent ? '180deg' : '0deg', ...props.accordionIcon }) })) : (_jsx(ListEmptyExpandedContentItem, {}))), getValue(headerValue)] }, indexHeader));
}), hasExpandedContentRow && (_jsx(ListItemExpandedStyled, { as: 'li', showExpandedContent: showExpandedContent, styles: props.styles.bodyRows?.[rowVariant], children: showExpandedContent && props.value.expandedContent
? props.value.expandedContent[props.device]
: props.expandedContentHelpMessage }))] })] }));
};
//# sourceMappingURL=listRowPriority.js.map