import { Fragment, type CSSProperties, type ReactNode } from 'react'; import { LinearProgress as MuiLinearProgress, CircularProgress as MuiCircularProgress, Box, Typography, type SxProps } from '@mui/material'; import clsx from 'clsx'; import './rds-progress.scss'; export interface RdsProgressProps { type?: 'linear' | 'circular'; style?: 'circular' | 'line' | 'stepper' | 'dash' | 'block'; value?: number; valueBuffer?: number; steps?: 0 | 1 | 2 | 3 | 4 | 5; variant?: 'determinate' | 'indeterminate' | 'buffer' | 'query'; color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'; size?: number; thickness?: number; showLabel?: boolean; label?: string; totalSteps?: number; stepperType?: 'number' | 'circle'; sx?: CSSProperties; 'aria-label'?: string; 'aria-labelledby'?: string; } const RdsProgress = ({ type = 'linear', style = 'line', value, valueBuffer, steps, variant = 'indeterminate', color = 'primary', size = 50, thickness = 3.6, showLabel = false, label, totalSteps = 5, stepperType = 'number', sx, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, ...props }:RdsProgressProps) => { const getProgressValue = () => steps !== undefined && ['circular', 'line', 'stepper', 'dash', 'block'].includes(style) ? steps * 20 : value; const getColorValue = () => ({ primary: 'var(--rds-color-primary)', secondary: 'var(--rds-color-secondary)', error: 'var(--rds-color-error)', info: 'var(--rds-color-info)', success: 'var(--rds-color-success)', warning: 'var(--rds-color-warning)', })[color] || 'var(--rds-color-primary)'; const getBaseClasses = (styleType: string) => clsx('rds-progress', `rds-progress--${styleType}`, `rds-progress--${color}`, variant === 'indeterminate' && 'rds-progress--indeterminate'); const finalValue = getProgressValue(); const colorValue = getColorValue(); const renderWithLabel = (baseClasses: string, progressElement: ReactNode, labelPosition: 'overlay' | 'side') => { if (!showLabel || variant !== 'determinate') return