@octanejs/visx 0.1.37 → 0.1.39
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 +4 -4
- package/src/annotation/components/EditableAnnotation.tsrx +6 -3
- package/src/annotation/components/EditableAnnotation.tsrx.d.ts +2 -2
- package/src/annotation/components/Label.tsrx +11 -2
- package/src/axis/axis/Axis.tsrx +4 -2
- package/src/brush/BaseBrush.tsrx +6 -7
- package/src/brush/BaseBrush.tsrx.d.ts +2 -3
- package/src/brush/BrushOverlay.tsrx +11 -8
- package/src/brush/BrushOverlay.tsrx.d.ts +3 -8
- package/src/brush/BrushSelection.tsrx +2 -3
- package/src/brush/BrushSelection.tsrx.d.ts +1 -2
- package/src/internal/useMeasure.tsrx +1 -1
- package/src/internal/useMeasure.tsrx.d.ts +1 -1
- package/src/kernel/warnings.ts +4 -0
- package/src/legend/legends/Legend/LegendItem.tsrx +2 -2
- package/src/legend/legends/Legend/LegendItem.tsrx.d.ts +2 -2
- package/src/legend/legends/Legend/LegendLabel.tsrx +2 -2
- package/src/legend/legends/Legend/LegendLabel.tsrx.d.ts +2 -2
- package/src/legend/legends/Legend/index.tsrx +30 -31
- package/src/legend/types/index.ts +3 -6
- package/src/responsive/types/index.ts +3 -21
- package/src/sankey/Sankey.tsrx +9 -5
- package/src/sankey/Sankey.tsrx.d.ts +3 -3
- package/src/shape/shapes/Bar.tsrx +2 -1
- package/src/shape/shapes/Bar.tsrx.d.ts +2 -1
- package/src/shape/shapes/BarRounded.tsrx +2 -1
- package/src/shape/shapes/BarRounded.tsrx.d.ts +2 -1
- package/src/shape/shapes/Line.tsrx +2 -1
- package/src/shape/shapes/Line.tsrx.d.ts +2 -1
- package/src/shape/shapes/LinePath.tsrx +2 -1
- package/src/shape/shapes/LinePath.tsrx.d.ts +2 -1
- package/src/shape/types/area.ts +2 -1
- package/src/text/index.ts +1 -0
- package/src/text/types.ts +4 -3
- package/src/theme/utils/warn.ts +4 -0
- package/src/tooltip/enhancers/withTooltip.tsrx +14 -9
- package/src/tooltip/enhancers/withTooltip.tsrx.d.ts +5 -4
- package/src/tooltip/floating/ChartTooltip.tsrx +4 -3
- package/src/tooltip/floating/ChartTooltip.tsrx.d.ts +2 -3
- package/src/tooltip/floating/ChartTooltipContent.tsrx +7 -6
- package/src/tooltip/floating/ChartTooltipContent.tsrx.d.ts +6 -6
- package/src/tooltip/floating/FloatingTooltip.tsrx +24 -18
- package/src/tooltip/floating/FloatingTooltip.tsrx.d.ts +7 -7
- package/src/tooltip/floating/context.tsrx +0 -1
- package/src/tooltip/floating/context.tsrx.d.ts +1 -2
- package/src/tooltip/floating/internalTypes.ts +13 -109
- package/src/tooltip/floating/types.ts +29 -26
- package/src/tooltip/floating/useChartTooltip.tsrx +1 -2
- package/src/tooltip/floating/useChartTooltip.tsrx.d.ts +1 -2
- package/src/tooltip/floating/useFloatingTooltip.tsrx +11 -6
- package/src/tooltip/hooks/useTooltipInPortal.tsrx +2 -2
- package/src/tooltip/hooks/useTooltipInPortal.tsrx.d.ts +2 -2
- package/src/tooltip/tooltips/Tooltip.tsrx +5 -2
- package/src/tooltip/tooltips/Tooltip.tsrx.d.ts +3 -2
- package/src/tooltip/tooltips/TooltipWithBounds.tsrx +9 -3
- package/src/tooltip/tooltips/TooltipWithBounds.tsrx.d.ts +6 -4
- package/src/xychart/components/Tooltip.tsrx +0 -2
- package/src/xychart/components/XYChart.tsrx +4 -1
- package/src/xychart/components/XYChart.tsrx.d.ts +0 -1
- package/src/xychart/components/annotation/private/BaseAnnotation.tsrx +2 -2
- package/src/xychart/components/annotation/private/BaseAnnotation.tsrx.d.ts +2 -2
- package/src/xychart/components/axis/BaseAxis.tsrx +2 -2
- package/src/xychart/components/axis/BaseAxis.tsrx.d.ts +2 -2
- package/src/xychart/components/grid/BaseGrid.tsrx +3 -3
- package/src/xychart/components/grid/BaseGrid.tsrx.d.ts +3 -3
- package/src/xychart/components/series/AnimatedGlyphSeries.tsrx +2 -2
- package/src/xychart/components/series/AnimatedGlyphSeries.tsrx.d.ts +2 -2
- package/src/xychart/components/series/GlyphSeries.tsrx +1 -2
- package/src/xychart/components/series/GlyphSeries.tsrx.d.ts +2 -2
- package/src/xychart/components/series/private/AnimatedGlyphs.tsrx +1 -2
- package/src/xychart/components/series/private/AnimatedGlyphs.tsrx.d.ts +2 -2
- package/src/xychart/components/series/private/BaseAreaSeries.tsrx +6 -3
- package/src/xychart/components/series/private/BaseAreaSeries.tsrx.d.ts +3 -3
- package/src/xychart/components/series/private/BaseAreaStack.tsrx +36 -28
- package/src/xychart/components/series/private/BaseAreaStack.tsrx.d.ts +4 -4
- package/src/xychart/components/series/private/BaseBarGroup.tsrx +3 -5
- package/src/xychart/components/series/private/BaseBarGroup.tsrx.d.ts +2 -3
- package/src/xychart/components/series/private/BaseBarSeries.tsrx +2 -2
- package/src/xychart/components/series/private/BaseBarSeries.tsrx.d.ts +2 -2
- package/src/xychart/components/series/private/BaseBarStack.tsrx +11 -7
- package/src/xychart/components/series/private/BaseBarStack.tsrx.d.ts +3 -3
- package/src/xychart/components/series/private/BaseLineSeries.tsrx +6 -3
- package/src/xychart/components/series/private/BaseLineSeries.tsrx.d.ts +3 -3
- package/src/xychart/hooks/useEventEmitter.tsrx +1 -2
- package/src/xychart/hooks/useEventEmitter.tsrx.d.ts +1 -2
- package/src/xychart/hooks/useEventEmitters.tsrx +0 -1
- package/src/xychart/hooks/useEventEmitters.tsrx.d.ts +0 -1
- package/src/xychart/hooks/useEventHandlers.tsrx +0 -1
- package/src/xychart/hooks/useEventHandlers.tsrx.d.ts +0 -1
- package/src/xychart/hooks/useSeriesEvents.tsrx +0 -1
- package/src/xychart/hooks/useSeriesEvents.tsrx.d.ts +0 -1
- package/src/xychart/hooks/useStackedData.tsrx.d.ts +1 -1
- package/src/xychart/index.ts +1 -0
- package/src/xychart/typeguards/events.ts +0 -2
- package/src/xychart/types/series.ts +0 -1
- package/src/xychart/types/svgPath.ts +5 -0
- package/src/xychart/types/theme.ts +4 -3
- package/src/xychart/utils/combineBarStackData.ts +1 -2
- package/src/xychart/utils/getChildrenAndGrandchildrenWithProps.ts +4 -5
- package/src/zoom/Zoom.tsrx +22 -20
- package/src/zoom/Zoom.tsrx.d.ts +3 -3
- package/src/zoom/types.ts +14 -27
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type { OctaneNode } from 'octane';
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { ElementDescriptor, OctaneNode } from 'octane';
|
|
3
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
4
|
+
import type { HTMLProps } from '@octanejs/floating-ui';
|
|
3
5
|
import type {
|
|
4
6
|
Boundary,
|
|
5
7
|
Delay,
|
|
@@ -16,7 +18,6 @@ import type {
|
|
|
16
18
|
SizeOptions,
|
|
17
19
|
Strategy,
|
|
18
20
|
UseDismissProps,
|
|
19
|
-
FloatingUiArrowProps,
|
|
20
21
|
UseFloatingOptions,
|
|
21
22
|
UseFloatingReturn,
|
|
22
23
|
UseFocusProps,
|
|
@@ -109,12 +110,12 @@ export type UseFloatingTooltipReturn<TData = unknown> = {
|
|
|
109
110
|
strategy: Strategy;
|
|
110
111
|
x: number | null;
|
|
111
112
|
y: number | null;
|
|
112
|
-
floatingStyles:
|
|
113
|
+
floatingStyles: CSSProperties;
|
|
113
114
|
middlewareData: MiddlewareData;
|
|
114
115
|
|
|
115
116
|
refs: UseFloatingReturn<ReferenceElement>['refs'];
|
|
116
117
|
context: UseFloatingReturn<ReferenceElement>['context'];
|
|
117
|
-
arrowRef:
|
|
118
|
+
arrowRef: (node: SVGSVGElement | null) => void;
|
|
118
119
|
|
|
119
120
|
setAnchor: (anchor: TooltipAnchor | null) => void;
|
|
120
121
|
setData: (data: TData | undefined) => void;
|
|
@@ -122,9 +123,9 @@ export type UseFloatingTooltipReturn<TData = unknown> = {
|
|
|
122
123
|
openTooltip: (data?: TData, anchor?: TooltipAnchor | null) => void;
|
|
123
124
|
closeTooltip: () => void;
|
|
124
125
|
|
|
125
|
-
getReferenceProps: <TProps extends
|
|
126
|
-
getFloatingProps: <TProps extends
|
|
127
|
-
getArrowProps: <TProps extends
|
|
126
|
+
getReferenceProps: <TProps extends HTMLProps<Element>>(props?: TProps) => TProps;
|
|
127
|
+
getFloatingProps: <TProps extends HTMLProps<HTMLElement>>(props?: TProps) => TProps;
|
|
128
|
+
getArrowProps: <TProps extends Octane.SVGProps<SVGSVGElement>>(props?: TProps) => TProps;
|
|
128
129
|
};
|
|
129
130
|
|
|
130
131
|
export type FloatingTooltipProviderProps = {
|
|
@@ -149,51 +150,53 @@ export type FloatingTooltipTriggerState = {
|
|
|
149
150
|
|
|
150
151
|
export type FloatingTooltipTriggerProps = {
|
|
151
152
|
render:
|
|
152
|
-
|
|
|
153
|
-
| ((props:
|
|
153
|
+
| ElementDescriptor
|
|
154
|
+
| ((props: HTMLProps<Element>, state: FloatingTooltipTriggerState) => ElementDescriptor);
|
|
154
155
|
disabled?: boolean;
|
|
155
156
|
};
|
|
156
157
|
|
|
157
158
|
export type FloatingTooltipPortalProps = {
|
|
158
|
-
container?: HTMLElement | ShadowRoot |
|
|
159
|
+
container?: HTMLElement | ShadowRoot | { current: HTMLElement | ShadowRoot | null } | null;
|
|
159
160
|
disabled?: boolean;
|
|
160
161
|
children: OctaneNode;
|
|
161
162
|
};
|
|
162
163
|
|
|
163
164
|
export type FloatingTooltipPositionerState = FloatingTooltipRootState;
|
|
164
165
|
|
|
165
|
-
export type FloatingTooltipPositionerProps =
|
|
166
|
+
export type FloatingTooltipPositionerProps = Octane.HTMLAttributes<HTMLDivElement> & {
|
|
166
167
|
'data-testid'?: string;
|
|
167
168
|
render?:
|
|
168
|
-
|
|
|
169
|
+
| ElementDescriptor
|
|
169
170
|
| ((
|
|
170
|
-
props:
|
|
171
|
+
props: HTMLProps<HTMLDivElement>,
|
|
171
172
|
state: FloatingTooltipPositionerState,
|
|
172
|
-
) =>
|
|
173
|
+
) => ElementDescriptor);
|
|
173
174
|
};
|
|
174
175
|
|
|
175
176
|
export type FloatingTooltipContentState = FloatingTooltipRootState;
|
|
176
177
|
|
|
177
|
-
export type FloatingTooltipContentProps =
|
|
178
|
+
export type FloatingTooltipContentProps = Octane.HTMLAttributes<HTMLDivElement> & {
|
|
178
179
|
render?:
|
|
179
|
-
|
|
|
180
|
-
| ((
|
|
181
|
-
props: React.HTMLProps<HTMLDivElement>,
|
|
182
|
-
state: FloatingTooltipContentState,
|
|
183
|
-
) => React.ReactElement);
|
|
180
|
+
| ElementDescriptor
|
|
181
|
+
| ((props: HTMLProps<HTMLDivElement>, state: FloatingTooltipContentState) => ElementDescriptor);
|
|
184
182
|
};
|
|
185
183
|
|
|
186
184
|
export type FloatingTooltipArrowState = FloatingTooltipRootState;
|
|
187
185
|
|
|
188
186
|
export type FloatingTooltipArrowProps = Omit<
|
|
189
|
-
|
|
190
|
-
'
|
|
187
|
+
Octane.SVGProps<SVGSVGElement>,
|
|
188
|
+
'width' | 'height' | 'ref'
|
|
191
189
|
> & {
|
|
190
|
+
width?: number;
|
|
191
|
+
height?: number;
|
|
192
|
+
tipRadius?: number;
|
|
193
|
+
staticOffset?: string | number | null;
|
|
194
|
+
d?: string;
|
|
192
195
|
padding?: never;
|
|
193
196
|
render?:
|
|
194
|
-
|
|
|
197
|
+
| ElementDescriptor
|
|
195
198
|
| ((
|
|
196
|
-
props:
|
|
199
|
+
props: Octane.SVGProps<SVGSVGElement>,
|
|
197
200
|
state: FloatingTooltipArrowState,
|
|
198
|
-
) =>
|
|
201
|
+
) => ElementDescriptor);
|
|
199
202
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'octane';
|
|
2
|
-
import type React from 'react';
|
|
3
2
|
import type {
|
|
4
3
|
ChartTooltipItem,
|
|
5
4
|
ChartTooltipProps,
|
|
@@ -43,7 +42,7 @@ export type UseChartTooltipReturn<Datum = unknown> = {
|
|
|
43
42
|
open: boolean;
|
|
44
43
|
items: ChartTooltipItem<Datum>[];
|
|
45
44
|
anchor: TooltipAnchor | null;
|
|
46
|
-
containerRef:
|
|
45
|
+
containerRef: (node: HTMLElement | SVGElement | null) => void;
|
|
47
46
|
show: (args: {
|
|
48
47
|
anchor: TooltipAnchor | ChartTooltipLocalPoint | ChartTooltipSvgPoint;
|
|
49
48
|
items: ChartTooltipItem<Datum>[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type React from 'react';
|
|
3
2
|
import type { ChartTooltipItem, ChartTooltipProps, ChartTooltipControlledProps } from './ChartTooltip.tsrx';
|
|
4
3
|
import type { FloatingTooltipOffset, TooltipAnchor, TooltipPlacement, UseFloatingTooltipOptions } from './types';
|
|
5
4
|
export type ChartTooltipLocalPoint = {
|
|
@@ -25,7 +24,7 @@ export type UseChartTooltipReturn<Datum = unknown> = {
|
|
|
25
24
|
open: boolean;
|
|
26
25
|
items: ChartTooltipItem<Datum>[];
|
|
27
26
|
anchor: TooltipAnchor | null;
|
|
28
|
-
containerRef:
|
|
27
|
+
containerRef: (node: HTMLElement | SVGElement | null) => void;
|
|
29
28
|
show: (args: {
|
|
30
29
|
anchor: TooltipAnchor | ChartTooltipLocalPoint | ChartTooltipSvgPoint;
|
|
31
30
|
items: ChartTooltipItem<Datum>[];
|
|
@@ -9,10 +9,15 @@ import {
|
|
|
9
9
|
useRole,
|
|
10
10
|
} from '@octanejs/floating-ui';
|
|
11
11
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'octane';
|
|
12
|
-
import type
|
|
12
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
13
13
|
import { getTooltipAnchorReference } from './anchors';
|
|
14
14
|
import { buildFloatingTooltipMiddleware } from './middleware';
|
|
15
|
-
import type {
|
|
15
|
+
import type {
|
|
16
|
+
HTMLProps,
|
|
17
|
+
OpenChangeReason,
|
|
18
|
+
ReferenceElement,
|
|
19
|
+
UseFloatingReturn,
|
|
20
|
+
} from './internalTypes';
|
|
16
21
|
import type {
|
|
17
22
|
FloatingTooltipOpenChangeDetails,
|
|
18
23
|
TooltipAlign,
|
|
@@ -31,7 +36,7 @@ function getSideAndAlign(placement: string): { side: TooltipSide; align: Tooltip
|
|
|
31
36
|
};
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
function getFloatingPropsWithDefaultId<TProps extends
|
|
39
|
+
function getFloatingPropsWithDefaultId<TProps extends HTMLProps<HTMLElement>>(
|
|
35
40
|
props: TProps | undefined,
|
|
36
41
|
id: string | undefined,
|
|
37
42
|
) {
|
|
@@ -263,7 +268,7 @@ export default function useFloatingTooltip<TData = unknown>(
|
|
|
263
268
|
|
|
264
269
|
const { align, side } = getSideAndAlign(floating.placement);
|
|
265
270
|
const getFloatingPropsWithId = useCallback(
|
|
266
|
-
<TProps extends
|
|
271
|
+
<TProps extends HTMLProps<HTMLElement>,>(props?: TProps) => getFloatingProps(
|
|
267
272
|
getFloatingPropsWithDefaultId(props, id),
|
|
268
273
|
) as TProps,
|
|
269
274
|
[getFloatingProps, id],
|
|
@@ -290,10 +295,10 @@ export default function useFloatingTooltip<TData = unknown>(
|
|
|
290
295
|
update: floating.update,
|
|
291
296
|
openTooltip,
|
|
292
297
|
closeTooltip,
|
|
293
|
-
getReferenceProps: <TProps extends
|
|
298
|
+
getReferenceProps: <TProps extends HTMLProps<Element>,>(props?: TProps) =>
|
|
294
299
|
getReferenceProps(props) as TProps,
|
|
295
300
|
getFloatingProps: getFloatingPropsWithId,
|
|
296
|
-
getArrowProps: <TProps extends
|
|
301
|
+
getArrowProps: <TProps extends Octane.SVGProps<SVGSVGElement>,>(props?: TProps) => {
|
|
297
302
|
const emptyProps = {};
|
|
298
303
|
return props ?? emptyProps as TProps;
|
|
299
304
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'octane';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import useMeasure from '../../internal/useMeasure.tsrx';
|
|
4
4
|
import type {
|
|
5
5
|
RectReadOnly,
|
|
@@ -23,7 +23,7 @@ export type UseTooltipInPortal = {
|
|
|
23
23
|
/** Function to force a refresh of the container bounds. */
|
|
24
24
|
forceRefreshBounds: () => void;
|
|
25
25
|
/** Component to render the tooltip in a portal. */
|
|
26
|
-
TooltipInPortal:
|
|
26
|
+
TooltipInPortal: ComponentBody<TooltipInPortalProps>;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export type UseTooltipPortalOptions = Pick<PortalProps, 'zIndex'> & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import type { RectReadOnly, Options as BaseUseMeasureOptions } from '../../internal/useMeasure.tsrx';
|
|
4
4
|
import type { PortalProps } from '../Portal.tsrx';
|
|
5
5
|
import type { TooltipProps } from '../tooltips/Tooltip.tsrx';
|
|
@@ -12,7 +12,7 @@ export type UseTooltipInPortal = {
|
|
|
12
12
|
/** Function to force a refresh of the container bounds. */
|
|
13
13
|
forceRefreshBounds: () => void;
|
|
14
14
|
/** Component to render the tooltip in a portal. */
|
|
15
|
-
TooltipInPortal:
|
|
15
|
+
TooltipInPortal: ComponentBody<TooltipInPortalProps>;
|
|
16
16
|
};
|
|
17
17
|
export type UseTooltipPortalOptions = Pick<PortalProps, 'zIndex'> & {
|
|
18
18
|
/** whether TooltipWithBounds should be used to auto-detect (page) boundaries and reposition itself. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { CSSProperties,
|
|
1
|
+
import type { CSSProperties, Ref } from 'react';
|
|
2
2
|
import type { OctaneNode } from 'octane';
|
|
3
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
3
4
|
import cx from 'classnames';
|
|
4
5
|
|
|
5
6
|
export type TooltipProps = {
|
|
@@ -56,7 +57,9 @@ const Tooltip = ({
|
|
|
56
57
|
applyPositionStyle = false,
|
|
57
58
|
ref,
|
|
58
59
|
...restProps
|
|
59
|
-
}: TooltipProps & HTMLAttributes<HTMLDivElement> & {
|
|
60
|
+
}: TooltipProps & Omit<Octane.HTMLAttributes<HTMLDivElement>, keyof TooltipProps> & {
|
|
61
|
+
ref?: Ref<HTMLDivElement>;
|
|
62
|
+
}) => <div
|
|
60
63
|
ref={ref}
|
|
61
64
|
className={cx('visx-tooltip', className)}
|
|
62
65
|
style={{
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type { CSSProperties,
|
|
2
|
+
import type { CSSProperties, Ref } from 'react';
|
|
3
3
|
import type { OctaneNode } from 'octane';
|
|
4
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
4
5
|
export type TooltipProps = {
|
|
5
6
|
/** Tooltip content. */
|
|
6
7
|
children?: OctaneNode;
|
|
@@ -32,7 +33,7 @@ export type TooltipProps = {
|
|
|
32
33
|
};
|
|
33
34
|
export declare const defaultStyles: CSSProperties;
|
|
34
35
|
declare const Tooltip: {
|
|
35
|
-
({ className, top, left, offsetLeft, offsetTop, style, children, unstyled, applyPositionStyle, ref, ...restProps }: TooltipProps & HTMLAttributes<HTMLDivElement> & {
|
|
36
|
+
({ className, top, left, offsetLeft, offsetTop, style, children, unstyled, applyPositionStyle, ref, ...restProps }: TooltipProps & Omit<Octane.HTMLAttributes<HTMLDivElement>, keyof TooltipProps> & {
|
|
36
37
|
ref?: Ref<HTMLDivElement>;
|
|
37
38
|
}): import("react").JSX.Element;
|
|
38
39
|
displayName: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Ref, CSSProperties } from 'react';
|
|
2
|
+
import type { ElementDescriptor } from 'octane';
|
|
3
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
2
4
|
import type { WithBoundingRectsProps } from '@octanejs/visx/bounds';
|
|
3
5
|
import { withBoundingRects } from '@octanejs/visx/bounds';
|
|
4
6
|
|
|
@@ -7,7 +9,7 @@ import Tooltip, { defaultStyles } from './Tooltip.tsrx';
|
|
|
7
9
|
import { TooltipPositionProvider } from '../context/TooltipPositionContext.tsrx';
|
|
8
10
|
|
|
9
11
|
export type TooltipWithBoundsProps =
|
|
10
|
-
TooltipProps & HTMLAttributes<HTMLDivElement> & WithBoundingRectsProps & {
|
|
12
|
+
TooltipProps & Omit<Octane.HTMLAttributes<HTMLDivElement>, keyof TooltipProps> & WithBoundingRectsProps & {
|
|
11
13
|
nodeRef?: Ref<HTMLDivElement>;
|
|
12
14
|
};
|
|
13
15
|
|
|
@@ -79,4 +81,8 @@ function TooltipWithBounds({
|
|
|
79
81
|
</Tooltip>;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
|
|
84
|
+
const TooltipWithBoundsComponent = withBoundingRects(TooltipWithBounds) as unknown as (
|
|
85
|
+
props: TooltipWithBoundsProps,
|
|
86
|
+
) => ElementDescriptor;
|
|
87
|
+
|
|
88
|
+
export default TooltipWithBoundsComponent;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type {
|
|
2
|
+
import type { Ref } from 'react';
|
|
3
|
+
import type { ElementDescriptor } from 'octane';
|
|
4
|
+
import type { Octane } from 'octane/jsx-runtime';
|
|
3
5
|
import type { WithBoundingRectsProps } from '@octanejs/visx/bounds';
|
|
4
6
|
import type { TooltipProps } from './Tooltip.tsrx';
|
|
5
|
-
export type TooltipWithBoundsProps = TooltipProps & HTMLAttributes<HTMLDivElement> & WithBoundingRectsProps & {
|
|
7
|
+
export type TooltipWithBoundsProps = TooltipProps & Omit<Octane.HTMLAttributes<HTMLDivElement>, keyof TooltipProps> & WithBoundingRectsProps & {
|
|
6
8
|
nodeRef?: Ref<HTMLDivElement>;
|
|
7
9
|
};
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
10
|
+
declare const TooltipWithBoundsComponent: (props: TooltipWithBoundsProps) => ElementDescriptor;
|
|
11
|
+
export default TooltipWithBoundsComponent;
|
|
@@ -237,8 +237,6 @@ function TooltipInner<Datum extends object>({
|
|
|
237
237
|
if (isValidNumber(left) && isValidNumber(top)) {
|
|
238
238
|
const color =
|
|
239
239
|
(nearestDatumKey && colorScale?.(nearestDatumKey)) ??
|
|
240
|
-
// @ts-expect-error
|
|
241
|
-
null ??
|
|
242
240
|
theme?.gridStyles?.stroke ??
|
|
243
241
|
theme?.htmlLabel?.color ??
|
|
244
242
|
'#222';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint jsx-a11y/mouse-events-have-key-events: 'off', @typescript-eslint/no-explicit-any: 'off' */
|
|
2
2
|
import { useContext, useEffect } from 'octane';
|
|
3
|
-
import type { PointerEvent } from 'react';
|
|
4
3
|
import type { OctaneNode } from 'octane';
|
|
5
4
|
import { ParentSize } from '@octanejs/visx/responsive';
|
|
6
5
|
import type { ResizeObserverPolyfill } from '@octanejs/visx/responsive';
|
|
@@ -22,6 +21,10 @@ import useEventHandlers, {
|
|
|
22
21
|
POINTER_EVENTS_NEAREST,
|
|
23
22
|
} from '../hooks/useEventHandlers.tsrx';
|
|
24
23
|
|
|
24
|
+
// Keep the literal expression below available to bundler define substitution
|
|
25
|
+
// without requiring Node ambient types in browser consumers.
|
|
26
|
+
declare const process: { env: { NODE_ENV?: string } };
|
|
27
|
+
|
|
25
28
|
const DEFAULT_MARGIN = { top: 50, right: 50, bottom: 50, left: 50 };
|
|
26
29
|
|
|
27
30
|
export type XYChartProps<XScaleConfig extends ScaleConfig<AxisScaleOutput, any, any>, YScaleConfig extends ScaleConfig<AxisScaleOutput, any, any>, Datum extends object> = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type { PointerEvent } from 'react';
|
|
3
2
|
import type { OctaneNode } from 'octane';
|
|
4
3
|
import type { ResizeObserverPolyfill } from '@octanejs/visx/responsive';
|
|
5
4
|
import type { AxisScaleOutput } from '@octanejs/visx/axis';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext, useMemo } from 'octane';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import type { AnnotationProps, EditableAnnotationProps } from '@octanejs/visx/annotation';
|
|
4
4
|
import type { ScaleInput } from '@octanejs/visx/scale';
|
|
5
5
|
import { coerceNumber } from '@octanejs/visx/scale';
|
|
@@ -18,7 +18,7 @@ export type BaseAnnotationProps<XScale extends AxisScale, YScale extends AxisSca
|
|
|
18
18
|
| 'onDragMove'
|
|
19
19
|
| 'onDragStart'> & {
|
|
20
20
|
/** Annotation component to render. */
|
|
21
|
-
AnnotationComponent:
|
|
21
|
+
AnnotationComponent: ComponentBody<AnnotationProps> | ComponentBody<EditableAnnotationProps>;
|
|
22
22
|
/** Key for series to which datum belongs (used for x/yAccessors). Alternatively xAccessor + yAccessor may be specified. */
|
|
23
23
|
dataKey?: string;
|
|
24
24
|
/** Datum to annotate, used for Annotation positioning. */
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import type { AnnotationProps, EditableAnnotationProps } from '@octanejs/visx/annotation';
|
|
4
4
|
import type { ScaleInput } from '@octanejs/visx/scale';
|
|
5
5
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
6
6
|
export type BaseAnnotationProps<XScale extends AxisScale, YScale extends AxisScale, Datum extends object> = Pick<EditableAnnotationProps, 'canEditLabel' | 'canEditSubject' | 'children' | 'dx' | 'dy' | 'onDragEnd' | 'onDragMove' | 'onDragStart'> & {
|
|
7
7
|
/** Annotation component to render. */
|
|
8
|
-
AnnotationComponent:
|
|
8
|
+
AnnotationComponent: ComponentBody<AnnotationProps> | ComponentBody<EditableAnnotationProps>;
|
|
9
9
|
/** Key for series to which datum belongs (used for x/yAccessors). Alternatively xAccessor + yAccessor may be specified. */
|
|
10
10
|
dataKey?: string;
|
|
11
11
|
/** Datum to annotate, used for Annotation positioning. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useMemo, useContext } from 'octane';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import type { AxisScale, TickLabelProps, AxisProps as VxAxisProps } from '@octanejs/visx/axis';
|
|
4
4
|
import type { ScaleInput } from '@octanejs/visx/scale';
|
|
5
5
|
import DataContext from '../../context/DataContext.tsrx';
|
|
@@ -12,7 +12,7 @@ export type BaseAxisProps<Scale extends AxisScale> = Omit<
|
|
|
12
12
|
orientation: NonNullable<VxAxisProps<Scale>['orientation']>;
|
|
13
13
|
} & {
|
|
14
14
|
/** Rendered component which is passed VxAxisProps by BaseAxis after processing. */
|
|
15
|
-
AxisComponent:
|
|
15
|
+
AxisComponent: ComponentBody<VxAxisProps<Scale>>;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import type { AxisScale, AxisProps as VxAxisProps } from '@octanejs/visx/axis';
|
|
4
4
|
export type BaseAxisProps<Scale extends AxisScale> = Omit<VxAxisProps<Scale>, 'scale' | 'orientation'> & {
|
|
5
5
|
/** Required axis orientation. */
|
|
6
6
|
orientation: NonNullable<VxAxisProps<Scale>['orientation']>;
|
|
7
7
|
} & {
|
|
8
8
|
/** Rendered component which is passed VxAxisProps by BaseAxis after processing. */
|
|
9
|
-
AxisComponent:
|
|
9
|
+
AxisComponent: ComponentBody<VxAxisProps<Scale>>;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Component which handles all xychart-specific logic for axes,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useContext } from 'octane';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import type { CommonGridProps, AllGridRowsProps, GridColumnsProps } from '@octanejs/visx/grid';
|
|
4
4
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
5
5
|
import DataContext from '../../context/DataContext.tsrx';
|
|
@@ -10,9 +10,9 @@ export type BaseGridProps = {
|
|
|
10
10
|
/** Whether to render GridColumns. */
|
|
11
11
|
columns?: boolean;
|
|
12
12
|
/** Rendered GridRows component which is passed GridRowProps by BaseGrid. */
|
|
13
|
-
GridRowsComponent:
|
|
13
|
+
GridRowsComponent: ComponentBody<AllGridRowsProps<AxisScale>>;
|
|
14
14
|
/** Rendered GridColumns component which is passed GridColumnsProps by BaseGrid. */
|
|
15
|
-
GridColumnsComponent:
|
|
15
|
+
GridColumnsComponent: ComponentBody<GridColumnsProps<AxisScale>>;
|
|
16
16
|
} & CommonGridProps;
|
|
17
17
|
|
|
18
18
|
/** Component that handles all */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type {
|
|
2
|
+
import type { ComponentBody } from 'octane';
|
|
3
3
|
import type { CommonGridProps, AllGridRowsProps, GridColumnsProps } from '@octanejs/visx/grid';
|
|
4
4
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
5
5
|
export type BaseGridProps = {
|
|
@@ -8,9 +8,9 @@ export type BaseGridProps = {
|
|
|
8
8
|
/** Whether to render GridColumns. */
|
|
9
9
|
columns?: boolean;
|
|
10
10
|
/** Rendered GridRows component which is passed GridRowProps by BaseGrid. */
|
|
11
|
-
GridRowsComponent:
|
|
11
|
+
GridRowsComponent: ComponentBody<AllGridRowsProps<AxisScale>>;
|
|
12
12
|
/** Rendered GridColumns component which is passed GridColumnsProps by BaseGrid. */
|
|
13
|
-
GridColumnsComponent:
|
|
13
|
+
GridColumnsComponent: ComponentBody<GridColumnsProps<AxisScale>>;
|
|
14
14
|
} & CommonGridProps;
|
|
15
15
|
/** Component that handles all */
|
|
16
16
|
export default function BaseGrid({ rows, columns, GridRowsComponent, GridColumnsComponent, ...props }: BaseGridProps): import("react").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
2
2
|
import { useCallback } from 'octane';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OctaneNode } from 'octane';
|
|
4
4
|
import type { GlyphProps, GlyphsProps } from '../../types';
|
|
5
5
|
import AnimatedGlyphs from './private/AnimatedGlyphs.tsrx';
|
|
6
6
|
import type { BaseGlyphSeriesProps } from './private/BaseGlyphSeries.tsrx';
|
|
@@ -15,7 +15,7 @@ export default function AnimatedGlyphSeries<
|
|
|
15
15
|
renderGlyph = defaultRenderGlyph,
|
|
16
16
|
...props
|
|
17
17
|
}: Omit<BaseGlyphSeriesProps<XScale, YScale, Datum>, 'renderGlyphs'> & {
|
|
18
|
-
renderGlyph?:
|
|
18
|
+
renderGlyph?: (props: GlyphProps<Datum>) => OctaneNode;
|
|
19
19
|
}) {
|
|
20
20
|
const renderGlyphs = useCallback(
|
|
21
21
|
(glyphsProps: GlyphsProps<XScale, YScale, Datum>) => (
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
2
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OctaneNode } from 'octane';
|
|
4
4
|
import type { GlyphProps } from '../../types';
|
|
5
5
|
import type { BaseGlyphSeriesProps } from './private/BaseGlyphSeries.tsrx';
|
|
6
6
|
export default function AnimatedGlyphSeries<XScale extends AxisScale, YScale extends AxisScale, Datum extends object>({ renderGlyph, ...props }: Omit<BaseGlyphSeriesProps<XScale, YScale, Datum>, 'renderGlyphs'> & {
|
|
7
|
-
renderGlyph?:
|
|
7
|
+
renderGlyph?: (props: GlyphProps<Datum>) => OctaneNode;
|
|
8
8
|
}): import("react").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
2
2
|
import { Fragment, useCallback } from 'octane';
|
|
3
|
-
import type { FC } from 'react';
|
|
4
3
|
import type { OctaneNode } from 'octane';
|
|
5
4
|
import type { GlyphProps, GlyphsProps } from '../../types';
|
|
6
5
|
import type { BaseGlyphSeriesProps } from './private/BaseGlyphSeries.tsrx';
|
|
@@ -11,7 +10,7 @@ export default function GlyphSeries<XScale extends AxisScale, YScale extends Axi
|
|
|
11
10
|
renderGlyph = defaultRenderGlyph,
|
|
12
11
|
...props
|
|
13
12
|
}: Omit<BaseGlyphSeriesProps<XScale, YScale, Datum>, 'renderGlyphs'> & {
|
|
14
|
-
renderGlyph?:
|
|
13
|
+
renderGlyph?: (props: GlyphProps<Datum>) => OctaneNode;
|
|
15
14
|
}) {
|
|
16
15
|
const renderGlyphs = useCallback(
|
|
17
16
|
({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
2
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OctaneNode } from 'octane';
|
|
4
4
|
import type { GlyphProps } from '../../types';
|
|
5
5
|
import type { BaseGlyphSeriesProps } from './private/BaseGlyphSeries.tsrx';
|
|
6
6
|
export default function GlyphSeries<XScale extends AxisScale, YScale extends AxisScale, Datum extends object>({ renderGlyph, ...props }: Omit<BaseGlyphSeriesProps<XScale, YScale, Datum>, 'renderGlyphs'> & {
|
|
7
|
-
renderGlyph?:
|
|
7
|
+
renderGlyph?: (props: GlyphProps<Datum>) => OctaneNode;
|
|
8
8
|
}): import("react").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
2
2
|
import { useMemo } from 'octane';
|
|
3
|
-
import type { FC } from 'react';
|
|
4
3
|
import type { OctaneNode } from 'octane';
|
|
5
4
|
import {
|
|
6
5
|
useTransition as useSpringTransition,
|
|
@@ -72,7 +71,7 @@ export default function AnimatedGlyphs<XScale extends AxisScale, YScale extends
|
|
|
72
71
|
// unanimated Glyph component
|
|
73
72
|
// unanimated Glyph component
|
|
74
73
|
// unanimated Glyph component
|
|
75
|
-
renderGlyph:
|
|
74
|
+
renderGlyph: (props: GlyphProps<Datum>) => OctaneNode;
|
|
76
75
|
} & GlyphsProps<XScale, YScale, Datum>) {
|
|
77
76
|
const animatedGlyphs = useSpringTransition(glyphs, {
|
|
78
77
|
...useAnimatedGlyphsConfig({ xScale, yScale, horizontal }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
2
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
3
|
-
import type {
|
|
3
|
+
import type { OctaneNode } from 'octane';
|
|
4
4
|
import type { GlyphProps, GlyphsProps } from '../../../types';
|
|
5
5
|
/** Memoized useTransition config */
|
|
6
6
|
export declare function useAnimatedGlyphsConfig<XScale extends AxisScale, YScale extends AxisScale, Datum extends object>({ xScale, yScale, horizontal, }: {
|
|
@@ -36,5 +36,5 @@ export declare function useAnimatedGlyphsConfig<XScale extends AxisScale, YScale
|
|
|
36
36
|
keys: (glyph: GlyphProps<Datum>) => string;
|
|
37
37
|
};
|
|
38
38
|
export default function AnimatedGlyphs<XScale extends AxisScale, YScale extends AxisScale, Datum extends object>({ renderGlyph, glyphs, horizontal, xScale, yScale, onBlur, onFocus, onPointerMove, onPointerOut, onPointerUp, }: {
|
|
39
|
-
renderGlyph:
|
|
39
|
+
renderGlyph: (props: GlyphProps<Datum>) => OctaneNode;
|
|
40
40
|
} & GlyphsProps<XScale, YScale, Datum>): import("react").JSX.Element;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Fragment, useContext, useCallback, useMemo, useEffect } from 'octane';
|
|
2
|
-
import type { FC } from 'react';
|
|
3
2
|
import type { Octane } from 'octane/jsx-runtime';
|
|
4
3
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
5
4
|
import type { AreaProps, LinePathProps } from '@octanejs/visx/shape';
|
|
6
5
|
import { Area, LinePath } from '@octanejs/visx/shape';
|
|
7
6
|
import DataContext from '../../../context/DataContext.tsrx';
|
|
8
7
|
import type { DataContextType, GlyphsProps, SeriesProps } from '../../../types';
|
|
8
|
+
import type { SvgPathComponent } from '../../../types/svgPath';
|
|
9
9
|
import getScaledValueFactory from '../../../utils/getScaledValueFactory';
|
|
10
10
|
import getScaleBaseline from '../../../utils/getScaleBaseline';
|
|
11
11
|
import isValidNumber from '../../../typeguards/isValidNumber';
|
|
@@ -31,8 +31,11 @@ export type BaseAreaSeriesProps<XScale extends AxisScale, YScale extends AxisSca
|
|
|
31
31
|
| 'children'
|
|
32
32
|
| 'defined'>;
|
|
33
33
|
/** Rendered component which is passed path props by BaseAreaSeries after processing. */
|
|
34
|
-
PathComponent?:
|
|
35
|
-
} & Omit<
|
|
34
|
+
PathComponent?: SvgPathComponent;
|
|
35
|
+
} & Omit<
|
|
36
|
+
Octane.SVGProps<SVGPathElement>,
|
|
37
|
+
'x' | 'y' | 'x0' | 'x1' | 'y0' | 'y1' | 'ref' | 'children'
|
|
38
|
+
>;
|
|
36
39
|
|
|
37
40
|
function BaseAreaSeries<XScale extends AxisScale, YScale extends AxisScale, Datum extends object>({
|
|
38
41
|
PathComponent = 'path',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Generated by scripts/generate-tsrx-types.mjs.
|
|
2
|
-
import type { FC } from 'react';
|
|
3
2
|
import type { Octane } from 'octane/jsx-runtime';
|
|
4
3
|
import type { AxisScale } from '@octanejs/visx/axis';
|
|
5
4
|
import type { AreaProps, LinePathProps } from '@octanejs/visx/shape';
|
|
6
5
|
import type { SeriesProps } from '../../../types';
|
|
6
|
+
import type { SvgPathComponent } from '../../../types/svgPath';
|
|
7
7
|
export type BaseAreaSeriesProps<XScale extends AxisScale, YScale extends AxisScale, Datum extends object> = SeriesProps<XScale, YScale, Datum> & {
|
|
8
8
|
/** Optional accessor to override the baseline value of Area shapes per datum (useful to generate band shapes) when chart is rendered horizontally (vertical line). Defaults to the scale zero value, not compatible with AreaStack. */
|
|
9
9
|
x0Accessor?: SeriesProps<XScale, YScale, Datum>['xAccessor'];
|
|
@@ -16,6 +16,6 @@ export type BaseAreaSeriesProps<XScale extends AxisScale, YScale extends AxisSca
|
|
|
16
16
|
/** Props to be passed to the Line, if rendered. */
|
|
17
17
|
lineProps?: Omit<LinePathProps<Datum> & Octane.SVGProps<SVGPathElement>, 'data' | 'x' | 'y' | 'children' | 'defined'>;
|
|
18
18
|
/** Rendered component which is passed path props by BaseAreaSeries after processing. */
|
|
19
|
-
PathComponent?:
|
|
20
|
-
} & Omit<Octane.SVGProps<SVGPathElement>, 'x' | 'y' | 'x0' | 'x1' | 'y0' | 'y1' | 'ref'>;
|
|
19
|
+
PathComponent?: SvgPathComponent;
|
|
20
|
+
} & Omit<Octane.SVGProps<SVGPathElement>, 'x' | 'y' | 'x0' | 'x1' | 'y0' | 'y1' | 'ref' | 'children'>;
|
|
21
21
|
export default function BaseAreaSeriesWithRegisteredData<XScale extends AxisScale, YScale extends AxisScale, Datum extends object>(props: BaseAreaSeriesProps<XScale, YScale, Datum>): import("react").JSX.Element | null;
|