@umriss-ui/core 0.52.0 → 0.54.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
@@ -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, 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;
@@ -50,7 +50,7 @@ export declare interface AccordionProps extends Omit<HTMLAttributes<HTMLDivEleme
50
50
  defaultValue?: readonly string[];
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
- onChange?: (value: string[]) => void;
53
+ onValueChange?: (value: string[]) => void;
54
54
  /** The level of the heading each header stands in - the one that fits the
55
55
  page's outline. */
56
56
  headingLevel?: 2 | 3 | 4 | 5 | 6;
@@ -367,7 +367,7 @@ export declare interface ComboboxOption<T extends string | number = string> {
367
367
  }
368
368
 
369
369
  /** The props of `Combobox`. */
370
- export declare interface ComboboxProps<T extends string | number = string> extends Omit<HTMLAttributes<HTMLInputElement>, "onChange" | "defaultValue">, RefProp<HTMLInputElement>, FormPostProps<T>, DeprecatedOnChange<(value: T | null) => void> {
370
+ export declare interface ComboboxProps<T extends string | number = string> extends Omit<HTMLAttributes<HTMLInputElement>, "onChange" | "defaultValue">, RefProp<HTMLInputElement>, FormPostProps<T> {
371
371
  /** The possibilities, in their natural order. Filtered while typing; never
372
372
  reordered. */
373
373
  options: readonly ComboboxOption<T>[];
@@ -646,7 +646,7 @@ export declare function DatePicker(props: DatePickerProps): JSX.Element;
646
646
  * one; resolution "day"). There is no path that delivers a time of day along
647
647
  * with it.
648
648
  */
649
- export declare interface DatePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostProps<Date>, DeprecatedOnChange<(date: Date | null) => void> {
649
+ export declare interface DatePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostProps<Date> {
650
650
  /** The day, as a `Date` on midnight in the formats' zone (the reader's, unless the application names one); `null` means none. */
651
651
  value?: Date | null;
652
652
  /** Uncontrolled: the value to start at.
@@ -712,7 +712,7 @@ export declare function DateRangePicker(props: DateRangePickerProps): JSX.Elemen
712
712
  * never lies after `to` - a range dragged backwards is silently turned around.
713
713
  * Both ends count inclusively. There is no error state.
714
714
  */
715
- export declare interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostRangeProps, DeprecatedOnChange<(range: DateRange | null) => void> {
715
+ export declare interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostRangeProps {
716
716
  /** The time span, both ends on midnight in the formats' zone (the reader's, unless the application names one) and both inclusive; `null`
717
717
  means none. */
718
718
  value?: DateRange | null;
@@ -769,7 +769,7 @@ export declare function DateTimePicker(props: DateTimePickerProps): JSX.Element;
769
769
  * panel applies (the default being the earlier one). A value is reported only
770
770
  * with "Apply", "Now" or "Clear", not already on the click on a day.
771
771
  */
772
- export declare interface DateTimePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostProps<Date>, DeprecatedOnChange<(date: Date | null) => void> {
772
+ export declare interface DateTimePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostProps<Date> {
773
773
  /** The instant; `null` means none. The panel reads and sets its day and
774
774
  wall clock in the formats' zone (the reader's, unless the application names one). */
775
775
  value?: Date | null;
@@ -837,7 +837,7 @@ export declare function DateTimeRangePicker(props: DateTimeRangePickerProps): JS
837
837
  * the daylight-saving change the same reservation holds as for the
838
838
  * DateTimePicker, separately per end of the range.
839
839
  */
840
- export declare interface DateTimeRangePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostRangeProps, DeprecatedOnChange<(range: DateRange | null) => void> {
840
+ export declare interface DateTimeRangePickerProps extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostRangeProps {
841
841
  /** The time span with times at both ends; `null` means none. The panel reads
842
842
  and sets days and wall clocks in the formats' zone (the reader's, unless
843
843
  the application names one). */
@@ -908,12 +908,6 @@ export declare const DEFAULT_WORDING: Wording;
908
908
  the calculation; a compact set of tokens does not exist. */
909
909
  export declare type Density = "comfortable" | "compact";
910
910
 
911
- /** The deprecated `onChange` alias of `onValueChange`, for a field prop type to extend. */
912
- declare interface DeprecatedOnChange<T> {
913
- /** The former name of `onValueChange`. @deprecated since 0.52 - use `onValueChange`; it goes in the next minor release. */
914
- onChange?: T;
915
- }
916
-
917
911
  /** Where the active node moves: up and down the visible rows, in and out of a
918
912
  branch, to the first or the last row. */
919
913
  export declare type Direction = "up" | "down" | "in" | "out" | "start" | "end";
@@ -973,7 +967,7 @@ export declare function FileInput(props: FileInputProps): JSX.Element;
973
967
 
974
968
  /** The props of `FileInput`: a native file input's attributes, with the files
975
969
  as the value. */
976
- export declare interface FileInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "size">, RefProp<HTMLInputElement>, DeprecatedOnChange<(files: File[]) => void> {
970
+ export declare interface FileInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "size">, RefProp<HTMLInputElement> {
977
971
  /** Controlled: the chosen files; `undefined` reads as none. Uncontrolled,
978
972
  the input keeps its own, from `defaultValue`. */
979
973
  value?: readonly File[];
@@ -1025,6 +1019,16 @@ export declare interface FlatteningEntry<K, S extends Key = string> {
1025
1019
  siblings: number;
1026
1020
  }
1027
1021
 
1022
+ /**
1023
+ * A span as hours and minutes from the wording's short units ("1 hr 30 min").
1024
+ * The span is rounded to the whole minute, so 1 h 29 min 40 s reads as
1025
+ * 1 hr 30 min everywhere; a span of no minutes reads "0 min", a negative one
1026
+ * as its size. With `days` the whole days lead and the hours stay below 24.
1027
+ */
1028
+ export declare function formatDuration(ms: number, wording: Wording, options?: {
1029
+ days?: boolean;
1030
+ }): string;
1031
+
1028
1032
  /** Everything the library knows about formatting. */
1029
1033
  export declare interface Formats {
1030
1034
  /** The language tag the set was built in: "en-GB". */
@@ -1594,7 +1598,7 @@ export declare interface MultiSelectOption<T extends string | number = string> {
1594
1598
  }
1595
1599
 
1596
1600
  /** The props of `MultiSelect`. */
1597
- export declare interface MultiSelectProps<T extends string | number = string> extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostProps<T>, DeprecatedOnChange<(value: T[]) => void> {
1601
+ export declare interface MultiSelectProps<T extends string | number = string> extends Omit<HTMLAttributes<HTMLButtonElement>, "onChange" | "defaultValue">, RefProp<HTMLButtonElement>, FormPostProps<T> {
1598
1602
  /** The possibilities, in their natural order. The list never re-sorts –
1599
1603
  not even in the "selected" scope. */
1600
1604
  options: readonly MultiSelectOption<T>[];
@@ -1673,7 +1677,7 @@ export declare function NumberInput(props: NumberInputProps): JSX.Element;
1673
1677
 
1674
1678
  /** The props of `NumberInput`: a native input's attributes, with the value a
1675
1679
  number or `null`. */
1676
- export declare interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "size" | "prefix" | "type" | "name">, RefProp<HTMLInputElement>, FormPostProps<number>, DeprecatedOnChange<(value: number | null) => void> {
1680
+ export declare interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange" | "size" | "prefix" | "type" | "name">, RefProp<HTMLInputElement>, FormPostProps<number> {
1677
1681
  /** The number, or `null` (or `undefined`) for "not stated". An empty
1678
1682
  field is not zero: a quantity that was not measured is not a quantity
1679
1683
  of zero. With it the field is controlled; without it the field keeps
@@ -1857,7 +1861,7 @@ export declare type Quality = "good" | "uncertain" | "bad";
1857
1861
  export declare function RadioGroup<T extends string | number>(props: RadioGroupProps<T>): JSX.Element;
1858
1862
 
1859
1863
  /** The props of `RadioGroup`. */
1860
- export declare interface RadioGroupProps<T extends string | number> extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">, RefProp<HTMLDivElement>, DeprecatedOnChange<(value: T) => void> {
1864
+ export declare interface RadioGroupProps<T extends string | number> extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">, RefProp<HTMLDivElement> {
1861
1865
  /** The possibilities, in the order in which they are meant to stand. */
1862
1866
  options: readonly RadioOption<T>[];
1863
1867
  /** The chosen possibility; `null` means: none yet. Together with
@@ -1961,7 +1965,7 @@ export declare interface RowPlacement {
1961
1965
  rowHeight: number;
1962
1966
  scrollTop: number;
1963
1967
  viewportHeight: number;
1964
- /** Height of the sticky header; it covers the upper edge. */
1968
+ /** Height of the sticky header; it stands above row 0 and covers the upper edge. */
1965
1969
  headerHeight?: number;
1966
1970
  }
1967
1971
 
@@ -1984,8 +1988,8 @@ export declare interface RowWindow {
1984
1988
  * This is the arithmetic the keyboard handling hangs on: without it the focus
1985
1989
  * moves into a row that is not rendered.
1986
1990
  *
1987
- * The sticky header counts against the upper edge: a row standing exactly at
1988
- * `scrollTop` lies behind it.
1991
+ * The sticky header stands above row 0, so it pushes every row down by its
1992
+ * height, and once scrolled it covers the upper edge of the viewport.
1989
1993
  */
1990
1994
  export declare function scrollForRow(index: number, { rowHeight, scrollTop, viewportHeight, headerHeight }: RowPlacement): number | null;
1991
1995
 
@@ -1996,7 +2000,7 @@ export declare function scrollForRow(index: number, { rowHeight, scrollTop, view
1996
2000
  export declare function SegmentedControl<T extends string | number>(props: SegmentedControlProps<T>): JSX.Element;
1997
2001
 
1998
2002
  /** The props of `SegmentedControl`. */
1999
- export declare interface SegmentedControlProps<T extends string | number> extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">, RefProp<HTMLDivElement>, DeprecatedOnChange<(value: T) => void> {
2003
+ export declare interface SegmentedControlProps<T extends string | number> extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">, RefProp<HTMLDivElement> {
2000
2004
  /** The possibilities, two to four, in the order in which they stand. */
2001
2005
  options: readonly SegmentedOption<T>[];
2002
2006
  /** The chosen possibility; `null` means: none yet. Together with
@@ -2137,13 +2141,13 @@ export declare type SliderMark = number | {
2137
2141
  };
2138
2142
 
2139
2143
  /** The props of `Slider`. */
2140
- export declare interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "onChange" | "min" | "max" | "step">, RefProp<HTMLInputElement>, DeprecatedOnChange<(value: number) => void> {
2144
+ export declare interface SliderProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "value" | "defaultValue" | "min" | "max" | "step">, RefProp<HTMLInputElement> {
2141
2145
  /** Controlled: the value; `undefined` reads as `min`. */
2142
2146
  value?: number;
2143
2147
  /** Uncontrolled: the value to start at.
2144
2148
  @default min */
2145
2149
  defaultValue?: number;
2146
- /** Reports every change, by pointer or key, as a number on the step. */
2150
+ /** Reports every change, by pointer or key, as a number on the step; `onChange` is the input's native event. */
2147
2151
  onValueChange?: (value: number) => void;
2148
2152
  /** The smallest value. */
2149
2153
  min?: number;
@@ -2224,7 +2228,7 @@ export declare interface SplitButtonProps extends Omit<ButtonProps, "children" |
2224
2228
 
2225
2229
  /** Two panes and the line between them. The line can be dragged, moved with
2226
2230
  the arrow keys, and Enter collapses the first pane and brings it back. */
2227
- export declare function Splitter({ ref, orientation, value: valueProp, defaultValue, onChange, min, max, step, separatorLabel, className, style, onKeyDown, children, ...rest }: SplitterProps): JSX.Element;
2231
+ export declare function Splitter({ ref, orientation, value: valueProp, defaultValue, onValueChange, min, max, step, separatorLabel, className, style, onKeyDown, children, ...rest }: SplitterProps): JSX.Element;
2228
2232
 
2229
2233
  /** The props of `Splitter`. */
2230
2234
  export declare interface SplitterProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue" | "children">, RefProp<HTMLDivElement> {
@@ -2236,7 +2240,7 @@ export declare interface SplitterProps extends Omit<HTMLAttributes<HTMLDivElemen
2236
2240
  /** Uncontrolled: the share to start at. */
2237
2241
  defaultValue?: number;
2238
2242
  /** Reports every move, by pointer or key, as the first pane's share. */
2239
- onChange?: (value: number) => void;
2243
+ onValueChange?: (value: number) => void;
2240
2244
  /** The smallest share of the first pane, and where Enter collapses it to. */
2241
2245
  min?: number;
2242
2246
  /** The largest share of the first pane. */
@@ -2373,8 +2377,8 @@ export declare interface TabProps extends ButtonHTMLAttributes<HTMLButtonElement
2373
2377
  }
2374
2378
 
2375
2379
  /** Tabs: a `TabList` of `Tab`s and one `TabPanel` per value. Controlled
2376
- through `value` and `onChange`, or uncontrolled from `defaultValue`. */
2377
- export declare function Tabs({ ref, value, defaultValue, onChange, className, children, ...rest }: TabsProps): JSX.Element;
2380
+ through `value` and `onValueChange`, or uncontrolled from `defaultValue`. */
2381
+ export declare function Tabs({ ref, value, defaultValue, onValueChange, className, children, ...rest }: TabsProps): JSX.Element;
2378
2382
 
2379
2383
  /** The props of `Tabs`. */
2380
2384
  export declare interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">, RefProp<HTMLDivElement> {
@@ -2386,7 +2390,7 @@ export declare interface TabsProps extends Omit<HTMLAttributes<HTMLDivElement>,
2386
2390
  defaultValue?: string;
2387
2391
  /** Receives the value of the chosen tab. Controlled, the tab switches only
2388
2392
  once `value` follows; uncontrolled it is merely a message. */
2389
- onChange?: (value: string) => void;
2393
+ onValueChange?: (value: string) => void;
2390
2394
  }
2391
2395
 
2392
2396
  /** A short label with a tone; with `onRemove` it carries a cross that removes
@@ -2722,6 +2726,7 @@ export declare interface TreeOptions<K, S extends Key = string> {
2722
2726
  defaultExpanded?: Iterable<S>;
2723
2727
  defaultChecked?: Iterable<S>;
2724
2728
  defaultActive?: S | null;
2729
+ defaultSearch?: string;
2725
2730
  /** Controlled from outside; where set, it wins over the tree's own state. */
2726
2731
  expanded?: ReadonlySet<S>;
2727
2732
  checked?: ReadonlySet<S>;
@@ -2730,11 +2735,11 @@ export declare interface TreeOptions<K, S extends Key = string> {
2730
2735
  four values, so that a range is repeatable. */
2731
2736
  anchor?: S | null;
2732
2737
  search?: string;
2733
- onExpanded?: (next: ReadonlySet<S>) => void;
2734
- onChecked?: (next: ReadonlySet<S>) => void;
2735
- onActive?: (next: S | null) => void;
2736
- onAnchor?: (next: S | null) => void;
2737
- onSearch?: (text: string) => void;
2738
+ onExpandedChange?: (next: ReadonlySet<S>) => void;
2739
+ onCheckedChange?: (next: ReadonlySet<S>) => void;
2740
+ onActiveChange?: (next: S | null) => void;
2741
+ onAnchorChange?: (next: S | null) => void;
2742
+ onSearchChange?: (text: string) => void;
2738
2743
  /** Enter on a node, or a click on its label. */
2739
2744
  onActivate?: (node: K) => void;
2740
2745
  /**