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

27 lines 1.49 kB
import { jsx as _jsx } from "react/jsx-runtime"; import React from 'react'; import { STYLES_NAME } from '../../constants/stylesName/stylesName'; import { useStyles } from '../../hooks/useStyles/useStyles'; import { ErrorBoundary } from '../../provider/errorBoundary/errorBoundary'; import { FallbackComponent } from '../../provider/errorBoundary/fallbackComponent'; import { TextStandAlone } from './textStandAlone'; const TextComponent = React.forwardRef(({ children, color, component, htmlFor, variant, weight, ctv, ...props }, ref) => { const styles = useStyles(STYLES_NAME.TEXT, variant, ctv); if (children === undefined || children === null || children === '') return null; return (_jsx(TextStandAlone, { ...props, ref: ref, color: color, component: component, htmlFor: htmlFor, styles: styles, transform: props.transform, weight: weight, children: children })); }); TextComponent.displayName = 'TextComponent'; const TextBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(TextStandAlone, { ...props, ref: ref }) }), children: _jsx(TextComponent, { ...props, ref: ref }) })); const Text = React.forwardRef(TextBoundary); /** * @description * Text component is a component that can be used to create a text. * @param {React.PropsWithChildren<IText<V>>} props * @returns {JSX.Element} * @constructor * @example * <Text variant="h1">Text</Text> */ export { Text }; //# sourceMappingURL=text.js.map