@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.
- package/README.md +37 -12
- package/dist/components/ai/conversation/conversation.d.mts +8 -10
- package/dist/components/ai/conversation/conversation.mjs +1 -6
- package/dist/components/ai/conversation/index.d.mts +15 -1
- package/dist/components/ai/conversation/index.mjs +8 -1
- package/dist/components/ai/index.d.mts +5 -9
- package/dist/components/ai/index.mjs +4 -4
- package/dist/components/ai/message/index.d.mts +12 -1
- package/dist/components/ai/message/index.mjs +7 -1
- package/dist/components/ai/message/message.d.mts +3 -5
- package/dist/components/ai/message/message.mjs +1 -5
- package/dist/components/ai/prompt-input/index.d.mts +23 -1
- package/dist/components/ai/prompt-input/index.mjs +8 -1
- package/dist/components/ai/prompt-input/prompt-input.d.mts +4 -6
- package/dist/components/ai/prompt-input/prompt-input.mjs +1 -6
- package/dist/components/ai/suggestion/index.d.mts +13 -1
- package/dist/components/ai/suggestion/index.mjs +7 -1
- package/dist/components/ai/suggestion/suggestion.d.mts +3 -5
- package/dist/components/ai/suggestion/suggestion.mjs +1 -5
- package/dist/components/buttons/icon-button/icon-button.mjs +1 -1
- package/dist/components/form/checkbox/checkbox.d.mts +1 -0
- package/dist/components/form/checkbox/checkbox.mjs +3 -2
- package/dist/components/form/checkbox-group/index.d.mts +1 -0
- package/dist/components/form/file-field/file-field.d.mts +12 -15
- package/dist/components/form/file-field/file-field.mjs +1 -6
- package/dist/components/form/file-field/index.d.mts +17 -1
- package/dist/components/form/file-field/index.mjs +8 -1
- package/dist/components/form/radio/radio.d.mts +1 -0
- package/dist/components/form/radio/radio.mjs +3 -2
- package/dist/components/index.d.mts +15 -21
- package/dist/components/index.mjs +7 -7
- package/dist/components/navigation/anchor/anchor.mjs +1 -1
- package/dist/components/navigation/tabs/index.d.mts +19 -1
- package/dist/components/navigation/tabs/index.mjs +9 -1
- package/dist/components/navigation/tabs/tabs.d.mts +16 -18
- package/dist/components/navigation/tabs/tabs.mjs +1 -7
- package/dist/components/overlays/dialog/dialog.d.mts +12 -16
- package/dist/components/overlays/dialog/dialog.mjs +1 -6
- package/dist/components/overlays/dialog/index.d.mts +17 -1
- package/dist/components/overlays/dialog/index.mjs +8 -1
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +20 -24
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +2 -11
- package/dist/components/overlays/dropdown-menu/index.d.mts +31 -1
- package/dist/components/overlays/dropdown-menu/index.mjs +12 -1
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +1 -1
- package/dist/components/overlays/list-box/index.d.mts +27 -1
- package/dist/components/overlays/list-box/index.mjs +9 -1
- package/dist/components/overlays/list-box/list-box.d.mts +20 -22
- package/dist/components/overlays/list-box/list-box.mjs +2 -8
- package/dist/components/overlays/popover/index.d.mts +24 -1
- package/dist/components/overlays/popover/index.mjs +8 -1
- package/dist/components/overlays/popover/popover.d.mts +18 -20
- package/dist/components/overlays/popover/popover.mjs +2 -7
- package/dist/components/overlays/tooltip/index.d.mts +21 -1
- package/dist/components/overlays/tooltip/index.mjs +8 -1
- package/dist/components/overlays/tooltip/tooltip.d.mts +18 -22
- package/dist/components/overlays/tooltip/tooltip.mjs +2 -7
- package/dist/hooks/index.d.mts +1 -4
- package/dist/hooks/index.mjs +2 -5
- package/dist/index.d.mts +13 -15
- package/dist/index.mjs +9 -12
- package/dist/integrations/_shared/renderers.mjs +7 -7
- package/dist/integrations/_shared/schemas.d.mts +1 -1
- package/dist/{hooks/focus-trap/index.d.mts → internal/focus-trap.d.mts} +1 -1
- package/dist/{hooks/focus-trap/index.mjs → internal/focus-trap.mjs} +1 -1
- package/dist/styles/index.css +0 -8
- package/docs/GUIDE.md +148 -133
- package/docs/llms.txt +11 -7
- package/docs/props.generated.json +18 -0
- package/docs/references/ai-chat.md +67 -67
- package/docs/references/color.md +108 -107
- package/docs/references/components.md +318 -310
- package/docs/references/generative-ui.md +51 -30
- package/docs/references/helpers.md +155 -52
- package/docs/references/hooks.md +61 -74
- package/docs/references/interaction-design.md +47 -47
- package/docs/references/spatial-design.md +83 -81
- package/docs/references/typography.md +68 -67
- package/package.json +32 -33
- package/dist/hooks/hash/index.d.mts +0 -4
- package/dist/hooks/hash/index.mjs +0 -25
- package/dist/hooks/local-storage/index.d.mts +0 -4
- package/dist/hooks/local-storage/index.mjs +0 -46
- package/dist/hooks/session-storage/index.d.mts +0 -4
- package/dist/hooks/session-storage/index.mjs +0 -46
package/docs/GUIDE.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# k8ordo
|
|
1
|
+
# @k8ordo/ui Design Guide
|
|
2
2
|
|
|
3
|
-
`@k8ordo/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.
|
|
12
|
+
// 1. Load the stylesheet (once, at your entry point)
|
|
13
13
|
import '@k8ordo/ui/styles.css';
|
|
14
14
|
|
|
15
|
-
// 2.
|
|
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
|
-
|
|
32
|
+
There are two CSS entries. Pick the one that matches your project:
|
|
33
33
|
|
|
34
|
-
- **`styles.css
|
|
35
|
-
- **`tailwind.css`** — Tailwind
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
###
|
|
53
|
+
### Wording language (i18n)
|
|
46
54
|
|
|
47
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
> [
|
|
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
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
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
|
-
|
|
|
89
|
-
|
|
|
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
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
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
|
-
-
|
|
111
|
-
-
|
|
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
|
-
-
|
|
118
|
-
-
|
|
119
|
-
- `font-medium`
|
|
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
|
-
-
|
|
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
|
-
> [
|
|
140
|
+
> [Typography details](references/typography.md)
|
|
128
141
|
|
|
129
|
-
###
|
|
142
|
+
### Color
|
|
130
143
|
|
|
131
144
|
**DO:**
|
|
132
145
|
|
|
133
|
-
- 60-30-10
|
|
134
|
-
-
|
|
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
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
-
|
|
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
|
-
> [
|
|
159
|
+
> [Color details](references/color.md)
|
|
147
160
|
|
|
148
|
-
###
|
|
161
|
+
### Spacing
|
|
149
162
|
|
|
150
163
|
**DO:**
|
|
151
164
|
|
|
152
|
-
- `p-8`
|
|
153
|
-
-
|
|
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
|
-
-
|
|
159
|
-
-
|
|
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
|
-
> [
|
|
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
|
|
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
|
-
> [
|
|
191
|
+
> [Interaction details](references/interaction-design.md)
|
|
179
192
|
|
|
180
|
-
##
|
|
193
|
+
## Component usage principles
|
|
181
194
|
|
|
182
195
|
### Button
|
|
183
196
|
|
|
184
|
-
`color`
|
|
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"
|
|
202
|
+
// Primary action
|
|
203
|
+
<Button color="primary" variant="solid">Save</Button>
|
|
191
204
|
|
|
192
|
-
//
|
|
193
|
-
<Button color="base" variant="outline"
|
|
205
|
+
// Secondary action
|
|
206
|
+
<Button color="base" variant="outline">Cancel</Button>
|
|
194
207
|
|
|
195
|
-
//
|
|
196
|
-
<Button variant="skeleton"
|
|
208
|
+
// Text only
|
|
209
|
+
<Button variant="skeleton">View details</Button>
|
|
197
210
|
|
|
198
|
-
//
|
|
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`
|
|
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="
|
|
217
|
-
<IconButton color="primary" label="
|
|
229
|
+
<IconButton color="transparent" label="Copy"><CopyIcon /></IconButton>
|
|
230
|
+
<IconButton color="primary" label="Send"><SendIcon /></IconButton>
|
|
218
231
|
|
|
219
|
-
//
|
|
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
|
-
|
|
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"
|
|
255
|
+
<div className="p-8">Card content</div>
|
|
243
256
|
</Card>
|
|
244
257
|
|
|
245
|
-
//
|
|
258
|
+
// Clickable card (interactive scales it up on hover)
|
|
246
259
|
<Card variant="shadow" interactive>
|
|
247
|
-
<div className="p-8"
|
|
260
|
+
<div className="p-8">Content</div>
|
|
248
261
|
</Card>
|
|
249
262
|
```
|
|
250
263
|
|
|
251
|
-
###
|
|
264
|
+
### Forms
|
|
252
265
|
|
|
253
|
-
`FormControl`
|
|
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="
|
|
277
|
+
<FormControl label="Email" required renderInput={(props) => (
|
|
265
278
|
<TextField {...props} placeholder="example@mail.com" />
|
|
266
279
|
)} />
|
|
267
280
|
|
|
268
|
-
<FormControl label="
|
|
281
|
+
<FormControl label="Category" renderInput={(props) => (
|
|
269
282
|
<Select
|
|
270
283
|
{...props}
|
|
271
|
-
options={[{ value: '1', label: '
|
|
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}
|
|
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
|
-
##
|
|
300
|
+
## Anti-patterns: avoiding "AI slop"
|
|
288
301
|
|
|
289
|
-
AI
|
|
302
|
+
Avoid the traits that make a UI recognizably AI-generated at a glance.
|
|
290
303
|
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
294
|
-
| Card in Card
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
| Inter
|
|
298
|
-
|
|
|
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
|
-
>
|
|
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
|
-
-
|
|
309
|
-
-
|
|
310
|
-
-
|
|
311
|
-
-
|
|
312
|
-
-
|
|
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
|
-
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
-
|
|
320
|
-
-
|
|
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
|
-
-
|
|
323
|
-
- AI
|
|
324
|
-
-
|
|
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
|
-
>
|
|
4
|
-
>
|
|
5
|
-
> (json-render & OpenUI) that let an LLM generate, validate, and render
|
|
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"],
|