{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toast",
  "title": "Toast",
  "description": "Keys that raise a notification in each tone.",
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json",
    "https://www.cyberspec.dev/r/button.json",
    "https://www.cyberspec.dev/r/toaster.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/toast.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Button, type ButtonTone } from \"@/registry/cyber/ui/button\"\nimport { notify, type NotifyOptions, type ToastTone } from \"@/registry/cyber/ui/toaster\"\nimport \"@/registry/cyber/ui/cyber/toast.css\"\n\ntype Sample = {\n  /** What the key says. */\n  label: string\n  title: string\n} & Pick<NotifyOptions, \"tone\" | \"description\" | \"action\">\n\n// The key that raises a tone wears the nearest thing a key has to it.\nconst keyTone: Record<ToastTone, ButtonTone> = { info: \"signal\", success: \"secondary\", warning: \"flag\", error: \"primary\" }\n\nconst samples: Sample[] = [\n  { label: \"Info\", tone: \"info\", title: \"Incoming job\", description: \"Mara Voss posted a courier run out of Lowtide.\", action: { label: \"Open\", onAction: () => {} } },\n  { label: \"Success\", tone: \"success\", title: \"Route cleared\", description: \"Glasswater checkpoint is behind you.\" },\n  { label: \"Warning\", tone: \"warning\", title: \"Trace at 60%\", description: \"Vanta ICE is closing on NODE 3F:A2.\" },\n  { label: \"Error\", tone: \"error\", title: \"Uplink lost\", description: \"No signal from the relay.\" },\n]\n\n// A row of keys that each raise one toast, for trying the tones out: the\n// toast itself is drawn by <Toasts /> (toaster.tsx), which has to be mounted\n// somewhere on the page, and anything can raise one with `notify()`.\n//\n// - `samples` replaces the four it comes with: a label for the key, a title, and\n//   notify's tone, description and action.\nfunction ToastKeys({ samples: list = samples, ...props }: Omit<React.ComponentProps<\"div\">, \"children\"> & { samples?: Sample[] }) {\n  return (\n    <div data-kit=\"toast-keys\" role=\"group\" aria-label=\"Raise a notification\" {...props}>\n      {list.map(({ label, title, ...options }) => (\n        // The toast makes its own sound as it arrives, so the key keeps\n        // quiet.\n        <Button key={label} tone={keyTone[options.tone ?? \"info\"]} data-sfx=\"none\" onClick={() => void notify(title, options)}>\n          {label}\n        </Button>\n      ))}\n    </div>\n  )\n}\n\nexport { ToastKeys }\nexport type { Sample as ToastSample }\n",
      "type": "registry:ui",
      "target": "@ui/toast.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/toast.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n/* The one animation in the kit that isn't an effect: a toast's time\n   running out. It's information, so it has no FX token and runs at every\n   level (the bar is marked data-motion=\"essential\"); it's a keyframe\n   rather than a transition because it has to pause. */\n@keyframes cy-toast-drain {\n  to {\n    transform: scaleX(0);\n  }\n}\n\n/* What one toast looks like. Where toasts go, and how they arrive, stack\n   and leave, is in toaster.css. */\n@layer cyber.ui {\n  /* What it's about decides one color, and everything that's lit takes it:\n     the edge, the strip, the drain bar. ui-sdk reports it as data-type.\n     Errors take the accent, which is the theme's own color, so they also\n     get the heaviest glyph. */\n  [data-skin=\"cyber\"] [data-kit=\"toast\"] {\n    --toast-tone: var(--cy-signal);\n\n    &[data-type=\"success\"] {\n      --toast-tone: var(--cy-ok);\n    }\n    &[data-type=\"warning\"] {\n      --toast-tone: var(--cy-flag);\n    }\n    &[data-type=\"error\"] {\n      --toast-tone: var(--cy-accent);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"toast-surface\"] {\n    --frame-cut: var(--cy-cut);\n    --frame-line: var(--toast-tone);\n    /* Opaque: it sits over whatever the page has under it. */\n    --frame-fill: var(--cy-panel);\n    /* Frame variables inherit; this one is never patterned. */\n    --frame-image: none;\n\n    display: grid;\n  }\n\n  /* The title strip: solid, in the tone's color, with dark ink. */\n  [data-skin=\"cyber\"] [data-kit=\"toast-strip\"] {\n    display: flex;\n    align-items: center;\n    gap: 8px;\n    min-height: 30px;\n    padding-inline-start: 9px;\n    color: var(--cy-on-solid);\n    background: var(--toast-tone);\n\n    @media (pointer: coarse) {\n      min-height: var(--cy-h);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"toast-glyph\"] {\n    flex: none;\n    display: grid;\n    place-items: center;\n    width: 16px;\n    height: 16px;\n\n    & svg {\n      width: 16px;\n      height: 16px;\n      stroke-width: 2;\n    }\n  }\n\n  /* Still working: a block that breathes, in place of a glyph. */\n  [data-skin=\"cyber\"] [data-kit=\"toast-busy\"] {\n    width: 8px;\n    height: 8px;\n    background: currentColor;\n    animation: var(--cy-fx-pulse) 1.2s linear infinite;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"toast-title\"] {\n    flex: 1;\n    min-width: 0;\n    padding-block: 5px;\n    font-size: var(--cy-text-md);\n    font-weight: 700;\n    line-height: 1.2;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    overflow-wrap: anywhere;\n  }\n\n  /* The tone again, as a word. */\n  [data-skin=\"cyber\"] [data-kit=\"toast-tag\"] {\n    flex: none;\n    font-family: var(--cy-mono);\n    font-size: 10px;\n    font-weight: 500;\n    letter-spacing: 0.08em;\n    opacity: 0.72;\n\n    /* Without a close key it's the last thing in the strip. */\n    &:last-child {\n      margin-inline-end: 10px;\n    }\n  }\n\n  /* The close key: the end of the strip, darkening under the pointer. Its\n     ink and its focus ring are the dark of the strip's text. */\n  [data-skin=\"cyber\"] [data-kit=\"toast-close\"] {\n    --frame-cut: 0px;\n    --frame-line: transparent;\n    --frame-fill: transparent;\n    --frame-focus: var(--cy-on-solid);\n\n    flex: none;\n    align-self: stretch;\n    display: grid;\n    place-items: center;\n    width: 30px;\n    padding: 0;\n    color: inherit;\n    cursor: pointer;\n    transition: background-color var(--cy-t-fast) linear;\n\n    @media (pointer: coarse) {\n      width: var(--cy-h);\n    }\n\n    & svg {\n      width: 14px;\n      height: 14px;\n      stroke-width: 2;\n    }\n\n    @media (hover: hover) {\n      &:hover {\n        --frame-fill: color-mix(in srgb, var(--cy-on-solid) 18%, transparent);\n      }\n    }\n    &:active {\n      --frame-fill: color-mix(in srgb, var(--cy-on-solid) 34%, transparent);\n    }\n  }\n\n  /* The body: the detail, then the action at its trailing end. */\n  [data-skin=\"cyber\"] [data-kit=\"toast-body\"] {\n    display: grid;\n    justify-items: end;\n    gap: 8px;\n    padding: 8px 12px 12px 10px;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"toast-description\"] {\n    justify-self: stretch;\n    font-size: var(--cy-text-sm);\n    line-height: 1.4;\n    color: var(--cy-ink-hi);\n    text-wrap: pretty;\n  }\n\n  /* Time left: a bar along the foot that drains toward the leading edge\n     over the toast's duration. It holds whenever ui-sdk holds the\n     countdown: the pointer or focus in the region, a swipe, an action\n     still running, the window or the page away. */\n  [data-skin=\"cyber\"] [data-kit=\"toast-timer\"] {\n    position: absolute;\n    inset: auto 0 0 0;\n    height: 2px;\n    background: var(--toast-tone);\n    transform-origin: 0 50%;\n    animation: cy-toast-drain var(--toast-duration, 5000ms) linear forwards;\n\n    :dir(rtl) & {\n      transform-origin: 100% 50%;\n    }\n\n    @media (hover: hover) {\n      [data-kit=\"toaster\"]:hover & {\n        animation-play-state: paused;\n      }\n    }\n    [data-kit=\"toaster\"]:is(:focus-within, [data-away]) &,\n    [data-kit=\"toast\"]:is([data-swiping], :has([data-pending])) & {\n      animation-play-state: paused;\n    }\n\n    /* A leaving toast is waited for until everything in it has stopped\n       moving, so the bar stops with it. */\n    [data-ending-style] & {\n      animation: none;\n      opacity: 0;\n    }\n  }\n\n  /* The row of keys that raise one toast each (ToastKeys). */\n  [data-skin=\"cyber\"] [data-kit=\"toast-keys\"] {\n    display: flex;\n    flex-wrap: wrap;\n    justify-content: center;\n    gap: var(--cy-gap);\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/toast.css"
    }
  ],
  "type": "registry:ui"
}
