@moderneinc/react-charts 1.5.2-next.f8b5a8 → 1.6.0-next.0d285b

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.
@@ -101,6 +101,22 @@ export type CampaignTimelineProps = {
101
101
  * @default true
102
102
  */
103
103
  snapToEvents?: boolean;
104
+ /**
105
+ * False makes the chart display-only: no playhead, no slider role, input
106
+ * ignored, `onTimeChange` never fires. Flags stay clickable - this disables
107
+ * scrubbing, not selection.
108
+ * @default true
109
+ */
110
+ enableScrubbing?: boolean;
111
+ /**
112
+ * Whether the campaign has finished. Complete graphs the span of its own
113
+ * data; incomplete runs to wall-clock now, so elapsed silence occupies width.
114
+ *
115
+ * NOTE: wall-clock is read once per instance - the edge does not advance on
116
+ * its own. Pass `horizonEnd` on an interval for that.
117
+ * @default true
118
+ */
119
+ complete?: boolean;
104
120
  /**
105
121
  * How far data is known - typically the last status refresh. The line stops
106
122
  * here and the rest is hatched: unrefreshed, not empty. Defaults to no hatch.
@@ -109,9 +125,28 @@ export type CampaignTimelineProps = {
109
125
  /**
110
126
  * Extends the x-domain to at least this time, so the chart can show
111
127
  * wall-clock time past the last refresh. Never shrinks the domain: a value
112
- * earlier than the last data point has no effect.
128
+ * earlier than the last data point has no effect - including under
129
+ * `complete={false}`, which sets a floor for the right edge rather than
130
+ * overriding one.
113
131
  */
114
132
  horizonEnd?: number;
133
+ /**
134
+ * Fraction of the plot width at which the newest data sits. `2/3` leaves the
135
+ * last third empty; `1` runs the data flush to the right edge.
136
+ *
137
+ * Trailing room is what a flag's label needs: the last event's banner is
138
+ * drawn to the RIGHT of its pole, so a pole at the edge has nowhere to put
139
+ * its text and the label flips to a chip on the other side. Reserving space
140
+ * here keeps the newest - usually most interesting - event reading like
141
+ * every other one.
142
+ *
143
+ * Applies to whatever right edge the domain settled on, so it composes with
144
+ * `horizonEnd` and with `complete={false}`'s wall-clock edge rather than
145
+ * fighting them. Clamped to (0, 1].
146
+ *
147
+ * @default 1
148
+ */
149
+ trailingRatio?: number;
115
150
  /** Ids of events drawn in the selected state. */
116
151
  selectedEventIds?: string[];
117
152
  /** Called when an event flag is clicked. */
@@ -7,13 +7,16 @@ type UseCampaignTimelineProps = {
7
7
  defaultTime?: number;
8
8
  onTimeChange?: (time: number, reason: PlayheadChangeReason) => void;
9
9
  snapToEvents: boolean;
10
+ enableScrubbing: boolean;
11
+ complete: boolean;
10
12
  now?: number;
11
13
  horizonEnd?: number;
14
+ trailingRatio: number;
12
15
  width?: number;
13
16
  fontFamily: string;
14
17
  formatDate?: (timestamp: number) => string;
15
18
  };
16
- export declare const useCampaignTimeline: ({ events, burndown, time, defaultTime, onTimeChange, snapToEvents, now, horizonEnd, width: widthProp, fontFamily, formatDate }: UseCampaignTimelineProps) => {
19
+ export declare const useCampaignTimeline: ({ events, burndown, time, defaultTime, onTimeChange, snapToEvents, enableScrubbing, complete, now, horizonEnd, trailingRatio, width: widthProp, fontFamily, formatDate }: UseCampaignTimelineProps) => {
17
20
  containerRef: import('react').RefObject<HTMLDivElement>;
18
21
  width: number;
19
22
  plotWidth: number;