{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "control-row",
  "title": "Control row",
  "description": "a control’s label row: label, off-default mark, Reset, trailing slot; the control goes underneath",
  "dependencies": [
    "cn@^0.5.2",
    "lucide-react@^1.52.0"
  ],
  "registryDependencies": [
    "@halftone-web/kit-setup"
  ],
  "files": [
    {
      "path": "components/controls/control-row.tsx",
      "content": "'use client';\nimport { cn } from 'cn';\nimport { RotateCcwIcon } from 'lucide-react';\nimport * as React from 'react';\n\n/**\n * The mark a control shows while its value is off its default. Its presence is the signal, never its colour: it sits\n * beside the label only while the value differs, the label turns from muted to full strength, and a Reset button\n * appears. Screen readers hear \"changed\".\n */\nexport function OffDefaultMark({ className }: { className?: string }) {\n  return <span aria-hidden className={cn('bg-primary inline-block size-1.5 shrink-0 rounded-full', className)} />;\n}\n\n/** Sets a control back to its default. Named for what it resets, and to what. */\nexport function ResetButton({ label, onReset, className }: { label: string; onReset: () => void; className?: string }) {\n  return (\n    <button\n      type=\"button\"\n      onClick={onReset}\n      aria-label={label}\n      title={label}\n      className={cn(\n        'text-muted-foreground hover:text-foreground hover:bg-accent focus-visible:ring-ring/50 inline-flex size-6 shrink-0 items-center justify-center rounded-md outline-none focus-visible:ring-[3px]',\n        className\n      )}>\n      <RotateCcwIcon className=\"size-3.5\" aria-hidden />\n    </button>\n  );\n}\n\ntype RowProps = {\n  label: React.ReactNode;\n  /** The control's id, so a click on the label focuses it. */\n  htmlFor?: string;\n  /** Off its default: shows the mark and, with `onReset`, the Reset button. */\n  edited?: boolean;\n  onReset?: () => void;\n  /** \"Reset blur to 8\": what the Reset button says. Defaults to \"Reset <label>\". */\n  resetLabel?: string;\n  /** Beside the label, at the end of the row: a value, a switch. */\n  trailing?: React.ReactNode;\n  /** One line under the control. */\n  hint?: React.ReactNode;\n  /** Props for the label itself (NumberField makes it the scrub handle). */\n  labelProps?: React.HTMLAttributes<HTMLElement> & { 'data-dragging'?: boolean };\n  className?: string;\n  children?: React.ReactNode;\n};\n\n/**\n * A control's label row: the label, the off-default mark, Reset, and anything trailing; the control itself goes\n * underneath (`children`). Every control in a ControlPanel sits in one, so they all read and reset the same way.\n */\nexport function ControlRow({ label, htmlFor, edited = false, onReset, resetLabel, trailing, hint, labelProps, className, children }: RowProps) {\n  const text = typeof label === 'string' ? label : undefined;\n  const Label = htmlFor ? 'label' : 'span';\n  return (\n    <div className={cn('flex min-w-0 flex-col gap-1.5', className)}>\n      <div className=\"flex min-h-7 min-w-0 items-center gap-2\">\n        <Label\n          {...labelProps}\n          {...(htmlFor ? { htmlFor } : {})}\n          className={cn(\n            'flex min-w-0 flex-1 items-center gap-1.5 text-xs font-medium',\n            edited ? 'text-foreground' : 'text-muted-foreground',\n            labelProps?.className\n          )}>\n          {edited ? <OffDefaultMark /> : null}\n          {/* Wraps rather than truncates: a cut-off label hides what the control is. */}\n          <span className=\"min-w-0 [overflow-wrap:anywhere]\">{label}</span>\n          {edited ? <span className=\"sr-only\">, changed</span> : null}\n        </Label>\n        {edited && onReset ? <ResetButton label={resetLabel ?? `Reset ${text?.toLowerCase() ?? 'this setting'}`} onReset={onReset} /> : null}\n        {trailing}\n      </div>\n      {children}\n      {hint ? <p className=\"text-muted-foreground text-xs\">{hint}</p> : null}\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/controls/control-row.tsx"
    }
  ],
  "meta": {
    "exports": [
      "ControlRow",
      "OffDefaultMark",
      "ResetButton"
    ],
    "api": "<ControlRow label htmlFor? edited? onReset? trailing? hint?>{control}</ControlRow>"
  },
  "categories": [
    "controls"
  ],
  "type": "registry:component"
}