import { forwardRef, type HTMLAttributes, type ForwardedRef } from 'react' import { getCircularProgressProps, splitClassNameProp, } from '@pluralsight/headless-styles' import type { CircularProgressOptions } from '@pluralsight/headless-styles/types' interface CircularProgressProps extends CircularProgressOptions, HTMLAttributes { displayValue?: boolean } function CircularProgressEl( props: CircularProgressProps, ref: ForwardedRef ) { const { ariaLabel, kind, max, min, now, displayValue, size, ...nativeProps } = props const progress = getCircularProgressProps({ ariaLabel, classNames: splitClassNameProp(props.className), kind, max, min, now, size, }) return (
{displayValue && size !== 'xs' && ( {progress.labelProps.value} )}
) } export const CircularProgress = forwardRef< HTMLDivElement, CircularProgressProps >(CircularProgressEl)