Skip to content
Merged
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
19 changes: 18 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
module.exports = require('@lobehub/lint').eslint;
const config = require('@lobehub/lint').eslint;
const { restrictedImports } = require('./node_modules/@lobehub/ui/es/eslint/index.mjs');

// ESLint 8 keys `paths` by module name, so a second `antd` entry would overwrite the first.
const [level, options] = restrictedImports.rules['no-restricted-imports'];
const paths = Object.values(
options.paths.reduce((acc, path) => {
const prev = acc[path.name];
acc[path.name] =
prev?.importNames && path.importNames
? { ...prev, importNames: [...prev.importNames, ...path.importNames] }
: path;
return acc;
}, {}),
);
config.rules['no-restricted-imports'] = [level, { ...options, paths }];

module.exports = config;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"@lobehub/docs-kit": "^5.27.4",
"@lobehub/icons": "^5.19.3",
"@lobehub/lint": "^1.26.3",
"@lobehub/ui": "^5.49.0",
"@lobehub/ui": "^5.54.0",
"@react-router/dev": "8.2.0",
"@testing-library/react": "^16.3.3",
"@types/chroma-js": "^3.1.2",
Expand Down Expand Up @@ -121,7 +121,7 @@
"vitest": "~1.2.2"
},
"peerDependencies": {
"@lobehub/ui": "^4.3.3",
"@lobehub/ui": "^5.54.0",
"antd": "^6.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0"
Expand Down
5 changes: 3 additions & 2 deletions src/AccuracyBarChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, Skeleton } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { css, cssVar, cx } from 'antd-style';
import { MouseEvent, forwardRef, useMemo, useState } from 'react';
import {
Expand Down Expand Up @@ -147,7 +148,7 @@ const AccuracyBarChart = forwardRef<HTMLDivElement, AccuracyBarChartProps>((prop
return getMaxLabelLength({ data, index, layout, valueFormatter: xAxisLabelFormatter });
}, [yAxisWidth, layout, data, xAxisLabelFormatter, index]);

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const CustomTooltip = customTooltip;
const paddingValue = !showXAxis && !showYAxis ? 0 : 20;
Expand Down
10 changes: 5 additions & 5 deletions src/AreaChart/demos/customTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AreaChart, AreaChartProps, ChartTooltipFrame } from '@lobehub/charts';
import { Flexbox } from '@lobehub/ui';
import { Typography } from 'antd';
import { Text } from '@lobehub/ui/base-ui';
import { useTheme } from 'antd-style';

const data: AreaChartProps['data'] = [
Expand Down Expand Up @@ -45,12 +45,12 @@ export default () => {
width={4}
/>
<Flexbox>
<Typography.Paragraph ellipsis style={{ color: theme.colorTextSecondary, margin: 0 }}>
<Text ellipsis style={{ color: theme.colorTextSecondary, margin: 0 }}>
{category.dataKey}
</Typography.Paragraph>
<Typography.Paragraph ellipsis style={{ margin: 0 }}>
</Text>
<Text ellipsis style={{ margin: 0 }}>
{category.value} bpm
</Typography.Paragraph>
</Text>
</Flexbox>
</Flexbox>
))}
Expand Down
5 changes: 3 additions & 2 deletions src/AreaChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, Skeleton } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { css, cssVar, cx } from 'antd-style';
import { Fragment, MouseEvent, forwardRef, useMemo, useState } from 'react';
import {
Expand Down Expand Up @@ -96,7 +97,7 @@ const AreaChart = forwardRef<HTMLDivElement, AreaChartProps>((props, ref) => {
return getMaxLabelLength({ data, index, margin: 16, valueFormatter });
}, [yAxisWidth, data, valueFormatter, index]);

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const CustomTooltip = customTooltip;
const paddingValue = (!showXAxis && !showYAxis) || (startEndOnly && !showYAxis) ? 0 : 20;
Expand Down
10 changes: 5 additions & 5 deletions src/BarChart/demos/customTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BarChart, BarChartProps, ChartTooltipFrame } from '@lobehub/charts';
import { Flexbox } from '@lobehub/ui';
import { Typography } from 'antd';
import { Text } from '@lobehub/ui/base-ui';
import { useTheme } from 'antd-style';

const data: BarChartProps['data'] = [
Expand Down Expand Up @@ -57,12 +57,12 @@ export default () => {
width={4}
/>
<Flexbox>
<Typography.Paragraph ellipsis style={{ color: theme.colorTextSecondary, margin: 0 }}>
<Text ellipsis style={{ color: theme.colorTextSecondary, margin: 0 }}>
{category.dataKey}
</Typography.Paragraph>
<Typography.Paragraph ellipsis style={{ margin: 0 }}>
</Text>
<Text ellipsis style={{ margin: 0 }}>
{category.value} bpm
</Typography.Paragraph>
</Text>
</Flexbox>
</Flexbox>
))}
Expand Down
5 changes: 3 additions & 2 deletions src/BarChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, Skeleton } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { css, cssVar, cx } from 'antd-style';
import { MouseEvent, forwardRef, useMemo, useState } from 'react';
import {
Expand Down Expand Up @@ -87,7 +88,7 @@ const BarChart = forwardRef<HTMLDivElement, BarChartProps>((props, ref) => {
return getMaxLabelLength({ data, index, layout, valueFormatter });
}, [yAxisWidth, layout, data, valueFormatter, index]);

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const CustomTooltip = customTooltip;
const paddingValue = !showXAxis && !showYAxis ? 0 : 20;
Expand Down
5 changes: 3 additions & 2 deletions src/BarList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { A, Flexbox, Skeleton } from '@lobehub/ui';
import { A, Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar, cx } from 'antd-style';
import React, { HTMLAttributes, ReactNode, forwardRef, useMemo } from 'react';

Expand Down Expand Up @@ -73,7 +74,7 @@ const BarList = forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
);
}, [sortedData]);

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const rowHeight = 32;
const labelHeight = 20;
Expand Down
5 changes: 3 additions & 2 deletions src/BenchmarkColumnChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, Skeleton } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { cssVar, cx, useTheme } from 'antd-style';
import { readableColor } from 'polished';
import { type CSSProperties, MouseEvent, ReactNode, forwardRef, useMemo, useState } from 'react';
Expand Down Expand Up @@ -401,7 +402,7 @@ const BenchmarkColumnChart = forwardRef<HTMLDivElement, BenchmarkColumnChartProp
const showChartHeader = enableLine && (showBarLegend || showLineLegend || showUnrankedAnnotation);
const chartTopPad = enableLine || enableError ? (showChartHeader ? 84 : 44) : 12;

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const hasOnValueChange = !!onValueChange;

Expand Down
14 changes: 11 additions & 3 deletions src/BenchmarkRankingChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { A, Flexbox, Skeleton } from '@lobehub/ui';
import { Tooltip } from 'antd';
import { A, Flexbox } from '@lobehub/ui';
import { Skeleton, Tooltip } from '@lobehub/ui/base-ui';
import { cssVar, cx, useTheme } from 'antd-style';
import { type CSSProperties, type ReactNode, forwardRef, useMemo, useState } from 'react';

Expand Down Expand Up @@ -201,7 +201,7 @@ const BenchmarkRankingChart = forwardRef<HTMLDivElement, BenchmarkRankingChartPr
const labelWidthStyle = typeof labelWidth === 'number' ? `${labelWidth}px` : labelWidth;
const gridTicks = axisTicks.filter((tick) => tick > 0 && tick < resolvedMaxValue);

if (loading || !data) return <Skeleton.Block active height={height ?? 280} width={width} />;
if (loading || !data) return <Skeleton height={height ?? 280} width={width} />;

const handleClick = (item: NormalizedBenchmarkItem) => {
if (!onValueChange) return;
Expand Down Expand Up @@ -257,6 +257,14 @@ const BenchmarkRankingChart = forwardRef<HTMLDivElement, BenchmarkRankingChartPr
padding: 0,
width: 'max-content',
},
content: {
color: cssVar.colorText,
fontSize: cssVar.fontSize,
lineHeight: cssVar.lineHeight,
maxWidth: 'none',
overflow: 'visible',
padding: 0,
},
root: {
maxWidth: 'none',
},
Expand Down
14 changes: 11 additions & 3 deletions src/BenchmarkScatterChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';

import { A, Skeleton } from '@lobehub/ui';
import { A } from '@lobehub/ui';
import { Segmented, Skeleton, Tooltip } from '@lobehub/ui/base-ui';
import { useSize } from 'ahooks';
import { Segmented, Tooltip } from 'antd';
import { cssVar, cx, useTheme } from 'antd-style';
import { type CSSProperties, type ReactNode, forwardRef, useMemo, useRef, useState } from 'react';

Expand Down Expand Up @@ -545,7 +545,7 @@ const BenchmarkScatterChart = forwardRef<HTMLDivElement, BenchmarkScatterChartPr
yValues,
]);

if (loading || !data) return <Skeleton.Block active height={plotHeight} width={width} />;
if (loading || !data) return <Skeleton height={plotHeight} width={width} />;

const focusKey = hoverKey ?? selectedKey;
const focusPoint =
Expand Down Expand Up @@ -634,6 +634,14 @@ const BenchmarkScatterChart = forwardRef<HTMLDivElement, BenchmarkScatterChartPr
pointerEvents: 'none',
width: 'max-content',
},
content: {
color: cssVar.colorText,
fontSize: cssVar.fontSize,
lineHeight: cssVar.lineHeight,
maxWidth: 'none',
overflow: 'visible',
padding: 0,
},
root: { maxWidth: 'none', pointerEvents: 'none' },
}}
title={
Expand Down
5 changes: 3 additions & 2 deletions src/ComposedChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, Skeleton } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { css, cssVar, cx } from 'antd-style';
import { forwardRef, useMemo, useState } from 'react';
import {
Expand Down Expand Up @@ -94,7 +95,7 @@ const ComposedChart = forwardRef<HTMLDivElement, ComposedChartProps>((props, ref
return getMaxLabelLength({ data, index, layout: 'horizontal', valueFormatter: rightFormatter });
}, [yAxisRight, data, index]);

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const paddingValue = !showXAxis && !showYAxis ? 0 : 20;

Expand Down
3 changes: 2 additions & 1 deletion src/DataBars/CategoryBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, FlexboxProps, Tooltip } from '@lobehub/ui';
import { Flexbox, FlexboxProps } from '@lobehub/ui';
import { Tooltip } from '@lobehub/ui/base-ui';
import { cssVar, cx } from 'antd-style';
import { forwardRef, memo, useMemo } from 'react';

Expand Down
3 changes: 2 additions & 1 deletion src/DataBars/DeltaBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, FlexboxProps, Tooltip } from '@lobehub/ui';
import { Flexbox, FlexboxProps } from '@lobehub/ui';
import { Tooltip } from '@lobehub/ui/base-ui';
import { cssVar, cx } from 'antd-style';
import { ReactNode, forwardRef } from 'react';

Expand Down
3 changes: 2 additions & 1 deletion src/DataBars/MarkerBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, FlexboxProps, Tooltip } from '@lobehub/ui';
import { Flexbox, FlexboxProps } from '@lobehub/ui';
import { Tooltip } from '@lobehub/ui/base-ui';
import { cssVar, cx } from 'antd-style';
import { ReactNode, forwardRef } from 'react';

Expand Down
3 changes: 2 additions & 1 deletion src/DataBars/ProgressBar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, FlexboxProps, Tooltip } from '@lobehub/ui';
import { Flexbox, FlexboxProps } from '@lobehub/ui';
import { Tooltip } from '@lobehub/ui/base-ui';
import { cssVar, cx } from 'antd-style';
import { ReactNode, forwardRef } from 'react';

Expand Down
10 changes: 5 additions & 5 deletions src/DonutChart/demos/customTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChartTooltipFrame, DonutChart, DonutChartProps } from '@lobehub/charts';
import { Flexbox } from '@lobehub/ui';
import { Typography } from 'antd';
import { Text } from '@lobehub/ui/base-ui';
import { useTheme } from 'antd-style';

const data: DonutChartProps['data'] = [
Expand Down Expand Up @@ -48,12 +48,12 @@ export default () => {
width={4}
/>
<Flexbox>
<Typography.Paragraph ellipsis style={{ color: theme.colorTextSecondary, margin: 0 }}>
<Text ellipsis style={{ color: theme.colorTextSecondary, margin: 0 }}>
{category.dataKey}
</Typography.Paragraph>
<Typography.Paragraph ellipsis style={{ margin: 0 }}>
</Text>
<Text ellipsis style={{ margin: 0 }}>
{category.value} bpm
</Typography.Paragraph>
</Text>
</Flexbox>
</Flexbox>
))}
Expand Down
5 changes: 3 additions & 2 deletions src/DonutChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, Skeleton } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { css, cssVar, cx, useThemeMode } from 'antd-style';
import { CSSProperties, ComponentType, MouseEvent, forwardRef, useEffect, useState } from 'react';
import { Pie, PieChart as ReChartsDonutChart, ResponsiveContainer, Tooltip } from 'recharts';
Expand Down Expand Up @@ -87,7 +88,7 @@ const DonutChart = forwardRef<HTMLDivElement, DonutChartProps>((props, ref) => {
}
}, [activeIndex]);

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const onShapeClick = (data: any, index: number, event: MouseEvent) => {
event.stopPropagation();
Expand Down
5 changes: 3 additions & 2 deletions src/FunnelChart/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use client';

import { Flexbox, Skeleton } from '@lobehub/ui';
import { Flexbox } from '@lobehub/ui';
import { Skeleton } from '@lobehub/ui/base-ui';
import { useSize } from 'ahooks';
import { css, cssVar, cx } from 'antd-style';
import {
Expand Down Expand Up @@ -272,7 +273,7 @@ const FunnelChart = forwardRef<HTMLDivElement, FunnelChartProps>((props, ref) =>
});
};

if (loading || !data) return <Skeleton.Block active height={height} width={width} />;
if (loading || !data) return <Skeleton height={height} width={width} />;

const errorMessage = data ? validateData(data, calculateFrom) : null;

Expand Down
2 changes: 1 addition & 1 deletion src/Heatmaps/Calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Tooltip } from '@lobehub/ui';
import { Tooltip } from '@lobehub/ui/base-ui';
import { keyframes } from 'antd-style';
import isEqual from 'fast-deep-equal';
import { CSSProperties, ReactNode, memo, useMemo } from 'react';
Expand Down
13 changes: 5 additions & 8 deletions src/Heatmaps/demos/customTooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Heatmaps, HeatmapsProps } from '@lobehub/charts';
import { Flexbox } from '@lobehub/ui';
import { Typography } from 'antd';
import { Text } from '@lobehub/ui/base-ui';
import { cssVar } from 'antd-style';

import { yearData } from './data';
Expand All @@ -16,15 +16,12 @@ export default () => {
width={4}
/>
<Flexbox>
<Typography.Paragraph
ellipsis
style={{ color: cssVar.colorBgLayout, margin: 0, opacity: 0.5 }}
>
<Text ellipsis style={{ color: cssVar.colorBgLayout, margin: 0, opacity: 0.5 }}>
{payload.date}
</Typography.Paragraph>
<Typography.Paragraph ellipsis style={{ color: cssVar.colorBgLayout, margin: 0 }}>
</Text>
<Text ellipsis style={{ color: cssVar.colorBgLayout, margin: 0 }}>
{payload.count}
</Typography.Paragraph>
</Text>
</Flexbox>
</Flexbox>
);
Expand Down
Loading
Loading