{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toast",
  "type": "registry:ui",
  "title": "Toast",
  "dependencies": [
    "@base-ui-next/react"
  ],
  "registryDependencies": [
    "https://hamur.dev/r/react/utils.json",
    "https://hamur.dev/r/react/button.json"
  ],
  "files": [
    {
      "path": "react/toast.tsx",
      "content": "'use client'\n\nimport * as React from 'react' // base-ui-next/ui toast@0.1.1\nimport { Toast as ToastPrimitive } from '@base-ui-next/react/toast'\nimport { cn } from '@/lib/utils'\nimport { Button } from '@/components/ui/button'\n\nconst toastViewportClassName =\n  'pointer-events-none fixed inset-x-4 bottom-4 z-50 mx-auto w-auto max-w-sm outline-none sm:right-4 sm:left-auto sm:mx-0 sm:w-full'\n\nconst toastClassName =\n  \"group/toast pointer-events-auto absolute right-0 bottom-0 z-[calc(1000-var(--toast-index))] w-full origin-bottom rounded-2xl border bg-popover text-popover-foreground shadow-lg will-change-transform outline-none select-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [--gap:0.75rem] [--height:var(--toast-frontmost-height,var(--toast-height))] [--offset-y:calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y))] [--peek:0.75rem] [--scale:calc(max(0,1-(var(--toast-index)*0.1)))] [--shrink:calc(1-var(--scale))] h-(--height) [transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)-(var(--toast-index)*var(--peek))-(var(--shrink)*var(--height))))_scale(var(--scale))] [transition:transform_500ms_cubic-bezier(0.22,1,0.36,1),opacity_500ms,height_150ms] after:absolute after:top-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-[''] data-expanded:h-(--toast-height) data-expanded:[transform:translateX(var(--toast-swipe-movement-x))_translateY(var(--offset-y))] data-limited:opacity-0 data-starting-style:[transform:translateY(150%)] [&[data-ending-style]:not([data-limited]):not([data-swipe-direction])]:[transform:translateY(150%)] data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))] data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))] data-expanded:data-ending-style:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))] data-expanded:data-ending-style:data-[swipe-direction=left]:[transform:translateX(calc(var(--toast-swipe-movement-x)-150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))] data-expanded:data-ending-style:data-[swipe-direction=up]:[transform:translateY(calc(var(--toast-swipe-movement-y)-150%))]\"\n\nconst toastContentClassName =\n  'flex h-full items-center gap-3 overflow-hidden p-4 transition-opacity duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-behind:opacity-0 data-expanded:opacity-100'\n\nconst toastTitleClassName = 'text-sm font-medium'\n\nconst toastDescriptionClassName = 'text-sm text-muted-foreground'\n\n/** The action, an `outline` `sm` Button by default. */\nconst toastActionClassName = 'shrink-0'\n\n/** The close button, a `ghost` `icon-sm` Button by default, with a larger hit area. */\nconst toastCloseClassName =\n  \"relative shrink-0 text-muted-foreground after:absolute after:-inset-2 after:content-[''] hover:text-foreground\"\n\n/** The wrapper of the icon `ToastList` shows for a toast's `type`. */\nconst toastIconClassName =\n  \"shrink-0 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4\"\n\n/** The `error` type's icon. */\nconst toastIconErrorClassName = 'text-destructive'\n\n/** The `loading` type's icon. */\nconst toastIconLoadingClassName = 'animate-spin'\n\n/** The column `ToastList` puts the title and description in. */\nconst toastTextClassName = 'flex min-w-0 flex-1 flex-col gap-1'\n\n// The manager `Toaster` uses unless given another: `toast.add({ title })` from anywhere shows a\n// toast, as base-vega's does. It is Base UI's `createToastManager`, not state of this file's own.\nconst toast = ToastPrimitive.createToastManager()\n\n// lucide's icons, inline and hidden from assistive technology (10 · As built, BN-309).\nfunction SvgIcon({ children, ...props }: React.ComponentProps<'svg'>) {\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      viewBox=\"0 0 24 24\"\n      fill=\"none\"\n      stroke=\"currentColor\"\n      strokeWidth=\"2\"\n      strokeLinecap=\"round\"\n      strokeLinejoin=\"round\"\n      aria-hidden=\"true\"\n      {...props}\n    >\n      {children}\n    </svg>\n  )\n}\n\nfunction XIcon(props: React.ComponentProps<'svg'>) {\n  return (\n    <SvgIcon {...props}>\n      <path d=\"M18 6 6 18\" />\n      <path d=\"m6 6 12 12\" />\n    </SvgIcon>\n  )\n}\n\nfunction CircleCheckIcon(props: React.ComponentProps<'svg'>) {\n  return (\n    <SvgIcon {...props}>\n      <circle cx=\"12\" cy=\"12\" r=\"10\" />\n      <path d=\"m9 12 2 2 4-4\" />\n    </SvgIcon>\n  )\n}\n\nfunction InfoIcon(props: React.ComponentProps<'svg'>) {\n  return (\n    <SvgIcon {...props}>\n      <circle cx=\"12\" cy=\"12\" r=\"10\" />\n      <path d=\"M12 16v-4\" />\n      <path d=\"M12 8h.01\" />\n    </SvgIcon>\n  )\n}\n\nfunction TriangleAlertIcon(props: React.ComponentProps<'svg'>) {\n  return (\n    <SvgIcon {...props}>\n      <path d=\"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3\" />\n      <path d=\"M12 9v4\" />\n      <path d=\"M12 17h.01\" />\n    </SvgIcon>\n  )\n}\n\nfunction OctagonXIcon(props: React.ComponentProps<'svg'>) {\n  return (\n    <SvgIcon {...props}>\n      <path d=\"m15 9-6 6\" />\n      <path d=\"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z\" />\n      <path d=\"m9 9 6 6\" />\n    </SvgIcon>\n  )\n}\n\nfunction Loader2Icon(props: React.ComponentProps<'svg'>) {\n  return (\n    <SvgIcon {...props}>\n      <path d=\"M21 12a9 9 0 1 1-6.219-8.56\" />\n    </SvgIcon>\n  )\n}\n\nfunction ToastProvider({ ...props }: ToastPrimitive.Provider.Props) {\n  return <ToastPrimitive.Provider {...props} />\n}\n\nfunction ToastPortal({ ...props }: ToastPrimitive.Portal.Props) {\n  return <ToastPrimitive.Portal data-slot=\"toast-portal\" {...props} />\n}\n\nfunction ToastViewport({ className, ...props }: ToastPrimitive.Viewport.Props) {\n  return (\n    <ToastPrimitive.Viewport\n      data-slot=\"toast-viewport\"\n      className={cn(toastViewportClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction Toast({ className, ...props }: ToastPrimitive.Root.Props) {\n  return (\n    <ToastPrimitive.Root data-slot=\"toast\" className={cn(toastClassName, className)} {...props} />\n  )\n}\n\nfunction ToastContent({ className, ...props }: ToastPrimitive.Content.Props) {\n  return (\n    <ToastPrimitive.Content\n      data-slot=\"toast-content\"\n      className={cn(toastContentClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction ToastTitle({ className, ...props }: ToastPrimitive.Title.Props) {\n  return (\n    <ToastPrimitive.Title\n      data-slot=\"toast-title\"\n      className={cn(toastTitleClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction ToastDescription({ className, ...props }: ToastPrimitive.Description.Props) {\n  return (\n    <ToastPrimitive.Description\n      data-slot=\"toast-description\"\n      className={cn(toastDescriptionClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction ToastAction({\n  className,\n  render = <Button variant=\"outline\" size=\"sm\" />,\n  ...props\n}: ToastPrimitive.Action.Props) {\n  return (\n    <ToastPrimitive.Action\n      data-slot=\"toast-action\"\n      render={render}\n      className={cn(toastActionClassName, className)}\n      {...props}\n    />\n  )\n}\n\nfunction ToastClose({\n  className,\n  children,\n  render = <Button variant=\"ghost\" size=\"icon-sm\" />,\n  ...props\n}: ToastPrimitive.Close.Props) {\n  return (\n    <ToastPrimitive.Close\n      data-slot=\"toast-close\"\n      aria-label=\"Close toast\"\n      render={render}\n      className={cn(toastCloseClassName, className)}\n      {...props}\n    >\n      {children ?? <XIcon />}\n    </ToastPrimitive.Close>\n  )\n}\n\n// The icon of a toast's `type`, as base-vega's: none for a type it does not know.\nfunction ToastIcon({ type }: { type: string | undefined }) {\n  const icon =\n    type === 'success' ? (\n      <CircleCheckIcon />\n    ) : type === 'info' ? (\n      <InfoIcon />\n    ) : type === 'warning' ? (\n      <TriangleAlertIcon />\n    ) : type === 'error' ? (\n      <OctagonXIcon className={toastIconErrorClassName} />\n    ) : type === 'loading' ? (\n      <Loader2Icon className={toastIconLoadingClassName} />\n    ) : null\n\n  if (!icon) {\n    return null\n  }\n\n  return (\n    <span data-slot=\"toast-icon\" className={toastIconClassName}>\n      {icon}\n    </span>\n  )\n}\n\nfunction ToastList() {\n  const { toasts } = ToastPrimitive.useToastManager()\n\n  return toasts.map((toastItem) => (\n    <Toast key={toastItem.id} toast={toastItem}>\n      <ToastContent>\n        <ToastIcon type={toastItem.type} />\n        <div className={toastTextClassName}>\n          <ToastTitle />\n          <ToastDescription />\n        </div>\n        <ToastAction />\n        <ToastClose />\n      </ToastContent>\n    </Toast>\n  ))\n}\n\nfunction Toaster({ children, toastManager = toast, ...props }: ToastPrimitive.Provider.Props) {\n  return (\n    <ToastProvider toastManager={toastManager} {...props}>\n      {children}\n      <ToastPortal>\n        <ToastViewport>\n          <ToastList />\n        </ToastViewport>\n      </ToastPortal>\n    </ToastProvider>\n  )\n}\n\nconst createToastManager = ToastPrimitive.createToastManager\nconst useToastManager = ToastPrimitive.useToastManager\n\nexport {\n  Toaster,\n  Toast,\n  ToastAction,\n  ToastClose,\n  ToastContent,\n  ToastDescription,\n  ToastPortal,\n  ToastProvider,\n  ToastTitle,\n  ToastViewport,\n  createToastManager,\n  toast,\n  useToastManager,\n}\n",
      "type": "registry:ui",
      "target": "@ui/toast.tsx"
    }
  ],
  "meta": {
    "baseUiNext": {
      "version": "0.1.1",
      "hash": "6fcfade390f079b5230425df7dcf2d97d443dc990ae4cc534e9bfff798ef1c39",
      "files": {
        "@ui/toast.tsx": "a6052e217287db80e97d2275f81b21bd4ee7a3cb9c9b6e7f5aa24a1eb2c005fe"
      }
    }
  }
}
