From 61ebd8d4b9778c150625b796dbdf4499d0790a0f Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Thu, 7 Oct 2021 16:44:03 -0500 Subject: [PATCH 01/12] feat(types): improve generic types in specs, and spec prop types --- .../layout/types/viewmodel_types.ts | 4 +- .../src/chart_types/goal_chart/specs/index.ts | 48 ++--- .../src/chart_types/heatmap/specs/heatmap.ts | 86 ++++---- .../heatmap/state/selectors/heatmap_spec.ts | 4 +- .../partition_chart/specs/index.ts | 108 +++++----- .../src/chart_types/wordcloud/specs/index.ts | 51 ++--- .../chart_types/xy_chart/specs/area_series.ts | 53 +++++ .../xy_chart/specs/area_series.tsx | 46 ----- .../src/chart_types/xy_chart/specs/axis.ts | 36 ++++ .../src/chart_types/xy_chart/specs/axis.tsx | 35 ---- .../chart_types/xy_chart/specs/bar_series.ts | 53 +++++ .../chart_types/xy_chart/specs/bar_series.tsx | 46 ----- .../xy_chart/specs/bubble_series.ts | 52 +++++ .../xy_chart/specs/bubble_series.tsx | 46 ----- .../xy_chart/specs/histogram_bar_series.ts | 53 +++++ .../xy_chart/specs/histogram_bar_series.tsx | 46 ----- .../xy_chart/specs/line_annotation.ts | 52 +++++ .../xy_chart/specs/line_annotation.tsx | 40 ---- .../chart_types/xy_chart/specs/line_series.ts | 53 +++++ .../xy_chart/specs/line_series.tsx | 45 ----- .../xy_chart/specs/rect_annotation.ts | 33 +++ .../xy_chart/specs/rect_annotation.tsx | 38 ---- .../src/chart_types/xy_chart/utils/specs.ts | 85 ++++---- packages/charts/src/specs/constants.ts | 53 +++-- packages/charts/src/specs/group_by.ts | 53 +++-- packages/charts/src/specs/settings.tsx | 56 ++---- packages/charts/src/specs/small_multiples.ts | 30 +-- packages/charts/src/state/spec_factory.ts | 190 ++++++++++++++---- packages/charts/src/utils/accessor.ts | 13 +- packages/charts/src/utils/common.tsx | 3 +- 30 files changed, 832 insertions(+), 679 deletions(-) create mode 100644 packages/charts/src/chart_types/xy_chart/specs/area_series.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/area_series.tsx create mode 100644 packages/charts/src/chart_types/xy_chart/specs/axis.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/axis.tsx create mode 100644 packages/charts/src/chart_types/xy_chart/specs/bar_series.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/bar_series.tsx create mode 100644 packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/bubble_series.tsx create mode 100644 packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.tsx create mode 100644 packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/line_annotation.tsx create mode 100644 packages/charts/src/chart_types/xy_chart/specs/line_series.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/line_series.tsx create mode 100644 packages/charts/src/chart_types/xy_chart/specs/rect_annotation.ts delete mode 100644 packages/charts/src/chart_types/xy_chart/specs/rect_annotation.tsx diff --git a/packages/charts/src/chart_types/goal_chart/layout/types/viewmodel_types.ts b/packages/charts/src/chart_types/goal_chart/layout/types/viewmodel_types.ts index 4699e2b444..408e8bd106 100644 --- a/packages/charts/src/chart_types/goal_chart/layout/types/viewmodel_types.ts +++ b/packages/charts/src/chart_types/goal_chart/layout/types/viewmodel_types.ts @@ -58,8 +58,6 @@ export type ShapeViewModel = { }; const commonDefaults = { - specType: SpecType.Series, - subtype: GoalSubtype.Goal, base: 0, actual: 50, ticks: [0, 25, 50, 75, 100], @@ -85,6 +83,8 @@ export const defaultGoalSpec = { /** @internal */ export const nullGoalViewModel = { ...commonDefaults, + specType: SpecType.Series, + subtype: GoalSubtype.Goal, bands: [], ticks: [], labelMajor: '', diff --git a/packages/charts/src/chart_types/goal_chart/specs/index.ts b/packages/charts/src/chart_types/goal_chart/specs/index.ts index ab0e103650..70e81ee436 100644 --- a/packages/charts/src/chart_types/goal_chart/specs/index.ts +++ b/packages/charts/src/chart_types/goal_chart/specs/index.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -import React from 'react'; +import { ComponentProps } from 'react'; import { ChartType } from '../..'; import { Color } from '../../../common/colors'; import { Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; -import { getConnect, specComponentFactory } from '../../../state/spec_factory'; +import { specComponentFactory } from '../../../state/spec_factory'; import { LabelAccessor, RecursivePartial } from '../../../utils/common'; import { Config } from '../layout/types/config_types'; import { defaultGoalSpec } from '../layout/types/viewmodel_types'; @@ -36,11 +36,6 @@ export type BandFillColorAccessor = (input: BandFillColorAccessorInput) => Color /** @alpha */ export type GoalLabelAccessor = LabelAccessor; -const defaultProps = { - chartType: ChartType.Goal, - ...defaultGoalSpec, -}; - /** @alpha */ export interface GoalSpec extends Spec { specType: typeof SpecType.Series; @@ -67,28 +62,19 @@ export interface GoalSpec extends Spec { bandLabels: string[]; } -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; - -/** @alpha */ -export const Goal: React.FunctionComponent = getConnect()( - specComponentFactory< - GoalSpec, - | 'chartType' - | 'subtype' - | 'base' - | 'target' - | 'actual' - | 'bands' - | 'bandLabels' - | 'ticks' - | 'bandFillColor' - | 'tickValueFormatter' - | 'labelMajor' - | 'labelMinor' - | 'centralMajor' - | 'centralMinor' - | 'angleStart' - | 'angleEnd' - >(defaultProps), +/** + * Add Goal spec to chart + * @alpha + */ +export const Goal = specComponentFactory()( + { + specType: SpecType.Series, + chartType: ChartType.Goal, + }, + { + ...defaultGoalSpec, + }, ); + +/** @public */ +export type GoalProps = ComponentProps; diff --git a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts index 36a8fe96f7..0bb20d65c8 100644 --- a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts +++ b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts @@ -6,35 +6,21 @@ * Side Public License, v 1. */ -import React from 'react'; +import { ComponentProps, useRef } from 'react'; import { ChartType } from '../..'; import { Color } from '../../../common/colors'; import { Predicate } from '../../../common/predicate'; import { ScaleType } from '../../../scales/constants'; -import { SeriesScales, Spec } from '../../../specs'; +import { BaseDatum, SeriesScales, Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; -import { getConnect, specComponentFactory } from '../../../state/spec_factory'; +import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; import { Accessor, AccessorFn } from '../../../utils/accessor'; -import { Datum, RecursivePartial } from '../../../utils/common'; +import { RecursivePartial } from '../../../utils/common'; import { config } from '../layout/config/config'; import { Config } from '../layout/types/config_types'; import { X_SCALE_DEFAULT } from './scale_defaults'; -const defaultProps = { - chartType: ChartType.Heatmap, - specType: SpecType.Series, - data: [], - xAccessor: ({ x }: { x: string | number }) => x, - yAccessor: ({ y }: { y: string | number }) => y, - xScaleType: X_SCALE_DEFAULT.type, - valueAccessor: ({ value }: { value: string | number }) => value, - valueFormatter: (value: number) => `${value}`, - xSortPredicate: Predicate.AlphaAsc, - ySortPredicate: Predicate.AlphaAsc, - config, -}; - /** @public */ export type HeatmapScaleType = | typeof ScaleType.Linear @@ -59,13 +45,13 @@ export interface HeatmapBandsColorScale { } /** @alpha */ -export interface HeatmapSpec extends Spec { +export interface HeatmapSpec extends Spec { specType: typeof SpecType.Series; chartType: typeof ChartType.Heatmap; - data: Datum[]; + data: D[]; colorScale: HeatmapBandsColorScale; - xAccessor: Accessor | AccessorFn; - yAccessor: Accessor | AccessorFn; + xAccessor: keyof D | AccessorFn; + yAccessor: keyof D | AccessorFn; valueAccessor: Accessor | AccessorFn; valueFormatter: (value: number) => string; xSortPredicate: Predicate; @@ -76,20 +62,42 @@ export interface HeatmapSpec extends Spec { name?: string; } -/** @alpha */ -export const Heatmap: React.FunctionComponent< - Pick & Partial> -> = getConnect()( - specComponentFactory< - HeatmapSpec, - | 'xAccessor' - | 'yAccessor' - | 'valueAccessor' - | 'data' - | 'ySortPredicate' - | 'xSortPredicate' - | 'valueFormatter' - | 'config' - | 'xScaleType' - >(defaultProps), -); +/** + * Adds heatmap spec to chart specs + * @alpha + */ +export const Heatmap = function ( + props: SFProps< + HeatmapSpec, + keyof typeof buildProps.current['overrides'], + keyof typeof buildProps.current['defaults'], + keyof typeof buildProps.current['optionals'], + keyof typeof buildProps.current['requires'] + >, +) { + const buildProps = useRef( + buildSFProps>()( + { + chartType: ChartType.Heatmap, + specType: SpecType.Series, + }, + { + data: [], + // xAccessor: ({ x }: { x: string | number }) => x, + // yAccessor: ({ y }: { y: string | number }) => y, + valueAccessor: ({ value }) => value, + xScaleType: X_SCALE_DEFAULT.type, + valueFormatter: (value) => `${value}`, + xSortPredicate: Predicate.AlphaAsc, + ySortPredicate: Predicate.AlphaAsc, + config, + }, + ), + ); + const { defaults, overrides } = buildProps.current; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; + +/** @public */ +export type HeatmapProps = ComponentProps; diff --git a/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts b/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts index a34755931e..4f11040d14 100644 --- a/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts +++ b/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts @@ -13,7 +13,7 @@ import { getSpecsFromStore } from '../../../../state/utils'; import { HeatmapSpec } from '../../specs/heatmap'; /** @internal */ -export function getSpecOrNull(state: GlobalChartState): HeatmapSpec | null { - const specs = getSpecsFromStore(state.specs, ChartType.Heatmap, SpecType.Series); +export function getSpecOrNull(state: GlobalChartState): HeatmapSpec | null { + const specs = getSpecsFromStore>(state.specs, ChartType.Heatmap, SpecType.Series); return specs.length > 0 ? specs[0] : null; } diff --git a/packages/charts/src/chart_types/partition_chart/specs/index.ts b/packages/charts/src/chart_types/partition_chart/specs/index.ts index 83a351fed1..633396af84 100644 --- a/packages/charts/src/chart_types/partition_chart/specs/index.ts +++ b/packages/charts/src/chart_types/partition_chart/specs/index.ts @@ -6,26 +6,19 @@ * Side Public License, v 1. */ -import React from 'react'; +import { ComponentProps } from 'react'; import { ChartType } from '../..'; import { Pixels } from '../../../common/geometry'; -import { Spec } from '../../../specs'; +import { BaseDatum, Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; // kept as unshortened import on separate line otherwise import circularity emerges -import { getConnect, specComponentFactory } from '../../../state/spec_factory'; +import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; import { IndexedAccessorFn } from '../../../utils/accessor'; -import { - Datum, - LabelAccessor, - RecursivePartial, - ShowAccessor, - ValueAccessor, - ValueFormatter, -} from '../../../utils/common'; +import { LabelAccessor, RecursivePartial, ShowAccessor, ValueAccessor, ValueFormatter } from '../../../utils/common'; import { config, percentFormatter } from '../layout/config'; import { Config, FillFontSizeRange, FillLabelConfig } from '../layout/types/config_types'; -import { NodeColorAccessor, ShapeTreeNode, ValueGetter } from '../layout/types/viewmodel_types'; -import { AGGREGATE_KEY, NodeSorter, PrimitiveValue } from '../layout/utils/group_by_rollup'; +import { NodeColorAccessor, ValueGetter } from '../layout/types/viewmodel_types'; +import { AGGREGATE_KEY, NodeSorter } from '../layout/utils/group_by_rollup'; interface ExtendedFillLabelConfig extends FillLabelConfig, FillFontSizeRange {} @@ -33,8 +26,8 @@ interface ExtendedFillLabelConfig extends FillLabelConfig, FillFontSizeRange {} * Specification for a given layer in the partition chart * @public */ -export interface Layer { - groupByRollup: IndexedAccessorFn; +export interface Layer { + groupByRollup: IndexedAccessorFn; sortPredicate?: NodeSorter | null; nodeLabel?: LabelAccessor; fillLabel?: Partial; @@ -42,58 +35,65 @@ export interface Layer { shape?: { fillColor: string | NodeColorAccessor }; } -const defaultProps = { - chartType: ChartType.Partition, - specType: SpecType.Series, - config, - valueAccessor: (d: Datum) => (typeof d === 'number' ? d : 0), - valueGetter: (n: ShapeTreeNode): number => n[AGGREGATE_KEY], - valueFormatter: (d: number): string => String(d), - percentFormatter, - topGroove: 20, - smallMultiples: null, - layers: [ - { - groupByRollup: (d: Datum, i: number) => i, - nodeLabel: (d: PrimitiveValue) => String(d), - showAccessor: () => true, - fillLabel: {}, - }, - ], -}; - /** * Specifies the partition chart * @public */ -export interface PartitionSpec extends Spec { +export interface PartitionSpec extends Spec { specType: typeof SpecType.Series; chartType: typeof ChartType.Partition; config: RecursivePartial; - data: Datum[]; - valueAccessor: ValueAccessor; + data: D[]; + valueAccessor: ValueAccessor; valueFormatter: ValueFormatter; valueGetter: ValueGetter; percentFormatter: ValueFormatter; topGroove: Pixels; smallMultiples: string | null; - layers: Layer[]; + layers: Layer[]; } -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; +const buildProps = buildSFProps>()( + { + chartType: ChartType.Partition, + specType: SpecType.Series, + }, + { + config, + valueAccessor: (d) => (typeof d === 'number' ? d : 0), + valueGetter: (n) => n[AGGREGATE_KEY], + valueFormatter: (d) => String(d), + percentFormatter, + topGroove: 20, + smallMultiples: null, + layers: [ + { + groupByRollup: (d, i) => i, + nodeLabel: (d) => String(d), + showAccessor: () => true, + fillLabel: {}, + }, + ], + }, +); + +/** + * Adds partition spec to chart specs + * @public + */ +export const Partition = function ( + props: SFProps< + PartitionSpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; /** @public */ -export const Partition: React.FunctionComponent = getConnect()( - specComponentFactory< - PartitionSpec, - | 'valueAccessor' - | 'valueGetter' - | 'valueFormatter' - | 'layers' - | 'config' - | 'percentFormatter' - | 'topGroove' - | 'smallMultiples' - >(defaultProps), -); +export type PartitionProp = ComponentProps; diff --git a/packages/charts/src/chart_types/wordcloud/specs/index.ts b/packages/charts/src/chart_types/wordcloud/specs/index.ts index beeb51028d..90a77bd687 100644 --- a/packages/charts/src/chart_types/wordcloud/specs/index.ts +++ b/packages/charts/src/chart_types/wordcloud/specs/index.ts @@ -6,13 +6,13 @@ * Side Public License, v 1. */ -import React from 'react'; +import { ComponentProps } from 'react'; import { ChartType } from '../..'; import { FontStyle } from '../../../common/text_utils'; import { Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; -import { getConnect, specComponentFactory } from '../../../state/spec_factory'; +import { specComponentFactory } from '../../../state/spec_factory'; import { RecursivePartial } from '../../../utils/common'; import { config } from '../layout/config/config'; import { @@ -23,13 +23,6 @@ import { Configs as WordcloudConfigs, } from '../layout/types/viewmodel_types'; -const defaultProps = { - chartType: ChartType.Wordcloud, - specType: SpecType.Series, - ...defaultWordcloudSpec, - config, -}; - export { WordModel, WeightFn, OutOfRoomCallback, WordcloudConfigs }; /** @alpha */ @@ -53,28 +46,20 @@ export interface WordcloudSpec extends Spec { outOfRoomCallback: OutOfRoomCallback; } -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; - -/** @alpha */ -export const Wordcloud: React.FunctionComponent = getConnect()( - specComponentFactory< - WordcloudSpec, - | 'chartType' - | 'startAngle' - | 'config' - | 'endAngle' - | 'angleCount' - | 'padding' - | 'fontWeight' - | 'fontFamily' - | 'fontStyle' - | 'minFontSize' - | 'maxFontSize' - | 'spiral' - | 'exponent' - | 'data' - | 'weightFn' - | 'outOfRoomCallback' - >(defaultProps), +/** + * Adds wordcloud spec to chart + * @alpha + */ +export const Wordcloud = specComponentFactory()( + { + specType: SpecType.Series, + chartType: ChartType.Wordcloud, + }, + { + ...defaultWordcloudSpec, + config, + }, ); + +/** @public */ +export type WordcloudProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/area_series.ts b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts new file mode 100644 index 0000000000..b74b2fa79d --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { ScaleType } from '../../../scales/constants'; +import { SpecType } from '../../../specs/constants'; +import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { AreaSeriesSpec, HistogramModeAlignments, DEFAULT_GLOBAL_ID, SeriesType, BaseDatum } from '../utils/specs'; + +const buildProps = buildSFProps>()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Series, + seriesType: SeriesType.Area, + }, + { + groupId: DEFAULT_GLOBAL_ID, + xScaleType: ScaleType.Linear, + yScaleType: ScaleType.Linear, + // xAccessor: 'x', + // yAccessors: ['y'], + hideInLegend: false, + histogramModeAlignment: HistogramModeAlignments.Center, + }, +); + +/** + * Adds bar series to chart specs + * @public + */ +export const AreaSeries = function ( + props: SFProps< + AreaSeriesSpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; + +/** @public */ +export type AreaSeriesProp = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/area_series.tsx b/packages/charts/src/chart_types/xy_chart/specs/area_series.tsx deleted file mode 100644 index 0e5231faf0..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/area_series.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { ScaleType } from '../../../scales/constants'; -import { SpecType } from '../../../specs/constants'; -import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { AreaSeriesSpec, HistogramModeAlignments, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Series, - seriesType: SeriesType.Area, - groupId: DEFAULT_GLOBAL_ID, - xScaleType: ScaleType.Linear, - yScaleType: ScaleType.Linear, - xAccessor: 'x', - yAccessors: ['y'], - hideInLegend: false, - histogramModeAlignment: HistogramModeAlignments.Center, -}; - -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; - -/** @public */ -export const AreaSeries: React.FunctionComponent = getConnect()( - specComponentFactory< - AreaSeriesSpec, - | 'seriesType' - | 'groupId' - | 'xScaleType' - | 'yScaleType' - | 'xAccessor' - | 'yAccessors' - | 'hideInLegend' - | 'histogramModeAlignment' - >(defaultProps), -); diff --git a/packages/charts/src/chart_types/xy_chart/specs/axis.ts b/packages/charts/src/chart_types/xy_chart/specs/axis.ts new file mode 100644 index 0000000000..7b5ce12da7 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/axis.ts @@ -0,0 +1,36 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { SpecType } from '../../../specs/constants'; +import { specComponentFactory } from '../../../state/spec_factory'; +import { Position } from '../../../utils/common'; +import { AxisSpec, DEFAULT_GLOBAL_ID } from '../utils/specs'; + +/** + * Add axis spec to chart + * @public + */ +export const Axis = specComponentFactory()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Axis, + }, + { + groupId: DEFAULT_GLOBAL_ID, + hide: false, + showOverlappingTicks: false, + showOverlappingLabels: false, + position: Position.Left, + }, +); + +/** @public */ +export type AxisProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/axis.tsx b/packages/charts/src/chart_types/xy_chart/specs/axis.tsx deleted file mode 100644 index d80e8c469d..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/axis.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { SpecType } from '../../../specs/constants'; -import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { Position } from '../../../utils/common'; -import { AxisSpec, DEFAULT_GLOBAL_ID } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Axis, - groupId: DEFAULT_GLOBAL_ID, - hide: false, - showOverlappingTicks: false, - showOverlappingLabels: false, - position: Position.Left, -}; - -type SpecRequired = Pick; -type SpecOptionals = Partial>; - -/** @public */ -export const Axis: React.FunctionComponent = getConnect()( - specComponentFactory( - defaultProps, - ), -); diff --git a/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts new file mode 100644 index 0000000000..55cd5b2431 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { ScaleType } from '../../../scales/constants'; +import { SpecType } from '../../../specs/constants'; +import { useSpecFactory, SFProps, buildSFProps } from '../../../state/spec_factory'; +import { BarSeriesSpec, BaseDatum, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; + +const buildProps = buildSFProps>()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Series, + seriesType: SeriesType.Bar, + }, + { + groupId: DEFAULT_GLOBAL_ID, + xScaleType: ScaleType.Ordinal, + yScaleType: ScaleType.Linear, + // xAccessor: 'x', + // yAccessors: ['y'], + hideInLegend: false, + enableHistogramMode: false, + }, +); + +/** + * Adds bar series to chart specs + * @public + */ +export const BarSeries = function ( + props: SFProps< + BarSeriesSpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; + +/** @public */ +export type BarSeriesProp = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bar_series.tsx b/packages/charts/src/chart_types/xy_chart/specs/bar_series.tsx deleted file mode 100644 index 7006236bc7..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/bar_series.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { ScaleType } from '../../../scales/constants'; -import { SpecType } from '../../../specs/constants'; -import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { BarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Series, - seriesType: SeriesType.Bar, - groupId: DEFAULT_GLOBAL_ID, - xScaleType: ScaleType.Ordinal, - yScaleType: ScaleType.Linear, - xAccessor: 'x', - yAccessors: ['y'], - hideInLegend: false, - enableHistogramMode: false, -}; - -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; - -/** @public */ -export const BarSeries: React.FunctionComponent = getConnect()( - specComponentFactory< - BarSeriesSpec, - | 'seriesType' - | 'groupId' - | 'xScaleType' - | 'yScaleType' - | 'xAccessor' - | 'yAccessors' - | 'hideInLegend' - | 'enableHistogramMode' - >(defaultProps), -); diff --git a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts new file mode 100644 index 0000000000..5d1eb05751 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { ScaleType } from '../../../scales/constants'; +import { SpecType } from '../../../specs/constants'; +import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { BaseDatum, BubbleSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; + +const buildProps = buildSFProps>()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Series, + seriesType: SeriesType.Bubble, + }, + { + groupId: DEFAULT_GLOBAL_ID, + xScaleType: ScaleType.Ordinal, + yScaleType: ScaleType.Linear, + // xAccessor: 'x', + // yAccessors: ['y'], + hideInLegend: false, + }, +); + +/** + * Adds bar series to chart specs + * @public + */ +export const BubbleSeries = function ( + props: SFProps< + BubbleSeriesSpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; + +/** @public */ +export type BubbleSeriesProp = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.tsx b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.tsx deleted file mode 100644 index ee37e0d052..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { ScaleType } from '../../../scales/constants'; -import { SpecType } from '../../../specs/constants'; -import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { BubbleSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Series, - seriesType: SeriesType.Bubble, - groupId: DEFAULT_GLOBAL_ID, - xScaleType: ScaleType.Ordinal, - yScaleType: ScaleType.Linear, - xAccessor: 'x', - yAccessors: ['y'], - hideInLegend: false, -}; -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; - -/** - * @alpha - * - * This series type uses a spatial index that is incompatible with other series types. This will - * be fixed once an update has been made to the tooltip design. - * - * When used alone with other `BubbleSeries` the spatial index will be used. However when - * mixed with other series types, the linear index will be used. This will affect highlighting - * of points when using the `markSizeAccessor`. - */ -export const BubbleSeries: React.FunctionComponent = getConnect()( - specComponentFactory< - BubbleSeriesSpec, - 'seriesType' | 'groupId' | 'xScaleType' | 'yScaleType' | 'xAccessor' | 'yAccessors' | 'hideInLegend' - >(defaultProps), -); diff --git a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts new file mode 100644 index 0000000000..8a65cc23d0 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { ScaleType } from '../../../scales/constants'; +import { SpecType } from '../../../specs/constants'; +import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { HistogramBarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType, BaseDatum } from '../utils/specs'; + +const buildProps = buildSFProps>()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Series, + seriesType: SeriesType.Bar, + }, + { + groupId: DEFAULT_GLOBAL_ID, + xScaleType: ScaleType.Linear, + yScaleType: ScaleType.Linear, + // xAccessor: 'x', + // yAccessors: ['y'], + hideInLegend: false, + enableHistogramMode: true as const, + }, +); + +/** + * Adds bar series to chart specs + * @public + */ +export const HistogramBarSeries = function ( + props: SFProps< + HistogramBarSeriesSpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; + +/** @public */ +export type HistogramBarSeriesProp = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.tsx b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.tsx deleted file mode 100644 index bd0d7e20b3..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.tsx +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { ScaleType } from '../../../scales/constants'; -import { SpecType } from '../../../specs/constants'; -import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { HistogramBarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Series, - seriesType: SeriesType.Bar, - groupId: DEFAULT_GLOBAL_ID, - xScaleType: ScaleType.Linear, - yScaleType: ScaleType.Linear, - xAccessor: 'x', - yAccessors: ['y'], - hideInLegend: false, - enableHistogramMode: true as const, -}; - -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; - -/** @public */ -export const HistogramBarSeries: React.FunctionComponent = getConnect()( - specComponentFactory< - HistogramBarSeriesSpec, - | 'seriesType' - | 'groupId' - | 'xScaleType' - | 'yScaleType' - | 'xAccessor' - | 'yAccessors' - | 'hideInLegend' - | 'enableHistogramMode' - >(defaultProps), -); diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts new file mode 100644 index 0000000000..9f11d02b64 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts @@ -0,0 +1,52 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { SpecType } from '../../../specs/constants'; +import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { DEFAULT_ANNOTATION_LINE_STYLE } from '../../../utils/themes/merge_utils'; +import { LineAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationType, BaseDatum } from '../utils/specs'; + +const buildProps = buildSFProps>()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Annotation, + }, + { + groupId: DEFAULT_GLOBAL_ID, + annotationType: AnnotationType.Line, + style: DEFAULT_ANNOTATION_LINE_STYLE, + hideLines: false, + hideTooltips: false, + hideLinesTooltips: true, + zIndex: 1, + }, +); + +/** + * Adds bar series to chart specs + * @public + */ +export const LineAnnotation = function ( + props: SFProps< + LineAnnotationSpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; + +/** @public */ +export type LineAnnotationProp = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.tsx b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.tsx deleted file mode 100644 index e7f445de0b..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.tsx +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { SpecType } from '../../../specs/constants'; -import { getConnect, specComponentFactory } from '../../../state/spec_factory'; -import { DEFAULT_ANNOTATION_LINE_STYLE } from '../../../utils/themes/merge_utils'; -import { LineAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationType } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Annotation, - groupId: DEFAULT_GLOBAL_ID, - annotationType: AnnotationType.Line, - style: DEFAULT_ANNOTATION_LINE_STYLE, - hideLines: false, - hideTooltips: false, - hideLinesTooltips: true, - zIndex: 1, -}; - -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial< - Omit< - LineAnnotationSpec, - 'chartType' | 'specType' | 'seriesType' | 'id' | 'dataValues' | 'domainType' | 'annotationType' - > ->; - -/** @public */ -export const LineAnnotation: React.FunctionComponent = getConnect()( - specComponentFactory(defaultProps), -); diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_series.ts b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts new file mode 100644 index 0000000000..0659fb0f94 --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { ScaleType } from '../../../scales/constants'; +import { SpecType } from '../../../specs/constants'; +import { SFProps, buildSFProps, useSpecFactory } from '../../../state/spec_factory'; +import { LineSeriesSpec, DEFAULT_GLOBAL_ID, HistogramModeAlignments, SeriesType, BaseDatum } from '../utils/specs'; + +const buildProps = buildSFProps>()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Series, + seriesType: SeriesType.Line, + }, + { + groupId: DEFAULT_GLOBAL_ID, + xScaleType: ScaleType.Ordinal, + yScaleType: ScaleType.Linear, + // xAccessor: 'x', + // yAccessors: ['y'], + hideInLegend: false, + histogramModeAlignment: HistogramModeAlignments.Center, + }, +); + +/** + * Adds bar series to chart specs + * @public + */ +export const LineSeries = function ( + props: SFProps< + LineSeriesSpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; + +/** @public */ +export type LineSeriesProp = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_series.tsx b/packages/charts/src/chart_types/xy_chart/specs/line_series.tsx deleted file mode 100644 index 3bde107fe9..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/line_series.tsx +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { ScaleType } from '../../../scales/constants'; -import { SpecType } from '../../../specs/constants'; -import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { LineSeriesSpec, DEFAULT_GLOBAL_ID, HistogramModeAlignments, SeriesType } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Series, - seriesType: SeriesType.Line, - groupId: DEFAULT_GLOBAL_ID, - xScaleType: ScaleType.Ordinal, - yScaleType: ScaleType.Linear, - xAccessor: 'x', - yAccessors: ['y'], - hideInLegend: false, - histogramModeAlignment: HistogramModeAlignments.Center, -}; -type SpecRequiredProps = Pick; -type SpecOptionalProps = Partial>; - -/** @public */ -export const LineSeries: React.FunctionComponent = getConnect()( - specComponentFactory< - LineSeriesSpec, - | 'seriesType' - | 'groupId' - | 'xScaleType' - | 'yScaleType' - | 'xAccessor' - | 'yAccessors' - | 'hideInLegend' - | 'histogramModeAlignment' - >(defaultProps), -); diff --git a/packages/charts/src/chart_types/xy_chart/specs/rect_annotation.ts b/packages/charts/src/chart_types/xy_chart/specs/rect_annotation.ts new file mode 100644 index 0000000000..59f28af53d --- /dev/null +++ b/packages/charts/src/chart_types/xy_chart/specs/rect_annotation.ts @@ -0,0 +1,33 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0 and the Server Side Public License, v 1; you may not use this file except + * in compliance with, at your election, the Elastic License 2.0 or the Server + * Side Public License, v 1. + */ + +import { ComponentProps } from 'react'; + +import { ChartType } from '../..'; +import { SpecType } from '../../../specs/constants'; +import { specComponentFactory } from '../../../state/spec_factory'; +import { DEFAULT_ANNOTATION_RECT_STYLE } from '../../../utils/themes/merge_utils'; +import { RectAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationType } from '../utils/specs'; + +/** @public */ +export const RectAnnotation = specComponentFactory()( + { + chartType: ChartType.XYAxis, + specType: SpecType.Annotation, + }, + { + groupId: DEFAULT_GLOBAL_ID, + annotationType: AnnotationType.Rectangle, + zIndex: -1, + style: DEFAULT_ANNOTATION_RECT_STYLE, + outside: false, + }, +); + +/** @public */ +export type RectAnnotationProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/rect_annotation.tsx b/packages/charts/src/chart_types/xy_chart/specs/rect_annotation.tsx deleted file mode 100644 index 1d2a260179..0000000000 --- a/packages/charts/src/chart_types/xy_chart/specs/rect_annotation.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import React from 'react'; - -import { ChartType } from '../..'; -import { SpecType } from '../../../specs/constants'; -import { specComponentFactory, getConnect } from '../../../state/spec_factory'; -import { DEFAULT_ANNOTATION_RECT_STYLE } from '../../../utils/themes/merge_utils'; -import { RectAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationType } from '../utils/specs'; - -const defaultProps = { - chartType: ChartType.XYAxis, - specType: SpecType.Annotation, - groupId: DEFAULT_GLOBAL_ID, - annotationType: AnnotationType.Rectangle, - zIndex: -1, - style: DEFAULT_ANNOTATION_RECT_STYLE, - outside: false, -}; - -/** @public */ -export const RectAnnotation: React.FunctionComponent< - Pick & - Partial< - Omit< - RectAnnotationSpec, - 'chartType' | 'specType' | 'seriesType' | 'id' | 'dataValues' | 'domainType' | 'annotationType' - > - > -> = getConnect()( - specComponentFactory(defaultProps), -); diff --git a/packages/charts/src/chart_types/xy_chart/utils/specs.ts b/packages/charts/src/chart_types/xy_chart/utils/specs.ts index b30231657a..62773bfeb4 100644 --- a/packages/charts/src/chart_types/xy_chart/utils/specs.ts +++ b/packages/charts/src/chart_types/xy_chart/utils/specs.ts @@ -17,8 +17,8 @@ import { ScaleType } from '../../../scales/constants'; import { LogScaleOptions } from '../../../scales/scale_continuous'; import { Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; -import { Accessor, AccessorFormat, AccessorFn } from '../../../utils/accessor'; -import { RecursivePartial, Position, Datum } from '../../../utils/common'; +import { AccessorFormat, AccessorFn } from '../../../utils/accessor'; +import { RecursivePartial, Position } from '../../../utils/common'; import { CurveType } from '../../../utils/curves'; import { OrdinalDomain } from '../../../utils/domain'; import { AxisId, GroupId } from '../../../utils/ids'; @@ -400,7 +400,7 @@ export interface DisplayValueSpec { } /** @public */ -export interface SeriesSpec extends Spec { +export interface SeriesSpec extends Spec { specType: typeof SpecType.Series; chartType: typeof ChartType.XYAxis; /** @@ -419,7 +419,7 @@ export interface SeriesSpec extends Spec { */ useDefaultGroupDomain?: boolean | string; /** An array of data */ - data: Datum[]; + data: D[]; /** The type of series you are looking to render */ seriesType: SeriesType; /** Set colors for specific series */ @@ -483,23 +483,23 @@ export type SeriesColorAccessorFn = (seriesIdentifier: XYChartSeriesIdentifier) export type SeriesColorAccessor = string | SeriesColorsArray | SeriesColorAccessorFn; /** @public */ -export interface SeriesAccessors { +export interface SeriesAccessors { /** The field name of the x value on Datum object */ - xAccessor: Accessor | AccessorFn; + xAccessor: keyof D | AccessorFn; /** An array of field names one per y metric value */ - yAccessors: (Accessor | AccessorFn)[]; + yAccessors: (keyof D | AccessorFn)[]; /** An optional accessor of the y0 value: base point for area/bar charts */ - y0Accessors?: (Accessor | AccessorFn)[]; + y0Accessors?: (keyof D | AccessorFn)[]; /** An array of fields thats indicates the datum series membership */ - splitSeriesAccessors?: (Accessor | AccessorFn)[]; + splitSeriesAccessors?: (keyof D | AccessorFn)[]; /** An array of fields thats indicates the stack membership */ - stackAccessors?: (Accessor | AccessorFn)[]; + stackAccessors?: (keyof D | AccessorFn)[]; /** * Field name of mark size metric on `Datum` * * Only used with line/area series */ - markSizeAccessor?: Accessor | AccessorFn; + markSizeAccessor?: keyof D | AccessorFn; } /** @public */ @@ -536,27 +536,36 @@ export interface SeriesScales { yNice?: boolean; } +type MarkFormatter = Type extends 'bar' + ? // eslint-disable-next-line @typescript-eslint/ban-types + {} // these options are to be empty thus {} + : { + /** + * A function called to format every single mark value + * + * Only used with line/area series + */ + markFormat?: TickFormatter; + }; + /** @public */ -export type BasicSeriesSpec = SeriesSpec & - SeriesAccessors & - SeriesScales & { - /** - * A function called to format every single mark value - * - * Only used with line/area series - */ - markFormat?: TickFormatter; - }; +export type BasicSeriesSpec = SeriesSpec & + SeriesAccessors & + SeriesScales & + MarkFormatter; /** @public */ -export type SeriesSpecs = Array; +export type SeriesSpecs = BasicSeriesSpec> = Array; + +/** @internal */ +export type BaseDatum = Record | unknown; /** * This spec describe the dataset configuration used to display a bar series. * @public */ -export type BarSeriesSpec = BasicSeriesSpec & +export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { /** @defaultValue `bar` {@link (SeriesType:type) | SeriesType.Bar} */ seriesType: typeof SeriesType.Bar; @@ -588,7 +597,7 @@ export type BarSeriesSpec = BasicSeriesSpec & * A histogram bar series is identical to a bar series except that stackAccessors are not allowed. * @public */ -export type HistogramBarSeriesSpec = Omit & { +export type HistogramBarSeriesSpec = Omit, 'stackAccessors'> & { enableHistogramMode: true; }; @@ -616,7 +625,7 @@ export type FitConfig = { * This spec describe the dataset configuration used to display a line series. * @public */ -export type LineSeriesSpec = BasicSeriesSpec & +export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { /** @defaultValue `line` {@link (SeriesType:type) | SeriesType.Line} */ seriesType: typeof SeriesType.Line; @@ -637,7 +646,7 @@ export type LineSeriesSpec = BasicSeriesSpec & * * @alpha */ -export type BubbleSeriesSpec = BasicSeriesSpec & { +export type BubbleSeriesSpec = BasicSeriesSpec & { /** @defaultValue `bubble` {@link (SeriesType:type) | SeriesType.Bubble} */ seriesType: typeof SeriesType.Bubble; bubbleSeriesStyle?: RecursivePartial; @@ -651,7 +660,7 @@ export type BubbleSeriesSpec = BasicSeriesSpec & { * This spec describe the dataset configuration used to display an area series. * @public */ -export type AreaSeriesSpec = BasicSeriesSpec & +export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { /** @defaultValue `area` {@link (SeriesType:type) | SeriesType.Area} */ @@ -789,11 +798,11 @@ export type AnnotationDomainType = $Values; * The descriptive object of a line annotation * @public */ -export interface LineAnnotationDatum { +export interface LineAnnotationDatum { /** * The value on the x or y axis accordingly to the domainType configured */ - dataValue: any; + dataValue: D; /** * A textual description of the annotation */ @@ -805,9 +814,9 @@ export interface LineAnnotationDatum { } /** @public */ -export type LineAnnotationSpec = BaseAnnotationSpec< +export type LineAnnotationSpec = BaseAnnotationSpec< typeof AnnotationType.Line, - LineAnnotationDatum, + LineAnnotationDatum, LineAnnotationStyle > & { domainType: AnnotationDomainType; @@ -927,7 +936,7 @@ export type AnnotationPortalSettings = TooltipPortalSettings<'chart'> & { /** @public */ export interface BaseAnnotationSpec< T extends typeof AnnotationType.Rectangle | typeof AnnotationType.Line, - D extends RectAnnotationDatum | LineAnnotationDatum, + D extends RectAnnotationDatum | LineAnnotationDatum, S extends RectAnnotationStyle | LineAnnotationStyle > extends Spec, AnnotationPortalSettings { @@ -962,10 +971,10 @@ export interface BaseAnnotationSpec< } /** @public */ -export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec; +export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec; /** @internal */ -export function isLineAnnotation(spec: AnnotationSpec): spec is LineAnnotationSpec { +export function isLineAnnotation(spec: AnnotationSpec): spec is LineAnnotationSpec { return spec.annotationType === AnnotationType.Line; } @@ -975,22 +984,22 @@ export function isRectAnnotation(spec: AnnotationSpec): spec is RectAnnotationSp } /** @internal */ -export function isBarSeriesSpec(spec: BasicSeriesSpec): spec is BarSeriesSpec { +export function isBarSeriesSpec(spec: BasicSeriesSpec): spec is BarSeriesSpec { return spec.seriesType === SeriesType.Bar; } /** @internal */ -export function isBubbleSeriesSpec(spec: BasicSeriesSpec): spec is BubbleSeriesSpec { +export function isBubbleSeriesSpec(spec: BasicSeriesSpec): spec is BubbleSeriesSpec { return spec.seriesType === SeriesType.Bubble; } /** @internal */ -export function isLineSeriesSpec(spec: BasicSeriesSpec): spec is LineSeriesSpec { +export function isLineSeriesSpec(spec: BasicSeriesSpec): spec is LineSeriesSpec { return spec.seriesType === SeriesType.Line; } /** @internal */ -export function isAreaSeriesSpec(spec: BasicSeriesSpec): spec is AreaSeriesSpec { +export function isAreaSeriesSpec(spec: BasicSeriesSpec): spec is AreaSeriesSpec { return spec.seriesType === SeriesType.Area; } diff --git a/packages/charts/src/specs/constants.ts b/packages/charts/src/specs/constants.ts index 1cedd90613..2011972d7b 100644 --- a/packages/charts/src/specs/constants.ts +++ b/packages/charts/src/specs/constants.ts @@ -10,6 +10,7 @@ import { $Values } from 'utility-types'; import { ChartType } from '../chart_types'; import { BOTTOM, CENTER, LEFT, MIDDLE, RIGHT, TOP } from '../common/constants'; +import { buildSFProps } from '../state/spec_factory'; import { Position } from '../utils/common'; import { LIGHT_THEME } from '../utils/themes/light_theme'; import { SettingsSpec } from './settings'; @@ -159,27 +160,37 @@ export const DEFAULT_TOOLTIP_CONFIG = { showNullValues: false, }; -/** @public */ -export const DEFAULT_SETTINGS_SPEC: SettingsSpec = { - id: '__global__settings___', - chartType: ChartType.Global, - specType: SpecType.Settings, - rendering: 'canvas' as const, - rotation: 0 as const, - animateData: true, - resizeDebounce: 10, - debug: false, - tooltip: DEFAULT_TOOLTIP_CONFIG, - pointerUpdateTrigger: PointerUpdateTrigger.X, - externalPointerEvents: { - tooltip: { - visible: false, +/** @internal */ +export const settingsBuildProps = buildSFProps()( + { + id: '__global__settings___' as const, + chartType: ChartType.Global, + specType: SpecType.Settings, + }, + { + rendering: 'canvas' as const, + rotation: 0 as const, + animateData: true, + resizeDebounce: 10, + debug: false, + tooltip: DEFAULT_TOOLTIP_CONFIG, + pointerUpdateTrigger: PointerUpdateTrigger.X, + externalPointerEvents: { + tooltip: { + visible: false, + }, }, + baseTheme: LIGHT_THEME, + brushAxis: BrushAxis.X, + minBrushDelta: 2, + ariaUseDefaultSummary: true, + ariaLabelHeadingLevel: 'p', + ...DEFAULT_LEGEND_CONFIG, }, - baseTheme: LIGHT_THEME, - brushAxis: BrushAxis.X, - minBrushDelta: 2, - ariaUseDefaultSummary: true, - ariaLabelHeadingLevel: 'p', - ...DEFAULT_LEGEND_CONFIG, +); + +/** @public */ +export const DEFAULT_SETTINGS_SPEC: SettingsSpec = { + ...settingsBuildProps.defaults, + ...settingsBuildProps.overrides, }; diff --git a/packages/charts/src/specs/group_by.ts b/packages/charts/src/specs/group_by.ts index 8a72f3dd32..d6370d9e28 100644 --- a/packages/charts/src/specs/group_by.ts +++ b/packages/charts/src/specs/group_by.ts @@ -6,16 +6,16 @@ * Side Public License, v 1. */ -import React from 'react'; +import { ComponentProps } from 'react'; -import { Spec } from '.'; +import { BaseDatum, Spec } from '.'; import { ChartType } from '../chart_types'; import { Predicate } from '../common/predicate'; -import { getConnect, specComponentFactory } from '../state/spec_factory'; +import { buildSFProps, SFProps, useSpecFactory } from '../state/spec_factory'; import { SpecType } from './constants'; /** @public */ -export type GroupByAccessor = (spec: Spec, datum: any) => string | number; +export type GroupByAccessor = (spec: Spec, datum: D) => string | number; /** @alpha */ export type GroupBySort = Predicate; @@ -23,14 +23,14 @@ export type GroupBySort = Predicate; * Title formatter that handles any value returned from the GroupByAccessor * @public */ -export type GroupByFormatter = (value: ReturnType) => string; +export type GroupByFormatter = (value: ReturnType>) => string; /** @alpha */ -export interface GroupBySpec extends Spec { +export interface GroupBySpec extends Spec { /** * Function to return a unique value __by__ which to group the data */ - by: GroupByAccessor; + by: GroupByAccessor; /** * Sort predicate used to sort grouped data */ @@ -40,19 +40,34 @@ export interface GroupBySpec extends Spec { * * Only for displayed values, not used in sorting or other internal computations. */ - format?: GroupByFormatter; + format?: GroupByFormatter; } -const DEFAULT_GROUP_BY_PROPS = { - chartType: ChartType.Global, - specType: SpecType.IndexOrder, -}; -type DefaultGroupByProps = 'chartType' | 'specType'; +const buildProps = buildSFProps>()( + { + chartType: ChartType.Global, + specType: SpecType.IndexOrder, + }, + {}, +); -/** @alpha */ -export type GroupByProps = Pick; +/** + * Add GroupBy spec to chart + * @public + */ +export const GroupBy = function ( + props: SFProps< + GroupBySpec, + keyof typeof buildProps['overrides'], + keyof typeof buildProps['defaults'], + keyof typeof buildProps['optionals'], + keyof typeof buildProps['requires'] + >, +) { + const { defaults, overrides } = buildProps; + useSpecFactory>({ ...defaults, ...props, ...overrides }); + return null; +}; -/** @alpha */ -export const GroupBy: React.FunctionComponent = getConnect()( - specComponentFactory(DEFAULT_GROUP_BY_PROPS), -); +/** @public */ +export type GroupByProps = ComponentProps; diff --git a/packages/charts/src/specs/settings.tsx b/packages/charts/src/specs/settings.tsx index f2bd1ac208..ae91ea9dbc 100644 --- a/packages/charts/src/specs/settings.tsx +++ b/packages/charts/src/specs/settings.tsx @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import React, { ComponentType, ReactChild } from 'react'; +import { ComponentProps, ComponentType, ReactChild } from 'react'; import { CustomXDomain, GroupByAccessor, Spec, TooltipStickTo } from '.'; import { Cell } from '../chart_types/heatmap/layout/types/viewmodel_types'; @@ -21,7 +21,7 @@ import { TooltipPortalSettings } from '../components'; import { CustomTooltip } from '../components/tooltip/types'; import { ScaleContinuousType, ScaleOrdinalType } from '../scales'; import { LegendPath } from '../state/actions/legend'; -import { getConnect, specComponentFactory } from '../state/spec_factory'; +import { SFProps, useSpecFactory } from '../state/spec_factory'; import { Accessor } from '../utils/accessor'; import { HorizontalAlignment, @@ -38,12 +38,12 @@ import { PartialTheme, Theme } from '../utils/themes/theme'; import { BinAgg, BrushAxis, - DEFAULT_SETTINGS_SPEC, DEFAULT_TOOLTIP_CONFIG, Direction, PointerEventType, PointerUpdateTrigger, TooltipType, + settingsBuildProps, } from './constants'; /** @public */ @@ -174,7 +174,7 @@ export type BasicListener = () => undefined | void; /** @public */ export type RectAnnotationEvent = { id: SpecId; datum: RectAnnotationDatum }; /** @public */ -export type LineAnnotationEvent = { id: SpecId; datum: LineAnnotationDatum }; +export type LineAnnotationEvent = { id: SpecId; datum: LineAnnotationDatum }; /** @public */ export type AnnotationClickListener = (annotations: { rects: RectAnnotationEvent[]; @@ -681,38 +681,26 @@ export interface OrderBy { direction?: Direction; } -/** @public */ -export type DefaultSettingsProps = - | 'id' - | 'chartType' - | 'specType' - | 'rendering' - | 'rotation' - | 'resizeDebounce' - | 'pointerUpdateDebounce' - | 'pointerUpdateTrigger' - | 'animateData' - | 'debug' - | 'tooltip' - | 'theme' - | 'brushAxis' - | 'minBrushDelta' - | 'externalPointerEvents' - | 'showLegend' - | 'showLegendExtra' - | 'legendPosition' - | 'legendMaxDepth' - | 'ariaUseDefaultSummary' - | 'ariaLabelHeadingLevel' - | 'ariaTableCaption'; - -/** @public */ -export type SettingsSpecProps = Partial>; +/** + * Adds settings spec to chart specs + * @public + */ +export const Settings = function ( + props: SFProps< + SettingsSpec, + keyof typeof settingsBuildProps['overrides'], + keyof typeof settingsBuildProps['defaults'], + keyof typeof settingsBuildProps['optionals'], + keyof typeof settingsBuildProps['requires'] + >, +) { + const { defaults, overrides } = settingsBuildProps; + useSpecFactory({ ...defaults, ...props, ...overrides }); + return null; +}; /** @public */ -export const Settings: React.FunctionComponent = getConnect()( - specComponentFactory(DEFAULT_SETTINGS_SPEC), -); +export type SettingsProp = ComponentProps; /** @internal */ export function isPointerOutEvent(event: PointerEvent | null | undefined): event is PointerOutEvent { diff --git a/packages/charts/src/specs/small_multiples.ts b/packages/charts/src/specs/small_multiples.ts index 91433c12c0..1bc9dac91c 100644 --- a/packages/charts/src/specs/small_multiples.ts +++ b/packages/charts/src/specs/small_multiples.ts @@ -6,12 +6,12 @@ * Side Public License, v 1. */ -import React from 'react'; +import { ComponentProps } from 'react'; import { Spec } from '.'; import { ChartType } from '../chart_types'; import { Ratio } from '../common/geometry'; -import { getConnect, specComponentFactory } from '../state/spec_factory'; +import { specComponentFactory } from '../state/spec_factory'; import { SpecType } from './constants'; /** @@ -70,16 +70,18 @@ export interface SmallMultiplesSpec extends Spec { style?: Partial; } -const DEFAULT_SMALL_MULTIPLES_PROPS = { - id: '__global__small_multiples___', - chartType: ChartType.Global, - specType: SpecType.SmallMultiples, -}; - -/** @alpha */ -export type SmallMultiplesProps = Partial>; - -/** @alpha */ -export const SmallMultiples: React.FunctionComponent = getConnect()( - specComponentFactory(DEFAULT_SMALL_MULTIPLES_PROPS), +/** + * Add small multiples spec to chart + * @alpha + */ +export const SmallMultiples = specComponentFactory()( + { + id: '__global__small_multiples___', + chartType: ChartType.Global, + specType: SpecType.SmallMultiples, + }, + {}, ); + +/** @public */ +export type SmallMultiplesProps = ComponentProps; diff --git a/packages/charts/src/state/spec_factory.ts b/packages/charts/src/state/spec_factory.ts index b65f89e241..6b648d7992 100644 --- a/packages/charts/src/state/spec_factory.ts +++ b/packages/charts/src/state/spec_factory.ts @@ -6,59 +6,161 @@ * Side Public License, v 1. */ -import { useEffect } from 'react'; -import { connect } from 'react-redux'; -import { Dispatch, bindActionCreators } from 'redux'; +import { FC, useEffect, useMemo } from 'react'; +import { useDispatch } from 'react-redux'; +import { bindActionCreators } from 'redux'; +import { OptionalKeys, RequiredKeys } from 'utility-types'; -import { Spec } from '../specs'; -import { upsertSpec, removeSpec } from './actions/specs'; +import { Spec as Spec } from '../specs'; +import { upsertSpec as upsertSpecAction, removeSpec as removeSpecAction } from './actions/specs'; /** @internal */ export interface DispatchProps { - upsertSpec: (spec: Spec) => void; - removeSpec: (id: string) => void; + upsertSpec: typeof upsertSpecAction; + removeSpec: typeof removeSpecAction; } -/** @internal */ -export function specComponentFactory( - defaultProps: Pick, -) { - /* eslint-disable no-shadow, react-hooks/exhaustive-deps, unicorn/consistent-function-scoping */ - const SpecInstance = (props: U & DispatchProps) => { - const { removeSpec, upsertSpec, ...SpecInstance } = props; - useEffect(() => { - upsertSpec(SpecInstance); - }); - useEffect( - () => () => { - removeSpec(props.id); - }, - [], - ); - return null; - }; - /* eslint-enable */ - SpecInstance.defaultProps = defaultProps; - return SpecInstance; -} +/** + * Used inside custom spec component to link component to state as new spec + * @internal + */ +export function useSpecFactory(props: Props) { + const dispatch = useDispatch(); + const { upsertSpec, removeSpec } = useMemo( + () => ({ + upsertSpec: bindActionCreators(upsertSpecAction, dispatch), + removeSpec: bindActionCreators(removeSpecAction, dispatch), + }), + [dispatch], + ); -const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => - bindActionCreators( - { - upsertSpec, - removeSpec, + useEffect(() => { + upsertSpec(props); + }); + useEffect( + () => () => { + removeSpec(props.id); }, - dispatch, + [], // eslint-disable-line react-hooks/exhaustive-deps ); +} + +/** + * Creates spec component factory given overrides and default props. + * + * To use this you must pass the Spec type via empty function call... + * + * ```ts + * const MyThing = specComponentFactory()(overrides, defaults) + * ``` + * + * > IMPORTANT: Both `overrides` and `defaults` should __NOT__ have explicit types. + * > The types are determined automatically from thier implicitly defined types, while still + * > enforing that the types are derived from the defined `Spec`. + * @internal + */ +export const specComponentFactory = () => < + Overrides extends SFOverrideKeys, + Defaults extends SFDefaultKeys, + Optionals extends SFOptionalKeys, + Requires extends SFRequiredKeys +>( + overrides: SFOverrides, + defaults: SFDefaults, +): FC> => { + return (props) => { + // @ts-ignore - All Spec keys are guaranteed to be included + useSpecFactory({ ...defaults, ...props, ...overrides }); + return null; + }; +}; + +/** + * Takes in prop overrides and defaults with enforced types. + * Determines implicit types of optional and required props. + * + * To use this you must pass the Spec type via empty function call... + * + * ```ts + * const MyThingBuildProps = buildSFProps()(overrides, defaults) + * ``` + * + * > IMPORTANT: Both `overrides` and `defaults` should __NOT__ have explicit types. + * > The types are determined automatically from thier implicitly defined types, while still + * > enforing that the types are derived from the defined `Spec`. + * @internal + */ +export const buildSFProps = () => < + Overrides extends SFOverrideKeys, + Defaults extends SFDefaultKeys, + Optionals extends SFOptionalKeys, + Requires extends SFRequiredKeys +>( + overrides: SFOverrides, + defaults: SFDefaults, +): BuildProps => ({ + overrides, + defaults, + optionals: {} as Pick, // used to transfer type only + requires: {} as Pick, // used to transfer type only +}); + +/* +------------------------------------------------------------ + Reused types to maintain single source of truth +------------------------------------------------------------ +*/ + +/** + * Resulting props for spec given overrides, defaults, optionals and required props + * @internal + */ +export type SFProps< + S extends Spec, + Overrides extends SFOverrideKeys, + Defaults extends SFDefaultKeys, + Optionals extends SFOptionalKeys, + Requires extends SFRequiredKeys +> = Pick & Partial>; /** @internal */ -export function getConnect() { - /** - * Redux assumes shallowEqual for all connected components - * - * This causes an issue where the specs are cleared and memoized spec components will never be - * re-rendered and thus never re-upserted to the state. Setting pure to false solves this issue - * and doesn't cause traditional performance degradations. - */ - return connect(null, mapDispatchToProps, null, { pure: false }); +export interface BuildProps< + S extends Spec, + Overrides extends SFOverrideKeys, + Defaults extends SFDefaultKeys, + Optionals extends SFOptionalKeys, + Requires extends SFRequiredKeys +> { + overrides: SFOverrides; + defaults: SFDefaults; + /** @deprecated typing only do not use as value */ + optionals: Pick; + /** @deprecated typing only do not use as value */ + requires: Pick; } + +/** All specs __must__ provide these as overrides */ +type RequiredSpecProps = keyof Pick; + +/* Types defining keys */ +type SFOverrideKeys = keyof S; +type SFDefaultKeys = keyof Omit; +type SFOptionalKeys< + S extends Spec, + Overrides extends keyof S, + Defaults extends keyof Omit +> = OptionalKeys>; +type SFRequiredKeys< + S extends Spec, + Overrides extends keyof S, + Defaults extends keyof Omit, + Optionals extends SFOptionalKeys +> = RequiredKeys>; + +/* Object types defined from key types above */ +type SFOverrides = Required>; +type SFDefaults< + S extends Spec, + Overrides extends SFOverrideKeys, + Defaults extends SFDefaultKeys +> = Required>; diff --git a/packages/charts/src/utils/accessor.ts b/packages/charts/src/utils/accessor.ts index ecb8b617f0..25e98190be 100644 --- a/packages/charts/src/utils/accessor.ts +++ b/packages/charts/src/utils/accessor.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { BaseDatum } from '../chart_types/specs'; import { Datum } from './common'; /** @@ -13,12 +14,12 @@ import { Datum } from './common'; * @param datum - the datum * @public */ -export interface UnaryAccessorFn { +export interface UnaryAccessorFn { /** * Name used as accessor field name in place of function reference */ fieldName?: string; - (datum: Datum): Return; + (datum: D): Return; } /** @@ -27,19 +28,21 @@ export interface UnaryAccessorFn { * @param index - the index in the array * @public */ -export type BinaryAccessorFn = (datum: Datum, index: number) => Return; +export type BinaryAccessorFn = (datum: D, index: number) => Return; /** * An accessor function * @public */ -export type AccessorFn = UnaryAccessorFn; +export type AccessorFn = UnaryAccessorFn; /** * An indexed accessor function * @public */ -export type IndexedAccessorFn = UnaryAccessorFn | BinaryAccessorFn; +export type IndexedAccessorFn = + | UnaryAccessorFn + | BinaryAccessorFn; /** * A key accessor string diff --git a/packages/charts/src/utils/common.tsx b/packages/charts/src/utils/common.tsx index d2c5addf0c..c952e2b882 100644 --- a/packages/charts/src/utils/common.tsx +++ b/packages/charts/src/utils/common.tsx @@ -13,6 +13,7 @@ import { v1 as uuidV1 } from 'uuid'; import { PrimitiveValue } from '../chart_types/partition_chart/layout/utils/group_by_rollup'; import { Color, Colors } from '../common/colors'; import { Degrees, Radian } from '../common/geometry'; +import { BaseDatum } from '../specs'; import { AdditiveNumber } from './accessor'; import { Point } from './point'; @@ -448,7 +449,7 @@ export function getUniqueValues(fullArray: T[], uniqueProperty: keyof T, filt /** @public */ export type ValueFormatter = (value: number) => string; /** @public */ -export type ValueAccessor = (d: Datum) => AdditiveNumber; +export type ValueAccessor = (d: D) => AdditiveNumber; /** @public */ export type LabelAccessor = (value: T) => string; /** @public */ From a9b702b96765c042a5a07b32aa6cdd6b82f1fbb1 Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Fri, 15 Oct 2021 15:57:28 -0500 Subject: [PATCH 02/12] chore: fix bad types from stricter typings --- .../heatmap/layout/viewmodel/viewmodel.ts | 8 +-- .../src/chart_types/heatmap/specs/heatmap.ts | 19 +++--- .../state/selectors/get_heatmap_table.ts | 19 ++++-- .../heatmap/state/selectors/heatmap_spec.ts | 4 +- .../partition_chart/specs/index.ts | 21 ++++--- .../annotations/line/tooltip.test.tsx | 4 ++ .../chart_types/xy_chart/annotations/types.ts | 2 +- .../chart_types/xy_chart/specs/area_series.ts | 11 ++-- .../chart_types/xy_chart/specs/bar_series.ts | 11 ++-- .../xy_chart/specs/bubble_series.ts | 11 ++-- .../xy_chart/specs/histogram_bar_series.ts | 11 ++-- .../xy_chart/specs/line_annotation.ts | 10 +-- .../chart_types/xy_chart/specs/line_series.ts | 11 ++-- .../src/chart_types/xy_chart/utils/series.ts | 31 ++++----- .../src/chart_types/xy_chart/utils/specs.ts | 63 ++++++++++--------- .../accessibility/accessibility.test.tsx | 6 +- packages/charts/src/components/chart.test.tsx | 9 ++- .../error_boundary/error_boundary.tsx | 4 +- .../src/components/legend/legend.test.tsx | 9 ++- packages/charts/src/components/no_results.tsx | 4 +- packages/charts/src/specs/group_by.ts | 9 +-- packages/charts/src/specs/settings.tsx | 11 ++-- packages/charts/src/utils/accessor.ts | 26 ++++++-- packages/charts/src/utils/common.ts | 2 +- 24 files changed, 185 insertions(+), 131 deletions(-) diff --git a/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts b/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts index 5a12a328ee..b2b60be707 100644 --- a/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts +++ b/packages/charts/src/chart_types/heatmap/layout/viewmodel/viewmodel.ts @@ -15,10 +15,10 @@ import { Pixels } from '../../../../common/geometry'; import { Box, maximiseFontSize, TextMeasure } from '../../../../common/text_utils'; import { ScaleContinuous } from '../../../../scales'; import { ScaleType } from '../../../../scales/constants'; -import { SettingsSpec } from '../../../../specs'; +import { BaseDatum, SettingsSpec } from '../../../../specs'; import { withTextMeasure } from '../../../../utils/bbox/canvas_text_bbox_calculator'; import { snapDateToESInterval } from '../../../../utils/chrono/elasticsearch'; -import { clamp, range } from '../../../../utils/common'; +import { clamp, Datum, range } from '../../../../utils/common'; import { Dimensions } from '../../../../utils/dimensions'; import { ContinuousDomain } from '../../../../utils/domain'; import { Logger } from '../../../../utils/logger'; @@ -72,9 +72,9 @@ function estimatedNonOverlappingTickCount( } /** @internal */ -export function shapeViewModel( +export function shapeViewModel( textMeasure: TextMeasure, - spec: HeatmapSpec, + spec: HeatmapSpec, config: Config, settingsSpec: SettingsSpec, chartDimensions: Dimensions, diff --git a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts index 0bb20d65c8..208c8df487 100644 --- a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts +++ b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts @@ -16,7 +16,7 @@ import { BaseDatum, SeriesScales, Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; import { Accessor, AccessorFn } from '../../../utils/accessor'; -import { RecursivePartial } from '../../../utils/common'; +import { Datum, RecursivePartial } from '../../../utils/common'; import { config } from '../layout/config/config'; import { Config } from '../layout/types/config_types'; import { X_SCALE_DEFAULT } from './scale_defaults'; @@ -45,13 +45,13 @@ export interface HeatmapBandsColorScale { } /** @alpha */ -export interface HeatmapSpec extends Spec { +export interface HeatmapSpec extends Spec { specType: typeof SpecType.Series; chartType: typeof ChartType.Heatmap; data: D[]; colorScale: HeatmapBandsColorScale; - xAccessor: keyof D | AccessorFn; - yAccessor: keyof D | AccessorFn; + xAccessor: Accessor | AccessorFn; + yAccessor: Accessor | AccessorFn; valueAccessor: Accessor | AccessorFn; valueFormatter: (value: number) => string; xSortPredicate: Predicate; @@ -66,9 +66,9 @@ export interface HeatmapSpec extends Spec { * Adds heatmap spec to chart specs * @alpha */ -export const Heatmap = function ( +export const Heatmap = function ( props: SFProps< - HeatmapSpec, + HeatmapSpec, keyof typeof buildProps.current['overrides'], keyof typeof buildProps.current['defaults'], keyof typeof buildProps.current['optionals'], @@ -76,15 +76,14 @@ export const Heatmap = function ( >, ) { const buildProps = useRef( - buildSFProps>()( + // @ts-ignore - excessively deep types + buildSFProps>()( { chartType: ChartType.Heatmap, specType: SpecType.Series, }, { data: [], - // xAccessor: ({ x }: { x: string | number }) => x, - // yAccessor: ({ y }: { y: string | number }) => y, valueAccessor: ({ value }) => value, xScaleType: X_SCALE_DEFAULT.type, valueFormatter: (value) => `${value}`, @@ -95,7 +94,7 @@ export const Heatmap = function ( ), ); const { defaults, overrides } = buildProps.current; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/heatmap/state/selectors/get_heatmap_table.ts b/packages/charts/src/chart_types/heatmap/state/selectors/get_heatmap_table.ts index 9a7ae82b32..55b1ab86f0 100644 --- a/packages/charts/src/chart_types/heatmap/state/selectors/get_heatmap_table.ts +++ b/packages/charts/src/chart_types/heatmap/state/selectors/get_heatmap_table.ts @@ -25,12 +25,12 @@ export const getHeatmapTableSelector = createCustomCachedSelector( [getHeatmapSpecSelector, getSettingsSpecSelector], (spec, settingsSpec): HeatmapTable => { const { data, valueAccessor, xAccessor, yAccessor, xSortPredicate, ySortPredicate } = spec; - const { xDomain } = settingsSpec; - const resultData = data.reduce( + const { table, xValues, yValues, extent } = data.reduce< + Omit & { xValues: Array } + >( (acc, curr, index) => { const x = getAccessorValue(curr, xAccessor); - const y = getAccessorValue(curr, yAccessor); const value = getAccessorValue(curr, valueAccessor); @@ -62,17 +62,24 @@ export const getHeatmapTableSelector = createCustomCachedSelector( }, ); - resultData.xDomain = mergeXDomain( + const xDomain = mergeXDomain( { type: getXScaleTypeFromSpec(spec.xScaleType), nice: getXNiceFromSpec(), isBandScale: false, desiredTickCount: X_SCALE_DEFAULT.desiredTickCount, - customDomain: xDomain, + customDomain: settingsSpec.xDomain, }, - resultData.xValues, + new Set(xValues), ); + const resultData: HeatmapTable = { + table, + xDomain, + yValues, + extent, + }; + // sort values by their predicates if (spec.xScaleType === ScaleType.Ordinal) { resultData.xDomain.domain.sort(getPredicateFn(xSortPredicate)); diff --git a/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts b/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts index 4f11040d14..a34755931e 100644 --- a/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts +++ b/packages/charts/src/chart_types/heatmap/state/selectors/heatmap_spec.ts @@ -13,7 +13,7 @@ import { getSpecsFromStore } from '../../../../state/utils'; import { HeatmapSpec } from '../../specs/heatmap'; /** @internal */ -export function getSpecOrNull(state: GlobalChartState): HeatmapSpec | null { - const specs = getSpecsFromStore>(state.specs, ChartType.Heatmap, SpecType.Series); +export function getSpecOrNull(state: GlobalChartState): HeatmapSpec | null { + const specs = getSpecsFromStore(state.specs, ChartType.Heatmap, SpecType.Series); return specs.length > 0 ? specs[0] : null; } diff --git a/packages/charts/src/chart_types/partition_chart/specs/index.ts b/packages/charts/src/chart_types/partition_chart/specs/index.ts index 633396af84..fb24d4e864 100644 --- a/packages/charts/src/chart_types/partition_chart/specs/index.ts +++ b/packages/charts/src/chart_types/partition_chart/specs/index.ts @@ -14,7 +14,14 @@ import { BaseDatum, Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; // kept as unshortened import on separate line otherwise import circularity emerges import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; import { IndexedAccessorFn } from '../../../utils/accessor'; -import { LabelAccessor, RecursivePartial, ShowAccessor, ValueAccessor, ValueFormatter } from '../../../utils/common'; +import { + Datum, + LabelAccessor, + RecursivePartial, + ShowAccessor, + ValueAccessor, + ValueFormatter, +} from '../../../utils/common'; import { config, percentFormatter } from '../layout/config'; import { Config, FillFontSizeRange, FillLabelConfig } from '../layout/types/config_types'; import { NodeColorAccessor, ValueGetter } from '../layout/types/viewmodel_types'; @@ -26,7 +33,7 @@ interface ExtendedFillLabelConfig extends FillLabelConfig, FillFontSizeRange {} * Specification for a given layer in the partition chart * @public */ -export interface Layer { +export interface Layer { groupByRollup: IndexedAccessorFn; sortPredicate?: NodeSorter | null; nodeLabel?: LabelAccessor; @@ -39,7 +46,7 @@ export interface Layer { * Specifies the partition chart * @public */ -export interface PartitionSpec extends Spec { +export interface PartitionSpec extends Spec { specType: typeof SpecType.Series; chartType: typeof ChartType.Partition; config: RecursivePartial; @@ -53,7 +60,7 @@ export interface PartitionSpec extends Spec { layers: Layer[]; } -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.Partition, specType: SpecType.Series, @@ -81,9 +88,9 @@ const buildProps = buildSFProps>()( * Adds partition spec to chart specs * @public */ -export const Partition = function ( +export const Partition = function ( props: SFProps< - PartitionSpec, + PartitionSpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -91,7 +98,7 @@ export const Partition = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/annotations/line/tooltip.test.tsx b/packages/charts/src/chart_types/xy_chart/annotations/line/tooltip.test.tsx index 0ff1c96032..89f27cbc9f 100644 --- a/packages/charts/src/chart_types/xy_chart/annotations/line/tooltip.test.tsx +++ b/packages/charts/src/chart_types/xy_chart/annotations/line/tooltip.test.tsx @@ -43,6 +43,8 @@ describe('Annotation tooltips', () => { { x: 2, y: 3 }, { x: 4, y: 5 }, ]} + xAccessor="x" + yAccessors={['y']} xScaleType={ScaleType.Linear} /> { { x: 2, y: 3 }, { x: 4, y: 5 }, ]} + xAccessor="x" + yAccessors={['y']} xScaleType={ScaleType.Linear} /> ; +export type ComponentWithAnnotationDatum = ComponentType>; /** * The marker for an Annotation. Usually a JSX element diff --git a/packages/charts/src/chart_types/xy_chart/specs/area_series.ts b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts index b74b2fa79d..47f54981cf 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/area_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts @@ -12,9 +12,10 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { Datum } from '../../../utils/common'; import { AreaSeriesSpec, HistogramModeAlignments, DEFAULT_GLOBAL_ID, SeriesType, BaseDatum } from '../utils/specs'; -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.XYAxis, specType: SpecType.Series, @@ -24,8 +25,6 @@ const buildProps = buildSFProps>()( groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Linear, yScaleType: ScaleType.Linear, - // xAccessor: 'x', - // yAccessors: ['y'], hideInLegend: false, histogramModeAlignment: HistogramModeAlignments.Center, }, @@ -35,9 +34,9 @@ const buildProps = buildSFProps>()( * Adds bar series to chart specs * @public */ -export const AreaSeries = function ( +export const AreaSeries = function ( props: SFProps< - AreaSeriesSpec, + AreaSeriesSpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -45,7 +44,7 @@ export const AreaSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts index 55cd5b2431..9d47338e7f 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts @@ -12,9 +12,10 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { useSpecFactory, SFProps, buildSFProps } from '../../../state/spec_factory'; +import { Datum } from '../../../utils/common'; import { BarSeriesSpec, BaseDatum, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.XYAxis, specType: SpecType.Series, @@ -24,8 +25,6 @@ const buildProps = buildSFProps>()( groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, - // xAccessor: 'x', - // yAccessors: ['y'], hideInLegend: false, enableHistogramMode: false, }, @@ -35,9 +34,9 @@ const buildProps = buildSFProps>()( * Adds bar series to chart specs * @public */ -export const BarSeries = function ( +export const BarSeries = function ( props: SFProps< - BarSeriesSpec, + BarSeriesSpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -45,7 +44,7 @@ export const BarSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts index 5d1eb05751..2fc151c3c7 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts @@ -12,9 +12,10 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { Datum } from '../../../utils/common'; import { BaseDatum, BubbleSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.XYAxis, specType: SpecType.Series, @@ -24,8 +25,6 @@ const buildProps = buildSFProps>()( groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, - // xAccessor: 'x', - // yAccessors: ['y'], hideInLegend: false, }, ); @@ -34,9 +33,9 @@ const buildProps = buildSFProps>()( * Adds bar series to chart specs * @public */ -export const BubbleSeries = function ( +export const BubbleSeries = function ( props: SFProps< - BubbleSeriesSpec, + BubbleSeriesSpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -44,7 +43,7 @@ export const BubbleSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts index 8a65cc23d0..12d08939a7 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts @@ -12,9 +12,10 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { Datum } from '../../../utils/common'; import { HistogramBarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType, BaseDatum } from '../utils/specs'; -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.XYAxis, specType: SpecType.Series, @@ -24,8 +25,6 @@ const buildProps = buildSFProps>()( groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Linear, yScaleType: ScaleType.Linear, - // xAccessor: 'x', - // yAccessors: ['y'], hideInLegend: false, enableHistogramMode: true as const, }, @@ -35,9 +34,9 @@ const buildProps = buildSFProps>()( * Adds bar series to chart specs * @public */ -export const HistogramBarSeries = function ( +export const HistogramBarSeries = function ( props: SFProps< - HistogramBarSeriesSpec, + HistogramBarSeriesSpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -45,7 +44,7 @@ export const HistogramBarSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts index 9f11d02b64..f8be059e87 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts @@ -12,9 +12,9 @@ import { ChartType } from '../..'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; import { DEFAULT_ANNOTATION_LINE_STYLE } from '../../../utils/themes/merge_utils'; -import { LineAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationType, BaseDatum } from '../utils/specs'; +import { LineAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationType } from '../utils/specs'; -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.XYAxis, specType: SpecType.Annotation, @@ -34,9 +34,9 @@ const buildProps = buildSFProps>()( * Adds bar series to chart specs * @public */ -export const LineAnnotation = function ( +export const LineAnnotation = function ( props: SFProps< - LineAnnotationSpec, + LineAnnotationSpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -44,7 +44,7 @@ export const LineAnnotation = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_series.ts b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts index 0659fb0f94..edbf60b890 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/line_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts @@ -12,9 +12,10 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { SFProps, buildSFProps, useSpecFactory } from '../../../state/spec_factory'; +import { Datum } from '../../../utils/common'; import { LineSeriesSpec, DEFAULT_GLOBAL_ID, HistogramModeAlignments, SeriesType, BaseDatum } from '../utils/specs'; -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.XYAxis, specType: SpecType.Series, @@ -24,8 +25,6 @@ const buildProps = buildSFProps>()( groupId: DEFAULT_GLOBAL_ID, xScaleType: ScaleType.Ordinal, yScaleType: ScaleType.Linear, - // xAccessor: 'x', - // yAccessors: ['y'], hideInLegend: false, histogramModeAlignment: HistogramModeAlignments.Center, }, @@ -35,9 +34,9 @@ const buildProps = buildSFProps>()( * Adds bar series to chart specs * @public */ -export const LineSeries = function ( +export const LineSeries = function ( props: SFProps< - LineSeriesSpec, + LineSeriesSpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -45,7 +44,7 @@ export const LineSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/utils/series.ts b/packages/charts/src/chart_types/xy_chart/utils/series.ts index 01d3831266..0d13658b9e 100644 --- a/packages/charts/src/chart_types/xy_chart/utils/series.ts +++ b/packages/charts/src/chart_types/xy_chart/utils/series.ts @@ -22,7 +22,7 @@ import { X_SCALE_DEFAULT } from '../scales/scale_defaults'; import { SmallMultiplesGroupBy } from '../state/selectors/get_specs'; import { applyFitFunctionToDataSeries } from './fit_function_utils'; import { groupBy } from './group_data_series'; -import { BasicSeriesSpec, SeriesNameConfigOptions, SeriesSpecs, SeriesType, StackMode } from './specs'; +import { BaseDatum, BasicSeriesSpec, SeriesNameConfigOptions, SeriesSpecs, SeriesType, StackMode } from './specs'; import { datumXSortPredicate, formatStackedDataSeriesValues } from './stacked_series_utils'; /** @internal */ @@ -59,8 +59,8 @@ export interface DataSeriesDatum { } /** @public */ -export interface XYChartSeriesIdentifier extends SeriesIdentifier { - yAccessor: Accessor; +export interface XYChartSeriesIdentifier extends SeriesIdentifier { + yAccessor: Accessor; splitAccessors: Map; // does the map have a size vs making it optional smVerticalAccessorValue?: string | number; smHorizontalAccessorValue?: string | number; @@ -68,7 +68,7 @@ export interface XYChartSeriesIdentifier extends SeriesIdentifier { } /** @internal */ -export type DataSeries = XYChartSeriesIdentifier & { +export type DataSeries = XYChartSeriesIdentifier & { groupId: GroupId; seriesType: SeriesType; data: DataSeriesDatum[]; @@ -95,7 +95,10 @@ export function getSeriesIndex(series: SeriesIdentifier[], target: SeriesIdentif * Returns string form of accessor. Uses index when accessor is a function. * @internal */ -export function getAccessorFieldName(accessor: Accessor | AccessorFn, index: number) { +export function getAccessorFieldName( + accessor: Accessor | AccessorFn, + index: number, +): Accessor | string { return typeof accessor === 'function' ? accessor.fieldName ?? `(index:${index})` : accessor; } @@ -245,13 +248,13 @@ export function getSeriesKey( * Get the array of values that forms a series key * @internal */ -function getSplitAccessors( - datum: Datum, - accessors: (Accessor | AccessorFn)[] = [], +function getSplitAccessors( + datum: D, + accessors: (Accessor | AccessorFn)[] = [], ): Map { const splitAccessors = new Map(); if (typeof datum === 'object' && datum !== null) { - accessors.forEach((accessor: Accessor | AccessorFn, index) => { + accessors.forEach((accessor, index) => { const value = getAccessorValue(datum, accessor); if (typeof value === 'string' || typeof value === 'number') { const accessorStr = getAccessorFieldName(accessor, index); @@ -266,12 +269,12 @@ function getSplitAccessors( * Extract y1 and y0 and mark properties from Datum. Casting them to numbers or null * @internal */ -export function extractYAndMarkFromDatum( - datum: Datum, - yAccessor: Accessor | AccessorFn, +export function extractYAndMarkFromDatum( + datum: D, + yAccessor: Accessor | AccessorFn, nonNumericValues: any[], - y0Accessor?: Accessor | AccessorFn, - markSizeAccessor?: Accessor | AccessorFn, + y0Accessor?: Accessor | AccessorFn, + markSizeAccessor?: Accessor | AccessorFn, ): Pick { const mark = markSizeAccessor === undefined ? null : finiteOrNull(getAccessorValue(datum, markSizeAccessor), nonNumericValues); diff --git a/packages/charts/src/chart_types/xy_chart/utils/specs.ts b/packages/charts/src/chart_types/xy_chart/utils/specs.ts index e9fb2e4b75..d98d912f8f 100644 --- a/packages/charts/src/chart_types/xy_chart/utils/specs.ts +++ b/packages/charts/src/chart_types/xy_chart/utils/specs.ts @@ -16,8 +16,8 @@ import { LogScaleOptions, ScaleContinuousType } from '../../../scales'; import { ScaleType } from '../../../scales/constants'; import { Spec } from '../../../specs'; import { SpecType } from '../../../specs/constants'; -import { AccessorFormat, AccessorFn } from '../../../utils/accessor'; -import { RecursivePartial, Position } from '../../../utils/common'; +import { AccessorFormat, AccessorFn, Accessor } from '../../../utils/accessor'; +import { RecursivePartial, Position, Datum } from '../../../utils/common'; import { CurveType } from '../../../utils/curves'; import { OrdinalDomain } from '../../../utils/domain'; import { AxisId, GroupId } from '../../../utils/ids'; @@ -399,7 +399,7 @@ export interface DisplayValueSpec { } /** @public */ -export interface SeriesSpec extends Spec { +export interface SeriesSpec extends Spec { specType: typeof SpecType.Series; chartType: typeof ChartType.XYAxis; /** @@ -484,21 +484,26 @@ export type SeriesColorAccessor = string | SeriesColorsArray | SeriesColorAccess /** @public */ export interface SeriesAccessors { /** The field name of the x value on Datum object */ - xAccessor: keyof D | AccessorFn; + xAccessor: Accessor | AccessorFn; /** An array of field names one per y metric value */ - yAccessors: (keyof D | AccessorFn)[]; + yAccessors: (Accessor | AccessorFn)[]; /** An optional accessor of the y0 value: base point for area/bar charts */ - y0Accessors?: (keyof D | AccessorFn)[]; + y0Accessors?: (Accessor | AccessorFn)[]; /** An array of fields thats indicates the datum series membership */ - splitSeriesAccessors?: (keyof D | AccessorFn)[]; - /** An array of fields thats indicates the stack membership */ - stackAccessors?: (keyof D | AccessorFn)[]; + splitSeriesAccessors?: (Accessor | AccessorFn)[]; + /** + * An array of fields thats indicates the stack membership. + * Does not depend on datum at the moment. + * + * @todo pass datum to accessors when applicable + */ + stackAccessors?: (Accessor | AccessorFn)[]; /** * Field name of mark size metric on `Datum` * * Only used with line/area series */ - markSizeAccessor?: keyof D | AccessorFn; + markSizeAccessor?: Accessor | AccessorFn; } /** @public */ @@ -549,22 +554,22 @@ type MarkFormatter = Type extends 'bar' /** @public */ -export type BasicSeriesSpec = SeriesSpec & +export type BasicSeriesSpec = SeriesSpec & SeriesAccessors & SeriesScales & MarkFormatter; /** @public */ -export type SeriesSpecs = BasicSeriesSpec> = Array; +export type SeriesSpecs = BasicSeriesSpec> = Array; /** @internal */ -export type BaseDatum = Record | unknown; +export type BaseDatum = Record | any[]; /** * This spec describe the dataset configuration used to display a bar series. * @public */ -export type BarSeriesSpec = BasicSeriesSpec & +export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { /** @defaultValue `bar` {@link (SeriesType:type) | SeriesType.Bar} */ seriesType: typeof SeriesType.Bar; @@ -596,7 +601,7 @@ export type BarSeriesSpec = BasicSeriesSpec & * A histogram bar series is identical to a bar series except that stackAccessors are not allowed. * @public */ -export type HistogramBarSeriesSpec = Omit, 'stackAccessors'> & { +export type HistogramBarSeriesSpec = Omit, 'stackAccessors'> & { enableHistogramMode: true; }; @@ -624,7 +629,7 @@ export type FitConfig = { * This spec describe the dataset configuration used to display a line series. * @public */ -export type LineSeriesSpec = BasicSeriesSpec & +export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { /** @defaultValue `line` {@link (SeriesType:type) | SeriesType.Line} */ seriesType: typeof SeriesType.Line; @@ -645,7 +650,7 @@ export type LineSeriesSpec = BasicSeriesSpec & * * @alpha */ -export type BubbleSeriesSpec = BasicSeriesSpec & { +export type BubbleSeriesSpec = BasicSeriesSpec & { /** @defaultValue `bubble` {@link (SeriesType:type) | SeriesType.Bubble} */ seriesType: typeof SeriesType.Bubble; bubbleSeriesStyle?: RecursivePartial; @@ -659,7 +664,7 @@ export type BubbleSeriesSpec = BasicSeriesSpec * This spec describe the dataset configuration used to display an area series. * @public */ -export type AreaSeriesSpec = BasicSeriesSpec & +export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { /** @defaultValue `area` {@link (SeriesType:type) | SeriesType.Area} */ @@ -797,9 +802,9 @@ export type AnnotationDomainType = $Values; * The descriptive object of a line annotation * @public */ -export interface LineAnnotationDatum { +export interface LineAnnotationDatum { /** - * The value on the x or y axis accordingly to the domainType configured + * The value on the x or y axis according to the domainType configured */ dataValue: D; /** @@ -813,16 +818,17 @@ export interface LineAnnotationDatum { } /** @public */ -export type LineAnnotationSpec = BaseAnnotationSpec< +export type LineAnnotationSpec = BaseAnnotationSpec< typeof AnnotationType.Line, LineAnnotationDatum, - LineAnnotationStyle + LineAnnotationStyle, + D > & { domainType: AnnotationDomainType; /** Optional Custom marker icon centered on data value */ - marker?: ReactNode | ComponentWithAnnotationDatum; + marker?: ReactNode | ComponentWithAnnotationDatum; /** Optional marker body, always contained within chart area */ - markerBody?: ReactNode | ComponentWithAnnotationDatum; + markerBody?: ReactNode | ComponentWithAnnotationDatum; /** * Custom marker dimensions; will be computed internally * Any user-supplied values will be overwritten @@ -935,8 +941,9 @@ export type AnnotationPortalSettings = TooltipPortalSettings<'chart'> & { /** @public */ export interface BaseAnnotationSpec< T extends typeof AnnotationType.Rectangle | typeof AnnotationType.Line, - D extends RectAnnotationDatum | LineAnnotationDatum, - S extends RectAnnotationStyle | LineAnnotationStyle + AD extends RectAnnotationDatum | LineAnnotationDatum, + S extends RectAnnotationStyle | LineAnnotationStyle, + D = never > extends Spec, AnnotationPortalSettings { chartType: typeof ChartType.XYAxis; @@ -953,7 +960,7 @@ export interface BaseAnnotationSpec< /** * Data values defined with coordinates and details */ - dataValues: D[]; + dataValues: AD[]; /** * Custom annotation style */ @@ -973,7 +980,7 @@ export interface BaseAnnotationSpec< export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec; /** @internal */ -export function isLineAnnotation(spec: AnnotationSpec): spec is LineAnnotationSpec { +export function isLineAnnotation(spec: AnnotationSpec): spec is LineAnnotationSpec { return spec.annotationType === AnnotationType.Line; } diff --git a/packages/charts/src/components/accessibility/accessibility.test.tsx b/packages/charts/src/components/accessibility/accessibility.test.tsx index 348335b0ac..d307ce63d3 100644 --- a/packages/charts/src/components/accessibility/accessibility.test.tsx +++ b/packages/charts/src/components/accessibility/accessibility.test.tsx @@ -26,7 +26,7 @@ describe('Accessibility', () => { const wrapper = mount( - + , ); expect(wrapper.find('dd').first().text()).toBe('bar chart'); @@ -35,8 +35,8 @@ describe('Accessibility', () => { const wrapper = mount( - - + + , ); expect(wrapper.find('dd').first().text()).toBe('Mixed chart: bar and line chart'); diff --git a/packages/charts/src/components/chart.test.tsx b/packages/charts/src/components/chart.test.tsx index c7f69b01c3..c63e540117 100644 --- a/packages/charts/src/components/chart.test.tsx +++ b/packages/charts/src/components/chart.test.tsx @@ -12,6 +12,11 @@ import React from 'react'; import { Settings, BarSeries } from '../specs'; import { Chart } from './chart'; +interface Datum { + x: number; + y: number; +} + describe('Chart', () => { it("should render 'No data to display' without series", () => { const wrapper = mount(); @@ -31,7 +36,7 @@ describe('Chart', () => { const wrapper = mount( - + id="test" data={[]} xAccessor="x" yAccessors={['y']} /> , ); expect(wrapper.text()).toContain('No data to display'); @@ -41,7 +46,7 @@ describe('Chart', () => { const wrapper = mount( - + , ); expect(wrapper.debug()).toMatchSnapshot(); diff --git a/packages/charts/src/components/error_boundary/error_boundary.tsx b/packages/charts/src/components/error_boundary/error_boundary.tsx index 47af7014c8..4284c53e9a 100644 --- a/packages/charts/src/components/error_boundary/error_boundary.tsx +++ b/packages/charts/src/components/error_boundary/error_boundary.tsx @@ -8,13 +8,13 @@ import React, { Component, ReactNode } from 'react'; -import { SettingsSpecProps } from '../../specs'; +import { SettingsSpec } from '../../specs/settings'; import { NoResults } from '../no_results'; import { isGracefulError } from './errors'; type ErrorBoundaryProps = { children: ReactNode; - renderFn?: SettingsSpecProps['noResults']; + renderFn?: SettingsSpec['noResults']; }; interface ErrorBoundaryState { diff --git a/packages/charts/src/components/legend/legend.test.tsx b/packages/charts/src/components/legend/legend.test.tsx index 4143dab187..656b5c588e 100644 --- a/packages/charts/src/components/legend/legend.test.tsx +++ b/packages/charts/src/components/legend/legend.test.tsx @@ -284,7 +284,14 @@ describe('Legend', () => { const wrapper = mount( - + , ); const legendItems = wrapper.find(LegendListItem); diff --git a/packages/charts/src/components/no_results.tsx b/packages/charts/src/components/no_results.tsx index a8987dc7ed..be217c0da1 100644 --- a/packages/charts/src/components/no_results.tsx +++ b/packages/charts/src/components/no_results.tsx @@ -8,10 +8,10 @@ import React, { FC, Suspense } from 'react'; -import { SettingsSpecProps } from '../specs'; +import { SettingsProps } from '../specs'; interface NoResultsProps { - renderFn?: SettingsSpecProps['noResults']; + renderFn?: SettingsProps['noResults']; } /** @internal */ diff --git a/packages/charts/src/specs/group_by.ts b/packages/charts/src/specs/group_by.ts index d6370d9e28..7e2a2cbb0a 100644 --- a/packages/charts/src/specs/group_by.ts +++ b/packages/charts/src/specs/group_by.ts @@ -12,6 +12,7 @@ import { BaseDatum, Spec } from '.'; import { ChartType } from '../chart_types'; import { Predicate } from '../common/predicate'; import { buildSFProps, SFProps, useSpecFactory } from '../state/spec_factory'; +import { Datum } from '../utils/common'; import { SpecType } from './constants'; /** @public */ @@ -43,7 +44,7 @@ export interface GroupBySpec extends Spec { format?: GroupByFormatter; } -const buildProps = buildSFProps>()( +const buildProps = buildSFProps()( { chartType: ChartType.Global, specType: SpecType.IndexOrder, @@ -55,9 +56,9 @@ const buildProps = buildSFProps>()( * Add GroupBy spec to chart * @public */ -export const GroupBy = function ( +export const GroupBy = function ( props: SFProps< - GroupBySpec, + GroupBySpec, keyof typeof buildProps['overrides'], keyof typeof buildProps['defaults'], keyof typeof buildProps['optionals'], @@ -65,7 +66,7 @@ export const GroupBy = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...props, ...overrides }); return null; }; diff --git a/packages/charts/src/specs/settings.tsx b/packages/charts/src/specs/settings.tsx index fcf7baba7a..54606d9965 100644 --- a/packages/charts/src/specs/settings.tsx +++ b/packages/charts/src/specs/settings.tsx @@ -12,7 +12,7 @@ import { CustomXDomain, GroupByAccessor, Spec, TooltipStickTo } from '.'; import { Cell } from '../chart_types/heatmap/layout/types/viewmodel_types'; import { PrimitiveValue } from '../chart_types/partition_chart/layout/utils/group_by_rollup'; import { LegendStrategy } from '../chart_types/partition_chart/layout/utils/highlighted_geoms'; -import { LineAnnotationDatum, RectAnnotationDatum } from '../chart_types/specs'; +import { BaseDatum, LineAnnotationDatum, RectAnnotationDatum } from '../chart_types/specs'; import { WordModel } from '../chart_types/wordcloud/layout/types/viewmodel_types'; import { XYChartSeriesIdentifier } from '../chart_types/xy_chart/utils/series'; import { Color } from '../common/colors'; @@ -24,6 +24,7 @@ import { LegendPath } from '../state/actions/legend'; import { SFProps, useSpecFactory } from '../state/spec_factory'; import { Accessor } from '../utils/accessor'; import { + Datum, HorizontalAlignment, LayoutDirection, Position, @@ -215,7 +216,7 @@ export type PointerEvent = PointerOverEvent | PointerOutEvent; * This interface describe the properties of single value shown in the tooltip * @public */ -export interface TooltipValue { +export interface TooltipValue { /** * The label of the tooltip value */ @@ -255,13 +256,13 @@ export interface TooltipValue { /** * The accessor linked to the current tooltip value */ - valueAccessor?: Accessor; + valueAccessor?: Accessor; /** * The datum associated with the current tooltip value * Maybe not available */ - datum?: unknown; + datum?: D; } /** @@ -690,7 +691,7 @@ export const Settings = function ( }; /** @public */ -export type SettingsProp = ComponentProps; +export type SettingsProps = ComponentProps; /** @internal */ export function isPointerOutEvent(event: PointerEvent | null | undefined): event is PointerOutEvent { diff --git a/packages/charts/src/utils/accessor.ts b/packages/charts/src/utils/accessor.ts index 25e98190be..aa381b0e2d 100644 --- a/packages/charts/src/utils/accessor.ts +++ b/packages/charts/src/utils/accessor.ts @@ -34,7 +34,7 @@ export type BinaryAccessorFn = (datum: * An accessor function * @public */ -export type AccessorFn = UnaryAccessorFn; +export type AccessorFn = UnaryAccessorFn; /** * An indexed accessor function @@ -56,11 +56,24 @@ export type AccessorObjectKey = string; */ export type AccessorArrayIndex = number; +/** + * Need to check for array to exclude array prototype keys. + * + * @todo tighten keyof types by removing string fallback. This will make it harder to satisfy the + * types for complex data values. + * + * Note: ignores symbols as keys + * @public + */ +export type DatumKey = D extends any[] ? number : Exclude; + /** * A datum accessor in form of object key accessor string/number * @public */ -export type Accessor = AccessorObjectKey | AccessorArrayIndex; +export type Accessor = D extends never + ? AccessorObjectKey | AccessorArrayIndex + : DatumKey; /** * Accessor format for _banded_ series as postfix string or accessor function @@ -94,12 +107,17 @@ export function getAccessorFormatLabel(accessor: AccessorFormat, label: string): * Helper function to get accessor value from string, number or function * @internal */ -export function getAccessorValue(datum: Datum, accessor: Accessor | AccessorFn) { +export function getAccessorValue(datum: D, accessor: Accessor | AccessorFn) { if (typeof accessor === 'function') { return accessor(datum); } - return datum[accessor]; + try { + // @ts-ignore - could throw error if not proper key accessed + return datum[accessor]; + } catch { + return undefined; + } } /** diff --git a/packages/charts/src/utils/common.ts b/packages/charts/src/utils/common.ts index 4635a8a7d0..dd4d4220b8 100644 --- a/packages/charts/src/utils/common.ts +++ b/packages/charts/src/utils/common.ts @@ -422,7 +422,7 @@ export function mergePartial( /** @public */ export type ValueFormatter = (value: number) => string; /** @public */ -export type ValueAccessor = (d: D) => AdditiveNumber; +export type ValueAccessor = (d: D) => AdditiveNumber; /** @public */ export type LabelAccessor = (value: T) => string; /** @public */ From ba3c8fc0c1c48d70df6e20a50feed8688e942269 Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Fri, 15 Oct 2021 16:01:09 -0500 Subject: [PATCH 03/12] fix: storybook typings --- packages/charts/src/utils/accessor.ts | 2 +- .../annotations/lines/8_advanced_markers.story.tsx | 2 ++ .../stories/annotations/rects/6_zero_domain.story.tsx | 2 ++ storybook/stories/bar/24_tooltip_visibility.story.tsx | 2 +- storybook/stories/bar/49_test_dual_axis.story.tsx | 2 ++ storybook/stories/debug/2_debug_state.story.tsx | 6 ++++++ storybook/stories/grids/1_basic.story.tsx | 1 - storybook/stories/grids/3_lines.story.tsx | 9 ++++++++- storybook/stories/legend/14_single_series.story.tsx | 4 ++++ storybook/stories/legend/1_legend_right.story.tsx | 7 ++----- storybook/stories/legend/7_display_values.story.tsx | 2 +- .../stories/line/15_test_negative_points.story.tsx | 10 +++++++++- storybook/stories/scales/7_log_scale_options.story.tsx | 2 ++ storybook/stories/scales/8_linear_binary.story.tsx | 1 + .../stories/small_multiples/5_histogram_bars.story.tsx | 2 ++ .../stories/small_multiples/7_sunbursts.story.tsx | 1 - storybook/stories/stylings/23_with_texture.story.tsx | 2 ++ .../stylings/24_texture_multiple_series.story.tsx | 2 ++ .../stories/stylings/25_mixed_point_shapes.story.tsx | 6 ++++++ .../stories/test_cases/2_chrome_path_bug_fix.story.tsx | 2 ++ .../test_cases/4_filter_zero_values_log.story.tsx | 2 ++ .../test_cases/5_legend_scroll_bar_sizing.story.tsx | 2 ++ 22 files changed, 59 insertions(+), 12 deletions(-) diff --git a/packages/charts/src/utils/accessor.ts b/packages/charts/src/utils/accessor.ts index aa381b0e2d..dcf9a22591 100644 --- a/packages/charts/src/utils/accessor.ts +++ b/packages/charts/src/utils/accessor.ts @@ -65,7 +65,7 @@ export type AccessorArrayIndex = number; * Note: ignores symbols as keys * @public */ -export type DatumKey = D extends any[] ? number : Exclude; +export type DatumKey = D extends any[] ? number : Exclude | string; /** * A datum accessor in form of object key accessor string/number diff --git a/storybook/stories/annotations/lines/8_advanced_markers.story.tsx b/storybook/stories/annotations/lines/8_advanced_markers.story.tsx index 6aa942962a..6bc6d192c1 100644 --- a/storybook/stories/annotations/lines/8_advanced_markers.story.tsx +++ b/storybook/stories/annotations/lines/8_advanced_markers.story.tsx @@ -134,6 +134,8 @@ export const Example = () => { ({ x: start.clone().add(i, 'd').valueOf(), y: maxMetric }))} diff --git a/storybook/stories/annotations/rects/6_zero_domain.story.tsx b/storybook/stories/annotations/rects/6_zero_domain.story.tsx index c7279d7464..e3ccb66e19 100644 --- a/storybook/stories/annotations/rects/6_zero_domain.story.tsx +++ b/storybook/stories/annotations/rects/6_zero_domain.story.tsx @@ -52,6 +52,8 @@ export const Example = () => { /> { yScaleType={ScaleType.Linear} xAccessor="x" yAccessors={['y1', 'y2']} - splitSeriesAccessors={['g1', 'g2', 'g3']} + splitSeriesAccessors={['g1', 'g2']} data={TestDatasets.BARCHART_2Y2G} filterSeriesInTooltip={isVisibleFunction} /> diff --git a/storybook/stories/bar/49_test_dual_axis.story.tsx b/storybook/stories/bar/49_test_dual_axis.story.tsx index 53d0782ac9..dd35a4913a 100644 --- a/storybook/stories/bar/49_test_dual_axis.story.tsx +++ b/storybook/stories/bar/49_test_dual_axis.story.tsx @@ -56,6 +56,7 @@ export const Example = () => { groupId="2" xScaleType={ScaleType.Ordinal} xAccessor="x" + yAccessors={['y']} stackAccessors={stack13 ? ['y'] : undefined} data={[ { x: 'trousers', y: 39 }, @@ -69,6 +70,7 @@ export const Example = () => { id="bars4" xScaleType={ScaleType.Ordinal} xAccessor="x" + yAccessors={['y']} stackAccessors={stack24 ? ['y'] : undefined} data={[ { x: 'trousers', y: 39 }, diff --git a/storybook/stories/debug/2_debug_state.story.tsx b/storybook/stories/debug/2_debug_state.story.tsx index 5d423bfb54..6d2df742d9 100644 --- a/storybook/stories/debug/2_debug_state.story.tsx +++ b/storybook/stories/debug/2_debug_state.story.tsx @@ -73,6 +73,8 @@ export const Example = () => { { { { xAccessor="x" yAccessors={['y']} stackAccessors={['x']} - splitSeriesAccessors={['g']} data={[ { x: 0, y: 3 }, { x: 1, y: 2 }, diff --git a/storybook/stories/grids/3_lines.story.tsx b/storybook/stories/grids/3_lines.story.tsx index 71f1e93609..9fbe06a9c4 100644 --- a/storybook/stories/grids/3_lines.story.tsx +++ b/storybook/stories/grids/3_lines.story.tsx @@ -83,7 +83,14 @@ export const Example = () => { /> - + ); }; diff --git a/storybook/stories/legend/14_single_series.story.tsx b/storybook/stories/legend/14_single_series.story.tsx index a4e872f3ee..cb2250244c 100644 --- a/storybook/stories/legend/14_single_series.story.tsx +++ b/storybook/stories/legend/14_single_series.story.tsx @@ -32,6 +32,8 @@ export const Example = () => { series.push( { /> { - const yAccessors = ['y1', 'y2']; - const splitSeriesAccessors = ['g1', 'g2']; - return ( @@ -28,8 +25,8 @@ export const Example = () => { xScaleType={ScaleType.Linear} yScaleType={ScaleType.Linear} xAccessor="x" - yAccessors={yAccessors} - splitSeriesAccessors={splitSeriesAccessors} + yAccessors={['y1', 'y2']} + splitSeriesAccessors={['g1', 'g2']} data={TestDatasets.BARCHART_2Y2G} hideInLegend={false} /> diff --git a/storybook/stories/legend/7_display_values.story.tsx b/storybook/stories/legend/7_display_values.story.tsx index 4b4f9e93a4..d3d423d30b 100644 --- a/storybook/stories/legend/7_display_values.story.tsx +++ b/storybook/stories/legend/7_display_values.story.tsx @@ -32,7 +32,7 @@ export const Example = () => { const namesArray = arrayKnobs('series names (in sort order)', ['jpg', 'php', 'png', 'css', 'gif']); - const seriesComponents = tsvbSeries.map((series: any) => { + const seriesComponents = tsvbSeries.map((series) => { const nameIndex = namesArray.findIndex((name) => name === series.label); const sortIndex = nameIndex > -1 ? nameIndex : undefined; diff --git a/storybook/stories/line/15_test_negative_points.story.tsx b/storybook/stories/line/15_test_negative_points.story.tsx index eeb2d0958f..72bf5f81b8 100644 --- a/storybook/stories/line/15_test_negative_points.story.tsx +++ b/storybook/stories/line/15_test_negative_points.story.tsx @@ -38,7 +38,15 @@ export const Example = () => { - + ); }; diff --git a/storybook/stories/scales/7_log_scale_options.story.tsx b/storybook/stories/scales/7_log_scale_options.story.tsx index 52d92e4ce4..3d7eb5a0e4 100644 --- a/storybook/stories/scales/7_log_scale_options.story.tsx +++ b/storybook/stories/scales/7_log_scale_options.story.tsx @@ -140,6 +140,8 @@ export const Example = () => { { yScaleType={yScaleType} data={data} yNice={yNice} + xAccessor="x" yAccessors={[yAccessor]} /> diff --git a/storybook/stories/small_multiples/5_histogram_bars.story.tsx b/storybook/stories/small_multiples/5_histogram_bars.story.tsx index 7d8b4cd141..4bad47a7c8 100644 --- a/storybook/stories/small_multiples/5_histogram_bars.story.tsx +++ b/storybook/stories/small_multiples/5_histogram_bars.story.tsx @@ -78,6 +78,8 @@ export const Example = () => { xScaleType={ScaleType.Linear} yScaleType={ScaleType.Linear} data={data} + xAccessor="x" + yAccessors={['y']} splitSeriesAccessors={['split']} color={(seriesIdentifier) => { return colorMap[seriesIdentifier.splitAccessors.get('split') ?? 'Default']; diff --git a/storybook/stories/small_multiples/7_sunbursts.story.tsx b/storybook/stories/small_multiples/7_sunbursts.story.tsx index b3f6257ede..cbd70a4d48 100644 --- a/storybook/stories/small_multiples/7_sunbursts.story.tsx +++ b/storybook/stories/small_multiples/7_sunbursts.story.tsx @@ -84,7 +84,6 @@ export const Example = () => { sort={select('Panel order', { alphaAsc: 'alphaAsc', alphaDesc: 'alphaDesc' }, 'alphaAsc')} /> { color={seriesColor} xScaleType={ScaleType.Linear} yScaleType={ScaleType.Linear} + xAccessor="x" + yAccessors={['y']} data={seriesType === 'bar' ? barData : areaData} curve={CurveType.CURVE_MONOTONE_X} /> diff --git a/storybook/stories/stylings/24_texture_multiple_series.story.tsx b/storybook/stories/stylings/24_texture_multiple_series.story.tsx index d5b828d7b0..9e6f6188f2 100644 --- a/storybook/stories/stylings/24_texture_multiple_series.story.tsx +++ b/storybook/stories/stylings/24_texture_multiple_series.story.tsx @@ -144,6 +144,8 @@ export const Example = () => { texture: getTexture(random), }, }} + xAccessor="x" + yAccessors={['y']} color={chartColor} stackAccessors={['yes']} data={data[i]} diff --git a/storybook/stories/stylings/25_mixed_point_shapes.story.tsx b/storybook/stories/stylings/25_mixed_point_shapes.story.tsx index 8a31699ffd..b4742c52f7 100644 --- a/storybook/stories/stylings/25_mixed_point_shapes.story.tsx +++ b/storybook/stories/stylings/25_mixed_point_shapes.story.tsx @@ -60,6 +60,8 @@ export const Example = () => { fill: fillKnobArea, }, }} + xAccessor="x" + yAccessors={['y']} xScaleType={ScaleType.Linear} yScaleType={ScaleType.Linear} data={[ @@ -79,6 +81,8 @@ export const Example = () => { fill: fillKnobLine, }, }} + xAccessor="x" + yAccessors={['y']} xScaleType={ScaleType.Linear} yScaleType={ScaleType.Linear} data={[ @@ -98,6 +102,8 @@ export const Example = () => { fill: fillKnobBubble, }, }} + xAccessor="x" + yAccessors={['y']} xScaleType={ScaleType.Linear} yScaleType={ScaleType.Linear} data={[ diff --git a/storybook/stories/test_cases/2_chrome_path_bug_fix.story.tsx b/storybook/stories/test_cases/2_chrome_path_bug_fix.story.tsx index 40ff724fbc..57ec0f894a 100644 --- a/storybook/stories/test_cases/2_chrome_path_bug_fix.story.tsx +++ b/storybook/stories/test_cases/2_chrome_path_bug_fix.story.tsx @@ -76,6 +76,8 @@ export const Example = () => { xScaleType="time" yScaleType={ScaleType.Linear} stackAccessors={['yes']} + xAccessor="x" + yAccessors={['y']} splitSeriesAccessors={['g']} data={data} /> diff --git a/storybook/stories/test_cases/4_filter_zero_values_log.story.tsx b/storybook/stories/test_cases/4_filter_zero_values_log.story.tsx index bcd728bc07..a522cf4177 100644 --- a/storybook/stories/test_cases/4_filter_zero_values_log.story.tsx +++ b/storybook/stories/test_cases/4_filter_zero_values_log.story.tsx @@ -33,6 +33,8 @@ export const Example = () => { { Date: Fri, 15 Oct 2021 16:40:12 -0500 Subject: [PATCH 04/12] chore: fix api errors and update api docs --- package.json | 4 +- packages/charts/api/charts.api.md | 231 +++++++++--------- .../src/chart_types/xy_chart/utils/specs.ts | 7 +- packages/charts/src/specs/constants.ts | 2 +- packages/charts/src/state/spec_factory.ts | 4 +- packages/charts/src/utils/accessor.ts | 2 +- yarn.lock | 136 ++++------- 7 files changed, 174 insertions(+), 212 deletions(-) diff --git a/package.json b/package.json index 9d572f2d07..da88b380a3 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ "@elastic/datemath": "^5.0.3", "@elastic/eui": "^38.2.0", "@mdx-js/loader": "^1.6.6", - "@microsoft/api-documenter": "^7.12.7", - "@microsoft/api-extractor": "^7.18.9", + "@microsoft/api-documenter": "^7.13.63", + "@microsoft/api-extractor": "^7.18.16", "@semantic-release/changelog": "^5.0.1", "@semantic-release/commit-analyzer": "^8.0.1", "@semantic-release/exec": "^5.0.0", diff --git a/packages/charts/api/charts.api.md b/packages/charts/api/charts.api.md index 582d628c95..359400a61a 100644 --- a/packages/charts/api/charts.api.md +++ b/packages/charts/api/charts.api.md @@ -5,19 +5,25 @@ ```ts import { $Values } from 'utility-types'; +import { ComponentProps } from 'react'; import { ComponentType } from 'react'; +import { FC } from 'react'; +import { OptionalKeys } from 'utility-types'; import { default as React_2 } from 'react'; import { ReactChild } from 'react'; import { ReactNode } from 'react'; +import { RequiredKeys } from 'utility-types'; +// Warning: (ae-forgotten-export) The symbol "DatumKey" needs to be exported by the entry point index.d.ts +// // @public -export type Accessor = AccessorObjectKey | AccessorArrayIndex; +export type Accessor = D extends never ? AccessorObjectKey | AccessorArrayIndex : DatumKey; // @public export type AccessorArrayIndex = number; // @public -export type AccessorFn = UnaryAccessorFn; +export type AccessorFn = UnaryAccessorFn; // @public export type AccessorObjectKey = string; @@ -66,7 +72,7 @@ export type AnnotationPortalSettings = TooltipPortalSettings<'chart'> & { }; // @public (undocumented) -export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec; +export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec; // @public (undocumented) export type AnnotationTooltipFormatter = (details?: string) => JSX.Element | null; @@ -96,14 +102,13 @@ export interface ArcStyle { visible: boolean; } -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "SFProps" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -export const AreaSeries: React_2.FunctionComponent; +// @public +export const AreaSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "areaSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "markFormat" | "stackMode" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { +export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { seriesType: typeof SeriesType.Area; curve?: CurveType; areaSeriesStyle?: RecursivePartial; @@ -145,11 +150,8 @@ export interface ArrayNode extends NodeDescriptor { [SORT_INDEX_KEY]: number; } -// Warning: (ae-forgotten-export) The symbol "SpecRequired" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionals" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const Axis: React_2.FunctionComponent; +// @public +export const Axis: FC>; // @public (undocumented) export type AxisId = string; @@ -239,14 +241,11 @@ export interface BandFillColorAccessorInput { value: number; } -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const BarSeries: React_2.FunctionComponent; +// @public +export const BarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { +export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { seriesType: typeof SeriesType.Bar; enableHistogramMode?: boolean; barSeriesStyle?: RecursivePartial; @@ -272,11 +271,11 @@ export type BarStyleAccessor = (datum: DataSeriesDatum, seriesIdentifier: XYChar export type BarStyleOverride = RecursivePartial | Color | null; // @public (undocumented) -export interface BaseAnnotationSpec extends Spec, AnnotationPortalSettings { +export interface BaseAnnotationSpec, S extends RectAnnotationStyle | LineAnnotationStyle, D = never> extends Spec, AnnotationPortalSettings { annotationType: T; // (undocumented) chartType: typeof ChartType.XYAxis; - dataValues: D[]; + dataValues: AD[]; groupId: GroupId; hideTooltips?: boolean; // (undocumented) @@ -285,6 +284,9 @@ export interface BaseAnnotationSpec | any[]; + // @public (undocumented) export interface BasePointerEvent { // (undocumented) @@ -296,10 +298,10 @@ export interface BasePointerEvent { // @public (undocumented) export type BasicListener = () => undefined | void; +// Warning: (ae-forgotten-export) The symbol "MarkFormatter" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -export type BasicSeriesSpec = SeriesSpec & SeriesAccessors & SeriesScales & { - markFormat?: TickFormatter; -}; +export type BasicSeriesSpec = SeriesSpec & SeriesAccessors & SeriesScales & MarkFormatter; // @public export const BinAgg: Readonly<{ @@ -326,14 +328,13 @@ export type BrushEndListener = (brushAreaEvent: BrushEvent) => void; // @public (undocumented) export type BrushEvent = XYBrushEvent | HeatmapBrushEvent; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-incompatible-release-tags) The symbol "BubbleSeries" is marked as @public, but its signature references "BubbleSeriesSpec" which is marked as @alpha // -// @alpha -export const BubbleSeries: React_2.FunctionComponent; +// @public +export const BubbleSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend", "sortIndex" | "name" | "timeZone" | "color" | "bubbleSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @alpha -export type BubbleSeriesSpec = BasicSeriesSpec & { +export type BubbleSeriesSpec = BasicSeriesSpec & { seriesType: typeof SeriesType.Bubble; bubbleSeriesStyle?: RecursivePartial; pointStyleAccessor?: PointStyleAccessor; @@ -474,7 +475,7 @@ export const ColorVariant: Readonly<{ export type ColorVariant = $Values; // @public -export type ComponentWithAnnotationDatum = ComponentType; +export type ComponentWithAnnotationDatum = ComponentType>; // @public (undocumented) export type ContinuousDomain = [min: number, max: number]; @@ -625,9 +626,6 @@ export const DEFAULT_TOOLTIP_SNAP = true; // @public export const DEFAULT_TOOLTIP_TYPE: "vertical"; -// @public (undocumented) -export type DefaultSettingsProps = 'id' | 'chartType' | 'specType' | 'rendering' | 'rotation' | 'resizeDebounce' | 'pointerUpdateDebounce' | 'pointerUpdateTrigger' | 'animateData' | 'debug' | 'tooltip' | 'theme' | 'brushAxis' | 'minBrushDelta' | 'externalPointerEvents' | 'showLegend' | 'showLegendExtra' | 'legendPosition' | 'legendMaxDepth' | 'ariaUseDefaultSummary' | 'ariaLabelHeadingLevel' | 'ariaTableCaption' | 'allowBrushingLastHistogramBin'; - // @public (undocumented) export const DEPTH_KEY = "depth"; @@ -781,15 +779,17 @@ export interface GeometryValue { // @public (undocumented) export function getNodeName(node: ArrayNode): string; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @alpha (undocumented) -export const Goal: React_2.FunctionComponent; +// @alpha +export const Goal: FC>; // @alpha (undocumented) export type GoalLabelAccessor = LabelAccessor; +// Warning: (ae-incompatible-release-tags) The symbol "GoalProps" is marked as @public, but its signature references "Goal" which is marked as @alpha +// +// @public (undocumented) +export type GoalProps = ComponentProps; + // @alpha (undocumented) export interface GoalSpec extends Spec { // (undocumented) @@ -880,17 +880,19 @@ export interface GroupBrushExtent { groupId: GroupId; } -// @alpha (undocumented) -export const GroupBy: React_2.FunctionComponent; +// Warning: (ae-incompatible-release-tags) The symbol "GroupBy" is marked as @public, but its signature references "GroupBySpec" which is marked as @alpha +// +// @public +export const GroupBy: (props: SFProps, "chartType" | "specType", never, "format", "id" | "sort" | "by">) => null; // @public (undocumented) -export type GroupByAccessor = (spec: Spec, datum: any) => string | number; +export type GroupByAccessor = (spec: Spec, datum: D) => string | number; // @public -export type GroupByFormatter = (value: ReturnType) => string; +export type GroupByFormatter = (value: ReturnType>) => string; -// @alpha (undocumented) -export type GroupByProps = Pick; +// @public (undocumented) +export type GroupByProps = ComponentProps; // Warning: (ae-forgotten-export) The symbol "Predicate" needs to be exported by the entry point index.d.ts // @@ -898,17 +900,17 @@ export type GroupByProps = Pick; export type GroupBySort = Predicate; // @alpha (undocumented) -export interface GroupBySpec extends Spec { - by: GroupByAccessor; - format?: GroupByFormatter; +export interface GroupBySpec extends Spec { + by: GroupByAccessor; + format?: GroupByFormatter; sort: GroupBySort; } // @public (undocumented) export type GroupId = string; -// @alpha (undocumented) -export const Heatmap: React_2.FunctionComponent & Partial>>; +// @alpha +export const Heatmap: (props: SFProps, "chartType" | "specType", "data" | "config" | "valueAccessor" | "valueFormatter" | "xScaleType" | "xSortPredicate" | "ySortPredicate", "name" | "highlightedData", "id" | "xAccessor" | "yAccessor" | "colorScale">) => null; // @alpha (undocumented) export interface HeatmapBandsColorScale { @@ -1033,7 +1035,7 @@ export interface HeatmapConfig { export type HeatmapElementEvent = [Cell, SeriesIdentifier]; // @alpha (undocumented) -export interface HeatmapSpec extends Spec { +export interface HeatmapSpec extends Spec { // (undocumented) chartType: typeof ChartType.Heatmap; // (undocumented) @@ -1041,7 +1043,7 @@ export interface HeatmapSpec extends Spec { // (undocumented) config: RecursivePartial; // (undocumented) - data: Datum[]; + data: D[]; // (undocumented) highlightedData?: { x: Array; @@ -1056,13 +1058,13 @@ export interface HeatmapSpec extends Spec { // (undocumented) valueFormatter: (value: number) => string; // (undocumented) - xAccessor: Accessor | AccessorFn; + xAccessor: Accessor | AccessorFn; // (undocumented) xScaleType: SeriesScales['xScaleType']; // (undocumented) xSortPredicate: Predicate; // (undocumented) - yAccessor: Accessor | AccessorFn; + yAccessor: Accessor | AccessorFn; // (undocumented) ySortPredicate: Predicate; } @@ -1073,14 +1075,11 @@ export const HIERARCHY_ROOT_KEY: Key; // @public (undocumented) export type HierarchyOfArrays = Array; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const HistogramBarSeries: React_2.FunctionComponent; +// @public +export const HistogramBarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type HistogramBarSeriesSpec = Omit & { +export type HistogramBarSeriesSpec = Omit, 'stackAccessors'> & { enableHistogramMode: true; }; @@ -1114,7 +1113,7 @@ export type HorizontalAlignment = $Values; // Warning: (ae-forgotten-export) The symbol "BinaryAccessorFn" needs to be exported by the entry point index.d.ts // // @public -export type IndexedAccessorFn = UnaryAccessorFn | BinaryAccessorFn; +export type IndexedAccessorFn = UnaryAccessorFn | BinaryAccessorFn; // @public (undocumented) export const INPUT_KEY = "inputIndex"; @@ -1255,15 +1254,12 @@ export interface LegendStyle { // @public (undocumented) export const LIGHT_THEME: Theme; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const LineAnnotation: React_2.FunctionComponent; +// @public +export const LineAnnotation: (props: SFProps, "chartType" | "specType", "style" | "zIndex" | "groupId" | "hideLines" | "hideLinesTooltips" | "annotationType" | "hideTooltips", "offset" | "fallbackPlacements" | "placement" | "boundary" | "boundaryPadding" | "marker" | "customTooltip" | "markerBody" | "markerDimensions" | "markerPosition" | "customTooltipDetails", "id" | "dataValues" | "domainType">) => null; // @public -export interface LineAnnotationDatum { - dataValue: any; +export interface LineAnnotationDatum { + dataValue: D; details?: string; header?: string; } @@ -1271,14 +1267,14 @@ export interface LineAnnotationDatum { // @public (undocumented) export type LineAnnotationEvent = { id: SpecId; - datum: LineAnnotationDatum; + datum: LineAnnotationDatum; }; // @public (undocumented) -export type LineAnnotationSpec = BaseAnnotationSpec & { +export type LineAnnotationSpec = BaseAnnotationSpec, LineAnnotationStyle, D> & { domainType: AnnotationDomainType; - marker?: ReactNode | ComponentWithAnnotationDatum; - markerBody?: ReactNode | ComponentWithAnnotationDatum; + marker?: ReactNode | ComponentWithAnnotationDatum; + markerBody?: ReactNode | ComponentWithAnnotationDatum; markerDimensions?: { width: number; height: number; @@ -1296,14 +1292,11 @@ export interface LineAnnotationStyle { line: StrokeStyle & Opacity & Partial; } -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const LineSeries: React_2.FunctionComponent; +// @public +export const LineSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "lineSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { +export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { seriesType: typeof SeriesType.Line; curve?: CurveType; lineSeriesStyle?: RecursivePartial; @@ -1413,11 +1406,10 @@ export function parentAccessor(n: ArrayEntry): ArrayNode; // @public (undocumented) export type PartialTheme = RecursivePartial; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "PartitionSpec" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -export const Partition: React_2.FunctionComponent; +// @public +export const Partition: (props: SFProps, "chartType" | "specType", "config" | "valueAccessor" | "valueFormatter" | "valueGetter" | "percentFormatter" | "topGroove" | "smallMultiples" | "layers", never, "id" | "data">) => null; // Warning: (ae-forgotten-export) The symbol "StaticConfig" needs to be exported by the entry point index.d.ts // @@ -1442,13 +1434,13 @@ export interface PartitionFillLabel extends LabelConfig { } // @public -export interface PartitionLayer { +export interface PartitionLayer { // Warning: (ae-forgotten-export) The symbol "ExtendedFillLabelConfig" needs to be exported by the entry point index.d.ts // // (undocumented) fillLabel?: Partial; // (undocumented) - groupByRollup: IndexedAccessorFn; + groupByRollup: IndexedAccessorFn; // (undocumented) nodeLabel?: LabelAccessor; // (undocumented) @@ -1630,7 +1622,7 @@ export type Ratio = number; export type RawTextGetter = (node: ShapeTreeNode) => string; // @public (undocumented) -export const RectAnnotation: React_2.FunctionComponent & Partial>>; +export const RectAnnotation: FC>; // @public export interface RectAnnotationDatum { @@ -1739,13 +1731,13 @@ export interface SectorGeomSpecY { } // @public (undocumented) -export interface SeriesAccessors { - markSizeAccessor?: Accessor | AccessorFn; - splitSeriesAccessors?: (Accessor | AccessorFn)[]; - stackAccessors?: (Accessor | AccessorFn)[]; - xAccessor: Accessor | AccessorFn; - y0Accessors?: (Accessor | AccessorFn)[]; - yAccessors: (Accessor | AccessorFn)[]; +export interface SeriesAccessors { + markSizeAccessor?: Accessor | AccessorFn; + splitSeriesAccessors?: (Accessor | AccessorFn)[]; + stackAccessors?: (Accessor | AccessorFn)[]; + xAccessor: Accessor | AccessorFn; + y0Accessors?: (Accessor | AccessorFn)[]; + yAccessors: (Accessor | AccessorFn)[]; } // @public (undocumented) @@ -1799,11 +1791,11 @@ export interface SeriesScales { } // @public (undocumented) -export interface SeriesSpec extends Spec { +export interface SeriesSpec extends Spec { // (undocumented) chartType: typeof ChartType.XYAxis; color?: SeriesColorAccessor; - data: Datum[]; + data: D[]; // (undocumented) displayValueSettings?: DisplayValueSpec; filterSeriesInTooltip?: FilterPredicate; @@ -1823,7 +1815,7 @@ export interface SeriesSpec extends Spec { } // @public (undocumented) -export type SeriesSpecs = Array; +export type SeriesSpecs = BasicSeriesSpec> = Array; // @public (undocumented) export const SeriesType: Readonly<{ @@ -1836,8 +1828,16 @@ export const SeriesType: Readonly<{ // @public export type SeriesType = $Values; +// @public +export const Settings: (props: SFProps) => null; + +// Warning: (ae-forgotten-export) The symbol "BuildProps" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -export const Settings: React_2.FunctionComponent; +export const settingsBuildProps: BuildProps; + +// @public (undocumented) +export type SettingsProps = ComponentProps; // @public export interface SettingsSpec extends Spec, LegendSpec { @@ -1891,9 +1891,6 @@ export interface SettingsSpec extends Spec, LegendSpec { xDomain?: CustomXDomain; } -// @public (undocumented) -export type SettingsSpecProps = Partial>; - // @public (undocumented) export interface ShapeTreeNode extends TreeNode, SectorGeomSpecY { // (undocumented) @@ -1933,11 +1930,13 @@ export interface SimplePadding { outer: number; } -// @alpha (undocumented) -export const SmallMultiples: React_2.FunctionComponent; +// @alpha +export const SmallMultiples: FC>; -// @alpha (undocumented) -export type SmallMultiplesProps = Partial>; +// Warning: (ae-incompatible-release-tags) The symbol "SmallMultiplesProps" is marked as @public, but its signature references "SmallMultiples" which is marked as @alpha +// +// @public (undocumented) +export type SmallMultiplesProps = ComponentProps; // @alpha (undocumented) export interface SmallMultiplesSpec extends Spec { @@ -2200,9 +2199,9 @@ export const TooltipType: Readonly<{ export type TooltipType = $Values; // @public -export interface TooltipValue { +export interface TooltipValue { color: Color; - datum?: unknown; + datum?: D; formattedMarkValue?: string | null; formattedValue: string; isHighlighted: boolean; @@ -2211,7 +2210,7 @@ export interface TooltipValue { markValue?: number | null; seriesIdentifier: SeriesIdentifier; value: any; - valueAccessor?: Accessor; + valueAccessor?: Accessor; } // @public @@ -2235,14 +2234,14 @@ export interface TreeNode extends AngleFromTo { } // @public -export interface UnaryAccessorFn { +export interface UnaryAccessorFn { // (undocumented) - (datum: Datum): Return; + (datum: D): Return; fieldName?: string; } // @public (undocumented) -export type ValueAccessor = (d: Datum) => AdditiveNumber; +export type ValueAccessor = (d: D) => AdditiveNumber; // @public (undocumented) export type ValueFormatter = (value: number) => string; @@ -2284,11 +2283,8 @@ export const WeightFn: Readonly<{ // @public (undocumented) export type WeightFn = $Values; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @alpha (undocumented) -export const Wordcloud: React_2.FunctionComponent; +// @alpha +export const Wordcloud: FC>; // @public (undocumented) export interface WordcloudConfigs { @@ -2325,6 +2321,11 @@ export interface WordcloudConfigs { // @public (undocumented) export type WordCloudElementEvent = [WordModel, SeriesIdentifier]; +// Warning: (ae-incompatible-release-tags) The symbol "WordcloudProps" is marked as @public, but its signature references "Wordcloud" which is marked as @alpha +// +// @public (undocumented) +export type WordcloudProps = ComponentProps; + // @alpha (undocumented) export interface WordcloudSpec extends Spec { // (undocumented) @@ -2388,7 +2389,7 @@ export interface XYBrushEvent { export type XYChartElementEvent = [GeometryValue, XYChartSeriesIdentifier]; // @public (undocumented) -export interface XYChartSeriesIdentifier extends SeriesIdentifier { +export interface XYChartSeriesIdentifier extends SeriesIdentifier { // (undocumented) seriesKeys: (string | number)[]; // (undocumented) @@ -2398,7 +2399,7 @@ export interface XYChartSeriesIdentifier extends SeriesIdentifier { // (undocumented) splitAccessors: Map; // (undocumented) - yAccessor: Accessor; + yAccessor: Accessor; } // @public diff --git a/packages/charts/src/chart_types/xy_chart/utils/specs.ts b/packages/charts/src/chart_types/xy_chart/utils/specs.ts index d98d912f8f..74f9e653a6 100644 --- a/packages/charts/src/chart_types/xy_chart/utils/specs.ts +++ b/packages/charts/src/chart_types/xy_chart/utils/specs.ts @@ -495,7 +495,7 @@ export interface SeriesAccessors { * An array of fields thats indicates the stack membership. * Does not depend on datum at the moment. * - * @todo pass datum to accessors when applicable + * TODO pass datum to accessors when applicable */ stackAccessors?: (Accessor | AccessorFn)[]; /** @@ -562,7 +562,10 @@ export type BasicSeriesSpec() => < /** * Resulting props for spec given overrides, defaults, optionals and required props - * @internal + * @public */ export type SFProps< S extends Spec, @@ -123,7 +123,7 @@ export type SFProps< Requires extends SFRequiredKeys > = Pick & Partial>; -/** @internal */ +/** @public */ export interface BuildProps< S extends Spec, Overrides extends SFOverrideKeys, diff --git a/packages/charts/src/utils/accessor.ts b/packages/charts/src/utils/accessor.ts index dcf9a22591..e9ffac71d5 100644 --- a/packages/charts/src/utils/accessor.ts +++ b/packages/charts/src/utils/accessor.ts @@ -59,7 +59,7 @@ export type AccessorArrayIndex = number; /** * Need to check for array to exclude array prototype keys. * - * @todo tighten keyof types by removing string fallback. This will make it harder to satisfy the + * TODO: tighten keyof types by removing string fallback. This will make it harder to satisfy the * types for complex data values. * * Note: ignores symbols as keys diff --git a/yarn.lock b/yarn.lock index 8626e1d56d..f51e20b482 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4060,53 +4060,45 @@ resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.6.tgz#9c70eb7e7e4abc1083c8edf7151d35a19e442c00" integrity sha512-PKTHVgMHnK5p+kcMWWNnZuoR7O19VmHiOujmVcyN50hya7qIdDb5vvsYC+dwLxApEXiABhLozq0dlIwFeS3yjg== -"@microsoft/api-documenter@^7.12.7": - version "7.12.7" - resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.12.7.tgz#7b1742999bc083a237f78e658b3351e92012b3f7" - integrity sha512-GD3Z52yzDz8ZN3efB0mL2ogXLoL/I/cpoZmwLm8KiXL6o5g9K25fQ7HrFt4fvk9XTvcYX/EvZw4TBjrWz7cj5A== +"@microsoft/api-documenter@^7.13.63": + version "7.13.63" + resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.13.63.tgz#ee2ca311bcc35ff1f39532c8cfcdf12ce1ca4ffa" + integrity sha512-NIg9IEHBcVG7yPhLYVmKGvL6TmNXzUM1lKaUTroEx/qj+fw/PU1PuMUAb8k2D8zySq6Y5x8zAjbURXeqkW8NzQ== dependencies: - "@microsoft/api-extractor-model" "7.12.2" - "@microsoft/tsdoc" "0.12.24" - "@rushstack/node-core-library" "3.36.0" - "@rushstack/ts-command-line" "4.7.8" + "@microsoft/api-extractor-model" "7.13.13" + "@microsoft/tsdoc" "0.13.2" + "@rushstack/node-core-library" "3.42.3" + "@rushstack/ts-command-line" "4.10.2" colors "~1.2.1" js-yaml "~3.13.1" resolve "~1.17.0" -"@microsoft/api-extractor-model@7.12.2": - version "7.12.2" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.12.2.tgz#d48b35e8ed20643b1c19d7a4f80c90c42dc7d1d8" - integrity sha512-EU+U09Mj65zUH0qwPF4PFJiL6Y+PQQE/RRGEHEDGJJzab/mRQDpKOyrzSdb00xvcd/URehIHJqC55cY2Y4jGOA== - dependencies: - "@microsoft/tsdoc" "0.12.24" - "@rushstack/node-core-library" "3.36.0" - -"@microsoft/api-extractor-model@7.13.7": - version "7.13.7" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.13.7.tgz#2ae0948cb7458b336694c458675717ef8a9dcc85" - integrity sha512-emwhcaSF/h3WdqBWps4UU0RtGOGzy53IsplxuoLwtCuMAx3namYvJSfUGa5ajGPBao4MCyRYGsMc3EZ6IdR8cQ== +"@microsoft/api-extractor-model@7.13.13": + version "7.13.13" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.13.13.tgz#5c1ac0fff0410b8f23478b15560b24096b8869c6" + integrity sha512-4Hz2TOL4TljsAfMQe7a8tm+Am8+AkrcgkbnH62S9YuaIC3Cw6jE4H2qP8WC2JJInWJP4pg/ZrUlHrtmtgrqn9Q== dependencies: "@microsoft/tsdoc" "0.13.2" "@microsoft/tsdoc-config" "~0.15.2" - "@rushstack/node-core-library" "3.40.2" + "@rushstack/node-core-library" "3.42.3" -"@microsoft/api-extractor@^7.18.9": - version "7.18.9" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.18.9.tgz#82f50f8791bfacd5e3dd5d9400cdb6d69a499249" - integrity sha512-N+fbG+6SwA1i6EW3iGRp/nAT8vQpRSDvZ1DzBUr8xIS7tNfJ0C75ndPPziUT8EmalhLixRnIw6Ncmur8AFELRg== +"@microsoft/api-extractor@^7.18.16": + version "7.18.16" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.18.16.tgz#c5e077e417938da7e7026124c51d34a90868e7bd" + integrity sha512-f0EcjGgS8IToUHxfQIr4vxGpBhUdaDOhGyddZpZ5K9e/GcGkImfkGeHpYbK043f2bZV3aagTx6NcIawwE72BKA== dependencies: - "@microsoft/api-extractor-model" "7.13.7" + "@microsoft/api-extractor-model" "7.13.13" "@microsoft/tsdoc" "0.13.2" "@microsoft/tsdoc-config" "~0.15.2" - "@rushstack/node-core-library" "3.40.2" - "@rushstack/rig-package" "0.3.0" - "@rushstack/ts-command-line" "4.9.0" + "@rushstack/node-core-library" "3.42.3" + "@rushstack/rig-package" "0.3.3" + "@rushstack/ts-command-line" "4.10.2" colors "~1.2.1" lodash "~4.17.15" resolve "~1.17.0" semver "~7.3.0" source-map "~0.6.1" - typescript "~4.3.5" + typescript "~4.4.2" "@microsoft/tsdoc-config@~0.15.2": version "0.15.2" @@ -4118,11 +4110,6 @@ jju "~1.4.0" resolve "~1.19.0" -"@microsoft/tsdoc@0.12.24": - version "0.12.24" - resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.24.tgz#30728e34ebc90351dd3aff4e18d038eed2c3e098" - integrity sha512-Mfmij13RUTmHEMi9vRUhMXD7rnGR2VvxeNYtaGtaJ4redwwjT4UXYJ+nzmVJF7hhd4pn/Fx5sncDKxMVFJSWPg== - "@microsoft/tsdoc@0.13.2": version "0.13.2" resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz#3b0efb6d3903bd49edb073696f60e90df08efb26" @@ -4495,12 +4482,12 @@ prop-types "^15.6.1" react-lifecycles-compat "^3.0.4" -"@rushstack/node-core-library@3.36.0": - version "3.36.0" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.36.0.tgz#95dace39d763c8695d6607c421f95c6ac65b0ed4" - integrity sha512-bID2vzXpg8zweXdXgQkKToEdZwVrVCN9vE9viTRk58gqzYaTlz4fMId6V3ZfpXN6H0d319uGi2KDlm+lUEeqCg== +"@rushstack/node-core-library@3.42.3": + version "3.42.3" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.42.3.tgz#e9bc8aee4ba047d1858afcb7822b5aaf973b4fd8" + integrity sha512-xtiJsHtO4Sf/hVKyf/8d58p3zQh2JAZNs1mmDNCyIlgSRYGdqUkpadvvn5mz7EwF6lwn+xTTaTV5/a32xKjbdw== dependencies: - "@types/node" "10.17.13" + "@types/node" "12.20.24" colors "~1.2.1" fs-extra "~7.0.1" import-lazy "~4.0.0" @@ -4510,43 +4497,18 @@ timsort "~0.3.0" z-schema "~3.18.3" -"@rushstack/node-core-library@3.40.2": - version "3.40.2" - resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.40.2.tgz#71d92180f14bafd212f720b2cfe8892e688159b6" - integrity sha512-wzcRucwnhOENTfx6hZ2M+CA1Zmp8Dr572mFFtjxmcQzBWTbNFRB1Mi1wLb7DLza+69OUBoSZcHUqydlwL+gvSA== - dependencies: - "@types/node" "10.17.13" - colors "~1.2.1" - fs-extra "~7.0.1" - import-lazy "~4.0.0" - jju "~1.4.0" - resolve "~1.17.0" - semver "~7.3.0" - timsort "~0.3.0" - z-schema "~3.18.3" - -"@rushstack/rig-package@0.3.0": - version "0.3.0" - resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.0.tgz#334ad2846797861361b3445d4cc9ae9164b1885c" - integrity sha512-Lj6noF7Q4BBm1hKiBDw94e6uZvq1xlBwM/d2cBFaPqXeGdV+G6r3qaCWfRiSXK0pcHpGGpV5Tb2MdfhVcO6G/g== +"@rushstack/rig-package@0.3.3": + version "0.3.3" + resolved "https://registry.yarnpkg.com/@rushstack/rig-package/-/rig-package-0.3.3.tgz#6e291d181b2b9b114dd8e806e8389d999142d137" + integrity sha512-ElPnChxIkUzcU3ywI0Cl7E1aM+2w6vFpAwM6X+oWk7Cyjf2ofItThje9e5qUBtKqvI9sc5jVsHY1bRC8rVwOqQ== dependencies: resolve "~1.17.0" strip-json-comments "~3.1.1" -"@rushstack/ts-command-line@4.7.8": - version "4.7.8" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.7.8.tgz#3aa77cf544c571be3206fc2bcba20c7a096ed254" - integrity sha512-8ghIWhkph7NnLCMDJtthpsb7TMOsVGXVDvmxjE/CeklTqjbbUFBjGXizJfpbEkRQTELuZQ2+vGn7sGwIWKN2uA== - dependencies: - "@types/argparse" "1.0.38" - argparse "~1.0.9" - colors "~1.2.1" - string-argv "~0.3.1" - -"@rushstack/ts-command-line@4.9.0": - version "4.9.0" - resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.9.0.tgz#781ba42cff73cae097b6d5241b6441e7cc2fe6e0" - integrity sha512-kmT8t+JfnvphISF1C5WwY56RefjwgajhSjs9J4ckvAFXZDXR6F5cvF5/RTh7fGCzIomg8esy2PHO/b52zFoZvA== +"@rushstack/ts-command-line@4.10.2": + version "4.10.2" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.10.2.tgz#019d43d8428e243031c66aeac1f088687f6730f3" + integrity sha512-Weq8B7oJeCQ4ITsaVLhOQombipyg+idpkdkhA6UqLtKvuzq8zTtPpAfhP5ff5L+RCmo1CFCVOBE3i+MvzUR5vA== dependencies: "@types/argparse" "1.0.38" argparse "~1.0.9" @@ -5906,10 +5868,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.7.tgz#01e4ea724d9e3bd50d90c11fd5980ba317d8fa11" integrity sha512-E6Zn0rffhgd130zbCbAr/JdXfXkoOUFAKNs/rF8qnafSJ8KYaA/j3oz7dcwal+lYjLA7xvdd5J4wdYpCTlP8+w== -"@types/node@10.17.13": - version "10.17.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" - integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== +"@types/node@12.20.24": + version "12.20.24" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.24.tgz#c37ac69cb2948afb4cef95f424fa0037971a9a5c" + integrity sha512-yxDeaQIAJlMav7fH5AQqPH1u8YIuhYJXYBzxaQ4PifsU0GDO38MSdmEDeRlIxrKbC6NbEaaEHDanWb+y30U8SQ== "@types/node@>= 8": version "14.14.20" @@ -10637,7 +10599,8 @@ eslint-module-utils@^2.6.0: pkg-dir "^2.0.0" "eslint-plugin-elastic-charts@link:./packages/eslint-plugin-elastic-charts": - version "1.0.0" + version "0.0.0" + uid "" eslint-plugin-eslint-comments@^3.2.0: version "3.2.0" @@ -15063,13 +15026,8 @@ lines-and-columns@^1.1.6: integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= "link-kibana@link:./packages/link_kibana": - version "1.0.0" - dependencies: - chalk "^4.1.1" - change-case "^4.1.2" - glob "^7.1.7" - inquirer "^8.0.0" - ora "^5.4.0" + version "0.0.0" + uid "" lint-staged@^10.5.3: version "10.5.3" @@ -22124,10 +22082,10 @@ typescript@~3.9.7: resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== -typescript@~4.3.5: - version "4.3.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4" - integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA== +typescript@~4.4.2: + version "4.4.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c" + integrity sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA== uglify-js@^3.1.4: version "3.13.5" From 5e1054fa9eeb721446e665dcc55328510f1fc51e Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Fri, 15 Oct 2021 16:44:19 -0500 Subject: [PATCH 05/12] test: update changed snapshots --- .../src/components/__snapshots__/chart.test.tsx.snap | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/charts/src/components/__snapshots__/chart.test.tsx.snap b/packages/charts/src/components/__snapshots__/chart.test.tsx.snap index d0682a2ccf..82f6a5e033 100644 --- a/packages/charts/src/components/__snapshots__/chart.test.tsx.snap +++ b/packages/charts/src/components/__snapshots__/chart.test.tsx.snap @@ -55,12 +55,8 @@ exports[`Chart should render the legend name test 1`] = ` - - - - - - + +
From a702f236ad190fca4b656ea77a6286990fb5086d Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Fri, 15 Oct 2021 16:45:29 -0500 Subject: [PATCH 06/12] chore: update api docs --- packages/charts/api/charts.api.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/charts/api/charts.api.md b/packages/charts/api/charts.api.md index 359400a61a..95a91eab90 100644 --- a/packages/charts/api/charts.api.md +++ b/packages/charts/api/charts.api.md @@ -105,7 +105,7 @@ export interface ArcStyle { // Warning: (ae-forgotten-export) The symbol "SFProps" needs to be exported by the entry point index.d.ts // // @public -export const AreaSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "areaSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "markFormat" | "stackMode" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; +export const AreaSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "areaSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor" | "stackMode", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { @@ -242,7 +242,7 @@ export interface BandFillColorAccessorInput { } // @public -export const BarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; +export const BarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { @@ -331,7 +331,7 @@ export type BrushEvent = XYBrushEvent | HeatmapBrushEvent; // Warning: (ae-incompatible-release-tags) The symbol "BubbleSeries" is marked as @public, but its signature references "BubbleSeriesSpec" which is marked as @alpha // // @public -export const BubbleSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend", "sortIndex" | "name" | "timeZone" | "color" | "bubbleSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; +export const BubbleSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend", "sortIndex" | "name" | "timeZone" | "color" | "bubbleSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @alpha export type BubbleSeriesSpec = BasicSeriesSpec & { @@ -1293,7 +1293,7 @@ export interface LineAnnotationStyle { } // @public -export const LineSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "lineSeriesStyle" | "xNice" | "yNice" | "stackAccessors" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; +export const LineSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "lineSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { From 7fc4e4facdb32265f26c012f9b2a7ab6fff860b6 Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Mon, 13 Dec 2021 11:19:00 -0700 Subject: [PATCH 07/12] chore: update api changes after merge --- packages/charts/api/charts.api.md | 231 +++++++++++++++--------------- 1 file changed, 116 insertions(+), 115 deletions(-) diff --git a/packages/charts/api/charts.api.md b/packages/charts/api/charts.api.md index 13849ac255..f5e5c2de96 100644 --- a/packages/charts/api/charts.api.md +++ b/packages/charts/api/charts.api.md @@ -5,23 +5,29 @@ ```ts import { $Values } from 'utility-types'; +import { ComponentProps } from 'react'; import { ComponentType } from 'react'; +import { FC } from 'react'; import { LegacyRef } from 'react'; +import { OptionalKeys } from 'utility-types'; import { default as React_2 } from 'react'; import { ReactChild } from 'react'; import { ReactNode } from 'react'; +import { RequiredKeys } from 'utility-types'; // @public (undocumented) export type A = number; +// Warning: (ae-forgotten-export) The symbol "DatumKey" needs to be exported by the entry point index.d.ts +// // @public -export type Accessor = AccessorObjectKey | AccessorArrayIndex; +export type Accessor = D extends never ? AccessorObjectKey | AccessorArrayIndex : DatumKey; // @public export type AccessorArrayIndex = number; // @public -export type AccessorFn = UnaryAccessorFn; +export type AccessorFn = UnaryAccessorFn; // @public export type AccessorObjectKey = string; @@ -84,7 +90,7 @@ export type AnnotationPortalSettings = TooltipPortalSettings<'chart'> & { }; // @public (undocumented) -export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec; +export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec; // @public (undocumented) export type AnnotationTooltipFormatter = (details?: string) => JSX.Element | null; @@ -120,14 +126,13 @@ export type AreaFitStyle = Visible & Opacity & { texture?: TexturedStyles; }; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "SFProps" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -export const AreaSeries: React_2.FunctionComponent; +// @public +export const AreaSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "areaSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "stackMode" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { +export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { seriesType: typeof SeriesType.Area; curve?: CurveType; areaSeriesStyle?: RecursivePartial; @@ -174,11 +179,8 @@ export interface ArrayNode extends NodeDescriptor { [SORT_INDEX_KEY]: number; } -// Warning: (ae-forgotten-export) The symbol "SpecRequired" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionals" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const Axis: React_2.FunctionComponent; +// @public +export const Axis: FC>; // @public (undocumented) export type AxisId = string; @@ -271,14 +273,11 @@ export interface BandFillColorAccessorInput { value: number; } -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const BarSeries: React_2.FunctionComponent; +// @public +export const BarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { +export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { seriesType: typeof SeriesType.Bar; enableHistogramMode?: boolean; barSeriesStyle?: RecursivePartial; @@ -304,11 +303,11 @@ export type BarStyleAccessor = (datum: DataSeriesDatum, seriesIdentifier: XYChar export type BarStyleOverride = RecursivePartial | Color | null; // @public (undocumented) -export interface BaseAnnotationSpec extends Spec, AnnotationPortalSettings { +export interface BaseAnnotationSpec, S extends RectAnnotationStyle | LineAnnotationStyle, D = never> extends Spec, AnnotationPortalSettings { annotationType: T; // (undocumented) chartType: typeof ChartType.XYAxis; - dataValues: D[]; + dataValues: AD[]; groupId: GroupId; hideTooltips?: boolean; // (undocumented) @@ -317,6 +316,9 @@ export interface BaseAnnotationSpec | any[]; + // @public (undocumented) export interface BasePointerEvent { // (undocumented) @@ -328,10 +330,10 @@ export interface BasePointerEvent { // @public (undocumented) export type BasicListener = () => undefined | void; +// Warning: (ae-forgotten-export) The symbol "MarkFormatter" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -export type BasicSeriesSpec = SeriesSpec & SeriesAccessors & SeriesScales & { - markFormat?: TickFormatter; -}; +export type BasicSeriesSpec = SeriesSpec & SeriesAccessors & SeriesScales & MarkFormatter; // @public export const BinAgg: Readonly<{ @@ -358,14 +360,13 @@ export type BrushEndListener = (brushAreaEvent: BrushEvent) => void; // @public (undocumented) export type BrushEvent = XYBrushEvent | HeatmapBrushEvent; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-incompatible-release-tags) The symbol "BubbleSeries" is marked as @public, but its signature references "BubbleSeriesSpec" which is marked as @alpha // -// @alpha -export const BubbleSeries: React_2.FunctionComponent; +// @public +export const BubbleSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend", "sortIndex" | "name" | "timeZone" | "color" | "bubbleSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @alpha -export type BubbleSeriesSpec = BasicSeriesSpec & { +export type BubbleSeriesSpec = BasicSeriesSpec & { seriesType: typeof SeriesType.Bubble; bubbleSeriesStyle?: RecursivePartial; pointStyleAccessor?: PointStyleAccessor; @@ -506,7 +507,7 @@ export const ColorVariant: Readonly<{ export type ColorVariant = $Values; // @public -export type ComponentWithAnnotationDatum = ComponentType; +export type ComponentWithAnnotationDatum = ComponentType>; // @public export function computeRatioByGroups>(data: T[], groupAccessors: GroupKeysOrKeyFn, valueAccessor: (k: T) => number | null | undefined, ratioKeyName: string): (T & { @@ -751,9 +752,6 @@ export const DEFAULT_TOOLTIP_SNAP = true; // @public export const DEFAULT_TOOLTIP_TYPE: "vertical"; -// @public (undocumented) -export type DefaultSettingsProps = 'id' | 'chartType' | 'specType' | 'rendering' | 'rotation' | 'resizeDebounce' | 'pointerUpdateDebounce' | 'pointerUpdateTrigger' | 'animateData' | 'debug' | 'tooltip' | 'theme' | 'brushAxis' | 'minBrushDelta' | 'externalPointerEvents' | 'showLegend' | 'showLegendExtra' | 'legendPosition' | 'legendMaxDepth' | 'legendSize' | 'ariaUseDefaultSummary' | 'ariaLabelHeadingLevel' | 'ariaTableCaption' | 'allowBrushingLastHistogramBin'; - // @public (undocumented) export const DEPTH_KEY = "depth"; @@ -933,15 +931,17 @@ export interface GeometryValue { // @public (undocumented) export function getNodeName(node: ArrayNode): string; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @alpha (undocumented) -export const Goal: React_2.FunctionComponent; +// @alpha +export const Goal: FC>; // @alpha (undocumented) export type GoalLabelAccessor = LabelAccessor; +// Warning: (ae-incompatible-release-tags) The symbol "GoalProps" is marked as @public, but its signature references "Goal" which is marked as @alpha +// +// @public (undocumented) +export type GoalProps = ComponentProps; + // @alpha (undocumented) export interface GoalSpec extends Spec { // (undocumented) @@ -1032,20 +1032,22 @@ export interface GroupBrushExtent { groupId: GroupId; } -// @alpha (undocumented) -export const GroupBy: React_2.FunctionComponent; +// Warning: (ae-incompatible-release-tags) The symbol "GroupBy" is marked as @public, but its signature references "GroupBySpec" which is marked as @alpha +// +// @public +export const GroupBy: (props: SFProps, "chartType" | "specType", never, "format", "id" | "sort" | "by">) => null; // @public (undocumented) -export type GroupByAccessor = (spec: Spec, datum: any) => string | number; +export type GroupByAccessor = (spec: Spec, datum: D) => string | number; // @public -export type GroupByFormatter = (value: ReturnType) => string; +export type GroupByFormatter = (value: ReturnType>) => string; // @public (undocumented) export type GroupByKeyFn = (data: T) => string; -// @alpha (undocumented) -export type GroupByProps = Pick; +// @public (undocumented) +export type GroupByProps = ComponentProps; // Warning: (ae-forgotten-export) The symbol "Predicate" needs to be exported by the entry point index.d.ts // @@ -1053,9 +1055,9 @@ export type GroupByProps = Pick; export type GroupBySort = Predicate; // @alpha (undocumented) -export interface GroupBySpec extends Spec { - by: GroupByAccessor; - format?: GroupByFormatter; +export interface GroupBySpec extends Spec { + by: GroupByAccessor; + format?: GroupByFormatter; sort: GroupBySort; } @@ -1065,8 +1067,8 @@ export type GroupId = string; // @public (undocumented) export type GroupKeysOrKeyFn = Array | GroupByKeyFn; -// @alpha (undocumented) -export const Heatmap: React_2.FunctionComponent & Partial>>; +// @alpha +export const Heatmap: (props: SFProps, "chartType" | "specType", "data" | "config" | "valueAccessor" | "valueFormatter" | "xSortPredicate" | "ySortPredicate" | "xScale", "name" | "highlightedData", "id" | "xAccessor" | "yAccessor" | "colorScale">) => null; // @alpha (undocumented) export interface HeatmapBandsColorScale { @@ -1191,7 +1193,7 @@ export interface HeatmapConfig { export type HeatmapElementEvent = [Cell, SeriesIdentifier]; // @alpha (undocumented) -export interface HeatmapSpec extends Spec { +export interface HeatmapSpec extends Spec { // (undocumented) chartType: typeof ChartType.Heatmap; // (undocumented) @@ -1199,7 +1201,7 @@ export interface HeatmapSpec extends Spec { // (undocumented) config: RecursivePartial; // (undocumented) - data: Datum[]; + data: D[]; // (undocumented) highlightedData?: { x: Array; @@ -1214,13 +1216,13 @@ export interface HeatmapSpec extends Spec { // (undocumented) valueFormatter: (value: number) => string; // (undocumented) - xAccessor: Accessor | AccessorFn; + xAccessor: Accessor | AccessorFn; // (undocumented) xScale: RasterTimeScale | OrdinalScale | LinearScale; // (undocumented) xSortPredicate: Predicate; // (undocumented) - yAccessor: Accessor | AccessorFn; + yAccessor: Accessor | AccessorFn; // (undocumented) ySortPredicate: Predicate; } @@ -1231,14 +1233,11 @@ export const HIERARCHY_ROOT_KEY: Key; // @public (undocumented) export type HierarchyOfArrays = Array; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const HistogramBarSeries: React_2.FunctionComponent; +// @public +export const HistogramBarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type HistogramBarSeriesSpec = Omit & { +export type HistogramBarSeriesSpec = Omit, 'stackAccessors'> & { enableHistogramMode: true; }; @@ -1272,7 +1271,7 @@ export type HorizontalAlignment = $Values; // Warning: (ae-forgotten-export) The symbol "BinaryAccessorFn" needs to be exported by the entry point index.d.ts // // @public -export type IndexedAccessorFn = UnaryAccessorFn | BinaryAccessorFn; +export type IndexedAccessorFn = UnaryAccessorFn | BinaryAccessorFn; // @public (undocumented) export const INPUT_KEY = "inputIndex"; @@ -1414,15 +1413,12 @@ export interface LegendStyle { // @public (undocumented) export const LIGHT_THEME: Theme; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const LineAnnotation: React_2.FunctionComponent; +// @public +export const LineAnnotation: (props: SFProps, "chartType" | "specType", "style" | "zIndex" | "groupId" | "hideLines" | "hideLinesTooltips" | "annotationType" | "hideTooltips", "offset" | "fallbackPlacements" | "placement" | "boundary" | "boundaryPadding" | "marker" | "customTooltip" | "markerBody" | "markerDimensions" | "markerPosition" | "customTooltipDetails", "id" | "dataValues" | "domainType">) => null; // @public -export interface LineAnnotationDatum { - dataValue: any; +export interface LineAnnotationDatum { + dataValue: D; details?: string; header?: string; } @@ -1430,14 +1426,14 @@ export interface LineAnnotationDatum { // @public (undocumented) export type LineAnnotationEvent = { id: SpecId; - datum: LineAnnotationDatum; + datum: LineAnnotationDatum; }; // @public (undocumented) -export type LineAnnotationSpec = BaseAnnotationSpec & { +export type LineAnnotationSpec = BaseAnnotationSpec, LineAnnotationStyle, D> & { domainType: AnnotationDomainType; - marker?: ReactNode | ComponentWithAnnotationDatum; - markerBody?: ReactNode | ComponentWithAnnotationDatum; + marker?: ReactNode | ComponentWithAnnotationDatum; + markerBody?: ReactNode | ComponentWithAnnotationDatum; markerDimensions?: { width: number; height: number; @@ -1466,14 +1462,11 @@ export type LineFitStyle = Visible & Opacity & StrokeDashArray & { stroke: Color | typeof ColorVariant.Series; }; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @public (undocumented) -export const LineSeries: React_2.FunctionComponent; +// @public +export const LineSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "lineSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; // @public -export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { +export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { seriesType: typeof SeriesType.Line; curve?: CurveType; lineSeriesStyle?: RecursivePartial; @@ -1593,11 +1586,10 @@ export function parentAccessor(n: ArrayEntry): ArrayNode; // @public (undocumented) export type PartialTheme = RecursivePartial; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "PartitionSpec" needs to be exported by the entry point index.d.ts // -// @public (undocumented) -export const Partition: React_2.FunctionComponent; +// @public +export const Partition: (props: SFProps, "chartType" | "specType", "config" | "valueAccessor" | "valueFormatter" | "valueGetter" | "percentFormatter" | "topGroove" | "smallMultiples" | "layers", never, "id" | "data">) => null; // @public (undocumented) export interface PartitionConfig extends StaticConfig { @@ -1620,13 +1612,13 @@ export interface PartitionFillLabel extends LabelConfig { } // @public -export interface PartitionLayer { +export interface PartitionLayer { // Warning: (ae-forgotten-export) The symbol "ExtendedFillLabelConfig" needs to be exported by the entry point index.d.ts // // (undocumented) fillLabel?: Partial; // (undocumented) - groupByRollup: IndexedAccessorFn; + groupByRollup: IndexedAccessorFn; // (undocumented) nodeLabel?: LabelAccessor; // (undocumented) @@ -1814,7 +1806,7 @@ export type Ratio = number; export type RawTextGetter = (node: ShapeTreeNode) => string; // @public (undocumented) -export const RectAnnotation: React_2.FunctionComponent & Partial>>; +export const RectAnnotation: FC>; // @public export interface RectAnnotationDatum { @@ -1929,13 +1921,13 @@ export interface SectorGeomSpecY { } // @public (undocumented) -export interface SeriesAccessors { - markSizeAccessor?: Accessor | AccessorFn; - splitSeriesAccessors?: (Accessor | AccessorFn)[]; - stackAccessors?: (Accessor | AccessorFn)[]; - xAccessor: Accessor | AccessorFn; - y0Accessors?: (Accessor | AccessorFn)[]; - yAccessors: (Accessor | AccessorFn)[]; +export interface SeriesAccessors { + markSizeAccessor?: Accessor | AccessorFn; + splitSeriesAccessors?: (Accessor | AccessorFn)[]; + stackAccessors?: (Accessor | AccessorFn)[]; + xAccessor: Accessor | AccessorFn; + y0Accessors?: (Accessor | AccessorFn)[]; + yAccessors: (Accessor | AccessorFn)[]; } // @public (undocumented) @@ -1989,11 +1981,11 @@ export interface SeriesScales { } // @public (undocumented) -export interface SeriesSpec extends Spec { +export interface SeriesSpec extends Spec { // (undocumented) chartType: typeof ChartType.XYAxis; color?: SeriesColorAccessor; - data: Datum[]; + data: D[]; // (undocumented) displayValueSettings?: DisplayValueSpec; filterSeriesInTooltip?: FilterPredicate; @@ -2013,7 +2005,7 @@ export interface SeriesSpec extends Spec { } // @public (undocumented) -export type SeriesSpecs = Array; +export type SeriesSpecs = BasicSeriesSpec> = Array; // @public (undocumented) export const SeriesType: Readonly<{ @@ -2026,8 +2018,16 @@ export const SeriesType: Readonly<{ // @public export type SeriesType = $Values; +// @public +export const Settings: (props: SFProps) => null; + +// Warning: (ae-forgotten-export) The symbol "BuildProps" needs to be exported by the entry point index.d.ts +// // @public (undocumented) -export const Settings: React_2.FunctionComponent; +export const settingsBuildProps: BuildProps; + +// @public (undocumented) +export type SettingsProps = ComponentProps; // @public export interface SettingsSpec extends Spec, LegendSpec { @@ -2081,9 +2081,6 @@ export interface SettingsSpec extends Spec, LegendSpec { xDomain?: CustomXDomain; } -// @public (undocumented) -export type SettingsSpecProps = Partial>; - // @public (undocumented) export interface ShapeTreeNode extends TreeNode, SectorGeomSpecY { // (undocumented) @@ -2126,11 +2123,13 @@ export interface SimplePadding { // @public (undocumented) export type SizeRatio = Ratio; -// @alpha (undocumented) -export const SmallMultiples: React_2.FunctionComponent; +// @alpha +export const SmallMultiples: FC>; -// @alpha (undocumented) -export type SmallMultiplesProps = Partial>; +// Warning: (ae-incompatible-release-tags) The symbol "SmallMultiplesProps" is marked as @public, but its signature references "SmallMultiples" which is marked as @alpha +// +// @public (undocumented) +export type SmallMultiplesProps = ComponentProps; // @alpha (undocumented) export interface SmallMultiplesSpec extends Spec { @@ -2412,9 +2411,9 @@ export const TooltipType: Readonly<{ export type TooltipType = $Values; // @public -export interface TooltipValue { +export interface TooltipValue { color: Color; - datum?: unknown; + datum?: D; formattedMarkValue?: string | null; formattedValue: string; isHighlighted: boolean; @@ -2423,7 +2422,7 @@ export interface TooltipValue { markValue?: number | null; seriesIdentifier: SeriesIdentifier; value: any; - valueAccessor?: Accessor; + valueAccessor?: Accessor; } // @public @@ -2447,9 +2446,9 @@ export interface TreeNode extends AngleFromTo { } // @public -export interface UnaryAccessorFn { +export interface UnaryAccessorFn { // (undocumented) - (datum: Datum): Return; + (datum: D): Return; fieldName?: string; } @@ -2457,7 +2456,7 @@ export interface UnaryAccessorFn { export function useLegendAction(): [ref: LegacyRef, onClose: () => void]; // @public (undocumented) -export type ValueAccessor = (d: Datum) => AdditiveNumber; +export type ValueAccessor = (d: D) => AdditiveNumber; // @public (undocumented) export type ValueFormatter = (value: number) => string; @@ -2499,11 +2498,8 @@ export const WeightFn: Readonly<{ // @public (undocumented) export type WeightFn = $Values; -// Warning: (ae-forgotten-export) The symbol "SpecRequiredProps" needs to be exported by the entry point index.d.ts -// Warning: (ae-forgotten-export) The symbol "SpecOptionalProps" needs to be exported by the entry point index.d.ts -// -// @alpha (undocumented) -export const Wordcloud: React_2.FunctionComponent; +// @alpha +export const Wordcloud: FC>; // @public (undocumented) export interface WordcloudConfigs { @@ -2540,6 +2536,11 @@ export interface WordcloudConfigs { // @public (undocumented) export type WordCloudElementEvent = [WordModel, SeriesIdentifier]; +// Warning: (ae-incompatible-release-tags) The symbol "WordcloudProps" is marked as @public, but its signature references "Wordcloud" which is marked as @alpha +// +// @public (undocumented) +export type WordcloudProps = ComponentProps; + // @alpha (undocumented) export interface WordcloudSpec extends Spec { // (undocumented) @@ -2603,7 +2604,7 @@ export interface XYBrushEvent { export type XYChartElementEvent = [GeometryValue, XYChartSeriesIdentifier]; // @public (undocumented) -export interface XYChartSeriesIdentifier extends SeriesIdentifier { +export interface XYChartSeriesIdentifier extends SeriesIdentifier { // (undocumented) seriesKeys: (string | number)[]; // (undocumented) @@ -2613,7 +2614,7 @@ export interface XYChartSeriesIdentifier extends SeriesIdentifier { // (undocumented) splitAccessors: Map; // (undocumented) - yAccessor: Accessor; + yAccessor: Accessor; } // @public From 46ce8cc55112b75d15e62de5896d4b512a2f8a3b Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Tue, 14 Dec 2021 09:44:58 -0700 Subject: [PATCH 08/12] chore: fix type alignment with kibana usages --- packages/charts/api/charts.api.md | 38 +++++++++++++++++-- .../src/chart_types/heatmap/specs/heatmap.ts | 2 +- .../partition_chart/specs/index.ts | 2 +- packages/charts/src/chart_types/specs.ts | 8 ++++ .../chart_types/xy_chart/specs/area_series.ts | 2 +- .../chart_types/xy_chart/specs/bar_series.ts | 2 +- .../xy_chart/specs/bubble_series.ts | 2 +- .../xy_chart/specs/histogram_bar_series.ts | 2 +- .../src/chart_types/xy_chart/specs/index.ts | 16 ++++---- .../xy_chart/specs/line_annotation.ts | 2 +- .../chart_types/xy_chart/specs/line_series.ts | 2 +- packages/charts/src/index.ts | 4 +- packages/charts/src/specs/small_multiples.ts | 5 ++- packages/charts/src/utils/accessor.ts | 9 ++--- .../stories/bar/58_data_values.story.tsx | 1 + storybook/stories/mixed/6_fitting.story.tsx | 7 +++- 16 files changed, 74 insertions(+), 30 deletions(-) diff --git a/packages/charts/api/charts.api.md b/packages/charts/api/charts.api.md index f5e5c2de96..0f50201ecb 100644 --- a/packages/charts/api/charts.api.md +++ b/packages/charts/api/charts.api.md @@ -21,7 +21,7 @@ export type A = number; // Warning: (ae-forgotten-export) The symbol "DatumKey" needs to be exported by the entry point index.d.ts // // @public -export type Accessor = D extends never ? AccessorObjectKey | AccessorArrayIndex : DatumKey; +export type Accessor = DatumKey | AccessorObjectKey | AccessorArrayIndex; // @public export type AccessorArrayIndex = number; @@ -131,6 +131,9 @@ export type AreaFitStyle = Visible & Opacity & { // @public export const AreaSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "areaSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "stackMode" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; +// @public (undocumented) +export type AreaSeriesProps = ComponentProps; + // @public export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & { seriesType: typeof SeriesType.Area; @@ -185,6 +188,9 @@ export const Axis: FC; + // @public export interface AxisSpec extends Spec { // (undocumented) @@ -276,6 +282,9 @@ export interface BandFillColorAccessorInput { // @public export const BarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; +// @public (undocumented) +export type BarSeriesProps = ComponentProps; + // @public export type BarSeriesSpec = BasicSeriesSpec & Postfixes & { seriesType: typeof SeriesType.Bar; @@ -365,6 +374,9 @@ export type BrushEvent = XYBrushEvent | HeatmapBrushEvent; // @public export const BubbleSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend", "sortIndex" | "name" | "timeZone" | "color" | "bubbleSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; +// @public (undocumented) +export type BubbleSeriesProps = ComponentProps; + // @alpha export type BubbleSeriesSpec = BasicSeriesSpec & { seriesType: typeof SeriesType.Bubble; @@ -1192,6 +1204,11 @@ export interface HeatmapConfig { // @public (undocumented) export type HeatmapElementEvent = [Cell, SeriesIdentifier]; +// Warning: (ae-incompatible-release-tags) The symbol "HeatmapProps" is marked as @public, but its signature references "Heatmap" which is marked as @alpha +// +// @public (undocumented) +export type HeatmapProps = ComponentProps; + // @alpha (undocumented) export interface HeatmapSpec extends Spec { // (undocumented) @@ -1212,7 +1229,7 @@ export interface HeatmapSpec extends Spec { // (undocumented) specType: typeof SpecType.Series; // (undocumented) - valueAccessor: Accessor | AccessorFn; + valueAccessor: Accessor | AccessorFn; // (undocumented) valueFormatter: (value: number) => string; // (undocumented) @@ -1236,6 +1253,9 @@ export type HierarchyOfArrays = Array; // @public export const HistogramBarSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "enableHistogramMode", "sortIndex" | "name" | "timeZone" | "color" | "barSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "markSizeAccessor" | "stackMode" | "styleAccessor" | "minBarHeight", "id" | "data" | "xAccessor" | "yAccessors">) => null; +// @public (undocumented) +export type HistogramBarSeriesProps = ComponentProps; + // @public export type HistogramBarSeriesSpec = Omit, 'stackAccessors'> & { enableHistogramMode: true; @@ -1429,6 +1449,9 @@ export type LineAnnotationEvent = { datum: LineAnnotationDatum; }; +// @public (undocumented) +export type LineAnnotationProps = ComponentProps; + // @public (undocumented) export type LineAnnotationSpec = BaseAnnotationSpec, LineAnnotationStyle, D> & { domainType: AnnotationDomainType; @@ -1465,6 +1488,9 @@ export type LineFitStyle = Visible & Opacity & StrokeDashArray & { // @public export const LineSeries: (props: SFProps, "chartType" | "specType" | "seriesType", "groupId" | "xScaleType" | "yScaleType" | "hideInLegend" | "histogramModeAlignment", "sortIndex" | "name" | "fit" | "timeZone" | "color" | "curve" | "lineSeriesStyle" | "xNice" | "yNice" | "useDefaultGroupDomain" | "displayValueSettings" | "y0AccessorFormat" | "y1AccessorFormat" | "filterSeriesInTooltip" | "tickFormat" | "y0Accessors" | "splitSeriesAccessors" | "stackAccessors" | "markSizeAccessor" | "markFormat" | "pointStyleAccessor", "id" | "data" | "xAccessor" | "yAccessors">) => null; +// @public (undocumented) +export type LineSeriesProps = ComponentProps; + // @public export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & { seriesType: typeof SeriesType.Line; @@ -1644,6 +1670,9 @@ export const PartitionLayout: Readonly<{ // @public (undocumented) export type PartitionLayout = $Values; +// @public (undocumented) +export type PartitionProps = ComponentProps; + // @public (undocumented) export const PATH_KEY = "path"; @@ -1825,6 +1854,9 @@ export type RectAnnotationEvent = { datum: RectAnnotationDatum; }; +// @public (undocumented) +export type RectAnnotationProps = ComponentProps; + // @public (undocumented) export type RectAnnotationSpec = BaseAnnotationSpec & { renderTooltip?: AnnotationTooltipFormatter; @@ -2124,7 +2156,7 @@ export interface SimplePadding { export type SizeRatio = Ratio; // @alpha -export const SmallMultiples: FC>; +export const SmallMultiples: FC>; // Warning: (ae-incompatible-release-tags) The symbol "SmallMultiplesProps" is marked as @public, but its signature references "SmallMultiples" which is marked as @alpha // diff --git a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts index 89b8cb8f34..90cda2a670 100644 --- a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts +++ b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts @@ -73,7 +73,7 @@ export interface HeatmapSpec extends Spec { colorScale: HeatmapBandsColorScale; xAccessor: Accessor | AccessorFn; yAccessor: Accessor | AccessorFn; - valueAccessor: Accessor | AccessorFn; + valueAccessor: Accessor | AccessorFn; valueFormatter: (value: number) => string; xSortPredicate: Predicate; ySortPredicate: Predicate; diff --git a/packages/charts/src/chart_types/partition_chart/specs/index.ts b/packages/charts/src/chart_types/partition_chart/specs/index.ts index fb24d4e864..a9fc46bb22 100644 --- a/packages/charts/src/chart_types/partition_chart/specs/index.ts +++ b/packages/charts/src/chart_types/partition_chart/specs/index.ts @@ -103,4 +103,4 @@ export const Partition = function ( }; /** @public */ -export type PartitionProp = ComponentProps; +export type PartitionProps = ComponentProps; diff --git a/packages/charts/src/chart_types/specs.ts b/packages/charts/src/chart_types/specs.ts index 1d0afcc8b7..ff029ddb4b 100644 --- a/packages/charts/src/chart_types/specs.ts +++ b/packages/charts/src/chart_types/specs.ts @@ -8,13 +8,21 @@ export { AreaSeries, + AreaSeriesProps, Axis, + AxisProps, BarSeries, + BarSeriesProps, BubbleSeries, + BubbleSeriesProps, HistogramBarSeries, + HistogramBarSeriesProps, LineAnnotation, + LineAnnotationProps, LineSeries, + LineSeriesProps, RectAnnotation, + RectAnnotationProps, } from './xy_chart/specs'; export * from './xy_chart/utils/specs'; diff --git a/packages/charts/src/chart_types/xy_chart/specs/area_series.ts b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts index 47f54981cf..ddc35c1c21 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/area_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts @@ -49,4 +49,4 @@ export const AreaSeries = function ( }; /** @public */ -export type AreaSeriesProp = ComponentProps; +export type AreaSeriesProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts index 9d47338e7f..52bbc249ba 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts @@ -49,4 +49,4 @@ export const BarSeries = function ( }; /** @public */ -export type BarSeriesProp = ComponentProps; +export type BarSeriesProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts index 2fc151c3c7..8f707a86cc 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts @@ -48,4 +48,4 @@ export const BubbleSeries = function ( }; /** @public */ -export type BubbleSeriesProp = ComponentProps; +export type BubbleSeriesProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts index 12d08939a7..cee4a83403 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts @@ -49,4 +49,4 @@ export const HistogramBarSeries = function ( }; /** @public */ -export type HistogramBarSeriesProp = ComponentProps; +export type HistogramBarSeriesProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/index.ts b/packages/charts/src/chart_types/xy_chart/specs/index.ts index a9dc880845..c7c0024398 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/index.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/index.ts @@ -6,11 +6,11 @@ * Side Public License, v 1. */ -export { AreaSeries } from './area_series'; -export { Axis } from './axis'; -export { BarSeries } from './bar_series'; -export { BubbleSeries } from './bubble_series'; -export { HistogramBarSeries } from './histogram_bar_series'; -export { LineAnnotation } from './line_annotation'; -export { LineSeries } from './line_series'; -export { RectAnnotation } from './rect_annotation'; +export * from './area_series'; +export * from './axis'; +export * from './bar_series'; +export * from './bubble_series'; +export * from './histogram_bar_series'; +export * from './line_annotation'; +export * from './line_series'; +export * from './rect_annotation'; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts index f8be059e87..1e85adef13 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts @@ -49,4 +49,4 @@ export const LineAnnotation = function ( }; /** @public */ -export type LineAnnotationProp = ComponentProps; +export type LineAnnotationProps = ComponentProps; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_series.ts b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts index edbf60b890..91000fcccc 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/line_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts @@ -49,4 +49,4 @@ export const LineSeries = function ( }; /** @public */ -export type LineSeriesProp = ComponentProps; +export type LineSeriesProps = ComponentProps; diff --git a/packages/charts/src/index.ts b/packages/charts/src/index.ts index 439979ac41..2600df1430 100644 --- a/packages/charts/src/index.ts +++ b/packages/charts/src/index.ts @@ -48,7 +48,7 @@ export { FillLabelConfig as PartitionFillLabel, PartitionLayout, } from './chart_types/partition_chart/layout/types/config_types'; -export { Layer as PartitionLayer } from './chart_types/partition_chart/specs/index'; +export { Layer as PartitionLayer, PartitionProps } from './chart_types/partition_chart/specs/index'; export * from './chart_types/goal_chart/specs/index'; export * from './chart_types/wordcloud/specs/index'; @@ -82,7 +82,7 @@ export { Cell } from './chart_types/heatmap/layout/types/viewmodel_types'; export { SizeRatio, TimeMs } from './common/geometry'; export { TextAlign, TextBaseline } from './common/text_utils'; export { Config as HeatmapConfig } from './chart_types/heatmap/layout/types/config_types'; -export { ColorBand, HeatmapBandsColorScale } from './chart_types/heatmap/specs/heatmap'; +export { ColorBand, HeatmapBandsColorScale, HeatmapProps } from './chart_types/heatmap/specs/heatmap'; // utilities export { diff --git a/packages/charts/src/specs/small_multiples.ts b/packages/charts/src/specs/small_multiples.ts index 1bc9dac91c..8a011f8484 100644 --- a/packages/charts/src/specs/small_multiples.ts +++ b/packages/charts/src/specs/small_multiples.ts @@ -76,11 +76,12 @@ export interface SmallMultiplesSpec extends Spec { */ export const SmallMultiples = specComponentFactory()( { - id: '__global__small_multiples___', chartType: ChartType.Global, specType: SpecType.SmallMultiples, }, - {}, + { + id: '__global__small_multiples___', + }, ); /** @public */ diff --git a/packages/charts/src/utils/accessor.ts b/packages/charts/src/utils/accessor.ts index e9ffac71d5..f57b179ce7 100644 --- a/packages/charts/src/utils/accessor.ts +++ b/packages/charts/src/utils/accessor.ts @@ -7,7 +7,6 @@ */ import { BaseDatum } from '../chart_types/specs'; -import { Datum } from './common'; /** * Accessor function @@ -71,9 +70,7 @@ export type DatumKey = D extends any[] ? number : Exclude = D extends never - ? AccessorObjectKey | AccessorArrayIndex - : DatumKey; +export type Accessor = DatumKey | AccessorObjectKey | AccessorArrayIndex; /** * Accessor format for _banded_ series as postfix string or accessor function @@ -86,8 +83,8 @@ export type AccessorFormat = string | ((value: string) => string); * @param accessor the spec accessor * @internal */ -export function getAccessorFn(accessor: Accessor): AccessorFn { - return (datum: Datum) => +export function getAccessorFn(accessor: Accessor): AccessorFn { + return (datum: D) => typeof datum === 'object' && datum !== null ? datum[accessor as keyof typeof datum] : undefined; } diff --git a/storybook/stories/bar/58_data_values.story.tsx b/storybook/stories/bar/58_data_values.story.tsx index 3bb1c4231a..bd815f2100 100644 --- a/storybook/stories/bar/58_data_values.story.tsx +++ b/storybook/stories/bar/58_data_values.story.tsx @@ -53,6 +53,7 @@ export const Example = () => { { - const dataTypes = { + const dataTypes: Record = { isolated: [ { x: 0, y: 3 }, { x: 1, y: 5 }, From 5949d16f7a17c49f93cee716632fb309700aaf66 Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Tue, 14 Dec 2021 11:59:02 -0700 Subject: [PATCH 09/12] fix: undefined prop default behaviour --- ...ds-basic-visually-looks-correct-1-snap.png | Bin 18112 -> 22793 bytes .../src/chart_types/heatmap/specs/heatmap.ts | 4 ++-- .../partition_chart/specs/index.ts | 5 +++-- .../chart_types/xy_chart/specs/area_series.ts | 4 ++-- .../chart_types/xy_chart/specs/bar_series.ts | 4 ++-- .../xy_chart/specs/bubble_series.ts | 4 ++-- .../xy_chart/specs/histogram_bar_series.ts | 4 ++-- .../xy_chart/specs/line_annotation.ts | 3 ++- .../chart_types/xy_chart/specs/line_series.ts | 4 ++-- packages/charts/src/specs/group_by.ts | 4 ++-- packages/charts/src/specs/settings.tsx | 3 ++- packages/charts/src/state/spec_factory.ts | 3 ++- packages/charts/src/utils/common.ts | 15 +++++++++++++++ .../small_multiples/7_sunbursts.story.tsx | 1 - 14 files changed, 38 insertions(+), 20 deletions(-) diff --git a/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-grids-basic-visually-looks-correct-1-snap.png b/integration/tests/__image_snapshots__/all-test-ts-baseline-visual-tests-for-all-stories-grids-basic-visually-looks-correct-1-snap.png index c4a401ba004a4df09c2838962d56cb04ec85f1ef..e5b4653d8950c5bfbaf0aab00da9eb1838c4dbb1 100644 GIT binary patch literal 22793 zcmbTe1z1&U*EI}C7zhGNNJ)uEgVLeWA|RraGy>AysVE_hNQXhFlyrl1gVIR1o9>Q( zE|A+EY7tdckkA{YJQAS$)5gHl>3JneY z`B`juXa2jv0{jQv_L0;*w5$#a_?v5JGU9h1JH;=KxVk;=tvEU9Z=;VHj*baMqY1x+ zMd(k5PH;{~0!vm-G5`5%m#>ZIpM?CfoS(VOzV+GZlB{fRY}eOA_41yZUr5x=pSbu- z>k+*9_==8%M*I#NO$-e^cXQj~7 zxZ=o*-cYrj?at}{sw+v85Wvfy^E`?cd2ve8XrBH|!;RzsKX}!VzP3YtB8>D?C>!z< zg!-4eB#L7?m35baJ#)vOk}`w>uRwm}_tW3kz%5^W^B6 zp|653^Hf0~hXLN~LQ53b$d~c%$esXB@Ak;m?l}ZtKmAnBI4>FJ7%{i{VB- zxooR|hyZ1Ji&0a&j$R}wgxs<`tZ2+5jz-Mq;p4}3`&$boYYpUsh2~Gw3$x4D&rdam z81;Ns%+M^0bl#Yy%B{LP#5A_t4yT-@Bw^Iy`wsb>zmu2dY(uzOC-L}|}<2(I839d$TX*6viDxW~rE zMspdQr}jML6m(d;#>-puBuUH%cLFY7V^T1=b3n##L(jm#0Jl!;H9h@|%4rPco?!=Z>T#wnb5#TAtyA6<_J(%q4;_c175foXyK4W$2^=b~lt4 z!gzTUgts1#Hyv)VlM6X`x_1m}5t%d%#(a}w?{vl7{sf{+lg4A}~W+*fFYq_%Wj=9-NDLfSyr+trt&3(PO zr3FK0t|Q^qJsPw^%Q3t|!3gRC`vqmR`Gp03r`2m#(_&w=3!XI-j=Jw?cJR+pM6#$6 zQU#r?H-;SV_gCe593hWnb8XmF20RQQ$^TgvH2ICvB~)i1H?>g(60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a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts index 90cda2a670..c598547e75 100644 --- a/packages/charts/src/chart_types/heatmap/specs/heatmap.ts +++ b/packages/charts/src/chart_types/heatmap/specs/heatmap.ts @@ -17,7 +17,7 @@ import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; import { Accessor, AccessorFn } from '../../../utils/accessor'; import { ESCalendarInterval, ESFixedInterval } from '../../../utils/chrono/elasticsearch'; -import { Datum, RecursivePartial } from '../../../utils/common'; +import { Datum, RecursivePartial, stripUndefined } from '../../../utils/common'; import { config } from '../layout/config/config'; import { Config } from '../layout/types/config_types'; import { X_SCALE_DEFAULT } from './scale_defaults'; @@ -115,7 +115,7 @@ export const Heatmap = function ( ), ); const { defaults, overrides } = buildProps.current; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/partition_chart/specs/index.ts b/packages/charts/src/chart_types/partition_chart/specs/index.ts index a9fc46bb22..f24484e953 100644 --- a/packages/charts/src/chart_types/partition_chart/specs/index.ts +++ b/packages/charts/src/chart_types/partition_chart/specs/index.ts @@ -21,6 +21,7 @@ import { ShowAccessor, ValueAccessor, ValueFormatter, + stripUndefined, } from '../../../utils/common'; import { config, percentFormatter } from '../layout/config'; import { Config, FillFontSizeRange, FillLabelConfig } from '../layout/types/config_types'; @@ -72,7 +73,7 @@ const buildProps = buildSFProps()( valueFormatter: (d) => String(d), percentFormatter, topGroove: 20, - smallMultiples: null, + smallMultiples: '__global__small_multiples___', layers: [ { groupByRollup: (d, i) => i, @@ -98,7 +99,7 @@ export const Partition = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/area_series.ts b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts index ddc35c1c21..a3a36c914c 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/area_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/area_series.ts @@ -12,7 +12,7 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; -import { Datum } from '../../../utils/common'; +import { Datum, stripUndefined } from '../../../utils/common'; import { AreaSeriesSpec, HistogramModeAlignments, DEFAULT_GLOBAL_ID, SeriesType, BaseDatum } from '../utils/specs'; const buildProps = buildSFProps()( @@ -44,7 +44,7 @@ export const AreaSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts index 52bbc249ba..866e810585 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/bar_series.ts @@ -12,7 +12,7 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { useSpecFactory, SFProps, buildSFProps } from '../../../state/spec_factory'; -import { Datum } from '../../../utils/common'; +import { Datum, stripUndefined } from '../../../utils/common'; import { BarSeriesSpec, BaseDatum, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; const buildProps = buildSFProps()( @@ -44,7 +44,7 @@ export const BarSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts index 8f707a86cc..d3ee9c5e94 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/bubble_series.ts @@ -12,7 +12,7 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; -import { Datum } from '../../../utils/common'; +import { Datum, stripUndefined } from '../../../utils/common'; import { BaseDatum, BubbleSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType } from '../utils/specs'; const buildProps = buildSFProps()( @@ -43,7 +43,7 @@ export const BubbleSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts index cee4a83403..031080a1be 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/histogram_bar_series.ts @@ -12,7 +12,7 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; -import { Datum } from '../../../utils/common'; +import { Datum, stripUndefined } from '../../../utils/common'; import { HistogramBarSeriesSpec, DEFAULT_GLOBAL_ID, SeriesType, BaseDatum } from '../utils/specs'; const buildProps = buildSFProps()( @@ -44,7 +44,7 @@ export const HistogramBarSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts index 1e85adef13..4f878a0b2c 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/line_annotation.ts @@ -11,6 +11,7 @@ import { ComponentProps } from 'react'; import { ChartType } from '../..'; import { SpecType } from '../../../specs/constants'; import { buildSFProps, SFProps, useSpecFactory } from '../../../state/spec_factory'; +import { stripUndefined } from '../../../utils/common'; import { DEFAULT_ANNOTATION_LINE_STYLE } from '../../../utils/themes/merge_utils'; import { LineAnnotationSpec, DEFAULT_GLOBAL_ID, AnnotationType } from '../utils/specs'; @@ -44,7 +45,7 @@ export const LineAnnotation = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/chart_types/xy_chart/specs/line_series.ts b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts index 91000fcccc..d9795767eb 100644 --- a/packages/charts/src/chart_types/xy_chart/specs/line_series.ts +++ b/packages/charts/src/chart_types/xy_chart/specs/line_series.ts @@ -12,7 +12,7 @@ import { ChartType } from '../..'; import { ScaleType } from '../../../scales/constants'; import { SpecType } from '../../../specs/constants'; import { SFProps, buildSFProps, useSpecFactory } from '../../../state/spec_factory'; -import { Datum } from '../../../utils/common'; +import { Datum, stripUndefined } from '../../../utils/common'; import { LineSeriesSpec, DEFAULT_GLOBAL_ID, HistogramModeAlignments, SeriesType, BaseDatum } from '../utils/specs'; const buildProps = buildSFProps()( @@ -44,7 +44,7 @@ export const LineSeries = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/specs/group_by.ts b/packages/charts/src/specs/group_by.ts index 7e2a2cbb0a..71ddbbca02 100644 --- a/packages/charts/src/specs/group_by.ts +++ b/packages/charts/src/specs/group_by.ts @@ -12,7 +12,7 @@ import { BaseDatum, Spec } from '.'; import { ChartType } from '../chart_types'; import { Predicate } from '../common/predicate'; import { buildSFProps, SFProps, useSpecFactory } from '../state/spec_factory'; -import { Datum } from '../utils/common'; +import { Datum, stripUndefined } from '../utils/common'; import { SpecType } from './constants'; /** @public */ @@ -66,7 +66,7 @@ export const GroupBy = function ( >, ) { const { defaults, overrides } = buildProps; - useSpecFactory>({ ...defaults, ...props, ...overrides }); + useSpecFactory>({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/specs/settings.tsx b/packages/charts/src/specs/settings.tsx index 8dabe2043e..d5161f3145 100644 --- a/packages/charts/src/specs/settings.tsx +++ b/packages/charts/src/specs/settings.tsx @@ -31,6 +31,7 @@ import { Rendering, Rotation, VerticalAlignment, + stripUndefined, } from '../utils/common'; import { GeometryValue } from '../utils/geometry'; import { GroupId, SpecId } from '../utils/ids'; @@ -693,7 +694,7 @@ export const Settings = function ( >, ) { const { defaults, overrides } = settingsBuildProps; - useSpecFactory({ ...defaults, ...props, ...overrides }); + useSpecFactory({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; diff --git a/packages/charts/src/state/spec_factory.ts b/packages/charts/src/state/spec_factory.ts index 451b388bdc..c4021bff18 100644 --- a/packages/charts/src/state/spec_factory.ts +++ b/packages/charts/src/state/spec_factory.ts @@ -12,6 +12,7 @@ import { bindActionCreators } from 'redux'; import { OptionalKeys, RequiredKeys } from 'utility-types'; import { Spec as Spec } from '../specs'; +import { stripUndefined } from '../utils/common'; import { upsertSpec as upsertSpecAction, removeSpec as removeSpecAction } from './actions/specs'; /** @internal */ @@ -70,7 +71,7 @@ export const specComponentFactory = () => < ): FC> => { return (props) => { // @ts-ignore - All Spec keys are guaranteed to be included - useSpecFactory({ ...defaults, ...props, ...overrides }); + useSpecFactory({ ...defaults, ...stripUndefined(props), ...overrides }); return null; }; }; diff --git a/packages/charts/src/utils/common.ts b/packages/charts/src/utils/common.ts index c96b02e226..3f64e3073e 100644 --- a/packages/charts/src/utils/common.ts +++ b/packages/charts/src/utils/common.ts @@ -627,3 +627,18 @@ export function getOppositeAlignment>(source: R): R { + return Object.keys(source).reduce((acc, key) => { + const val = source[key]; + if (val !== undefined) { + // @ts-ignore - building new R from {} + acc[key] = val; + } + return acc; + }, {} as R); +} diff --git a/storybook/stories/small_multiples/7_sunbursts.story.tsx b/storybook/stories/small_multiples/7_sunbursts.story.tsx index cbd70a4d48..eac4802eb0 100644 --- a/storybook/stories/small_multiples/7_sunbursts.story.tsx +++ b/storybook/stories/small_multiples/7_sunbursts.story.tsx @@ -123,7 +123,6 @@ export const Example = () => { data={data} valueAccessor={(d: Datum) => d.exportVal as number} valueFormatter={(d: number) => `$${config.fillLabel.valueFormatter(Math.round(d / 1000000000))}\u00A0Bn`} - smallMultiples="sm" layers={[ { groupByRollup: (d: Datum) => d.sitc1, From 7962273b8a7a5d9c573749107105d424c689b957 Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Tue, 4 Jan 2022 16:48:03 -0600 Subject: [PATCH 10/12] test: fix bad test --- .../charts/src/components/__snapshots__/chart.test.tsx.snap | 4 ++-- packages/charts/src/components/chart.test.tsx | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/charts/src/components/__snapshots__/chart.test.tsx.snap b/packages/charts/src/components/__snapshots__/chart.test.tsx.snap index bcf09df073..69c2ad65b4 100644 --- a/packages/charts/src/components/__snapshots__/chart.test.tsx.snap +++ b/packages/charts/src/components/__snapshots__/chart.test.tsx.snap @@ -69,7 +69,7 @@ exports[`Chart should render the legend name test 1`] = `
- +
@@ -110,7 +110,7 @@ exports[`Chart should render the legend name test 1`] = ` - + diff --git a/packages/charts/src/components/chart.test.tsx b/packages/charts/src/components/chart.test.tsx index c63e540117..488a0a7bbd 100644 --- a/packages/charts/src/components/chart.test.tsx +++ b/packages/charts/src/components/chart.test.tsx @@ -43,6 +43,8 @@ describe('Chart', () => { }); it('should render the legend name test', () => { + // This is snapshot has a slight diff between local and ci runs, need to investigate + // See https://github.com/elastic/elastic-charts/runs/4706561347?check_suite_focus=true const wrapper = mount( From 7916d9458f7238e1ab36f77a594dfc2c2909d58c Mon Sep 17 00:00:00 2001 From: nickofthyme Date: Tue, 4 Jan 2022 17:32:31 -0600 Subject: [PATCH 11/12] test: update vrt screenshots --- ...tories-time-snap-with-dataset-3-1-snap.png | Bin 6945 -> 5645 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/integration/tests/__image_snapshots__/heatmap-stories-test-ts-heatmap-stories-time-snap-with-dataset-3-1-snap.png b/integration/tests/__image_snapshots__/heatmap-stories-test-ts-heatmap-stories-time-snap-with-dataset-3-1-snap.png index 747e09e5ded23dd877d7f61be441bb6d46307e8a..8f309b842565d1a8bc279a688413fa4aa434b563 100644 GIT binary patch delta 3891 zcmX|D3pkT~|JU2~WDa&J8j z4Y9nGqJK5xrTz;aUw0Lo)XRUsPG5R9^Dr~J_kV7Ef#&TyzUPSRnUa5o@3{@RvozfT z_}PZ^mL7JFDttUpR;jSzY;reSePkp21c1A4I|D7v+%J7!fMx3J)q zH%4rhN;1Ix7l_tabbeI7t)PIP5LQIOFFGO7uzt8=Tl~2|jW>{7qBSKBhPUhV_4T2- zlWuOD$1Go*{n4@bp|X(vd|QhfA0CQ34CNPjyyt$-&dv^N?{*82Z92Zwm7#;=#Njb*+q)OHWyiES!#p?DtS1Ir zNN0*;BE2^68*PbyDMqX{drPZJ5lSK<9;ebQEann?o}ms$UMdT0`7>M4`&=ON`_v+;f_WLKb@e@U|ISqDk^03d{-m4re*GTWrHVqsJ5ml zgi*zK4sHJhlSB=?Di^`4e$GJ3H#u_~X?*!`Apz)@2?v(d;&IzCIb&mEVg|=a%lYxX zr$$5vOGxwLYrneC3tp?d-$Y|-q4aDZ&cXwMqfmbhcH6h8g+*@Uio25u&)#n&(;x2b zPYpS=9I_Oyc$%f3b_javY^t_8NC1lj@tTdW+h{%w#w-^#xL4NISrxY8FabiU!YmvJ zucYbLPBWSQl5njh=|=;%c;jPE3dsPy(x>WmMTPNWHN(|W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$Bh7C%Dpv$7(#q;$1;KfQclgpNLa1&xOis2!BG0_&PK~H!JA^9XhU4eK!#7$el=)3Unr+_-{0S4 z~QDzi0>;NCo5--PZF7q^dFo&@?-P`qQLU zi(jK{DuD=P%KKLN{udY|qz7uTY#7kYV@ph8-aOyVz!7g`7%_d6Ma|4q*tNS0-!elS zI2U3JH9bwU%}}`^D!-GA+!+e*PCa}^PBMe$zdy7pdHVF}h-k<{9LAnjchjwUbx)D1 zps4l^7>?Uz@BMf@ls}C|``nL;%}6<<9V2oetj!Ii30PDra1Z~`E>2iAq)&bV#6rB> za0XD5d};kSbJKuq%X>4z9>sQ?l0n=4Ao1ap`oJJM>?*` zRoop0>yzKpDQlOk_LTupK)f5;fgfW7+r$?x(FeT0aP2kK4^ai3oLimmg?xZ|a9CKi zUP`CHs_KK zjPi9YiRuB$M6k^vQ!Pslan>NIPmQybs`L{1G2u)wN#R@RYS9|%ZfCI}AK4=jpyRyK_Zb88B@!QPtFuV(zOJSAzN z!A_2AnUK-kQ12==*;|K1#{=fVcQg``zZ!_y2rL6?9l6X*)7JxJ6Tz0A3mwk}iJb?m z;n~=g50O-L6_w^%r; Date: Wed, 5 Jan 2022 13:44:26 -0600 Subject: [PATCH 12/12] chore: update api changes --- packages/charts/api/charts.api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/charts/api/charts.api.md b/packages/charts/api/charts.api.md index 588514b677..b06c57d671 100644 --- a/packages/charts/api/charts.api.md +++ b/packages/charts/api/charts.api.md @@ -944,7 +944,7 @@ export interface GeometryValue { export function getNodeName(node: ArrayNode): string; // @alpha -export const Goal: FC>; +export const Goal: FC>; // @alpha (undocumented) export type GoalLabelAccessor = LabelAccessor;