@exegia/corpora-ui 2.0.0 → 3.0.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 (55) hide show
  1. package/dist-lib/components/composed/chat/chart/chart-atom.d.ts +30 -0
  2. package/dist-lib/components/composed/chat/chart/chart-context.d.ts +2 -0
  3. package/dist-lib/components/composed/chat/chart/chart-legend.d.ts +4 -0
  4. package/dist-lib/components/composed/chat/chart/chart-plot.d.ts +3 -0
  5. package/dist-lib/components/composed/chat/chart/chart-root.d.ts +3 -0
  6. package/dist-lib/components/composed/chat/chart/chart-tooltip.d.ts +4 -0
  7. package/dist-lib/components/composed/chat/chart/constants.d.ts +3 -0
  8. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-area-chart.d.ts +93 -0
  9. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-bar-chart.d.ts +86 -0
  10. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-brush.d.ts +65 -0
  11. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-chart.d.ts +44 -0
  12. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-dot.d.ts +16 -0
  13. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-legend.d.ts +24 -0
  14. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-line-chart.d.ts +90 -0
  15. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-pie-chart.d.ts +73 -0
  16. package/dist-lib/components/composed/chat/chart/evilcharts/echarts-tooltip.d.ts +29 -0
  17. package/dist-lib/components/composed/chat/chart/index.d.ts +6 -0
  18. package/dist-lib/components/composed/chat/chart/type.d.ts +80 -0
  19. package/dist-lib/components/composed/chat/chart/use-chart-state.d.ts +3 -0
  20. package/dist-lib/components/composed/chat/chart/use-chart.d.ts +6 -0
  21. package/dist-lib/components/composed/chat/chart/utils.d.ts +5 -0
  22. package/dist-lib/components/composed/chat/chart.d.ts +1 -44
  23. package/dist-lib/components/composed/chat/index.d.ts +1 -1
  24. package/dist-lib/components/stories/chart.story.d.ts +39 -2
  25. package/dist-lib/components/stories/insight-cards.story.d.ts +30 -1
  26. package/dist-lib/index.js +10020 -5549
  27. package/dist-lib/index.js.map +1 -1
  28. package/package.json +2 -1
  29. package/src/components/composed/chat/__tests__/chart.test.tsx +255 -1
  30. package/src/components/composed/chat/chart/chart-atom.ts +55 -0
  31. package/src/components/composed/chat/chart/chart-context.ts +9 -0
  32. package/src/components/composed/chat/chart/chart-legend.tsx +75 -0
  33. package/src/components/composed/chat/chart/chart-plot.tsx +233 -0
  34. package/src/components/composed/chat/chart/chart-root.tsx +229 -0
  35. package/src/components/composed/chat/chart/chart-tooltip.tsx +74 -0
  36. package/src/components/composed/chat/chart/constants.ts +8 -0
  37. package/src/components/composed/chat/chart/evilcharts/LICENSE +21 -0
  38. package/src/components/composed/chat/chart/evilcharts/README.md +8 -0
  39. package/src/components/composed/chat/chart/evilcharts/echarts-area-chart.tsx +2358 -0
  40. package/src/components/composed/chat/chart/evilcharts/echarts-bar-chart.tsx +2261 -0
  41. package/src/components/composed/chat/chart/evilcharts/echarts-brush.tsx +233 -0
  42. package/src/components/composed/chat/chart/evilcharts/echarts-chart.tsx +214 -0
  43. package/src/components/composed/chat/chart/evilcharts/echarts-dot.tsx +111 -0
  44. package/src/components/composed/chat/chart/evilcharts/echarts-legend.tsx +131 -0
  45. package/src/components/composed/chat/chart/evilcharts/echarts-line-chart.tsx +2112 -0
  46. package/src/components/composed/chat/chart/evilcharts/echarts-pie-chart.tsx +1235 -0
  47. package/src/components/composed/chat/chart/evilcharts/echarts-tooltip.tsx +125 -0
  48. package/src/components/composed/chat/chart/index.ts +13 -0
  49. package/src/components/composed/chat/chart/type.ts +88 -0
  50. package/src/components/composed/chat/chart/use-chart-state.ts +22 -0
  51. package/src/components/composed/chat/chart/use-chart.ts +70 -0
  52. package/src/components/composed/chat/chart/utils.ts +47 -0
  53. package/src/components/composed/chat/chart.tsx +2 -400
  54. package/src/components/composed/chat/index.ts +1 -7
  55. package/src/components/stories/chart.story.tsx +16 -1
@@ -0,0 +1,80 @@
1
+ import { useRender } from '@base-ui/react/use-render';
2
+ import { Reference } from '../../../atoms/reference';
3
+ import { AreaProps, CurveType, TooltipProps, XAxisProps, YAxisProps } from './evilcharts/echarts-area-chart';
4
+ import { BarProps } from './evilcharts/echarts-bar-chart';
5
+ import { LineProps } from './evilcharts/echarts-line-chart';
6
+ import { PieProps } from './evilcharts/echarts-pie-chart';
7
+ import { BrushProps } from './evilcharts/echarts-brush';
8
+ import { EChartsRenderer } from './evilcharts/echarts-chart';
9
+ import type * as React from "react";
10
+ export type TChartType = "pie" | "area" | "line" | "bar";
11
+ export type TChartVariant = "default" | "stacked" | "percent" | "donut" | "horizontal";
12
+ export type TChartInstanceId = string;
13
+ export type TChartDatum = {
14
+ label: string;
15
+ [key: string]: string | number | null;
16
+ };
17
+ export interface IChartSeries {
18
+ key: string;
19
+ label: React.ReactNode;
20
+ color?: string;
21
+ format?: (value: number) => React.ReactNode;
22
+ area?: Omit<AreaProps, "dataKey" | "children">;
23
+ line?: Omit<LineProps, "dataKey" | "children">;
24
+ bar?: Omit<BarProps, "dataKey">;
25
+ }
26
+ export interface IChartState {
27
+ selectedKey: string | null;
28
+ }
29
+ export interface IChartStateActions {
30
+ select: (key: string | null) => void;
31
+ toggle: (key: string) => void;
32
+ clearSelection: () => void;
33
+ reset: () => void;
34
+ }
35
+ export interface IChartProps extends Omit<React.ComponentPropsWithoutRef<"div">, "title"> {
36
+ type: TChartType;
37
+ /** Unique within the current Jotai store. Omit for an isolated generated id. */
38
+ chartId?: TChartInstanceId;
39
+ title?: React.ReactNode;
40
+ subtitle?: React.ReactNode;
41
+ badge?: React.ReactNode;
42
+ reference?: React.ComponentProps<typeof Reference>;
43
+ data: TChartDatum[];
44
+ series: IChartSeries[];
45
+ center?: {
46
+ value: React.ReactNode;
47
+ label?: React.ReactNode;
48
+ };
49
+ headerless?: boolean;
50
+ /** Outer component width. Numbers are pixels; CSS lengths such as "100%" work. */
51
+ width?: React.CSSProperties["width"];
52
+ /** Outer component height, including header and legend. Plot fills remaining space. */
53
+ height?: React.CSSProperties["height"];
54
+ /** Explicit plot height takes precedence over filling the outer height. */
55
+ plotHeight?: React.CSSProperties["height"];
56
+ /** Replace the outer element using the coss/Base UI render API. */
57
+ render?: useRender.ComponentProps<"div">["render"];
58
+ /** stacked/percent: area or bar; horizontal: bar; donut: pie. */
59
+ variant?: TChartVariant;
60
+ renderer?: EChartsRenderer;
61
+ animation?: boolean;
62
+ loading?: boolean;
63
+ emptyContent?: React.ReactNode;
64
+ showLegend?: boolean;
65
+ interactive?: boolean;
66
+ selectedKey?: string | null;
67
+ defaultSelectedKey?: string | null;
68
+ onSelectionChange?: (key: string | null) => void;
69
+ curveType?: CurveType;
70
+ grid?: boolean;
71
+ xAxis?: boolean | XAxisProps;
72
+ yAxis?: boolean | YAxisProps;
73
+ tooltip?: boolean | TooltipProps;
74
+ brush?: boolean | BrushProps;
75
+ pie?: Omit<PieProps, "children">;
76
+ /** ECharts options override generated options at the top level. */
77
+ chartOptions?: Record<string, unknown>;
78
+ /** Selection methods; also available via useChartActions(chartId). */
79
+ ref?: React.Ref<IChartStateActions>;
80
+ }
@@ -0,0 +1,3 @@
1
+ import { IChartStateActions, TChartInstanceId } from './type';
2
+ export declare function useChartState(id: TChartInstanceId): import('./type').IChartState;
3
+ export declare function useChartActions(id: TChartInstanceId): IChartStateActions;
@@ -0,0 +1,6 @@
1
+ import { IChartProps } from './type';
2
+ export declare function useChart(props: IChartProps): {
3
+ id: string;
4
+ selectedKey: string | null;
5
+ actions: import('./type').IChartStateActions;
6
+ };
@@ -0,0 +1,5 @@
1
+ import { ChartConfig } from './evilcharts/echarts-chart';
2
+ import { IChartSeries, TChartDatum, TChartType } from './type';
3
+ export declare function chartSeriesColor(series: IChartSeries, index: number): string;
4
+ export declare function formatChartValue(series: IChartSeries | undefined, value: unknown): import('react').ReactNode;
5
+ export declare function buildChartConfig(type: TChartType, data: TChartDatum[], series: IChartSeries[]): ChartConfig;
@@ -1,44 +1 @@
1
- import { Reference } from '../../atoms/reference';
2
- import type * as React from "react";
3
- export type TChartType = "pie" | "area" | "line" | "bar";
4
- export interface IChartSeries {
5
- /** Key into each data row. */
6
- key: string;
7
- label: React.ReactNode;
8
- /** Defaults to `var(--chart-series-N)` by position. */
9
- color?: string;
10
- /** Renders a value in the legend and tooltip (`v => \`${v}%\``). */
11
- format?: (value: number) => React.ReactNode;
12
- }
13
- export type TChartDatum = {
14
- label: string;
15
- [key: string]: string | number;
16
- };
17
- export interface IChartProps extends Omit<React.ComponentPropsWithoutRef<"div">, "title"> {
18
- type: TChartType;
19
- title?: React.ReactNode;
20
- subtitle?: React.ReactNode;
21
- /** Pill text; defaults to the capitalised type. */
22
- badge?: React.ReactNode;
23
- /** The passage or Strong's entry behind the data. Replaces the type badge. */
24
- reference?: React.ComponentProps<typeof Reference>;
25
- data: TChartDatum[];
26
- /** Series to plot; pie uses the first one. */
27
- series: IChartSeries[];
28
- /** Pie only: big number and caption in the donut's centre. */
29
- center?: {
30
- value: React.ReactNode;
31
- label?: React.ReactNode;
32
- };
33
- /** Drop the title row (InsightCards embeds a bare plot). */
34
- headerless?: boolean;
35
- /** Plot height in px; the card is 244 tall with the header. */
36
- plotHeight?: number;
37
- }
38
- /**
39
- * Compact chart card: title, subtitle, reference or type pill, plot and legend.
40
- * Series colours are the `--chart-series-*` tokens, grid is `--chart-grid`.
41
- *
42
- * @sketch "Component / Chart / {Pie, Area, Line, Bar}"
43
- */
44
- export declare function Chart({ type, title, subtitle, badge, reference, data, series, center, headerless, plotHeight, className, ...props }: IChartProps): React.ReactElement;
1
+ export * from './chart/index';
@@ -1,5 +1,5 @@
1
1
  export { Attachment, type TAttachmentKind, type TAttachmentProps, type TAttachmentVariant, } from './attachment';
2
- export { Chart, type TChartDatum, type IChartProps, type IChartSeries, type TChartType, } from './chart';
2
+ export * from './chart';
3
3
  export { Markdown, markdownViewAtom, removeMarkdownInstance, useMarkdownView, type IMarkdownProps, type TMarkdownView, } from './markdown';
4
4
  export { addComposerAttachmentAtom, clearComposerAttachmentsAtom, CommandMenu, Composer, composerAttachmentsAtom, removeComposerAttachmentAtom, removeComposerInstance, useComposerAttachmentActions, useComposerAttachments, } from './composer';
5
5
  export type { TComposerAttachment, IComposerModel, IComposerOption, IComposerBaseProps, TComposerMode, IComposerSuggestionsProps, IComposerMenuProps, IComposerProps, IComposerSubmitButtonProps, } from './composer';
@@ -4,12 +4,17 @@ export declare const story: import('@fumadocs/story/vite/client').Story<import('
4
4
  label?: string | undefined;
5
5
  } | undefined;
6
6
  data: {
7
- [x: string]: string | number;
7
+ [x: string]: string | number | null;
8
8
  label: string;
9
9
  }[];
10
10
  title?: string | undefined;
11
+ variant?: import('../composed/chat/chart').TChartVariant | undefined;
11
12
  type: import('../composed/chat/chart').TChartType;
13
+ height?: import("csstype").Property.Height<string | number> | undefined;
14
+ width?: import("csstype").Property.Width<string | number> | undefined;
15
+ animation?: boolean | undefined;
12
16
  subtitle?: string | undefined;
17
+ loading?: boolean | undefined;
13
18
  reference?: {
14
19
  href?: string | undefined;
15
20
  target?: React.HTMLAttributeAnchorTarget | undefined;
@@ -27,8 +32,40 @@ export declare const story: import('@fumadocs/story/vite/client').Story<import('
27
32
  label: string;
28
33
  color?: string | undefined;
29
34
  format?: ((value: number) => React.ReactNode) | undefined;
35
+ area?: {
36
+ variant?: import('../composed/chat/chart/evilcharts/echarts-area-chart').AreaVariant | undefined;
37
+ strokeWidth?: number | undefined;
38
+ isClickable?: boolean | undefined;
39
+ curveType?: import('../composed/chat/chart/evilcharts/echarts-area-chart').CurveType | undefined;
40
+ connectNulls?: boolean | undefined;
41
+ animationType?: import('../composed/chat/chart/evilcharts/echarts-area-chart').AreaAnimationType | undefined;
42
+ strokeVariant?: import('../composed/chat/chart/evilcharts/echarts-area-chart').StrokeVariant | undefined;
43
+ enableBufferLine?: boolean | undefined;
44
+ } | undefined;
45
+ line?: {
46
+ strokeWidth?: number | undefined;
47
+ isClickable?: boolean | undefined;
48
+ curveType?: import('../composed/chat/chart/evilcharts/echarts-line-chart').CurveType | undefined;
49
+ connectNulls?: boolean | undefined;
50
+ animationType?: import('../composed/chat/chart/evilcharts/echarts-line-chart').LineAnimationType | undefined;
51
+ strokeVariant?: import('../composed/chat/chart/evilcharts/echarts-line-chart').StrokeVariant | undefined;
52
+ enableBufferLine?: boolean | undefined;
53
+ glowing?: boolean | undefined;
54
+ } | undefined;
55
+ bar?: {
56
+ radius?: number | undefined;
57
+ variant?: import('../composed/chat/chart/evilcharts/echarts-bar-chart').BarVariant | undefined;
58
+ isClickable?: boolean | undefined;
59
+ enableHoverHighlight?: boolean | undefined;
60
+ animationType?: import('../composed/chat/chart/evilcharts/echarts-bar-chart').BarAnimationType | undefined;
61
+ glowing?: boolean | undefined;
62
+ bufferBar?: boolean | undefined;
63
+ } | undefined;
30
64
  }[];
65
+ renderer?: import('../composed/chat/chart/evilcharts/echarts-chart').EChartsRenderer | undefined;
31
66
  headerless?: boolean | undefined;
32
- plotHeight?: number | undefined;
67
+ plotHeight?: import("csstype").Property.Height<string | number> | undefined;
68
+ showLegend?: boolean | undefined;
69
+ interactive?: boolean | undefined;
33
70
  }>>;
34
71
  export declare const Preview: import('react').FC;
@@ -8,7 +8,7 @@ export declare const story: import('@fumadocs/story/vite/client').Story<import('
8
8
  label?: string | undefined;
9
9
  badge?: string | undefined;
10
10
  data: {
11
- [x: string]: string | number;
11
+ [x: string]: string | number | null;
12
12
  label: string;
13
13
  }[];
14
14
  series: {
@@ -16,6 +16,35 @@ export declare const story: import('@fumadocs/story/vite/client').Story<import('
16
16
  label: string;
17
17
  color?: string | undefined;
18
18
  format?: ((value: number) => React.ReactNode) | undefined;
19
+ area?: {
20
+ variant?: import('../composed/chat/chart/evilcharts/echarts-area-chart').AreaVariant | undefined;
21
+ strokeWidth?: number | undefined;
22
+ isClickable?: boolean | undefined;
23
+ curveType?: import('../composed/chat/chart/evilcharts/echarts-area-chart').CurveType | undefined;
24
+ connectNulls?: boolean | undefined;
25
+ animationType?: import('../composed/chat/chart/evilcharts/echarts-area-chart').AreaAnimationType | undefined;
26
+ strokeVariant?: import('../composed/chat/chart/evilcharts/echarts-area-chart').StrokeVariant | undefined;
27
+ enableBufferLine?: boolean | undefined;
28
+ } | undefined;
29
+ line?: {
30
+ strokeWidth?: number | undefined;
31
+ isClickable?: boolean | undefined;
32
+ curveType?: import('../composed/chat/chart/evilcharts/echarts-line-chart').CurveType | undefined;
33
+ connectNulls?: boolean | undefined;
34
+ animationType?: import('../composed/chat/chart/evilcharts/echarts-line-chart').LineAnimationType | undefined;
35
+ strokeVariant?: import('../composed/chat/chart/evilcharts/echarts-line-chart').StrokeVariant | undefined;
36
+ enableBufferLine?: boolean | undefined;
37
+ glowing?: boolean | undefined;
38
+ } | undefined;
39
+ bar?: {
40
+ radius?: number | undefined;
41
+ variant?: import('../composed/chat/chart/evilcharts/echarts-bar-chart').BarVariant | undefined;
42
+ isClickable?: boolean | undefined;
43
+ enableHoverHighlight?: boolean | undefined;
44
+ animationType?: import('../composed/chat/chart/evilcharts/echarts-bar-chart').BarAnimationType | undefined;
45
+ glowing?: boolean | undefined;
46
+ bufferBar?: boolean | undefined;
47
+ } | undefined;
19
48
  }[];
20
49
  } | undefined;
21
50
  allocation?: {