{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toast",
  "title": "Toast",
  "description": "Toasts slide in and stack, the ones behind shrink back, and they spread out when you hover.",
  "dependencies": [
    "@ui-sdk/core@0.1.0-beta.2",
    "@ui-sdk/react@0.1.0-beta.2"
  ],
  "registryDependencies": [
    "@keyframery/motion"
  ],
  "files": [
    {
      "path": "registry/components/keyframery/primitives/toast.tsx",
      "content": "\"use client\"\n\n/* Animated drop-in for `@ui-sdk/react/toast`: same parts, same props. Swap the import and keep your code.\n   This file adds motion only, plus the positioning a stack needs to move. Colours, radii,\n   shadows and spacing stay yours.\n\n   - Region: pinned to its side and corner; as tall as the front toast, growing to the whole stack\n     while hovered or focused.\n   - Toast: arrives on a spring from the region's edge, from scale 0.9. Collapsed, the toasts behind\n     peek out 10px each and shrink 5% each, their content faded; expanded, each moves by the height\n     of the toasts in front of it plus a 10px gap. A swipe drags it, and a dismissing swipe sends it\n     on out the same way.\n   - Action and close: Press. */\n\nimport {\n  Toast as ToastPart,\n  ToastAction as ToastActionPart,\n  ToastClose as ToastClosePart,\n  ToastRegion as ToastRegionPart,\n} from \"@ui-sdk/react/toast\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport * from \"@ui-sdk/react/toast\"\n\n/* Pressed parts shrink; the toast's own child transition (scale on `ease-pop`) springs them back. */\nconst press = \"active:scale-[0.92]\"\n\nfunction ToastRegion({ className, ...props }: React.ComponentProps<typeof ToastRegionPart>) {\n  return (\n    <ToastRegionPart\n      className={cn(\n        \"fixed z-50 m-0 w-[360px] max-w-[calc(100vw-32px)] overflow-visible border-0 bg-transparent p-0 text-start\",\n        \"[--dir:-1] data-[side=top]:[--dir:1]\",\n        \"data-[side=bottom]:top-auto data-[side=bottom]:bottom-[calc(16px+var(--keyboard-inset,0px))] data-[side=top]:top-4 data-[side=top]:bottom-auto\",\n        \"data-[align=end]:right-4 data-[align=end]:left-auto data-[align=start]:right-auto data-[align=start]:left-4\",\n        \"data-[align=center]:right-auto data-[align=center]:left-1/2 data-[align=center]:-translate-x-1/2\",\n        \"h-(--toast-front-height) data-expanded:h-[calc(var(--toast-stack-height)+(var(--toast-count)-1)*10px)]\",\n        \"transition-[height] duration-[calc(380ms*var(--kf-speed,1))] ease-house motion-reduce:transition-none!\",\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction Toast({ className, ...props }: React.ComponentProps<typeof ToastPart>) {\n  return (\n    <ToastPart\n      className={cn(\n        \"absolute inset-x-0 overflow-hidden select-none\",\n        \"in-data-[side=bottom]:bottom-0 in-data-[side=top]:top-0\",\n        /* The stack. */\n        \"z-[calc(100-var(--toast-index))] h-(--toast-height) not-data-front:not-data-expanded:h-(--toast-front-height)\",\n        \"[--y:calc(var(--toast-index)*10px*var(--dir))] [scale:calc(1-var(--toast-index)*0.05)]\",\n        \"data-expanded:[--y:calc((var(--toast-offset)+var(--toast-index)*10px)*var(--dir))] data-expanded:[scale:1]\",\n        \"[translate:calc(var(--toast-swipe-x,0px)+var(--exit-x,0px))_calc(var(--y)+var(--toast-swipe-y,0px)+var(--exit-y,0px))]\",\n        \"origin-[50%_calc(50%-50%*var(--dir))]\",\n        \"[transition:translate_calc(560ms*var(--kf-speed,1))_var(--ease-spring),scale_calc(560ms*var(--kf-speed,1))_var(--ease-spring),height_calc(380ms*var(--kf-speed,1))_var(--ease-house),opacity_calc(280ms*var(--kf-speed,1))_var(--ease-house),filter_calc(280ms*var(--kf-speed,1))_var(--ease-house)]\",\n        /* Content behind the front toast fades, so only its edge peeks out. The same rule carries\n           the springy release of anything pressed inside (action, close). */\n        \"*:transition-[opacity,scale] *:duration-[calc(300ms*var(--kf-speed,1))] *:ease-pop not-data-front:not-data-expanded:*:opacity-0\",\n        /* Arriving: from beyond the region's edge, small and soft, on a spring. */\n        \"data-starting-style:data-front:[--y:calc(-110%*var(--dir))] data-starting-style:data-front:[scale:0.9]\",\n        \"data-starting-style:opacity-0 data-starting-style:blur-[4px]\",\n        /* Leaving: quick and quiet; after a swipe it carries on out the way it was thrown. */\n        \"data-ending-style:opacity-0 data-ending-style:blur-[3px]\",\n        \"data-ending-style:[transition:translate_calc(220ms*var(--kf-speed,1))_var(--ease-house),scale_calc(200ms*var(--kf-speed,1))_var(--ease-house),opacity_calc(200ms*var(--kf-speed,1))_var(--ease-house),filter_calc(200ms*var(--kf-speed,1))_var(--ease-house)]\",\n        \"data-ending-style:not-data-swipe-direction:[scale:0.94]\",\n        \"data-ending-style:data-[swipe-direction=right]:[--exit-x:100%] data-ending-style:data-[swipe-direction=left]:[--exit-x:-100%]\",\n        \"data-ending-style:data-[swipe-direction=down]:[--exit-y:100%] data-ending-style:data-[swipe-direction=up]:[--exit-y:-100%]\",\n        \"data-swiping:[transition:none] data-swiping:*:transition-none\",\n        \"motion-reduce:[transition:opacity_calc(200ms*var(--kf-speed,1))] motion-reduce:*:transition-none\",\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction ToastAction({ className, ...props }: React.ComponentProps<typeof ToastActionPart>) {\n  return <ToastActionPart className={cn(press, className)} {...props} />\n}\n\nfunction ToastClose({ className, ...props }: React.ComponentProps<typeof ToastClosePart>) {\n  return <ToastClosePart className={cn(press, className)} {...props} />\n}\n\nexport { Toast, ToastAction, ToastClose, ToastRegion }\n",
      "type": "registry:component",
      "target": "components/keyframery/primitives/toast.tsx"
    },
    {
      "path": "registry/components/keyframery/toast.tsx",
      "content": "\"use client\"\n\n/* Styled toast: the animated primitive plus the Keyframery look. */\n\nimport {\n  Toast as ToastPrimitive,\n  ToastAction as ToastActionPart,\n  ToastClose as ToastClosePart,\n  ToastDescription as ToastDescriptionPart,\n  ToastRegion as ToastRegionPrimitive,\n  ToastTitle as ToastTitlePart,\n  createToaster,\n  toast,\n  type ToastData,\n  type ToastType,\n} from \"@/components/keyframery/primitives/toast\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\n/* Every toast renders this unless the region is given children of its own. */\nfunction defaultRenderToast(item: ToastData<React.ReactNode>) {\n  return (\n    <Toast>\n      <ToastIcon type={item.type} />\n      <div className=\"flex min-w-0 flex-1 flex-col gap-1 py-0.5\">\n        <ToastTitle />\n        <ToastDescription />\n      </div>\n      {item.action && <ToastAction />}\n      {item.dismissible !== false && <ToastClose />}\n    </Toast>\n  )\n}\n\n/* The region: the primitive pins it and sizes it for the stack; this adds a focus ring. */\nfunction ToastRegion({\n  className,\n  children = defaultRenderToast,\n  ...props\n}: React.ComponentProps<typeof ToastRegionPrimitive>) {\n  return (\n    <ToastRegionPrimitive\n      className={cn(\n        \"group/region outline-none\",\n        \"focus-visible:rounded-[16px] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-4 focus-visible:ring-offset-background\",\n        className,\n      )}\n      {...props}\n    >\n      {children}\n    </ToastRegionPrimitive>\n  )\n}\n\n/* A toast is a sheet. The primitive stacks it, brings it in on a spring and swipes it away. */\nfunction Toast({ className, ...props }: React.ComponentProps<typeof ToastPrimitive>) {\n  return (\n    <ToastPrimitive\n      className={cn(\n        \"group/toast flex items-start gap-3 rounded-[14px] bg-popover p-3 pr-2.5 text-popover-foreground outline-none\",\n        \"shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_2px_6px_-2px_rgb(0_0_0/0.08),0_12px_32px_-8px_rgb(0_0_0/0.18)]\",\n        \"dark:shadow-[0_0_0_1px_rgb(255_255_255/0.08),0_12px_32px_-8px_rgb(0_0_0/0.7)]\",\n        \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction ToastTitle({ className, ...props }: React.ComponentProps<typeof ToastTitlePart>) {\n  return (\n    <ToastTitlePart\n      className={cn(\"text-[13px] leading-[18px] font-medium text-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\nfunction ToastDescription({\n  className,\n  ...props\n}: React.ComponentProps<typeof ToastDescriptionPart>) {\n  return (\n    <ToastDescriptionPart\n      className={cn(\"text-[12px] leading-[17px] text-muted-foreground\", className)}\n      {...props}\n    />\n  )\n}\n\n/* The action is a small key, like Undo. */\nfunction ToastAction({ className, ...props }: React.ComponentProps<typeof ToastActionPart>) {\n  return (\n    <ToastActionPart\n      className={cn(\n        \"inline-flex h-7 shrink-0 cursor-pointer items-center self-center rounded-[8px] bg-background px-2.5 text-[12px] leading-none font-medium text-foreground outline-none\",\n        \"shadow-[0_0_0_1px_rgb(0_0_0/0.06),0_1px_1px_rgb(0_0_0/0.05),0_3px_6px_-2px_rgb(0_0_0/0.1)]\",\n        \"dark:bg-accent dark:shadow-[0_0_0_1px_rgb(255_255_255/0.07),inset_0_1px_0_rgb(255_255_255/0.08),0_2px_6px_-1px_rgb(0_0_0/0.6)]\",\n        \"hover:bg-accent dark:hover:bg-muted\",\n        \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-popover\",\n        \"data-pending:pointer-events-none data-pending:opacity-60\",\n        \"disabled:pointer-events-none disabled:opacity-50\",\n        className,\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction ToastClose({\n  className,\n  children,\n  ...props\n}: React.ComponentProps<typeof ToastClosePart>) {\n  return (\n    <ToastClosePart\n      aria-label=\"Dismiss\"\n      className={cn(\n        \"grid size-6 shrink-0 cursor-pointer place-items-center self-start rounded-[7px] text-muted-foreground outline-none\",\n        \"hover:bg-foreground/[0.06] hover:text-foreground\",\n        \"focus-visible:ring-2 focus-visible:ring-ring\",\n        \"data-pending:pointer-events-none data-pending:opacity-50\",\n        \"[&_svg]:size-3.5\",\n        className,\n      )}\n      {...props}\n    >\n      {children ?? (\n        <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n          <path d=\"m4.5 4.5 7 7m0-7-7 7\" />\n        </svg>\n      )}\n    </ToastClosePart>\n  )\n}\n\n/* A small mark by type. As the toast arrives its tile pops in and its mark draws itself. */\nconst draw =\n  \"[stroke-dasharray:1] [stroke-dashoffset:0] transition-[stroke-dashoffset] delay-[calc(260ms*var(--kf-speed,1))] duration-[calc(260ms*var(--kf-speed,1))] ease-house group-data-starting-style/toast:[stroke-dashoffset:1] group-data-starting-style/toast:transition-none motion-reduce:transition-none!\"\n\nfunction ToastIcon({\n  type = \"default\",\n  className,\n  ...props\n}: React.ComponentProps<\"span\"> & { type?: ToastType }) {\n  if (type === \"default\") return null\n  const svg = {\n    viewBox: \"0 0 16 16\",\n    fill: \"none\",\n    stroke: \"currentColor\",\n    strokeWidth: 2,\n    strokeLinecap: \"round\" as const,\n    strokeLinejoin: \"round\" as const,\n    \"aria-hidden\": true,\n  }\n  return (\n    <span data-slot=\"toast-icon\" data-type={type} className={cn(\"group/icon mt-px shrink-0\", className)} {...props}>\n      <span\n        className={cn(\n          \"grid size-[18px] place-items-center rounded-full [&_svg]:size-3.5\",\n          \"transition-[scale] delay-[calc(100ms*var(--kf-speed,1))] duration-[calc(480ms*var(--kf-speed,1))] ease-pop group-data-starting-style/toast:scale-[0.5] group-data-starting-style/toast:transition-none motion-reduce:transition-none!\",\n          \"group-data-[type=success]/icon:bg-[oklch(0.62_0.16_150/0.14)] group-data-[type=success]/icon:text-[oklch(0.62_0.16_150)]\",\n          \"group-data-[type=error]/icon:bg-destructive/12 group-data-[type=error]/icon:text-destructive\",\n          \"group-data-[type=info]/icon:bg-muted group-data-[type=info]/icon:text-foreground\",\n          \"group-data-[type=warning]/icon:bg-muted group-data-[type=warning]/icon:text-foreground\",\n          \"group-data-[type=loading]/icon:text-muted-foreground\",\n        )}\n      >\n        {type === \"success\" && (\n          <svg {...svg}>\n            <path d=\"m4.5 8.25 2.25 2.25 4.75-5\" pathLength={1} className={draw} />\n          </svg>\n        )}\n        {(type === \"error\" || type === \"warning\") && (\n          <svg {...svg}>\n            <path d=\"M8 4.75v3.75\" pathLength={1} className={draw} />\n            <path d=\"M8 11.25v.01\" />\n          </svg>\n        )}\n        {type === \"info\" && (\n          <svg {...svg}>\n            <path d=\"M8 7.5v3.75\" pathLength={1} className={draw} />\n            <path d=\"M8 4.75v.01\" />\n          </svg>\n        )}\n        {type === \"loading\" && (\n          <svg {...svg} strokeWidth={1.5} className=\"animate-spin motion-reduce:animate-none!\">\n            <path d=\"M8 2.5a5.5 5.5 0 1 1-5.5 5.5\" />\n          </svg>\n        )}\n      </span>\n    </span>\n  )\n}\n\nexport {\n  createToaster,\n  toast,\n  Toast,\n  ToastAction,\n  ToastClose,\n  ToastDescription,\n  ToastIcon,\n  ToastRegion,\n  ToastTitle,\n}\n",
      "type": "registry:component",
      "target": "components/keyframery/toast.tsx"
    }
  ],
  "type": "registry:component"
}