{"version":3,"file":"Progress.cjs","sources":["../../../../src/components/feedback/progress/Progress.tsx"],"sourcesContent":["import { PROGRESS_STYLES } from '@components/feedback/progress/styles/Progress.css.ts'\r\nimport type { ProgressBaseProps, ProgressRenderProps } from '@components/feedback/progress/types/Progress.props.ts'\r\nimport { Box } from '@components/layout/box'\r\nimport { Typography } from '@components/foundation/typography'\r\nimport { cn } from '@utils/cn.ts'\r\nimport { memo, type FC } from 'react'\r\n\r\nconst clamp = (value: number) => Math.min(100, Math.max(0, value))\r\n\r\n/**\r\n * Horizontal `role=\"progressbar\"` with label, optional quantity display,\r\n * design-token `size` (xs|sm|md|lg|xl), `color`, and `borderRadius`.\r\n * Requires an accessible name via `label`, `aria-label`, or\r\n * `aria-labelledby`.\r\n */\r\nconst Progress: FC<ProgressBaseProps> = memo<ProgressRenderProps>(({\r\n    value,\r\n    color,\r\n    size = 'sm',\r\n    borderRadius = 'sm',\r\n    label,\r\n    'aria-label': ariaLabel,\r\n    'aria-labelledby': ariaLabelledBy,\r\n    quantityLabel,\r\n    width = '100%',\r\n    className,\r\n    ref,\r\n    ...props\r\n}) => {\r\n    const clampedValue = clamp(value)\r\n    const resolvedQuantityLabel =\r\n    quantityLabel === true ? `${Math.round(clampedValue)}%` : quantityLabel\r\n    const valueText = resolvedQuantityLabel ?? `${clampedValue}%`\r\n\r\n    return (\r\n        <Box\r\n            ref={ref}\r\n            display={'flex'}\r\n            flexDirection={'column'}\r\n            gap={'xs'}\r\n            width={width}\r\n            className={className}\r\n            {...props}\r\n        >\r\n            {(label || resolvedQuantityLabel) && (\r\n                <Box\r\n                    display={'flex'}\r\n                    justifyContent={'space-between'}\r\n                    alignItems={'center'}\r\n                    gap={'sm'}\r\n                >\r\n                    {label && (\r\n                        <Typography\r\n                            as={'span'}\r\n                            variant={'span'}\r\n                            fontSize={'sm'}\r\n                            color={'textSecondary'}\r\n                        >\r\n                            {label}\r\n                        </Typography>\r\n                    )}\r\n                    {resolvedQuantityLabel && (\r\n                        <Typography\r\n                            as={'span'}\r\n                            variant={'span'}\r\n                            fontSize={'sm'}\r\n                            fontWeight={'medium'}\r\n                            color={'textSecondary'}\r\n                        >\r\n                            {resolvedQuantityLabel}\r\n                        </Typography>\r\n                    )}\r\n                </Box>\r\n            )}\r\n            <Box\r\n                as={'div'}\r\n                role={'progressbar'}\r\n                aria-valuenow={clampedValue}\r\n                aria-valuemin={0}\r\n                aria-valuemax={100}\r\n                aria-valuetext={valueText}\r\n                aria-label={label ?? ariaLabel}\r\n                aria-labelledby={ariaLabelledBy}\r\n                className={cn(PROGRESS_STYLES.recipe({ size, borderRadius, color }))}\r\n            >\r\n                <Box\r\n                    as={'div'}\r\n                    data-progress-fill\r\n                    width={`${clampedValue}%`}\r\n                    className={cn(PROGRESS_STYLES.fill({ borderRadius, color }))}\r\n                />\r\n            </Box>\r\n        </Box>\r\n    )\r\n})\r\n\r\nProgress.displayName = 'Progress'\r\n\r\nexport default Progress\r\n"],"names":["clamp","value","Progress","memo","color","size","borderRadius","label","ariaLabel","ariaLabelledBy","quantityLabel","width","className","ref","props","clampedValue","resolvedQuantityLabel","valueText","jsxs","Box","jsx","Typography","cn","PROGRESS_STYLES"],"mappings":"yWAOMA,EAASC,GAAkB,KAAK,IAAI,IAAK,KAAK,IAAI,EAAGA,CAAK,CAAC,EAQ3DC,EAAkCC,EAAAA,KAA0B,CAAC,CAC/D,MAAAF,EACA,MAAAG,EACA,KAAAC,EAAO,KACP,aAAAC,EAAe,KACf,MAAAC,EACA,aAAcC,EACd,kBAAmBC,EACnB,cAAAC,EACA,MAAAC,EAAQ,OACR,UAAAC,EACA,IAAAC,EACA,GAAGC,CACP,IAAM,CACF,MAAMC,EAAef,EAAMC,CAAK,EAC1Be,EACNN,IAAkB,GAAO,GAAG,KAAK,MAAMK,CAAY,CAAC,IAAML,EACpDO,EAAYD,GAAyB,GAAGD,CAAY,IAE1D,OACIG,EAAAA,KAACC,EAAA,CACG,IAAAN,EACA,QAAS,OACT,cAAe,SACf,IAA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