@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
30 lines • 1.68 kB
JavaScript
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 { ProgressBarStandalone } from './progressBarStandAlone';
const ProgressBarComponent = React.forwardRef(({ variant, percentProgressCompleted, ctv, ...props }, ref) => {
const styles = useStyles(STYLES_NAME.PROGRESS_BAR, variant, ctv);
const sizeStyles = useStyles(STYLES_NAME.PROGRESS_BAR, props.size, props.cts);
// Avoid values not included in 0 - 100
const progressCompleted = !percentProgressCompleted
? 0
: Math.min(Math.max(percentProgressCompleted, 0), 100);
return (_jsx(ProgressBarStandalone, { ...props, ref: ref, progressCompleted: progressCompleted, sizeStyles: sizeStyles, styles: styles }));
});
ProgressBarComponent.displayName = 'ProgressBarComponent';
const ProgressBarBoundary = (props, ref) => (_jsx(ErrorBoundary, { fallBackComponent: _jsx(FallbackComponent, { children: _jsx(ProgressBarStandalone, { ...props, ref: ref }) }), children: _jsx(ProgressBarComponent, { ...props, ref: ref }) }));
const ProgressBar = React.forwardRef(ProgressBarBoundary);
/**
* @description
* ProgressBar component is used to show a progress bar.
* @param {React.PropsWithChildren<IProgressBar<V>>} props
* @returns {JSX.Element}
* @constructor
* @example
* <ProgressBar variant="progressBar" />
*/
export { ProgressBar };
//# sourceMappingURL=progressBar.js.map