@moderneinc/react-charts 1.3.0-next.d7d66e → 1.4.0-next.9cb5c1
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/d3-stacked-area-chart/d3-stacked-area-chart.types.d.ts +13 -0
- package/dist/components/d3-stacked-bar-chart/d3-stacked-bar-chart.types.d.ts +13 -0
- package/dist/components/shared/chart-tooltip.component.d.ts +15 -0
- package/dist/components/shared/chart-tooltip.types.d.ts +47 -0
- package/dist/index.cjs +9 -9
- package/dist/index.js +3884 -3793
- package/package.json +1 -1
|
@@ -112,4 +112,17 @@ export type D3StackedAreaChartProps = {
|
|
|
112
112
|
};
|
|
113
113
|
/** Morph progress (0 = area, 1 = parliament) */
|
|
114
114
|
morphProgress?: number;
|
|
115
|
+
/**
|
|
116
|
+
* Scale factor for tooltip size. Use values like 0.8 for 80% size, 1.2 for 120% size.
|
|
117
|
+
* Affects font sizes, padding, spacing, and color bar width proportionally.
|
|
118
|
+
* @default 1
|
|
119
|
+
*/
|
|
120
|
+
tooltipScale?: number;
|
|
121
|
+
/**
|
|
122
|
+
* Render tooltip in a portal to escape container overflow constraints.
|
|
123
|
+
* When true, tooltip renders in document.body and positions relative to viewport.
|
|
124
|
+
* Use this when the chart is placed inside a container with overflow:hidden.
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
usePortalTooltip?: boolean;
|
|
115
128
|
};
|
|
@@ -80,6 +80,19 @@ export type D3StackedBarChartProps = {
|
|
|
80
80
|
* Set to 0 to disable minimum width entirely.
|
|
81
81
|
*/
|
|
82
82
|
minBarWidth?: number;
|
|
83
|
+
/**
|
|
84
|
+
* Scale factor for tooltip size. Use values like 0.8 for 80% size, 1.2 for 120% size.
|
|
85
|
+
* Affects font sizes, padding, spacing, and color bar width proportionally.
|
|
86
|
+
* @default 1
|
|
87
|
+
*/
|
|
88
|
+
tooltipScale?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Render tooltip in a portal to escape container overflow constraints.
|
|
91
|
+
* When true, tooltip renders in document.body and positions relative to viewport.
|
|
92
|
+
* Use this when the chart is placed inside a container with overflow:hidden.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
usePortalTooltip?: boolean;
|
|
83
96
|
};
|
|
84
97
|
export type TooltipData = {
|
|
85
98
|
visible: boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { ChartTooltipProps } from './chart-tooltip.types';
|
|
3
|
+
/**
|
|
4
|
+
* Chart tooltip component that supports both inline and portal rendering modes.
|
|
5
|
+
*
|
|
6
|
+
* Coordinates are provided in SVG viewBox space and transformed to pixel coordinates
|
|
7
|
+
* based on the actual rendered size of the container.
|
|
8
|
+
*
|
|
9
|
+
* When `usePortal` is false (default), the tooltip renders with `position: absolute`
|
|
10
|
+
* relative to the chart container - this can be clipped by parent overflow settings.
|
|
11
|
+
*
|
|
12
|
+
* When `usePortal` is true, the tooltip renders in a React Portal (document.body)
|
|
13
|
+
* with `position: fixed`, escaping any container overflow constraints.
|
|
14
|
+
*/
|
|
15
|
+
export declare const ChartTooltip: FunctionComponent<ChartTooltipProps>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type ChartTooltipProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the tooltip is visible
|
|
5
|
+
*/
|
|
6
|
+
visible: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* X position in SVG viewBox coordinates
|
|
9
|
+
*/
|
|
10
|
+
x: number;
|
|
11
|
+
/**
|
|
12
|
+
* Y position in SVG viewBox coordinates
|
|
13
|
+
*/
|
|
14
|
+
y: number;
|
|
15
|
+
/**
|
|
16
|
+
* Reference to the chart container element for dimension calculations
|
|
17
|
+
*/
|
|
18
|
+
containerRef: RefObject<HTMLElement | null>;
|
|
19
|
+
/**
|
|
20
|
+
* SVG viewBox width - required to transform viewBox coordinates to pixel coordinates
|
|
21
|
+
*/
|
|
22
|
+
viewBoxWidth: number;
|
|
23
|
+
/**
|
|
24
|
+
* SVG viewBox height - required to transform viewBox coordinates to pixel coordinates
|
|
25
|
+
*/
|
|
26
|
+
viewBoxHeight: number;
|
|
27
|
+
/**
|
|
28
|
+
* Render tooltip in a portal to escape container overflow constraints.
|
|
29
|
+
* When true, tooltip renders in document.body and positions relative to viewport.
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
usePortal?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Scale factor for tooltip size. Affects padding and base styles.
|
|
35
|
+
* @default 1
|
|
36
|
+
*/
|
|
37
|
+
scale?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Width threshold in viewBox coordinates for horizontal flip.
|
|
40
|
+
* When x exceeds this value, tooltip flips to the left side of the cursor.
|
|
41
|
+
*/
|
|
42
|
+
flipThreshold?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Tooltip content
|
|
45
|
+
*/
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
};
|