@campxdev/react-blueprint 1.2.15 → 1.2.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campxdev/react-blueprint",
3
- "version": "1.2.15",
3
+ "version": "1.2.16",
4
4
  "main": "./export.ts",
5
5
  "private": false,
6
6
  "dependencies": {
@@ -142,7 +142,10 @@ export const BarChart = ({
142
142
  type="category"
143
143
  dataKey={dataKey}
144
144
  stroke={theme.palette.border.primary}
145
- tick={{ fill: theme.palette.text.tertiary }}
145
+ tick={{
146
+ fill: theme.palette.text.tertiary,
147
+ ...baseAxisProps?.xAxis?.tick,
148
+ }}
146
149
  angle={baseAxisProps?.xAxis?.angle}
147
150
  tickMargin={baseAxisProps?.xAxis?.tickMargin}
148
151
  >
@@ -155,7 +158,10 @@ export const BarChart = ({
155
158
  <YAxis
156
159
  type="number"
157
160
  stroke={theme.palette.border.primary}
158
- tick={{ fill: theme.palette.text.tertiary }}
161
+ tick={{
162
+ fill: theme.palette.text.tertiary,
163
+ ...baseAxisProps?.yAxis?.tick,
164
+ }}
159
165
  tickMargin={baseAxisProps?.yAxis?.tickMargin}
160
166
  domain={domain}
161
167
  >
@@ -176,7 +182,10 @@ export const BarChart = ({
176
182
  <XAxis
177
183
  type="number"
178
184
  stroke={theme.palette.border.primary}
179
- tick={{ fill: theme.palette.text.tertiary }}
185
+ tick={{
186
+ fill: theme.palette.text.tertiary,
187
+ ...baseAxisProps?.xAxis?.tick,
188
+ }}
180
189
  angle={baseAxisProps?.xAxis?.angle}
181
190
  tickMargin={baseAxisProps?.xAxis?.tickMargin}
182
191
  >
@@ -190,7 +199,10 @@ export const BarChart = ({
190
199
  dataKey={dataKey}
191
200
  type="category"
192
201
  stroke={theme.palette.border.primary}
193
- tick={{ fill: theme.palette.text.tertiary }}
202
+ tick={{
203
+ fill: theme.palette.text.tertiary,
204
+ ...baseAxisProps?.yAxis?.tick,
205
+ }}
194
206
  tickMargin={baseAxisProps?.yAxis?.tickMargin}
195
207
  >
196
208
  {yLabel && (
@@ -12,9 +12,11 @@ import {
12
12
  } from 'recharts';
13
13
  import {
14
14
  AxisLabelProps,
15
+ BaseAxisProps,
15
16
  CartesianGridProps,
16
17
  LegendProps,
17
18
  MarginProps,
19
+ SubTitleProps,
18
20
  TitleProps,
19
21
  } from '../types/types';
20
22
  import { CurveType } from 'recharts/types/shape/Curve';
@@ -22,7 +24,10 @@ import { Typography } from '../../export';
22
24
 
23
25
  export type LineChartProps = {
24
26
  title?: string;
27
+ showSubtitle?: boolean;
28
+ subTitle?: string;
25
29
  titleProps?: TitleProps;
30
+ subTitleProps?: SubTitleProps;
26
31
  width?: number;
27
32
  height?: number;
28
33
  dataKey: string;
@@ -32,6 +37,7 @@ export type LineChartProps = {
32
37
  showLegend?: boolean;
33
38
  cartesianGrid?: CartesianGridProps;
34
39
  axisLabelProps?: AxisLabelProps;
40
+ baseAxisProps?: BaseAxisProps;
35
41
  legendSx?: LegendProps;
36
42
  containerSx?: SxProps;
37
43
  margin?: MarginProps;
@@ -46,6 +52,9 @@ type LineItem = {
46
52
 
47
53
  export const LineChart = ({
48
54
  title = 'Line Chart',
55
+ showSubtitle = false,
56
+ subTitle = '',
57
+ subTitleProps = { variant: 'caption' },
49
58
  titleProps = { variant: 'subtitle2' },
50
59
  width = 700,
51
60
  height = 500,
@@ -57,6 +66,7 @@ export const LineChart = ({
57
66
  showLegend = true,
58
67
  cartesianGrid = { showCartesianGrid: false },
59
68
  axisLabelProps,
69
+ baseAxisProps,
60
70
  legendSx,
61
71
  containerSx,
62
72
  }: LineChartProps) => {
@@ -73,6 +83,15 @@ export const LineChart = ({
73
83
  >
74
84
  {title}
75
85
  </Typography>
86
+ {showSubtitle && (
87
+ <Typography
88
+ variant={subTitleProps.variant}
89
+ align={'center'}
90
+ sx={subTitleProps.sx}
91
+ >
92
+ {title}
93
+ </Typography>
94
+ )}
76
95
  <ReLineChart width={width} height={height} margin={margin} data={data}>
77
96
  {showCartesianGrid && (
78
97
  <CartesianGrid strokeDasharray={`${size} ${size}`} />
@@ -98,7 +117,12 @@ export const LineChart = ({
98
117
  type="category"
99
118
  dataKey={dataKey}
100
119
  stroke={theme.palette.border.primary}
101
- tick={{ fill: theme.palette.text.tertiary }}
120
+ tick={{
121
+ fill: theme.palette.text.tertiary,
122
+ ...baseAxisProps?.xAxis?.tick,
123
+ }}
124
+ angle={baseAxisProps?.xAxis?.angle}
125
+ tickMargin={baseAxisProps?.xAxis?.tickMargin}
102
126
  >
103
127
  <Label
104
128
  {...xLabel}
@@ -109,7 +133,11 @@ export const LineChart = ({
109
133
  <YAxis
110
134
  type="number"
111
135
  stroke={theme.palette.border.primary}
112
- tick={{ fill: theme.palette.text.tertiary }}
136
+ tick={{
137
+ fill: theme.palette.text.tertiary,
138
+ ...baseAxisProps?.yAxis?.tick,
139
+ }}
140
+ tickMargin={baseAxisProps?.yAxis?.tickMargin}
113
141
  >
114
142
  {yLabel && (
115
143
  <Label
@@ -1,11 +1,19 @@
1
1
  import { Stack, SxProps, useTheme } from '@mui/material';
2
2
  import { Cell, Legend, Pie, PieChart as RePieChart, Tooltip } from 'recharts';
3
- import { LegendProps, MarginProps, TitleProps } from '../types/types';
3
+ import {
4
+ LegendProps,
5
+ MarginProps,
6
+ SubTitleProps,
7
+ TitleProps,
8
+ } from '../types/types';
4
9
  import { Typography } from '../../export';
5
10
 
6
11
  export type PieChartProps = {
7
12
  title?: string;
13
+ showSubtitle?: boolean;
14
+ subTitle?: string;
8
15
  titleProps?: TitleProps;
16
+ subTitleProps?: SubTitleProps;
9
17
  margin?: MarginProps;
10
18
  width?: number;
11
19
  height?: number;
@@ -31,6 +39,9 @@ type PieProps = {
31
39
 
32
40
  export const PieChart = ({
33
41
  title = 'Pie Chart',
42
+ showSubtitle = false,
43
+ subTitle = '',
44
+ subTitleProps = { variant: 'caption' },
34
45
  titleProps = { variant: 'subtitle2' },
35
46
  margin,
36
47
  width = 500,
@@ -53,6 +64,15 @@ export const PieChart = ({
53
64
  >
54
65
  {title}
55
66
  </Typography>
67
+ {showSubtitle && (
68
+ <Typography
69
+ variant={subTitleProps.variant}
70
+ align={'center'}
71
+ sx={subTitleProps.sx}
72
+ >
73
+ {title}
74
+ </Typography>
75
+ )}
56
76
  <RePieChart width={width} height={height} margin={margin}>
57
77
  {showToolTip && (
58
78
  <Tooltip
@@ -1,12 +1,15 @@
1
1
  import { Box, Stack, styled, SxProps, useTheme } from '@mui/material';
2
2
  import { Treemap as ReTreeMap, Tooltip } from 'recharts';
3
3
  import { AnimationTiming } from 'recharts/types/util/types';
4
- import { MarginProps, TitleProps } from '../types/types';
4
+ import { MarginProps, SubTitleProps, TitleProps } from '../types/types';
5
5
  import { Typography } from '../../export';
6
6
 
7
7
  interface TreeMapProps {
8
8
  title?: string;
9
+ showSubtitle?: boolean;
10
+ subTitle?: string;
9
11
  titleProps?: TitleProps;
12
+ subTitleProps?: SubTitleProps;
10
13
  data: any;
11
14
  dataKey: string | number;
12
15
  width?: number;
@@ -26,6 +29,9 @@ interface TreeMapProps {
26
29
  const TreeMap = ({
27
30
  title = 'Tree Map',
28
31
  titleProps = { variant: 'subtitle2' },
32
+ showSubtitle = false,
33
+ subTitle = '',
34
+ subTitleProps = { variant: 'caption' },
29
35
  data,
30
36
  dataKey,
31
37
  width = 400,
@@ -49,6 +55,15 @@ const TreeMap = ({
49
55
  >
50
56
  {title}
51
57
  </Typography>
58
+ {showSubtitle && (
59
+ <Typography
60
+ variant={subTitleProps.variant}
61
+ align={'center'}
62
+ sx={subTitleProps.sx}
63
+ >
64
+ {title}
65
+ </Typography>
66
+ )}
52
67
  <ReTreeMap
53
68
  data={data}
54
69
  dataKey={dataKey}
@@ -49,6 +49,7 @@ export type BaseAxisProps = {
49
49
  export type TickProps = {
50
50
  angle?: number;
51
51
  tickMargin?: number;
52
+ tick?: any;
52
53
  };
53
54
 
54
55
  export type LegendProps = {