@blockscout/ui-toolkit 2.4.0-alpha → 2.4.0-alpha.1
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 +3 -0
- package/dist/chakra/link.d.ts +1 -1
- package/dist/components/charts/Chart.d.ts +14 -0
- package/dist/components/charts/ChartFullscreenDialog.d.ts +17 -0
- package/dist/components/charts/ChartWidget.d.ts +18 -0
- package/dist/components/charts/ChartWidgetContent.d.ts +17 -0
- package/dist/components/charts/index.d.ts +17 -0
- package/dist/components/charts/parts/ChartArea.d.ts +15 -0
- package/dist/components/charts/parts/ChartAxis.d.ts +11 -0
- package/dist/components/charts/parts/ChartGridLine.d.ts +10 -0
- package/dist/components/charts/parts/ChartLegend.d.ts +9 -0
- package/dist/components/charts/parts/ChartLine.d.ts +11 -0
- package/dist/components/charts/parts/ChartMenu.d.ts +19 -0
- package/dist/components/charts/parts/ChartOverlay.d.ts +7 -0
- package/dist/components/charts/parts/ChartSelectionX.d.ts +11 -0
- package/dist/components/charts/parts/ChartTooltip.d.ts +15 -0
- package/dist/components/charts/parts/ChartWatermark.d.ts +3 -0
- package/dist/components/charts/parts/tooltip/ChartTooltipBackdrop.d.ts +8 -0
- package/dist/components/charts/parts/tooltip/ChartTooltipContent.d.ts +14 -0
- package/dist/components/charts/parts/tooltip/ChartTooltipLine.d.ts +4 -0
- package/dist/components/charts/parts/tooltip/ChartTooltipPoint.d.ts +20 -0
- package/dist/components/charts/parts/tooltip/ChartTooltipRow.d.ts +24 -0
- package/dist/components/charts/parts/tooltip/ChartTooltipTitle.d.ts +7 -0
- package/dist/components/charts/parts/tooltip/pointerTracker.d.ts +13 -0
- package/dist/components/charts/parts/tooltip/utils.d.ts +7 -0
- package/dist/components/charts/types.d.ts +67 -0
- package/dist/components/charts/utils/animations.d.ts +5 -0
- package/dist/components/charts/utils/calculateInnerSize.d.ts +5 -0
- package/dist/components/charts/utils/formatters.d.ts +2 -0
- package/dist/components/charts/utils/getDateLabel.d.ts +2 -0
- package/dist/components/charts/utils/timeChartAxis.d.ts +22 -0
- package/dist/components/charts/utils/useChartBrushX.d.ts +7 -0
- package/dist/components/charts/utils/useChartLegend.d.ts +4 -0
- package/dist/components/charts/utils/useChartZoom.d.ts +6 -0
- package/dist/components/charts/utils/useTimeChartController.d.ts +30 -0
- package/dist/components/forms/fields/FormFieldAddress.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldCheckbox.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldCheckboxGroup.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldColor.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldEmail.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldNumber.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldRadio.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldSelect.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldSelectAsync.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldSwitch.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldText.d.ts +3 -1
- package/dist/components/forms/fields/FormFieldUrl.d.ts +3 -1
- package/dist/components/forms/inputs/file/FileInput.d.ts +2 -1
- package/dist/hooks/useClientRect.d.ts +2 -0
- package/dist/index.js +5319 -3688
- package/dist/package/src/index.d.ts +3 -0
- package/dist/utils/file.d.ts +2 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -34,6 +34,9 @@ Ensure you have the following peer dependencies installed:
|
|
|
34
34
|
"@blockscout/ui-toolkit": "latest",
|
|
35
35
|
"@chakra-ui/react": ">=3.15.0",
|
|
36
36
|
"@emotion/react": ">=11.14.0",
|
|
37
|
+
"d3": ">=7.6.1",
|
|
38
|
+
"dayjs": ">=1.11.5",
|
|
39
|
+
"es-toolkit": ">=1.39.10",
|
|
37
40
|
"next": ">=15.2.3",
|
|
38
41
|
"next-themes": ">=0.4.4",
|
|
39
42
|
"react": ">=18.3.1",
|
package/dist/chakra/link.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LinkProps as ChakraLinkProps } from '@chakra-ui/react';
|
|
|
2
2
|
import { LinkProps as NextLinkProps } from 'next/link';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
export declare const LinkExternalIcon: ({ color }: {
|
|
5
|
-
color?: ChakraLinkProps[
|
|
5
|
+
color?: ChakraLinkProps["color"];
|
|
6
6
|
}) => React.JSX.Element;
|
|
7
7
|
interface LinkPropsChakra extends ChakraLinkProps {
|
|
8
8
|
loading?: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AxesConfigFn, ChartMargin, TimeChartData, Resolution } from './types';
|
|
3
|
+
export interface ChartProps {
|
|
4
|
+
charts: TimeChartData;
|
|
5
|
+
title: string;
|
|
6
|
+
zoomRange?: [Date, Date];
|
|
7
|
+
onZoom: (range: [Date, Date]) => void;
|
|
8
|
+
margin?: ChartMargin;
|
|
9
|
+
noAnimation?: boolean;
|
|
10
|
+
resolution?: Resolution;
|
|
11
|
+
axesConfig?: AxesConfigFn;
|
|
12
|
+
isEnlarged?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const Chart: React.MemoExoticComponent<({ isEnlarged, charts, onZoom, margin: marginProps, noAnimation, resolution, zoomRange, axesConfig: axesConfigProps, }: ChartProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Resolution, TimeChartData } from './types';
|
|
3
|
+
export interface Props {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: ({ open }: {
|
|
6
|
+
open: boolean;
|
|
7
|
+
}) => void;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
charts: TimeChartData;
|
|
11
|
+
resolution?: Resolution;
|
|
12
|
+
zoomRange?: [Date, Date];
|
|
13
|
+
handleZoom: (range: [Date, Date]) => void;
|
|
14
|
+
handleZoomReset: () => void;
|
|
15
|
+
}
|
|
16
|
+
declare const FullscreenChartModal: ({ charts, open, onOpenChange, title, description, resolution, zoomRange, handleZoom, handleZoomReset, }: Props) => React.JSX.Element;
|
|
17
|
+
export default FullscreenChartModal;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FlexProps } from '@chakra-ui/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { AxesConfigFn, TimeChartData } from './types';
|
|
4
|
+
import { ChartMenuItemId } from './parts/ChartMenu';
|
|
5
|
+
export interface ChartWidgetProps extends FlexProps {
|
|
6
|
+
charts: TimeChartData;
|
|
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?: AxesConfigFn;
|
|
16
|
+
menuItemIds?: Array<ChartMenuItemId>;
|
|
17
|
+
}
|
|
18
|
+
export declare const ChartWidget: React.MemoExoticComponent<({ charts, title, description, isLoading, isError, emptyText, noAnimation, href, chartUrl, axesConfig, menuItemIds, ...rest }: ChartWidgetProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AxesConfigFn, Resolution, TimeChartData } from './types';
|
|
3
|
+
export interface ChartWidgetContentProps {
|
|
4
|
+
charts: TimeChartData;
|
|
5
|
+
title: string;
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
isError?: boolean;
|
|
8
|
+
empty?: boolean;
|
|
9
|
+
emptyText?: string;
|
|
10
|
+
zoomRange?: [Date, Date];
|
|
11
|
+
handleZoom: (range: [Date, Date]) => void;
|
|
12
|
+
isEnlarged?: boolean;
|
|
13
|
+
noAnimation?: boolean;
|
|
14
|
+
resolution?: Resolution;
|
|
15
|
+
axesConfig?: AxesConfigFn;
|
|
16
|
+
}
|
|
17
|
+
export declare const ChartWidgetContent: React.MemoExoticComponent<({ charts, title, isLoading, isError, empty, emptyText, zoomRange, handleZoom, isEnlarged, noAnimation, resolution, axesConfig, }: ChartWidgetContentProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,17 @@
|
|
|
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/ChartOverlay';
|
|
10
|
+
export * from './parts/ChartSelectionX';
|
|
11
|
+
export * from './parts/ChartTooltip';
|
|
12
|
+
export * from './parts/ChartWatermark';
|
|
13
|
+
export * from './utils/useChartBrushX';
|
|
14
|
+
export * from './utils/useChartZoom';
|
|
15
|
+
export * from './utils/useChartLegend';
|
|
16
|
+
export * from './utils/useTimeChartController';
|
|
17
|
+
export * from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimeChartItem } from '../types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
export interface ChartAreaProps extends React.SVGProps<SVGPathElement> {
|
|
5
|
+
id: string;
|
|
6
|
+
xScale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
7
|
+
yScale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
8
|
+
gradient: {
|
|
9
|
+
startColor: string;
|
|
10
|
+
stopColor: string;
|
|
11
|
+
};
|
|
12
|
+
data: Array<TimeChartItem>;
|
|
13
|
+
noAnimation?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const ChartArea: React.MemoExoticComponent<({ id, xScale, yScale, gradient, data, noAnimation, ...props }: ChartAreaProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import * as d3 from 'd3';
|
|
3
|
+
export interface ChartAxisProps extends Omit<React.SVGProps<SVGGElement>, 'scale'> {
|
|
4
|
+
type: 'left' | 'bottom';
|
|
5
|
+
scale: d3.ScaleTime<number, number> | d3.ScaleLinear<number, number>;
|
|
6
|
+
noAnimation?: boolean;
|
|
7
|
+
ticks: number;
|
|
8
|
+
tickFormatGenerator?: (axis: d3.Axis<d3.NumberValue>) => (domainValue: d3.AxisDomain, index: number) => string;
|
|
9
|
+
anchorEl?: SVGRectElement | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const ChartAxis: React.MemoExoticComponent<({ type, scale, ticks, tickFormatGenerator, noAnimation, anchorEl, ...props }: ChartAxisProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import * as d3 from 'd3';
|
|
3
|
+
export interface ChartGridLineProps 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 ChartGridLine: React.MemoExoticComponent<({ type, scale, ticks, size, noAnimation, ...props }: ChartGridLineProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BoxProps } from '@chakra-ui/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { TimeChartData } from '../types';
|
|
4
|
+
export interface ChartLegendProps extends BoxProps {
|
|
5
|
+
data: TimeChartData;
|
|
6
|
+
selectedIndexes?: Array<number>;
|
|
7
|
+
onItemClick?: (index: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const ChartLegend: React.MemoExoticComponent<({ data, selectedIndexes, onItemClick, ...props }: ChartLegendProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimeChartItem } from '../types';
|
|
3
|
+
import { AnimationType } from '../utils/animations';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
export interface ChartLineProps 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<TimeChartItem>;
|
|
9
|
+
animation: AnimationType;
|
|
10
|
+
}
|
|
11
|
+
export declare const ChartLine: React.MemoExoticComponent<({ xScale, yScale, data, animation, strokeDasharray, ...props }: ChartLineProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Resolution, TimeChartData } from '../types';
|
|
3
|
+
export declare const CHART_MENU_ITEMS_IDS: ("share" | "fullscreen" | "save_png" | "save_csv")[];
|
|
4
|
+
export type ChartMenuItemId = (typeof CHART_MENU_ITEMS_IDS)[number];
|
|
5
|
+
export interface Props {
|
|
6
|
+
itemIds?: Array<ChartMenuItemId>;
|
|
7
|
+
charts: TimeChartData;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
chartRef: React.RefObject<HTMLDivElement | null>;
|
|
12
|
+
chartUrl?: string;
|
|
13
|
+
resolution?: Resolution;
|
|
14
|
+
zoomRange?: [Date, Date];
|
|
15
|
+
handleZoom: (range: [Date, Date]) => void;
|
|
16
|
+
handleZoomReset: () => void;
|
|
17
|
+
}
|
|
18
|
+
declare const ChartMenu: ({ itemIds, charts, title, description, isLoading, chartRef, chartUrl, resolution, zoomRange, handleZoom, handleZoomReset, }: Props) => React.JSX.Element;
|
|
19
|
+
export default ChartMenu;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface ChartOverlayProps {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const ChartOverlay: React.ForwardRefExoticComponent<ChartOverlayProps & React.RefAttributes<SVGRectElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimeChartData } from '../types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
export interface ChartSelectionXProps {
|
|
5
|
+
height: number;
|
|
6
|
+
anchorEl?: SVGRectElement | null;
|
|
7
|
+
scale: d3.ScaleTime<number, number>;
|
|
8
|
+
data: TimeChartData;
|
|
9
|
+
onSelect: (range: [Date, Date]) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const ChartSelectionX: React.MemoExoticComponent<({ anchorEl, height, scale, data, onSelect }: ChartSelectionXProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Resolution, TimeChartData } from '../types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
export interface ChartTooltipProps {
|
|
5
|
+
width?: number;
|
|
6
|
+
tooltipWidth?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
data: TimeChartData;
|
|
9
|
+
xScale: d3.ScaleTime<number, number>;
|
|
10
|
+
yScale: d3.ScaleLinear<number, number>;
|
|
11
|
+
anchorEl: SVGRectElement | null;
|
|
12
|
+
noAnimation?: boolean;
|
|
13
|
+
resolution?: Resolution;
|
|
14
|
+
}
|
|
15
|
+
export declare const ChartTooltip: React.MemoExoticComponent<({ xScale, yScale, width, tooltipWidth, height, data, anchorEl, noAnimation, resolution, ...props }: ChartTooltipProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
declare const _default: React.MemoExoticComponent<() => React.JSX.Element>;
|
|
3
|
+
export default _default;
|
|
4
|
+
interface UseRenderBackdropParams {
|
|
5
|
+
seriesNum: number;
|
|
6
|
+
transitionDuration: number | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function useRenderBackdrop(ref: React.RefObject<SVGGElement | null>, { seriesNum, transitionDuration }: UseRenderBackdropParams): (width: number, isIncompleteData: boolean) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
declare const _default: React.MemoExoticComponent<({ children }: Props) => React.JSX.Element>;
|
|
6
|
+
export default _default;
|
|
7
|
+
interface UseRenderContentParams {
|
|
8
|
+
chart: {
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
};
|
|
12
|
+
transitionDuration: number | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function useRenderContent(ref: React.RefObject<SVGGElement | null>, { chart, transitionDuration }: UseRenderContentParams): (x: number, y: number) => void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
declare const _default: React.MemoExoticComponent<() => React.JSX.Element>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare function useRenderLine(ref: React.RefObject<SVGGElement | null>, chartHeight: number | undefined): (x: number) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimeChartData, TimeChartItem } from '../../types';
|
|
3
|
+
import * as d3 from 'd3';
|
|
4
|
+
declare const _default: React.MemoExoticComponent<() => React.JSX.Element>;
|
|
5
|
+
export default _default;
|
|
6
|
+
interface UseRenderPointsParams {
|
|
7
|
+
data: TimeChartData;
|
|
8
|
+
xScale: d3.ScaleTime<number, number>;
|
|
9
|
+
yScale: d3.ScaleLinear<number, number>;
|
|
10
|
+
}
|
|
11
|
+
export interface CurrentPoint {
|
|
12
|
+
datumIndex: number;
|
|
13
|
+
item: TimeChartItem;
|
|
14
|
+
}
|
|
15
|
+
interface RenderPointsReturnType {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
currentPoints: Array<CurrentPoint>;
|
|
19
|
+
}
|
|
20
|
+
export declare function useRenderPoints(ref: React.RefObject<SVGGElement | null>, params: UseRenderPointsParams): (x: number) => RenderPointsReturnType;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TimeChartData } from '../../types';
|
|
3
|
+
import { CurrentPoint } from './ChartTooltipPoint';
|
|
4
|
+
import * as d3 from 'd3';
|
|
5
|
+
type Props = {
|
|
6
|
+
lineNum: number;
|
|
7
|
+
} & ({
|
|
8
|
+
label: string;
|
|
9
|
+
children?: never;
|
|
10
|
+
} | {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
label?: never;
|
|
13
|
+
});
|
|
14
|
+
declare const _default: React.MemoExoticComponent<({ label, lineNum, children }: Props) => React.JSX.Element>;
|
|
15
|
+
export default _default;
|
|
16
|
+
interface UseRenderRowsParams {
|
|
17
|
+
data: TimeChartData;
|
|
18
|
+
xScale: d3.ScaleTime<number, number>;
|
|
19
|
+
minWidth: number;
|
|
20
|
+
}
|
|
21
|
+
interface UseRenderRowsReturnType {
|
|
22
|
+
width: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function useRenderRows(ref: React.RefObject<SVGGElement | null>, { data, xScale, minWidth }: UseRenderRowsParams): (x: number, currentPoints: Array<CurrentPoint>) => UseRenderRowsReturnType;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Resolution } from '../../types';
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ resolution }: {
|
|
4
|
+
resolution?: Resolution;
|
|
5
|
+
}) => React.JSX.Element>;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare function useRenderTitle(ref: React.RefObject<SVGGElement | null>): (isVisible: boolean) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface Pointer {
|
|
2
|
+
id: number;
|
|
3
|
+
point: [number, number] | null;
|
|
4
|
+
prev: [number, number] | null;
|
|
5
|
+
sourceEvent?: PointerEvent;
|
|
6
|
+
}
|
|
7
|
+
export interface PointerOptions {
|
|
8
|
+
start?: (tracker: Pointer) => void;
|
|
9
|
+
move?: (tracker: Pointer) => void;
|
|
10
|
+
out?: (tracker: Pointer) => void;
|
|
11
|
+
end?: (tracker: Pointer) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function trackPointer(event: PointerEvent, { start, move, out, end }: PointerOptions): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const TEXT_LINE_HEIGHT = 12;
|
|
2
|
+
export declare const PADDING = 16;
|
|
3
|
+
export declare const LINE_SPACE = 10;
|
|
4
|
+
export declare const POINT_SIZE = 16;
|
|
5
|
+
export declare const LABEL_WIDTH = 80;
|
|
6
|
+
export declare const calculateContainerHeight: (seriesNum: number, isIncomplete?: boolean) => number;
|
|
7
|
+
export declare const calculateRowTransformValue: (rowNum: number) => string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Resolution as ResolutionEnum } from '@blockscout/stats-types';
|
|
2
|
+
import type * as d3 from 'd3';
|
|
3
|
+
export { Resolution } from '@blockscout/stats-types';
|
|
4
|
+
export declare const RESOLUTION_LABELS: Array<{
|
|
5
|
+
id: ResolutionEnum;
|
|
6
|
+
title: string;
|
|
7
|
+
}>;
|
|
8
|
+
export interface TimeChartItemRaw {
|
|
9
|
+
date: Date;
|
|
10
|
+
dateLabel?: string;
|
|
11
|
+
value: number | string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface TimeChartItem {
|
|
14
|
+
date: Date;
|
|
15
|
+
date_to?: Date;
|
|
16
|
+
dateLabel?: string;
|
|
17
|
+
value: number;
|
|
18
|
+
isApproximate?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ChartMargin {
|
|
21
|
+
top?: number;
|
|
22
|
+
right?: number;
|
|
23
|
+
bottom?: number;
|
|
24
|
+
left?: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ChartOffset {
|
|
27
|
+
x?: number;
|
|
28
|
+
y?: number;
|
|
29
|
+
}
|
|
30
|
+
export type ChartConfig = {
|
|
31
|
+
type: 'line';
|
|
32
|
+
color: string;
|
|
33
|
+
strokeWidth?: number;
|
|
34
|
+
strokeDasharray?: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: 'area';
|
|
37
|
+
gradient: {
|
|
38
|
+
startColor: string;
|
|
39
|
+
stopColor: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export interface TimeChartDataItem {
|
|
43
|
+
id: string;
|
|
44
|
+
name: string;
|
|
45
|
+
items: Array<TimeChartItem>;
|
|
46
|
+
charts: Array<ChartConfig>;
|
|
47
|
+
units?: string;
|
|
48
|
+
valueFormatter?: (value: number) => string;
|
|
49
|
+
}
|
|
50
|
+
export type TimeChartData = Array<TimeChartDataItem>;
|
|
51
|
+
export interface AxisConfig {
|
|
52
|
+
ticks?: number;
|
|
53
|
+
nice?: boolean;
|
|
54
|
+
noLabel?: boolean;
|
|
55
|
+
scale?: {
|
|
56
|
+
min?: number;
|
|
57
|
+
};
|
|
58
|
+
tickFormatter?: () => (d: d3.AxisDomain) => string;
|
|
59
|
+
}
|
|
60
|
+
export interface AxesConfig {
|
|
61
|
+
x?: AxisConfig;
|
|
62
|
+
y?: AxisConfig;
|
|
63
|
+
}
|
|
64
|
+
export type AxesConfigFn = (props: {
|
|
65
|
+
isEnlarged?: boolean;
|
|
66
|
+
isMobile?: boolean;
|
|
67
|
+
}) => AxesConfig;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type AnimationType = 'left' | 'fadeIn' | 'none';
|
|
2
|
+
export declare const animateLeft: (path: SVGPathElement) => void;
|
|
3
|
+
export declare const animateFadeIn: (path: SVGPathElement) => void;
|
|
4
|
+
export declare const noneAnimation: (path: SVGPathElement) => void;
|
|
5
|
+
export declare const ANIMATIONS: Record<AnimationType, (path: SVGPathElement) => void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AxesConfig, TimeChartData } from '../types';
|
|
2
|
+
import * as d3 from 'd3';
|
|
3
|
+
export declare const DEFAULT_MAXIMUM_SIGNIFICANT_DIGITS = 2;
|
|
4
|
+
export declare const DEFAULT_MAXIMUM_FRACTION_DIGITS = 3;
|
|
5
|
+
export declare const MAXIMUM_SIGNIFICANT_DIGITS_LIMIT = 8;
|
|
6
|
+
export declare const DEFAULT_LABEL_LENGTH = 5;
|
|
7
|
+
export interface LabelFormatParams extends Intl.NumberFormatOptions {
|
|
8
|
+
maxLabelLength: number;
|
|
9
|
+
}
|
|
10
|
+
type Data = TimeChartData;
|
|
11
|
+
export declare function getAxesParams(data: Data, axesConfig?: AxesConfig): {
|
|
12
|
+
x: {
|
|
13
|
+
scale: d3.ScaleTime<number, number, never>;
|
|
14
|
+
tickFormatter: (axis: d3.Axis<d3.NumberValue>) => (d: d3.AxisDomain) => string;
|
|
15
|
+
};
|
|
16
|
+
y: {
|
|
17
|
+
scale: d3.ScaleLinear<number, number, never>;
|
|
18
|
+
labelFormatParams: LabelFormatParams;
|
|
19
|
+
tickFormatter: () => (d: d3.AxisDomain) => string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AxesConfig, ChartMargin, TimeChartData } from '../types';
|
|
3
|
+
interface Props {
|
|
4
|
+
data: TimeChartData;
|
|
5
|
+
margin?: ChartMargin;
|
|
6
|
+
axesConfig?: AxesConfig;
|
|
7
|
+
}
|
|
8
|
+
export declare function useTimeChartController({ data, margin, axesConfig }: Props): {
|
|
9
|
+
rect: DOMRect | null;
|
|
10
|
+
ref: React.LegacyRef<SVGSVGElement> | undefined;
|
|
11
|
+
chartMargin: {
|
|
12
|
+
left: number;
|
|
13
|
+
top?: number;
|
|
14
|
+
right?: number;
|
|
15
|
+
bottom?: number;
|
|
16
|
+
};
|
|
17
|
+
innerWidth: number;
|
|
18
|
+
innerHeight: number;
|
|
19
|
+
axes: {
|
|
20
|
+
x: {
|
|
21
|
+
tickFormatter: (axis: d3.Axis<d3.NumberValue>) => (d: d3.AxisDomain) => string;
|
|
22
|
+
scale: import('d3-scale').ScaleTime<number, number, never>;
|
|
23
|
+
};
|
|
24
|
+
y: {
|
|
25
|
+
tickFormatter: () => (d: d3.AxisDomain) => string;
|
|
26
|
+
scale: import('d3-scale').ScaleLinear<number, number, never>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -2,4 +2,6 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
4
|
import { PartialBy } from '../../../../types/utils';
|
|
5
|
-
|
|
5
|
+
declare const FormFieldAddressContent: <FormFields extends FieldValues>(props: PartialBy<FormFieldPropsBase<FormFields>, "placeholder">) => React.JSX.Element;
|
|
6
|
+
export declare const FormFieldAddress: typeof FormFieldAddressContent;
|
|
7
|
+
export {};
|
|
@@ -5,4 +5,6 @@ import { CheckboxProps } from '../../../chakra/checkbox';
|
|
|
5
5
|
export interface FormFieldCheckboxProps<FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>> extends Pick<FormFieldPropsBase<FormFields, Name>, 'rules' | 'name' | 'onChange' | 'readOnly' | 'controllerProps'>, Omit<CheckboxProps, 'name' | 'onChange'> {
|
|
6
6
|
label: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare const FormFieldCheckboxContent: <FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>>({ name, label, rules, onChange, readOnly, controllerProps, ...rest }: FormFieldCheckboxProps<FormFields, Name>) => React.JSX.Element;
|
|
9
|
+
export declare const FormFieldCheckbox: typeof FormFieldCheckboxContent;
|
|
10
|
+
export {};
|
|
@@ -9,4 +9,6 @@ export interface FormFieldCheckboxGroupProps<FormFields extends FieldValues, Nam
|
|
|
9
9
|
}>;
|
|
10
10
|
itemProps?: CheckboxProps;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
declare const FormFieldCheckboxGroupContent: <FormFields extends FieldValues, Name extends Path<FormFields>>(props: FormFieldCheckboxGroupProps<FormFields, Name>) => React.JSX.Element;
|
|
13
|
+
export declare const FormFieldCheckboxGroup: typeof FormFieldCheckboxGroupContent;
|
|
14
|
+
export {};
|
|
@@ -5,4 +5,6 @@ import { FormFieldPropsBase } from './types';
|
|
|
5
5
|
export interface FormFieldColorProps<FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>> extends FormFieldPropsBase<FormFields, Name> {
|
|
6
6
|
sampleDefaultBgColor?: BoxProps['bgColor'];
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare const FormFieldColorContent: <FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>>({ name, placeholder, rules, onBlur, group, inputProps, size, disabled, sampleDefaultBgColor, controllerProps, ...restProps }: FormFieldColorProps<FormFields, Name>) => React.JSX.Element;
|
|
9
|
+
export declare const FormFieldColor: typeof FormFieldColorContent;
|
|
10
|
+
export {};
|
|
@@ -2,4 +2,6 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
4
|
import { PartialBy } from '../../../../types/utils';
|
|
5
|
-
|
|
5
|
+
declare const FormFieldEmailContent: <FormFields extends FieldValues>(props: PartialBy<FormFieldPropsBase<FormFields>, "placeholder">) => React.JSX.Element;
|
|
6
|
+
export declare const FormFieldEmail: typeof FormFieldEmailContent;
|
|
7
|
+
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
|
-
|
|
4
|
+
declare const FormFieldNumberContent: <FormFields extends FieldValues>({ inputProps, ...rest }: FormFieldPropsBase<FormFields>) => React.JSX.Element;
|
|
5
|
+
export declare const FormFieldNumber: typeof FormFieldNumberContent;
|
|
6
|
+
export {};
|
|
@@ -11,4 +11,6 @@ export interface FormFieldRadioProps<FormFields extends FieldValues, Name extend
|
|
|
11
11
|
}>;
|
|
12
12
|
itemProps?: RadioProps;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
declare const FormFieldRadioContent: <FormFields extends FieldValues, Name extends Path<FormFields>>({ name, options, itemProps, onValueChange, disabled, controllerProps, ...rest }: FormFieldRadioProps<FormFields, Name>) => React.JSX.Element;
|
|
15
|
+
export declare const FormFieldRadio: typeof FormFieldRadioContent;
|
|
16
|
+
export {};
|
|
@@ -3,4 +3,6 @@ import { Path, FieldValues } from 'react-hook-form';
|
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
4
|
import { SelectProps } from '../../../chakra/select';
|
|
5
5
|
export type FormFieldSelectProps<FormFields extends FieldValues, Name extends Path<FormFields>> = FormFieldPropsBase<FormFields, Name> & SelectProps;
|
|
6
|
-
|
|
6
|
+
declare const FormFieldSelectContent: <FormFields extends FieldValues, Name extends Path<FormFields>>(props: FormFieldSelectProps<FormFields, Name>) => React.JSX.Element;
|
|
7
|
+
export declare const FormFieldSelect: typeof FormFieldSelectContent;
|
|
8
|
+
export {};
|
|
@@ -3,4 +3,6 @@ import { Path, FieldValues } from 'react-hook-form';
|
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
4
|
import { SelectAsyncProps } from '../../../chakra/select';
|
|
5
5
|
export type FormFieldSelectAsyncProps<FormFields extends FieldValues, Name extends Path<FormFields>> = FormFieldPropsBase<FormFields, Name> & SelectAsyncProps;
|
|
6
|
-
|
|
6
|
+
declare const FormFieldSelectAsyncContent: <FormFields extends FieldValues, Name extends Path<FormFields>>(props: FormFieldSelectAsyncProps<FormFields, Name>) => React.JSX.Element;
|
|
7
|
+
export declare const FormFieldSelectAsync: typeof FormFieldSelectAsyncContent;
|
|
8
|
+
export {};
|
|
@@ -3,4 +3,6 @@ import { FieldValues, Path } from 'react-hook-form';
|
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
4
|
import { SwitchProps } from '../../../chakra/switch';
|
|
5
5
|
export type FormFieldSwitchProps<FormFields extends FieldValues, Name extends Path<FormFields>> = Pick<FormFieldPropsBase<FormFields, Name>, 'name' | 'placeholder' | 'rules' | 'controllerProps'> & SwitchProps;
|
|
6
|
-
|
|
6
|
+
declare const FormFieldSwitchContent: <FormFields extends FieldValues, Name extends Path<FormFields>>({ name, placeholder, onCheckedChange, rules, controllerProps, disabled, ...rest }: FormFieldSwitchProps<FormFields, Name>) => React.JSX.Element;
|
|
7
|
+
export declare const FormFieldSwitch: typeof FormFieldSwitchContent;
|
|
8
|
+
export {};
|
|
@@ -4,4 +4,6 @@ import { FormFieldPropsBase } from './types';
|
|
|
4
4
|
export interface FormFieldTextProps<FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>> extends FormFieldPropsBase<FormFields, Name> {
|
|
5
5
|
asComponent?: 'Input' | 'Textarea';
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
declare const FormFieldTextContent: <FormFields extends FieldValues, Name extends Path<FormFields> = Path<FormFields>>({ name, placeholder, rules, onBlur, group, inputProps, asComponent, size: sizeProp, disabled, floating: floatingProp, controllerProps, ...restProps }: FormFieldTextProps<FormFields, Name>) => React.JSX.Element;
|
|
8
|
+
export declare const FormFieldText: typeof FormFieldTextContent;
|
|
9
|
+
export {};
|