@blockscout/ui-toolkit 2.7.0-alpha.1 → 2.7.0-alpha.3
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 +2 -2
- package/dist/chakra/collapsible.d.ts +2 -1
- package/dist/chakra/select.d.ts +3 -0
- package/dist/components/charts/sankey/SankeyChart.d.ts +16 -0
- package/dist/components/charts/sankey/constants.d.ts +16 -0
- package/dist/components/charts/sankey/index.d.ts +6 -0
- package/dist/components/charts/sankey/parts/SankeyLink.d.ts +18 -0
- package/dist/components/charts/sankey/parts/SankeyNode.d.ts +9 -0
- package/dist/components/charts/sankey/types.d.ts +19 -0
- package/dist/components/charts/sankey/useSankeyController.d.ts +20 -0
- package/dist/index.js +2882 -2798
- package/dist/theme/recipes/button.recipe.d.ts +40 -2
- package/dist/theme/recipes/index.d.ts +41 -3
- package/dist/theme/recipes/select.recipe.d.ts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Ensure you have the following peer dependencies installed:
|
|
|
32
32
|
{
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@blockscout/ui-toolkit": "latest",
|
|
35
|
-
"@chakra-ui/react": ">=3.
|
|
35
|
+
"@chakra-ui/react": ">=3.33.0",
|
|
36
36
|
"@emotion/react": ">=11.14.0",
|
|
37
37
|
"@uidotdev/usehooks": ">=2.4.1",
|
|
38
38
|
"d3": ">=7.6.1",
|
|
@@ -46,7 +46,7 @@ Ensure you have the following peer dependencies installed:
|
|
|
46
46
|
"react-hook-form": ">=7.52.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@chakra-ui/cli": ">=3.
|
|
49
|
+
"@chakra-ui/cli": ">=3.33.0",
|
|
50
50
|
"@types/node": "^20",
|
|
51
51
|
"@types/react": "18.3.12",
|
|
52
52
|
"@types/react-dom": "18.3.1",
|
|
@@ -14,7 +14,8 @@ interface CollapsibleListProps<T> extends FlexProps {
|
|
|
14
14
|
renderItem: (item: T, index: number) => React.ReactNode;
|
|
15
15
|
triggerProps?: LinkProps;
|
|
16
16
|
cutLength?: number;
|
|
17
|
-
text?: [
|
|
17
|
+
text?: [React.ReactNode, React.ReactNode];
|
|
18
|
+
defaultExpanded?: boolean;
|
|
18
19
|
}
|
|
19
20
|
export declare const CollapsibleList: <T>(props: CollapsibleListProps<T>) => React.JSX.Element;
|
|
20
21
|
export {};
|
package/dist/chakra/select.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface SelectOption<Value extends string = string> {
|
|
|
6
6
|
renderLabel?: () => React.ReactNode;
|
|
7
7
|
value: Value;
|
|
8
8
|
icon?: React.ReactNode;
|
|
9
|
+
afterElement?: React.ReactNode;
|
|
9
10
|
}
|
|
10
11
|
export interface SelectControlProps extends ChakraSelect.ControlProps {
|
|
11
12
|
noIndicator?: boolean;
|
|
@@ -48,6 +49,8 @@ export interface SelectProps extends SelectRootProps {
|
|
|
48
49
|
loading?: boolean;
|
|
49
50
|
errorText?: string;
|
|
50
51
|
contentProps?: SelectContentProps;
|
|
52
|
+
contentHeader?: React.ReactNode;
|
|
53
|
+
itemFilter?: (item: SelectOption) => boolean;
|
|
51
54
|
mode?: ViewMode;
|
|
52
55
|
}
|
|
53
56
|
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartMargin } from '../types';
|
|
3
|
+
import { SankeyData } from './types';
|
|
4
|
+
export type SankeyLinkColorMode = 'source' | 'target';
|
|
5
|
+
export interface SankeyChartProps {
|
|
6
|
+
data: SankeyData;
|
|
7
|
+
margin?: ChartMargin;
|
|
8
|
+
nodeWidth?: number;
|
|
9
|
+
nodePadding?: number;
|
|
10
|
+
linkOpacity?: number;
|
|
11
|
+
linkHoverOpacity?: number;
|
|
12
|
+
linkColorMode?: SankeyLinkColorMode;
|
|
13
|
+
colors?: ReadonlyArray<string>;
|
|
14
|
+
valueFormatter?: (value: number) => string;
|
|
15
|
+
}
|
|
16
|
+
export declare const SankeyChart: React.MemoExoticComponent<({ data, margin: marginProps, nodeWidth, nodePadding, linkOpacity, linkHoverOpacity, linkColorMode, colors: colorsProp, valueFormatter, }: SankeyChartProps) => React.JSX.Element>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sankey node color tokens from Figma (Universal Bridge Indexer).
|
|
3
|
+
* Light theme: Chakra 300 palette. Resolved via useToken in the chart.
|
|
4
|
+
* @see https://www.figma.com/design/3mGpZEE65cSuLnhtJBfKkO?node-id=6867-20752
|
|
5
|
+
*/
|
|
6
|
+
export declare const SANKEY_NODE_COLOR_TOKENS_LIGHT: Array<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Sankey node color tokens from Figma (Universal Bridge Indexer).
|
|
9
|
+
* Dark theme: Chakra 700 palette. Resolved via useToken in the chart.
|
|
10
|
+
* @see https://www.figma.com/design/3mGpZEE65cSuLnhtJBfKkO?node-id=6867-21363
|
|
11
|
+
*/
|
|
12
|
+
export declare const SANKEY_NODE_COLOR_TOKENS_DARK: Array<string>;
|
|
13
|
+
export declare const DEFAULT_SANKEY_NODE_WIDTH = 16;
|
|
14
|
+
export declare const DEFAULT_SANKEY_NODE_PADDING = 40;
|
|
15
|
+
export declare const DEFAULT_SANKEY_LINK_OPACITY = 0.35;
|
|
16
|
+
export declare const DEFAULT_SANKEY_LINK_HOVER_OPACITY = 0.6;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SankeyLinkExtended } from '../types';
|
|
3
|
+
export interface SankeyLinkProps {
|
|
4
|
+
link: SankeyLinkExtended;
|
|
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: SankeyLinkExtended, ...args: Array<any>) => string | null;
|
|
15
|
+
onMouseEnter?: (link: SankeyLinkExtended, event: React.MouseEvent) => void;
|
|
16
|
+
onMouseLeave?: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare const SankeyLink: React.MemoExoticComponent<({ link, color, sourceColor, targetColor, gradientIdSuffix, opacity, hoverOpacity, pathGenerator, onMouseEnter, onMouseLeave, }: SankeyLinkProps) => React.JSX.Element | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { SankeyNodeExtended } from '../types';
|
|
3
|
+
export interface SankeyNodeProps {
|
|
4
|
+
node: SankeyNodeExtended;
|
|
5
|
+
color: string;
|
|
6
|
+
onMouseEnter?: (node: SankeyNodeExtended, event: React.MouseEvent) => void;
|
|
7
|
+
onMouseLeave?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const SankeyNode: React.MemoExoticComponent<({ node, color, onMouseEnter, onMouseLeave }: SankeyNodeProps) => React.JSX.Element | null>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SankeyNode, SankeyLink } from 'd3-sankey';
|
|
2
|
+
export interface SankeyNodeDatum {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SankeyLinkDatum {
|
|
7
|
+
readonly source: string;
|
|
8
|
+
readonly target: string;
|
|
9
|
+
readonly value: number;
|
|
10
|
+
}
|
|
11
|
+
export interface SankeyData {
|
|
12
|
+
readonly nodes: ReadonlyArray<SankeyNodeDatum>;
|
|
13
|
+
readonly links: ReadonlyArray<SankeyLinkDatum>;
|
|
14
|
+
}
|
|
15
|
+
export type SankeyNodeExtended = SankeyNodeDatum & SankeyNode<SankeyNodeDatum, SankeyLinkDatum>;
|
|
16
|
+
export type SankeyLinkExtended = Omit<SankeyLink<SankeyNodeDatum, SankeyLinkDatum>, 'source' | 'target'> & {
|
|
17
|
+
source: SankeyNodeExtended;
|
|
18
|
+
target: SankeyNodeExtended;
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ChartMargin } from '../types';
|
|
3
|
+
import { SankeyData, SankeyLinkExtended, SankeyNodeExtended } from './types';
|
|
4
|
+
interface Props {
|
|
5
|
+
data: SankeyData;
|
|
6
|
+
margin?: ChartMargin;
|
|
7
|
+
nodeWidth?: number;
|
|
8
|
+
nodePadding?: number;
|
|
9
|
+
}
|
|
10
|
+
interface UseSankeyControllerResult {
|
|
11
|
+
ref: React.Ref<SVGSVGElement> | undefined;
|
|
12
|
+
readonly rect: DOMRect | null;
|
|
13
|
+
readonly innerWidth: number;
|
|
14
|
+
readonly innerHeight: number;
|
|
15
|
+
readonly nodes: Array<SankeyNodeExtended>;
|
|
16
|
+
readonly links: Array<SankeyLinkExtended>;
|
|
17
|
+
readonly linkPathGenerator: (link: SankeyLinkExtended) => string | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function useSankeyController({ data, margin, nodeWidth, nodePadding }: Props): UseSankeyControllerResult;
|
|
20
|
+
export {};
|