@umriss-ui/core 0.26.0 → 0.28.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
@@ -1085,19 +1085,26 @@ export declare interface GlyphProps extends Omit<SVGProps<SVGSVGElement>, "viewB
1085
1085
  size?: number;
1086
1086
  }
1087
1087
 
1088
- /** Children in a grid: a fixed number of columns, or as many as fit at
1089
- `minItemWidth`. */
1088
+ /** Children in a grid: a fixed number of columns, a list of column widths,
1089
+ or as many columns as fit at `minItemWidth`. */
1090
1090
  export declare const Grid: ForwardRefExoticComponent<GridProps & RefAttributes<HTMLDivElement>>;
1091
1091
 
1092
+ /** The width of one column in `Grid`'s list: a number in pixels, or
1093
+ `"fill"` for a share of what the other columns leave. */
1094
+ export declare type GridColumnWidth = number | "fill";
1095
+
1092
1096
  /** The grid laid over an area. Two by two lines; the frame is missing on
1093
1097
  purpose, otherwise it would be a window. */
1094
1098
  export declare const GridGlyph: ForwardRefExoticComponent<Omit<GlyphProps, "ref"> & RefAttributes<SVGSVGElement>>;
1095
1099
 
1096
1100
  /** The props of `Grid`. */
1097
1101
  export declare interface GridProps extends HTMLAttributes<HTMLDivElement> {
1098
- /** Fixed column count; overridden by minItemWidth. */
1099
- columns?: number;
1100
- /** Responsive: as many columns as fit at this minimum width. */
1102
+ /** How many columns, all of one width - or a list with one width per
1103
+ column: a number in pixels, or `"fill"` for a share of what is left.
1104
+ Overridden by minItemWidth. */
1105
+ columns?: number | readonly GridColumnWidth[];
1106
+ /** Responsive: as many columns as fit at this minimum width; wins over
1107
+ `columns`, a list included. */
1101
1108
  minItemWidth?: string;
1102
1109
  /** Spacing as a step of the 4 px spacing steps (1–8); applies in both
1103
1110
  directions. */
@@ -1774,6 +1781,15 @@ export declare interface SegmentedControlProps<T extends string> extends Omit<HT
1774
1781
  /** `sm` for a toolbar and dense forms, `md` otherwise.
1775
1782
  @default the size of a `ControlSizeProvider` around it, else `"md"` */
1776
1783
  size?: "sm" | "md";
1784
+ /** How it is drawn. `inset`: a sunken track without an edge, the choice a
1785
+ surface lifted out of it. `field`: a field's edge, the choice filled
1786
+ with ink - for a row whose fields it should match box for box.
1787
+ @default "inset" */
1788
+ variant?: "field" | "inset";
1789
+ /** Takes the whole width its place gives it, as a field in a column does,
1790
+ and shares it equally between the segments. Without it the control is
1791
+ as wide as its words. */
1792
+ fill?: boolean;
1777
1793
  /** Disables the whole control. `SegmentedOption` disables single
1778
1794
  possibilities. */
1779
1795
  disabled?: boolean;
@@ -1788,6 +1804,11 @@ export declare interface SegmentedOption<T extends string> {
1788
1804
  value: T;
1789
1805
  /** The segment's word - a short one; a long label ends in an ellipsis. */
1790
1806
  label: ReactNode;
1807
+ /** An icon before the word: an SVG, a glyph of the set or an icon font's
1808
+ element. The control sets its size - `--u-icon-size`, `--u-icon-size-sm`
1809
+ at `sm` - and hides it from assistive technology: the word names the
1810
+ possibility. */
1811
+ icon?: ReactNode;
1791
1812
  /** Takes the possibility out of the choice but leaves it visible. */
1792
1813
  disabled?: boolean;
1793
1814
  }
package/docs/llms-full.md CHANGED
@@ -1,4 +1,4 @@
1
- # @umriss-ui/core 0.26.0
1
+ # @umriss-ui/core 0.28.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
 
@@ -2899,6 +2899,15 @@ The travel of the grip is the knob to turn when the gesture feels lifeless: [ADR
2899
2899
  | `--u-dock-refusal-duration` | `1400ms` | same | — |
2900
2900
  | `--u-drawer-width` | `400px` | same | The width of a drawer (core-foundations 03). 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`. |
2901
2901
 
2902
+ ##### Toast (toast-inset-tokens)
2903
+
2904
+ 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.
2905
+
2906
+ | Token | Light | Dark | Description |
2907
+ |---|---|---|---|
2908
+ | `--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 |
2909
+ | `--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 |
2910
+
2902
2911
  ##### Shadow stacks: every step has one job
2903
2912
 
2904
2913
  Card: edge, contact with the ground, soft depth. Overlay: edge, near shadow, depth.
@@ -3025,8 +3034,8 @@ From `GridProps` — the full table stands on [Stack and Grid](#/stack-and-grid/
3025
3034
 
3026
3035
  | Prop | Type | Default | Description |
3027
3036
  |---|---|---|---|
3028
- | [`columns`](#/stack-and-grid/GridProps-columns) | `number` | `2` | Fixed column count; overridden by minItemWidth. |
3029
- | [`minItemWidth`](#/stack-and-grid/GridProps-minItemWidth) | `string` | — | Responsive: as many columns as fit at this minimum width. |
3037
+ | [`columns`](#/stack-and-grid/GridProps-columns) | `number \| readonly `[`GridColumnWidth`](#/stack-and-grid/type-GridColumnWidth)`[]` | `2` | How many columns, all of one width - or a list with one width per column: a number in pixels, or `"fill"` for a share of what is left. Overridden by minItemWidth. |
3038
+ | [`minItemWidth`](#/stack-and-grid/GridProps-minItemWidth) | `string` | — | Responsive: as many columns as fit at this minimum width; wins over `columns`, a list included. |
3030
3039
  | [`gap`](#/stack-and-grid/GridProps-gap) | [`SpaceStep`](#/stack-and-grid/type-SpaceStep)<br>`1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8` | `4` | Spacing as a step of the 4 px spacing steps (1–8); applies in both directions. |
3031
3040
 
3032
3041
  From `CardHeaderProps` — the full table stands on [Card](#/card/type-CardHeaderProps).
@@ -3079,7 +3088,7 @@ From `BadgeProps` — the full table stands on [Badge](#/badge/type-BadgeProps).
3079
3088
 
3080
3089
  - 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)).
3081
3090
  - 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.
3082
- - 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. Give [UmrissProvider](#/umrissprovider) a `portalTarget` inside the region, or override on `:root`.
3091
+ - 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. 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`.
3083
3092
 
3084
3093
  What umriss deliberately does not build, and why: [ADR-0032](https://romanhaendler.github.io/umriss-ui/what-umriss-ui-is-not/).
3085
3094
 
@@ -3346,7 +3355,7 @@ export default function NarrowPlaces() {
3346
3355
 
3347
3356
  ##### A row of fields
3348
3357
 
3349
- Fields side by side share one line: their labels on one line, their boxes on one height, their words on the line the select's value stands on. A segmented control is a field itself; a horizontal radio group is as tall as a control, and so are a checkbox and a switch in a field, so their words stand on that line too - at either size.
3358
+ Fields side by side share one line: their labels on one line, their boxes on one height, their words on the line the select's value stands on. A segmented control is as tall as a field; a horizontal radio group is as tall as a control, and so are a checkbox and a switch in a field, so their words stand on that line too - at either size.
3350
3359
 
3351
3360
  ```tsx
3352
3361
  import { Checkbox, ControlSizeProvider, FormField, RadioGroup, SegmentedControl, Select, Stack, Switch } from "@umriss-ui/core";
@@ -3425,8 +3434,8 @@ The keys of [Button](#/button/keyboard-button), [ButtonGroup](#/buttongroup/keyb
3425
3434
 
3426
3435
  | Prop | Type | Default | Description |
3427
3436
  |---|---|---|---|
3428
- | `size` *required* | [`ControlSize`](#type-ControlSize)<br>`"sm" \| "md"` | — | The size of every control inside that does not say its own.<br>Shown in: [One size for a place](#/sizes/one-size-for-a-place), [A row of fields](#/sizes/a-row-of-fields) |
3429
- | `children` *required* | `ReactNode` | — | The place the size holds for.<br>Shown in: [One size for a place](#/sizes/one-size-for-a-place), [A row of fields](#/sizes/a-row-of-fields) |
3437
+ | `size` *required* | [`ControlSize`](#type-ControlSize)<br>`"sm" \| "md"` | — | The size of every control inside that does not say its own.<br>Shown in: [One size for a place](#/sizes/one-size-for-a-place), [A row of fields](#/sizes/a-row-of-fields), [Drawn as a field (SegmentedControl)](#/segmentedcontrol/drawn-as-a-field) |
3438
+ | `children` *required* | `ReactNode` | — | The place the size holds for.<br>Shown in: [One size for a place](#/sizes/one-size-for-a-place), [A row of fields](#/sizes/a-row-of-fields), [Drawn as a field (SegmentedControl)](#/segmentedcontrol/drawn-as-a-field) |
3430
3439
 
3431
3440
  ##### Types on this page
3432
3441
 
@@ -4662,6 +4671,40 @@ export default function ColumnsByWidth() {
4662
4671
  }
4663
4672
  ```
4664
4673
 
4674
+ ##### Columns of their own widths
4675
+
4676
+ ```tsx
4677
+ import { Card, CardBody, Grid, Text } from "@umriss-ui/core";
4678
+
4679
+ /* One cost centre's key figures, written out here so the example runs on its own. */
4680
+ const FIGURES = [
4681
+ { label: "Cost centre", value: "CC-1200 · Marketing" },
4682
+ { label: "Owner", value: "Rafael Ortiz" },
4683
+ { label: "Monthly budget", value: "68,000\u00a0€" },
4684
+ { label: "Spent, March", value: "77,500\u00a0€, 9,500\u00a0€ over budget" },
4685
+ { label: "Approved by", value: "Helen Marsh, Sales" },
4686
+ ];
4687
+
4688
+ export default function ColumnsOfTheirOwnWidths() {
4689
+ return (
4690
+ <Card style={{ maxWidth: 480 }}>
4691
+ <CardBody>
4692
+ <Grid columns={[140, "fill"]} gap={3}>
4693
+ {FIGURES.flatMap((figure) => [
4694
+ <Text key={`${figure.label} label`} size="sm" tone="muted">
4695
+ {figure.label}
4696
+ </Text>,
4697
+ <Text key={`${figure.label} value`} size="sm">
4698
+ {figure.value}
4699
+ </Text>,
4700
+ ])}
4701
+ </Grid>
4702
+ </CardBody>
4703
+ </Card>
4704
+ );
4705
+ }
4706
+ ```
4707
+
4665
4708
  ##### A tour summary
4666
4709
 
4667
4710
  Stacks and grids nest: a column holds a header row, a grid of key figures and a row of actions.
@@ -4725,11 +4768,11 @@ The keys of [Button](#/button/keyboard-button) apply here.
4725
4768
 
4726
4769
  | Prop | Type | Default | Description |
4727
4770
  |---|---|---|---|
4728
- | `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 67 more |
4729
- | `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 |
4771
+ | `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 |
4772
+ | `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 165 more |
4730
4773
  | `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 |
4731
4774
  | `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 |
4732
- | `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 31 more |
4775
+ | `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 |
4733
4776
 
4734
4777
  Also takes every attribute of `<div>`.
4735
4778
 
@@ -4737,9 +4780,9 @@ Also takes every attribute of `<div>`.
4737
4780
 
4738
4781
  | Prop | Type | Default | Description |
4739
4782
  |---|---|---|---|
4740
- | `columns` | `number` | `2` | Fixed column count; overridden by minItemWidth.<br>Shown in: [Fixed columns](#/stack-and-grid/fixed-columns), [A token for one region (Theming)](#/theming/a-token-for-one-region), [A field fills its place (Sizes)](#/sizes/fill-the-place) and 2 more |
4741
- | `minItemWidth` | `string` | — | Responsive: as many columns as fit at this minimum width.<br>Shown in: [Columns by width](#/stack-and-grid/columns-by-width), [A tour summary](#/stack-and-grid/a-tour-summary), [A dark region (Theming)](#/theming/a-dark-region) and 51 more |
4742
- | `gap` | [`SpaceStep`](#type-SpaceStep)<br>`1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8` | `4` | Spacing as a step of the 4 px spacing steps (1–8); applies in both directions.<br>Shown in: [Fixed columns](#/stack-and-grid/fixed-columns), [Columns by width](#/stack-and-grid/columns-by-width), [A tour summary](#/stack-and-grid/a-tour-summary) and 56 more |
4783
+ | `columns` | `number \| readonly `[`GridColumnWidth`](#type-GridColumnWidth)`[]` | `2` | How many columns, all of one width - or a list with one width per column: a number in pixels, or `"fill"` for a share of what is left. Overridden by minItemWidth.<br>Shown in: [Fixed columns](#/stack-and-grid/fixed-columns), [Columns of their own widths](#/stack-and-grid/columns-of-their-own-widths), [A token for one region (Theming)](#/theming/a-token-for-one-region) and 3 more |
4784
+ | `minItemWidth` | `string` | — | Responsive: as many columns as fit at this minimum width; wins over `columns`, a list included.<br>Shown in: [Columns by width](#/stack-and-grid/columns-by-width), [A tour summary](#/stack-and-grid/a-tour-summary), [A dark region (Theming)](#/theming/a-dark-region) and 51 more |
4785
+ | `gap` | [`SpaceStep`](#type-SpaceStep)<br>`1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8` | `4` | Spacing as a step of the 4 px spacing steps (1–8); applies in both directions.<br>Shown in: [Fixed columns](#/stack-and-grid/fixed-columns), [Columns by width](#/stack-and-grid/columns-by-width), [Columns of their own widths](#/stack-and-grid/columns-of-their-own-widths) and 57 more |
4743
4786
 
4744
4787
  Also takes every attribute of `<div>`.
4745
4788
 
@@ -4754,6 +4797,15 @@ A step of the spacing scale, from 1 (4 px) to 8 (40 px) - the tokens
4754
4797
  type SpaceStep = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
4755
4798
  ```
4756
4799
 
4800
+ ###### `GridColumnWidth`
4801
+
4802
+ The width of one column in `Grid`'s list: a number in pixels, or
4803
+ `"fill"` for a share of what the other columns leave.
4804
+
4805
+ ```ts
4806
+ type GridColumnWidth = number | "fill";
4807
+ ```
4808
+
4757
4809
  #### Known limits
4758
4810
 
4759
4811
  - No breakpoints and no responsive props: a grid follows the width through `minItemWidth`, anything else is your stylesheet's.
@@ -6341,9 +6393,9 @@ export default function IncidentSummary() {
6341
6393
  | Prop | Type | Default | Description |
6342
6394
  |---|---|---|---|
6343
6395
  | `as` | `ElementType` | `"p"` | Element to render as.<br>Shown in: [Tones and weights](#/typography/tones-and-weights), [Set an incident summary](#/typography/incident-summary), [Use the language in your own components (Language)](#/language/own-components) and 16 more |
6344
- | `size` | [`TextSize`](#type-TextSize)<br>`"xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl"` | `"md"` | Type size from the token set. It is independent of the element: a `p` may be small without becoming a different element.<br>Shown in: [Configurator](#/typography/configurator-typography), [Sizes](#/typography/sizes), [Tones and weights](#/typography/tones-and-weights) and 129 more |
6396
+ | `size` | [`TextSize`](#type-TextSize)<br>`"xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl"` | `"md"` | Type size from the token set. It is independent of the element: a `p` may be small without becoming a different element.<br>Shown in: [Configurator](#/typography/configurator-typography), [Sizes](#/typography/sizes), [Tones and weights](#/typography/tones-and-weights) and 130 more |
6345
6397
  | `weight` | [`TextWeight`](#type-TextWeight)<br>`"regular" \| "medium" \| "semibold"` | `"regular"` | Font weight from the token set.<br>Shown in: [Configurator](#/typography/configurator-typography), [Tones and weights](#/typography/tones-and-weights), [Tracking and leading](#/typography/tracking-and-leading) and 16 more |
6346
- | `tone` | [`TextTone`](#type-TextTone)<br>`"default" \| "secondary" \| "muted"` | `"default"` | How loud the text is. `secondary` and `muted` step back without falling below the contrast threshold.<br>Shown in: [Configurator](#/typography/configurator-typography), [Tones and weights](#/typography/tones-and-weights), [Tracking and leading](#/typography/tracking-and-leading) and 94 more |
6398
+ | `tone` | [`TextTone`](#type-TextTone)<br>`"default" \| "secondary" \| "muted"` | `"default"` | How loud the text is. `secondary` and `muted` step back without falling below the contrast threshold.<br>Shown in: [Configurator](#/typography/configurator-typography), [Tones and weights](#/typography/tones-and-weights), [Tracking and leading](#/typography/tracking-and-leading) and 95 more |
6347
6399
  | `mono` | `boolean` | `false` | Geist Mono with tabular figures – for numbers and identifiers.<br>Shown in: [Configurator](#/typography/configurator-typography), [Numbers and identifiers](#/typography/numbers), [Handle long values](#/typography/long-values) and 30 more |
6348
6400
  | `tracking` | [`TextTracking`](#type-TextTracking)<br>`"normal" \| "tight" \| "display" \| "caps"` | `"normal"` | Letter spacing from the token set. `caps` belongs with letterspaced capitals.<br>Shown in: [Configurator](#/typography/configurator-typography), [Tracking and leading](#/typography/tracking-and-leading), [Set an incident summary](#/typography/incident-summary) |
6349
6401
  | `leading` | [`TextLeading`](#type-TextLeading)<br>`"normal" \| "tight"` | `"normal"` | Line spacing. `tight` for multi-line headings and key figures, where the normal spacing lets the lines fall apart.<br>Shown in: [Configurator](#/typography/configurator-typography), [Tracking and leading](#/typography/tracking-and-leading) |
@@ -8057,7 +8109,7 @@ The keys of [Input](#/input/keyboard-input), [NumberInput](#/numberinput/keyboar
8057
8109
 
8058
8110
  | Prop | Type | Default | Description |
8059
8111
  |---|---|---|---|
8060
- | `label` *required* | `ReactNode` | — | The label of the field. It is mandatory: a field without a name is a field without a question for a screen reader.<br>Shown in: [Configurator](#/formfield/configurator-formfield), [Label and hint](#/formfield/label-and-hint), [Show an error](#/formfield/show-an-error) and 74 more |
8112
+ | `label` *required* | `ReactNode` | — | The label of the field. It is mandatory: a field without a name is a field without a question for a screen reader.<br>Shown in: [Configurator](#/formfield/configurator-formfield), [Label and hint](#/formfield/label-and-hint), [Show an error](#/formfield/show-an-error) and 76 more |
8061
8113
  | `hint` | `ReactNode` | — | Help text below the field. Replaced by `error`.<br>Shown in: [Configurator](#/formfield/configurator-formfield), [Label and hint](#/formfield/label-and-hint), [Show an error](#/formfield/show-an-error) and 33 more |
8062
8114
  | `error` | `ReactNode` | — | Error message; it marks the field as invalid at the same time.<br>Shown in: [Configurator](#/formfield/configurator-formfield), [Show an error](#/formfield/show-an-error), [Check an invoice on submit](#/formfield/check-an-invoice-on-submit) and 22 more |
8063
8115
  | `required` | `boolean` | `false` | Sets the required mark on the label and `aria-required` on the field - on Input, Select, Textarea, NumberInput, Combobox, RadioGroup and Checkbox. The triggers of the pickers and of the MultiSelect are buttons, on which `aria-required` is not a permitted attribute; there the mark carries it alone. It validates nothing - validation belongs to the caller.<br>Shown in: [Configurator](#/formfield/configurator-formfield), [Mark a field as required](#/formfield/mark-a-field-as-required), [Check an invoice on submit](#/formfield/check-an-invoice-on-submit) and 9 more |
@@ -9203,7 +9255,7 @@ Also takes every attribute of `<div>` – without `defaultValue`, `onChange`.
9203
9255
 
9204
9256
  ### SegmentedControl
9205
9257
 
9206
- One choice out of a few short possibilities, drawn as one field with a segment for each (segmented button, button toggle). It stands in a row of fields as one of them: as tall, as edged and as rounded as a select.
9258
+ One choice out of a few short possibilities, drawn as one control with a segment for each (segmented button, button toggle): a sunken track, the choice lifted out of it. As tall as a select, so it stands in a row of fields too.
9207
9259
 
9208
9260
  ```ts
9209
9261
  import { SegmentedControl } from "@umriss-ui/core";
@@ -9213,7 +9265,9 @@ Demo page: https://romanhaendler.github.io/umriss-ui/core/segmentedcontrol/
9213
9265
 
9214
9266
  A screen reader hears a radio group, each segment a radio with its position and whether it is chosen; the control is one tab stop, and the arrow keys move and choose at once, skipping disabled possibilities.
9215
9267
 
9216
- Each segment is as wide as its word, and the chosen one is filled with ink. The width never follows the choice.
9268
+ Each segment is as wide as its word, and the width never follows the choice. `fill` takes the width of the place instead and shares it equally; an option's `icon` stands before its word.
9269
+
9270
+ Two drawings: `inset`, the default - a sunken track with the choice lifted out of it; and `field` - a field's edge, the choice filled with ink, for a row whose fields it should match box for box. Both are a control's height with their words on a select's line, and the keys are the same.
9217
9271
 
9218
9272
  #### Examples
9219
9273
 
@@ -9339,6 +9393,106 @@ export default function LongWordsInANarrowPlace() {
9339
9393
  }
9340
9394
  ```
9341
9395
 
9396
+ ##### A theme switch
9397
+
9398
+ A choice that stands on its own, in a menu or a settings panel. `fill` takes the panel's width and shares it equally between the segments; an option's `icon` stands before its word, at the size the control gives it.
9399
+
9400
+ ```tsx
9401
+ import { Card, CardBody, FormField, SegmentedControl } from "@umriss-ui/core";
9402
+
9403
+ /* Icons from outside the set: any SVG, sized by the control. */
9404
+ const stroke = { fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" } as const;
9405
+
9406
+ function Sun() {
9407
+ return (
9408
+ <svg viewBox="0 0 24 24" {...stroke}>
9409
+ <circle cx="12" cy="12" r="4" />
9410
+ <path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" />
9411
+ </svg>
9412
+ );
9413
+ }
9414
+
9415
+ function Moon() {
9416
+ return (
9417
+ <svg viewBox="0 0 24 24" {...stroke}>
9418
+ <path d="M20 14.5A8 8 0 1 1 9.5 4a6.5 6.5 0 0 0 10.5 10.5z" />
9419
+ </svg>
9420
+ );
9421
+ }
9422
+
9423
+ function Monitor() {
9424
+ return (
9425
+ <svg viewBox="0 0 24 24" {...stroke}>
9426
+ <rect x="3" y="4" width="18" height="12" rx="2" />
9427
+ <path d="M8 20h8M12 16v4" />
9428
+ </svg>
9429
+ );
9430
+ }
9431
+
9432
+ export default function ThemeSwitch() {
9433
+ return (
9434
+ <Card style={{ maxWidth: 320 }}>
9435
+ <CardBody>
9436
+ <FormField label="Theme">
9437
+ <SegmentedControl
9438
+ fill
9439
+ defaultValue="system"
9440
+ options={[
9441
+ { value: "light", label: "Light", icon: <Sun /> },
9442
+ { value: "dark", label: "Dark", icon: <Moon /> },
9443
+ { value: "system", label: "System", icon: <Monitor /> },
9444
+ ]}
9445
+ />
9446
+ </FormField>
9447
+ </CardBody>
9448
+ </Card>
9449
+ );
9450
+ }
9451
+ ```
9452
+
9453
+ ##### Drawn as a field
9454
+
9455
+ `variant="field"` gives it a field's edge and fills the choice with ink, for a row whose fields it should match box for box. Inset or a field, it is a control's height and its words stand on the select's line - at either size.
9456
+
9457
+ ```tsx
9458
+ import { ControlSizeProvider, FormField, SegmentedControl, Select, Stack } from "@umriss-ui/core";
9459
+ import type { ControlSize } from "@umriss-ui/core";
9460
+
9461
+ function Row({ size }: { size: ControlSize }) {
9462
+ return (
9463
+ <Stack role="group" aria-label={size === "sm" ? "Small" : "Medium"} direction="row" gap={3} wrap>
9464
+ <FormField label="Caster">
9465
+ <Select defaultValue="">
9466
+ <option value="">Every caster</option>
9467
+ <option>Caster 1</option>
9468
+ </Select>
9469
+ </FormField>
9470
+ <FormField label="Values">
9471
+ <SegmentedControl
9472
+ variant="field"
9473
+ defaultValue="measured"
9474
+ options={[
9475
+ { value: "measured", label: "Measured" },
9476
+ { value: "forecast", label: "Forecast" },
9477
+ ]}
9478
+ />
9479
+ </FormField>
9480
+ </Stack>
9481
+ );
9482
+ }
9483
+
9484
+ export default function DrawnAsAField() {
9485
+ return (
9486
+ <Stack gap={5}>
9487
+ <Row size="md" />
9488
+ <ControlSizeProvider size="sm">
9489
+ <Row size="sm" />
9490
+ </ControlSizeProvider>
9491
+ </Stack>
9492
+ );
9493
+ }
9494
+ ```
9495
+
9342
9496
  #### When to use something else
9343
9497
 
9344
9498
  - Possibilities that need a line of explanation each → RadioGroup
@@ -9359,10 +9513,12 @@ export default function LongWordsInANarrowPlace() {
9359
9513
 
9360
9514
  | Prop | Type | Default | Description |
9361
9515
  |---|---|---|---|
9362
- | `options` *required* | `readonly `[`SegmentedOption`](#type-SegmentedOption)`<T>[]` | — | The possibilities, two to four, in the order in which they stand.<br>Shown in: [Configurator](#/segmentedcontrol/configurator-segmentedcontrol), [Segmented control](#/segmentedcontrol/segmented-control), [In a field](#/segmentedcontrol/in-a-field) and 3 more |
9363
- | `defaultValue` | `T \| null` | — | Initial value of an uncontrolled control. Not together with `value`.<br>Shown in: [Configurator](#/segmentedcontrol/configurator-segmentedcontrol), [States and sizes](#/segmentedcontrol/states-and-sizes), [Long words in a narrow place](#/segmentedcontrol/long-words-in-a-narrow-place) and 1 more |
9516
+ | `options` *required* | `readonly `[`SegmentedOption`](#type-SegmentedOption)`<T>[]` | — | The possibilities, two to four, in the order in which they stand.<br>Shown in: [Configurator](#/segmentedcontrol/configurator-segmentedcontrol), [Segmented control](#/segmentedcontrol/segmented-control), [In a field](#/segmentedcontrol/in-a-field) and 5 more |
9517
+ | `defaultValue` | `T \| null` | — | Initial value of an uncontrolled control. Not together with `value`.<br>Shown in: [Configurator](#/segmentedcontrol/configurator-segmentedcontrol), [States and sizes](#/segmentedcontrol/states-and-sizes), [Long words in a narrow place](#/segmentedcontrol/long-words-in-a-narrow-place) and 3 more |
9364
9518
  | `value` | `T \| null` | — | The chosen possibility; `null` means: none yet. Together with `onChange` the control is controlled.<br>Shown in: [Segmented control](#/segmentedcontrol/segmented-control), [In a field](#/segmentedcontrol/in-a-field) |
9365
9519
  | `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](#/segmentedcontrol/configurator-segmentedcontrol), [States and sizes](#/segmentedcontrol/states-and-sizes) |
9520
+ | `variant` | `"field" \| "inset"` | `"inset"` | How it is drawn. `inset`: a sunken track without an edge, the choice a surface lifted out of it. `field`: a field's edge, the choice filled with ink - for a row whose fields it should match box for box.<br>Shown in: [Configurator](#/segmentedcontrol/configurator-segmentedcontrol), [Drawn as a field](#/segmentedcontrol/drawn-as-a-field) |
9521
+ | `fill` | `boolean` | `false` | Takes the whole width its place gives it, as a field in a column does, and shares it equally between the segments. Without it the control is as wide as its words.<br>Shown in: [Configurator](#/segmentedcontrol/configurator-segmentedcontrol), [A theme switch](#/segmentedcontrol/a-theme-switch) |
9366
9522
  | `disabled` | `boolean` | `false` | Disables the whole control. `SegmentedOption` disables single possibilities.<br>Shown in: [Configurator](#/segmentedcontrol/configurator-segmentedcontrol), [States and sizes](#/segmentedcontrol/states-and-sizes) |
9367
9523
  | `name` | `string` | a generated one | Name of the radio group within the form. |
9368
9524
 
@@ -9378,8 +9534,9 @@ Also takes every attribute of `<div>` – without `defaultValue`, `onChange`.
9378
9534
 
9379
9535
  | Prop | Type | Default | Description |
9380
9536
  |---|---|---|---|
9381
- | `value` *required* | `T` | — | What comes back when this possibility is chosen.<br>Shown in: [Segmented control](#/segmentedcontrol/segmented-control), [In a field](#/segmentedcontrol/in-a-field), [States and sizes](#/segmentedcontrol/states-and-sizes) and 2 more |
9382
- | `label` *required* | `ReactNode` | — | The segment's word - a short one; a long label ends in an ellipsis.<br>Shown in: [Segmented control](#/segmentedcontrol/segmented-control), [In a field](#/segmentedcontrol/in-a-field), [States and sizes](#/segmentedcontrol/states-and-sizes) and 2 more |
9537
+ | `value` *required* | `T` | — | What comes back when this possibility is chosen.<br>Shown in: [Segmented control](#/segmentedcontrol/segmented-control), [In a field](#/segmentedcontrol/in-a-field), [States and sizes](#/segmentedcontrol/states-and-sizes) and 4 more |
9538
+ | `label` *required* | `ReactNode` | — | The segment's word - a short one; a long label ends in an ellipsis.<br>Shown in: [Segmented control](#/segmentedcontrol/segmented-control), [In a field](#/segmentedcontrol/in-a-field), [States and sizes](#/segmentedcontrol/states-and-sizes) and 4 more |
9539
+ | `icon` | `ReactNode` | — | An icon before the word: an SVG, a glyph of the set or an icon font's element. The control sets its size - `--u-icon-size`, `--u-icon-size-sm` at `sm` - and hides it from assistive technology: the word names the possibility.<br>Shown in: [A theme switch](#/segmentedcontrol/a-theme-switch) |
9383
9540
  | `disabled` | `boolean` | — | Takes the possibility out of the choice but leaves it visible.<br>Shown in: [States and sizes](#/segmentedcontrol/states-and-sizes) |
9384
9541
 
9385
9542
  #### Known limits
@@ -12187,7 +12344,7 @@ export default function AfterAnAction() {
12187
12344
 
12188
12345
  ##### Where they stand
12189
12346
 
12190
- `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.
12347
+ `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.
12191
12348
 
12192
12349
  ```tsx
12193
12350
  import { useMemo, useState } from "react";
@@ -18065,14 +18222,14 @@ const CalendarGlyph: import("react").ForwardRefExoticComponent<Omit<GlyphProps &
18065
18222
 
18066
18223
  [Card](#/card) – A surface that holds one block of a screen together: a head with its title and actions, and a body (also called a panel or tile). Reach for it for each block of a dashboard or a detail view.
18067
18224
 
18068
- Used on [Scenarios](#/), [UmrissProvider](#/umrissprovider), [Theming](#/theming), [Sizes](#/sizes), [Stack and Grid](#/stack-and-grid), [Card](#/card), [Splitter](#/splitter), [Typography](#/typography), [Button](#/button), [NumberInput](#/numberinput), [Slider](#/slider), [Switch](#/switch), [FileInput](#/fileinput), [Combobox](#/combobox), [Spinner](#/spinner), [ProgressBar](#/progressbar), [EmptyState](#/emptystate), [CommandPalette](#/commandpalette), [Breadcrumb](#/breadcrumb), [Tabs](#/tabs), [Accordion](#/accordion), [Stepper](#/stepper) and [Stat](#/stat).
18225
+ Used on [Scenarios](#/), [UmrissProvider](#/umrissprovider), [Theming](#/theming), [Sizes](#/sizes), [Stack and Grid](#/stack-and-grid), [Card](#/card), [Splitter](#/splitter), [Typography](#/typography), [Button](#/button), [NumberInput](#/numberinput), [Slider](#/slider), [Switch](#/switch), [SegmentedControl](#/segmentedcontrol), [FileInput](#/fileinput), [Combobox](#/combobox), [Spinner](#/spinner), [ProgressBar](#/progressbar), [EmptyState](#/emptystate), [CommandPalette](#/commandpalette), [Breadcrumb](#/breadcrumb), [Tabs](#/tabs), [Accordion](#/accordion), [Stepper](#/stepper) and [Stat](#/stat).
18069
18226
 
18070
18227
  ##### `CardBody`
18071
18228
 
18072
18229
  [Card](#/card) – The content of a `Card`; the part that folds away in a collapsible card.
18073
18230
  `flush` removes the padding for a table or a log.
18074
18231
 
18075
- Used on [Scenarios](#/), [UmrissProvider](#/umrissprovider), [Theming](#/theming), [Sizes](#/sizes), [Stack and Grid](#/stack-and-grid), [Card](#/card), [Typography](#/typography), [Button](#/button), [NumberInput](#/numberinput), [Slider](#/slider), [Switch](#/switch), [FileInput](#/fileinput), [Combobox](#/combobox), [Spinner](#/spinner), [ProgressBar](#/progressbar), [EmptyState](#/emptystate), [Breadcrumb](#/breadcrumb), [Tabs](#/tabs), [Accordion](#/accordion), [Stepper](#/stepper) and [Stat](#/stat).
18232
+ Used on [Scenarios](#/), [UmrissProvider](#/umrissprovider), [Theming](#/theming), [Sizes](#/sizes), [Stack and Grid](#/stack-and-grid), [Card](#/card), [Typography](#/typography), [Button](#/button), [NumberInput](#/numberinput), [Slider](#/slider), [Switch](#/switch), [SegmentedControl](#/segmentedcontrol), [FileInput](#/fileinput), [Combobox](#/combobox), [Spinner](#/spinner), [ProgressBar](#/progressbar), [EmptyState](#/emptystate), [Breadcrumb](#/breadcrumb), [Tabs](#/tabs), [Accordion](#/accordion), [Stepper](#/stepper) and [Stat](#/stat).
18076
18233
 
18077
18234
  ##### `CardHeader`
18078
18235
 
@@ -18214,8 +18371,8 @@ function FormFieldBoundary({ children }: {
18214
18371
 
18215
18372
  ##### `Grid`
18216
18373
 
18217
- [Stack and Grid](#/stack-and-grid) – Children in a grid: a fixed number of columns, or as many as fit at
18218
- `minItemWidth`.
18374
+ [Stack and Grid](#/stack-and-grid) – Children in a grid: a fixed number of columns, a list of column widths,
18375
+ or as many columns as fit at `minItemWidth`.
18219
18376
 
18220
18377
  Used on [Scenarios](#/), [Theming](#/theming), [Sizes](#/sizes), [Language](#/language), [Stack and Grid](#/stack-and-grid), [Card](#/card), [Splitter](#/splitter), [Dock](#/dock), [Typography](#/typography), [Input](#/input), [FormField](#/formfield), [Textarea](#/textarea), [NumberInput](#/numberinput), [Slider](#/slider), [Checkbox](#/checkbox), [Switch](#/switch), [RadioGroup](#/radiogroup), [FileInput](#/fileinput), [Select](#/select), [Combobox](#/combobox), [MultiSelect](#/multiselect), [DatePicker](#/datepicker), [DateTimePicker](#/datetimepicker), [DateRangePicker](#/daterangepicker), [DateTimeRangePicker](#/datetimerangepicker), [Modal](#/modal), [Drawer](#/drawer), [CommandPalette](#/commandpalette), [Breadcrumb](#/breadcrumb), [Tabs](#/tabs), [TreeView](#/treeview), [Stat](#/stat) and [Meter](#/meter).
18221
18378
 
@@ -18409,7 +18566,7 @@ Used on [Scenarios](#/), [Sizes](#/sizes) and [RadioGroup](#/radiogroup).
18409
18566
 
18410
18567
  ##### `SegmentedControl`
18411
18568
 
18412
- [SegmentedControl](#/segmentedcontrol) – One choice out of a few short possibilities, drawn as one field with a segment for each (segmented button, button toggle). It stands in a row of fields as one of them: as tall, as edged and as rounded as a select.
18569
+ [SegmentedControl](#/segmentedcontrol) – One choice out of a few short possibilities, drawn as one control with a segment for each (segmented button, button toggle): a sunken track, the choice lifted out of it. As tall as a select, so it stands in a row of fields too.
18413
18570
 
18414
18571
  Used on [Sizes](#/sizes) and [SegmentedControl](#/segmentedcontrol).
18415
18572
 
@@ -18417,7 +18574,7 @@ Used on [Sizes](#/sizes) and [SegmentedControl](#/segmentedcontrol).
18417
18574
 
18418
18575
  [Select](#/select) – One choice from a short, known list (dropdown). Under a mouse and the keys it opens the Combobox's list; under a finger the system's picker, a wheel on the phone.
18419
18576
 
18420
- Used on [Scenarios](#/), [Sizes](#/sizes), [FormField](#/formfield), [Select](#/select), [Popover](#/popover), [Modal](#/modal), [CommandPalette](#/commandpalette), [Accordion](#/accordion) and [Tag](#/tag).
18577
+ Used on [Scenarios](#/), [Sizes](#/sizes), [FormField](#/formfield), [SegmentedControl](#/segmentedcontrol), [Select](#/select), [Popover](#/popover), [Modal](#/modal), [CommandPalette](#/commandpalette), [Accordion](#/accordion) and [Tag](#/tag).
18421
18578
 
18422
18579
  ##### `Skeleton`
18423
18580
 
@@ -19298,7 +19455,7 @@ otherwise.
19298
19455
  type ControlSize = "sm" | "md";
19299
19456
  ```
19300
19457
 
19301
- Used on [Sizes](#/sizes).
19458
+ Used on [Sizes](#/sizes) and [SegmentedControl](#/segmentedcontrol).
19302
19459
 
19303
19460
  ##### `ControlSizeProviderProps`
19304
19461
 
@@ -19482,6 +19639,15 @@ The props of a glyph: an SVG's attributes and its edge length.
19482
19639
 
19483
19640
  Also takes every attribute of `<svg>` – without `children`, `viewBox`.
19484
19641
 
19642
+ ##### `GridColumnWidth`
19643
+
19644
+ The width of one column in `Grid`'s list: a number in pixels, or
19645
+ `"fill"` for a share of what the other columns leave.
19646
+
19647
+ ```ts
19648
+ type GridColumnWidth = number | "fill";
19649
+ ```
19650
+
19485
19651
  ##### `GridProps`
19486
19652
 
19487
19653
  Its table stands on [Stack and Grid](#/stack-and-grid/type-GridProps).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umriss-ui/core",
3
- "version": "0.26.0",
3
+ "version": "0.28.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",