@umriss-ui/core 0.20.0 → 0.21.1

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
@@ -166,6 +166,9 @@ export declare const ButtonGroup: ForwardRefExoticComponent<ButtonGroupProps & R
166
166
  export declare interface ButtonGroupProps extends HTMLAttributes<HTMLDivElement> {
167
167
  /** Label of the group for the screen reader. */
168
168
  "aria-label"?: string;
169
+ /** The size of the buttons in it that do not say their own - one group,
170
+ one height. Default: the size around it, else `md`. */
171
+ size?: ButtonSize;
169
172
  }
170
173
 
171
174
  export declare interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
@@ -173,13 +176,15 @@ export declare interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElem
173
176
  actions side by side are no longer a main action. `ghost` is quiet in the
174
177
  accent, `plain` quiet and neutral. */
175
178
  variant?: ButtonVariant;
176
- /** `sm` for buttons in header bars and table rows, `md` otherwise. */
179
+ /** `sm` for buttons in header bars and table rows, `md` otherwise. Default:
180
+ the size of a `ControlSizeProvider` around it, else `md`. */
177
181
  size?: ButtonSize;
178
182
  /** Shows a loading indicator and locks the button. */
179
183
  loading?: boolean;
180
184
  }
181
185
 
182
- export declare type ButtonSize = "sm" | "md";
186
+ /** A button's two heights - the controls' (`ControlSize`). */
187
+ export declare type ButtonSize = ControlSize;
183
188
 
184
189
  export declare type ButtonVariant = "primary" | "secondary" | "ghost" | "plain" | "danger";
185
190
 
@@ -298,9 +303,16 @@ export declare interface ComboboxProps<T extends string = string> extends Omit<H
298
303
  onChange: (value: T | null) => void;
299
304
  /** What stands in the empty field. */
300
305
  placeholder?: string;
301
- /** `sm` for a table toolbar and dense forms, `md` otherwise - the heights of
302
- `Input`'s two sizes. */
306
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
307
+ `ControlSizeProvider` around it, else `md`. */
303
308
  size?: "sm" | "md";
309
+ /** The width in characters - room for the typed text and the chosen
310
+ option; the field adds its own padding, chevron and cross. Given, the
311
+ field is that wide wherever it stands, and never wider than its place.
312
+ Without it the field fills its place, and is 16 characters wide where the
313
+ place asks - in a toolbar or a row. The panel is never narrower than the
314
+ field. */
315
+ chars?: number;
304
316
  /** Locks field and panel. */
305
317
  disabled?: boolean;
306
318
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
@@ -421,6 +433,22 @@ export declare interface ContextMenuProps {
421
433
  children: ReactNode;
422
434
  }
423
435
 
436
+ /** The two heights of a control: `sm` for a toolbar and dense forms, `md`
437
+ otherwise. */
438
+ export declare type ControlSize = "sm" | "md";
439
+
440
+ /** Sets the size of the controls inside it - every control with `size` takes
441
+ it unless it says its own. A popover, dialog or tooltip opened from inside
442
+ starts without it. */
443
+ export declare function ControlSizeProvider({ size, children }: ControlSizeProviderProps): JSX.Element;
444
+
445
+ export declare interface ControlSizeProviderProps {
446
+ /** The size of every control inside that does not say its own. */
447
+ size: ControlSize;
448
+ /** The place the size holds for. */
449
+ children: ReactNode;
450
+ }
451
+
424
452
  /** The cross that clears a field, removes a tag or a chip, and closes a
425
453
  dialog, a toast or an alert - one drawing at the size of its place. */
426
454
  export declare const CrossGlyph: ForwardRefExoticComponent<Omit<GlyphProps, "ref"> & RefAttributes<SVGSVGElement>>;
@@ -447,8 +475,15 @@ export declare interface DatePickerProps extends Omit<HTMLAttributes<HTMLSpanEle
447
475
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
448
476
  carries an `error` - by hand only necessary without `FormField`. */
449
477
  invalid?: boolean;
450
- /** `sm` for dense forms and table rows, `md` otherwise. */
478
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
479
+ `ControlSizeProvider` around it, else `md`. */
451
480
  size?: "sm" | "md";
481
+ /** The width in characters - room for the value; the field adds its own
482
+ padding, glyph and cross. Given, the field is that wide wherever it
483
+ stands, and never wider than its place. Without it the field fills its
484
+ place, and where the place asks - in a toolbar or a row - it is as wide
485
+ as its longest value in the formats in use, so a date never truncates. */
486
+ chars?: number;
452
487
  /** Shows a cross where a value is set, which fades in on hover/focus and
453
488
  clears the value. */
454
489
  clearable?: boolean;
@@ -497,8 +532,15 @@ export declare interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLSp
497
532
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
498
533
  carries an `error` - by hand only necessary without `FormField`. */
499
534
  invalid?: boolean;
500
- /** `sm` for dense forms and table rows, `md` otherwise. */
535
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
536
+ `ControlSizeProvider` around it, else `md`. */
501
537
  size?: "sm" | "md";
538
+ /** The width in characters - room for the value; the field adds its own
539
+ padding, glyph and cross. Given, the field is that wide wherever it
540
+ stands, and never wider than its place. Without it the field fills its
541
+ place, and where the place asks - in a toolbar or a row - it is as wide
542
+ as its longest value in the formats in use, so a date never truncates. */
543
+ chars?: number;
502
544
  /** Shows a cross where a value is set, which fades in on hover/focus and
503
545
  clears the value. */
504
546
  clearable?: boolean;
@@ -532,8 +574,15 @@ export declare interface DateTimePickerProps extends Omit<HTMLAttributes<HTMLSpa
532
574
  placeholder?: string;
533
575
  /** Locks the field and the panel. */
534
576
  disabled?: boolean;
535
- /** `sm` for dense forms and table rows, `md` otherwise. */
577
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
578
+ `ControlSizeProvider` around it, else `md`. */
536
579
  size?: "sm" | "md";
580
+ /** The width in characters - room for the value; the field adds its own
581
+ padding, glyph and cross. Given, the field is that wide wherever it
582
+ stands, and never wider than its place. Without it the field fills its
583
+ place, and where the place asks - in a toolbar or a row - it is as wide
584
+ as its longest value in the formats in use, so a date never truncates. */
585
+ chars?: number;
537
586
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
538
587
  carries an `error` - by hand only necessary without `FormField`. */
539
588
  invalid?: boolean;
@@ -587,8 +636,15 @@ export declare interface DateTimeRangePickerProps extends Omit<HTMLAttributes<HT
587
636
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
588
637
  carries an `error` - by hand only necessary without `FormField`. */
589
638
  invalid?: boolean;
590
- /** `sm` for dense forms and table rows, `md` otherwise. */
639
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
640
+ `ControlSizeProvider` around it, else `md`. */
591
641
  size?: "sm" | "md";
642
+ /** The width in characters - room for the value; the field adds its own
643
+ padding, glyph and cross. Given, the field is that wide wherever it
644
+ stands, and never wider than its place. Without it the field fills its
645
+ place, and where the place asks - in a toolbar or a row - it is as wide
646
+ as its longest value in the formats in use, so a date never truncates. */
647
+ chars?: number;
592
648
  /** Shows a cross where a value is set, which fades in on hover/focus and
593
649
  clears the value. */
594
650
  clearable?: boolean;
@@ -959,8 +1015,14 @@ export declare interface IconButtonProps extends Omit<ButtonProps, "aria-label"
959
1015
  export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes<HTMLInputElement>>;
960
1016
 
961
1017
  export declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
962
- /** `sm` for dense forms and table rows, `md` otherwise. */
1018
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1019
+ `ControlSizeProvider` around it, else `md`. */
963
1020
  size?: "sm" | "md";
1021
+ /** The width in characters - room for the value; the field adds its own
1022
+ padding and cross. Given, the field is that wide wherever it stands, and
1023
+ never wider than its place. Without it the field fills its place, and is
1024
+ 16 characters wide where the place asks - in a toolbar or a row. */
1025
+ chars?: number;
964
1026
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
965
1027
  carries an `error` - by hand only necessary without `FormField`. */
966
1028
  invalid?: boolean;
@@ -1190,9 +1252,16 @@ export declare interface MultiSelectProps<T extends string = string> extends Omi
1190
1252
  searchPlaceholder?: string;
1191
1253
  /** Text when the search finds nothing. */
1192
1254
  emptyText?: string;
1193
- /** `sm` for a table toolbar and dense forms, `md` otherwise - the heights of
1194
- `Input`'s two sizes. */
1255
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1256
+ `ControlSizeProvider` around it, else `md`. */
1195
1257
  size?: "sm" | "md";
1258
+ /** The width in characters - room for the chips; the field adds its own
1259
+ padding and chevron. Given, the field is that wide wherever it stands,
1260
+ and never wider than its place. Without it the field fills its place,
1261
+ and is 20 characters wide where the place asks - in a toolbar or a row,
1262
+ room for two short chips and the counter. Either way, choosing and removing values never moves it: the chips that
1263
+ do not fit stand as "+N". */
1264
+ chars?: number;
1196
1265
  /** Locks field and panel. */
1197
1266
  disabled?: boolean;
1198
1267
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
@@ -1260,8 +1329,15 @@ export declare interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLI
1260
1329
  prefix?: ReactNode;
1261
1330
  /** Adornment after the number, e.g. "€" or "%". */
1262
1331
  suffix?: ReactNode;
1263
- /** `sm` for dense forms and table rows, `md` otherwise. */
1332
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1333
+ `ControlSizeProvider` around it, else `md`. */
1264
1334
  size?: "sm" | "md";
1335
+ /** The width in characters - room for the number; the field adds its own
1336
+ padding and steppers, and the room for a `prefix` and `suffix` given as
1337
+ text. Given, the field is that wide wherever it stands, and never wider
1338
+ than its place. Without it the field fills its place, and is 10
1339
+ characters wide where the place asks - in a toolbar or a row. */
1340
+ chars?: number;
1265
1341
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
1266
1342
  carries an `error` – by hand only needed without `FormField`. */
1267
1343
  invalid?: boolean;
@@ -1380,7 +1456,8 @@ export declare interface RadioGroupProps<T extends string> extends Omit<HTMLAttr
1380
1456
  onChange?: (value: T) => void;
1381
1457
  /** Arrangement; Default one below the other. */
1382
1458
  orientation?: "vertical" | "horizontal";
1383
- /** `sm` for dense forms, `md` otherwise. */
1459
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1460
+ `ControlSizeProvider` around it, else `md`. */
1384
1461
  size?: "sm" | "md";
1385
1462
  /** Disables the whole group. `RadioOption` disables single
1386
1463
  possibilities. */
@@ -1479,11 +1556,16 @@ export declare function scrollForRow(index: number, { rowHeight, scrollTop, view
1479
1556
  */
1480
1557
  export declare const Select: ForwardRefExoticComponent<SelectProps & RefAttributes<HTMLSelectElement>>;
1481
1558
 
1482
- export declare interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
1483
- /** `sm` for dense forms and table rows, `md` otherwise. Not called `size`,
1484
- because `<select size>` on the native element is the number of visible
1485
- rows – two meanings, one name, that would go wrong. */
1486
- selectSize?: "sm" | "md";
1559
+ export declare interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, "size"> {
1560
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1561
+ `ControlSizeProvider` around it, else `md`. */
1562
+ size?: "sm" | "md";
1563
+ /** The width in characters - room for the chosen option; the field adds
1564
+ its own padding, chevron and cross. Given, the field is that wide
1565
+ wherever it stands, and never wider than its place. Without it the field
1566
+ fills its place, and is 16 characters wide where the place asks - never
1567
+ as wide as its longest option. */
1568
+ chars?: number;
1487
1569
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
1488
1570
  carries an `error` – by hand only necessary without `FormField`. */
1489
1571
  invalid?: boolean;
@@ -1624,7 +1706,8 @@ export declare interface SplitButtonProps extends Omit<ButtonProps, "children" |
1624
1706
  menu: ReactNode;
1625
1707
  /** How loud the main action is; the trigger beside it follows suit. */
1626
1708
  variant?: ButtonVariant;
1627
- /** `sm` for buttons in header bars and table rows, `md` otherwise. */
1709
+ /** `sm` for buttons in header bars and table rows, `md` otherwise. Default:
1710
+ the size around it, else `md`. */
1628
1711
  size?: ButtonSize;
1629
1712
  /** Label of the trigger; default "More actions". */
1630
1713
  menuLabel?: string;
@@ -1729,8 +1812,8 @@ export declare const Switch: ForwardRefExoticComponent<SwitchProps & RefAttribut
1729
1812
  export declare interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "role"> {
1730
1813
  /** Label to the right of the switch. */
1731
1814
  label?: ReactNode;
1732
- /** `sm` for dense forms and table rows, `md` otherwise - the sizes of the
1733
- fields beside it. */
1815
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1816
+ `ControlSizeProvider` around it, else `md`. */
1734
1817
  size?: "sm" | "md";
1735
1818
  /** Marks the switch as invalid. `FormField` sets it itself as soon as it
1736
1819
  carries an `error` - by hand only necessary without `FormField`. */
@@ -1803,9 +1886,15 @@ export { Text_2 as Text }
1803
1886
 
1804
1887
  export declare const Textarea: ForwardRefExoticComponent<TextareaProps & RefAttributes<HTMLTextAreaElement>>;
1805
1888
 
1806
- export declare interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
1807
- /** `sm` for dense forms and table rows, `md` otherwise. */
1889
+ export declare interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "cols"> {
1890
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1891
+ `ControlSizeProvider` around it, else `md`. */
1808
1892
  size?: "sm" | "md";
1893
+ /** The width in characters - the length of a line; the field adds its own
1894
+ padding. Given, the field is that wide wherever it stands, and never
1895
+ wider than its place. Without it the field fills its place, and is 40
1896
+ characters wide where the place asks - in a row. */
1897
+ chars?: number;
1809
1898
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
1810
1899
  carries an `error` – by hand only needed without `FormField`. */
1811
1900
  invalid?: boolean;