@godxjp/ui 0.2.0 → 2.2.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.
package/BRAND.md ADDED
@@ -0,0 +1,286 @@
1
+ # GoDX brand bible
2
+
3
+ **Locked 2026-05-13.** Source: Claude Design handoff bundle —
4
+ `design/source-2026-05-13/` (also kept verbatim as
5
+ `design/godx-admin-2026-05-13.tar.gz`).
6
+
7
+ ## Drop-in / no customization
8
+
9
+ `@godxjp/ui` is **turnkey**. A new service does ONE thing to be brand-compliant:
10
+
11
+ ```tsx
12
+ // services/<svc>/frontend/src/main.tsx
13
+ import "@godxjp/ui/tokens"; // <-- this is the entire brand contract
14
+ import "./app.tsx";
15
+ ```
16
+
17
+ That single import wires:
18
+ - type scale, color palette, OKLCH dark mode, four tenants
19
+ (godx / kintai / tempo / betoya), density modes, spacing grid,
20
+ shadows, motion
21
+ - all application-shell CSS classes (`.app-root`, `.sb-*`, `.tb-*`,
22
+ `.btn`, `.badge`, `.card`, `.kanban`, `.diff`, `.prose`,
23
+ `.auth-shell`, …)
24
+
25
+ For React: also pull pre-built primitives + screens:
26
+
27
+ ```tsx
28
+ import { AppShell, Sidebar, Topbar, TweaksPanel } from "@godxjp/ui/components/shell";
29
+ import { DashboardScreen, PlansScreen, IssuesScreen, WikiScreen } from "@godxjp/ui/components/screens";
30
+ import { useTweaks } from "@godxjp/ui/hooks";
31
+ import { initI18n } from "@godxjp/ui/i18n";
32
+ ```
33
+
34
+ **There is no theming step.** No per-service "wire up tokens" boilerplate. If a screen needs more than this provides, the answer is to add the primitive to `@godxjp/ui`, not fork.
35
+
36
+ ## Optional service-local overlay
37
+
38
+ If — and only if — a service has a **brand-approved** deviation (e.g.
39
+ a new tenant variant, a service-specific accent), the service ships
40
+ a single overlay file:
41
+
42
+ ```css
43
+ /* services/<svc>/frontend/src/theme.css */
44
+ [data-tenant="my-svc"] {
45
+ --primary: oklch(56% 0.15 200); /* still chroma ≤ 0.18 */
46
+ --ring: oklch(56% 0.15 200);
47
+ }
48
+ ```
49
+
50
+ Imported AFTER the base tokens:
51
+
52
+ ```tsx
53
+ import "@godxjp/ui/tokens";
54
+ import "./theme.css"; // overlay
55
+ ```
56
+
57
+ The overlay can **only** redeclare brand-token CSS variables under a
58
+ `[data-tenant]` or `[data-theme]` attribute selector. Editing
59
+ foundational variables on `:root`, redefining the type scale, or
60
+ overriding shell classes is forbidden and a review-block.
61
+
62
+ > ⚠️ **Never lose the brand.** Every frontend in the GoDX ecosystem
63
+ > (admin / forge / console / me / work / knowledge / agent / media /
64
+ > chat / reporting / schema-studio / marketing) must:
65
+ >
66
+ > 1. import `@godxjp/ui/tokens` as the FIRST stylesheet
67
+ > 2. consume the variables below as-is — never redefine `--primary`,
68
+ > `--foreground`, `--background`, spacing, type, density tokens
69
+ > 3. live by the design philosophy (next section)
70
+ >
71
+ > A PR that hard-codes a color, custom font scale, or off-grid spacing
72
+ > gets rejected at review.
73
+
74
+ ## Design philosophy (immutable)
75
+
76
+ Three principles from the dxs-kintai brand foundation (Japanese
77
+ enterprise aesthetics):
78
+
79
+ | Term | Meaning | What it enforces |
80
+ |---|---|---|
81
+ | **渋み** (shibumi) | restrained elegance | Primary chroma ≤ 0.18 in OKLCH. No neon. No gradients on functional UI. |
82
+ | **間** (ma) | vertical breathing room | Body `line-height: 1.7`. Generous spacing. Density toggle for compact data tables. |
83
+ | **簡素** (kanso) | simplicity | Three font weights total: **400** (body), **500** (heading + emphasis default), **700** (loud emphasis only). No 600 in new code (kept as legacy alias). |
84
+
85
+ These are NOT taste choices — they're brand contracts. Any visual
86
+ direction that breaks them needs operator sign-off in advance.
87
+
88
+ ## Token surface (read from `src/tokens/tokens.css`)
89
+
90
+ One file. Variables + application-shell classes mastered together so
91
+ consumers do `import "@godxjp/ui/tokens"` once and get everything. The
92
+ design handoff bundle split them into `tokens.css` + `tokens-ext.css`
93
+ for portability to Figma / theme tools — that split is preserved
94
+ verbatim under `design/source-2026-05-13/` as an audit trail; the
95
+ consumable artefact in `src/tokens/` is intentionally merged.
96
+
97
+ ### Type
98
+
99
+ ```
100
+ --font-sans-jp "M PLUS 2" + JP fallback chain + system-ui
101
+ --font-weight-normal 400 (body)
102
+ --font-weight-medium 500 (headings, buttons, labels)
103
+ --font-weight-bold 700 (loud emphasis only)
104
+
105
+ --text-2xs 11px fine print
106
+ --text-xs 12px caption / label
107
+ --text-sm 13px dense table rows
108
+ --text-base 14px DEFAULT body (JP density override)
109
+ --text-md 16px content-heavy body
110
+ --text-lg 18px subheading
111
+ --text-xl 20px h3 / page title
112
+ --text-2xl 24px h2
113
+ --text-3xl 30px
114
+ --text-4xl 32px h1 cap
115
+
116
+ --leading-tight 1.25 headings
117
+ --leading-normal 1.5 dense / single-line UI
118
+ --leading-body 1.7 JP body default (ma principle)
119
+ ```
120
+
121
+ Semantic heading sizes are deliberately small — info-dense JP
122
+ enterprise vibe: `--heading-h1 = 20px`, `--heading-h2 = 18px`,
123
+ `--heading-h3 = 14px`, `--heading-h4 = 13px`.
124
+
125
+ ### Color — OKLCH only
126
+
127
+ Primary palette mastered in OKLCH so dark mode + tenant overrides are
128
+ mechanical. Never override `--primary` / `--foreground` /
129
+ `--background` / `--card` / `--muted` in app code; switch via
130
+ `[data-tenant]` or `[data-theme="dark"]` attributes.
131
+
132
+ ```
133
+ --background warm off-white oklch(99% 0.002 60)
134
+ --foreground warm off-black oklch(20% 0.006 60) (SmartHR #23221e)
135
+ --primary SmartHR blue oklch(56% 0.15 240) (#0077c7)
136
+ --destructive 茜 madder oklch(52% 0.18 25) (#b7282e, chroma capped)
137
+ --success 若竹 bamboo oklch(72% 0.13 155) (#68be8d)
138
+ --warning 山吹 mountain oklch(80% 0.17 85) (#f8b500)
139
+ --info 群青 ultramarine oklch(55% 0.12 265) (#4c6cb3)
140
+ --attention 朱 vermilion oklch(66% 0.19 45) (#eb6101)
141
+ ```
142
+
143
+ **和色 (wa-iro) decorative palette** is for charts, accent tags,
144
+ illustrations — **never** for role-mapped UI (don't use `--wa-akane`
145
+ as a button color; use `--destructive`). The palette:
146
+
147
+ `--wa-ai` `--wa-gunjo` `--wa-ruri` `--wa-kon` `--wa-wakatake`
148
+ `--wa-moegi` `--wa-yamabuki` `--wa-shu` `--wa-akane` `--wa-enji`
149
+ `--wa-sakura` `--wa-sumi` `--wa-nezu`.
150
+
151
+ ### Tenant overrides
152
+
153
+ Brand palette swaps via `[data-tenant="<slug>"]` at `<html>` or any
154
+ ancestor. Defined slugs:
155
+
156
+ - `godx` (default) — Famgia emerald accent + SmartHR blue primary
157
+ - `kintai` — SmartHR blue primary
158
+ - `tempo` — deeper indigo
159
+ - `betoya` — Vietnamese green (Betoya restaurant brand)
160
+
161
+ ### Dark mode
162
+
163
+ `[data-theme="dark"]` flips every surface + tenant. Already wired in
164
+ `tokens-ext.css`.
165
+
166
+ ### Density
167
+
168
+ `[data-density="compact|default|comfortable"]` rescales every UI
169
+ element (button height, padding, row height). Default fits SmartHR /
170
+ freee density (32px element). Compact for kintone-style dense tables
171
+ (28px). Comfortable for public surfaces (44px — WCAG touch target).
172
+
173
+ ### Spacing — 4px grid
174
+
175
+ ```
176
+ --spacing-0 0 --spacing-1 4px --spacing-2 8px
177
+ --spacing-3 12px --spacing-4 16px --spacing-5 20px
178
+ --spacing-6 24px --spacing-8 32px --spacing-10 40px
179
+ --spacing-12 48px --spacing-16 64px --spacing-20 80px --spacing-24 96px
180
+ ```
181
+
182
+ Never invent off-grid values (`13px`, `7px`, etc).
183
+
184
+ ### Layout invariants
185
+
186
+ ```
187
+ --header-height 48px
188
+ --sidebar-width 256px
189
+ --sidebar-collapsed-width 64px
190
+ --container-max-width 1280px
191
+ --touch-target-min 44px (Digital Agency hard rule, never go below)
192
+ ```
193
+
194
+ ### Radius / motion
195
+
196
+ ```
197
+ --radius 6px (base)
198
+ --radius-md 4px, --radius-lg 6px, --radius-xl 10px, --radius-full ∞
199
+
200
+ --transition-fast 150ms
201
+ --transition-base 200ms
202
+ --transition-slow 300ms
203
+ --ease-in-out cubic-bezier(0.4, 0, 0.2, 1)
204
+ ```
205
+
206
+ `@media (prefers-reduced-motion: reduce)` honours user preference; the
207
+ `.pulse` keyframe self-disables.
208
+
209
+ ## Component primitives (read from `src/tokens/tokens-ext.css`)
210
+
211
+ Application-shell primitives are mastered as CSS classes (not React
212
+ components — those layer on top per portal). Each frontend imports the
213
+ tokens and gets these for free:
214
+
215
+ | Class | Use |
216
+ |---|---|
217
+ | `.app-root / .app-sidebar / .app-topbar / .app-main` | three-pane app shell with collapse animation |
218
+ | `.sb-product / .sb-section / .sb-nav-item` | sidebar primary nav |
219
+ | `.tb-breadcrumb / .tb-chip / .tb-search / .tb-icon-btn` | topbar |
220
+ | `.sw-pop` family | command-palette / switcher dropdown |
221
+ | `.page / .page-header / .page-title / .page-actions` | page chrome |
222
+ | `.card / .card-header / .card-title` | card surface |
223
+ | `.btn / .btn-primary / .btn-secondary / .btn-ghost / .btn-danger / .btn-sm / .btn-lg` | buttons |
224
+ | `.input / .label / .help` | form primitives |
225
+ | `.badge / .badge-success / -warning / -info / -error / -attention / -neutral / -outline` | status badges |
226
+ | `.chip` | tag |
227
+ | `.table / .num / .mono` | tabular data |
228
+ | `.tabs / .tab` | tab strip |
229
+ | `.kpi / .kpi-label / .kpi-value / .kpi-delta` | dashboard metric |
230
+ | `.log-line` | terminal-style activity feed |
231
+ | `.diff / .diff-row.add / .diff-row.del / .diff-row.ctx` | code diff |
232
+ | `.kanban / .kanban-col / .issue-card` | kanban board |
233
+ | `.wiki-layout / .wiki-toc / .prose` | wiki / doc render |
234
+ | `.auth-shell / .auth-card / .auth-art` | login screen |
235
+ | `.avatar / .kbd / .dot / .pulse` | utilities |
236
+
237
+ Use them directly when building plain HTML. When using React, wrap
238
+ each in a small primitive component in your portal's `components/`
239
+ directory; do NOT re-create the class names — import the existing CSS.
240
+
241
+ ## Reference HTML prototypes
242
+
243
+ The bundle ships pixel-canonical HTML prototypes in
244
+ `design/source-2026-05-13/project/`:
245
+
246
+ | File | What it shows |
247
+ |---|---|
248
+ | `godx-unified.html` | full admin shell (sidebar + topbar + page) |
249
+ | `signin.html` | sign-in flow (email → password → 2FA → done) |
250
+ | `device.html` | device-code authorize flow |
251
+ | `login.html` | 15-artboard canvas reviewing every login state |
252
+ | `design-canvas.jsx` | React canvas showcasing every primitive |
253
+ | `shell.jsx`, `ui-kit.jsx`, `tweaks-panel.jsx` | JSX primitives mirroring the CSS classes |
254
+ | `screens-*.jsx` | per-screen reference layouts (product / project / detail) |
255
+
256
+ When implementing a new screen, **open the closest reference** first
257
+ and match its visual rhythm. Don't redesign solo without a precedent.
258
+
259
+ ## Forbidden patterns
260
+
261
+ - ❌ Hard-coded hex colors in component code (use `var(--primary)` etc).
262
+ - ❌ Custom font sizes outside the `--text-*` scale.
263
+ - ❌ Spacing values off the 4px grid (`5px`, `7px`, `13px`…).
264
+ - ❌ Font weight 300 / 600 / 800 / 900 in new code (only 400 / 500 / 700).
265
+ - ❌ Tailwind utility classes that re-encode tokens (e.g. `text-blue-500`
266
+ instead of `text-[var(--primary)]`).
267
+ - ❌ A new shadow / radius / motion curve "just for this card".
268
+ - ❌ Logos, marketing copy, or product-specific imagery in the
269
+ `@godxjp/ui` package — those live in the consumer portal.
270
+
271
+ ## Updating the brand
272
+
273
+ When the operator approves a brand change:
274
+
275
+ 1. Update `src/tokens/tokens.css` and/or `tokens-ext.css` here in
276
+ `packages/godxjp-ui`.
277
+ 2. Bump the package version.
278
+ 3. Bump the submodule pointer in `godx-admin` umbrella.
279
+ 4. Each portal pulls the new submodule SHA in a follow-up PR.
280
+ 5. **Refresh `BRAND.md` if the change moves a foundational rule.**
281
+
282
+ Document the change in `design/CHANGELOG.md` (create on first change).
283
+
284
+ The current locked snapshot is preserved at
285
+ `design/source-2026-05-13/` + the original archive at
286
+ `design/godx-admin-2026-05-13.tar.gz`.
package/CHANGELOG.md ADDED
@@ -0,0 +1,94 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@godxjp/ui`. Follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
4
+ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
+
6
+ ## [2.1.0] — 2026-05-13
7
+
8
+ ### Added
9
+ - **Popover** primitive (`Popover`, `PopoverTrigger`, `PopoverContent`,
10
+ `PopoverAnchor`) wrapping `@radix-ui/react-popover`. Visual contract
11
+ in the new `.popover-content` class in `tokens.css` — brand-tokenised
12
+ surface (`--popover`), border, and elevation.
13
+ - **DropdownMenu** primitive (`DropdownMenu`, `DropdownMenuTrigger`,
14
+ `DropdownMenuContent`, `DropdownMenuItem`, `DropdownMenuSeparator`,
15
+ `DropdownMenuLabel`, `DropdownMenuShortcut`, `DropdownMenuGroup`,
16
+ `DropdownMenuPortal`, `DropdownMenuSub`, `DropdownMenuRadioGroup`)
17
+ wrapping `@radix-ui/react-dropdown-menu`. `<DropdownMenuItem>`
18
+ supports `variant="destructive"` + `inset` matching the public v0.2
19
+ surface so call sites migrate by dep bump only.
20
+ - **Calendar** primitive — `react-day-picker` themed via the new
21
+ `.calendar` class in `tokens.css` (primary / surface / ring tokens).
22
+ - **TimeInput** primitive — narrow `HH:mm` text input with on-blur
23
+ normalisation (accepts `HHmm`, `H:mm`, etc.). Surfaces
24
+ `aria-invalid` when the draft doesn't parse.
25
+ - New CSS classes in `tokens.css`: `.popover-content`,
26
+ `.dropdown-menu-content`, `.dropdown-menu-item`,
27
+ `.dropdown-menu-separator`, `.dropdown-menu-label`,
28
+ `.dropdown-menu-shortcut`, `.calendar`, `.time-input`.
29
+ - `react-day-picker` added as a dependency.
30
+
31
+ ### Notes
32
+ - This release fills the gap that blocked
33
+ `services/forge-service/frontend/` from migrating off the public
34
+ TempoFast `@godxjp/ui@0.2.0`. After 2.1.0 every primitive forge
35
+ imports (`Badge`, `Button`, `Tabs*`, `Popover*`, `DropdownMenu*`,
36
+ `Calendar`, `TimeInput`) is brand-tokenised by default.
37
+
38
+ ## [2.0.0] — 2026-05-13
39
+
40
+ **Major version bump.** `@godxjp/ui` (the npm package owned by godx-jp / TempoFast) is now the GoDX brand bible. The previous public 0.2.0 — TempoFast's existing component library — stays consumable for legacy callers until TempoFast itself migrates onto 2.0+. SemVer signals the breaking change so dependents pin explicitly.
41
+
42
+ ### Breaking
43
+
44
+ - Package surface re-anchored on the Claude Design handoff 2026-05-13.
45
+ Color tokens use OKLCH (not hex literals), font scale tightened
46
+ (text-2xs..text-4xl), density modes added, four tenants pinned.
47
+ `<Badge>` / `<Button>` etc. now wrap canonical CSS classes from
48
+ `tokens.css` rather than shadcn-default Tailwind utilities.
49
+ - Token files merged: `tokens.css` + `tokens-ext.css` →
50
+ single `tokens.css` (635 lines). Consumers do
51
+ `import "@godxjp/ui/tokens"` once.
52
+ - `src/primitives/` moved to `src/components/primitives/` —
53
+ `@godxjp/ui/primitives` alias preserved in the exports map for
54
+ backwards compatibility, but new code should import from
55
+ `@godxjp/ui` (top-level barrel re-exports everything).
56
+
57
+ ### Added
58
+
59
+ ### Added
60
+ - **BRAND.md** — the brand bible (locked 2026-05-13 from Claude Design
61
+ handoff bundle). Spells out the 渋み / 間 / 簡素 design philosophy
62
+ and lists the forbidden patterns reviewers reject.
63
+ - **`design/source-2026-05-13/`** — full design handoff preserved
64
+ verbatim (README, chat transcripts, every JSX + HTML prototype).
65
+ - **`design/godx-admin-2026-05-13.tar.gz`** — original archive from
66
+ `api.anthropic.com/v1/design/h/7Ya1OxEEfiaI2SWojzuP9A`. Kept so the
67
+ brand can be re-extracted on any fresh checkout.
68
+ - **Atomic primitives**: `Badge`, `Button`, `Card` (+ `CardHeader`,
69
+ `CardTitle`, `CardSubtitle`, `CardContent`), `Input`, `Textarea`,
70
+ `Label`, `Tabs` (+ `TabsList`, `TabsTrigger`, `TabsContent`),
71
+ `Avatar`, `Separator`. Each maps onto a canonical CSS class from
72
+ `tokens.css` — no Tailwind utility re-encoding.
73
+ - **`./components/primitives` export path** for explicit imports.
74
+
75
+ ### Changed
76
+ - **`tokens.css` is now the single CSS entry point.** The handoff's
77
+ `tokens.css` + `tokens-ext.css` were merged so consumers do one
78
+ import (`@godxjp/ui/tokens`). The split is preserved verbatim under
79
+ `design/source-2026-05-13/` as an audit trail.
80
+ - **`src/primitives/` → `src/components/primitives/`** for consistency
81
+ with international design-system conventions (atomic primitives
82
+ alongside shell + screens under `components/`). Top-level
83
+ `@godxjp/ui` import paths unchanged.
84
+ - **`src/index.ts`** now re-exports primitives by default so
85
+ consumers can `import { Badge, Button } from "@godxjp/ui"`.
86
+
87
+ ### Removed
88
+ - `src/tokens/tokens-ext.css` (merged into `tokens.css`).
89
+ - `src/tokens/index.css` (no longer needed — `tokens.css` is the entry).
90
+
91
+ ## [0.1.0] — 2026-05-10
92
+
93
+ Initial scaffold: tokens, hooks, i18n, data, shell components, screen
94
+ components.
package/README.md CHANGED
@@ -1,50 +1,206 @@
1
- # @godxjp/ui
1
+ # @godxjp/ui — GoDX Forge unified design system
2
2
 
3
- > GodX Design System React UI components with i18n, translatable fields, and metadata-driven forms/tables.
3
+ **Status:** core source of truth. **Every frontend in the GoDX
4
+ ecosystem MUST consume this package.** No service may bring its own
5
+ tokens, theme, color palette, i18n provider, or component primitives.
6
+ This rule is review-blocking (see `MUST RULES` below).
4
7
 
5
- ## Install
8
+ The only thing a service is allowed to do differently from another is
9
+ **layout**: route tree, page composition, screen-specific widgets that
10
+ have no equivalent in another service. Everything visual — typography,
11
+ color, spacing, density, dark mode, language switcher, sidebar shape,
12
+ top-bar shape, buttons, badges, kanban, KPI tiles, modal pattern — comes
13
+ from here.
14
+
15
+ ---
16
+
17
+ ## MUST RULES (review-blocking)
18
+
19
+ > If a PR violates any of these the reviewer rejects, regardless of
20
+ > deadline. Sync the visual layer first, ship the feature after.
21
+
22
+ 1. **Tokens.** Every frontend imports `@godxjp/ui/tokens.css` AND
23
+ `@godxjp/ui/tokens-ext.css` from its root entry (`main.tsx` /
24
+ `app.tsx`). Services do not define their own `--background`,
25
+ `--foreground`, `--primary`, font stack, density variables, or
26
+ shadow scale. Tenant overrides happen via `[data-tenant="<id>"]`
27
+ on `<html>`, never per-service.
28
+
29
+ 2. **Stack.** TypeScript + React 19 + Vite + Tailwind v4 + shadcn-style
30
+ primitives (Radix + cva + tailwind-merge). Components from this
31
+ package are the only UI atoms a service uses. No service may ship
32
+ `@mui/material`, `chakra-ui`, `antd`, native `styled-components`,
33
+ raw `<input>` with custom CSS, etc.
34
+
35
+ 3. **i18n.** All translation goes through `@godxjp/ui/i18n` — a single
36
+ pre-configured `i18next` instance with auto-detect + JA fallback +
37
+ localStorage persistence. The base dictionary (nav, shell, common,
38
+ tweaks, kpi, pdca, issue) lives in `src/i18n/locales/{ja,en,vi}.ts`
39
+ and is exported as `ForgeTranslations`. Services may register their
40
+ own namespace (e.g. `i18n.addResourceBundle("ja", "sandbox", {…})`)
41
+ but never replace the base.
42
+
43
+ 4. **Locale set.** Supported: `ja` (default), `en`, `vi`. Adding a
44
+ locale = PR to this package, never per-service.
45
+
46
+ 5. **Theme + density + tenant.** All toggled via the `useTweaks` hook
47
+ from `@godxjp/ui/hooks`. The hook mirrors selections onto `<html>`
48
+ data attributes — services rely on those, they do not maintain
49
+ their own theme state.
50
+
51
+ 6. **Fonts.** `M PLUS 2` (loaded by `tokens.css`) is the primary face;
52
+ fallbacks are Hiragino → Yu Gothic → Noto Sans JP → system. No
53
+ service may swap in `Inter`, `Roboto`, `Comic Sans`, etc.
54
+
55
+ 7. **Color literals.** No hex / rgb / oklch literals in service code.
56
+ Always reference a CSS variable: `var(--primary)`, `var(--wa-akane)`,
57
+ `text-foreground`, `bg-surface-2`. The 13 `--wa-*` 和色 colors are
58
+ for charts + decoration ONLY; never role-map them.
59
+
60
+ 8. **Density.** Three modes only: `compact` (28 px element), `default`
61
+ (32 px), `comfortable` (44 px, WCAG-friendly). No `medium`, no
62
+ intermediate sizes. Components honor `--density-element-*` tokens.
63
+
64
+ 9. **Signal palette.** 5 colors with fixed semantics — `--success`
65
+ (若竹 wakatake), `--warning` (山吹 yamabuki), `--info` (群青
66
+ gunjō), `--error/destructive` (茜 akane), `--attention` (朱 shu).
67
+ **Red (`--destructive`) is reserved for destructive actions only.**
68
+ Don't use `--destructive` for "wrong answer" badges, validation
69
+ chrome, or general emphasis.
70
+
71
+ 10. **No emojis in product UI.** Iconography uses `lucide-react`.
72
+ Emoji are acceptable in user-generated content (comments, chat,
73
+ notifications) but never in chrome.
74
+
75
+ 11. **Shell layout.** When a service needs a sidebar + topbar shell,
76
+ it imports `<AppShell>` from `@godxjp/ui/components/shell` and
77
+ plugs in its own nav config + screen routes. Services do not
78
+ hand-roll a CSS grid for the chrome.
79
+
80
+ 12. **Switchers (product/project) are universal.** The Linear-style
81
+ quick switcher is one component, used everywhere — same data
82
+ shape (`ForgeProduct` / `ForgeProject` from `@godxjp/ui/data`).
83
+ A service that doesn't have a project concept passes
84
+ `project={null}`; the chip auto-hides.
85
+
86
+ ---
87
+
88
+ ## Layout boundary — what a service CAN do without violating
89
+
90
+ | Service-owned | Must come from `@godxjp/ui` |
91
+ |---|---|
92
+ | Route tree (`react-router-dom` config) | Visual atoms: button, badge, card, KPI, kanban col |
93
+ | Page composition (what cards live on this screen) | Shell: sidebar + topbar + tweaks panel |
94
+ | Screen-specific widgets (e.g. a domain-pool map view that no other service has) | Theme tokens, density, dark mode |
95
+ | Domain data shapes (e.g. the sandbox's tmux pane object) | i18n provider, locale list, base dictionary |
96
+ | Per-service API client | Color palette, font stack, spacing scale |
97
+
98
+ If a screen requires a NEW primitive that another service might also
99
+ need, add it to this package first, then consume it. Don't fork.
100
+
101
+ ---
102
+
103
+ ## Adoption tracker
104
+
105
+ Each service must reach **100% token coverage** before it's allowed
106
+ to claim "GoDX Forge compliant" in its README:
107
+
108
+ | Service | Status | Owner | Notes |
109
+ |---|---|---|---|
110
+ | `forge-service/frontend` | adopting (phase 1) | platform | Reference implementation. |
111
+ | `admin-platform/frontend` | partial (existing Omnify tokens overlap ~90%) | platform | Migrate before Plan #19 cut-over. |
112
+ | `me-service/frontend` | not started | platform | Tracked under Plan #31 R6. |
113
+ | `console-service/frontend` | not started | platform | Tracked under Plan #31 R6. |
114
+ | `agent-service/frontend` | not started | platform | Plan #21 G17 finished embed; visual port pending. |
115
+ | `knowledge-service/frontend` | not started | knowledge | Plan #18 K-phase polish. |
116
+
117
+ Operator-side dashboards (Grafana, Mailpit, etc.) are external — they
118
+ keep their own UI, not in scope.
119
+
120
+ ---
121
+
122
+ ## What lives here
6
123
 
7
- ```sh
8
- npm install @godxjp/ui
9
124
  ```
125
+ packages/godxjp-ui/src/
126
+ ├── tokens/ Source of truth for CSS variables.
127
+ │ ├── tokens.css Base palette, type scale, density,
128
+ │ │ shadows, motion. Imports M PLUS 2.
129
+ │ └── tokens-ext.css Sidebar, topbar, page, card, badge,
130
+ │ kanban, dark mode, tenant overrides.
131
+
132
+ ├── i18n/ i18next bootstrap + base dictionary.
133
+ │ ├── index.ts initI18n(); auto-detect + JA fallback.
134
+ │ └── locales/{ja,en,vi}.ts `ForgeTranslations` shape.
135
+
136
+ ├── hooks/
137
+ │ └── useTweaks.ts density / theme / tenant / locale /
138
+ │ sidebar-collapsed state w/ persistence.
139
+
140
+ ├── data/
141
+ │ └── products.ts ForgeProduct / ForgeProject types +
142
+ │ mock fixture (until forge-service
143
+ │ /api/v1/orgs/ wires real data).
144
+
145
+ ├── primitives/ shadcn-styled atoms (button, badge,
146
+ │ card, kbd, ...). One copy across the
147
+ │ org.
148
+
149
+ └── components/shell/ AppShell, Sidebar, Topbar,
150
+ ProductSwitcher, ProjectSwitcher,
151
+ TweaksPanel, CommandPalette.
152
+ ```
153
+
154
+ ---
10
155
 
11
- ## Usage
156
+ ## How to consume from a service frontend
12
157
 
13
158
  ```tsx
14
- import { Button, Input, Card, UIProvider } from "@godxjp/ui";
15
-
16
- function App() {
17
- return (
18
- <UIProvider locales={{ ja: "日本語", en: "English" }} defaultLocale="ja">
19
- <Card>
20
- <Input placeholder="Enter text..." />
21
- <Button>Submit</Button>
22
- </Card>
23
- </UIProvider>
24
- );
25
- }
159
+ // services/<svc>/frontend/src/main.tsx
160
+ import "@godxjp/ui/tokens.css";
161
+ import "@godxjp/ui/tokens-ext.css";
162
+ import { initI18n } from "@godxjp/ui/i18n";
163
+ import { AppShell, Sidebar, Topbar } from "@godxjp/ui/components/shell";
164
+
165
+ initI18n();
166
+
167
+ createRoot(document.getElementById("root")!).render(
168
+ <BrowserRouter>
169
+ <AppShell sidebar={<Sidebar nav={MY_NAV} />} topbar={<Topbar />}>
170
+ <Routes>{/* service-specific routes */}</Routes>
171
+ </AppShell>
172
+ </BrowserRouter>,
173
+ );
26
174
  ```
27
175
 
28
- ## Components
176
+ That's the entire integration surface for a new service.
29
177
 
30
- 60+ components including: Accordion, Alert, Avatar, Badge, Breadcrumb, Button, Calendar, Card, Checkbox, ColorPicker, Combobox, DatePicker, Dialog, Drawer, DropdownMenu, FileUpload (5 variants), Input, Label, Menubar, Pagination, PasswordInput, Popover, Progress, RadioGroup, Rating, SchemaField, SchemaTable, Select, Separator, Sheet, Skeleton, Slider, Switch, Table, Tabs, Textarea, TimePicker, Toggle, Tooltip, TranslatableField.
178
+ ---
31
179
 
32
- ## Key Features
180
+ ## Versioning + change control
33
181
 
34
- - **Translatable fields** locale tab switcher on Input/Textarea
35
- - **SchemaField** metadata-driven form fields (15 input types)
36
- - **SchemaTable** — metadata-driven data table (sort, filter, paginate, actions)
37
- - **FileUpload** — 5 variants (dropzone, compact, avatar, gallery, inline)
38
- - **i18n** — UIProvider with locale context, all labels locale-aware
182
+ The package follows semver. Breaking changes (renamed token, removed
183
+ component prop, changed default tenant) require:
39
184
 
40
- ## Build
185
+ 1. RFC issue in `godx-platform-sdk` repo (or local `docs/plans/` if
186
+ pre-extraction).
187
+ 2. Cross-service audit — which surfaces break, who fixes them.
188
+ 3. Major version bump.
41
189
 
42
- Source lives in `frontend/src/components/ui/` (sibling repo). This package builds from there:
190
+ Additive changes (new component, new locale string, new wa-iro color,
191
+ new tenant) are minor / patch — no RFC needed.
43
192
 
44
- ```sh
45
- npm run build # tsup dist/
46
- ```
193
+ Issue / PR for changes: file under `godx-jp/godx-platform-sdk` repo
194
+ once Plan #22 extraction completes; until then file under
195
+ `godx-jp/godx-admin` with label `area:design-system`.
196
+
197
+ ---
47
198
 
48
- ## License
199
+ ## See also
49
200
 
50
- Private GodX Japan.
201
+ - Design prototype the package is ported from: `chat1.md` + `chat2.md`
202
+ (Claude Design handoff, 2026-05-08 / 2026-05-09).
203
+ - Plan #19 — forge-service extraction.
204
+ - Plan #22 — multi-repo standalone services. `@godxjp/ui` is the
205
+ TypeScript counterpart to `godx-platform-sdk` (Go shared kernel).
206
+ - Plan #31 R6 — per-portal UI alignment.