{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "user-row",
  "title": "User Row",
  "description": "Identity row for the foot of a sidebar: avatar, name, a second line and a trailing affordance.",
  "dependencies": [
    "class-variance-authority@^0.7.1"
  ],
  "registryDependencies": [
    "@pestoui/style",
    "@pestoui/utils"
  ],
  "files": [
    {
      "path": "pestoui/components/user-row.tsx",
      "content": "import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* The identity row that closes a sidebar: avatar, name, one quiet second line,\n * and a trailing affordance.\n *\n * `SidebarUser` already covers the case where the whole row is the control — it\n * renders as a `<button>` and inherits the menu-button variants. This one is the\n * deliberate opposite, and the distinction is the reason it exists: the row is\n * inert markup and only `action` is interactive.\n *\n * That matters because the two things a caller wants from this row are \"go to my\n * account\" and \"open the overflow menu\", and satisfying both on one element\n * produces a button inside a link. Screen readers flatten the nesting, keyboard\n * users get one stop where there are two targets, and the click that opens the\n * menu also navigates. Splitting them is the only way out, so the split is baked\n * into the component rather than left as a caller's discipline.\n *\n * No collapsed-rail handling here on purpose. Reaching for `<Sidebar>`'s\n * `data-collapsible` from a primitive would make the row silently depend on an\n * ancestor it doesn't own, and this shape is equally wanted in team lists and\n * settings panes where no such ancestor exists. `SidebarUser` is the\n * rail-coupled one.\n */\nconst userRowVariants = cva(\"group/user-row flex min-w-0 items-center\", {\n  variants: {\n    variant: {\n      /* Bare. Every container that holds one of these — `SidebarFooter` is\n         `p-2` — already pads its children, so padding here would double it. */\n      plain: \"\",\n      card: \"rounded-xl border border-border bg-card\",\n    },\n    size: {\n      sm: \"gap-2\",\n      default: \"gap-3\",\n    },\n  },\n  /* Only the card variant has an inside, so only it takes padding, and the\n     padding is what `size` means for it. */\n  compoundVariants: [\n    { variant: \"card\", size: \"sm\", class: \"p-2\" },\n    { variant: \"card\", size: \"default\", class: \"p-3\" },\n  ],\n  defaultVariants: { variant: \"plain\", size: \"default\" },\n})\n\ntype UserRowVariant = NonNullable<VariantProps<typeof userRowVariants>[\"variant\"]>\ntype UserRowSize = NonNullable<VariantProps<typeof userRowVariants>[\"size\"]>\n\ntype UserRowProps = React.ComponentProps<\"div\"> &\n  VariantProps<typeof userRowVariants> & {\n    /** Leading mark — an `<Avatar>`, an `<OrbAvatar>`, an initials tile. */\n    avatar?: React.ReactNode\n    label: React.ReactNode\n    /** The quiet second line — an email, a plan name, a region. */\n    sublabel?: React.ReactNode\n    /** Trailing slot. The only interactive part of the row. */\n    action?: React.ReactNode\n  }\n\n/**\n * @example\n * <UserRow\n *   variant=\"card\"\n *   avatar={<Avatar><AvatarFallback>NR</AvatarFallback></Avatar>}\n *   label=\"Account 0172\"\n *   sublabel=\"North region\"\n *   action={\n *     <Button variant=\"ghost\" size=\"icon-sm\" aria-label=\"Account options\">\n *       <EllipsisVertical />\n *     </Button>\n *   }\n * />\n */\nfunction UserRow({\n  className,\n  variant = \"plain\",\n  size = \"default\",\n  avatar,\n  label,\n  sublabel,\n  action,\n  ...props\n}: UserRowProps) {\n  return (\n    <div\n      data-slot=\"user-row\"\n      data-variant={variant}\n      data-size={size}\n      className={cn(userRowVariants({ variant, size }), className)}\n      {...props}\n    >\n      {avatar ? (\n        <span\n          data-slot=\"user-row-avatar\"\n          className=\"flex shrink-0 items-center justify-center\"\n        >\n          {avatar}\n        </span>\n      ) : null}\n      {/* `grid` + `min-w-0` is what makes the two `truncate`d lines actually\n          truncate: the track's min sizing is min-content, and an\n          `overflow: hidden` child contributes zero to that, so the column\n          collapses to the space left over instead of pushing the action out of\n          the rail. `flex-1` claims that space; `shrink-0` on the two slots\n          beside it means a 60-character value shortens the name, never the\n          affordance. */}\n      <div\n        data-slot=\"user-row-text\"\n        className=\"grid min-w-0 flex-1 text-left leading-tight\"\n      >\n        <div\n          data-slot=\"user-row-label\"\n          className=\"truncate text-sm font-medium group-data-[size=sm]/user-row:text-xs\"\n        >\n          {label}\n        </div>\n        {sublabel ? (\n          <div\n            data-slot=\"user-row-sublabel\"\n            className=\"truncate text-xs text-muted-foreground\"\n          >\n            {sublabel}\n          </div>\n        ) : null}\n      </div>\n      {action ? (\n        <div\n          data-slot=\"user-row-action\"\n          className=\"flex shrink-0 items-center text-muted-foreground\"\n        >\n          {action}\n        </div>\n      ) : null}\n    </div>\n  )\n}\n\nexport { UserRow, userRowVariants }\nexport type { UserRowProps, UserRowSize, UserRowVariant }\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}