{"version":3,"file":"Progress.cjs","names":[],"sources":["../../../src/components/Progress/Progress.tsx"],"sourcesContent":["/**\n * @tempest-limits props-count — value, max, indeterminate, size, tone, label,\n * showValue and className: a progress bar is one element with eight independent\n * presentation choices, and the destructuring counts them all because none has a\n * sensible sub-object.\n */\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Progress.module.css\";\n\nexport type ProgressVariant = \"primary\" | \"success\" | \"warning\" | \"danger\";\n\nexport interface ProgressProps {\n    /** Value between 0 and `max` (or 0-100 by default). Ignored when `indeterminate`. */\n    value?: number;\n    max?: number;\n    variant?: ProgressVariant;\n    /** Show an animated indeterminate bar. Default: false. */\n    indeterminate?: boolean;\n    /** Render a numeric label \"x% / max\" above the bar. Default: false. */\n    showLabel?: boolean;\n    /** Optional left-aligned descriptor (e.g. \"Enviando arquivo…\"). */\n    label?: string;\n    /**\n     * Accessible name for the bar. Defaults to `label` when that is set —\n     * provide it explicitly whenever the bar renders without a visible label,\n     * otherwise screen readers announce an unnamed progressbar.\n     */\n    \"aria-label\"?: string;\n    /** Id of an existing element that names the bar (alternative to `aria-label`). */\n    \"aria-labelledby\"?: string;\n    className?: string;\n}\n\n/**\n * Linear progress bar with determinate / indeterminate modes.\n *\n * The `progressbar` role requires an accessible name: it comes from\n * `aria-labelledby`, then explicit `aria-label`, then the visible `label`.\n */\nexport function Progress({\n    value = 0,\n    max = 100,\n    variant = \"primary\",\n    indeterminate = false,\n    showLabel = false,\n    label,\n    \"aria-label\": ariaLabel,\n    \"aria-labelledby\": ariaLabelledBy,\n    className,\n}: ProgressProps) {\n    const pct = indeterminate ? 0 : Math.max(0, Math.min(100, (value / max) * 100));\n\n    return (\n        <div className={cn(styles.wrapper, className)}>\n            {(showLabel || label) && (\n                <div className={styles.label}>\n                    {label && <span>{label}</span>}\n                    {showLabel && !indeterminate && <span>{Math.round(pct)}%</span>}\n                </div>\n            )}\n            <div\n                role=\"progressbar\"\n                aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? label)}\n                aria-labelledby={ariaLabelledBy}\n                aria-valuemin={0}\n                aria-valuemax={max}\n                aria-valuenow={indeterminate ? undefined : value}\n                className={cn(styles.bar, indeterminate && styles.indeterminate)}\n            >\n                <div\n                    className={cn(styles.fill, variant !== \"primary\" && styles[variant])}\n                    style={{ width: indeterminate ? undefined : `${pct}%` }}\n                />\n            </div>\n        </div>\n    );\n}\n"],"mappings":"4GAuCA,SAAgB,EAAS,CACrB,QAAQ,EACR,MAAM,IACN,UAAU,UACV,gBAAgB,GAChB,YAAY,GACZ,QACA,aAAc,EACd,kBAAmB,EACnB,aACc,CACd,IAAM,EAAM,EAAgB,EAAI,KAAK,IAAI,EAAG,KAAK,IAAI,IAAM,EAAQ,EAAO,GAAG,CAAC,EAE9E,OACI,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,EAAA,QAAO,QAAS,CAAS,EAA5C,SAAA,EACM,GAAa,KACX,EAAA,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,EAAA,QAAO,MAAvB,SAAA,CACK,IAAS,EAAA,EAAA,IAAA,CAAC,OAAD,CAAA,SAAO,CAAY,CAAA,EAC5B,GAAa,CAAC,IAAiB,EAAA,EAAA,KAAA,CAAC,OAAD,CAAA,SAAA,CAAO,KAAK,MAAM,CAAG,EAAE,GAAO,CAAA,CAAA,CAC7D,CAET,CAAA,GAAA,EAAA,EAAA,IAAA,CAAC,MAAD,CACI,KAAK,cACL,aAAY,EAAiB,IAAA,GAAa,GAAa,EACvD,kBAAiB,EACjB,gBAAe,EACf,gBAAe,EACf,gBAAe,EAAgB,IAAA,GAAY,EAC3C,UAAW,EAAA,GAAG,EAAA,QAAO,IAAK,GAAiB,EAAA,QAAO,aAAa,EAE/D,UAAA,EAAA,EAAA,IAAA,CAAC,MAAD,CACI,UAAW,EAAA,GAAG,EAAA,QAAO,KAAM,IAAY,WAAa,EAAA,QAAO,EAAQ,EACnE,MAAO,CAAE,MAAO,EAAgB,IAAA,GAAY,GAAG,EAAI,EAAG,CACzD,CAAA,CACA,CAAA,CACJ,GAEb"}