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

33 lines 1.97 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Illustration = exports.IllustrationBasic = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = __importDefault(require("react")); const aria_1 = require("../../utils/aria/aria"); const type_1 = require("../button/types/type"); const illustration_styled_1 = require("./illustration.styled"); const illustrationStandAlone_1 = require("./illustrationStandAlone"); const IllustrationBasicComponent = ({ tabIndex = 0, ...props }, ref) => { const illustrationWithTitle = ((0, jsx_runtime_1.jsx)(illustrationStandAlone_1.IllustrationStandAlone, { ...props, ref: ref, altText: "", illustration: props.illustration })); const buildButton = () => { const ariaProps = (0, aria_1.pickAriaProps)(props); let illustrationElement = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {}); if (props.illustration) { if (props.onClick) { illustrationElement = ((0, jsx_runtime_1.jsx)(illustration_styled_1.IllustrationButtonStyled, { ...ariaProps, "aria-disabled": props.disabled, "aria-label": props['aria-label'] || props.altText, disabled: props.disabled, tabIndex: tabIndex, type: type_1.ButtonType.BUTTON, onClick: props.onClick, children: illustrationWithTitle })); } else { illustrationElement = ((0, jsx_runtime_1.jsx)(illustrationStandAlone_1.IllustrationStandAlone, { ...props, ref: ref, illustration: props.illustration })); } return illustrationElement; } return illustrationElement; }; return buildButton(); }; exports.IllustrationBasic = react_1.default.forwardRef(IllustrationBasicComponent); exports.Illustration = exports.IllustrationBasic; //# sourceMappingURL=illustration.js.map