@umriss-ui/core 0.16.0 → 0.18.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
@@ -170,7 +170,8 @@ export declare interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement>
170
170
 
171
171
  export declare interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
172
172
  /** How loud the button is. `primary` exactly once per surface - two main
173
- actions side by side are no longer a main action. */
173
+ actions side by side are no longer a main action. `ghost` is quiet in the
174
+ accent, `plain` quiet and neutral. */
174
175
  variant?: ButtonVariant;
175
176
  /** `sm` for buttons in header bars and table rows, `md` otherwise. */
176
177
  size?: ButtonSize;
@@ -180,7 +181,7 @@ export declare interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElem
180
181
 
181
182
  export declare type ButtonSize = "sm" | "md";
182
183
 
183
- export declare type ButtonVariant = "primary" | "secondary" | "ghost" | "danger";
184
+ export declare type ButtonVariant = "primary" | "secondary" | "ghost" | "plain" | "danger";
184
185
 
185
186
  /**
186
187
  * The cadence at which a display has to re-judge itself, in milliseconds -
@@ -936,6 +937,22 @@ export declare interface HeadingProps extends HTMLAttributes<HTMLHeadingElement>
936
937
  tone?: TextTone;
937
938
  }
938
939
 
940
+ /** A button that shows only an icon: square, named by its `aria-label`, and
941
+ that name shown as a tooltip. Everything else is a `Button`'s. */
942
+ export declare const IconButton: ForwardRefExoticComponent<IconButtonProps & RefAttributes<HTMLButtonElement>>;
943
+
944
+ export declare interface IconButtonProps extends Omit<ButtonProps, "aria-label" | "aria-labelledby" | "title" | "children"> {
945
+ /** The name: what a screen reader announces and the tooltip shows. Required -
946
+ an icon alone names nothing. */
947
+ "aria-label": string;
948
+ /** The icon: an SVG, a glyph of the set or an icon font's element. The
949
+ button sets its size - `--u-icon-size`, `--u-icon-size-sm` at `sm`. */
950
+ children: ReactNode;
951
+ /** How loud the button is; `plain` is quiet and neutral, and the rest mean
952
+ what they mean on a `Button`. Default: `plain` */
953
+ variant?: ButtonVariant;
954
+ }
955
+
939
956
  export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes<HTMLInputElement>>;
940
957
 
941
958
  export declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
@@ -1043,7 +1060,8 @@ export declare interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLBut
1043
1060
  }
1044
1061
 
1045
1062
  export declare interface MenuProps {
1046
- /** Trigger, e.g. a <Button>; must accept refs. */
1063
+ /** Trigger, e.g. a <Button>; must accept refs. Its own ref keeps its
1064
+ element: the menu holds the same one beside it. */
1047
1065
  trigger: ReactElement<Record<string, unknown>>;
1048
1066
  /** The entries – typically `MenuItem` and `MenuSeparator`. */
1049
1067
  children: ReactNode;
@@ -1913,8 +1931,7 @@ export declare interface TooltipProps {
1913
1931
  /** Short help text; no interaction, no long content. */
1914
1932
  content: ReactNode;
1915
1933
  /** Exactly one element that triggers the tooltip (must accept refs). Its
1916
- own ref is replaced by the tooltip's: a trigger that needs its element
1917
- takes it from its events. */
1934
+ own ref keeps its element: the tooltip holds the same one beside it. */
1918
1935
  children: ReactElement<Record<string, unknown>>;
1919
1936
  /** Delay in ms before the tooltip appears. */
1920
1937
  delay?: number;
package/docs/llms-full.md CHANGED
@@ -1,4 +1,4 @@
1
- # @umriss-ui/core 0.16.0
1
+ # @umriss-ui/core 0.18.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
 
@@ -3643,7 +3643,7 @@ It imports `controlling.ts` from beside itself; the file stands once, under "Fil
3643
3643
  #### When to use something else
3644
3644
 
3645
3645
  - A hint every user should be able to see → Tooltip
3646
- - A button that shows only an icon → an `aria-label` on the button
3646
+ - A button that shows only an icon → IconButton
3647
3647
 
3648
3648
  #### Keyboard
3649
3649
 
@@ -3682,7 +3682,7 @@ import { Button } from "@umriss-ui/core";
3682
3682
 
3683
3683
  Demo page: https://romanhaendler.github.io/umriss-ui/core/button/
3684
3684
 
3685
- Use the primary variant once per surface, and danger only for what cannot be undone.
3685
+ Use the primary variant once per surface, and danger only for what cannot be undone. `ghost` is quiet in the accent, `plain` quiet and neutral.
3686
3686
 
3687
3687
  A loading button locks itself and tells assistive technology it is busy; it needs no `disabled` beside it. A button is `type="button"` unless you set another type, so it never sends a form by accident.
3688
3688
 
@@ -3708,7 +3708,7 @@ export default function OneAction() {
3708
3708
 
3709
3709
  ##### Variants
3710
3710
 
3711
- Use `primary` once per surface – two main actions side by side are no longer a main action; `danger` only for what cannot be undone.
3711
+ Use `primary` once per surface – two main actions side by side are no longer a main action; `danger` only for what cannot be undone. `ghost` is quiet in the accent, `plain` quiet and neutral.
3712
3712
 
3713
3713
  ```tsx
3714
3714
  import { Button, Stack } from "@umriss-ui/core";
@@ -3719,6 +3719,7 @@ export default function Variants() {
3719
3719
  <Button variant="primary">Approve invoice</Button>
3720
3720
  <Button>Send back</Button>
3721
3721
  <Button variant="ghost">Add a note</Button>
3722
+ <Button variant="plain">Remind me later</Button>
3722
3723
  <Button variant="danger">Reject</Button>
3723
3724
  </Stack>
3724
3725
  );
@@ -3813,14 +3814,14 @@ export default function SubmitAForm() {
3813
3814
 
3814
3815
  ##### Add an icon
3815
3816
 
3816
- Put an SVG before the label as a child and hide it from screen readers; with no label at all, give the button an `aria-label`.
3817
+ Put the icon before the label and hide it from screen readers; the button sets its size. A button with no label at all is an `IconButton`.
3817
3818
 
3818
3819
  ```tsx
3819
3820
  import { Button, Stack } from "@umriss-ui/core";
3820
3821
 
3821
3822
  function Download() {
3822
3823
  return (
3823
- <svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true">
3824
+ <svg viewBox="0 0 16 16" aria-hidden="true">
3824
3825
  <path d="M8 2v8m0 0 3-3m-3 3L5 7M3 13h10" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
3825
3826
  </svg>
3826
3827
  );
@@ -3833,8 +3834,9 @@ export default function WithAnIcon() {
3833
3834
  <Download />
3834
3835
  Export CSV
3835
3836
  </Button>
3836
- <Button size="sm" variant="ghost" aria-label="Export CSV">
3837
+ <Button size="sm" variant="ghost">
3837
3838
  <Download />
3839
+ Export CSV
3838
3840
  </Button>
3839
3841
  </Stack>
3840
3842
  );
@@ -3904,6 +3906,7 @@ It imports `controlling.ts` from beside itself; the file stands once, under "Fil
3904
3906
 
3905
3907
  #### When to use something else
3906
3908
 
3909
+ - A button that shows only an icon → IconButton
3907
3910
  - Several buttons that act on the same thing → ButtonGroup
3908
3911
  - One main action with rarer variants → ButtonGroup
3909
3912
  - Going to another page rather than doing something → Typography
@@ -3915,7 +3918,7 @@ It imports `controlling.ts` from beside itself; the file stands once, under "Fil
3915
3918
 
3916
3919
  | Prop | Type | Default | Description |
3917
3920
  |---|---|---|---|
3918
- | `variant` | `ButtonVariant` | `"secondary"` | How loud the button is. `primary` exactly once per surface - two main actions side by side are no longer a main action. |
3921
+ | `variant` | `ButtonVariant` | `"secondary"` | How loud the button is. `primary` exactly once per surface - two main actions side by side are no longer a main action. `ghost` is quiet in the accent, `plain` quiet and neutral. |
3919
3922
  | `size` | `ButtonSize` | `"md"` | `sm` for buttons in header bars and table rows, `md` otherwise. |
3920
3923
  | `loading` | `boolean` | `false` | Shows a loading indicator and locks the button. |
3921
3924
 
@@ -3924,7 +3927,330 @@ Also takes every attribute of `<button>`.
3924
3927
  #### Known limits
3925
3928
 
3926
3929
  - The label stays on one line; keep it short rather than let it wrap.
3927
- - No icon slot and no icon-only variant: an SVG goes among the children, and an icon-only button needs an `aria-label`.
3930
+ - No icon slot: an icon goes among the children, before the label, and the button sets its size.
3931
+
3932
+ What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0032-what-umriss-is-not.md).
3933
+
3934
+ ### IconButton
3935
+
3936
+ A square button that shows only an icon (also called an icon-only button): refresh, export, close, the actions of a row. Reach for it where the icon is known well enough to stand alone; its name is required and shows as a tooltip.
3937
+
3938
+ ```ts
3939
+ import { IconButton } from "@umriss-ui/core";
3940
+ ```
3941
+
3942
+ Demo page: https://romanhaendler.github.io/umriss-ui/core/iconbutton/
3943
+
3944
+ Its `aria-label` is required, and it is the accessible name and the tooltip in one: a screen reader hears it once, and the eye reads it on hover or keyboard focus.
3945
+
3946
+ The icon is yours: an SVG, a glyph of the set, or an icon font's element. The button sets its size – 14 px, 12 px at `sm` – the size an SVG takes beside a label in a `Button` as well.
3947
+
3948
+ It is a `Button` underneath, with the same sizes, loading state and variants; the default is `plain`, quiet and neutral. As the trigger of a `Menu` it anchors the panel, and its tooltip gives way while the menu is open.
3949
+
3950
+ #### Examples
3951
+
3952
+ ##### Name the icon
3953
+
3954
+ `aria-label` is required: it is the name a screen reader announces and the tooltip a sighted reader sees on hover or keyboard focus.
3955
+
3956
+ ```tsx
3957
+ import { IconButton } from "@umriss-ui/core";
3958
+
3959
+ function Refresh() {
3960
+ return (
3961
+ <svg viewBox="0 0 10 10" aria-hidden="true">
3962
+ <path d="M8.3 5.8A3.4 3.4 0 1 1 7.6 2.7M7.9 1.2v1.8H6.1" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
3963
+ </svg>
3964
+ );
3965
+ }
3966
+
3967
+ export default function NameTheIcon() {
3968
+ return (
3969
+ <IconButton aria-label="Refresh the tours">
3970
+ <Refresh />
3971
+ </IconButton>
3972
+ );
3973
+ }
3974
+ ```
3975
+
3976
+ ##### Variants
3977
+
3978
+ `plain` is the default – quiet and neutral, for a bar or a row. `ghost` is quiet in the accent; the others mean what they mean on a `Button`.
3979
+
3980
+ ```tsx
3981
+ import { CrossGlyph, IconButton, PlusGlyph, Stack } from "@umriss-ui/core";
3982
+
3983
+ function Export() {
3984
+ return (
3985
+ <svg viewBox="0 0 10 10" aria-hidden="true">
3986
+ <path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
3987
+ </svg>
3988
+ );
3989
+ }
3990
+
3991
+ function Check() {
3992
+ return (
3993
+ <svg viewBox="0 0 10 10" aria-hidden="true">
3994
+ <path d="M1.8 5.3 4 7.5l4.2-5" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
3995
+ </svg>
3996
+ );
3997
+ }
3998
+
3999
+ export default function Variants() {
4000
+ return (
4001
+ <Stack direction="row" gap={3} wrap align="center">
4002
+ <IconButton aria-label="Export the tour list">
4003
+ <Export />
4004
+ </IconButton>
4005
+ <IconButton variant="ghost" aria-label="Add a stop">
4006
+ <PlusGlyph />
4007
+ </IconButton>
4008
+ <IconButton variant="secondary" aria-label="Export the tour list">
4009
+ <Export />
4010
+ </IconButton>
4011
+ <IconButton variant="primary" aria-label="Release the tour">
4012
+ <Check />
4013
+ </IconButton>
4014
+ <IconButton variant="danger" aria-label="Cancel the tour">
4015
+ <CrossGlyph />
4016
+ </IconButton>
4017
+ </Stack>
4018
+ );
4019
+ }
4020
+ ```
4021
+
4022
+ ##### Sizes
4023
+
4024
+ The heights of `Button`, and the same icon size beside a label and alone: 14 px at `md`, 12 px at `sm`, in header bars and table rows.
4025
+
4026
+ ```tsx
4027
+ import { Button, IconButton, Stack } from "@umriss-ui/core";
4028
+
4029
+ function Export() {
4030
+ return (
4031
+ <svg viewBox="0 0 10 10" aria-hidden="true">
4032
+ <path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
4033
+ </svg>
4034
+ );
4035
+ }
4036
+
4037
+ export default function Sizes() {
4038
+ return (
4039
+ <Stack gap={3}>
4040
+ <Stack direction="row" gap={2} align="center">
4041
+ <Button>
4042
+ <Export />
4043
+ Export
4044
+ </Button>
4045
+ <IconButton variant="secondary" aria-label="Export the tour list">
4046
+ <Export />
4047
+ </IconButton>
4048
+ </Stack>
4049
+ <Stack direction="row" gap={2} align="center">
4050
+ <Button size="sm">
4051
+ <Export />
4052
+ Export
4053
+ </Button>
4054
+ <IconButton size="sm" variant="secondary" aria-label="Export the tour list">
4055
+ <Export />
4056
+ </IconButton>
4057
+ </Stack>
4058
+ </Stack>
4059
+ );
4060
+ }
4061
+ ```
4062
+
4063
+ ##### Bring your own icons
4064
+
4065
+ A glyph of the set, an SVG drawn for 24 px as lucide and Font Awesome ship theirs, a character the way an icon font sets it – the button gives each the same size.
4066
+
4067
+ ```tsx
4068
+ import { CrossGlyph, IconButton, Stack } from "@umriss-ui/core";
4069
+
4070
+ /* Drawn on a 24 grid with its own width and height, as icon sets ship them. */
4071
+ function Printer() {
4072
+ return (
4073
+ <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
4074
+ <path d="M6 9V2h12v7" />
4075
+ <path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" />
4076
+ <path d="M6 14h12v8H6z" />
4077
+ </svg>
4078
+ );
4079
+ }
4080
+
4081
+ export default function BringYourOwnIcons() {
4082
+ return (
4083
+ <Stack direction="row" gap={3} align="center">
4084
+ <IconButton variant="secondary" aria-label="Remove the filter">
4085
+ <CrossGlyph />
4086
+ </IconButton>
4087
+ <IconButton variant="secondary" aria-label="Print the delivery notes">
4088
+ <Printer />
4089
+ </IconButton>
4090
+ <IconButton variant="secondary" aria-label="Sort by departure">
4091
+ <span aria-hidden="true">⇅</span>
4092
+ </IconButton>
4093
+ </Stack>
4094
+ );
4095
+ }
4096
+ ```
4097
+
4098
+ ##### Loading and disabled
4099
+
4100
+ While its action runs, the spinner takes the icon's place and the button locks; disabled, it fades and keeps its name.
4101
+
4102
+ ```tsx
4103
+ import { useEffect, useState } from "react";
4104
+ import { IconButton, Stack, Text } from "@umriss-ui/core";
4105
+
4106
+ function Refresh() {
4107
+ return (
4108
+ <svg viewBox="0 0 10 10" aria-hidden="true">
4109
+ <path d="M8.3 5.8A3.4 3.4 0 1 1 7.6 2.7M7.9 1.2v1.8H6.1" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
4110
+ </svg>
4111
+ );
4112
+ }
4113
+
4114
+ function Export() {
4115
+ return (
4116
+ <svg viewBox="0 0 10 10" aria-hidden="true">
4117
+ <path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
4118
+ </svg>
4119
+ );
4120
+ }
4121
+
4122
+ export default function LoadingAndDisabled() {
4123
+ const [loading, setLoading] = useState(false);
4124
+ const [refreshed, setRefreshed] = useState("10:30");
4125
+
4126
+ useEffect(() => {
4127
+ if (!loading) return;
4128
+ const timer = setTimeout(() => {
4129
+ setLoading(false);
4130
+ setRefreshed("10:31");
4131
+ }, 1500);
4132
+ return () => clearTimeout(timer);
4133
+ }, [loading]);
4134
+
4135
+ return (
4136
+ <Stack direction="row" gap={2} align="center">
4137
+ <IconButton variant="secondary" aria-label="Refresh the tours" loading={loading} onClick={() => setLoading(true)}>
4138
+ <Refresh />
4139
+ </IconButton>
4140
+ <IconButton variant="secondary" aria-label="Export the tour list" disabled>
4141
+ <Export />
4142
+ </IconButton>
4143
+ <Text size="sm" tone="muted">
4144
+ Refreshed at {refreshed}
4145
+ </Text>
4146
+ </Stack>
4147
+ );
4148
+ }
4149
+ ```
4150
+
4151
+ ##### Build a toolbar
4152
+
4153
+ Plain buttons for the bar, a group for the pair that belongs together, a menu for the rest – every square the same size, every name a tooltip.
4154
+
4155
+ ```tsx
4156
+ import { useState } from "react";
4157
+ import { ButtonGroup, IconButton, Menu, MenuItem, MenuSeparator, MinusGlyph, PlusGlyph, Stack, Text } from "@umriss-ui/core";
4158
+
4159
+ const ZOOM = [50, 75, 100, 150, 200];
4160
+
4161
+ function Refresh() {
4162
+ return (
4163
+ <svg viewBox="0 0 10 10" aria-hidden="true">
4164
+ <path d="M8.3 5.8A3.4 3.4 0 1 1 7.6 2.7M7.9 1.2v1.8H6.1" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
4165
+ </svg>
4166
+ );
4167
+ }
4168
+
4169
+ function Export() {
4170
+ return (
4171
+ <svg viewBox="0 0 10 10" aria-hidden="true">
4172
+ <path d="M5 1.5v5M2.8 4.3 5 6.5l2.2-2.2M1.8 8.5h6.4" fill="none" stroke="currentColor" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
4173
+ </svg>
4174
+ );
4175
+ }
4176
+
4177
+ export default function Toolbar() {
4178
+ const [zoom, setZoom] = useState(2);
4179
+
4180
+ return (
4181
+ <Stack direction="row" gap={3} align="center" justify="space-between" wrap style={{ maxWidth: 620 }}>
4182
+ <Text size="sm" weight="semibold">
4183
+ Tours, Tuesday 17 March
4184
+ </Text>
4185
+ <Stack direction="row" gap={2} align="center">
4186
+ <ButtonGroup aria-label="Zoom the tour plan">
4187
+ <IconButton size="sm" variant="secondary" aria-label="Zoom out" disabled={zoom === 0} onClick={() => setZoom(zoom - 1)}>
4188
+ <MinusGlyph />
4189
+ </IconButton>
4190
+ <IconButton size="sm" variant="secondary" aria-label="Zoom in" disabled={zoom === ZOOM.length - 1} onClick={() => setZoom(zoom + 1)}>
4191
+ <PlusGlyph />
4192
+ </IconButton>
4193
+ </ButtonGroup>
4194
+ <Text as="span" size="xs" mono tone="muted" style={{ width: "4ch" }}>
4195
+ {ZOOM[zoom]}%
4196
+ </Text>
4197
+ <IconButton size="sm" aria-label="Refresh the tours">
4198
+ <Refresh />
4199
+ </IconButton>
4200
+ <IconButton size="sm" aria-label="Export the tour list">
4201
+ <Export />
4202
+ </IconButton>
4203
+ <Menu
4204
+ align="end"
4205
+ trigger={
4206
+ <IconButton size="sm" aria-label="More actions for the tours">
4207
+ ⋯
4208
+ </IconButton>
4209
+ }
4210
+ >
4211
+ <MenuItem>Print the delivery notes</MenuItem>
4212
+ <MenuItem>Copy the link</MenuItem>
4213
+ <MenuSeparator />
4214
+ <MenuItem tone="danger">Cancel every open tour</MenuItem>
4215
+ </Menu>
4216
+ </Stack>
4217
+ </Stack>
4218
+ );
4219
+ }
4220
+ ```
4221
+
4222
+ #### When to use something else
4223
+
4224
+ - The action is clearer said than drawn → Button
4225
+ - Icon buttons that act on the same thing → ButtonGroup
4226
+ - A floating strip of tools over a canvas → Dock
4227
+
4228
+ #### Keyboard
4229
+
4230
+ | Key | Action |
4231
+ |---|---|
4232
+ | `Tab` | Reaches the button and shows its name. |
4233
+ | `Enter / Space` | Presses it. |
4234
+ | `Escape` | Hides the name. |
4235
+
4236
+ #### API
4237
+
4238
+ ##### `IconButtonProps`
4239
+
4240
+ | Prop | Type | Default | Description |
4241
+ |---|---|---|---|
4242
+ | `aria-label` (required) | `string` | — | The name: what a screen reader announces and the tooltip shows. Required - an icon alone names nothing. |
4243
+ | `children` (required) | `ReactNode` | — | The icon: an SVG, a glyph of the set or an icon font's element. The button sets its size - `--u-icon-size`, `--u-icon-size-sm` at `sm`. |
4244
+ | `variant` | `ButtonVariant` | `"plain"` | How loud the button is; `plain` is quiet and neutral, and the rest mean what they mean on a `Button`. Default: `plain` |
4245
+ | `size` | `ButtonSize` | `"md"` | `sm` for buttons in header bars and table rows, `md` otherwise. From `ButtonProps`. |
4246
+ | `loading` | `boolean` | `false` | Shows a loading indicator and locks the button. From `ButtonProps`. |
4247
+
4248
+ Also takes every attribute of `<button>`.
4249
+
4250
+ #### Known limits
4251
+
4252
+ - The tooltip always shows the name; a hint that says more than the name is a `Tooltip` around a `Button`.
4253
+ - A touch screen shows no tooltip: choose icons whose meaning is common, or a `Button` with a label.
3928
4254
 
3929
4255
  What umriss deliberately does not build, and why: [ADR-0032](https://github.com/romanhaendler/umriss-ui/blob/main/docs/adr/0032-what-umriss-is-not.md).
3930
4256
 
@@ -8012,7 +8338,7 @@ What opens above the screen and closes again.
8012
8338
 
8013
8339
  ### Tooltip
8014
8340
 
8015
- A sentence of explanation that appears while the pointer rests on an element or the keyboard focus is on it (also called a hint). Reach for it to name an icon button or explain an abbreviation.
8341
+ A sentence of explanation that appears while the pointer rests on an element or the keyboard focus is on it (also called a hint). Reach for it to explain an abbreviation or a control; an icon button names itself as an [IconButton](#/iconbutton).
8016
8342
 
8017
8343
  ```ts
8018
8344
  import { Tooltip } from "@umriss-ui/core";
@@ -8024,6 +8350,8 @@ It wraps exactly one element that can take focus and a ref; on text, give a `spa
8024
8350
 
8025
8351
  Anything that stands only in a tooltip is lost on a touch screen. Keep it to a sentence that repeats or explains what is already there.
8026
8352
 
8353
+ It shows for keyboard focus, not for the focus a click leaves behind, and a tooltip that repeats its element's `aria-label` does not describe the element a second time.
8354
+
8027
8355
  #### Examples
8028
8356
 
8029
8357
  ##### A tooltip
@@ -8063,34 +8391,6 @@ export default function Delay() {
8063
8391
  }
8064
8392
  ```
8065
8393
 
8066
- ##### Name icon buttons
8067
-
8068
- A button with only a glyph gets its name from `aria-label`; the tooltip shows the same words to a sighted reader.
8069
-
8070
- ```tsx
8071
- import { Button, Stack, Tooltip } from "@umriss-ui/core";
8072
-
8073
- const TOOLS = [
8074
- { glyph: "↻", label: "Refresh the tours" },
8075
- { glyph: "⇅", label: "Sort by departure" },
8076
- { glyph: "⤓", label: "Export the tour list" },
8077
- ];
8078
-
8079
- export default function IconButtons() {
8080
- return (
8081
- <Stack direction="row" gap={1}>
8082
- {TOOLS.map((tool) => (
8083
- <Tooltip key={tool.label} content={tool.label}>
8084
- <Button size="sm" variant="ghost" aria-label={tool.label}>
8085
- <span aria-hidden="true">{tool.glyph}</span>
8086
- </Button>
8087
- </Tooltip>
8088
- ))}
8089
- </Stack>
8090
- );
8091
- }
8092
- ```
8093
-
8094
8394
  ##### Explain an abbreviation
8095
8395
 
8096
8396
  On text, make the element focusable with `tabIndex={0}` so a keyboard reader reaches the explanation too.
@@ -8151,7 +8451,7 @@ export default function AnAbbreviation() {
8151
8451
  | Prop | Type | Default | Description |
8152
8452
  |---|---|---|---|
8153
8453
  | `content` (required) | `ReactNode` | — | Short help text; no interaction, no long content. |
8154
- | `children` (required) | `ReactElement<Record<string, unknown>>` | — | Exactly one element that triggers the tooltip (must accept refs). Its own ref is replaced by the tooltip's: a trigger that needs its element takes it from its events. |
8454
+ | `children` (required) | `ReactElement<Record<string, unknown>>` | — | Exactly one element that triggers the tooltip (must accept refs). Its own ref keeps its element: the tooltip holds the same one beside it. |
8155
8455
  | `delay` | `number` | `300` | Delay in ms before the tooltip appears. |
8156
8456
 
8157
8457
  #### Known limits
@@ -8374,7 +8674,7 @@ Demo page: https://romanhaendler.github.io/umriss-ui/core/menu/
8374
8674
 
8375
8675
  The entries are things that happen, not values that stay; choosing one runs it and closes the menu so the result is in view.
8376
8676
 
8377
- An icon-only trigger needs an `aria-label` that says what it acts on, such as “Actions for INC-1048”.
8677
+ An [IconButton](#/iconbutton) makes the trigger for a row; its label says what it acts on, such as “Actions for INC-1048”.
8378
8678
 
8379
8679
  #### Examples
8380
8680
 
@@ -8454,7 +8754,7 @@ One menu per row keeps a list quiet; the trigger's name says which row it acts o
8454
8754
 
8455
8755
  ```tsx
8456
8756
  import { useState } from "react";
8457
- import { Badge, Button, Menu, MenuItem, MenuSeparator, Stack, Text } from "@umriss-ui/core";
8757
+ import { Badge, IconButton, Menu, MenuItem, MenuSeparator, Stack, Text } from "@umriss-ui/core";
8458
8758
 
8459
8759
  interface Incident {
8460
8760
  id: string;
@@ -8493,9 +8793,9 @@ export default function PerRow() {
8493
8793
  <Menu
8494
8794
  align="end"
8495
8795
  trigger={
8496
- <Button size="sm" variant="ghost" aria-label={`Actions for ${incident.id}`}>
8796
+ <IconButton size="sm" aria-label={`Actions for ${incident.id}`}>
8497
8797
  ⋯
8498
- </Button>
8798
+ </IconButton>
8499
8799
  }
8500
8800
  >
8501
8801
  <MenuItem disabled={incident.state !== "open"} onSelect={() => set(incident.id, "acknowledged")}>
@@ -8540,7 +8840,7 @@ export default function PerRow() {
8540
8840
 
8541
8841
  | Prop | Type | Default | Description |
8542
8842
  |---|---|---|---|
8543
- | `trigger` (required) | `ReactElement<Record<string, unknown>>` | — | Trigger, e.g. a <Button>; must accept refs. |
8843
+ | `trigger` (required) | `ReactElement<Record<string, unknown>>` | — | Trigger, e.g. a <Button>; must accept refs. Its own ref keeps its element: the menu holds the same one beside it. |
8544
8844
  | `children` (required) | `ReactNode` | — | The entries – typically `MenuItem` and `MenuSeparator`. |
8545
8845
  | `align` | `"start" \| "end"` | `"start"` | Alignment of the panel relative to the trigger. |
8546
8846
 
@@ -12855,7 +13155,10 @@ The demos' shared data, which some examples import from beside themselves. Copie
12855
13155
  * where the month is closed (January and February), the forecast for every
12856
13156
  * month; Marketing overspends, IT runs under;
12857
13157
  * - `INVOICES` - incoming invoices with their lines (quantity, unit price,
12858
- * discount, VAT rate), and `APPROVALS`, who signed which, or has yet to.
13158
+ * discount, VAT rate), and `APPROVALS`, who signed which, or has yet to;
13159
+ * - `TEAMS` - the teams of each cost centre with their headcount, full-time
13160
+ * equivalents and monthly staff cost, and `BUSINESS_LINES`, which cost
13161
+ * centres each of the three business lines holds.
12859
13162
  *
12860
13163
  * Amounts in euros. "Now" is Tuesday, 17 March 2026. Plain data and small pure
12861
13164
  * functions, no imports: copy the file beside an example and it runs.
@@ -13007,6 +13310,58 @@ export const APPROVALS: readonly Approval[] = [
13007
13310
  { invoice: "INV-26-0226", step: "finance", approver: "Martina Vogel", decision: "approved", at: on(3, 2) },
13008
13311
  { invoice: "INV-26-0221", step: "cost centre", approver: "Anika Sørensen", decision: "rejected", at: on(2, 24), comment: "Not ordered - the review was cancelled in January." },
13009
13312
  ];
13313
+
13314
+ export interface Team {
13315
+ /** The cost centre the team books to. */
13316
+ costCentre: string;
13317
+ name: string;
13318
+ /** People employed, whatever their hours. */
13319
+ headcount: number;
13320
+ /** Full-time equivalents: contracted hours over 40 a week. */
13321
+ fte: number;
13322
+ /** Staff cost of a month, in thousand euros. */
13323
+ monthlyCost: number;
13324
+ }
13325
+
13326
+ /** Every team, on 17 March: 102 people, 91.5 full-time equivalents. */
13327
+ export const TEAMS: readonly Team[] = [
13328
+ { costCentre: "CC-1100", name: "Field sales North", headcount: 9, fte: 8.6, monthlyCost: 61.2 },
13329
+ { costCentre: "CC-1100", name: "Field sales South", headcount: 8, fte: 7.5, monthlyCost: 53.9 },
13330
+ { costCentre: "CC-1100", name: "Inside sales", headcount: 6, fte: 5.2, monthlyCost: 29.8 },
13331
+ { costCentre: "CC-1100", name: "Key accounts", headcount: 4, fte: 4.0, monthlyCost: 33.6 },
13332
+ { costCentre: "CC-1200", name: "Brand", headcount: 3, fte: 2.8, monthlyCost: 19.4 },
13333
+ { costCentre: "CC-1200", name: "Online marketing", headcount: 4, fte: 3.5, monthlyCost: 24.1 },
13334
+ { costCentre: "CC-1200", name: "Trade fairs", headcount: 2, fte: 1.5, monthlyCost: 10.2 },
13335
+ { costCentre: "CC-3100", name: "Service desk", headcount: 7, fte: 5.9, monthlyCost: 31.3 },
13336
+ { costCentre: "CC-3100", name: "Returns", headcount: 3, fte: 2.5, monthlyCost: 12.6 },
13337
+ { costCentre: "CC-2100", name: "Seating", headcount: 6, fte: 5.8, monthlyCost: 43.5 },
13338
+ { costCentre: "CC-2100", name: "Desks", headcount: 7, fte: 6.5, monthlyCost: 48.1 },
13339
+ { costCentre: "CC-2100", name: "Storage", headcount: 5, fte: 4.6, monthlyCost: 33.9 },
13340
+ { costCentre: "CC-2100", name: "Test lab", headcount: 3, fte: 2.5, monthlyCost: 16.8 },
13341
+ { costCentre: "CC-2200", name: "Industrial design", headcount: 4, fte: 3.6, monthlyCost: 27.2 },
13342
+ { costCentre: "CC-2200", name: "Colour and material", headcount: 2, fte: 1.8, monthlyCost: 12.9 },
13343
+ { costCentre: "CC-4100", name: "Accounting", headcount: 5, fte: 4.4, monthlyCost: 27.5 },
13344
+ { costCentre: "CC-4100", name: "Controlling", headcount: 3, fte: 3.0, monthlyCost: 21.3 },
13345
+ { costCentre: "CC-4200", name: "Recruiting", headcount: 2, fte: 1.8, monthlyCost: 12.4 },
13346
+ { costCentre: "CC-4200", name: "Payroll", headcount: 2, fte: 1.5, monthlyCost: 9.6 },
13347
+ { costCentre: "CC-4300", name: "Workplace", headcount: 4, fte: 3.8, monthlyCost: 24.2 },
13348
+ { costCentre: "CC-4300", name: "Applications", headcount: 5, fte: 4.5, monthlyCost: 34.8 },
13349
+ { costCentre: "CC-4400", name: "Buildings", headcount: 3, fte: 3.0, monthlyCost: 16.9 },
13350
+ { costCentre: "CC-4400", name: "Canteen", headcount: 5, fte: 3.2, monthlyCost: 14.7 },
13351
+ ];
13352
+
13353
+ export interface BusinessLine {
13354
+ name: string;
13355
+ /** Its cost centres, in the order a report lists them. */
13356
+ costCentres: readonly string[];
13357
+ }
13358
+
13359
+ /** How the company reports: three business lines over the nine cost centres. */
13360
+ export const BUSINESS_LINES: readonly BusinessLine[] = [
13361
+ { name: "Commercial", costCentres: ["CC-1100", "CC-1200", "CC-3100"] },
13362
+ { name: "Product", costCentres: ["CC-2100", "CC-2200"] },
13363
+ { name: "Corporate services", costCentres: ["CC-4100", "CC-4200", "CC-4300", "CC-4400"] },
13364
+ ];
13010
13365
  ```
13011
13366
 
13012
13367
  ### `logistics.ts`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/core",
3
- "version": "0.16.0",
3
+ "version": "0.18.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",