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 1.52 kB
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime"; import React from 'react'; import { pickAriaProps } from '../../utils/aria/aria'; import { ButtonType } from '../button/types/type'; import { IllustrationButtonStyled } from './illustration.styled'; import { IllustrationStandAlone } from './illustrationStandAlone'; const IllustrationBasicComponent = ({ tabIndex = 0, ...props }, ref) => { const illustrationWithTitle = (_jsx(IllustrationStandAlone, { ...props, ref: ref, altText: "", illustration: props.illustration })); const buildButton = () => { const ariaProps = pickAriaProps(props); let illustrationElement = _jsx(_Fragment, {}); if (props.illustration) { if (props.onClick) { illustrationElement = (_jsx(IllustrationButtonStyled, { ...ariaProps, "aria-disabled": props.disabled, "aria-label": props['aria-label'] || props.altText, disabled: props.disabled, tabIndex: tabIndex, type: ButtonType.BUTTON, onClick: props.onClick, children: illustrationWithTitle })); } else { illustrationElement = (_jsx(IllustrationStandAlone, { ...props, ref: ref, illustration: props.illustration })); } return illustrationElement; } return illustrationElement; }; return buildButton(); }; export const IllustrationBasic = React.forwardRef(IllustrationBasicComponent); export { IllustrationBasic as Illustration }; //# sourceMappingURL=illustration.js.map