@redsift/charts 10.2.0 → 10.3.0-alpha.10
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/CONTRIBUTING.md +4 -4
- package/index.d.ts +56 -18
- package/index.js +842 -341
- package/index.js.map +1 -1
- package/package.json +4 -4
package/CONTRIBUTING.md
CHANGED
|
@@ -58,6 +58,10 @@ The Design System is following a monorepo architecture, providing multiple packa
|
|
|
58
58
|
|
|
59
59
|
This package provides dashboard-related components and decorators to make charts and datagrid filterable using [crossfilter](https://crossfilter.github.io/crossfilter/).
|
|
60
60
|
|
|
61
|
+
- `@redsift/products`
|
|
62
|
+
|
|
63
|
+
This package provides ready-to-use implementation of components with a customize style to fit Red Sift's use cases. It is based on all other packages.
|
|
64
|
+
|
|
61
65
|
- _Deprecated_ `@redsift/design-system-legacy`
|
|
62
66
|
|
|
63
67
|
This package contains all components prior to the 6.0.0 version. These components are deprecated and contributing to this package is discouraged since it will be removed in the future.
|
|
@@ -133,9 +137,6 @@ import { BadgeProps } from './types';
|
|
|
133
137
|
|
|
134
138
|
const COMPONENT_NAME = 'Badge';
|
|
135
139
|
const CLASSNAME = 'redsift-badge';
|
|
136
|
-
const DEFAULT_PROPS: Partial<BadgeProps> = {
|
|
137
|
-
// default values
|
|
138
|
-
};
|
|
139
140
|
|
|
140
141
|
/**
|
|
141
142
|
* The Badge component.
|
|
@@ -158,7 +159,6 @@ export const Badge: Comp<BadgeProps, HTMLDivElement> = forwardRef((props, ref) =
|
|
|
158
159
|
);
|
|
159
160
|
});
|
|
160
161
|
Badge.className = CLASSNAME;
|
|
161
|
-
Badge.defaultProps = DEFAULT_PROPS;
|
|
162
162
|
Badge.displayName = COMPONENT_NAME;
|
|
163
163
|
```
|
|
164
164
|
|
package/index.d.ts
CHANGED
|
@@ -386,10 +386,15 @@ 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. */
|
|
@@ -411,7 +416,7 @@ interface DataPointProps<T> extends Omit<ComponentProps<'g'>, 'onClick' | 'scale
|
|
|
411
416
|
/** State from which the component should start the animation, if any. */
|
|
412
417
|
previousData?: T;
|
|
413
418
|
/** Role. Will be set to 'button' if onClick is provided. If 'option', then the component becomes selectable. */
|
|
414
|
-
role?: 'button' | 'link' | 'option';
|
|
419
|
+
role?: 'img' | 'button' | 'link' | 'option';
|
|
415
420
|
/** Theme. */
|
|
416
421
|
theme?: Theme;
|
|
417
422
|
/** Tooltip variant. */
|
|
@@ -542,6 +547,23 @@ interface ChartContainerProps extends Omit<ComponentProps<'div'>, 'title'>, Cont
|
|
|
542
547
|
title?: string | ReactElement;
|
|
543
548
|
/** Theme. */
|
|
544
549
|
theme?: Theme;
|
|
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. */
|
|
551
|
+
descriptionForAssistiveTechnology?: string;
|
|
552
|
+
/** Whether the chart is static or interactive. */
|
|
553
|
+
mode?: string;
|
|
554
|
+
/** Small text explaining which kind of chart is presenting and what's its basic composition. */
|
|
555
|
+
definition?: string;
|
|
556
|
+
/** Small text explaining the basic composition of the x-axis, if any. */
|
|
557
|
+
xAxisDefinition?: string;
|
|
558
|
+
/** Small text explaining the basic composition of the y-axis, if any. */
|
|
559
|
+
yAxisDefinition?: string;
|
|
560
|
+
/** Small text explaining how the chart is interactive, if any. */
|
|
561
|
+
interactionExplanation?: string;
|
|
562
|
+
/** Table representation of the chart. */
|
|
563
|
+
dataTableRepresentation?: {
|
|
564
|
+
header: ReactElement;
|
|
565
|
+
body: ReactElement;
|
|
566
|
+
};
|
|
545
567
|
}
|
|
546
568
|
type StyledChartContainerProps = Omit<ChartContainerProps, 'theme'> & {
|
|
547
569
|
$theme: Theme;
|
|
@@ -584,7 +606,7 @@ interface LegendProps extends Omit<ComponentProps<'ul'>, 'onClick'>, ContainerPr
|
|
|
584
606
|
data: (Statistic & {
|
|
585
607
|
color: string;
|
|
586
608
|
})[];
|
|
587
|
-
/** Method to determine whether a
|
|
609
|
+
/** Method to determine whether a legend is selected or not. */
|
|
588
610
|
isLegendItemSelected?: (datum: LegendItemDatum) => void;
|
|
589
611
|
/** Method to override the data labels. */
|
|
590
612
|
labelDecorator?: (datum: LegendItemDatum, props?: {
|
|
@@ -643,7 +665,9 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
643
665
|
/** @deprecated: Use xAxisTickRotation instead. Whether the x axis labels are rotated or not. */
|
|
644
666
|
areXLabelsRotated?: boolean;
|
|
645
667
|
/** Native HTML props to forward to each bar. */
|
|
646
|
-
barProps?: Omit<ComponentProps<'g'>, 'onClick' | 'orientation' | 'ref' | 'scale'
|
|
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'];
|
|
647
671
|
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
648
672
|
caping?: number;
|
|
649
673
|
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
@@ -652,7 +676,9 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
652
676
|
dataType?: 'TwoCategoryData' | 'LinearData' | 'CategoryData';
|
|
653
677
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
654
678
|
emptyComponent?: ReactNode;
|
|
655
|
-
/** Method to
|
|
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. */
|
|
656
682
|
isBarSelected?: (datum: BarDatum) => void;
|
|
657
683
|
/** Method to override the data labels. */
|
|
658
684
|
labelDecorator?: (datum: BarDatum, props?: {
|
|
@@ -669,12 +695,14 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
669
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. */
|
|
670
696
|
legendVariant?: BarChartLegendVariant;
|
|
671
697
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
672
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'
|
|
698
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'> & {
|
|
699
|
+
extraLegendItems?: Statistics;
|
|
700
|
+
};
|
|
673
701
|
/** Labels and texts. */
|
|
674
702
|
localeText?: LocaleText$3;
|
|
675
703
|
/** Custom margins, used to give more space for axes labels and legend for instance. */
|
|
676
704
|
margins?: MarginProps;
|
|
677
|
-
/** Method to be called on a click on a bar. */
|
|
705
|
+
/** Method to be called on a click on a bar. For a navigation link, please use `getBarAnchorProps` instead. */
|
|
678
706
|
onBarClick?: (datum: BarDatum) => void;
|
|
679
707
|
/** Orientation of the bar. */
|
|
680
708
|
orientation?: BarOrientation;
|
|
@@ -684,8 +712,6 @@ interface BarChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
684
712
|
size?: ChartSize | BarChartDimensions;
|
|
685
713
|
/** Define how to sort categories. */
|
|
686
714
|
sortingMethod?: SortingMethod;
|
|
687
|
-
/** 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. */
|
|
688
|
-
barRole?: BarProps['role'];
|
|
689
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. */
|
|
690
716
|
colorTheme?: ChartTheme;
|
|
691
717
|
/** Method modifying what's displayed within the tooltip when the tooltipVariant is "custom". */
|
|
@@ -794,10 +820,12 @@ type LineChartDimensions = ChartDimensions & {
|
|
|
794
820
|
interface LineChartProps extends ChartContainerProps, ChartAxesProps {
|
|
795
821
|
/** Dataset to use to generate the chart. */
|
|
796
822
|
data?: TwoCategoryData;
|
|
797
|
-
/**
|
|
823
|
+
/** Dot role. If an onClick is provided, the dots will have the role `button`. For a navigation link, please use `getDotAnchorProps` instead. */
|
|
798
824
|
dotRole?: DotProps['role'];
|
|
799
825
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
800
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;
|
|
801
829
|
/** Method to determine whether a dot is selected or not. */
|
|
802
830
|
isDotSelected?: (datum: DotDatum) => boolean | undefined;
|
|
803
831
|
/** Method to override the data point labels. */
|
|
@@ -815,12 +843,14 @@ interface LineChartProps extends ChartContainerProps, ChartAxesProps {
|
|
|
815
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. */
|
|
816
844
|
legendVariant?: LineChartLegendVariant;
|
|
817
845
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
818
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'
|
|
846
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'> & {
|
|
847
|
+
extraLegendItems?: Statistics;
|
|
848
|
+
};
|
|
819
849
|
/** Labels and texts. */
|
|
820
850
|
localeText?: LocaleText$2;
|
|
821
851
|
/** Custom margins, used to give more space for axes labels and legend for instance. */
|
|
822
852
|
margins?: MarginProps;
|
|
823
|
-
/** 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. */
|
|
824
854
|
onDotClick?: (datum: DotDatum) => void;
|
|
825
855
|
/** LineChart size. */
|
|
826
856
|
size?: ChartSize | LineChartDimensions;
|
|
@@ -895,6 +925,8 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
895
925
|
data?: CategoryData;
|
|
896
926
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
897
927
|
emptyComponent?: ReactNode;
|
|
928
|
+
/** Method used to define the anchor props to use when the slice is a navigation link. */
|
|
929
|
+
getSliceAnchorProps?: (datum: ArcDatum) => AnchorProps;
|
|
898
930
|
/** Whether the pie or donut is cut in half or not. */
|
|
899
931
|
isHalf?: boolean;
|
|
900
932
|
/** Method to determine whether a slice is selected or not. */
|
|
@@ -914,10 +946,12 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
914
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. */
|
|
915
947
|
legendVariant?: PieChartLegendVariant;
|
|
916
948
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
917
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant'
|
|
949
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant'> & {
|
|
950
|
+
extraLegendItems?: Statistics;
|
|
951
|
+
};
|
|
918
952
|
/** Labels and texts. */
|
|
919
953
|
localeText?: LocaleText$1;
|
|
920
|
-
/** Method to be called on a click on a slice. */
|
|
954
|
+
/** Method to be called on a click on a slice. For a navigation link, please use `getSliceAnchorProps` instead. */
|
|
921
955
|
onSliceClick?: (datum: ArcDatum) => void;
|
|
922
956
|
/** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */
|
|
923
957
|
others?: boolean | string;
|
|
@@ -925,7 +959,7 @@ interface PieChartProps extends ChartContainerProps {
|
|
|
925
959
|
size?: ChartSize | PieChartDimensions;
|
|
926
960
|
/** Native HTML props to forward to each slice. */
|
|
927
961
|
sliceProps?: Omit<ComponentProps<'g'>, 'onClick' | 'ref' | 'width'>;
|
|
928
|
-
/** 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. */
|
|
929
963
|
sliceRole?: ArcProps['role'];
|
|
930
964
|
/** Define how to sort categories. */
|
|
931
965
|
sortingMethod?: SortingMethod;
|
|
@@ -1002,7 +1036,9 @@ type ScatterPlotDimensions = ChartDimensions & {
|
|
|
1002
1036
|
interface ScatterPlotProps extends ChartContainerProps, ChartAxesProps {
|
|
1003
1037
|
/** Dataset to use to generate the chart. */
|
|
1004
1038
|
data?: CoordinatesCategoryData;
|
|
1005
|
-
/**
|
|
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. */
|
|
1006
1042
|
dotRole?: DotProps['role'];
|
|
1007
1043
|
/** Component to use if the chart is empty (replacing the default one). */
|
|
1008
1044
|
emptyComponent?: ReactNode;
|
|
@@ -1027,7 +1063,9 @@ interface ScatterPlotProps extends ChartContainerProps, ChartAxesProps {
|
|
|
1027
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. */
|
|
1028
1064
|
legendVariant?: ScatterPlotLegendVariant;
|
|
1029
1065
|
/** Props to forward to the Legend block. Can be used to make the legend selectable. */
|
|
1030
|
-
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'
|
|
1066
|
+
legendProps?: Omit<LegendProps, 'data' | 'ref' | 'variant' | 'width'> & {
|
|
1067
|
+
extraLegendItems?: Statistics;
|
|
1068
|
+
};
|
|
1031
1069
|
/** Labels and texts. */
|
|
1032
1070
|
localeText?: LocaleText;
|
|
1033
1071
|
/** Custom margins, used to give more space for axes labels and legend for instance. */
|
|
@@ -1036,7 +1074,7 @@ interface ScatterPlotProps extends ChartContainerProps, ChartAxesProps {
|
|
|
1036
1074
|
onBrush?: (selection: [[number, number], [number, number]] | null, scaleX: ScaleLinear$1<number, number>, scaleY: ScaleLinear$1<number, number>) => void;
|
|
1037
1075
|
/** Method called on brush end. */
|
|
1038
1076
|
onBrushEnd?: (selection: [[number, number], [number, number]] | null, scaleX?: ScaleLinear$1<number, number>, scaleY?: ScaleLinear$1<number, number>) => void;
|
|
1039
|
-
/** 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. */
|
|
1040
1078
|
onDotClick?: (datum: DotDatum) => void;
|
|
1041
1079
|
/** ScatterPlot size. */
|
|
1042
1080
|
size?: ChartSize | ScatterPlotDimensions;
|
|
@@ -1073,4 +1111,4 @@ declare const StyledScatterPlotEmptyText: styled_components.StyledComponent<"div
|
|
|
1073
1111
|
$theme: Theme;
|
|
1074
1112
|
}, never>;
|
|
1075
1113
|
|
|
1076
|
-
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 };
|