@godxjp/ui 20.2.1 → 22.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 (141) hide show
  1. package/dist/app/app-provider.js +2 -1
  2. package/dist/components/data-display/badge.d.ts +28 -1
  3. package/dist/components/data-display/badge.js +2 -0
  4. package/dist/components/data-display/chat-bubble.d.ts +30 -0
  5. package/dist/components/data-display/chat-bubble.js +229 -0
  6. package/dist/components/data-display/data-table.d.ts +18 -2
  7. package/dist/components/data-display/data-table.js +4 -0
  8. package/dist/components/data-display/descriptions.js +4 -1
  9. package/dist/components/data-display/index.d.ts +5 -3
  10. package/dist/components/data-display/index.js +5 -2
  11. package/dist/components/data-display/popover.d.ts +19 -1
  12. package/dist/components/data-display/popover.js +12 -3
  13. package/dist/components/data-display/progress.d.ts +37 -0
  14. package/dist/components/data-display/progress.js +57 -5
  15. package/dist/components/data-display/scroll-area.js +26 -1
  16. package/dist/components/data-display/tree.d.ts +8 -0
  17. package/dist/components/data-display/tree.js +426 -0
  18. package/dist/components/data-entry/chat-composer.d.ts +50 -0
  19. package/dist/components/data-entry/chat-composer.js +163 -0
  20. package/dist/components/data-entry/chat-suggestion.d.ts +28 -0
  21. package/dist/components/data-entry/chat-suggestion.js +285 -0
  22. package/dist/components/data-entry/date-picker.d.ts +10 -3
  23. package/dist/components/data-entry/date-picker.js +503 -238
  24. package/dist/components/data-entry/form-field.d.ts +1 -1
  25. package/dist/components/data-entry/form-field.js +4 -1
  26. package/dist/components/data-entry/form.js +10 -1
  27. package/dist/components/data-entry/index.d.ts +4 -6
  28. package/dist/components/data-entry/index.js +4 -6
  29. package/dist/components/data-entry/label.d.ts +14 -1
  30. package/dist/components/data-entry/label.js +6 -1
  31. package/dist/components/data-entry/radio.d.ts +27 -6
  32. package/dist/components/data-entry/radio.js +88 -43
  33. package/dist/components/data-entry/search-select.js +8 -1
  34. package/dist/components/data-entry/select.js +2 -0
  35. package/dist/components/data-entry/switch.d.ts +6 -3
  36. package/dist/components/data-entry/switch.js +34 -11
  37. package/dist/components/data-entry/textarea.js +3 -1
  38. package/dist/components/data-entry/tree-utils.d.ts +10 -48
  39. package/dist/components/data-entry/tree-utils.js +1 -154
  40. package/dist/components/layout/mobile-shell.d.ts +1 -1
  41. package/dist/components/layout/mobile-shell.js +2 -0
  42. package/dist/components/navigation/menubar.d.ts +10 -3
  43. package/dist/components/navigation/steps.d.ts +1 -1
  44. package/dist/components/navigation/steps.js +3 -1
  45. package/dist/components/navigation/tabs-scroll.d.ts +27 -0
  46. package/dist/components/navigation/tabs-scroll.js +52 -1
  47. package/dist/components/navigation/tabs.d.ts +2 -2
  48. package/dist/components/navigation/tabs.js +88 -23
  49. package/dist/components/ui/index.d.ts +0 -1
  50. package/dist/components/ui/index.js +0 -1
  51. package/dist/components/ui/segmented.d.ts +15 -1
  52. package/dist/components/ui/segmented.js +13 -6
  53. package/dist/i18n/messages/en.json +48 -2
  54. package/dist/i18n/messages/ja.json +46 -2
  55. package/dist/i18n/messages/vi.json +47 -2
  56. package/dist/lib/datetime/picker-format.d.ts +18 -0
  57. package/dist/lib/datetime/picker-format.js +35 -1
  58. package/dist/lib/field-a11y.d.ts +12 -0
  59. package/dist/lib/field-a11y.js +14 -1
  60. package/dist/lib/tree.d.ts +53 -0
  61. package/dist/lib/tree.js +155 -0
  62. package/dist/props/components/data-display.prop.d.ts +194 -1
  63. package/dist/props/components/data-entry.prop.d.ts +307 -99
  64. package/dist/props/components/index.d.ts +1 -1
  65. package/dist/props/components/layout.prop.d.ts +12 -1
  66. package/dist/props/components/navigation.prop.d.ts +76 -1
  67. package/dist/props/registry.d.ts +156 -19
  68. package/dist/props/registry.js +218 -18
  69. package/dist/props/vocabulary/data.prop.d.ts +12 -0
  70. package/dist/props/vocabulary/index.d.ts +2 -2
  71. package/dist/props/vocabulary/layout.prop.d.ts +11 -0
  72. package/dist/styles/badge-layout.css +4 -0
  73. package/dist/styles/card-layout.css +6 -6
  74. package/dist/styles/control.css +22 -6
  75. package/dist/styles/data-display-layout.css +385 -68
  76. package/dist/styles/data-entry-layout.css +64 -0
  77. package/dist/styles/focus-ring.css +4 -2
  78. package/dist/styles/navigation-layout.css +25 -0
  79. package/dist/styles/shell-layout.css +7 -1
  80. package/dist/styles/table-layout.css +34 -0
  81. package/dist/tokens/base.css +3 -0
  82. package/dist/tokens/components/chat-bubble.css +36 -0
  83. package/dist/tokens/components/chat-composer.css +19 -0
  84. package/dist/tokens/components/data-display.css +9 -6
  85. package/dist/tokens/components/descriptions.css +4 -0
  86. package/dist/tokens/components/navigation.css +6 -0
  87. package/dist/tokens/components/segmented.css +0 -2
  88. package/dist/tokens/components/shell.css +3 -0
  89. package/dist/tokens/components/table.css +3 -0
  90. package/dist/tokens/components/tree.css +27 -0
  91. package/dist/tokens/foundation.css +7 -0
  92. package/docs/COMPONENTS.md +14 -14
  93. package/docs/CONSUMER-RULES.md +24 -1
  94. package/docs/FRAME-COVERAGE-LEDGER.md +1 -1
  95. package/docs/FRAME-COVERAGE-REPORT.md +9 -7
  96. package/docs/TOKENS.md +65 -0
  97. package/docs/data-display/badge.tsx +37 -0
  98. package/docs/data-display/chat-bubble.tsx +397 -0
  99. package/docs/data-display/data-table/index.tsx +18 -0
  100. package/docs/data-display/popover.tsx +41 -1
  101. package/docs/data-display/progress.tsx +28 -0
  102. package/docs/data-display/timeline.tsx +46 -0
  103. package/docs/data-display/tree.tsx +394 -0
  104. package/docs/data-entry/calendar.tsx +2 -2
  105. package/docs/data-entry/chat-composer.tsx +464 -0
  106. package/docs/data-entry/chat-suggestion.tsx +301 -0
  107. package/docs/data-entry/date-picker.tsx +143 -3
  108. package/docs/data-entry/form/examples/invoice-form.tsx +2 -2
  109. package/docs/data-entry/form-field/examples/a11y-contract.tsx +3 -5
  110. package/docs/data-entry/form.tsx +4 -4
  111. package/docs/data-entry/number-input.tsx +31 -0
  112. package/docs/data-entry/segmented.tsx +103 -1
  113. package/docs/layout/mobile-shell.tsx +5 -0
  114. package/docs/navigation/tabs.tsx +149 -0
  115. package/docs/roadmap/ai-chat-components.md +207 -0
  116. package/docs/roadmap/antd-parity.md +155 -0
  117. package/docs/roadmap/badge-tag-chip-count.md +172 -0
  118. package/docs/roadmap/list-masonry.md +159 -0
  119. package/docs/roadmap/parity-audit-data-display-feedback.md +567 -0
  120. package/docs/roadmap/parity-audit-data-entry.md +357 -0
  121. package/docs/roadmap/parity-audit-layout-navigation-general.md +464 -0
  122. package/docs/roadmap/parity-backlog.md +78 -0
  123. package/docs/roadmap/tree-components.md +151 -0
  124. package/docs/showcase/acme-portal.tsx +7 -0
  125. package/docs/showcase/table-tree-rows.tsx +4 -4
  126. package/package.json +13 -23
  127. package/scripts/ui-audit.mjs +17 -4
  128. package/dist/components/data-display/tree-list.d.ts +0 -13
  129. package/dist/components/data-display/tree-list.js +0 -26
  130. package/dist/components/data-entry/date-range-picker.d.ts +0 -11
  131. package/dist/components/data-entry/date-range-picker.js +0 -349
  132. package/dist/components/data-entry/month-picker.d.ts +0 -10
  133. package/dist/components/data-entry/month-picker.js +0 -241
  134. package/dist/components/data-entry/month-range-picker.d.ts +0 -10
  135. package/dist/components/data-entry/month-range-picker.js +0 -301
  136. package/dist/components/ui/date-range-picker.d.ts +0 -1
  137. package/dist/components/ui/date-range-picker.js +0 -2
  138. package/docs/data-display/tree-list.tsx +0 -107
  139. package/docs/data-entry/date-range-picker.tsx +0 -175
  140. package/docs/data-entry/month-picker.tsx +0 -101
  141. package/docs/data-entry/month-range-picker.tsx +0 -115
@@ -0,0 +1,155 @@
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 react-aria-components' `RadioGroup`
131
+ (Radix's, when this was audited) — the correct APG choice either way, and the comment explaining why
132
+ it is not a `ToggleGroup` should be preserved verbatim.
133
+ Present: `options` (`value`/`label`/`icon`/`disabled`), `value`/`defaultValue`/`onValueChange`,
134
+ `block`, `vertical`, `size`, `disabled`, `name`.
135
+
136
+ | Gap | Priority | Verdict |
137
+ | ------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
138
+ | `shape: 'default' \| 'round'` | P2 | Add as `shape` — the existing `ShapeProp` vocabulary already has `pill`; reuse it rather than antd's `round`. |
139
+ | Option as a bare `string \| number` | P2 | Add. Ant accepts it; it removes ceremony for the common case. |
140
+ | Per-option `title` (a tooltip / hover hint) | P2 | `COVERED-ELSEWHERE` — wrap the option in `Tooltip`. Do not add a second tooltip API. |
141
+ | `size` lacks `xs` | P2 | Add. |
142
+
143
+ **None of these three is the source of the "doesn't look like Ant Design" impression** — that is
144
+ `TreeList`, the missing count badge, and the missing `List`/`Masonry`/`Tree`.
145
+
146
+ ## 4. How to run an audit (per component group)
147
+
148
+ 1. Read the group's catalog entries in `mcp/src/data/components.ts` and the prop types in
149
+ `src/props/components/<group>.prop.ts`.
150
+ 2. Fetch the matching Ant Design docs page for each. Where a component's _identity_ is unclear,
151
+ settle it at <https://namethatui.com/?platform=web> before writing anything.
152
+ 3. Produce the §2 ledger per component. Cite file:line.
153
+ 4. Publish a GATE-0 C1–C7 ledger for anything proposed as a **new** component.
154
+ 5. Do **not** write source in an audit pass. An audit is read-only; fixes are a separate wave with
155
+ their own spec, so the diff stays reviewable and two agents never edit one file at once.
@@ -0,0 +1,172 @@
1
+ # Badge / Tag / Chip / Pill / Count — audit + normalized spec
2
+
3
+ > **Canonical taxonomy:** <https://namethatui.com/web/badge-chip-pill?part=badge-count>
4
+ > **Capability reference:** Ant Design `Badge` + `Tag` (never their prop spellings where they
5
+ > conflict with `docs/PROPS-VOCABULARY.md`).
6
+ > **Contract:** `.claude/skills/godxjp-ui-component/SKILL.md` is the hard gate.
7
+
8
+ ## 1. The canonical taxonomy — five different things, routinely confused
9
+
10
+ | Term | Canonical definition | Interactive? |
11
+ | --- | --- | --- |
12
+ | **Badge** | A tiny count or status marker **attached to another object**. Parts: the *badge anchor* (the icon/avatar it attaches to) and the *badge count* (the number in the bubble). | No |
13
+ | **Tag** | Non-interactive **category metadata** on a card or row. | No |
14
+ | **Pill** | A **shape**, not a component — a capsule-shaped status label. | No |
15
+ | **Chip** | A compact **interactive token** that can be selected, edited or removed. Parts: a *remove button* (a real `<button>` with an `aria-label`) and a *selected state* (`aria-pressed`). | Yes |
16
+ | **Label** | The text naming a form field (`<label for>`). | No |
17
+
18
+ ## 2. What the library actually has, mapped onto that taxonomy
19
+
20
+ | Repo component | What it really is | Verdict |
21
+ | --- | --- | --- |
22
+ | `Badge` (`src/components/data-display/badge.tsx`) | A **Tag / Pill** — a standalone non-interactive chip with `variant` (structure), `tone` (meaning), `color` (data), `shape`, `status`→tone+icon+i18n. Nothing is attached to an anchor and there is no count. | **Misnamed, but keep the name** — see §5. Capability-wise it is *richer* than Ant's `Tag` (the `color` wash carries a real WCAG argument: 8.52:1 worst case across the sRGB cube). |
23
+ | `Toggle` / `ToggleGroupItem` | The **selectable Chip** — `pressed`/`onPressedChange` (= `aria-pressed`) plus the `count`/`overflowCount`/`showZero`/`countLabel` counter-pill vocabulary. Its own catalog entry already says a faceted filter chip ("Open 42") and a reaction chip are this, and explicitly forbids nesting a `Badge` inside it. | **Already correct.** Do **not** build a second selectable chip. |
24
+ | `TagInput` | The **chip field** — Ant-aligned (`tagRender`, `status`, `readOnly`, overflow, Backspace-removes-last). Its removable chips are **private markup** (`.ui-tag-input-chip` + a `<button aria-label>`). | Chip rendering is trapped inside it — see §4.2. |
25
+ | `Label` | A real `<label>` on `react-aria-components`. | **Correct.** Not part of this family. |
26
+ | `Button` | Also carries `count`/`overflowCount`/`showZero`/`countLabel`. | Source of the count vocabulary to reuse. |
27
+
28
+ ## 3. The gap — what Ant Design has and this library does not
29
+
30
+ Verified: `count` / `overflowCount` appear **only** in `Button`, `Toggle`, `ToggleGroup` and their
31
+ props. `Badge` has no `count` at all, and nothing anywhere renders a bubble attached to a child.
32
+
33
+ | Ant Design | Missing here | Consequence today |
34
+ | --- | --- | --- |
35
+ | antd `Badge` with `count` wrapping an `Avatar` — the count bubble on an anchor | **Entirely** | No way to put an unread count on an avatar, a nav icon, a Topbar bell or a tab. `Sidebar`/`NavList` take a `badge` prop, but that renders the Tag-style pill *inline*, not an attached marker. |
36
+ | antd `Badge` with `dot` — the bare dot marker | **Entirely** | No "there is something new" affordance. |
37
+ | `overflowCount` → `99+` on a marker | **Entirely** | (The cap exists on `Button`/`Toggle`; it never reaches a marker.) |
38
+ | `<Tag closable onClose>` — the removable chip | **Not public** | Only exists privately inside `TagInput`; a filter-summary row or a recipient list has to hand-roll a ✕ button, which is how `aria-label`-less removers get shipped. |
39
+ | `<Badge.Ribbon>` | Entirely | Composition — see §4.4. |
40
+ | `<CheckableTag>` | — | **Already covered by `Toggle`.** No action. |
41
+
42
+ ## 4. The fix — one new component, one extension, two documentation fixes
43
+
44
+ This deliberately adds the **minimum**. Three of the five gaps close by extending what exists;
45
+ building a `Chip` component would duplicate `Toggle` and is an instant reject.
46
+
47
+ ### 4.1 NEW — `CountBadge` (group: `data-display`)
48
+
49
+ The attached count/status marker. Ant's `Badge`; NameThatUI's *badge* proper.
50
+
51
+ **GATE 0 ledger**
52
+
53
+ | # | Criterion | Verdict | Why |
54
+ | --- | --- | --- | --- |
55
+ | C1 | Universal | **PASS** | Unread counts on avatars, nav icons, bells, tabs, inbox rows — every app. |
56
+ | C2 | Reusable behavior | **PASS** | Overflow capping, zero suppression, dot mode, anchor-relative placement that survives RTL, and folding the count into the anchor's accessible name / announcing changes politely. |
57
+ | C3 | Not composable | **PASS** | Requires an absolutely-positioned marker measured against an arbitrary child plus a live-region contract. A `Badge` in a `<div className="relative">` is exactly the hand-rolled version this replaces. |
58
+ | C4 | Single responsibility + vocabulary | **PASS** | One job; reuses the count vocabulary already defined by `Button`. |
59
+ | C5 | Token-themeable | **PASS** | Size, offset, surface, ring are `--count-badge-*` tokens. |
60
+ | C6 | Earns the i18n/a11y contract | **PASS** | `Intl.NumberFormat` for the number *and* the cap (vi renders `1.000+`), and the count must be announced, not merely drawn. |
61
+ | C7 | Earns bundle cost | **PASS** | Used by nav chrome in every consumer. |
62
+
63
+ **ALL PASS → framework component.**
64
+
65
+ **API — reuse the EXISTING count vocabulary verbatim.** `Button` and `Toggle` already define
66
+ `count` / `overflowCount` / `showZero` / `countLabel`. Do not invent a second spelling; a third
67
+ dialect of the same idea is the defect this repo keeps fixing.
68
+
69
+ | Ant Design | **godx `CountBadge`** |
70
+ | --- | --- |
71
+ | `count` | `count: number` |
72
+ | `overflowCount` | `overflowCount: number` (default `99`) |
73
+ | `showZero` | `showZero: boolean` (default `false`) |
74
+ | `dot` | `dot: boolean` — a marker with no number |
75
+ | `children` | `children` — the **anchor**; omit it for a standalone inline marker |
76
+ | `status` + `text` | *dropped* — that is `Badge status=…`, which already exists |
77
+ | `color` | `tone` (semantic) — the free-form data colour stays `Badge`'s job |
78
+ | `offset` | *dropped* — placement is `placement` + tokens, never a caller-supplied pixel pair |
79
+ | `size: 'default' \| 'small'` | `size: 'xs' \| 'sm' \| 'md' \| 'lg'` (never `"default"`) |
80
+ | `title` | `countLabel` — same name `Button` uses |
81
+ | — | `placement: 'start' \| 'end'` (logical; flips under RTL) |
82
+
83
+ **Required semantics**
84
+ - The number and the cap both go through `Intl.NumberFormat` on the active locale — never
85
+ `String(n)`, never a hand-rolled thousands separator. Above the cap render `{overflowCount}+`.
86
+ - `count={0}` renders nothing unless `showZero`.
87
+ - The marker is **not** an accessible name of its own floating next to the anchor: fold it into the
88
+ anchor's name via a visually-hidden text node (`t()`-driven, e.g. "Notifications, 5 unread"), or
89
+ expose `countLabel`. A bare "5" read out of context is a bug.
90
+ - A changing count updates a single `aria-live="polite"` region — not one per marker.
91
+ - `dot` mode still needs a text alternative; **never colour-or-shape-only** (WCAG 1.4.1).
92
+ - Placement uses logical offsets (`inset-inline-end`), so it flips under `dir="rtl"`.
93
+ - The marker must not clip: it overflows the anchor box deliberately, and the anchor keeps its own
94
+ hit area ≥24×24px (WCAG 2.5.8).
95
+
96
+ **Tokens** — `src/tokens/components/count-badge.css`, `@import`ed from `src/tokens/base.css`,
97
+ names passing `check:token-tiers`: `--count-badge-size`, `--count-badge-dot-size`,
98
+ `--count-badge-inset-block`, `--count-badge-inset-inline`, `--count-badge-background`,
99
+ `--count-badge-foreground`, `--count-badge-ring-color`, `--count-badge-ring-width`,
100
+ `--count-badge-font-size`. No literal heights.
101
+
102
+ **i18n** — `countBadge.unreadCount` (a CLDR `{one, other}` plural selected by `Intl.PluralRules`,
103
+ in en/vi/ja), `countBadge.new` for `dot`.
104
+
105
+ ### 4.2 EXTEND — `Badge` gains `onRemove` (this *is* the removable Chip)
106
+
107
+ Rather than a new `Chip` component that would collide with `Toggle`:
108
+
109
+ - Add `onRemove?: () => void` and `removeLabel?: string` to `Badge`. When `onRemove` is present the
110
+ badge renders a trailing `<button type="button">` with a `t()`-driven `aria-label` naming the
111
+ item it removes ("Remove {tag}"), a ≥24×24px target, and `Backspace`/`Delete` support when the
112
+ badge itself is focused. `Badge` renders a `<div>`/`<span>`, so this is **not** a button-in-button.
113
+ - Then **fix it upstream, not at the call site**: refactor `TagInput` to render its chips as
114
+ `Badge onRemove=…` instead of the private `.ui-tag-input-chip` markup, so there is exactly one
115
+ removable-chip implementation and one remover `aria-label` in the system. `TagInput`'s public API
116
+ and its existing tests must not change — prove it by running them.
117
+ - Selection is **not** added to `Badge`. A selectable chip is `Toggle` (`pressed` + `count`), and
118
+ the catalog must keep saying so.
119
+
120
+ ### 4.3 DOCUMENT — the routing rules, so consumers stop guessing
121
+
122
+ The real reason this family "doesn't look like Ant Design" is that the map is unwritten. Add to
123
+ `mcp/src/data/components.ts`, on **both** sides of each pair (a one-sided claim is the mistake
124
+ commit `8365bf05` fixed):
125
+
126
+ - `Badge` tagline: state that in the canonical taxonomy this is the **Tag / Pill** — non-interactive
127
+ category or status metadata — and that a count marker attached to an anchor is `CountBadge`.
128
+ - `Badge.related`: → `CountBadge` (counts on an anchor), `Toggle` (selectable chip),
129
+ `TagInput` (an editable set of chips), `Label` (naming a form field).
130
+ - `CountBadge.related`: → `Badge`, `Toggle`, `Sidebar`/`NavList` `badge` props.
131
+ - New rules: *DON'T hand-roll a `<span>` counter or an absolutely positioned `Badge` to mark an
132
+ anchor — use `CountBadge`.* *DON'T nest a `Badge` inside a `Toggle` for a count — `Toggle` owns
133
+ `count`.* *DON'T build a selectable chip out of `Badge` + `onClick` — use `Toggle`.*
134
+
135
+ ### 4.4 COMPOSITION — not framework components
136
+
137
+ - **Ribbon** (Ant `Badge.Ribbon`): C2 and C3 fail — it is a `Card` plus an absolutely positioned
138
+ `Badge` plus a corner token. Ship it as a `docs/` showcase, never in `src/components/`.
139
+ - **Status dot + text** (Ant `Badge status text`): already `Badge status=…`, which maps the key to
140
+ tone + icon + an i18n label. No new API.
141
+
142
+ ## 5. Explicitly NOT doing: renaming `Badge`
143
+
144
+ `Badge` is used across the entire library and every consumer. Renaming it to `Tag` to satisfy the
145
+ taxonomy would be a breaking change that buys nothing a catalog tagline cannot. **Keep the name;
146
+ document the meaning.** No agent may rename, alias or deprecate `Badge` under this work.
147
+
148
+ ## 6. Definition of done
149
+
150
+ 1. `src/components/data-display/count-badge.tsx`, exported from that group's `index.ts`
151
+ 2. `CountBadgeProp` (+ `as CountBadgeProps`) in `src/props/components/data-display.prop.ts`,
152
+ **registered in `src/props/registry.ts`**; `Badge`'s `onRemove`/`removeLabel` added to its prop type
153
+ 3. `src/tokens/components/count-badge.css` + `@import` in `src/tokens/base.css`
154
+ 4. i18n keys in **all three** of `en.json`, `vi.json`, `ja.json`
155
+ 5. Tests in `src/components/data-display/__tests__/`: `count-badge.test.tsx` (Intl formatting in
156
+ en/vi/ja, cap → `99+`, `showZero`, `dot`, RTL placement, live-region announcement, accessible
157
+ name folding), `badge-remove.test.tsx` (remove button name, keyboard, ≥24px), and
158
+ `count-badge.a11y.test.tsx` at **0 axe violations**
159
+ 6. `mcp/src/data/components.ts`: a `CountBadge` entry, `Badge`'s new props, and the §4.3 routing
160
+ rules on both sides
161
+ 7. A real-screen docs page `docs/data-display/count-badge.tsx`
162
+ 8. `TagInput` refactored onto `Badge onRemove`, with its existing tests still green
163
+
164
+ Gates, then only the touched test files:
165
+
166
+ ```
167
+ pnpm typecheck && pnpm lint && pnpm run audit \
168
+ && pnpm check:prop-vocabulary && pnpm check:mcp-sync && pnpm check:mcp-orphans \
169
+ && pnpm check:token-tiers && pnpm check:control-sizing && pnpm check:example-imports
170
+ ```
171
+
172
+ `pnpm test` and a bare `pnpm vitest run` are **forbidden** — the full suite is CI's job.
@@ -0,0 +1,159 @@
1
+ # `List` (Ant `Listy`) + `Masonry` — normalized spec
2
+
3
+ > **Capability reference:** <https://ant.design/components/listy> and
4
+ > <https://ant.design/components/masonry>. **Canonical definition:**
5
+ > <https://namethatui.com/web/masonry>.
6
+ > **Contract:** `.claude/skills/godxjp-ui-component/SKILL.md`.
7
+
8
+ Measured facts this spec rests on: the library has **no virtualization anywhere**
9
+ (no `react-window` / `@tanstack/react-virtual` / any `virtual` code path in `src/`), and **no
10
+ masonry** (every `grid-template-columns` in `src/styles/` is a fixed uniform grid; `ResponsiveGrid`
11
+ is a uniform-row card grid). Both are genuine holes, not restyling jobs.
12
+
13
+ ---
14
+
15
+ ## 1. `List` — port of Ant Design `Listy` (group: `data-display`)
16
+
17
+ Ant's old `List` is **deprecated** and `Listy` replaces it. Port `Listy`, not `List`: it is the
18
+ narrower, performance-shaped component (virtual scrolling + grouping), which is exactly the part
19
+ that cannot be composed here.
20
+
21
+ ### GATE 0 ledger
22
+
23
+ | # | Criterion | Verdict | Why |
24
+ | --- | --- | --- | --- |
25
+ | C1 | Universal | **PASS** | Long feeds, activity streams, message lists, pickers, log views. |
26
+ | C2 | Reusable behavior | **PASS** | Windowed rendering, measured row heights, sticky group headers, an imperative `scrollTo` that resolves an item key or a group key to an offset. |
27
+ | C3 | Not composable | **PASS** | Nothing in the library virtualizes. `ScrollArea` + `.map()` renders every row. |
28
+ | C4 | Single responsibility + vocabulary | **PASS** | One job; maps onto `items` / `getRowId` / `size`. |
29
+ | C5 | Token-themeable | **PASS** | Row height, group-header surface, divider are `--list-*` tokens. |
30
+ | C6 | Earns the contract | **PASS** | A virtual list is where `role`/`aria-setsize`/`aria-posinset` are *mandatory* — the DOM no longer contains the whole set. |
31
+ | C7 | Earns bundle cost | **PASS** | Every consumer has at least one long list. |
32
+
33
+ **ALL PASS → framework component.**
34
+
35
+ ### API — Ant `Listy` → godx `List`
36
+
37
+ | Ant `Listy` | **godx `List`** | Note |
38
+ | --- | --- | --- |
39
+ | `items` | `items: T[]` | |
40
+ | `itemRender(item, index)` | `itemRender(item, index)` | |
41
+ | `rowKey` | **`getRowId: (item: T) => string`** | The house spelling — `DataTable` already uses `getRowId`. Do not introduce `rowKey` as a second dialect. |
42
+ | `height` | `height?: number` | Scroll container height; content scrolls past it. |
43
+ | `virtual` | `virtual?: boolean` (default `false`) | |
44
+ | `group: { key, title }` | `group?: { key: (item) => K; title: (key, items) => ReactNode }` | |
45
+ | `sticky` | `sticky?: boolean` (default `false`) | Group headers stick. |
46
+ | `onScroll` | `onScroll?: React.UIEventHandler<HTMLElement>` | |
47
+ | `classNames` / `styles` | `classNames?: { root?; item?; groupHeader? }` | Keep the semantic-slot shape; skip the `styles` twin (inline style is not how this system themes). |
48
+ | ref `scrollTo(config)` | ref `scrollTo(config)` | Accepts a pixel offset, `{ top }`, `{ key, align?, offset? }`, or `{ groupKey, align?, offset? }`. |
49
+ | — | `size: 'xs' \| 'sm' \| 'md' \| 'lg'` | House requirement. |
50
+ | — | `loading?: boolean`, `empty?: ReactNode` | Compose the real `Skeleton` / `EmptyState`; do not hand-roll either. |
51
+
52
+ **Deliberately NOT ported** (and say so in the catalog entry, so nobody re-adds them): `bordered`,
53
+ `split`, `header`, `footer`, `size: 'large'`, `pagination`, `loadMore`, `itemLayout`. `Listy`
54
+ dropped them, and here they are already covered — the frame is `Card` + `CardContent flush`,
55
+ dividers are `Separator`, paging is `Pagination`. Re-adding them would rebuild a second `Card`.
56
+
57
+ ### Required semantics
58
+ - `role="list"` with `role="listitem"` rows; when `virtual`, every row **must** carry `aria-setsize`
59
+ (the full count) and `aria-posinset` — otherwise a screen reader reports the window, not the list.
60
+ This is the single most-skipped part of a virtual list and it is not optional.
61
+ - Grouping renders `role="group"` with the header as its `aria-label`/`aria-labelledby`.
62
+ - Keyboard: the scroll container is focusable; `PageUp`/`PageDown`/`Home`/`End` work. Rows are not
63
+ a roving-tabindex widget — interactive controls inside a row keep normal tab order.
64
+ - `sticky` headers use `position: sticky` with logical insets and must not cover the focused row
65
+ (`scroll-margin-block-start`).
66
+ - Row heights are measured, not assumed; a row whose content grows must not desynchronise the
67
+ window. Reserve image dimensions.
68
+ - `prefers-reduced-motion: reduce` disables any smooth-scroll in `scrollTo`.
69
+
70
+ ### Tokens
71
+ `src/tokens/components/list.css` (`@import` from `src/tokens/base.css`): `--list-row-min-height`
72
+ (from the `--control-height` tier), `--list-divider-color`,
73
+ `--list-group-header-background`, `--list-group-header-foreground`, `--list-group-header-height`.
74
+
75
+ ### Spacing — the list does NOT own its inline inset
76
+
77
+ Read `docs/SPACING.md` before writing a single spacing declaration. A row inside a
78
+ `Card` + `CardContent flush` takes its inline inset from the public class **`ui-card-inset-x`**
79
+ (which reads `--card-space-inset`), so the row lines up with the card shell and follows the card's
80
+ `density`. **Do not invent a `--list-row-padding-inline`** — a parallel spacing knob drifts away
81
+ from the Card that contains it, and the block axis is owned by `--list-row-min-height`.
82
+
83
+ Macro rhythm is never the component's: no Tailwind `p-*` / `m-*` / `gap-*` (the audit rejects them
84
+ as `no-utility-spacing`), no hand-rolled `flex`/`grid` (`no-utility-layout`). Vertical rhythm comes
85
+ from `Flex gap` on the φ scale (`xs`/`sm` = 4px grid, `md` = φ⁰, `lg` = φ¹, `xl` = φ²) — this repo
86
+ does **not** use the 8pt grid.
87
+
88
+ ### i18n
89
+ `list.empty`, `list.loading`, `list.group` (group-header accessible name), and any count through
90
+ `Intl.NumberFormat` + `Intl.PluralRules`.
91
+
92
+ ---
93
+
94
+ ## 2. `Masonry` (group: `layout`)
95
+
96
+ **Canonical definition** (NameThatUI): *a layout where each new item joins the shortest column,
97
+ creating a staggered bottom edge with no row lines and cards keeping their individual heights.*
98
+ The named part is the **packed column** — each column flows straight down, nothing lines up
99
+ sideways. Aliases: Pinterest grid, waterfall, brick layout.
100
+
101
+ ### GATE 0 ledger
102
+
103
+ | # | Criterion | Verdict | Why |
104
+ | --- | --- | --- | --- |
105
+ | C1 | Universal | **PASS** | Media galleries, card boards, dashboards with variable-height cards. |
106
+ | C2 | Reusable behavior | **PASS** | Shortest-column packing, re-packing on resize/content change (`ResizeObserver`), and keeping DOM reading order row-major while the visual flow is column-major. Native `grid-template-rows: masonry` covers the paint but not the ordering or the fallback. |
107
+ | C3 | Not composable | **PASS** | `ResponsiveGrid` is a uniform grid; nothing packs by column height. |
108
+ | C4 | Single responsibility + vocabulary | **PASS** | One job; `columns`/`gap` reuse `ResponsiveGrid`'s exact spellings. |
109
+ | C5 | Token-themeable | **PASS** | Gaps come from the spacing scale. |
110
+ | C6 | Earns the contract | **PASS** | Reading order vs visual order is an accessibility decision, not a style one. |
111
+ | C7 | Earns bundle cost | **PASS** | Small; broadly useful. |
112
+
113
+ **ALL PASS → framework component.**
114
+
115
+ ### API — Ant `Masonry` → godx `Masonry`
116
+
117
+ | Ant Design | **godx `Masonry`** | Note |
118
+ | --- | --- | --- |
119
+ | `columns: number \| { xs, sm, md }` | `columns: number \| { base?, sm?, md?, lg? }` (default `3`) | **Use `ResponsiveGrid`'s existing breakpoint shape** (`base/sm/md/lg`), not antd's `xs/…/xxl`. One breakpoint dialect in this library. |
120
+ | `gutter: Gap \| [Gap, Gap]` | `gap: 'none' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` (default `'md'`) | Token scale, exactly as `ResponsiveGrid`. A caller-supplied pixel pair is not how this system spaces. |
121
+ | `items: MasonryItem[]` | `items: MasonryItemProp[]` — `{ key, children?, data?, column? }` | Drop antd's `height`: heights are measured, never declared. |
122
+ | `itemRender(item)` | `itemRender(item, index)` | `item.children` still wins. |
123
+ | `fresh` | `observeItems?: boolean` (default `true`) | Keep watching child sizes via `ResizeObserver`; the antd name says nothing. |
124
+ | `onLayoutChange` | `onLayoutChange?: (placements: { key: Key; column: number }[]) => void` | |
125
+ | `classNames` / `styles` | `classNames?: { root?; item? }` | Skip the `styles` twin. |
126
+ | — | `sequential?: boolean` | Fill columns left-to-right in order instead of shortest-first, for a strict reading order. |
127
+
128
+ ### Required semantics
129
+ - **Reading order is DOM order.** Whatever the visual packing, the DOM stays in `items` order so
130
+ keyboard and screen-reader traversal match the source sequence. This is the reason the CSS
131
+ `columns` fallback alone is not acceptable — it flows column-major.
132
+ - Prefer native `@supports (grid-template-rows: masonry)`; fall back to measured absolute/transform
133
+ packing. Never ship the bare `columns:` fallback as the only path.
134
+ - The container is a plain grouping element with no invented role. If the content is a list, the
135
+ **caller** supplies the semantics; `Masonry` must not silently impose `role="list"`.
136
+ - Re-pack on container resize and on item resize (`ResizeObserver`), debounced to a frame.
137
+ - Reserve media dimensions (`AspectRatio`) so image loads do not cause layout shift — call this out
138
+ in the docs page.
139
+ - Logical CSS only; column order flips under `dir="rtl"`.
140
+
141
+ ### Tokens
142
+ `src/tokens/components/masonry.css`: `--masonry-gap-inline`, `--masonry-gap-block`,
143
+ `--masonry-column-min-inline-size`.
144
+
145
+ ---
146
+
147
+ ## 3. Definition of done (both)
148
+
149
+ Per component: source + group `index.ts` export · `XProp` (+ `as XProps`) in the group's
150
+ `*.prop.ts` **and `src/props/registry.ts`** · tokens file + `@import` in `src/tokens/base.css` ·
151
+ i18n keys in **en/vi/ja** · `@testing-library/user-event` behaviour tests + a `*.a11y.test.tsx` at
152
+ **0 axe violations** · an `mcp/src/data/components.ts` entry (including the "deliberately not
153
+ ported" list for `List`) · a real-screen docs page.
154
+
155
+ For `List`, the virtual-mode test must assert `aria-setsize`/`aria-posinset` reflect the **full**
156
+ item count while only a window is in the DOM. For `Masonry`, a test must assert DOM order equals
157
+ `items` order under every `columns` value.
158
+
159
+ Gates, then only the touched test files. `pnpm test` and a bare `pnpm vitest run` are **forbidden**.