ag-common 0.0.216 → 0.0.217

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.
@@ -7,9 +7,10 @@ export interface ISparkLine {
7
7
  className?: string;
8
8
  data: TSparkLineData[];
9
9
  pointTitleF?: (p: TSparkLineData) => string;
10
+ title?: string;
10
11
  }
11
12
  export declare type TSparkLineData = {
12
13
  x: number;
13
14
  y: number;
14
15
  };
15
- export declare const SparkLine: ({ data: raw, className, pointTitleF, pointColour, }: ISparkLine) => JSX.Element;
16
+ export declare const SparkLine: (p: ISparkLine) => JSX.Element;
@@ -26,7 +26,8 @@ const Point = styled_components_1.default.div `
26
26
  border-style: solid;
27
27
  width: 1px;
28
28
  `;
29
- const SparkLine = ({ data: raw, className, pointTitleF, pointColour = '#4d76ff', }) => {
29
+ const SparkLine = (p) => {
30
+ const { data: raw, pointColour = '#4d76ff' } = p;
30
31
  const xMin = Math.min(...raw.map((d) => d.x));
31
32
  const xMax = Math.max(...raw.map((d) => d.x));
32
33
  const yMin = Math.min(...raw.map((d) => d.y));
@@ -44,15 +45,15 @@ const SparkLine = ({ data: raw, className, pointTitleF, pointColour = '#4d76ff',
44
45
  }) * 100,
45
46
  orig,
46
47
  }));
47
- return (react_1.default.createElement(Base, { className: className },
48
- react_1.default.createElement(Points, null, data.map((p) => {
49
- var _a;
50
- return (react_1.default.createElement(Point, { title: (_a = pointTitleF === null || pointTitleF === void 0 ? void 0 : pointTitleF(p.orig)) !== null && _a !== void 0 ? _a : '', key: p.x + ' ' + p.y, style: {
48
+ return (react_1.default.createElement(Base, { className: p.className, title: p.title },
49
+ react_1.default.createElement(Points, null, data.map((pt) => {
50
+ var _a, _b;
51
+ return (react_1.default.createElement(Point, { title: (_b = (_a = p.pointTitleF) === null || _a === void 0 ? void 0 : _a.call(p, pt.orig)) !== null && _b !== void 0 ? _b : '', key: pt.x + ' ' + pt.y, style: {
51
52
  backgroundColor: pointColour,
52
53
  borderColor: pointColour,
53
- left: p.x + '%',
54
+ left: pt.x + '%',
54
55
  bottom: 0,
55
- height: p.y + '%',
56
+ height: pt.y + '%',
56
57
  } }));
57
58
  }))));
58
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.216",
3
+ "version": "0.0.217",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",