@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
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Recipe: a record tab with groups. One Section for the area; one Group per thing that belongs together (here a
|
|
2
|
+
// delivery). A finished one is folded to its head. Inside a group: a sentence, its way, a table, facts; no lines, no
|
|
3
|
+
// nesting.
|
|
4
|
+
import { Bar, Button, Chip, Facts, Group, Pane, Progress, RecordHead, Section, Steps, Table, Tabs, Text, Workspace } from "@k2b/ui/v2";
|
|
5
|
+
|
|
6
|
+
type Settlement = { day: string; items: string; when: string; workday: number; amount: string; estimate: boolean };
|
|
7
|
+
|
|
8
|
+
const settlements: Settlement[] = [
|
|
9
|
+
{ day: "15. Nov.", items: "10 Artikel", when: "15. Dez.", workday: 5, amount: "180,00 €", estimate: true },
|
|
10
|
+
{ day: "24. Nov.", items: "8 Artikel", when: "15. Jan.", workday: 0, amount: "offen", estimate: false },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export default function CustomerDeliveries() {
|
|
14
|
+
return (
|
|
15
|
+
<Workspace
|
|
16
|
+
head={
|
|
17
|
+
<Bar
|
|
18
|
+
start={
|
|
19
|
+
<RecordHead
|
|
20
|
+
name="Ottilie Brandner"
|
|
21
|
+
avatar={{ name: "Ottilie Brandner", color: "#1d4ed8" }}
|
|
22
|
+
ids={[{ label: "Kunde", value: "7K4QX" }]}
|
|
23
|
+
/>
|
|
24
|
+
}
|
|
25
|
+
end={
|
|
26
|
+
<Button variant="primary" icon="plus">
|
|
27
|
+
Einlieferung
|
|
28
|
+
</Button>
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
}
|
|
32
|
+
primary={{ label: "Einlieferung", icon: "plus" }}
|
|
33
|
+
>
|
|
34
|
+
<Pane
|
|
35
|
+
label="Kundenakte"
|
|
36
|
+
head={
|
|
37
|
+
<Tabs
|
|
38
|
+
label="Bereiche"
|
|
39
|
+
items={[
|
|
40
|
+
{ label: "Überblick", icon: "layout-grid", href: "#" },
|
|
41
|
+
{ label: "Einlieferungen", icon: "package", count: 3, current: true },
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
44
|
+
}
|
|
45
|
+
>
|
|
46
|
+
<Section
|
|
47
|
+
icon="package"
|
|
48
|
+
color="#c2410c"
|
|
49
|
+
title="Einlieferungen"
|
|
50
|
+
count={3}
|
|
51
|
+
actions={[{ label: "Herausgabe", icon: "package-export" }]}
|
|
52
|
+
summary="18 Artikel laufen, 10 sind ausgelaufen."
|
|
53
|
+
>
|
|
54
|
+
<Group
|
|
55
|
+
icon="package"
|
|
56
|
+
title="EL-2611-00009"
|
|
57
|
+
count={18}
|
|
58
|
+
meta="angekommen 3. Nov. · Post"
|
|
59
|
+
state={<Chip yours>Du bist dran</Chip>}
|
|
60
|
+
actions={[{ label: "Öffnen" }]}
|
|
61
|
+
>
|
|
62
|
+
<Text type="body" weight="strong">
|
|
63
|
+
10 Artikel sind ausgelaufen.
|
|
64
|
+
</Text>
|
|
65
|
+
<Steps
|
|
66
|
+
label="Weg der Einlieferung"
|
|
67
|
+
items={[
|
|
68
|
+
{ label: "Angekommen", meta: "3. Nov.", state: "done" },
|
|
69
|
+
{ label: "Läuft", meta: "10 von 18 ausgelaufen", state: "now" },
|
|
70
|
+
{ label: "Abgerechnet", state: "next" },
|
|
71
|
+
{ label: "Ausgezahlt", state: "next" },
|
|
72
|
+
]}
|
|
73
|
+
/>
|
|
74
|
+
<Table
|
|
75
|
+
label="Abrechnung"
|
|
76
|
+
rows={settlements}
|
|
77
|
+
columns={[
|
|
78
|
+
{ title: "Auslauftag", cell: (row) => ({ lines: [row.day, row.items] }) },
|
|
79
|
+
{
|
|
80
|
+
title: "Abrechnung",
|
|
81
|
+
cell: (row) => ({
|
|
82
|
+
lines: [row.when, <Progress value={row.workday} of={22} label={`Arbeitstag ${row.workday} von 22`} />],
|
|
83
|
+
}),
|
|
84
|
+
},
|
|
85
|
+
{ title: "Auszahlung", align: "end", cell: (row) => ({ lines: [row.amount, row.estimate ? "geschätzt" : ""] }) },
|
|
86
|
+
]}
|
|
87
|
+
/>
|
|
88
|
+
<Facts
|
|
89
|
+
inline
|
|
90
|
+
items={[
|
|
91
|
+
{ label: "Quittung", value: "Q-2611-00009" },
|
|
92
|
+
{ label: "Vertrag", value: "VT-2610-00031" },
|
|
93
|
+
]}
|
|
94
|
+
end={
|
|
95
|
+
<Button variant="text" icon="printer">
|
|
96
|
+
Drucken
|
|
97
|
+
</Button>
|
|
98
|
+
}
|
|
99
|
+
/>
|
|
100
|
+
</Group>
|
|
101
|
+
<Group
|
|
102
|
+
icon="package"
|
|
103
|
+
title="EL-2610-00031"
|
|
104
|
+
count={6}
|
|
105
|
+
meta="angekommen 14. Okt."
|
|
106
|
+
state={<Chip status="warn">Wartet auf Abholung</Chip>}
|
|
107
|
+
>
|
|
108
|
+
<Text>2 Artikel sind nicht verkauft und warten auf Abholung bis 12. Dez.</Text>
|
|
109
|
+
</Group>
|
|
110
|
+
<Group icon="package" title="EL-2609-00017" folded state={<Chip status="ok">Ausgezahlt</Chip>} />
|
|
111
|
+
</Section>
|
|
112
|
+
</Pane>
|
|
113
|
+
</Workspace>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// Recipe: a record (customer file), first tab. RecordHead in the head bar, the record's areas as tabs over the pane,
|
|
2
|
+
// the main column beside a side column with the details. What needs a person comes first ("Anstehend").
|
|
3
|
+
import {
|
|
4
|
+
Bar,
|
|
5
|
+
Button,
|
|
6
|
+
Canvas,
|
|
7
|
+
Cells,
|
|
8
|
+
Chip,
|
|
9
|
+
Digest,
|
|
10
|
+
Facts,
|
|
11
|
+
Nav,
|
|
12
|
+
Notice,
|
|
13
|
+
Pane,
|
|
14
|
+
RecordHead,
|
|
15
|
+
Row,
|
|
16
|
+
Section,
|
|
17
|
+
Tabs,
|
|
18
|
+
Text,
|
|
19
|
+
Workspace,
|
|
20
|
+
} from "@k2b/ui/v2";
|
|
21
|
+
|
|
22
|
+
const area = { money: "#8e1b6f", deliveries: "#c2410c", todo: "#2563eb" };
|
|
23
|
+
|
|
24
|
+
export default function CustomerOverview() {
|
|
25
|
+
return (
|
|
26
|
+
<Workspace
|
|
27
|
+
sidebar={
|
|
28
|
+
<Nav
|
|
29
|
+
title="Kunden"
|
|
30
|
+
icon="users"
|
|
31
|
+
groups={[
|
|
32
|
+
{
|
|
33
|
+
items: [
|
|
34
|
+
{ label: "Alle Kunden", icon: "users", current: true, count: 412 },
|
|
35
|
+
{ label: "Zuletzt", icon: "clock" },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
]}
|
|
39
|
+
/>
|
|
40
|
+
}
|
|
41
|
+
head={
|
|
42
|
+
<Bar
|
|
43
|
+
start={
|
|
44
|
+
<RecordHead
|
|
45
|
+
name="Ottilie Brandner"
|
|
46
|
+
avatar={{ name: "Ottilie Brandner", color: "#1d4ed8" }}
|
|
47
|
+
kinds={["Privat"]}
|
|
48
|
+
ids={[{ label: "Kunde", value: "7K4QX", copy: true }]}
|
|
49
|
+
/>
|
|
50
|
+
}
|
|
51
|
+
end={
|
|
52
|
+
<Button variant="primary" icon="plus" menu>
|
|
53
|
+
Neu
|
|
54
|
+
</Button>
|
|
55
|
+
}
|
|
56
|
+
/>
|
|
57
|
+
}
|
|
58
|
+
primary={{ label: "Neu", icon: "plus" }}
|
|
59
|
+
>
|
|
60
|
+
<Pane
|
|
61
|
+
label="Kundenakte"
|
|
62
|
+
head={
|
|
63
|
+
<Tabs
|
|
64
|
+
label="Bereiche"
|
|
65
|
+
items={[
|
|
66
|
+
{ label: "Überblick", icon: "layout-grid", current: true },
|
|
67
|
+
{ label: "Einlieferungen", icon: "package", count: 4, href: "#einlieferungen" },
|
|
68
|
+
{ label: "Geld", icon: "currency-euro", count: 12, href: "#geld" },
|
|
69
|
+
]}
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
{/* Note and key statements span both columns; the split below holds the main and the side column. */}
|
|
74
|
+
<Notice tone="note" icon="pin" title="Notiz" meta="Ada Renz, 12. Nov." actions={[{ label: "Bearbeiten" }]}>
|
|
75
|
+
Ruft lieber an, als Mails zu schreiben. Abholung nur samstags.
|
|
76
|
+
</Notice>
|
|
77
|
+
<Cells>
|
|
78
|
+
<Cells.Cell
|
|
79
|
+
icon="currency-euro"
|
|
80
|
+
color={area.money}
|
|
81
|
+
label="Geld heute"
|
|
82
|
+
value={<Chip amount="out">532,30 €</Chip>}
|
|
83
|
+
meta="1 Rechnung offen"
|
|
84
|
+
href="#geld"
|
|
85
|
+
/>
|
|
86
|
+
<Cells.Cell
|
|
87
|
+
icon="package"
|
|
88
|
+
color={area.deliveries}
|
|
89
|
+
label="Einlieferungen"
|
|
90
|
+
value="2 laufen"
|
|
91
|
+
meta="Abrechnung am 15. Dez."
|
|
92
|
+
href="#einlieferungen"
|
|
93
|
+
/>
|
|
94
|
+
<Cells.Cell icon="file-text" label="Vertrag" value={<Chip status="ok">Gültig</Chip>} meta="bis 31. Dez. 2027" />
|
|
95
|
+
</Cells>
|
|
96
|
+
<Pane.Split>
|
|
97
|
+
<Pane label="Überblick">
|
|
98
|
+
<Section icon="checklist" color={area.todo} title="Anstehend" count={2} actions={[{ label: "Todo anlegen", icon: "plus" }]}>
|
|
99
|
+
<Row
|
|
100
|
+
yours
|
|
101
|
+
strong
|
|
102
|
+
icon="signature"
|
|
103
|
+
lines={["Quittung wartet auf Unterschrift", "Q-2611-00021 · seit 18. Nov."]}
|
|
104
|
+
action={{ label: "Zur Quittung" }}
|
|
105
|
+
/>
|
|
106
|
+
<Row
|
|
107
|
+
strong
|
|
108
|
+
icon="packages"
|
|
109
|
+
lines={["3 Artikel sind abholbereit", "bis 12. Dez."]}
|
|
110
|
+
action={{ label: "Herausgabe vorbereiten" }}
|
|
111
|
+
/>
|
|
112
|
+
</Section>
|
|
113
|
+
<Section icon="list-details" color={area.deliveries} title="Vorgänge" more={{ label: "Alle Einlieferungen", forward: true }}>
|
|
114
|
+
<Digest
|
|
115
|
+
items={[
|
|
116
|
+
{
|
|
117
|
+
icon: "package",
|
|
118
|
+
color: area.deliveries,
|
|
119
|
+
date: "3. Nov.",
|
|
120
|
+
title: "EL-2611-00009",
|
|
121
|
+
state: { icon: "gavel", label: "Läuft" },
|
|
122
|
+
text: (
|
|
123
|
+
<>
|
|
124
|
+
8 Artikel laufen, die Auktion endet <Text weight="strong">morgen</Text>.
|
|
125
|
+
</>
|
|
126
|
+
),
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
icon: "package",
|
|
130
|
+
color: area.deliveries,
|
|
131
|
+
date: "14. Okt.",
|
|
132
|
+
title: "EL-2610-00031",
|
|
133
|
+
state: { icon: "check", label: "Abgerechnet", tone: "ok" },
|
|
134
|
+
text: "Ausgezahlt am 15. Nov.",
|
|
135
|
+
},
|
|
136
|
+
]}
|
|
137
|
+
/>
|
|
138
|
+
</Section>
|
|
139
|
+
</Pane>
|
|
140
|
+
<Pane side label="Angaben" width={{ min: 280, default: 360 }}>
|
|
141
|
+
<Canvas label="Karte mit der Adresse" height={176}>
|
|
142
|
+
<span />
|
|
143
|
+
</Canvas>
|
|
144
|
+
<Section
|
|
145
|
+
icon="phone"
|
|
146
|
+
title="Kontakt"
|
|
147
|
+
actions={[{ label: "Ändern", icon: "pencil" }]}
|
|
148
|
+
more={{ label: "Alle Angaben", meta: "Bank, Person" }}
|
|
149
|
+
>
|
|
150
|
+
<Facts
|
|
151
|
+
items={[
|
|
152
|
+
{ label: "Telefon", value: "+49 30 5550 142", hint: "Standard", copy: "+49 30 5550 142" },
|
|
153
|
+
{ label: "E-Mail", value: "o.brandner@example.de", copy: "o.brandner@example.de" },
|
|
154
|
+
{ label: "Sprache", value: "Deutsch" },
|
|
155
|
+
]}
|
|
156
|
+
/>
|
|
157
|
+
</Section>
|
|
158
|
+
</Pane>
|
|
159
|
+
</Pane.Split>
|
|
160
|
+
</Pane>
|
|
161
|
+
</Workspace>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Recipe: a table with a status row. The lead says the one main fact, key figures follow, filters sit at the end.
|
|
2
|
+
// Each row opens its invoice and has one deed; on the phone the table becomes two-line rows that open the invoice.
|
|
3
|
+
// With no rows, the table's empty state says so in its place.
|
|
4
|
+
import { Bar, Button, Chip, Pane, StatusRow, Table, Text, Workspace } from "@k2b/ui/v2";
|
|
5
|
+
|
|
6
|
+
type Invoice = { number: string; customer: string; due: string; overdue: boolean; amount: string };
|
|
7
|
+
|
|
8
|
+
const invoices: Invoice[] = [
|
|
9
|
+
{ number: "RE-2611-0042", customer: "Holzwerk Brandt", due: "12. Nov.", overdue: true, amount: "1.280,00 €" },
|
|
10
|
+
{ number: "RE-2611-0047", customer: "Familie Oswald", due: "28. Nov.", overdue: false, amount: "420,50 €" },
|
|
11
|
+
{ number: "RE-2611-0051", customer: "Architekturbüro Winter", due: "2. Dez.", overdue: false, amount: "140,00 €" },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export default function OpenInvoices() {
|
|
15
|
+
return (
|
|
16
|
+
<Workspace head={<Bar start={<Text type="body">Offene Rechnungen</Text>} />}>
|
|
17
|
+
<Pane
|
|
18
|
+
label="Offene Rechnungen"
|
|
19
|
+
status={
|
|
20
|
+
<StatusRow
|
|
21
|
+
lead={`${invoices.length} offen`}
|
|
22
|
+
facts={[
|
|
23
|
+
{ before: "Summe", value: "1.840,50 €" },
|
|
24
|
+
{ value: 1, after: "überfällig" },
|
|
25
|
+
]}
|
|
26
|
+
filters={
|
|
27
|
+
<Button variant="ghost" icon="filter" menu>
|
|
28
|
+
Alle Kunden
|
|
29
|
+
</Button>
|
|
30
|
+
}
|
|
31
|
+
/>
|
|
32
|
+
}
|
|
33
|
+
>
|
|
34
|
+
<Table
|
|
35
|
+
label="Offene Rechnungen"
|
|
36
|
+
rows={invoices}
|
|
37
|
+
// A row opens its invoice by its address; with `onNavigate` beside `href` it would open in place.
|
|
38
|
+
open={(row) => ({ href: `#${row.number}` })}
|
|
39
|
+
empty={{ icon: "receipt", text: "Keine offenen Rechnungen." }}
|
|
40
|
+
// On the phone each invoice is a row of two lines that opens the invoice; six column widths never fit 390 px.
|
|
41
|
+
phone={(row) => ({
|
|
42
|
+
lines: [row.customer, `${row.number} · fällig ${row.due}${row.overdue ? " · überfällig" : ""}`],
|
|
43
|
+
time: row.amount,
|
|
44
|
+
})}
|
|
45
|
+
columns={[
|
|
46
|
+
{ title: "Nummer", width: { min: 120, default: 140 }, cell: (row) => row.number, drop: true },
|
|
47
|
+
{ title: "Kunde", width: { min: 160, default: 240 }, cell: (row) => row.customer },
|
|
48
|
+
{ title: "Fällig", width: { min: 100, default: 120 }, cell: (row) => row.due, drop: true },
|
|
49
|
+
{
|
|
50
|
+
title: "Status",
|
|
51
|
+
width: { min: 120, default: 140 },
|
|
52
|
+
cell: (row) => <Chip status={row.overdue ? "bad" : "warn"}>{row.overdue ? "Überfällig" : "Offen"}</Chip>,
|
|
53
|
+
},
|
|
54
|
+
{ title: "Betrag", width: { min: 100, default: 120 }, align: "end", cell: (row) => row.amount },
|
|
55
|
+
{
|
|
56
|
+
title: "Aktion",
|
|
57
|
+
cell: (row) => (
|
|
58
|
+
<Button variant="text" icon="mail-forward" href={`#remind-${row.number}`}>
|
|
59
|
+
Mahnung senden
|
|
60
|
+
</Button>
|
|
61
|
+
),
|
|
62
|
+
},
|
|
63
|
+
]}
|
|
64
|
+
/>
|
|
65
|
+
</Pane>
|
|
66
|
+
</Workspace>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Mistakes, what reports them, and the fix
|
|
2
|
+
|
|
3
|
+
Each entry: the message (shortened), why it is wrong, the fix. Agents trained
|
|
4
|
+
on Tailwind make the first group most; the second group comes from building
|
|
5
|
+
without a recipe.
|
|
6
|
+
|
|
7
|
+
## Layout written by the app
|
|
8
|
+
|
|
9
|
+
### `class on <div> in a v2 screen` (rule `v2-app-layout-css`)
|
|
10
|
+
|
|
11
|
+
The same for `style`, `classList`, `className`, `{...spread}` on a plain
|
|
12
|
+
element, a `ref` that sets styles, `<style>`, and `import "./x.css"`.
|
|
13
|
+
v2 primitives own spacing and type; a class is a second way to lay out.
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
// wrong
|
|
17
|
+
<div class="flex gap-2 p-4"><Chip status="ok">Aktiv</Chip><Chip tag>Neu</Chip></div>
|
|
18
|
+
// right: in a column or bar
|
|
19
|
+
<Inline><Chip status="ok">Aktiv</Chip><Chip tag>Neu</Chip></Inline>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Padding around a notice, a list or a toolbar is never needed: every band
|
|
23
|
+
already carries the text edge and reaches both column edges.
|
|
24
|
+
|
|
25
|
+
### `innerHTML on <div> … use Prose`
|
|
26
|
+
|
|
27
|
+
Markup brings its own classes. Reading text goes into
|
|
28
|
+
`<Prose markdown={…} />`, which renders safe Markdown.
|
|
29
|
+
|
|
30
|
+
### `<Canvas> stands as the root of a component` / `outside a v2 primitive`
|
|
31
|
+
|
|
32
|
+
`Canvas` takes its size from the primitive around it. Return the drawing
|
|
33
|
+
from your component and place it: `<Band><Canvas label="Karte"><Map
|
|
34
|
+
/></Canvas></Band>`.
|
|
35
|
+
|
|
36
|
+
### `… restyles the v2 class .k2-row` (rule, in an app stylesheet)
|
|
37
|
+
|
|
38
|
+
App CSS may not target `k2-` classes, `data-k2-` attributes or set `--k2-`
|
|
39
|
+
tokens. If a primitive looks wrong, report it as a gap of `@k2b/ui`.
|
|
40
|
+
|
|
41
|
+
## Structure
|
|
42
|
+
|
|
43
|
+
### `plain <div> in Pane "…": no primitive owns it` (outline)
|
|
44
|
+
|
|
45
|
+
Rule 3, fixed places. A wrapper element in a `Pane`, `List`, `Section`,
|
|
46
|
+
`Group`, `Band` or `Workspace` has no edge, no line and no type role.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
// wrong
|
|
50
|
+
<Pane><div><h2>Kontakt</h2><p>+49 30 5550 142</p></div></Pane>
|
|
51
|
+
// right
|
|
52
|
+
<Pane>
|
|
53
|
+
<Section icon="phone" title="Kontakt">
|
|
54
|
+
<Facts items={[{ label: "Telefon", value: "+49 30 5550 142" }]} />
|
|
55
|
+
</Section>
|
|
56
|
+
</Pane>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `loose text "…" in Pane` (outline)
|
|
60
|
+
|
|
61
|
+
Text needs a type role: `<Text>`, `<Text type="body" weight="strong">`, or a
|
|
62
|
+
`Notice` when it is a message.
|
|
63
|
+
|
|
64
|
+
### `Button "…" stands alone in Pane and takes its full width` (outline)
|
|
65
|
+
|
|
66
|
+
A button has a place: `Bar end` (a head or a footer bar of a form), `Row
|
|
67
|
+
action`, `Section actions`, `Group actions`, `Notice actions`, `Tiles
|
|
68
|
+
more`. A form's buttons go in a `Bar` at the end of the pane.
|
|
69
|
+
|
|
70
|
+
### `Group "…" stands in another Group` (outline)
|
|
71
|
+
|
|
72
|
+
Groups are never nested. Use one `Section` with several `Group`s; inside a
|
|
73
|
+
group use `Text`, `Table`, `Facts`, `Row`.
|
|
74
|
+
|
|
75
|
+
### `2 primary buttons (…)` (outline)
|
|
76
|
+
|
|
77
|
+
One filled action per page. The others: default (framed), `ghost`, or
|
|
78
|
+
`text` in heads and row ends.
|
|
79
|
+
|
|
80
|
+
### `the primary action is hidden at this width` (outline at 390 px)
|
|
81
|
+
|
|
82
|
+
Head actions hide on the phone. Give `Workspace` the same action as
|
|
83
|
+
`primary`; it floats there. A head button that must stay gets `keep`.
|
|
84
|
+
|
|
85
|
+
### `the floating main action … covers "Speichern" at this width` (outline at 390 px)
|
|
86
|
+
|
|
87
|
+
On the phone `Workspace primary` floats at the bottom right. A form at the
|
|
88
|
+
end of a pane slides under it. A form or dialog is its own route on the
|
|
89
|
+
phone; beside a list it is a `Pane detail`, which leaves at that width.
|
|
90
|
+
|
|
91
|
+
### `Table "…" is 312 px wider than its column at this width` (outline at 390 px)
|
|
92
|
+
|
|
93
|
+
The widths of the columns that stay do not fit the phone, so the last
|
|
94
|
+
columns (often the amount and the deed) are cut off. Give the table
|
|
95
|
+
`phone(row)`; `drop` alone is rarely enough. The same happens at 1440 px
|
|
96
|
+
when a `Pane detail` beside the table has no `width`.
|
|
97
|
+
|
|
98
|
+
### `Failed "…" stands in a bar` (outline)
|
|
99
|
+
|
|
100
|
+
"Erneut versuchen" belongs only where data that failed to load once would
|
|
101
|
+
stand. In a status row or bar, a connection that retries on its own says so
|
|
102
|
+
in words (`StatusRow lead` or a fact) without a button; something a person
|
|
103
|
+
must fix is a `Notice` that names the deed.
|
|
104
|
+
|
|
105
|
+
### A line under a section head, between entries, inside a group
|
|
106
|
+
|
|
107
|
+
Rule 9. You drew it with your own element or a `Bar` between entries.
|
|
108
|
+
`Section`, `Group` and `List` draw the lines they need; remove yours. A
|
|
109
|
+
`Bar` belongs at the top (head, status) or as a form footer.
|
|
110
|
+
|
|
111
|
+
## Measured layout (`measureV2Layout`)
|
|
112
|
+
|
|
113
|
+
- `line … stops 20 px short of the left … edge of its column`: something
|
|
114
|
+
pads a band. Remove the wrapper; the band must stand directly in the
|
|
115
|
+
`Pane`.
|
|
116
|
+
- `double line: … and … at … px`: two parts draw a line at the same place,
|
|
117
|
+
usually a `Bar` right under a `Bar`, or a `Band` before a `Section` end.
|
|
118
|
+
Drop one of them.
|
|
119
|
+
- `line inside …: … separates parts of one thing`: a line between the
|
|
120
|
+
parts of one band or group, at any distance (rule 9). Remove the element
|
|
121
|
+
that draws it; spacing alone separates the parts.
|
|
122
|
+
- `control … cuts its label`: a button, chip or tab without the room for
|
|
123
|
+
its whole label. Shorten the label, give the place more room (a `width`
|
|
124
|
+
on the pane), or move the action where it has room.
|
|
125
|
+
- `… wraps to 2 lines; it stays on one line and ends with "…"`: a line of
|
|
126
|
+
a three-line row or a cell of a table with widths wraps. Report it as a
|
|
127
|
+
primitive gap; the primitive owns the cut.
|
|
128
|
+
- `text outside the type roles: 15px/22px 500`: own font sizes. Use
|
|
129
|
+
`Text type`; emphasis is `weight`, never a size.
|
|
130
|
+
- `grip …: pill centre … px off its line`: a primitive bug. Report it.
|
|
131
|
+
|
|
132
|
+
## Types
|
|
133
|
+
|
|
134
|
+
- `Property 'label' is missing` on `Button`: an icon button needs a name.
|
|
135
|
+
- `Type '"red"' is not assignable to type 'Status'`: tones are meanings
|
|
136
|
+
(`ok`, `warn`, `bad`), not colours.
|
|
137
|
+
- `Property 'class' does not exist`: no part takes classes; pick the part
|
|
138
|
+
that owns the look.
|
|
139
|
+
- `Object literal may only specify known properties` on `Chip`: one chip is
|
|
140
|
+
one kind (`status` or `tag` or `amount` …).
|
|
141
|
+
|
|
142
|
+
## Habits that pass the checks and still look wrong
|
|
143
|
+
|
|
144
|
+
- A `Text type="lead"` as a page title inside a pane: the title belongs in
|
|
145
|
+
the head `Bar start`, the lead statement in `StatusRow lead`.
|
|
146
|
+
- Building a list from `Band`s: many like things are a `List` of `Row`s
|
|
147
|
+
or a `Table`.
|
|
148
|
+
- A "Retry" button of your own after an error: data that failed to load
|
|
149
|
+
once is `Failed` in its place; a connection that retries on its own says
|
|
150
|
+
so in the `StatusRow` without a button; something a person must fix is a
|
|
151
|
+
`Notice tone="bad"` whose action names the deed.
|
|
152
|
+
- An empty list as a `Band` with muted text, or nothing at all: use `Empty`
|
|
153
|
+
(or `Table empty`) with one sentence and one way out.
|
|
154
|
+
- A spinner or a blank pane while data loads: use `Loading` (or `Table
|
|
155
|
+
loading`) with as many rows as usually come, so nothing moves.
|
|
156
|
+
- An open entry kept only in state: the detail is lost on reload. Put it
|
|
157
|
+
in the address, give `Pane detail` a `back` with `href`, open rows by
|
|
158
|
+
`href` and `onNavigate`.
|
|
159
|
+
- Colour without a word: a red dot alone says nothing; `Chip status="bad"`
|
|
160
|
+
carries the word.
|
|
161
|
+
- `marks` on a two-line `Row`: they add a third line. Use `end` or three
|
|
162
|
+
lines.
|