@redsift/dashboard 6.1.0-alpha.0 → 6.2.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.
Files changed (4) hide show
  1. package/index.d.ts +80 -10
  2. package/index.js +3427 -92
  3. package/index.js.map +1 -1
  4. package/package.json +4 -4
package/index.d.ts CHANGED
@@ -10,7 +10,7 @@ declare type JSONValue = string | number | boolean | {
10
10
  declare type JSONObject = {
11
11
  [x: string]: JSONValue;
12
12
  };
13
- declare type JSONType = Array<JSONObject>;
13
+ declare type JSONArray = Array<JSONObject>;
14
14
  declare type TNdx = Crossfilter<any>;
15
15
  declare type Group = Group$1<any, NaturallyOrderedValue, unknown>;
16
16
  declare type GroupSelector = (group: Group) => Group;
@@ -49,7 +49,7 @@ declare type DashboardContextProps = {
49
49
  ndx?: TNdx;
50
50
  state: DashboardReducerState;
51
51
  dispatch?: Dispatch<DashboardReducerAction>;
52
- data?: JSONType;
52
+ data?: JSONArray;
53
53
  };
54
54
  /**
55
55
  * Reducer props.
@@ -70,7 +70,7 @@ declare type DashboardReducerAction = {
70
70
  */
71
71
  interface DashboardProps extends ComponentProps<'div'> {
72
72
  /** Dataset that will be share across every components within the dashboard. */
73
- data: JSONType;
73
+ data: JSONArray;
74
74
  }
75
75
 
76
76
  declare const Dashboard: Comp<DashboardProps, HTMLDivElement>;
@@ -108,7 +108,7 @@ declare const HorizontalBarChartTheme: {
108
108
  readonly monochrome: "monochrome";
109
109
  };
110
110
  declare type HorizontalBarChartTheme = ValueOf<typeof HorizontalBarChartTheme>;
111
- interface LocaleText$1 {
111
+ interface LocaleText$2 {
112
112
  resetLabel?: string;
113
113
  }
114
114
  /**
@@ -124,7 +124,7 @@ interface HorizontalBarChartProps extends ComponentProps<'div'> {
124
124
  /** Field value of the DataGrid column to filter. */
125
125
  columnToFilter?: string;
126
126
  /** Dataset to use to generate the chart, if no context is provided. */
127
- data?: JSONType;
127
+ data?: JSONArray;
128
128
  /** Method that will be used by crossfilter to compute the dimensions of the charts. */
129
129
  dimension: DimensionSelector;
130
130
  /** Reset function that is triggered when reset button is pressed in the empty state chart. */
@@ -134,7 +134,9 @@ interface HorizontalBarChartProps extends ComponentProps<'div'> {
134
134
  /** Whether the reset button is hidden or not. */
135
135
  isResetable?: boolean;
136
136
  /** Overriden values for internal labels and texts. */
137
- localeText?: LocaleText$1;
137
+ localeText?: LocaleText$2;
138
+ /** Method to call when a filter occured on the chart. */
139
+ onFilter?: (filters?: string[]) => void;
138
140
  /** 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. */
139
141
  others?: boolean | string;
140
142
  /** HorizontalBarChart size. */
@@ -152,7 +154,7 @@ declare type StyledHorizontalBarChartProps = Omit<HorizontalBarChartProps, 'colu
152
154
 
153
155
  declare const HorizontalBarChart: Comp<HorizontalBarChartProps, HTMLDivElement>;
154
156
 
155
- interface LocaleText {
157
+ interface LocaleText$1 {
156
158
  emptyChartTitle?: string;
157
159
  emptyChartSubtitle?: string;
158
160
  emptyChartResetLabel?: string;
@@ -169,7 +171,7 @@ interface PieChartProps extends ComponentProps<'div'> {
169
171
  /** Field value of the DataGrid column to filter. */
170
172
  columnToFilter?: string;
171
173
  /** Dataset to use to generate the chart, if no context is provided. */
172
- data?: JSONType;
174
+ data?: JSONArray;
173
175
  /** Method that will be used by crossfilter to compute the dimensions of the charts. */
174
176
  dimension: DimensionSelector;
175
177
  /** Method that will be used by crossfilter to compute the groups of the charts. */
@@ -179,7 +181,9 @@ interface PieChartProps extends ComponentProps<'div'> {
179
181
  /** Define whether the labels should be displayed inside or outside the charts and if they should contain raw or percentage values. */
180
182
  labelVariant?: PieChartLabelVariant;
181
183
  /** Overriden values for internal labels and texts. */
182
- localeText?: LocaleText;
184
+ localeText?: LocaleText$1;
185
+ /** Method to call when a filter occured on the chart. */
186
+ onFilter?: (filters?: string[]) => void;
183
187
  /** 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. */
184
188
  others?: boolean | string;
185
189
  /** PieChart size. */
@@ -206,4 +210,70 @@ declare type StyledPieChartProps = Omit<PieChartProps, 'columnToFilter' | 'dimen
206
210
 
207
211
  declare const PieChart: Comp<PieChartProps, HTMLDivElement>;
208
212
 
209
- export { ChartDimensions, Dashboard, DashboardContext, DashboardContextProps, DashboardProps, DashboardReducer, DashboardReducerAction, DashboardReducerActionType, DashboardReducerState, DataGrid, DataGridProps, Dimension, DimensionSelector, Group, GroupSelector, HorizontalBarChart, HorizontalBarChartProps, HorizontalBarChartSize, HorizontalBarChartTheme, JSONObject, JSONType, JSONValue, PieChart, PieChartProps, StyledHorizontalBarChartProps, StyledPieChartProps, TNdx, initialState };
213
+ /**
214
+ * Component size.
215
+ */
216
+ declare const TimeSeriesBarChartSize: {
217
+ readonly large: "large";
218
+ readonly medium: "medium";
219
+ readonly small: "small";
220
+ };
221
+ declare type TimeSeriesBarChartSize = ValueOf<typeof TimeSeriesBarChartSize>;
222
+ /**
223
+ * Component theme.
224
+ */
225
+ declare const TimeSeriesBarChartTheme: {
226
+ readonly default: "default";
227
+ readonly dark: "dark";
228
+ readonly darker: "darker";
229
+ readonly monochrome: "monochrome";
230
+ };
231
+ declare type TimeSeriesBarChartTheme = ValueOf<typeof TimeSeriesBarChartTheme>;
232
+ declare type datetimeEnum = 'hour' | 'day' | 'week' | 'month' | 'year';
233
+ interface LocaleText {
234
+ resetLabel?: string;
235
+ }
236
+ /**
237
+ * Component props.
238
+ */
239
+ interface TimeSeriesBarChartProps extends ComponentProps<'div'> {
240
+ /** Caption. */
241
+ caption?: string;
242
+ /** Whether the x axis labels are rotated or not. */
243
+ areXLabelsRotated?: boolean;
244
+ /** Field value of the DataGrid column to filter. */
245
+ columnToFilter?: string;
246
+ /** Dataset to use to generate the chart, if no context is provided. */
247
+ data?: JSONArray;
248
+ /** Name of the dataset field that contains the datetime value. */
249
+ dateTimeFieldName: string;
250
+ /** Format used for the date and time values in the dataset by d3.js. Should follow https://github.com/d3/d3-time-format#locale_format. */
251
+ dateTimeFormat?: string;
252
+ /** Datetime unit to used to group values and for x units. */
253
+ dateTimeGroup?: datetimeEnum;
254
+ /** Method that will be used by crossfilter to compute the dimensions of the charts. */
255
+ dimension: DimensionSelector;
256
+ /** Whether the reset button is hidden or not. */
257
+ isResetable?: boolean;
258
+ /** Overriden values for internal labels and texts. */
259
+ localeText?: LocaleText;
260
+ /** TimeSeriesChart size. */
261
+ size?: TimeSeriesBarChartSize;
262
+ /** 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. */
263
+ theme?: TimeSeriesBarChartTheme | {
264
+ success: string;
265
+ warning: string;
266
+ danger: string;
267
+ };
268
+ /** Title. */
269
+ title?: string;
270
+ /** Dataset key to use to stack values. */
271
+ stackedCategory?: string;
272
+ /** Y Axis Label. */
273
+ yAxisLabel?: string;
274
+ }
275
+ declare type StyledTimeSeriesBarChartProps = Omit<TimeSeriesBarChartProps, 'dimension' | 'dateTimeFieldName'> & {};
276
+
277
+ declare const TimeSeriesBarChart: Comp<TimeSeriesBarChartProps, HTMLDivElement>;
278
+
279
+ export { ChartDimensions, Dashboard, DashboardContext, DashboardContextProps, DashboardProps, DashboardReducer, DashboardReducerAction, DashboardReducerActionType, DashboardReducerState, DataGrid, DataGridProps, Dimension, DimensionSelector, Group, GroupSelector, HorizontalBarChart, HorizontalBarChartProps, HorizontalBarChartSize, HorizontalBarChartTheme, JSONArray, JSONObject, JSONValue, PieChart, PieChartProps, StyledHorizontalBarChartProps, StyledPieChartProps, StyledTimeSeriesBarChartProps, TNdx, TimeSeriesBarChart, TimeSeriesBarChartProps, TimeSeriesBarChartSize, TimeSeriesBarChartTheme, datetimeEnum, initialState };