@redsift/charts 7.6.0 → 7.7.0-alpha.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 CHANGED
@@ -1,12 +1,200 @@
1
1
  import { PieArcDatum as PieArcDatum$1 } from 'd3-shape';
2
+ import { Ref, ReactElement, ComponentProps } from 'react';
2
3
  import { ScaleOrdinal, ScaleLinear } from 'd3';
3
- import { ValueOf as ValueOf$1, Comp } from '@redsift/design-system';
4
- import { ComponentProps } from 'react';
4
+ import { ValueOf as ValueOf$1, Comp as Comp$1 } from '@redsift/design-system';
5
5
  import * as styled_components from 'styled-components';
6
6
 
7
+ /** Component Type. */
8
+ type Comp<P, T = HTMLElement> = {
9
+ (props: P & {
10
+ ref?: Ref<T>;
11
+ }): ReactElement | null;
12
+ /** React component type. */
13
+ readonly $$typeof: symbol;
14
+ /** Component default props. */
15
+ defaultProps?: Partial<P>;
16
+ /** Component name. */
17
+ displayName?: string;
18
+ /** Component base class name. */
19
+ className?: string;
20
+ };
7
21
  /** Get types of the values of a record. */
8
22
  type ValueOf<T extends Record<any, any>> = T[keyof T];
9
23
 
24
+ declare const AlignSelf: {
25
+ readonly auto: "auto";
26
+ readonly normal: "normal";
27
+ readonly start: "start";
28
+ readonly end: "end";
29
+ readonly center: "center";
30
+ readonly 'flex-start': "flex-start";
31
+ readonly 'flex-end': "flex-end";
32
+ readonly 'self-start': "self-start";
33
+ readonly 'self-end': "self-end";
34
+ readonly baseline: "baseline";
35
+ readonly stretch: "stretch";
36
+ };
37
+ type AlignSelf = ValueOf<typeof AlignSelf>;
38
+ declare const AlignContent: {
39
+ readonly 'flex-start': "flex-start";
40
+ readonly 'flex-end': "flex-end";
41
+ readonly center: "center";
42
+ readonly 'space-between': "space-between";
43
+ readonly 'space-around': "space-around";
44
+ readonly 'space-evenly': "space-evenly";
45
+ readonly stretch: "stretch";
46
+ readonly start: "start";
47
+ readonly end: "end";
48
+ readonly baseline: "baseline";
49
+ readonly 'first baseline': "first baseline";
50
+ readonly 'last baseline': "last baseline";
51
+ };
52
+ type AlignContent = ValueOf<typeof AlignContent>;
53
+ declare const AlignItems: {
54
+ readonly stretch: "stretch";
55
+ readonly 'flex-start': "flex-start";
56
+ readonly 'flex-end': "flex-end";
57
+ readonly center: "center";
58
+ readonly baseline: "baseline";
59
+ readonly 'first baseline': "first baseline";
60
+ readonly 'last baseline': "last baseline";
61
+ readonly start: "start";
62
+ readonly end: "end";
63
+ readonly 'self-start': "self-start";
64
+ readonly 'self-end': "self-end";
65
+ };
66
+ type AlignItems = ValueOf<typeof AlignItems>;
67
+ declare const FlexDirection: {
68
+ readonly row: "row";
69
+ readonly 'row-reverse': "row-reverse";
70
+ readonly column: "column";
71
+ readonly 'column-reverse': "column-reverse";
72
+ };
73
+ type FlexDirection = ValueOf<typeof FlexDirection>;
74
+ declare const FlexWrap: {
75
+ readonly nowrap: "nowrap";
76
+ readonly wrap: "wrap";
77
+ readonly 'wrap-reverse': "wrap-reverse";
78
+ };
79
+ type FlexWrap = ValueOf<typeof FlexWrap>;
80
+ declare const JustifyContent: {
81
+ readonly 'flex-start': "flex-start";
82
+ readonly 'flex-end': "flex-end";
83
+ readonly center: "center";
84
+ readonly 'space-between': "space-between";
85
+ readonly 'space-around': "space-around";
86
+ readonly 'space-evenly': "space-evenly";
87
+ readonly start: "start";
88
+ readonly end: "end";
89
+ readonly left: "left";
90
+ readonly right: "right";
91
+ readonly baseline: "baseline";
92
+ readonly 'first baseline': "first baseline";
93
+ readonly 'last baseline': "last baseline";
94
+ readonly stretch: "stretch";
95
+ };
96
+ type JustifyContent = ValueOf<typeof JustifyContent>;
97
+ interface LayoutProps {
98
+ /** When used in a flex layout, specifies how the element will grow or shrink to fit the space available. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex">MDN</a>. */
99
+ flex?: string;
100
+ /** When used in a flex layout, specifies how the element will grow to fit the space available. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-grow">MDN</a>. */
101
+ flexGrow?: number;
102
+ /** When used in a flex layout, specifies how the element will shrink to fit the space available. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-shrink">MDN</a>. */
103
+ flexShrink?: number;
104
+ /** When used in a flex layout, specifies the initial main size of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex_basis">MDN</a>. */
105
+ flexBasis?: string;
106
+ /** Overrides the alignItems property of a flex or grid container. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-self">MDN</a>. */
107
+ alignSelf?: AlignSelf;
108
+ /** Specifies how the element is justified inside a flex or grid container. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self">MDN</a>. */
109
+ justifySelf?: string;
110
+ /** The layout order for the element within a flex or grid container. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/order">MDN</a>. */
111
+ order?: number;
112
+ /** When used in a grid layout, specifies the named grid area that the element should be placed in within the grid. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area">MDN</a>. */
113
+ gridArea?: string;
114
+ /** When used in a grid layout, specifies the column the element should be placed in within the grid. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column">MDN</a>. */
115
+ gridColumn?: string;
116
+ /** When used in a grid layout, specifies the row the element should be placed in within the grid. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row">MDN</a>. */
117
+ gridRow?: string;
118
+ /** When used in a grid layout, specifies the starting column to span within the grid. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column-start">MDN</a>. */
119
+ gridColumnStart?: string;
120
+ /** When used in a grid layout, specifies the ending column to span within the grid. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column-end">MDN</a>. */
121
+ gridColumnEnd?: string;
122
+ /** When used in a grid layout, specifies the starting row to span within the grid. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row-start">MDN</a>. */
123
+ gridRowStart?: string;
124
+ /** When used in a grid layout, specifies the ending row to span within the grid. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row-end">MDN</a>. */
125
+ gridRowEnd?: string;
126
+ }
127
+ interface SpacingProps {
128
+ /** The margin for all four sides of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/margin">MDN</a>. */
129
+ margin?: string;
130
+ /** The margin for the bottom side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom">MDN</a>. */
131
+ marginBottom?: string;
132
+ /** The margin for the left side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left">MDN</a>. */
133
+ marginLeft?: string;
134
+ /** The margin for the right side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right">MDN</a>. */
135
+ marginRight?: string;
136
+ /** The margin for the top side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top">MDN</a>. */
137
+ marginTop?: string;
138
+ }
139
+ interface SizingProps {
140
+ /** The height of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/height">MDN</a>. */
141
+ height?: string | number;
142
+ /** The maximum height of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/max-height">MDN</a>. */
143
+ maxHeight?: string;
144
+ /** The maximum width of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/max-width">MDN</a>. */
145
+ maxWidth?: string;
146
+ /** The minimum height of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/min-height">MDN</a>. */
147
+ minHeight?: string;
148
+ /** The minimum width of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/min-width">MDN</a>. */
149
+ minWidth?: string;
150
+ /** The width of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/width">MDN</a>. */
151
+ width?: string | number;
152
+ }
153
+ interface PositioningProps {
154
+ /** Specifies how the element is positioned. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/position">MDN</a>. */
155
+ position?: string;
156
+ /** The top position for the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/top">MDN</a>. */
157
+ top?: string;
158
+ /** The bottom position for the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/bottom">MDN</a>. */
159
+ bottom?: string;
160
+ /** The left position for the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/left">MDN</a>. Consider using start instead for RTL support. */
161
+ left?: string;
162
+ /** The right position for the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/right">MDN</a>. Consider using start instead for RTL support. */
163
+ right?: string;
164
+ /** The stacking order for the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/z-index">MDN</a>. */
165
+ zIndex?: string;
166
+ }
167
+ interface FlexLayoutProps {
168
+ /** The distribution of space around child items along the cross axis. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-content">MDN</a>. */
169
+ alignContent?: AlignContent;
170
+ /** The alignment of children within their container. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-items">MDN</a>. */
171
+ alignItems?: AlignItems;
172
+ /** The direction in which to layout children. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction">MDN</a>. */
173
+ flexDirection?: FlexDirection;
174
+ /** Whether to wrap items onto multiple lines. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap">MDN</a>. */
175
+ flexWrap?: FlexWrap;
176
+ /** The space to display between both rows and columns. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/gap">MDN</a>. */
177
+ gap?: string;
178
+ /** Whether the box is displayed inline or not. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/display">MDN</a>. */
179
+ inline?: boolean;
180
+ /** The distribution of space around items along the main axis. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content">MDN</a>. */
181
+ justifyContent?: JustifyContent;
182
+ }
183
+ interface StylingProps extends LayoutProps, SpacingProps, SizingProps, PositioningProps {
184
+ }
185
+ interface InternalSpacingProps {
186
+ /** The padding for all four sides of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/padding">MDN</a>. */
187
+ padding?: string;
188
+ /** The padding for the bottom side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/padding-bottom">MDN</a>. */
189
+ paddingBottom?: string;
190
+ /** The padding for the left side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/padding-left">MDN</a>. */
191
+ paddingLeft?: string;
192
+ /** The padding for the right side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/padding-right">MDN</a>. */
193
+ paddingRight?: string;
194
+ /** The padding for the top side of the element. See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/padding-top">MDN</a>. */
195
+ paddingTop?: string;
196
+ }
197
+
10
198
  type ChartDimensions = {
11
199
  width: number;
12
200
  height: number;
@@ -126,7 +314,7 @@ interface HorizontalBarChartBarProps extends ComponentProps<'g'> {
126
314
  role?: HorizontalBarChartProps['barRole'];
127
315
  showTooltip: boolean;
128
316
  tooltipLabelOnly: boolean;
129
- tooltipPercent: string | null;
317
+ tooltipPercent: number | null;
130
318
  width: number;
131
319
  }
132
320
  type StyledHorizontalBarChartBarProps = Omit<HorizontalBarChartBarProps, 'chartId' | 'color' | 'data' | 'gap' | 'height' | 'index' | 'isEmpty' | 'showTooltip' | 'tooltipPercent' | 'tooltipLabelOnly' | 'width'> & {
@@ -139,13 +327,19 @@ interface HorizontalBarChartAxisBottomProps extends ComponentProps<'g'> {
139
327
  }
140
328
  type StyledHorizontalBarChartAxisBottomProps = Omit<HorizontalBarChartAxisBottomProps, 'areXLabelsRotated' | 'chartHeight' | 'd3scale'> & {};
141
329
 
142
- declare const HorizontalBarChart: Comp<HorizontalBarChartProps, HTMLDivElement>;
330
+ declare const HorizontalBarChart: Comp$1<HorizontalBarChartProps, HTMLDivElement>;
331
+
332
+ /**
333
+ * Component props.
334
+ */
335
+ interface FlexboxProps extends ComponentProps<'div'>, StylingProps, InternalSpacingProps, FlexLayoutProps {
336
+ }
143
337
 
144
338
  /**
145
339
  * Component style.
146
340
  */
147
341
  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>;
342
+ declare const StyledHorizontalBarChartTitle: styled_components.StyledComponent<Comp<FlexboxProps, HTMLDivElement>, any, Omit<HorizontalBarChartProps, "data">, never>;
149
343
  declare const StyledHorizontalBarChartCaption: styled_components.StyledComponent<"p", any, Omit<HorizontalBarChartProps, "data">, never>;
150
344
  declare const StyledHorizontalBarChartEmptyText: styled_components.StyledComponent<"div", any, {
151
345
  $maxWidth: number;
@@ -257,7 +451,7 @@ interface PieChartArcProps extends ComponentProps<'g'> {
257
451
  role?: PieChartProps['sliceRole'];
258
452
  spaced?: boolean;
259
453
  showTooltip: boolean;
260
- tooltipPercent: string | null;
454
+ tooltipPercent: number | null;
261
455
  tooltipLabelOnly: boolean;
262
456
  isEmpty: boolean;
263
457
  }
@@ -266,13 +460,13 @@ type StyledPieChartArcProps = Omit<PieChartArcProps, 'chartId' | 'color' | 'data
266
460
  $clickable: boolean;
267
461
  };
268
462
 
269
- declare const PieChart: Comp<PieChartProps, HTMLDivElement>;
463
+ declare const PieChart: Comp$1<PieChartProps, HTMLDivElement>;
270
464
 
271
465
  /**
272
466
  * Component style.
273
467
  */
274
468
  declare const StyledPieChart: styled_components.StyledComponent<"div", any, Omit<PieChartProps, "data">, never>;
275
- declare const StyledPieChartTitle: styled_components.StyledComponent<"div", any, Omit<PieChartProps, "data">, never>;
469
+ declare const StyledPieChartTitle: styled_components.StyledComponent<Comp<FlexboxProps, HTMLDivElement>, any, Omit<PieChartProps, "data">, never>;
276
470
  declare const StyledPieChartCaption: styled_components.StyledComponent<"p", any, Omit<PieChartProps, "data">, never>;
277
471
  declare const StyledPieChartCenterText: styled_components.StyledComponent<"div", any, {
278
472
  $maxWidth: number;