@tfdesign/b-end 1.0.4
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/AI_READ_FIRST.md +131 -0
- package/LICENSE +21 -0
- package/README.md +353 -0
- package/package.json +67 -0
- package/scripts/check-tfds-contract.mjs +334 -0
- package/scripts/check-tfds-integration.mjs +263 -0
- package/scripts/postinstall-cursor-skill.mjs +382 -0
- package/scripts/setup.mjs +520 -0
- package/skills/tfds/CHECKLIST.md +205 -0
- package/skills/tfds/COMMON_FAILURES.md +238 -0
- package/skills/tfds/DESIGN_PRINCIPLES.md +477 -0
- package/skills/tfds/GLOBAL_DESIGN_RULES.md +636 -0
- package/skills/tfds/LAYOUT_RECIPES.md +140 -0
- package/skills/tfds/LAYOUT_RULES.md +1355 -0
- package/skills/tfds/PAGE_ARCHETYPES.md +201 -0
- package/skills/tfds/SKILL.md +188 -0
- package/skills/tfds/components.index.json +7305 -0
- package/skills/tfds/components.summary.json +1809 -0
- package/src/_b_end_runtime/components/AiSuggestionShared.jsx +166 -0
- package/src/_b_end_runtime/components/Avatar.jsx +325 -0
- package/src/_b_end_runtime/components/Avatar.tokens.js +76 -0
- package/src/_b_end_runtime/components/AvatarGridPreview.jsx +56 -0
- package/src/_b_end_runtime/components/AvatarGroup.jsx +80 -0
- package/src/_b_end_runtime/components/AvatarGroup.tokens.js +28 -0
- package/src/_b_end_runtime/components/Button.jsx +144 -0
- package/src/_b_end_runtime/components/Button.tokens.js +90 -0
- package/src/_b_end_runtime/components/Card.jsx +460 -0
- package/src/_b_end_runtime/components/Card.tokens.js +124 -0
- package/src/_b_end_runtime/components/CardPreview.jsx +51 -0
- package/src/_b_end_runtime/components/ChatBubble.jsx +384 -0
- package/src/_b_end_runtime/components/ChatBubble.tokens.js +60 -0
- package/src/_b_end_runtime/components/ChatBubblePreview.jsx +129 -0
- package/src/_b_end_runtime/components/ChatInput.jsx +1399 -0
- package/src/_b_end_runtime/components/ChatInput.tokens.js +75 -0
- package/src/_b_end_runtime/components/ChatMessage.jsx +2215 -0
- package/src/_b_end_runtime/components/ChatMessage.tokens.js +257 -0
- package/src/_b_end_runtime/components/ChatMessagePreview.jsx +388 -0
- package/src/_b_end_runtime/components/Checkbox.jsx +317 -0
- package/src/_b_end_runtime/components/Checkbox.tokens.js +59 -0
- package/src/_b_end_runtime/components/ConversationList.jsx +1264 -0
- package/src/_b_end_runtime/components/ConversationList.tokens.js +135 -0
- package/src/_b_end_runtime/components/ConversationListPreview.jsx +108 -0
- package/src/_b_end_runtime/components/CustomerServiceWorkspaceFrame.jsx +324 -0
- package/src/_b_end_runtime/components/CustomerServiceWorkspaceFrame.tokens.js +69 -0
- package/src/_b_end_runtime/components/DatePicker.jsx +739 -0
- package/src/_b_end_runtime/components/DatePicker.tokens.js +99 -0
- package/src/_b_end_runtime/components/Empty.jsx +141 -0
- package/src/_b_end_runtime/components/Empty.tokens.js +40 -0
- package/src/_b_end_runtime/components/Form.jsx +609 -0
- package/src/_b_end_runtime/components/Form.tokens.js +77 -0
- package/src/_b_end_runtime/components/FormFieldStack.jsx +123 -0
- package/src/_b_end_runtime/components/FormFieldStack.tokens.js +12 -0
- package/src/_b_end_runtime/components/FormTitle.jsx +119 -0
- package/src/_b_end_runtime/components/FormTitle.tokens.js +87 -0
- package/src/_b_end_runtime/components/FullScreenPage.jsx +97 -0
- package/src/_b_end_runtime/components/FullScreenPage.tokens.js +19 -0
- package/src/_b_end_runtime/components/Icon.jsx +172 -0
- package/src/_b_end_runtime/components/Icon.tokens.js +26 -0
- package/src/_b_end_runtime/components/IconGridPreview.jsx +277 -0
- package/src/_b_end_runtime/components/InfoDisplayPanel.jsx +620 -0
- package/src/_b_end_runtime/components/InfoDisplayPanel.tokens.js +71 -0
- package/src/_b_end_runtime/components/InfoDisplayPanelPreview.jsx +133 -0
- package/src/_b_end_runtime/components/Input.jsx +258 -0
- package/src/_b_end_runtime/components/Input.tokens.js +68 -0
- package/src/_b_end_runtime/components/InputNumber.jsx +242 -0
- package/src/_b_end_runtime/components/InputNumber.tokens.js +55 -0
- package/src/_b_end_runtime/components/Modal.jsx +155 -0
- package/src/_b_end_runtime/components/Modal.tokens.js +73 -0
- package/src/_b_end_runtime/components/NavBar.jsx +842 -0
- package/src/_b_end_runtime/components/NavBar.tokens.js +97 -0
- package/src/_b_end_runtime/components/NavBarPreview.jsx +11 -0
- package/src/_b_end_runtime/components/Radio.jsx +227 -0
- package/src/_b_end_runtime/components/Radio.tokens.js +59 -0
- package/src/_b_end_runtime/components/Select.jsx +766 -0
- package/src/_b_end_runtime/components/Select.tokens.js +99 -0
- package/src/_b_end_runtime/components/Sheet.jsx +132 -0
- package/src/_b_end_runtime/components/Sheet.tokens.js +61 -0
- package/src/_b_end_runtime/components/Slider.jsx +346 -0
- package/src/_b_end_runtime/components/Slider.tokens.js +47 -0
- package/src/_b_end_runtime/components/Switch.jsx +124 -0
- package/src/_b_end_runtime/components/Switch.tokens.js +38 -0
- package/src/_b_end_runtime/components/Table.jsx +1338 -0
- package/src/_b_end_runtime/components/Table.tokens.js +147 -0
- package/src/_b_end_runtime/components/TablePreview.jsx +599 -0
- package/src/_b_end_runtime/components/Tabs.jsx +149 -0
- package/src/_b_end_runtime/components/Tabs.tokens.js +102 -0
- package/src/_b_end_runtime/components/Tag.jsx +199 -0
- package/src/_b_end_runtime/components/Tag.tokens.js +171 -0
- package/src/_b_end_runtime/components/TagBar.jsx +1134 -0
- package/src/_b_end_runtime/components/TagBar.tokens.js +75 -0
- package/src/_b_end_runtime/components/TagGridPreview.jsx +23 -0
- package/src/_b_end_runtime/components/TagInput.jsx +382 -0
- package/src/_b_end_runtime/components/TagInput.tokens.js +52 -0
- package/src/_b_end_runtime/components/TextArea.jsx +363 -0
- package/src/_b_end_runtime/components/TextArea.tokens.js +65 -0
- package/src/_b_end_runtime/components/TimePicker.jsx +444 -0
- package/src/_b_end_runtime/components/TimePicker.tokens.js +77 -0
- package/src/_b_end_runtime/components/Toast.jsx +120 -0
- package/src/_b_end_runtime/components/Toast.tokens.js +146 -0
- package/src/_b_end_runtime/components/Tooltip.jsx +282 -0
- package/src/_b_end_runtime/components/Tooltip.tokens.js +48 -0
- package/src/_b_end_runtime/components/TooltipPreview.jsx +50 -0
- package/src/_b_end_runtime/components/Upload.jsx +455 -0
- package/src/_b_end_runtime/components/Upload.tokens.js +47 -0
- package/src/_b_end_runtime/components/avatar-assets/avatar-default.png +0 -0
- package/src/_b_end_runtime/components/avatar-group-assets/avatar-group-1.png +0 -0
- package/src/_b_end_runtime/components/avatar-group-assets/avatar-group-2.png +0 -0
- package/src/_b_end_runtime/components/avatar-group-assets/avatar-group-3.png +0 -0
- package/src/_b_end_runtime/components/avatar-group-assets/avatar-group-4.png +0 -0
- package/src/_b_end_runtime/components/avatar-group-assets/avatar-group-5.png +0 -0
- package/src/_b_end_runtime/components/empty-assets/administrator-1.svg +40 -0
- package/src/_b_end_runtime/components/empty-assets/administrator-2.svg +33 -0
- package/src/_b_end_runtime/components/empty-assets/construction.svg +33 -0
- package/src/_b_end_runtime/components/empty-assets/failure.svg +49 -0
- package/src/_b_end_runtime/components/empty-assets/idle.svg +34 -0
- package/src/_b_end_runtime/components/empty-assets/no-access.svg +36 -0
- package/src/_b_end_runtime/components/empty-assets/no-content.svg +77 -0
- package/src/_b_end_runtime/components/empty-assets/no-result.svg +61 -0
- package/src/_b_end_runtime/components/empty-assets/not-found.svg +46 -0
- package/src/_b_end_runtime/components/empty-assets/success.svg +38 -0
- package/src/_b_end_runtime/components/file-type-assets/batch-report.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/catcat.svg +21 -0
- package/src/_b_end_runtime/components/file-type-assets/code.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/conversation.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/document.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/feishu-card.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/feishu-sheet.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/feishu.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/image.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/index.js +105 -0
- package/src/_b_end_runtime/components/file-type-assets/knowledge.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/pdf.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/pe.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/strategy.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/table.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/webpage.png +0 -0
- package/src/_b_end_runtime/components/file-type-assets/xmind.png +0 -0
- package/src/_b_end_runtime/components/icons/icon-data.js +12496 -0
- package/src/_b_end_runtime/components/nav-bar-assets/bytehi-logo-mark.svg +21 -0
- package/src/_b_end_runtime/components/table-assets/avatar.png +0 -0
- package/src/_b_end_runtime/components/table-assets/button.png +0 -0
- package/src/_b_end_runtime/components/table-assets/icon-chevron-down.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/avatar.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/button.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/checkbox.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/icon-chevron-right.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/icon.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/semi-icons-handle.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/semi-icons-tree-triangle-right.png +0 -0
- package/src/_b_end_runtime/components/table-cell-assets/switch.png +0 -0
- package/src/_b_end_runtime/components/tagShared.js +3 -0
- package/src/_b_end_runtime/components/team-avatar-assets/chengcheng-murphy.png +0 -0
- package/src/_b_end_runtime/components/team-avatar-assets/duan-ran.png +0 -0
- package/src/_b_end_runtime/components/team-avatar-assets/guo-zhezhi.png +0 -0
- package/src/_b_end_runtime/components/team-avatar-assets/li-siru.png +0 -0
- package/src/_b_end_runtime/components/team-avatar-assets/liu-delin.png +0 -0
- package/src/_b_end_runtime/components.js +3499 -0
- package/src/_b_end_runtime/index.js +9 -0
- package/src/_b_end_runtime/page-patterns/BasePageFramePattern.jsx +395 -0
- package/src/_b_end_runtime/page-patterns/ChatConversationPattern.jsx +989 -0
- package/src/_b_end_runtime/page-patterns/ChatHomePagePattern.jsx +281 -0
- package/src/_b_end_runtime/page-patterns/CopilotPagePattern.jsx +380 -0
- package/src/_b_end_runtime/page-patterns/CustomerServiceWorkspaceFramePattern.jsx +392 -0
- package/src/_b_end_runtime/page-patterns/IMConversationPattern.jsx +590 -0
- package/src/_b_end_runtime/page-patterns/McpManagementPage.jsx +237 -0
- package/src/_b_end_runtime/page-patterns/StrategyListPage.jsx +189 -0
- package/src/_b_end_runtime/page-patterns/TabTopBarListPage.jsx +594 -0
- package/src/_b_end_runtime/page-patterns/VariableManagementPage.jsx +87 -0
- package/src/_b_end_runtime/page-patterns/pageListShared.jsx +177 -0
- package/src/_b_end_runtime/patterns.js +428 -0
- package/src/_b_end_runtime/preview-registry.jsx +4719 -0
- package/src/_b_end_runtime/teamMembers.js +56 -0
- package/src/_b_end_runtime/tokens.js +500 -0
- package/src/index.d.ts +1073 -0
- package/src/index.js +52 -0
- package/theme.css +350 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DatePicker — TOKEN_MAP(供平台属性面板展示)
|
|
3
|
+
*
|
|
4
|
+
* 对齐 HiUI DatePicker Trigger + Panel(Date / Datetime / Daterange / DatetimeRange)
|
|
5
|
+
* 分组顺序:文本 → 图标 → 触发器 → 面板容器 → 日历结构 → 底部栏 → 类型尺寸
|
|
6
|
+
*/
|
|
7
|
+
export const DATEPICKER_TOKEN_MAP = {
|
|
8
|
+
base: [
|
|
9
|
+
{ label: '默认高度', cssProp: 'height', value: '36px' },
|
|
10
|
+
],
|
|
11
|
+
值文本: [
|
|
12
|
+
{ label: '颜色', cssProp: 'color', token: '--color-foreground', value: '#182230', semanticRef: 'text-primary' },
|
|
13
|
+
{ label: '字号', cssProp: 'font-size', token: '--text-sm', value: '14px' },
|
|
14
|
+
{ label: '行高', cssProp: 'line-height', value: '20px' },
|
|
15
|
+
],
|
|
16
|
+
占位符: [
|
|
17
|
+
{ label: '颜色', cssProp: 'color', token: '--color-foreground-muted', value: '#667085', semanticRef: 'text-tertiary' },
|
|
18
|
+
{ label: '字号', cssProp: 'font-size', token: '--text-sm', value: '14px' },
|
|
19
|
+
{ label: '行高', cssProp: 'line-height', value: '20px' },
|
|
20
|
+
],
|
|
21
|
+
范围分隔: [
|
|
22
|
+
{ label: '颜色', cssProp: 'color', token: '--color-foreground-muted', value: '#667085', semanticRef: 'text-tertiary' },
|
|
23
|
+
{ label: '字号', cssProp: 'font-size', token: '--text-sm', value: '14px' },
|
|
24
|
+
],
|
|
25
|
+
图标: [
|
|
26
|
+
{ label: '颜色', cssProp: 'color', token: '--color-foreground-disabled', value: '#98A2B3', semanticRef: 'text-disabled' },
|
|
27
|
+
{ label: '尺寸', cssProp: 'width / height', value: '16px' },
|
|
28
|
+
],
|
|
29
|
+
触发器: [
|
|
30
|
+
{ label: '背景色', cssProp: 'background', token: '--color-surface', value: '#FFFFFF', semanticRef: 'bg-surface' },
|
|
31
|
+
{ label: '边框色', cssProp: 'border-color', token: '--color-border-default', value: '#E4E7EC', semanticRef: 'border-default' },
|
|
32
|
+
{ label: '圆角', cssProp: 'border-radius', token: '--radius-md', value: '8px' },
|
|
33
|
+
{ label: '左内边距', cssProp: 'padding-left', token: '--spacing-3', value: '12px' },
|
|
34
|
+
{ label: '右内边距', cssProp: 'padding-right', token: '--spacing-2', value: '8px' },
|
|
35
|
+
{ label: '元素间距', cssProp: 'gap', token: '--spacing-2', value: '8px' },
|
|
36
|
+
{ label: '悬浮边框', cssProp: 'border-color', token: '--color-blueGrey-400', value: '#D0D5DD', state: 'hover' },
|
|
37
|
+
{ label: '聚焦边框', cssProp: 'border-color', token: '--color-primary', value: '#56D3BC', semanticRef: 'status-primary', state: 'focus' },
|
|
38
|
+
{ label: '背景色', cssProp: 'background', token: '--color-disabled', value: '#F9FAFB', semanticRef: 'bg-disabled', state: 'disabled' },
|
|
39
|
+
{ label: '边框色', cssProp: 'border-color', token: '--color-border-default', value: '#E4E7EC', semanticRef: 'border-default', state: 'disabled' },
|
|
40
|
+
{ label: '透明度', cssProp: 'opacity', value: '0.6', state: 'disabled' },
|
|
41
|
+
],
|
|
42
|
+
面板容器: [
|
|
43
|
+
{ label: '背景色', cssProp: 'background', token: '--color-surface', value: '#FFFFFF', semanticRef: 'bg-surface' },
|
|
44
|
+
{ label: '边框色', cssProp: 'border-color', token: '--color-border-default', value: '#E4E7EC', semanticRef: 'border-default' },
|
|
45
|
+
{ label: '圆角', cssProp: 'border-radius', value: '6px' },
|
|
46
|
+
{ label: '阴影', cssProp: 'box-shadow', value: '0 4px 14px rgba(0,0,0,0.1)' },
|
|
47
|
+
],
|
|
48
|
+
月标题栏: [
|
|
49
|
+
{ label: '标题颜色', cssProp: 'color', token: '--color-foreground', value: '#182230', semanticRef: 'text-primary' },
|
|
50
|
+
{ label: '标题字号', cssProp: 'font-size', token: '--text-sm', value: '14px' },
|
|
51
|
+
{ label: '标题字重', cssProp: 'font-weight', value: '600' },
|
|
52
|
+
{ label: '导航图标', cssProp: 'color', token: '--color-foreground-secondary', value: '#475467', semanticRef: 'text-secondary' },
|
|
53
|
+
{ label: '悬停背景', cssProp: 'background', token: '--color-fill', value: 'rgba(83,96,143,0.07)', semanticRef: 'fill-default', state: 'hover' },
|
|
54
|
+
],
|
|
55
|
+
星期标题: [
|
|
56
|
+
{ label: '颜色', cssProp: 'color', token: '--color-foreground-muted', value: '#667085', semanticRef: 'text-tertiary' },
|
|
57
|
+
{ label: '字号', cssProp: 'font-size', value: '12px' },
|
|
58
|
+
{ label: '字重', cssProp: 'font-weight', value: '600' },
|
|
59
|
+
{ label: '行高', cssProp: 'line-height', value: '16px' },
|
|
60
|
+
],
|
|
61
|
+
日期默认: [
|
|
62
|
+
{ label: '文字色', cssProp: 'color', token: '--color-foreground', value: '#182230', semanticRef: 'text-primary' },
|
|
63
|
+
{ label: '字号', cssProp: 'font-size', token: '--text-sm', value: '14px' },
|
|
64
|
+
{ label: '格子尺寸', cssProp: 'width / height', value: 'auto / 36px' },
|
|
65
|
+
{ label: '内层选中块', cssProp: 'inner width / height', value: '32px / 32px' },
|
|
66
|
+
],
|
|
67
|
+
日期今天: [
|
|
68
|
+
{ label: '背景色', cssProp: 'background', value: 'rgba(52,59,58,0.05)' },
|
|
69
|
+
{ label: '文字色', cssProp: 'color', token: '--color-primary', value: '#56D3BC', semanticRef: 'status-primary' },
|
|
70
|
+
{ label: '字重', cssProp: 'font-weight', value: '600' },
|
|
71
|
+
],
|
|
72
|
+
日期选中: [
|
|
73
|
+
{ label: '背景色', cssProp: 'background', token: '--color-primary', value: '#56D3BC', semanticRef: 'status-primary' },
|
|
74
|
+
{ label: '文字色', cssProp: 'color', token: '--color-foreground-inverse', value: '#FFFFFF', semanticRef: 'text-inverse' },
|
|
75
|
+
{ label: '圆角', cssProp: 'border-radius', value: '3px' },
|
|
76
|
+
],
|
|
77
|
+
范围高亮: [
|
|
78
|
+
{ label: '背景色', cssProp: 'background', token: '--color-brand-50', value: '#EAFAF6', semanticRef: 'status-primary.bg' },
|
|
79
|
+
{ label: '起止圆角', cssProp: 'border-radius', value: '3px(仅起止端)' },
|
|
80
|
+
],
|
|
81
|
+
时间底栏: [
|
|
82
|
+
{ label: '上边框', cssProp: 'border-top-color', token: '--color-border-default', value: '#E4E7EC', semanticRef: 'border-default' },
|
|
83
|
+
{ label: '日期文字', cssProp: 'color', token: '--color-foreground', value: '#182230', semanticRef: 'text-primary' },
|
|
84
|
+
{ label: '时间文字', cssProp: 'color', token: '--color-foreground-muted', value: '#667085', semanticRef: 'text-tertiary' },
|
|
85
|
+
{ label: '图标色', cssProp: 'color', token: '--color-foreground-secondary', value: '#475467', semanticRef: 'text-secondary' },
|
|
86
|
+
],
|
|
87
|
+
面板尺寸: [
|
|
88
|
+
{ label: '面板宽度', cssProp: 'width', value: 'same as trigger, min 280px' },
|
|
89
|
+
{ label: '纯日期高度', cssProp: 'height', value: '312px' },
|
|
90
|
+
{ label: '日期时间高度', cssProp: 'height', value: '348px' },
|
|
91
|
+
{ label: '日期范围高度', cssProp: 'height', value: '312px' },
|
|
92
|
+
{ label: '日时范围高度', cssProp: 'height', value: '348px' },
|
|
93
|
+
],
|
|
94
|
+
类型宽度: [
|
|
95
|
+
{ label: '日期类宽', cssProp: 'width', value: '300px' },
|
|
96
|
+
{ label: '范围宽度', cssProp: 'width', value: '300px' },
|
|
97
|
+
{ label: '加宽范围', cssProp: 'width', value: '400px' },
|
|
98
|
+
],
|
|
99
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import Button from './Button';
|
|
2
|
+
|
|
3
|
+
import imgFailure from './empty-assets/failure.svg';
|
|
4
|
+
import imgIdle from './empty-assets/idle.svg';
|
|
5
|
+
import imgNoResult from './empty-assets/no-result.svg';
|
|
6
|
+
import imgNotFound from './empty-assets/not-found.svg';
|
|
7
|
+
import imgSuccess from './empty-assets/success.svg';
|
|
8
|
+
import imgConstruction from './empty-assets/construction.svg';
|
|
9
|
+
import imgNoAccess from './empty-assets/no-access.svg';
|
|
10
|
+
import imgNoContent from './empty-assets/no-content.svg';
|
|
11
|
+
import imgAdmin1 from './empty-assets/administrator-1.svg';
|
|
12
|
+
import imgAdmin2 from './empty-assets/administrator-2.svg';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Empty — B端空状态占位组件(Tailwind 内联)
|
|
16
|
+
*
|
|
17
|
+
* 固定布局:插画 → 文案区 → 操作区,所有内容区域均可按需配置,不传则不渲染。
|
|
18
|
+
* 通过 props 自由组合出不同场景,见 components.js examples 中的常见用法建议。
|
|
19
|
+
*
|
|
20
|
+
* **插画选型建议**:
|
|
21
|
+
* - 数据为空 → illustrationType="no-content"
|
|
22
|
+
* - 搜索无结果 → illustrationType="no-result"
|
|
23
|
+
* - 页面不存在 → illustrationType="not-found"
|
|
24
|
+
* - 无权限 → illustrationType="no-access"
|
|
25
|
+
* - 加载/网络失败 → illustrationType="failure"
|
|
26
|
+
* - 功能建设中 → illustrationType="construction"
|
|
27
|
+
*
|
|
28
|
+
* @prop {'no-result'|'no-content'|'not-found'|'no-access'|'failure'|'idle'|'success'|'construction'|'administrator-1'|'administrator-2'} [illustrationType='no-content'] — 插画类型
|
|
29
|
+
* @prop {string} [title=''] — 标题文案,不传则不渲染标题行
|
|
30
|
+
* @prop {string} [description=''] — 描述文案,不传则不渲染描述行
|
|
31
|
+
* @prop {string} [linkPrefix=''] — 内嵌链接前缀文案(如"页面出错了,"),不传则不渲染链接行
|
|
32
|
+
* @prop {string} [linkText=''] — 内嵌链接可点击文字(如"刷新重试"),不传则不渲染链接行
|
|
33
|
+
* @prop {Function} [onLinkClick=null] — 链接点击回调
|
|
34
|
+
* @prop {string} [primaryLabel=''] — 一级按钮文案,不传则不渲染
|
|
35
|
+
* @prop {Function} [onPrimary=null] — 一级按钮点击回调
|
|
36
|
+
* @prop {string} [secondaryLabel=''] — 二级按钮文案(outline-black 样式),不传则不渲染
|
|
37
|
+
* @prop {Function} [onSecondary=null] — 二级按钮点击回调
|
|
38
|
+
* @prop {string} [tertiaryLabel=''] — 文字按钮文案(text-brand 样式),不传则不渲染
|
|
39
|
+
* @prop {Function} [onTertiary=null] — 文字按钮点击回调
|
|
40
|
+
* @prop {'row'|'column'} [buttonLayout='row'] — 按钮排列方向,row 横排 / column 竖排
|
|
41
|
+
* @prop {string} [className=''] — 自定义类名
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/* ── 插画类型 → 图片资源 ── */
|
|
45
|
+
const ILLUSTRATION_SRC = {
|
|
46
|
+
'no-result': imgNoResult,
|
|
47
|
+
'no-content': imgNoContent,
|
|
48
|
+
'not-found': imgNotFound,
|
|
49
|
+
'no-access': imgNoAccess,
|
|
50
|
+
'failure': imgFailure,
|
|
51
|
+
'idle': imgIdle,
|
|
52
|
+
'success': imgSuccess,
|
|
53
|
+
'construction': imgConstruction,
|
|
54
|
+
'administrator-1': imgAdmin1,
|
|
55
|
+
'administrator-2': imgAdmin2,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/* ── 按钮组排列方向 ── */
|
|
59
|
+
const BUTTON_LAYOUT_CLASS = {
|
|
60
|
+
row: 'flex-row',
|
|
61
|
+
column: 'flex-col',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default function Empty({
|
|
65
|
+
illustrationType = 'no-content',
|
|
66
|
+
title = '',
|
|
67
|
+
description = '',
|
|
68
|
+
linkPrefix = '',
|
|
69
|
+
linkText = '',
|
|
70
|
+
onLinkClick = null,
|
|
71
|
+
primaryLabel = '',
|
|
72
|
+
onPrimary = null,
|
|
73
|
+
secondaryLabel = '',
|
|
74
|
+
onSecondary = null,
|
|
75
|
+
tertiaryLabel = '',
|
|
76
|
+
onTertiary = null,
|
|
77
|
+
buttonLayout = 'row',
|
|
78
|
+
className = '',
|
|
79
|
+
}) {
|
|
80
|
+
const src = ILLUSTRATION_SRC[illustrationType] ?? imgNoContent;
|
|
81
|
+
const hasActions = primaryLabel || secondaryLabel || tertiaryLabel;
|
|
82
|
+
const hasLinkLine = linkText;
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div className={[`tfds-empty`, ['flex flex-col items-center gap-6', className].filter(Boolean).join(' ')].filter(Boolean).join(' ')} data-tfds-component="Empty">
|
|
86
|
+
{/* 插画 */}
|
|
87
|
+
<img src={src} alt="" className="size-[200px] shrink-0 object-contain" />
|
|
88
|
+
|
|
89
|
+
{/* 文案区:标题 + 描述 */}
|
|
90
|
+
{(title || description) && (
|
|
91
|
+
<div className="flex flex-col items-center gap-4 text-center">
|
|
92
|
+
{title && (
|
|
93
|
+
<p className="text-xl [font-weight:var(--font-semibold)] text-foreground leading-7 w-[400px] max-w-full">
|
|
94
|
+
{title}
|
|
95
|
+
</p>
|
|
96
|
+
)}
|
|
97
|
+
{description && (
|
|
98
|
+
<p className="text-sm text-foreground-secondary leading-5 w-[400px] max-w-full">
|
|
99
|
+
{description}
|
|
100
|
+
</p>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
104
|
+
|
|
105
|
+
{/* 链接行:轻量错误提示专用(如"页面出错了,刷新试试") */}
|
|
106
|
+
{hasLinkLine && (
|
|
107
|
+
<p className="text-sm text-foreground-secondary leading-5 text-center w-[400px] max-w-full">
|
|
108
|
+
{linkPrefix}
|
|
109
|
+
<button
|
|
110
|
+
type="button"
|
|
111
|
+
onClick={onLinkClick ?? undefined}
|
|
112
|
+
className="[font-weight:var(--font-semibold)] text-brand-800 hover:text-brand-900 active:text-brand-950 focus-visible:outline-brand-300 focus-visible:outline-2 focus-visible:outline-offset-1 hover:underline underline-offset-2 cursor-pointer"
|
|
113
|
+
>
|
|
114
|
+
{linkText}
|
|
115
|
+
</button>
|
|
116
|
+
</p>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{/* 操作区:按钮组 */}
|
|
120
|
+
{hasActions && (
|
|
121
|
+
<div className={['flex items-center gap-3', BUTTON_LAYOUT_CLASS[buttonLayout]].join(' ')}>
|
|
122
|
+
{secondaryLabel && (
|
|
123
|
+
<Button variant="outline-black" size="md" onClick={onSecondary ?? undefined}>
|
|
124
|
+
{secondaryLabel}
|
|
125
|
+
</Button>
|
|
126
|
+
)}
|
|
127
|
+
{primaryLabel && (
|
|
128
|
+
<Button variant="primary" size="md" onClick={onPrimary ?? undefined}>
|
|
129
|
+
{primaryLabel}
|
|
130
|
+
</Button>
|
|
131
|
+
)}
|
|
132
|
+
{tertiaryLabel && (
|
|
133
|
+
<Button variant="text-brand" size="md" onClick={onTertiary ?? undefined}>
|
|
134
|
+
{tertiaryLabel}
|
|
135
|
+
</Button>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
)}
|
|
139
|
+
</div>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const EMPTY_TOKEN_MAP = {
|
|
2
|
+
插画: [
|
|
3
|
+
{ label: '尺寸', cssProp: 'width / height', value: '200px' },
|
|
4
|
+
],
|
|
5
|
+
|
|
6
|
+
标题: [
|
|
7
|
+
{ label: '字色', cssProp: 'color', token: '--color-foreground', value: '#182230' },
|
|
8
|
+
{ label: '字号', cssProp: 'font-size', token: '--text-xl', value: '20px' },
|
|
9
|
+
{ label: '字重', cssProp: 'font-weight', value: '600' },
|
|
10
|
+
{ label: '行高', cssProp: 'line-height', value: '28px' },
|
|
11
|
+
{ label: '最大宽', cssProp: 'width', value: '400px' },
|
|
12
|
+
],
|
|
13
|
+
|
|
14
|
+
描述文案: [
|
|
15
|
+
{ label: '字色', cssProp: 'color', token: '--color-foreground-secondary', value: 'rgba(24,34,48,0.6)' },
|
|
16
|
+
{ label: '字号', cssProp: 'font-size', token: '--text-sm', value: '14px' },
|
|
17
|
+
{ label: '字重', cssProp: 'font-weight', value: '400' },
|
|
18
|
+
{ label: '行高', cssProp: 'line-height', value: '20px' },
|
|
19
|
+
{ label: '最大宽', cssProp: 'width', value: '400px' },
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
链接文字: [
|
|
23
|
+
{ label: '默认色', cssProp: 'color', token: '--color-brand-800', value: '#129683' },
|
|
24
|
+
{ label: '悬浮色', cssProp: 'color', token: '--color-brand-900', value: '#0D786A', state: 'hover' },
|
|
25
|
+
{ label: '字号', cssProp: 'font-size', token: '--text-sm', value: '14px' },
|
|
26
|
+
{ label: '字重', cssProp: 'font-weight', value: '600' },
|
|
27
|
+
],
|
|
28
|
+
|
|
29
|
+
间距: [
|
|
30
|
+
{ label: '纵向间距', cssProp: 'gap', token: '--spacing-6', value: '24px' },
|
|
31
|
+
{ label: '文字区间距', cssProp: 'gap (text area)', token: '--spacing-4', value: '16px' },
|
|
32
|
+
{ label: '按钮间距', cssProp: 'gap (buttons)', token: '--spacing-3', value: '12px' },
|
|
33
|
+
],
|
|
34
|
+
|
|
35
|
+
引用组件: [
|
|
36
|
+
{ label: '一级按钮', cssProp: '—', value: 'Button primary md' },
|
|
37
|
+
{ label: '二级按钮', cssProp: '—', value: 'Button outline-black md' },
|
|
38
|
+
{ label: '文字按钮', cssProp: '—', value: 'Button text-brand md' },
|
|
39
|
+
],
|
|
40
|
+
};
|