{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "range-histogram-demo",
  "title": "Range Histogram Demo",
  "description": "A worked example of Range Histogram: A two-handle range filter drawn over the distribution it filters, so you can see where the results are before you cut them off.",
  "registryDependencies": [
    "https://ui.tinkererslabs.com/r/range-histogram.json"
  ],
  "files": [
    {
      "path": "components/demos/range-histogram-demo.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\n\nimport { RangeHistogram } from \"@/registry/default/range-histogram/range-histogram\"\n\n/** A repeatable spread of nightly rates: private rooms, then whole homes. */\nfunction nightlyRates() {\n  let seed = 412\n  const random = () => {\n    seed = (seed * 16807) % 2147483647\n    return seed / 2147483647\n  }\n  const normal = () =>\n    Math.sqrt(-2 * Math.log(random() || 1e-9)) *\n    Math.cos(2 * Math.PI * random())\n\n  return Array.from({ length: 412 }, (_, index) => {\n    const wholeHome = index % 3 === 0\n    const rate = wholeHome ? 240 + normal() * 70 : 95 + normal() * 32\n    return Math.round(Math.min(Math.max(rate, 35), 480))\n  })\n}\n\nconst rates = nightlyRates()\nconst dollars = (value: number) => `$${value}`\n\nexport function RangeHistogramDemo() {\n  const [range, setRange] = React.useState<[number, number]>([70, 260])\n\n  return (\n    <div className=\"bg-background border-border w-full max-w-[28rem] rounded-[1.25rem] border p-5 shadow-sm sm:p-6\">\n      <h3 className=\"text-lg font-semibold\">Filters</h3>\n      <p className=\"text-muted-foreground mt-1 text-sm\">\n        Stays in Lisbon, 3 nights, 2 guests.\n      </p>\n\n      <RangeHistogram\n        className=\"mt-6\"\n        label=\"Price per night\"\n        values={rates}\n        min={30}\n        max={480}\n        step={5}\n        value={range}\n        onValueChange={setRange}\n        formatValue={dollars}\n        formatCount={(count, total) => `${count} of ${total} stays`}\n        inputs\n      />\n    </div>\n  )\n}\n",
      "type": "registry:example"
    }
  ],
  "type": "registry:example"
}