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

25 lines 1.69 kB
import { jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { STYLES_NAME } from '../../../constants/stylesName/stylesName'; import { useManageState } from '../../../hooks/useManageState/useManageState'; import { useStyles } from '../../../hooks/useStyles/useStyles'; import { useGenericComponents } from '../../../provider/genericComponents/genericComponentsProvider'; import { ErrorBoundary } from '../../../provider/errorBoundary/errorBoundary'; import { FallbackComponent } from '../../../provider/errorBoundary/fallbackComponent'; import { ButtonStateType } from '../../button/types/state'; import { LinkAsButtonStandAlone } from './linkAsButtonStandAlone'; export const LinkAsButtonComponent = React.forwardRef(({ variant, size, ...props }, ref) => { const styles = useStyles(STYLES_NAME.BUTTON, variant); const sizeStyles = useStyles(STYLES_NAME.BUTTON, size); const { LINK: genericLinkComponent } = useGenericComponents(); const { state, setRef } = useManageState({ states: Object.values(ButtonStateType), ref, disabled: props.disabled, }); return (_jsx(LinkAsButtonStandAlone, { ...props, ref: setRef, component: genericLinkComponent, sizeStyles: sizeStyles, state: state, styles: styles })); }); LinkAsButtonComponent.displayName = 'LinkAsButtonComponent'; const LinkAsButtonBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(LinkAsButtonStandAlone, { ...props, ref: ref }) }), children: _jsx(LinkAsButtonComponent, { ...props, ref: ref }) })); export const LinkAsButton = React.forwardRef(LinkAsButtonBoundary); //# sourceMappingURL=linkAsButton.js.map