@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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlexProps } from '@chakra-ui/react';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { SankeyChartData } from './types';
|
|
4
|
+
import { ChartContentProps } from '../components/ChartContent';
|
|
5
|
+
import { SankeyChartProps } from './SankeyChart';
|
|
6
|
+
export interface SankeyChartWidgetProps extends Omit<ChartContentProps, 'children'>, Omit<SankeyChartProps, 'data'> {
|
|
7
|
+
data?: SankeyChartData;
|
|
8
|
+
title: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
href?: string;
|
|
11
|
+
chartUrl?: string;
|
|
12
|
+
containerProps?: FlexProps;
|
|
13
|
+
}
|
|
14
|
+
export declare const SankeyChartWidget: ({ data, title, description, isLoading, href, chartUrl, containerProps, ...rest }: SankeyChartWidgetProps) => React.JSX.Element;
|
|
@@ -10,7 +10,7 @@ export declare const SANKEY_NODE_COLOR_TOKENS_LIGHT: Array<string>;
|
|
|
10
10
|
* @see https://www.figma.com/design/3mGpZEE65cSuLnhtJBfKkO?node-id=6867-21363
|
|
11
11
|
*/
|
|
12
12
|
export declare const SANKEY_NODE_COLOR_TOKENS_DARK: Array<string>;
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
13
|
+
export declare const SANKEY_NODE_DEFAULT_WIDTH = 16;
|
|
14
|
+
export declare const SANKEY_NODE_DEFAULT_PADDING = 40;
|
|
15
|
+
export declare const SANKEY_LINK_DEFAULT_OPACITY = 0.35;
|
|
16
|
+
export declare const SANKEY_LINK_DEFAULT_HOVER_OPACITY = 0.6;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from './SankeyChart';
|
|
2
|
-
export * from './parts/
|
|
3
|
-
export * from './parts/
|
|
2
|
+
export * from './parts/SankeyChartNode';
|
|
3
|
+
export * from './parts/SankeyChartLink';
|
|
4
4
|
export * from './useSankeyController';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export * from './constants';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SankeyChartLinkExtended } from '../types';
|
|
3
|
+
export interface SankeyChartLinkProps {
|
|
4
|
+
link: SankeyChartLinkExtended;
|
|
5
|
+
/** Single color when gradient is not used */
|
|
6
|
+
color?: string;
|
|
7
|
+
/** When set with targetColor, link stroke is a gradient from source to target */
|
|
8
|
+
sourceColor?: string;
|
|
9
|
+
targetColor?: string;
|
|
10
|
+
/** Unique suffix for gradient id (e.g. link index) when multiple links share same source/target */
|
|
11
|
+
gradientIdSuffix?: string | number;
|
|
12
|
+
opacity: number;
|
|
13
|
+
hoverOpacity: number;
|
|
14
|
+
pathGenerator: (link: SankeyChartLinkExtended, ...args: Array<any>) => string | null;
|
|
15
|
+
onMouseEnter?: (link: SankeyChartLinkExtended, event: React.MouseEvent) => void;
|
|
16
|
+
onMouseLeave?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const SankeyChartLink: React.MemoExoticComponent<({ link, color, sourceColor, targetColor, gradientIdSuffix, opacity, hoverOpacity, pathGenerator, onMouseEnter, onMouseLeave, }: SankeyChartLinkProps) => React.JSX.Element | null>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SankeyChartData } from '../types';
|
|
3
|
+
import { ChartMenuProps } from '../../components/ChartMenu';
|
|
4
|
+
export interface SankeyChartMenuProps extends Omit<ChartMenuProps, 'csvData' | 'onFullscreenOpen'> {
|
|
5
|
+
data?: SankeyChartData;
|
|
6
|
+
}
|
|
7
|
+
export declare const SankeyChartMenu: React.MemoExoticComponent<({ data, ...rest }: SankeyChartMenuProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SankeyChartNodeExtended } from '../types';
|
|
3
|
+
export interface SankeyChartNodeProps {
|
|
4
|
+
node: SankeyChartNodeExtended;
|
|
5
|
+
color: string;
|
|
6
|
+
onMouseEnter?: (node: SankeyChartNodeExtended, event: React.MouseEvent) => void;
|
|
7
|
+
onMouseLeave?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const SankeyChartNode: React.MemoExoticComponent<({ node, color, onMouseEnter, onMouseLeave }: SankeyChartNodeProps) => React.JSX.Element>;
|
|
@@ -8,12 +8,12 @@ export interface SankeyLinkDatum {
|
|
|
8
8
|
readonly target: string;
|
|
9
9
|
readonly value: number;
|
|
10
10
|
}
|
|
11
|
-
export interface
|
|
11
|
+
export interface SankeyChartData {
|
|
12
12
|
readonly nodes: ReadonlyArray<SankeyNodeDatum>;
|
|
13
13
|
readonly links: ReadonlyArray<SankeyLinkDatum>;
|
|
14
14
|
}
|
|
15
|
-
export type
|
|
16
|
-
export type
|
|
17
|
-
source:
|
|
18
|
-
target:
|
|
15
|
+
export type SankeyChartNodeExtended = SankeyNodeDatum & SankeyNode<SankeyNodeDatum, SankeyLinkDatum>;
|
|
16
|
+
export type SankeyChartLinkExtended = Omit<SankeyLink<SankeyNodeDatum, SankeyLinkDatum>, 'source' | 'target'> & {
|
|
17
|
+
source: SankeyChartNodeExtended;
|
|
18
|
+
target: SankeyChartNodeExtended;
|
|
19
19
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { ChartMargin } from '../types';
|
|
3
|
-
import {
|
|
3
|
+
import { SankeyChartData, SankeyChartLinkExtended, SankeyChartNodeExtended } from './types';
|
|
4
4
|
interface Props {
|
|
5
|
-
data:
|
|
5
|
+
data: SankeyChartData;
|
|
6
6
|
margin?: ChartMargin;
|
|
7
7
|
nodeWidth?: number;
|
|
8
8
|
nodePadding?: number;
|
|
@@ -12,9 +12,9 @@ interface UseSankeyControllerResult {
|
|
|
12
12
|
readonly rect: DOMRect | null;
|
|
13
13
|
readonly innerWidth: number;
|
|
14
14
|
readonly innerHeight: number;
|
|
15
|
-
readonly nodes: Array<
|
|
16
|
-
readonly links: Array<
|
|
17
|
-
readonly linkPathGenerator: (link:
|
|
15
|
+
readonly nodes: Array<SankeyChartNodeExtended>;
|
|
16
|
+
readonly links: Array<SankeyChartLinkExtended>;
|
|
17
|
+
readonly linkPathGenerator: (link: SankeyChartLinkExtended) => string | null;
|
|
18
18
|
}
|
|
19
19
|
export declare function useSankeyController({ data, margin, nodeWidth, nodePadding }: Props): UseSankeyControllerResult;
|
|
20
20
|
export {};
|
|
@@ -1,22 +1,3 @@
|
|
|
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
1
|
export interface ChartMargin {
|
|
21
2
|
top?: number;
|
|
22
3
|
right?: number;
|
|
@@ -27,41 +8,13 @@ export interface ChartOffset {
|
|
|
27
8
|
x?: number;
|
|
28
9
|
y?: number;
|
|
29
10
|
}
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
11
|
+
export declare enum ChartResolution {
|
|
12
|
+
DAY = "DAY",
|
|
13
|
+
WEEK = "WEEK",
|
|
14
|
+
MONTH = "MONTH",
|
|
15
|
+
YEAR = "YEAR"
|
|
49
16
|
}
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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;
|
|
17
|
+
export declare const CHART_RESOLUTION_LABELS: Array<{
|
|
18
|
+
id: ChartResolution;
|
|
19
|
+
title: string;
|
|
20
|
+
}>;
|
|
@@ -2,7 +2,7 @@ import { default as React } from 'react';
|
|
|
2
2
|
import { FieldValues, Path } from 'react-hook-form';
|
|
3
3
|
import { FormFieldPropsBase } from './types';
|
|
4
4
|
import { SwitchProps } from '../../../chakra/switch';
|
|
5
|
-
export type FormFieldSwitchProps<FormFields extends FieldValues, Name extends Path<FormFields>> = Pick<FormFieldPropsBase<FormFields, Name>, 'name' | '
|
|
6
|
-
declare const FormFieldSwitchContent: <FormFields extends FieldValues, Name extends Path<FormFields>>({ name,
|
|
5
|
+
export type FormFieldSwitchProps<FormFields extends FieldValues, Name extends Path<FormFields>> = Pick<FormFieldPropsBase<FormFields, Name>, 'name' | 'rules' | 'controllerProps'> & SwitchProps;
|
|
6
|
+
declare const FormFieldSwitchContent: <FormFields extends FieldValues, Name extends Path<FormFields>>({ name, onCheckedChange, rules, controllerProps, disabled, children, ...rest }: FormFieldSwitchProps<FormFields, Name>) => React.JSX.Element;
|
|
7
7
|
export declare const FormFieldSwitch: typeof FormFieldSwitchContent;
|
|
8
8
|
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Placement } from '@floating-ui/dom';
|
|
2
1
|
import { default as React } from 'react';
|
|
2
|
+
import { ExcludeUndefined } from '../../../types/utils';
|
|
3
3
|
import { SkeletonTextProps } from '../../chakra/skeleton';
|
|
4
|
+
import { TooltipProps } from '../../chakra/tooltip';
|
|
4
5
|
export interface TruncatedTextProps extends Omit<SkeletonTextProps, 'loading'> {
|
|
5
6
|
text: string;
|
|
6
7
|
loading?: boolean;
|
|
7
8
|
tooltipContent?: string;
|
|
8
|
-
tooltipPlacement?:
|
|
9
|
+
tooltipPlacement?: ExcludeUndefined<TooltipProps['positioning']>['placement'];
|
|
9
10
|
tooltipInteractive?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare const TruncatedText: ({ text, tooltipPlacement, tooltipInteractive, tooltipContent, loading, ...rest }: TruncatedTextProps) => React.JSX.Element;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Placement } from '@floating-ui/dom';
|
|
2
1
|
import { default as React } from 'react';
|
|
2
|
+
import { ExcludeUndefined } from '../../../types/utils';
|
|
3
|
+
import { TooltipProps } from '../../chakra/tooltip';
|
|
3
4
|
export interface TruncatedTextTooltipProps {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
label: React.ReactNode;
|
|
6
|
-
placement?:
|
|
7
|
+
placement?: ExcludeUndefined<TooltipProps['positioning']>['placement'];
|
|
7
8
|
interactive?: boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare const TruncatedTextTooltip: React.MemoExoticComponent<({ children, label, placement, interactive }: TruncatedTextTooltipProps) => React.JSX.Element>;
|
|
@@ -3,8 +3,6 @@ export declare function useClipboard(text: string, timeout?: number): {
|
|
|
3
3
|
copy: () => void;
|
|
4
4
|
disclosure: {
|
|
5
5
|
open: boolean;
|
|
6
|
-
onOpenChange: ({ open }:
|
|
7
|
-
open: boolean;
|
|
8
|
-
}) => void;
|
|
6
|
+
onOpenChange: ({ open }: import('./useDisclosure').OpenChangeDetails) => void;
|
|
9
7
|
};
|
|
10
8
|
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { UseDisclosureProps } from '@chakra-ui/react';
|
|
2
|
+
export interface OpenChangeDetails {
|
|
3
|
+
open: boolean;
|
|
4
|
+
}
|
|
5
|
+
export type OnOpenChangeHandler = (details: OpenChangeDetails) => void;
|
|
2
6
|
export declare function useDisclosure(props?: UseDisclosureProps): {
|
|
3
7
|
open: boolean;
|
|
4
|
-
onOpenChange: ({ open }:
|
|
5
|
-
open: boolean;
|
|
6
|
-
}) => void;
|
|
8
|
+
onOpenChange: ({ open }: OpenChangeDetails) => void;
|
|
7
9
|
onClose: () => void;
|
|
8
10
|
onOpen: () => void;
|
|
9
11
|
onToggle: () => void;
|