@lilt-ui/charts 0.12.0 → 0.12.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.
@@ -13,6 +13,11 @@ export interface AxisCursor {
13
13
  * with the bars that light up, for marks that snap to a column rather than glide.
14
14
  */
15
15
  columnX: MotionValue<number>;
16
+ /**
17
+ * The color of the inspected column's mark: the hovered series' bar, or a candle's direction.
18
+ * Empty until a column is read; it keeps the last color while the band fades out.
19
+ */
20
+ columnColor: MotionValue<string>;
16
21
  y: MotionValue<number>;
17
22
  /** 1 while this chart owns an inspection with pills on its axes, else 0. */
18
23
  active: MotionValue<number>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Lets go of a card's pin the way a Cartesian chart does: on any press that misses the marks,
3
+ * whether on empty plot, elsewhere in the card, or off it, and on Escape while the card has the
4
+ * keyboard (focus inside it, or the last press landed in it). Presses on controls keep the pin,
5
+ * so a legend item or period menu decides for itself.
6
+ */
7
+ export declare function usePinRelease(root: Element | null, pinned: boolean, release: (() => void) | undefined,
8
+ /** Whether a press inside the plot landed on a mark. */
9
+ onMark: (event: PointerEvent, root: Element) => boolean): void;
@@ -12,6 +12,10 @@ export interface TouchGlideOptions<T> {
12
12
  /** A tap with no glide. Leave unset where the item's own click already handles taps. */
13
13
  onTap?: (value: T | null) => void;
14
14
  disabled?: boolean;
15
+ /** Whether the card holds a pin, so Escape or a press that misses the marks lets it go. */
16
+ pinned?: boolean;
17
+ /** Releases the pin. See `usePinRelease`. */
18
+ onRelease?: () => void;
15
19
  }
16
20
  /** Finds the nearest `data-glide-id` under a point, for families whose marks are elements. */
17
21
  export declare function glideTarget(clientX: number, clientY: number, root: Element): string | null;
@@ -33,6 +33,11 @@ export interface MarkSpec<P> {
33
33
  loading?: (props: P) => LoadingMark;
34
34
  /** Draws one observation emphasized, over the dimmed marks, while it is inspected. */
35
35
  highlight?: (props: P, input: MarkHighlightInput) => ReactNode;
36
+ /**
37
+ * The color one observation is drawn in, when the mark decides it (rising and falling
38
+ * candles). Otherwise the series' `colorAt`, then its color.
39
+ */
40
+ color?: (props: P, input: Omit<MarkHighlightInput, 'color'>) => string | undefined;
36
41
  }
37
42
  export interface MarkHighlightInput {
38
43
  row: NormalizedRow<unknown>;
@@ -47,6 +52,7 @@ export interface PlotMark {
47
52
  fields: readonly string[];
48
53
  loading?: LoadingMark;
49
54
  highlight?: (input: MarkHighlightInput) => ReactNode;
55
+ color?: (input: Omit<MarkHighlightInput, 'color'>) => string | undefined;
50
56
  }
51
57
  export declare function defineMark<P>(component: (props: P) => ReactElement, spec: MarkSpec<P>): (props: P) => ReactElement;
52
58
  /** Marks placed directly in a plot, or inside fragments there, in document order. */
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  /**
3
3
  * Behind a bar or column chart, the inspected column is lit as a whole: a soft band the height of
4
4
  * the plot, a little wider than its bars. A column is what a reader inspects on a bar chart, so
5
- * the band says so where a thin crosshair would not.
5
+ * the band says so where a thin crosshair would not. It takes the color of the column it holds,
6
+ * so a falling candle is lit in red and a rising one in green.
6
7
  */
7
8
  export declare function HoverBand(): ReactElement | null;