{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "meter",
  "title": "Meter",
  "description": "A measurement in a known range, such as storage or seats, as a fill on a thin track. Past its high mark, or below its low mark, the fill and the value turn red, and a notch shows where that mark is.",
  "dependencies": [
    "@ui-sdk/react",
    "@ui-sdk/core"
  ],
  "registryDependencies": [
    "https://kinoui.com/r/track.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/meter.tsx",
      "content": "'use client'\n\nimport {\n  gaugeText,\n  slidingFillClassName,\n  slidingFillStyle,\n  trackClassName,\n  trackHeaderClassName,\n  trackLabelClassName,\n  trackRootClassName,\n  valuePercent,\n} from '@/registry/lib/track'\nimport {\n  MeterIndicator as MeterIndicatorPrimitive,\n  MeterLabel as MeterLabelPrimitive,\n  Meter as MeterPrimitive,\n  MeterTrack as MeterTrackPrimitive,\n  MeterValue as MeterValuePrimitive,\n} from '@ui-sdk/react/meter'\nimport type { ComponentProps, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ntype MeterProps = Omit<\n  ComponentProps<typeof MeterPrimitive>,\n  'className' | 'format' | 'locale' | 'children'\n> & {\n  className?: string\n  /** How `MeterValue` and the value read out are written: a percentage by default. */\n  format?: Intl.NumberFormatOptions\n  locale?: Intl.LocalesArgument\n  /** Past this value the meter warns: the fill and the value turn red. A notch on the track marks it. */\n  high?: number\n  /** Below this value the meter warns, as past `high`: for a measure that should be high, such as a password's strength. */\n  low?: number\n  /**\n   * What the meter's own sums don't see: `success` turns the fill and the\n   * value green for a goal reached, such as free shipping; `warning`, for a\n   * limit close at hand or reached, amber; and `danger` red, as past `high`.\n   * Say it in words beside the meter too.\n   */\n  tone?: 'success' | 'warning' | 'danger'\n  /** Names a meter that has no `MeterLabel`. */\n  'aria-label'?: string\n  /** The label and value, in a row above the track. */\n  children?: ReactNode\n}\n\nfunction Meter({\n  className,\n  children,\n  value,\n  min = 0,\n  max = 100,\n  high,\n  low,\n  tone,\n  format,\n  locale,\n  ...props\n}: MeterProps) {\n  return (\n    <MeterPrimitive\n      data-success={tone === 'success' || undefined}\n      data-warning={tone === 'warning' || undefined}\n      data-high={tone === 'danger' || (high !== undefined && value > high) || undefined}\n      data-low={(low !== undefined && value < low) || undefined}\n      value={value}\n      min={min}\n      max={max}\n      format={(reading: number) => gaugeText(reading, { min, max, locale, format })}\n      className={cn(trackRootClassName, 'group/meter', className)}\n      {...props}\n    >\n      {children ? (\n        <div data-slot='meter-header' className={trackHeaderClassName}>\n          {children}\n        </div>\n      ) : null}\n      <MeterTrackPrimitive className={cn(trackClassName, 'overflow-hidden')}>\n        <MeterIndicatorPrimitive\n          style={slidingFillStyle(valuePercent(value, min, max))}\n          className={cn(\n            slidingFillClassName,\n            'group-data-success/meter:bg-success group-data-warning/meter:bg-warning group-data-high/meter:bg-destructive group-data-low/meter:bg-destructive',\n          )}\n        />\n        {[low, high].map((mark) =>\n          mark === undefined ? null : (\n            // Where it starts to warn: a notch cut through the track and the fill.\n            <span\n              key={mark === low ? 'low' : 'high'}\n              aria-hidden\n              data-slot='meter-mark'\n              style={{ insetInlineStart: `${valuePercent(mark, min, max)}%` }}\n              className='bg-background absolute inset-y-0 w-0.5 -translate-x-1/2 rtl:translate-x-1/2'\n            />\n          ),\n        )}\n      </MeterTrackPrimitive>\n    </MeterPrimitive>\n  )\n}\n\nfunction MeterLabel({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof MeterLabelPrimitive>, 'className'> & {\n  className?: string\n}) {\n  return <MeterLabelPrimitive className={cn(trackLabelClassName, className)} {...props} />\n}\n\nfunction MeterValue({\n  className,\n  ...props\n}: Omit<ComponentProps<typeof MeterValuePrimitive>, 'className'> & {\n  className?: string\n}) {\n  return (\n    <MeterValuePrimitive\n      className={cn(\n        'text-muted-foreground group-data-success/meter:text-success-foreground group-data-warning/meter:text-warning-foreground group-data-high/meter:text-destructive group-data-low/meter:text-destructive ms-auto shrink-0 tabular-nums transition-colors duration-(--motion-draw-duration) ease-(--motion-draw-fade-easing)',\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Meter, MeterLabel, MeterValue }\n",
      "type": "registry:component",
      "target": "@components/kino/meter.tsx"
    }
  ],
  "type": "registry:component"
}