{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "range-slider",
  "type": "registry:item",
  "title": "Range Slider",
  "description": "Pick a number by dragging, on a native `<input type=\"range\">`: arrow keys, Page Up and Down, Home and End work as the browser's own, and it submits under `name`. The value shows beside the label, with `unit` after it. `value` is two-way.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "input"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/range-slider.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/range-slider.js",
      "content": "// Generated by zubra from range-slider.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { id } from '@zubra/runtime';\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"range-slider\";\n\nexport default $define(tag, {\n  props: {\n    \"value\": { attribute: \"value\", default: 50, required: false, model: true },\n    \"min\": { attribute: \"min\", default: 0, required: false },\n    \"max\": { attribute: \"max\", default: 100, required: false },\n    \"step\": { attribute: \"step\", default: 1, required: false },\n    \"label\": { attribute: \"label\", default: \"Value\", required: false },\n    \"unit\": { attribute: \"unit\", default: \"\", required: false },\n    \"name\": { attribute: \"name\", default: \"\", required: false },\n    \"disabled\": { attribute: \"disabled\", default: false, required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [],\n  events: [\"valuechange\"],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (range-slider) to ([data-zb-slotted=\\\"range-slider\\\"]) {\\n  :scope { display: block; }\\n  .range-head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }\\n  label { font-weight: 600; font-size: 0.925rem; }\\n  output { font-variant-numeric: tabular-nums; font-weight: 600; }\\n  input { width: 100%; height: 1.5rem; margin: 0; background: none; appearance: none; cursor: pointer; }\\n  input::-webkit-slider-runnable-track { height: 0.4rem; border-radius: 999px; background: linear-gradient(to right, var(--primary, #18181b) var(--fill), var(--muted, #e4e4e7) var(--fill)); }\\n  input::-moz-range-track { height: 0.4rem; border-radius: 999px; background: var(--muted, #e4e4e7); }\\n  input::-moz-range-progress { height: 0.4rem; border-radius: 999px; background: var(--primary, #18181b); }\\n  input::-webkit-slider-thumb { appearance: none; width: 1.15rem; height: 1.15rem; margin-top: -0.375rem; border: 2px solid var(--primary, #18181b); border-radius: 50%; background: var(--background, #fff); box-shadow: 0 1px 3px #0003; }\\n  input::-moz-range-thumb { width: 1rem; height: 1rem; border: 2px solid var(--primary, #18181b); border-radius: 50%; background: var(--background, #fff); }\\n  input:focus-visible { outline: 2px solid var(--ring, #a1a1aa); outline-offset: 4px; border-radius: 0.25rem; }\\n  input:disabled { opacity: 0.5; cursor: not-allowed; }\\n  .range-scale { display: flex; justify-content: space-between; margin-top: 0.25rem; font-size: 0.775rem; color: color-mix(in oklab, var(--muted-foreground, #71717a) 75%, var(--foreground, #18181b)); }\\n  @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; } }\\n}\\n}\\n\",\n  template: \"\\n  <div class=\\\"range-head\\\"><label></label><output></output></div>\\n  <input type=\\\"range\\\">\\n  <div class=\\\"range-scale\\\" aria-hidden=\\\"true\\\"><span></span><span></span></div>\\n\",\n  setup($p, $emit) {\n                                     \n\n  const inputId = id()\n  const fill = __zubraComputed(() => ($p.max > $p.min ? ((Math.min(Math.max($p.value, $p.min), $p.max) - $p.min) / ($p.max - $p.min)) * 100 : 0))\n  // en-US grouping and up to three decimals, as toLocaleString(\"en-US\") gives, in arithmetic the\n  // server runs too (toLocaleString is the browser's alone), so the server's HTML has the numbers.\n  const thousands = (n) => (n < 1000 ? String(n) : `${thousands(Math.floor(n / 1000))},${String(n % 1000).padStart(3, \"0\")}`)\n  const number = (value) => {\n    const milli = Math.round(Math.abs(value) * 1000)\n    const rest = milli % 1000\n    const fraction = rest === 0 ? \"\" : rest % 100 === 0 ? `.${rest / 100}` : rest % 10 === 0 ? `.${String(rest / 10).padStart(2, \"0\")}` : `.${String(rest).padStart(3, \"0\")}`\n    return `${value < 0 && milli > 0 ? \"-\" : \"\"}${thousands(Math.floor(milli / 1000))}${fraction}`\n  }\n  const shown = __zubraComputed(() => (`${number(Number($p.value))}${$p.unit}`))\n    return [\n      { path: [0, 0], attribute: \"for\", value: () => $r(inputId) },\n      { path: [0, 0], text: () => $t($p.label) },\n      { path: [0, 1], attribute: \"for\", value: () => $r(inputId) },\n      { path: [0, 1], text: () => $t($r(shown)) },\n      { path: [1], attribute: \"id\", value: () => $r(inputId) },\n      { path: [1], attribute: \"name\", value: () => ($p.name || null) },\n      { path: [1], attribute: \"min\", value: () => $p.min },\n      { path: [1], attribute: \"max\", value: () => $p.max },\n      { path: [1], attribute: \"step\", value: () => $p.step },\n      { path: [1], attribute: \"disabled\", boolean: true, value: () => $p.disabled },\n      { path: [1], attribute: \"value\", value: () => $p.value },\n      { path: [1], attribute: \"aria-valuetext\", value: () => $r(shown) },\n      { path: [1], style: \"--fill\", value: () => (`${fill.get()}%`) },\n      { path: [1], on: \"input\", handler: () => ((event) => ($p.value = Number(event.target.value))) },\n      { path: [2, 0], text: () => $t($p.min) + $t($p.unit) },\n      { path: [2, 1], text: () => $t($p.max) + $t($p.unit) },\n    ];\n  },\n});\n"
    }
  ]
}
