{
  "name": "commit-key",
  "type": "registry:ui",
  "title": "CommitKey",
  "description": "The wide commit control for G1 (the GO family): dark console key, strong accent rim, lit legend, machined edge, 1px travel. Armed breathes the rim's temperature. Live is not a button — it becomes the status token.",
  "dependencies": [
    "@candlelight-ds/tokens",
    "clsx",
    "tailwind-merge"
  ],
  "registryDependencies": [
    "kbd",
    "utils"
  ],
  "files": [
    {
      "path": "components/instruments/CommitKey.tsx",
      "type": "registry:ui",
      "content": "'use client'\n\n/**\n * CommitKey — the wide commit control for G1's commit half (the GO\n * family). A dark console key with a strong accent rim and a lit\n * legend — strength is structure (rim, weight, contrast), never glow.\n * Armed breathes the rim's temperature: a color pulse, never a halo.\n *\n * LIVE is not a button. Once the armed thing is live there is nothing\n * to commit, so the control renders as a status: the pulsing live dot\n * and the thing's name (G6/G7). It becomes the commit key again the\n * moment a different object arms.\n *\n * Use when: committing the armed object — GO, TAKE, Apply, Assign.\n * Don't use when: ordinary confirmations (Button variant=\"primary\").\n */\n\nimport { Play } from 'lucide-react'\nimport { cn } from '@/lib/utils'\nimport { Kbd } from '@/components/ui/Kbd'\n\ninterface CommitKeyProps {\n  /** Primary label: \"Go\" / \"Take\" / \"Apply\" — your metaphor's verb. */\n  label: string\n  /** The armed object's name, truncated. */\n  sublabel?: string\n  /** Live = committed state; the control becomes a status, not a button. */\n  live?: boolean\n  /** Armed and ready to commit — the rim breathes until pressed. */\n  armed?: boolean\n  /** md = the console control · sm = the compact corner cut. */\n  size?: 'md' | 'sm'\n  kbd?: string\n  onClick: () => void\n  disabled?: boolean\n  ariaLabel?: string\n  className?: string\n}\n\nexport function CommitKey({\n  label,\n  sublabel,\n  live = false,\n  armed = false,\n  size = 'md',\n  kbd = '⏎',\n  onClick,\n  disabled,\n  ariaLabel,\n  className,\n}: CommitKeyProps) {\n  const frame = cn(\n    'relative flex items-center rounded-sm',\n    // Density (§2.6) is ambient: the GO key is performance-native (48px);\n    // under a bench ancestor the md key compacts toward the sm geometry.\n    size === 'sm'\n      ? 'h-9 max-w-[220px] gap-2 px-3.5'\n      : 'h-12 min-w-[170px] max-w-[260px] gap-3 px-5 [[data-density=bench]_&]:h-9 [[data-density=bench]_&]:min-w-[120px] [[data-density=bench]_&]:gap-2 [[data-density=bench]_&]:px-3.5',\n    className\n  )\n\n  const legend = (\n    <span className=\"min-w-0 text-start\">\n      <span\n        className={cn(\n          'block font-bold uppercase',\n          size === 'sm'\n            ? 'text-eyebrow tracking-key'\n            : 'text-body-lg leading-4 tracking-chip [[data-density=bench]_&]:text-eyebrow [[data-density=bench]_&]:tracking-key'\n        )}\n      >\n        {label}\n      </span>\n      {sublabel ? (\n        <span\n          className={cn(\n            'block truncate font-normal normal-case tracking-normal',\n            live ? 'text-live/70' : 'text-ink-mute',\n            size === 'sm' ? 'text-micro' : 'text-micro leading-4'\n          )}\n        >\n          {sublabel}\n        </span>\n      ) : null}\n    </span>\n  )\n\n  if (live) {\n    // The show is on. Status, not action: no play glyph, no printed key,\n    // no click — the dot carries the state (G6).\n    return (\n      <div\n        role=\"status\"\n        className={cn(frame, 'border border-live-rim bg-live-fill text-live')}\n      >\n        <span\n          aria-hidden\n          className={cn(\n            'shrink-0 animate-pulse rounded-full bg-live motion-reduce:animate-none',\n            size === 'sm' ? 'h-1.5 w-1.5' : 'h-2 w-2'\n          )}\n        />\n        {legend}\n      </div>\n    )\n  }\n\n  return (\n    <button\n      type=\"button\"\n      onClick={onClick}\n      disabled={disabled}\n      aria-label={ariaLabel}\n      className={cn(\n        frame,\n        'key-cue bg-surface-3 text-brass-hot',\n        'disabled:cursor-default disabled:opacity-35',\n        armed && !disabled && 'key-cue-armed'\n      )}\n    >\n      {/* The compact cut keeps its triangle (a doorway needs an arrow);\n          the console key is legend-first — the verb is its own icon. */}\n      {size === 'sm' ? <Play className=\"h-3 w-3 shrink-0 fill-current\" /> : null}\n      {legend}\n      {kbd && size !== 'sm' ? (\n        <Kbd tone=\"brass\" className=\"ml-auto shrink-0\">\n          {kbd}\n        </Kbd>\n      ) : null}\n    </button>\n  )\n}\n",
      "target": "components/instruments/CommitKey.tsx"
    }
  ],
  "meta": {
    "candlelight": {
      "category": "instrument",
      "gRules": [
        "G1",
        "G2",
        "G6",
        "G7"
      ],
      "useWhen": "Committing the armed object — GO, TAKE, Apply, Assign. Exactly one per surface.",
      "dontUseWhen": "Ordinary confirmations (Button variant=\"primary\").",
      "states": [
        "idle",
        "armed (rim breathes — color pulse, never halo)",
        "live (role=status: pulsing dot, no click, no printed key)",
        "disabled",
        "sm (compact cut)"
      ],
      "keyboard": [
        {
          "keys": "⏎",
          "does": "the printed default — Enter is sacred to the commit key (§5)"
        }
      ],
      "acceptanceTests": [
        "Live renders role=status with no button and no Kbd.",
        "The armed pulse is border-color only and dies under reduced motion (key-cue-armed)."
      ]
    }
  }
}