@umriss-ui/core 0.38.0 → 0.39.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/dist/index.d.ts CHANGED
@@ -2140,8 +2140,10 @@ export declare interface ToastConfig {
2140
2140
  stand in different places are not read as one.
2141
2141
  @default "bottom-end" */
2142
2142
  position?: ToastPosition;
2143
- /** How many toasts stand at once; the oldest gives way to a new one, as if
2144
- it had been closed.
2143
+ /** How many toasts that leave by themselves stand at once; the oldest of
2144
+ them gives way to a new one, as if it had been closed. A toast that
2145
+ stays (`duration: 0`) or is still at work (`loading`) neither counts nor
2146
+ gives way.
2145
2147
  @default 3 */
2146
2148
  limit?: number;
2147
2149
  }
@@ -2151,8 +2153,10 @@ declare interface ToastContextValue {
2151
2153
  toast: (options: ToastOptions) => number;
2152
2154
  /** Changes a standing toast. A new tone or a new `duration` starts its time
2153
2155
  afresh - so a `loading` toast turned into `success` begins to count then.
2154
- An id that no longer stands is ignored: a toast that gave way to newer
2155
- ones - a `loading` one too - has said so through `onClose`. */
2156
+ An id that no longer stands is ignored: a timed toast that gave way
2157
+ to newer ones has said so through `onClose`. A `loading` toast turned into
2158
+ its outcome counts toward the limit from the next arrival on; `update`
2159
+ itself pushes nothing out. */
2156
2160
  update: (id: number, options: Partial<ToastOptions>) => void;
2157
2161
  /** Closes a toast, with the reason `dismiss`. */
2158
2162
  dismiss: (id: number) => void;
@@ -2190,8 +2194,9 @@ export declare interface ToastOptions {
2190
2194
  export declare type ToastPosition = "top-start" | "top-center" | "top-end" | "bottom-start" | "bottom-center" | "bottom-end";
2191
2195
 
2192
2196
  /** Holds the toasts and draws them; `useToast` works only below it. Put it
2193
- once at the root of the application. Duration, position and limit come from
2194
- `UmrissProvider`'s `toast` where one stands around it. */
2197
+ once at the root of the application: a second one draws a second deck at
2198
+ the same place, and the two lie on each other. Duration, position and limit
2199
+ come from `UmrissProvider`'s `toast` where one stands around it. */
2195
2200
  export declare function ToastProvider({ children, held }: ToastProviderProps): JSX.Element;
2196
2201
 
2197
2202
  /** The props of `ToastProvider`. */
package/docs/llms-full.md CHANGED
@@ -1,4 +1,4 @@
1
- # @umriss-ui/core 0.38.0
1
+ # @umriss-ui/core 0.39.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
 
@@ -506,7 +506,6 @@ import {
506
506
  Stack,
507
507
  Switch,
508
508
  Text,
509
- ToastProvider,
510
509
  TreeView,
511
510
  useToast,
512
511
  useTree,
@@ -848,11 +847,7 @@ function Content() {
848
847
  /* `useToast` needs a `ToastProvider` above it; at the root of an application
849
848
  one provider serves every screen. */
850
849
  export default function DispatchATour() {
851
- return (
852
- <ToastProvider>
853
- <Content />
854
- </ToastProvider>
855
- );
850
+ return <Content />;
856
851
  }
857
852
  ```
858
853
 
@@ -2450,13 +2445,14 @@ Wrap the application once; here `toast` keeps every toast on screen for eight se
2450
2445
  ```tsx
2451
2446
  import { Button, ToastProvider, UmrissProvider, useToast, type ToastConfig } from "@umriss-ui/core";
2452
2447
 
2448
+ type ToastFn = ReturnType<typeof useToast>["toast"];
2449
+
2450
+ const deploy = (toast: ToastFn) => toast({ title: "Checkout 4.12.0 deployed", description: "Rolled out to all regions.", tone: "success" });
2451
+
2453
2452
  function DeployButton() {
2454
2453
  const { toast } = useToast();
2455
2454
  return (
2456
- <Button
2457
- variant="primary"
2458
- onClick={() => toast({ title: "Checkout 4.12.0 deployed", description: "Rolled out to all regions.", tone: "success" })}
2459
- >
2455
+ <Button variant="primary" onClick={() => deploy(toast)}>
2460
2456
  Deploy Checkout
2461
2457
  </Button>
2462
2458
  );
@@ -2534,15 +2530,20 @@ import { GERMAN_FORMATS, GERMAN_WORDING } from "@umriss-ui/core/wording/de";
2534
2530
  const LANGUAGE: UmrissProviderProps["language"] = { wording: GERMAN_WORDING, formats: GERMAN_FORMATS };
2535
2531
  const TOAST: ToastConfig = { duration: 3000 };
2536
2532
 
2533
+ type ToastFn = ReturnType<typeof useToast>["toast"];
2534
+
2535
+ const rebook = (toast: ToastFn) => toast({ title: "Shipment SH-1042 rebooked" });
2536
+
2537
2537
  function DeliveryDate() {
2538
2538
  const { toast } = useToast();
2539
+ const rebookNow = () => rebook(toast);
2539
2540
  const [date, setDate] = useState<Date | null>(new Date(2026, 2, 18));
2540
2541
  return (
2541
2542
  <Stack gap={3} align="flex-start">
2542
2543
  <FormField label="Delivery date">
2543
2544
  <DatePicker value={date} onChange={setDate} clearable />
2544
2545
  </FormField>
2545
- <Button size="sm" disabled={date === null} onClick={() => toast({ title: "Shipment SH-1042 rebooked" })}>
2546
+ <Button size="sm" disabled={date === null} onClick={rebookNow}>
2546
2547
  Rebook
2547
2548
  </Button>
2548
2549
  </Stack>
@@ -2586,7 +2587,7 @@ Where a `ToastProvider` stands inside it, the toasts' two live regions stand whe
2586
2587
  | `portalTarget` | [`PortalTarget`](#type-PortalTarget) | `null` | Where overlays portal to, unless an open dialog takes them. 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, and the toasts follow the topmost modal dialog, because a toast outside it lies behind it and is inert.<br>Shown in: [Open overlays inside a full-screen panel](#/umrissprovider/portal-target), [Set up an application](#/umrissprovider/everything-at-once) |
2587
2588
  | `toast` | [`ToastConfig`](#type-ToastConfig) | — | The setting for toasts: the display duration where the individual toast names none, where they stand, and how many stand at once.<br>Shown in: [At the root](#/umrissprovider/at-the-root), [Set up an application](#/umrissprovider/everything-at-once), [Where they stand (Toast)](#/toast/where-they-stand) and 1 more |
2588
2589
  | `language` | [`LanguageOptions`](#/language/type-LanguageOptions) | none - the surrounding language holds, English at the root | Formats and wording, entry by entry - see [Language](#/language).<br>Shown in: [Set up an application](#/umrissprovider/everything-at-once) |
2589
- | `children` *required* | `ReactNode` | — | The subtree the settings apply to.<br>Shown in: [At the root](#/umrissprovider/at-the-root), [Open overlays inside a full-screen panel](#/umrissprovider/portal-target), [Set up an application](#/umrissprovider/everything-at-once) and 2 more |
2590
+ | `children` *required* | `ReactNode` | — | The subtree the settings apply to.<br>Shown in: [Open overlays inside a full-screen panel](#/umrissprovider/portal-target), [Set up an application](#/umrissprovider/everything-at-once) |
2590
2591
 
2591
2592
  ##### `ToastConfig`
2592
2593
 
@@ -2594,7 +2595,7 @@ Where a `ToastProvider` stands inside it, the toasts' two live regions stand whe
2594
2595
  |---|---|---|---|
2595
2596
  | `duration` | `number` | `5000` | Display duration in ms, where the individual toast names none.<br>Shown in: [At the root](#/umrissprovider/at-the-root), [Set up an application](#/umrissprovider/everything-at-once) |
2596
2597
  | `position` | [`ToastPosition`](#type-ToastPosition)<br>`"top-start" \| "top-center" \| "top-end" \| "bottom-start" \| "bottom-center" \| "bottom-end"` | `"bottom-end"` | Where the toasts stand. There is no position per toast - toasts that stand in different places are not read as one.<br>Shown in: [Where they stand (Toast)](#/toast/where-they-stand) |
2597
- | `limit` | `number` | `3` | How many toasts stand at once; the oldest gives way to a new one, as if it had been closed.<br>Shown in: [How many stand at once (Toast)](#/toast/how-many-stand) |
2598
+ | `limit` | `number` | `3` | How many toasts that leave by themselves stand at once; the oldest of them gives way to a new one, as if it had been closed. A toast that stays (`duration: 0`) or is still at work (`loading`) neither counts nor gives way.<br>Shown in: [How many stand at once (Toast)](#/toast/how-many-stand) |
2598
2599
 
2599
2600
  ##### Types on this page
2600
2601
 
@@ -11703,7 +11704,7 @@ Nothing that must be read goes in a toast: whoever looked elsewhere has missed i
11703
11704
 
11704
11705
  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.
11705
11706
 
11706
- At most three stand at once (`toast.limit` in the [UmrissProvider](#/umrissprovider)); the oldest gives way to a new one, as if closed.
11707
+ At most three that leave by themselves stand at once (`toast.limit` in the [UmrissProvider](#/umrissprovider)); the oldest of them gives way to a new one, as if closed. A toast with `duration: 0` and a `loading` toast never give way and do not count.
11707
11708
 
11708
11709
  #### Examples
11709
11710
 
@@ -11712,7 +11713,7 @@ At most three stand at once (`toast.limit` in the [UmrissProvider](#/umrissprovi
11712
11713
  Call `toast()` from [`useToast`](#/api/useToast) with what has happened; a `ToastProvider` at the root of the application holds them.
11713
11714
 
11714
11715
  ```tsx
11715
- import { Button, ToastProvider, useToast } from "@umriss-ui/core";
11716
+ import { Button, useToast } from "@umriss-ui/core";
11716
11717
 
11717
11718
  function Content() {
11718
11719
  const { toast } = useToast();
@@ -11727,11 +11728,7 @@ function Content() {
11727
11728
  /* `useToast` needs a `ToastProvider` above it; at the root of an application
11728
11729
  one provider serves every screen. */
11729
11730
  export default function ShowAToast() {
11730
- return (
11731
- <ToastProvider>
11732
- <Content />
11733
- </ToastProvider>
11734
- );
11731
+ return <Content />;
11735
11732
  }
11736
11733
  ```
11737
11734
 
@@ -11740,7 +11737,7 @@ export default function ShowAToast() {
11740
11737
  The `tone` says how it turned out; a symbol and the words say the same, so the colour is never alone.
11741
11738
 
11742
11739
  ```tsx
11743
- import { Button, Stack, ToastProvider, useToast } from "@umriss-ui/core";
11740
+ import { Button, Stack, useToast } from "@umriss-ui/core";
11744
11741
 
11745
11742
  function Content() {
11746
11743
  const { toast } = useToast();
@@ -11763,11 +11760,7 @@ function Content() {
11763
11760
  /* `useToast` needs a `ToastProvider` above it; at the root of an application
11764
11761
  one provider serves every screen. */
11765
11762
  export default function Tones() {
11766
- return (
11767
- <ToastProvider>
11768
- <Content />
11769
- </ToastProvider>
11770
- );
11763
+ return <Content />;
11771
11764
  }
11772
11765
  ```
11773
11766
 
@@ -11777,7 +11770,7 @@ One `action` reverses what just happened; `onClose` says whether the time ran ou
11777
11770
 
11778
11771
  ```tsx
11779
11772
  import { useState } from "react";
11780
- import { Button, Stack, Text, ToastProvider, useToast } from "@umriss-ui/core";
11773
+ import { Button, Stack, Text, useToast } from "@umriss-ui/core";
11781
11774
  import type { ToastCloseReason } from "@umriss-ui/core";
11782
11775
 
11783
11776
  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"];
@@ -11828,11 +11821,7 @@ function Content() {
11828
11821
  /* `useToast` needs a `ToastProvider` above it; at the root of an application
11829
11822
  one provider serves every screen. */
11830
11823
  export default function Undo() {
11831
- return (
11832
- <ToastProvider>
11833
- <Content />
11834
- </ToastProvider>
11835
- );
11824
+ return <Content />;
11836
11825
  }
11837
11826
  ```
11838
11827
 
@@ -11841,7 +11830,7 @@ export default function Undo() {
11841
11830
  `duration: 0` keeps a toast until the reader closes it – for the rare message whose loss costs something.
11842
11831
 
11843
11832
  ```tsx
11844
- import { Button, ToastProvider, useToast } from "@umriss-ui/core";
11833
+ import { Button, useToast } from "@umriss-ui/core";
11845
11834
 
11846
11835
  function Content() {
11847
11836
  const { toast } = useToast();
@@ -11865,11 +11854,7 @@ function Content() {
11865
11854
  /* `useToast` needs a `ToastProvider` above it; at the root of an application
11866
11855
  one provider serves every screen. */
11867
11856
  export default function UntilClosed() {
11868
- return (
11869
- <ToastProvider>
11870
- <Content />
11871
- </ToastProvider>
11872
- );
11857
+ return <Content />;
11873
11858
  }
11874
11859
  ```
11875
11860
 
@@ -11879,7 +11864,7 @@ A `loading` toast shows a spinner, has no close button and does not leave by its
11879
11864
 
11880
11865
  ```tsx
11881
11866
  import { useEffect, useRef, useState } from "react";
11882
- import { Button, Stack, Switch, ToastProvider, useToast } from "@umriss-ui/core";
11867
+ import { Button, Stack, Switch, useToast } from "@umriss-ui/core";
11883
11868
 
11884
11869
  function Content() {
11885
11870
  const { toast, update } = useToast();
@@ -11921,11 +11906,7 @@ function Content() {
11921
11906
  /* `useToast` needs a `ToastProvider` above it; at the root of an application
11922
11907
  one provider serves every screen. */
11923
11908
  export default function SaveWithLoading() {
11924
- return (
11925
- <ToastProvider>
11926
- <Content />
11927
- </ToastProvider>
11928
- );
11909
+ return <Content />;
11929
11910
  }
11930
11911
  ```
11931
11912
 
@@ -11935,7 +11916,7 @@ The row changes where the reader looks; the toast confirms it in passing, so a s
11935
11916
 
11936
11917
  ```tsx
11937
11918
  import { useState } from "react";
11938
- import { Badge, Button, Stack, Text, ToastProvider, useToast } from "@umriss-ui/core";
11919
+ import { Badge, Button, Stack, Text, useToast } from "@umriss-ui/core";
11939
11920
 
11940
11921
  const INVOICES = [
11941
11922
  { id: "INV-26-0318", supplier: "Brandlow Office Supply", amount: "€ 1,965.84" },
@@ -11984,11 +11965,7 @@ function Content() {
11984
11965
  /* `useToast` needs a `ToastProvider` above it; at the root of an application
11985
11966
  one provider serves every screen. */
11986
11967
  export default function AfterAnAction() {
11987
- return (
11988
- <ToastProvider>
11989
- <Content />
11990
- </ToastProvider>
11991
- );
11968
+ return <Content />;
11992
11969
  }
11993
11970
  ```
11994
11971
 
@@ -12047,20 +12024,23 @@ export default function WhereTheyStand() {
12047
12024
 
12048
12025
  ##### How many stand at once
12049
12026
 
12050
- `toast.limit` in the `UmrissProvider` caps the deck: here two stand, and each new toast pushes out the oldest as if it had been closed. Scan four parcels in a row and only the last two remain.
12027
+ `toast.limit` in the `UmrissProvider` caps the toasts that leave by themselves: here two stand, and each new one pushes out the oldest of them as if it had been closed. Scan four parcels in a row and only the last two remain.
12051
12028
 
12052
12029
  ```tsx
12053
12030
  import { Button, ToastProvider, UmrissProvider, useToast, type ToastConfig } from "@umriss-ui/core";
12054
12031
 
12032
+ type ToastFn = ReturnType<typeof useToast>["toast"];
12033
+
12055
12034
  const PARCELS = ["FP-2081", "FP-2082", "FP-2083", "FP-2084"];
12056
12035
 
12036
+ function scan(toast: ToastFn) {
12037
+ PARCELS.forEach((parcel) => toast({ title: `Parcel ${parcel} scanned`, description: "Loaded onto tour T-03.", tone: "success" }));
12038
+ }
12039
+
12057
12040
  function ScanButton() {
12058
12041
  const { toast } = useToast();
12059
12042
  return (
12060
- <Button
12061
- variant="primary"
12062
- onClick={() => PARCELS.forEach((parcel) => toast({ title: `Parcel ${parcel} scanned`, description: "Loaded onto tour T-03.", tone: "success" }))}
12063
- >
12043
+ <Button variant="primary" onClick={() => scan(toast)}>
12064
12044
  Scan four parcels
12065
12045
  </Button>
12066
12046
  );
@@ -12087,7 +12067,7 @@ A toast stands above an open modal dialog and can be pressed there: the dialog's
12087
12067
 
12088
12068
  ```tsx
12089
12069
  import { useState } from "react";
12090
- import { Button, FormField, Input, Modal, ModalBody, ModalFooter, ModalHeader, Select, Text, ToastProvider, Tooltip, useToast } from "@umriss-ui/core";
12070
+ import { Button, FormField, Input, Modal, ModalBody, ModalFooter, ModalHeader, Select, Text, Tooltip, useToast } from "@umriss-ui/core";
12091
12071
 
12092
12072
  function Content() {
12093
12073
  const { toast } = useToast();
@@ -12141,11 +12121,7 @@ function Content() {
12141
12121
  }
12142
12122
 
12143
12123
  export default function InsideAModal() {
12144
- return (
12145
- <ToastProvider>
12146
- <Content />
12147
- </ToastProvider>
12148
- );
12124
+ return <Content />;
12149
12125
  }
12150
12126
  ```
12151
12127
 
@@ -12258,7 +12234,8 @@ type ToastCloseReason = "timeout" | "dismiss" | "action";
12258
12234
 
12259
12235
  - 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).
12260
12236
  - One position for the whole application, set in the [UmrissProvider](#/umrissprovider); none per toast.
12261
- - No queue: a toast over the limit pushes the oldest out rather than waiting.
12237
+ - One `ToastProvider` per application, at its root. A second one in the same document draws a second deck at the same place and the two lie on each other; in development it is reported on the console.
12238
+ - No queue: a toast over the limit pushes the oldest timed one out rather than waiting. Lasting and `loading` toasts are not capped: the deck holds every one of them beside the timed ones.
12262
12239
  - Without the Popover API the deck moves with a dialog that transforms itself: inside a dialog the toasts stand in the top layer only where the browser has it, and elsewhere they are a fixed box in the dialog.
12263
12240
 
12264
12241
  What umriss deliberately does not build, and why: [ADR-0032](https://romanhaendler.github.io/umriss-ui/what-umriss-ui-is-not/).
@@ -18742,8 +18719,9 @@ Used on [Scenarios](#/), [Sizes](#/sizes), [Textarea](#/textarea) and [CommandPa
18742
18719
  ##### `ToastProvider`
18743
18720
 
18744
18721
  Holds the toasts and draws them; [`useToast`](#/api/useToast) works only below it. Put it
18745
- once at the root of the application. Duration, position and limit come from
18746
- `UmrissProvider`'s `toast` where one stands around it.
18722
+ once at the root of the application: a second one draws a second deck at
18723
+ the same place, and the two lie on each other. Duration, position and limit
18724
+ come from `UmrissProvider`'s `toast` where one stands around it.
18747
18725
 
18748
18726
  ```ts
18749
18727
  function ToastProvider({ children, held }: ToastProviderProps): import("react").JSX.Element;
@@ -19955,7 +19933,7 @@ The props of `ToastProvider`.
19955
19933
 
19956
19934
  | Prop | Type | Default | Description |
19957
19935
  |---|---|---|---|
19958
- | `children` *required* | `ReactNode` | — | <br>Shown in: [At the root (UmrissProvider)](#/umrissprovider/at-the-root), [Set up an application (UmrissProvider)](#/umrissprovider/everything-at-once), [Show a toast (Toast)](#/toast/show-a-toast) and 13 more |
19936
+ | `children` *required* | `ReactNode` | — | <br>Shown in: [Resolve an incident (Scenarios)](#/scenarios/resolve-an-incident), [Approve spending against a budget (Scenarios)](#/scenarios/approve-spending), [Set up a team (Scenarios)](#/scenarios/set-up-a-team) |
19959
19937
  | `held` | `boolean` | `false` | While true, the toasts are held back: none is seen or heard, no time runs out, and a new one waits. When false again they come back with the time they had left. For a surface the toasts must not cover for a while, where there is no room beside it: nothing is lost, as it would be by dismissing.<br>Shown in: [Hold the toasts (Toast)](#/toast/hold-the-toasts) |
19960
19938
 
19961
19939
  ##### `ToastTone`
@@ -20435,8 +20413,8 @@ Used on [UmrissProvider](#/umrissprovider) and [Language](#/language).
20435
20413
 
20436
20414
  | Prop | Type | Default | Description |
20437
20415
  |---|---|---|---|
20438
- | `toast` *required* | `(options: `[`ToastOptions`](#/toast/type-ToastOptions)`) => number` | — | Shows a toast and returns its id.<br>Shown in: [At the root (UmrissProvider)](#/umrissprovider/at-the-root), [Set up an application (UmrissProvider)](#/umrissprovider/everything-at-once), [Show a toast (Toast)](#/toast/show-a-toast) and 13 more |
20439
- | `update` *required* | `(id: number, options: Partial<`[`ToastOptions`](#/toast/type-ToastOptions)`>) => void` | — | Changes a standing toast. A new tone or a new `duration` starts its time afresh - so a `loading` toast turned into `success` begins to count then. An id that no longer stands is ignored: a toast that gave way to newer ones - a `loading` one too - has said so through `onClose`.<br>Shown in: [Save, and say how it went (Toast)](#/toast/save-with-loading) |
20416
+ | `toast` *required* | `(options: `[`ToastOptions`](#/toast/type-ToastOptions)`) => number` | — | Shows a toast and returns its id.<br>Shown in: [Show a toast (Toast)](#/toast/show-a-toast), [Tones (Toast)](#/toast/tones), [Undo (Toast)](#/toast/undo) and 10 more |
20417
+ | `update` *required* | `(id: number, options: Partial<`[`ToastOptions`](#/toast/type-ToastOptions)`>) => void` | — | Changes a standing toast. A new tone or a new `duration` starts its time afresh - so a `loading` toast turned into `success` begins to count then. An id that no longer stands is ignored: a timed toast that gave way to newer ones has said so through `onClose`. A `loading` toast turned into its outcome counts toward the limit from the next arrival on; `update` itself pushes nothing out.<br>Shown in: [Save, and say how it went (Toast)](#/toast/save-with-loading) |
20440
20418
  | `dismiss` *required* | `(id: number) => void` | — | Closes a toast, with the reason `dismiss`. |
20441
20419
 
20442
20420
  ##### `Instant`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/core",
3
- "version": "0.38.0",
3
+ "version": "0.39.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",