@lobehub/charts 1.9.7 → 1.9.9

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,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import BaseChartProps from "../common/BaseChartProps";
3
- import { CurveType } from "../types";
3
+ import { CurveType } from "../types/charts";
4
4
  export interface AreaChartProps extends BaseChartProps {
5
5
  connectNulls?: boolean;
6
6
  curveType?: CurveType;
@@ -1,5 +1,5 @@
1
1
  import React, { HTMLAttributes, ReactNode } from 'react';
2
- import { ValueFormatter } from "../types";
2
+ import { ValueFormatter } from "../types/charts";
3
3
  export interface Bar {
4
4
  [key: string]: any;
5
5
  color?: string;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { FlexboxProps } from 'react-layout-kit';
3
- import { ValueFormatter } from "../types";
3
+ import { ValueFormatter } from "../types/charts";
4
4
  export interface CategoryBarProps extends FlexboxProps {
5
5
  colors?: string[];
6
6
  markerValue?: number;
@@ -7,7 +7,7 @@ var _excluded = ["value", "bgColors", "color", "isIncreasePositive", "showAnimat
7
7
  import { Tooltip } from '@lobehub/ui';
8
8
  import { forwardRef } from 'react';
9
9
  import { Flexbox } from 'react-layout-kit';
10
- import { DeltaTypes } from "../types";
10
+ import { DeltaTypes } from "../types/charts";
11
11
  import { mapInputsToDeltaType } from "../utils";
12
12
  import { useStyles } from "./styles";
13
13
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { ValueFormatter } from "../types";
1
+ import { ValueFormatter } from "../types/charts";
2
2
  export interface DonutChartTooltipProps {
3
3
  active: boolean | undefined;
4
4
  customCategories?: {
@@ -2,8 +2,8 @@ import { CSSProperties, ComponentType } from 'react';
2
2
  import type BaseAnimationTimingProps from "../common/BaseAnimationTimingProps";
3
3
  import { CustomTooltipProps } from "../common/CustomTooltipProps";
4
4
  import { type NoDataProps } from "../common/NoData";
5
- import type { EventProps } from "../types";
6
- import { ValueFormatter } from "../types";
5
+ import type { EventProps } from "../types/charts";
6
+ import { ValueFormatter } from "../types/charts";
7
7
  type DonutChartVariant = 'donut' | 'pie';
8
8
  export interface DonutChartProps extends BaseAnimationTimingProps {
9
9
  category?: string;
@@ -1,2 +1,2 @@
1
- import { ValueFormatter } from "../types";
1
+ import { ValueFormatter } from "../types/charts";
2
2
  export declare const parseLabelInput: (labelInput: string | undefined, valueFormatter: ValueFormatter, data: any[], category: string) => string;
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import type { Activity, Labels, Week } from "../types";
2
+ import type { Activity, Labels, Week } from "../types/charts";
3
3
  interface CalendarProps {
4
4
  blockMargin: number;
5
5
  blockRadius: number;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { Labels, Week } from "../types";
2
+ import type { Labels, Week } from "../types/charts";
3
3
  interface ChartLabelsProps {
4
4
  blockMargin: number;
5
5
  blockSize: number;
@@ -2,7 +2,7 @@ import type { Day as WeekDay } from 'date-fns';
2
2
  import { ReactNode } from 'react';
3
3
  import { FlexboxProps } from 'react-layout-kit';
4
4
  import { NoDataProps } from "../common/NoData";
5
- import type { Activity, Labels } from "../types";
5
+ import type { Activity, Labels } from "../types/charts";
6
6
  export interface HeatmapsProps extends FlexboxProps {
7
7
  blockMargin?: number;
8
8
  blockRadius?: number;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import BaseChartProps from "../common/BaseChartProps";
3
- import { CurveType } from "../types";
3
+ import { CurveType } from "../types/charts";
4
4
  export interface LineChartProps extends BaseChartProps {
5
5
  connectNulls?: boolean;
6
6
  curveType?: CurveType;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ScatterChartValueFormatter } from "../types";
2
+ import { ScatterChartValueFormatter } from "../types/charts";
3
3
  export interface ScatterChartTooltipProps {
4
4
  active: boolean | undefined;
5
5
  axis: any;
@@ -1,7 +1,7 @@
1
1
  import { ComponentType, HTMLAttributes } from 'react';
2
2
  import { CustomTooltipProps } from "../common/CustomTooltipProps";
3
- import type { EventProps } from "../types";
4
- import { IntervalType, ValueFormatter } from "../types";
3
+ import type { EventProps } from "../types/charts";
4
+ import { IntervalType, ValueFormatter } from "../types/charts";
5
5
  import BaseAnimationTimingProps from '../common/BaseAnimationTimingProps';
6
6
  import { type NoDataProps } from '../common/NoData';
7
7
  export type ScatterChartValueFormatter = {
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import BaseSparkChartProps from "../common/BaseSparkChartProps";
3
- import { CurveType } from "../types";
3
+ import { CurveType } from "../types/charts";
4
4
  export interface SparkAreaChartProps extends BaseSparkChartProps {
5
5
  connectNulls?: boolean;
6
6
  curveType?: CurveType;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import BaseSparkChartProps from "../common/BaseSparkChartProps";
3
- import { CurveType } from "../types";
3
+ import { CurveType } from "../types/charts";
4
4
  export interface SparkLineChartProps extends BaseSparkChartProps {
5
5
  connectNulls?: boolean;
6
6
  curveType?: CurveType;
@@ -1,6 +1,6 @@
1
1
  import { ComponentType, HTMLAttributes } from 'react';
2
2
  import type { NoDataProps } from "./NoData";
3
- import { IntervalType, LabelFormatter, ValueFormatter } from "../types";
3
+ import { IntervalType, LabelFormatter, ValueFormatter } from "../types/charts";
4
4
  import type BaseAnimationTimingProps from './BaseAnimationTimingProps';
5
5
  import { CustomTooltipProps } from './CustomTooltipProps';
6
6
  type FixedProps = {
@@ -1,13 +1,15 @@
1
- import { ValueFormatter } from "../../types";
1
+ import { ReactNode } from 'react';
2
+ import { ValueFormatter } from "../../types/charts";
2
3
  export interface ChartTooltipProps {
3
4
  active: boolean | undefined;
4
5
  categoryColors: Map<string, string>;
5
6
  customCategories?: {
6
7
  [key: string]: string;
7
8
  };
9
+ footer?: ReactNode;
8
10
  label: string;
9
11
  payload: any;
10
12
  valueFormatter: ValueFormatter;
11
13
  }
12
- declare const ChartTooltip: ({ active, payload, label, categoryColors, valueFormatter, customCategories, }: ChartTooltipProps) => import("react/jsx-runtime").JSX.Element | null;
14
+ declare const ChartTooltip: ({ active, payload, label, categoryColors, valueFormatter, customCategories, footer, }: ChartTooltipProps) => import("react/jsx-runtime").JSX.Element | null;
13
15
  export default ChartTooltip;
@@ -20,7 +20,8 @@ var ChartTooltip = function ChartTooltip(_ref2) {
20
20
  label = _ref2.label,
21
21
  categoryColors = _ref2.categoryColors,
22
22
  valueFormatter = _ref2.valueFormatter,
23
- customCategories = _ref2.customCategories;
23
+ customCategories = _ref2.customCategories,
24
+ footer = _ref2.footer;
24
25
  var _useStyles = useStyles(),
25
26
  cx = _useStyles.cx,
26
27
  theme = _useStyles.theme,
@@ -59,7 +60,7 @@ var ChartTooltip = function ChartTooltip(_ref2) {
59
60
  value: valueFormatter(value)
60
61
  }, "id-".concat(idx));
61
62
  })
62
- })]
63
+ }), footer]
63
64
  });
64
65
  }
65
66
  return null;
@@ -1,6 +1,6 @@
1
1
  import { NameType, Payload } from 'recharts/types/component/DefaultTooltipContent';
2
2
  import { ScatterChartValueFormatter } from "../ScatterChart";
3
- import { ValueFormatter } from "../types";
3
+ import { ValueFormatter } from "../types/charts";
4
4
  export type CustomTooltipProps = {
5
5
  active: boolean | undefined;
6
6
  customCategories?: {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ValueFormatter } from "../types";
2
+ import { ValueFormatter } from "../types/charts";
3
3
  interface CustomYAxisTickProps {
4
4
  align: 'left' | 'right';
5
5
  formatter: ValueFormatter;
@@ -1,5 +1,8 @@
1
1
  import { useTheme } from 'antd-style';
2
+ import { useMemo } from 'react';
2
3
  export var useThemeColorRange = function useThemeColorRange() {
3
4
  var theme = useTheme();
4
- return [theme.geekblue, theme.gold, theme.lime, theme.volcano, theme.purple, theme.blue, theme.orange, theme.green, theme.red, theme.cyan, theme.yellow, theme.magenta];
5
+ return useMemo(function () {
6
+ return [theme.geekblue, theme.gold, theme.green, theme.cyan, theme.purple, theme.red, theme.volcano, theme.gray, theme.geekblue7, theme.gold7, theme.green7, theme.cyan7, theme.purple7, theme.red7, theme.volcano7, theme.gray7];
7
+ }, [theme]);
5
8
  };
package/es/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  export { default as AreaChart, type AreaChartProps } from './AreaChart';
2
2
  export { default as BarChart, type BarChartProps } from './BarChart';
3
3
  export { type Bar, default as BarList, type BarListProps } from './BarList';
4
+ export { default as ChartTooltip, type ChartTooltipProps } from './common/ChartTooltip';
4
5
  export { default as ChartTooltipFrame } from './common/ChartTooltip/ChartTooltipFrame';
6
+ export { default as ChartTooltipRow } from './common/ChartTooltip/ChartTooltipRow';
5
7
  export * from './DataBars';
6
8
  export { default as DonutChart, type DonutChartProps } from './DonutChart';
7
9
  export { default as FunnelChart, type FunnelChartProps } from './FunnelChart';
@@ -11,5 +13,5 @@ export { default as LineChart, type LineChartProps } from './LineChart';
11
13
  export { default as ScatterChart, type ScatterChartProps } from './ScatterChart';
12
14
  export * from './SparkChart';
13
15
  export { default as Tracker, type TrackerProps } from './Tracker';
14
- export type * from './types';
16
+ export type * from './types/charts';
15
17
  export { useThemeColorRange } from "./hooks/useThemeColorRange";
package/es/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export { default as AreaChart } from "./AreaChart";
2
2
  export { default as BarChart } from "./BarChart";
3
3
  export { default as BarList } from "./BarList";
4
+ export { default as ChartTooltip } from "./common/ChartTooltip";
4
5
  export { default as ChartTooltipFrame } from "./common/ChartTooltip/ChartTooltipFrame";
6
+ export { default as ChartTooltipRow } from "./common/ChartTooltip/ChartTooltipRow";
5
7
  export * from "./DataBars";
6
8
  export { default as DonutChart } from "./DonutChart";
7
9
  export { default as FunnelChart } from "./FunnelChart";
@@ -0,0 +1,9 @@
1
+ import type { LobeCustomStylish, LobeCustomToken } from '@lobehub/ui';
2
+ import 'antd-style';
3
+
4
+ declare module 'antd-style' {
5
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
6
+ export interface CustomToken extends LobeCustomToken {}
7
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
8
+ export interface CustomStylish extends LobeCustomStylish {}
9
+ }
@@ -1,5 +1,5 @@
1
1
  import type { Day as WeekDay } from 'date-fns';
2
- import type { Activity, Week } from "../types";
2
+ import type { Activity, Week } from "../types/charts";
3
3
  export declare const DEFAULT_MONTH_LABELS: string[];
4
4
  export declare const DEFAULT_LABELS: {
5
5
  legend: {
@@ -1,4 +1,4 @@
1
- import { ValueFormatter } from "../types";
1
+ import { ValueFormatter } from "../types/charts";
2
2
  export declare const getTextWidth: (text: string) => number;
3
3
  export declare const getMaxLabelLength: ({ data, valueFormatter, index, layout, margin, isScatterChart, }: {
4
4
  data: Array<Record<string, any>>;
@@ -1,4 +1,4 @@
1
- import { ValueFormatter } from "../types";
1
+ import { ValueFormatter } from "../types/charts";
2
2
  export declare const defaultValueFormatter: ValueFormatter;
3
3
  export declare const sumNumericArray: (arr: number[]) => number;
4
4
  export declare const isOnSeverSide: boolean;
package/es/utils/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { DeltaTypes } from "../types";
1
+ import { DeltaTypes } from "../types/charts";
2
2
  export var defaultValueFormatter = String;
3
3
  export var sumNumericArray = function sumNumericArray(arr) {
4
4
  return arr.reduce(function (prefixSum, num) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/charts",
3
- "version": "1.9.7",
3
+ "version": "1.9.9",
4
4
  "description": "React modern charts components built on recharts",
5
5
  "keywords": [
6
6
  "lobehub",
File without changes
File without changes