{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "alert-dialog",
  "title": "Alert dialog",
  "description": "A flagged confirmation that has to be answered, and that an agent has to ask a person about.",
  "dependencies": [
    "@ui-sdk/react@0.1.0-beta.5",
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json",
    "https://www.cyberspec.dev/r/button.json",
    "https://www.cyberspec.dev/r/dialog.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/alert-dialog.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { TriangleAlert } from \"lucide-react\"\nimport {\n  AlertDialog as SdkAlertDialog,\n  AlertDialogBackdrop,\n  AlertDialogClose,\n  AlertDialogContent,\n  AlertDialogDescription,\n  AlertDialogTitle,\n  AlertDialogTrigger,\n} from \"@ui-sdk/react/alert-dialog\"\nimport type { ButtonTone } from \"@/registry/cyber/ui/button\"\nimport \"@/registry/cyber/ui/cyber/button.css\"\nimport \"@/registry/cyber/ui/cyber/dialog.css\"\nimport \"@/registry/cyber/ui/cyber/alert-dialog.css\"\n\n// A question that has to be answered before anything else happens: the\n// dialog's sibling, flagged in yellow, with a hazard spine and a warning\n// glyph. Pressing outside does nothing, and it opens with focus on the key\n// that backs out.\n//\n// - `trigger` is the label of the key that opens it; leave it out and\n//   control it with `open` and `onOpenChange`, or a `controller`.\n// - `confirm` and `cancel` label the keys. `onConfirm` runs on confirm;\n//   return a Promise from it and the dialog stays open, its key busy, until\n//   the Promise settles (a rejection keeps it open to try again).\n// - `agentConfirm` is the sentence an agent has to put to a person before it\n//   may press confirm. Without it the description, or the title, is used.\n// - `children` go between the description and the keys.\n// - `code` is the line of micro-print over the frame.\nfunction AlertDialog({\n  trigger,\n  triggerTone = \"secondary\",\n  title,\n  description,\n  confirm = \"Confirm\",\n  cancel = \"Cancel\",\n  onConfirm,\n  agentConfirm,\n  code = \"ALERT 0x3F // ANSWER REQUIRED\",\n  children,\n  ...props\n}: Omit<React.ComponentProps<typeof SdkAlertDialog>, \"children\"> & {\n  trigger?: React.ReactNode\n  triggerTone?: ButtonTone\n  title: string\n  description?: string\n  confirm?: string\n  cancel?: string\n  onConfirm?: () => unknown\n  agentConfirm?: string\n  code?: string\n  children?: React.ReactNode\n}) {\n  return (\n    <SdkAlertDialog {...props}>\n      {trigger != null && (\n        <AlertDialogTrigger data-kit=\"button\" data-frame=\"notch br\" data-press-flash=\"\" data-tone={triggerTone}>\n          {trigger}\n        </AlertDialogTrigger>\n      )}\n      <AlertDialogBackdrop data-kit=\"backdrop\" />\n      <AlertDialogContent data-kit=\"alert-dialog\">\n        <span data-micro aria-hidden>\n          {code}\n        </span>\n        <div data-kit=\"alert-dialog-surface\" data-frame=\"spine br\">\n          <span data-kit=\"alert-dialog-glyph\" aria-hidden>\n            <TriangleAlert />\n          </span>\n          <div data-kit=\"alert-dialog-text\">\n            <AlertDialogTitle data-kit=\"alert-dialog-title\">{title}</AlertDialogTitle>\n            {description && <AlertDialogDescription data-kit=\"dialog-description\">{description}</AlertDialogDescription>}\n            {children && <div data-kit=\"dialog-body\">{children}</div>}\n          </div>\n        </div>\n        <div data-kit=\"actions\">\n          {/* The way out comes first: it's where focus lands. */}\n          <AlertDialogClose data-kit=\"button\" data-frame=\"notch br\" data-press-flash=\"\" data-tone=\"secondary\">\n            {cancel}\n          </AlertDialogClose>\n          <AlertDialogClose\n            data-kit=\"button\"\n            data-frame=\"notch br\"\n            data-press-flash=\"\"\n            data-tone=\"flag\"\n            data-sfx=\"confirm\"\n            data-agent-confirm={agentConfirm ?? description ?? title}\n            value=\"confirm\"\n            action={onConfirm && (() => onConfirm())}\n          >\n            {confirm}\n          </AlertDialogClose>\n        </div>\n      </AlertDialogContent>\n    </SdkAlertDialog>\n  )\n}\n\nexport { AlertDialog }\n",
      "type": "registry:ui",
      "target": "@ui/alert-dialog.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/alert-dialog.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n/* The backdrop, the description and the body are the dialog's (dialog.css),\n   and the keys are buttons. What's here is what makes it an\n   alert: the yellow frame and its hazard spine. */\n@layer cyber.ui {\n  /* The same column as a dialog: micro-print, the frame, the keys. */\n  [data-skin=\"cyber\"] [data-kit=\"alert-dialog\"] {\n    position: fixed;\n    inset: 0;\n    margin: auto;\n    display: flex;\n    flex-direction: column;\n    gap: 6px;\n    width: min(480px, calc(100vw - 32px));\n    height: fit-content;\n    max-height: calc(100dvh - 32px);\n\n    & > [data-kit=\"alert-dialog-surface\"] {\n      min-height: min(124px, 100%);\n    }\n\n    &[data-open] {\n      animation: var(--cy-fx-in) 280ms var(--cy-ease-snap) backwards;\n    }\n    &[data-ending-style] {\n      animation: var(--cy-fx-out) 150ms var(--cy-ease-snap) both;\n    }\n\n    & > [data-micro] {\n      color: var(--cy-flag);\n    }\n\n    & > [data-kit=\"actions\"] {\n      margin-block-start: 6px;\n    }\n  }\n\n  /* Yellow means \"look here\" everywhere in the kit, so the whole frame takes\n     it: edge, spine and the question itself. */\n  [data-skin=\"cyber\"] [data-kit=\"alert-dialog-surface\"] {\n    --frame-cut: var(--cy-cut-lg);\n    --frame-line: var(--cy-flag);\n    --frame-fill: color-mix(in srgb, var(--cy-flag) 7%, var(--cy-panel));\n    /* Frame variables inherit; this one is never patterned. */\n    --frame-image: none;\n    --frame-spine: 34px;\n\n    display: flex;\n    min-height: 124px;\n  }\n\n  /* The words scroll inside the frame if they have to, so the spine's\n     glyph, which sits over the frame's border, is never clipped. */\n  [data-skin=\"cyber\"] [data-kit=\"alert-dialog-text\"] {\n    flex: 1;\n    min-width: 0;\n    display: grid;\n    gap: 10px;\n    align-content: start;\n    padding: 18px 22px 24px;\n    overflow: auto;\n  }\n\n  /* The question, in the flag color. */\n  [data-skin=\"cyber\"] [data-kit=\"alert-dialog-title\"] {\n    font-size: var(--cy-text-lg);\n    font-weight: 600;\n    line-height: 1.25;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    color: var(--cy-flag);\n    text-wrap: balance;\n  }\n\n  /* The spine: the warning glyph at its head, hazard stripes down the rest.\n     It sits over the frame's thick leading border. */\n  [data-skin=\"cyber\"] [data-kit=\"alert-dialog-glyph\"] {\n    position: absolute;\n    inset-block: 0;\n    inset-inline-start: calc(var(--frame-spine) * -1);\n    width: var(--frame-spine);\n    display: grid;\n    align-content: start;\n    justify-items: center;\n    padding-block-start: 16px;\n    color: var(--cy-on-solid);\n    background: repeating-linear-gradient(\n        135deg,\n        transparent 0 7px,\n        color-mix(in srgb, var(--cy-on-solid) 78%, transparent) 7px 14px\n      )\n      0 56px / 100% 100% no-repeat;\n\n    & svg {\n      width: 18px;\n      height: 18px;\n      stroke-width: 2;\n      /* One small lamp that isn't quite steady. */\n      animation: var(--cy-fx-flicker) 3.6s linear infinite;\n    }\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/alert-dialog.css"
    }
  ],
  "type": "registry:ui"
}
