{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "meter",
  "title": "Meter",
  "description": "Astro range meters for capacity, usage, and other bounded measurements.",
  "dependencies": [
    "cn@0.4.0"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "packages/ui/src/components/ui/meter/meter-label.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cn } from \"cn\"\ntype Props = HTMLAttributes<\"span\">\nconst { class: className, ...props } = Astro.props\n---\n\n<span\n  data-slot=\"meter-label\"\n  class={cn(\"font-medium text-foreground text-sm\", className)}\n  {...props}\n>\n  <slot />\n</span>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/meter/meter-label.astro"
    },
    {
      "path": "packages/ui/src/components/ui/meter/meter-track.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cn } from \"cn\"\ntype Props = HTMLAttributes<\"div\">\nconst { class: className, ...props } = Astro.props\n---\n\n<div\n  data-slot=\"meter-track\"\n  class={cn(\"block h-2 w-full overflow-hidden bg-input\", className)}\n  {...props}\n>\n  <slot />\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/meter/meter-track.astro"
    },
    {
      "path": "packages/ui/src/components/ui/meter/index.ts",
      "content": "export { default as Meter } from './meter.astro'\nexport { default as MeterLabel } from './meter-label.astro'\nexport { default as MeterTrack } from './meter-track.astro'\nexport { default as MeterIndicator } from './meter-indicator.astro'\nexport { default as MeterValue } from './meter-value.astro'\n",
      "type": "registry:file",
      "target": "~/src/components/ui/meter/index.ts"
    },
    {
      "path": "packages/ui/src/components/ui/meter/meter.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cn } from \"cn\"\nimport Track from \"./meter-track.astro\"\nimport Indicator from \"./meter-indicator.astro\"\ntype Props = HTMLAttributes<\"div\"> & {\n  value: number\n  min?: number\n  max?: number\n}\nconst {\n  class: className,\n  value,\n  min = 0,\n  max = 100,\n  style,\n  ...props\n} = Astro.props\nif (\n  !Number.isFinite(min) ||\n  !Number.isFinite(max) ||\n  max <= min ||\n  (value !== null && !Number.isFinite(value))\n)\n  throw new RangeError(\n    \"Meter needs finite bounds with max greater than min, and a finite value.\",\n  )\nconst current = value === null ? null : Math.min(max, Math.max(min, value))\nconst percent = current === null ? 0 : ((current - min) / (max - min)) * 100\nconst mergedStyle =\n  typeof style === \"string\"\n    ? `${style};--meter-percentage:${percent}%`\n    : { ...style, \"--meter-percentage\": percent + \"%\" }\n---\n\n<div\n  data-slot=\"meter\"\n  role=\"meter\"\n  aria-valuemin={min}\n  aria-valuemax={max}\n  aria-valuenow={current ?? undefined}\n  style={mergedStyle}\n  class={cn(\"flex w-full flex-col gap-2\", className)}\n  {...props}\n>\n  <slot>\n    <Track>\n      <Indicator />\n    </Track>\n  </slot>\n</div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/meter/meter.astro"
    },
    {
      "path": "packages/ui/src/components/ui/meter/meter-value.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cn } from \"cn\"\ntype Props = HTMLAttributes<\"span\">\nconst { class: className, ...props } = Astro.props\n---\n\n<span\n  data-slot=\"meter-value\"\n  class={cn(\"text-foreground text-sm tabular-nums\", className)}\n  {...props}\n>\n  <slot />\n</span>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/meter/meter-value.astro"
    },
    {
      "path": "packages/ui/src/components/ui/meter/meter-indicator.astro",
      "content": "---\nimport type { HTMLAttributes } from \"astro/types\"\nimport { cn } from \"cn\"\ntype Props = HTMLAttributes<\"div\">\nconst { class: className, ...props } = Astro.props\n---\n\n<div\n  data-slot=\"meter-indicator\"\n  class={cn(\n    \"h-full w-(--meter-percentage) bg-primary transition-[width] duration-500 motion-reduce:transition-none\",\n    className,\n  )}\n  {...props}\n></div>\n",
      "type": "registry:file",
      "target": "~/src/components/ui/meter/meter-indicator.astro"
    }
  ],
  "meta": {
    "framework": "astro",
    "source": "@gnosticai/ui"
  },
  "docs": "https://ui.gnosticai.com/components/meter",
  "categories": [
    "ui"
  ],
  "type": "registry:ui"
}
