{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "share-panel",
  "title": "Share Panel",
  "description": "Share sheet with a document preview, a copy-link field, audience toggles and a primary action.",
  "dependencies": [
    "lucide-react@^1.27.0"
  ],
  "registryDependencies": [
    "@pestoui/badge",
    "@pestoui/button",
    "@pestoui/orb-avatar",
    "@pestoui/style",
    "@pestoui/switch",
    "@pestoui/utils"
  ],
  "files": [
    {
      "path": "pestoui/components/share-panel.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Check, Globe, Link2 } from \"lucide-react\"\n\nimport { Badge } from \"@/components/ui/badge\"\nimport { Button } from \"@/components/ui/button\"\nimport { Switch } from \"@/components/ui/switch\"\nimport { OrbStack } from \"@/components/orb-avatar\"\nimport { cn } from \"@/lib/utils\"\n\nfunction ShareRow({\n  leading,\n  label,\n  badge,\n  trailing,\n  defaultChecked = true,\n}: {\n  leading: React.ReactNode\n  label: string\n  badge: string\n  trailing?: React.ReactNode\n  defaultChecked?: boolean\n}) {\n  return (\n    /* Motion: switching an audience off settles its label back to the muted\n       tone, so the switch is not the only thing that acknowledges the change —\n       the row it governs answers too. Both rows ship on, so the resting panel\n       is untouched. */\n    <div className=\"flex items-center gap-2.5 py-3 transition-colors duration-base ease-out-expo has-data-[state=unchecked]:text-muted-foreground\">\n      {leading}\n      <span className=\"text-lead font-semibold tracking-[-0.015em]\">{label}</span>\n      <Badge variant=\"secondary\" className=\"h-7 px-3 text-body-sm font-normal\">\n        {badge}\n      </Badge>\n      <div className=\"ml-auto flex items-center gap-4\">\n        {trailing}\n        <Switch\n          defaultChecked={defaultChecked}\n          aria-label={`Share with ${label.toLowerCase()}`}\n        />\n      </div>\n    </div>\n  )\n}\n\n/* A copy control that answers back — the one interaction in this panel worth\n   real motion, because copying a link is otherwise entirely silent.\n\n   The confirmation is stacked *over* the label rather than replacing it, so the\n   button keeps its exact resting width and nothing in the row reflows; a label\n   that grew from \"Copy\" to a longer word would snap the width, since width is\n   not animatable from auto. The label leaves on the short exit tween while the\n   tick arrives on the swap spring. A reversible two-state toggle shares one\n   travel distance in both directions by construction, so the asymmetry between\n   arriving and leaving lives entirely in the timing.\n\n   The visible state resets itself; the live region announces the same thing\n   once, for anyone who cannot see the tick. */\nfunction CopyLinkButton() {\n  const [copied, setCopied] = React.useState(false)\n  const timer = React.useRef<number | undefined>(undefined)\n\n  React.useEffect(() => () => window.clearTimeout(timer.current), [])\n\n  return (\n    <>\n      <Button\n        variant=\"outline\"\n        size=\"sm\"\n        className=\"relative h-10 rounded-[13px] px-5 text-body-md\"\n        onClick={() => {\n          setCopied(true)\n          window.clearTimeout(timer.current)\n          timer.current = window.setTimeout(() => setCopied(false), 1600)\n        }}\n      >\n        {/* Each state emits exactly one timing pair rather than layering an\n            override on a base — the duration and easing tokens are not numeric,\n            so the class merger cannot tell two of them apart and both would\n            survive, leaving stylesheet order to pick the winner. */}\n        <span\n          className={cn(\n            /* Only the two properties that move — a blanket transition here\n               would also retime the label's inherited hover colour and leave it\n               trailing the button's own background by a hundred milliseconds. */\n            \"transition-[translate,opacity]\",\n            copied\n              ? \"-translate-y-1.5 opacity-0 duration-exit ease-out-expo\"\n              : \"translate-y-0 opacity-100 duration-spring-swap ease-spring-swap\"\n          )}\n        >\n          Copy\n        </span>\n        <span\n          aria-hidden=\"true\"\n          className={cn(\n            \"absolute inset-0 flex items-center justify-center transition-[translate,opacity]\",\n            copied\n              ? \"translate-y-0 opacity-100 duration-spring-swap ease-spring-swap\"\n              : \"translate-y-1.5 opacity-0 duration-exit ease-out-expo\"\n          )}\n        >\n          <Check />\n        </span>\n      </Button>\n      <span aria-live=\"polite\" className=\"sr-only\">\n        {copied ? \"Link copied\" : \"\"}\n      </span>\n    </>\n  )\n}\n\n/* Share sheet — paper preview, copy-link field, audience toggles, primary CTA */\nexport function SharePanel({ className }: { className?: string }) {\n  return (\n    <div\n      className={cn(\n        \"w-full max-w-[480px] rounded-xl bg-card p-7 shadow-card ring-1 ring-foreground/[0.04]\",\n        className\n      )}\n    >\n      <div className=\"h-28 rounded-lg bg-paper ring-1 ring-foreground/[0.03]\" />\n\n      <h3 className=\"mt-7 text-[1.5rem] leading-tight font-semibold tracking-title\">\n        Share this Document\n      </h3>\n      <p className=\"mt-1.5 text-body-lg text-muted-foreground\">\n        Sharing as a single view\n      </p>\n\n      <div className=\"mt-6 flex h-16 items-center gap-3.5 rounded-lg bg-secondary/60 px-4 ring-1 ring-foreground/[0.035]\">\n        <Link2 className=\"size-5.5 text-foreground/70\" strokeWidth={1.8} />\n        <span className=\"flex-1 text-lead font-medium tracking-snug\">Link</span>\n        <CopyLinkButton />\n      </div>\n\n      <div className=\"mt-7 text-body-md text-muted-foreground\">Share with</div>\n      <div className=\"mt-1.5\">\n        <ShareRow\n          leading={\n            <span className=\"flex size-9 shrink-0 items-center justify-center rounded-full bg-info/15 text-body-md font-semibold text-info\">\n              Y\n            </span>\n          }\n          label=\"Your team\"\n          badge=\"Team\"\n          trailing={<OrbStack />}\n        />\n        <ShareRow\n          leading={\n            <span className=\"flex size-9 shrink-0 items-center justify-center\">\n              <Globe className=\"size-6.5 text-foreground/80\" strokeWidth={1.6} />\n            </span>\n          }\n          label=\"Anyone with the link\"\n          badge=\"World\"\n        />\n      </div>\n\n      <Button size=\"xl\" className=\"mt-7 w-full text-body-lg\">\n        Publish\n      </Button>\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}