{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "user-avatar",
  "type": "registry:item",
  "title": "User Avatar",
  "description": "A person's picture, or their initials when there's no picture or it fails to load. `name` is the picture's text alternative (and where the initials come from). `size` is sm, md, lg or xl. `status` (online, away, busy, offline) adds a dot, and says so in words for screen readers.",
  "dependencies": [
    "@zubra/runtime@^5.13.1"
  ],
  "categories": [
    "display"
  ],
  "registryDependencies": [
    "https://zubra-js.github.io/zubra-ui/r/theme.json"
  ],
  "files": [
    {
      "path": "components/user-avatar.js",
      "type": "registry:file",
      "target": "~/src/components/zubra/user-avatar.js",
      "content": "// Generated by zubra from user-avatar.zb. Do not edit.\nimport { $define, $r, $t } from \"@zubra/runtime\";\nimport { state as __zubraState, computed as __zubraComputed } from \"@zubra/runtime\";\n\nexport const tag = \"user-avatar\";\n\nexport default $define(tag, {\n  props: {\n    \"src\": { attribute: \"src\", default: \"\", required: false },\n    \"name\": { attribute: \"name\", default: \"\", required: false },\n    \"size\": { attribute: \"size\", default: \"md\", required: false },\n    \"status\": { attribute: \"status\", default: \"\", required: false },\n  },\n  abi: 3,\n  shadow: false,\n  form: false,\n  slots: [],\n  events: [],\n  styled: true,\n  styles: \"@layer theme, base, components, utilities;\\n@layer components {\\n@scope (user-avatar) to ([data-zb-slotted=\\\"user-avatar\\\"]) {\\n  :scope { display: inline-block; vertical-align: middle; }\\n  .avatar-frame { position: relative; display: inline-grid; place-items: center; width: var(--size); height: var(--size); border-radius: 50%; background: var(--muted, #f4f4f5); color: color-mix(in oklab, var(--muted-foreground, #71717a) 70%, var(--foreground, #18181b)); font-weight: 700; font-size: calc(var(--size) * 0.38); line-height: 1; user-select: none; }\\n  .avatar-sm { --size: 2rem; } .avatar-md { --size: 2.5rem; } .avatar-lg { --size: 3.5rem; } .avatar-xl { --size: 5rem; }\\n  img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }\\n  .avatar-dot { position: absolute; right: 0; bottom: 0; width: calc(var(--size) * 0.28); height: calc(var(--size) * 0.28); min-width: 0.55rem; min-height: 0.55rem; border: 2px solid var(--background, #fff); border-radius: 50%; background: #a1a1aa; }\\n  .avatar-online { background: oklch(0.65 0.17 150); }\\n  .avatar-away { background: oklch(0.78 0.16 80); }\\n  .avatar-busy { background: var(--destructive, #dc2626); }\\n  .avatar-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\\n}\\n}\\n\",\n  template: \"\\n  <span>\\n    <!--[--><!--]-->\\n    <!--[--><!--]-->\\n    <!--[--><!--]-->\\n  </span>\\n\",\n  setup($p, $emit) {\nfunction __zubraAssign(signal, value) { signal.set(value); return value }\nfunction __zubraUpdate(signal, delta, prefix) { const old = signal.get(); signal.set(old + delta); return prefix ? old + delta : old }\n                                                \n                                                                    \n  const failed = __zubraState(false)\n  // Plain string methods, so the server renders them too (a pattern is the browser's alone): a\n  // tab or line break between the names counts as a space.\n  const initials = __zubraComputed(() => ($p.name.replaceAll(\"\\t\", \" \").replaceAll(\"\\n\", \" \").replaceAll(\"\\r\", \" \").trim().split(\" \").filter((part) => part !== \"\").map((part) => part[0]).slice(0, 2).join(\"\").toUpperCase()))\n  const statusLabel = __zubraComputed(() => ({ online: \"online\", away: \"away\", busy: \"busy\", offline: \"offline\" }[$p.status] ?? \"\"))\n  const shown = __zubraComputed(() => (Boolean($p.src) && !failed.get()))\n    return [\n      { path: [0], attribute: \"class\", value: () => \"avatar-frame avatar-\" + $t($p.size) },\n      { path: [0, 0], when: () => $r(shown), blocks: [{ template: \"<img>\", parts: () => [{ path: [0], attribute: \"src\", url: true, value: () => $p.src }, { path: [0], attribute: \"alt\", value: () => $p.name }, { path: [0], on: \"error\", handler: () => (() => (__zubraAssign(failed, true))) }] }, { template: \"<span role=\\\"img\\\"></span>\", parts: () => [{ path: [0], attribute: \"aria-label\", value: () => ($p.name || \"Avatar\") }, { path: [0], text: () => $t($r(initials)) }] }] },\n      { path: [0, 1], when: () => $r(statusLabel), blocks: [{ template: \"<span></span>\", parts: () => [{ path: [0], attribute: \"class\", value: () => \"avatar-dot avatar-\" + $t($p.status) }] }, null] },\n      { path: [0, 2], when: () => $r(statusLabel), blocks: [{ template: \"<span class=\\\"avatar-hidden\\\"></span>\", parts: () => [{ path: [0], text: () => \", \" + $t($r(statusLabel)) }] }, null] },\n    ];\n  },\n});\n"
    }
  ]
}
