{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "alert",
  "title": "Alert & Notice",
  "description": "Non-color semantic status notice (neutral, info, success, warning, danger) with glyph stamp, deduplicated screen-reader prefix, and restrained ARIA live-region defaults.",
  "registryDependencies": [
    "https://frame12.dev/r/frame12-styles.json",
    "https://frame12.dev/r/tag.json"
  ],
  "files": [
    {
      "path": "ui/alert.tsx",
      "content": "'use client';\n\nimport * as React from 'react';\nimport {\n  type SemanticStatus,\n  STATUS_GLYPHS,\n  STATUS_SR_LABELS,\n  extractTextContent,\n  startsWithStatusLabel,\n} from './tag';\n\nexport type AlertStatus = SemanticStatus;\nexport type AlertDensity = 'comfortable' | 'compact';\nexport type AlertLive = 'off' | 'polite' | 'assertive';\n\nexport interface AlertProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n  status?: AlertStatus;\n  title?: React.ReactNode;\n  description?: React.ReactNode;\n  glyph?: string | false;\n  srLabel?: string | false;\n  density?: AlertDensity;\n  live?: AlertLive;\n  onDismiss?: () => void;\n  dismissLabel?: string;\n  actions?: React.ReactNode;\n  children?: React.ReactNode;\n}\n\nexport type NoticeProps = AlertProps;\n\nfunction hasCompoundAlertSlot(node: React.ReactNode): boolean {\n  let found = false;\n  const walk = (n: React.ReactNode) => {\n    React.Children.forEach(n, (child) => {\n      if (found || !React.isValidElement<Record<string, unknown>>(child)) return;\n      const fnType = child.type as { f12AlertSlot?: boolean };\n      if (fnType?.f12AlertSlot) {\n        found = true;\n        return;\n      }\n      if (child.type === React.Fragment && child.props?.children) {\n        walk(child.props.children as React.ReactNode);\n      }\n    });\n  };\n  walk(node);\n  return found;\n}\n\nexport const Alert = React.forwardRef<HTMLDivElement, AlertProps>(function Alert(\n  {\n    status = 'info',\n    title,\n    description,\n    glyph,\n    srLabel,\n    density = 'comfortable',\n    live,\n    role: userRole,\n    onDismiss,\n    dismissLabel = 'Dismiss notice',\n    actions,\n    className = '',\n    children,\n    ...rest\n  },\n  ref,\n) {\n  const isCompact = density === 'compact';\n  const resolvedRole =\n    userRole ??\n    (live === 'assertive'\n      ? 'alert'\n      : live === 'polite'\n        ? 'status'\n        : live === 'off'\n          ? 'note'\n          : status === 'danger'\n            ? 'alert'\n            : 'note');\n\n  const resolvedGlyph =\n    glyph === false\n      ? undefined\n      : glyph !== undefined\n        ? glyph\n        : STATUS_GLYPHS[status];\n\n  const resolvedSrLabel =\n    srLabel === false\n      ? undefined\n      : srLabel !== undefined\n        ? srLabel\n        : STATUS_SR_LABELS[status];\n\n  const combinedText = [\n    extractTextContent(title),\n    extractTextContent(description),\n    extractTextContent(children),\n  ]\n    .filter(Boolean)\n    .join(' ')\n    .trim();\n  const showSrLabel =\n    Boolean(resolvedSrLabel) &&\n    !(\n      combinedText &&\n      resolvedSrLabel &&\n      startsWithStatusLabel(combinedText, resolvedSrLabel, status)\n    );\n\n  const isCompound = hasCompoundAlertSlot(children);\n\n  return (\n    <div\n      ref={ref}\n      role={resolvedRole}\n      data-status={status}\n      data-density={isCompact ? 'compact' : undefined}\n      className={`f12-alert f12-alert-${status}${isCompact ? ' f12-alert-compact' : ''}${className ? ` ${className}` : ''}`}\n      {...rest}\n    >\n      {resolvedGlyph && (\n        <span className=\"f12-alert-glyph f12-status-glyph\" aria-hidden=\"true\">\n          {resolvedGlyph}\n        </span>\n      )}\n      <div className=\"f12-alert-body\">\n        {showSrLabel && <span className=\"f12-sr-only\">{`${resolvedSrLabel}: `}</span>}\n        {title && <div className=\"f12-alert-title\">{title}</div>}\n        {description && <div className=\"f12-alert-description\">{description}</div>}\n        {children &&\n          (isCompound ? (\n            children\n          ) : (\n            <div className=\"f12-alert-description\">{children}</div>\n          ))}\n        {actions && <div className=\"f12-alert-actions\">{actions}</div>}\n      </div>\n      {onDismiss && (\n        <button\n          type=\"button\"\n          className=\"f12-alert-dismiss\"\n          aria-label={dismissLabel}\n          onClick={onDismiss}\n        >\n          <span aria-hidden=\"true\">×</span>\n        </button>\n      )}\n    </div>\n  );\n});\n\nexport const Notice = React.forwardRef<HTMLDivElement, NoticeProps>(function Notice(\n  { live = 'off', ...rest },\n  ref,\n) {\n  return <Alert ref={ref} live={live} {...rest} />;\n});\n\nexport type AlertTitleProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const AlertTitle = React.forwardRef<HTMLDivElement, AlertTitleProps>(function AlertTitle(\n  { className = '', children, ...rest },\n  ref,\n) {\n  return (\n    <div ref={ref} className={`f12-alert-title${className ? ` ${className}` : ''}`} {...rest}>\n      {children}\n    </div>\n  );\n});\n(AlertTitle as unknown as { f12AlertSlot?: boolean }).f12AlertSlot = true;\n\nexport type AlertDescriptionProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const AlertDescription = React.forwardRef<HTMLDivElement, AlertDescriptionProps>(\n  function AlertDescription({ className = '', children, ...rest }, ref) {\n    return (\n      <div\n        ref={ref}\n        className={`f12-alert-description${className ? ` ${className}` : ''}`}\n        {...rest}\n      >\n        {children}\n      </div>\n    );\n  },\n);\n(AlertDescription as unknown as { f12AlertSlot?: boolean }).f12AlertSlot = true;\n\nexport type AlertActionsProps = React.HTMLAttributes<HTMLDivElement>;\n\nexport const AlertActions = React.forwardRef<HTMLDivElement, AlertActionsProps>(\n  function AlertActions({ className = '', children, ...rest }, ref) {\n    return (\n      <div ref={ref} className={`f12-alert-actions${className ? ` ${className}` : ''}`} {...rest}>\n        {children}\n      </div>\n    );\n  },\n);\n(AlertActions as unknown as { f12AlertSlot?: boolean }).f12AlertSlot = true;\n",
      "type": "registry:ui",
      "target": "components/frame12/alert.tsx"
    }
  ],
  "type": "registry:ui"
}