{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "team",
  "type": "registry:block",
  "title": "Team block",
  "description": "A studio's people as one screen: the seats as a meter, and a table with each person's role to change in place, open invites, when they were last active and a menu of actions. Invite opens a dialog that takes several addresses, and a removal is undone from its toast.",
  "registryDependencies": [
    "https://littmd.vercel.app/r/litt.json",
    "https://littmd.vercel.app/r/avatar.json",
    "https://littmd.vercel.app/r/button.json",
    "https://littmd.vercel.app/r/chart.json",
    "https://littmd.vercel.app/r/dialog.json",
    "https://littmd.vercel.app/r/framed.json",
    "https://littmd.vercel.app/r/icons.json",
    "https://littmd.vercel.app/r/menu.json",
    "https://littmd.vercel.app/r/segmented.json",
    "https://littmd.vercel.app/r/select.json",
    "https://littmd.vercel.app/r/table.json",
    "https://littmd.vercel.app/r/tag.json",
    "https://littmd.vercel.app/r/toast.json",
    "https://littmd.vercel.app/r/token-input.json"
  ],
  "files": [
    {
      "path": "registry/litt/components/litt-blocks/team.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n// @litt/team 2026.11.03. What changed: https://littmd.vercel.app/changelog.md\n\n/**\n * Team: who is in the studio, what each person can do, and the invites still open. A block: a whole screen built from\n * the litt parts, to copy and make your own. Swap the sample members at the top for yours, and the handlers for your\n * requests; the table, the dialog and the words stay.\n *\n * A title with the head count, the seats as one meter, then a table: each person with their avatar, a role you can\n * change in place, an Invited tag on an open invite, when they were last active, and a menu of what else you can do.\n * Invite opens a dialog that takes several addresses at once. Removing someone is undone from the toast. Invite is the\n * one accent fill on the page, and Send invites the one in the dialog. Render it inside your app's shell (the dashboard\n * block's AppShell, for one), and mount the Toaster once near your root.\n */\nimport { useId, useState, type FormEvent } from \"react\";\nimport { Avatar } from \"../litt/avatar\";\nimport { Button } from \"../litt/button\";\nimport { Meter } from \"../litt/chart\";\nimport { Dialog, DialogClose, DialogContent, DialogTrigger } from \"../litt/dialog\";\nimport { MoreIcon, PlusIcon } from \"../litt/icons\";\nimport { Menu, MenuItem, MenuSeparator } from \"../litt/menu\";\nimport { Segmented } from \"../litt/segmented\";\nimport { Select } from \"../litt/select\";\nimport { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from \"../litt/table\";\nimport { Tag } from \"../litt/tag\";\nimport { toast } from \"../litt/toast\";\nimport { TokenInput } from \"../litt/token-input\";\nimport { Heading } from \"../litt/framed\";\n\n/* Radix's asChild, spread in: shadcn's CLI rewrites a written asChild to Base UI's render prop in base-* hosts. */\nconst asChildProps = { asChild: true } as const;\n\n/* ----------------------------------------------------------------- data */\n\ntype Role = \"owner\" | \"admin\" | \"editor\" | \"viewer\";\ntype Member = { id: string; name: string; email: string; role: Role; invited?: boolean; active: string };\n\n/** The studio's people. Load yours. The owner's role is fixed, so it shows as words, not a picker. */\nconst MEMBERS: Member[] = [\n  { id: \"ines\", name: \"Ines Ortega\", email: \"ines@halo.studio\", role: \"owner\", active: \"Now\" },\n  { id: \"rui\", name: \"Rui Santos\", email: \"rui@halo.studio\", role: \"admin\", active: \"2 h ago\" },\n  { id: \"maya\", name: \"Maya Lind\", email: \"maya@halo.studio\", role: \"editor\", active: \"Yesterday\" },\n  { id: \"tomas\", name: \"Tomás Vega\", email: \"tomas@northwind.co\", role: \"viewer\", active: \"6 days ago\" },\n  { id: \"ada\", name: \"ada@marlowlabs.com\", email: \"ada@marlowlabs.com\", role: \"editor\", invited: true, active: \"Invited 2 days ago\" },\n];\n\nconst SEATS = 8;\n\nconst ROLES: { value: Exclude<Role, \"owner\">; label: string; can: string }[] = [\n  { value: \"admin\", label: \"Admin\", can: \"Admins manage people, billing and every project.\" },\n  { value: \"editor\", label: \"Editor\", can: \"Editors change pages and publish.\" },\n  { value: \"viewer\", label: \"Viewer\", can: \"Viewers open projects and leave comments.\" },\n];\n\nconst EMAIL = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst WORDS = [\"No\", \"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \"Seven\", \"Eight\", \"Nine\", \"Ten\"];\n/** \"One person\", \"Four people\": the number in words, and the noun that goes with it. */\nconst count = (n: number, one: string, many = `${one}s`) => `${WORDS[n] ?? n} ${n === 1 ? one : many}`;\n\n/* ----------------------------------------------------------------- the invite dialog */\n\nfunction InviteDialog({ seatsLeft, onInvite }: { seatsLeft: number; onInvite: (emails: string[], role: Role) => void }) {\n  /* The footer's Send invites submits the form by its id, so the id is this dialog's own. */\n  const formId = useId();\n  const [open, setOpen] = useState(false);\n  const [emails, setEmails] = useState<string[]>([]);\n  const [role, setRole] = useState<Exclude<Role, \"owner\">>(\"editor\");\n  const [error, setError] = useState<string | null>(null);\n\n  const submit = (e: FormEvent<HTMLFormElement>) => {\n    e.preventDefault();\n    if (!emails.length) return setError(\"Add at least one address.\");\n    if (emails.length > seatsLeft) return setError(`There ${seatsLeft === 1 ? \"is one seat\" : `are ${seatsLeft} seats`} left. Remove an address, or add seats first.`);\n    onInvite(emails, role);\n    setOpen(false);\n  };\n\n  return (\n    <Dialog\n      open={open}\n      onOpenChange={(o) => {\n        if (o) {\n          setEmails([]);\n          setRole(\"editor\");\n          setError(null);\n        }\n        setOpen(o);\n      }}\n    >\n      <DialogTrigger {...asChildProps}>\n        <Button variant=\"primary\" size=\"sm\" icon={<PlusIcon />}>\n          Invite\n        </Button>\n      </DialogTrigger>\n      <DialogContent\n        title=\"Invite people\"\n        description=\"Each one gets an email with a link that joins the studio.\"\n        footer={\n          <>\n            <DialogClose {...asChildProps}>\n              <Button>Cancel</Button>\n            </DialogClose>\n            <Button variant=\"primary\" type=\"submit\" form={formId}>\n              Send invites\n            </Button>\n          </>\n        }\n      >\n        <form id={formId} noValidate onSubmit={submit} className=\"grid gap-6\">\n          <TokenInput\n            label=\"Email addresses\"\n            hint=\"Press Enter or a comma after each address.\"\n            placeholder=\"name@studio.com\"\n            value={emails}\n            onValueChange={(next) => {\n              setEmails(next);\n              if (error) setError(null);\n            }}\n            validate={(v) => (EMAIL.test(v) ? true : `${v} is not a full address.`)}\n            error={error}\n          />\n          <div className=\"grid gap-2\">\n            <Segmented legend=\"Role\" showLegend block name={`${formId}-role`} value={role} onValueChange={setRole} options={ROLES} />\n            <p className=\"text-litt-small text-litt-fg-subtle\">{ROLES.find((r) => r.value === role)!.can}</p>\n          </div>\n        </form>\n      </DialogContent>\n    </Dialog>\n  );\n}\n\n/* ----------------------------------------------------------------- the screen */\n\nexport function Team() {\n  const [members, setMembers] = useState(MEMBERS);\n  const people = members.filter((m) => !m.invited).length;\n  const invites = members.length - people;\n\n  const setRole = (id: string, role: Role) => setMembers((all) => all.map((m) => (m.id === id ? { ...m, role } : m)));\n\n  const remove = (member: Member) => {\n    const at = members.indexOf(member);\n    setMembers((all) => all.filter((m) => m.id !== member.id));\n    toast({\n      title: member.invited ? `Invite to ${member.email} cancelled` : `${member.name} removed`,\n      description: member.invited ? undefined : \"They lose access to every project.\",\n      action: { label: \"Undo\", onClick: () => setMembers((all) => [...all.slice(0, at), member, ...all.slice(at)]) },\n    });\n  };\n\n  const invite = (emails: string[], role: Role) => {\n    const known = new Set(members.map((m) => m.email));\n    const fresh = emails.filter((e) => !known.has(e));\n    setMembers((all) => [...all, ...fresh.map((email) => ({ id: email, name: email, email, role, invited: true, active: \"Invited just now\" }))]);\n    toast({ title: fresh.length === 1 ? `Invite sent to ${fresh[0]}` : `${count(fresh.length, \"invite\")} sent`, tone: \"success\" });\n  };\n\n  return (\n    <div className=\"@container grid w-full grid-cols-1 gap-8\">\n      <header className=\"flex flex-wrap items-end justify-between gap-4\">\n        <div className=\"grid gap-1\">\n          <Heading level={1} className=\"text-litt-h1 text-litt-fg\">Team</Heading>\n          <p className=\"text-litt-body text-litt-fg-muted\">\n            {count(people, \"person\", \"people\")}\n            {invites ? ` and ${count(invites, \"open invite\").toLowerCase()}` : \"\"}.\n          </p>\n        </div>\n        <InviteDialog seatsLeft={SEATS - members.length} onInvite={invite} />\n      </header>\n\n      <Meter label=\"Seats\" value={members.length} max={SEATS} valueText={`${members.length} of ${SEATS}`} steps={SEATS} className=\"max-w-sm\" />\n\n      <Table label=\"Team members\">\n        <TableHeader>\n          <TableRow>\n            <TableHead>Person</TableHead>\n            <TableHead>Role</TableHead>\n            <TableHead numeric>Last active</TableHead>\n            <TableHead>\n              <span className=\"sr-only\">Actions</span>\n            </TableHead>\n          </TableRow>\n        </TableHeader>\n        <TableBody>\n          {members.map((m) => (\n            <TableRow key={m.id}>\n              <TableCell primary>\n                <span className=\"flex items-center gap-3\">\n                  <Avatar name={m.name} size=\"sm\" decorative />\n                  <span className=\"grid min-w-0\">\n                    <span className=\"flex items-center gap-2\">\n                      <span className=\"truncate\">{m.invited ? m.email : m.name}</span>\n                      {m.invited && <Tag status=\"neutral\">Invited</Tag>}\n                    </span>\n                    {!m.invited && <span className=\"truncate text-litt-small text-litt-fg-subtle\">{m.email}</span>}\n                  </span>\n                </span>\n              </TableCell>\n              <TableCell>\n                {m.role === \"owner\" ? (\n                  <span className=\"text-litt-small text-litt-fg-muted\">Owner</span>\n                ) : (\n                  <div className=\"w-32\">\n                    <Select size=\"sm\" aria-label={`Role for ${m.name}`} value={m.role} onValueChange={(v) => setRole(m.id, v as Role)} options={ROLES} />\n                  </div>\n                )}\n              </TableCell>\n              <TableCell numeric>{m.active}</TableCell>\n              <TableCell numeric>\n                {m.role !== \"owner\" && (\n                  <Menu\n                    align=\"end\"\n                    label={`Actions for ${m.name}`}\n                    trigger={\n                      <Button iconOnly variant=\"ghost\" size=\"sm\" aria-label={`Actions for ${m.name}`}>\n                        <MoreIcon />\n                      </Button>\n                    }\n                  >\n                    {m.invited && (\n                      <>\n                        <MenuItem onSelect={() => toast({ title: `Invite sent again to ${m.email}` })}>Resend invite</MenuItem>\n                        <MenuSeparator />\n                      </>\n                    )}\n                    <MenuItem destructive onSelect={() => remove(m)}>\n                      {m.invited ? \"Cancel invite\" : \"Remove from team\"}\n                    </MenuItem>\n                  </Menu>\n                )}\n              </TableCell>\n            </TableRow>\n          ))}\n        </TableBody>\n      </Table>\n    </div>\n  );\n}\n",
      "target": "components/litt-blocks/team.tsx"
    }
  ],
  "docs": "Import Team from components/litt-blocks/team and render it inside your app's shell, with the Toaster mounted once near your root. The members and the seat count sit at the top of the file; setRole, remove and invite are where your requests go. See it live at https://littmd.vercel.app/#team.",
  "meta": {
    "version": "2026.11.03",
    "released": "2026-11-03",
    "changelog": "https://littmd.vercel.app/changelog.md"
  }
}
