@octanejs/visx 0.1.36 → 0.1.38

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 (98) hide show
  1. package/package.json +4 -4
  2. package/src/annotation/components/EditableAnnotation.tsrx +6 -3
  3. package/src/annotation/components/EditableAnnotation.tsrx.d.ts +2 -2
  4. package/src/annotation/components/Label.tsrx +11 -2
  5. package/src/axis/axis/Axis.tsrx +4 -2
  6. package/src/brush/BaseBrush.tsrx +6 -7
  7. package/src/brush/BaseBrush.tsrx.d.ts +2 -3
  8. package/src/brush/BrushOverlay.tsrx +11 -8
  9. package/src/brush/BrushOverlay.tsrx.d.ts +3 -8
  10. package/src/brush/BrushSelection.tsrx +2 -3
  11. package/src/brush/BrushSelection.tsrx.d.ts +1 -2
  12. package/src/internal/useMeasure.tsrx +1 -1
  13. package/src/internal/useMeasure.tsrx.d.ts +1 -1
  14. package/src/legend/legends/Legend/LegendItem.tsrx +2 -2
  15. package/src/legend/legends/Legend/LegendItem.tsrx.d.ts +2 -2
  16. package/src/legend/legends/Legend/LegendLabel.tsrx +2 -2
  17. package/src/legend/legends/Legend/LegendLabel.tsrx.d.ts +2 -2
  18. package/src/legend/legends/Legend/index.tsrx +30 -31
  19. package/src/legend/types/index.ts +3 -6
  20. package/src/responsive/types/index.ts +3 -21
  21. package/src/sankey/Sankey.tsrx +9 -5
  22. package/src/sankey/Sankey.tsrx.d.ts +3 -3
  23. package/src/shape/shapes/Bar.tsrx +2 -1
  24. package/src/shape/shapes/Bar.tsrx.d.ts +2 -1
  25. package/src/shape/shapes/BarRounded.tsrx +2 -1
  26. package/src/shape/shapes/BarRounded.tsrx.d.ts +2 -1
  27. package/src/shape/shapes/Line.tsrx +2 -1
  28. package/src/shape/shapes/Line.tsrx.d.ts +2 -1
  29. package/src/shape/shapes/LinePath.tsrx +2 -1
  30. package/src/shape/shapes/LinePath.tsrx.d.ts +2 -1
  31. package/src/shape/types/area.ts +2 -1
  32. package/src/text/types.ts +4 -3
  33. package/src/tooltip/enhancers/withTooltip.tsrx +14 -9
  34. package/src/tooltip/enhancers/withTooltip.tsrx.d.ts +5 -4
  35. package/src/tooltip/floating/ChartTooltip.tsrx +3 -2
  36. package/src/tooltip/floating/ChartTooltip.tsrx.d.ts +1 -2
  37. package/src/tooltip/floating/ChartTooltipContent.tsrx +7 -6
  38. package/src/tooltip/floating/ChartTooltipContent.tsrx.d.ts +6 -6
  39. package/src/tooltip/floating/FloatingTooltip.tsrx +24 -18
  40. package/src/tooltip/floating/FloatingTooltip.tsrx.d.ts +7 -7
  41. package/src/tooltip/floating/context.tsrx +0 -1
  42. package/src/tooltip/floating/context.tsrx.d.ts +1 -2
  43. package/src/tooltip/floating/internalTypes.ts +13 -109
  44. package/src/tooltip/floating/types.ts +29 -26
  45. package/src/tooltip/floating/useChartTooltip.tsrx +1 -2
  46. package/src/tooltip/floating/useChartTooltip.tsrx.d.ts +1 -2
  47. package/src/tooltip/floating/useFloatingTooltip.tsrx +11 -6
  48. package/src/tooltip/hooks/useTooltipInPortal.tsrx +2 -2
  49. package/src/tooltip/hooks/useTooltipInPortal.tsrx.d.ts +2 -2
  50. package/src/tooltip/tooltips/Tooltip.tsrx +5 -2
  51. package/src/tooltip/tooltips/Tooltip.tsrx.d.ts +3 -2
  52. package/src/tooltip/tooltips/TooltipWithBounds.tsrx +9 -3
  53. package/src/tooltip/tooltips/TooltipWithBounds.tsrx.d.ts +6 -4
  54. package/src/xychart/components/Tooltip.tsrx +0 -2
  55. package/src/xychart/components/XYChart.tsrx +0 -1
  56. package/src/xychart/components/XYChart.tsrx.d.ts +0 -1
  57. package/src/xychart/components/annotation/private/BaseAnnotation.tsrx +2 -2
  58. package/src/xychart/components/annotation/private/BaseAnnotation.tsrx.d.ts +2 -2
  59. package/src/xychart/components/axis/BaseAxis.tsrx +2 -2
  60. package/src/xychart/components/axis/BaseAxis.tsrx.d.ts +2 -2
  61. package/src/xychart/components/grid/BaseGrid.tsrx +3 -3
  62. package/src/xychart/components/grid/BaseGrid.tsrx.d.ts +3 -3
  63. package/src/xychart/components/series/AnimatedGlyphSeries.tsrx +2 -2
  64. package/src/xychart/components/series/AnimatedGlyphSeries.tsrx.d.ts +2 -2
  65. package/src/xychart/components/series/GlyphSeries.tsrx +1 -2
  66. package/src/xychart/components/series/GlyphSeries.tsrx.d.ts +2 -2
  67. package/src/xychart/components/series/private/AnimatedGlyphs.tsrx +1 -2
  68. package/src/xychart/components/series/private/AnimatedGlyphs.tsrx.d.ts +2 -2
  69. package/src/xychart/components/series/private/BaseAreaSeries.tsrx +6 -3
  70. package/src/xychart/components/series/private/BaseAreaSeries.tsrx.d.ts +3 -3
  71. package/src/xychart/components/series/private/BaseAreaStack.tsrx +36 -28
  72. package/src/xychart/components/series/private/BaseAreaStack.tsrx.d.ts +4 -4
  73. package/src/xychart/components/series/private/BaseBarGroup.tsrx +3 -5
  74. package/src/xychart/components/series/private/BaseBarGroup.tsrx.d.ts +2 -3
  75. package/src/xychart/components/series/private/BaseBarSeries.tsrx +2 -2
  76. package/src/xychart/components/series/private/BaseBarSeries.tsrx.d.ts +2 -2
  77. package/src/xychart/components/series/private/BaseBarStack.tsrx +11 -7
  78. package/src/xychart/components/series/private/BaseBarStack.tsrx.d.ts +3 -3
  79. package/src/xychart/components/series/private/BaseLineSeries.tsrx +6 -3
  80. package/src/xychart/components/series/private/BaseLineSeries.tsrx.d.ts +3 -3
  81. package/src/xychart/hooks/useEventEmitter.tsrx +1 -2
  82. package/src/xychart/hooks/useEventEmitter.tsrx.d.ts +1 -2
  83. package/src/xychart/hooks/useEventEmitters.tsrx +0 -1
  84. package/src/xychart/hooks/useEventEmitters.tsrx.d.ts +0 -1
  85. package/src/xychart/hooks/useEventHandlers.tsrx +0 -1
  86. package/src/xychart/hooks/useEventHandlers.tsrx.d.ts +0 -1
  87. package/src/xychart/hooks/useSeriesEvents.tsrx +0 -1
  88. package/src/xychart/hooks/useSeriesEvents.tsrx.d.ts +0 -1
  89. package/src/xychart/hooks/useStackedData.tsrx.d.ts +1 -1
  90. package/src/xychart/typeguards/events.ts +0 -2
  91. package/src/xychart/types/series.ts +0 -1
  92. package/src/xychart/types/svgPath.ts +5 -0
  93. package/src/xychart/types/theme.ts +4 -3
  94. package/src/xychart/utils/combineBarStackData.ts +1 -2
  95. package/src/xychart/utils/getChildrenAndGrandchildrenWithProps.ts +4 -5
  96. package/src/zoom/Zoom.tsrx +22 -20
  97. package/src/zoom/Zoom.tsrx.d.ts +3 -3
  98. package/src/zoom/types.ts +14 -27
@@ -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: React.RefCallback<HTMLElement | SVGElement>;
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: React.RefCallback<HTMLElement | SVGElement>;
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 React from 'react';
12
+ import type { Octane } from 'octane/jsx-runtime';
13
13
  import { getTooltipAnchorReference } from './anchors';
14
14
  import { buildFloatingTooltipMiddleware } from './middleware';
15
- import type { OpenChangeReason, ReferenceElement, UseFloatingReturn } from './internalTypes';
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 React.HTMLProps<HTMLElement>>(
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 React.HTMLProps<HTMLElement>>(props?: TProps) => getFloatingProps(
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 React.HTMLProps<Element>>(props?: TProps) =>
298
+ getReferenceProps: <TProps extends HTMLProps<Element>>(props?: TProps) =>
294
299
  getReferenceProps(props) as TProps,
295
300
  getFloatingProps: getFloatingPropsWithId,
296
- getArrowProps: <TProps extends React.SVGProps<SVGSVGElement>>(props?: TProps) => {
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 { FC } from 'react';
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: FC<TooltipInPortalProps>;
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 { FC } from 'react';
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: FC<TooltipInPortalProps>;
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, HTMLAttributes, Ref } from 'react';
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> & { ref?: Ref<HTMLDivElement> }) => <div
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, HTMLAttributes, Ref } from 'react';
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 { HTMLAttributes, Ref, CSSProperties } from 'react';
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
- export default withBoundingRects(TooltipWithBounds)
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 { HTMLAttributes, Ref } from 'react';
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 _default: any;
9
- export default _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';
@@ -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 { FC } from 'react';
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: FC<AnnotationProps> | FC<EditableAnnotationProps>;
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 { FC } from 'react';
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: FC<AnnotationProps> | FC<EditableAnnotationProps>;
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 { FC } from 'react';
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: FC<VxAxisProps<Scale>>;
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 { FC } from 'react';
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: FC<VxAxisProps<Scale>>;
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 { FC } from 'react';
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: FC<AllGridRowsProps<AxisScale>>;
13
+ GridRowsComponent: ComponentBody<AllGridRowsProps<AxisScale>>;
14
14
  /** Rendered GridColumns component which is passed GridColumnsProps by BaseGrid. */
15
- GridColumnsComponent: FC<GridColumnsProps<AxisScale>>;
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 { FC } from 'react';
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: FC<AllGridRowsProps<AxisScale>>;
11
+ GridRowsComponent: ComponentBody<AllGridRowsProps<AxisScale>>;
12
12
  /** Rendered GridColumns component which is passed GridColumnsProps by BaseGrid. */
13
- GridColumnsComponent: FC<GridColumnsProps<AxisScale>>;
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 { FC } from 'react';
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?: FC<GlyphProps<Datum>>;
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 { FC } from 'react';
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?: FC<GlyphProps<Datum>>;
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?: FC<GlyphProps<Datum>>;
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 { FC } from 'react';
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?: FC<GlyphProps<Datum>>;
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: FC<GlyphProps<Datum>>;
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 { FC } from 'react';
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: FC<GlyphProps<Datum>>;
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?: FC<Omit<Octane.SVGProps<SVGPathElement>, 'ref'>> | 'path';
35
- } & Omit<Octane.SVGProps<SVGPathElement>, 'x' | 'y' | 'x0' | 'x1' | 'y0' | 'y1' | 'ref'>;
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?: FC<Omit<Octane.SVGProps<SVGPathElement>, 'ref'>> | 'path';
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;
@@ -1,5 +1,5 @@
1
- import { Fragment, createElement, useCallback, useContext, useMemo } from 'octane';
2
- import type { ReactElement, FC } from 'react';
1
+ import { Fragment, useCallback, useContext, useMemo } from 'octane';
2
+ import type { ElementDescriptor } from 'octane';
3
3
  import type { Octane } from 'octane/jsx-runtime';
4
4
  import type { AxisScale } from '@octanejs/visx/axis';
5
5
  import type { SeriesPoint } from 'd3-shape';
@@ -15,6 +15,7 @@ import type {
15
15
  NearestDatumReturnType,
16
16
  SeriesProps,
17
17
  } from '../../../types';
18
+ import type { SvgPathComponent } from '../../../types/svgPath';
18
19
  import DataContext from '../../../context/DataContext.tsrx';
19
20
  import type { BaseAreaSeriesProps } from './BaseAreaSeries.tsrx';
20
21
  import { BaseGlyphSeries } from './BaseGlyphSeries.tsrx';
@@ -23,6 +24,7 @@ import { getStackValue } from '../../../utils/combineBarStackData';
23
24
  import isValidNumber from '../../../typeguards/isValidNumber';
24
25
  import findNearestStackDatum from '../../../utils/findNearestStackDatum';
25
26
  import { AREASTACK_EVENT_SOURCE, XYCHART_EVENT_SOURCE } from '../../../constants';
27
+ import type { SeriesEventsParams } from '../../../hooks/useSeriesEvents.tsrx';
26
28
  import useSeriesEvents from '../../../hooks/useSeriesEvents.tsrx';
27
29
  import defaultRenderGlyph from './defaultRenderGlyph.tsrx';
28
30
  import getScaleBandwidth from '../../../utils/getScaleBandwidth';
@@ -36,10 +38,10 @@ type AreaStackDatum<XScale extends AxisScale, YScale extends AxisScale> =
36
38
  export type BaseAreaStackProps<XScale extends AxisScale, YScale extends AxisScale, Datum extends object> =
37
39
  {
38
40
  /** `AreaSeries` elements, note we can't strictly enforce this with TS yet. */
39
- children: | ReactElement<AreaStackChildProps<XScale, YScale, Datum>>
40
- | ReactElement<AreaStackChildProps<XScale, YScale, Datum>>[];
41
+ children: | ElementDescriptor<AreaStackChildProps<XScale, YScale, Datum>>
42
+ | ElementDescriptor<AreaStackChildProps<XScale, YScale, Datum>>[];
41
43
  /** Rendered component which is passed path props by BaseAreaStack after processing. */
42
- PathComponent?: FC<Omit<Octane.SVGProps<SVGPathElement>, 'ref'>> | 'path';
44
+ PathComponent?: SvgPathComponent;
43
45
  /** Sets the curve factory (from @octanejs/visx/curve or d3-curve) for the line generator. Defaults to curveLinear. */
44
46
  curve?: AreaProps<Datum>['curve'];
45
47
  /** Whether to render a Line along value of the Area shape (area is fill only). */
@@ -53,7 +55,9 @@ export type BaseAreaStackProps<XScale extends AxisScale, YScale extends AxisScal
53
55
  | 'onFocus'
54
56
  | 'enableEvents'>;
55
57
 
56
- const identity = (_: unknown) => _;
58
+ function identity<T>(value: T): T {
59
+ return value;
60
+ }
57
61
 
58
62
  function BaseAreaStack<XScale extends AxisScale, YScale extends AxisScale, Datum extends object>({
59
63
  PathComponent = 'path',
@@ -118,7 +122,7 @@ function BaseAreaStack<XScale extends AxisScale, YScale extends AxisScale, Datum
118
122
  // pull out all area + line props for each dataKey
119
123
  const stacks = useMemo(
120
124
  () => stackedData.map((stack, stackIndex) => {
121
- const areaSeries: ReactElement<BaseAreaSeriesProps<XScale, YScale, Datum>> | undefined =
125
+ const areaSeries: ElementDescriptor<BaseAreaSeriesProps<XScale, YScale, Datum>> | undefined =
122
126
  seriesChildren.find((child) => child.props.dataKey === stack.key);
123
127
  const {
124
128
  data,
@@ -163,9 +167,11 @@ function BaseAreaStack<XScale extends AxisScale, YScale extends AxisScale, Datum
163
167
  const eventEmitters = useSeriesEvents<XScale, YScale, Datum>({
164
168
  dataKey: dataKeys,
165
169
  enableEvents,
166
- // @ts-expect-error Datum input + return type are expected to be the same type but they differ
167
- // for AreaStack (registry data is StackedDatum, return type is user Datum)
168
- findNearestDatum,
170
+ findNearestDatum: findNearestDatum as unknown as SeriesEventsParams<
171
+ XScale,
172
+ YScale,
173
+ Datum
174
+ >['findNearestDatum'],
169
175
  onBlur,
170
176
  onFocus,
171
177
  onPointerMove,
@@ -196,22 +202,24 @@ function BaseAreaStack<XScale extends AxisScale, YScale extends AxisScale, Datum
196
202
  if (dataKeys.some((key) => dataRegistry.get(key) == null) || !xScale || !yScale || !colorScale) {
197
203
  return null;
198
204
  }
199
- const areaNodes = stacks.map(
200
- (stack) => createElement(
201
- Area,
202
- { key: stack.key, curve, ...stack.accessors },
203
- ({ path }: { path: (data: typeof stack.data) => string | null }) => createElement(
204
- PathComponent,
205
- {
206
- className: 'visx-area',
207
- stroke: 'transparent',
208
- d: path(stack.data) || '',
209
- ...stack.areaProps,
210
- ...eventEmitters,
211
- },
212
- ),
213
- ),
214
- );
205
+ const areaNodes = stacks.map(function (stack) {
206
+ function renderAreaPath(args: { path: (data: typeof stack.data) => string | null }) {
207
+ return (
208
+ <PathComponent
209
+ className="visx-area"
210
+ stroke="transparent"
211
+ d={args.path(stack.data) || ''}
212
+ {...stack.areaProps}
213
+ {...eventEmitters}
214
+ />
215
+ );
216
+ }
217
+ return (
218
+ <Area key={stack.key} curve={curve} {...stack.accessors}>
219
+ {renderAreaPath}
220
+ </Area>
221
+ );
222
+ });
215
223
 
216
224
  return <g className="visx-area-stack">
217
225
  {areaNodes}
@@ -249,8 +257,8 @@ function BaseAreaStack<XScale extends AxisScale, YScale extends AxisScale, Datum
249
257
  data={stack.data}
250
258
  xAccessor={stack.accessors.x || stack.accessors.x1}
251
259
  yAccessor={stack.accessors.y || stack.accessors.y1}
252
- xScale={identity}
253
- yScale={identity}
260
+ xScale={identity as unknown as XScale}
261
+ yScale={identity as unknown as YScale}
254
262
  renderGlyphs={renderGlyphs}
255
263
  />;
256
264
  })}
@@ -1,16 +1,16 @@
1
1
  // Generated by scripts/generate-tsrx-types.mjs.
2
- import type { ReactElement, FC } from 'react';
3
- import type { Octane } from 'octane/jsx-runtime';
2
+ import type { ElementDescriptor } from 'octane';
4
3
  import type { AxisScale } from '@octanejs/visx/axis';
5
4
  import type { StackPathConfig, AreaProps } from '@octanejs/visx/shape';
6
5
  import type { SeriesProps } from '../../../types';
6
+ import type { SvgPathComponent } from '../../../types/svgPath';
7
7
  import type { BaseAreaSeriesProps } from './BaseAreaSeries.tsrx';
8
8
  type AreaStackChildProps<XScale extends AxisScale, YScale extends AxisScale, Datum extends object> = Omit<BaseAreaSeriesProps<XScale, YScale, Datum>, 'PathComponent' | 'curve'>;
9
9
  export type BaseAreaStackProps<XScale extends AxisScale, YScale extends AxisScale, Datum extends object> = {
10
10
  /** `AreaSeries` elements, note we can't strictly enforce this with TS yet. */
11
- children: ReactElement<AreaStackChildProps<XScale, YScale, Datum>> | ReactElement<AreaStackChildProps<XScale, YScale, Datum>>[];
11
+ children: ElementDescriptor<AreaStackChildProps<XScale, YScale, Datum>> | ElementDescriptor<AreaStackChildProps<XScale, YScale, Datum>>[];
12
12
  /** Rendered component which is passed path props by BaseAreaStack after processing. */
13
- PathComponent?: FC<Omit<Octane.SVGProps<SVGPathElement>, 'ref'>> | 'path';
13
+ PathComponent?: SvgPathComponent;
14
14
  /** Sets the curve factory (from @octanejs/visx/curve or d3-curve) for the line generator. Defaults to curveLinear. */
15
15
  curve?: AreaProps<Datum>['curve'];
16
16
  /** Whether to render a Line along value of the Area shape (area is fill only). */