@redsift/charts 10.3.0-alpha.7 → 10.3.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +36 -27
- package/index.js +469 -112
- package/index.js.map +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -386,16 +386,19 @@ declare const getColorScale: ({ colorTheme, domain, isEmpty, theme, }: {
|
|
|
386
386
|
theme: Theme;
|
|
387
387
|
}) => ScaleOrdinal<string, string>;
|
|
388
388
|
|
|
389
|
+
type AnchorProps = ComponentProps<'a'> & {
|
|
390
|
+
as?: any;
|
|
391
|
+
};
|
|
389
392
|
/**
|
|
390
393
|
* Component props.
|
|
391
394
|
*/
|
|
392
395
|
interface DataPointProps<T> extends Omit<ComponentProps<'g'>, 'onClick' | 'scale'> {
|
|
396
|
+
/** Anchor props to use when the component is a navigation link. */
|
|
397
|
+
anchorProps?: AnchorProps;
|
|
393
398
|
/** Color of the DataPoint. */
|
|
394
399
|
color?: string;
|
|
395
400
|
/** Data. Also state to which the component should end the animation, if any. */
|
|
396
401
|
data: T;
|
|
397
|
-
/** Href when the component is a navigation link. */
|
|
398
|
-
href?: string;
|
|
399
402
|
/** Id. Used for accessibility. */
|
|
400
403
|
id?: string;
|
|
401
404
|
/** Position in the list of siblings. Used for placement and selection. */
|
|
@@ -547,7 +550,7 @@ interface ChartContainerProps extends Omit<ComponentProps<'div'>, 'title'>, Cont
|
|
|
547
550
|
/** Description that won't be visually displayed but will be used for assistive technology. If you want to display the description, use `description` instead. */
|
|
548
551
|
descriptionForAssistiveTechnology?: string;
|
|
549
552
|
/** Whether the chart is static or interactive. */
|
|
550
|
-
mode?:
|
|
553
|
+
mode?: string;
|
|
551
554
|
/** Small text explaining which kind of chart is presenting and what's its basic composition. */
|
|
552
555
|
definition?: string;
|
|
553
556
|
/** Small text explaining the basic composition of the x-axis, if any. */
|
|
@@ -603,7 +606,7 @@ interface LegendProps extends Omit<ComponentProps<'ul'>, 'onClick'>, ContainerPr
|
|
|
603
606
|
data: (Statistic & {
|
|
604
607
|
color: string;
|
|
605
608
|
})[];
|
|
606
|
-
/** Method to determine whether a
|
|
609
|
+
/** Method to determine whether a legend is selected or not. */
|
|
607
610
|
isLegendItemSelected?: (datum: LegendItemDatum) => void;
|
|
608
611
|
/** Method to override the data labels. */
|
|
609
612
|
labelDecorator?: (datum: LegendItemDatum, props?: {
|
|
@@ -663,6 +666,8 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
663
666
|
areXLabelsRotated?: boolean;
|
|
664
667
|
/** Native HTML props to forward to each bar. */
|
|
665
668
|
barProps?: Omit<ComponentProps<'g'>, 'onClick' | 'orientation' | 'ref' | 'scale'>;
|
|
669
|
+
/** Bar role. If an onClick is provided, the bars will have the role `button`. For a navigation link, please use `getBarAnchorProps` instead. */
|
|
670
|
+
barRole?: BarProps['role'];
|
|
666
671
|
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
667
672
|
caping?: number;
|
|
668
673
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
@@ -671,12 +676,9 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
671
676
|
dataType?: 'TwoCategoryData' | 'LinearData' | 'CategoryData';
|
|
672
677
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
673
678
|
emptyComponent?: ReactNode;
|
|
674
|
-
/** Method used to define the
|
|
675
|
-
getBarAnchorProps?: (datum: BarDatum) =>
|
|
676
|
-
|
|
677
|
-
target?: string;
|
|
678
|
-
};
|
|
679
|
-
/** Method to determine whether a slice is selected or not. */
|
|
679
|
+
/** Method used to define the anchor props to use when the bar is a navigation link. */
|
|
680
|
+
getBarAnchorProps?: (datum: BarDatum) => AnchorProps;
|
|
681
|
+
/** Method to determine whether a bar is selected or not. */
|
|
680
682
|
isBarSelected?: (datum: BarDatum) => void;
|
|
681
683
|
/** Method to override the data labels. */
|
|
682
684
|
labelDecorator?: (datum: BarDatum, props?: {
|
|
@@ -693,7 +695,9 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
693
695
|
/** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. If set to "custom", use `legendDecorator` to customize it. */
|
|
694
696
|
legendVariant?: BarChartLegendVariant;
|
|
695
697
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
696
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'
|
|
698
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'> & {
|
|
699
|
+
extraLegendItems?: Statistics;
|
|
700
|
+
};
|
|
697
701
|
/** Labels and texts. */
|
|
698
702
|
localeText?: LocaleText$3;
|
|
699
703
|
/** Custom margins, used to give more space for axes labels and legend for instance. */
|
|
@@ -708,8 +712,6 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
708
712
|
size?: ChartSize | BarChartDimensions;
|
|
709
713
|
/** Define how to sort categories. */
|
|
710
714
|
sortingMethod?: SortingMethod;
|
|
711
|
-
/** Bar role. Used to indicate that bars are to be considered buttons or links. If an onClick is provided, the bars will have the role `button` unless specifically set to `link` with this prop. */
|
|
712
|
-
barRole?: BarProps['role'];
|
|
713
715
|
/** Color palette to use. You can choose among the list of available color palette or also choose to use the success/warning/danger theme for which you have to specify which key corresponds to which status. */
|
|
714
716
|
colorTheme?: ChartTheme;
|
|
715
717
|
/** Method modifying what's displayed within the tooltip when the tooltipVariant is "custom". */
|
|
@@ -818,10 +820,12 @@ type LineChartDimensions = ChartDimensions & {
|
|
|
818
820
|
interface LineChartProps extends ChartContainerProps, ChartAxesProps {
|
|
819
821
|
/** Dataset to use to generate the chart. */
|
|
820
822
|
data?: TwoCategoryData;
|
|
821
|
-
/**
|
|
823
|
+
/** Dot role. If an onClick is provided, the dots will have the role `button`. For a navigation link, please use `getDotAnchorProps` instead. */
|
|
822
824
|
dotRole?: DotProps['role'];
|
|
823
825
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
824
826
|
emptyComponent?: ReactNode;
|
|
827
|
+
/** Method used to define the anchor props to use when the dot is a navigation link. */
|
|
828
|
+
getDotAnchorProps?: (datum: DotDatum) => AnchorProps;
|
|
825
829
|
/** Method to determine whether a dot is selected or not. */
|
|
826
830
|
isDotSelected?: (datum: DotDatum) => boolean | undefined;
|
|
827
831
|
/** Method to override the data point labels. */
|
|
@@ -839,12 +843,14 @@ interface LineChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
839
843
|
/** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. If set to "custom", use `legendDecorator` to customize it. */
|
|
840
844
|
legendVariant?: LineChartLegendVariant;
|
|
841
845
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
842
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'
|
|
846
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'> & {
|
|
847
|
+
extraLegendItems?: Statistics;
|
|
848
|
+
};
|
|
843
849
|
/** Labels and texts. */
|
|
844
850
|
localeText?: LocaleText$2;
|
|
845
851
|
/** Custom margins, used to give more space for axes labels and legend for instance. */
|
|
846
852
|
margins?: MarginProps;
|
|
847
|
-
/** Method to be called on a click on a dot. */
|
|
853
|
+
/** Method to be called on a click on a dot. For a navigation link, please use `getDotAnchorProps` instead. */
|
|
848
854
|
onDotClick?: (datum: DotDatum) => void;
|
|
849
855
|
/** LineChart size. */
|
|
850
856
|
size?: ChartSize | LineChartDimensions;
|
|
@@ -919,11 +925,8 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
919
925
|
data?: CategoryData;
|
|
920
926
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
921
927
|
emptyComponent?: ReactNode;
|
|
922
|
-
/** Method used to define the
|
|
923
|
-
getSliceAnchorProps?: (datum: ArcDatum) =>
|
|
924
|
-
href: string;
|
|
925
|
-
target?: string;
|
|
926
|
-
};
|
|
928
|
+
/** Method used to define the anchor props to use when the slice is a navigation link. */
|
|
929
|
+
getSliceAnchorProps?: (datum: ArcDatum) => AnchorProps;
|
|
927
930
|
/** Whether the pie or donut is cut in half or not. */
|
|
928
931
|
isHalf?: boolean;
|
|
929
932
|
/** Method to determine whether a slice is selected or not. */
|
|
@@ -943,7 +946,9 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
943
946
|
/** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. If set to "custom", use `legendDecorator` to customize it. */
|
|
944
947
|
legendVariant?: PieChartLegendVariant;
|
|
945
948
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
946
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant'
|
|
949
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant'> & {
|
|
950
|
+
extraLegendItems?: Statistics;
|
|
951
|
+
};
|
|
947
952
|
/** Labels and texts. */
|
|
948
953
|
localeText?: LocaleText$1;
|
|
949
954
|
/** Method to be called on a click on a slice. For a navigation link, please use `getSliceAnchorProps` instead. */
|
|
@@ -954,7 +959,7 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
954
959
|
size?: ChartSize | PieChartDimensions;
|
|
955
960
|
/** Native HTML props to forward to each slice. */
|
|
956
961
|
sliceProps?: Omit<ComponentProps<'g'>, 'onClick' | 'ref' | 'width'>;
|
|
957
|
-
/** Slice role.
|
|
962
|
+
/** Slice role. If an onClick is provided, the slices will have the role `button`. For a navigation link, please use `getSliceAnchorProps` instead. */
|
|
958
963
|
sliceRole?: ArcProps['role'];
|
|
959
964
|
/** Define how to sort categories. */
|
|
960
965
|
sortingMethod?: SortingMethod;
|
|
@@ -1031,7 +1036,9 @@ type ScatterPlotDimensions = ChartDimensions & {
|
|
|
1031
1036
|
interface ScatterPlotProps extends ChartContainerProps, ChartAxesProps {
|
|
1032
1037
|
/** Dataset to use to generate the chart. */
|
|
1033
1038
|
data?: CoordinatesCategoryData;
|
|
1034
|
-
/**
|
|
1039
|
+
/** Method used to define the anchor props to use when the dot is a navigation link. */
|
|
1040
|
+
getDotAnchorProps?: (datum: DotDatum) => AnchorProps;
|
|
1041
|
+
/** Dot role. If an onClick is provided, the dots will have the role `button`. For a navigation link, please use `getDotAnchorProps` instead. */
|
|
1035
1042
|
dotRole?: DotProps['role'];
|
|
1036
1043
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
1037
1044
|
emptyComponent?: ReactNode;
|
|
@@ -1056,7 +1063,9 @@ interface ScatterPlotProps extends ChartContainerProps, ChartAxesProps {
|
|
|
1056
1063
|
/** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. If set to "custom", use `legendDecorator` to customize it. */
|
|
1057
1064
|
legendVariant?: ScatterPlotLegendVariant;
|
|
1058
1065
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
1059
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'
|
|
1066
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'> & {
|
|
1067
|
+
extraLegendItems?: Statistics;
|
|
1068
|
+
};
|
|
1060
1069
|
/** Labels and texts. */
|
|
1061
1070
|
localeText?: LocaleText;
|
|
1062
1071
|
/** Custom margins, used to give more space for axes labels and legend for instance. */
|
|
@@ -1065,7 +1074,7 @@ interface ScatterPlotProps extends ChartContainerProps, ChartAxesProps {
|
|
|
1065
1074
|
onBrush?: (selection: [[number, number], [number, number]] | null, scaleX: ScaleLinear$1<number, number>, scaleY: ScaleLinear$1<number, number>) => void;
|
|
1066
1075
|
/** Method called on brush end. */
|
|
1067
1076
|
onBrushEnd?: (selection: [[number, number], [number, number]] | null, scaleX?: ScaleLinear$1<number, number>, scaleY?: ScaleLinear$1<number, number>) => void;
|
|
1068
|
-
/** Method to be called on a click on a dot. */
|
|
1077
|
+
/** Method to be called on a click on a dot. For a navigation link, please use `getDotAnchorProps` instead. */
|
|
1069
1078
|
onDotClick?: (datum: DotDatum) => void;
|
|
1070
1079
|
/** ScatterPlot size. */
|
|
1071
1080
|
size?: ChartSize | ScatterPlotDimensions;
|
|
@@ -1102,4 +1111,4 @@ declare const StyledScatterPlotEmptyText: styled_components.StyledComponent<"div
|
|
|
1102
1111
|
$theme: Theme;
|
|
1103
1112
|
}, never>;
|
|
1104
1113
|
|
|
1105
|
-
export { AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, AxisVariant, Bar, BarChart, BarChartDimensions, BarChartLegendVariant, BarChartProps, BarDatum, BarOrientation, BarProps, CategoricalOrLinearDim, CategoryData, CategoryDatum, CategoryDim, ChartAxesProps, ChartContainer, ChartContainerProps, ChartDimensions, ChartSize, ChartTheme, ColorTheme, Coordinates, CoordinatesCategoryData, CoordinatesCategoryDatum, CoordinatesCategoryDim, CustomColorTheme, DataPoint, DataPointProps, Datum, Dot, DotDatum, DotProps, DotVariant, EmptyDatum, JSONArray, JSONObject, JSONValue, LabelVariant, Legend, LegendItemDatum, LegendProps, LegendVariant, Line, LineChart, LineChartDimensions, LineChartLegendVariant, LineChartProps, LinePointDatum, LineProps, LinearData, LinearDatum, LinearDim, MarginProps, NumericValue, PieChart, PieChartDimensions, PieChartLegendVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLegendVariant, ScatterPlotProps, ScatterPlotVariant, SortingMethod, Statistic, Statistics, StringValue, StyledArc, StyledArcProps, StyledArcs, StyledArcsProps, StyledAxis, StyledAxisProps, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledBarChartProps, StyledBarProps, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerProps, StyledChartContainerTitle, StyledDataPoint, StyledDataPointProps, StyledDot, StyledDotProps, StyledLegend, StyledLegendProps, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledLineChartProps, StyledLineProps, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartProps, StyledScatterPlot, StyledScatterPlotEmptyText, StyledScatterPlotProps, SuccessDangerColorTheme, TicksSpec, TooltipVariant, TwoCategoryData, TwoCategoryDatum, TwoCategoryDim, UseBrushProps, UseColorProps, UseFormatCategoricalDataProps, UseZoomProps, XScaleType, empty, getColorScale, getSortingMethod, isValidDate, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
|
1114
|
+
export { AnchorProps, AnyScale, Arc, ArcDatum, ArcProps, Arcs, ArcsProps, Axis, AxisPosition, AxisProps, AxisVariant, Bar, BarChart, BarChartDimensions, BarChartLegendVariant, BarChartProps, BarDatum, BarOrientation, BarProps, CategoricalOrLinearDim, CategoryData, CategoryDatum, CategoryDim, ChartAxesProps, ChartContainer, ChartContainerProps, ChartDimensions, ChartSize, ChartTheme, ColorTheme, Coordinates, CoordinatesCategoryData, CoordinatesCategoryDatum, CoordinatesCategoryDim, CustomColorTheme, DataPoint, DataPointProps, Datum, Dot, DotDatum, DotProps, DotVariant, EmptyDatum, JSONArray, JSONObject, JSONValue, LabelVariant, Legend, LegendItemDatum, LegendProps, LegendVariant, Line, LineChart, LineChartDimensions, LineChartLegendVariant, LineChartProps, LinePointDatum, LineProps, LinearData, LinearDatum, LinearDim, MarginProps, NumericValue, PieChart, PieChartDimensions, PieChartLegendVariant, PieChartProps, PieChartVariant, Scale, ScaleBand, ScaleLinear, ScaleLog, ScalePoint, ScaleSymlog, ScaleTime, ScaleTypeToScale, ScaleValue, ScaleWithBandwidth, ScatterPlot, ScatterPlotDimensions, ScatterPlotLegendVariant, ScatterPlotProps, ScatterPlotVariant, SortingMethod, Statistic, Statistics, StringValue, StyledArc, StyledArcProps, StyledArcs, StyledArcsProps, StyledAxis, StyledAxisProps, StyledBar, StyledBarChart, StyledBarChartEmptyText, StyledBarChartProps, StyledBarProps, StyledChartContainer, StyledChartContainerCaption, StyledChartContainerProps, StyledChartContainerTitle, StyledDataPoint, StyledDataPointProps, StyledDot, StyledDotProps, StyledLegend, StyledLegendProps, StyledLine, StyledLineChart, StyledLineChartEmptyText, StyledLineChartProps, StyledLineProps, StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartProps, StyledScatterPlot, StyledScatterPlotEmptyText, StyledScatterPlotProps, SuccessDangerColorTheme, TicksSpec, TooltipVariant, TwoCategoryData, TwoCategoryDatum, TwoCategoryDim, UseBrushProps, UseColorProps, UseFormatCategoricalDataProps, UseZoomProps, XScaleType, empty, getColorScale, getSortingMethod, isValidDate, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|