@umriss-ui/charts 0.43.0 → 0.44.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
@@ -38,6 +38,12 @@ declare interface ChartsWording {
38
38
  walkHelp: string;
39
39
  /** The key that reports the Active point - only where `onSelect` is given. */
40
40
  selectHelp: string;
41
+ /** Said when the keyboard sets the start of a range; the x value is written in the axis' format. */
42
+ rangeStarted: (from: string) => string;
43
+ /** Said when the keyboard sets the end of a range. */
44
+ rangeMade: (from: string, to: string) => string;
45
+ /** The key that marks a range - only where `onRange` is given and a tooltip stands. */
46
+ rangeHelp: string;
41
47
  /** The keys that zoom and pan it - only where the chart can be zoomed. */
42
48
  zoomHelp: string;
43
49
  /** The keys of the legend's entries - only where it has one to press. */
package/dist/index.d.ts CHANGED
@@ -375,7 +375,7 @@ export declare type CalendarInput = WorkingCalendar | readonly WorkingInterval[]
375
375
 
376
376
  /** What `useChart` takes besides the rows: the view to start from and the
377
377
  handler that hears every change of it. */
378
- export declare interface ChartOptions<Z = unknown> {
378
+ export declare interface ChartOptions<Z = unknown, V extends number | string = number> {
379
379
  /** The view to start from, read once when the hook first runs; a different
380
380
  value on a later render is ignored, as React ignores a changed
381
381
  `defaultValue`. To go to a view later, call `setView`. The chart
@@ -393,6 +393,14 @@ export declare interface ChartOptions<Z = unknown> {
393
393
  none: what is chosen is the application's state. Needs a `<Tooltip>`,
394
394
  which makes the hits; the hit does not travel over `syncId`. */
395
395
  onSelect?: (hit: TooltipHit<Z>) => void;
396
+ /** The reader marked a stretch of an x axis: Alt with a drag where the chart
397
+ zooms, a plain drag where it does not. Called once, on release - once per
398
+ x axis -, with `from` not after `to`, in the axis' own values: numbers, milliseconds on a time axis, wall-clock instants on a calendar axis, and on a category axis the first and last category covered, as strings - say so in the handler's parameter, `ChartRange<string>`. A band
399
+ covers the stretch while the pointer is down; the chart keeps no range and
400
+ draws none afterwards, and it does not travel over `syncId`. A press that
401
+ travels 4 px or less is a click and reaches `onSelect`; Escape and a
402
+ cancelled pointer report nothing. */
403
+ onRange?: (range: ChartRange<V>) => void;
396
404
  }
397
405
 
398
406
  /** What `useChart` hands back: the chart and its parts, typed at the row `Z`,
@@ -435,6 +443,15 @@ export declare interface ChartParts<Z> {
435
443
  showOnly: (name: string) => void;
436
444
  /** Shows every series again. */
437
445
  showAllSeries: () => void;
446
+ /** A PNG of the chart as it stands: the plot with its grid, series and
447
+ limits, the axes with ticks, labels and titles, and the legend, on the
448
+ chart's own ground in the colour scheme in use, at the chart's size on
449
+ screen and at least twice its CSS pixels. Not in it: the tooltip, the
450
+ crosshair and hover marks, the "Show all" button, the data key and
451
+ its table, the screen-reader texts, and any title. Where the picture goes
452
+ - a download, the clipboard, an upload - is the application's. Rejects
453
+ with an `Error` when the chart is not on screen or has no size. */
454
+ toPng: () => Promise<Blob>;
438
455
  }
439
456
 
440
457
  /** Measurements of the instrumentation for the benchmark page. */
@@ -463,10 +480,6 @@ export declare interface ChartProps extends Omit<HTMLAttributes<HTMLDivElement>,
463
480
  height?: number;
464
481
  /** Outer spacing of the plot area in CSS pixels. */
465
482
  padding?: number | Partial<Padding>;
466
- /** Accessible name of the plot. Without a name, `aria-label` or
467
- `aria-labelledby`, the chart warns in development.
468
- @deprecated since 0.43 - use `aria-label`. */
469
- ariaLabel?: string;
470
483
  /** Goes to the root element, as it does everywhere in this workspace. */
471
484
  className?: string;
472
485
  /** Goes to the root element, after the chart's own styles: a `height` or
@@ -513,6 +526,16 @@ export declare interface ChartProps extends Omit<HTMLAttributes<HTMLDivElement>,
513
526
  children?: ReactNode;
514
527
  }
515
528
 
529
+ /** A stretch of an x axis the reader marked (`onRange`): `from` is not after
530
+ `to`, both in the axis' own values - numbers on a numeric or time axis
531
+ (milliseconds). A caller that reads numbers takes the default and needs no
532
+ cast; `V` is what a category axis widens it to. */
533
+ export declare interface ChartRange<V extends number | string = number> {
534
+ axisId: string;
535
+ from: V;
536
+ to: V;
537
+ }
538
+
516
539
  /** Everything the charts put out as text. */
517
540
  export declare interface ChartsWording {
518
541
  /** The BCP 47 tag every number and every date or time label of the chart is
@@ -553,6 +576,12 @@ export declare interface ChartsWording {
553
576
  walkHelp: string;
554
577
  /** The key that reports the Active point - only where `onSelect` is given. */
555
578
  selectHelp: string;
579
+ /** Said when the keyboard sets the start of a range; the x value is written in the axis' format. */
580
+ rangeStarted: (from: string) => string;
581
+ /** Said when the keyboard sets the end of a range. */
582
+ rangeMade: (from: string, to: string) => string;
583
+ /** The key that marks a range - only where `onRange` is given and a tooltip stands. */
584
+ rangeHelp: string;
556
585
  /** The keys that zoom and pan it - only where the chart can be zoomed. */
557
586
  zoomHelp: string;
558
587
  /** The keys of the legend's entries - only where it has one to press. */
@@ -1516,7 +1545,7 @@ export declare function toWorkingTimeClamped(wallClock: number, input: CalendarI
1516
1545
  @returns `Chart`, `XAxis`, `YAxis` and every series kind - each keeps its
1517
1546
  identity over the renders -, the `view`, its `domains` and `hidden`, and
1518
1547
  the setters that change them. */
1519
- export declare function useChart<Z>(rows: readonly Z[], options?: ChartOptions<Z>): ChartParts<Z>;
1548
+ export declare function useChart<Z, V extends number | string = number>(rows: readonly Z[], options?: ChartOptions<Z, V>): ChartParts<Z>;
1520
1549
 
1521
1550
  /** A value read from the row (ADR-0048): the name of a number field, compared
1522
1551
  by its name, or a function, compared by its source text (`ValueFunction`). */
@@ -1529,8 +1558,8 @@ export declare type ValueFormat = ((value: number) => string) | NumberOptions;
1529
1558
  /** A **value** computed from the row - the function form of `Value`.
1530
1559
  Compared by its source text, not its identity - an inline function is new
1531
1560
  on every render. Known limit: one that reads a
1532
- changed closure variable under the same text is not run again; pass a new
1533
- data reference then. A native or bound function is compared by identity. */
1561
+ changed closure variable under the same text is not run again, and DEV warns;
1562
+ carry the value in the rows, or give the series a `key` that changes with it. A native or bound function is compared by identity. */
1534
1563
  export declare type ValueFunction<T> = (d: T, index: number) => number | null | undefined;
1535
1564
 
1536
1565
  /** What a value is. Four outcomes, not three.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- const i = {
2
+ const r = {
3
3
  locale: "de-DE",
4
4
  roleDescription: "Diagramm",
5
5
  empty: "Keine Daten",
@@ -12,6 +12,9 @@ const i = {
12
12
  percent: (e) => `${e} %`,
13
13
  walkHelp: "Pfeil links und rechts gehen durch die Werte, Pfeil hoch und runter wechseln die Serie, Pos1 und Ende springen zum ersten und letzten Wert, Escape hebt die Markierung auf.",
14
14
  selectHelp: "Enter wählt den Punkt.",
15
+ rangeStarted: (e) => `Bereich ab ${e} begonnen.`,
16
+ rangeMade: (e, n) => `Bereich von ${e} bis ${n}.`,
17
+ rangeHelp: "Leertaste setzt Anfang und Ende eines Bereichs, Escape bricht ab.",
15
18
  zoomHelp: "Plus und Minus zoomen, Umschalt mit Pfeil links oder rechts verschiebt, 0 kehrt zum eigenen Bereich der Achse zurück.",
16
19
  legendHelp: "In der Legende blendet Enter eine Serie aus oder ein, Umschalt+Enter zeigt nur sie.",
17
20
  allShown: "Sonst wäre nichts mehr zu sehen, darum werden alle Serien gezeigt.",
@@ -35,5 +38,5 @@ const i = {
35
38
  downsampled: (e) => `Ausgedünnt aus ${e.toLocaleString("de-DE")} Messwerten: erster, kleinster, größter und letzter Wert je Abschnitt.`
36
39
  };
37
40
  export {
38
- i as GERMAN_CHARTS_WORDING
41
+ r as GERMAN_CHARTS_WORDING
39
42
  };