@blockscout/ui-toolkit 2.7.3 → 2.8.0-alpha.0
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/README.md +6 -6
- package/dist/chakra/checkbox.d.ts +2 -3
- package/dist/chakra/select.d.ts +8 -0
- package/dist/chakra/status.d.ts +5 -0
- package/dist/chakra/toaster.d.ts +2 -1
- package/dist/components/AdaptiveTabs/AdaptiveTabsList.d.ts +5 -1
- package/dist/components/charts/components/ChartContent.d.ts +10 -0
- package/dist/components/charts/components/ChartDialog.d.ts +11 -0
- package/dist/components/charts/components/ChartMenu.d.ts +15 -0
- package/dist/components/charts/components/ChartResetZoomButton.d.ts +5 -0
- package/dist/components/charts/components/ChartWidget.d.ts +12 -0
- package/dist/components/charts/components/index.d.ts +6 -0
- package/dist/components/charts/index.d.ts +3 -17
- package/dist/components/charts/line/LineChart.d.ts +14 -0
- package/dist/components/charts/line/LineChartContent.d.ts +6 -0
- package/dist/components/charts/line/LineChartModal.d.ts +13 -0
- package/dist/components/charts/line/LineChartWidget.d.ts +19 -0
- package/dist/components/charts/line/index.d.ts +17 -0
- package/dist/components/charts/{parts/ChartArea.d.ts → line/parts/LineChartArea.d.ts} +4 -4
- package/dist/components/charts/{parts/ChartAxis.d.ts → line/parts/LineChartAxis.d.ts} +2 -2
- package/dist/components/charts/line/parts/LineChartGridLine.d.ts +10 -0
- package/dist/components/charts/line/parts/LineChartLegend.d.ts +9 -0
- package/dist/components/charts/line/parts/LineChartLine.d.ts +11 -0
- package/dist/components/charts/line/parts/LineChartMenu.d.ts +13 -0
- package/dist/components/charts/line/parts/LineChartOverlay.d.ts +7 -0
- package/dist/components/charts/line/parts/LineChartSelectionX.d.ts +11 -0
- package/dist/components/charts/line/parts/LineChartTooltip.d.ts +16 -0
- package/dist/components/charts/{parts/tooltip/ChartTooltipPoint.d.ts → line/parts/tooltip/LineChartTooltipPoint.d.ts} +3 -3
- package/dist/components/charts/{parts/tooltip/ChartTooltipRow.d.ts → line/parts/tooltip/LineChartTooltipRow.d.ts} +3 -3
- package/dist/components/charts/{parts/tooltip/ChartTooltipTitle.d.ts → line/parts/tooltip/LineChartTooltipTitle.d.ts} +2 -2
- package/dist/components/charts/line/types.d.ts +51 -0
- package/dist/components/charts/line/utils/formatters.d.ts +2 -0
- package/dist/components/charts/line/utils/getDateLabel.d.ts +2 -0
- package/dist/components/charts/{utils/timeChartAxis.d.ts → line/utils/lineChartAxis.d.ts} +3 -3
- package/dist/components/charts/{utils/useChartBrushX.d.ts → line/utils/useLineChartBrushX.d.ts} +1 -1
- package/dist/components/charts/{utils/useTimeChartController.d.ts → line/utils/useLineChartController.d.ts} +7 -6
- package/dist/components/charts/{utils/useChartLegend.d.ts → line/utils/useLineChartLegend.d.ts} +1 -1
- package/dist/components/charts/{utils/useChartZoom.d.ts → line/utils/useLineChartZoom.d.ts} +1 -1
- package/dist/components/charts/sankey/SankeyChart.d.ts +2 -2
- package/dist/components/charts/sankey/SankeyChartContent.d.ts +8 -0
- package/dist/components/charts/sankey/SankeyChartModal.d.ts +7 -0
- package/dist/components/charts/sankey/SankeyChartWidget.d.ts +14 -0
- package/dist/components/charts/sankey/constants.d.ts +4 -4
- package/dist/components/charts/sankey/index.d.ts +2 -2
- package/dist/components/charts/sankey/parts/SankeyChartLink.d.ts +18 -0
- package/dist/components/charts/sankey/parts/SankeyChartMenu.d.ts +7 -0
- package/dist/components/charts/sankey/parts/SankeyChartNode.d.ts +9 -0
- package/dist/components/charts/sankey/types.d.ts +5 -5
- package/dist/components/charts/sankey/useSankeyController.d.ts +5 -5
- package/dist/components/charts/types.d.ts +9 -56
- package/dist/components/forms/fields/FormFieldSwitch.d.ts +2 -2
- package/dist/components/truncation/TruncatedText.d.ts +3 -2
- package/dist/components/truncation/TruncatedTextTooltip.d.ts +3 -2
- package/dist/hooks/useClipboard.d.ts +1 -3
- package/dist/hooks/useDisclosure.d.ts +5 -3
- package/dist/index.js +7649 -5358
- package/dist/package/src/index.d.ts +1 -0
- package/dist/theme/recipes/badge.recipe.d.ts +0 -1
- package/dist/theme/recipes/button.recipe.d.ts +8 -0
- package/dist/theme/recipes/code.recipe.d.ts +2 -100
- package/dist/theme/recipes/index.d.ts +32 -101
- package/dist/theme/recipes/status.recipe.d.ts +22 -0
- package/dist/utils/file.d.ts +1 -1
- package/package.json +3 -7
- package/dist/components/charts/Chart.d.ts +0 -13
- package/dist/components/charts/ChartFullscreenDialog.d.ts +0 -17
- package/dist/components/charts/ChartWidget.d.ts +0 -19
- package/dist/components/charts/ChartWidgetContent.d.ts +0 -17
- package/dist/components/charts/parts/ChartGridLine.d.ts +0 -10
- package/dist/components/charts/parts/ChartLegend.d.ts +0 -9
- package/dist/components/charts/parts/ChartLine.d.ts +0 -11
- package/dist/components/charts/parts/ChartMenu.d.ts +0 -19
- package/dist/components/charts/parts/ChartOverlay.d.ts +0 -7
- package/dist/components/charts/parts/ChartSelectionX.d.ts +0 -11
- package/dist/components/charts/parts/ChartTooltip.d.ts +0 -15
- package/dist/components/charts/sankey/parts/SankeyLink.d.ts +0 -18
- package/dist/components/charts/sankey/parts/SankeyNode.d.ts +0 -9
- package/dist/components/charts/utils/formatters.d.ts +0 -2
- package/dist/components/charts/utils/getDateLabel.d.ts +0 -2
- /package/dist/components/charts/{parts → components}/ChartWatermark.d.ts +0 -0
- /package/dist/components/charts/{parts/tooltip/ChartTooltipBackdrop.d.ts → line/parts/tooltip/LineChartTooltipBackdrop.d.ts} +0 -0
- /package/dist/components/charts/{parts/tooltip/ChartTooltipContent.d.ts → line/parts/tooltip/LineChartTooltipContent.d.ts} +0 -0
- /package/dist/components/charts/{parts/tooltip/ChartTooltipLine.d.ts → line/parts/tooltip/LineChartTooltipLine.d.ts} +0 -0
- /package/dist/components/charts/{parts → line/parts}/tooltip/pointerTracker.d.ts +0 -0
- /package/dist/components/charts/{parts → line/parts}/tooltip/utils.d.ts +0 -0
- /package/dist/components/charts/{utils → line/utils}/animations.d.ts +0 -0
package/README.md
CHANGED
|
@@ -20,8 +20,8 @@ Install the package using your preferred package manager:
|
|
|
20
20
|
# Using npm
|
|
21
21
|
npm install @blockscout/ui-toolkit
|
|
22
22
|
|
|
23
|
-
# Using
|
|
24
|
-
|
|
23
|
+
# Using pnpm
|
|
24
|
+
pnpm add @blockscout/ui-toolkit
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
### Required Dependencies
|
|
@@ -39,7 +39,7 @@ Ensure you have the following peer dependencies installed:
|
|
|
39
39
|
"dayjs": ">=1.11.5",
|
|
40
40
|
"dom-to-image": ">=2.6.0",
|
|
41
41
|
"es-toolkit": ">=1.39.10",
|
|
42
|
-
"next": ">=
|
|
42
|
+
"next": ">=16.2.4",
|
|
43
43
|
"next-themes": ">=0.4.4",
|
|
44
44
|
"react": ">=18.3.1",
|
|
45
45
|
"react-dom": ">=18.3.1",
|
|
@@ -125,17 +125,17 @@ Add the following script to your `package.json` to generate Chakra UI type defin
|
|
|
125
125
|
|
|
126
126
|
1. Clone the repository and install dependencies:
|
|
127
127
|
```bash
|
|
128
|
-
|
|
128
|
+
pnpm
|
|
129
129
|
```
|
|
130
130
|
|
|
131
131
|
2. Start the development server:
|
|
132
132
|
```bash
|
|
133
|
-
|
|
133
|
+
pnpm dev
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
3. Build the package:
|
|
137
137
|
```bash
|
|
138
|
-
|
|
138
|
+
pnpm build
|
|
139
139
|
```
|
|
140
140
|
|
|
141
141
|
### Publishing
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Checkbox as
|
|
2
|
-
import { HTMLChakraProps, Checkbox as ChakraCheckbox } from '@chakra-ui/react';
|
|
1
|
+
import { CheckboxGroupProps as ChakraCheckboxGroupProps, Checkbox as ChakraCheckbox } from '@chakra-ui/react';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
export interface CheckboxProps extends ChakraCheckbox.RootProps {
|
|
5
4
|
icon?: React.ReactNode;
|
|
@@ -7,7 +6,7 @@ export interface CheckboxProps extends ChakraCheckbox.RootProps {
|
|
|
7
6
|
rootRef?: React.Ref<HTMLLabelElement>;
|
|
8
7
|
}
|
|
9
8
|
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
10
|
-
export interface CheckboxGroupProps extends
|
|
9
|
+
export interface CheckboxGroupProps extends ChakraCheckboxGroupProps {
|
|
11
10
|
orientation?: 'vertical' | 'horizontal';
|
|
12
11
|
}
|
|
13
12
|
export declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/chakra/select.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ListCollection, Select as ChakraSelect } from '@chakra-ui/react';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
export type ViewMode = 'default' | 'compact';
|
|
4
|
+
export type OnValueChangeHandler = (details: {
|
|
5
|
+
value: Array<string>;
|
|
6
|
+
}) => void;
|
|
4
7
|
export interface SelectOption<Value extends string = string> {
|
|
5
8
|
label: string;
|
|
6
9
|
renderLabel?: (place: 'item' | 'value-text') => React.ReactNode;
|
|
@@ -31,6 +34,10 @@ interface SelectValueTextProps extends Omit<ChakraSelect.ValueTextProps, 'childr
|
|
|
31
34
|
invalid?: boolean;
|
|
32
35
|
errorText?: string;
|
|
33
36
|
mode?: ViewMode;
|
|
37
|
+
multipleConfig?: {
|
|
38
|
+
term?: string;
|
|
39
|
+
icon?: React.ReactNode;
|
|
40
|
+
};
|
|
34
41
|
}
|
|
35
42
|
export declare const SelectValueText: React.ForwardRefExoticComponent<SelectValueTextProps & React.RefAttributes<HTMLSpanElement>>;
|
|
36
43
|
export interface SelectRootProps extends ChakraSelect.RootProps {
|
|
@@ -50,6 +57,7 @@ export interface SelectProps extends SelectRootProps {
|
|
|
50
57
|
errorText?: string;
|
|
51
58
|
contentProps?: SelectContentProps;
|
|
52
59
|
contentHeader?: React.ReactNode;
|
|
60
|
+
multipleConfig?: SelectValueTextProps['multipleConfig'];
|
|
53
61
|
itemFilter?: (item: SelectOption) => boolean;
|
|
54
62
|
mode?: ViewMode;
|
|
55
63
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Status as ChakraStatus } from '@chakra-ui/react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface StatusProps extends ChakraStatus.RootProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const Status: React.ForwardRefExoticComponent<StatusProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/chakra/toaster.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLChakraProps } from '@chakra-ui/react';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
3
|
import { TabItemRegular } from './types';
|
|
4
|
-
import { TabsProps } from '../../chakra/tabs';
|
|
4
|
+
import { TabsProps, TabsTriggerProps } from '../../chakra/tabs';
|
|
5
5
|
export interface SlotProps extends HTMLChakraProps<'div'> {
|
|
6
6
|
widthAllocation?: 'available' | 'fixed';
|
|
7
7
|
}
|
|
@@ -11,6 +11,10 @@ export interface BaseProps {
|
|
|
11
11
|
isSticky: boolean;
|
|
12
12
|
activeTab: string;
|
|
13
13
|
}) => HTMLChakraProps<'div'>);
|
|
14
|
+
listItemProps?: TabsTriggerProps | (({ index, isActive }: {
|
|
15
|
+
index: number;
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
}) => TabsTriggerProps);
|
|
14
18
|
rightSlot?: React.ReactNode;
|
|
15
19
|
rightSlotProps?: SlotProps;
|
|
16
20
|
leftSlot?: React.ReactNode;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ChartContentProps {
|
|
3
|
+
isError?: boolean;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
isEmpty?: boolean;
|
|
6
|
+
emptyText?: string;
|
|
7
|
+
noWatermark?: boolean;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const ChartContent: ({ isError, isLoading, isEmpty, emptyText, noWatermark, children }: ChartContentProps) => React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { OnOpenChangeHandler } from '../../../hooks/useDisclosure';
|
|
3
|
+
export interface ChartDialogProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: OnOpenChangeHandler;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
headerRightSlot?: React.ReactNode;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare const ChartDialog: ({ open, onOpenChange, title, description, headerRightSlot, children }: ChartDialogProps) => React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const CHART_MENU_ITEMS_IDS: ("share" | "fullscreen" | "save_png" | "save_csv")[];
|
|
3
|
+
export type ChartMenuItemId = (typeof CHART_MENU_ITEMS_IDS)[number];
|
|
4
|
+
export interface ChartMenuProps {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
items?: Array<ChartMenuItemId>;
|
|
8
|
+
csvData: Array<Array<string>>;
|
|
9
|
+
chartUrl?: string;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
chartRef: React.RefObject<HTMLDivElement | null>;
|
|
12
|
+
onShare?: () => void;
|
|
13
|
+
onFullscreenOpen?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const ChartMenu: ({ title, description, items, csvData, chartUrl, isLoading, chartRef, onShare, onFullscreenOpen, }: ChartMenuProps) => React.JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IconButtonProps } from '../../../chakra/icon-button';
|
|
2
|
+
export interface ChartResetZoomButtonProps extends IconButtonProps {
|
|
3
|
+
range?: unknown;
|
|
4
|
+
}
|
|
5
|
+
export declare const ChartResetZoomButton: ({ range, ...props }: ChartResetZoomButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FlexProps } from '@chakra-ui/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface ChartWidgetRootProps extends FlexProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const ChartWidgetRoot: React.ForwardRefExoticComponent<ChartWidgetRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export interface ChartWidgetHeaderProps extends FlexProps {
|
|
7
|
+
title: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
href?: string;
|
|
10
|
+
isLoading?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare const ChartWidgetHeader: ({ title, description, href, isLoading, ...rest }: ChartWidgetHeaderProps) => React.JSX.Element;
|
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
export * from './Chart';
|
|
2
|
-
export * from './ChartWidget';
|
|
3
|
-
export * from './ChartWidgetContent';
|
|
4
|
-
export * from './parts/ChartArea';
|
|
5
|
-
export * from './parts/ChartAxis';
|
|
6
|
-
export * from './parts/ChartGridLine';
|
|
7
|
-
export * from './parts/ChartLegend';
|
|
8
|
-
export * from './parts/ChartLine';
|
|
9
|
-
export * from './parts/ChartMenu';
|
|
10
|
-
export * from './parts/ChartOverlay';
|
|
11
|
-
export * from './parts/ChartSelectionX';
|
|
12
|
-
export * from './parts/ChartTooltip';
|
|
13
|
-
export * from './parts/ChartWatermark';
|
|
14
|
-
export * from './utils/useChartBrushX';
|
|
15
|
-
export * from './utils/useChartZoom';
|
|
16
|
-
export * from './utils/useChartLegend';
|
|
17
|
-
export * from './utils/useTimeChartController';
|
|
18
1
|
export * from './types';
|
|
2
|
+
export * from './components';
|
|
3
|
+
export * from './line';
|
|
4
|
+
export * from './sankey';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartMargin, ChartResolution } from '../types';
|
|
3
|
+
import { LineChartAxesConfigFn, LineChartData } from './types';
|
|
4
|
+
export interface LineChartProps {
|
|
5
|
+
charts: LineChartData;
|
|
6
|
+
zoomRange?: [Date, Date];
|
|
7
|
+
onZoom: (range: [Date, Date]) => void;
|
|
8
|
+
margin?: ChartMargin;
|
|
9
|
+
noAnimation?: boolean;
|
|
10
|
+
resolution?: ChartResolution;
|
|
11
|
+
axesConfig?: LineChartAxesConfigFn;
|
|
12
|
+
isEnlarged?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const LineChart: React.MemoExoticComponent<({ isEnlarged, charts, onZoom, margin: marginProps, noAnimation, resolution, zoomRange, axesConfig: axesConfigProps, }: LineChartProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartContentProps } from '../components/ChartContent';
|
|
3
|
+
import { LineChartProps } from './LineChart';
|
|
4
|
+
export interface LineChartContentProps extends Omit<ChartContentProps, 'children'>, LineChartProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const LineChartContent: React.MemoExoticComponent<({ isLoading, isError, isEmpty, emptyText, noWatermark, ...rest }: LineChartContentProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartResolution } from '../types';
|
|
3
|
+
import { LineChartData } from './types';
|
|
4
|
+
import { ChartDialogProps } from '../components/ChartDialog';
|
|
5
|
+
interface Props extends Omit<ChartDialogProps, 'children' | 'headerRightSlot'> {
|
|
6
|
+
charts: LineChartData;
|
|
7
|
+
resolution?: ChartResolution;
|
|
8
|
+
zoomRange?: [Date, Date];
|
|
9
|
+
handleZoom: (range: [Date, Date]) => void;
|
|
10
|
+
handleZoomReset: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const LineChartModal: ({ charts, open, onOpenChange, title, description, resolution, zoomRange, handleZoom, handleZoomReset, }: Props) => React.JSX.Element;
|
|
13
|
+
export default LineChartModal;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FlexProps } from '@chakra-ui/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { LineChartAxesConfigFn, LineChartData } from './types';
|
|
4
|
+
import { ChartMenuItemId } from '../components/ChartMenu';
|
|
5
|
+
export interface LineChartWidgetProps extends FlexProps {
|
|
6
|
+
charts: LineChartData;
|
|
7
|
+
title: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
isError: boolean;
|
|
11
|
+
emptyText?: string;
|
|
12
|
+
noAnimation?: boolean;
|
|
13
|
+
href?: string;
|
|
14
|
+
chartUrl?: string;
|
|
15
|
+
axesConfig?: LineChartAxesConfigFn;
|
|
16
|
+
menuItems?: Array<ChartMenuItemId>;
|
|
17
|
+
noWatermark?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const LineChartWidget: React.MemoExoticComponent<({ charts, title, description, isLoading, isError, emptyText, noAnimation, href, chartUrl, axesConfig, menuItems, noWatermark, ...rest }: LineChartWidgetProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export * from './LineChart';
|
|
2
|
+
export * from './LineChartWidget';
|
|
3
|
+
export * from './LineChartContent';
|
|
4
|
+
export * from './parts/LineChartArea';
|
|
5
|
+
export * from './parts/LineChartAxis';
|
|
6
|
+
export * from './parts/LineChartGridLine';
|
|
7
|
+
export * from './parts/LineChartLegend';
|
|
8
|
+
export * from './parts/LineChartLine';
|
|
9
|
+
export * from './parts/LineChartMenu';
|
|
10
|
+
export * from './parts/LineChartOverlay';
|
|
11
|
+
export * from './parts/LineChartSelectionX';
|
|
12
|
+
export * from './parts/LineChartTooltip';
|
|
13
|
+
export * from './utils/useLineChartBrushX';
|
|
14
|
+
export * from './utils/useLineChartZoom';
|
|
15
|
+
export * from './utils/useLineChartLegend';
|
|
16
|
+
export * from './utils/useLineChartController';
|
|
17
|
+
export * from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LineChartItem } from '../types';
|
|
3
3
|
import * as d3 from 'd3';
|
|
4
|
-
export interface
|
|
4
|
+
export interface LineChartAreaProps extends React.SVGProps<SVGPathElement> {
|
|
5
5
|
id: string;
|
|
6
6
|
xScale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
7
7
|
yScale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
@@ -9,7 +9,7 @@ export interface ChartAreaProps extends React.SVGProps<SVGPathElement> {
|
|
|
9
9
|
startColor: string;
|
|
10
10
|
stopColor: string;
|
|
11
11
|
};
|
|
12
|
-
data: Array<
|
|
12
|
+
data: Array<LineChartItem>;
|
|
13
13
|
noAnimation?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare const
|
|
15
|
+
export declare const LineChartArea: React.MemoExoticComponent<({ id, xScale, yScale, gradient, data, noAnimation, ...props }: LineChartAreaProps) => React.JSX.Element>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import * as d3 from 'd3';
|
|
3
|
-
export interface
|
|
3
|
+
export interface LineChartAxisProps extends Omit<React.SVGProps<SVGGElement>, 'scale'> {
|
|
4
4
|
type: 'left' | 'bottom';
|
|
5
5
|
scale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
6
6
|
noAnimation?: boolean;
|
|
@@ -8,4 +8,4 @@ export interface ChartAxisProps extends Omit<React.SVGProps<SVGGElement>, 'scale
|
|
|
8
8
|
tickFormatGenerator?: (axis: d3.Axis<d3.NumberValue>) => (domainValue: d3.AxisDomain, index: number) => string;
|
|
9
9
|
anchorEl?: SVGRectElement | null;
|
|
10
10
|
}
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const LineChartAxis: React.MemoExoticComponent<({ type, scale, ticks, tickFormatGenerator, noAnimation, anchorEl, ...props }: LineChartAxisProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import * as d3 from 'd3';
|
|
3
|
+
export interface LineChartGridLineProps extends Omit<React.SVGProps<SVGGElement>, 'scale'> {
|
|
4
|
+
type: 'vertical' | 'horizontal';
|
|
5
|
+
scale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
6
|
+
noAnimation?: boolean;
|
|
7
|
+
size: number;
|
|
8
|
+
ticks: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const LineChartGridLine: React.MemoExoticComponent<({ type, scale, ticks, size, noAnimation, ...props }: LineChartGridLineProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BoxProps } from '@chakra-ui/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { LineChartData } from '../types';
|
|
4
|
+
export interface LineChartLegendProps extends BoxProps {
|
|
5
|
+
data: LineChartData;
|
|
6
|
+
selectedIndexes?: Array<number>;
|
|
7
|
+
onItemClick?: (index: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const LineChartLegend: React.MemoExoticComponent<({ data, selectedIndexes, onItemClick, ...props }: LineChartLegendProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LineChartItem } from '../types';
|
|
3
|
+
import { AnimationType } from '../utils/animations';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
export interface LineChartLineProps extends React.SVGProps<SVGPathElement> {
|
|
6
|
+
xScale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
7
|
+
yScale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
8
|
+
data: Array<LineChartItem>;
|
|
9
|
+
animation: AnimationType;
|
|
10
|
+
}
|
|
11
|
+
export declare const LineChartLine: React.MemoExoticComponent<({ xScale, yScale, data, animation, strokeDasharray, ...props }: LineChartLineProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartResolution } from '../../types';
|
|
3
|
+
import { LineChartData } from '../types';
|
|
4
|
+
import { ChartMenuProps } from '../../components/ChartMenu';
|
|
5
|
+
export interface Props extends Omit<ChartMenuProps, 'csvData' | 'onFullscreenOpen'> {
|
|
6
|
+
charts: LineChartData;
|
|
7
|
+
resolution?: ChartResolution;
|
|
8
|
+
zoomRange?: [Date, Date];
|
|
9
|
+
handleZoom: (range: [Date, Date]) => void;
|
|
10
|
+
handleZoomReset: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const LineChartMenu: ({ items, charts, title, description, isLoading, chartRef, chartUrl, resolution, zoomRange, handleZoom, handleZoomReset, onShare, }: Props) => React.JSX.Element;
|
|
13
|
+
export default LineChartMenu;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface LineChartOverlayProps {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const LineChartOverlay: React.ForwardRefExoticComponent<LineChartOverlayProps & React.RefAttributes<SVGRectElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { LineChartData } from '../types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
export interface LineChartSelectionXProps {
|
|
5
|
+
height: number;
|
|
6
|
+
anchorEl?: SVGRectElement | null;
|
|
7
|
+
scale: d3.ScaleTime<number, number>;
|
|
8
|
+
data: LineChartData;
|
|
9
|
+
onSelect: (range: [Date, Date]) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const LineChartSelectionX: React.MemoExoticComponent<({ anchorEl, height, scale, data, onSelect }: LineChartSelectionXProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartResolution } from '../../types';
|
|
3
|
+
import { LineChartData } from '../types';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
export interface LineChartTooltipProps {
|
|
6
|
+
width?: number;
|
|
7
|
+
tooltipWidth?: number;
|
|
8
|
+
height?: number;
|
|
9
|
+
data: LineChartData;
|
|
10
|
+
xScale: d3.ScaleTime<number, number>;
|
|
11
|
+
yScale: d3.ScaleLinear<number, number>;
|
|
12
|
+
anchorEl: SVGRectElement | null;
|
|
13
|
+
noAnimation?: boolean;
|
|
14
|
+
resolution?: ChartResolution;
|
|
15
|
+
}
|
|
16
|
+
export declare const LineChartTooltip: React.MemoExoticComponent<({ xScale, yScale, width, tooltipWidth, height, data, anchorEl, noAnimation, resolution, ...props }: LineChartTooltipProps) => React.JSX.Element>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { LineChartData, LineChartItem } from '../../types';
|
|
3
3
|
import * as d3 from 'd3';
|
|
4
4
|
declare const _default: React.MemoExoticComponent<() => React.JSX.Element>;
|
|
5
5
|
export default _default;
|
|
6
6
|
interface UseRenderPointsParams {
|
|
7
|
-
data:
|
|
7
|
+
data: LineChartData;
|
|
8
8
|
xScale: d3.ScaleTime<number, number>;
|
|
9
9
|
yScale: d3.ScaleLinear<number, number>;
|
|
10
10
|
}
|
|
11
11
|
export interface CurrentPoint {
|
|
12
12
|
datumIndex: number;
|
|
13
|
-
item:
|
|
13
|
+
item: LineChartItem;
|
|
14
14
|
}
|
|
15
15
|
interface RenderPointsReturnType {
|
|
16
16
|
x: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { CurrentPoint } from './
|
|
2
|
+
import { LineChartData } from '../../types';
|
|
3
|
+
import { CurrentPoint } from './LineChartTooltipPoint';
|
|
4
4
|
import * as d3 from 'd3';
|
|
5
5
|
type Props = {
|
|
6
6
|
lineNum: number;
|
|
@@ -14,7 +14,7 @@ type Props = {
|
|
|
14
14
|
declare const _default: React.MemoExoticComponent<({ label, lineNum, children }: Props) => React.JSX.Element>;
|
|
15
15
|
export default _default;
|
|
16
16
|
interface UseRenderRowsParams {
|
|
17
|
-
data:
|
|
17
|
+
data: LineChartData;
|
|
18
18
|
xScale: d3.ScaleTime<number, number>;
|
|
19
19
|
minWidth: number;
|
|
20
20
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ChartResolution } from '../../../types';
|
|
3
3
|
declare const _default: React.MemoExoticComponent<({ resolution }: {
|
|
4
|
-
resolution?:
|
|
4
|
+
resolution?: ChartResolution;
|
|
5
5
|
}) => React.JSX.Element>;
|
|
6
6
|
export default _default;
|
|
7
7
|
export declare function useRenderTitle(ref: React.RefObject<SVGGElement | null>): (isVisible: boolean) => void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type * as d3 from 'd3';
|
|
2
|
+
export interface LineChartItemRaw {
|
|
3
|
+
date: Date;
|
|
4
|
+
dateLabel?: string;
|
|
5
|
+
value: number | string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface LineChartItem {
|
|
8
|
+
date: Date;
|
|
9
|
+
date_to?: Date;
|
|
10
|
+
dateLabel?: string;
|
|
11
|
+
value: number;
|
|
12
|
+
isApproximate?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type LineChartConfig = {
|
|
15
|
+
type: 'line';
|
|
16
|
+
color: string;
|
|
17
|
+
strokeWidth?: number;
|
|
18
|
+
strokeDasharray?: string;
|
|
19
|
+
} | {
|
|
20
|
+
type: 'area';
|
|
21
|
+
gradient: {
|
|
22
|
+
startColor: string;
|
|
23
|
+
stopColor: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export interface LineChartDataItem {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
items: Array<LineChartItem>;
|
|
30
|
+
charts: Array<LineChartConfig>;
|
|
31
|
+
units?: string;
|
|
32
|
+
valueFormatter?: (value: number) => string;
|
|
33
|
+
}
|
|
34
|
+
export type LineChartData = Array<LineChartDataItem>;
|
|
35
|
+
export interface LineChartAxisConfig {
|
|
36
|
+
ticks?: number;
|
|
37
|
+
nice?: boolean;
|
|
38
|
+
noLabel?: boolean;
|
|
39
|
+
scale?: {
|
|
40
|
+
min?: number;
|
|
41
|
+
};
|
|
42
|
+
tickFormatter?: () => (d: d3.AxisDomain) => string;
|
|
43
|
+
}
|
|
44
|
+
export interface LineChartAxesConfig {
|
|
45
|
+
x?: LineChartAxisConfig;
|
|
46
|
+
y?: LineChartAxisConfig;
|
|
47
|
+
}
|
|
48
|
+
export type LineChartAxesConfigFn = (props: {
|
|
49
|
+
isEnlarged?: boolean;
|
|
50
|
+
isMobile?: boolean;
|
|
51
|
+
}) => LineChartAxesConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LineChartAxesConfig, LineChartData } from '../types';
|
|
2
2
|
import * as d3 from 'd3';
|
|
3
3
|
export declare const DEFAULT_MAXIMUM_SIGNIFICANT_DIGITS = 2;
|
|
4
4
|
export declare const DEFAULT_MAXIMUM_FRACTION_DIGITS = 3;
|
|
@@ -7,8 +7,8 @@ export declare const DEFAULT_LABEL_LENGTH = 5;
|
|
|
7
7
|
export interface LabelFormatParams extends Intl.NumberFormatOptions {
|
|
8
8
|
maxLabelLength: number;
|
|
9
9
|
}
|
|
10
|
-
type Data =
|
|
11
|
-
export declare function getAxesParams(data: Data, axesConfig?:
|
|
10
|
+
type Data = LineChartData;
|
|
11
|
+
export declare function getAxesParams(data: Data, axesConfig?: LineChartAxesConfig): {
|
|
12
12
|
x: {
|
|
13
13
|
scale: d3.ScaleTime<number, number, never>;
|
|
14
14
|
tickFormatter: (axis: d3.Axis<d3.NumberValue>) => (d: d3.AxisDomain) => string;
|
package/dist/components/charts/{utils/useChartBrushX.d.ts → line/utils/useLineChartBrushX.d.ts}
RENAMED
|
@@ -3,5 +3,5 @@ interface Props {
|
|
|
3
3
|
anchor: SVGSVGElement | null;
|
|
4
4
|
setRange: (range: [number, number]) => void;
|
|
5
5
|
}
|
|
6
|
-
export declare function
|
|
6
|
+
export declare function useLineChartBrushX({ limits, anchor, setRange }: Props): void;
|
|
7
7
|
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ChartMargin } from '../../types';
|
|
3
|
+
import { LineChartAxesConfig, LineChartData } from '../types';
|
|
3
4
|
interface Props {
|
|
4
|
-
data:
|
|
5
|
+
data: LineChartData;
|
|
5
6
|
margin?: ChartMargin;
|
|
6
|
-
axesConfig?:
|
|
7
|
+
axesConfig?: LineChartAxesConfig;
|
|
7
8
|
}
|
|
8
|
-
export declare function
|
|
9
|
+
export declare function useLineChartController({ data, margin, axesConfig }: Props): {
|
|
9
10
|
rect: DOMRect | null;
|
|
10
11
|
ref: React.LegacyRef<SVGSVGElement> | undefined;
|
|
11
12
|
chartMargin: {
|
|
@@ -19,11 +20,11 @@ export declare function useTimeChartController({ data, margin, axesConfig }: Pro
|
|
|
19
20
|
axes: {
|
|
20
21
|
x: {
|
|
21
22
|
tickFormatter: (axis: d3.Axis<d3.NumberValue>) => (d: d3.AxisDomain) => string;
|
|
22
|
-
scale: import('d3
|
|
23
|
+
scale: import('d3').ScaleTime<number, number, never>;
|
|
23
24
|
};
|
|
24
25
|
y: {
|
|
25
26
|
tickFormatter: () => (d: d3.AxisDomain) => string;
|
|
26
|
-
scale: import('d3
|
|
27
|
+
scale: import('d3').ScaleLinear<number, number, never>;
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
30
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ChartMargin } from '../types';
|
|
3
|
-
import {
|
|
3
|
+
import { SankeyChartData } from './types';
|
|
4
4
|
export type SankeyLinkColorMode = 'source' | 'target';
|
|
5
5
|
export interface SankeyChartProps {
|
|
6
|
-
data:
|
|
6
|
+
data: SankeyChartData;
|
|
7
7
|
margin?: ChartMargin;
|
|
8
8
|
nodeWidth?: number;
|
|
9
9
|
nodePadding?: number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SankeyChartData } from './types';
|
|
3
|
+
import { ChartContentProps } from '../components/ChartContent';
|
|
4
|
+
import { SankeyChartProps } from './SankeyChart';
|
|
5
|
+
export interface SankeyChartContentProps extends Omit<ChartContentProps, 'children'>, Omit<SankeyChartProps, 'data'> {
|
|
6
|
+
data?: SankeyChartData;
|
|
7
|
+
}
|
|
8
|
+
export declare const SankeyChartContent: React.MemoExoticComponent<({ data, isError, isLoading, isEmpty, emptyText, noWatermark, ...rest }: SankeyChartContentProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartDialogProps } from '../components/ChartDialog';
|
|
3
|
+
import { SankeyChartContentProps } from './SankeyChartContent';
|
|
4
|
+
interface Props extends Omit<ChartDialogProps, 'children' | 'headerRightSlot'>, SankeyChartContentProps {
|
|
5
|
+
}
|
|
6
|
+
export declare const SankeyChartModal: React.MemoExoticComponent<({ open, onOpenChange, title, description, ...rest }: Props) => React.JSX.Element>;
|
|
7
|
+
export {};
|