@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
41 lines • 2.24 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.QuickButton = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
//vendors
const react_1 = __importDefault(require("react"));
const useManageState_1 = require("../../hooks/useManageState/useManageState");
//hooks
const useStyles_1 = require("../../hooks/useStyles/useStyles");
//hooks
const errorBoundary_1 = require("../../provider/errorBoundary/errorBoundary");
const fallbackComponent_1 = require("../../provider/errorBoundary/fallbackComponent");
const type_1 = require("../button/types/type");
//components
const quickButtonStandAlone_1 = require("./quickButtonStandAlone");
const state_1 = require("./types/state");
//types
const QUICK_BUTTON_STYLES = 'QUICK_BUTTON_STYLES';
const QuickButtonComponent = react_1.default.forwardRef(({ type = type_1.ButtonType.BUTTON, disabled = false, ctv, ...props }, ref) => {
const styles = (0, useStyles_1.useStyles)(QUICK_BUTTON_STYLES, props.variant, ctv);
const { state, setRef } = (0, useManageState_1.useManageState)({
states: Object.values(state_1.QuickButtonState),
ref: ref,
disabled,
});
return ((0, jsx_runtime_1.jsx)(quickButtonStandAlone_1.QuickButtonStandAlone, { ...props, ref: setRef, state: state, styles: styles, type: type }));
});
QuickButtonComponent.displayName = 'QuickButtonComponent';
const QuickButtonBoundary = (props, ref) => ((0, jsx_runtime_1.jsx)(errorBoundary_1.ErrorBoundary, { fallBackComponent: (0, jsx_runtime_1.jsx)(fallbackComponent_1.FallbackComponent, { children: (0, jsx_runtime_1.jsx)(quickButtonStandAlone_1.QuickButtonStandAlone, { ...props, ref: ref }) }), children: (0, jsx_runtime_1.jsx)(QuickButtonComponent, { ...props, ref: ref }) }));
/**
* @description
* QuickButton component is a button component that can be used to create a button.
* @param {React.PropsWithChildren<IQuickButton<V>>} props
* @returns {JSX.Element}
*/
const QuickButton = react_1.default.forwardRef(QuickButtonBoundary);
exports.QuickButton = QuickButton;
//# sourceMappingURL=quickButton.js.map