@moderneinc/react-charts 1.1.0-next.dcefa6 → 1.2.0-next.27c469

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 (48) hide show
  1. package/dist/components/chrono-chart/chrono-chart.component.d.ts +10 -0
  2. package/dist/components/chrono-chart/chrono-chart.types.d.ts +112 -0
  3. package/dist/components/chrono-chart/components/category-table.component.d.ts +13 -0
  4. package/dist/components/chrono-chart/components/category-table.types.d.ts +42 -0
  5. package/dist/components/chrono-chart/utils/data-transformer.d.ts +41 -0
  6. package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.component.d.ts +7 -0
  7. package/dist/components/d3-stacked-area-chart/d3-stacked-area-chart.types.d.ts +89 -0
  8. package/dist/components/d3-stacked-area-chart/hooks/use-d3-stacked-area.hook.d.ts +34 -0
  9. package/dist/components/morph-chart/hooks/shared/computations.d.ts +29 -0
  10. package/dist/components/morph-chart/hooks/shared/types.d.ts +24 -0
  11. package/dist/components/morph-chart/hooks/use-morph-chart.hook.d.ts +87 -0
  12. package/dist/components/morph-chart/index.d.ts +2 -0
  13. package/dist/components/morph-chart/morph-chart.component.d.ts +14 -0
  14. package/dist/components/morph-chart/morph-chart.types.d.ts +158 -0
  15. package/dist/components/morph-chart/utils/accordion-generator.d.ts +102 -0
  16. package/dist/components/morph-chart/utils/animation-constants.d.ts +23 -0
  17. package/dist/components/morph-chart/utils/animation-utils.d.ts +44 -0
  18. package/dist/components/morph-chart/utils/arc-path-calculator.d.ts +53 -0
  19. package/dist/components/morph-chart/utils/area-renderer.d.ts +24 -0
  20. package/dist/components/morph-chart/utils/bar-renderer.d.ts +19 -0
  21. package/dist/components/morph-chart/utils/gsap-orchestrator.d.ts +291 -0
  22. package/dist/components/morph-chart/utils/morph-interpolator.d.ts +96 -0
  23. package/dist/components/morph-chart/utils/parliament-renderer.d.ts +23 -0
  24. package/dist/components/morph-chart/utils/parliament-seat-extractor.d.ts +33 -0
  25. package/dist/components/morph-chart/utils/position-mapper.d.ts +48 -0
  26. package/dist/components/morph-chart/utils/segment-transformer.d.ts +70 -0
  27. package/dist/components/morph-chart/utils/slinky-3d-generator.d.ts +35 -0
  28. package/dist/components/morph-chart/utils/svg-patterns.d.ts +19 -0
  29. package/dist/components/morph-chart/utils/svg-slinky-generator.d.ts +25 -0
  30. package/dist/components/parliament-chart/hooks/{use-parliament-chart.d.ts → use-parliament-chart.hook.d.ts} +5 -1
  31. package/dist/components/parliament-chart/parliament-chart.types.d.ts +5 -0
  32. package/dist/components/parliament-chart/utils/parliament-animation.d.ts +13 -0
  33. package/dist/components/stacked-area-chart/hooks/use-stacked-area-chart.hook.d.ts +6 -0
  34. package/dist/components/stacked-area-chart/stacked-area-chart.component.d.ts +10 -0
  35. package/dist/components/stacked-area-chart/stacked-area-chart.constants.d.ts +115 -0
  36. package/dist/components/stacked-area-chart/stacked-area-chart.types.d.ts +186 -0
  37. package/dist/components/stacked-area-chart/utils/color.utils.d.ts +4 -0
  38. package/dist/components/timeline-chart/hooks/use-timeline-chart.hook.d.ts +2 -0
  39. package/dist/components/timeline-chart/timeline-chart.component.d.ts +9 -0
  40. package/dist/components/timeline-chart/timeline-chart.types.d.ts +156 -0
  41. package/dist/components/timeline-chart/timeline-selected-events.component.d.ts +9 -0
  42. package/dist/index.cjs +144 -11
  43. package/dist/index.d.ts +19 -6
  44. package/dist/index.js +31142 -4853
  45. package/dist/theme/default-colors.d.ts +8 -4
  46. package/dist/theme/timeline-defaults.d.ts +82 -0
  47. package/package.json +34 -11
  48. /package/dist/components/parliament-chart/{parliament-chart.d.ts → parliament-chart.component.d.ts} +0 -0
@@ -0,0 +1,156 @@
1
+ import { BoxProps, StackProps, TypographyProps } from '@mui/material';
2
+ export type TimelineEvent = {
3
+ date: Date;
4
+ timestamp: number;
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;
12
+ [key: string]: unknown;
13
+ };
14
+ export type TimelineSelection = {
15
+ start: number | null;
16
+ end: number | null;
17
+ };
18
+ export type DragHandleType = 'start' | 'end' | 'body' | null;
19
+ type DragHandleVariant = 'arrow' | 'grip';
20
+ export type TimelineChartSlotProps = {
21
+ /** Props for the header container (Stack) */
22
+ header?: StackProps;
23
+ /** Props for the title Typography component */
24
+ title?: TypographyProps;
25
+ /** Props for the instructions Typography component */
26
+ instructions?: TypographyProps;
27
+ /** Props for the month labels container (Stack) */
28
+ monthLabelsContainer?: StackProps;
29
+ /** Props for individual month label Typography components */
30
+ monthLabel?: TypographyProps;
31
+ /** Props for the timeline container (Box) */
32
+ timeline?: BoxProps;
33
+ /** Props for individual event markers (Box) */
34
+ event?: BoxProps;
35
+ /** Props for the selection highlight overlay (Box) */
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;
41
+ /** Props for the hover tooltip container (Box) */
42
+ tooltip?: BoxProps;
43
+ /** Props for the tooltip event name Typography component */
44
+ tooltipEventName?: TypographyProps;
45
+ /** Props for the tooltip date Typography component */
46
+ tooltipDate?: TypographyProps;
47
+ };
48
+ export type TimelineChartProps = {
49
+ /** Array of events to display on the timeline (must be sorted by timestamp) */
50
+ events: TimelineEvent[];
51
+ /** Callback when selection changes */
52
+ onSelectionChange?: (selection: TimelineSelection) => void;
53
+ /** Controlled selection state (optional) */
54
+ selectedRange?: TimelineSelection;
55
+ /** Height of the timeline container in pixels (default: 32) */
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
+ };
64
+ /** Custom date formatter */
65
+ formatDate?: (timestamp: number) => string;
66
+ /** Custom month/year formatter */
67
+ formatMonthYear?: (timestamp: number) => string;
68
+ /** Show month labels at top */
69
+ showMonthLabels?: boolean;
70
+ /** Number of month labels to display (default: 6) */
71
+ monthLabelCount?: number;
72
+ /** Enable zoom with mouse wheel */
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;
78
+ /** Show header title and instructions (default: true) */
79
+ showHeader?: boolean;
80
+ /** Custom title for the header */
81
+ title?: string;
82
+ /**
83
+ * Zoom to selection mode - When enabled, dragging to select a range
84
+ * will automatically rescale the timeline to show only that range.
85
+ * Selection highlight only shows during drag.
86
+ */
87
+ zoomToSelection?: boolean;
88
+ /** Callback when the visible range changes (for zoom to selection mode) */
89
+ onVisibleRangeChange?: (range: TimelineSelection) => void;
90
+ /** Controlled visible range (for zoom to selection mode) */
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;
106
+ /** Props for individual component slots */
107
+ slotProps?: TimelineChartSlotProps;
108
+ };
109
+ export type UseTimelineChartProps = {
110
+ events: TimelineEvent[];
111
+ selectedRange?: TimelineSelection;
112
+ onSelectionChange?: (selection: TimelineSelection) => void;
113
+ enableZoom: boolean;
114
+ zoomToSelection: boolean;
115
+ visibleRange?: TimelineSelection;
116
+ onVisibleRangeChange?: (range: TimelineSelection) => void;
117
+ };
118
+ export type UseTimelineChartReturn = {
119
+ isDragging: boolean;
120
+ dragStart: number | null;
121
+ dragHandleType: DragHandleType;
122
+ internalSelectedRange: TimelineSelection;
123
+ internalVisibleRange: TimelineSelection;
124
+ hoveredEvent: TimelineEvent | null;
125
+ minDate: number;
126
+ maxDate: number;
127
+ timeSpan: number;
128
+ timelineContainerRef: React.RefObject<HTMLDivElement>;
129
+ getPositionFromTimestamp: (timestamp: number) => number;
130
+ getTimestampFromPosition: (x: number, containerWidth: number) => number;
131
+ handleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
132
+ handleMouseMove: (e: React.MouseEvent<HTMLDivElement>) => void;
133
+ handleMouseUp: () => void;
134
+ handleWheel: (e: React.WheelEvent<HTMLDivElement>) => void;
135
+ handleDoubleClick: () => void;
136
+ handleStartHandleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
137
+ handleEndHandleMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
138
+ handleSelectionBodyMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void;
139
+ setHoveredEvent: (event: TimelineEvent | null) => void;
140
+ getEventsInRange: () => TimelineEvent[];
141
+ resetZoom: () => void;
142
+ showHandles: boolean;
143
+ };
144
+ export type TimelineSelectedEventsProps = {
145
+ /** Array of selected events to display */
146
+ events: TimelineEvent[];
147
+ /** Title for the selected events section */
148
+ title?: string;
149
+ /** Maximum height before scrolling */
150
+ maxHeight?: string;
151
+ /** Custom date formatter */
152
+ formatDate?: (timestamp: number) => string;
153
+ /** Primary color for event items */
154
+ primaryColor?: string;
155
+ };
156
+ export {};
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { TimelineSelectedEventsProps } from './timeline-chart.types';
3
+ /**
4
+ * TimelineSelectedEvents component - Displays selected events from timeline
5
+ *
6
+ * This component observes and displays events that have been selected in a timeline.
7
+ * It can be used independently alongside the TimelineChart component.
8
+ */
9
+ export declare const TimelineSelectedEvents: FunctionComponent<TimelineSelectedEventsProps>;