@k2b/ui 0.65.0 → 0.66.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 +47 -0
- package/dist/browser/v2/button.js +180 -0
- package/dist/browser/v2/button.js.map +1 -0
- package/dist/browser/v2/components.js +763 -0
- package/dist/browser/v2/components.js.map +1 -0
- package/dist/browser/v2/content.js +1107 -0
- package/dist/browser/v2/content.js.map +1 -0
- package/dist/browser/v2/controls.js +568 -0
- package/dist/browser/v2/controls.js.map +1 -0
- package/dist/browser/v2/describe.js +397 -0
- package/dist/browser/v2/describe.js.map +1 -0
- package/dist/browser/v2/index.js +25 -0
- package/dist/browser/v2/index.js.map +1 -0
- package/dist/browser/v2/layout.js +578 -0
- package/dist/browser/v2/layout.js.map +1 -0
- package/dist/browser/v2/link.js +9 -0
- package/dist/browser/v2/link.js.map +1 -0
- package/dist/browser/v2/marks.js +211 -0
- package/dist/browser/v2/marks.js.map +1 -0
- package/dist/browser/v2/states.js +180 -0
- package/dist/browser/v2/states.js.map +1 -0
- package/dist/browser/v2/structure.js +328 -0
- package/dist/browser/v2/structure.js.map +1 -0
- package/dist/browser/v2/testing/index.js +23 -0
- package/dist/browser/v2/testing/index.js.map +1 -0
- package/dist/browser/v2/testing/measure-v2-layout.js +762 -0
- package/dist/browser/v2/testing/measure-v2-layout.js.map +1 -0
- package/dist/browser/v2/testing/settled.js +52 -0
- package/dist/browser/v2/testing/settled.js.map +1 -0
- package/dist/browser/v2/tokens.js +83 -0
- package/dist/browser/v2/tokens.js.map +1 -0
- package/dist/browser/v2/types.js +24 -0
- package/dist/browser/v2/types.js.map +1 -0
- package/dist/ssr/v2/button.js +177 -0
- package/dist/ssr/v2/button.js.map +1 -0
- package/dist/ssr/v2/components.js +518 -0
- package/dist/ssr/v2/components.js.map +1 -0
- package/dist/ssr/v2/content.js +727 -0
- package/dist/ssr/v2/content.js.map +1 -0
- package/dist/ssr/v2/controls.js +268 -0
- package/dist/ssr/v2/controls.js.map +1 -0
- package/dist/ssr/v2/describe.js +397 -0
- package/dist/ssr/v2/describe.js.map +1 -0
- package/dist/ssr/v2/index.js +25 -0
- package/dist/ssr/v2/index.js.map +1 -0
- package/dist/ssr/v2/layout.js +377 -0
- package/dist/ssr/v2/layout.js.map +1 -0
- package/dist/ssr/v2/link.js +9 -0
- package/dist/ssr/v2/link.js.map +1 -0
- package/dist/ssr/v2/marks.js +126 -0
- package/dist/ssr/v2/marks.js.map +1 -0
- package/dist/ssr/v2/states.js +128 -0
- package/dist/ssr/v2/states.js.map +1 -0
- package/dist/ssr/v2/structure.js +229 -0
- package/dist/ssr/v2/structure.js.map +1 -0
- package/dist/ssr/v2/testing/index.js +23 -0
- package/dist/ssr/v2/testing/index.js.map +1 -0
- package/dist/ssr/v2/testing/measure-v2-layout.js +762 -0
- package/dist/ssr/v2/testing/measure-v2-layout.js.map +1 -0
- package/dist/ssr/v2/testing/settled.js +52 -0
- package/dist/ssr/v2/testing/settled.js.map +1 -0
- package/dist/ssr/v2/tokens.js +83 -0
- package/dist/ssr/v2/tokens.js.map +1 -0
- package/dist/ssr/v2/types.js +24 -0
- package/dist/ssr/v2/types.js.map +1 -0
- package/dist/types/v2/button.d.ts +54 -0
- package/dist/types/v2/components.d.ts +173 -0
- package/dist/types/v2/content.d.ts +233 -0
- package/dist/types/v2/controls.d.ts +118 -0
- package/dist/types/v2/describe.d.ts +18 -0
- package/dist/types/v2/index.d.ts +22 -0
- package/dist/types/v2/layout.d.ts +124 -0
- package/dist/types/v2/link.d.ts +7 -0
- package/dist/types/v2/marks.d.ts +90 -0
- package/dist/types/v2/states.d.ts +45 -0
- package/dist/types/v2/structure.d.ts +47 -0
- package/dist/types/v2/testing/index.d.ts +16 -0
- package/dist/types/v2/testing/measure-v2-layout.d.ts +99 -0
- package/dist/types/v2/testing/settled.d.ts +13 -0
- package/dist/types/v2/tokens.d.ts +77 -0
- package/dist/types/v2/types.d.ts +44 -0
- package/dist/v2.css +3072 -0
- package/package.json +23 -4
- package/skills/k2b-ui/SKILL.md +201 -0
- package/skills/k2b-ui/images/form-1440.png +0 -0
- package/skills/k2b-ui/images/form-390.png +0 -0
- package/skills/k2b-ui/images/list-detail-1440.png +0 -0
- package/skills/k2b-ui/images/list-detail-390.png +0 -0
- package/skills/k2b-ui/images/mail-1440.png +0 -0
- package/skills/k2b-ui/images/mail-390.png +0 -0
- package/skills/k2b-ui/images/record-1440.png +0 -0
- package/skills/k2b-ui/images/record-390.png +0 -0
- package/skills/k2b-ui/images/record-groups-1440.png +0 -0
- package/skills/k2b-ui/images/record-groups-390.png +0 -0
- package/skills/k2b-ui/images/table-1440.png +0 -0
- package/skills/k2b-ui/images/table-390.png +0 -0
- package/skills/k2b-ui/recipes/form.tsx +54 -0
- package/skills/k2b-ui/recipes/list-detail.tsx +105 -0
- package/skills/k2b-ui/recipes/mail.tsx +193 -0
- package/skills/k2b-ui/recipes/record-groups.tsx +115 -0
- package/skills/k2b-ui/recipes/record.tsx +163 -0
- package/skills/k2b-ui/recipes/table.tsx +68 -0
- package/skills/k2b-ui/references/mistakes.md +162 -0
- package/skills/k2b-ui/references/primitives.md +310 -0
- package/skills/k2b-ui/references/recipes.md +101 -0
- package/skills/k2b-ui/references/seeing.md +94 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@k2b/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.66.0",
|
|
4
4
|
"description": "Production-ready components for SolidJS applications.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -72,6 +72,18 @@
|
|
|
72
72
|
"import": "./dist/ssr/panes.js",
|
|
73
73
|
"default": "./dist/ssr/panes.js"
|
|
74
74
|
},
|
|
75
|
+
"./v2": {
|
|
76
|
+
"types": "./dist/types/v2/index.d.ts",
|
|
77
|
+
"browser": "./dist/browser/v2/index.js",
|
|
78
|
+
"import": "./dist/ssr/v2/index.js",
|
|
79
|
+
"default": "./dist/ssr/v2/index.js"
|
|
80
|
+
},
|
|
81
|
+
"./v2/testing": {
|
|
82
|
+
"types": "./dist/types/v2/testing/index.d.ts",
|
|
83
|
+
"import": "./dist/ssr/v2/testing/index.js",
|
|
84
|
+
"default": "./dist/ssr/v2/testing/index.js"
|
|
85
|
+
},
|
|
86
|
+
"./v2.css": "./dist/v2.css",
|
|
75
87
|
"./package.json": "./package.json",
|
|
76
88
|
"./map-glyphs/*": "./map-glyphs/*",
|
|
77
89
|
"./text-editor": {
|
|
@@ -95,6 +107,7 @@
|
|
|
95
107
|
"files": [
|
|
96
108
|
"dist",
|
|
97
109
|
"map-glyphs",
|
|
110
|
+
"skills",
|
|
98
111
|
"README.md"
|
|
99
112
|
],
|
|
100
113
|
"scripts": {
|
|
@@ -130,12 +143,18 @@
|
|
|
130
143
|
},
|
|
131
144
|
"peerDependencies": {
|
|
132
145
|
"@k2b/ssr": "^0.12.0 || ^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0 || ^0.19.0 || ^0.20.0 || ^0.21.0 || ^0.22.0 || ^0.23.0",
|
|
133
|
-
"solid-js": "^1.9.10"
|
|
146
|
+
"solid-js": "^1.9.10",
|
|
147
|
+
"playwright": "^1.50.0"
|
|
148
|
+
},
|
|
149
|
+
"peerDependenciesMeta": {
|
|
150
|
+
"playwright": {
|
|
151
|
+
"optional": true
|
|
152
|
+
}
|
|
134
153
|
},
|
|
135
154
|
"devDependencies": {
|
|
136
155
|
"@babel/core": "8.1.0",
|
|
137
156
|
"@babel/preset-typescript": "8.0.7",
|
|
138
|
-
"@k2b/ssr": "0.23.
|
|
157
|
+
"@k2b/ssr": "0.23.2",
|
|
139
158
|
"@types/babel__core": "7.20.5",
|
|
140
159
|
"@types/bun": "1.4.2",
|
|
141
160
|
"axe-core": "4.14.0",
|
|
@@ -145,7 +164,7 @@
|
|
|
145
164
|
"happy-dom": "20.14.5",
|
|
146
165
|
"hono": "4.13.17",
|
|
147
166
|
"playwright": "1.65.0",
|
|
148
|
-
"seroval": "1.6.
|
|
167
|
+
"seroval": "1.6.12",
|
|
149
168
|
"solid-js": "1.9.18",
|
|
150
169
|
"tailwindcss": "4.3.5",
|
|
151
170
|
"typescript": "7.0.2",
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: k2b-ui
|
|
3
|
+
description: >
|
|
4
|
+
Build screens with @k2b/ui/v2, the primitives that own spacing, lines and
|
|
5
|
+
type so an application writes no layout CSS. Use this skill whenever code
|
|
6
|
+
imports from @k2b/ui/v2 or a task asks for a new or rebuilt screen in a
|
|
7
|
+
Cloud application or another SolidJS app on @k2b/ui: workspaces, sidebars,
|
|
8
|
+
heads, status rows, lists, tables, records, groups, forms, notices, mail-like
|
|
9
|
+
readers. Covers which primitive to pick, the rules and why, recipes with
|
|
10
|
+
code and picture, the messages of the checks with their fixes, and how to
|
|
11
|
+
see what you built (describeV2 outline, layout measurement, screenshot).
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Build screens with @k2b/ui v2
|
|
15
|
+
|
|
16
|
+
v2 primitives own spacing, hairlines, heights and type. An application only
|
|
17
|
+
chooses **which** primitive stands **where** and fills it with data. There is
|
|
18
|
+
no `class`, `style`, `size` or `gap` to tune, and no app CSS outside `Canvas`.
|
|
19
|
+
That is the point: two agents building the same screen get the same result.
|
|
20
|
+
|
|
21
|
+
`@k2b/ui/v2` is **provisional** until the maintainer approves it. Names and
|
|
22
|
+
props may change in any release; check the types of the installed version.
|
|
23
|
+
|
|
24
|
+
## Start here
|
|
25
|
+
|
|
26
|
+
1. Find the screen in the task table below and open its recipe in
|
|
27
|
+
`recipes/` (code) and `images/` (picture at 1440 and 390 px). Read
|
|
28
|
+
[recipes](references/recipes.md) for what each one shows.
|
|
29
|
+
2. Copy the recipe, keep its structure, replace the data. Change the
|
|
30
|
+
arrangement only where the task really differs.
|
|
31
|
+
3. Check it, cheapest first (see "See what you built"). Fix every finding
|
|
32
|
+
before you look at a picture.
|
|
33
|
+
4. Something has no primitive? Do not write CSS or a wrapper. Use the
|
|
34
|
+
nearest primitive, write `// k2b-ui gap: <what is missing>` at that
|
|
35
|
+
place, and name the gap in your report.
|
|
36
|
+
|
|
37
|
+
Read [primitives](references/primitives.md) for every prop and place,
|
|
38
|
+
[mistakes](references/mistakes.md) when a check reports something, and
|
|
39
|
+
[seeing](references/seeing.md) for the feedback tools.
|
|
40
|
+
|
|
41
|
+
## Set up
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { Workspace, Pane, Bar, List, Row } from "@k2b/ui/v2";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
- Styles: `@k2b/ui/v2.css`. Every v2 class lives under the scope class
|
|
48
|
+
`k2-ui` on an ancestor, never set by a screen.
|
|
49
|
+
- In a Cloud app, a page opts in with `ui: "v2"` on its layout; the layout
|
|
50
|
+
puts `k2-ui` on the page's main area and loads v2.css with the app's accent
|
|
51
|
+
tokens. Outside Cloud, the page template puts `class="k2-ui"` on `<body>`
|
|
52
|
+
and loads `@k2b/ui/v2.css`.
|
|
53
|
+
- A screen is a component that returns one `Workspace`.
|
|
54
|
+
- Strings come from the app's message catalog; recipes inline German sample
|
|
55
|
+
text only to look like the real thing.
|
|
56
|
+
|
|
57
|
+
## What to use for what
|
|
58
|
+
|
|
59
|
+
| You want to show | Use | Recipe |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| an app's frame: sidebar, head, columns | `Workspace` with `sidebar`, `head`, `primary` | all |
|
|
62
|
+
| the app's sections in the sidebar | `Nav` | `list-detail.tsx` |
|
|
63
|
+
| views of the page, or areas of a record | `Tabs` (in the head `Bar`, or as `Pane` head) | `mail.tsx`, `record.tsx` |
|
|
64
|
+
| where a sub-page stands | `Path` in the head `Bar start` | – |
|
|
65
|
+
| the one main statement and key figures | `StatusRow` in `Pane status` | `table.tsx` |
|
|
66
|
+
| many like things, one per line | `List` of `Row` | `mail.tsx` |
|
|
67
|
+
| many like things with columns | `Table` | `table.tsx` |
|
|
68
|
+
| a large table: select rows, groups, sticky first column | `Table` with `rowKey`, `select`, `group`, `sticky`; `StatusRow selection` | – |
|
|
69
|
+
| a list beside the open entry | `Pane.Split` with a `Pane detail` | `list-detail.tsx` |
|
|
70
|
+
| a record (customer, contact) | `RecordHead` in the head, `Tabs`, `Pane side` | `record.tsx` |
|
|
71
|
+
| 2–4 key numbers side by side | `Cells` with `Cells.Cell` | `record.tsx` |
|
|
72
|
+
| a titled part of a page | `Section` (title, count, ≤ 2 actions, `more`) | `record.tsx` |
|
|
73
|
+
| what belongs together (a delivery, a thread) | `Group`; `folded` when done | `record-groups.tsx` |
|
|
74
|
+
| the way of a thing (arrived → … → paid) | `Steps` | `record-groups.tsx` |
|
|
75
|
+
| the newest few on a first page | `Digest` | `record.tsx` |
|
|
76
|
+
| labels with values | `Facts` (`inline` for one line) | `record.tsx` |
|
|
77
|
+
| something wrong, waiting, a person's note, an AI summary | `Notice` with `tone` (`bad`, `warn`, `note`, `ai`) | `list-detail.tsx` |
|
|
78
|
+
| one statement that stands out in a column (not a message) | `Band tone` with `Text` | – |
|
|
79
|
+
| something that needs this person | `Row yours` or `Chip yours` | `record-groups.tsx` |
|
|
80
|
+
| a form | `Field` / `Field.Row` with `Input`, `Select`, `DateInput`, `Check`, `Choice` | `form.tsx` |
|
|
81
|
+
| reading text, an email body | `Prose` | `mail.tsx` |
|
|
82
|
+
| attachments, like things to press | `Tiles` | `mail.tsx` |
|
|
83
|
+
| a state, tag, amount, count | `Chip` | `table.tsx` |
|
|
84
|
+
| a free drawing (map, chart) | `Canvas` inside a primitive | `record.tsx` |
|
|
85
|
+
| nothing to show (yet) | `Empty` where the data would stand; a table takes `empty` | `table.tsx` |
|
|
86
|
+
| data still loading | `Loading` where the list will stand; a table takes `loading` | – |
|
|
87
|
+
| data that failed to load once | `Failed` with "Erneut versuchen", in place of the data only | – |
|
|
88
|
+
| a search in a head or status row | `Input type="search"` with `icon`, `onKeyDown`, `ref`, `end` | – |
|
|
89
|
+
| a link that opens in place | `href` plus `onNavigate` on rows, tabs, nav entries, actions, buttons, chips | – |
|
|
90
|
+
|
|
91
|
+
## The rules, and why
|
|
92
|
+
|
|
93
|
+
1. **One way per task.** Each need above has one primitive. A second way
|
|
94
|
+
is how screens drift apart.
|
|
95
|
+
2. **Primitives own spacing, lines and type.** You never pick a gap, a
|
|
96
|
+
padding or a font size. The checks fail the build otherwise.
|
|
97
|
+
3. **Fixed places, not free children.** Slots such as `head`, `status`,
|
|
98
|
+
`sidebar`, `start`, `end`, `actions`, `marks` say where a thing goes. A
|
|
99
|
+
plain `<div>` in a `Pane` is a finding.
|
|
100
|
+
4. **Variants only for meaning.** `tone`, `status`, `variant` say ok,
|
|
101
|
+
waiting, wrong, AI, yours. Size comes from the place.
|
|
102
|
+
5. **Wrong fails at once.** Types reject a missing label; the rule and
|
|
103
|
+
`describeV2` name the fix.
|
|
104
|
+
6. **Recipes for whole screens.** Copy one instead of composing from
|
|
105
|
+
scratch.
|
|
106
|
+
7. **Rows and columns stay dense.** In a table with column `width`s, long
|
|
107
|
+
text is cut with "…" and the row keeps its height; columns that matter
|
|
108
|
+
less `drop` on the phone, and a table wider than a phone gets
|
|
109
|
+
`phone(row)` (two-line rows). A small table without widths (a few rows
|
|
110
|
+
in a group) wraps its cells instead; keep its texts short.
|
|
111
|
+
8. **Round is what you press; square is what structures.** Buttons, chips,
|
|
112
|
+
inputs and tiles are round; panes, bands, sections, groups are square.
|
|
113
|
+
9. **Lines separate groups, not entries or the parts of one thing.** No
|
|
114
|
+
line under a section head, none between its entries, none inside a
|
|
115
|
+
`Group`.
|
|
116
|
+
|
|
117
|
+
One primary action per page: the filled `Button variant="primary"` in the
|
|
118
|
+
head, mirrored as `Workspace primary` so the phone shows it. A form page
|
|
119
|
+
without a head action has its "Save" as the one primary in its footer
|
|
120
|
+
`Bar`; a form shown beside a page that has a head primary saves with a
|
|
121
|
+
default (framed) button.
|
|
122
|
+
|
|
123
|
+
What a list has open belongs in the address: render the `Pane detail` only
|
|
124
|
+
while the address names an entry, give its `back` an `href` to the list
|
|
125
|
+
without that entry, and make rows open with `href` (plus `onNavigate` to
|
|
126
|
+
open in place). Reload, back and forward then show the same page.
|
|
127
|
+
|
|
128
|
+
"Erneut versuchen" belongs to one place only: `Failed`, standing where data
|
|
129
|
+
that failed to load once would stand. A connection that retries on its own
|
|
130
|
+
says so in the `StatusRow` without a button; something a person must fix is
|
|
131
|
+
a `Notice` that names the deed.
|
|
132
|
+
|
|
133
|
+
## Primitives in one line each
|
|
134
|
+
|
|
135
|
+
- **Frame:** `Workspace` (sidebar, head, primary), `Pane` (head, status,
|
|
136
|
+
`width`, `detail`, `side`), `Pane.Split`, `Bar` (start, end), `Band`
|
|
137
|
+
(`tone`), `Cells`, `Tiles`, `Canvas`.
|
|
138
|
+
- **Structure:** `Section`, `Group`.
|
|
139
|
+
- **Content:** `List`, `Row`, `Table`, `Facts`, `Text` (`type` meta, row,
|
|
140
|
+
body, lead), `Prose`, `Inline`, `Icon`, `Avatar`, `Chip`, `Progress`,
|
|
141
|
+
`Steps`.
|
|
142
|
+
- **Controls:** `Button`, `Field`, `Field.Row`, `Input`, `Select`,
|
|
143
|
+
`DateInput`, `Check`, `Choice`.
|
|
144
|
+
- **Components:** `Nav`, `Tabs`, `Path`, `StatusRow`, `Notice`, `Digest`,
|
|
145
|
+
`RecordHead`.
|
|
146
|
+
- **States:** `Empty`, `Loading`, `Failed`.
|
|
147
|
+
- **Tools:** `describeV2`, the tokens (`typeRoles`, `heights`, `textEdge`),
|
|
148
|
+
and `@k2b/ui/v2/testing` for Playwright tests.
|
|
149
|
+
|
|
150
|
+
Not there yet (write a `k2b-ui gap` comment, never a replacement):
|
|
151
|
+
`Dialog`, `Menu`, `Popover`, `Tooltip`, `Toast` (their behaviour exists
|
|
152
|
+
inside `@k2b/ui`, the v2 components follow), filter components, the mail
|
|
153
|
+
and chat composer (comes from `@k2b/editor`), and an assistant message or
|
|
154
|
+
answer card.
|
|
155
|
+
How to stand in until then: a dialog is a `Pane detail` (see
|
|
156
|
+
[primitives](references/primitives.md), "Pane.Split"); filters are a
|
|
157
|
+
`Button variant="ghost" menu` or pressed `Chip`s in `StatusRow filters`,
|
|
158
|
+
or a ghost icon button in a search field's `end`.
|
|
159
|
+
|
|
160
|
+
## See what you built
|
|
161
|
+
|
|
162
|
+
Cheapest first; stop at the first step that finds something, fix, repeat.
|
|
163
|
+
|
|
164
|
+
1. **Types** reject wrong props (a `Button` with only an icon and no
|
|
165
|
+
`label`, a `Chip` with two kinds).
|
|
166
|
+
2. **The rule `v2-app-layout-css`** (`bun run check` in the Cloud monorepo)
|
|
167
|
+
reports `class`, `style`, spreads and stylesheets outside `Canvas`.
|
|
168
|
+
3. **The outline** from `describeV2` lists every part with its text and
|
|
169
|
+
count, and ends with `Problems` when something is off. About 30 lines,
|
|
170
|
+
no picture.
|
|
171
|
+
4. **The layout measurement** (`measureV2Layout`) checks edges, double
|
|
172
|
+
lines, type roles and grips at 1440 and 390 px.
|
|
173
|
+
5. **A screenshot** only when the outline leaves a doubt.
|
|
174
|
+
|
|
175
|
+
In the Cloud monorepo one command runs all five on a screen file:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
bun packages/ui/scripts/v2-preview.ts path/to/screen.tsx --text # 1-3, no browser
|
|
179
|
+
bun packages/ui/scripts/v2-preview.ts path/to/screen.tsx --png out # 1-5
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Details, the outline format and use outside the monorepo:
|
|
183
|
+
[seeing](references/seeing.md).
|
|
184
|
+
|
|
185
|
+
## Most common mistakes
|
|
186
|
+
|
|
187
|
+
| Finding | Fix |
|
|
188
|
+
| --- | --- |
|
|
189
|
+
| `class on <div> in a v2 screen` | delete it; pick the primitive that owns that look |
|
|
190
|
+
| `plain <div> in Pane` | put the content in `Band`, `Section`, `Group`, `List`, `Table` or `Notice` |
|
|
191
|
+
| `loose text in Pane` | wrap it in `<Text>` |
|
|
192
|
+
| `Button … stands alone in Pane` | move it into a `Bar end`, `Row action`, `Section actions` or `Notice actions` |
|
|
193
|
+
| `2 primary buttons` | keep one `primary`; the others are default or `ghost` |
|
|
194
|
+
| `primary action is hidden at this width` | add `Workspace primary` |
|
|
195
|
+
| `floating main action … covers …` | the form leaves on the phone: put it in a `Pane detail` or its own route |
|
|
196
|
+
| `Table … wider than its column` | give the table `phone(row)`; give a `Pane detail` beside it a `width` |
|
|
197
|
+
| `Group … stands in another Group` | flatten: one `Section`, several `Group`s |
|
|
198
|
+
| a line under a section head | remove your own divider; `Section` draws the one line |
|
|
199
|
+
| icon button without a name (type error) | give `label="…"` |
|
|
200
|
+
|
|
201
|
+
More, with before and after: [mistakes](references/mistakes.md).
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Recipe: a form with a required field, a range limit, an error from the server at its field, and a conflict that
|
|
2
|
+
// blocks saving. The form state lives in the app; the primitives only show it. (Dialog comes with the behaviour layer;
|
|
3
|
+
// until then a form stands in its own pane.)
|
|
4
|
+
import { Band, Bar, Button, Check, Choice, Field, Input, Notice, Pane, Select, Text, Workspace } from "@k2b/ui/v2";
|
|
5
|
+
|
|
6
|
+
type Errors = Partial<Record<"name" | "interval" | "url", string>>;
|
|
7
|
+
|
|
8
|
+
// What the server answered on the last save: one error at its field, one conflict for the whole form.
|
|
9
|
+
const errors: Errors = { url: "Diese Adresse antwortet nicht (HTTP 404).", interval: "Mindestens 60 Sekunden." };
|
|
10
|
+
const conflict = true;
|
|
11
|
+
|
|
12
|
+
export default function SourceForm() {
|
|
13
|
+
return (
|
|
14
|
+
<Workspace head={<Bar start={<Text type="body">Neue Quelle</Text>} />}>
|
|
15
|
+
<Pane label="Neue Quelle">
|
|
16
|
+
{conflict && (
|
|
17
|
+
<Notice tone="warn" title="Inzwischen geändert" actions={[{ label: "Neu laden", icon: "refresh" }]}>
|
|
18
|
+
Ada Renz hat diese Quelle um 09:41 geändert. Lade neu, bevor du speicherst.
|
|
19
|
+
</Notice>
|
|
20
|
+
)}
|
|
21
|
+
<Band>
|
|
22
|
+
<Field name="name" label="Name" hint="So erscheint die Quelle in der Liste." error={errors.name}>
|
|
23
|
+
<Input value="Lackfabrik Nordhaus" />
|
|
24
|
+
</Field>
|
|
25
|
+
<Field.Row>
|
|
26
|
+
<Field name="kind" label="Art">
|
|
27
|
+
<Select options={["Webhook", "Abruf"]} value="Abruf" />
|
|
28
|
+
</Field>
|
|
29
|
+
<Field name="interval" label="Intervall" optional="Sekunden" error={errors.interval}>
|
|
30
|
+
<Input type="number" value="30" min={60} max={86400} />
|
|
31
|
+
</Field>
|
|
32
|
+
</Field.Row>
|
|
33
|
+
<Field name="url" label="Adresse" error={errors.url}>
|
|
34
|
+
<Input type="url" value="https://nordhaus.example/hook" />
|
|
35
|
+
</Field>
|
|
36
|
+
</Band>
|
|
37
|
+
<Band>
|
|
38
|
+
<Choice name="notify" label="Benachrichtigen" options={["Bei jedem Fehler", "Einmal am Tag"]} value="Bei jedem Fehler" />
|
|
39
|
+
<Check name="active" switch label="Sofort aktiv" checked />
|
|
40
|
+
</Band>
|
|
41
|
+
<Bar
|
|
42
|
+
end={
|
|
43
|
+
<>
|
|
44
|
+
<Button href="#">Abbrechen</Button>
|
|
45
|
+
<Button variant="primary" type="submit" disabled={conflict}>
|
|
46
|
+
Speichern
|
|
47
|
+
</Button>
|
|
48
|
+
</>
|
|
49
|
+
}
|
|
50
|
+
/>
|
|
51
|
+
</Pane>
|
|
52
|
+
</Workspace>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Recipe: list with detail. A sidebar, a head with views and the main action, a list beside the open entry.
|
|
2
|
+
// On the phone the detail pane leaves; open the entry as its own page (its own route) there.
|
|
3
|
+
import { Bar, Button, Chip, Facts, List, Nav, Notice, Pane, Row, Section, StatusRow, Tabs, Text, Workspace } from "@k2b/ui/v2";
|
|
4
|
+
|
|
5
|
+
type Source = { id: string; name: string; kind: string; seen: string; state: "ok" | "warn" | "bad" };
|
|
6
|
+
|
|
7
|
+
const sources: Source[] = [
|
|
8
|
+
{ id: "s1", name: "Lackfabrik Nordhaus", kind: "Webhook", seen: "09:42", state: "ok" },
|
|
9
|
+
{ id: "s2", name: "Holzwerk Brandt", kind: "Abruf alle 5 min", seen: "gestern", state: "bad" },
|
|
10
|
+
{ id: "s3", name: "Spedition Kraus", kind: "Webhook", seen: "08:10", state: "ok" },
|
|
11
|
+
];
|
|
12
|
+
const stateLabel = { ok: "Aktiv", warn: "Wartet", bad: "Gestört" } as const;
|
|
13
|
+
const open = sources[1]!;
|
|
14
|
+
|
|
15
|
+
export default function SourcesScreen() {
|
|
16
|
+
return (
|
|
17
|
+
<Workspace
|
|
18
|
+
sidebar={
|
|
19
|
+
<Nav
|
|
20
|
+
title="Pulse"
|
|
21
|
+
icon="activity"
|
|
22
|
+
groups={[
|
|
23
|
+
{
|
|
24
|
+
items: [
|
|
25
|
+
{ label: "Quellen", icon: "plug", current: true, count: sources.length },
|
|
26
|
+
{ label: "Ereignisse", icon: "list" },
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
]}
|
|
30
|
+
/>
|
|
31
|
+
}
|
|
32
|
+
head={
|
|
33
|
+
<Bar
|
|
34
|
+
start={
|
|
35
|
+
<Tabs
|
|
36
|
+
label="Ansichten"
|
|
37
|
+
items={[
|
|
38
|
+
{ label: "Alle", count: 3, current: true },
|
|
39
|
+
{ label: "Gestört", count: 1 },
|
|
40
|
+
]}
|
|
41
|
+
/>
|
|
42
|
+
}
|
|
43
|
+
end={
|
|
44
|
+
<Button variant="primary" icon="plus">
|
|
45
|
+
Neue Quelle
|
|
46
|
+
</Button>
|
|
47
|
+
}
|
|
48
|
+
/>
|
|
49
|
+
}
|
|
50
|
+
primary={{ label: "Neue Quelle", icon: "plus" }}
|
|
51
|
+
>
|
|
52
|
+
<Pane.Split>
|
|
53
|
+
<Pane
|
|
54
|
+
label="Quellen"
|
|
55
|
+
width={{ min: 320, default: 400 }}
|
|
56
|
+
status={<StatusRow lead="3 Quellen" facts={[{ value: 1, after: "gestört" }]} />}
|
|
57
|
+
>
|
|
58
|
+
<List label="Quellen">
|
|
59
|
+
{sources.map((source) => (
|
|
60
|
+
<Row
|
|
61
|
+
icon="plug"
|
|
62
|
+
lines={[source.name, source.kind]}
|
|
63
|
+
time={source.seen}
|
|
64
|
+
selected={source.id === open.id}
|
|
65
|
+
href={`#${source.id}`}
|
|
66
|
+
/>
|
|
67
|
+
))}
|
|
68
|
+
</List>
|
|
69
|
+
</Pane>
|
|
70
|
+
<Pane
|
|
71
|
+
detail
|
|
72
|
+
label={open.name}
|
|
73
|
+
head={
|
|
74
|
+
<Bar
|
|
75
|
+
start={<Text type="lead">{open.name}</Text>}
|
|
76
|
+
end={
|
|
77
|
+
<>
|
|
78
|
+
<Button icon="pencil">Bearbeiten</Button>
|
|
79
|
+
<Button variant="ghost" icon="x" label="Schließen" href="#" />
|
|
80
|
+
</>
|
|
81
|
+
}
|
|
82
|
+
/>
|
|
83
|
+
}
|
|
84
|
+
>
|
|
85
|
+
<Notice tone="bad" title="Antwortet nicht" actions={[{ label: "Erneut prüfen", icon: "refresh" }]}>
|
|
86
|
+
Seit gestern, 17:20 kommen keine Ereignisse an. Prüfe die Adresse oder den Schlüssel.
|
|
87
|
+
</Notice>
|
|
88
|
+
<Section icon="settings" title="Angaben">
|
|
89
|
+
<Facts
|
|
90
|
+
items={[
|
|
91
|
+
{ label: "Art", value: open.kind },
|
|
92
|
+
{ label: "Zustand", value: <Chip status={open.state}>{stateLabel[open.state]}</Chip> },
|
|
93
|
+
{ label: "Schlüssel", value: "pk_7f3a…c21", copy: "pk_7f3a9be0c21" },
|
|
94
|
+
]}
|
|
95
|
+
/>
|
|
96
|
+
</Section>
|
|
97
|
+
<Section icon="list" title="Letzte Ereignisse" count={2} more={{ label: "Alle Ereignisse", forward: true }}>
|
|
98
|
+
<Row icon="alert-circle" lines={["Zeitüberschreitung", "nach 30 s"]} time="gestern" />
|
|
99
|
+
<Row icon="check" lines={["38 Ereignisse angenommen"]} time="Mo." />
|
|
100
|
+
</Section>
|
|
101
|
+
</Pane>
|
|
102
|
+
</Pane.Split>
|
|
103
|
+
</Workspace>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// Recipe: a list with a reader (mail). Three-line rows on the left; the reader shows the thread: a bar with its state,
|
|
2
|
+
// an AI summary, one Band per message with the sender row, the text in Prose and the attachments as Tiles.
|
|
3
|
+
import {
|
|
4
|
+
Avatar,
|
|
5
|
+
Band,
|
|
6
|
+
Bar,
|
|
7
|
+
Button,
|
|
8
|
+
Chip,
|
|
9
|
+
Icon,
|
|
10
|
+
Inline,
|
|
11
|
+
List,
|
|
12
|
+
Nav,
|
|
13
|
+
Notice,
|
|
14
|
+
Pane,
|
|
15
|
+
Prose,
|
|
16
|
+
Row,
|
|
17
|
+
StatusRow,
|
|
18
|
+
Tabs,
|
|
19
|
+
Text,
|
|
20
|
+
Tiles,
|
|
21
|
+
Workspace,
|
|
22
|
+
} from "@k2b/ui/v2";
|
|
23
|
+
|
|
24
|
+
type Thread = {
|
|
25
|
+
id: string;
|
|
26
|
+
from: string;
|
|
27
|
+
subject: string;
|
|
28
|
+
preview: string;
|
|
29
|
+
at: string;
|
|
30
|
+
unread?: boolean;
|
|
31
|
+
count?: number;
|
|
32
|
+
tag?: string;
|
|
33
|
+
files?: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const threads: Thread[] = [
|
|
37
|
+
{
|
|
38
|
+
id: "t1",
|
|
39
|
+
from: "Holzwerk Brandt",
|
|
40
|
+
subject: "Angebot Eichenplatten – Liefertermin",
|
|
41
|
+
preview: "Guten Tag Frau Solberg, die Platten können wir in KW 49 liefern …",
|
|
42
|
+
at: "09:42",
|
|
43
|
+
unread: true,
|
|
44
|
+
count: 3,
|
|
45
|
+
tag: "Angebot",
|
|
46
|
+
files: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "t2",
|
|
50
|
+
from: "Spedition Kraus",
|
|
51
|
+
subject: "Abholung Montag",
|
|
52
|
+
preview: "Wir holen die Paletten am Montag zwischen 8 und 10 Uhr ab.",
|
|
53
|
+
at: "08:15",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "t3",
|
|
57
|
+
from: "Mira Solberg",
|
|
58
|
+
subject: "Re: Rechnung 4471",
|
|
59
|
+
preview: "Danke, ist angekommen. Ich gebe sie heute frei.",
|
|
60
|
+
at: "gestern",
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
const open = threads[0]!;
|
|
64
|
+
|
|
65
|
+
export default function MailScreen() {
|
|
66
|
+
return (
|
|
67
|
+
<Workspace
|
|
68
|
+
sidebar={
|
|
69
|
+
<Nav
|
|
70
|
+
title="Mail"
|
|
71
|
+
icon="mail"
|
|
72
|
+
groups={[
|
|
73
|
+
{
|
|
74
|
+
label: "Postfächer",
|
|
75
|
+
items: [
|
|
76
|
+
{ label: "Posteingang", icon: "inbox", current: true, count: 7 },
|
|
77
|
+
{ label: "Lieferanten", icon: "folder", nested: true },
|
|
78
|
+
{ label: "Gesendet", icon: "send" },
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
]}
|
|
82
|
+
/>
|
|
83
|
+
}
|
|
84
|
+
head={
|
|
85
|
+
<Bar
|
|
86
|
+
start={
|
|
87
|
+
<Tabs
|
|
88
|
+
label="Ansichten"
|
|
89
|
+
items={[
|
|
90
|
+
{ label: "Alle", count: 42, current: true },
|
|
91
|
+
{ label: "Handlungsbedarf", count: 5 },
|
|
92
|
+
]}
|
|
93
|
+
/>
|
|
94
|
+
}
|
|
95
|
+
end={
|
|
96
|
+
<Button variant="primary" icon="pencil">
|
|
97
|
+
Neue Nachricht
|
|
98
|
+
</Button>
|
|
99
|
+
}
|
|
100
|
+
/>
|
|
101
|
+
}
|
|
102
|
+
primary={{ label: "Neue Nachricht", icon: "pencil" }}
|
|
103
|
+
>
|
|
104
|
+
<Pane.Split>
|
|
105
|
+
<Pane
|
|
106
|
+
label="Nachrichten"
|
|
107
|
+
width={{ min: 320, default: 432 }}
|
|
108
|
+
status={
|
|
109
|
+
<StatusRow
|
|
110
|
+
select={{ label: "Alle auswählen" }}
|
|
111
|
+
lead="7 ungelesen"
|
|
112
|
+
facts={[{ before: "Heute", value: 12, after: "erledigt" }]}
|
|
113
|
+
/>
|
|
114
|
+
}
|
|
115
|
+
>
|
|
116
|
+
<List label="Nachrichten">
|
|
117
|
+
{threads.map((thread) => (
|
|
118
|
+
<Row
|
|
119
|
+
unread={thread.unread}
|
|
120
|
+
selected={thread.id === open.id}
|
|
121
|
+
lines={[thread.from, thread.subject, thread.preview]}
|
|
122
|
+
meta={thread.count}
|
|
123
|
+
time={thread.at}
|
|
124
|
+
href={`#${thread.id}`}
|
|
125
|
+
marks={
|
|
126
|
+
<>
|
|
127
|
+
{thread.tag && (
|
|
128
|
+
<Chip tag color="#0f766e">
|
|
129
|
+
{thread.tag}
|
|
130
|
+
</Chip>
|
|
131
|
+
)}
|
|
132
|
+
{thread.files && <Icon name="paperclip" label="Anhang" />}
|
|
133
|
+
</>
|
|
134
|
+
}
|
|
135
|
+
/>
|
|
136
|
+
))}
|
|
137
|
+
</List>
|
|
138
|
+
</Pane>
|
|
139
|
+
<Pane
|
|
140
|
+
detail
|
|
141
|
+
label="Nachricht"
|
|
142
|
+
head={
|
|
143
|
+
<Bar
|
|
144
|
+
start={<Text type="lead">{open.subject}</Text>}
|
|
145
|
+
end={
|
|
146
|
+
<>
|
|
147
|
+
<Button icon="check">Erledigt</Button>
|
|
148
|
+
<Button variant="ghost" icon="archive" label="Archivieren" />
|
|
149
|
+
<Button variant="ghost" icon="dots" label="Weitere Aktionen" />
|
|
150
|
+
</>
|
|
151
|
+
}
|
|
152
|
+
/>
|
|
153
|
+
}
|
|
154
|
+
>
|
|
155
|
+
<Bar
|
|
156
|
+
start={
|
|
157
|
+
<Inline>
|
|
158
|
+
<Text type="meta">3 Nachrichten</Text>
|
|
159
|
+
<Chip status="warn">Wartet auf Antwort</Chip>
|
|
160
|
+
<Chip tag color="#0f766e">
|
|
161
|
+
Angebot
|
|
162
|
+
</Chip>
|
|
163
|
+
</Inline>
|
|
164
|
+
}
|
|
165
|
+
end={<Avatar name="Ada Renz" color="#be123c" />}
|
|
166
|
+
/>
|
|
167
|
+
<Notice tone="ai" title="Kurz gesagt" actions={[{ label: "Bearbeiten" }]}>
|
|
168
|
+
Brandt liefert 14 Eichenplatten in KW 49 und braucht bis Freitag eine Bestätigung.
|
|
169
|
+
</Notice>
|
|
170
|
+
<Band>
|
|
171
|
+
<Row
|
|
172
|
+
avatar={{ name: "Holzwerk Brandt", color: "#57534e" }}
|
|
173
|
+
strong
|
|
174
|
+
lines={["Holzwerk Brandt", "an Mira Solberg · heute, 09:42"]}
|
|
175
|
+
end={
|
|
176
|
+
<>
|
|
177
|
+
<Button variant="ghost" icon="arrow-back-up" label="Antworten" />
|
|
178
|
+
<Button variant="ghost" icon="dots" label="Weitere Aktionen" />
|
|
179
|
+
</>
|
|
180
|
+
}
|
|
181
|
+
/>
|
|
182
|
+
<Prose
|
|
183
|
+
markdown={
|
|
184
|
+
"Guten Tag Frau Solberg,\n\ndie 14 Platten können wir in KW 49 liefern. Bitte bestätigen Sie bis Freitag.\n\nViele Grüße \nJonas Brandt"
|
|
185
|
+
}
|
|
186
|
+
/>
|
|
187
|
+
<Tiles items={[{ icon: "file-type-pdf", title: "Angebot-4471.pdf", meta: "212 KB" }]} more={{ label: "Alle herunterladen" }} />
|
|
188
|
+
</Band>
|
|
189
|
+
</Pane>
|
|
190
|
+
</Pane.Split>
|
|
191
|
+
</Workspace>
|
|
192
|
+
);
|
|
193
|
+
}
|