@redsift/dashboard 7.1.1 → 7.2.0-alpha.1

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 +132 -7
  2. package/index.js +589 -43
  3. package/index.js.map +1 -1
  4. package/package.json +12 -4
package/index.d.ts CHANGED
@@ -2,8 +2,9 @@ import * as crossfilter2 from 'crossfilter2';
2
2
  import { Crossfilter, Group as Group$1, NaturallyOrderedValue, Dimension as Dimension$1, ComparableObject, OrderedValueSelector } from 'crossfilter2';
3
3
  import { PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant } from '@redsift/charts';
4
4
  export { ColorTheme, PieChartLabelVariant, PieChartSize, PieChartTheme, PieChartVariant } from '@redsift/charts';
5
- import React, { Ref, ReactElement, ComponentProps, Dispatch } from 'react';
6
- import { GridFilterItem, DataGridProps as DataGridProps$1 } from '@redsift/table';
5
+ import React, { Ref, ReactElement, ComponentProps, RefObject, MutableRefObject, Dispatch } from 'react';
6
+ import { GridFilterItem, DataGridProps as DataGridProps$1, GridFilterModel } from '@redsift/table';
7
+ import { GridApi } from '@mui/x-data-grid-pro';
7
8
 
8
9
  type SuccessDangerColorTheme = {
9
10
  success: string;
@@ -53,6 +54,105 @@ type Comp<P, T = HTMLElement> = {
53
54
  };
54
55
  /** Get types of the values of a record. */
55
56
  type ValueOf<T extends Record<any, any>> = T[keyof T];
57
+ /**
58
+ * Color palette.
59
+ */
60
+ declare const ColorPalette: {
61
+ readonly default: "default";
62
+ readonly success: "success";
63
+ readonly error: "error";
64
+ readonly warning: "warning";
65
+ readonly info: "info";
66
+ readonly question: "question";
67
+ readonly 'no-data': "no-data";
68
+ };
69
+ type ColorPalette = ValueOf<typeof ColorPalette>;
70
+ declare const ProductColorPalette: {
71
+ readonly website: "website";
72
+ readonly ondmarc: "ondmarc";
73
+ readonly oninbox: "oninbox";
74
+ readonly ondomain: "ondomain";
75
+ readonly hardenize: "hardenize";
76
+ readonly tools: "tools";
77
+ };
78
+ type ProductColorPalette = ValueOf<typeof ProductColorPalette>;
79
+
80
+ /*
81
+ * Copyright 2020 Adobe. All rights reserved.
82
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
83
+ * you may not use this file except in compliance with the License. You may obtain a copy
84
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
85
+ *
86
+ * Unless required by applicable law or agreed to in writing, software distributed under
87
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
88
+ * OF ANY KIND, either express or implied. See the License for the specific language
89
+ * governing permissions and limitations under the License.
90
+ */
91
+
92
+
93
+ type PointerType = 'mouse' | 'pen' | 'touch' | 'keyboard' | 'virtual';
94
+
95
+ interface PressEvent {
96
+ /** The type of press event being fired. */
97
+ type: 'pressstart' | 'pressend' | 'pressup' | 'press',
98
+ /** The pointer type that triggered the press event. */
99
+ pointerType: PointerType,
100
+ /** The target element of the press event. */
101
+ target: Element,
102
+ /** Whether the shift keyboard modifier was held during the press event. */
103
+ shiftKey: boolean,
104
+ /** Whether the ctrl keyboard modifier was held during the press event. */
105
+ ctrlKey: boolean,
106
+ /** Whether the meta keyboard modifier was held during the press event. */
107
+ metaKey: boolean,
108
+ /** Whether the alt keyboard modifier was held during the press event. */
109
+ altKey: boolean
110
+ }
111
+
112
+ /**
113
+ * Component variant.
114
+ */
115
+ declare const ButtonVariant: {
116
+ readonly primary: "primary";
117
+ readonly secondary: "secondary";
118
+ readonly unstyled: "unstyled";
119
+ };
120
+ type ButtonVariant = ValueOf<typeof ButtonVariant>;
121
+ /**
122
+ * Component color.
123
+ */
124
+ type ButtonColor = typeof ColorPalette.default | typeof ColorPalette.error | ProductColorPalette;
125
+ /**
126
+ * Component props.
127
+ */
128
+ interface ButtonProps extends ComponentProps<'button'> {
129
+ /** Color variant. The product colors are available but should only be used to display the Button in the color of another product. To display a Button with a color of the current product, use `default`. */
130
+ color?: ButtonColor;
131
+ /** Whether the component take the full width or not. */
132
+ fullWidth?: boolean;
133
+ /** Whether the component is active or not. */
134
+ isActive?: boolean;
135
+ /** Whether the component is disabled or not. */
136
+ isDisabled?: boolean;
137
+ /**
138
+ * Icon path data (`d` property of the `path` SVG element).<br />
139
+ * See <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths">https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths</a>.<br />
140
+ * Recommended path data come from mdi/js.<br />
141
+ * See <a href="https://www.npmjs.com/package/@mdi/js">https://www.npmjs.com/package/@mdi/js</a>.
142
+ */
143
+ leftIcon?: string;
144
+ /** Preferred method to handle click, press and touch. */
145
+ onPress?: (e: PressEvent) => void;
146
+ /**
147
+ * Icon path data (`d` property of the `path` SVG element).<br />
148
+ * See <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths">https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths</a>.<br />
149
+ * Recommended path data come from mdi/js.<br />
150
+ * See <a href="https://www.npmjs.com/package/@mdi/js">https://www.npmjs.com/package/@mdi/js</a>.
151
+ */
152
+ rightIcon?: string;
153
+ /** Button variant. */
154
+ variant?: ButtonVariant;
155
+ }
56
156
 
57
157
  /**
58
158
  * Component props.
@@ -74,10 +174,12 @@ declare const ChartEmptyState: Comp<ChartEmptyStateProps, HTMLDivElement>;
74
174
  * Context props.
75
175
  */
76
176
  type DashboardContextProps = {
177
+ dashboardRef?: RefObject<HTMLDivElement>;
178
+ data?: JSONArray;
179
+ dataGridApiRef?: MutableRefObject<GridApi>;
180
+ dispatch?: Dispatch<DashboardReducerAction>;
77
181
  ndx?: TNdx;
78
182
  state: DashboardReducerState;
79
- dispatch?: Dispatch<DashboardReducerAction>;
80
- data?: JSONArray;
81
183
  };
82
184
  /**
83
185
  * Reducer props.
@@ -115,6 +217,7 @@ declare const DashboardReducer: (state: DashboardReducerState, action: Dashboard
115
217
  */
116
218
  interface DataGridProps extends Omit<DataGridProps$1, 'rows'> {
117
219
  rows?: DataGridProps$1['rows'];
220
+ onFilter?: (filterModel: GridFilterModel) => void;
118
221
  }
119
222
 
120
223
  declare const DataGrid: React.FC<DataGridProps>;
@@ -141,7 +244,7 @@ declare const HorizontalBarChartTheme: {
141
244
  readonly monochrome: "monochrome";
142
245
  };
143
246
  type HorizontalBarChartTheme = ValueOf<typeof HorizontalBarChartTheme>;
144
- interface LocaleText$2 {
247
+ interface LocaleText$3 {
145
248
  emptyChartTitle?: string;
146
249
  emptyChartSubtitle?: string;
147
250
  emptyChartResetLabel?: string;
@@ -175,7 +278,7 @@ interface HorizontalBarChartProps extends ComponentProps<'div'> {
175
278
  /** Whether the reset button is hidden or not. */
176
279
  isResetable?: boolean;
177
280
  /** Overriden values for internal labels and texts. */
178
- localeText?: LocaleText$2;
281
+ localeText?: LocaleText$3;
179
282
  /** Method to call when a filter occured on the chart. */
180
283
  onFilter?: (filters?: string[]) => void;
181
284
  /** 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. */
@@ -193,6 +296,28 @@ type StyledHorizontalBarChartProps = Omit<HorizontalBarChartProps, 'columnToFilt
193
296
 
194
297
  declare const HorizontalBarChart: Comp<HorizontalBarChartProps, HTMLDivElement>;
195
298
 
299
+ interface LocaleText$2 {
300
+ maxSizeDisclaimer?: string;
301
+ }
302
+ interface PdfExportButtonProps extends ButtonProps {
303
+ /** Ref to the DOM component to export. By default, will be the ref to the parent Dashboard. */
304
+ componentRef?: RefObject<HTMLElement>;
305
+ /** Name of the exported PDF file. */
306
+ fileName?: string;
307
+ /** Text to display at the beginning of the PDF. */
308
+ introduction?: string;
309
+ /** Labels and texts. */
310
+ localeText?: LocaleText$2;
311
+ /** Image to put at the top of the PDF (SVG format not supported). */
312
+ logo?: string;
313
+ /** Function to be executed when button is clicked. */
314
+ onClick?: () => void;
315
+ /** Color used for the header and footer of the PDF. */
316
+ primaryColor?: string;
317
+ }
318
+
319
+ declare const PdfExportButton: Comp<PdfExportButtonProps, HTMLButtonElement>;
320
+
196
321
  interface LocaleText$1 {
197
322
  emptyChartTitle?: string;
198
323
  emptyChartSubtitle?: string;
@@ -326,4 +451,4 @@ type StyledTimeSeriesBarChartProps = Omit<TimeSeriesBarChartProps, 'dimension' |
326
451
 
327
452
  declare const TimeSeriesBarChart: Comp<TimeSeriesBarChartProps, HTMLDivElement>;
328
453
 
329
- export { COUNT, ChartDimensions, ChartEmptyState, ChartEmptyStateProps, Dashboard, DashboardContext, DashboardContextProps, DashboardProps, DashboardReducer, DashboardReducerAction, DashboardReducerActionType, DashboardReducerState, DataGrid, DataGridProps, Dimension, DimensionSelector, Group, GroupSelector, HorizontalBarChart, HorizontalBarChartProps, HorizontalBarChartSize, HorizontalBarChartTheme, JSONArray, JSONObject, JSONValue, PieChart, PieChartProps, SUM, StyledHorizontalBarChartProps, StyledPieChartProps, StyledTimeSeriesBarChartProps, SuccessDangerColorTheme, TNdx, TimeSeriesBarChart, TimeSeriesBarChartProps, TimeSeriesBarChartSize, TimeSeriesBarChartTheme, datetimeEnum, groupReduceSum, initialState };
454
+ export { COUNT, ChartDimensions, ChartEmptyState, ChartEmptyStateProps, Dashboard, DashboardContext, DashboardContextProps, DashboardProps, DashboardReducer, DashboardReducerAction, DashboardReducerActionType, DashboardReducerState, DataGrid, DataGridProps, Dimension, DimensionSelector, Group, GroupSelector, HorizontalBarChart, HorizontalBarChartProps, HorizontalBarChartSize, HorizontalBarChartTheme, JSONArray, JSONObject, JSONValue, PdfExportButton, PieChart, PieChartProps, SUM, StyledHorizontalBarChartProps, StyledPieChartProps, StyledTimeSeriesBarChartProps, SuccessDangerColorTheme, TNdx, TimeSeriesBarChart, TimeSeriesBarChartProps, TimeSeriesBarChartSize, TimeSeriesBarChartTheme, datetimeEnum, groupReduceSum, initialState };