@pushwoosh/kit-charts 0.0.25 → 0.1.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.
@@ -266,9 +266,9 @@ It therefore carries none of the application-template configuration — no
266
266
  reads one), no `.browserslistrc` and no `.stylelintrc`. Only what something
267
267
  actually reads is here: `tsconfig.json`, `playground/tsconfig.json`,
268
268
  `eslint.config.mjs` (the engine's config plus this project's two rules),
269
- `pushwoosh.config.js`, and `jest.config.js`.
269
+ `pushwoosh.config.js`, and `vitest.config.mts`.
270
270
 
271
- `jest.config.js` is hand-written because the engine has no test runner. The
271
+ `vitest.config.mts` is hand-written because the engine has no test runner. The
272
272
  `playground` script runs the command `lib:command:playground` prints (backticks, like the
273
273
  engine's `app:command:*`): since engine 3.1.3 it names webpack-dev-server and the playground
274
274
  config by absolute paths inside the engine, so the package needs no webpack of its own.
@@ -337,7 +337,7 @@ Two mechanisms, chosen by the shape being moved.
337
337
 
338
338
  **CSS transitions** carry shapes whose geometry interpolates correctly component by
339
339
  component: the vertices of a line or an area, and the `x`/`y`/`width`/`height` of a
340
- column. `SeriesLayer` in `Chart.styles.ts` owns those.
340
+ column. `SeriesLayer` in `Chart/styles.ts` owns those.
341
341
 
342
342
  **A frame-by-frame tween** (`useTweenedNumbers`) carries shapes that are *generated*
343
343
  from numbers, where blending the drawing instructions is not the same as blending
@@ -416,7 +416,7 @@ Golden cases: `tooltip/callout`, `tooltip/shared-formatter`.
416
416
  ## Styling
417
417
 
418
418
  The library ships no inline styles: everything visual is either an SVG
419
- presentation attribute or a styled-component in `*.styles.ts`. Every layout
419
+ presentation attribute or a styled-component in `styles.ts`. Every layout
420
420
  distance — label gaps, axis gutters, legend rows, tooltip padding — is a named
421
421
  constant in `src/core/layout/metrics.ts`, not a number typed at the point of use;
422
422
  that is what keeps the chrome consistent across components. Fonts, greys and
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { Grid, XAxis, XAxisLine, YAxis } from './Axes';
4
- import { Canvas, Centred, Container, PinnedAxes, ResetZoom, ScrollBox, SeriesLayer, TooltipCell, TooltipDivider, TooltipHeadCell, TooltipName, TooltipRow, TooltipSeriesCell, TooltipSeriesInner, TooltipSwatch, TooltipTable, TooltipTitle, TooltipValue, ZoomBand } from './Chart.styles';
5
4
  import { ChartErrorBoundary } from './ChartErrorBoundary';
6
5
  import { Legend } from './Legend';
7
6
  import { PlotDecorations } from './PlotDecorations';
8
7
  import { StackLabels } from './StackLabels';
8
+ import { Canvas, Centred, Container, PinnedAxes, ResetZoom, ScrollBox, SeriesLayer, TooltipCell, TooltipDivider, TooltipHeadCell, TooltipName, TooltipRow, TooltipSeriesCell, TooltipSeriesInner, TooltipSwatch, TooltipTable, TooltipTitle, TooltipValue, ZoomBand } from './styles';
9
9
  import { Titles } from './Titles';
10
10
  import { Tooltip } from './Tooltip';
11
11
  import { useSize } from './useSize';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LegendItemBox } from './Chart.styles';
2
+ import { LegendItemBox } from './styles';
3
3
  import { layoutLegend } from '../layout/legend-layout';
4
4
  import { measureText, DEFAULT_FONT_SIZE } from '../layout/measure-text';
5
5
  import { TEXT_BASELINE_SHIFT } from '../layout/metrics';
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { HintIcon } from './Chart.styles';
3
2
  import { Hinted } from './Hinted';
3
+ import { HintIcon } from './styles';
4
4
  import { DEFAULT_FONT_SIZE } from '../layout/measure-text';
5
5
  import { HINT_ICON_RADIUS, HINT_ICON_SIZE } from '../layout/metrics';
6
6
  import { DEFAULT_MUTED_TEXT_COLOR, DEFAULT_TEXT_COLOR } from '../model/palette';
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useLayoutEffect, useRef, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
- import { DEFAULTS, Tail, TooltipBox } from './Chart.styles';
4
+ import { DEFAULTS, Tail, TooltipBox } from './styles';
5
5
  import { TOOLTIP_ANCHOR_GAP, TOOLTIP_CURSOR_OFFSET, TOOLTIP_PADDING, TOOLTIP_RADIUS, TOOLTIP_TAIL_HEIGHT, TOOLTIP_TAIL_WIDTH, VIEWPORT_MARGIN } from '../layout/metrics';
6
6
  const SHADOW_COLOR = 'rgba(0, 0, 0, 0.12)';
7
7
  const DEFAULT_SHADOW = `0 2px 8px ${SHADOW_COLOR}`;
@@ -0,0 +1,159 @@
1
+ export interface ContainerProps {
2
+ $width: string;
3
+ $height: string;
4
+ $autoHeight: boolean;
5
+ $background: string | undefined;
6
+ $fontFamily: string;
7
+ $fontSize: string;
8
+ }
9
+ export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
10
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
11
+ }, ContainerProps>> & string;
12
+ export declare const ScrollBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
13
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
14
+ }, {
15
+ $scrolls: boolean;
16
+ }>> & string;
17
+ /**
18
+ * The y axes of a horizontally scrolling chart, drawn in their own layer over
19
+ * the scroll box so the plot slides under them instead of taking them with it —
20
+ * a row-label column is useless once it has scrolled off. Highcharts does the
21
+ * same with a second, fixed SVG.
22
+ */
23
+ export declare const PinnedAxes: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").SVGProps<SVGSVGElement>, "style"> & {
24
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
25
+ }> & string;
26
+ export declare const Canvas: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").SVGProps<SVGSVGElement>, "style"> & {
27
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
28
+ }, {
29
+ $clickable?: boolean;
30
+ }>> & string;
31
+ /**
32
+ * One series. Hiding it never drops it from the tree, so the change can play: the
33
+ * geometry transitions carry every shape to where the renderer put it — collapsed
34
+ * onto its own baseline, or rescaled by the axis the remaining series left behind —
35
+ * and the opacity mops up the rest. `d` is animatable in Chromium; the attribute
36
+ * transitions cover columns, cells and markers everywhere.
37
+ */
38
+ export declare const SeriesLayer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").SVGProps<SVGGElement>, "style"> & {
39
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
40
+ }, {
41
+ $hidden: boolean;
42
+ $collapse: boolean;
43
+ $selfAnimated: boolean;
44
+ /** Opacity while another series is hovered, from `states.inactive`. */
45
+ $inactive?: number;
46
+ /** `series.opacity`: the whole series faded, border and labels included. */
47
+ $opacity?: number;
48
+ /** `series.animation`; the chart clock unless this series asked for its own. */
49
+ $motionMs: number;
50
+ $cursor: string;
51
+ }>> & string;
52
+ export declare const LegendItemBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").SVGProps<SVGGElement>, "style"> & {
53
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
54
+ }, {
55
+ $off: boolean;
56
+ $interactive: boolean;
57
+ $hoverColor?: string;
58
+ $hoverWeight?: string;
59
+ }>> & string;
60
+ /** The hint badge beside a title: a light square with a blue glyph, as in the CP. */
61
+ export declare const HintIcon: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").SVGProps<SVGGElement>, "style"> & {
62
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
63
+ }> & string;
64
+ export declare const Centred: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
65
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
66
+ }> & string;
67
+ export interface TooltipBoxProps {
68
+ $x: number;
69
+ $y: number;
70
+ $padding: number;
71
+ $radius: number;
72
+ $borderColor: string;
73
+ $background: string;
74
+ $color: string;
75
+ $fontFamily: string;
76
+ $fontSize: string;
77
+ $whiteSpace: string;
78
+ $shadow: string;
79
+ }
80
+ export declare const TooltipBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
81
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
82
+ }, TooltipBoxProps>> & string;
83
+ /** Edge of the box the beak sits on, named after that edge. */
84
+ export type TailSide = 'top' | 'right' | 'bottom' | 'left';
85
+ export interface TailProps {
86
+ $offset: number;
87
+ $width: number;
88
+ $height: number;
89
+ $side: TailSide;
90
+ }
91
+ /** The callout beak; an SVG, so it can carry the box border and cut it at the base. */
92
+ export declare const Tail: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").SVGProps<SVGSVGElement>, "style"> & {
93
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
94
+ }, TailProps>> & string;
95
+ export declare const TooltipTitle: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
96
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
97
+ }> & string;
98
+ export declare const TooltipRow: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
99
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
100
+ }> & string;
101
+ export declare const TooltipSwatch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
102
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
103
+ }, {
104
+ $color: string;
105
+ $round?: boolean;
106
+ }>> & string;
107
+ export declare const TooltipName: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
108
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
109
+ }> & string;
110
+ export declare const TooltipValue: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
111
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
112
+ }> & string;
113
+ export declare const DEFAULTS: {
114
+ fontFamily: string;
115
+ fontSize: string;
116
+ border: string;
117
+ surface: string;
118
+ text: string;
119
+ tooltipSurface: string;
120
+ tooltipText: string;
121
+ };
122
+ /**
123
+ * The table layout of the tooltip. A heading row plus one row per series, so a
124
+ * count and its share line up in columns instead of running together on one line.
125
+ */
126
+ export declare const TooltipTable: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "style"> & {
127
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
128
+ }> & string;
129
+ export declare const TooltipHeadCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, "style"> & {
130
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
131
+ }, {
132
+ $align: "left" | "right";
133
+ }>> & string;
134
+ export declare const TooltipCell: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "style"> & {
135
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
136
+ }, {
137
+ $align: "left" | "right";
138
+ $muted?: boolean;
139
+ }>> & string;
140
+ export declare const TooltipSeriesCell: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, "style"> & {
141
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
142
+ }> & string;
143
+ /** Keeps the swatch on the baseline of the series name inside a table cell. */
144
+ export declare const TooltipSeriesInner: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "style"> & {
145
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
146
+ }> & string;
147
+ /** Separates the header line from the table under it. */
148
+ export declare const TooltipDivider: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
149
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
150
+ }, {
151
+ $color: string;
152
+ }>> & string;
153
+ /** The rectangle dragged out over the plot before the zoom is applied. */
154
+ export declare const ZoomBand: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").SVGProps<SVGRectElement>, "style"> & {
155
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
156
+ }> & string;
157
+ export declare const ResetZoom: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
158
+ style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
159
+ }> & string;
@@ -8,7 +8,7 @@ const TOOLTIP_MAX_WIDTH = '360px';
8
8
  const TOOLTIP_Z_INDEX = 2147483000;
9
9
  export const Container = styled.div.withConfig({
10
10
  displayName: "Container",
11
- componentId: "sc-1pit1b9-0"
11
+ componentId: "sc-1qn3vlx-0"
12
12
  })(["position:relative;width:", ";height:", ";min-width:0;overflow:hidden;min-height:", ";background:", ";font-family:", ";font-size:", ";"], ({
13
13
  $width
14
14
  }) => $width, ({
@@ -24,7 +24,7 @@ export const Container = styled.div.withConfig({
24
24
  }) => $fontSize);
25
25
  export const ScrollBox = styled.div.withConfig({
26
26
  displayName: "ScrollBox",
27
- componentId: "sc-1pit1b9-1"
27
+ componentId: "sc-1qn3vlx-1"
28
28
  })(["", ""], ({
29
29
  $scrolls
30
30
  }) => $scrolls ? css(["overflow-x:auto;overflow-y:hidden;"]) : '');
@@ -36,11 +36,11 @@ export const ScrollBox = styled.div.withConfig({
36
36
  */
37
37
  export const PinnedAxes = styled.svg.withConfig({
38
38
  displayName: "PinnedAxes",
39
- componentId: "sc-1pit1b9-2"
39
+ componentId: "sc-1qn3vlx-2"
40
40
  })(["position:absolute;top:0;left:0;pointer-events:none;"]);
41
41
  export const Canvas = styled.svg.withConfig({
42
42
  displayName: "Canvas",
43
- componentId: "sc-1pit1b9-3"
43
+ componentId: "sc-1qn3vlx-3"
44
44
  })(["display:block;touch-action:none;cursor:", ";"], ({
45
45
  $clickable
46
46
  }) => $clickable ? 'pointer' : 'default');
@@ -53,7 +53,7 @@ export const Canvas = styled.svg.withConfig({
53
53
  */
54
54
  export const SeriesLayer = styled.g.withConfig({
55
55
  displayName: "SeriesLayer",
56
- componentId: "sc-1pit1b9-4"
56
+ componentId: "sc-1qn3vlx-4"
57
57
  })(["opacity:", ";pointer-events:", ";cursor:", ";transition:opacity ", "ms ", ";", " @media (prefers-reduced-motion:reduce){transition:none;path,rect,circle,text{transition:none;}}"], ({
58
58
  $hidden,
59
59
  $inactive,
@@ -75,7 +75,7 @@ export const SeriesLayer = styled.g.withConfig({
75
75
  }) => $selfAnimated ? '' : css(["path,rect,circle,text{transition:d ", "ms ", ",x ", "ms ", ",y ", "ms ", ",width ", "ms ", ",height ", "ms ", ",cx ", "ms ", ",cy ", "ms ", ",opacity ", "ms ", ";}"], $motionMs, MOTION_EASING, $motionMs, MOTION_EASING, $motionMs, MOTION_EASING, $motionMs, MOTION_EASING, $motionMs, MOTION_EASING, $motionMs, MOTION_EASING, $motionMs, MOTION_EASING, $motionMs, MOTION_EASING));
76
76
  export const LegendItemBox = styled.g.withConfig({
77
77
  displayName: "LegendItemBox",
78
- componentId: "sc-1pit1b9-5"
78
+ componentId: "sc-1qn3vlx-5"
79
79
  })(["cursor:", ";opacity:", ";transition:opacity ", "ms ", ";&:hover{opacity:", ";", "}&:focus{outline:none;}&:focus-visible{outline:2px solid ", ";outline-offset:2px;}"], ({
80
80
  $interactive
81
81
  }) => $interactive ? 'pointer' : 'default', ({
@@ -95,15 +95,15 @@ export const LegendItemBox = styled.g.withConfig({
95
95
  /** The hint badge beside a title: a light square with a blue glyph, as in the CP. */
96
96
  export const HintIcon = styled.g.withConfig({
97
97
  displayName: "HintIcon",
98
- componentId: "sc-1pit1b9-6"
98
+ componentId: "sc-1qn3vlx-6"
99
99
  })(["cursor:help;rect{fill:", ";transition:fill ", "ms ", ";}text{fill:", ";font-weight:700;transition:fill ", "ms ", ";}&:hover rect,&:focus-visible rect{fill:", ";}&:hover text,&:focus-visible text{fill:", ";}&:focus{outline:none;}&:focus-visible{outline:2px solid ", ";outline-offset:2px;}"], Color.BRIGHT_LIGHT, HOVER_MS, MOTION_EASING, Color.PRIMARY, HOVER_MS, MOTION_EASING, Color.PRIMARY, DEFAULT_SURFACE_COLOR, Color.PRIMARY);
100
100
  export const Centred = styled.div.withConfig({
101
101
  displayName: "Centred",
102
- componentId: "sc-1pit1b9-7"
102
+ componentId: "sc-1qn3vlx-7"
103
103
  })(["display:flex;align-items:center;justify-content:center;width:100%;height:100%;font-size:", ";color:", ";"], DEFAULT_FONT_SIZE, DEFAULT_MUTED_TEXT_COLOR);
104
104
  export const TooltipBox = styled.div.withConfig({
105
105
  displayName: "TooltipBox",
106
- componentId: "sc-1pit1b9-8"
106
+ componentId: "sc-1qn3vlx-8"
107
107
  })(["position:fixed;z-index:", ";top:", ";left:", ";max-width:", ";padding:", ";border:1px solid ", ";border-radius:", ";background:", ";box-shadow:", ";font-family:", ";font-size:", ";line-height:1.45;color:", ";white-space:", ";pointer-events:none;"], TOOLTIP_Z_INDEX, ({
108
108
  $y
109
109
  }) => `${$y}px`, ({
@@ -140,19 +140,19 @@ function tailAnchor({
140
140
  /** The callout beak; an SVG, so it can carry the box border and cut it at the base. */
141
141
  export const Tail = styled.svg.withConfig({
142
142
  displayName: "Tail",
143
- componentId: "sc-1pit1b9-9"
143
+ componentId: "sc-1qn3vlx-9"
144
144
  })(["position:absolute;", ";overflow:visible;"], tailAnchor);
145
145
  export const TooltipTitle = styled.div.withConfig({
146
146
  displayName: "TooltipTitle",
147
- componentId: "sc-1pit1b9-10"
147
+ componentId: "sc-1qn3vlx-10"
148
148
  })(["margin:0 0 4px;font-weight:600;"]);
149
149
  export const TooltipRow = styled.div.withConfig({
150
150
  displayName: "TooltipRow",
151
- componentId: "sc-1pit1b9-11"
151
+ componentId: "sc-1qn3vlx-11"
152
152
  })(["display:flex;align-items:center;gap:6px;"]);
153
153
  export const TooltipSwatch = styled.span.withConfig({
154
154
  displayName: "TooltipSwatch",
155
- componentId: "sc-1pit1b9-12"
155
+ componentId: "sc-1qn3vlx-12"
156
156
  })(["display:inline-block;flex:0 0 auto;width:8px;height:8px;border-radius:", ";background:", ";"], ({
157
157
  $round
158
158
  }) => $round ? '50%' : '2px', ({
@@ -160,11 +160,11 @@ export const TooltipSwatch = styled.span.withConfig({
160
160
  }) => $color);
161
161
  export const TooltipName = styled.span.withConfig({
162
162
  displayName: "TooltipName",
163
- componentId: "sc-1pit1b9-13"
163
+ componentId: "sc-1qn3vlx-13"
164
164
  })(["opacity:0.7;"]);
165
165
  export const TooltipValue = styled.span.withConfig({
166
166
  displayName: "TooltipValue",
167
- componentId: "sc-1pit1b9-14"
167
+ componentId: "sc-1qn3vlx-14"
168
168
  })(["margin-left:auto;font-weight:600;"]);
169
169
  export const DEFAULTS = {
170
170
  fontFamily: DEFAULT_FONT_FAMILY,
@@ -181,17 +181,17 @@ export const DEFAULTS = {
181
181
  */
182
182
  export const TooltipTable = styled.table.withConfig({
183
183
  displayName: "TooltipTable",
184
- componentId: "sc-1pit1b9-15"
184
+ componentId: "sc-1qn3vlx-15"
185
185
  })(["border-collapse:collapse;width:100%;"]);
186
186
  export const TooltipHeadCell = styled.th.withConfig({
187
187
  displayName: "TooltipHeadCell",
188
- componentId: "sc-1pit1b9-16"
188
+ componentId: "sc-1qn3vlx-16"
189
189
  })(["padding:0 0 6px;text-align:", ";font-weight:400;white-space:nowrap;opacity:0.6;&:not(:first-child){padding-left:16px;}"], ({
190
190
  $align
191
191
  }) => $align);
192
192
  export const TooltipCell = styled.td.withConfig({
193
193
  displayName: "TooltipCell",
194
- componentId: "sc-1pit1b9-17"
194
+ componentId: "sc-1qn3vlx-17"
195
195
  })(["padding:3px 0 0;text-align:", ";white-space:nowrap;opacity:", ";&:not(:first-child){padding-left:16px;}"], ({
196
196
  $align
197
197
  }) => $align, ({
@@ -199,26 +199,26 @@ export const TooltipCell = styled.td.withConfig({
199
199
  }) => $muted ? 0.6 : 1);
200
200
  export const TooltipSeriesCell = styled.td.withConfig({
201
201
  displayName: "TooltipSeriesCell",
202
- componentId: "sc-1pit1b9-18"
202
+ componentId: "sc-1qn3vlx-18"
203
203
  })(["padding:3px 0 0;white-space:nowrap;"]);
204
204
  /** Keeps the swatch on the baseline of the series name inside a table cell. */
205
205
  export const TooltipSeriesInner = styled.span.withConfig({
206
206
  displayName: "TooltipSeriesInner",
207
- componentId: "sc-1pit1b9-19"
207
+ componentId: "sc-1qn3vlx-19"
208
208
  })(["display:inline-flex;align-items:center;gap:6px;"]);
209
209
  /** Separates the header line from the table under it. */
210
210
  export const TooltipDivider = styled.div.withConfig({
211
211
  displayName: "TooltipDivider",
212
- componentId: "sc-1pit1b9-20"
212
+ componentId: "sc-1qn3vlx-20"
213
213
  })(["height:1px;margin:8px 0;background:", ";opacity:0.5;"], ({
214
214
  $color
215
215
  }) => $color);
216
216
  /** The rectangle dragged out over the plot before the zoom is applied. */
217
217
  export const ZoomBand = styled.rect.withConfig({
218
218
  displayName: "ZoomBand",
219
- componentId: "sc-1pit1b9-21"
219
+ componentId: "sc-1qn3vlx-21"
220
220
  })(["fill:", ";fill-opacity:0.12;pointer-events:none;"], Color.PRIMARY);
221
221
  export const ResetZoom = styled.button.withConfig({
222
222
  displayName: "ResetZoom",
223
- componentId: "sc-1pit1b9-22"
223
+ componentId: "sc-1qn3vlx-22"
224
224
  })(["position:absolute;top:8px;right:8px;padding:4px 10px;border:1px solid ", ";border-radius:4px;background:", ";font-family:inherit;font-size:", ";color:", ";cursor:pointer;&:hover{border-color:", ";color:", ";}&:focus-visible{outline:2px solid ", ";outline-offset:2px;}"], DEFAULT_GRID_COLOR, DEFAULT_SURFACE_COLOR, DEFAULT_FONT_SIZE, DEFAULT_TEXT_COLOR, Color.PRIMARY, Color.PRIMARY, Color.PRIMARY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/kit-charts",
3
- "version": "0.0.25",
3
+ "version": "0.1.0",
4
4
  "description": "Small React chart library on SVG, with a Highcharts-shaped configuration model",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -26,25 +26,22 @@
26
26
  "directory": "dist"
27
27
  },
28
28
  "dependencies": {
29
- "@pushwoosh/kit-constants": "^2.1.0"
29
+ "@pushwoosh/kit-constants": "^2.1.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@pushwoosh/frontend-builder-engine": "^3.1.3",
32
+ "@pushwoosh/frontend-builder-engine": "^3.1.4",
33
33
  "@testing-library/dom": "^10.4.2",
34
34
  "@testing-library/jest-dom": "^6.9.1",
35
35
  "@testing-library/react": "^16.3.0",
36
- "@types/jest": "^30.0.0",
37
- "@types/node": "^26.1.1",
36
+ "@types/node": "^24.19.1",
38
37
  "@types/react": "^18.3.31",
39
38
  "@types/react-dom": "^18.3.7",
40
- "@types/styled-components": "^5.1.34",
41
- "jest": "^30.2.0",
42
- "jest-environment-jsdom": "^30.2.0",
39
+ "jsdom": "^26.1.0",
43
40
  "react": "^18.3.1",
44
41
  "react-dom": "^18.3.1",
45
- "styled-components": "^5.3.11",
46
- "ts-jest": "^29.4.6",
47
- "typescript": "^6.0.3"
42
+ "styled-components": "^6.5.3",
43
+ "typescript": "^6.0.3",
44
+ "vitest": "^4.1.10"
48
45
  },
49
46
  "peerDependencies": {
50
47
  "react": ">=18.0.0",
@@ -61,6 +58,6 @@
61
58
  "check:lint": "echo \"Run check:lint\" && NODE_ENV=production eslint ./src ./playground ./tests",
62
59
  "check:lint-fix": "echo \"Run check:lint\" && NODE_ENV=production eslint ./src ./playground ./tests --fix",
63
60
  "check:types": "echo \"Run check:types\" && pushwoosh-engine lib:check-types && tsc --noEmit -p tsconfig.json",
64
- "test": "jest"
61
+ "test": "vitest run"
65
62
  }
66
63
  }
@@ -1,113 +0,0 @@
1
- export interface ContainerProps {
2
- $width: string;
3
- $height: string;
4
- $autoHeight: boolean;
5
- $background: string | undefined;
6
- $fontFamily: string;
7
- $fontSize: string;
8
- }
9
- export declare const Container: import("styled-components").StyledComponent<"div", any, ContainerProps, never>;
10
- export declare const ScrollBox: import("styled-components").StyledComponent<"div", any, {
11
- $scrolls: boolean;
12
- }, never>;
13
- /**
14
- * The y axes of a horizontally scrolling chart, drawn in their own layer over
15
- * the scroll box so the plot slides under them instead of taking them with it —
16
- * a row-label column is useless once it has scrolled off. Highcharts does the
17
- * same with a second, fixed SVG.
18
- */
19
- export declare const PinnedAxes: import("styled-components").StyledComponent<"svg", any, {}, never>;
20
- export declare const Canvas: import("styled-components").StyledComponent<"svg", any, {
21
- $clickable?: boolean;
22
- }, never>;
23
- /**
24
- * One series. Hiding it never drops it from the tree, so the change can play: the
25
- * geometry transitions carry every shape to where the renderer put it — collapsed
26
- * onto its own baseline, or rescaled by the axis the remaining series left behind —
27
- * and the opacity mops up the rest. `d` is animatable in Chromium; the attribute
28
- * transitions cover columns, cells and markers everywhere.
29
- */
30
- export declare const SeriesLayer: import("styled-components").StyledComponent<"g", any, {
31
- $hidden: boolean;
32
- $collapse: boolean;
33
- $selfAnimated: boolean;
34
- /** Opacity while another series is hovered, from `states.inactive`. */
35
- $inactive?: number;
36
- /** `series.opacity`: the whole series faded, border and labels included. */
37
- $opacity?: number;
38
- /** `series.animation`; the chart clock unless this series asked for its own. */
39
- $motionMs: number;
40
- $cursor: string;
41
- }, never>;
42
- export declare const LegendItemBox: import("styled-components").StyledComponent<"g", any, {
43
- $off: boolean;
44
- $interactive: boolean;
45
- $hoverColor?: string;
46
- $hoverWeight?: string;
47
- }, never>;
48
- /** The hint badge beside a title: a light square with a blue glyph, as in the CP. */
49
- export declare const HintIcon: import("styled-components").StyledComponent<"g", any, {}, never>;
50
- export declare const Centred: import("styled-components").StyledComponent<"div", any, {}, never>;
51
- export interface TooltipBoxProps {
52
- $x: number;
53
- $y: number;
54
- $padding: number;
55
- $radius: number;
56
- $borderColor: string;
57
- $background: string;
58
- $color: string;
59
- $fontFamily: string;
60
- $fontSize: string;
61
- $whiteSpace: string;
62
- $shadow: string;
63
- }
64
- export declare const TooltipBox: import("styled-components").StyledComponent<"div", any, TooltipBoxProps, never>;
65
- /** Edge of the box the beak sits on, named after that edge. */
66
- export type TailSide = 'top' | 'right' | 'bottom' | 'left';
67
- export interface TailProps {
68
- $offset: number;
69
- $width: number;
70
- $height: number;
71
- $side: TailSide;
72
- }
73
- /** The callout beak; an SVG, so it can carry the box border and cut it at the base. */
74
- export declare const Tail: import("styled-components").StyledComponent<"svg", any, TailProps, never>;
75
- export declare const TooltipTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
76
- export declare const TooltipRow: import("styled-components").StyledComponent<"div", any, {}, never>;
77
- export declare const TooltipSwatch: import("styled-components").StyledComponent<"span", any, {
78
- $color: string;
79
- $round?: boolean;
80
- }, never>;
81
- export declare const TooltipName: import("styled-components").StyledComponent<"span", any, {}, never>;
82
- export declare const TooltipValue: import("styled-components").StyledComponent<"span", any, {}, never>;
83
- export declare const DEFAULTS: {
84
- fontFamily: string;
85
- fontSize: string;
86
- border: string;
87
- surface: string;
88
- text: string;
89
- tooltipSurface: string;
90
- tooltipText: string;
91
- };
92
- /**
93
- * The table layout of the tooltip. A heading row plus one row per series, so a
94
- * count and its share line up in columns instead of running together on one line.
95
- */
96
- export declare const TooltipTable: import("styled-components").StyledComponent<"table", any, {}, never>;
97
- export declare const TooltipHeadCell: import("styled-components").StyledComponent<"th", any, {
98
- $align: "left" | "right";
99
- }, never>;
100
- export declare const TooltipCell: import("styled-components").StyledComponent<"td", any, {
101
- $align: "left" | "right";
102
- $muted?: boolean;
103
- }, never>;
104
- export declare const TooltipSeriesCell: import("styled-components").StyledComponent<"td", any, {}, never>;
105
- /** Keeps the swatch on the baseline of the series name inside a table cell. */
106
- export declare const TooltipSeriesInner: import("styled-components").StyledComponent<"span", any, {}, never>;
107
- /** Separates the header line from the table under it. */
108
- export declare const TooltipDivider: import("styled-components").StyledComponent<"div", any, {
109
- $color: string;
110
- }, never>;
111
- /** The rectangle dragged out over the plot before the zoom is applied. */
112
- export declare const ZoomBand: import("styled-components").StyledComponent<"rect", any, {}, never>;
113
- export declare const ResetZoom: import("styled-components").StyledComponent<"button", any, {}, never>;