@redsift/charts 7.0.2 → 7.1.0
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 +114 -5
- package/index.js +719 -201
- package/index.js.map +1 -1
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PieArcDatum as PieArcDatum$1 } from 'd3-shape';
|
|
2
|
-
import { ScaleOrdinal } from 'd3';
|
|
2
|
+
import { ScaleOrdinal, ScaleLinear } from 'd3';
|
|
3
3
|
import { ValueOf as ValueOf$1, Comp } from '@redsift/design-system';
|
|
4
4
|
import { ComponentProps } from 'react';
|
|
5
5
|
import * as styled_components from 'styled-components';
|
|
@@ -52,6 +52,111 @@ declare const successDangerScheme: {
|
|
|
52
52
|
};
|
|
53
53
|
declare const getColorScale: (theme: ColorTheme | SuccessDangerColorTheme, isEmpty?: boolean) => ScaleOrdinal<string, string>;
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Component size.
|
|
57
|
+
*/
|
|
58
|
+
declare const HorizontalBarChartSize: {
|
|
59
|
+
readonly small: "small";
|
|
60
|
+
readonly medium: "medium";
|
|
61
|
+
readonly large: "large";
|
|
62
|
+
};
|
|
63
|
+
declare type HorizontalBarChartSize = ValueOf$1<typeof HorizontalBarChartSize>;
|
|
64
|
+
/**
|
|
65
|
+
* Component theme.
|
|
66
|
+
*/
|
|
67
|
+
declare const HorizontalBarChartTheme: {
|
|
68
|
+
readonly default: "default";
|
|
69
|
+
readonly dark: "dark";
|
|
70
|
+
readonly darker: "darker";
|
|
71
|
+
readonly monochrome: "monochrome";
|
|
72
|
+
};
|
|
73
|
+
declare type HorizontalBarChartTheme = ValueOf$1<typeof HorizontalBarChartTheme>;
|
|
74
|
+
/**
|
|
75
|
+
* Tooltip label variant.
|
|
76
|
+
*/
|
|
77
|
+
declare const HorizontalBarChartTooltipVariant: {
|
|
78
|
+
none: string;
|
|
79
|
+
label: string;
|
|
80
|
+
value: string;
|
|
81
|
+
percent: string;
|
|
82
|
+
};
|
|
83
|
+
declare type HorizontalBarChartTooltipVariant = ValueOf$1<typeof HorizontalBarChartTooltipVariant>;
|
|
84
|
+
interface LocaleText$1 {
|
|
85
|
+
emptyChartText: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Component props.
|
|
89
|
+
*/
|
|
90
|
+
interface HorizontalBarChartProps extends ComponentProps<'div'> {
|
|
91
|
+
/** Whether the x axis labels are rotated or not. */
|
|
92
|
+
areXLabelsRotated?: boolean;
|
|
93
|
+
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
94
|
+
caping?: number;
|
|
95
|
+
/** Caption. */
|
|
96
|
+
caption?: string;
|
|
97
|
+
/** Dataset to use to generate the chart, should be a list of objects containing a name and a value. */
|
|
98
|
+
data: Datum[];
|
|
99
|
+
/** Labels and texts. */
|
|
100
|
+
localeText?: LocaleText$1;
|
|
101
|
+
/** Method to be called on a click on a bar. */
|
|
102
|
+
onBarClick?: (data: Datum) => void;
|
|
103
|
+
/** 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. */
|
|
104
|
+
others?: boolean | string;
|
|
105
|
+
/** HorizontalBarChart size. */
|
|
106
|
+
size?: HorizontalBarChartSize;
|
|
107
|
+
/** 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. */
|
|
108
|
+
barRole?: 'button' | 'link';
|
|
109
|
+
/** 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. */
|
|
110
|
+
theme?: HorizontalBarChartTheme | SuccessDangerColorTheme;
|
|
111
|
+
/** Title. */
|
|
112
|
+
title?: string;
|
|
113
|
+
/** Tooltip variant. */
|
|
114
|
+
tooltipVariant?: HorizontalBarChartTooltipVariant;
|
|
115
|
+
}
|
|
116
|
+
declare type StyledHorizontalBarChartProps = Omit<HorizontalBarChartProps, 'data'> & {};
|
|
117
|
+
interface HorizontalBarChartBarProps extends ComponentProps<'g'> {
|
|
118
|
+
chartId: string;
|
|
119
|
+
color: string;
|
|
120
|
+
data: Datum;
|
|
121
|
+
gap: number;
|
|
122
|
+
height: number;
|
|
123
|
+
index: number;
|
|
124
|
+
isEmpty: boolean;
|
|
125
|
+
onClick?: () => void;
|
|
126
|
+
role?: HorizontalBarChartProps['barRole'];
|
|
127
|
+
showTooltip: boolean;
|
|
128
|
+
tooltipLabelOnly: boolean;
|
|
129
|
+
tooltipPercent: string | null;
|
|
130
|
+
width: number;
|
|
131
|
+
}
|
|
132
|
+
declare type StyledHorizontalBarChartBarProps = Omit<HorizontalBarChartBarProps, 'chartId' | 'color' | 'data' | 'gap' | 'height' | 'index' | 'isEmpty' | 'showTooltip' | 'tooltipPercent' | 'tooltipLabelOnly' | 'width'> & {
|
|
133
|
+
$clickable: boolean;
|
|
134
|
+
};
|
|
135
|
+
interface HorizontalBarChartAxisBottomProps extends ComponentProps<'g'> {
|
|
136
|
+
areXLabelsRotated: boolean;
|
|
137
|
+
chartHeight: number;
|
|
138
|
+
d3scale: ScaleLinear<number, number>;
|
|
139
|
+
}
|
|
140
|
+
declare type StyledHorizontalBarChartAxisBottomProps = Omit<HorizontalBarChartAxisBottomProps, 'areXLabelsRotated' | 'chartHeight' | 'd3scale'> & {};
|
|
141
|
+
|
|
142
|
+
declare const HorizontalBarChart: Comp<HorizontalBarChartProps, HTMLDivElement>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Component style.
|
|
146
|
+
*/
|
|
147
|
+
declare const StyledHorizontalBarChart: styled_components.StyledComponent<"div", any, Omit<HorizontalBarChartProps, "data">, never>;
|
|
148
|
+
declare const StyledHorizontalBarChartTitle: styled_components.StyledComponent<"div", any, Omit<HorizontalBarChartProps, "data">, never>;
|
|
149
|
+
declare const StyledHorizontalBarChartCaption: styled_components.StyledComponent<"p", any, Omit<HorizontalBarChartProps, "data">, never>;
|
|
150
|
+
declare const StyledHorizontalBarChartEmptyText: styled_components.StyledComponent<"div", any, {
|
|
151
|
+
$maxWidth: number;
|
|
152
|
+
$textSize: number;
|
|
153
|
+
}, never>;
|
|
154
|
+
declare const StyledHorizontalBarChartBar: styled_components.StyledComponent<"g", any, Omit<HorizontalBarChartBarProps, "data" | "color" | "height" | "width" | "chartId" | "gap" | "index" | "isEmpty" | "showTooltip" | "tooltipPercent" | "tooltipLabelOnly"> & {
|
|
155
|
+
$clickable: boolean;
|
|
156
|
+
}, never>;
|
|
157
|
+
declare const StyledHorizontalBarChartTooltip: styled_components.StyledComponent<"div", any, {}, never>;
|
|
158
|
+
declare const StyledHorizontalBarChartAxisBottom: styled_components.StyledComponent<"g", any, {}, never>;
|
|
159
|
+
|
|
55
160
|
/**
|
|
56
161
|
* Component size.
|
|
57
162
|
*/
|
|
@@ -125,6 +230,8 @@ interface PieChartProps extends ComponentProps<'div'> {
|
|
|
125
230
|
others?: boolean | string;
|
|
126
231
|
/** PieChart size. */
|
|
127
232
|
size?: PieChartSize;
|
|
233
|
+
/** Slice role. Used to indicate that slices are to be considered buttons or links. If an onClick is provided, the slices will have the role `button` unless specifically set to `link` with this prop. */
|
|
234
|
+
sliceRole?: 'button' | 'link';
|
|
128
235
|
/** Secondary text to be displayed in the middle of the chart, between the main text and subtext. Recommended to be used with donut variants only. */
|
|
129
236
|
middleText?: string;
|
|
130
237
|
/** Secondary text to be displayed in the middle of the chart, above the main text. Recommended to be used with `donut` variants only. */
|
|
@@ -142,18 +249,20 @@ interface PieChartProps extends ComponentProps<'div'> {
|
|
|
142
249
|
}
|
|
143
250
|
declare type StyledPieChartProps = Omit<PieChartProps, 'data'> & {};
|
|
144
251
|
interface PieChartArcProps extends ComponentProps<'g'> {
|
|
252
|
+
chartId: string;
|
|
145
253
|
color: string;
|
|
146
254
|
data: Datum;
|
|
147
255
|
index: number;
|
|
148
256
|
onClick?: () => void;
|
|
149
257
|
path: string;
|
|
258
|
+
role?: PieChartProps['sliceRole'];
|
|
150
259
|
spaced?: boolean;
|
|
151
260
|
showTooltip: boolean;
|
|
152
261
|
tooltipPercent: string | null;
|
|
153
262
|
tooltipLabelOnly: boolean;
|
|
154
263
|
isEmpty: boolean;
|
|
155
264
|
}
|
|
156
|
-
declare type StyledPieChartArcProps = Omit<PieChartArcProps, 'color' | 'data' | 'index' | 'path' | 'spaced' | 'showTooltip' | 'tooltipPercent' | 'tooltipLabelOnly' | 'isEmpty'> & {
|
|
265
|
+
declare type StyledPieChartArcProps = Omit<PieChartArcProps, 'chartId' | 'color' | 'data' | 'index' | 'path' | 'spaced' | 'showTooltip' | 'tooltipPercent' | 'tooltipLabelOnly' | 'isEmpty'> & {
|
|
157
266
|
$spaced: boolean;
|
|
158
267
|
$clickable: boolean;
|
|
159
268
|
};
|
|
@@ -179,10 +288,10 @@ declare const StyledPieChartEmptyText: styled_components.StyledComponent<"div",
|
|
|
179
288
|
declare const StyledPieChartLabel: styled_components.StyledComponent<"li", any, {
|
|
180
289
|
$color: string;
|
|
181
290
|
}, never>;
|
|
182
|
-
declare const StyledPieChartArc: styled_components.StyledComponent<"g", any, Omit<PieChartArcProps, "data" | "path" | "color" | "
|
|
291
|
+
declare const StyledPieChartArc: styled_components.StyledComponent<"g", any, Omit<PieChartArcProps, "data" | "path" | "color" | "chartId" | "index" | "isEmpty" | "showTooltip" | "tooltipPercent" | "tooltipLabelOnly" | "spaced"> & {
|
|
183
292
|
$spaced: boolean;
|
|
184
293
|
$clickable: boolean;
|
|
185
294
|
}, never>;
|
|
186
|
-
declare const
|
|
295
|
+
declare const StyledPieChartTooltip: styled_components.StyledComponent<"div", any, {}, never>;
|
|
187
296
|
|
|
188
|
-
export { ChartDimensions, ColorTheme, Datum, PieArcDatum, PieChart, PieChartArcProps, PieChartLabelVariant, PieChartProps, PieChartSize, PieChartTheme, PieChartTooltipVariant, PieChartVariant, StyledPieChart, StyledPieChartArc, StyledPieChartArcProps, StyledPieChartCaption, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartLabel, StyledPieChartProps, StyledPieChartTitle,
|
|
297
|
+
export { ChartDimensions, ColorTheme, Datum, HorizontalBarChart, HorizontalBarChartAxisBottomProps, HorizontalBarChartBarProps, HorizontalBarChartProps, HorizontalBarChartSize, HorizontalBarChartTheme, HorizontalBarChartTooltipVariant, PieArcDatum, PieChart, PieChartArcProps, PieChartLabelVariant, PieChartProps, PieChartSize, PieChartTheme, PieChartTooltipVariant, PieChartVariant, StyledHorizontalBarChart, StyledHorizontalBarChartAxisBottom, StyledHorizontalBarChartAxisBottomProps, StyledHorizontalBarChartBar, StyledHorizontalBarChartBarProps, StyledHorizontalBarChartCaption, StyledHorizontalBarChartEmptyText, StyledHorizontalBarChartProps, StyledHorizontalBarChartTitle, StyledHorizontalBarChartTooltip, StyledPieChart, StyledPieChartArc, StyledPieChartArcProps, StyledPieChartCaption, StyledPieChartCenterText, StyledPieChartEmptyText, StyledPieChartLabel, StyledPieChartProps, StyledPieChartTitle, StyledPieChartTooltip, SuccessDangerColorTheme, getColorScale, monochrome, scheme, successDangerScheme };
|