@moderneinc/react-charts 1.2.0-next.ceab4e → 1.2.0-next.d2aaa2

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.
@@ -4,6 +4,8 @@ export type ChronoCategory = {
4
4
  id: string;
5
5
  label: string;
6
6
  color: string;
7
+ /** Optional dash pattern for the stroke (e.g., '5 5' for dashed lines with no fill) */
8
+ strokeDasharray?: string;
7
9
  parliamentMapping?: {
8
10
  isSpecialCategory: boolean;
9
11
  hatchPattern?: string;
@@ -16,7 +18,7 @@ export type ChronoData = {
16
18
  }>;
17
19
  categories: ChronoCategory[];
18
20
  metadata: {
19
- totalRepositories: number;
21
+ total: number;
20
22
  specialCounts?: {
21
23
  notApplicable: number;
22
24
  noLst: number;
@@ -50,6 +52,13 @@ export type ChronoChartProps = {
50
52
  showGrid?: boolean;
51
53
  enableAnimation?: boolean;
52
54
  animationDuration?: number;
55
+ /**
56
+ * Disable the timeline in historical mode.
57
+ * By default, the timeline is always shown in historical mode, even when there are no events.
58
+ * Set this to true to hide the timeline.
59
+ * @default false
60
+ */
61
+ disableTimeline?: boolean;
53
62
  formatDate?: (timestamp: number) => string;
54
63
  formatValue?: (value: number) => string;
55
64
  onAnimationStateChange?: (isAnimating: boolean) => void;
@@ -68,6 +68,7 @@ export type D3StackedAreaChartProps = {
68
68
  timestamp: number;
69
69
  label?: string;
70
70
  color?: string;
71
+ strokeDasharray?: string;
71
72
  }>;
72
73
  /** Marker visibility mode: 'hover' shows only nearest marker on hover, 'always' shows all markers */
73
74
  markerVisibilityMode?: 'always' | 'hover';
@@ -25,8 +25,10 @@ type UseD3StackedAreaProps = {
25
25
  timestamp: number;
26
26
  label?: string;
27
27
  color?: string;
28
+ strokeDasharray?: string;
28
29
  }>;
29
30
  markerVisibilityMode?: 'always' | 'hover';
31
+ onMarkerHoverChange?: (isHovering: boolean) => void;
30
32
  };
31
- export declare const useD3StackedArea: ({ containerRef, data, categories, width, height, margin, timeRange, showGrid, showXAxis, showYAxis, enableBrush, zoomToSelection, onTimeRangeChange, formatDate, formatValue, markers, markerVisibilityMode }: UseD3StackedAreaProps) => void;
33
+ export declare const useD3StackedArea: ({ containerRef, data, categories, width, height, margin, timeRange, showGrid, showXAxis, showYAxis, enableBrush, zoomToSelection, onTimeRangeChange, formatDate, formatValue, markers, markerVisibilityMode, onMarkerHoverChange }: UseD3StackedAreaProps) => void;
32
34
  export {};
@@ -39,11 +39,47 @@ type UseMorphChartProps = {
39
39
  onTimeRangeChange?: (range: [number, number]) => void;
40
40
  showScaleIndicator?: boolean;
41
41
  reposPerSeat?: number;
42
+ timelineEvents?: Array<{
43
+ timestamp: number;
44
+ eventName: string;
45
+ color?: string;
46
+ }>;
47
+ showTimeline?: boolean;
48
+ timelineHeight?: number;
49
+ timelineOffset?: number;
42
50
  };
43
- export declare const useMorphChart: ({ containerRef, data, categories, mode, width, height, margin, timeRange, showGrid, showAxes, formatDate, formatValue, markers: _markers, arcAngle, parliamentRadius, seatSize, animationDuration, onMorphComplete, onAnimationStateChange, onTimelineReady, onAnimationProgress, onHoveredDataChange, hoveredCategory: externalHoveredCategory, maxSeats, parliamentTimestamp, enableBrush, onTimeRangeChange, showScaleIndicator, reposPerSeat }: UseMorphChartProps) => {
51
+ export declare const useMorphChart: ({ containerRef, data, categories, mode, width, height, margin, timeRange, showGrid, showAxes, formatDate, formatValue, markers, arcAngle, parliamentRadius, seatSize, animationDuration, onMorphComplete, onAnimationStateChange, onTimelineReady, onAnimationProgress, onHoveredDataChange, hoveredCategory: externalHoveredCategory, maxSeats, parliamentTimestamp, enableBrush, onTimeRangeChange, showScaleIndicator, reposPerSeat, timelineEvents, showTimeline, timelineHeight, timelineOffset }: UseMorphChartProps) => {
44
52
  isMorphing: boolean;
45
53
  currentMode: MorphMode;
46
54
  hoveredCategory: string | null;
47
55
  scaleIndicatorOpacity: number;
56
+ visibleMarkers: {
57
+ timestamp: number;
58
+ label?: string;
59
+ color?: string;
60
+ x: number;
61
+ }[];
62
+ hoveredMarker: {
63
+ timestamp: number;
64
+ label?: string;
65
+ color?: string;
66
+ x: number;
67
+ } | null;
68
+ setHoveredMarker: import('react').Dispatch<import('react').SetStateAction<{
69
+ timestamp: number;
70
+ label?: string;
71
+ color?: string;
72
+ x: number;
73
+ } | null>>;
74
+ hoveredTimelineEvent: {
75
+ timestamp: number;
76
+ eventName: string;
77
+ x: number;
78
+ } | null;
79
+ setHoveredTimelineEvent: import('react').Dispatch<import('react').SetStateAction<{
80
+ timestamp: number;
81
+ eventName: string;
82
+ x: number;
83
+ } | null>>;
48
84
  };
49
85
  export {};
@@ -94,6 +94,18 @@ export type MorphChartProps = {
94
94
  * If not provided, defaults to the rightmost (most recent) timestamp.
95
95
  */
96
96
  parliamentTimestamp?: number;
97
+ /** Timeline events to display below the x-axis (area mode only) */
98
+ timelineEvents?: Array<{
99
+ timestamp: number;
100
+ eventName: string;
101
+ color?: string;
102
+ }>;
103
+ /** Show timeline track (default: false) */
104
+ showTimeline?: boolean;
105
+ /** Timeline track height in pixels (default: 40) */
106
+ timelineHeight?: number;
107
+ /** Space between x-axis and timeline in pixels (default: 35) */
108
+ timelineOffset?: number;
97
109
  };
98
110
  /**
99
111
  * Seat position in parliament layout
@@ -3,6 +3,12 @@ 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 = {