@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
25 lines • 2.12 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuickButtonStandAlone = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = __importDefault(require("react"));
const elementOrIcon_1 = require("../../components/elementOrIcon/elementOrIcon");
const labelStandAlone_1 = require("../label/labelStandAlone");
const quickButton_styled_1 = require("./quickButton.styled");
const state_1 = require("./types/state");
const QuickButtonStandAloneComponent = ({ dataTestId = 'quick-button', ...props }, ref) => {
const button = ((0, jsx_runtime_1.jsx)(quickButton_styled_1.QuickButtonStyled, { ref: ref, "aria-label": props.label ? '' : props['aria-label'], "data-testid": dataTestId, disabled: props.state === state_1.QuickButtonState.DISABLED, id: props.buttonId, role: props.role, styles: props.styles, type: props.type, onClick: props.onClick, children: (0, jsx_runtime_1.jsx)(elementOrIcon_1.ElementOrIcon, { color: props.styles?.[props.state]?.icon?.color, height: props.styles?.[props.state]?.icon?.height, width: props.styles?.[props.state]?.icon?.width, ...props.icon }) }));
return props.label ? ((0, jsx_runtime_1.jsxs)(quickButton_styled_1.QuickButtonContainerStyled, { maxWidth: props.maxWidth, styles: props.styles, children: [button, (0, jsx_runtime_1.jsx)(labelStandAlone_1.LabelStandAlone, { color: props.styles?.[props.state]?.label?.color, inputId: props.buttonId, textVariant: props.styles?.[props.state]?.label?.font_family, weight: props.styles?.[props.state]?.label?.font_weight, ...props.label, children: props.label.content })] })) : (button);
};
/**
* @description
* QuickButton component is a button component that can be used to create a button.
* @param {React.PropsWithChildren<IQuickButtonStandAlone>} props
* @returns {JSX.Element}
* @constructor
*/
exports.QuickButtonStandAlone = react_1.default.forwardRef(QuickButtonStandAloneComponent);
//# sourceMappingURL=quickButtonStandAlone.js.map