# Notification

通知提醒组件，以函数式调用在页面角落弹出通知消息，支持多种类型和位置。

## 适用场景

- 系统级通知消息（如环境状态变更、任务完成）
- 需要标题和详细内容的操作反馈
- 需要在不同角落展示的持续性通知

## Props

`notification` 是函数式 API，无 React 组件 props 定义，通过调用参数传入配置。

## 典型用法

### 基础通知

```tsx
import { notification } from '@befe/brick'

notification({
    headline: '环境通知',
    content: 'Notebook 已从运行状态中恢复，请查看变量监控和运行历史了解运行状态',
})
```

### 消息类型

```tsx
import { notification } from '@befe/brick'

notification.info('通知', '一小段消息话术')
notification.success('成功消息', '一小段消息话术')
notification.warning('警告消息', '一小段消息话术')
notification.error('错误消息', '一小段消息话术')
```

### 指定弹出位置

```tsx
import { notification, NotificationOptions } from '@befe/brick'

notification({
    headline: '消息标题',
    content: '一串消息内容话术串',
    placement: 'top-right', // 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
})
```

### 禁用手动关闭

```tsx
notification({
    type: 'success',
    icon: true,
    headline: '连接成功',
    content: '现在可以正常使用了',
    manualClose: false,
})
```

### 样式隔离（createNotification）

> `notification()` 在独立 root 渲染，ConfigProvider 的 context 值无法跨 root 传递，需使用 `createNotification` 单独传入配置。

```tsx
import { createNotification } from '@befe/brick'

const notification = createNotification({
    wrapClassName: 'awesome-one',
})

notification({
    headline: '环境通知',
    content: '通知内容',
})
```

## 注意事项

- `notification()` 在页面上另行取 root 进行 render，ConfigProvider 配置的值（除 `theme`、`i18n` 外）在不同 root 间无法访问
- 需要样式隔离时，使用 `createNotification({wrapClassName})` 重新创建 notification 实例，并传入与应用一致的配置
- `manualClose: false` 时不显示关闭按钮，仅依赖自动消失
- 类似的 API 还有 Message 的 `createMessage()` 和 Dialog 的 `createConfirm()`、`createAlert()`
