@moderneinc/react-charts 1.2.0-next.c015c0 → 1.2.0-next.c03472
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/components/chrono-chart/chrono-chart.component.d.ts +10 -0
- package/dist/components/chrono-chart/chrono-chart.types.d.ts +129 -0
- package/dist/components/chrono-chart/components/category-table.component.d.ts +13 -0
- package/dist/components/chrono-chart/components/category-table.types.d.ts +42 -0
- package/dist/components/chrono-chart/utils/data-transformer.d.ts +41 -0
- package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.component.d.ts +7 -0
- package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.types.d.ts +95 -0
- package/dist/components/d3-stacked-area-chart/hooks/use-d3-stacked-area.hook.d.ts +35 -0
- package/dist/components/morph-chart/hooks/shared/computations.d.ts +29 -0
- package/dist/components/morph-chart/hooks/shared/types.d.ts +24 -0
- package/dist/components/morph-chart/hooks/use-morph-chart.hook.d.ts +90 -0
- package/dist/components/morph-chart/index.d.ts +2 -0
- package/dist/components/morph-chart/morph-chart.component.d.ts +14 -0
- package/dist/components/morph-chart/morph-chart.types.d.ts +175 -0
- package/dist/components/morph-chart/utils/accordion-generator.d.ts +102 -0
- package/dist/components/morph-chart/utils/animation-constants.d.ts +23 -0
- package/dist/components/morph-chart/utils/animation-utils.d.ts +44 -0
- package/dist/components/morph-chart/utils/arc-path-calculator.d.ts +53 -0
- package/dist/components/morph-chart/utils/area-renderer.d.ts +24 -0
- package/dist/components/morph-chart/utils/bar-renderer.d.ts +19 -0
- package/dist/components/morph-chart/utils/gsap-orchestrator.d.ts +291 -0
- package/dist/components/morph-chart/utils/morph-interpolator.d.ts +96 -0
- package/dist/components/morph-chart/utils/parliament-renderer.d.ts +23 -0
- package/dist/components/morph-chart/utils/parliament-seat-extractor.d.ts +33 -0
- package/dist/components/morph-chart/utils/position-mapper.d.ts +48 -0
- package/dist/components/morph-chart/utils/segment-transformer.d.ts +70 -0
- package/dist/components/morph-chart/utils/slinky-3d-generator.d.ts +35 -0
- package/dist/components/morph-chart/utils/svg-patterns.d.ts +19 -0
- package/dist/components/morph-chart/utils/svg-slinky-generator.d.ts +25 -0
- package/dist/components/parliament-chart/hooks/use-parliament-chart.hook.d.ts +5 -1
- package/dist/components/parliament-chart/parliament-chart.types.d.ts +5 -0
- package/dist/components/parliament-chart/utils/parliament-animation.d.ts +13 -0
- package/dist/components/stacked-area-chart/stacked-area-chart.types.d.ts +23 -0
- package/dist/components/stacked-area-chart/utils/color.utils.d.ts +0 -5
- package/dist/components/stacked-area-with-timeline/hooks/use-stacked-area-with-timeline.hook.d.ts +52 -0
- package/dist/components/stacked-area-with-timeline/index.d.ts +4 -0
- package/dist/components/stacked-area-with-timeline/stacked-area-with-timeline.component.d.ts +3 -0
- package/dist/components/stacked-area-with-timeline/stacked-area-with-timeline.types.d.ts +97 -0
- package/dist/components/stacked-area-with-timeline/utils/render-timeline-track.d.ts +54 -0
- package/dist/components/timeline-chart/timeline-chart.types.d.ts +44 -0
- package/dist/index.cjs +109 -71
- package/dist/index.d.ts +9 -0
- package/dist/index.js +24923 -16477
- package/dist/theme/default-colors.d.ts +0 -4
- package/dist/theme/timeline-defaults.d.ts +33 -1
- package/package.json +30 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ParliamentChartTheme } from '../../theme/default-colors';
|
|
2
|
+
import { ArcSweepDirection } from './utils/parliament-animation';
|
|
2
3
|
type ParliamentDataSeries = {
|
|
3
4
|
value: number;
|
|
4
5
|
label: string;
|
|
@@ -12,6 +13,10 @@ export type ParliamentChartProps = {
|
|
|
12
13
|
arcAngle?: number;
|
|
13
14
|
useEnhanced?: boolean;
|
|
14
15
|
theme?: ParliamentChartTheme;
|
|
16
|
+
showTable?: boolean;
|
|
17
|
+
shouldAnimate?: boolean;
|
|
18
|
+
animationDirection?: ArcSweepDirection;
|
|
19
|
+
onAnimationComplete?: () => void;
|
|
15
20
|
};
|
|
16
21
|
export type ProcessedDataItem = {
|
|
17
22
|
id: string | number;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ArcSweepDirection = 'left-to-right' | 'right-to-left';
|
|
2
|
+
/**
|
|
3
|
+
* Animates the parliament chart with an arc sweep reveal effect.
|
|
4
|
+
* Creates a clipPath that progressively reveals or collapses seats.
|
|
5
|
+
*
|
|
6
|
+
* @param svgElement - The SVG element containing the parliament chart
|
|
7
|
+
* @param arcAngle - The arc angle in degrees (e.g., 200)
|
|
8
|
+
* @param radius - The radius of the parliament arc
|
|
9
|
+
* @param direction - Direction of the sweep: 'left-to-right' (expand) or 'right-to-left' (collapse)
|
|
10
|
+
* @param duration - Animation duration in milliseconds (default: 900ms)
|
|
11
|
+
* @param onComplete - Optional callback fired when animation completes
|
|
12
|
+
*/
|
|
13
|
+
export declare function animateArcSweep(svgElement: SVGSVGElement, arcAngle: number, radius: number, direction?: ArcSweepDirection, duration?: number, onComplete?: () => void): void;
|
|
@@ -132,6 +132,29 @@ export type StackedAreaChartProps = {
|
|
|
132
132
|
* - 'silhouette': Centered streamgraph
|
|
133
133
|
*/
|
|
134
134
|
stackOffset?: 'none' | 'expand' | 'wiggle' | 'silhouette';
|
|
135
|
+
/**
|
|
136
|
+
* External time domain control [minTimestamp, maxTimestamp]
|
|
137
|
+
* When provided, overrides automatic domain calculation and controls the X-axis range.
|
|
138
|
+
* Useful for synchronizing multiple charts to show the same time range.
|
|
139
|
+
*/
|
|
140
|
+
timeRange?: [number, number] | null;
|
|
141
|
+
/**
|
|
142
|
+
* Callback when user selects a time range via brush or other interaction
|
|
143
|
+
* Returns [startTimestamp, endTimestamp]
|
|
144
|
+
*/
|
|
145
|
+
onTimeRangeChange?: (range: [number, number]) => void;
|
|
146
|
+
/**
|
|
147
|
+
* Enable brush component for time range selection
|
|
148
|
+
* When enabled, displays a brush control below the chart that users can drag to select a time range.
|
|
149
|
+
* Triggers onTimeRangeChange callback when the brush is moved.
|
|
150
|
+
*/
|
|
151
|
+
enableBrush?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Zoom to selection mode - When enabled, dragging to select a range
|
|
154
|
+
* will automatically rescale the chart to show only that range via the timeRange prop.
|
|
155
|
+
* Selection highlight only shows during drag.
|
|
156
|
+
*/
|
|
157
|
+
zoomToSelection?: boolean;
|
|
135
158
|
};
|
|
136
159
|
/**
|
|
137
160
|
* Props for the custom hook
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maps category index to a color from the measure gradient.
|
|
3
|
-
* Mirrors ParliamentChart logic - first category gets worst color (red), last gets best (green).
|
|
4
|
-
*/
|
|
5
|
-
export declare function getMeasureGradientColor(index: number, totalCategories: number): string;
|
|
6
1
|
/**
|
|
7
2
|
* Generates gradient colors for categories, ordered from worst (red) to best (green).
|
|
8
3
|
*/
|
package/dist/components/stacked-area-with-timeline/hooks/use-stacked-area-with-timeline.hook.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { D3StackedAreaCategory } from '../../d3-stacked-area-chart/d3-stacked-area-chart.types';
|
|
3
|
+
import { HoveredData, HoveredMarker, HoveredTimelineEvent, StackedAreaDataPoint, TimelineEvent } from '../stacked-area-with-timeline.types';
|
|
4
|
+
export type UseStackedAreaWithTimelineOptions = {
|
|
5
|
+
containerRef: RefObject<SVGSVGElement | null>;
|
|
6
|
+
data: StackedAreaDataPoint[];
|
|
7
|
+
categories: D3StackedAreaCategory[];
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
margin: {
|
|
11
|
+
top: number;
|
|
12
|
+
right: number;
|
|
13
|
+
bottom: number;
|
|
14
|
+
left: number;
|
|
15
|
+
};
|
|
16
|
+
timelineEvents?: TimelineEvent[];
|
|
17
|
+
showTimeline?: boolean;
|
|
18
|
+
timelineHeight?: number;
|
|
19
|
+
timelineOffset?: number;
|
|
20
|
+
timeRange?: [number, number];
|
|
21
|
+
showGrid?: boolean;
|
|
22
|
+
showAxes?: boolean;
|
|
23
|
+
axisLabelColor?: string;
|
|
24
|
+
axisLabelSize?: number;
|
|
25
|
+
enableBrush?: boolean;
|
|
26
|
+
onTimeRangeChange?: (range: [number, number]) => void;
|
|
27
|
+
minAllowedTime?: number;
|
|
28
|
+
maxAllowedTime?: number;
|
|
29
|
+
brushColor?: string;
|
|
30
|
+
formatDate?: (timestamp: number) => string;
|
|
31
|
+
formatValue?: (value: number) => string;
|
|
32
|
+
markers?: Array<{
|
|
33
|
+
timestamp: number;
|
|
34
|
+
label?: string;
|
|
35
|
+
color?: string;
|
|
36
|
+
}>;
|
|
37
|
+
onHoveredDataChange?: (data: HoveredData) => void;
|
|
38
|
+
hoveredCategory?: string | null;
|
|
39
|
+
onTimelineEventHover?: (event: HoveredTimelineEvent) => void;
|
|
40
|
+
};
|
|
41
|
+
export type VisibleMarker = {
|
|
42
|
+
timestamp: number;
|
|
43
|
+
label?: string;
|
|
44
|
+
color?: string;
|
|
45
|
+
x: number;
|
|
46
|
+
};
|
|
47
|
+
export type UseStackedAreaWithTimelineResult = {
|
|
48
|
+
hoveredTimelineEvent: HoveredTimelineEvent;
|
|
49
|
+
hoveredMarker: HoveredMarker;
|
|
50
|
+
visibleMarkers: VisibleMarker[];
|
|
51
|
+
};
|
|
52
|
+
export declare const useStackedAreaWithTimeline: ({ containerRef, data, categories, width, height, margin, timelineEvents, showTimeline, timelineHeight, timelineOffset, timeRange, showGrid, showAxes, axisLabelColor, axisLabelSize, enableBrush, onTimeRangeChange, minAllowedTime, maxAllowedTime, brushColor, formatDate, formatValue, markers, onHoveredDataChange, hoveredCategory, onTimelineEventHover }: UseStackedAreaWithTimelineOptions) => UseStackedAreaWithTimelineResult;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { StackedAreaWithTimeline } from './stacked-area-with-timeline.component';
|
|
2
|
+
export type { HoveredData, HoveredTimelineEvent, StackedAreaDataPoint, StackedAreaWithTimelineProps, TimelineEvent } from './stacked-area-with-timeline.types';
|
|
3
|
+
export type { HoveredTimelineEvent as TimelineHoveredEvent, RenderTimelineTrackOptions, TimelineEvent as TimelineEventData } from './utils/render-timeline-track';
|
|
4
|
+
export { renderTimelineTrack } from './utils/render-timeline-track';
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { D3StackedAreaCategory } from '../d3-stacked-area-chart/d3-stacked-area-chart.types';
|
|
2
|
+
export type StackedAreaDataPoint = {
|
|
3
|
+
timestamp: number;
|
|
4
|
+
values: Record<string, number>;
|
|
5
|
+
};
|
|
6
|
+
export type TimelineEvent = {
|
|
7
|
+
timestamp: number;
|
|
8
|
+
eventName: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
};
|
|
11
|
+
export type HoveredData = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: number;
|
|
14
|
+
color: string;
|
|
15
|
+
} | null;
|
|
16
|
+
export type HoveredTimelineEvent = {
|
|
17
|
+
timestamp: number;
|
|
18
|
+
eventName: string;
|
|
19
|
+
x: number;
|
|
20
|
+
} | null;
|
|
21
|
+
export type HoveredMarker = {
|
|
22
|
+
timestamp: number;
|
|
23
|
+
label?: string;
|
|
24
|
+
color?: string;
|
|
25
|
+
x: number;
|
|
26
|
+
} | null;
|
|
27
|
+
export type StackedAreaWithTimelineProps = {
|
|
28
|
+
/** Time series data points */
|
|
29
|
+
data: StackedAreaDataPoint[];
|
|
30
|
+
/** Category definitions (colors, labels, data keys) */
|
|
31
|
+
categories: D3StackedAreaCategory[];
|
|
32
|
+
/** Timeline events to display below the chart */
|
|
33
|
+
timelineEvents?: TimelineEvent[];
|
|
34
|
+
/** Show the timeline track (default: true if timelineEvents provided) */
|
|
35
|
+
showTimeline?: boolean;
|
|
36
|
+
/** Height of the timeline track in pixels (default: 40) */
|
|
37
|
+
timelineHeight?: number;
|
|
38
|
+
/** Vertical space between chart and timeline in pixels (default: 35) */
|
|
39
|
+
timelineOffset?: number;
|
|
40
|
+
/** Chart width in pixels (default: 900) */
|
|
41
|
+
width?: number;
|
|
42
|
+
/** Chart height in pixels, not including timeline (default: 400) */
|
|
43
|
+
height?: number;
|
|
44
|
+
/** Chart margins */
|
|
45
|
+
margin?: {
|
|
46
|
+
top: number;
|
|
47
|
+
right: number;
|
|
48
|
+
bottom: number;
|
|
49
|
+
left: number;
|
|
50
|
+
};
|
|
51
|
+
/** Show grid lines (default: true) */
|
|
52
|
+
showGrid?: boolean;
|
|
53
|
+
/** Show axes (default: true) */
|
|
54
|
+
showAxes?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Color for axis labels (dates on x-axis, values on y-axis).
|
|
57
|
+
* @default undefined (inherits from SVG default, typically black)
|
|
58
|
+
*/
|
|
59
|
+
axisLabelColor?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Font size for axis labels in pixels.
|
|
62
|
+
* Increase for smaller chart displays (e.g., dashboards).
|
|
63
|
+
* @default 14
|
|
64
|
+
*/
|
|
65
|
+
axisLabelSize?: number;
|
|
66
|
+
/** Custom date formatter for x-axis */
|
|
67
|
+
formatDate?: (timestamp: number) => string;
|
|
68
|
+
/** Custom value formatter for y-axis */
|
|
69
|
+
formatValue?: (value: number) => string;
|
|
70
|
+
/** Time range to display [start, end] timestamps */
|
|
71
|
+
timeRange?: [number, number];
|
|
72
|
+
/** Enable brush selection for zooming/panning */
|
|
73
|
+
enableBrush?: boolean;
|
|
74
|
+
/** Callback when time range changes via brush */
|
|
75
|
+
onTimeRangeChange?: (range: [number, number]) => void;
|
|
76
|
+
/** Minimum allowed timestamp for brush constraint */
|
|
77
|
+
minAllowedTime?: number;
|
|
78
|
+
/** Maximum allowed timestamp for brush constraint */
|
|
79
|
+
maxAllowedTime?: number;
|
|
80
|
+
/**
|
|
81
|
+
* Color for brush selection overlay.
|
|
82
|
+
* @default '#69b3a2'
|
|
83
|
+
*/
|
|
84
|
+
brushColor?: string;
|
|
85
|
+
/** Event markers (vertical lines on the main chart) */
|
|
86
|
+
markers?: Array<{
|
|
87
|
+
timestamp: number;
|
|
88
|
+
label?: string;
|
|
89
|
+
color?: string;
|
|
90
|
+
}>;
|
|
91
|
+
/** Callback when a category is hovered */
|
|
92
|
+
onHoveredDataChange?: (data: HoveredData) => void;
|
|
93
|
+
/** Currently hovered category (for external highlighting control) */
|
|
94
|
+
hoveredCategory?: string | null;
|
|
95
|
+
/** Callback when a timeline event is hovered */
|
|
96
|
+
onTimelineEventHover?: (event: HoveredTimelineEvent) => void;
|
|
97
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ScaleTime } from 'd3-scale';
|
|
2
|
+
import { Selection } from 'd3-selection';
|
|
3
|
+
export type TimelineEvent = {
|
|
4
|
+
timestamp: number;
|
|
5
|
+
eventName: string;
|
|
6
|
+
color?: string;
|
|
7
|
+
};
|
|
8
|
+
export type HoveredTimelineEvent = {
|
|
9
|
+
timestamp: number;
|
|
10
|
+
eventName: string;
|
|
11
|
+
x: number;
|
|
12
|
+
} | null;
|
|
13
|
+
export type RenderTimelineTrackOptions = {
|
|
14
|
+
/** D3 SVG selection */
|
|
15
|
+
svg: Selection<SVGSVGElement, unknown, null, undefined>;
|
|
16
|
+
/** Timeline events to display */
|
|
17
|
+
events: TimelineEvent[];
|
|
18
|
+
/** D3 time scale for x-axis */
|
|
19
|
+
xScale: ScaleTime<number, number>;
|
|
20
|
+
/** Height of the main chart area (timeline renders below this) */
|
|
21
|
+
chartHeight: number;
|
|
22
|
+
/** Width of the chart area */
|
|
23
|
+
chartWidth: number;
|
|
24
|
+
/** Height of the timeline track */
|
|
25
|
+
timelineHeight: number;
|
|
26
|
+
/** Vertical offset between chart and timeline */
|
|
27
|
+
timelineOffset: number;
|
|
28
|
+
/** Optional instance ID for unique CSS classes */
|
|
29
|
+
instanceId?: string;
|
|
30
|
+
/** Callback when an event is hovered */
|
|
31
|
+
setHoveredTimelineEvent: (event: HoveredTimelineEvent) => void;
|
|
32
|
+
/** Enable brush selection on timeline */
|
|
33
|
+
enableBrush?: boolean;
|
|
34
|
+
/** Callback when time range changes via brush */
|
|
35
|
+
onTimeRangeChange?: (range: [number, number]) => void;
|
|
36
|
+
/** Minimum allowed timestamp for brush constraint */
|
|
37
|
+
minAllowedTime?: number;
|
|
38
|
+
/** Maximum allowed timestamp for brush constraint */
|
|
39
|
+
maxAllowedTime?: number;
|
|
40
|
+
/** Color for brush selection overlay */
|
|
41
|
+
brushColor?: string;
|
|
42
|
+
/** CSS selector for the main chart group (default: '.main-chart-group') */
|
|
43
|
+
mainGroupSelector?: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Renders an interactive timeline track below a chart
|
|
47
|
+
*
|
|
48
|
+
* Features:
|
|
49
|
+
* - Event markers as vertical colored lines
|
|
50
|
+
* - Hover interactions with width expansion
|
|
51
|
+
* - Optional brush selection with constraint bounds
|
|
52
|
+
* - Double-click to reset to full time range
|
|
53
|
+
*/
|
|
54
|
+
export declare function renderTimelineTrack({ svg, events, xScale, chartHeight, chartWidth, timelineHeight, timelineOffset, instanceId, setHoveredTimelineEvent, enableBrush, onTimeRangeChange, minAllowedTime, maxAllowedTime, brushColor, mainGroupSelector }: RenderTimelineTrackOptions): void;
|
|
@@ -3,12 +3,20 @@ export type TimelineEvent = {
|
|
|
3
3
|
date: Date;
|
|
4
4
|
timestamp: number;
|
|
5
5
|
eventName: string;
|
|
6
|
+
/**
|
|
7
|
+
* Optional color for the event marker.
|
|
8
|
+
* If not provided, defaults to #2F42FF (Digital Blue 500).
|
|
9
|
+
* Accepts any valid CSS color string.
|
|
10
|
+
*/
|
|
11
|
+
color?: string;
|
|
6
12
|
[key: string]: unknown;
|
|
7
13
|
};
|
|
8
14
|
export type TimelineSelection = {
|
|
9
15
|
start: number | null;
|
|
10
16
|
end: number | null;
|
|
11
17
|
};
|
|
18
|
+
export type DragHandleType = 'start' | 'end' | 'body' | null;
|
|
19
|
+
type DragHandleVariant = 'arrow' | 'grip';
|
|
12
20
|
export type TimelineChartSlotProps = {
|
|
13
21
|
/** Props for the header container (Stack) */
|
|
14
22
|
header?: StackProps;
|
|
@@ -26,6 +34,10 @@ export type TimelineChartSlotProps = {
|
|
|
26
34
|
event?: BoxProps;
|
|
27
35
|
/** Props for the selection highlight overlay (Box) */
|
|
28
36
|
selection?: BoxProps;
|
|
37
|
+
/** Props for the start drag handle (Box) */
|
|
38
|
+
startHandle?: BoxProps;
|
|
39
|
+
/** Props for the end drag handle (Box) */
|
|
40
|
+
endHandle?: BoxProps;
|
|
29
41
|
/** Props for the hover tooltip container (Box) */
|
|
30
42
|
tooltip?: BoxProps;
|
|
31
43
|
/** Props for the tooltip event name Typography component */
|
|
@@ -42,6 +54,13 @@ export type TimelineChartProps = {
|
|
|
42
54
|
selectedRange?: TimelineSelection;
|
|
43
55
|
/** Height of the timeline container in pixels (default: 32) */
|
|
44
56
|
height?: number;
|
|
57
|
+
/** Margin around the timeline drawable area (for alignment with other charts) */
|
|
58
|
+
margin?: {
|
|
59
|
+
top: number;
|
|
60
|
+
right: number;
|
|
61
|
+
bottom: number;
|
|
62
|
+
left: number;
|
|
63
|
+
};
|
|
45
64
|
/** Custom date formatter */
|
|
46
65
|
formatDate?: (timestamp: number) => string;
|
|
47
66
|
/** Custom month/year formatter */
|
|
@@ -52,6 +71,10 @@ export type TimelineChartProps = {
|
|
|
52
71
|
monthLabelCount?: number;
|
|
53
72
|
/** Enable zoom with mouse wheel */
|
|
54
73
|
enableZoom?: boolean;
|
|
74
|
+
/** Drag handle style variant (default: 'arrow') */
|
|
75
|
+
dragHandleVariant?: DragHandleVariant;
|
|
76
|
+
/** Color for drag handles (default: '#4B5563' for arrow, '#9CA3AF' for grip) */
|
|
77
|
+
dragHandleColor?: string;
|
|
55
78
|
/** Show header title and instructions (default: true) */
|
|
56
79
|
showHeader?: boolean;
|
|
57
80
|
/** Custom title for the header */
|
|
@@ -66,6 +89,20 @@ export type TimelineChartProps = {
|
|
|
66
89
|
onVisibleRangeChange?: (range: TimelineSelection) => void;
|
|
67
90
|
/** Controlled visible range (for zoom to selection mode) */
|
|
68
91
|
visibleRange?: TimelineSelection;
|
|
92
|
+
/**
|
|
93
|
+
* External time domain control [minTimestamp, maxTimestamp]
|
|
94
|
+
* Simplified alias for visibleRange that uses tuple format instead of object format.
|
|
95
|
+
* When provided, overrides automatic domain calculation and controls the visible time range.
|
|
96
|
+
* Useful for synchronizing multiple charts to show the same time range.
|
|
97
|
+
* Note: This is converted internally to visibleRange format { start, end }
|
|
98
|
+
*/
|
|
99
|
+
timeRange?: [number, number] | null;
|
|
100
|
+
/**
|
|
101
|
+
* Callback when the visible time range changes
|
|
102
|
+
* Simplified alias for onVisibleRangeChange that uses tuple format [start, end].
|
|
103
|
+
* Note: This is converted internally to/from TimelineSelection format { start, end }
|
|
104
|
+
*/
|
|
105
|
+
onTimeRangeChange?: (range: [number, number]) => void;
|
|
69
106
|
/** Props for individual component slots */
|
|
70
107
|
slotProps?: TimelineChartSlotProps;
|
|
71
108
|
};
|
|
@@ -81,12 +118,14 @@ export type UseTimelineChartProps = {
|
|
|
81
118
|
export type UseTimelineChartReturn = {
|
|
82
119
|
isDragging: boolean;
|
|
83
120
|
dragStart: number | null;
|
|
121
|
+
dragHandleType: DragHandleType;
|
|
84
122
|
internalSelectedRange: TimelineSelection;
|
|
85
123
|
internalVisibleRange: TimelineSelection;
|
|
86
124
|
hoveredEvent: TimelineEvent | null;
|
|
87
125
|
minDate: number;
|
|
88
126
|
maxDate: number;
|
|
89
127
|
timeSpan: number;
|
|
128
|
+
timelineContainerRef: React.RefObject<HTMLDivElement>;
|
|
90
129
|
getPositionFromTimestamp: (timestamp: number) => number;
|
|
91
130
|
getTimestampFromPosition: (x: number, containerWidth: number) => number;
|
|
92
131
|
handleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
@@ -94,9 +133,13 @@ export type UseTimelineChartReturn = {
|
|
|
94
133
|
handleMouseUp: () => void;
|
|
95
134
|
handleWheel: (e: React.WheelEvent<HTMLDivElement>) => void;
|
|
96
135
|
handleDoubleClick: () => void;
|
|
136
|
+
handleStartHandleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
137
|
+
handleEndHandleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
138
|
+
handleSelectionBodyMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
97
139
|
setHoveredEvent: (event: TimelineEvent | null) => void;
|
|
98
140
|
getEventsInRange: () => TimelineEvent[];
|
|
99
141
|
resetZoom: () => void;
|
|
142
|
+
showHandles: boolean;
|
|
100
143
|
};
|
|
101
144
|
export type TimelineSelectedEventsProps = {
|
|
102
145
|
/** Array of selected events to display */
|
|
@@ -110,3 +153,4 @@ export type TimelineSelectedEventsProps = {
|
|
|
110
153
|
/** Primary color for event items */
|
|
111
154
|
primaryColor?: string;
|
|
112
155
|
};
|
|
156
|
+
export {};
|