ag-common 0.0.651 → 0.0.653

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.
@@ -1,4 +1,4 @@
1
- export declare const isEmailValid: (email: string) => boolean;
1
+ export declare const isEmailValid: (email: string | undefined) => boolean;
2
2
  export declare const getEmailErrors: (email: string, event: {
3
3
  creatorId: string;
4
4
  }) => string | undefined;
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
+ import { type IVarStyles } from '../../styles/common';
2
3
  import type { IBarChartData } from './types';
3
- export declare const BarChart: ({ data: dataRaw }: {
4
+ export declare const BarChart: ({ data: dataRaw, style: sRaw, }: {
4
5
  data: IBarChartData[];
6
+ style?: Partial<IVarStyles>;
5
7
  }) => React.JSX.Element;
@@ -7,6 +7,7 @@ exports.BarChart = void 0;
7
7
  const styled_1 = __importDefault(require("@emotion/styled"));
8
8
  const react_1 = __importDefault(require("react"));
9
9
  const useTooltip_1 = require("../../helpers/useTooltip");
10
+ const common_1 = require("../../styles/common");
10
11
  const Item_1 = require("./Item");
11
12
  const Legend_1 = require("./Legend");
12
13
  const TooltipContent_1 = require("./TooltipContent");
@@ -17,7 +18,6 @@ const BarChartBase = styled_1.default.div `
17
18
  height: 100%;
18
19
  margin-top: 0.5rem;
19
20
  position: relative;
20
- background-color: var(--main-bg);
21
21
  `;
22
22
  const ItemStyled = (0, styled_1.default)(Item_1.Item) `
23
23
  margin-bottom: 0.75rem;
@@ -26,21 +26,22 @@ const ItemStyled = (0, styled_1.default)(Item_1.Item) `
26
26
  margin-bottom: 0;
27
27
  }
28
28
  `;
29
- const BarChart = ({ data: dataRaw }) => {
29
+ const BarChart = ({ data: dataRaw, style: sRaw, }) => {
30
+ const style = (0, common_1.getVarStyles)(sRaw);
30
31
  const UT = (0, useTooltip_1.useTooltip)();
31
32
  const maxWidth = Math.max(...dataRaw.map((a) => a.total));
32
- return (react_1.default.createElement(BarChartBase, { "data-type": "bcb" },
33
- react_1.default.createElement(UT.Comp, { pos: UT.pos }, (p) => react_1.default.createElement(TooltipContent_1.TooltipContent, Object.assign({}, p))),
34
- dataRaw.map((data) => (react_1.default.createElement(ItemStyled, { key: data.name, data: data, maxWidth: maxWidth, onMouseLeave: () => UT.setPos(undefined), onMouseMove: (element) => {
33
+ return (react_1.default.createElement(BarChartBase, { "data-type": "bcb", style: style },
34
+ react_1.default.createElement(UT.Comp, { pos: UT.pos }, (p) => react_1.default.createElement(TooltipContent_1.TooltipContent, Object.assign({}, p, { style: style }))),
35
+ dataRaw.map((data) => (react_1.default.createElement(ItemStyled, { style: style, key: data.name, data: data, maxWidth: maxWidth, onMouseLeave: () => UT.setPos(undefined), onMouseMove: (element) => {
35
36
  var _a, _b;
36
37
  const selectedKey = (_b = (_a = document
37
38
  .elementFromPoint(element.pageX, element.pageY)) === null || _a === void 0 ? void 0 : _a.getAttribute('data-barchartitem-key')) !== null && _b !== void 0 ? _b : '';
38
39
  UT.setPos({
39
40
  element,
40
41
  parent: element.currentTarget.closest("[data-type='bcb']"),
41
- data: { data, selectedKey },
42
+ data: { selectedKey, data },
42
43
  });
43
44
  } }))),
44
- react_1.default.createElement(Legend_1.Legend, { data: dataRaw, maxWidth: maxWidth })));
45
+ react_1.default.createElement(Legend_1.Legend, { data: dataRaw, maxWidth: maxWidth, style: style })));
45
46
  };
46
47
  exports.BarChart = BarChart;
@@ -1,10 +1,12 @@
1
1
  import type { MouseEventHandler } from 'react';
2
2
  import React from 'react';
3
+ import type { IVarStyles } from '../../styles';
3
4
  import type { IBarChartData } from './types';
4
- export declare const Item: ({ data, className, onMouseMove, onMouseLeave, maxWidth, }: {
5
+ export declare const Item: ({ data, className, onMouseMove, onMouseLeave, maxWidth, style, }: {
5
6
  data: IBarChartData;
6
7
  className?: string | undefined;
7
8
  onMouseMove?: MouseEventHandler<HTMLDivElement> | undefined;
8
9
  onMouseLeave?: MouseEventHandler<HTMLDivElement> | undefined;
9
10
  maxWidth: number;
11
+ style: IVarStyles;
10
12
  }) => React.JSX.Element;
@@ -18,11 +18,12 @@ const Base = styled_1.default.div `
18
18
  const Title = styled_1.default.div `
19
19
  position: absolute;
20
20
  left: 0.25rem;
21
- color: var(--main-fg);
22
- ${(0, styles_1.HardOutline)('var(--main-bg)')};
23
21
  `;
24
- const Item = ({ data, className, onMouseMove, onMouseLeave, maxWidth, }) => (react_1.default.createElement(Base, { className: className, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave },
25
- react_1.default.createElement(Title, null, data.name),
22
+ const Item = ({ data, className, onMouseMove, onMouseLeave, maxWidth, style, }) => (react_1.default.createElement(Base, { className: className, onMouseMove: onMouseMove, onMouseLeave: onMouseLeave, style: style },
23
+ react_1.default.createElement(Title, { style: {
24
+ color: style.color,
25
+ filter: (0, styles_1.HardOutlineFilter)(style.backgroundColor),
26
+ } }, data.name),
26
27
  data.values.map((v) => (react_1.default.createElement("div", { "data-barchartitem-key": v.name, key: v.name, style: {
27
28
  height: '100%',
28
29
  width: `${(v.value / maxWidth) * 100}%`,
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import type { IVarStyles } from '../../styles/common';
2
3
  import type { IBarChartData } from './types';
3
- export declare const Legend: ({ data, maxWidth, }: {
4
+ export declare const Legend: ({ data, maxWidth, style, }: {
4
5
  data: IBarChartData[];
5
6
  maxWidth: number;
7
+ style: IVarStyles;
6
8
  }) => React.JSX.Element;
@@ -26,7 +26,6 @@ const Line = styled_1.default.div `
26
26
  height: 2px;
27
27
  left: 0;
28
28
  right: 0;
29
- background-color: var(--main-fg);
30
29
  `;
31
30
  const Numbers = styled_1.default.div `
32
31
  width: 100%;
@@ -35,9 +34,6 @@ const Numbers = styled_1.default.div `
35
34
  flex-flow: row;
36
35
  justify-content: space-between;
37
36
  z-index: 1;
38
- > span {
39
- background-color: var(--main-bg);
40
- }
41
37
  `;
42
38
  const Items = styled_1.default.div `
43
39
  width: 100%;
@@ -59,7 +55,7 @@ const Col = styled_1.default.div `
59
55
  border-radius: 50%;
60
56
  margin-right: 0.25rem;
61
57
  `;
62
- const Legend = ({ data, maxWidth, }) => {
58
+ const Legend = ({ data, maxWidth, style, }) => {
63
59
  const items = [0];
64
60
  if (maxWidth > 10) {
65
61
  items.push(Math.floor(maxWidth * 0.25));
@@ -73,10 +69,13 @@ const Legend = ({ data, maxWidth, }) => {
73
69
  name: v.name,
74
70
  }));
75
71
  })), (s) => s.name).sort((a, b) => (a.name < b.name ? -1 : 1));
76
- return (react_1.default.createElement(Base, null,
72
+ return (react_1.default.createElement(Base, { style: style },
77
73
  react_1.default.createElement(Bar, null,
78
- react_1.default.createElement(Line, null),
79
- react_1.default.createElement(Numbers, null, items.map((i) => (react_1.default.createElement("span", { key: i }, i))))),
74
+ react_1.default.createElement(Line, { style: { background: style.backgroundColor, color: style.color } }),
75
+ react_1.default.createElement(Numbers, null, items.map((i) => (react_1.default.createElement("span", { style: {
76
+ backgroundColor: style.backgroundColor,
77
+ color: style.color,
78
+ }, key: i }, i))))),
80
79
  keys.length > 1 && (react_1.default.createElement(Items, null, keys.map((k) => (react_1.default.createElement(Item, { key: k.name },
81
80
  react_1.default.createElement(Col, { style: { backgroundColor: k.colour } }),
82
81
  k.name)))))));
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import type { IVarStyles } from '../../styles/common';
2
3
  import type { IBarChartData } from './types';
3
- export declare const TooltipContent: ({ data, selectedKey, }: {
4
+ export declare const TooltipContent: ({ data, selectedKey, style, }: {
4
5
  data: IBarChartData;
5
6
  selectedKey?: string | undefined;
7
+ style: IVarStyles;
6
8
  }) => React.JSX.Element;
@@ -8,8 +8,6 @@ const styled_1 = __importDefault(require("@emotion/styled"));
8
8
  const react_1 = __importDefault(require("react"));
9
9
  const getLegendItems_1 = require("./getLegendItems");
10
10
  const Base = styled_1.default.div `
11
- background-color: var(--main-bg);
12
- border: solid 1px var(--main-bg-mid);
13
11
  padding: 0.5rem;
14
12
  `;
15
13
  const Title = styled_1.default.div `
@@ -34,9 +32,9 @@ const Total = styled_1.default.span `
34
32
  text-decoration: underline;
35
33
  }
36
34
  `;
37
- const TooltipContent = ({ data, selectedKey, }) => {
35
+ const TooltipContent = ({ data, selectedKey, style, }) => {
38
36
  const { part, rest, restTotal } = (0, getLegendItems_1.getLegendItems)({ data, selectedKey });
39
- return (react_1.default.createElement(Base, null,
37
+ return (react_1.default.createElement(Base, { style: Object.assign(Object.assign({}, style), { border: `solid 1px ${style.borderColor}` }) },
40
38
  react_1.default.createElement(Title, null, data.name),
41
39
  react_1.default.createElement(Row, null,
42
40
  react_1.default.createElement("span", null, "total"),
@@ -10,6 +10,7 @@ const react_1 = __importDefault(require("react"));
10
10
  const array_1 = require("../../../common/helpers/array");
11
11
  const math_1 = require("../../../common/helpers/math");
12
12
  const useTooltip_1 = require("../../helpers/useTooltip");
13
+ const common_1 = require("../../styles/common");
13
14
  const FlexRow_1 = require("../FlexRow");
14
15
  const dateHelpers_1 = require("./dateHelpers");
15
16
  const getLegendItems_1 = require("./getLegendItems");
@@ -31,14 +32,13 @@ const Base = styled_1.default.div `
31
32
  `;
32
33
  const Svg = styled_1.default.svg `
33
34
  padding: 2px;
34
- border-left: solid 1px var(--main-fg);
35
- border-top: solid 1px var(--main-fg);
36
35
  width: calc(100% - 5px);
37
36
  height: calc(100% - 5px);
38
37
  `;
39
38
  const LineChart = (p) => {
40
39
  var _a;
41
40
  const UT = (0, useTooltip_1.useTooltip)();
41
+ const style = (0, common_1.getVarStyles)(p.style);
42
42
  const { points, xTime } = (0, interpolate_1.interpolate)(p.data);
43
43
  let tt = p.tooltipTitle;
44
44
  if (!tt && xTime) {
@@ -57,7 +57,10 @@ const LineChart = (p) => {
57
57
  const lt2 = lt;
58
58
  const tt2 = tt;
59
59
  const legendItems = (0, getLegendItems_1.getLegendItems)(Object.assign(Object.assign({ colours: p.colours, data: p.data, tt: tt2, lt: lt2 }, (_a = UT.pos) === null || _a === void 0 ? void 0 : _a.data), { fixed: false }));
60
- const SvgC = (react_1.default.createElement(Svg, { transform: "scale(-1,1) scale(-1,-1)", strokeWidth: '3px', fillOpacity: 1, preserveAspectRatio: "none", onMouseMove: (element) => {
60
+ const SvgC = (react_1.default.createElement(Svg, { style: {
61
+ borderLeft: `solid 1px ${style.borderColor}`,
62
+ borderTop: `solid 1px ${style.borderColor}`,
63
+ }, transform: "scale(-1,1) scale(-1,-1)", strokeWidth: '3px', fillOpacity: 1, preserveAspectRatio: "none", onMouseMove: (element) => {
61
64
  const parent = element.currentTarget.closest("[data-type='lcb']");
62
65
  const bb = parent === null || parent === void 0 ? void 0 : parent.getBoundingClientRect();
63
66
  if (!bb) {
@@ -96,11 +99,11 @@ const LineChart = (p) => {
96
99
  p2.x1 === p2.x2) && (react_1.default.createElement("circle", { cx: `${p2.x2}%`, cy: `${p2.y2}%`, r: "8px", fill: p.colours[p2.name] })),
97
100
  p2.x1 !== p2.x2 && (react_1.default.createElement("line", { strokeOpacity: legendItems.part.find((f) => f.name === p2.name) ? 1 : 0.3, x1: `${p2.x1}%`, x2: `${p2.x2}%`, y1: `${p2.y1}%`, y2: `${p2.y2}%`, style: { stroke: p.colours[p2.name] } }))));
98
101
  })));
99
- return (react_1.default.createElement(Base, { className: p.className, "data-type": "lcb", onMouseLeave: () => UT.setPos(undefined) },
102
+ return (react_1.default.createElement(Base, { className: p.className, "data-type": "lcb", onMouseLeave: () => UT.setPos(undefined), style: style },
100
103
  react_1.default.createElement(UT.Comp, { pos: UT.pos }, (p2) => (react_1.default.createElement(TooltipContent_1.TooltipContent, Object.assign({}, p2, { colours: p.colours, data: p.data, lt: lt2, tt: tt2, legendItems: legendItems })))),
101
104
  react_1.default.createElement(FlexRow_1.FlexRow, { noWrap: true },
102
- react_1.default.createElement(LegendY_1.LegendY, { data: p.data }),
105
+ react_1.default.createElement(LegendY_1.LegendY, { data: p.data, style: style }),
103
106
  SvgC),
104
- react_1.default.createElement(LegendX_1.LegendX, { data: p.data, colours: p.colours, lt: lt, tt: tt })));
107
+ react_1.default.createElement(LegendX_1.LegendX, { data: p.data, colours: p.colours, lt: lt, tt: tt, style: style })));
105
108
  };
106
109
  exports.LineChart = LineChart;
@@ -1,8 +1,10 @@
1
1
  import React from 'react';
2
+ import type { IVarStyles } from '../../styles/common';
2
3
  import type { ILineChartItemRaw } from './types';
3
- export declare const LegendX: ({ data, lt, tt, colours, }: {
4
+ export declare const LegendX: ({ data, lt, tt, colours, style, }: {
4
5
  data: ILineChartItemRaw[];
5
6
  colours: Record<string, string>;
6
7
  lt: (a: number) => string;
7
8
  tt: (a: number) => string;
9
+ style: IVarStyles;
8
10
  }) => React.JSX.Element;
@@ -12,7 +12,6 @@ const Base = styled_1.default.div `
12
12
  display: flex;
13
13
  flex-flow: column;
14
14
  width: 100%;
15
- color: var(--main-fg);
16
15
  `;
17
16
  const Bar = styled_1.default.div `
18
17
  width: 100%;
@@ -27,7 +26,6 @@ const Line = styled_1.default.div `
27
26
  height: 2px;
28
27
  left: 0;
29
28
  right: 0;
30
- background-color: var(--main-fg);
31
29
  `;
32
30
  const Numbers = styled_1.default.div `
33
31
  width: 100%;
@@ -35,10 +33,6 @@ const Numbers = styled_1.default.div `
35
33
  flex-flow: row;
36
34
  justify-content: space-between;
37
35
  z-index: 1;
38
-
39
- > span {
40
- background-color: var(--main-bg);
41
- }
42
36
  `;
43
37
  const Items = styled_1.default.div `
44
38
  width: 100%;
@@ -66,7 +60,7 @@ const Col = styled_1.default.div `
66
60
  border-radius: 50%;
67
61
  margin-right: 0.25rem;
68
62
  `;
69
- const LegendX = ({ data, lt, tt, colours, }) => {
63
+ const LegendX = ({ data, lt, tt, colours, style, }) => {
70
64
  const legendItems = (0, getLegendItems_1.getLegendItems)({
71
65
  data,
72
66
  colours,
@@ -90,12 +84,12 @@ const LegendX = ({ data, lt, tt, colours, }) => {
90
84
  itemsRaw.push(maxX);
91
85
  const items = itemsRaw.map((d) => { var _a; return (_a = lt(d)) !== null && _a !== void 0 ? _a : d; });
92
86
  const ch = maxY.toString().length + 1;
93
- return (react_1.default.createElement(Base, { style: { marginLeft: 'auto', width: `calc(100% - ${ch}ch)` } },
87
+ return (react_1.default.createElement(Base, { style: Object.assign(Object.assign({}, style), { marginLeft: 'auto', width: `calc(100% - ${ch}ch)` }) },
94
88
  react_1.default.createElement(Bar, null,
95
- react_1.default.createElement(Line, null),
96
- react_1.default.createElement(Numbers, null, items.map((i, i2) => (
97
- // eslint-disable-next-line react/no-array-index-key
98
- react_1.default.createElement("span", { key: i + i2 }, i))))),
89
+ react_1.default.createElement(Line, { style: { backgroundColor: style.color } }),
90
+ react_1.default.createElement(Numbers, null, items.map((i, i2) => (react_1.default.createElement("span", {
91
+ // eslint-disable-next-line react/no-array-index-key
92
+ key: i + i2, style: { backgroundColor: style.backgroundColor } }, i))))),
99
93
  legendItems.length > 1 && (react_1.default.createElement(Items, null, legendItems.map((k) => (react_1.default.createElement(Item, { key: k.name },
100
94
  react_1.default.createElement(Col, { style: { backgroundColor: k.colour } }),
101
95
  k.name)))))));
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
+ import type { IVarStyles } from '../../styles/common';
2
3
  import type { ILineChartItemRaw } from './types';
3
- export declare const LegendY: ({ data }: {
4
+ export declare const LegendY: ({ data, style, }: {
4
5
  data: ILineChartItemRaw[];
6
+ style: IVarStyles;
5
7
  }) => React.JSX.Element;
@@ -18,12 +18,10 @@ const Numbers = styled_1.default.div `
18
18
  justify-content: space-between;
19
19
  z-index: 1;
20
20
  > span {
21
- color: var(--main-fg);
22
- background-color: var(--main-bg);
23
21
  text-align: right;
24
22
  }
25
23
  `;
26
- const LegendY = ({ data }) => {
24
+ const LegendY = ({ data, style, }) => {
27
25
  const ys = data.map((a) => a.y);
28
26
  const minY = Math.min(...ys);
29
27
  const maxY = Math.max(...ys);
@@ -35,9 +33,12 @@ const LegendY = ({ data }) => {
35
33
  }
36
34
  items.push(maxY);
37
35
  const ch = maxY.toString().length;
38
- return (react_1.default.createElement(Base, { style: { maxWidth: `${ch}ch`, paddingRight: '1ch' } },
39
- react_1.default.createElement(Numbers, null, items.map((i, i2) => (
40
- // eslint-disable-next-line react/no-array-index-key
41
- react_1.default.createElement("span", { key: i + i2 }, i))))));
36
+ return (react_1.default.createElement(Base, { style: Object.assign(Object.assign({}, style), { maxWidth: `${ch}ch`, paddingRight: '1ch' }) },
37
+ react_1.default.createElement(Numbers, null, items.map((i, i2) => (react_1.default.createElement("span", {
38
+ // eslint-disable-next-line react/no-array-index-key
39
+ key: i + i2, style: {
40
+ color: style.color,
41
+ backgroundColor: style.backgroundColor,
42
+ } }, i))))));
42
43
  };
43
44
  exports.LegendY = LegendY;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
+ import type { IVarStyles } from '../../styles/common';
2
3
  import type { ILegendItems } from './getLegendItems';
3
4
  import type { ILineChartTooltip } from './types';
4
5
  export declare const TooltipContent: (p: ILineChartTooltip & {
5
6
  legendItems: ILegendItems;
6
- }) => React.JSX.Element;
7
+ }, style: IVarStyles) => React.JSX.Element;
@@ -7,8 +7,6 @@ exports.TooltipContent = void 0;
7
7
  const styled_1 = __importDefault(require("@emotion/styled"));
8
8
  const react_1 = __importDefault(require("react"));
9
9
  const Base = styled_1.default.div `
10
- background-color: var(--main-bg);
11
- border: solid 1px var(--main-bg-mid);
12
10
  padding: 0.5rem;
13
11
  `;
14
12
  const Title = styled_1.default.div `
@@ -33,10 +31,10 @@ const Total = styled_1.default.span `
33
31
  text-decoration: underline;
34
32
  }
35
33
  `;
36
- const TooltipContent = (p) => {
34
+ const TooltipContent = (p, style) => {
37
35
  var _a, _b, _c, _d;
38
36
  const name = (_d = (_a = p.tt) === null || _a === void 0 ? void 0 : _a.call(p, (_c = (_b = p.selectedXs) === null || _b === void 0 ? void 0 : _b[0].x) !== null && _c !== void 0 ? _c : 0)) !== null && _d !== void 0 ? _d : '';
39
- return (react_1.default.createElement(Base, null,
37
+ return (react_1.default.createElement(Base, { style: Object.assign(Object.assign({}, style), { border: `solid 1px ${style.borderColor}` }) },
40
38
  react_1.default.createElement(Title, null, name),
41
39
  react_1.default.createElement(Row, null,
42
40
  react_1.default.createElement("span", null, "total"),
@@ -1,3 +1,4 @@
1
+ import type { IVarStyles } from '../../styles/common';
1
2
  export type ILineChartItemRaw = {
2
3
  x: number;
3
4
  y: number;
@@ -23,4 +24,5 @@ export interface ILineChart {
23
24
  colours: Record<string, string>;
24
25
  tooltipTitle?: (a: number) => string;
25
26
  legendTitle?: (a: number) => string;
27
+ style: Partial<IVarStyles>;
26
28
  }
@@ -7,7 +7,7 @@ exports.Checkmark = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const Checkmark = ({ style, }) => {
9
9
  var _a;
10
- return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: Object.assign({}, style) },
10
+ return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: style },
11
11
  react_1.default.createElement("path", { fill: "none", stroke: (_a = style === null || style === void 0 ? void 0 : style.fill) !== null && _a !== void 0 ? _a : '#000', strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M8 12.333 10.461 15 16 9m5 3a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" })));
12
12
  };
13
13
  exports.Checkmark = Checkmark;
@@ -7,7 +7,7 @@ exports.Circle = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const Circle = ({ style, dotted = false, }) => {
9
9
  var _a;
10
- return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: Object.assign({}, style) },
10
+ return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "2 2 20 20", style: style },
11
11
  react_1.default.createElement("path", { fill: "none", stroke: (_a = style === null || style === void 0 ? void 0 : style.fill) !== null && _a !== void 0 ? _a : '#000', strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: !dotted ? '' : '4 4', strokeWidth: "2", d: "M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" })));
12
12
  };
13
13
  exports.Circle = Circle;
@@ -5,6 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Computer = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
- const Computer = ({ style, }) => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: Object.assign({}, style) },
8
+ const Computer = ({ style, }) => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: style },
9
9
  react_1.default.createElement("path", { fillRule: "evenodd", d: "M2 6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-6v1h2a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2h2v-1H5a3 3 0 0 1-3-3V6Zm3-1a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1H5Z", clipRule: "evenodd" })));
10
10
  exports.Computer = Computer;
@@ -7,7 +7,7 @@ exports.Magnify = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const Magnify = ({ style, }) => {
9
9
  var _a;
10
- return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 490 490", style: Object.assign({}, style) },
10
+ return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 490 490", style: style },
11
11
  react_1.default.createElement("path", { fill: "none", stroke: (_a = style === null || style === void 0 ? void 0 : style.fill) !== null && _a !== void 0 ? _a : 'black', strokeWidth: "36", strokeLinecap: "round", d: "M280 278a153 153 0 1 0-2 2l170 170m-91-117 110 110-26 26-110-110" })));
12
12
  };
13
13
  exports.Magnify = Magnify;
@@ -5,6 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Moon = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
- const Moon = ({ style, }) => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 35 35", style: Object.assign({}, style) },
8
+ const Moon = ({ style, }) => (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 35 35", style: style },
9
9
  react_1.default.createElement("path", { d: "M18.44 34.68a18.22 18.22 0 0 1-2.94-.24 18.18 18.18 0 0 1-15-20.86A18.06 18.06 0 0 1 9.59.63a2.42 2.42 0 0 1 2.61.16 2.39 2.39 0 0 1 1 2.41l-1.3-.1 1.23.22A15.66 15.66 0 0 0 23.34 21a15.82 15.82 0 0 0 8.47.53A2.44 2.44 0 0 1 34.47 25a18.18 18.18 0 0 1-16.03 9.68ZM10.67 2.89a15.67 15.67 0 0 0-5 22.77A15.66 15.66 0 0 0 32.18 24a18.49 18.49 0 0 1-9.65-.64A18.18 18.18 0 0 1 10.67 2.89Z" })));
10
10
  exports.Moon = Moon;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import type { CSSProperties } from 'react';
2
2
  /** function that returns css that gives a text outline drop shadow.
3
3
  * @param outlineColour default='white'
4
4
  * @param sizePx default = 1px
@@ -23,3 +23,12 @@ export declare const Card: import("@emotion/styled").StyledComponent<{
23
23
  theme?: import("@emotion/react").Theme | undefined;
24
24
  as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
25
25
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
26
+ export interface IVarStyles {
27
+ /** default var(--main-fg) */
28
+ color: string;
29
+ /** default var(--main-bg) */
30
+ backgroundColor: string;
31
+ /** default var(--main-bg-mid) */
32
+ borderColor: string;
33
+ }
34
+ export declare const getVarStyles: (raw?: Partial<IVarStyles & CSSProperties>) => IVarStyles;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Card = exports.bounce = exports.noDrag = exports.TextOverflowEllipsis = exports.NoTextSelect = exports.HardOutlineFilter = exports.HardOutline = void 0;
7
+ exports.getVarStyles = exports.Card = exports.bounce = exports.noDrag = exports.TextOverflowEllipsis = exports.NoTextSelect = exports.HardOutlineFilter = exports.HardOutline = void 0;
8
8
  const react_1 = require("@emotion/react");
9
9
  const styled_1 = __importDefault(require("@emotion/styled"));
10
10
  const colours_1 = require("./colours");
@@ -77,3 +77,8 @@ exports.Card = styled_1.default.div `
77
77
  padding: 1rem;
78
78
  border: solid 2px ${colours_1.colours.lighter};
79
79
  `;
80
+ const getVarStyles = (raw) => {
81
+ var _a, _b, _c;
82
+ return (Object.assign(Object.assign({}, raw), { color: (_a = raw === null || raw === void 0 ? void 0 : raw.color) !== null && _a !== void 0 ? _a : 'var(--main-fg)', backgroundColor: (_b = raw === null || raw === void 0 ? void 0 : raw.backgroundColor) !== null && _b !== void 0 ? _b : 'var(--main-bg)', borderColor: (_c = raw === null || raw === void 0 ? void 0 : raw.borderColor) !== null && _c !== void 0 ? _c : 'var(--main-bg-mid)' }));
83
+ };
84
+ exports.getVarStyles = getVarStyles;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.651",
2
+ "version": "0.0.653",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",