@godxjp/ui 20.2.0 → 21.0.0

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.
Files changed (60) hide show
  1. package/dist/components/data-display/chat-bubble.d.ts +30 -0
  2. package/dist/components/data-display/chat-bubble.js +229 -0
  3. package/dist/components/data-display/descriptions.js +4 -1
  4. package/dist/components/data-display/index.d.ts +4 -2
  5. package/dist/components/data-display/index.js +5 -2
  6. package/dist/components/data-display/popover.js +3 -2
  7. package/dist/components/data-display/scroll-area.js +26 -1
  8. package/dist/components/data-display/tree.d.ts +8 -0
  9. package/dist/components/data-display/tree.js +426 -0
  10. package/dist/components/data-entry/chat-composer.d.ts +50 -0
  11. package/dist/components/data-entry/chat-composer.js +163 -0
  12. package/dist/components/data-entry/chat-suggestion.d.ts +28 -0
  13. package/dist/components/data-entry/chat-suggestion.js +285 -0
  14. package/dist/components/data-entry/index.d.ts +4 -0
  15. package/dist/components/data-entry/index.js +4 -0
  16. package/dist/components/data-entry/textarea.js +3 -1
  17. package/dist/components/data-entry/tree-utils.d.ts +10 -48
  18. package/dist/components/data-entry/tree-utils.js +1 -154
  19. package/dist/components/layout/org-switcher.js +22 -2
  20. package/dist/i18n/messages/en.json +50 -0
  21. package/dist/i18n/messages/ja.json +48 -0
  22. package/dist/i18n/messages/vi.json +49 -0
  23. package/dist/lib/tree.d.ts +53 -0
  24. package/dist/lib/tree.js +155 -0
  25. package/dist/props/components/data-display.prop.d.ts +187 -1
  26. package/dist/props/components/data-entry.prop.d.ts +127 -0
  27. package/dist/props/registry.d.ts +140 -3
  28. package/dist/props/registry.js +202 -3
  29. package/dist/styles/control.css +7 -0
  30. package/dist/styles/data-display-layout.css +309 -55
  31. package/dist/styles/data-entry-layout.css +64 -0
  32. package/dist/styles/shell-layout.css +41 -11
  33. package/dist/tokens/base.css +3 -0
  34. package/dist/tokens/components/chat-bubble.css +36 -0
  35. package/dist/tokens/components/chat-composer.css +19 -0
  36. package/dist/tokens/components/data-display.css +0 -6
  37. package/dist/tokens/components/descriptions.css +4 -0
  38. package/dist/tokens/components/shell.css +13 -3
  39. package/dist/tokens/components/tree.css +27 -0
  40. package/docs/FRAME-COVERAGE-LEDGER.md +1 -1
  41. package/docs/FRAME-COVERAGE-REPORT.md +8 -3
  42. package/docs/data-display/chat-bubble.tsx +397 -0
  43. package/docs/data-display/timeline.tsx +46 -0
  44. package/docs/data-display/tree.tsx +394 -0
  45. package/docs/data-entry/chat-composer.tsx +464 -0
  46. package/docs/data-entry/chat-suggestion.tsx +301 -0
  47. package/docs/roadmap/ai-chat-components.md +207 -0
  48. package/docs/roadmap/antd-parity.md +154 -0
  49. package/docs/roadmap/badge-tag-chip-count.md +172 -0
  50. package/docs/roadmap/list-masonry.md +159 -0
  51. package/docs/roadmap/parity-audit-data-display-feedback.md +567 -0
  52. package/docs/roadmap/parity-audit-data-entry.md +344 -0
  53. package/docs/roadmap/parity-audit-layout-navigation-general.md +464 -0
  54. package/docs/roadmap/parity-backlog.md +79 -0
  55. package/docs/roadmap/tree-components.md +151 -0
  56. package/docs/showcase/table-tree-rows.tsx +4 -4
  57. package/package.json +5 -3
  58. package/dist/components/data-display/tree-list.d.ts +0 -13
  59. package/dist/components/data-display/tree-list.js +0 -26
  60. package/docs/data-display/tree-list.tsx +0 -107
@@ -0,0 +1,301 @@
1
+ import { useState } from "react";
2
+
3
+ import {
4
+ Avatar,
5
+ AvatarFallback,
6
+ Card,
7
+ CardContent,
8
+ CardDescription,
9
+ CardHeader,
10
+ CardTitle,
11
+ } from "@godxjp/ui/data-display";
12
+ import {
13
+ ChatComposer,
14
+ ChatSuggestion,
15
+ type ChatSuggestionItemProp,
16
+ } from "@godxjp/ui/data-entry";
17
+ import { Text } from "@godxjp/ui/general";
18
+ import {
19
+ AppShell,
20
+ Flex,
21
+ PageContainer,
22
+ Sidebar,
23
+ type SidebarSectionProp,
24
+ Topbar,
25
+ } from "@godxjp/ui/layout";
26
+ import { AtSign, Bot, Hash, MessageSquare, Settings, Slash, Users } from "lucide-react";
27
+
28
+ /**
29
+ * ChatSuggestion — the trigger-character list that completes a draft in place.
30
+ *
31
+ * It owns the part `Command` does not: watching a TEXTAREA for a trigger character at the caret,
32
+ * tracking the query as the caret moves, and closing on Escape, on blur and on a word break —
33
+ * while the list itself stays the real `Command` inside a real `Popover`, so the listbox ARIA is
34
+ * cmdk's and not hand-rolled.
35
+ *
36
+ * Every card here is one axis at rest, so the whole API is visible without clicking:
37
+ * `triggerCharacter`, one level of `children`, a disabled row, an empty result, and the
38
+ * open/defaultOpen/onOpenChange triad. `ChatComposer`'s own page shows it wired into a live
39
+ * transcript; this page is about the completion behaviour alone.
40
+ *
41
+ * Composed only from real @godxjp/ui components.
42
+ */
43
+ const sections: SidebarSectionProp[] = [
44
+ {
45
+ label: "アシスタント",
46
+ items: [
47
+ { id: "chat", label: "チャット", icon: MessageSquare },
48
+ { id: "agents", label: "エージェント", icon: Bot },
49
+ { id: "members", label: "メンバー", icon: Users },
50
+ ],
51
+ },
52
+ { label: "管理", items: [{ id: "settings", label: "設定", icon: Settings }] },
53
+ ];
54
+
55
+ /** Slash commands — the `template` row carries one level of `children`. */
56
+ const COMMANDS: ChatSuggestionItemProp[] = [
57
+ { value: "summarize", label: "要約する", description: "このスレッドを3行で要約します" },
58
+ { value: "translate", label: "翻訳する", description: "英語 ⇄ 日本語" },
59
+ { value: "explain", label: "詳しく説明する" },
60
+ {
61
+ value: "archive",
62
+ label: "アーカイブする",
63
+ description: "権限がないため選択できません",
64
+ disabled: true,
65
+ },
66
+ {
67
+ value: "template",
68
+ label: "テンプレート",
69
+ description: "定型文を挿入します",
70
+ children: [
71
+ { value: "minutes", label: "議事録" },
72
+ { value: "weekly", label: "週報" },
73
+ ],
74
+ },
75
+ ];
76
+
77
+ const MEMBERS: ChatSuggestionItemProp[] = [
78
+ { value: "sato", label: "佐藤 花子", description: "経理" },
79
+ { value: "tanaka", label: "田中 太郎", description: "開発" },
80
+ { value: "nguyen", label: "Nguyễn Minh", description: "Design" },
81
+ ];
82
+
83
+ const CHANNELS: ChatSuggestionItemProp[] = [
84
+ { value: "general", label: "general", description: "全社アナウンス" },
85
+ { value: "accounting", label: "accounting", description: "経理チーム" },
86
+ ];
87
+
88
+ export default function Demo() {
89
+ const [slashDraft, setSlashDraft] = useState("");
90
+ const [mentionDraft, setMentionDraft] = useState("");
91
+ const [channelDraft, setChannelDraft] = useState("");
92
+ const [emptyDraft, setEmptyDraft] = useState("");
93
+ const [controlledDraft, setControlledDraft] = useState("");
94
+ const [controlledOpen, setControlledOpen] = useState(false);
95
+
96
+ return (
97
+ <AppShell
98
+ sidebar={
99
+ <Sidebar
100
+ activeId="chat"
101
+ sections={sections}
102
+ onSelect={() => {}}
103
+ product={{ name: "CoreDesk", role: "アシスタント", color: "hsl(var(--primary))" }}
104
+ />
105
+ }
106
+ topbar={
107
+ <Topbar
108
+ start={
109
+ <Avatar className="rounded-md">
110
+ <AvatarFallback className="bg-primary text-primary-foreground font-bold">
111
+ C
112
+ </AvatarFallback>
113
+ </Avatar>
114
+ }
115
+ />
116
+ }
117
+ >
118
+ <PageContainer
119
+ title="入力補完"
120
+ subtitle="ChatSuggestion · トリガー文字 / 階層 / 無効行 / 該当なし / 制御された開閉"
121
+ breadcrumb={[{ label: "アシスタント", to: "#" }, { label: "入力補完" }]}
122
+ >
123
+ <Flex direction="col" gap="lg">
124
+ {/* ── 1. The default trigger, and one level of children ────────────────────────── */}
125
+ <Card>
126
+ <CardHeader>
127
+ <CardTitle level={2}>
128
+ <Slash aria-hidden="true" />
129
+ スラッシュコマンド
130
+ </CardTitle>
131
+ <CardDescription>
132
+ 「/」を入力すると開きます。「テンプレート」は子を持つので、Enter
133
+ はまだ確定せず一段深く入ります。Escape
134
+ は閉じるだけで、入力済みの文字はそのまま残ります。
135
+ </CardDescription>
136
+ </CardHeader>
137
+ <CardContent>
138
+ <ChatSuggestion
139
+ items={COMMANDS}
140
+ onValueChange={(value) => setSlashDraft(`/${value} `)}
141
+ >
142
+ {({ onTrigger, onKeyDown }) => (
143
+ <ChatComposer
144
+ id="slash-composer"
145
+ aria-label="スラッシュコマンドを試す"
146
+ value={slashDraft}
147
+ onValueChange={(next) => {
148
+ setSlashDraft(next);
149
+ onTrigger(next);
150
+ }}
151
+ onKeyDown={onKeyDown}
152
+ onSubmit={() => setSlashDraft("")}
153
+ placeholder="「/」でコマンド一覧"
154
+ />
155
+ )}
156
+ </ChatSuggestion>
157
+ </CardContent>
158
+ </Card>
159
+
160
+ {/* ── 2. triggerCharacter="@" ──────────────────────────────────────────────────── */}
161
+ <Card>
162
+ <CardHeader>
163
+ <CardTitle level={2}>
164
+ <AtSign aria-hidden="true" />
165
+ triggerCharacter=&quot;@&quot;
166
+ </CardTitle>
167
+ <CardDescription>
168
+ トリガー文字は差し替えられます。1つの入力欄に対して1つの
169
+ ChatSuggestion — 2種類を同時に見張るのではなく、用途ごとに別の欄にします。
170
+ </CardDescription>
171
+ </CardHeader>
172
+ <CardContent>
173
+ <ChatSuggestion
174
+ items={MEMBERS}
175
+ triggerCharacter="@"
176
+ onValueChange={(value) => setMentionDraft(`@${value} `)}
177
+ >
178
+ {({ onTrigger, onKeyDown }) => (
179
+ <ChatComposer
180
+ id="mention-composer"
181
+ aria-label="メンバーをメンション"
182
+ value={mentionDraft}
183
+ onValueChange={(next) => {
184
+ setMentionDraft(next);
185
+ onTrigger(next);
186
+ }}
187
+ onKeyDown={onKeyDown}
188
+ onSubmit={() => setMentionDraft("")}
189
+ placeholder="「@」でメンバー一覧"
190
+ />
191
+ )}
192
+ </ChatSuggestion>
193
+ </CardContent>
194
+ </Card>
195
+
196
+ {/* ── 3. triggerCharacter="#" ──────────────────────────────────────────────────── */}
197
+ <Card>
198
+ <CardHeader>
199
+ <CardTitle level={2}>
200
+ <Hash aria-hidden="true" />
201
+ triggerCharacter=&quot;#&quot;
202
+ </CardTitle>
203
+ <CardDescription>チャンネル参照。項目が少なくても扱いは同じです。</CardDescription>
204
+ </CardHeader>
205
+ <CardContent>
206
+ <ChatSuggestion
207
+ items={CHANNELS}
208
+ triggerCharacter="#"
209
+ onValueChange={(value) => setChannelDraft(`#${value} `)}
210
+ >
211
+ {({ onTrigger, onKeyDown }) => (
212
+ <ChatComposer
213
+ id="channel-composer"
214
+ aria-label="チャンネルを参照"
215
+ value={channelDraft}
216
+ onValueChange={(next) => {
217
+ setChannelDraft(next);
218
+ onTrigger(next);
219
+ }}
220
+ onKeyDown={onKeyDown}
221
+ onSubmit={() => setChannelDraft("")}
222
+ placeholder="「#」でチャンネル一覧"
223
+ size="sm"
224
+ />
225
+ )}
226
+ </ChatSuggestion>
227
+ </CardContent>
228
+ </Card>
229
+
230
+ {/* ── 4. No items — the empty state is the component's, not the caller's ───────── */}
231
+ <Card>
232
+ <CardHeader>
233
+ <CardTitle level={2}>該当なし</CardTitle>
234
+ <CardDescription>
235
+ 候補が0件でもパネルは開き、件数は読み上げ用の status
236
+ で通知されます。空の list を黙って閉じると、利用者には「効かない」ように見えます。
237
+ </CardDescription>
238
+ </CardHeader>
239
+ <CardContent>
240
+ <ChatSuggestion items={[]} onValueChange={() => {}}>
241
+ {({ onTrigger, onKeyDown }) => (
242
+ <ChatComposer
243
+ id="empty-composer"
244
+ aria-label="候補が0件の例"
245
+ value={emptyDraft}
246
+ onValueChange={(next) => {
247
+ setEmptyDraft(next);
248
+ onTrigger(next);
249
+ }}
250
+ onKeyDown={onKeyDown}
251
+ onSubmit={() => setEmptyDraft("")}
252
+ placeholder="「/」を押しても候補はありません"
253
+ />
254
+ )}
255
+ </ChatSuggestion>
256
+ </CardContent>
257
+ </Card>
258
+
259
+ {/* ── 5. open / onOpenChange — the controlled triad ────────────────────────────── */}
260
+ <Card>
261
+ <CardHeader>
262
+ <CardTitle level={2}>open · onOpenChange</CardTitle>
263
+ <CardDescription>
264
+ 開閉も制御できます。下の行は現在の状態をそのまま映したもので、
265
+ トリガー文字・Escape・語の区切りのいずれでも同じ値が動きます。
266
+ </CardDescription>
267
+ </CardHeader>
268
+ <CardContent>
269
+ <Flex direction="col" gap="sm">
270
+ <ChatSuggestion
271
+ items={COMMANDS}
272
+ open={controlledOpen}
273
+ onOpenChange={setControlledOpen}
274
+ onValueChange={(value) => setControlledDraft(`/${value} `)}
275
+ >
276
+ {({ onTrigger, onKeyDown }) => (
277
+ <ChatComposer
278
+ id="controlled-composer"
279
+ aria-label="開閉を制御した例"
280
+ value={controlledDraft}
281
+ onValueChange={(next) => {
282
+ setControlledDraft(next);
283
+ onTrigger(next);
284
+ }}
285
+ onKeyDown={onKeyDown}
286
+ onSubmit={() => setControlledDraft("")}
287
+ placeholder="「/」で開き、Escape で閉じます"
288
+ />
289
+ )}
290
+ </ChatSuggestion>
291
+ <Text size="xs" tone="muted">
292
+ open = {controlledOpen ? "true" : "false"}
293
+ </Text>
294
+ </Flex>
295
+ </CardContent>
296
+ </Card>
297
+ </Flex>
298
+ </PageContainer>
299
+ </AppShell>
300
+ );
301
+ }
@@ -0,0 +1,207 @@
1
+ # AI / chatbot components — normalized spec
2
+
3
+ > **Reference:** Ant Design X (<https://x.ant.design/components/overview>) for *capabilities*.
4
+ > **Naming:** when a component's identity is unclear, look it up at
5
+ > <https://namethatui.com/?platform=web> before inventing a name.
6
+ > **Contract:** `.claude/skills/godxjp-ui-component/SKILL.md` is the hard gate — MCP-first, real
7
+ > primitives only, `t()` + `Intl`, WAI-ARIA APG + WCAG 2.2 AA + vitest-axe, logical CSS, controlled
8
+ > vocabulary, semantic tokens, MCP catalog entry, real-screen docs page.
9
+
10
+ The library has **zero** chat/AI components today (verified against `mcp/src/data/components.ts` —
11
+ 127 entries, none of them conversational). This document decides which of Ant Design X's surface
12
+ becomes a framework component and which is a composition, so no agent has to re-litigate it.
13
+
14
+ ## 1. Scope decision — GATE 0 applied to every Ant Design X component
15
+
16
+ `docs/COMPOSITION-VS-COMPONENT.md` C1–C7. **Any FAIL ⇒ composition, never `src/components/`.**
17
+
18
+ | Ant Design X | godx name | Group | C1 | C2 | C3 | C4 | C5 | C6 | C7 | Verdict |
19
+ | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
20
+ | `Bubble` | **`ChatBubble`** | `data-display` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | **Framework component** |
21
+ | `Bubble.List` | **`ChatBubbleList`** | `data-display` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | **Framework component** |
22
+ | `Sender` | **`ChatComposer`** | `data-entry` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | **Framework component** |
23
+ | `Suggestion` | **`ChatSuggestion`** | `data-entry` | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | **Framework component** |
24
+ | `Conversations` | **`ConversationList`** | `navigation` | ✅ | ✅ | ⚠️ | ✅ | ✅ | ✅ | ✅ | **Verify C3 first** — see §6 |
25
+ | `ThoughtChain` / `Think` | **`ThoughtChain`** | `data-display` | ✅ | ⚠️ | ⚠️ | ✅ | ✅ | ✅ | ⚠️ | **Verify C2/C3 first** — see §6 |
26
+ | `Prompts` | — | — | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | **Composition** — `ResponsiveGrid` + `Card` + `Button` |
27
+ | `Welcome` | — | — | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | **Composition** — static block, `EmptyState`-shaped |
28
+ | `Actions` | — | — | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | **Composition** — `Button` + `DropdownMenu` |
29
+ | `Attachments` / `FileCard` | — | — | ✅ | ✅ | ❌ | — | — | — | — | **Extend `Upload`** — duplicating it is an instant reject |
30
+ | `CodeHighlighter` | — | — | — | — | ❌ | — | — | — | — | **Use `CodeBlock`** |
31
+ | `Sources` | — | — | ✅ | ❌ | ❌ | ❌ | ✅ | ❌ | ❌ | **Composition** — `ListRow` + `Badge` |
32
+ | `XProvider` | — | — | — | — | ❌ | — | — | — | — | **Use `AppProvider`** |
33
+ | `Mermaid` | — | — | ❌ | — | — | — | — | — | ❌ | **Out of scope** |
34
+ | `Folder/File Tree` | — | — | — | — | ❌ | — | — | — | — | **Covered by `Tree`** — see `docs/roadmap/tree-components.md` |
35
+
36
+ **v1 build set: `ChatBubble`, `ChatBubbleList`, `ChatComposer`, `ChatSuggestion`** (4 components,
37
+ all 7/7 PASS). `ConversationList` and `ThoughtChain` are conditional — §6.
38
+ Everything else ships as a `docs/` showcase composition, not library code.
39
+
40
+ ---
41
+
42
+ ## 2. `ChatBubble` — one message in a conversation
43
+
44
+ **Group:** `data-display` · **File:** `src/components/data-display/chat-bubble.tsx`
45
+
46
+ | Ant Design X | **godx `ChatBubble`** |
47
+ | --- | --- |
48
+ | `content` | `children` (a `ReactNode`; do not take an HTML string) |
49
+ | `placement: 'start' \| 'end'` | `placement: 'start' \| 'end'` (logical — flips under RTL) |
50
+ | `variant: 'filled' \| 'borderless' \| 'outlined' \| 'shadow'` | `variant: 'filled' \| 'borderless' \| 'outlined'` (drop `shadow`; the design system is 1px-border, no drop shadows) |
51
+ | `avatar` | `avatar` (a real `Avatar` node, never a styled div) |
52
+ | `header` / `footer` | `header` / `footer` |
53
+ | `loading` | `loading` (renders `Skeleton`, `aria-busy="true"`) |
54
+ | `typing` | `typing: boolean \| { step?: number; interval?: number }` |
55
+ | `messageRender` | *dropped* — the caller passes rendered `children` |
56
+ | `shape` | *dropped* — corner radius is a token |
57
+ | — | `size: 'xs' \| 'sm' \| 'lg'` (`md` default) |
58
+ | — | `tone` for status-tinted bubbles (error/warning), never colour-only |
59
+
60
+ **Semantics.** The bubble is an `<article>` inside the list's feed. Give it an accessible name from
61
+ its `header` (the author). The typing animation MUST respect `prefers-reduced-motion: reduce` —
62
+ render the full text immediately, no animation. Streaming text goes in an `aria-live="polite"`
63
+ region owned by `ChatBubbleList`, **not** per-bubble (a live region per bubble floods a screen
64
+ reader). Decorative avatars `aria-hidden`.
65
+
66
+ **Tokens** (`src/tokens/components/chat-bubble.css`): `--chat-bubble-background`,
67
+ `--chat-bubble-foreground`, `--chat-bubble-border-color`, `--chat-bubble-radius`,
68
+ `--chat-bubble-gap`, `--chat-bubble-max-inline-size`, `--chat-bubble-avatar-size`.
69
+ Role-mirror knobs default to `initial` (`docs/TOKENS.md`).
70
+
71
+ **i18n:** `chat.bubble.typing`, `chat.bubble.loading`, `chat.bubble.you`, `chat.bubble.assistant`.
72
+ Timestamps via `Intl.DateTimeFormat`; "2 minutes ago" via `Intl.RelativeTimeFormat`; counted nouns
73
+ via `Intl.PluralRules` — never a template string.
74
+
75
+ ---
76
+
77
+ ## 3. `ChatBubbleList` — the message feed
78
+
79
+ **Group:** `data-display` · **File:** same module as `ChatBubble`
80
+
81
+ | Ant Design X `Bubble.List` | **godx `ChatBubbleList`** |
82
+ | --- | --- |
83
+ | `items` | `items: ChatMessageProp[]` |
84
+ | `roles` | `roles: Record<string, Partial<ChatBubbleProp>>` — per-role defaults (`user`, `assistant`, `system`) |
85
+ | `autoScroll` | `autoScroll` (default `true`) |
86
+
87
+ **The behavior that earns C2/C3** — none of it is composable from `ScrollArea` + `map`:
88
+
89
+ 1. **Stick-to-bottom.** Auto-scroll while the user is at the bottom; the moment they scroll up,
90
+ **stop** and surface a "jump to latest" affordance. Silently yanking a reader back to the bottom
91
+ mid-read is the classic chat-UI defect.
92
+ 2. **Streaming without layout thrash** — appended text must not re-scroll the whole feed.
93
+ 3. **One `aria-live="polite"` region** for the whole feed, announcing only the newest message.
94
+ 4. `role="log"` on the scroll container, `aria-label` via `t()`.
95
+ 5. Keyboard: the feed is focusable and scrollable with `PageUp`/`PageDown`/`Home`/`End`; bubbles
96
+ are not a roving-tabindex widget (interactive controls inside them keep normal tab order).
97
+
98
+ ---
99
+
100
+ ## 4. `ChatComposer` — the message input (Ant's `Sender`)
101
+
102
+ **Group:** `data-entry` · **File:** `src/components/data-entry/chat-composer.tsx`
103
+
104
+ Named for what the industry calls it (Slack/Discord "composer"); `Sender` describes the person,
105
+ not the control.
106
+
107
+ | Ant Design X `Sender` | **godx `ChatComposer`** |
108
+ | --- | --- |
109
+ | `value` / `onChange` | `value` / `defaultValue` / `onValueChange` (**controlled triad — mandatory**) |
110
+ | `onSubmit` | `onSubmit(value: string)` |
111
+ | `loading` + `onCancel` | `loading` + `onCancel` |
112
+ | `submitType: 'enter' \| 'shiftEnter'` | `submitType: 'enter' \| 'shiftEnter'` |
113
+ | `placeholder` | `placeholder` (through `t()` at the call site) |
114
+ | `disabled` / `readOnly` | `disabled` / `readOnly` |
115
+ | `header` (`Sender.Header`) | `header` slot |
116
+ | `prefix` / `footer` / `actions` | `prefix` / `footer` / `actions` slots |
117
+ | `allowSpeech` | **out of scope v1** — Web Speech API is not cross-browser; file a follow-up |
118
+ | `autoSize` | always auto-sizing; not a prop |
119
+ | — | `size: 'xs' \| 'sm' \| 'lg'` · `maxLength` · `status` |
120
+
121
+ **Rules.**
122
+ - Built on the real `Textarea` primitive and real `Button`s — **no raw `<textarea>`/`<button>`**.
123
+ - Auto-grow between a min and max height expressed in `--control-height` tiers, then scroll
124
+ inside. **No literal `height` and no `calc(var(--control-height) ± …)`** (`check:control-sizing`).
125
+ - `submitType="enter"`: `Enter` submits, `Shift+Enter` newline. `submitType="shiftEnter"`: the
126
+ inverse. IME composition must never submit — guard on `compositionstart`/`compositionend`
127
+ (this is the bug that breaks Japanese and Vietnamese input; it is not optional).
128
+ - Empty or whitespace-only input does not submit; the submit button is `disabled` with an
129
+ accessible name, not merely greyed out.
130
+ - While `loading`, the submit button becomes a cancel button — **one trailing action at a time**,
131
+ the same discipline as the picker trailing-action rule.
132
+ - The textarea is the semantic focus target; forward the `FormField` label/helper/error contract
133
+ onto it via `pickFieldA11y` / `useFieldIdentity` — do not reinvent it (`src/lib/field-a11y.ts`).
134
+
135
+ ---
136
+
137
+ ## 5. `ChatSuggestion` — trigger-character autocomplete over the composer
138
+
139
+ **Group:** `data-entry` · **File:** `src/components/data-entry/chat-suggestion.tsx`
140
+
141
+ | Ant Design X `Suggestion` | **godx `ChatSuggestion`** |
142
+ | --- | --- |
143
+ | `items` | `items: SuggestionItemProp[]` (supports one level of `children`) |
144
+ | `onSelect` | `onValueChange(value: string)` |
145
+ | `block` | *dropped* — width follows the anchor |
146
+ | render-prop `children({ onTrigger, onKeyDown })` | same shape — it wraps `ChatComposer` |
147
+ | — | `triggerCharacter` (default `'/'`) · `open` / `defaultOpen` / `onOpenChange` |
148
+
149
+ **Rules.** Compose the existing `Command` (cmdk) inside a `Popover` anchored to the composer — do
150
+ **not** hand-roll a listbox; `Command` already ships correct ARIA. What this component owns is the
151
+ part `Command` does not: detecting the trigger character in a textarea, tracking the query as the
152
+ caret moves, and closing on `Escape`/blur/word-break. `Escape` returns focus to the textarea and
153
+ leaves the typed text intact.
154
+
155
+ ---
156
+
157
+ ## 6. Conditional components — prove C3 before writing code
158
+
159
+ Do **not** start these until the ledger is recorded in the PR description.
160
+
161
+ **`ConversationList`** (Ant's `Conversations`). `NavList` already renders selectable rows with
162
+ `aria-current="page"`, an icon column and a badge; `ListRow` covers short entity lists. Before
163
+ building, answer in writing: what does a conversation list own that `NavList` does not?
164
+ The honest candidates are date **grouping** (Today / Yesterday / Last 7 days — via
165
+ `Intl.RelativeTimeFormat` + `Intl.DateTimeFormat`, never hand-rolled buckets), a **per-item
166
+ overflow menu**, and **inline rename**. If those land as `NavList` props instead, that is the
167
+ better outcome — extend `NavList` and close this out.
168
+
169
+ **`ThoughtChain`** (Ant's `ThoughtChain` / `Think`). `Timeline` already has a 3-state per-item
170
+ `status` (`done`/`current`/`pending`), an icon rail and ordinal/status variants; `Collapsible`
171
+ owns disclosure. `ThoughtChain` = `Timeline` + per-item collapsible body + a streaming/pending
172
+ state. Strongly prefer adding a `collapsible` affordance to `Timeline` over a new component.
173
+ Whichever way it goes, the reasoning body must be collapsible, and the running step must be
174
+ announced once via `aria-live="polite"` — not on every token.
175
+
176
+ ---
177
+
178
+ ## 7. Per-component definition of done
179
+
180
+ Every component in the build set ships **all** of:
181
+
182
+ 1. `src/components/<group>/<name>.tsx` — real primitives only, logical CSS, `t()` for every string
183
+ and `aria-label`, `ref` forwarded, `...props` spread, `className` + `id` accepted.
184
+ 2. `XProp` + `XProp as XProps` in `src/props/components/<group>.prop.ts`, **registered in
185
+ `src/props/registry.ts`**.
186
+ 3. `src/tokens/components/<name>.css` + an `@import` in `src/tokens/base.css`; names pass
187
+ `check:token-tiers`; control boxes come from the `--control-height` tier.
188
+ 4. Keys in `src/i18n/messages/en.json`, `vi.json`, `ja.json` — all three, no exceptions.
189
+ 5. Tests in `src/components/<group>/__tests__/`: a behavior test using `@testing-library/user-event`
190
+ **and** a `<name>.a11y.test.tsx` with `expectNoA11yViolations` at **0 violations**.
191
+ 6. An `mcp/src/data/components.ts` entry (props / usage / useCases / related / example / rules) —
192
+ `check:mcp-sync` and `check:mcp-orphans` must pass.
193
+ 7. A real-screen docs page under `docs/<group>/` (AppShell + PageContainer + real primitives), not
194
+ a bare `Card` snippet.
195
+ 8. Export from the group's `index.ts`.
196
+
197
+ Gates, then **only** the touched group's tests:
198
+
199
+ ```
200
+ pnpm typecheck && pnpm lint && pnpm run audit \
201
+ && pnpm check:prop-vocabulary && pnpm check:mcp-sync && pnpm check:mcp-orphans \
202
+ && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:example-imports
203
+ pnpm vitest run src/components/<group>/__tests__ --maxWorkers=2
204
+ ```
205
+
206
+ `pnpm test` and a bare `pnpm vitest run` are **forbidden** — 506 files / 3700+ tests, and several
207
+ agents on one machine takes the load past 90. The full suite is CI's job on the PR.
@@ -0,0 +1,154 @@
1
+ # Ant Design parity — the audit programme
2
+
3
+ > The complaint is systemic: *"hầu hết các component thiếu tính năng so với Ant Design."*
4
+ > This document is the **method**, so that 127 catalog entries can be audited by different agents
5
+ > and still produce comparable, reviewable results. Per-component specs live in sibling files.
6
+
7
+ ## 0. Ground rules (a parity gap is not a licence to copy Ant Design)
8
+
9
+ 1. **Capabilities are the target; prop names are not.** Map every antd prop onto
10
+ `docs/PROPS-VOCABULARY.md` — controlled triad `value`/`defaultValue`/`onValueChange`,
11
+ overlays `open`/`defaultOpen`/`onOpenChange`, `size ∈ xs|sm|md|lg` (never `"default"`),
12
+ `tone` for status, positive booleans. Where the library already has a spelling
13
+ (`getRowId`, `gap`, `columns: {base,sm,md,lg}`, `count`/`overflowCount`/`showZero`), **reuse it**.
14
+ A third dialect of the same idea is the defect this repo keeps paying to fix.
15
+ 2. **GATE 0 still applies.** A missing antd component is not automatically a framework component.
16
+ Run the C1–C7 test in `docs/COMPOSITION-VS-COMPONENT.md` and publish the ledger. Ant ships
17
+ things that are compositions here (`Badge.Ribbon`, `Welcome`, `Prompts`).
18
+ 3. **Do not duplicate what exists.** Ant's `CheckableTag` is this library's `Toggle`. Ant's
19
+ searchable select is `Select showSearch`. Check the MCP catalog before proposing anything.
20
+ 4. **Do not port antd's mistakes.** Skip `styles={{…}}` inline-style twins (this system themes with
21
+ tokens), pixel `offset` pairs, and physical `left/right` spellings.
22
+ 5. **A gap is only real once measured.** Cite the file and line, or the absence of a grep hit.
23
+ "Looks less capable than antd" is not a finding.
24
+
25
+ ## 1. Spacing, geometry and token names — the rules already exist, so use them
26
+
27
+ This library is instrumented with ~60 checkers. Anything you write — **a spec document included** —
28
+ is machine-checkable, so check it before you hand it to anyone.
29
+
30
+ **Spacing is not free-form.** `docs/SPACING.md` is binding:
31
+
32
+ - Macro layout uses a **φ modular scale (≈1.618)**, *not* the 8pt grid. `xs`/`sm` = 4px grid,
33
+ `md` = φ⁰, `lg` = φ¹, `xl` = φ². Applying Material's 8pt grid here is wrong, not "standard".
34
+ - Tailwind `p-*` / `m-*` / `gap-*` are rejected by `no-utility-spacing`; hand-rolled `flex`/`grid`
35
+ by `no-utility-layout`. Rows are `<Flex>`, stacks `<Flex direction="col" gap>`, grids
36
+ `<ResponsiveGrid>`, page sections spaced by `<PageContainer>` itself.
37
+ - **Card padding has a single owner**: `src/styles/card-layout.css`. Anything else that must sit on
38
+ the same rhythm uses `ui-card-inset-x` / `ui-card-inset-y` / `ui-card-inset` — and those three do
39
+ **not** share one value. Never invent a per-component inline-padding token where the Card already
40
+ owns the inset.
41
+
42
+ **Component token names must match this exact shape** — `check:token-tiers` enforces it:
43
+
44
+ ```
45
+ --{component}-{part}-{property}
46
+ ```
47
+
48
+ where `{property}` is one of: `space color background foreground border radius height width padding
49
+ gap size font line letter shadow glow tint gradient alpha align inset offset translate max overflow
50
+ display`.
51
+
52
+ `surface`, `bg`, `fg`, `spacing` are **not** accepted words. Control boxes come from the
53
+ `--control-height` tier — never a literal height, never `calc(var(--control-height) ± …)`
54
+ (`check:control-sizing`), never a Tailwind scale literal (`check:no-hardcoded-geometry` —
55
+ even `min-w-0` fails).
56
+
57
+ **Before handing over any doc or spec, run at minimum:**
58
+
59
+ ```
60
+ pnpm check:doc-prop-existence # a prop named in an example must exist on that component —
61
+ # including a prop you only meant as an Ant Design illustration
62
+ pnpm check:token-tiers && pnpm check:no-hardcoded-geometry && pnpm run audit
63
+ ```
64
+
65
+ This section exists because it was violated: a comparison table in
66
+ `badge-tag-chip-count.md` wrote an antd `Badge` + `count` example to illustrate *Ant's* API and
67
+ `check:doc-prop-existence` correctly read it as a claim about *ours*; and three specs named tokens
68
+ `--…-surface` / `--…-bg`, which the shape above forbids. Both were caught by gates that already
69
+ existed and simply had not been run.
70
+
71
+ ## 2. The ledger format — every audit produces exactly this table
72
+
73
+ One row per antd capability. No prose findings.
74
+
75
+ | Ant Design prop / behaviour | Status | Evidence | Verdict |
76
+ | --- | --- | --- | --- |
77
+ | `<prop>` — one-line meaning | `PRESENT` / `RENAMED` / `COVERED-ELSEWHERE` / `MISSING` / `WONT-PORT` | `src/…:line`, or the grep that found nothing | for `MISSING`: the godx prop name to add, or "composition" |
78
+
79
+ - `RENAMED` — present under the house spelling. Record both names; no work.
80
+ - `COVERED-ELSEWHERE` — another primitive owns it. Name it. No work, but add a `related` cross-link
81
+ in the catalog **on both sides** (a one-sided claim is the mistake commit `8365bf05` fixed).
82
+ - `WONT-PORT` — a deliberate refusal. State the reason in the catalog entry so nobody re-adds it.
83
+
84
+ Close every audit with a **priority call**: `P0` (breaks a real screen), `P1` (a workaround exists
85
+ but it is hand-rolled and a11y-risky), `P2` (nice to have).
86
+
87
+ ## 3. Findings so far
88
+
89
+ ### 3.1 Already specced — see the sibling documents
90
+
91
+ | Area | Verdict | Spec |
92
+ | --- | --- | --- |
93
+ | `Tree` / `TreeList` / `TreeSelect` | `TreeSelect` fine; `TreeList` is not a tree; **`Tree` missing entirely** | `tree-components.md` |
94
+ | Badge / Tag / Chip / Pill / Count | Count marker missing entirely; removable chip trapped inside `TagInput`; selectable chip already is `Toggle` | `badge-tag-chip-count.md` |
95
+ | `List` (Ant `Listy`) / `Masonry` | Both missing entirely — no virtualization and no column packing anywhere in `src/` | `list-masonry.md` |
96
+ | AI / chat surface | Nothing exists; 4 components + 6 compositions decided | `ai-chat-components.md` |
97
+
98
+ ### 3.2 `Tabs`, `Steps`, `Segmented` — audited 2026-09-10
99
+
100
+ These three are **already deliberately Ant-aligned** — the prop types cite antd by name. The
101
+ remaining gaps are narrow, and none of them is P0.
102
+
103
+ **`Tabs`** (`src/props/components/navigation.prop.ts:301`, `src/components/navigation/tabs.tsx`).
104
+ Present: `items` (incl. `closable`/`closeIcon`/`icon`), `value`/`defaultValue`/`onValueChange`,
105
+ `variant` (`line`/`card`/`editable-card`), `tabPlacement`, `centered`, `extra`
106
+ (= antd `tabBarExtraContent`), `destroyOnHidden`, `onEdit`, `addIcon`, `hideAdd`. Overflow already
107
+ scrolls and keeps the active tab visible (`src/components/navigation/tabs-scroll.ts`).
108
+
109
+ | Gap | Priority | Verdict |
110
+ | --- | --- | --- |
111
+ | `moreIcon` + an overflow **"more" dropdown** when the strip cannot scroll (narrow viewports) | **P1** | Add. Scrolling alone hides tabs from a touch user with no affordance. |
112
+ | `indicator: { size, align }` | P2 | Add as tokens (`--tabs-indicator-*`), not props — it is a design knob (cardinal rule #44). |
113
+ | `tabBarGutter` | P2 | Token, not a prop. |
114
+ | `animated` | P2 | `WONT-PORT` as a prop — motion is a system decision and must follow `prefers-reduced-motion`. |
115
+ | `renderTabBar` | P2 | `WONT-PORT` — an escape hatch that lets a consumer bypass the a11y contract. |
116
+ | `size` lacks `xs` | P2 | Add `xs` for the full `xs\|sm\|md\|lg` tier. |
117
+
118
+ **`Steps`** (`src/props/components/navigation.prop.ts:201-240`).
119
+ Present: `items` (`title`/`subtitle`/`description`/`icon`/`status`/`disabled`),
120
+ `value`/`defaultValue`/`onValueChange`, `orientation`, `status`, `type`
121
+ (`default`/`dot`/`inline`/`navigation` — `dot` **is** antd's deprecated `progressDot`), `percent`,
122
+ `titlePlacement`, `separator`.
123
+
124
+ | Gap | Priority | Verdict |
125
+ | --- | --- | --- |
126
+ | `initial` — start the visible numbering at N | P2 | Add. Trivial, and real for resumed wizards. |
127
+ | `responsive` — auto-switch to vertical on a narrow container | **P1** | Add. Today a horizontal 5-step bar on a phone is the caller's problem. |
128
+ | `size` is `md\|sm` only | P2 | Extend to `xs\|sm\|md\|lg`. |
129
+
130
+ **`Segmented`** (`src/components/ui/segmented.tsx`). Built on Radix `RadioGroup` — the correct APG
131
+ choice, and the comment explaining why it is not a `ToggleGroup` should be preserved verbatim.
132
+ Present: `options` (`value`/`label`/`icon`/`disabled`), `value`/`defaultValue`/`onValueChange`,
133
+ `block`, `vertical`, `size`, `disabled`, `name`.
134
+
135
+ | Gap | Priority | Verdict |
136
+ | --- | --- | --- |
137
+ | `shape: 'default' \| 'round'` | P2 | Add as `shape` — the existing `ShapeProp` vocabulary already has `pill`; reuse it rather than antd's `round`. |
138
+ | Option as a bare `string \| number` | P2 | Add. Ant accepts it; it removes ceremony for the common case. |
139
+ | Per-option `title` (a tooltip / hover hint) | P2 | `COVERED-ELSEWHERE` — wrap the option in `Tooltip`. Do not add a second tooltip API. |
140
+ | `size` lacks `xs` | P2 | Add. |
141
+
142
+ **None of these three is the source of the "doesn't look like Ant Design" impression** — that is
143
+ `TreeList`, the missing count badge, and the missing `List`/`Masonry`/`Tree`.
144
+
145
+ ## 4. How to run an audit (per component group)
146
+
147
+ 1. Read the group's catalog entries in `mcp/src/data/components.ts` and the prop types in
148
+ `src/props/components/<group>.prop.ts`.
149
+ 2. Fetch the matching Ant Design docs page for each. Where a component's *identity* is unclear,
150
+ settle it at <https://namethatui.com/?platform=web> before writing anything.
151
+ 3. Produce the §2 ledger per component. Cite file:line.
152
+ 4. Publish a GATE-0 C1–C7 ledger for anything proposed as a **new** component.
153
+ 5. Do **not** write source in an audit pass. An audit is read-only; fixes are a separate wave with
154
+ their own spec, so the diff stays reviewable and two agents never edit one file at once.