@umriss-ui/core 0.36.0 → 0.38.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
@@ -2192,9 +2192,18 @@ export declare type ToastPosition = "top-start" | "top-center" | "top-end" | "bo
2192
2192
  /** Holds the toasts and draws them; `useToast` works only below it. Put it
2193
2193
  once at the root of the application. Duration, position and limit come from
2194
2194
  `UmrissProvider`'s `toast` where one stands around it. */
2195
- export declare function ToastProvider({ children }: {
2195
+ export declare function ToastProvider({ children, held }: ToastProviderProps): JSX.Element;
2196
+
2197
+ /** The props of `ToastProvider`. */
2198
+ export declare interface ToastProviderProps {
2196
2199
  children: ReactNode;
2197
- }): JSX.Element;
2200
+ /** While true, the toasts are held back: none is seen or heard, no time runs
2201
+ out, and a new one waits. When false again they come back with the time
2202
+ they had left. For a surface the toasts must not cover for a while, where
2203
+ there is no room beside it: nothing is lost, as it would be by dismissing.
2204
+ @default false */
2205
+ held?: boolean;
2206
+ }
2198
2207
 
2199
2208
  /** How the message turns out; `loading` is a toast still at work. */
2200
2209
  export declare type ToastTone = "neutral" | "success" | "warning" | "danger" | "loading";
package/docs/llms-full.md CHANGED
@@ -1,4 +1,4 @@
1
- # @umriss-ui/core 0.36.0
1
+ # @umriss-ui/core 0.38.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
 
@@ -2915,14 +2915,17 @@ One look for every component. A soft glow would read as a second, shadowy border
2915
2915
  | `--u-button-padding-sm` | `6px` | same | — |
2916
2916
  | `--u-drawer-width` | `400px` | same | The width of a drawer A token rather than a size prop: a detail beside a process picture wants one width across an application, and one drawer that needs another sets it in its `style`. |
2917
2917
 
2918
- ##### Toast (toast-inset-tokens)
2918
+ ##### Toast
2919
2919
 
2920
- How far the toasts stand from the window's top and bottom edge - set it to keep them clear of a fixed header or a toolbar at the bottom. The region hangs in `body`, so set them on `:root`; a media query of your own may set another value per width.
2920
+ How far the toasts stand from the window's top and bottom edge and from its sides - set it to keep them clear of a fixed header, a toolbar at the bottom or a navigation rail at the side - and how wide a toast is. The region hangs in `body`, so set them on `:root`; a media query of your own may set another value per width. The center positions stand in the middle of the window whatever the side tokens are.
2921
2921
 
2922
2922
  | Token | Light | Dark | Description |
2923
2923
  |---|---|---|---|
2924
2924
  | `--u-toast-inset-top` | `var(`[--u-space-5](#token-u-space-5)`)` | same | for the three `top-*` positions; `var(--u-space-4)` up to 600 px wide |
2925
2925
  | `--u-toast-inset-bottom` | `var(`[--u-space-5](#token-u-space-5)`)` | same | for the three `bottom-*` positions; `var(--u-space-4)` up to 600 px wide |
2926
+ | `--u-toast-inset-start` | `var(`[--u-space-5](#token-u-space-5)`)` | same | for the `*-start` positions, and on a phone the room at the start side; `var(--u-space-4)` up to 600 px wide |
2927
+ | `--u-toast-inset-end` | `var(`[--u-space-5](#token-u-space-5)`)` | same | for the `*-end` positions, and on a phone the room at the end side; `var(--u-space-4)` up to 600 px wide |
2928
+ | `--u-toast-width` | `360px` | same | a plain length, read it to know whether the deck has room beside a surface; up to 600 px wide the toast takes the window's width less the side tokens instead |
2926
2929
 
2927
2930
  ##### Shadow stacks: every step has one job
2928
2931
 
@@ -3104,7 +3107,7 @@ From `BadgeProps` — the full table stands on [Badge](#/badge/type-BadgeProps).
3104
3107
 
3105
3108
  - No theme object, no theme provider and no theme switch: a theme is a set of token overrides in your stylesheet, the mode is the page's `color-scheme` ([ADR-0021](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0021-the-styles-load-themselves-and-touch-nothing-else.md)).
3106
3109
  - A token that names another resolves where it is declared: set `--u-color-accent` on a region, and `--u-focus-ring`, which names it on `:root`, still draws the application's accent there. Set the naming token in the region too.
3107
- - A panel opened in a portal - a popover, a tooltip, a toast - takes the tokens and the `color-scheme` of the place it lands, not of the region it was opened from; inside a dialog the toasts take the tokens of the dialog's place. Give [UmrissProvider](#/umrissprovider) a `portalTarget` inside the region, or override on `:root` - as for the toasts' distance from the window's edge, `--u-toast-inset-top` and `--u-toast-inset-bottom`.
3110
+ - A panel opened in a portal - a popover, a tooltip, a toast - takes the tokens and the `color-scheme` of the place it lands, not of the region it was opened from; inside a dialog the toasts take the tokens of the dialog's place. Give [UmrissProvider](#/umrissprovider) a `portalTarget` inside the region, or override on `:root` - as for the toasts' distance from the window's edge and its sides, `--u-toast-inset-top`, `--u-toast-inset-bottom`, `--u-toast-inset-start` and `--u-toast-inset-end`.
3108
3111
 
3109
3112
  What umriss deliberately does not build, and why: [ADR-0032](https://romanhaendler.github.io/umriss-ui/what-umriss-ui-is-not/).
3110
3113
 
@@ -4772,9 +4775,9 @@ The keys of [Button](#/button/keyboard-button) apply here.
4772
4775
 
4773
4776
  | Prop | Type | Default | Description |
4774
4777
  |---|---|---|---|
4775
- | `direction` | `"row" \| "column"` | `"column"` | Below one another or beside one another. Below is the direction content stands in anyway, without being asked.<br>Shown in: [A row](#/stack-and-grid/a-row), [Gaps](#/stack-and-grid/gaps), [Wrapping](#/stack-and-grid/wrapping) and 68 more |
4776
- | `gap` | [`SpaceStep`](#type-SpaceStep)<br>`1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8` | `3` | Spacing as a step of the 4 px spacing steps (1–8).<br>Shown in: [A column](#/stack-and-grid/a-column), [A row](#/stack-and-grid/a-row), [Gaps](#/stack-and-grid/gaps) and 163 more |
4777
- | `align` | `CSSProperties["alignItems"]` | — | Alignment across the direction – `alignItems` unchanged.<br>Shown in: [A row](#/stack-and-grid/a-row), [Gaps](#/stack-and-grid/gaps), [A tour summary](#/stack-and-grid/a-tour-summary) and 77 more |
4778
+ | `direction` | `"row" \| "column"` | `"column"` | Below one another or beside one another. Below is the direction content stands in anyway, without being asked.<br>Shown in: [A row](#/stack-and-grid/a-row), [Gaps](#/stack-and-grid/gaps), [Wrapping](#/stack-and-grid/wrapping) and 69 more |
4779
+ | `gap` | [`SpaceStep`](#type-SpaceStep)<br>`1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8` | `3` | Spacing as a step of the 4 px spacing steps (1–8).<br>Shown in: [A column](#/stack-and-grid/a-column), [A row](#/stack-and-grid/a-row), [Gaps](#/stack-and-grid/gaps) and 164 more |
4780
+ | `align` | `CSSProperties["alignItems"]` | — | Alignment across the direction – `alignItems` unchanged.<br>Shown in: [A row](#/stack-and-grid/a-row), [Gaps](#/stack-and-grid/gaps), [A tour summary](#/stack-and-grid/a-tour-summary) and 78 more |
4778
4781
  | `justify` | `CSSProperties["justifyContent"]` | — | Distribution along the direction – `justifyContent` unchanged.<br>Shown in: [A row](#/stack-and-grid/a-row), [A tour summary](#/stack-and-grid/a-tour-summary), [Name the same action in every row (VisuallyHidden)](#/visuallyhidden/actions-in-rows) and 9 more |
4779
4782
  | `wrap` | `boolean` | `false` | Lets the children wrap when the line does not suffice.<br>Shown in: [Gaps](#/stack-and-grid/gaps), [Wrapping](#/stack-and-grid/wrapping), [Sized to the value (Sizes)](#/sizes/sized-to-the-value) and 32 more |
4780
4783
  | `ref` | `Ref<HTMLDivElement>` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [A row that holds still (Sizes)](#/sizes/a-row-that-holds-still), [An anchored surface (Popover)](#/popover/anchored-surface), [Take the width of the trigger (Popover)](#/popover/width-from-anchor) and 2 more |
@@ -8696,7 +8699,7 @@ export default function SettingsOfAService() {
8696
8699
 
8697
8700
  | Prop | Type | Default | Description |
8698
8701
  |---|---|---|---|
8699
- | `label` | `ReactNode` | — | Label to the right of the switch.<br>Shown in: [Configurator](#/switch/configurator-switch), [On and off](#/switch/on-and-off), [States and sizes](#/switch/states-and-sizes) and 12 more |
8702
+ | `label` | `ReactNode` | — | Label to the right of the switch.<br>Shown in: [Configurator](#/switch/configurator-switch), [On and off](#/switch/on-and-off), [States and sizes](#/switch/states-and-sizes) and 13 more |
8700
8703
  | `size` | `"sm" \| "md"` | the size of a `ControlSizeProvider` around it, else `"md"` | `sm` for a toolbar and dense forms, `md` otherwise.<br>Shown in: [Configurator](#/switch/configurator-switch), [States and sizes](#/switch/states-and-sizes) |
8701
8704
  | `invalid` | `boolean` | — | Marks the switch as invalid. `FormField` sets it itself as soon as it carries an `error` - by hand only necessary without `FormField`.<br>Shown in: [Configurator](#/switch/configurator-switch), [With an error](#/switch/with-an-error) |
8702
8705
  | `ref` | `Ref<HTMLInputElement>` | — | Receives the component's root element. From `RefProp`.<br>Shown in: [A row that holds still (Sizes)](#/sizes/a-row-that-holds-still), [An anchored surface (Popover)](#/popover/anchored-surface), [Take the width of the trigger (Popover)](#/popover/width-from-anchor) and 2 more |
@@ -11690,6 +11693,8 @@ Demo page: https://romanhaendler.github.io/umriss-ui/core/toast/
11690
11693
 
11691
11694
  Toasts stand above an open modal dialog and can be used there: they are seen, pressed and heard, and stay where they were while a dialog opens or closes.
11692
11695
 
11696
+ `held` on the `ToastProvider` holds them back while a surface they must not cover is open: none is seen or heard, their time stands still, and they come back with the time they had left, so nothing is lost.
11697
+
11693
11698
  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.
11694
11699
 
11695
11700
  The title says what has happened, in about one line: “Invoice not sent”. Why, and what to do next, go in the description.
@@ -11989,7 +11994,7 @@ export default function AfterAnAction() {
11989
11994
 
11990
11995
  ##### Where they stand
11991
11996
 
11992
- `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. How far they stand from the edge is `--u-toast-inset-top` and `--u-toast-inset-bottom` on `:root` - below a fixed header, above a toolbar at the bottom.
11997
+ `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. How far they stand from the edge is `--u-toast-inset-top` and `--u-toast-inset-bottom` on `:root` - below a fixed header, above a toolbar at the bottom; how far from the window's sides, `--u-toast-inset-start` and `--u-toast-inset-end` - beside a navigation rail, at the page's gutter.
11993
11998
 
11994
11999
  ```tsx
11995
12000
  import { useMemo, useState } from "react";
@@ -12144,6 +12149,36 @@ export default function InsideAModal() {
12144
12149
  }
12145
12150
  ```
12146
12151
 
12152
+ ##### Hold the toasts
12153
+
12154
+ `held` on the `ToastProvider` keeps every toast out of sight and hearing while a surface is open that they must not cover and there is no room beside it. Their time stands still, a new one waits, and when the hold ends they come back with the time they had left: nothing is lost, as it would be by dismissing them.
12155
+
12156
+ ```tsx
12157
+ import { useState } from "react";
12158
+ import { Button, Stack, Switch, ToastProvider, useToast } from "@umriss-ui/core";
12159
+
12160
+ function SendButton() {
12161
+ const { toast } = useToast();
12162
+ return (
12163
+ <Button onClick={() => toast({ title: "Route T-03 planned", description: "12 stops, back by 16:40.", tone: "success" })}>
12164
+ Send a toast
12165
+ </Button>
12166
+ );
12167
+ }
12168
+
12169
+ export default function HoldTheToasts() {
12170
+ const [held, setHeld] = useState(false);
12171
+ return (
12172
+ <ToastProvider held={held}>
12173
+ <Stack direction="row" gap={4} align="center">
12174
+ <Switch label="Hold the toasts" checked={held} onChange={(event) => setHeld(event.target.checked)} />
12175
+ <SendButton />
12176
+ </Stack>
12177
+ </ToastProvider>
12178
+ );
12179
+ }
12180
+ ```
12181
+
12147
12182
  #### When to use something else
12148
12183
 
12149
12184
  - The reader must see it, or it stays true until something is done → Alert
@@ -12153,7 +12188,7 @@ export default function InsideAModal() {
12153
12188
 
12154
12189
  | Key | Action |
12155
12190
  |---|---|
12156
- | `Alt + T` | While a toast stands, moves the focus into the messages and opens the deck. |
12191
+ | `Alt + T` | While a toast stands and is not held back, moves the focus into the messages and opens the deck. |
12157
12192
  | `Tab / Shift + Tab` | Moves through the toasts' actions and close crosses; a keyboard focus inside opens the deck and holds every toast's clock. |
12158
12193
  | `Enter / Space` | On an action, runs it and closes its toast; on a cross, closes the toast. |
12159
12194
  | `Escape` | Closes the deck; after Alt + T, the focus goes back to where it was. |
@@ -12176,9 +12211,9 @@ Inside a modal dialog the live regions move with the toasts, so a message is hea
12176
12211
 
12177
12212
  | Prop | Type | Default | Description |
12178
12213
  |---|---|---|---|
12179
- | `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.<br>Shown in: [Show a toast](#/toast/show-a-toast), [Tones](#/toast/tones), [Undo](#/toast/undo) and 12 more |
12180
- | `description` | `string` | — | One more sentence where the title alone is too little. Nothing the reader MUST read: the toast goes away by itself.<br>Shown in: [Show a toast](#/toast/show-a-toast), [Tones](#/toast/tones), [Undo](#/toast/undo) and 10 more |
12181
- | `tone` | [`ToastTone`](#type-ToastTone)<br>`"neutral" \| "success" \| "warning" \| "danger" \| "loading"` | — | 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`.<br>Shown in: [Tones](#/toast/tones), [Keep it until it is closed](#/toast/until-closed), [Save, and say how it went](#/toast/save-with-loading) and 9 more |
12214
+ | `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.<br>Shown in: [Show a toast](#/toast/show-a-toast), [Tones](#/toast/tones), [Undo](#/toast/undo) and 13 more |
12215
+ | `description` | `string` | — | One more sentence where the title alone is too little. Nothing the reader MUST read: the toast goes away by itself.<br>Shown in: [Show a toast](#/toast/show-a-toast), [Tones](#/toast/tones), [Undo](#/toast/undo) and 11 more |
12216
+ | `tone` | [`ToastTone`](#type-ToastTone)<br>`"neutral" \| "success" \| "warning" \| "danger" \| "loading"` | — | 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`.<br>Shown in: [Tones](#/toast/tones), [Keep it until it is closed](#/toast/until-closed), [Save, and say how it went](#/toast/save-with-loading) and 10 more |
12182
12217
  | `duration` | `number` | the provider's `duration`, else `5000` | Display duration in ms; 0 = stays until closed by hand.<br>Shown in: [Keep it until it is closed](#/toast/until-closed), [Inside a modal](#/toast/inside-a-modal) |
12183
12218
  | `action` | [`ToastAction`](#type-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.<br>Shown in: [Undo](#/toast/undo), [Save, and say how it went](#/toast/save-with-loading), [Inside a modal](#/toast/inside-a-modal) |
12184
12219
 
@@ -18711,9 +18746,7 @@ once at the root of the application. Duration, position and limit come from
18711
18746
  `UmrissProvider`'s `toast` where one stands around it.
18712
18747
 
18713
18748
  ```ts
18714
- function ToastProvider({ children }: {
18715
- children: ReactNode;
18716
- }): import("react").JSX.Element;
18749
+ function ToastProvider({ children, held }: ToastProviderProps): import("react").JSX.Element;
18717
18750
  ```
18718
18751
 
18719
18752
  Used on [Scenarios](#/), [UmrissProvider](#/umrissprovider) and [Toast](#/toast).
@@ -19916,6 +19949,15 @@ type ToastPosition = "top-start" | "top-center" | "top-end" | "bottom-start" | "
19916
19949
 
19917
19950
  Used on [Toast](#/toast).
19918
19951
 
19952
+ ##### `ToastProviderProps`
19953
+
19954
+ The props of `ToastProvider`.
19955
+
19956
+ | Prop | Type | Default | Description |
19957
+ |---|---|---|---|
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 |
19959
+ | `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
+
19919
19961
  ##### `ToastTone`
19920
19962
 
19921
19963
  How the message turns out; `loading` is a toast still at work.
@@ -20393,7 +20435,7 @@ Used on [UmrissProvider](#/umrissprovider) and [Language](#/language).
20393
20435
 
20394
20436
  | Prop | Type | Default | Description |
20395
20437
  |---|---|---|---|
20396
- | `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 12 more |
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 |
20397
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) |
20398
20440
  | `dismiss` *required* | `(id: number) => void` | — | Closes a toast, with the reason `dismiss`. |
20399
20441
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/core",
3
- "version": "0.36.0",
3
+ "version": "0.38.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",