{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "alert",
  "type": "registry:ui",
  "title": "Alert",
  "description": "هشدار",
  "registryDependencies": [
    "https://kashi.sepantapouya.com/r/cx.json",
    "https://kashi.sepantapouya.com/r/icons.json",
    "https://kashi.sepantapouya.com/r/kashi-provider.json"
  ],
  "files": [
    {
      "path": "registry/kashi/Alert.tsx",
      "type": "registry:ui",
      "target": "components/kashi/Alert.tsx",
      "content": "\"use client\";\n\nimport { forwardRef, type HTMLAttributes, type ReactElement, type ReactNode } from \"react\";\nimport { cx } from \"./cx\";\nimport { CloseIcon, ErrorIcon, InfoIcon, SuccessIcon, WarningIcon } from \"./icons\";\nimport { useKashi } from \"./KashiProvider\";\n\nexport type AlertTone = \"neutral\" | \"brand\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\nexport interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n  /** @default \"neutral\" */\n  tone?: AlertTone;\n  title?: ReactNode;\n  /** آیکون سفارشی؛ false برای حذف */\n  icon?: ReactNode | false;\n  /** دکمه‌ها یا لینک‌های زیر متن */\n  actions?: ReactNode;\n  /** با دادن این تابع دکمهٔ بستن نمایش داده می‌شود */\n  onClose?: () => void;\n  /** @default \"بستن\" */\n  closeLabel?: string;\n  /** پس‌زمینهٔ رنگی کم‌رنگ */\n  tinted?: boolean;\n  /** «banner»: تمام‌عرض بالای صفحه، بدون گوشهٔ گرد @default \"card\" */\n  layout?: \"card\" | \"banner\";\n  /** «sm»: فشرده، مناسب داخل فرم‌ها @default \"md\" */\n  size?: \"sm\" | \"md\";\n  classNames?: { root?: string; icon?: string; title?: string; description?: string; actions?: string };\n}\n\nconst ICONS: Record<AlertTone, () => ReactElement> = {\n  neutral: InfoIcon,\n  brand: InfoIcon,\n  info: InfoIcon,\n  success: SuccessIcon,\n  warning: WarningIcon,\n  error: ErrorIcon,\n};\n\nexport const Alert = forwardRef<HTMLDivElement, AlertProps>(function Alert(\n  { tone = \"neutral\", title, icon, actions, onClose, closeLabel, tinted = false, layout = \"card\", size = \"md\", classNames = {}, role, className, children, ...rest },\n  ref,\n) {\n  const { messages: M } = useKashi();\n  closeLabel ??= M.alert.close;\n  const Icon = ICONS[tone];\n  return (\n    <div\n      ref={ref}\n      // خطا و هشدار فوراً خوانده می‌شوند؛ بقیه مؤدبانه\n      role={role ?? (tone === \"error\" || tone === \"warning\" ? \"alert\" : \"status\")}\n      data-tone={tone}\n      className={cx(\"k-alert\", tone !== \"neutral\" && `k-alert--${tone}`, tinted && \"k-alert--tinted\", layout === \"banner\" && \"k-alert--banner\", size === \"sm\" && \"k-alert--sm\", className, classNames.root)}\n      {...rest}\n    >\n      {icon !== false && <span className={cx(\"k-alert__icon\", classNames.icon)} aria-hidden=\"true\">{icon ?? <Icon />}</span>}\n      <div className=\"k-alert__content\">\n        {title && <p className={cx(\"k-alert__title\", classNames.title)}>{title}</p>}\n        {children && <div className={cx(\"k-alert__description\", classNames.description)}>{children}</div>}\n        {actions && <div className={cx(\"k-alert__actions\", classNames.actions)}>{actions}</div>}\n      </div>\n      {onClose && (\n        <button type=\"button\" className=\"k-btn k-btn--tertiary k-btn--icon k-btn--sm k-alert__close\" aria-label={closeLabel} onClick={onClose}>\n          <CloseIcon />\n        </button>\n      )}\n    </div>\n  );\n});\n"
    }
  ]
}