@umriss-ui/core 0.53.0 → 0.55.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/de.d.ts CHANGED
@@ -162,6 +162,41 @@ declare interface Wording {
162
162
  /** The clearing x of the range with time - kept apart from the range without,
163
163
  so that an application can call the two differently. */
164
164
  dateTimeRangeClear: string;
165
+ colorPlaceholder: string;
166
+ /** The name of the ColorPicker trigger where nothing else names it: the colour as hex, or `null` for none. */
167
+ colorTrigger: (hex: string | null) => string;
168
+ /** Accessible name of the ColorPicker panel, where its field names it no other way. */
169
+ colorPanel: string;
170
+ /** The name and the visible label of the hex field. */
171
+ colorHex: string;
172
+ colorBefore: string;
173
+ colorAfter: string;
174
+ /** Stands for no colour in the strip that compares the colour the panel opened with and the colour now. */
175
+ colorNone: string;
176
+ /** The strip as one sentence, for a screen reader. */
177
+ colorBeforeAfter: (before: string, after: string) => string;
178
+ colorDone: string;
179
+ /** Name of the row of the application's own colours. */
180
+ colorSwatches: string;
181
+ /** The name of core's light surface in the contrast readout. */
182
+ colorSurfaceLight: string;
183
+ /** The name of core's dark surface in the contrast readout. */
184
+ colorSurfaceDark: string;
185
+ /** The verdict of the contrast readout at 3:1 and above, and below it; words, so that the colour is not the only sign. */
186
+ colorPass: string;
187
+ colorFail: string;
188
+ /** Names of the red, green and blue fields of the ColorPicker panel. */
189
+ colorRed: string;
190
+ colorGreen: string;
191
+ colorBlue: string;
192
+ /** The button that picks a colour from the screen. */
193
+ colorEyedropper: string;
194
+ /** Names of the square and the hue strip, the square's role description, and what they say as value. */
195
+ colorSquare: string;
196
+ colorSquareRole: string;
197
+ colorSquareValue: (saturation: number, brightness: number) => string;
198
+ colorHue: string;
199
+ colorHueValue: (degrees: number) => string;
165
200
  previousMonth: string;
166
201
  nextMonth: string;
167
202
  /** Name of the calendar head's month list. */
package/dist/index.d.ts CHANGED
@@ -23,7 +23,7 @@ import { TextareaHTMLAttributes } from 'react';
23
23
 
24
24
  /** Sections behind headers that open and close: one at a time (`single`) or
25
25
  any number (`multiple`). The arrow keys move between the headers. */
26
- export declare function Accordion({ ref, type, value: valueProp, defaultValue, onValueChange, onChange, headingLevel, className, onKeyDown, children, ...rest }: AccordionProps): JSX.Element;
26
+ export declare function Accordion({ ref, type, value: valueProp, defaultValue, onValueChange, headingLevel, className, onKeyDown, children, ...rest }: AccordionProps): JSX.Element;
27
27
 
28
28
  /** One section of an `Accordion`: its header and the content it opens. */
29
29
  export declare function AccordionItem({ ref, value, title, disabled, className, children, ...rest }: AccordionItemProps): JSX.Element;
@@ -51,8 +51,6 @@ export declare interface AccordionProps extends Omit<HTMLAttributes<HTMLDivEleme
51
51
  /** Reports the open sections after a header's click. Controlled, the
52
52
  accordion follows once `value` does; uncontrolled it is a message. */
53
53
  onValueChange?: (value: string[]) => void;
54
- /** The former name of `onValueChange`. @deprecated since 0.53 - use `onValueChange`; it goes in the next minor release. */
55
- onChange?: (value: string[]) => void;
56
54
  /** The level of the heading each header stands in - the one that fits the
57
55
  page's outline. */
58
56
  headingLevel?: 2 | 3 | 4 | 5 | 6;
@@ -350,6 +348,53 @@ export declare interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInpu
350
348
  /** A clock face at a quarter past - the time pickers' character. */
351
349
  export declare function ClockGlyph({ ref, size, ...rest }: GlyphProps): JSX.Element;
352
350
 
351
+ /** A colour field: a trigger with the colour's swatch and hex value, and a panel with the saturation and brightness square, the hue strip, the hex field, the red, green and blue fields, the eyedropper where the browser has one, the application's own swatches, the contrast against light and dark surfaces, the colour as it was when the panel opened beside the colour now, Cancel and Done. */
352
+ export declare function ColorPicker(props: ColorPickerProps): JSX.Element;
353
+
354
+ /** The props of `ColorPicker`: the field's value contract (ADR-0081) with a hex colour for the value. */
355
+ export declare interface ColorPickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostProps<string> {
356
+ /** The colour as a hex string - `#2563eb`, `2563EB` and `#26e` are read; `null` means none. Anything else warns in development and reads as `null`. It leaves as lowercase `#rrggbb`. */
357
+ value?: string | null;
358
+ /** Uncontrolled: the colour to start at.
359
+ @default null */
360
+ defaultValue?: string | null;
361
+ /** Runs on every settled step - a hex value as soon as it is a whole colour - and once more with the colour the panel opened with when Cancel or Escape put it back. */
362
+ onValueChange?: (value: string | null) => void;
363
+ /** What stands in the empty field. */
364
+ placeholder?: string;
365
+ /** A cross on the trigger and Clear in the panel set `null`.
366
+ @default false */
367
+ clearable?: boolean;
368
+ /** Locks the field and the panel. */
369
+ disabled?: boolean;
370
+ /** Marks the field as invalid. `FormField` sets it itself as soon as it
371
+ carries an `error` - by hand only necessary without `FormField`. */
372
+ invalid?: boolean;
373
+ /** `sm` for a toolbar and dense forms, `md` otherwise.
374
+ @default the size of a `ControlSizeProvider` around it, else `"md"` */
375
+ size?: "sm" | "md";
376
+ /** The width in characters - room for the value; the field adds its own
377
+ padding, swatch and chevron. Given, the field is that wide wherever it
378
+ stands, and never wider than its place. Without it the field fills its
379
+ place, and where the place asks - in a toolbar or a row - it is as wide
380
+ as a hex value. */
381
+ chars?: number;
382
+ /** The application's own colours as one-click choices in the panel, named for a screen reader and on hover; the one matching the colour is pressed.
383
+ @default no default */
384
+ swatches?: readonly ColorSwatch[];
385
+ /** The surfaces the panel measures the colour against, each with its contrast ratio and Pass or Fail at 3:1 (WCAG 1.4.11 - for marks and lines, not text). An empty list hides the readout.
386
+ @default core's light and dark surface */
387
+ contrastAgainst?: readonly ColorSwatch[];
388
+ }
389
+
390
+ /** A named colour: an entry of `swatches`, or a surface in `contrastAgainst`. */
391
+ export declare interface ColorSwatch {
392
+ /** What the colour is called: said by a screen reader and shown on hover (swatch), or the surface's name in the readout. */
393
+ name: string;
394
+ /** A hex colour, `#2563eb` or `2563EB`. */
395
+ value: string;
396
+ }
397
+
353
398
  /** A searchable select field (the combobox pattern with a listbox panel).
354
399
  The label of the chosen `value` is kept from the last `options` that held
355
400
  it, so a search that replaces the options does not empty the field - an
@@ -938,6 +983,9 @@ export declare interface DrawerProps extends Omit<ModalProps, "size"> {
938
983
  side?: "right" | "left";
939
984
  }
940
985
 
986
+ /** An eyedropper: a pipette with its bulb at the top and its tip at the bottom left. */
987
+ export declare function DropperGlyph({ ref, size, ...rest }: GlyphProps): JSX.Element;
988
+
941
989
  /** The first key that occurs twice, otherwise null. Two nodes with the same
942
990
  key break the cascade and the active node silently - `useTree` reports
943
991
  that during development. */
@@ -1021,6 +1069,16 @@ export declare interface FlatteningEntry<K, S extends Key = string> {
1021
1069
  siblings: number;
1022
1070
  }
1023
1071
 
1072
+ /**
1073
+ * A span as hours and minutes from the wording's short units ("1 hr 30 min").
1074
+ * The span is rounded to the whole minute, so 1 h 29 min 40 s reads as
1075
+ * 1 hr 30 min everywhere; a span of no minutes reads "0 min", a negative one
1076
+ * as its size. With `days` the whole days lead and the hours stay below 24.
1077
+ */
1078
+ export declare function formatDuration(ms: number, wording: Wording, options?: {
1079
+ days?: boolean;
1080
+ }): string;
1081
+
1024
1082
  /** Everything the library knows about formatting. */
1025
1083
  export declare interface Formats {
1026
1084
  /** The language tag the set was built in: "en-GB". */
@@ -1742,13 +1800,19 @@ export declare function PlusGlyph({ ref, size, ...rest }: GlyphProps): JSX.Eleme
1742
1800
  */
1743
1801
  export declare function Popover({ open, onOpenChange, anchorRef, focusRef, insideRefs, align, offset, width, minWidth, restoreFocus, hideOnScroll, role: roleProp, "aria-label": name, id, className, closeOnTabOut, onBlur, children, }: PopoverProps): ReactPortal | null;
1744
1802
 
1803
+ /** Why a popover asks to close: Escape, a click outside, a scroll
1804
+ (`hideOnScroll`), the anchor clipped away by a scrolling container, a Tab
1805
+ out of the panel (`closeOnTabOut`). */
1806
+ export declare type PopoverCloseReason = "escape" | "outside" | "scroll" | "clipped" | "tab";
1807
+
1745
1808
  /** The props of `Popover`. */
1746
1809
  export declare interface PopoverProps {
1747
1810
  /** Whether the surface stands. Controlled: the popover never opens itself. */
1748
1811
  open: boolean;
1749
1812
  /** Reports every wish to change the state – outside click, Escape,
1750
- scrolling. Whether it closes as a result is the caller's decision. */
1751
- onOpenChange: (open: boolean) => void;
1813
+ scrolling. Whether it closes as a result is the caller's decision. A
1814
+ wish to close carries its `PopoverCloseReason`. */
1815
+ onOpenChange: (open: boolean, reason?: PopoverCloseReason) => void;
1752
1816
  /** Trigger the panel hangs from (the reference for the position). */
1753
1817
  anchorRef: RefObject<HTMLElement | null>;
1754
1818
  /**
@@ -1957,7 +2021,7 @@ export declare interface RowPlacement {
1957
2021
  rowHeight: number;
1958
2022
  scrollTop: number;
1959
2023
  viewportHeight: number;
1960
- /** Height of the sticky header; it covers the upper edge. */
2024
+ /** Height of the sticky header; it stands above row 0 and covers the upper edge. */
1961
2025
  headerHeight?: number;
1962
2026
  }
1963
2027
 
@@ -1980,8 +2044,8 @@ export declare interface RowWindow {
1980
2044
  * This is the arithmetic the keyboard handling hangs on: without it the focus
1981
2045
  * moves into a row that is not rendered.
1982
2046
  *
1983
- * The sticky header counts against the upper edge: a row standing exactly at
1984
- * `scrollTop` lies behind it.
2047
+ * The sticky header stands above row 0, so it pushes every row down by its
2048
+ * height, and once scrolled it covers the upper edge of the viewport.
1985
2049
  */
1986
2050
  export declare function scrollForRow(index: number, { rowHeight, scrollTop, viewportHeight, headerHeight }: RowPlacement): number | null;
1987
2051
 
@@ -2220,7 +2284,7 @@ export declare interface SplitButtonProps extends Omit<ButtonProps, "children" |
2220
2284
 
2221
2285
  /** Two panes and the line between them. The line can be dragged, moved with
2222
2286
  the arrow keys, and Enter collapses the first pane and brings it back. */
2223
- export declare function Splitter({ ref, orientation, value: valueProp, defaultValue, onValueChange, onChange, min, max, step, separatorLabel, className, style, onKeyDown, children, ...rest }: SplitterProps): JSX.Element;
2287
+ export declare function Splitter({ ref, orientation, value: valueProp, defaultValue, onValueChange, min, max, step, separatorLabel, className, style, onKeyDown, children, ...rest }: SplitterProps): JSX.Element;
2224
2288
 
2225
2289
  /** The props of `Splitter`. */
2226
2290
  export declare interface SplitterProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue" | "children">, RefProp<HTMLDivElement> {
@@ -2233,8 +2297,6 @@ export declare interface SplitterProps extends Omit<HTMLAttributes<HTMLDivElemen
2233
2297
  defaultValue?: number;
2234
2298
  /** Reports every move, by pointer or key, as the first pane's share. */
2235
2299
  onValueChange?: (value: number) => void;
2236
- /** The former name of `onValueChange`. @deprecated since 0.53 - use `onValueChange`; it goes in the next minor release. */
2237
- onChange?: (value: number) => void;
2238
2300
  /** The smallest share of the first pane, and where Enter collapses it to. */
2239
2301
  min?: number;
2240
2302
  /** The largest share of the first pane. */
@@ -2372,7 +2434,7 @@ export declare interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement
2372
2434
 
2373
2435
  /** Tabs: a `TabList` of `Tab`s and one `TabPanel` per value. Controlled
2374
2436
  through `value` and `onValueChange`, or uncontrolled from `defaultValue`. */
2375
- export declare function Tabs({ ref, value, defaultValue, onValueChange, onChange, className, children, ...rest }: TabsProps): JSX.Element;
2437
+ export declare function Tabs({ ref, value, defaultValue, onValueChange, className, children, ...rest }: TabsProps): JSX.Element;
2376
2438
 
2377
2439
  /** The props of `Tabs`. */
2378
2440
  export declare interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">, RefProp<HTMLDivElement> {
@@ -2385,8 +2447,6 @@ export declare interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>,
2385
2447
  /** Receives the value of the chosen tab. Controlled, the tab switches only
2386
2448
  once `value` follows; uncontrolled it is merely a message. */
2387
2449
  onValueChange?: (value: string) => void;
2388
- /** The former name of `onValueChange`. @deprecated since 0.53 - use `onValueChange`; it goes in the next minor release. */
2389
- onChange?: (value: string) => void;
2390
2450
  }
2391
2451
 
2392
2452
  /** A short label with a tone; with `onRemove` it carries a cross that removes
@@ -2736,16 +2796,6 @@ export declare interface TreeOptions<K, S extends Key = string> {
2736
2796
  onActiveChange?: (next: S | null) => void;
2737
2797
  onAnchorChange?: (next: S | null) => void;
2738
2798
  onSearchChange?: (text: string) => void;
2739
- /** The former name of `onExpandedChange`. @deprecated since 0.53 - use `onExpandedChange`; it goes in the next minor release. */
2740
- onExpanded?: (next: ReadonlySet<S>) => void;
2741
- /** The former name of `onCheckedChange`. @deprecated since 0.53 - use `onCheckedChange`; it goes in the next minor release. */
2742
- onChecked?: (next: ReadonlySet<S>) => void;
2743
- /** The former name of `onActiveChange`. @deprecated since 0.53 - use `onActiveChange`; it goes in the next minor release. */
2744
- onActive?: (next: S | null) => void;
2745
- /** The former name of `onAnchorChange`. @deprecated since 0.53 - use `onAnchorChange`; it goes in the next minor release. */
2746
- onAnchor?: (next: S | null) => void;
2747
- /** The former name of `onSearchChange`. @deprecated since 0.53 - use `onSearchChange`; it goes in the next minor release. */
2748
- onSearch?: (text: string) => void;
2749
2799
  /** Enter on a node, or a click on its label. */
2750
2800
  onActivate?: (node: K) => void;
2751
2801
  /**
@@ -3157,6 +3207,41 @@ export declare interface Wording {
3157
3207
  /** The clearing x of the range with time - kept apart from the range without,
3158
3208
  so that an application can call the two differently. */
3159
3209
  dateTimeRangeClear: string;
3210
+ colorPlaceholder: string;
3211
+ /** The name of the ColorPicker trigger where nothing else names it: the colour as hex, or `null` for none. */
3212
+ colorTrigger: (hex: string | null) => string;
3213
+ /** Accessible name of the ColorPicker panel, where its field names it no other way. */
3214
+ colorPanel: string;
3215
+ /** The name and the visible label of the hex field. */
3216
+ colorHex: string;
3217
+ colorBefore: string;
3218
+ colorAfter: string;
3219
+ /** Stands for no colour in the strip that compares the colour the panel opened with and the colour now. */
3220
+ colorNone: string;
3221
+ /** The strip as one sentence, for a screen reader. */
3222
+ colorBeforeAfter: (before: string, after: string) => string;
3223
+ colorDone: string;
3224
+ /** Name of the row of the application's own colours. */
3225
+ colorSwatches: string;
3226
+ /** The name of core's light surface in the contrast readout. */
3227
+ colorSurfaceLight: string;
3228
+ /** The name of core's dark surface in the contrast readout. */
3229
+ colorSurfaceDark: string;
3230
+ /** The verdict of the contrast readout at 3:1 and above, and below it; words, so that the colour is not the only sign. */
3231
+ colorPass: string;
3232
+ colorFail: string;
3233
+ /** Names of the red, green and blue fields of the ColorPicker panel. */
3234
+ colorRed: string;
3235
+ colorGreen: string;
3236
+ colorBlue: string;
3237
+ /** The button that picks a colour from the screen. */
3238
+ colorEyedropper: string;
3239
+ /** Names of the square and the hue strip, the square's role description, and what they say as value. */
3240
+ colorSquare: string;
3241
+ colorSquareRole: string;
3242
+ colorSquareValue: (saturation: number, brightness: number) => string;
3243
+ colorHue: string;
3244
+ colorHueValue: (degrees: number) => string;
3160
3245
  previousMonth: string;
3161
3246
  nextMonth: string;
3162
3247
  /** Name of the calendar head's month list. */
@@ -52,6 +52,29 @@ const u = /* @__PURE__ */ d("de-DE"), c = {
52
52
  dateRangeClear: "Zeitraum leeren",
53
53
  dateTimeRangePanel: "Zeitraum mit Uhrzeit wählen",
54
54
  dateTimeRangeClear: "Zeitraum mit Uhrzeit leeren",
55
+ colorPlaceholder: "Farbe wählen",
56
+ colorTrigger: (e) => e ? `Farbe ${e}` : "Farbe: keine",
57
+ colorPanel: "Farbe wählen",
58
+ colorHex: "Hex",
59
+ colorBefore: "Vorher",
60
+ colorAfter: "Nachher",
61
+ colorNone: "Keine",
62
+ colorBeforeAfter: (e, n) => `Vorher ${e}, nachher ${n}`,
63
+ colorDone: "Fertig",
64
+ colorSwatches: "Farbfelder",
65
+ colorSurfaceLight: "Hell",
66
+ colorSurfaceDark: "Dunkel",
67
+ colorPass: "Bestanden",
68
+ colorFail: "Nicht bestanden",
69
+ colorRed: "Rot",
70
+ colorGreen: "Grün",
71
+ colorBlue: "Blau",
72
+ colorEyedropper: "Farbe vom Bildschirm aufnehmen",
73
+ colorSquare: "Sättigung und Helligkeit",
74
+ colorSquareRole: "zweiachsige Farbfläche",
75
+ colorSquareValue: (e, n) => `Sättigung ${e} %, Helligkeit ${n} %`,
76
+ colorHue: "Farbton",
77
+ colorHueValue: (e) => `${e} Grad`,
55
78
  previousMonth: "Voriger Monat",
56
79
  nextMonth: "Nächster Monat",
57
80
  monthSelect: "Monat",