@autional/ui 0.1.0-rc.51 → 0.1.0-rc.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/atoms/Button.tsx
CHANGED
|
@@ -28,7 +28,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
28
28
|
primary: 'bg-[var(--color-brand)] text-[var(--color-on-brand)] hover:bg-[var(--color-brand-hover)]',
|
|
29
29
|
secondary: 'bg-[var(--color-bg-muted)] text-[var(--color-text-primary)] hover:opacity-80',
|
|
30
30
|
outline:
|
|
31
|
-
'border border-[var(--color-border-
|
|
31
|
+
'border border-[var(--color-border-strong)] bg-transparent hover:bg-[var(--color-bg-muted)] text-[var(--color-text-primary)]',
|
|
32
32
|
ghost: 'bg-transparent hover:bg-[var(--color-bg-muted)] text-[var(--color-text-primary)]',
|
|
33
33
|
danger: 'bg-[var(--color-danger)] text-white hover:opacity-80',
|
|
34
34
|
};
|
package/src/i18n/resources.ts
CHANGED
|
@@ -29,6 +29,9 @@ export const uiI18nResources: Record<'zh-CN' | 'en-US', Record<string, string>>
|
|
|
29
29
|
'pageStatus.loading': '加载中…',
|
|
30
30
|
'pageStatus.loadError': '数据加载失败',
|
|
31
31
|
'pageStatus.retry': '重试',
|
|
32
|
+
// ErrorState 默认标题与描述(原组件硬编码中文);重试按钮复用 pageStatus.retry。
|
|
33
|
+
'errorState.title': '加载失败',
|
|
34
|
+
'errorState.description': '请稍后重试',
|
|
32
35
|
// ThemeToggle 默认文案(UP-04:原为组件内硬编码中文,EN 站点顶栏出现中文标签)
|
|
33
36
|
'theme.toggleDark': '切换到深色模式',
|
|
34
37
|
'theme.toggleLight': '切换到浅色模式',
|
|
@@ -58,6 +61,8 @@ export const uiI18nResources: Record<'zh-CN' | 'en-US', Record<string, string>>
|
|
|
58
61
|
'pageStatus.loading': 'Loading...',
|
|
59
62
|
'pageStatus.loadError': 'Data loading failed',
|
|
60
63
|
'pageStatus.retry': 'Retry',
|
|
64
|
+
'errorState.title': 'Failed to load',
|
|
65
|
+
'errorState.description': 'Please try again later',
|
|
61
66
|
'theme.toggleDark': 'Switch to dark mode',
|
|
62
67
|
'theme.toggleLight': 'Switch to light mode',
|
|
63
68
|
// EN 词汇对齐舰队既有口径(Loading... / No data / Confirm / Cancel / Close)
|
|
@@ -99,7 +99,7 @@ export const ConfirmDialog = React.memo(function ConfirmDialog({
|
|
|
99
99
|
<div className="mt-6 flex justify-end gap-3">
|
|
100
100
|
<button
|
|
101
101
|
onClick={onCancel}
|
|
102
|
-
className="rounded-md border border-[var(--color-border-
|
|
102
|
+
className="rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text-primary)] transition-colors hover:bg-[var(--color-bg-muted)]"
|
|
103
103
|
>
|
|
104
104
|
{cancelLabel}
|
|
105
105
|
</button>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { AlertTriangle, RefreshCw } from 'lucide-react';
|
|
2
|
+
import { useTranslation } from 'react-i18next';
|
|
3
|
+
import { UI_I18N_NS, uiText } from '../i18n';
|
|
2
4
|
|
|
3
5
|
export interface ErrorStateProps {
|
|
4
6
|
title?: string;
|
|
@@ -17,8 +19,13 @@ export function ErrorState({
|
|
|
17
19
|
action,
|
|
18
20
|
className = '',
|
|
19
21
|
}: ErrorStateProps) {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
+
const { t, i18n } = useTranslation();
|
|
23
|
+
// 文案解析链与 LoadingScreen / EmptyState 同构(语言问题审计 2026-10-13 家族):
|
|
24
|
+
// 原为硬编码中文默认,EN 站错误态裸露「加载失败 / 请稍后重试 / 重试」。
|
|
25
|
+
const resolve = (key: string, fallback: string): string =>
|
|
26
|
+
t(key, { ns: UI_I18N_NS, defaultValue: uiText(i18n.language, key) ?? fallback });
|
|
27
|
+
const displayTitle = title || resolve('errorState.title', '加载失败');
|
|
28
|
+
const displayMessage = description || message || resolve('errorState.description', '请稍后重试');
|
|
22
29
|
|
|
23
30
|
return (
|
|
24
31
|
<div
|
|
@@ -34,7 +41,7 @@ export function ErrorState({
|
|
|
34
41
|
{action ? (
|
|
35
42
|
<button
|
|
36
43
|
onClick={action.onClick}
|
|
37
|
-
className="inline-flex items-center gap-1.5 rounded-md border border-[var(--color-border-
|
|
44
|
+
className="inline-flex items-center gap-1.5 rounded-md border border-[var(--color-border-strong)] bg-[var(--color-bg-surface)] px-3 py-1.5 text-xs text-[var(--color-text-primary)] hover:bg-[var(--color-bg-muted)]"
|
|
38
45
|
>
|
|
39
46
|
{action.label}
|
|
40
47
|
</button>
|
|
@@ -44,7 +51,7 @@ export function ErrorState({
|
|
|
44
51
|
className="inline-flex items-center gap-1.5 rounded-md border border-danger-soft bg-[var(--color-bg-surface)] px-3 py-1.5 text-xs text-danger-text hover:bg-danger-soft"
|
|
45
52
|
>
|
|
46
53
|
<RefreshCw className="h-3.5 w-3.5" />
|
|
47
|
-
重试
|
|
54
|
+
{resolve('pageStatus.retry', '重试')}
|
|
48
55
|
</button>
|
|
49
56
|
) : null}
|
|
50
57
|
</div>
|