@blockscout/ui-toolkit 2.7.3 → 2.7.8-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.
Files changed (86) hide show
  1. package/README.md +6 -6
  2. package/dist/chakra/checkbox.d.ts +2 -3
  3. package/dist/chakra/select.d.ts +8 -0
  4. package/dist/chakra/status.d.ts +5 -0
  5. package/dist/chakra/toaster.d.ts +2 -1
  6. package/dist/components/AdaptiveTabs/AdaptiveTabsList.d.ts +5 -1
  7. package/dist/components/charts/components/ChartContent.d.ts +10 -0
  8. package/dist/components/charts/components/ChartDialog.d.ts +11 -0
  9. package/dist/components/charts/components/ChartMenu.d.ts +15 -0
  10. package/dist/components/charts/components/ChartResetZoomButton.d.ts +5 -0
  11. package/dist/components/charts/components/ChartWidget.d.ts +12 -0
  12. package/dist/components/charts/components/index.d.ts +6 -0
  13. package/dist/components/charts/index.d.ts +3 -17
  14. package/dist/components/charts/line/LineChart.d.ts +14 -0
  15. package/dist/components/charts/line/LineChartContent.d.ts +6 -0
  16. package/dist/components/charts/line/LineChartModal.d.ts +13 -0
  17. package/dist/components/charts/line/LineChartWidget.d.ts +19 -0
  18. package/dist/components/charts/line/index.d.ts +17 -0
  19. package/dist/components/charts/{parts/ChartArea.d.ts → line/parts/LineChartArea.d.ts} +4 -4
  20. package/dist/components/charts/{parts/ChartAxis.d.ts → line/parts/LineChartAxis.d.ts} +2 -2
  21. package/dist/components/charts/line/parts/LineChartGridLine.d.ts +10 -0
  22. package/dist/components/charts/line/parts/LineChartLegend.d.ts +9 -0
  23. package/dist/components/charts/line/parts/LineChartLine.d.ts +11 -0
  24. package/dist/components/charts/line/parts/LineChartMenu.d.ts +13 -0
  25. package/dist/components/charts/line/parts/LineChartOverlay.d.ts +7 -0
  26. package/dist/components/charts/line/parts/LineChartSelectionX.d.ts +11 -0
  27. package/dist/components/charts/line/parts/LineChartTooltip.d.ts +16 -0
  28. package/dist/components/charts/{parts/tooltip/ChartTooltipPoint.d.ts → line/parts/tooltip/LineChartTooltipPoint.d.ts} +3 -3
  29. package/dist/components/charts/{parts/tooltip/ChartTooltipRow.d.ts → line/parts/tooltip/LineChartTooltipRow.d.ts} +3 -3
  30. package/dist/components/charts/{parts/tooltip/ChartTooltipTitle.d.ts → line/parts/tooltip/LineChartTooltipTitle.d.ts} +2 -2
  31. package/dist/components/charts/line/types.d.ts +51 -0
  32. package/dist/components/charts/line/utils/formatters.d.ts +2 -0
  33. package/dist/components/charts/line/utils/getDateLabel.d.ts +2 -0
  34. package/dist/components/charts/{utils/timeChartAxis.d.ts → line/utils/lineChartAxis.d.ts} +3 -3
  35. package/dist/components/charts/{utils/useChartBrushX.d.ts → line/utils/useLineChartBrushX.d.ts} +1 -1
  36. package/dist/components/charts/{utils/useTimeChartController.d.ts → line/utils/useLineChartController.d.ts} +7 -6
  37. package/dist/components/charts/{utils/useChartLegend.d.ts → line/utils/useLineChartLegend.d.ts} +1 -1
  38. package/dist/components/charts/{utils/useChartZoom.d.ts → line/utils/useLineChartZoom.d.ts} +1 -1
  39. package/dist/components/charts/sankey/SankeyChart.d.ts +2 -2
  40. package/dist/components/charts/sankey/SankeyChartContent.d.ts +8 -0
  41. package/dist/components/charts/sankey/SankeyChartModal.d.ts +7 -0
  42. package/dist/components/charts/sankey/SankeyChartWidget.d.ts +14 -0
  43. package/dist/components/charts/sankey/constants.d.ts +4 -4
  44. package/dist/components/charts/sankey/index.d.ts +2 -2
  45. package/dist/components/charts/sankey/parts/SankeyChartLink.d.ts +18 -0
  46. package/dist/components/charts/sankey/parts/SankeyChartMenu.d.ts +7 -0
  47. package/dist/components/charts/sankey/parts/SankeyChartNode.d.ts +9 -0
  48. package/dist/components/charts/sankey/types.d.ts +5 -5
  49. package/dist/components/charts/sankey/useSankeyController.d.ts +5 -5
  50. package/dist/components/charts/types.d.ts +9 -56
  51. package/dist/components/forms/fields/FormFieldSwitch.d.ts +2 -2
  52. package/dist/components/truncation/TruncatedText.d.ts +3 -2
  53. package/dist/components/truncation/TruncatedTextTooltip.d.ts +3 -2
  54. package/dist/hooks/useClipboard.d.ts +1 -3
  55. package/dist/hooks/useDisclosure.d.ts +5 -3
  56. package/dist/index.js +7649 -5358
  57. package/dist/package/src/index.d.ts +1 -0
  58. package/dist/theme/recipes/badge.recipe.d.ts +0 -1
  59. package/dist/theme/recipes/button.recipe.d.ts +8 -0
  60. package/dist/theme/recipes/code.recipe.d.ts +2 -100
  61. package/dist/theme/recipes/index.d.ts +32 -101
  62. package/dist/theme/recipes/status.recipe.d.ts +22 -0
  63. package/dist/utils/file.d.ts +1 -1
  64. package/package.json +3 -7
  65. package/dist/components/charts/Chart.d.ts +0 -13
  66. package/dist/components/charts/ChartFullscreenDialog.d.ts +0 -17
  67. package/dist/components/charts/ChartWidget.d.ts +0 -19
  68. package/dist/components/charts/ChartWidgetContent.d.ts +0 -17
  69. package/dist/components/charts/parts/ChartGridLine.d.ts +0 -10
  70. package/dist/components/charts/parts/ChartLegend.d.ts +0 -9
  71. package/dist/components/charts/parts/ChartLine.d.ts +0 -11
  72. package/dist/components/charts/parts/ChartMenu.d.ts +0 -19
  73. package/dist/components/charts/parts/ChartOverlay.d.ts +0 -7
  74. package/dist/components/charts/parts/ChartSelectionX.d.ts +0 -11
  75. package/dist/components/charts/parts/ChartTooltip.d.ts +0 -15
  76. package/dist/components/charts/sankey/parts/SankeyLink.d.ts +0 -18
  77. package/dist/components/charts/sankey/parts/SankeyNode.d.ts +0 -9
  78. package/dist/components/charts/utils/formatters.d.ts +0 -2
  79. package/dist/components/charts/utils/getDateLabel.d.ts +0 -2
  80. /package/dist/components/charts/{parts → components}/ChartWatermark.d.ts +0 -0
  81. /package/dist/components/charts/{parts/tooltip/ChartTooltipBackdrop.d.ts → line/parts/tooltip/LineChartTooltipBackdrop.d.ts} +0 -0
  82. /package/dist/components/charts/{parts/tooltip/ChartTooltipContent.d.ts → line/parts/tooltip/LineChartTooltipContent.d.ts} +0 -0
  83. /package/dist/components/charts/{parts/tooltip/ChartTooltipLine.d.ts → line/parts/tooltip/LineChartTooltipLine.d.ts} +0 -0
  84. /package/dist/components/charts/{parts → line/parts}/tooltip/pointerTracker.d.ts +0 -0
  85. /package/dist/components/charts/{parts → line/parts}/tooltip/utils.d.ts +0 -0
  86. /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 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;
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/SankeyNode';
3
- export * from './parts/SankeyLink';
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 SankeyData {
11
+ export interface SankeyChartData {
12
12
  readonly nodes: ReadonlyArray<SankeyNodeDatum>;
13
13
  readonly links: ReadonlyArray<SankeyLinkDatum>;
14
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;
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 { SankeyData, SankeyLinkExtended, SankeyNodeExtended } from './types';
3
+ import { SankeyChartData, SankeyChartLinkExtended, SankeyChartNodeExtended } from './types';
4
4
  interface Props {
5
- data: SankeyData;
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<SankeyNodeExtended>;
16
- readonly links: Array<SankeyLinkExtended>;
17
- readonly linkPathGenerator: (link: SankeyLinkExtended) => string | null;
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 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;
11
+ export declare enum ChartResolution {
12
+ DAY = "DAY",
13
+ WEEK = "WEEK",
14
+ MONTH = "MONTH",
15
+ YEAR = "YEAR"
49
16
  }
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;
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' | 'placeholder' | 'rules' | 'controllerProps'> & SwitchProps;
6
- declare const FormFieldSwitchContent: <FormFields extends FieldValues, Name extends Path<FormFields>>({ name, placeholder, onCheckedChange, rules, controllerProps, disabled, ...rest }: FormFieldSwitchProps<FormFields, Name>) => React.JSX.Element;
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?: Placement;
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?: 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;