{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "alert",
  "title": "Alert",
  "description": "An inline notice on a spined frame: info, success, warning or danger, each with its own glyph.",
  "dependencies": [
    "lucide-react@1.73.0"
  ],
  "registryDependencies": [
    "https://www.cyberspec.dev/r/cyber.json"
  ],
  "files": [
    {
      "path": "registry/cyber/ui/alert.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { Check, Info, OctagonAlert, TriangleAlert } from \"lucide-react\"\nimport \"@/registry/cyber/ui/cyber/alert.css\"\n\ntype Tone = \"info\" | \"success\" | \"warning\" | \"danger\"\n\n// What each tone prints besides its color: a glyph on the spine and a word\n// in the corner, so the four are told apart without seeing the hue. The two\n// that can't wait interrupt a screen reader; the other two are polite.\nconst tones: Record<Tone, { glyph: React.ReactNode; word: string; role: \"status\" | \"alert\" }> = {\n  info: { glyph: <Info aria-hidden />, word: \"Notice\", role: \"status\" },\n  success: { glyph: <Check aria-hidden />, word: \"Clear\", role: \"status\" },\n  warning: { glyph: <TriangleAlert aria-hidden />, word: \"Caution\", role: \"alert\" },\n  danger: { glyph: <OctagonAlert aria-hidden />, word: \"Critical\", role: \"alert\" },\n}\n\n// An inline notice: a frame with a thick spine in the tone's color, its\n// glyph printed on the spine, a title, a line of text and room for one key.\n//\n// - `tone`: \"info\" is the signal cyan, \"success\" green, \"warning\" yellow, and\n//   \"danger\" is the accent with the frame lit, since red is the kit's resting\n//   color and only a fill makes it urgent.\n// - `action`: a key that answers the notice, usually a small Button.\n// - `word` replaces the tone's printed word (\"Notice\", \"Clear\", \"Caution\",\n//   \"Critical\").\nfunction Alert({\n  tone = \"info\",\n  title,\n  word,\n  action,\n  children,\n  ...props\n}: Omit<React.ComponentProps<\"div\">, \"title\"> & {\n  tone?: Tone\n  title: string\n  word?: string\n  action?: React.ReactNode\n}) {\n  const spec = tones[tone]\n  return (\n    <div data-kit=\"alert\" data-frame=\"spine br\" data-tone={tone} role={spec.role} {...props}>\n      <span data-kit=\"alert-glyph\" aria-hidden>\n        {spec.glyph}\n      </span>\n      <div data-kit=\"alert-body\">\n        <div data-kit=\"alert-head\">\n          <strong data-kit=\"alert-title\">{title}</strong>\n          <span data-kit=\"alert-word\">{word ?? spec.word}</span>\n        </div>\n        {children != null && <p data-kit=\"alert-text\">{children}</p>}\n      </div>\n      {action != null && <div data-kit=\"alert-action\">{action}</div>}\n    </div>\n  )\n}\n\nexport { Alert }\nexport type { Tone as AlertTone }\n",
      "type": "registry:ui",
      "target": "@ui/alert.tsx"
    },
    {
      "path": "registry/cyber/ui/cyber/alert.css",
      "content": "@layer ui-sdk, cyber.tokens, cyber.base, cyber.ui, cyber.blocks, cyber.fx, cyber.a11y;\n\n@layer cyber.ui {\n  /* One color per tone, as --tone; everything else is mixed from it. The\n     spine is the frame's own thick leading edge, so it takes the tone at\n     full strength and the glyph is printed on it in dark ink. */\n  [data-skin=\"cyber\"] [data-kit=\"alert\"] {\n    --tone: var(--cy-signal);\n    --spine: 28px;\n    --frame-cut: var(--cy-cut);\n    /* Frame variables inherit, and a surface behind may have set one. */\n    --frame-image: none;\n    --frame-spine: var(--spine);\n    --frame-line: var(--tone);\n    --frame-fill: color-mix(in srgb, var(--tone) 7%, var(--cy-panel));\n\n    display: flex;\n    flex-wrap: wrap;\n    align-items: center;\n    gap: 8px 14px;\n    width: 100%;\n    min-width: 0;\n    padding: 10px 14px 12px 12px;\n    text-align: start;\n\n    &[data-tone=\"success\"] {\n      --tone: var(--cy-ok);\n    }\n    &[data-tone=\"warning\"] {\n      --tone: var(--cy-flag);\n    }\n    /* Red is what everything here already is, so danger is the one that\n       lights its whole frame, and its text goes to the bright ink a lit\n       fill needs. */\n    &[data-tone=\"danger\"] {\n      --tone: var(--cy-accent);\n      --frame-fill: var(--cy-fill-active);\n    }\n  }\n\n  /* The glyph sits on the spine, which is a border: outside the padding\n     box, so it's placed with a negative offset the width of the spine. */\n  [data-skin=\"cyber\"] [data-kit=\"alert-glyph\"] {\n    position: absolute;\n    inset-block: 0;\n    inset-inline-start: calc(var(--spine) * -1);\n    display: grid;\n    place-items: center;\n    width: var(--spine);\n    color: var(--cy-on-solid);\n\n    & svg {\n      width: 16px;\n      height: 16px;\n      stroke-width: 2;\n    }\n\n    /* The critical one isn't quite steady. */\n    [data-tone=\"danger\"] > & svg {\n      animation: var(--cy-fx-flicker) 3.2s linear infinite;\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"alert-body\"] {\n    flex: 1 1 168px;\n    display: grid;\n    gap: 2px;\n    min-width: 0;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"alert-head\"] {\n    display: flex;\n    align-items: baseline;\n    justify-content: space-between;\n    gap: 4px 12px;\n    flex-wrap: wrap;\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"alert-title\"] {\n    min-width: 0;\n    font-size: var(--cy-text-md);\n    font-weight: 600;\n    line-height: 1.25;\n    letter-spacing: var(--cy-track);\n    text-transform: uppercase;\n    color: var(--tone);\n    text-wrap: balance;\n\n    [data-tone=\"danger\"] & {\n      color: var(--cy-ink-hi);\n    }\n  }\n\n  /* The tone, in words. */\n  [data-skin=\"cyber\"] [data-kit=\"alert-word\"] {\n    flex: none;\n    font-family: var(--cy-mono);\n    font-size: var(--cy-text-xs);\n    line-height: 1.4;\n    letter-spacing: 0.08em;\n    text-transform: uppercase;\n    color: var(--tone);\n\n    &::before {\n      content: \"// \";\n      opacity: 0.6;\n    }\n\n    [data-tone=\"danger\"] & {\n      color: var(--cy-ink-hi);\n    }\n  }\n\n  [data-skin=\"cyber\"] [data-kit=\"alert-text\"] {\n    max-width: 62ch;\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  [data-skin=\"cyber\"] [data-kit=\"alert-action\"] {\n    flex: none;\n    display: flex;\n    gap: var(--cy-gap);\n    margin-inline-start: auto;\n  }\n}\n",
      "type": "registry:file",
      "target": "@ui/cyber/alert.css"
    }
  ],
  "type": "registry:ui"
}
