UNPKG

@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

27 lines 3.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ListRowPriority = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const type_1 = require("../../button/types/type"); const elementOrIcon_1 = require("../../elementOrIcon/elementOrIcon"); const useContent_1 = require("../hooks/useContent"); const table_styled_1 = require("../table.styled"); const listDivider_1 = require("./listDivider"); const ListRowPriority = (props) => { const { divider, dividerValue, getExpandedAria, getValue, handleShowExpandedContent, hasExpandedContentRow, showExpandedContent, rowVariant, } = (0, useContent_1.useContent)({ ...props }); return ((0, jsx_runtime_1.jsxs)(table_styled_1.ListRowContainerStyled, { hasDivider: !!dividerValue(), lineSeparatorLineStyles: props.lineSeparatorLineStyles, styles: props.styles, children: [(0, jsx_runtime_1.jsx)(listDivider_1.ListDivider, { divider: dividerValue(), dividerStyles: props.styles.divider }), (0, jsx_runtime_1.jsxs)(table_styled_1.ListRowStyled, { formatSideBySideInList: props.formatSideBySideInList, styles: props.styles, children: [props.headers .filter(headerValue => headerValue.id !== divider?.id) .map((headerValue, indexHeader) => { const hasExpandedIcon = indexHeader === 0; return ((0, jsx_runtime_1.jsxs)(table_styled_1.ListItemStyled, { "data-testid": `${props.dataTestId}-item-list-${indexHeader}`, hasSomeExpandedContent: hasExpandedIcon && props.hasSomeExpandedContent && hasExpandedContentRow, styles: props.styles, children: [hasExpandedIcon && props.hasSomeExpandedContent && (hasExpandedContentRow ? ((0, jsx_runtime_1.jsx)(table_styled_1.TableExpandedButton, { "aria-label": getExpandedAria(), styles: props.styles.bodyRows?.[rowVariant], type: type_1.ButtonType.BUTTON, onClick: () => { props.onExpandedContentOpen?.(!showExpandedContent, getValue(headerValue), indexHeader); handleShowExpandedContent(!showExpandedContent); }, children: (0, jsx_runtime_1.jsx)(elementOrIcon_1.ElementOrIcon, { customIconStyles: props.styles.bodyRows?.[rowVariant]?.accordionIcon, rotate: showExpandedContent ? '180deg' : '0deg', ...props.accordionIcon }) })) : ((0, jsx_runtime_1.jsx)(table_styled_1.ListEmptyExpandedContentItem, {}))), getValue(headerValue)] }, indexHeader)); }), hasExpandedContentRow && ((0, jsx_runtime_1.jsx)(table_styled_1.ListItemExpandedStyled, { as: 'li', showExpandedContent: showExpandedContent, styles: props.styles.bodyRows?.[rowVariant], children: showExpandedContent && props.value.expandedContent ? props.value.expandedContent[props.device] : props.expandedContentHelpMessage }))] })] })); }; exports.ListRowPriority = ListRowPriority; //# sourceMappingURL=listRowPriority.js.map