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

29 lines 1.58 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 { DotStandAlone } from './dotStandAlone'; const DotComponent = React.forwardRef((props, ref) => { const { size, variant, number, maxNumber } = props; const styles = useStyles(STYLES_NAME.DOT, variant, props.ctv); const sizeStyles = useStyles(STYLES_NAME.DOT, size, props.cts); const formattedNumber = number && maxNumber && number > maxNumber ? `+${maxNumber}` : number?.toString(); return (_jsx(DotStandAlone, { ...props, ref: ref, formatedNumber: formattedNumber, sizeStyles: sizeStyles, styles: styles })); }); DotComponent.displayName = 'DotComponent'; const DotBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(DotStandAlone, { ...props, ref: ref }) }), children: _jsx(DotComponent, { ...props, ref: ref }) })); const Dot = React.forwardRef(DotBoundary); /** * @description * Dot component is a component that can be used to display a dot. * It can be used to display a notification dot or a dot to indicate a status. * @param {IDot<V, S>} props * @returns {JSX.Element} * @constructor * @example * <Dot variant="primary" size="SMALL" number={1} maxNumber={99} /> */ export { Dot }; //# sourceMappingURL=dot.js.map