@wavv/ui 1.5.6 → 1.6.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.
@@ -1,32 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { Margin } from './types';
3
- type ChartData = {
4
- name: string;
5
- };
6
- type StackData = {
7
- key: string;
8
- color: string;
9
- };
10
- type Default = {
11
- /** The property name of the data value key */
12
- dataKey: string;
13
- stackData?: never;
14
- };
15
- type Stacked = {
16
- dataKey?: never;
17
- /** Stacks multiple data points within a single bar */
18
- stackData: StackData[];
19
- };
20
- type KeyProps = Default | Stacked;
2
+ import { ChartProps } from './ChartHelpers';
21
3
  type Props = {
22
- /** Width of the chart */
23
- width: number;
24
- /** Height of the chart */
25
- height: number;
26
- /** The chart data array */
27
- data: ChartData[];
28
- /** Displays a data legend beneath the chart */
29
- legend?: boolean;
30
- } & KeyProps & Margin;
31
- declare const BarChart: ({ width, height, data, dataKey, legend, stackData, ...rest }: Props) => JSX.Element;
4
+ /** Stacks multiple data points within a single bar */
5
+ stacked?: boolean;
6
+ } & ChartProps;
7
+ declare const BarChart: ({ data, legend, keys, stacked, ...rest }: Props) => JSX.Element;
32
8
  export default BarChart;
@@ -1,14 +1,36 @@
1
1
  /// <reference types="react" />
2
2
  import { TooltipProps } from 'recharts';
3
3
  import { Payload } from 'recharts/types/component/DefaultLegendContent';
4
- import { Margin } from './types';
4
+ import { Margin, WidthHeight } from './types';
5
+ type ChartData = {
6
+ name: string;
7
+ };
8
+ export type KeyData = {
9
+ key: string;
10
+ color: string;
11
+ hidden?: boolean;
12
+ };
13
+ export type ChartProps = {
14
+ /** The chart data array */
15
+ data: ChartData[];
16
+ /** Designates the chart colors corresponding to the chart's data properties */
17
+ keys: KeyData[];
18
+ /** Displays a data legend beneath the chart */
19
+ legend?: boolean;
20
+ /** Allows the chart to grow and shrink (default if no explicit width) */
21
+ responsive?: boolean;
22
+ } & Margin & WidthHeight;
5
23
  export declare const ChartStyles: () => JSX.Element;
6
24
  export declare const ChartContainer: import("@emotion/styled").StyledComponent<{
7
25
  theme?: import("@emotion/react").Theme | undefined;
8
26
  as?: import("react").ElementType<any> | undefined;
9
- } & Margin, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
27
+ } & Margin & import("./types").Width & import("./types").Height & {
28
+ responsive?: boolean | undefined;
29
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
10
30
  export declare const TooltipContent: ({ active, payload, label }: TooltipProps<number, string>) => JSX.Element | null;
11
31
  export declare const Tooltip: () => JSX.Element;
12
- export declare const LegendContent: ({ payload }: {
32
+ export declare const LegendContent: ({ payload, toggleData, }: {
13
33
  payload?: Payload[] | undefined;
34
+ toggleData?: ((item: Payload) => void) | undefined;
14
35
  }) => JSX.Element;
36
+ export {};
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { ChartProps } from './ChartHelpers';
3
+ declare const LineChart: ({ data, legend, keys, ...rest }: ChartProps) => JSX.Element;
4
+ export default LineChart;
@@ -10,11 +10,10 @@ type Props = {
10
10
  data: ChartData[];
11
11
  /** The width & height of the chart */
12
12
  size?: number;
13
- outerRadius?: number;
14
13
  /** The radius of the inner circle */
15
14
  innerRadius?: number;
16
15
  /** Displays a gray chart if no data is present */
17
16
  showWhenEmpty?: boolean;
18
17
  } & Margin;
19
- declare const PieChart: ({ size, data, innerRadius, outerRadius, showWhenEmpty, ...rest }: Props) => JSX.Element;
18
+ declare const PieChart: ({ size, data, innerRadius, showWhenEmpty, ...rest }: Props) => JSX.Element;
20
19
  export default PieChart;
@@ -14,6 +14,12 @@ export type Padding = {
14
14
  paddingRight?: number | string;
15
15
  paddingLeft?: number | string;
16
16
  };
17
+ export type MaxWidth = {
18
+ maxWidth?: number | string;
19
+ };
20
+ export type MaxHeight = {
21
+ maxHeight?: number | string;
22
+ };
17
23
  export type Width = {
18
24
  width?: number | string;
19
25
  };
@@ -21,6 +27,7 @@ export type Height = {
21
27
  height?: number | string;
22
28
  };
23
29
  export type WidthHeight = Width & Height;
30
+ export type MaxWidthHeight = MaxWidth & MaxHeight;
24
31
  export type MarginPadding = Margin & Padding;
25
32
  export type FlexPosition = 'start' | 'end' | 'center' | 'space-around' | 'space-between';
26
33
  export type As = {
@@ -16,6 +16,7 @@ export { default as InlineCode } from './components/InlineCode';
16
16
  export { default as Input } from './components/Input';
17
17
  export { default as InputUtils } from './components/InputHelpers';
18
18
  export { default as Label } from './components/Label';
19
+ export { default as LineChart } from './components/LineChart';
19
20
  export { default as Menu } from './components/Menu';
20
21
  export { default as Message } from './components/Message';
21
22
  export { default as MessageHr } from './components/MessageHr';