@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.58 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigationCardStandalone = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const decorativeElementStandAlone_1 = require("../../components/decorativeElement/decorativeElementStandAlone");
const text_1 = require("../../components/text/text");
const component_1 = require("../../components/text/types/component");
const useId_1 = require("../../hooks/useId/useId");
const type_1 = require("../button/types/type");
const elementOrIcon_1 = require("../elementOrIcon/elementOrIcon");
const navigationCardInfo_1 = require("./fragments/navigationCardInfo");
const buildProps_1 = require("./helpers/buildProps");
const navigationCard_styled_1 = require("./navigationCard.styled");
const NavigationCardStandaloneComponent = ({ dataTestId = 'navigation-card', type = type_1.ButtonType.BUTTON, ...props }, ref) => {
const infoId = (0, useId_1.useId)('infoId');
const { marginRight, additionalProps } = (0, buildProps_1.buildProps)(props.styles, props.decorative, props.device, dataTestId);
const innerContainersComponent = props.url ? 'div' : 'span';
return (
// Can not be spread -> styled component breaks
(0, jsx_runtime_1.jsx)(navigationCard_styled_1.NavigationCardStyled, { ref: ref, "aria-disabled": props['aria-disabled'], as: props.url ? props.component : 'button', className: props.className, dataTestId: dataTestId, draggable: props.draggable, role: props.role, styles: props.styles, target: props.target, type: props.url ? undefined : type, url: props.url, onClick: props.onClick, onFocus: props.onFocus, onMouseEnter: props.onMouseEnter, onMouseLeave: props.onMouseLeave, children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [props.decorative && ((0, jsx_runtime_1.jsx)(navigationCard_styled_1.NavigationCardDecorativeContainer, { as: innerContainersComponent, marginRight: marginRight, styles: props.styles, children: (0, jsx_runtime_1.jsx)(decorativeElementStandAlone_1.DecorativeElement, { additionalProps: additionalProps, element: props.decorative }) })), (0, jsx_runtime_1.jsxs)(navigationCard_styled_1.NavigationCardInfoContentStyled, { as: innerContainersComponent, id: infoId, isExpanded: props.styles.containerExpandedContent, children: [(0, jsx_runtime_1.jsx)(navigationCard_styled_1.NavigationCardLeftContentStyled, { as: innerContainersComponent, isExpanded: props.styles.containerExpandedContent, children: (0, jsx_runtime_1.jsx)(navigationCardInfo_1.NavigationCardInfo, { description: props.description, device: props.device, innerContainersComponent: innerContainersComponent, styles: props.styles, tag: props.tag, title: props.title }) }), (0, jsx_runtime_1.jsxs)(navigationCard_styled_1.NavigationCardRightContentStyled, { "aria-hidden": true, as: innerContainersComponent, styles: props.styles, children: [props.styles.containerExpandedContent && ((0, jsx_runtime_1.jsx)(text_1.Text, { component: component_1.TextComponentType.SPAN, customTypography: props.styles.arrowIconText, ...props.arrowIconText, children: props.arrowIconText?.content })), (0, jsx_runtime_1.jsx)(elementOrIcon_1.ElementOrIcon, { customIconStyles: props.styles.arrowIcon, ...props.arrowIcon })] })] })] }) }));
};
exports.NavigationCardStandalone = react_1.default.forwardRef(NavigationCardStandaloneComponent);
//# sourceMappingURL=navigationCardStandAlone.js.map