@moderneinc/react-charts 1.2.0-next.2d0a72 → 1.2.0-next.32e773

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 (28) 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 +114 -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.types.d.ts +21 -1
  7. package/dist/components/d3-stacked-area-chart/hooks/use-d3-stacked-area.hook.d.ts +7 -2
  8. package/dist/components/morph-chart/hooks/shared/computations.d.ts +12 -8
  9. package/dist/components/morph-chart/hooks/shared/types.d.ts +9 -5
  10. package/dist/components/morph-chart/hooks/use-morph-chart.hook.d.ts +42 -1
  11. package/dist/components/morph-chart/morph-chart.types.d.ts +12 -0
  12. package/dist/components/morph-chart/utils/accordion-generator.d.ts +102 -0
  13. package/dist/components/morph-chart/utils/area-renderer.d.ts +1 -0
  14. package/dist/components/morph-chart/utils/bar-renderer.d.ts +0 -9
  15. package/dist/components/morph-chart/utils/gsap-orchestrator.d.ts +55 -16
  16. package/dist/components/morph-chart/utils/parliament-renderer.d.ts +2 -0
  17. package/dist/components/morph-chart/utils/slinky-3d-generator.d.ts +35 -0
  18. package/dist/components/morph-chart/utils/svg-slinky-generator.d.ts +25 -0
  19. package/dist/components/timeline-chart/timeline-chart.types.d.ts +13 -0
  20. package/dist/index.cjs +81 -75
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +17330 -16237
  23. package/package.json +3 -1
  24. package/dist/components/chrono-perspective-chart/chrono-perspective-chart.component.d.ts +0 -3
  25. package/dist/components/chrono-perspective-chart/chrono-perspective-chart.types.d.ts +0 -62
  26. package/dist/components/chrono-perspective-chart/components/category-table.component.d.ts +0 -3
  27. package/dist/components/chrono-perspective-chart/components/category-table.types.d.ts +0 -13
  28. package/dist/components/chrono-perspective-chart/utils/data-transformer.d.ts +0 -9
@@ -1,11 +1,13 @@
1
1
  import { Selection } from 'd3-selection';
2
2
  import { MorphChartCategory } from '../morph-chart.types';
3
3
  interface AnimationDurations {
4
- seatsToBar: number;
4
+ seatsToRings: number;
5
+ ringsToBar: number;
5
6
  axesReveal: number;
6
7
  barSlide: number;
7
8
  barsGrow: number;
8
9
  barsToArea: number;
10
+ ringsHold?: number;
9
11
  }
10
12
  interface AnimationCallbacks {
11
13
  onStageComplete?: (stage: string) => void;
@@ -34,39 +36,76 @@ export declare class GSAPOrchestrator {
34
36
  private durations;
35
37
  constructor(durations: AnimationDurations, callbacks?: AnimationCallbacks);
36
38
  /**
37
- * Stage 1: Animate parliament seats collapsing into bar segments
39
+ * Stage 1a: Animate parliament seats transforming into slinky rings
38
40
  *
39
- * Transforms the circular parliament layout into a stacked vertical bar.
40
- * Each seat morphs from its position in the parliament arc into a rectangular
41
- * segment of a bar, maintaining visual continuity through smooth transitions.
41
+ * Transforms the circular parliament layout into a slinky (spring coil) formation.
42
+ * This creates a whimsical intermediate state between the circular parliament
43
+ * and the stacked bar, making the transition more visually engaging.
42
44
  *
43
- * @param seats - D3 selection of parliament seat rectangles to animate
44
- * @param targetPositions - Array of target positions for each seat, where each position defines the final rectangle geometry (x, y, width, height)
45
+ * @param seats - D3 selection of parliament seat elements to animate
46
+ * @param baselineY - Y-coordinate of the chart baseline (reference for positioning)
45
47
  * @returns this - Returns the orchestrator instance for method chaining
46
48
  *
47
49
  * @remarks
48
50
  * **Visual transformation:**
49
- * - Parliament seats (circular arc) → Vertical bar segments (stacked rectangles)
50
- * - All seats animate simultaneously (no stagger)
51
- * - Uses power2.inOut easing for smooth acceleration/deceleration
51
+ * - Parliament seats (circular arc) → Slinky rings (elliptical coils)
52
+ * - Seats morph and fade into overlapping rings
53
+ * - Rings positioned along the parliament arc initially
54
+ * - Uses perspective effects for 3D slinky appearance
52
55
  *
53
56
  * **Data preservation:**
54
57
  * - Original seat positions stored in data-orig-* attributes for potential reversal
55
- * - Target positions must match seat count (indexed by array position)
58
+ * - Current dimensions preserved before transformation
56
59
  *
57
60
  * **Timeline integration:**
58
- * - Added at 'seatsToBar' label
59
- * - Duration: 30% of total animation (STAGE_DURATION_RATIOS.SEATS_TO_BAR)
61
+ * - Added at 'seatsToRings' label (first stage)
62
+ * - Duration: Set by durations.seatsToRings
60
63
  * - Triggers onStageComplete callback when starting
61
64
  *
62
65
  * @example
63
66
  * ```ts
64
67
  * const seats = svg.selectAll('.parliament-seat');
65
- * const targets = calculateBarPositions(seats);
66
- * orchestrator.animateSeatsToBar(seats, targets);
68
+ * const baselineY = height - margin.bottom;
69
+ * orchestrator.animateSeatsToRings(seats, baselineY);
70
+ * ```
71
+ */
72
+ animateSeatsToRings(seats: Selection<SVGRectElement, unknown, null, undefined>, baselineY: number): GSAPOrchestrator;
73
+ /**
74
+ * Stage 1b: Animate slinky rings collapsing into stacked bar
75
+ *
76
+ * Transforms the slinky rings created in Stage 1a into a stacked
77
+ * vertical bar. Rings compress and stack vertically to form rectangular
78
+ * segments of the final bar, maintaining visual continuity.
79
+ *
80
+ * @param seats - D3 selection of ring elements (formerly seats) to animate
81
+ * @param targetPositions - Array of target positions for each segment, where each position defines the final rectangle geometry (x, y, width, height)
82
+ * @returns this - Returns the orchestrator instance for method chaining
83
+ *
84
+ * @remarks
85
+ * **Visual transformation:**
86
+ * - Slinky rings → Stacked bar segments (rectangles)
87
+ * - Rings compress and flatten into bar segments
88
+ * - Reposition to stack vertically in correct order
89
+ * - All segments animate simultaneously (no stagger)
90
+ * - Uses power2.inOut easing for smooth acceleration/deceleration
91
+ *
92
+ * **Data requirements:**
93
+ * - Target positions must match ring count (indexed by array position)
94
+ * - Each position defines final x, y, width, height for the bar segment
95
+ *
96
+ * **Timeline integration:**
97
+ * - Added at 'ringsToBar' label (after seatsToRings)
98
+ * - Duration: Set by durations.ringsToBar
99
+ * - Triggers onStageComplete callback when starting
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const rings = svg.selectAll('.slinky-ring');
104
+ * const targets = calculateBarPositions(rings);
105
+ * orchestrator.animateRingsToBar(rings, targets);
67
106
  * ```
68
107
  */
69
- animateSeatsToBar(seats: Selection<SVGRectElement, unknown, null, undefined>, targetPositions: Array<{
108
+ animateRingsToBar(seats: Selection<SVGRectElement, unknown, null, undefined>, targetPositions: Array<{
70
109
  x: number;
71
110
  y: number;
72
111
  width: number;
@@ -9,6 +9,8 @@ interface ParliamentRenderOptions {
9
9
  centerX: number;
10
10
  centerY: number;
11
11
  addClasses?: boolean;
12
+ instanceId?: string;
13
+ parliamentRadius?: number;
12
14
  }
13
15
  /**
14
16
  * Render parliament seats into an SVG container
@@ -0,0 +1,35 @@
1
+ import { Selection } from 'd3-selection';
2
+ export interface Slinky3DConfig {
3
+ categories: Array<{
4
+ name: string;
5
+ color: string;
6
+ seatCount: number;
7
+ }>;
8
+ centerX: number;
9
+ centerY: number;
10
+ radius: number;
11
+ arcAngle: number;
12
+ }
13
+ /**
14
+ * Generate HTML content for 3D slinky rings
15
+ */
16
+ export declare function generate3DSlinkyHTML(categories: Array<{
17
+ name: string;
18
+ color: string;
19
+ seatCount: number;
20
+ }>): string;
21
+ /**
22
+ * Generate CSS styles for 3D slinky effect
23
+ */
24
+ export declare function generate3DSlinkyStyles(instanceId: string): string;
25
+ /**
26
+ * Create 3D slinky elements in SVG using foreignObject
27
+ */
28
+ export declare function create3DSlinky(container: Selection<SVGGElement, unknown, null, undefined>, config: Slinky3DConfig, instanceId: string): {
29
+ wrapper: Selection<SVGForeignObjectElement, unknown, null, undefined>;
30
+ cleanup: () => void;
31
+ };
32
+ /**
33
+ * Animate 3D slinky compression using GSAP
34
+ */
35
+ export declare function animate3DSlinkyCompression(instanceId: string, timeline: gsap.core.Timeline, startTime: string, duration: number, targetX: number, targetY: number): void;
@@ -0,0 +1,25 @@
1
+ import { Selection } from 'd3-selection';
2
+ export interface SvgSlinkyConfig {
3
+ categories: Array<{
4
+ name: string;
5
+ color: string;
6
+ seatCount: number;
7
+ }>;
8
+ centerX: number;
9
+ centerY: number;
10
+ radius: number;
11
+ innerRadius: number;
12
+ arcAngle: number;
13
+ }
14
+ /**
15
+ * Create SVG slinky coils
16
+ */
17
+ export declare function createSvgSlinky(container: Selection<SVGGElement, unknown, null, undefined>, config: SvgSlinkyConfig, instanceId: string): {
18
+ slinkyGroup: Selection<SVGGElement, unknown, null, undefined>;
19
+ cleanup: () => void;
20
+ };
21
+ /**
22
+ * Animate SVG slinky closing - stacks rings vertically into a bar on the right
23
+ * Uses staggered animation phases to create realistic slinky walking effect
24
+ */
25
+ export declare function animateSvgSlinkyCompression(slinkyGroup: Selection<SVGGElement, unknown, null, undefined>, timeline: gsap.core.Timeline, startTime: string, duration: number, targetX: number, targetY: number): void;
@@ -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 = {
@@ -42,6 +48,13 @@ export type TimelineChartProps = {
42
48
  selectedRange?: TimelineSelection;
43
49
  /** Height of the timeline container in pixels (default: 32) */
44
50
  height?: number;
51
+ /** Margin around the timeline drawable area (for alignment with other charts) */
52
+ margin?: {
53
+ top: number;
54
+ right: number;
55
+ bottom: number;
56
+ left: number;
57
+ };
45
58
  /** Custom date formatter */
46
59
  formatDate?: (timestamp: number) => string;
47
60
  /** Custom month/year formatter */