orbcafe-ui 1.3.4 → 1.3.7

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/README.md CHANGED
@@ -1,560 +1,208 @@
1
1
  # ORBCAFE UI
2
2
 
3
- 面向 React / Next.js 的企业级 UI 组件库,目标是作为可复用的 NPM 包发布并长期维护。
3
+ ORBCAFE UI is a React / Next.js enterprise UI library for building SAP-style business applications: standard reports, value help filters, planning Gantt boards, touch-first pad workflows, analytical pivot views, detail pages, Kanban boards, app shells, auth pages, and AI chat surfaces.
4
4
 
5
- ## Project Goal
5
+ The library is designed for two audiences at once:
6
6
 
7
- - 组件可直接通过 NPM 安装并使用。
7
+ - Developers who want stable, typed public React components.
8
+ - AI coding agents that need clear module contracts, examples, and skills to generate working ORBCAFE screens without guessing internal APIs.
8
9
 
9
- ### 安装依赖
10
+ ![ORBCAFE UI examples home](docs/images/examples/home.png)
10
11
 
11
- 为了确保与 `orbcafe-ui` 的最佳兼容性,请使用以下命令安装精确版本的相关依赖(避免 `latest` 带来的破坏性更新):
12
+ ## Highlights
12
13
 
13
- ```bash
14
- npm install orbcafe-ui @mui/material@^7.3.9 @mui/icons-material@^7.3.9 @mui/x-date-pickers@^8.27.2 @emotion/react@^11.14.0 @emotion/styled@^11.14.1 dayjs@^1.11.20 lucide-react@^0.575.0 tailwind-merge@^3.5.0 clsx@^2.1.1 class-variance-authority@^0.7.1 @radix-ui/react-slot@^1.2.4
15
- ```
16
-
17
- ### 运行时环境与集成基线(重要)
18
-
19
- 1. **Tailwind CSS 编译要求**
20
- 本组件库严重依赖 Tailwind 实用类(utility classes,如 Glassmorphism `backdrop-blur-xl` 等)。**发布在 NPM `dist/index.css` 并不包含完整的样式!** 必须让宿主项目在构建时扫描并编译 `orbcafe-ui`。
21
- - **如果你使用的是 Tailwind v3**,在 `tailwind.config.js` 中增加:
22
- ```js
23
- content: ["./node_modules/orbcafe-ui/dist/**/*.{js,mjs}"]
24
- ```
25
- - **如果你使用的是 Tailwind v4 + Next.js**(如我们的官方 examples),在 `globals.css` 中声明:
26
- ```css
27
- @import "tailwindcss";
28
- @source "../../node_modules/orbcafe-ui/dist";
29
- ```
30
-
31
- 2. **Provider 注入要求**
32
- 部分组件(如通知、日期筛选、主题色)依赖 MUI 和内部的 Context。你的应用入口(如 `layout.tsx` 或 `_app.tsx`)必须提供以下 Provider 矩阵:
33
- - `ThemeProvider` (MUI)
34
- - `CssBaseline` (MUI)
35
- - `LocalizationProvider` (MUI X)
36
- - `GlobalMessage` (orbcafe-ui 导出)
37
-
38
- - 组件 API 稳定、类型完整、目录结构一致。
39
- - 组件公共 API、类型契约与回调契约稳定,文档与 examples 可追踪。
40
-
41
- ---
42
-
43
- ## 组件总目录(先看这里)
44
-
45
- 下表用于快速判断“该用哪个组件、去哪个目录、看哪份细节文档”。
46
-
47
- | 模块 | 典型用途 | 代码目录 | 先看文档 |
48
- | --- | --- | --- | --- |
49
- | `Atoms` | 基础输入/按钮/文本等原子能力,作为上层组件基础件 | `src/components/Atoms` | `src/components/Atoms/README.md` |
50
- | `Molecules` | 组合型基础组件(如统一消息框) | `src/components/Molecules` | `src/components/Molecules/README.md` |
51
- | `Navigation-Island` | 左侧导航树、折叠导航、菜单路由入口 | `src/components/Navigation-Island` | `src/components/Navigation-Island/README.md` |
52
- | `StdReport` | 标准报表主容器(筛选、表格、分页、变体、布局) | `src/components/StdReport` | `src/components/StdReport/README.md` |
53
- | `GraphReport` | 图形报表弹窗(KPI、图表、联动、AI 输入区) | `src/components/GraphReport` | `src/components/GraphReport/README.md` |
54
- | `CustomizeAgent` | AI 参数与 Prompt 模板设置弹窗 | `src/components/CustomizeAgent` | `src/components/CustomizeAgent/README.md` |
55
- | `DetailInfo` | 标准详情页容器(信息块 + Tabs + 底部表格 + AI/搜索) | `src/components/DetailInfo` | `src/components/DetailInfo/README.md` |
56
- | `Kanban` | 标准看板模块(Bucket + Card + Drag/Drop + Detail 跳转) | `src/components/Kanban` | `src/components/Kanban/README.md` |
57
- | `PageLayout` | 页面壳层(Header + Navigation + Content) | `src/components/PageLayout` | `src/components/PageLayout/README.md` |
58
- | `PivotTable` | 透视分析(拖拽维度/度量、图表联动、preset) | `src/components/PivotTable` | `src/components/PivotTable/README.md` |
59
- | `AINav` | 语音导航与命令输入能力 | `src/components/AINav` | `src/components/AINav/README.md` |
60
- | `Pad` | 平板触摸场景 UI(壳层、触摸表格、数字键盘、扫码) | `src/components/Pad` | `src/components/Pad/README.md` |
61
- | `AgentUI` | 聊天 UI 与 Copilot UI(StdChat / CopilotChat / AgentPanel) | `src/components/AgentUI` | `src/components/AgentUI/README.md` |
62
- | `Auth` | 登录、用户注册、忘记密码的入口页 | `src/components/Auth` | `src/components/Auth/README.md` |
63
- | `Planning` | 项目管理/生产计划表格 + 甘特图 | `src/components/Planning` | `src/components/Planning/README.md` |
64
-
65
- ### 文档查阅顺序(推荐)
66
-
67
- 1. 先看模块根 README:了解能力边界、最小接入示例。
68
- 2. 如果该模块公开导出 hooks,再看模块 `Hooks/README.md`:确认状态管理、参数、返回值与联动方式。
69
- 3. 最后看模块详细设计文档或 AI 契约索引:理解内部结构、标准案例与扩展点。
70
-
71
- ### 常用文档索引
72
-
73
- - `GraphReport` 详细设计:`src/components/GraphReport/graphreport.md`
74
- - `GraphReport Hooks`:`src/components/GraphReport/Hooks/README.md`
75
- - `StdReport Hooks`:`src/components/StdReport/Hooks/README.md`
76
- - `PageLayout Hooks`:`src/components/PageLayout/Hooks/README.md`
77
- - `Pad` 模块文档:`src/components/Pad/README.md`
78
- - `Pad Hooks`:`src/components/Pad/Hooks/README.md`
79
- - `DetailInfo` 模块文档:`src/components/DetailInfo/README.md`
80
- - `Kanban` 模块文档:`src/components/Kanban/README.md`
81
- - `Kanban Hooks`:`src/components/Kanban/Hooks/README.md`
82
- - `Kanban Tools`:`src/components/Kanban/Utils/README.md`
83
- - `AgentUI` 模块文档:`src/components/AgentUI/README.md`
84
- - `Auth` 模块文档:`src/components/Auth/README.md`
85
- - `Planning` 模块文档:`src/components/Planning/README.md`
86
- - `AI 模块契约索引`:`skills/orbcafe-ui-component-usage/references/module-contracts.md`
87
- - `Pad skill`:`skills/orbcafe-pad-workflow/SKILL.md`
88
- - `组件通俗名映射(多语言)`:`skills/orbcafe-ui-component-usage/references/component-glossary-i18n.md`
89
-
90
- ### 组件通俗名(Natural Name)对照
91
-
92
- 用于“用户自然语言 -> 组件 canonical API”映射,避免只有英文技术名才可路由。
93
-
94
- | Canonical API | English natural name | 中文通俗名 | German cues |
95
- | --- | --- | --- | --- |
96
- | `CTable` | Desktop table | 电脑端表格 | Desktop Tabelle |
97
- | `CSmartFilter` | Smart filter bar | 智能筛选条 | Filterleiste |
98
- | `PTable` | Pad/touch table | 平板触摸表格 | Tablet Tabelle |
99
- | `PSmartFilter` | Pad filter bar | 平板筛选条 | Tablet Filter |
100
- | `PBarcodeScanner` | Camera barcode scanner | 摄像头扫码控件 | Barcode Scanner |
101
- | `PNumericKeypad` | On-screen numeric keypad | 屏幕数字小键盘 | Ziffernblock |
102
- | `CAppPageLayout` | App shell layout | 应用壳层布局 | App Layout |
103
- | `CDetailInfoPage` | Detail page | 详情页 | Detailseite |
104
- | `CPivotTable` | Pivot table | 透视表 | Pivot Tabelle |
105
- | `AgentPanel` | Agent chat panel | 智能体聊天面板 | Agent Chat Panel |
106
-
107
- ---
108
-
109
- ## AgentUI(聊天与 Copilot)
110
-
111
- `AgentUI` 是库里负责聊天类交互的标准模块,当前建议直接使用以下公共 API:
112
-
113
- - `AgentPanel`: 带头部的标准聊天容器。
114
- - `StdChat`: 适合整页、弹窗、工作台内嵌聊天。
115
- - `CopilotChat`: 适合右下角 Copilot 浮窗内容层。
116
- - `AgentUICardHooks` / `AgentUICardHookEvent`: 卡片交互事件回调类型。
117
-
118
- ### Import
119
-
120
- ```tsx
121
- import {
122
- AgentPanel,
123
- StdChat,
124
- CopilotChat,
125
- type ChatMessage,
126
- type AgentUICardHooks
127
- } from 'orbcafe-ui'
128
- ```
129
-
130
- ### 使用约定
131
-
132
- - `AgentUI` 当前没有独立导出的自定义 hooks,对外稳定接口是组件 props 和回调契约。
133
- - 标准消息状态以 `messages + isResponding` 为主。
134
- - 卡片交互统一通过 `cardHooks.onCardEvent` 承接。
135
- - `StdChat` 负责标准聊天布局,`CopilotChat` 只负责 Copilot 面板内容层,不负责浮窗壳、拖拽和缩放。
136
-
137
- 详细接入方式、example 拆解和封装边界说明见 `src/components/AgentUI/README.md`。
138
-
139
- ---
140
-
141
- ## Pad(平板触摸场景)
142
-
143
- `Pad` 模块用于 iPad/平板仓储场景,核心是“保留标准报表能力 + 触摸友好交互”:
14
+ | Area | What you get |
15
+ | --- | --- |
16
+ | App shell | `CAppPageLayout`, `NavigationIsland`, locale switcher, user menu, logo slot, route-safe page transitions. |
17
+ | Standard report | `CStandardPage`, `CSmartFilter`, `CTable`, variants, layouts, quick create/edit/delete, pagination, and SAP-style `CValueHelp`. |
18
+ | Planning | `CPlanningLayout` / `CPlanningGantt` with table + timeline panes, row reorder, page-size selector, equal 50/50 split toggle, and manual drag resizing. |
19
+ | Analytics | `CPivotTable`, pivot chart companion views, draggable rows/columns/filters/values, aggregations, and presets. |
20
+ | Workflow pages | `CKanbanBoard`, `CDetailInfoPage`, `CGraphReport`, and `CCustomizeAgent` for operational work surfaces. |
21
+ | Pad | `PAppPageLayout`, `PTable`, `PSmartFilter`, `PNumericKeypad`, `PBarcodeScanner` for touch-first warehouse and shop-floor scenarios. |
22
+ | AI surfaces | `StdChat`, `CopilotChat`, `AgentPanel`, dynamic markdown/cards rendering, voice navigation via `CAINavProvider`. |
23
+ | AI-ready docs | Skills under `skills/` route natural-language requests to canonical ORBCAFE modules and enforce examples-first integration. |
144
24
 
145
- - `PAppPageLayout`: 平板壳层布局(顶部栏 + 导航 + workload)
146
- - `PTable`: 触摸卡片式表格,兼容 layout/variant/分页/分组/汇总/quick actions
147
- - `PSmartFilter`: 触摸友好筛选包装
148
- - `PNumericKeypad`: 数字录入键盘
149
- - `PBarcodeScanner`: 摄像头扫码弹窗,优先 `BarcodeDetector`,支持手动回退
150
- - `usePadLayout` / `usePadRecordEditor`: 平板方向与记录编辑 hook
25
+ ## Documentation Map
151
26
 
152
- 参考:
153
- - `src/components/Pad/README.md`
154
- - `examples/app/_components/PadExampleClient.tsx`
155
- - `examples/app/pad/page.tsx`
27
+ - [Official examples walkthrough](docs/EXAMPLES.md): screenshots, routes, and key behavior for every example page.
28
+ - [Vibe coding and skills guide](docs/VIBE_CODING.md): how to ask AI agents to use ORBCAFE UI, including `CValueHelp` and module skills.
29
+ - [Examples app README](examples/README.md): how to run the Next.js examples locally.
30
+ - [AI module contracts](skills/orbcafe-ui-component-usage/references/module-contracts.md): public API, hook strategy, examples, validation, and troubleshooting index for agent use.
31
+ - Component docs:
32
+ - [StdReport](src/components/StdReport/README.md)
33
+ - [Molecules / CValueHelp](src/components/Molecules/README.md)
34
+ - [Planning](src/components/Planning/README.md)
35
+ - [Pad](src/components/Pad/README.md)
36
+ - [AgentUI](src/components/AgentUI/README.md)
37
+ - [PageLayout](src/components/PageLayout/README.md)
38
+ - [PivotTable](src/components/PivotTable/README.md)
39
+ - [DetailInfo](src/components/DetailInfo/README.md)
40
+ - [Kanban](src/components/Kanban/README.md)
156
41
 
157
- ---
42
+ ## Install
158
43
 
159
- ## AI-First Integration
44
+ Install the package and its peer/runtime dependencies with pinned compatible ranges:
160
45
 
161
- 如果目标是让 AI 在 vibe coding 场景里稳定使用 ORBCAFE UI,推荐遵循这条顺序:
162
-
163
- 1. 先看 `skills/orbcafe-ui-component-usage/references/component-glossary-i18n.md`,把自然语言组件名映射到 canonical API。
164
- 2. 再用 `skills/orbcafe-ui-component-usage` 判定目标模块。
165
- 3. 再看 `skills/orbcafe-ui-component-usage/references/module-contracts.md`,确认:
166
- - 公共导出入口
167
- - 推荐标准组件
168
- - 是否公开 hooks
169
- - 最小状态结构
170
- - 标准 example
171
- - 验证与排障清单
172
- 4. 最后才看具体模块 README 和官方 examples。
173
-
174
- ### 当前标准化原则
175
-
176
- - 只使用 `src/index.ts` 可达的公共导出。
177
- - 优先走 canonical example,不从内部组件自由拼装。
178
- - 每个模块都要回答 5 个问题:
179
- - 用哪个公共入口组件或 hook
180
- - 最小状态是什么
181
- - 必须回调有哪些
182
- - 标准 example 是哪个
183
- - 怎么验证“真的生效了”
184
-
185
- ### 关于 Hooks
186
-
187
- 不是所有模块都以 hooks 为主入口。
188
-
189
- - `StdReport`、`DetailInfo`、`Kanban`、`PivotTable`、`AINav`、`PageLayout`、`Pad` 明确公开了 hooks。
190
- - `AgentUI` 当前不公开自定义 hook,稳定入口是组件 props 和回调契约。
191
-
192
- 这条规则对 AI 很重要,因为它决定了应该生成“hook 驱动代码”还是“组件 + callbacks 驱动代码”。
193
-
194
- ---
195
-
196
- ## 重点组件:CMessageBox(请优先使用)
197
-
198
- `CMessageBox` 是标准体系里用于统一提示/确认交互的基础分子组件,适用于:
199
-
200
- - 删除确认
201
- - 保存成功提示
202
- - 警告/错误弹窗
203
- - 通用信息提醒
204
-
205
- > 建议在项目中统一使用 `CMessageBox`,避免各页面自行拼装不一致的 Dialog 样式。
206
-
207
- ### Import
208
-
209
- ```tsx
210
- import { CMessageBox } from 'orbcafe-ui';
46
+ ```bash
47
+ npm install orbcafe-ui @mui/material@^7.3.9 @mui/icons-material@^7.3.9 @mui/x-date-pickers@^8.27.2 @emotion/react@^11.14.0 @emotion/styled@^11.14.1 dayjs@^1.11.20 lucide-react@^0.575.0 tailwind-merge@^3.5.0 clsx@^2.1.1 class-variance-authority@^0.7.1 @radix-ui/react-slot@^1.2.4
211
48
  ```
212
49
 
213
- ### 最小示例
50
+ ## Required App Setup
214
51
 
215
- ```tsx
216
- const [open, setOpen] = useState(false);
217
-
218
- <CMessageBox
219
- open={open}
220
- type="warning"
221
- title="Delete Item"
222
- message="Are you sure you want to delete this record?"
223
- confirmText="Delete"
224
- cancelText="Cancel"
225
- onClose={() => setOpen(false)}
226
- onConfirm={() => {
227
- // do delete
228
- setOpen(false);
229
- }}
230
- />;
231
- ```
52
+ ### Tailwind source scanning
232
53
 
233
- ### 标准约定
54
+ ORBCAFE UI components rely on Tailwind utility classes. The published `dist/index.css` is not enough by itself; your app must scan the library output.
234
55
 
235
- - `type`: `success | warning | error | info | default`
236
- - 默认支持确认与取消按钮,可通过 `showCancel` 控制
237
- - 建议所有业务确认弹窗统一走该组件,保证品牌与交互一致
56
+ Tailwind v4 / Next.js baseline:
238
57
 
239
- ---
58
+ ```css
59
+ @import "tailwindcss";
60
+ @source "../node_modules/orbcafe-ui/dist";
61
+ ```
240
62
 
241
- ## Installation
63
+ When developing inside this repo, the examples app also scans the source package:
242
64
 
243
- ```bash
244
- npm install orbcafe-ui
245
- # or
246
- yarn add orbcafe-ui
247
- # or
248
- pnpm add orbcafe-ui
65
+ ```css
66
+ @source "../../src";
249
67
  ```
250
68
 
251
- 如果使用 Tailwind,请确保扫描到库产物:
69
+ Tailwind v3 fallback:
252
70
 
253
71
  ```js
254
- // tailwind.config.js
255
72
  module.exports = {
256
- content: [
257
- "./node_modules/orbcafe-ui/dist/**/*.{js,mjs}",
258
- ],
259
- }
260
- ```
261
-
262
- ### Next.js App Router 最小接入(推荐)
263
-
264
- ```tsx
265
- // app/page.tsx (Server Component)
266
- import HomeClientPage from './HomeClientPage';
267
-
268
- export default function Page() {
269
- return <HomeClientPage />;
270
- }
271
- ```
272
-
273
- ```tsx
274
- // app/HomeClientPage.tsx (Client Component)
275
- 'use client';
276
-
277
- import { CAppPageLayout } from 'orbcafe-ui';
278
-
279
- export default function HomeClientPage() {
280
- return <CAppPageLayout appTitle="ORBCAFE" menuData={[]} />;
281
- }
73
+ content: ["./node_modules/orbcafe-ui/dist/**/*.{js,mjs}"],
74
+ };
282
75
  ```
283
76
 
284
- ---
285
-
286
- ## Next.js 16 兼容性说明(务必阅读)
287
-
288
- 官方 example 已按 Next.js `16.2.0` 调整,接入时请遵循以下规则:
289
-
290
- ### 1. 动态路由参数必须在 Server Page 解包
291
-
292
- 在 Next 16 中,`params` / `searchParams` 是 Promise 语义。
293
- 不要在 Client Page 里直接把它当普通对象枚举或访问属性。
77
+ ### Providers
294
78
 
295
- 推荐写法:
79
+ Wrap your app with the MUI and ORBCAFE providers used by the official examples:
296
80
 
297
81
  ```tsx
298
- // app/detail/[id]/page.tsx (Server Component)
299
- import DetailClientPage from './DetailClientPage';
300
-
301
- interface PageProps {
302
- params: Promise<{ id: string }>;
303
- }
304
-
305
- export default async function Page({ params }: PageProps) {
306
- const { id } = await params;
307
- return <DetailClientPage rowId={id} />;
82
+ import { CssBaseline, ThemeProvider, createTheme } from '@mui/material';
83
+ import { LocalizationProvider } from '@mui/x-date-pickers';
84
+ import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
85
+ import { GlobalMessage, OrbcafeI18nProvider } from 'orbcafe-ui';
86
+
87
+ const theme = createTheme();
88
+
89
+ export function Providers({ children }: { children: React.ReactNode }) {
90
+ return (
91
+ <ThemeProvider theme={theme}>
92
+ <CssBaseline />
93
+ <LocalizationProvider dateAdapter={AdapterDayjs}>
94
+ <OrbcafeI18nProvider locale="en">
95
+ {children}
96
+ <GlobalMessage />
97
+ </OrbcafeI18nProvider>
98
+ </LocalizationProvider>
99
+ </ThemeProvider>
100
+ );
308
101
  }
309
102
  ```
310
103
 
311
- ### 2. Client Component 避免首屏依赖不稳定值
312
-
313
- Hydration mismatch 常见来源:
314
-
315
- - 首屏直接使用 `usePathname()` 结果做高亮
316
- - `Date.now()` / `Math.random()` 直接参与首屏渲染
317
- - 仅在浏览器可用的数据(`window` / `localStorage`)首屏参与结构分支
318
-
319
- 建议:
320
-
321
- - 用 `mounted`(`useEffect` 后置为 `true`)再启用这类 UI 高亮/分支
322
- - 浏览器侧状态在 `useEffect` 中读取
323
- - 保持 SSR 首屏与 CSR 首帧 DOM 结构一致
324
-
325
- ### 3. 常见报错对照
326
-
327
- - `searchParams is a Promise and must be unwrapped with React.use()`
328
- 根因:在错误层级直接同步访问了 `searchParams`。
329
- - `params are being enumerated`
330
- 根因:对 `params` 做了 `Object.keys/entries` 或扩展操作。
331
- - `Hydration failed because the server rendered HTML didn't match the client`
332
- 根因:SSR 与 CSR 首屏输出不一致(通常由路由状态或浏览器变量引起)。
333
-
334
- ---
335
-
336
- ## 官方 Example 验证命令
337
-
338
- 提交前建议至少执行:
104
+ ## Run The Official Examples
339
105
 
340
106
  ```bash
341
- # 1) 校验 AI 契约与公开导出一致
342
- npm run check:ai-contracts
343
-
344
- # 2) 构建组件库
345
107
  npm run build
346
108
 
347
- # 3) 校验 examples
348
- cd examples
349
- npm run lint
350
- npx tsc --noEmit
351
- ```
352
-
353
- 如果要做一轮更完整的发布前检查:
354
-
355
- ```bash
356
- npm run release:check
357
- ```
358
-
359
- 如果只想快速看运行效果:
360
-
361
- ```bash
362
109
  cd examples
110
+ npm install
363
111
  npm run dev
364
112
  ```
365
113
 
366
- ### 发布前 AI 契约清单
367
-
368
- 每次发布前至少确认:
369
-
370
- 1. `src/index.ts` 的公共导出与 skill 文档一致。
371
- 2. `skills/orbcafe-ui-component-usage/references/module-contracts.md` 和 `.json` 已同步更新。
372
- 3. 新模块已声明 `Hook-first` / `Component-first`。
373
- 4. 每个模块至少有一个 canonical example。
374
- 5. router skill 已能把新模块正确分流。
375
-
376
- ---
114
+ Open `http://localhost:3000`.
377
115
 
378
- ## Internationalization (i18n)
116
+ Main routes:
379
117
 
380
- ORBCAFE UI 标准组件已内置 6 种语言:
118
+ | Route | Demonstrates |
119
+ | --- | --- |
120
+ | `/` | Navigation island and base button states. |
121
+ | `/std-report` | Standard report, i18n, `CSmartFilter`, `CTable`, variants/layouts, quick create, and `CValueHelp`. |
122
+ | `/planning` | Production planning Gantt with many columns, page-size selector, 50/50 split toggle, and manual resizing. |
123
+ | `/kanban` | Drag/drop workflow board and card-to-detail navigation. |
124
+ | `/pivot-table` | Pivot fields, aggregations, chart views, and preset persistence. |
125
+ | `/detail-info/ID-1` | Detail page with sections, tabs, related table, search, and AI fallback. |
126
+ | `/pad` | Touch-first warehouse workload, pad table, keypad, and scanner flow. |
127
+ | `/chat` | Full-page `StdChat` with markdown, math, code, Mermaid, and dynamic cards. |
128
+ | `/copilot` | Floating draggable/resizable `CopilotChat`. |
129
+ | `/aipanel` | Display-only `AgentPanel` with status states. |
130
+ | `/ai-nav` | Space-key voice navigation provider and hook state. |
381
131
 
382
- - `en` (English)
383
- - `zh` (中文)
384
- - `fr` (Français)
385
- - `de` (Deutsch)
386
- - `ja` (日本語)
387
- - `ko` (한국어)
132
+ ## CValueHelp Quick Start
388
133
 
389
- 可通过 `OrbcafeI18nProvider` `CAppPageLayout.locale` 统一控制语言。
390
-
391
- ### 方式 1:在应用根部包裹 Provider
134
+ Use `CValueHelp` directly for standalone form fields, or configure it through `CSmartFilter` / `PSmartFilter` so value selection is preserved in filter and variant state.
392
135
 
393
136
  ```tsx
394
- import { OrbcafeI18nProvider } from 'orbcafe-ui';
395
-
396
- <OrbcafeI18nProvider locale="de">
397
- <YourApp />
398
- </OrbcafeI18nProvider>
399
- ```
400
-
401
- ### 方式 2:使用 PageLayout 时直接传 `locale`
402
-
403
- ```tsx
404
- <CAppPageLayout
405
- appTitle="ORBCAFE"
406
- locale="ja"
407
- menuData={menuData}
408
- >
409
- {children}
410
- </CAppPageLayout>
411
- ```
412
-
413
- 组件内部统一使用同一套翻译 key,避免出现中英混搭。
414
-
415
- ### 国际化维护规范(必须)
416
-
417
- - 所有标准组件可见文案必须通过 `useOrbcafeI18n().t()` 读取,不允许新增硬编码文案。
418
- - 统一词条源:`src/i18n/messages.ts`。
419
- - 新增文案时必须同时补齐 6 个语言分支:`en/zh/fr/de/ja/ko`。
420
- - 业务字段值(如状态、类别)建议采用“稳定 value + 本地化 label”模式,避免筛选逻辑与展示文案耦合。
421
- - 示例工程(`examples/app/std-report/page.tsx`)已按该模式实现,作为接入参考。
422
-
423
- ---
424
-
425
- ## ORBCAFE UI 标准化规范(Template Spec)
426
-
427
- 以下规范适用于“成形组件(Standard Component)”,例如:
428
- - `Navigation-Island`
429
- - `StdReport`
430
-
431
- ### 1. 标准组件目录结构(必须)
432
-
433
- 每个成形组件使用独立目录:
434
-
435
- ```text
436
- src/components/<StandardComponent>/
437
- ├── index.ts # 本组件统一导出入口(必须)
438
- ├── <MainComponent>.tsx # 主组件(必须)
439
- ├── Components/ # 仅放该标准组件私有子组件(可选)
440
- ├── Hooks/ # 仅放该标准组件 Hooks(必须)
441
- │ ├── README.md # Hooks 使用说明(必须)
442
- │ └── useXxx.ts # 一个或多个 hooks
443
- ├── Structures/ # 布局结构组件(可选)
444
- ├── types.ts # 公共类型(建议)
445
- └── *.md # 组件文档(建议)
446
- ```
447
-
448
- 说明:
449
- - 如果该标准组件有专用子组件,统一放在 `Components/` 下,不要散落到其他目录。
450
- - 所有标准组件必须提供 `Hooks/`,即使只有一个 Hook 也要建立目录。
451
- - `Hooks/README.md` 是强制项,至少包含:用途、参数、返回值、最小示例。
452
-
453
- ### 2. 命名规范(必须)
454
-
455
- - 标准组件目录使用业务语义名称(例如 `StdReport`、`Navigation-Island`)。
456
- - Hook 文件统一 `use-*.ts` 或 `use*.ts`,并保持项目内一致。
457
- - Hook 导出名称必须以 `use` 开头,例如 `useNavigationIsland`、`useStandardReport`。
458
- - 对外组件与 Hook 的导出名称应稳定,避免频繁重命名。
459
-
460
- ### 3. 导出规范(必须)
461
-
462
- - 每个标准组件目录必须有 `index.ts` 作为本目录的聚合导出入口。
463
- - 根入口 `src/index.ts` 必须只做统一导出,不写业务逻辑。
464
- - 新增组件时必须同步更新:
465
- - `src/components/<StandardComponent>/index.ts`
466
- - `src/index.ts`
467
-
468
- ### 4. Hooks 规范(必须)
469
-
470
- 每个标准组件至少提供一个可直接接入的 Hook,负责:
471
- - 状态管理(如折叠态、筛选态、分页态)
472
- - 默认行为封装(如 toggle、filter、sort)
473
- - 向主组件提供可直接 spread 的 props(推荐)
474
-
475
- 建议返回结构:
476
-
477
- ```ts
478
137
  {
479
- state,
480
- actions,
481
- componentProps
138
+ id: 'customer',
139
+ label: 'Customer',
140
+ type: 'value-help',
141
+ valueHelp: {
142
+ dialogTitle: 'Customer Value Help',
143
+ items: customers,
144
+ columns: [
145
+ { field: 'customerId', label: 'Customer', minWidth: 120 },
146
+ { field: 'customerName', label: 'Name', minWidth: 220 },
147
+ { field: 'country', label: 'Country', minWidth: 90 },
148
+ ],
149
+ getOptionValue: (item) => item.customerId,
150
+ getOptionLabel: (item) => item.customerName,
151
+ getOptionDescription: (item) => item.country,
152
+ },
482
153
  }
483
154
  ```
484
155
 
485
- 最小要求:
486
- - 强类型输入输出(避免 `any` 外溢到公共 API)
487
- - 可控/非可控模式边界清晰
488
- - README 中有完整示例
156
+ Rules:
489
157
 
490
- ### 5. 文档规范(必须)
158
+ - Store stable keys as values, not localized labels.
159
+ - Single selection maps to `equals`.
160
+ - Multiple selection maps to `anyOf`.
161
+ - Use `onSearch(query)` for remote search help.
162
+ - In reports/planning/pad filters, prefer SmartFilter field config over a separate custom lookup dialog.
491
163
 
492
- 每个标准组件至少包含以下文档:
493
- - `Hooks/README.md`(强制)
494
- - 组件主文档 `*.md`(建议,例如 `stdreport.md`)
164
+ See [Vibe coding and skills guide](docs/VIBE_CODING.md#cvaluehelp-f4--value-help) for AI-agent usage rules.
495
165
 
496
- `Hooks/README.md` 模板建议:
497
- - Hook 列表
498
- - 每个 Hook 的参数表
499
- - 返回值表
500
- - 典型接入示例
501
- - 常见坑与约束
166
+ ## AI / Vibe Coding Baseline
502
167
 
503
- ### 6. UI 与主题规范(NPM 发布建议)
168
+ When using Codex or another AI coding agent with ORBCAFE UI, ask it to follow the local skills instead of inventing component APIs:
504
169
 
505
- - 不写死主题关键色,优先使用主题 token(MUI theme / CSS variables)。
506
- - 深色模式必须可用,至少覆盖:
507
- - 背景色
508
- - 字体颜色
509
- - 交互态(hover/active/disabled)
510
- - 默认尺寸、字体、间距在同一模块内保持一致(如 SmartFilter 与相关输入控件一致)。
170
+ 1. Route the request through `skills/orbcafe-ui-component-usage`.
171
+ 2. Map natural names like "table", "F4", "pad table", "planning Gantt", or "copilot" to canonical exports.
172
+ 3. Check the target module skill, for example `orbcafe-stdreport-workflow`, `orbcafe-planning-gantt`, `orbcafe-pad-workflow`, or `orbcafe-agentui-chat`.
173
+ 4. Import only from `orbcafe-ui`.
174
+ 5. Validate against the official Next.js examples.
511
175
 
512
- ### 7. 兼容性与发布规范(必须)
176
+ Two integration styles are used across the library:
513
177
 
514
- - 保持 `dist` 产物稳定(ESM/CJS/types)。
515
- - `peerDependencies` 明确声明 React/Next 兼容范围。
516
- - API 变更必须记录(建议在 CHANGELOG)。
517
- - 发布前至少完成:
518
- - 类型构建通过
519
- - 示例工程可验证
520
- - 关键组件 smoke test
178
+ - Hook-first: the module exposes a public hook that owns state and returns props for the standard component, for example `useStandardReport`, `usePlanningLayout`, `useKanbanBoard`, `usePivotTable`, and `usePadLayout`.
179
+ - Component-first: the module's stable contract is the component props and callbacks, for example `StdChat`, `CopilotChat`, and `AgentPanel`.
521
180
 
522
- ---
181
+ More detail: [docs/VIBE_CODING.md](docs/VIBE_CODING.md).
523
182
 
524
- ## 当前项目落地范例
183
+ ## Public API Rule
525
184
 
526
- ### Navigation-Island(已标准化方向)
527
-
528
- - 主组件:`src/components/Navigation-Island/navigation-island.tsx`
529
- - 专用组件:`src/components/Navigation-Island/tree-menu.tsx`、`button.tsx`
530
- - Hook:`src/components/Navigation-Island/Hooks/use-navigation-island.ts`(建议统一收敛到 `Hooks/`)
531
-
532
- ### StdReport(标准范例)
533
-
534
- - 主组件:`src/components/StdReport/CStandardPage.tsx`
535
- - 专用子组件:`src/components/StdReport/Components/*`
536
- - Hooks:`src/components/StdReport/Hooks/*`
537
- - Hooks 文档:`src/components/StdReport/Hooks/README.md`
538
-
539
- ---
540
-
541
- ## Recommended Usage Example
542
-
543
- 以 Navigation Island 为例,推荐通过 Hook 接入:
185
+ Application code should import only from the package entry:
544
186
 
545
187
  ```tsx
546
- import { NavigationIsland, useNavigationIsland } from 'orbcafe-ui';
547
-
548
- const { navigationIslandProps } = useNavigationIsland({
549
- initialCollapsed: false,
550
- content: menuData,
551
- });
552
-
553
- <NavigationIsland {...navigationIslandProps} />
188
+ import {
189
+ CStandardPage,
190
+ CValueHelp,
191
+ CPlanningLayout,
192
+ CPivotTable,
193
+ PTable,
194
+ StdChat,
195
+ } from 'orbcafe-ui';
554
196
  ```
555
197
 
556
- ---
198
+ Do not import from `src/components/...` in consuming applications. Internal paths may change; public exports are the contract.
557
199
 
558
- ## License
200
+ ## Quality Checks
201
+
202
+ ```bash
203
+ npm run build
204
+ cd examples && npm run build
205
+ npm run check:ai-contracts
206
+ ```
559
207
 
560
- MIT
208
+ Before publishing documentation screenshots, run the examples app and refresh the images under `docs/images/examples/`.