@moderneinc/react-charts 1.2.0-next.e5d8ee → 1.2.0-next.e86ce0

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.
Files changed (32) hide show
  1. package/dist/components/chrono-chart/chrono-chart.component.d.ts +7 -0
  2. package/dist/components/chrono-chart/chrono-chart.types.d.ts +64 -2
  3. package/dist/components/chrono-chart/components/category-table.component.d.ts +10 -0
  4. package/dist/components/chrono-chart/components/category-table.types.d.ts +25 -0
  5. package/dist/components/chrono-chart/utils/data-transformer.d.ts +32 -0
  6. package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.types.d.ts +6 -0
  7. package/dist/components/d3-stacked-area-chart/hooks/use-d3-stacked-area.hook.d.ts +2 -1
  8. package/dist/components/morph-chart/hooks/shared/computations.d.ts +12 -10
  9. package/dist/components/morph-chart/hooks/shared/types.d.ts +7 -5
  10. package/dist/components/morph-chart/hooks/use-morph-chart.hook.d.ts +6 -1
  11. package/dist/components/morph-chart/morph-chart.types.d.ts +21 -0
  12. package/dist/components/morph-chart/utils/gsap-orchestrator.d.ts +55 -16
  13. package/dist/components/stacked-area-with-timeline/hooks/use-stacked-area-with-timeline.hook.d.ts +53 -0
  14. package/dist/components/stacked-area-with-timeline/stacked-area-with-timeline.component.d.ts +3 -0
  15. package/dist/components/stacked-area-with-timeline/stacked-area-with-timeline.types.d.ts +97 -0
  16. package/dist/components/stacked-area-with-timeline/utils/render-timeline-track.d.ts +46 -0
  17. package/dist/components/timeline-chart/timeline-chart.types.d.ts +17 -0
  18. package/dist/index.cjs +27 -122
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +9586 -24416
  21. package/dist/{components/stacked-area-chart/stacked-area-chart.constants.d.ts → theme/chart-palettes.d.ts} +4 -60
  22. package/dist/theme/timeline-defaults.d.ts +25 -1
  23. package/package.json +7 -14
  24. package/dist/components/morph-chart/index.d.ts +0 -2
  25. package/dist/components/morph-chart/utils/animation-utils.d.ts +0 -44
  26. package/dist/components/morph-chart/utils/arc-path-calculator.d.ts +0 -53
  27. package/dist/components/morph-chart/utils/morph-interpolator.d.ts +0 -96
  28. package/dist/components/morph-chart/utils/segment-transformer.d.ts +0 -70
  29. package/dist/components/stacked-area-chart/hooks/use-stacked-area-chart.hook.d.ts +0 -6
  30. package/dist/components/stacked-area-chart/stacked-area-chart.component.d.ts +0 -10
  31. package/dist/components/stacked-area-chart/stacked-area-chart.types.d.ts +0 -186
  32. package/dist/components/stacked-area-chart/utils/color.utils.d.ts +0 -4
@@ -0,0 +1,46 @@
1
+ import { ScaleTime } from 'd3-scale';
2
+ import { Selection } from 'd3-selection';
3
+ import { HoveredTimelineEvent, TimelineEvent } from '../stacked-area-with-timeline.types';
4
+ type RenderTimelineTrackOptions = {
5
+ /** D3 SVG selection */
6
+ svg: Selection<SVGSVGElement, unknown, null, undefined>;
7
+ /** Timeline events to display */
8
+ events: TimelineEvent[];
9
+ /** D3 time scale for x-axis */
10
+ xScale: ScaleTime<number, number>;
11
+ /** Height of the main chart area (timeline renders below this) */
12
+ chartHeight: number;
13
+ /** Width of the chart area */
14
+ chartWidth: number;
15
+ /** Height of the timeline track */
16
+ timelineHeight: number;
17
+ /** Vertical offset between chart and timeline */
18
+ timelineOffset: number;
19
+ /** Optional instance ID for unique CSS classes */
20
+ instanceId?: string;
21
+ /** Callback when an event is hovered */
22
+ setHoveredTimelineEvent: (event: HoveredTimelineEvent) => void;
23
+ /** Enable brush selection on timeline */
24
+ enableBrush?: boolean;
25
+ /** Callback when time range changes via brush */
26
+ onTimeRangeChange?: (range: [number, number]) => void;
27
+ /** Minimum allowed timestamp for brush constraint */
28
+ minAllowedTime?: number;
29
+ /** Maximum allowed timestamp for brush constraint */
30
+ maxAllowedTime?: number;
31
+ /** Color for brush selection overlay */
32
+ brushColor?: string;
33
+ /** CSS selector for the main chart group (default: '.main-chart-group') */
34
+ mainGroupSelector?: string;
35
+ };
36
+ /**
37
+ * Renders an interactive timeline track below a chart
38
+ *
39
+ * Features:
40
+ * - Event markers as vertical colored lines
41
+ * - Hover interactions with width expansion
42
+ * - Optional brush selection with constraint bounds
43
+ * - Double-click to reset to full time range
44
+ */
45
+ export declare function renderTimelineTrack({ svg, events, xScale, chartHeight, chartWidth, timelineHeight, timelineOffset, instanceId, setHoveredTimelineEvent, enableBrush, onTimeRangeChange, minAllowedTime, maxAllowedTime, brushColor, mainGroupSelector }: RenderTimelineTrackOptions): void;
46
+ export {};
@@ -15,6 +15,8 @@ export type TimelineSelection = {
15
15
  start: number | null;
16
16
  end: number | null;
17
17
  };
18
+ export type DragHandleType = 'start' | 'end' | 'body' | null;
19
+ type DragHandleVariant = 'arrow' | 'grip';
18
20
  export type TimelineChartSlotProps = {
19
21
  /** Props for the header container (Stack) */
20
22
  header?: StackProps;
@@ -32,6 +34,10 @@ export type TimelineChartSlotProps = {
32
34
  event?: BoxProps;
33
35
  /** Props for the selection highlight overlay (Box) */
34
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;
35
41
  /** Props for the hover tooltip container (Box) */
36
42
  tooltip?: BoxProps;
37
43
  /** Props for the tooltip event name Typography component */
@@ -65,6 +71,10 @@ export type TimelineChartProps = {
65
71
  monthLabelCount?: number;
66
72
  /** Enable zoom with mouse wheel */
67
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;
68
78
  /** Show header title and instructions (default: true) */
69
79
  showHeader?: boolean;
70
80
  /** Custom title for the header */
@@ -108,12 +118,14 @@ export type UseTimelineChartProps = {
108
118
  export type UseTimelineChartReturn = {
109
119
  isDragging: boolean;
110
120
  dragStart: number | null;
121
+ dragHandleType: DragHandleType;
111
122
  internalSelectedRange: TimelineSelection;
112
123
  internalVisibleRange: TimelineSelection;
113
124
  hoveredEvent: TimelineEvent | null;
114
125
  minDate: number;
115
126
  maxDate: number;
116
127
  timeSpan: number;
128
+ timelineContainerRef: React.RefObject<HTMLDivElement>;
117
129
  getPositionFromTimestamp: (timestamp: number) => number;
118
130
  getTimestampFromPosition: (x: number, containerWidth: number) => number;
119
131
  handleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
@@ -121,9 +133,13 @@ export type UseTimelineChartReturn = {
121
133
  handleMouseUp: () => void;
122
134
  handleWheel: (e: React.WheelEvent<HTMLDivElement>) => void;
123
135
  handleDoubleClick: () => void;
136
+ handleStartHandleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
137
+ handleEndHandleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
138
+ handleSelectionBodyMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
124
139
  setHoveredEvent: (event: TimelineEvent | null) => void;
125
140
  getEventsInRange: () => TimelineEvent[];
126
141
  resetZoom: () => void;
142
+ showHandles: boolean;
127
143
  };
128
144
  export type TimelineSelectedEventsProps = {
129
145
  /** Array of selected events to display */
@@ -137,3 +153,4 @@ export type TimelineSelectedEventsProps = {
137
153
  /** Primary color for event items */
138
154
  primaryColor?: string;
139
155
  };
156
+ export {};