@octanejs/recharts 0.1.61 → 0.1.63
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/package.json +5 -5
- package/src/animation/AnimatedItems.tsrx +36 -31
- package/src/animation/CSSTransitionAnimate.tsrx +1 -2
- package/src/animation/JavascriptAnimate.tsrx +1 -2
- package/src/cartesian/Area.tsrx +414 -386
- package/src/cartesian/AreaRevealShape.tsrx +103 -84
- package/src/cartesian/Bar.tsrx +343 -317
- package/src/cartesian/BarStack.tsrx +33 -28
- package/src/cartesian/CartesianAxis.tsrx +168 -165
- package/src/cartesian/CartesianGrid.tsrx +256 -272
- package/src/cartesian/ErrorBar.tsrx +108 -104
- package/src/cartesian/Funnel.tsrx +405 -382
- package/src/cartesian/GraphicalItemClipPath.tsrx +4 -8
- package/src/cartesian/Line.tsrx +190 -177
- package/src/cartesian/LineDrawShape.tsrx +14 -15
- package/src/cartesian/ReferenceLine.tsrx +119 -105
- package/src/cartesian/Scatter.tsrx +416 -398
- package/src/cartesian/XAxis.tsrx +39 -32
- package/src/cartesian/YAxis.tsrx +47 -37
- package/src/cartesian/ZAxis.tsrx +76 -73
- package/src/chart/AreaChart.tsrx +15 -11
- package/src/chart/BarChart.tsrx +15 -11
- package/src/chart/CategoricalChart.tsrx +32 -26
- package/src/chart/ComposedChart.tsrx +15 -11
- package/src/chart/FunnelChart.tsrx +15 -11
- package/src/chart/LineChart.tsrx +15 -11
- package/src/chart/PieChart.tsrx +15 -11
- package/src/chart/PolarChart.tsrx +45 -48
- package/src/chart/RadarChart.tsrx +38 -32
- package/src/chart/RadialBarChart.tsrx +15 -11
- package/src/chart/RechartsWrapper.tsrx +214 -162
- package/src/chart/Sankey.tsrx +412 -378
- package/src/chart/ScatterChart.tsrx +15 -11
- package/src/chart/SunburstChart.tsrx +162 -155
- package/src/component/ActivePoints.tsrx +19 -13
- package/src/component/Cursor.tsrx +25 -18
- package/src/component/DefaultLegendContent.tsrx +131 -127
- package/src/component/DefaultTooltipContent.tsrx +46 -42
- package/src/component/Dots.tsrx +11 -5
- package/src/component/Label.tsrx +69 -55
- package/src/component/LabelList.tsrx +32 -27
- package/src/component/Legend.tsrx +120 -123
- package/src/component/ResponsiveContainer.tsrx +18 -11
- package/src/component/Text.tsrx +50 -43
- package/src/component/Tooltip.tsrx +234 -223
- package/src/component/TooltipBoundingBox.tsrx +34 -34
- package/src/container/ClipPathProvider.tsrx +1 -3
- package/src/container/Layer.tsrx +5 -1
- package/src/container/RootSurface.tsrx +31 -21
- package/src/container/Surface.tsrx +15 -13
- package/src/context/ErrorBarContext.tsrx +5 -5
- package/src/polar/Pie.tsrx +541 -487
- package/src/polar/PolarAngleAxis.tsrx +245 -227
- package/src/polar/PolarGrid.tsrx +139 -127
- package/src/polar/PolarRadiusAxis.tsrx +204 -185
- package/src/polar/Radar.tsrx +274 -264
- package/src/polar/RadialBar.tsrx +408 -361
- package/src/shape/Cross.tsrx +13 -7
- package/src/shape/Curve.tsrx +54 -44
- package/src/shape/Dot.tsrx +10 -8
- package/src/shape/Polygon.tsrx +38 -29
- package/src/shape/Rectangle.tsrx +73 -28
- package/src/shape/Sector.tsrx +30 -18
- package/src/shape/Symbols.tsrx +13 -11
- package/src/shape/Trapezoid.tsrx +16 -11
- package/src/state/RechartsStoreProvider.tsrx +5 -1
- package/src/synchronisation/useChartSynchronisation.tsrx +8 -7
- package/src/util/BarUtils.tsrx +43 -40
- package/src/util/FunnelUtils.tsrx +5 -5
- package/src/util/RadialBarUtils.tsrx +3 -4
- package/src/util/ScatterUtils.tsrx +13 -8
- package/src/zIndex/ZIndexLayer.tsrx +2 -2
- package/src/zIndex/ZIndexPortal.tsrx +2 -8
|
@@ -27,16 +27,16 @@ export type Formatter = (value: any, entry: LegendPayload, index: number) => Oct
|
|
|
27
27
|
|
|
28
28
|
export interface LegendPayload {
|
|
29
29
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
* This is the text that will be displayed in the legend in the DOM.
|
|
31
|
+
* If undefined, the text will not be displayed, so the icon will be rendered without text.
|
|
32
|
+
*/
|
|
33
33
|
value: string | undefined;
|
|
34
34
|
type?: LegendType;
|
|
35
35
|
color?: string;
|
|
36
36
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
* Different graphical items put different information in the payload object
|
|
38
|
+
* so double check in runtime what are you getting here.
|
|
39
|
+
*/
|
|
40
40
|
payload?: object;
|
|
41
41
|
formatter?: Formatter;
|
|
42
42
|
inactive?: boolean;
|
|
@@ -46,87 +46,84 @@ export interface LegendPayload {
|
|
|
46
46
|
|
|
47
47
|
interface DefaultLegendContentProps {
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
* The size of icon in each legend item.
|
|
50
|
+
* @defaultValue 14
|
|
51
|
+
*/
|
|
52
52
|
iconSize?: number;
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
* The type of icon in each legend item.
|
|
55
|
+
*/
|
|
56
56
|
iconType?: LegendType;
|
|
57
57
|
/**
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
* The layout of legend items inside the legend container.
|
|
59
|
+
* @defaultValue horizontal
|
|
60
|
+
*/
|
|
61
61
|
layout?: CartesianLayout;
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
63
|
+
* Horizontal alignment of the whole Legend container:
|
|
64
|
+
*
|
|
65
|
+
* - `left`: shows the Legend to the left of the chart, and chart width reduces automatically to make space for it.
|
|
66
|
+
* - `right` shows the Legend to the right of the chart, and chart width reduces automatically.
|
|
67
|
+
* - `center` shows the Legend in the middle of chart, and chart width remains unchanged.
|
|
68
|
+
*
|
|
69
|
+
* The exact behavior changes depending on 'verticalAlign' prop.
|
|
70
|
+
*
|
|
71
|
+
* @defaultValue center
|
|
72
|
+
*/
|
|
73
73
|
align?: HorizontalAlignmentType;
|
|
74
74
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
* Vertical alignment of the whole Legend container:
|
|
76
|
+
*
|
|
77
|
+
* - `bottom`: shows the Legend below chart, and chart height reduces automatically to make space for it.
|
|
78
|
+
* - `top`: shows the Legend above chart, and chart height reduces automatically.
|
|
79
|
+
* - `middle`: shows the Legend in the middle of chart, covering other content, and chart height remains unchanged.
|
|
80
|
+
* The exact behavior changes depending on `align` prop.
|
|
81
|
+
*
|
|
82
|
+
* @defaultValue middle
|
|
83
|
+
*/
|
|
84
84
|
verticalAlign?: VerticalAlignmentType;
|
|
85
85
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
* The color of the icon when the item is inactive.
|
|
87
|
+
* @defaultValue #ccc
|
|
88
|
+
*/
|
|
89
89
|
inactiveColor?: string;
|
|
90
90
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
91
|
+
* Function to customize how content is serialized before rendering.
|
|
92
|
+
*
|
|
93
|
+
* This should return HTML elements, or strings.
|
|
94
|
+
*
|
|
95
|
+
* @example (value, entry, index) => <span style={{ color: 'red' }}>{value}</span>
|
|
96
|
+
* @example https://codesandbox.io/s/legend-formatter-rmzp9
|
|
97
|
+
*/
|
|
98
98
|
formatter?: Formatter;
|
|
99
99
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
* The customized event handler of mouseenter on the items in this group
|
|
101
|
+
* @example https://recharts.github.io/examples/LegendEffectOpacity
|
|
102
|
+
*/
|
|
103
103
|
onMouseEnter?: (data: LegendPayload, index: number, event: NativeMouseEvent<HTMLElement>) => void;
|
|
104
104
|
/**
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
* The customized event handler of mouseleave on the items in this group
|
|
106
|
+
* @example https://recharts.github.io/examples/LegendEffectOpacity
|
|
107
|
+
*/
|
|
108
108
|
onMouseLeave?: (data: LegendPayload, index: number, event: NativeMouseEvent<HTMLElement>) => void;
|
|
109
109
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
* The customized event handler of click on the items in this group
|
|
111
|
+
*/
|
|
112
112
|
onClick?: (data: LegendPayload, index: number, event: NativeMouseEvent<HTMLElement>) => void;
|
|
113
113
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
* DefaultLegendContent.payload is omitted from Legend props.
|
|
115
|
+
* A custom payload can be passed here if desired, or it can be passed from the Legend "content" callback.
|
|
116
|
+
*/
|
|
117
117
|
payload?: ReadonlyArray<LegendPayload>;
|
|
118
118
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
* The style of each text label which is a span element.
|
|
120
|
+
* @defaultValue {}
|
|
121
|
+
*/
|
|
122
122
|
labelStyle?: CSSProperties;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
export type Props =
|
|
126
|
-
|
|
127
|
-
PresentationAttributesAdaptChildEvent<any, OctaneElement>,
|
|
128
|
-
keyof DefaultLegendContentProps
|
|
129
|
-
>;
|
|
125
|
+
export type Props = DefaultLegendContentProps &
|
|
126
|
+
Omit<PresentationAttributesAdaptChildEvent<any, OctaneElement>, keyof DefaultLegendContentProps>;
|
|
130
127
|
|
|
131
128
|
export const defaultLegendContentDefaultProps = {
|
|
132
129
|
align: 'center',
|
|
@@ -137,10 +134,9 @@ export const defaultLegendContentDefaultProps = {
|
|
|
137
134
|
labelStyle: {},
|
|
138
135
|
} as const satisfies Partial<Props>;
|
|
139
136
|
|
|
140
|
-
type InternalProps =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
};
|
|
137
|
+
type InternalProps = RequiresDefaultProps<Props, typeof defaultLegendContentDefaultProps> & {
|
|
138
|
+
payload: ReadonlyArray<LegendPayload>;
|
|
139
|
+
};
|
|
144
140
|
|
|
145
141
|
function getStrokeDasharray(input: unknown): string | undefined {
|
|
146
142
|
if (typeof input === 'object' && input !== null && 'strokeDasharray' in input) {
|
|
@@ -168,41 +164,43 @@ function Icon({
|
|
|
168
164
|
return null;
|
|
169
165
|
}
|
|
170
166
|
if (preferredIcon === 'plainline') {
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
167
|
+
return (
|
|
168
|
+
<line
|
|
169
|
+
strokeWidth={4}
|
|
170
|
+
fill="none"
|
|
171
|
+
stroke={color}
|
|
172
|
+
strokeDasharray={getStrokeDasharray(data.payload)}
|
|
173
|
+
x1={0}
|
|
174
|
+
y1={halfSize}
|
|
175
|
+
x2={SIZE}
|
|
176
|
+
y2={halfSize}
|
|
177
|
+
className="recharts-legend-icon"
|
|
178
|
+
/>
|
|
179
|
+
);
|
|
182
180
|
}
|
|
183
181
|
if (preferredIcon === 'line') {
|
|
184
|
-
return
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
H${SIZE}M${
|
|
193
|
-
2 * thirdSize
|
|
194
|
-
},${halfSize}
|
|
182
|
+
return (
|
|
183
|
+
<path
|
|
184
|
+
strokeWidth={4}
|
|
185
|
+
fill="none"
|
|
186
|
+
stroke={color}
|
|
187
|
+
d={`M0,${halfSize}h${thirdSize}
|
|
188
|
+
A${sixthSize},${sixthSize},0,1,1,${2 * thirdSize},${halfSize}
|
|
189
|
+
H${SIZE}M${2 * thirdSize},${halfSize}
|
|
195
190
|
A${sixthSize},${sixthSize},0,1,1,${thirdSize},${halfSize}`}
|
|
196
|
-
|
|
197
|
-
|
|
191
|
+
className="recharts-legend-icon"
|
|
192
|
+
/>
|
|
193
|
+
);
|
|
198
194
|
}
|
|
199
195
|
if (preferredIcon === 'rect') {
|
|
200
|
-
return
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
return (
|
|
197
|
+
<path
|
|
198
|
+
stroke="none"
|
|
199
|
+
fill={color}
|
|
200
|
+
d={`M0,${SIZE / 8}h${SIZE}v${(SIZE * 3) / 4}h${-SIZE}z`}
|
|
201
|
+
className="recharts-legend-icon"
|
|
202
|
+
/>
|
|
203
|
+
);
|
|
206
204
|
}
|
|
207
205
|
if (React.isValidElement(data.legendIcon)) {
|
|
208
206
|
const iconProps: any = { ...data };
|
|
@@ -210,14 +208,16 @@ function Icon({
|
|
|
210
208
|
return React.cloneElement(data.legendIcon, iconProps);
|
|
211
209
|
}
|
|
212
210
|
|
|
213
|
-
return
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
211
|
+
return (
|
|
212
|
+
<Symbols
|
|
213
|
+
fill={color}
|
|
214
|
+
cx={halfSize}
|
|
215
|
+
cy={halfSize}
|
|
216
|
+
size={SIZE}
|
|
217
|
+
sizeType="diameter"
|
|
218
|
+
type={preferredIcon}
|
|
219
|
+
/>
|
|
220
|
+
);
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
function Items(props: InternalProps) {
|
|
@@ -240,30 +240,32 @@ function Items(props: InternalProps) {
|
|
|
240
240
|
return null;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
const finalLabelStyle =
|
|
244
|
-
typeof labelStyle === 'object' ? { ...labelStyle } : {};
|
|
243
|
+
const finalLabelStyle = typeof labelStyle === 'object' ? { ...labelStyle } : {};
|
|
245
244
|
finalLabelStyle.color = entry.inactive ? inactiveColor : finalLabelStyle.color || entry.color;
|
|
246
245
|
|
|
247
|
-
const finalValue =
|
|
248
|
-
finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
|
|
246
|
+
const finalValue = finalFormatter ? finalFormatter(entry.value, entry, i) : entry.value;
|
|
249
247
|
|
|
250
|
-
return
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
<Surface
|
|
257
|
-
width={iconSize}
|
|
258
|
-
height={iconSize}
|
|
259
|
-
viewBox={viewBox}
|
|
260
|
-
style={svgStyle}
|
|
261
|
-
aria-label={entry.value == null ? 'legend icon' : `${entry.value} legend icon`}
|
|
248
|
+
return (
|
|
249
|
+
<li
|
|
250
|
+
className={className}
|
|
251
|
+
style={itemStyle}
|
|
252
|
+
key={`legend-item-${i}`}
|
|
253
|
+
{...adaptEventsOfChild(props, entry, i)}
|
|
262
254
|
>
|
|
263
|
-
<
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
255
|
+
<Surface
|
|
256
|
+
width={iconSize}
|
|
257
|
+
height={iconSize}
|
|
258
|
+
viewBox={viewBox}
|
|
259
|
+
style={svgStyle}
|
|
260
|
+
aria-label={entry.value == null ? 'legend icon' : `${entry.value} legend icon`}
|
|
261
|
+
>
|
|
262
|
+
<Icon data={entry} iconType={iconType} inactiveColor={inactiveColor} />
|
|
263
|
+
</Surface>
|
|
264
|
+
<span className="recharts-legend-item-text" style={finalLabelStyle}>
|
|
265
|
+
{finalValue}
|
|
266
|
+
</span>
|
|
267
|
+
</li>
|
|
268
|
+
);
|
|
267
269
|
});
|
|
268
270
|
}
|
|
269
271
|
|
|
@@ -287,7 +289,9 @@ export const DefaultLegendContent = (outsideProps: Props) => {
|
|
|
287
289
|
textAlign: layout === 'horizontal' ? align : 'left',
|
|
288
290
|
};
|
|
289
291
|
|
|
290
|
-
return
|
|
291
|
-
<
|
|
292
|
-
|
|
292
|
+
return (
|
|
293
|
+
<ul className="recharts-default-legend" style={finalStyle}>
|
|
294
|
+
<Items {...props} payload={payload} />
|
|
295
|
+
</ul>
|
|
296
|
+
);
|
|
293
297
|
};
|
|
@@ -20,12 +20,13 @@ function defaultFormatter(value: ValueType | undefined): OctaneNode {
|
|
|
20
20
|
export type TooltipType = 'none';
|
|
21
21
|
export type ValueType = number | string | ReadonlyArray<number | string>;
|
|
22
22
|
export type NameType = number | string;
|
|
23
|
-
export type Formatter<TValue extends ValueType = ValueType, TName extends NameType = NameType> =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
export type Formatter<TValue extends ValueType = ValueType, TName extends NameType = NameType> = (
|
|
24
|
+
value: TValue | undefined,
|
|
25
|
+
name: TName | undefined,
|
|
26
|
+
item: Payload<TValue, TName>,
|
|
27
|
+
index: number,
|
|
28
|
+
payload: ReadonlyArray<Payload<TValue, TName>>,
|
|
29
|
+
) => [OctaneNode, TName] | OctaneNode;
|
|
29
30
|
|
|
30
31
|
export interface Payload<
|
|
31
32
|
TValue extends ValueType = ValueType,
|
|
@@ -48,8 +49,8 @@ export interface Payload<
|
|
|
48
49
|
className?: string;
|
|
49
50
|
hide?: boolean;
|
|
50
51
|
/**
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
* The id of the graphical item that the data point belongs to
|
|
53
|
+
*/
|
|
53
54
|
graphicalItemId: string;
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -59,8 +60,7 @@ export interface Payload<
|
|
|
59
60
|
export type TooltipItemSorter<
|
|
60
61
|
TValue extends ValueType = ValueType,
|
|
61
62
|
TName extends NameType = NameType,
|
|
62
|
-
> =
|
|
63
|
-
'dataKey' | 'value' | 'name' | ((item: Payload<TValue, TName>) => number | string | undefined);
|
|
63
|
+
> = 'dataKey' | 'value' | 'name' | ((item: Payload<TValue, TName>) => number | string | undefined);
|
|
64
64
|
|
|
65
65
|
export interface Props<TValue extends ValueType = ValueType, TName extends NameType = NameType> {
|
|
66
66
|
separator?: string;
|
|
@@ -70,9 +70,10 @@ export interface Props<TValue extends ValueType = ValueType, TName extends NameT
|
|
|
70
70
|
contentStyle?: CSSProperties;
|
|
71
71
|
itemStyle?: CSSProperties;
|
|
72
72
|
labelStyle?: CSSProperties;
|
|
73
|
-
labelFormatter?: (
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
labelFormatter?: (
|
|
74
|
+
label: OctaneNode,
|
|
75
|
+
payload: ReadonlyArray<Payload<TValue, TName>>,
|
|
76
|
+
) => OctaneNode;
|
|
76
77
|
label?: OctaneNode;
|
|
77
78
|
payload?: ReadonlyArray<Payload<TValue, TName>>;
|
|
78
79
|
itemSorter?: TooltipItemSorter<TValue, TName>;
|
|
@@ -161,23 +162,25 @@ export const DefaultTooltipContent = (props: Props) => {
|
|
|
161
162
|
...itemStyle,
|
|
162
163
|
};
|
|
163
164
|
|
|
164
|
-
return
|
|
165
|
-
className="recharts-tooltip-item"
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
: null}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<span className="recharts-tooltip-item-unit">{entry.unit || ''}</span>
|
|
177
|
-
</li>;
|
|
165
|
+
return (
|
|
166
|
+
<li className="recharts-tooltip-item" key={`tooltip-item-${i}`} style={finalItemStyle}>
|
|
167
|
+
{isNumOrStr(finalName) ? (
|
|
168
|
+
<span className="recharts-tooltip-item-name">{finalName}</span>
|
|
169
|
+
) : null}
|
|
170
|
+
{isNumOrStr(finalName) ? (
|
|
171
|
+
<span className="recharts-tooltip-item-separator">{separator}</span>
|
|
172
|
+
) : null}
|
|
173
|
+
<span className="recharts-tooltip-item-value">{finalValue}</span>
|
|
174
|
+
<span className="recharts-tooltip-item-unit">{entry.unit || ''}</span>
|
|
175
|
+
</li>
|
|
176
|
+
);
|
|
178
177
|
});
|
|
179
178
|
|
|
180
|
-
return
|
|
179
|
+
return (
|
|
180
|
+
<ul className="recharts-tooltip-item-list" style={listStyle}>
|
|
181
|
+
{items}
|
|
182
|
+
</ul>
|
|
183
|
+
);
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
return null;
|
|
@@ -200,18 +203,19 @@ export const DefaultTooltipContent = (props: Props) => {
|
|
|
200
203
|
finalLabel = labelFormatter(label, payload);
|
|
201
204
|
}
|
|
202
205
|
|
|
203
|
-
const accessibilityAttributes =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
206
|
+
const accessibilityAttributes = accessibilityLayer
|
|
207
|
+
? ({
|
|
208
|
+
role: 'status',
|
|
209
|
+
'aria-live': 'assertive',
|
|
210
|
+
} as HTMLAttributes<HTMLDivElement>)
|
|
211
|
+
: {};
|
|
212
|
+
|
|
213
|
+
return (
|
|
214
|
+
<div className={wrapperCN} style={finalStyle} {...accessibilityAttributes}>
|
|
215
|
+
<p className={labelCN} style={finalLabelStyle}>
|
|
216
|
+
{React.isValidElement(finalLabel) ? finalLabel : `${finalLabel}`}
|
|
217
|
+
</p>
|
|
218
|
+
{renderContent()}
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
217
221
|
};
|
package/src/component/Dots.tsrx
CHANGED
|
@@ -15,8 +15,10 @@ type DotItemProps = {
|
|
|
15
15
|
className: string;
|
|
16
16
|
};
|
|
17
17
|
type DotElementProps = Extract<DotType, OctaneElement>['props'];
|
|
18
|
-
export type DotsDotProps =
|
|
19
|
-
|
|
18
|
+
export type DotsDotProps = Omit<
|
|
19
|
+
DotProps,
|
|
20
|
+
'cx' | 'cy' | 'key' | 'index' | 'dataKey' | 'value' | 'payload'
|
|
21
|
+
>;
|
|
20
22
|
interface DotsProps extends ZIndexable {
|
|
21
23
|
points: ReadonlyArray<DotPoint>;
|
|
22
24
|
dot: DotType;
|
|
@@ -99,7 +101,11 @@ export function Dots(dotsProps: DotsProps) {
|
|
|
99
101
|
if (needClip && clipPathId != null) {
|
|
100
102
|
layerProps.clipPath = 'url(#clipPath-' + (clipDot ? '' : 'dots-') + clipPathId + ')';
|
|
101
103
|
}
|
|
102
|
-
return
|
|
103
|
-
<
|
|
104
|
-
|
|
104
|
+
return (
|
|
105
|
+
<ZIndexLayer zIndex={zIndex}>
|
|
106
|
+
<Layer className={className} {...layerProps}>
|
|
107
|
+
{dots}
|
|
108
|
+
</Layer>
|
|
109
|
+
</ZIndexLayer>
|
|
110
|
+
);
|
|
105
111
|
}
|