{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toast",
  "title": "Toast",
  "description": "A short message that rises from the bottom. Call toast() from anywhere.",
  "dependencies": [
    "@radix-ui/react-toast@^1.2.24"
  ],
  "registryDependencies": [
    "https://creance.pages.dev/r/creance-base.json"
  ],
  "files": [
    {
      "path": "toast/Toast.css",
      "content": ".cr-toast-viewport {\n  position: fixed;\n  bottom: var(--cr-space-6);\n  left: 50%;\n  z-index: 60;\n  display: flex;\n  flex-direction: column;\n  gap: var(--cr-space-2);\n  width: min(460px, calc(100vw - 2 * var(--cr-space-4)));\n  margin: 0;\n  padding: 0;\n  list-style: none;\n  outline: none;\n  transform: translateX(-50%);\n}\n\n.cr-toast {\n  display: flex;\n  align-items: center;\n  gap: var(--cr-space-3);\n  padding: var(--cr-space-3) 14px var(--cr-space-3) 18px;\n  border-radius: var(--cr-radius-full);\n  color: var(--cr-color-text-default);\n  font-family: var(--cr-font-family-sans);\n  font-size: var(--cr-font-size-md);\n  animation: cr-toast-in var(--cr-motion-duration-slow) var(--cr-motion-easing-spring);\n}\n\n.cr-toast[data-tone='danger'] > .cr-icon {\n  color: var(--cr-color-danger-text);\n}\n\n.cr-toast[data-state='closed'] {\n  animation: cr-toast-out var(--cr-motion-duration-base) var(--cr-motion-easing-standard) forwards;\n}\n\n.cr-toast__title {\n  flex: 1;\n  min-width: 0;\n}\n\n.cr-toast__action {\n  padding: var(--cr-space-1) var(--cr-space-2);\n  border: 0;\n  border-radius: var(--cr-radius-full);\n  background: none;\n  color: var(--cr-color-text-link);\n  font: inherit;\n  font-weight: var(--cr-font-weight-semibold);\n  cursor: pointer;\n}\n\n.cr-toast__action:focus-visible,\n.cr-toast:focus-visible {\n  outline: var(--cr-focus-width) solid var(--cr-color-focus);\n  outline-offset: var(--cr-focus-offset);\n}\n\n@keyframes cr-toast-in {\n  from { opacity: 0; transform: translateY(16px) scale(0.98); }\n}\n\n@keyframes cr-toast-out {\n  to { opacity: 0; transform: translateY(8px); }\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .cr-toast, .cr-toast[data-state='closed'] { animation: none; }\n}\n",
      "type": "registry:file",
      "target": "@components/creance/toast/Toast.css"
    },
    {
      "path": "toast/Toast.tsx",
      "content": "'use client';\n\nimport * as RadixToast from '@radix-ui/react-toast';\nimport { useSyncExternalStore, type ReactNode } from 'react';\nimport { CheckIcon, CrossIcon, InfoIcon } from '@/lib/creance/icons';\nimport './Toast.css';\n\nexport interface ToastOptions {\n  title: ReactNode;\n  /** `success` and `danger` change the icon; the words must say what happened. */\n  tone?: 'default' | 'success' | 'danger';\n  /** One follow-up, such as Undo or Open run. */\n  action?: { label: string; onClick: () => void };\n  /** Milliseconds before it leaves. Default 5000. It stays while hovered or focused. */\n  duration?: number;\n}\n\ninterface Item extends ToastOptions {\n  id: number;\n}\n\n// One queue per page: toasts outlive the component that raised them.\nlet items: Item[] = [];\nlet nextId = 1;\nconst listeners = new Set<() => void>();\nconst emit = () => listeners.forEach((l) => l());\n\n/** Show a toast. Needs one `<Toaster />` mounted somewhere in the app. Returns a function that dismisses it. */\nexport function toast(options: ToastOptions) {\n  const id = nextId++;\n  items = [...items, { ...options, id }];\n  emit();\n  return () => dismiss(id);\n}\n\nfunction dismiss(id: number) {\n  items = items.filter((t) => t.id !== id);\n  emit();\n}\n\nconst subscribe = (l: () => void) => {\n  listeners.add(l);\n  return () => listeners.delete(l);\n};\n\nconst icons = { default: InfoIcon, success: CheckIcon, danger: CrossIcon };\n\nexport interface ToasterProps {\n  /** Accessible name of the region; F8 moves focus to it. */\n  label?: string;\n}\n\n/** Renders queued toasts as glass capsules rising from the bottom. Announced politely by screen readers. */\nexport function Toaster({ label = 'Notifications' }: ToasterProps) {\n  const queue = useSyncExternalStore(subscribe, () => items, () => items);\n  return (\n    <RadixToast.Provider label={label} swipeDirection=\"down\">\n      {queue.map(({ id, title, tone = 'default', action, duration = 5000 }) => {\n        const Icon = icons[tone];\n        return (\n          <RadixToast.Root\n            key={id}\n            className=\"cr-toast cr-glass\"\n            data-tone={tone}\n            duration={duration}\n            onOpenChange={(open) => !open && dismiss(id)}\n          >\n            <Icon />\n            <RadixToast.Title className=\"cr-toast__title\">{title}</RadixToast.Title>\n            {action && (\n              <RadixToast.Action className=\"cr-toast__action\" altText={action.label} onClick={action.onClick}>\n                {action.label}\n              </RadixToast.Action>\n            )}\n          </RadixToast.Root>\n        );\n      })}\n      <RadixToast.Viewport className=\"cr-toast-viewport\" />\n    </RadixToast.Provider>\n  );\n}\n",
      "type": "registry:ui",
      "target": "@components/creance/toast/Toast.tsx"
    }
  ],
  "categories": [
    "molecule",
    "overlays"
  ],
  "type": "registry:ui"
}