@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
21 lines • 2.84 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from 'react';
import { Text } from '../../components/text/text';
import { TextComponentType } from '../../components/text/types/component';
import { ElementOrIcon } from '../elementOrIcon/elementOrIcon';
import { BodyStyled, ContainerStyled, HeaderStyled, HeaderTitleIconStyled, LeftIconWrapper, RightIconWrapper, TitleWrapper, } from './summaryDetails.styled';
const SummaryDetailsStandAloneComponent = ({ dataTestId = 'summary-details', rotateOpenIcon = '180deg', hasLineSeparator = true, ...props }, ref) => {
const leftIcon = props.open && props.leftOpenIcon ? props.leftOpenIcon : props.leftIcon;
const rightIcon = props.open && props.openIcon ? props.openIcon : props.icon;
const leftIconStyles = props.open ? props.styles.leftOpenIcon : props.styles.leftClosedIcon;
const rightIconStyles = props.open ? props.styles.rightOpenIcon : props.styles.rightClosedIcon;
const leftRotateOpen = props.leftOpenIcon ? '0deg' : rotateOpenIcon;
const rightRotateOpen = props.openIcon ? '0deg' : rotateOpenIcon;
return (_jsxs(ContainerStyled, { ref: ref, "data-testid": dataTestId, open: props.open, styles: props.styles, onClick: props.onClick, children: [_jsxs(HeaderStyled, { "$isOpen": props.open, "data-testid": `${dataTestId}-summary`, hasLineSeparator: hasLineSeparator, lineSeparatorLineStyles: props.lineSeparatorLineStyles, styles: props.styles, children: [_jsxs(HeaderTitleIconStyled, { as: props.title.component, styles: props.styles, children: [leftIcon && (_jsx(LeftIconWrapper, { styles: props.styles, children: _jsx(ElementOrIcon, { customIconStyles: leftIconStyles, rotate: props.styles.leftIconContainer?.allowRotate && props.open
? leftRotateOpen
: '0deg', ...leftIcon }) })), _jsx(TitleWrapper, { styles: props.styles, children: _jsx(Text, { customTypography: props.styles.title, ...props.title, component: TextComponentType.SPAN, children: props.title.content }) }), rightIcon && (_jsx(RightIconWrapper, { styles: props.styles, children: _jsx(ElementOrIcon, { customIconStyles: rightIconStyles, rotate: props.styles.rightIconContainer?.allowRotate && props.open
? rightRotateOpen
: '0deg', ...rightIcon }) }))] }), _jsx(Text, { component: TextComponentType.SPAN, customTypography: props.styles.description, ...props.description, children: props.description?.content })] }), _jsx(BodyStyled, { "data-testid": `${dataTestId}-content`, styles: props.styles, onClick: props.onBodyClick, children: props.children })] }));
};
export const SummaryDetailsStandAlone = React.forwardRef(SummaryDetailsStandAloneComponent);
//# sourceMappingURL=summaryDetailsStandAlone.js.map