From 9d28b2649049c0f0a830ed8ec9ec3a59bdc5d37f Mon Sep 17 00:00:00 2001 From: sax3l Date: Wed, 30 Sep 2026 00:43:44 +0200 Subject: [PATCH] =?UTF-8?q?feat(charts):=20recharts=20=E2=86=92=20@siax/ch?= =?UTF-8?q?arts=20=E2=80=94=20Product=20Firewall=20fullbordad=20i=200pt=20?= =?UTF-8?q?(v=C3=A5g=202.4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ui/chart.tsx | 353 ---------------------------------------- package.json | 6 +- pnpm-lock.yaml | 40 ++++- 3 files changed, 40 insertions(+), 359 deletions(-) delete mode 100644 components/ui/chart.tsx diff --git a/components/ui/chart.tsx b/components/ui/chart.tsx deleted file mode 100644 index 421fe58..0000000 --- a/components/ui/chart.tsx +++ /dev/null @@ -1,353 +0,0 @@ -'use client' - -import * as React from 'react' -import * as RechartsPrimitive from 'recharts' - -import { cn } from '@/lib/utils' - -// Format: { THEME_NAME: CSS_SELECTOR } -const THEMES = { light: '', dark: '.dark' } as const - -export type ChartConfig = { - [k in string]: { - label?: React.ReactNode - icon?: React.ComponentType - } & ( - | { color?: string; theme?: never } - | { color?: never; theme: Record } - ) -} - -type ChartContextProps = { - config: ChartConfig -} - -const ChartContext = React.createContext(null) - -function useChart() { - const context = React.useContext(ChartContext) - - if (!context) { - throw new Error('useChart must be used within a ') - } - - return context -} - -function ChartContainer({ - id, - className, - children, - config, - ...props -}: React.ComponentProps<'div'> & { - config: ChartConfig - children: React.ComponentProps< - typeof RechartsPrimitive.ResponsiveContainer - >['children'] -}) { - const uniqueId = React.useId() - const chartId = `chart-${id || uniqueId.replace(/:/g, '')}` - - return ( - -
- - - {children} - -
-
- ) -} - -const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => { - const colorConfig = Object.entries(config).filter( - ([, config]) => config.theme || config.color, - ) - - if (!colorConfig.length) { - return null - } - - return ( -