@umriss-ui/core 0.15.0 → 0.17.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/CHANGELOG.md +103 -0
- package/README.md +3 -2
- package/dist/core.css +1 -1
- package/dist/core.js +3596 -3353
- package/dist/de.d.ts +4 -0
- package/dist/index.d.ts +72 -11
- package/dist/wording/de.js +2 -0
- package/docs/llms-full.md +717 -167
- package/package.json +1 -1
package/docs/llms-full.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @umriss-ui/core 0.
|
|
1
|
+
# @umriss-ui/core 0.17.0
|
|
2
2
|
|
|
3
3
|
> React component library for data-dense dashboards and tools - forms, date pickers, overlays, a tree view and a command palette. Precise, quiet, professional.
|
|
4
4
|
|
|
@@ -685,8 +685,8 @@ export default function ApproveSpending() {
|
|
|
685
685
|
<td style={{ padding: "6px 8px 6px 0" }}>{line.description}</td>
|
|
686
686
|
<td style={{ padding: "6px 8px", textAlign: "right" }}>{line.quantity}</td>
|
|
687
687
|
<td style={{ padding: "6px 8px", textAlign: "right" }}>{euro.format(line.unitPrice)}</td>
|
|
688
|
-
<td style={{ padding: "6px 8px", textAlign: "right" }}>{line.discount === 0 ? "-" : `${Math.round(line.discount * 100)}
|
|
689
|
-
<td style={{ padding: "6px 8px", textAlign: "right" }}>{Math.round(line.vatRate * 100)}
|
|
688
|
+
<td style={{ padding: "6px 8px", textAlign: "right" }}>{line.discount === 0 ? "-" : `${Math.round(line.discount * 100)}\u00a0%`}</td>
|
|
689
|
+
<td style={{ padding: "6px 8px", textAlign: "right" }}>{`${Math.round(line.vatRate * 100)}\u00a0%`}</td>
|
|
690
690
|
<td style={{ padding: "6px 0 6px 8px", textAlign: "right" }}>
|
|
691
691
|
{euro.format(line.quantity * line.unitPrice * (1 - line.discount))}
|
|
692
692
|
</td>
|
|
@@ -764,7 +764,7 @@ A team lead at Tidewell keeps the team's settings here: who is in it and for how
|
|
|
764
764
|
Built from: Breadcrumb, Card, Select, NumberInput, Combobox, ConfirmDialog, RadioGroup, DatePicker, Checkbox, Slider, Switch, Toast.
|
|
765
765
|
|
|
766
766
|
```tsx
|
|
767
|
-
import {
|
|
767
|
+
import { useState } from "react";
|
|
768
768
|
import {
|
|
769
769
|
Breadcrumb,
|
|
770
770
|
Button,
|
|
@@ -853,45 +853,53 @@ export default function SetUpATeam() {
|
|
|
853
853
|
<Card>
|
|
854
854
|
<CardHeader title="Members" />
|
|
855
855
|
<CardBody>
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
856
|
+
{/* One row a person, which wraps on a narrow screen: the name above,
|
|
857
|
+
role and then hours and Remove beneath it - a grid of four columns had
|
|
858
|
+
scrolled its last two out of sight on a phone. */}
|
|
859
|
+
<Text size="xs" tone="muted">
|
|
860
|
+
Role and hours a week, per person
|
|
861
|
+
</Text>
|
|
862
|
+
<Stack gap={2} style={{ marginTop: "var(--u-space-2)" }}>
|
|
862
863
|
{draft.members.map((one, i) => (
|
|
863
|
-
<
|
|
864
|
-
<Text size="sm"
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
{role}
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
864
|
+
<Stack key={one.id} direction="row" gap={3} align="center" wrap>
|
|
865
|
+
<Text size="sm" style={{ flex: "1 1 8rem" }}>
|
|
866
|
+
{one.name}
|
|
867
|
+
</Text>
|
|
868
|
+
<Stack direction="row" gap={3} align="center" wrap style={{ flex: "1 1 18rem" }}>
|
|
869
|
+
<div style={{ flex: "1 1 10rem", minWidth: 0 }}>
|
|
870
|
+
<Select
|
|
871
|
+
selectSize="sm"
|
|
872
|
+
aria-label={`Role of ${one.name}`}
|
|
873
|
+
data-callout={i === 0 ? "2" : undefined}
|
|
874
|
+
value={one.role}
|
|
875
|
+
onChange={(event) => setMember(one.id, { role: event.target.value as Role })}
|
|
876
|
+
>
|
|
877
|
+
{ROLES.map((role) => (
|
|
878
|
+
<option key={role} value={role}>
|
|
879
|
+
{role}
|
|
880
|
+
</option>
|
|
881
|
+
))}
|
|
882
|
+
</Select>
|
|
883
|
+
</div>
|
|
884
|
+
<div style={{ flex: "none", width: "7.5rem" }}>
|
|
885
|
+
<NumberInput
|
|
886
|
+
size="sm"
|
|
887
|
+
aria-label={`Hours a week of ${one.name}`}
|
|
888
|
+
value={one.capacity}
|
|
889
|
+
onChange={(value) => setMember(one.id, { capacity: value ?? 0 })}
|
|
890
|
+
min={0}
|
|
891
|
+
max={40}
|
|
892
|
+
decimals={0}
|
|
893
|
+
suffix="h"
|
|
894
|
+
/>
|
|
895
|
+
</div>
|
|
896
|
+
<Button size="sm" variant="ghost" data-callout={i === 0 ? "3" : undefined} onClick={() => setRemoving(one)}>
|
|
897
|
+
Remove
|
|
898
|
+
</Button>
|
|
899
|
+
</Stack>
|
|
900
|
+
</Stack>
|
|
892
901
|
))}
|
|
893
|
-
</
|
|
894
|
-
</div>
|
|
902
|
+
</Stack>
|
|
895
903
|
<Stack direction="row" gap={3} align="flex-end" justify="space-between" wrap style={{ marginTop: "var(--u-space-4)" }}>
|
|
896
904
|
<FormField label="Add someone" style={{ flex: "0 1 280px" }}>
|
|
897
905
|
<Combobox
|
|
@@ -1617,7 +1625,7 @@ What umriss deliberately does not build, and why: [ADR-0032](https://github.com/
|
|
|
1617
1625
|
|
|
1618
1626
|
### UmrissProvider
|
|
1619
1627
|
|
|
1620
|
-
Sets once, at the root, what an application shares: the density of its tables, where overlays open, how long toasts stay and the language. It is optional; every component works the same without it.
|
|
1628
|
+
Sets once, at the root, what an application shares: the density of its tables, where overlays open, how long toasts stay and where they stand, and the language. It is optional; every component works the same without it.
|
|
1621
1629
|
|
|
1622
1630
|
```ts
|
|
1623
1631
|
import { UmrissProvider } from "@umriss-ui/core";
|
|
@@ -1762,12 +1770,20 @@ export default function EverythingAtOnce() {
|
|
|
1762
1770
|
|
|
1763
1771
|
| Prop | Type | Default | Description |
|
|
1764
1772
|
|---|---|---|---|
|
|
1765
|
-
| `density` | `Density` | — | The default for the `density` of every component that reads it with `useDensityFor` - in |
|
|
1773
|
+
| `density` | `Density` | — | The default for the `density` of every component that reads it with `useDensityFor` - in `@umriss-ui/table` `Table` and `AlarmList` ("comfortable" means "regular"). Without a value the provider touches no component: one that is compact of its own accord stays compact. |
|
|
1766
1774
|
| `portalTarget` | `PortalTarget` | `null` | Where overlays portal to. A function is evaluated on every opening - a target that only enters the tree later cannot be given otherwise; `null` means "as before". The callers' own rules take precedence: the popover seam portals into the nearest `<dialog>` ancestor, because a portal at the body does not reach the top layer. |
|
|
1767
|
-
| `toast` | `ToastConfig` | — | The setting for toasts: the display duration where the individual toast names none. |
|
|
1775
|
+
| `toast` | `ToastConfig` | — | The setting for toasts: the display duration where the individual toast names none, where they stand, and how many stand at once. |
|
|
1768
1776
|
| `language` | `LanguageOptions` | — | Formats and wording, entry by entry. See `lib/language`. |
|
|
1769
1777
|
| `children` (required) | `ReactNode` | — | The subtree the settings apply to. |
|
|
1770
1778
|
|
|
1779
|
+
##### `ToastConfig`
|
|
1780
|
+
|
|
1781
|
+
| Prop | Type | Default | Description |
|
|
1782
|
+
|---|---|---|---|
|
|
1783
|
+
| `duration` | `number` | — | Display duration in ms, where the individual toast names none. |
|
|
1784
|
+
| `position` | `ToastPosition` | — | Where the toasts stand. Default: `bottom-end`. There is no position per toast - toasts that stand in different places are not read as one. |
|
|
1785
|
+
| `limit` | `number` | — | How many toasts stand at once; the oldest gives way to a new one, as if it had been closed. Default: 3. |
|
|
1786
|
+
|
|
1771
1787
|
#### Known limits
|
|
1772
1788
|
|
|
1773
1789
|
- No theme and no default variants for components: a component is configured by its own props.
|
|
@@ -2129,12 +2145,14 @@ export default function Gaps() {
|
|
|
2129
2145
|
<Stack gap={4}>
|
|
2130
2146
|
{([1, 3, 6] as const).map((gap) => (
|
|
2131
2147
|
<Stack key={gap} direction="row" gap={gap} align="center">
|
|
2132
|
-
<Text size="xs" tone="muted" style={{ width: 48 }}>
|
|
2148
|
+
<Text size="xs" tone="muted" style={{ width: 48, flex: "none", whiteSpace: "nowrap" }}>
|
|
2133
2149
|
gap {gap}
|
|
2134
2150
|
</Text>
|
|
2135
|
-
{
|
|
2136
|
-
|
|
2137
|
-
|
|
2151
|
+
<Stack direction="row" gap={gap} align="center" wrap>
|
|
2152
|
+
{TEAMS.map((team) => (
|
|
2153
|
+
<Badge key={team}>{team}</Badge>
|
|
2154
|
+
))}
|
|
2155
|
+
</Stack>
|
|
2138
2156
|
</Stack>
|
|
2139
2157
|
))}
|
|
2140
2158
|
</Stack>
|
|
@@ -2174,9 +2192,9 @@ Use `columns` where the layout decides the count, such as three figures that alw
|
|
|
2174
2192
|
import { Card, CardBody, Grid, Stack, Text } from "@umriss-ui/core";
|
|
2175
2193
|
|
|
2176
2194
|
const FIGURES = [
|
|
2177
|
-
{ label: "Marketing budget, March", value: "68,000
|
|
2178
|
-
{ label: "Forecast, March", value: "77,500
|
|
2179
|
-
{ label: "Over budget", value: "9,500
|
|
2195
|
+
{ label: "Marketing budget, March", value: "68,000\u00a0€" },
|
|
2196
|
+
{ label: "Forecast, March", value: "77,500\u00a0€" },
|
|
2197
|
+
{ label: "Over budget", value: "9,500\u00a0€" },
|
|
2180
2198
|
];
|
|
2181
2199
|
|
|
2182
2200
|
export default function FixedColumns() {
|
|
@@ -2658,7 +2676,7 @@ import { Button, Divider, Stack } from "@umriss-ui/core";
|
|
|
2658
2676
|
|
|
2659
2677
|
export default function UprightInABar() {
|
|
2660
2678
|
return (
|
|
2661
|
-
<Stack direction="row" gap={3} align="center">
|
|
2679
|
+
<Stack direction="row" gap={3} align="center" wrap>
|
|
2662
2680
|
<Button size="sm" variant="ghost">
|
|
2663
2681
|
This sprint
|
|
2664
2682
|
</Button>
|
|
@@ -3625,7 +3643,7 @@ It imports `controlling.ts` from beside itself; the file stands once, under "Fil
|
|
|
3625
3643
|
#### When to use something else
|
|
3626
3644
|
|
|
3627
3645
|
- A hint every user should be able to see → Tooltip
|
|
3628
|
-
- A button that shows only an icon →
|
|
3646
|
+
- A button that shows only an icon → IconButton
|
|
3629
3647
|
|
|
3630
3648
|
#### Keyboard
|
|
3631
3649
|
|
|
@@ -3664,7 +3682,7 @@ import { Button } from "@umriss-ui/core";
|
|
|
3664
3682
|
|
|
3665
3683
|
Demo page: https://romanhaendler.github.io/umriss-ui/core/button/
|
|
3666
3684
|
|
|
3667
|
-
Use the primary variant once per surface, and danger only for what cannot be undone.
|
|
3685
|
+
Use the primary variant once per surface, and danger only for what cannot be undone. `ghost` is quiet in the accent, `plain` quiet and neutral.
|
|
3668
3686
|
|
|
3669
3687
|
A loading button locks itself and tells assistive technology it is busy; it needs no `disabled` beside it. A button is `type="button"` unless you set another type, so it never sends a form by accident.
|
|
3670
3688
|
|
|
@@ -3690,7 +3708,7 @@ export default function OneAction() {
|
|
|
3690
3708
|
|
|
3691
3709
|
##### Variants
|
|
3692
3710
|
|
|
3693
|
-
Use `primary` once per surface – two main actions side by side are no longer a main action; `danger` only for what cannot be undone.
|
|
3711
|
+
Use `primary` once per surface – two main actions side by side are no longer a main action; `danger` only for what cannot be undone. `ghost` is quiet in the accent, `plain` quiet and neutral.
|
|
3694
3712
|
|
|
3695
3713
|
```tsx
|
|
3696
3714
|
import { Button, Stack } from "@umriss-ui/core";
|
|
@@ -3701,6 +3719,7 @@ export default function Variants() {
|
|
|
3701
3719
|
<Button variant="primary">Approve invoice</Button>
|
|
3702
3720
|
<Button>Send back</Button>
|
|
3703
3721
|
<Button variant="ghost">Add a note</Button>
|
|
3722
|
+
<Button variant="plain">Remind me later</Button>
|
|
3704
3723
|
<Button variant="danger">Reject</Button>
|
|
3705
3724
|
</Stack>
|
|
3706
3725
|
);
|
|
@@ -3795,14 +3814,14 @@ export default function SubmitAForm() {
|
|
|
3795
3814
|
|
|
3796
3815
|
##### Add an icon
|
|
3797
3816
|
|
|
3798
|
-
Put
|
|
3817
|
+
Put the icon before the label and hide it from screen readers; the button sets its size. A button with no label at all is an `IconButton`.
|
|
3799
3818
|
|
|
3800
3819
|
```tsx
|
|
3801
3820
|
import { Button, Stack } from "@umriss-ui/core";
|
|
3802
3821
|
|
|
3803
3822
|
function Download() {
|
|
3804
3823
|
return (
|
|
3805
|
-
<svg viewBox="0 0 16 16"
|
|
3824
|
+
<svg viewBox="0 0 16 16" aria-hidden="true">
|
|
3806
3825
|
<path d="M8 2v8m0 0 3-3m-3 3L5 7M3 13h10" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
|
|
3807
3826
|
</svg>
|
|
3808
3827
|
);
|
|
@@ -3815,8 +3834,9 @@ export default function WithAnIcon() {
|
|
|
3815
3834
|
<Download />
|
|
3816
3835
|
Export CSV
|
|
3817
3836
|
</Button>
|
|
3818
|
-
<Button size="sm" variant="ghost"
|
|
3837
|
+
<Button size="sm" variant="ghost">
|
|
3819
3838
|
<Download />
|
|
3839
|
+
Export CSV
|
|
3820
3840
|
</Button>
|
|
3821
3841
|
</Stack>
|
|
3822
3842
|
);
|
|
@@ -3886,6 +3906,7 @@ It imports `controlling.ts` from beside itself; the file stands once, under "Fil
|
|
|
3886
3906
|
|
|
3887
3907
|
#### When to use something else
|
|
3888
3908
|
|
|
3909
|
+
- A button that shows only an icon → IconButton
|
|
3889
3910
|
- Several buttons that act on the same thing → ButtonGroup
|
|
3890
3911
|
- One main action with rarer variants → ButtonGroup
|
|
3891
3912
|
- Going to another page rather than doing something → Typography
|
|
@@ -3897,7 +3918,7 @@ It imports `controlling.ts` from beside itself; the file stands once, under "Fil
|
|
|
3897
3918
|
|
|
3898
3919
|
| Prop | Type | Default | Description |
|
|
3899
3920
|
|---|---|---|---|
|
|
3900
|
-
| `variant` | `ButtonVariant` | `"secondary"` | How loud the button is. `primary` exactly once per surface - two main actions side by side are no longer a main action. |
|
|
3921
|
+
| `variant` | `ButtonVariant` | `"secondary"` | How loud the button is. `primary` exactly once per surface - two main actions side by side are no longer a main action. `ghost` is quiet in the accent, `plain` quiet and neutral. |
|
|
3901
3922
|
| `size` | `ButtonSize` | `"md"` | `sm` for buttons in header bars and table rows, `md` otherwise. |
|
|
3902
3923
|
| `loading` | `boolean` | `false` | Shows a loading indicator and locks the button. |
|
|
3903
3924
|
|
|
@@ -3906,7 +3927,330 @@ Also takes every attribute of `<button>`.
|
|
|
3906
3927
|
#### Known limits
|
|
3907
3928
|
|
|
3908
3929
|
- The label stays on one line; keep it short rather than let it wrap.
|
|
3909
|
-
- No icon slot
|
|
3930
|
+
- No icon slot: an icon goes among the children, before the label, and the button sets its size.
|
|
3931
|
+
|
|
3932
|
+
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0032-what-umriss-is-not.md).
|
|
3933
|
+
|
|
3934
|
+
### IconButton
|
|
3935
|
+
|
|
3936
|
+
A square button that shows only an icon (also called an icon-only button): refresh, export, close, the actions of a row. Reach for it where the icon is known well enough to stand alone; its name is required and shows as a tooltip.
|
|
3937
|
+
|
|
3938
|
+
```ts
|
|
3939
|
+
import { IconButton } from "@umriss-ui/core";
|
|
3940
|
+
```
|
|
3941
|
+
|
|
3942
|
+
Demo page: https://romanhaendler.github.io/umriss-ui/core/iconbutton/
|
|
3943
|
+
|
|
3944
|
+
Its `aria-label` is required, and it is the accessible name and the tooltip in one: a screen reader hears it once, and the eye reads it on hover or keyboard focus.
|
|
3945
|
+
|
|
3946
|
+
The icon is yours: an SVG, a glyph of the set, or an icon font's element. The button sets its size – 14 px, 12 px at `sm` – the size an SVG takes beside a label in a `Button` as well.
|
|
3947
|
+
|
|
3948
|
+
It is a `Button` underneath, with the same sizes, loading state and variants; the default is `plain`, quiet and neutral. As the trigger of a `Menu` it anchors the panel, and its tooltip gives way while the menu is open.
|
|
3949
|
+
|
|
3950
|
+
#### Examples
|
|
3951
|
+
|
|
3952
|
+
##### Name the icon
|
|
3953
|
+
|
|
3954
|
+
`aria-label` is required: it is the name a screen reader announces and the tooltip a sighted reader sees on hover or keyboard focus.
|
|
3955
|
+
|
|
3956
|
+
```tsx
|
|
3957
|
+
import { IconButton } from "@umriss-ui/core";
|
|
3958
|
+
|
|
3959
|
+
function Refresh() {
|
|
3960
|
+
return (
|
|
3961
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
3962
|
+
<path d="M8.3 5.8A3.4 3.4 0 1 1 7.6 2.7M7.9 1.2v1.8H6.1" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
3963
|
+
</svg>
|
|
3964
|
+
);
|
|
3965
|
+
}
|
|
3966
|
+
|
|
3967
|
+
export default function NameTheIcon() {
|
|
3968
|
+
return (
|
|
3969
|
+
<IconButton aria-label="Refresh the tours">
|
|
3970
|
+
<Refresh />
|
|
3971
|
+
</IconButton>
|
|
3972
|
+
);
|
|
3973
|
+
}
|
|
3974
|
+
```
|
|
3975
|
+
|
|
3976
|
+
##### Variants
|
|
3977
|
+
|
|
3978
|
+
`plain` is the default – quiet and neutral, for a bar or a row. `ghost` is quiet in the accent; the others mean what they mean on a `Button`.
|
|
3979
|
+
|
|
3980
|
+
```tsx
|
|
3981
|
+
import { CrossGlyph, IconButton, PlusGlyph, Stack } from "@umriss-ui/core";
|
|
3982
|
+
|
|
3983
|
+
function Export() {
|
|
3984
|
+
return (
|
|
3985
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
3986
|
+
<path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
3987
|
+
</svg>
|
|
3988
|
+
);
|
|
3989
|
+
}
|
|
3990
|
+
|
|
3991
|
+
function Check() {
|
|
3992
|
+
return (
|
|
3993
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
3994
|
+
<path d="M1.8 5.3 4 7.5l4.2-5" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
3995
|
+
</svg>
|
|
3996
|
+
);
|
|
3997
|
+
}
|
|
3998
|
+
|
|
3999
|
+
export default function Variants() {
|
|
4000
|
+
return (
|
|
4001
|
+
<Stack direction="row" gap={3} wrap align="center">
|
|
4002
|
+
<IconButton aria-label="Export the tour list">
|
|
4003
|
+
<Export />
|
|
4004
|
+
</IconButton>
|
|
4005
|
+
<IconButton variant="ghost" aria-label="Add a stop">
|
|
4006
|
+
<PlusGlyph />
|
|
4007
|
+
</IconButton>
|
|
4008
|
+
<IconButton variant="secondary" aria-label="Export the tour list">
|
|
4009
|
+
<Export />
|
|
4010
|
+
</IconButton>
|
|
4011
|
+
<IconButton variant="primary" aria-label="Release the tour">
|
|
4012
|
+
<Check />
|
|
4013
|
+
</IconButton>
|
|
4014
|
+
<IconButton variant="danger" aria-label="Cancel the tour">
|
|
4015
|
+
<CrossGlyph />
|
|
4016
|
+
</IconButton>
|
|
4017
|
+
</Stack>
|
|
4018
|
+
);
|
|
4019
|
+
}
|
|
4020
|
+
```
|
|
4021
|
+
|
|
4022
|
+
##### Sizes
|
|
4023
|
+
|
|
4024
|
+
The heights of `Button`, and the same icon size beside a label and alone: 14 px at `md`, 12 px at `sm`, in header bars and table rows.
|
|
4025
|
+
|
|
4026
|
+
```tsx
|
|
4027
|
+
import { Button, IconButton, Stack } from "@umriss-ui/core";
|
|
4028
|
+
|
|
4029
|
+
function Export() {
|
|
4030
|
+
return (
|
|
4031
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
4032
|
+
<path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
4033
|
+
</svg>
|
|
4034
|
+
);
|
|
4035
|
+
}
|
|
4036
|
+
|
|
4037
|
+
export default function Sizes() {
|
|
4038
|
+
return (
|
|
4039
|
+
<Stack gap={3}>
|
|
4040
|
+
<Stack direction="row" gap={2} align="center">
|
|
4041
|
+
<Button>
|
|
4042
|
+
<Export />
|
|
4043
|
+
Export
|
|
4044
|
+
</Button>
|
|
4045
|
+
<IconButton variant="secondary" aria-label="Export the tour list">
|
|
4046
|
+
<Export />
|
|
4047
|
+
</IconButton>
|
|
4048
|
+
</Stack>
|
|
4049
|
+
<Stack direction="row" gap={2} align="center">
|
|
4050
|
+
<Button size="sm">
|
|
4051
|
+
<Export />
|
|
4052
|
+
Export
|
|
4053
|
+
</Button>
|
|
4054
|
+
<IconButton size="sm" variant="secondary" aria-label="Export the tour list">
|
|
4055
|
+
<Export />
|
|
4056
|
+
</IconButton>
|
|
4057
|
+
</Stack>
|
|
4058
|
+
</Stack>
|
|
4059
|
+
);
|
|
4060
|
+
}
|
|
4061
|
+
```
|
|
4062
|
+
|
|
4063
|
+
##### Bring your own icons
|
|
4064
|
+
|
|
4065
|
+
A glyph of the set, an SVG drawn for 24 px as lucide and Font Awesome ship theirs, a character the way an icon font sets it – the button gives each the same size.
|
|
4066
|
+
|
|
4067
|
+
```tsx
|
|
4068
|
+
import { CrossGlyph, IconButton, Stack } from "@umriss-ui/core";
|
|
4069
|
+
|
|
4070
|
+
/* Drawn on a 24 grid with its own width and height, as icon sets ship them. */
|
|
4071
|
+
function Printer() {
|
|
4072
|
+
return (
|
|
4073
|
+
<svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
|
|
4074
|
+
<path d="M6 9V2h12v7" />
|
|
4075
|
+
<path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" />
|
|
4076
|
+
<path d="M6 14h12v8H6z" />
|
|
4077
|
+
</svg>
|
|
4078
|
+
);
|
|
4079
|
+
}
|
|
4080
|
+
|
|
4081
|
+
export default function BringYourOwnIcons() {
|
|
4082
|
+
return (
|
|
4083
|
+
<Stack direction="row" gap={3} align="center">
|
|
4084
|
+
<IconButton variant="secondary" aria-label="Remove the filter">
|
|
4085
|
+
<CrossGlyph />
|
|
4086
|
+
</IconButton>
|
|
4087
|
+
<IconButton variant="secondary" aria-label="Print the delivery notes">
|
|
4088
|
+
<Printer />
|
|
4089
|
+
</IconButton>
|
|
4090
|
+
<IconButton variant="secondary" aria-label="Sort by departure">
|
|
4091
|
+
<span aria-hidden="true">⇅</span>
|
|
4092
|
+
</IconButton>
|
|
4093
|
+
</Stack>
|
|
4094
|
+
);
|
|
4095
|
+
}
|
|
4096
|
+
```
|
|
4097
|
+
|
|
4098
|
+
##### Loading and disabled
|
|
4099
|
+
|
|
4100
|
+
While its action runs, the spinner takes the icon's place and the button locks; disabled, it fades and keeps its name.
|
|
4101
|
+
|
|
4102
|
+
```tsx
|
|
4103
|
+
import { useEffect, useState } from "react";
|
|
4104
|
+
import { IconButton, Stack, Text } from "@umriss-ui/core";
|
|
4105
|
+
|
|
4106
|
+
function Refresh() {
|
|
4107
|
+
return (
|
|
4108
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
4109
|
+
<path d="M8.3 5.8A3.4 3.4 0 1 1 7.6 2.7M7.9 1.2v1.8H6.1" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
4110
|
+
</svg>
|
|
4111
|
+
);
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
function Export() {
|
|
4115
|
+
return (
|
|
4116
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
4117
|
+
<path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
4118
|
+
</svg>
|
|
4119
|
+
);
|
|
4120
|
+
}
|
|
4121
|
+
|
|
4122
|
+
export default function LoadingAndDisabled() {
|
|
4123
|
+
const [loading, setLoading] = useState(false);
|
|
4124
|
+
const [refreshed, setRefreshed] = useState("10:30");
|
|
4125
|
+
|
|
4126
|
+
useEffect(() => {
|
|
4127
|
+
if (!loading) return;
|
|
4128
|
+
const timer = setTimeout(() => {
|
|
4129
|
+
setLoading(false);
|
|
4130
|
+
setRefreshed("10:31");
|
|
4131
|
+
}, 1500);
|
|
4132
|
+
return () => clearTimeout(timer);
|
|
4133
|
+
}, [loading]);
|
|
4134
|
+
|
|
4135
|
+
return (
|
|
4136
|
+
<Stack direction="row" gap={2} align="center">
|
|
4137
|
+
<IconButton variant="secondary" aria-label="Refresh the tours" loading={loading} onClick={() => setLoading(true)}>
|
|
4138
|
+
<Refresh />
|
|
4139
|
+
</IconButton>
|
|
4140
|
+
<IconButton variant="secondary" aria-label="Export the tour list" disabled>
|
|
4141
|
+
<Export />
|
|
4142
|
+
</IconButton>
|
|
4143
|
+
<Text size="sm" tone="muted">
|
|
4144
|
+
Refreshed at {refreshed}
|
|
4145
|
+
</Text>
|
|
4146
|
+
</Stack>
|
|
4147
|
+
);
|
|
4148
|
+
}
|
|
4149
|
+
```
|
|
4150
|
+
|
|
4151
|
+
##### Build a toolbar
|
|
4152
|
+
|
|
4153
|
+
Plain buttons for the bar, a group for the pair that belongs together, a menu for the rest – every square the same size, every name a tooltip.
|
|
4154
|
+
|
|
4155
|
+
```tsx
|
|
4156
|
+
import { useState } from "react";
|
|
4157
|
+
import { ButtonGroup, IconButton, Menu, MenuItem, MenuSeparator, MinusGlyph, PlusGlyph, Stack, Text } from "@umriss-ui/core";
|
|
4158
|
+
|
|
4159
|
+
const ZOOM = [50, 75, 100, 150, 200];
|
|
4160
|
+
|
|
4161
|
+
function Refresh() {
|
|
4162
|
+
return (
|
|
4163
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
4164
|
+
<path d="M8.3 5.8A3.4 3.4 0 1 1 7.6 2.7M7.9 1.2v1.8H6.1" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
4165
|
+
</svg>
|
|
4166
|
+
);
|
|
4167
|
+
}
|
|
4168
|
+
|
|
4169
|
+
function Export() {
|
|
4170
|
+
return (
|
|
4171
|
+
<svg viewBox="0 0 10 10" aria-hidden="true">
|
|
4172
|
+
<path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
|
|
4173
|
+
</svg>
|
|
4174
|
+
);
|
|
4175
|
+
}
|
|
4176
|
+
|
|
4177
|
+
export default function Toolbar() {
|
|
4178
|
+
const [zoom, setZoom] = useState(2);
|
|
4179
|
+
|
|
4180
|
+
return (
|
|
4181
|
+
<Stack direction="row" gap={3} align="center" justify="space-between" wrap style={{ maxWidth: 620 }}>
|
|
4182
|
+
<Text size="sm" weight="semibold">
|
|
4183
|
+
Tours, Tuesday 17 March
|
|
4184
|
+
</Text>
|
|
4185
|
+
<Stack direction="row" gap={2} align="center">
|
|
4186
|
+
<ButtonGroup aria-label="Zoom the tour plan">
|
|
4187
|
+
<IconButton size="sm" variant="secondary" aria-label="Zoom out" disabled={zoom === 0} onClick={() => setZoom(zoom - 1)}>
|
|
4188
|
+
<MinusGlyph />
|
|
4189
|
+
</IconButton>
|
|
4190
|
+
<IconButton size="sm" variant="secondary" aria-label="Zoom in" disabled={zoom === ZOOM.length - 1} onClick={() => setZoom(zoom + 1)}>
|
|
4191
|
+
<PlusGlyph />
|
|
4192
|
+
</IconButton>
|
|
4193
|
+
</ButtonGroup>
|
|
4194
|
+
<Text as="span" size="xs" mono tone="muted" style={{ width: "4ch" }}>
|
|
4195
|
+
{ZOOM[zoom]}%
|
|
4196
|
+
</Text>
|
|
4197
|
+
<IconButton size="sm" aria-label="Refresh the tours">
|
|
4198
|
+
<Refresh />
|
|
4199
|
+
</IconButton>
|
|
4200
|
+
<IconButton size="sm" aria-label="Export the tour list">
|
|
4201
|
+
<Export />
|
|
4202
|
+
</IconButton>
|
|
4203
|
+
<Menu
|
|
4204
|
+
align="end"
|
|
4205
|
+
trigger={
|
|
4206
|
+
<IconButton size="sm" aria-label="More actions for the tours">
|
|
4207
|
+
⋯
|
|
4208
|
+
</IconButton>
|
|
4209
|
+
}
|
|
4210
|
+
>
|
|
4211
|
+
<MenuItem>Print the delivery notes</MenuItem>
|
|
4212
|
+
<MenuItem>Copy the link</MenuItem>
|
|
4213
|
+
<MenuSeparator />
|
|
4214
|
+
<MenuItem tone="danger">Cancel every open tour</MenuItem>
|
|
4215
|
+
</Menu>
|
|
4216
|
+
</Stack>
|
|
4217
|
+
</Stack>
|
|
4218
|
+
);
|
|
4219
|
+
}
|
|
4220
|
+
```
|
|
4221
|
+
|
|
4222
|
+
#### When to use something else
|
|
4223
|
+
|
|
4224
|
+
- The action is clearer said than drawn → Button
|
|
4225
|
+
- Icon buttons that act on the same thing → ButtonGroup
|
|
4226
|
+
- A floating strip of tools over a canvas → Dock
|
|
4227
|
+
|
|
4228
|
+
#### Keyboard
|
|
4229
|
+
|
|
4230
|
+
| Key | Action |
|
|
4231
|
+
|---|---|
|
|
4232
|
+
| `Tab` | Reaches the button and shows its name. |
|
|
4233
|
+
| `Enter / Space` | Presses it. |
|
|
4234
|
+
| `Escape` | Hides the name. |
|
|
4235
|
+
|
|
4236
|
+
#### API
|
|
4237
|
+
|
|
4238
|
+
##### `IconButtonProps`
|
|
4239
|
+
|
|
4240
|
+
| Prop | Type | Default | Description |
|
|
4241
|
+
|---|---|---|---|
|
|
4242
|
+
| `aria-label` (required) | `string` | — | The name: what a screen reader announces and the tooltip shows. Required - an icon alone names nothing. |
|
|
4243
|
+
| `children` (required) | `ReactNode` | — | The icon: an SVG, a glyph of the set or an icon font's element. The button sets its size - `--u-icon-size`, `--u-icon-size-sm` at `sm`. |
|
|
4244
|
+
| `variant` | `ButtonVariant` | `"plain"` | How loud the button is; `plain` is quiet and neutral, and the rest mean what they mean on a `Button`. Default: `plain` |
|
|
4245
|
+
| `size` | `ButtonSize` | `"md"` | `sm` for buttons in header bars and table rows, `md` otherwise. From `ButtonProps`. |
|
|
4246
|
+
| `loading` | `boolean` | `false` | Shows a loading indicator and locks the button. From `ButtonProps`. |
|
|
4247
|
+
|
|
4248
|
+
Also takes every attribute of `<button>`.
|
|
4249
|
+
|
|
4250
|
+
#### Known limits
|
|
4251
|
+
|
|
4252
|
+
- The tooltip always shows the name; a hint that says more than the name is a `Tooltip` around a `Button`.
|
|
4253
|
+
- A touch screen shows no tooltip: choose icons whose meaning is common, or a `Button` with a label.
|
|
3910
4254
|
|
|
3911
4255
|
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0032-what-umriss-is-not.md).
|
|
3912
4256
|
|
|
@@ -4082,7 +4426,7 @@ export default function InvoiceToolbar() {
|
|
|
4082
4426
|
return (
|
|
4083
4427
|
<Stack gap={3}>
|
|
4084
4428
|
<Stack direction="row" gap={3} align="center" justify="space-between" wrap>
|
|
4085
|
-
<Stack direction="row" gap={3} align="center">
|
|
4429
|
+
<Stack direction="row" gap={3} align="center" wrap>
|
|
4086
4430
|
<ButtonGroup aria-label="Invoices awaiting approval">
|
|
4087
4431
|
<Button size="sm" disabled={index === 0} onClick={() => setIndex(index - 1)}>
|
|
4088
4432
|
Previous
|
|
@@ -6238,7 +6582,7 @@ export default function FilterIncidentsByService() {
|
|
|
6238
6582
|
{shown.map((incident) => (
|
|
6239
6583
|
<Stack key={incident.id} direction="row" gap={3} align="center">
|
|
6240
6584
|
<Badge tone={incident.severity === "SEV1" ? "danger" : "warning"}>{incident.severity}</Badge>
|
|
6241
|
-
<Text size="sm" mono>
|
|
6585
|
+
<Text size="sm" mono style={{ flex: "none" }}>
|
|
6242
6586
|
{incident.id}
|
|
6243
6587
|
</Text>
|
|
6244
6588
|
<Text size="sm">{incident.title}</Text>
|
|
@@ -7065,15 +7409,21 @@ Demo page: https://romanhaendler.github.io/umriss-ui/core/toast/
|
|
|
7065
7409
|
|
|
7066
7410
|
`useToast` needs a `ToastProvider` around the application, once, at the root.
|
|
7067
7411
|
|
|
7068
|
-
A toast stays five seconds by default. Its clock stops while the pointer
|
|
7412
|
+
A toast stays five seconds by default. Its clock stops while the deck is open – under the pointer, with the focus inside it – and runs on with the time that was left.
|
|
7413
|
+
|
|
7414
|
+
The title says what has happened, in about one line: “Invoice not sent”. Why, and what to do next, go in the description.
|
|
7069
7415
|
|
|
7070
7416
|
Nothing that must be read goes in a toast: whoever looked elsewhere has missed it. `duration: 0` keeps one until it is closed – for the rare message whose loss costs something, since a corner full of standing toasts stops being read.
|
|
7071
7417
|
|
|
7418
|
+
Several toasts stand as a deck: the newest in front, a count on it, two edges behind it. It opens under the pointer, on the count, with the focus inside it, or with Alt+T; Escape gives the focus back.
|
|
7419
|
+
|
|
7420
|
+
At most three stand at once (`toast.limit` in the [UmrissProvider](#/umrissprovider)); the oldest gives way to a new one, as if closed.
|
|
7421
|
+
|
|
7072
7422
|
#### Examples
|
|
7073
7423
|
|
|
7074
7424
|
##### Show a toast
|
|
7075
7425
|
|
|
7076
|
-
Call `toast()` from `useToast` with what has happened; a `ToastProvider` at the root of the application holds
|
|
7426
|
+
Call `toast()` from `useToast` with what has happened; a `ToastProvider` at the root of the application holds them.
|
|
7077
7427
|
|
|
7078
7428
|
```tsx
|
|
7079
7429
|
import { Button, useToast } from "@umriss-ui/core";
|
|
@@ -7115,6 +7465,61 @@ export default function Tones() {
|
|
|
7115
7465
|
}
|
|
7116
7466
|
```
|
|
7117
7467
|
|
|
7468
|
+
##### Undo
|
|
7469
|
+
|
|
7470
|
+
One `action` reverses what just happened; `onClose` says whether the time ran out, the toast was closed or the action was taken, and the line under the list reports which.
|
|
7471
|
+
|
|
7472
|
+
```tsx
|
|
7473
|
+
import { useState } from "react";
|
|
7474
|
+
import { Button, Stack, Text, useToast } from "@umriss-ui/core";
|
|
7475
|
+
import type { ToastCloseReason } from "@umriss-ui/core";
|
|
7476
|
+
|
|
7477
|
+
const BOOKINGS = ["Room 2.14 · Tue 10:00 · Design review", "Room 3.02 · Tue 14:00 · Quarterly planning", "Room 1.05 · Wed 09:30 · Onboarding"];
|
|
7478
|
+
|
|
7479
|
+
const OUTCOME: Record<ToastCloseReason, string> = {
|
|
7480
|
+
timeout: "The time ran out: the cancellation stands.",
|
|
7481
|
+
dismiss: "The toast was closed: the cancellation stands.",
|
|
7482
|
+
action: "Undone: the booking is back.",
|
|
7483
|
+
};
|
|
7484
|
+
|
|
7485
|
+
export default function Undo() {
|
|
7486
|
+
const { toast } = useToast();
|
|
7487
|
+
const [bookings, setBookings] = useState(BOOKINGS);
|
|
7488
|
+
const [outcome, setOutcome] = useState<string | null>(null);
|
|
7489
|
+
|
|
7490
|
+
const cancel = (booking: string) => {
|
|
7491
|
+
setBookings((list) => list.filter((entry) => entry !== booking));
|
|
7492
|
+
setOutcome(null);
|
|
7493
|
+
toast({
|
|
7494
|
+
title: "Booking cancelled",
|
|
7495
|
+
description: booking,
|
|
7496
|
+
action: {
|
|
7497
|
+
label: "Undo",
|
|
7498
|
+
/* Back in its place in the week, whatever went meanwhile. */
|
|
7499
|
+
onClick: () => setBookings((list) => BOOKINGS.filter((entry) => entry === booking || list.includes(entry))),
|
|
7500
|
+
},
|
|
7501
|
+
onClose: (reason) => setOutcome(OUTCOME[reason]),
|
|
7502
|
+
});
|
|
7503
|
+
};
|
|
7504
|
+
|
|
7505
|
+
return (
|
|
7506
|
+
<Stack gap={2} style={{ maxWidth: 480 }}>
|
|
7507
|
+
{bookings.map((booking) => (
|
|
7508
|
+
<Stack key={booking} direction="row" gap={3} align="center" justify="space-between">
|
|
7509
|
+
<Text size="sm">{booking}</Text>
|
|
7510
|
+
<Button size="sm" variant="secondary" onClick={() => cancel(booking)}>
|
|
7511
|
+
Cancel
|
|
7512
|
+
</Button>
|
|
7513
|
+
</Stack>
|
|
7514
|
+
))}
|
|
7515
|
+
<Text size="xs" tone="muted">
|
|
7516
|
+
{outcome ?? `${bookings.length} of ${BOOKINGS.length} rooms booked`}
|
|
7517
|
+
</Text>
|
|
7518
|
+
</Stack>
|
|
7519
|
+
);
|
|
7520
|
+
}
|
|
7521
|
+
```
|
|
7522
|
+
|
|
7118
7523
|
##### Keep it until it is closed
|
|
7119
7524
|
|
|
7120
7525
|
`duration: 0` keeps a toast until the reader closes it – for the rare message whose loss costs something.
|
|
@@ -7142,9 +7547,55 @@ export default function UntilClosed() {
|
|
|
7142
7547
|
}
|
|
7143
7548
|
```
|
|
7144
7549
|
|
|
7550
|
+
##### Save, and say how it went
|
|
7551
|
+
|
|
7552
|
+
A `loading` toast shows a spinner, has no close button and does not leave by itself; `update` turns it into its outcome in place, and only then does its time begin.
|
|
7553
|
+
|
|
7554
|
+
```tsx
|
|
7555
|
+
import { useEffect, useRef, useState } from "react";
|
|
7556
|
+
import { Button, Stack, Switch, useToast } from "@umriss-ui/core";
|
|
7557
|
+
|
|
7558
|
+
export default function SaveWithLoading() {
|
|
7559
|
+
const { toast, update } = useToast();
|
|
7560
|
+
const [fail, setFail] = useState(false);
|
|
7561
|
+
/* Read when the answer comes, so that "Try again" follows the switch. */
|
|
7562
|
+
const failRef = useRef(fail);
|
|
7563
|
+
useEffect(() => {
|
|
7564
|
+
failRef.current = fail;
|
|
7565
|
+
}, [fail]);
|
|
7566
|
+
|
|
7567
|
+
const publish = () => {
|
|
7568
|
+
const id = toast({ title: "Publishing release notes…", tone: "loading" });
|
|
7569
|
+
setTimeout(() => {
|
|
7570
|
+
if (failRef.current) {
|
|
7571
|
+
update(id, {
|
|
7572
|
+
title: "Release notes not published",
|
|
7573
|
+
description: "Two sections still have open review comments.",
|
|
7574
|
+
tone: "danger",
|
|
7575
|
+
action: { label: "Try again", onClick: publish },
|
|
7576
|
+
});
|
|
7577
|
+
} else {
|
|
7578
|
+
update(id, {
|
|
7579
|
+
title: "Release notes published",
|
|
7580
|
+
description: "All 214 subscribers were notified.",
|
|
7581
|
+
tone: "success",
|
|
7582
|
+
});
|
|
7583
|
+
}
|
|
7584
|
+
}, 1500);
|
|
7585
|
+
};
|
|
7586
|
+
|
|
7587
|
+
return (
|
|
7588
|
+
<Stack direction="row" gap={4} align="center" wrap>
|
|
7589
|
+
<Button onClick={publish}>Publish release notes</Button>
|
|
7590
|
+
<Switch label="Let it fail" checked={fail} onChange={(event) => setFail(event.target.checked)} />
|
|
7591
|
+
</Stack>
|
|
7592
|
+
);
|
|
7593
|
+
}
|
|
7594
|
+
```
|
|
7595
|
+
|
|
7145
7596
|
##### Confirm an action in a list
|
|
7146
7597
|
|
|
7147
|
-
The row changes where the reader looks; the toast confirms it in passing, so a second approval never waits on the first.
|
|
7598
|
+
The row changes where the reader looks; the toast confirms it in passing, so a second approval never waits on the first. Approve all three: the toasts stand as a deck with a count on the front one, and open under the pointer, on the count or with Alt+T.
|
|
7148
7599
|
|
|
7149
7600
|
```tsx
|
|
7150
7601
|
import { useState } from "react";
|
|
@@ -7195,6 +7646,59 @@ export default function AfterAnAction() {
|
|
|
7195
7646
|
}
|
|
7196
7647
|
```
|
|
7197
7648
|
|
|
7649
|
+
##### Where they stand
|
|
7650
|
+
|
|
7651
|
+
`toast.position` in the `UmrissProvider` puts every toast of the application at one edge and one place along it; the deck grows away from that edge. On a phone they take the window's width, and only the edge counts.
|
|
7652
|
+
|
|
7653
|
+
```tsx
|
|
7654
|
+
import { useMemo, useState } from "react";
|
|
7655
|
+
import { Button, Stack, ToastProvider, UmrissProvider, useToast } from "@umriss-ui/core";
|
|
7656
|
+
import type { ToastPosition } from "@umriss-ui/core";
|
|
7657
|
+
|
|
7658
|
+
const POSITIONS: { position: ToastPosition; label: string }[] = [
|
|
7659
|
+
{ position: "top-start", label: "Top start" },
|
|
7660
|
+
{ position: "top-center", label: "Top center" },
|
|
7661
|
+
{ position: "top-end", label: "Top end" },
|
|
7662
|
+
{ position: "bottom-start", label: "Bottom start" },
|
|
7663
|
+
{ position: "bottom-center", label: "Bottom center" },
|
|
7664
|
+
{ position: "bottom-end", label: "Bottom end" },
|
|
7665
|
+
];
|
|
7666
|
+
|
|
7667
|
+
function Buttons({ onPick }: { onPick: (position: ToastPosition) => void }) {
|
|
7668
|
+
const { toast } = useToast();
|
|
7669
|
+
return (
|
|
7670
|
+
<Stack direction="row" gap={2} wrap>
|
|
7671
|
+
{POSITIONS.map(({ position, label }) => (
|
|
7672
|
+
<Button
|
|
7673
|
+
key={position}
|
|
7674
|
+
size="sm"
|
|
7675
|
+
variant="secondary"
|
|
7676
|
+
onClick={() => {
|
|
7677
|
+
onPick(position);
|
|
7678
|
+
toast({ title: "Report exported", description: `Standing ${label.toLowerCase()}.`, tone: "success" });
|
|
7679
|
+
}}
|
|
7680
|
+
>
|
|
7681
|
+
{label}
|
|
7682
|
+
</Button>
|
|
7683
|
+
))}
|
|
7684
|
+
</Stack>
|
|
7685
|
+
);
|
|
7686
|
+
}
|
|
7687
|
+
|
|
7688
|
+
export default function WhereTheyStand() {
|
|
7689
|
+
const [position, setPosition] = useState<ToastPosition>("top-center");
|
|
7690
|
+
/* A new object is a new setting: kept until the position changes. */
|
|
7691
|
+
const config = useMemo(() => ({ position }), [position]);
|
|
7692
|
+
return (
|
|
7693
|
+
<UmrissProvider toast={config}>
|
|
7694
|
+
<ToastProvider>
|
|
7695
|
+
<Buttons onPick={setPosition} />
|
|
7696
|
+
</ToastProvider>
|
|
7697
|
+
</UmrissProvider>
|
|
7698
|
+
);
|
|
7699
|
+
}
|
|
7700
|
+
```
|
|
7701
|
+
|
|
7198
7702
|
#### When to use something else
|
|
7199
7703
|
|
|
7200
7704
|
- The reader must see it, or it stays true until something is done → Alert
|
|
@@ -7206,15 +7710,25 @@ export default function AfterAnAction() {
|
|
|
7206
7710
|
|
|
7207
7711
|
| Prop | Type | Default | Description |
|
|
7208
7712
|
|---|---|---|---|
|
|
7209
|
-
| `title` (required) | `string` | — | What has happened –
|
|
7713
|
+
| `title` (required) | `string` | — | What has happened – short, about one line (some 45 characters), in the perfect tense and not a request: "Invoice not sent". Why, and what to do next, belong in the description. A longer title wraps; it is never cut. |
|
|
7210
7714
|
| `description` | `string` | — | One more sentence where the title alone is too little. Nothing the reader MUST read: the toast goes away by itself. |
|
|
7211
|
-
| `tone` | `ToastTone` | — | How the message turns out. The tone is never the only information – the
|
|
7715
|
+
| `tone` | `ToastTone` | — | How the message turns out. The tone is never the only information – the glyph beside it and the text say the same thing once more. `loading` shows a spinner, has no close button and does not leave by itself: turn it into its outcome with `update`. |
|
|
7212
7716
|
| `duration` | `number` | — | Display duration in ms; 0 = stays until closed by hand. Default: 5000. |
|
|
7717
|
+
| `action` | `ToastAction` | — | One action - "Undo". Never the only way to do what it offers: the toast leaves by itself, and not everybody reaches it in time. More than one action is a dialog. |
|
|
7718
|
+
| `onClose` | `(reason: ToastCloseReason) => void` | — | Called once when the toast goes, with the reason. |
|
|
7719
|
+
|
|
7720
|
+
##### `ToastAction`
|
|
7721
|
+
|
|
7722
|
+
| Prop | Type | Default | Description |
|
|
7723
|
+
|---|---|---|---|
|
|
7724
|
+
| `label` (required) | `string` | — | A verb for what it does - "Undo", "Show". |
|
|
7725
|
+
| `onClick` (required) | `() => void` | — | Runs, and the toast goes with the reason `action`. |
|
|
7213
7726
|
|
|
7214
7727
|
#### Known limits
|
|
7215
7728
|
|
|
7216
|
-
-
|
|
7217
|
-
-
|
|
7729
|
+
- One action at most, and never the only way to what it offers: the toast leaves by itself. What needs a decision needs an [Alert](#/alert) or a [ConfirmDialog](#/confirmdialog).
|
|
7730
|
+
- One position for the whole application, set in the [UmrissProvider](#/umrissprovider); none per toast.
|
|
7731
|
+
- No queue: a toast over the limit pushes the oldest out rather than waiting.
|
|
7218
7732
|
|
|
7219
7733
|
What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0032-what-umriss-is-not.md).
|
|
7220
7734
|
|
|
@@ -7824,7 +8338,7 @@ What opens above the screen and closes again.
|
|
|
7824
8338
|
|
|
7825
8339
|
### Tooltip
|
|
7826
8340
|
|
|
7827
|
-
A sentence of explanation that appears while the pointer rests on an element or the keyboard focus is on it (also called a hint). Reach for it to
|
|
8341
|
+
A sentence of explanation that appears while the pointer rests on an element or the keyboard focus is on it (also called a hint). Reach for it to explain an abbreviation or a control; an icon button names itself as an [IconButton](#/iconbutton).
|
|
7828
8342
|
|
|
7829
8343
|
```ts
|
|
7830
8344
|
import { Tooltip } from "@umriss-ui/core";
|
|
@@ -7836,6 +8350,8 @@ It wraps exactly one element that can take focus and a ref; on text, give a `spa
|
|
|
7836
8350
|
|
|
7837
8351
|
Anything that stands only in a tooltip is lost on a touch screen. Keep it to a sentence that repeats or explains what is already there.
|
|
7838
8352
|
|
|
8353
|
+
It shows for keyboard focus, not for the focus a click leaves behind, and a tooltip that repeats its element's `aria-label` does not describe the element a second time.
|
|
8354
|
+
|
|
7839
8355
|
#### Examples
|
|
7840
8356
|
|
|
7841
8357
|
##### A tooltip
|
|
@@ -7875,34 +8391,6 @@ export default function Delay() {
|
|
|
7875
8391
|
}
|
|
7876
8392
|
```
|
|
7877
8393
|
|
|
7878
|
-
##### Name icon buttons
|
|
7879
|
-
|
|
7880
|
-
A button with only a glyph gets its name from `aria-label`; the tooltip shows the same words to a sighted reader.
|
|
7881
|
-
|
|
7882
|
-
```tsx
|
|
7883
|
-
import { Button, Stack, Tooltip } from "@umriss-ui/core";
|
|
7884
|
-
|
|
7885
|
-
const TOOLS = [
|
|
7886
|
-
{ glyph: "↻", label: "Refresh the tours" },
|
|
7887
|
-
{ glyph: "⇅", label: "Sort by departure" },
|
|
7888
|
-
{ glyph: "⤓", label: "Export the tour list" },
|
|
7889
|
-
];
|
|
7890
|
-
|
|
7891
|
-
export default function IconButtons() {
|
|
7892
|
-
return (
|
|
7893
|
-
<Stack direction="row" gap={1}>
|
|
7894
|
-
{TOOLS.map((tool) => (
|
|
7895
|
-
<Tooltip key={tool.label} content={tool.label}>
|
|
7896
|
-
<Button size="sm" variant="ghost" aria-label={tool.label}>
|
|
7897
|
-
<span aria-hidden="true">{tool.glyph}</span>
|
|
7898
|
-
</Button>
|
|
7899
|
-
</Tooltip>
|
|
7900
|
-
))}
|
|
7901
|
-
</Stack>
|
|
7902
|
-
);
|
|
7903
|
-
}
|
|
7904
|
-
```
|
|
7905
|
-
|
|
7906
8394
|
##### Explain an abbreviation
|
|
7907
8395
|
|
|
7908
8396
|
On text, make the element focusable with `tabIndex={0}` so a keyboard reader reaches the explanation too.
|
|
@@ -7963,7 +8451,7 @@ export default function AnAbbreviation() {
|
|
|
7963
8451
|
| Prop | Type | Default | Description |
|
|
7964
8452
|
|---|---|---|---|
|
|
7965
8453
|
| `content` (required) | `ReactNode` | — | Short help text; no interaction, no long content. |
|
|
7966
|
-
| `children` (required) | `ReactElement<Record<string, unknown>>` | — | Exactly one element that triggers the tooltip (must accept refs). Its own ref
|
|
8454
|
+
| `children` (required) | `ReactElement<Record<string, unknown>>` | — | Exactly one element that triggers the tooltip (must accept refs). Its own ref keeps its element: the tooltip holds the same one beside it. |
|
|
7967
8455
|
| `delay` | `number` | `300` | Delay in ms before the tooltip appears. |
|
|
7968
8456
|
|
|
7969
8457
|
#### Known limits
|
|
@@ -8186,7 +8674,7 @@ Demo page: https://romanhaendler.github.io/umriss-ui/core/menu/
|
|
|
8186
8674
|
|
|
8187
8675
|
The entries are things that happen, not values that stay; choosing one runs it and closes the menu so the result is in view.
|
|
8188
8676
|
|
|
8189
|
-
An
|
|
8677
|
+
An [IconButton](#/iconbutton) makes the trigger for a row; its label says what it acts on, such as “Actions for INC-1048”.
|
|
8190
8678
|
|
|
8191
8679
|
#### Examples
|
|
8192
8680
|
|
|
@@ -8266,7 +8754,7 @@ One menu per row keeps a list quiet; the trigger's name says which row it acts o
|
|
|
8266
8754
|
|
|
8267
8755
|
```tsx
|
|
8268
8756
|
import { useState } from "react";
|
|
8269
|
-
import { Badge,
|
|
8757
|
+
import { Badge, IconButton, Menu, MenuItem, MenuSeparator, Stack, Text } from "@umriss-ui/core";
|
|
8270
8758
|
|
|
8271
8759
|
interface Incident {
|
|
8272
8760
|
id: string;
|
|
@@ -8294,7 +8782,7 @@ export default function PerRow() {
|
|
|
8294
8782
|
<Stack key={incident.id} direction="row" gap={3} align="center">
|
|
8295
8783
|
<Badge tone={TONE[incident.severity]}>{incident.severity}</Badge>
|
|
8296
8784
|
<Text size="sm" style={{ flex: 1 }}>
|
|
8297
|
-
<Text as="span" size="sm" mono>
|
|
8785
|
+
<Text as="span" size="sm" mono style={{ whiteSpace: "nowrap" }}>
|
|
8298
8786
|
{incident.id}
|
|
8299
8787
|
</Text>{" "}
|
|
8300
8788
|
{incident.title}
|
|
@@ -8305,9 +8793,9 @@ export default function PerRow() {
|
|
|
8305
8793
|
<Menu
|
|
8306
8794
|
align="end"
|
|
8307
8795
|
trigger={
|
|
8308
|
-
<
|
|
8796
|
+
<IconButton size="sm" aria-label={`Actions for ${incident.id}`}>
|
|
8309
8797
|
⋯
|
|
8310
|
-
</
|
|
8798
|
+
</IconButton>
|
|
8311
8799
|
}
|
|
8312
8800
|
>
|
|
8313
8801
|
<MenuItem disabled={incident.state !== "open"} onSelect={() => set(incident.id, "acknowledged")}>
|
|
@@ -8352,7 +8840,7 @@ export default function PerRow() {
|
|
|
8352
8840
|
|
|
8353
8841
|
| Prop | Type | Default | Description |
|
|
8354
8842
|
|---|---|---|---|
|
|
8355
|
-
| `trigger` (required) | `ReactElement<Record<string, unknown>>` | — | Trigger, e.g. a <Button>; must accept refs. |
|
|
8843
|
+
| `trigger` (required) | `ReactElement<Record<string, unknown>>` | — | Trigger, e.g. a <Button>; must accept refs. Its own ref keeps its element: the menu holds the same one beside it. |
|
|
8356
8844
|
| `children` (required) | `ReactNode` | — | The entries – typically `MenuItem` and `MenuSeparator`. |
|
|
8357
8845
|
| `align` | `"start" \| "end"` | `"start"` | Alignment of the panel relative to the trigger. |
|
|
8358
8846
|
|
|
@@ -8410,7 +8898,8 @@ export default function AtThePointer() {
|
|
|
8410
8898
|
<div
|
|
8411
8899
|
onContextMenu={openHere}
|
|
8412
8900
|
style={{
|
|
8413
|
-
width:
|
|
8901
|
+
width: "100%",
|
|
8902
|
+
maxWidth: 320,
|
|
8414
8903
|
height: 120,
|
|
8415
8904
|
display: "grid",
|
|
8416
8905
|
placeItems: "center",
|
|
@@ -9496,7 +9985,10 @@ export default function RouteItYourself() {
|
|
|
9496
9985
|
|
|
9497
9986
|
return (
|
|
9498
9987
|
<Stack gap={3} align="flex-start">
|
|
9499
|
-
<Breadcrumb
|
|
9988
|
+
<Breadcrumb
|
|
9989
|
+
items={trail.map((label, i) => ({ label, onSelect: () => setDepth(i + 1) }))}
|
|
9990
|
+
style={{ alignSelf: "stretch" }}
|
|
9991
|
+
/>
|
|
9500
9992
|
<Text size="xs" tone="muted">
|
|
9501
9993
|
Page: {trail[trail.length - 1]}
|
|
9502
9994
|
</Text>
|
|
@@ -9529,11 +10021,11 @@ export default function FoldWhenNarrow() {
|
|
|
9529
10021
|
return (
|
|
9530
10022
|
<Stack gap={4}>
|
|
9531
10023
|
{[300, 480].map((width) => (
|
|
9532
|
-
<Card key={width} style={{ width }}>
|
|
10024
|
+
<Card key={width} style={{ width: "100%", maxWidth: width }}>
|
|
9533
10025
|
<CardBody>
|
|
9534
10026
|
<Stack gap={2}>
|
|
9535
10027
|
<Text size="xs" tone="muted">
|
|
9536
|
-
{width} pixels
|
|
10028
|
+
Up to {width} pixels
|
|
9537
10029
|
</Text>
|
|
9538
10030
|
<Breadcrumb items={TRAIL} />
|
|
9539
10031
|
</Stack>
|
|
@@ -9702,7 +10194,7 @@ export default function WhereAProcedureStands() {
|
|
|
9702
10194
|
aria-label="Incident INC-1048"
|
|
9703
10195
|
steps={[{ label: "Detect" }, { label: "Acknowledge" }, { label: "Mitigate" }, { label: "Resolve" }, { label: "Review" }]}
|
|
9704
10196
|
current={2}
|
|
9705
|
-
style={{ maxWidth:
|
|
10197
|
+
style={{ maxWidth: 720 }}
|
|
9706
10198
|
/>
|
|
9707
10199
|
);
|
|
9708
10200
|
}
|
|
@@ -11384,7 +11876,7 @@ export default function TeamCapacity() {
|
|
|
11384
11876
|
<td style={CELL}>
|
|
11385
11877
|
<Meter value={share} tone={toneOf(share)} showLabel label={`Capacity booked, ${name}`} />
|
|
11386
11878
|
</td>
|
|
11387
|
-
<td style={{ ...CELL, textAlign: "right" }}>
|
|
11879
|
+
<td style={{ ...CELL, textAlign: "right", whiteSpace: "nowrap" }}>
|
|
11388
11880
|
<Text as="span" size="sm" mono>
|
|
11389
11881
|
{booked} / {available}
|
|
11390
11882
|
</Text>
|
|
@@ -11533,43 +12025,45 @@ const CELL = { padding: "var(--u-space-1) var(--u-space-3)", borderBottom: "1px
|
|
|
11533
12025
|
|
|
11534
12026
|
export default function InATable() {
|
|
11535
12027
|
return (
|
|
11536
|
-
<
|
|
11537
|
-
<
|
|
11538
|
-
<
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
<
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
</thead>
|
|
11548
|
-
<tbody>
|
|
11549
|
-
{ROWS.map(({ service, p95, now }) => (
|
|
11550
|
-
<tr key={service.id}>
|
|
11551
|
-
<td style={CELL}>
|
|
11552
|
-
<Text as="span" size="sm">
|
|
11553
|
-
{service.name}
|
|
11554
|
-
</Text>
|
|
11555
|
-
</td>
|
|
11556
|
-
<td style={CELL}>
|
|
11557
|
-
<Sparkline data={p95} />
|
|
11558
|
-
</td>
|
|
11559
|
-
<td style={{ ...CELL, textAlign: "right" }}>
|
|
11560
|
-
<Text as="span" size="sm" mono>
|
|
11561
|
-
{now} ms
|
|
11562
|
-
</Text>
|
|
11563
|
-
</td>
|
|
11564
|
-
<td style={{ ...CELL, textAlign: "right" }}>
|
|
11565
|
-
<Text as="span" size="sm" mono tone="muted">
|
|
11566
|
-
{service.latencySlo} ms
|
|
11567
|
-
</Text>
|
|
11568
|
-
</td>
|
|
12028
|
+
<div style={{ overflowX: "auto" }}>
|
|
12029
|
+
<table style={{ borderCollapse: "collapse", maxWidth: 560, width: "100%" }}>
|
|
12030
|
+
<thead>
|
|
12031
|
+
<tr>
|
|
12032
|
+
{["Service", "p95, last 2 h", "Now", "Objective"].map((head, i) => (
|
|
12033
|
+
<th key={head} style={{ ...CELL, textAlign: i >= 2 ? "right" : "left", whiteSpace: "nowrap" }}>
|
|
12034
|
+
<Text as="span" size="xs" tone="muted">
|
|
12035
|
+
{head}
|
|
12036
|
+
</Text>
|
|
12037
|
+
</th>
|
|
12038
|
+
))}
|
|
11569
12039
|
</tr>
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
12040
|
+
</thead>
|
|
12041
|
+
<tbody>
|
|
12042
|
+
{ROWS.map(({ service, p95, now }) => (
|
|
12043
|
+
<tr key={service.id}>
|
|
12044
|
+
<td style={CELL}>
|
|
12045
|
+
<Text as="span" size="sm">
|
|
12046
|
+
{service.name}
|
|
12047
|
+
</Text>
|
|
12048
|
+
</td>
|
|
12049
|
+
<td style={CELL}>
|
|
12050
|
+
<Sparkline data={p95} />
|
|
12051
|
+
</td>
|
|
12052
|
+
<td style={{ ...CELL, textAlign: "right", whiteSpace: "nowrap" }}>
|
|
12053
|
+
<Text as="span" size="sm" mono>
|
|
12054
|
+
{now} ms
|
|
12055
|
+
</Text>
|
|
12056
|
+
</td>
|
|
12057
|
+
<td style={{ ...CELL, textAlign: "right", whiteSpace: "nowrap" }}>
|
|
12058
|
+
<Text as="span" size="sm" mono tone="muted">
|
|
12059
|
+
{service.latencySlo} ms
|
|
12060
|
+
</Text>
|
|
12061
|
+
</td>
|
|
12062
|
+
</tr>
|
|
12063
|
+
))}
|
|
12064
|
+
</tbody>
|
|
12065
|
+
</table>
|
|
12066
|
+
</div>
|
|
11573
12067
|
);
|
|
11574
12068
|
}
|
|
11575
12069
|
```
|
|
@@ -11865,25 +12359,26 @@ export default function AFilterBar() {
|
|
|
11865
12359
|
return (
|
|
11866
12360
|
<Stack gap={3} style={{ maxWidth: 560 }}>
|
|
11867
12361
|
<Stack direction="row" gap={3} align="center" wrap>
|
|
11868
|
-
<
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
</option>
|
|
11881
|
-
{OPTIONS.map((option, i) => (
|
|
11882
|
-
<option key={option.value} value={i}>
|
|
11883
|
-
{option.key === "depot" ? "Depot" : "Status"}: {option.value}
|
|
12362
|
+
<div style={{ width: 200 }}>
|
|
12363
|
+
<Select
|
|
12364
|
+
selectSize="sm"
|
|
12365
|
+
aria-label="Add a filter"
|
|
12366
|
+
value=""
|
|
12367
|
+
onChange={(event) => {
|
|
12368
|
+
const picked = OPTIONS[Number(event.target.value)];
|
|
12369
|
+
if (picked && !filters.some((f) => f.value === picked.value)) setFilters([...filters, picked]);
|
|
12370
|
+
}}
|
|
12371
|
+
>
|
|
12372
|
+
<option value="" disabled>
|
|
12373
|
+
Add a filter …
|
|
11884
12374
|
</option>
|
|
11885
|
-
|
|
11886
|
-
|
|
12375
|
+
{OPTIONS.map((option, i) => (
|
|
12376
|
+
<option key={option.value} value={i}>
|
|
12377
|
+
{option.key === "depot" ? "Depot" : "Status"}: {option.value}
|
|
12378
|
+
</option>
|
|
12379
|
+
))}
|
|
12380
|
+
</Select>
|
|
12381
|
+
</div>
|
|
11887
12382
|
<TagGroup aria-label="Active filters">
|
|
11888
12383
|
{filters.map((filter) => (
|
|
11889
12384
|
<Tag key={filter.value} tone="accent" onRemove={() => setFilters(filters.filter((f) => f !== filter))}>
|
|
@@ -12660,7 +13155,10 @@ The demos' shared data, which some examples import from beside themselves. Copie
|
|
|
12660
13155
|
* where the month is closed (January and February), the forecast for every
|
|
12661
13156
|
* month; Marketing overspends, IT runs under;
|
|
12662
13157
|
* - `INVOICES` - incoming invoices with their lines (quantity, unit price,
|
|
12663
|
-
* discount, VAT rate), and `APPROVALS`, who signed which, or has yet to
|
|
13158
|
+
* discount, VAT rate), and `APPROVALS`, who signed which, or has yet to;
|
|
13159
|
+
* - `TEAMS` - the teams of each cost centre with their headcount, full-time
|
|
13160
|
+
* equivalents and monthly staff cost, and `BUSINESS_LINES`, which cost
|
|
13161
|
+
* centres each of the three business lines holds.
|
|
12664
13162
|
*
|
|
12665
13163
|
* Amounts in euros. "Now" is Tuesday, 17 March 2026. Plain data and small pure
|
|
12666
13164
|
* functions, no imports: copy the file beside an example and it runs.
|
|
@@ -12812,6 +13310,58 @@ export const APPROVALS: readonly Approval[] = [
|
|
|
12812
13310
|
{ invoice: "INV-26-0226", step: "finance", approver: "Martina Vogel", decision: "approved", at: on(3, 2) },
|
|
12813
13311
|
{ invoice: "INV-26-0221", step: "cost centre", approver: "Anika Sørensen", decision: "rejected", at: on(2, 24), comment: "Not ordered - the review was cancelled in January." },
|
|
12814
13312
|
];
|
|
13313
|
+
|
|
13314
|
+
export interface Team {
|
|
13315
|
+
/** The cost centre the team books to. */
|
|
13316
|
+
costCentre: string;
|
|
13317
|
+
name: string;
|
|
13318
|
+
/** People employed, whatever their hours. */
|
|
13319
|
+
headcount: number;
|
|
13320
|
+
/** Full-time equivalents: contracted hours over 40 a week. */
|
|
13321
|
+
fte: number;
|
|
13322
|
+
/** Staff cost of a month, in thousand euros. */
|
|
13323
|
+
monthlyCost: number;
|
|
13324
|
+
}
|
|
13325
|
+
|
|
13326
|
+
/** Every team, on 17 March: 102 people, 91.5 full-time equivalents. */
|
|
13327
|
+
export const TEAMS: readonly Team[] = [
|
|
13328
|
+
{ costCentre: "CC-1100", name: "Field sales North", headcount: 9, fte: 8.6, monthlyCost: 61.2 },
|
|
13329
|
+
{ costCentre: "CC-1100", name: "Field sales South", headcount: 8, fte: 7.5, monthlyCost: 53.9 },
|
|
13330
|
+
{ costCentre: "CC-1100", name: "Inside sales", headcount: 6, fte: 5.2, monthlyCost: 29.8 },
|
|
13331
|
+
{ costCentre: "CC-1100", name: "Key accounts", headcount: 4, fte: 4.0, monthlyCost: 33.6 },
|
|
13332
|
+
{ costCentre: "CC-1200", name: "Brand", headcount: 3, fte: 2.8, monthlyCost: 19.4 },
|
|
13333
|
+
{ costCentre: "CC-1200", name: "Online marketing", headcount: 4, fte: 3.5, monthlyCost: 24.1 },
|
|
13334
|
+
{ costCentre: "CC-1200", name: "Trade fairs", headcount: 2, fte: 1.5, monthlyCost: 10.2 },
|
|
13335
|
+
{ costCentre: "CC-3100", name: "Service desk", headcount: 7, fte: 5.9, monthlyCost: 31.3 },
|
|
13336
|
+
{ costCentre: "CC-3100", name: "Returns", headcount: 3, fte: 2.5, monthlyCost: 12.6 },
|
|
13337
|
+
{ costCentre: "CC-2100", name: "Seating", headcount: 6, fte: 5.8, monthlyCost: 43.5 },
|
|
13338
|
+
{ costCentre: "CC-2100", name: "Desks", headcount: 7, fte: 6.5, monthlyCost: 48.1 },
|
|
13339
|
+
{ costCentre: "CC-2100", name: "Storage", headcount: 5, fte: 4.6, monthlyCost: 33.9 },
|
|
13340
|
+
{ costCentre: "CC-2100", name: "Test lab", headcount: 3, fte: 2.5, monthlyCost: 16.8 },
|
|
13341
|
+
{ costCentre: "CC-2200", name: "Industrial design", headcount: 4, fte: 3.6, monthlyCost: 27.2 },
|
|
13342
|
+
{ costCentre: "CC-2200", name: "Colour and material", headcount: 2, fte: 1.8, monthlyCost: 12.9 },
|
|
13343
|
+
{ costCentre: "CC-4100", name: "Accounting", headcount: 5, fte: 4.4, monthlyCost: 27.5 },
|
|
13344
|
+
{ costCentre: "CC-4100", name: "Controlling", headcount: 3, fte: 3.0, monthlyCost: 21.3 },
|
|
13345
|
+
{ costCentre: "CC-4200", name: "Recruiting", headcount: 2, fte: 1.8, monthlyCost: 12.4 },
|
|
13346
|
+
{ costCentre: "CC-4200", name: "Payroll", headcount: 2, fte: 1.5, monthlyCost: 9.6 },
|
|
13347
|
+
{ costCentre: "CC-4300", name: "Workplace", headcount: 4, fte: 3.8, monthlyCost: 24.2 },
|
|
13348
|
+
{ costCentre: "CC-4300", name: "Applications", headcount: 5, fte: 4.5, monthlyCost: 34.8 },
|
|
13349
|
+
{ costCentre: "CC-4400", name: "Buildings", headcount: 3, fte: 3.0, monthlyCost: 16.9 },
|
|
13350
|
+
{ costCentre: "CC-4400", name: "Canteen", headcount: 5, fte: 3.2, monthlyCost: 14.7 },
|
|
13351
|
+
];
|
|
13352
|
+
|
|
13353
|
+
export interface BusinessLine {
|
|
13354
|
+
name: string;
|
|
13355
|
+
/** Its cost centres, in the order a report lists them. */
|
|
13356
|
+
costCentres: readonly string[];
|
|
13357
|
+
}
|
|
13358
|
+
|
|
13359
|
+
/** How the company reports: three business lines over the nine cost centres. */
|
|
13360
|
+
export const BUSINESS_LINES: readonly BusinessLine[] = [
|
|
13361
|
+
{ name: "Commercial", costCentres: ["CC-1100", "CC-1200", "CC-3100"] },
|
|
13362
|
+
{ name: "Product", costCentres: ["CC-2100", "CC-2200"] },
|
|
13363
|
+
{ name: "Corporate services", costCentres: ["CC-4100", "CC-4200", "CC-4300", "CC-4400"] },
|
|
13364
|
+
];
|
|
12815
13365
|
```
|
|
12816
13366
|
|
|
12817
13367
|
### `logistics.ts`
|
|
@@ -13348,7 +13898,7 @@ export interface AlertType {
|
|
|
13348
13898
|
|
|
13349
13899
|
export const ALERT_TYPES: readonly AlertType[] = [
|
|
13350
13900
|
{ id: "checkout-latency", label: "Checkout · p95 latency above 300 ms", priority: "high" },
|
|
13351
|
-
{ id: "checkout-errors", label: "Checkout · error rate above 2
|
|
13901
|
+
{ id: "checkout-errors", label: "Checkout · error rate above 2\u00a0%", priority: "high" },
|
|
13352
13902
|
{ id: "webhooks-queue", label: "Webhooks · queue older than 5 min", priority: "medium" },
|
|
13353
13903
|
{ id: "search-latency", label: "Search · p95 latency above 250 ms", priority: "medium" },
|
|
13354
13904
|
{ id: "images-disk", label: "Image service · disk 85 % full", priority: "low" },
|