@umriss-ui/core 0.37.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.37.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
 
@@ -2917,7 +2917,7 @@ One look for every component. A soft glow would read as a second, shadowy border
2917
2917
 
2918
2918
  ##### Toast
2919
2919
 
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. 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.
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
  |---|---|---|---|
@@ -2925,6 +2925,7 @@ How far the toasts stand from the window's top and bottom edge and from its side
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
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
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 |
2928
2929
 
2929
2930
  ##### Shadow stacks: every step has one job
2930
2931
 
@@ -4774,9 +4775,9 @@ The keys of [Button](#/button/keyboard-button) apply here.
4774
4775
 
4775
4776
  | Prop | Type | Default | Description |
4776
4777
  |---|---|---|---|
4777
- | `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 |
4778
- | `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 |
4779
- | `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 |
4780
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 |
4781
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 |
4782
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 |
@@ -8698,7 +8699,7 @@ export default function SettingsOfAService() {
8698
8699
 
8699
8700
  | Prop | Type | Default | Description |
8700
8701
  |---|---|---|---|
8701
- | `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 |
8702
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) |
8703
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) |
8704
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 |
@@ -11692,6 +11693,8 @@ Demo page: https://romanhaendler.github.io/umriss-ui/core/toast/
11692
11693
 
11693
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.
11694
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
+
11695
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.
11696
11699
 
11697
11700
  The title says what has happened, in about one line: “Invoice not sent”. Why, and what to do next, go in the description.
@@ -12146,6 +12149,36 @@ export default function InsideAModal() {
12146
12149
  }
12147
12150
  ```
12148
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
+
12149
12182
  #### When to use something else
12150
12183
 
12151
12184
  - The reader must see it, or it stays true until something is done → Alert
@@ -12155,7 +12188,7 @@ export default function InsideAModal() {
12155
12188
 
12156
12189
  | Key | Action |
12157
12190
  |---|---|
12158
- | `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. |
12159
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. |
12160
12193
  | `Enter / Space` | On an action, runs it and closes its toast; on a cross, closes the toast. |
12161
12194
  | `Escape` | Closes the deck; after Alt + T, the focus goes back to where it was. |
@@ -12178,9 +12211,9 @@ Inside a modal dialog the live regions move with the toasts, so a message is hea
12178
12211
 
12179
12212
  | Prop | Type | Default | Description |
12180
12213
  |---|---|---|---|
12181
- | `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 |
12182
- | `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 |
12183
- | `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 |
12184
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) |
12185
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) |
12186
12219
 
@@ -18713,9 +18746,7 @@ once at the root of the application. Duration, position and limit come from
18713
18746
  `UmrissProvider`'s `toast` where one stands around it.
18714
18747
 
18715
18748
  ```ts
18716
- function ToastProvider({ children }: {
18717
- children: ReactNode;
18718
- }): import("react").JSX.Element;
18749
+ function ToastProvider({ children, held }: ToastProviderProps): import("react").JSX.Element;
18719
18750
  ```
18720
18751
 
18721
18752
  Used on [Scenarios](#/), [UmrissProvider](#/umrissprovider) and [Toast](#/toast).
@@ -19918,6 +19949,15 @@ type ToastPosition = "top-start" | "top-center" | "top-end" | "bottom-start" | "
19918
19949
 
19919
19950
  Used on [Toast](#/toast).
19920
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
+
19921
19961
  ##### `ToastTone`
19922
19962
 
19923
19963
  How the message turns out; `loading` is a toast still at work.
@@ -20395,7 +20435,7 @@ Used on [UmrissProvider](#/umrissprovider) and [Language](#/language).
20395
20435
 
20396
20436
  | Prop | Type | Default | Description |
20397
20437
  |---|---|---|---|
20398
- | `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 |
20399
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) |
20400
20440
  | `dismiss` *required* | `(id: number) => void` | — | Closes a toast, with the reason `dismiss`. |
20401
20441
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/core",
3
- "version": "0.37.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",