{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "upper-limit",
  "type": "registry:component",
  "title": "Upper limit",
  "description": "Set a top limit, such as kilometres driven.",
  "author": "Eugen Eşanu <https://eugenesanu.com>",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "registryDependencies": [
    "https://filtersui.com/r/range-histogram.json"
  ],
  "files": [
    {
      "path": "registry/filters/upper-limit.tsx",
      "type": "registry:component",
      "target": "@components/filters-ui/filters/upper-limit.tsx",
      "content": "\"use client\";\n\nimport type { HTMLAttributes } from \"react\";\nimport type { StateProps } from \"../ui/status-frame\";\nimport { RangeHistogram } from \"./range-histogram\";\n\nexport type UpperLimitProps = Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> &\n  StateProps & {\n  min: number;\n  /** The top of the scale. A limit here, or null, means no limit. */\n  max: number;\n  step: number;\n  /** The limit, or null for none. */\n  value: number | null;\n  onChange: (value: number | null) => void;\n  /** Item count per bar, spread evenly from min to max. */\n  buckets?: readonly number[];\n  /** Field, tooltip and screen-reader text for a value, e.g. \"50,000 km\". Default: the number in the locale. */\n  format?: (value: number) => string;\n  /** Reads a typed value. Default: the first number in the text, read with the locale's marks, with an optional k or m suffix. */\n  parse?: (text: string) => number | null;\n  /** Formats and reads numbers by default, e.g. \"de-DE\". Default \"en-US\". */\n  locale?: string;\n  /** Tooltip text while there is no limit. Default \"Any\". */\n  openLabel?: string;\n  /** Field placeholder. Default \"Maximum\". */\n  placeholder?: string;\n  /** Accessible name of the handle and the field. Default: the placeholder. */\n  label?: string;\n  /** Bar width as a share of its slot, so a chart with few bars can keep the rhythm of a denser one. Default 1. */\n  barScale?: number;\n};\n\n/**\n * One upper limit: a bar chart with a single handle and one typed field under it, kept in step both ways.\n * A typed value snaps to the step and stays at least one step above min; an empty field, or the top, is no limit.\n * The states (status, onRetry, errorText, emptyText, disabled) are the price range's: \"Couldn't load the counts.\" and\n * \"No items to show\" by default.\n */\nexport function UpperLimit({\n  value,\n  onChange,\n  openLabel = \"Any\",\n  placeholder = \"Maximum\",\n  label,\n  ...props\n}: UpperLimitProps) {\n  return (\n    <RangeHistogram\n      single\n      value={[null, value]}\n      onChange={([, high]) => onChange(high)}\n      openLabel={openLabel}\n      placeholders={{ high: placeholder }}\n      labels={{ high: label ?? placeholder }}\n      {...props}\n    />\n  );\n}\n"
    }
  ],
  "meta": {
    "addedIn": "1.0.0",
    "updatedIn": "1.3.0"
  }
}
