Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom props and children #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tremor/react",
"version": "0.0.0-development",
"name": "@traceloop/tremor",
"version": "0.0.0",
"description": "The React library to build dashboards faster.",
"scripts": {
"prebuild": "rm -rf dist",
Expand All @@ -15,14 +15,14 @@
},
"repository": {
"type": "git",
"url": "https://github.com/tremorlabs/tremor.git"
"url": "https://github.com/traceloop/tremor.git"
},
"author": "tremor",
"author": "tremor (forked by traceloop)",
"license": "Apache 2.0",
"bugs": {
"url": "https://github.com/tremorlabs/tremor/issues"
"url": "https://github.com/traceloop/tremor/issues"
},
"homepage": "https://github.com/tremorlabs/tremor#readme",
"homepage": "https://github.com/traceloop/tremor#readme",
"dependencies": {
"@floating-ui/react": "^0.19.2",
"@headlessui/react": "^1.7.18",
Expand Down
4 changes: 4 additions & 0 deletions src/components/chart-elements/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ interface ActiveDot {

const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref) => {
const {
children,
data = [],
categories = [],
index,
Expand Down Expand Up @@ -77,6 +78,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
enableLegendSlider = false,
customTooltip,
rotateLabelX,
rechartProps,
tickGap = 5,
...other
} = props;
Expand Down Expand Up @@ -139,6 +141,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
<ResponsiveContainer className="h-full w-full">
{data?.length ? (
<ReChartsAreaChart
{...rechartProps}
data={data}
onClick={
hasOnValueChange && (activeLegend || activeDot)
Expand All @@ -150,6 +153,7 @@ const AreaChart = React.forwardRef<HTMLDivElement, AreaChartProps>((props, ref)
: undefined
}
>
{children}
{showGridLines ? (
<CartesianGrid
className={tremorTwMerge(
Expand Down
4 changes: 4 additions & 0 deletions src/components/chart-elements/BarChart/BarChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface BarChartProps extends BaseChartProps {

const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) => {
const {
children,
data = [],
categories = [],
index,
Expand Down Expand Up @@ -93,6 +94,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
rotateLabelX,
tickGap = 5,
className,
rechartProps,
...other
} = props;
const CustomTooltip = customTooltip;
Expand Down Expand Up @@ -145,6 +147,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
<ResponsiveContainer className="h-full w-full">
{data?.length ? (
<ReChartsBarChart
{...rechartProps}
data={data}
stackOffset={stack ? "sign" : relative ? "expand" : "none"}
layout={layout === "vertical" ? "vertical" : "horizontal"}
Expand All @@ -158,6 +161,7 @@ const BarChart = React.forwardRef<HTMLDivElement, BarChartProps>((props, ref) =>
: undefined
}
>
{children}
{showGridLines ? (
<CartesianGrid
className={tremorTwMerge(
Expand Down
4 changes: 4 additions & 0 deletions src/components/chart-elements/LineChart/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ interface ActiveDot {

const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref) => {
const {
children,
data = [],
categories = [],
index,
Expand Down Expand Up @@ -73,6 +74,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
customTooltip,
rotateLabelX,
tickGap = 5,
rechartProps,
...other
} = props;
const CustomTooltip = customTooltip;
Expand Down Expand Up @@ -135,6 +137,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
<ResponsiveContainer className="h-full w-full">
{data?.length ? (
<ReChartsLineChart
{...rechartProps}
data={data}
onClick={
hasOnValueChange && (activeLegend || activeDot)
Expand All @@ -146,6 +149,7 @@ const LineChart = React.forwardRef<HTMLDivElement, LineChartProps>((props, ref)
: undefined
}
>
{children}
{showGridLines ? (
<CartesianGrid
className={tremorTwMerge(
Expand Down
1 change: 1 addition & 0 deletions src/components/chart-elements/common/BaseChartProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ interface BaseChartProps extends BaseAnimationTimingProps, React.HTMLAttributes<
xAxisHeight?: number;
};
tickGap?: number;
rechartProps?: { [key: string]: any };
}

export default BaseChartProps;