{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "progress",
  "title": "Progress",
  "description": "A bar that shows how far along a task is, or that it is under way when you can't tell.",
  "dependencies": [
    "@base-ui/react@^1.8.0"
  ],
  "registryDependencies": [
    "@ouro/lib-appearance-hints",
    "@ouro/lib-class-name-check",
    "@ouro/lib-cn",
    "@ouro/lib-env",
    "@ouro/lib-tones",
    "@ouro/lib-use-dev-messages"
  ],
  "files": [
    {
      "path": "registry/ouro/components/ouro/progress/progress.tsx",
      "content": "\"use client\";\n\nimport { Progress as BaseProgress } from \"@base-ui/react/progress\";\nimport { useId, useSyncExternalStore, type CSSProperties, type JSX, type Ref } from \"react\";\nimport { toneFor } from \"@/registry/ouro/lib/ouro/appearance-hints\";\nimport { useAppearanceClassNameCheck } from \"@/registry/ouro/lib/ouro/class-name-check\";\nimport { cn } from \"@/registry/ouro/lib/ouro/cn\";\nimport { toneWarning } from \"@/registry/ouro/lib/ouro/tones\";\nimport { useDevWarnings } from \"@/registry/ouro/lib/ouro/use-dev-messages\";\n\n/** Props for {@link Progress}. */\nexport interface ProgressProps {\n  /**\n   * How far along the work is, from `min` to `max`. `null` while you don't know: the bar\n   * is indeterminate and slides instead of filling.\n   */\n  value: number | null;\n  /** What is in progress: \"Uploading photos\". It names the bar for screen readers. */\n  label: string;\n  /** Hides the label visually; screen readers still use it. */\n  hideLabel?: boolean | undefined;\n  /** Shows the value beside the label, as a percentage unless `format` says otherwise. */\n  showValue?: boolean | undefined;\n  /** The value at the start of the bar. @default 0 */\n  min?: number | undefined;\n  /** The value at the end of the bar, when the work is done. @default 100 */\n  max?: number | undefined;\n  /**\n   * What screen readers say for the value while it is `null`, that the work is under way.\n   * Translate it with the rest of your interface.\n   * @default \"Loading\"\n   */\n  indeterminateText?: string | undefined;\n  /**\n   * How the value is written, for `showValue` and screen readers: `{ style: \"unit\", unit: \"megabyte\" }`.\n   * In the reader's locale once the page has hydrated; en-US in the server's HTML and during\n   * hydration, since the server cannot know the reader's.\n   */\n  format?: Intl.NumberFormatOptions | undefined;\n  /**\n   * Color role from the theme for the filled part, named after its token. `secondary` is\n   * the muted foreground.\n   * @default \"primary\"\n   */\n  tone?:\n    | \"primary\"\n    | \"secondary\"\n    | \"destructive\"\n    | \"success\"\n    | \"warning\"\n    | (string & { 'danger is \"destructive\"; accent is \"primary\"; neutral is \"secondary\"': never })\n    | undefined;\n  /** Layout only: margins, width, grid placement (`mt-4`, `max-w-sm`). Appearance classes warn in development; use `tone`. */\n  className?: string | undefined;\n  /** The progress bar's id, for `aria-describedby` or `aria-controls` elsewhere on the page. */\n  id?: string | undefined;\n  ref?: Ref<HTMLDivElement> | undefined;\n\n  /** Not a prop. An unknown value is `null`: `<Progress value={null}>`. */\n  indeterminate?: { 'Use <Progress value={null}>': never };\n  /** Not a prop. An unknown value is `null`: `<Progress value={null}>`. */\n  isIndeterminate?: { 'Use <Progress value={null}>': never };\n  /** Not a prop. A number `value` is determinate, `null` indeterminate. */\n  variant?: { 'Use <Progress value={40}>, or value={null} while unknown': never };\n  /** Not a prop. Ouro UI uses `tone`: `<Progress tone=\"success\">`. */\n  color?: { 'Use <Progress tone=\"success\">': never };\n}\n\n// Class strings are literal so the app's Tailwind finds them when it compiles.\nconst tones = {\n  primary: \"bg-primary\",\n  secondary: \"bg-muted-foreground\",\n  destructive: \"bg-destructive\",\n  success: \"bg-success\",\n  warning: \"bg-warning\",\n} as const;\n\n// Determinate, the bar is always full width and slides with `translate` (the compositor), not by\n// animating the width Base UI sets inline, which `w-full!` overrides. Indeterminate, a third of\n// the track slides across; with reduced motion the whole track pulses instead.\nconst indicatorClass =\n  \"absolute inset-y-0 start-0 h-full w-full! rounded-full \" +\n  \"-translate-x-[calc(100%-var(--ouro-progress))] rtl:translate-x-[calc(100%-var(--ouro-progress))] \" +\n  \"transition-[translate] duration-(--ouro-duration-slow) ease-(--ouro-ease-out) motion-reduce:transition-none \" +\n  \"data-indeterminate:w-1/3! data-indeterminate:translate-x-0 rtl:data-indeterminate:translate-x-0 data-indeterminate:animate-[ouro-progress_1.4s_ease-in-out_infinite] \" +\n  \"motion-reduce:data-indeterminate:w-full! motion-reduce:data-indeterminate:animate-[ouro-pulse_1.6s_ease-in-out_infinite]\";\n\n/** An empty subscription: here `useSyncExternalStore` only tells the server and hydration apart from the browser. */\n// Stryker disable next-line ArrowFunction: React takes an unsubscribe of undefined as none, and this store never changes.\nconst noSubscription = () => () => {};\n\n/**\n * A bar that shows how far along a task is, or that it is under way when you can't tell.\n * It is a labeled `progressbar`, so screen readers hear the label and the value.\n *\n * Use `Spinner` instead for a short wait with no measurable progress, and `Skeleton` to\n * hold the place of content that is loading.\n *\n * @group Feedback\n * @see https://ui.ouroboros.bot/docs/progress\n *\n * @example\n * <Progress label=\"Uploading photos\" value={40} showValue />\n * <Progress label=\"Importing recipes\" value={null} />\n */\nexport function Progress(props: ProgressProps): JSX.Element {\n  const {\n    value,\n    label,\n    hideLabel,\n    showValue,\n    min,\n    max,\n    format,\n    indeterminateText = \"Loading\",\n    tone: toneProp = \"primary\",\n    className,\n    id,\n    ref,\n    // Guard props (hint types), dropped here so they never reach the DOM.\n    indeterminate,\n    isIndeterminate,\n    variant,\n    color,\n  } = props;\n  const low = min ?? 0;\n  const span = (max ?? 100) - low;\n  // An empty or backwards range (max equal to min, say while a total is still 0) shows an empty bar.\n  const fraction = value === null || !(span > 0) ? 0 : Math.min(Math.max((value - low) / span, 0), 1);\n  const tone = Object.hasOwn(tones, toneProp) ? (toneProp as keyof typeof tones) : \"primary\";\n  // Base UI links the label in an effect, after the first render; an id of our own puts\n  // aria-labelledby in the server HTML too.\n  const labelId = `${useId()}-label`;\n  useAppearanceClassNameCheck(\n    \"Progress\",\n    className,\n    process.env.NODE_ENV !== \"production\" ? (token: string) => `tone=\"${toneFor(token)}\"` : /* istanbul ignore next @preserve -- production only */ \"\",\n  );\n  useDevWarnings(\n    \"Progress\",\n    process.env.NODE_ENV !== \"production\"\n      ? () => [\n          tone !== toneProp && toneWarning(\"Progress\", String(toneProp), Object.keys(tones)),\n          indeterminate !== undefined && [\"indeterminate is not a prop\", \"<Progress value={null}>\"],\n          isIndeterminate !== undefined && [\"isIndeterminate is not a prop\", \"<Progress value={null}>\"],\n          variant !== undefined && [\n            \"variant is not a prop; a number value is determinate\",\n            \"<Progress value={40}>, or value={null} while unknown\",\n          ],\n          color !== undefined && [\"color is not a prop\", `<Progress tone=\"${toneFor(`bg-${String(color)}`)}\">`],\n        ]\n      : /* istanbul ignore next @preserve -- production only */ undefined,\n  );\n  // The reader's locale is unknown on the server and during hydration, so both write the value in\n  // en-US (Base UI keeps a formatter per locale, so no formatter made earlier in another locale is\n  // reused), and the reader's browser switches to its own once hydrated.\n  const hydrated = useSyncExternalStore(\n    noSubscription,\n    () => true,\n    // Stryker disable next-line ArrowFunction: undefined, like false, reads as not yet hydrated.\n    () => false,\n  );\n  return (\n    <BaseProgress.Root\n      ref={ref}\n      locale={hydrated ? undefined : \"en-US\"}\n      id={id}\n      value={value}\n      {...(min !== undefined && { min })}\n      {...(max !== undefined && { max })}\n      {...(format !== undefined && { format })}\n      aria-labelledby={labelId}\n      getAriaValueText={(formatted, current) => (current === null ? indeterminateText : formatted)}\n      data-ouro=\"progress\"\n      className={cn(\"grid w-full gap-1.5\", className)}\n    >\n      <div className={hideLabel ? \"sr-only\" : \"flex items-baseline justify-between gap-3 text-sm\"}>\n        <BaseProgress.Label id={labelId} data-ouro-progress-label=\"\" className=\"font-medium text-foreground\">\n          {label}\n        </BaseProgress.Label>\n        {showValue && value !== null && (\n          <BaseProgress.Value data-ouro-progress-value=\"\" className=\"text-muted-foreground tabular-nums\" />\n        )}\n      </div>\n      <BaseProgress.Track data-ouro-progress-track=\"\" className=\"relative block h-2 w-full overflow-hidden rounded-full bg-secondary\">\n        <BaseProgress.Indicator\n          data-ouro-progress-indicator=\"\"\n          className={cn(indicatorClass, tones[tone])}\n          style={{ \"--ouro-progress\": `${fraction * 100}%` } as CSSProperties}\n        />\n      </BaseProgress.Track>\n    </BaseProgress.Root>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/ouro/progress/progress.tsx"
    }
  ],
  "docs": "A bar that shows how far along a task is, or that it is under way when you can't tell. Import: import { Progress } from \"@/components/ouro/progress/progress\", with @/components replaced by your components alias (aliases.components in components.json, such as ~/components). Also installed: the helpers it imports in lib/ouro. Needs ouro-base in your stylesheet: add that item once per app, from the same place as this one, if you have not. Docs: https://ui.ouroboros.bot/docs/progress.md Ouro UI v1.3.257.",
  "type": "registry:ui"
}