@umriss-ui/core 0.14.1 → 0.16.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 +78 -0
- package/README.md +1 -1
- package/dist/core.css +1 -1
- package/dist/core.js +3409 -3173
- package/dist/de.d.ts +4 -0
- package/dist/index.d.ts +50 -6
- package/dist/wording/de.js +2 -0
- package/docs/llms-full.md +318 -123
- 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.16.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>
|
|
@@ -4082,7 +4100,7 @@ export default function InvoiceToolbar() {
|
|
|
4082
4100
|
return (
|
|
4083
4101
|
<Stack gap={3}>
|
|
4084
4102
|
<Stack direction="row" gap={3} align="center" justify="space-between" wrap>
|
|
4085
|
-
<Stack direction="row" gap={3} align="center">
|
|
4103
|
+
<Stack direction="row" gap={3} align="center" wrap>
|
|
4086
4104
|
<ButtonGroup aria-label="Invoices awaiting approval">
|
|
4087
4105
|
<Button size="sm" disabled={index === 0} onClick={() => setIndex(index - 1)}>
|
|
4088
4106
|
Previous
|
|
@@ -6238,7 +6256,7 @@ export default function FilterIncidentsByService() {
|
|
|
6238
6256
|
{shown.map((incident) => (
|
|
6239
6257
|
<Stack key={incident.id} direction="row" gap={3} align="center">
|
|
6240
6258
|
<Badge tone={incident.severity === "SEV1" ? "danger" : "warning"}>{incident.severity}</Badge>
|
|
6241
|
-
<Text size="sm" mono>
|
|
6259
|
+
<Text size="sm" mono style={{ flex: "none" }}>
|
|
6242
6260
|
{incident.id}
|
|
6243
6261
|
</Text>
|
|
6244
6262
|
<Text size="sm">{incident.title}</Text>
|
|
@@ -7065,15 +7083,21 @@ Demo page: https://romanhaendler.github.io/umriss-ui/core/toast/
|
|
|
7065
7083
|
|
|
7066
7084
|
`useToast` needs a `ToastProvider` around the application, once, at the root.
|
|
7067
7085
|
|
|
7068
|
-
A toast stays five seconds by default. Its clock stops while the pointer
|
|
7086
|
+
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.
|
|
7087
|
+
|
|
7088
|
+
The title says what has happened, in about one line: “Invoice not sent”. Why, and what to do next, go in the description.
|
|
7069
7089
|
|
|
7070
7090
|
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
7091
|
|
|
7092
|
+
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.
|
|
7093
|
+
|
|
7094
|
+
At most three stand at once (`toast.limit` in the [UmrissProvider](#/umrissprovider)); the oldest gives way to a new one, as if closed.
|
|
7095
|
+
|
|
7072
7096
|
#### Examples
|
|
7073
7097
|
|
|
7074
7098
|
##### Show a toast
|
|
7075
7099
|
|
|
7076
|
-
Call `toast()` from `useToast` with what has happened; a `ToastProvider` at the root of the application holds
|
|
7100
|
+
Call `toast()` from `useToast` with what has happened; a `ToastProvider` at the root of the application holds them.
|
|
7077
7101
|
|
|
7078
7102
|
```tsx
|
|
7079
7103
|
import { Button, useToast } from "@umriss-ui/core";
|
|
@@ -7115,6 +7139,61 @@ export default function Tones() {
|
|
|
7115
7139
|
}
|
|
7116
7140
|
```
|
|
7117
7141
|
|
|
7142
|
+
##### Undo
|
|
7143
|
+
|
|
7144
|
+
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.
|
|
7145
|
+
|
|
7146
|
+
```tsx
|
|
7147
|
+
import { useState } from "react";
|
|
7148
|
+
import { Button, Stack, Text, useToast } from "@umriss-ui/core";
|
|
7149
|
+
import type { ToastCloseReason } from "@umriss-ui/core";
|
|
7150
|
+
|
|
7151
|
+
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"];
|
|
7152
|
+
|
|
7153
|
+
const OUTCOME: Record<ToastCloseReason, string> = {
|
|
7154
|
+
timeout: "The time ran out: the cancellation stands.",
|
|
7155
|
+
dismiss: "The toast was closed: the cancellation stands.",
|
|
7156
|
+
action: "Undone: the booking is back.",
|
|
7157
|
+
};
|
|
7158
|
+
|
|
7159
|
+
export default function Undo() {
|
|
7160
|
+
const { toast } = useToast();
|
|
7161
|
+
const [bookings, setBookings] = useState(BOOKINGS);
|
|
7162
|
+
const [outcome, setOutcome] = useState<string | null>(null);
|
|
7163
|
+
|
|
7164
|
+
const cancel = (booking: string) => {
|
|
7165
|
+
setBookings((list) => list.filter((entry) => entry !== booking));
|
|
7166
|
+
setOutcome(null);
|
|
7167
|
+
toast({
|
|
7168
|
+
title: "Booking cancelled",
|
|
7169
|
+
description: booking,
|
|
7170
|
+
action: {
|
|
7171
|
+
label: "Undo",
|
|
7172
|
+
/* Back in its place in the week, whatever went meanwhile. */
|
|
7173
|
+
onClick: () => setBookings((list) => BOOKINGS.filter((entry) => entry === booking || list.includes(entry))),
|
|
7174
|
+
},
|
|
7175
|
+
onClose: (reason) => setOutcome(OUTCOME[reason]),
|
|
7176
|
+
});
|
|
7177
|
+
};
|
|
7178
|
+
|
|
7179
|
+
return (
|
|
7180
|
+
<Stack gap={2} style={{ maxWidth: 480 }}>
|
|
7181
|
+
{bookings.map((booking) => (
|
|
7182
|
+
<Stack key={booking} direction="row" gap={3} align="center" justify="space-between">
|
|
7183
|
+
<Text size="sm">{booking}</Text>
|
|
7184
|
+
<Button size="sm" variant="secondary" onClick={() => cancel(booking)}>
|
|
7185
|
+
Cancel
|
|
7186
|
+
</Button>
|
|
7187
|
+
</Stack>
|
|
7188
|
+
))}
|
|
7189
|
+
<Text size="xs" tone="muted">
|
|
7190
|
+
{outcome ?? `${bookings.length} of ${BOOKINGS.length} rooms booked`}
|
|
7191
|
+
</Text>
|
|
7192
|
+
</Stack>
|
|
7193
|
+
);
|
|
7194
|
+
}
|
|
7195
|
+
```
|
|
7196
|
+
|
|
7118
7197
|
##### Keep it until it is closed
|
|
7119
7198
|
|
|
7120
7199
|
`duration: 0` keeps a toast until the reader closes it – for the rare message whose loss costs something.
|
|
@@ -7142,9 +7221,55 @@ export default function UntilClosed() {
|
|
|
7142
7221
|
}
|
|
7143
7222
|
```
|
|
7144
7223
|
|
|
7224
|
+
##### Save, and say how it went
|
|
7225
|
+
|
|
7226
|
+
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.
|
|
7227
|
+
|
|
7228
|
+
```tsx
|
|
7229
|
+
import { useEffect, useRef, useState } from "react";
|
|
7230
|
+
import { Button, Stack, Switch, useToast } from "@umriss-ui/core";
|
|
7231
|
+
|
|
7232
|
+
export default function SaveWithLoading() {
|
|
7233
|
+
const { toast, update } = useToast();
|
|
7234
|
+
const [fail, setFail] = useState(false);
|
|
7235
|
+
/* Read when the answer comes, so that "Try again" follows the switch. */
|
|
7236
|
+
const failRef = useRef(fail);
|
|
7237
|
+
useEffect(() => {
|
|
7238
|
+
failRef.current = fail;
|
|
7239
|
+
}, [fail]);
|
|
7240
|
+
|
|
7241
|
+
const publish = () => {
|
|
7242
|
+
const id = toast({ title: "Publishing release notes…", tone: "loading" });
|
|
7243
|
+
setTimeout(() => {
|
|
7244
|
+
if (failRef.current) {
|
|
7245
|
+
update(id, {
|
|
7246
|
+
title: "Release notes not published",
|
|
7247
|
+
description: "Two sections still have open review comments.",
|
|
7248
|
+
tone: "danger",
|
|
7249
|
+
action: { label: "Try again", onClick: publish },
|
|
7250
|
+
});
|
|
7251
|
+
} else {
|
|
7252
|
+
update(id, {
|
|
7253
|
+
title: "Release notes published",
|
|
7254
|
+
description: "All 214 subscribers were notified.",
|
|
7255
|
+
tone: "success",
|
|
7256
|
+
});
|
|
7257
|
+
}
|
|
7258
|
+
}, 1500);
|
|
7259
|
+
};
|
|
7260
|
+
|
|
7261
|
+
return (
|
|
7262
|
+
<Stack direction="row" gap={4} align="center" wrap>
|
|
7263
|
+
<Button onClick={publish}>Publish release notes</Button>
|
|
7264
|
+
<Switch label="Let it fail" checked={fail} onChange={(event) => setFail(event.target.checked)} />
|
|
7265
|
+
</Stack>
|
|
7266
|
+
);
|
|
7267
|
+
}
|
|
7268
|
+
```
|
|
7269
|
+
|
|
7145
7270
|
##### Confirm an action in a list
|
|
7146
7271
|
|
|
7147
|
-
The row changes where the reader looks; the toast confirms it in passing, so a second approval never waits on the first.
|
|
7272
|
+
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
7273
|
|
|
7149
7274
|
```tsx
|
|
7150
7275
|
import { useState } from "react";
|
|
@@ -7195,6 +7320,59 @@ export default function AfterAnAction() {
|
|
|
7195
7320
|
}
|
|
7196
7321
|
```
|
|
7197
7322
|
|
|
7323
|
+
##### Where they stand
|
|
7324
|
+
|
|
7325
|
+
`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.
|
|
7326
|
+
|
|
7327
|
+
```tsx
|
|
7328
|
+
import { useMemo, useState } from "react";
|
|
7329
|
+
import { Button, Stack, ToastProvider, UmrissProvider, useToast } from "@umriss-ui/core";
|
|
7330
|
+
import type { ToastPosition } from "@umriss-ui/core";
|
|
7331
|
+
|
|
7332
|
+
const POSITIONS: { position: ToastPosition; label: string }[] = [
|
|
7333
|
+
{ position: "top-start", label: "Top start" },
|
|
7334
|
+
{ position: "top-center", label: "Top center" },
|
|
7335
|
+
{ position: "top-end", label: "Top end" },
|
|
7336
|
+
{ position: "bottom-start", label: "Bottom start" },
|
|
7337
|
+
{ position: "bottom-center", label: "Bottom center" },
|
|
7338
|
+
{ position: "bottom-end", label: "Bottom end" },
|
|
7339
|
+
];
|
|
7340
|
+
|
|
7341
|
+
function Buttons({ onPick }: { onPick: (position: ToastPosition) => void }) {
|
|
7342
|
+
const { toast } = useToast();
|
|
7343
|
+
return (
|
|
7344
|
+
<Stack direction="row" gap={2} wrap>
|
|
7345
|
+
{POSITIONS.map(({ position, label }) => (
|
|
7346
|
+
<Button
|
|
7347
|
+
key={position}
|
|
7348
|
+
size="sm"
|
|
7349
|
+
variant="secondary"
|
|
7350
|
+
onClick={() => {
|
|
7351
|
+
onPick(position);
|
|
7352
|
+
toast({ title: "Report exported", description: `Standing ${label.toLowerCase()}.`, tone: "success" });
|
|
7353
|
+
}}
|
|
7354
|
+
>
|
|
7355
|
+
{label}
|
|
7356
|
+
</Button>
|
|
7357
|
+
))}
|
|
7358
|
+
</Stack>
|
|
7359
|
+
);
|
|
7360
|
+
}
|
|
7361
|
+
|
|
7362
|
+
export default function WhereTheyStand() {
|
|
7363
|
+
const [position, setPosition] = useState<ToastPosition>("top-center");
|
|
7364
|
+
/* A new object is a new setting: kept until the position changes. */
|
|
7365
|
+
const config = useMemo(() => ({ position }), [position]);
|
|
7366
|
+
return (
|
|
7367
|
+
<UmrissProvider toast={config}>
|
|
7368
|
+
<ToastProvider>
|
|
7369
|
+
<Buttons onPick={setPosition} />
|
|
7370
|
+
</ToastProvider>
|
|
7371
|
+
</UmrissProvider>
|
|
7372
|
+
);
|
|
7373
|
+
}
|
|
7374
|
+
```
|
|
7375
|
+
|
|
7198
7376
|
#### When to use something else
|
|
7199
7377
|
|
|
7200
7378
|
- The reader must see it, or it stays true until something is done → Alert
|
|
@@ -7206,15 +7384,25 @@ export default function AfterAnAction() {
|
|
|
7206
7384
|
|
|
7207
7385
|
| Prop | Type | Default | Description |
|
|
7208
7386
|
|---|---|---|---|
|
|
7209
|
-
| `title` (required) | `string` | — | What has happened –
|
|
7387
|
+
| `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
7388
|
| `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
|
|
7389
|
+
| `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
7390
|
| `duration` | `number` | — | Display duration in ms; 0 = stays until closed by hand. Default: 5000. |
|
|
7391
|
+
| `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. |
|
|
7392
|
+
| `onClose` | `(reason: ToastCloseReason) => void` | — | Called once when the toast goes, with the reason. |
|
|
7393
|
+
|
|
7394
|
+
##### `ToastAction`
|
|
7395
|
+
|
|
7396
|
+
| Prop | Type | Default | Description |
|
|
7397
|
+
|---|---|---|---|
|
|
7398
|
+
| `label` (required) | `string` | — | A verb for what it does - "Undo", "Show". |
|
|
7399
|
+
| `onClick` (required) | `() => void` | — | Runs, and the toast goes with the reason `action`. |
|
|
7213
7400
|
|
|
7214
7401
|
#### Known limits
|
|
7215
7402
|
|
|
7216
|
-
-
|
|
7217
|
-
-
|
|
7403
|
+
- 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).
|
|
7404
|
+
- One position for the whole application, set in the [UmrissProvider](#/umrissprovider); none per toast.
|
|
7405
|
+
- No queue: a toast over the limit pushes the oldest out rather than waiting.
|
|
7218
7406
|
|
|
7219
7407
|
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
7408
|
|
|
@@ -8294,7 +8482,7 @@ export default function PerRow() {
|
|
|
8294
8482
|
<Stack key={incident.id} direction="row" gap={3} align="center">
|
|
8295
8483
|
<Badge tone={TONE[incident.severity]}>{incident.severity}</Badge>
|
|
8296
8484
|
<Text size="sm" style={{ flex: 1 }}>
|
|
8297
|
-
<Text as="span" size="sm" mono>
|
|
8485
|
+
<Text as="span" size="sm" mono style={{ whiteSpace: "nowrap" }}>
|
|
8298
8486
|
{incident.id}
|
|
8299
8487
|
</Text>{" "}
|
|
8300
8488
|
{incident.title}
|
|
@@ -8410,7 +8598,8 @@ export default function AtThePointer() {
|
|
|
8410
8598
|
<div
|
|
8411
8599
|
onContextMenu={openHere}
|
|
8412
8600
|
style={{
|
|
8413
|
-
width:
|
|
8601
|
+
width: "100%",
|
|
8602
|
+
maxWidth: 320,
|
|
8414
8603
|
height: 120,
|
|
8415
8604
|
display: "grid",
|
|
8416
8605
|
placeItems: "center",
|
|
@@ -9496,7 +9685,10 @@ export default function RouteItYourself() {
|
|
|
9496
9685
|
|
|
9497
9686
|
return (
|
|
9498
9687
|
<Stack gap={3} align="flex-start">
|
|
9499
|
-
<Breadcrumb
|
|
9688
|
+
<Breadcrumb
|
|
9689
|
+
items={trail.map((label, i) => ({ label, onSelect: () => setDepth(i + 1) }))}
|
|
9690
|
+
style={{ alignSelf: "stretch" }}
|
|
9691
|
+
/>
|
|
9500
9692
|
<Text size="xs" tone="muted">
|
|
9501
9693
|
Page: {trail[trail.length - 1]}
|
|
9502
9694
|
</Text>
|
|
@@ -9529,11 +9721,11 @@ export default function FoldWhenNarrow() {
|
|
|
9529
9721
|
return (
|
|
9530
9722
|
<Stack gap={4}>
|
|
9531
9723
|
{[300, 480].map((width) => (
|
|
9532
|
-
<Card key={width} style={{ width }}>
|
|
9724
|
+
<Card key={width} style={{ width: "100%", maxWidth: width }}>
|
|
9533
9725
|
<CardBody>
|
|
9534
9726
|
<Stack gap={2}>
|
|
9535
9727
|
<Text size="xs" tone="muted">
|
|
9536
|
-
{width} pixels
|
|
9728
|
+
Up to {width} pixels
|
|
9537
9729
|
</Text>
|
|
9538
9730
|
<Breadcrumb items={TRAIL} />
|
|
9539
9731
|
</Stack>
|
|
@@ -9702,7 +9894,7 @@ export default function WhereAProcedureStands() {
|
|
|
9702
9894
|
aria-label="Incident INC-1048"
|
|
9703
9895
|
steps={[{ label: "Detect" }, { label: "Acknowledge" }, { label: "Mitigate" }, { label: "Resolve" }, { label: "Review" }]}
|
|
9704
9896
|
current={2}
|
|
9705
|
-
style={{ maxWidth:
|
|
9897
|
+
style={{ maxWidth: 720 }}
|
|
9706
9898
|
/>
|
|
9707
9899
|
);
|
|
9708
9900
|
}
|
|
@@ -11384,7 +11576,7 @@ export default function TeamCapacity() {
|
|
|
11384
11576
|
<td style={CELL}>
|
|
11385
11577
|
<Meter value={share} tone={toneOf(share)} showLabel label={`Capacity booked, ${name}`} />
|
|
11386
11578
|
</td>
|
|
11387
|
-
<td style={{ ...CELL, textAlign: "right" }}>
|
|
11579
|
+
<td style={{ ...CELL, textAlign: "right", whiteSpace: "nowrap" }}>
|
|
11388
11580
|
<Text as="span" size="sm" mono>
|
|
11389
11581
|
{booked} / {available}
|
|
11390
11582
|
</Text>
|
|
@@ -11533,43 +11725,45 @@ const CELL = { padding: "var(--u-space-1) var(--u-space-3)", borderBottom: "1px
|
|
|
11533
11725
|
|
|
11534
11726
|
export default function InATable() {
|
|
11535
11727
|
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>
|
|
11728
|
+
<div style={{ overflowX: "auto" }}>
|
|
11729
|
+
<table style={{ borderCollapse: "collapse", maxWidth: 560, width: "100%" }}>
|
|
11730
|
+
<thead>
|
|
11731
|
+
<tr>
|
|
11732
|
+
{["Service", "p95, last 2 h", "Now", "Objective"].map((head, i) => (
|
|
11733
|
+
<th key={head} style={{ ...CELL, textAlign: i >= 2 ? "right" : "left", whiteSpace: "nowrap" }}>
|
|
11734
|
+
<Text as="span" size="xs" tone="muted">
|
|
11735
|
+
{head}
|
|
11736
|
+
</Text>
|
|
11737
|
+
</th>
|
|
11738
|
+
))}
|
|
11569
11739
|
</tr>
|
|
11570
|
-
|
|
11571
|
-
|
|
11572
|
-
|
|
11740
|
+
</thead>
|
|
11741
|
+
<tbody>
|
|
11742
|
+
{ROWS.map(({ service, p95, now }) => (
|
|
11743
|
+
<tr key={service.id}>
|
|
11744
|
+
<td style={CELL}>
|
|
11745
|
+
<Text as="span" size="sm">
|
|
11746
|
+
{service.name}
|
|
11747
|
+
</Text>
|
|
11748
|
+
</td>
|
|
11749
|
+
<td style={CELL}>
|
|
11750
|
+
<Sparkline data={p95} />
|
|
11751
|
+
</td>
|
|
11752
|
+
<td style={{ ...CELL, textAlign: "right", whiteSpace: "nowrap" }}>
|
|
11753
|
+
<Text as="span" size="sm" mono>
|
|
11754
|
+
{now} ms
|
|
11755
|
+
</Text>
|
|
11756
|
+
</td>
|
|
11757
|
+
<td style={{ ...CELL, textAlign: "right", whiteSpace: "nowrap" }}>
|
|
11758
|
+
<Text as="span" size="sm" mono tone="muted">
|
|
11759
|
+
{service.latencySlo} ms
|
|
11760
|
+
</Text>
|
|
11761
|
+
</td>
|
|
11762
|
+
</tr>
|
|
11763
|
+
))}
|
|
11764
|
+
</tbody>
|
|
11765
|
+
</table>
|
|
11766
|
+
</div>
|
|
11573
11767
|
);
|
|
11574
11768
|
}
|
|
11575
11769
|
```
|
|
@@ -11865,25 +12059,26 @@ export default function AFilterBar() {
|
|
|
11865
12059
|
return (
|
|
11866
12060
|
<Stack gap={3} style={{ maxWidth: 560 }}>
|
|
11867
12061
|
<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}
|
|
12062
|
+
<div style={{ width: 200 }}>
|
|
12063
|
+
<Select
|
|
12064
|
+
selectSize="sm"
|
|
12065
|
+
aria-label="Add a filter"
|
|
12066
|
+
value=""
|
|
12067
|
+
onChange={(event) => {
|
|
12068
|
+
const picked = OPTIONS[Number(event.target.value)];
|
|
12069
|
+
if (picked && !filters.some((f) => f.value === picked.value)) setFilters([...filters, picked]);
|
|
12070
|
+
}}
|
|
12071
|
+
>
|
|
12072
|
+
<option value="" disabled>
|
|
12073
|
+
Add a filter …
|
|
11884
12074
|
</option>
|
|
11885
|
-
|
|
11886
|
-
|
|
12075
|
+
{OPTIONS.map((option, i) => (
|
|
12076
|
+
<option key={option.value} value={i}>
|
|
12077
|
+
{option.key === "depot" ? "Depot" : "Status"}: {option.value}
|
|
12078
|
+
</option>
|
|
12079
|
+
))}
|
|
12080
|
+
</Select>
|
|
12081
|
+
</div>
|
|
11887
12082
|
<TagGroup aria-label="Active filters">
|
|
11888
12083
|
{filters.map((filter) => (
|
|
11889
12084
|
<Tag key={filter.value} tone="accent" onRemove={() => setFilters(filters.filter((f) => f !== filter))}>
|
|
@@ -13348,7 +13543,7 @@ export interface AlertType {
|
|
|
13348
13543
|
|
|
13349
13544
|
export const ALERT_TYPES: readonly AlertType[] = [
|
|
13350
13545
|
{ id: "checkout-latency", label: "Checkout · p95 latency above 300 ms", priority: "high" },
|
|
13351
|
-
{ id: "checkout-errors", label: "Checkout · error rate above 2
|
|
13546
|
+
{ id: "checkout-errors", label: "Checkout · error rate above 2\u00a0%", priority: "high" },
|
|
13352
13547
|
{ id: "webhooks-queue", label: "Webhooks · queue older than 5 min", priority: "medium" },
|
|
13353
13548
|
{ id: "search-latency", label: "Search · p95 latency above 250 ms", priority: "medium" },
|
|
13354
13549
|
{ id: "images-disk", label: "Image service · disk 85 % full", priority: "low" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umriss-ui/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "React component library for data-dense dashboards and tools - forms, date pickers, overlays, a tree view and a command palette. Precise, quiet, professional.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Roman Händler",
|