@umriss-ui/core 0.19.0 → 0.21.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
@@ -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,6 +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;
306
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
307
+ `ControlSizeProvider` around it, else `md`. */
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;
301
316
  /** Locks field and panel. */
302
317
  disabled?: boolean;
303
318
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
@@ -418,6 +433,22 @@ export declare interface ContextMenuProps {
418
433
  children: ReactNode;
419
434
  }
420
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
+
421
452
  /** The cross that clears a field, removes a tag or a chip, and closes a
422
453
  dialog, a toast or an alert - one drawing at the size of its place. */
423
454
  export declare const CrossGlyph: ForwardRefExoticComponent<Omit<GlyphProps, "ref"> & RefAttributes<SVGSVGElement>>;
@@ -444,8 +475,15 @@ export declare interface DatePickerProps extends Omit<HTMLAttributes<HTMLSpanEle
444
475
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
445
476
  carries an `error` - by hand only necessary without `FormField`. */
446
477
  invalid?: boolean;
447
- /** `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`. */
448
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;
449
487
  /** Shows a cross where a value is set, which fades in on hover/focus and
450
488
  clears the value. */
451
489
  clearable?: boolean;
@@ -494,8 +532,15 @@ export declare interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLSp
494
532
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
495
533
  carries an `error` - by hand only necessary without `FormField`. */
496
534
  invalid?: boolean;
497
- /** `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`. */
498
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;
499
544
  /** Shows a cross where a value is set, which fades in on hover/focus and
500
545
  clears the value. */
501
546
  clearable?: boolean;
@@ -529,8 +574,15 @@ export declare interface DateTimePickerProps extends Omit<HTMLAttributes<HTMLSpa
529
574
  placeholder?: string;
530
575
  /** Locks the field and the panel. */
531
576
  disabled?: boolean;
532
- /** `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`. */
533
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;
534
586
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
535
587
  carries an `error` - by hand only necessary without `FormField`. */
536
588
  invalid?: boolean;
@@ -584,8 +636,15 @@ export declare interface DateTimeRangePickerProps extends Omit<HTMLAttributes<HT
584
636
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
585
637
  carries an `error` - by hand only necessary without `FormField`. */
586
638
  invalid?: boolean;
587
- /** `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`. */
588
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;
589
648
  /** Shows a cross where a value is set, which fades in on hover/focus and
590
649
  clears the value. */
591
650
  clearable?: boolean;
@@ -956,8 +1015,14 @@ export declare interface IconButtonProps extends Omit<ButtonProps, "aria-label"
956
1015
  export declare const Input: ForwardRefExoticComponent<InputProps & RefAttributes<HTMLInputElement>>;
957
1016
 
958
1017
  export declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
959
- /** `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`. */
960
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;
961
1026
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
962
1027
  carries an `error` - by hand only necessary without `FormField`. */
963
1028
  invalid?: boolean;
@@ -1187,6 +1252,16 @@ export declare interface MultiSelectProps<T extends string = string> extends Omi
1187
1252
  searchPlaceholder?: string;
1188
1253
  /** Text when the search finds nothing. */
1189
1254
  emptyText?: string;
1255
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1256
+ `ControlSizeProvider` around it, else `md`. */
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;
1190
1265
  /** Locks field and panel. */
1191
1266
  disabled?: boolean;
1192
1267
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
@@ -1254,8 +1329,15 @@ export declare interface NumberInputProps extends Omit<InputHTMLAttributes<HTMLI
1254
1329
  prefix?: ReactNode;
1255
1330
  /** Adornment after the number, e.g. "€" or "%". */
1256
1331
  suffix?: ReactNode;
1257
- /** `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`. */
1258
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;
1259
1341
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
1260
1342
  carries an `error` – by hand only needed without `FormField`. */
1261
1343
  invalid?: boolean;
@@ -1374,7 +1456,8 @@ export declare interface RadioGroupProps<T extends string> extends Omit<HTMLAttr
1374
1456
  onChange?: (value: T) => void;
1375
1457
  /** Arrangement; Default one below the other. */
1376
1458
  orientation?: "vertical" | "horizontal";
1377
- /** `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`. */
1378
1461
  size?: "sm" | "md";
1379
1462
  /** Disables the whole group. `RadioOption` disables single
1380
1463
  possibilities. */
@@ -1473,11 +1556,16 @@ export declare function scrollForRow(index: number, { rowHeight, scrollTop, view
1473
1556
  */
1474
1557
  export declare const Select: ForwardRefExoticComponent<SelectProps & RefAttributes<HTMLSelectElement>>;
1475
1558
 
1476
- export declare interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
1477
- /** `sm` for dense forms and table rows, `md` otherwise. Not called `size`,
1478
- because `<select size>` on the native element is the number of visible
1479
- rows – two meanings, one name, that would go wrong. */
1480
- 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;
1481
1569
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
1482
1570
  carries an `error` – by hand only necessary without `FormField`. */
1483
1571
  invalid?: boolean;
@@ -1618,7 +1706,8 @@ export declare interface SplitButtonProps extends Omit<ButtonProps, "children" |
1618
1706
  menu: ReactNode;
1619
1707
  /** How loud the main action is; the trigger beside it follows suit. */
1620
1708
  variant?: ButtonVariant;
1621
- /** `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`. */
1622
1711
  size?: ButtonSize;
1623
1712
  /** Label of the trigger; default "More actions". */
1624
1713
  menuLabel?: string;
@@ -1723,8 +1812,8 @@ export declare const Switch: ForwardRefExoticComponent<SwitchProps & RefAttribut
1723
1812
  export declare interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "role"> {
1724
1813
  /** Label to the right of the switch. */
1725
1814
  label?: ReactNode;
1726
- /** `sm` for dense forms and table rows, `md` otherwise - the sizes of the
1727
- fields beside it. */
1815
+ /** `sm` for a toolbar and dense forms, `md` otherwise. Default: the size of a
1816
+ `ControlSizeProvider` around it, else `md`. */
1728
1817
  size?: "sm" | "md";
1729
1818
  /** Marks the switch as invalid. `FormField` sets it itself as soon as it
1730
1819
  carries an `error` - by hand only necessary without `FormField`. */
@@ -1797,9 +1886,15 @@ export { Text_2 as Text }
1797
1886
 
1798
1887
  export declare const Textarea: ForwardRefExoticComponent<TextareaProps & RefAttributes<HTMLTextAreaElement>>;
1799
1888
 
1800
- export declare interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
1801
- /** `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`. */
1802
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;
1803
1898
  /** Marks the field as invalid. `FormField` sets it itself as soon as it
1804
1899
  carries an `error` – by hand only needed without `FormField`. */
1805
1900
  invalid?: boolean;