@k8ordo/ui 1.0.0 → 2.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 (85) hide show
  1. package/README.md +37 -12
  2. package/dist/components/ai/conversation/conversation.d.mts +8 -10
  3. package/dist/components/ai/conversation/conversation.mjs +1 -6
  4. package/dist/components/ai/conversation/index.d.mts +15 -1
  5. package/dist/components/ai/conversation/index.mjs +8 -1
  6. package/dist/components/ai/index.d.mts +5 -9
  7. package/dist/components/ai/index.mjs +4 -4
  8. package/dist/components/ai/message/index.d.mts +12 -1
  9. package/dist/components/ai/message/index.mjs +7 -1
  10. package/dist/components/ai/message/message.d.mts +3 -5
  11. package/dist/components/ai/message/message.mjs +1 -5
  12. package/dist/components/ai/prompt-input/index.d.mts +23 -1
  13. package/dist/components/ai/prompt-input/index.mjs +8 -1
  14. package/dist/components/ai/prompt-input/prompt-input.d.mts +4 -6
  15. package/dist/components/ai/prompt-input/prompt-input.mjs +1 -6
  16. package/dist/components/ai/suggestion/index.d.mts +13 -1
  17. package/dist/components/ai/suggestion/index.mjs +7 -1
  18. package/dist/components/ai/suggestion/suggestion.d.mts +3 -5
  19. package/dist/components/ai/suggestion/suggestion.mjs +1 -5
  20. package/dist/components/buttons/icon-button/icon-button.mjs +1 -1
  21. package/dist/components/form/checkbox/checkbox.d.mts +1 -0
  22. package/dist/components/form/checkbox/checkbox.mjs +3 -2
  23. package/dist/components/form/checkbox-group/index.d.mts +1 -0
  24. package/dist/components/form/file-field/file-field.d.mts +12 -15
  25. package/dist/components/form/file-field/file-field.mjs +1 -6
  26. package/dist/components/form/file-field/index.d.mts +17 -1
  27. package/dist/components/form/file-field/index.mjs +8 -1
  28. package/dist/components/form/radio/radio.d.mts +1 -0
  29. package/dist/components/form/radio/radio.mjs +3 -2
  30. package/dist/components/index.d.mts +15 -21
  31. package/dist/components/index.mjs +7 -7
  32. package/dist/components/navigation/anchor/anchor.mjs +1 -1
  33. package/dist/components/navigation/tabs/index.d.mts +19 -1
  34. package/dist/components/navigation/tabs/index.mjs +9 -1
  35. package/dist/components/navigation/tabs/tabs.d.mts +16 -18
  36. package/dist/components/navigation/tabs/tabs.mjs +1 -7
  37. package/dist/components/overlays/dialog/dialog.d.mts +12 -16
  38. package/dist/components/overlays/dialog/dialog.mjs +1 -6
  39. package/dist/components/overlays/dialog/index.d.mts +17 -1
  40. package/dist/components/overlays/dialog/index.mjs +8 -1
  41. package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +20 -24
  42. package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +2 -11
  43. package/dist/components/overlays/dropdown-menu/index.d.mts +31 -1
  44. package/dist/components/overlays/dropdown-menu/index.mjs +12 -1
  45. package/dist/components/overlays/dropdown-menu/sub-menu.mjs +1 -1
  46. package/dist/components/overlays/list-box/index.d.mts +27 -1
  47. package/dist/components/overlays/list-box/index.mjs +9 -1
  48. package/dist/components/overlays/list-box/list-box.d.mts +20 -22
  49. package/dist/components/overlays/list-box/list-box.mjs +2 -8
  50. package/dist/components/overlays/popover/index.d.mts +24 -1
  51. package/dist/components/overlays/popover/index.mjs +8 -1
  52. package/dist/components/overlays/popover/popover.d.mts +18 -20
  53. package/dist/components/overlays/popover/popover.mjs +2 -7
  54. package/dist/components/overlays/tooltip/index.d.mts +21 -1
  55. package/dist/components/overlays/tooltip/index.mjs +8 -1
  56. package/dist/components/overlays/tooltip/tooltip.d.mts +18 -22
  57. package/dist/components/overlays/tooltip/tooltip.mjs +2 -7
  58. package/dist/hooks/index.d.mts +1 -4
  59. package/dist/hooks/index.mjs +2 -5
  60. package/dist/index.d.mts +13 -15
  61. package/dist/index.mjs +9 -12
  62. package/dist/integrations/_shared/renderers.mjs +7 -7
  63. package/dist/integrations/_shared/schemas.d.mts +1 -1
  64. package/dist/{hooks/focus-trap/index.d.mts → internal/focus-trap.d.mts} +1 -1
  65. package/dist/{hooks/focus-trap/index.mjs → internal/focus-trap.mjs} +1 -1
  66. package/dist/styles/index.css +0 -8
  67. package/docs/GUIDE.md +148 -133
  68. package/docs/llms.txt +11 -7
  69. package/docs/props.generated.json +18 -0
  70. package/docs/references/ai-chat.md +67 -67
  71. package/docs/references/color.md +108 -107
  72. package/docs/references/components.md +318 -310
  73. package/docs/references/generative-ui.md +51 -30
  74. package/docs/references/helpers.md +155 -52
  75. package/docs/references/hooks.md +61 -74
  76. package/docs/references/interaction-design.md +47 -47
  77. package/docs/references/spatial-design.md +83 -81
  78. package/docs/references/typography.md +68 -67
  79. package/package.json +32 -33
  80. package/dist/hooks/hash/index.d.mts +0 -4
  81. package/dist/hooks/hash/index.mjs +0 -25
  82. package/dist/hooks/local-storage/index.d.mts +0 -4
  83. package/dist/hooks/local-storage/index.mjs +0 -46
  84. package/dist/hooks/session-storage/index.d.mts +0 -4
  85. package/dist/hooks/session-storage/index.mjs +0 -46
package/docs/GUIDE.md CHANGED
@@ -1,18 +1,18 @@
1
- # k8ordo UI Design Guide
1
+ # @k8ordo/ui Design Guide
2
2
 
3
- `@k8ordo/ui` デザインシステムを使って UI を作るためのガイド。
3
+ How to build UI with the `@k8ordo/ui` design system.
4
4
 
5
- ## セットアップ
5
+ ## Setup
6
6
 
7
7
  ```bash
8
8
  npm install @k8ordo/ui
9
9
  ```
10
10
 
11
11
  ```tsx
12
- // 1. スタイルシートを読み込む(エントリポイントで1回)
12
+ // 1. Load the stylesheet (once, at your entry point)
13
13
  import '@k8ordo/ui/styles.css';
14
14
 
15
- // 2. Provider でアプリを囲む
15
+ // 2. Wrap the app in the provider
16
16
  import { UIProvider } from '@k8ordo/ui';
17
17
 
18
18
  function App() {
@@ -23,30 +23,40 @@ function App() {
23
23
  );
24
24
  }
25
25
 
26
- // 3. コンポーネントを使う
26
+ // 3. Use components
27
27
  import { Button, Card } from '@k8ordo/ui';
28
28
  ```
29
29
 
30
- ### スタイルシートの選び方
30
+ ### Choosing a stylesheet
31
31
 
32
- CSS のエントリは2つある。プロジェクトの CSS 環境で選ぶ:
32
+ There are two CSS entries. Pick the one that matches your project:
33
33
 
34
- - **`styles.css`(既定)** — ビルド済み CSS。Tailwind を持たないプロジェクト(CSS Modules・素の CSS)はこちら。import 1行で完結し、Tailwind のセットアップは不要。ライブラリのルールはすべて `@layer` 内にあるため、レイヤー外にある利用側の CSS がカスケードで優先される(唯一の例外は preflight の `[hidden] { display: none !important }`)。デザイントークンは `:root` / `.dark` の CSS カスタムプロパティとしてそのまま参照できる(`var(--fg-mute)` など)。
35
- - **`tailwind.css`** — Tailwind ソース版。Tailwind CSS 4 を使うプロジェクトはこちらを import すると、デザイントークン(`bg-bg-base` など)を自分のマークアップの Tailwind クラスとしても使える。内部で `@import 'tailwindcss'` を含むため、プロジェクトの CSS は次の1行でよい:
34
+ - **`styles.css` (default)** — prebuilt CSS. Use it if your project has no Tailwind (CSS Modules, plain CSS). A single import is all it takes, and no Tailwind setup is needed. Every library rule sits inside `@layer`, so your own unlayered CSS wins the cascade (the one exception is preflight's `[hidden] { display: none !important }`). Design tokens are readable as CSS custom properties on `:root` / `.dark` (`var(--fg-mute)`, …).
35
+ - **`tailwind.css`** — the Tailwind source entry. Import this in a Tailwind CSS 4 project and the design tokens become usable as Tailwind classes (`bg-bg-base`, …) in your own markup too. It contains `@import 'tailwindcss'` internally, so one line is enough for your project's CSS:
36
36
 
37
37
  ```css
38
38
  @import '@k8ordo/ui/tailwind.css';
39
39
  ```
40
40
 
41
- どちらのエントリも文書全体にベーススタイルを適用する点に注意。Tailwind の preflight(見出し・リスト・余白のリセット等)に加え、ライブラリの base レイヤーが `b` / `strong` の太字や `i` / `em` の斜体を解除し、`body` のタイポグラフィ既定(`font-size` / `overflow-wrap: anywhere` / `scrollbar-gutter: stable` など)を設定する。既存アプリに後付けする場合はコンポーネント以外の見た目にも影響する。
41
+ Note that either entry applies base styles document-wide. On top of Tailwind's
42
+ preflight (resets for headings, lists, and margins), the library's base layer
43
+ unsets bold on `b` / `strong` and italics on `i` / `em`, and sets `body`
44
+ typography defaults (`font-size`, `overflow-wrap: anywhere`,
45
+ `scrollbar-gutter: stable`, …). Adding it to an existing app restyles more than
46
+ the library's own components.
42
47
 
43
- 例外がもう1つ: `@k8ordo/ui/ai/response`(`Response`)だけは streamdown のクラスを利用側の Tailwind ビルドで生成する必要があるため、ビルド済み `styles.css` では表示が完成しない。`Response` を使うなら `tailwind.css` + `@source` 設定([ai-chat](references/ai-chat.md))が前提。
48
+ One more exception: `@k8ordo/ui/ai/response` (`Response`) needs streamdown's
49
+ classes to be generated by _your_ Tailwind build, so the prebuilt `styles.css`
50
+ alone will not render it completely. Using `Response` requires `tailwind.css`
51
+ plus a `@source` entry — see [ai-chat](references/ai-chat.md).
44
52
 
45
- ### 文言の言語(i18n)
53
+ ### Wording language (i18n)
46
54
 
47
- コンポーネントが内部で持つ文言(「閉じる」「必須」「読み込み中」など)は**既定で日本語**。Provider を置かなくても、`messages` を渡さなくても日本語で動くので、日本語のアプリでは何も設定しなくてよい。
55
+ The wording components own internally ("close", "required", "loading", …)
56
+ **defaults to Japanese**. It works without a provider and without passing
57
+ `messages`, so a Japanese app needs no setup at all.
48
58
 
49
- 英語にするときは `@k8ordo/ui/i18n` の `en` を渡す。
59
+ To switch to English, pass `en` from `@k8ordo/ui/i18n`.
50
60
 
51
61
  ```tsx
52
62
  import { UIProvider } from '@k8ordo/ui';
@@ -57,7 +67,7 @@ import { en } from '@k8ordo/ui/i18n';
57
67
  </UIProvider>;
58
68
  ```
59
69
 
60
- 一部だけ差し替えたいときは辞書をスプレッドして上書きする。
70
+ To replace only some of it, spread the dictionary and override those keys.
61
71
 
62
72
  ```tsx
63
73
  <UIProvider messages={{ ...en, close: 'Dismiss' }}>
@@ -65,161 +75,164 @@ import { en } from '@k8ordo/ui/i18n';
65
75
  </UIProvider>
66
76
  ```
67
77
 
68
- 優先順位は **コンポーネントの prop > Provider の辞書 > 既定(日本語)**。`Spinner` の `label` のように個別の文言 prop を持つコンポーネントでは、その prop が辞書より優先される。
78
+ Resolution order is **component prop > provider dictionary > built-in default
79
+ (Japanese)**. For a component with a wording prop of its own, such as
80
+ `Spinner`'s `label`, that prop wins over the dictionary.
69
81
 
70
- > [キー一覧・詳細](references/components.md)(「i18n(文言辞書)」の節)
82
+ > [Full key list and details](references/components.md) (the "i18n (message dictionary)" section)
71
83
 
72
- ## デザインの方向性
84
+ ## Design direction
73
85
 
74
- ### コアコンセプト
86
+ ### Core concept
75
87
 
76
- **「触れるものは柔らかく、読むものは端正に」**
88
+ **"Soft where you touch, precise where you read."**
89
+ (触れるものは柔らかく、読むものは端正に)
77
90
 
78
- - **空間と形が主役**: 色ではなく、余白のゆとりと形の柔らかさがこのデザインの個性
79
- - **要素の性格で使い分ける**: 触れる要素(フォーム、ボタン)は柔らかく、情報を示す要素(Alert、Badge)は端正に
80
- - **余白で語る**: 詰め込まず、空間にゆとりを持たせる
81
- - **静かな変化**: アニメーションは控えめに、繊細なフィードバック
82
- - **穏やかな色**: OKLCH ベースのパレット、セマンティックトークンで抑えたトーンに
91
+ - **Space and shape lead**: the character of this design comes from generous spacing and soft shapes, not from color
92
+ - **Vary by the element's role**: things you touch (forms, buttons) are soft; things that inform (Alert, Badge) are precise
93
+ - **Let the spacing speak**: do not pack things in; leave room
94
+ - **Quiet motion**: restrained animation, subtle feedback
95
+ - **Calm color**: an OKLCH-based palette kept low-key through semantic tokens
83
96
 
84
- すべてを同じトーンにしない。要素の性格ごとに柔らかさを変える。
97
+ Do not give everything the same tone. Soften in proportion to the element's role.
85
98
 
86
- | 要素 | 方向性 |
87
- | --------------------------------------- | -------------------------------------------------------- |
88
- | フォーム(TextField, Textarea, Button) | 柔らかい(大きな角丸、ピル型ボタン、ゆったりパディング) |
89
- | カード・コンテナ | 柔らかい(`rounded-xl`〜`rounded-2xl`、ふんわり影) |
90
- | Alert, Badge | 端正(情報の明確さを優先) |
91
- | Tabs, Breadcrumb | シャープ(構造を示す要素は端正に) |
99
+ | Element | Direction |
100
+ | ----------------------------------- | ---------------------------------------------------- |
101
+ | Forms (TextField, Textarea, Button) | Soft (large radii, pill buttons, generous padding) |
102
+ | Cards and containers | Soft (`rounded-xl`–`rounded-2xl`, gentle shadow) |
103
+ | Alert, Badge | Precise (clarity of information comes first) |
104
+ | Tabs, Breadcrumb | Sharp (elements that express structure stay precise) |
92
105
 
93
- ### トーン
106
+ ### Tone
94
107
 
95
- 柔らかな余白と静かな洗練。空間と形の柔らかさで魅せる。
108
+ Soft spacing and quiet refinement. The appeal is in space and shape.
96
109
 
97
- ## 美学ガイドライン
110
+ ## Aesthetic guidelines
98
111
 
99
- ### ページ構造
112
+ ### Page structure
100
113
 
101
114
  **DO:**
102
115
 
103
- - ページ背景は `bg-bg-subtle`(薄いグレー)
104
- - コンテンツは白いカードで浮かせる
105
- - カード間に十分な余白(`gap-6`〜`gap-10`)
116
+ - Use `bg-bg-subtle` (a light grey) for the page background
117
+ - Float content on white cards
118
+ - Leave enough room between cards (`gap-6`–`gap-10`)
106
119
 
107
120
  **DON'T:**
108
121
 
109
- - 純白背景にカードをフラットに置く
110
- - すべてを Card に入れる
111
- - Card を入れ子にする(Card in Card)
122
+ - Lay flat cards on a pure white background
123
+ - Put everything in a Card
124
+ - Nest cards (Card in Card)
112
125
 
113
- ### タイポグラフィ
126
+ ### Typography
114
127
 
115
128
  **DO:**
116
129
 
117
- - 日本語フォント(Noto Sans JP, M PLUS 2)を使う
118
- - フォントウェイトは 3種類まで(`font-normal`, `font-medium`, `font-bold`)
119
- - `font-medium` が 450(一般的な 500 より軽い)であることを活かした繊細な強調
130
+ - Use the Japanese fonts (Noto Sans JP, M PLUS 2)
131
+ - Keep to three font weights at most (`font-normal`, `font-medium`, `font-bold`)
132
+ - Lean on `font-medium` being 450 — lighter than the usual 500 — for delicate emphasis
120
133
 
121
134
  **DON'T:**
122
135
 
123
- - Inter / Roboto / Open Sans を使う
124
- - 4種類以上のフォントサイズを1画面で使う
125
- - テキストにグラデーションをかける
136
+ - Use Inter / Roboto / Open Sans
137
+ - Use four or more font sizes on one screen
138
+ - Apply gradients to text
126
139
 
127
- > [タイポグラフィ詳細](references/typography.md)
140
+ > [Typography details](references/typography.md)
128
141
 
129
- ### カラー
142
+ ### Color
130
143
 
131
144
  **DO:**
132
145
 
133
- - 60-30-10 ルール(ニュートラル60%, サポート30%, アクセント10%)
134
- - セマンティックカラートークンを使う(`bg-bg-subtle`, `text-fg-mute` 等)
135
- - ダークモードを独立したトーンで設計する
136
- - 色は穏やかに、空間と形で魅せる
146
+ - Follow the 60-30-10 rule (60% neutral, 30% supporting, 10% accent)
147
+ - Use semantic color tokens (`bg-bg-subtle`, `text-fg-mute`, …)
148
+ - Design dark mode as its own tone, not a derivative
149
+ - Keep color calm; let space and shape carry the design
137
150
 
138
151
  **DON'T:**
139
152
 
140
- - グラデーション背景
141
- - ホバーに `bg-primary-bg` — `bg-bg-mute` を使う
142
- - 透明度(`/90`)で状態表現 — 専用トークンを使う
143
- - 鮮やかな色を広範囲に使う
144
- - 生のパレット色(`bg-teal-500`)— セマンティックトークン(`bg-primary-bg`)を使う
153
+ - Use gradient backgrounds
154
+ - Use `bg-primary-bg` on hover — use `bg-bg-mute`
155
+ - Express state with opacity (`/90`) — use the dedicated token
156
+ - Spread vivid color over large areas
157
+ - Use raw palette colors (`bg-teal-500`) — use semantic tokens (`bg-primary-bg`)
145
158
 
146
- > [カラー詳細](references/color.md)
159
+ > [Color details](references/color.md)
147
160
 
148
- ### スペーシング
161
+ ### Spacing
149
162
 
150
163
  **DO:**
151
164
 
152
- - `p-8` を標準パディングとする(フォーム・カード内)
153
- - 余白の差で関連度を表す(`mt-2` 近い、`mt-4` 標準、`mt-8` セクション間)
154
- - Separator でセクションを区切る
165
+ - Treat `p-8` as the standard padding (inside forms and cards)
166
+ - Express relatedness through the size of the gap (`mt-2` close, `mt-4` standard, `mt-8` between sections)
167
+ - Separate sections with Separator
155
168
 
156
169
  **DON'T:**
157
170
 
158
- - すべてを Card に入れる
159
- - Card を入れ子にする(Card in Card)
160
- - `gap-1` のような極端に狭いスペーシング
171
+ - Put everything in a Card
172
+ - Nest cards (Card in Card)
173
+ - Use extremely tight spacing such as `gap-1`
161
174
 
162
- > [スペーシング詳細](references/spatial-design.md)
175
+ > [Spacing details](references/spatial-design.md)
163
176
 
164
- ### インタラクション
177
+ ### Interaction
165
178
 
166
179
  **DO:**
167
180
 
168
- - `transition-colors` を基本にする
169
- - `focus-visible:ring-2 focus-visible:ring-border-info` でフォーカス表現
170
- - `hover:bg-bg-mute` で穏やかなホバー
181
+ - Start from `transition-colors`
182
+ - Express focus with `focus-visible:ring-2 focus-visible:ring-border-info`
183
+ - Keep hover gentle with `hover:bg-bg-mute`
171
184
 
172
185
  **DON'T:**
173
186
 
174
- - bounce / spring 系のイージング
175
- - 300ms を超えるアニメーション
176
- - ホバーに強い原色を使う
187
+ - Use bounce or spring easing
188
+ - Animate for longer than 300ms
189
+ - Use a strong primary color on hover
177
190
 
178
- > [インタラクション詳細](references/interaction-design.md)
191
+ > [Interaction details](references/interaction-design.md)
179
192
 
180
- ## コンポーネント使用の原則
193
+ ## Component usage principles
181
194
 
182
195
  ### Button
183
196
 
184
- `color` と `variant` で統一されたスタイル。ピル型(`rounded-full`)。
197
+ Styling is unified through `color` and `variant`. Pill-shaped (`rounded-full`).
185
198
 
186
199
  ```tsx
187
200
  import { Button } from '@k8ordo/ui';
188
201
 
189
- // プライマリアクション
190
- <Button color="primary" variant="solid">保存する</Button>
202
+ // Primary action
203
+ <Button color="primary" variant="solid">Save</Button>
191
204
 
192
- // セカンダリアクション
193
- <Button color="base" variant="outline">キャンセル</Button>
205
+ // Secondary action
206
+ <Button color="base" variant="outline">Cancel</Button>
194
207
 
195
- // テキストのみ
196
- <Button variant="skeleton">詳細を見る</Button>
208
+ // Text only
209
+ <Button variant="skeleton">View details</Button>
197
210
 
198
- // リンクとしてレンダーする(renderItem prop)
211
+ // Render as a link (renderItem prop)
199
212
  <Button
200
213
  color="base"
201
214
  renderItem={({ className, children }) => (
202
215
  <a className={className} href="/settings">{children}</a>
203
216
  )}
204
217
  >
205
- 設定へ
218
+ Settings
206
219
  </Button>
207
220
  ```
208
221
 
209
222
  ### IconButton
210
223
 
211
- `color` prop でスタイルを制御(`variant` ではない)。`label` は必須。
224
+ Styling is controlled by `color` (not `variant`). `label` is required.
212
225
 
213
226
  ```tsx
214
227
  import { IconButton } from '@k8ordo/ui';
215
228
 
216
- <IconButton color="transparent" label="コピー"><CopyIcon /></IconButton>
217
- <IconButton color="primary" label="送信"><SendIcon /></IconButton>
229
+ <IconButton color="transparent" label="Copy"><CopyIcon /></IconButton>
230
+ <IconButton color="primary" label="Send"><SendIcon /></IconButton>
218
231
 
219
- // リンクとしてレンダーする(renderItem prop)
232
+ // Render as a link (renderItem prop)
220
233
  <IconButton
221
234
  color="base"
222
- label="ホーム"
235
+ label="Home"
223
236
  renderItem={({ className, children, 'aria-label': ariaLabel, triggerProps }) => (
224
237
  <a aria-label={ariaLabel} className={className} href="/home" {...triggerProps}>
225
238
  {children}
@@ -232,25 +245,25 @@ import { IconButton } from '@k8ordo/ui';
232
245
 
233
246
  ### Card
234
247
 
235
- シャドウで浮かせるのが基本。ページ背景 `bg-subtle` の上に白カード。
248
+ Floating on a shadow is the default: a white card over a `bg-subtle` page.
236
249
 
237
250
  ```tsx
238
251
  import { Card } from '@k8ordo/ui';
239
252
 
240
- // 静的カード(シャドウで浮かせる)
253
+ // Static card (floated with a shadow)
241
254
  <Card variant="shadow">
242
- <div className="p-8">カードのコンテンツ</div>
255
+ <div className="p-8">Card content</div>
243
256
  </Card>
244
257
 
245
- // クリック可能なカード(interactive でホバー時にスケールアップ)
258
+ // Clickable card (interactive scales it up on hover)
246
259
  <Card variant="shadow" interactive>
247
- <div className="p-8">コンテンツ</div>
260
+ <div className="p-8">Content</div>
248
261
  </Card>
249
262
  ```
250
263
 
251
- ### フォーム
264
+ ### Forms
252
265
 
253
- `FormControl` + 各フォームコンポーネントの `renderInput` パターン。
266
+ `FormControl` plus each form component's `renderInput` pattern.
254
267
 
255
268
  ```tsx
256
269
  import {
@@ -261,14 +274,14 @@ import {
261
274
  TextField,
262
275
  } from '@k8ordo/ui';
263
276
 
264
- <FormControl label="メール" required renderInput={(props) => (
277
+ <FormControl label="Email" required renderInput={(props) => (
265
278
  <TextField {...props} placeholder="example@mail.com" />
266
279
  )} />
267
280
 
268
- <FormControl label="カテゴリ" renderInput={(props) => (
281
+ <FormControl label="Category" renderInput={(props) => (
269
282
  <Select
270
283
  {...props}
271
- options={[{ value: '1', label: 'オプション1' }]}
284
+ options={[{ value: '1', label: 'Option 1' }]}
272
285
  value={value}
273
286
  onChange={onChange}
274
287
  />
@@ -277,48 +290,50 @@ import {
277
290
  <FileField.Root accept="image/*" multiple>
278
291
  <FileField.Trigger
279
292
  renderItem={({ onClick, disabled }) => (
280
- <Button disabled={disabled} onClick={onClick}>ファイルを選択</Button>
293
+ <Button disabled={disabled} onClick={onClick}>Choose files</Button>
281
294
  )}
282
295
  />
283
296
  <FileField.ItemList />
284
297
  </FileField.Root>
285
298
  ```
286
299
 
287
- ## アンチパターン: 「AI スロップ」を避ける
300
+ ## Anti-patterns: avoiding "AI slop"
288
301
 
289
- AI が生成したと一目でわかるUIの特徴を避ける。
302
+ Avoid the traits that make a UI recognizably AI-generated at a glance.
290
303
 
291
- | アンチパターン | k8ordo UI での代替 |
292
- | ------------------------------ | -------------------------------------------------- |
293
- | パープルグラデーション | Teal/Cyan のフラットカラー |
294
- | Card in Card(入れ子カード) | Separator + 余白で区切り |
295
- | グレー背景にグレーテキスト | `text-fg-base` / `text-fg-mute` のコントラスト確保 |
296
- | bounce / spring アニメーション | `transition-colors duration-150 ease-out` |
297
- | Inter フォント | Noto Sans JP / M PLUS 2 |
298
- | 過剰な glassmorphism | border + subtle な背景色 |
299
- | 情報の詰め込み | 余白を活かした疎な配置 |
304
+ | Anti-pattern | The @k8ordo/ui alternative |
305
+ | -------------------------- | -------------------------------------------------- |
306
+ | Purple gradients | Flat teal/cyan color |
307
+ | Card in Card | A Separator and spacing instead |
308
+ | Grey text on a grey ground | Hold contrast with `text-fg-base` / `text-fg-mute` |
309
+ | Bounce / spring animation | `transition-colors duration-150 ease-out` |
310
+ | The Inter typeface | Noto Sans JP / M PLUS 2 |
311
+ | Heavy glassmorphism | A border plus a subtle background color |
312
+ | Cramming information in | Sparse placement that lets the space breathe |
300
313
 
301
- ### AI スロップテスト
314
+ ### The AI slop test
302
315
 
303
- > このUIを誰かに見せて「AIが作った」と言ったら、すぐに信じるだろうか?
304
- > もし「はい」なら、それが問題だ。
316
+ > Show this UI to someone and tell them an AI made it. Would they believe it
317
+ > immediately? If yes, that is the problem.
305
318
 
306
- ## 実装の原則
319
+ ## Implementation principles
307
320
 
308
- - **既存コンポーネントを使う**: カスタムUIの前にまず k8ordo UI コンポーネントを探す
309
- - **セマンティックトークンを使う**: 生のカラー値(`bg-teal-500`)ではなくトークン(`bg-primary-bg`)
310
- - **空間と形で魅せる**: 色の華やかさではなく、余白と角丸の柔らかさで個性を出す
311
- - **ダークモードを忘れない**: セマンティックトークンを使えば自動対応
312
- - **アクセシビリティ**: `aria-label`, キーボードナビゲーション, カラーだけに頼らない状態表現
321
+ - **Use the existing components**: look for a @k8ordo/ui component before building custom UI
322
+ - **Render from Server Components**: every component, compound ones included (`Dialog.Root`, `Tabs.Root`, …), can be placed in a Server Component; only the interactive parts are client modules
323
+ - **Keep placed state in `@k8ordo/state`**: state that lives in the URL, a history entry, localStorage, or memory is `defineLocalState` and friends, not a hook from this package
324
+ - **Use semantic tokens**: tokens (`bg-primary-bg`), never raw color values (`bg-teal-500`)
325
+ - **Let space and shape carry it**: character comes from spacing and soft radii, not from vivid color
326
+ - **Do not forget dark mode**: semantic tokens handle it for you
327
+ - **Accessibility**: `aria-label`, keyboard navigation, and state that does not rely on color alone
313
328
 
314
- ## 詳細リファレンス
329
+ ## Detailed reference
315
330
 
316
- - タイポグラフィ: [references/typography.md](references/typography.md)
317
- - カラーシステム: [references/color.md](references/color.md)
318
- - スペーシング・レイアウト: [references/spatial-design.md](references/spatial-design.md)
319
- - インタラクション: [references/interaction-design.md](references/interaction-design.md)
320
- - コンポーネント一覧: [references/components.md](references/components.md)
331
+ - Typography: [references/typography.md](references/typography.md)
332
+ - Color system: [references/color.md](references/color.md)
333
+ - Spacing and layout: [references/spatial-design.md](references/spatial-design.md)
334
+ - Interaction: [references/interaction-design.md](references/interaction-design.md)
335
+ - Component catalog: [references/components.md](references/components.md)
321
336
  - Hooks: [references/hooks.md](references/hooks.md)
322
- - ヘルパー・型: [references/helpers.md](references/helpers.md)
323
- - AI チャット(Conversation / Message / PromptInput など): [references/ai-chat.md](references/ai-chat.md)
324
- - 生成 UI(json-render / OpenUI で LLM に UI を生成させる): [references/generative-ui.md](references/generative-ui.md)
337
+ - Helpers and types: [references/helpers.md](references/helpers.md)
338
+ - AI chat (Conversation / Message / PromptInput, …): [references/ai-chat.md](references/ai-chat.md)
339
+ - Generative UI (having an LLM generate UI via json-render / OpenUI): [references/generative-ui.md](references/generative-ui.md)
package/docs/llms.txt CHANGED
@@ -1,9 +1,13 @@
1
1
  # @k8ordo/ui
2
2
 
3
- > k8o's React UI library (React 19, TypeScript, Tailwind CSS 4) with semantic design
4
- > tokens, dark mode, AI chat components, and official generative UI adapters
5
- > (json-render & OpenUI) that let an LLM generate, validate, and render on-brand UIs
6
- > from these components.
3
+ > React components from k8ordo, with semantic design tokens, dark mode,
4
+ > built-in Japanese/English wording, AI chat components, and official generative UI
5
+ > adapters (json-render & OpenUI) that let an LLM generate, validate, and render
6
+ > on-brand UIs from these components.
7
+ >
8
+ > Like every k8ordo package it assumes React 19 and Server Components, uses only
9
+ > what has reached Baseline, and ships no polyfills or legacy fallbacks — so
10
+ > nothing here branches for a browser or a framework it does not support.
7
11
 
8
12
  When installed via npm, these docs live under `node_modules/@k8ordo/ui/docs/`.
9
13
  Start with GUIDE.md, then follow the reference most relevant to the task.
@@ -14,12 +18,12 @@ Start with GUIDE.md, then follow the reference most relevant to the task.
14
18
 
15
19
  ## References
16
20
 
17
- - [Components](references/components.md): full component list, import paths, props, and i18n — component wording comes from a dictionary that defaults to Japanese; `@k8ordo/ui/i18n` exports `ja` / `en` / the `Messages` type for `<UIProvider messages={...}>` (per-component wording props win over the dictionary).
21
+ - [Components](references/components.md): full component list, import paths, props, and i18n — every component, compound ones included (`Dialog.Root`, `Tabs.Root`, …), renders from a Server Component — component wording comes from a dictionary that defaults to Japanese; `@k8ordo/ui/i18n` exports `ja` / `en` / the `Messages` type for `<UIProvider messages={...}>` (per-component wording props win over the dictionary).
18
22
  - [AI chat](references/ai-chat.md): AI chat components from `@k8ordo/ui/ai` (Conversation / Message / PromptInput / Reasoning / Suggestion / ToolInvocation), streaming Markdown `Response` from `@k8ordo/ui/ai/response` (optional peer `streamdown`), and `mapMessageParts` from `@k8ordo/ui/ai-sdk` to render AI SDK `UIMessage.parts` (optional peer `ai`).
19
23
  - [Generative UI](references/generative-ui.md): use json-render / OpenUI to make an LLM generate UIs — `catalog.prompt()` (server-safe), `<JsonRenderUI spec={spec} />` (client), `validateGeneratedSpec()` (validate/repair LLM output), `satisfies UISpec` (typed specs), and `@k8ordo/ui/openui/prompt`.
20
24
  - [Typography](references/typography.md): type scale and usage.
21
25
  - [Color](references/color.md): semantic token system and dark mode.
22
26
  - [Spacing & layout](references/spatial-design.md): spacing scale and layout patterns.
23
27
  - [Interaction](references/interaction-design.md): motion and interaction guidelines.
24
- - [Hooks](references/hooks.md): custom hooks.
25
- - [Helpers & types](references/helpers.md): helper functions and types.
28
+ - [Hooks](references/hooks.md): custom hooks for UI mechanics (disclosure, timing, DOM observation). State that lives in a place (URL, history, localStorage, memory) belongs to `@k8ordo/state`, not to a hook here.
29
+ - [Helpers & types](references/helpers.md): the five helper functions (`chain` / `cn` / `createSafeContext` / `mergeProps` / `mergeRefs`) and the public types (`Status` / `Direction` / `Placement` / `ModalSide` / `DrawerSide` / `Option`).
@@ -562,6 +562,12 @@
562
562
  "defaultValue": null,
563
563
  "required": false
564
564
  },
565
+ {
566
+ "name": "invalid",
567
+ "types": ["boolean"],
568
+ "defaultValue": "false",
569
+ "required": false
570
+ },
565
571
  {
566
572
  "name": "itemValue",
567
573
  "types": ["string"],
@@ -654,6 +660,12 @@
654
660
  "defaultValue": null,
655
661
  "required": false
656
662
  },
663
+ {
664
+ "name": "invalid",
665
+ "types": ["boolean"],
666
+ "defaultValue": "false",
667
+ "required": false
668
+ },
657
669
  {
658
670
  "name": "itemValue",
659
671
  "types": ["string"],
@@ -2434,6 +2446,12 @@
2434
2446
  "defaultValue": "false",
2435
2447
  "required": false
2436
2448
  },
2449
+ {
2450
+ "name": "invalid",
2451
+ "types": ["boolean"],
2452
+ "defaultValue": "false",
2453
+ "required": false
2454
+ },
2437
2455
  {
2438
2456
  "name": "name",
2439
2457
  "types": ["string"],