@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
35 lines • 1.7 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
//vendors
import React from 'react';
import { useManageState } from '../../hooks/useManageState/useManageState';
//hooks
import { useStyles } from '../../hooks/useStyles/useStyles';
//hooks
import { ErrorBoundary } from '../../provider/errorBoundary/errorBoundary';
import { FallbackComponent } from '../../provider/errorBoundary/fallbackComponent';
import { ButtonType } from '../button/types/type';
//components
import { QuickButtonStandAlone } from './quickButtonStandAlone';
import { QuickButtonState } from './types/state';
//types
const QUICK_BUTTON_STYLES = 'QUICK_BUTTON_STYLES';
const QuickButtonComponent = React.forwardRef(({ type = ButtonType.BUTTON, disabled = false, ctv, ...props }, ref) => {
const styles = useStyles(QUICK_BUTTON_STYLES, props.variant, ctv);
const { state, setRef } = useManageState({
states: Object.values(QuickButtonState),
ref: ref,
disabled,
});
return (_jsx(QuickButtonStandAlone, { ...props, ref: setRef, state: state, styles: styles, type: type }));
});
QuickButtonComponent.displayName = 'QuickButtonComponent';
const QuickButtonBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(QuickButtonStandAlone, { ...props, ref: ref }) }), children: _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.forwardRef(QuickButtonBoundary);
export { QuickButton };
//# sourceMappingURL=quickButton.js.map