@oanda/labs-currency-power-balance-widget 1.0.157 → 1.0.159

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 (25) hide show
  1. package/CHANGELOG.md +1276 -0
  2. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +3 -10
  3. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  4. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +21 -3
  5. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  6. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/index.js +0 -11
  7. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -1
  8. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +3 -11
  9. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
  10. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +23 -5
  11. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
  12. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js +0 -1
  13. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -1
  14. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +104 -1
  15. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/index.d.ts +0 -1
  16. package/package.json +5 -5
  17. package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +3 -17
  18. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +36 -2
  19. package/src/CurrencyPowerBalanceWidget/components/Chart/options/index.ts +0 -1
  20. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +0 -36
  21. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +0 -1
  22. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +0 -30
  23. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +0 -1
  24. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.d.ts +0 -110
  25. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts +0 -48
@@ -1,8 +1,19 @@
1
- import { Theme, themeColors } from '@oanda/labs-widget-common';
1
+ import { getGridLines, Theme, themeColors } from '@oanda/labs-widget-common';
2
2
 
3
3
  import type { CurrencyPowerBalance } from '../../../../gql/types/graphql';
4
4
  import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';
5
- import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';
5
+ import {
6
+ CHART_HEIGHT,
7
+ CHART_WIDTH,
8
+ COLOR_CONFIG,
9
+ LEGEND_HEIGHT,
10
+ LEGEND_HEIGHT_MOBILE,
11
+ TOOLTIP_LINE_COLOR_CONFIG,
12
+ X_LABEL_SIZE,
13
+ X_LABEL_SIZE_MOBILE,
14
+ Y_LABEL_SIZE,
15
+ Y_LABEL_SIZE_MOBILE,
16
+ } from './constants';
6
17
  import {
7
18
  formatLegendData,
8
19
  intervalFormatter,
@@ -15,6 +26,8 @@ const getOption = (
15
26
  chartData: CurrencyPowerBalance[],
16
27
  timeUnit: CurrencyPowerBalanceTimeUnit,
17
28
  isDark: boolean,
29
+ isDesktop: boolean,
30
+ isMobile: boolean,
18
31
  lang: (key: string) => string
19
32
  ) => {
20
33
  const currentTheme = isDark ? Theme.Dark : Theme.Light;
@@ -88,6 +101,16 @@ const getOption = (
88
101
 
89
102
  const legendData = formatLegendData(chartData);
90
103
 
104
+ const baseGridLines = getGridLines({
105
+ isDark,
106
+ chartWidth: CHART_WIDTH,
107
+ chartHeight: CHART_HEIGHT,
108
+ xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,
109
+ yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,
110
+ bottomLeftBox: false,
111
+ marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT,
112
+ });
113
+
91
114
  return {
92
115
  animation: false,
93
116
  legend: {
@@ -137,9 +160,20 @@ const getOption = (
137
160
  axisLabel: {
138
161
  showMaxLabel: false,
139
162
  showMinLabel: false,
163
+ margin: isDesktop ? 8 : 6,
140
164
  },
141
165
  },
142
166
  series: seriesData,
167
+ grid: [
168
+ {
169
+ name: 'main-grid',
170
+ top: '0px',
171
+ left: '0px',
172
+ right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,
173
+ bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`,
174
+ },
175
+ ],
176
+ graphic: [...baseGridLines],
143
177
  };
144
178
  };
145
179
 
@@ -1,2 +1 @@
1
1
  export * from './getOption';
2
- export * from './getResponsiveOption';
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getResponsiveOption = void 0;
7
- var _labsWidgetCommon = require("@oanda/labs-widget-common");
8
- var _constants = require("./constants");
9
- const getResponsiveOption = (isDesktop, isMobile, isDark) => {
10
- const baseGridLines = (0, _labsWidgetCommon.getGridLines)({
11
- isDark,
12
- chartWidth: _constants.CHART_WIDTH,
13
- chartHeight: _constants.CHART_HEIGHT,
14
- xLabelsSize: isMobile ? _constants.X_LABEL_SIZE_MOBILE : _constants.X_LABEL_SIZE,
15
- yLabelSize: isMobile ? _constants.Y_LABEL_SIZE_MOBILE : _constants.Y_LABEL_SIZE,
16
- bottomLeftBox: false,
17
- marginBottom: isMobile ? _constants.LEGEND_HEIGHT_MOBILE : _constants.LEGEND_HEIGHT
18
- });
19
- return {
20
- yAxis: {
21
- axisLabel: {
22
- margin: isDesktop ? 8 : 6
23
- }
24
- },
25
- grid: [{
26
- name: 'main-grid',
27
- top: '0px',
28
- left: '0px',
29
- right: `${isMobile ? _constants.Y_LABEL_SIZE_MOBILE : _constants.Y_LABEL_SIZE}px`,
30
- bottom: `${isMobile ? _constants.X_LABEL_SIZE_MOBILE : _constants.X_LABEL_SIZE}px`
31
- }],
32
- graphic: [...baseGridLines]
33
- };
34
- };
35
- exports.getResponsiveOption = getResponsiveOption;
36
- //# sourceMappingURL=getResponsiveOption.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getResponsiveOption.js","names":["_labsWidgetCommon","require","_constants","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","X_LABEL_SIZE_MOBILE","X_LABEL_SIZE","yLabelSize","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","bottomLeftBox","marginBottom","LEGEND_HEIGHT_MOBILE","LEGEND_HEIGHT","yAxis","axisLabel","margin","grid","name","top","left","right","bottom","graphic","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n} from './constants';\n\nconst getResponsiveOption = (\n isDesktop: boolean,\n isMobile: boolean,\n isDark: boolean\n) => {\n const baseGridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,\n yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,\n bottomLeftBox: false,\n marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT,\n });\n\n return {\n yAxis: {\n axisLabel: {\n margin: isDesktop ? 8 : 6,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '0px',\n left: '0px',\n right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,\n bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...baseGridLines],\n };\n};\n\nexport { getResponsiveOption };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAWA,MAAME,mBAAmB,GAAGA,CAC1BC,SAAkB,EAClBC,QAAiB,EACjBC,MAAe,KACZ;EACH,MAAMC,aAAa,GAAG,IAAAC,8BAAY,EAAC;IACjCF,MAAM;IACNG,UAAU,EAAEC,sBAAW;IACvBC,WAAW,EAAEC,uBAAY;IACzBC,WAAW,EAAER,QAAQ,GAAGS,8BAAmB,GAAGC,uBAAY;IAC1DC,UAAU,EAAEX,QAAQ,GAAGY,8BAAmB,GAAGC,uBAAY;IACzDC,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAEf,QAAQ,GAAGgB,+BAAoB,GAAGC;EAClD,CAAC,CAAC;EAEF,OAAO;IACLC,KAAK,EAAE;MACLC,SAAS,EAAE;QACTC,MAAM,EAAErB,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACDsB,IAAI,EAAE,CACJ;MACEC,IAAI,EAAE,WAAW;MACjBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,EAAE,GAAGzB,QAAQ,GAAGY,8BAAmB,GAAGC,uBAAY,IAAI;MAC3Da,MAAM,EAAE,GAAG1B,QAAQ,GAAGS,8BAAmB,GAAGC,uBAAY;IAC1D,CAAC,CACF;IACDiB,OAAO,EAAE,CAAC,GAAGzB,aAAa;EAC5B,CAAC;AACH,CAAC;AAAC0B,OAAA,CAAA9B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,30 +0,0 @@
1
- import { getGridLines } from '@oanda/labs-widget-common';
2
- import { CHART_HEIGHT, CHART_WIDTH, LEGEND_HEIGHT, LEGEND_HEIGHT_MOBILE, X_LABEL_SIZE, X_LABEL_SIZE_MOBILE, Y_LABEL_SIZE, Y_LABEL_SIZE_MOBILE } from './constants';
3
- const getResponsiveOption = (isDesktop, isMobile, isDark) => {
4
- const baseGridLines = getGridLines({
5
- isDark,
6
- chartWidth: CHART_WIDTH,
7
- chartHeight: CHART_HEIGHT,
8
- xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,
9
- yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,
10
- bottomLeftBox: false,
11
- marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT
12
- });
13
- return {
14
- yAxis: {
15
- axisLabel: {
16
- margin: isDesktop ? 8 : 6
17
- }
18
- },
19
- grid: [{
20
- name: 'main-grid',
21
- top: '0px',
22
- left: '0px',
23
- right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,
24
- bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`
25
- }],
26
- graphic: [...baseGridLines]
27
- };
28
- };
29
- export { getResponsiveOption };
30
- //# sourceMappingURL=getResponsiveOption.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getResponsiveOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","Y_LABEL_SIZE_MOBILE","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","yAxis","axisLabel","margin","grid","name","top","left","right","bottom","graphic"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n} from './constants';\n\nconst getResponsiveOption = (\n isDesktop: boolean,\n isMobile: boolean,\n isDark: boolean\n) => {\n const baseGridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,\n yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,\n bottomLeftBox: false,\n marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT,\n });\n\n return {\n yAxis: {\n axisLabel: {\n margin: isDesktop ? 8 : 6,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '0px',\n left: '0px',\n right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,\n bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...baseGridLines],\n };\n};\n\nexport { getResponsiveOption };\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,SACEC,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,oBAAoB,EACpBC,YAAY,EACZC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,QACd,aAAa;AAEpB,MAAMC,mBAAmB,GAAGA,CAC1BC,SAAkB,EAClBC,QAAiB,EACjBC,MAAe,KACZ;EACH,MAAMC,aAAa,GAAGb,YAAY,CAAC;IACjCY,MAAM;IACNE,UAAU,EAAEZ,WAAW;IACvBa,WAAW,EAAEd,YAAY;IACzBe,WAAW,EAAEL,QAAQ,GAAGL,mBAAmB,GAAGD,YAAY;IAC1DY,UAAU,EAAEN,QAAQ,GAAGH,mBAAmB,GAAGD,YAAY;IACzDW,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAER,QAAQ,GAAGP,oBAAoB,GAAGD;EAClD,CAAC,CAAC;EAEF,OAAO;IACLiB,KAAK,EAAE;MACLC,SAAS,EAAE;QACTC,MAAM,EAAEZ,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACDa,IAAI,EAAE,CACJ;MACEC,IAAI,EAAE,WAAW;MACjBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,EAAE,GAAGhB,QAAQ,GAAGH,mBAAmB,GAAGD,YAAY,IAAI;MAC3DqB,MAAM,EAAE,GAAGjB,QAAQ,GAAGL,mBAAmB,GAAGD,YAAY;IAC1D,CAAC,CACF;IACDwB,OAAO,EAAE,CAAC,GAAGhB,aAAa;EAC5B,CAAC;AACH,CAAC;AAED,SAASJ,mBAAmB","ignoreList":[]}
@@ -1,110 +0,0 @@
1
- declare const getResponsiveOption: (isDesktop: boolean, isMobile: boolean, isDark: boolean) => {
2
- yAxis: {
3
- axisLabel: {
4
- margin: number;
5
- };
6
- };
7
- grid: {
8
- name: string;
9
- top: string;
10
- left: string;
11
- right: string;
12
- bottom: string;
13
- }[];
14
- graphic: ({
15
- top: number | undefined;
16
- bottom: number | undefined;
17
- left: number | undefined;
18
- right: number | undefined;
19
- shape: {
20
- x1: number;
21
- y1: number;
22
- x2: number;
23
- y2: number;
24
- };
25
- type: string;
26
- silent: boolean;
27
- z: number;
28
- style: {
29
- stroke: string;
30
- lineWidth: number;
31
- };
32
- } | {
33
- top: number;
34
- shape: {
35
- x1: number;
36
- y1: number;
37
- x2: number;
38
- y2: number;
39
- };
40
- type: string;
41
- silent: boolean;
42
- z: number;
43
- style: {
44
- stroke: string;
45
- lineWidth: number;
46
- };
47
- } | {
48
- right: number;
49
- shape: {
50
- x1: number;
51
- y1: number;
52
- x2: number;
53
- y2: number;
54
- };
55
- type: string;
56
- silent: boolean;
57
- z: number;
58
- style: {
59
- stroke: string;
60
- lineWidth: number;
61
- };
62
- } | {
63
- bottom: number;
64
- shape: {
65
- x1: number;
66
- y1: number;
67
- x2: number;
68
- y2: number;
69
- };
70
- type: string;
71
- silent: boolean;
72
- z: number;
73
- style: {
74
- stroke: string;
75
- lineWidth: number;
76
- };
77
- } | {
78
- left: number;
79
- shape: {
80
- x1: number;
81
- y1: number;
82
- x2: number;
83
- y2: number;
84
- };
85
- type: string;
86
- silent: boolean;
87
- z: number;
88
- style: {
89
- stroke: string;
90
- lineWidth: number;
91
- };
92
- } | {
93
- right: number;
94
- bottom: number;
95
- shape: {
96
- x1: number;
97
- y1: number;
98
- x2: number;
99
- y2: number;
100
- };
101
- type: string;
102
- silent: boolean;
103
- z: number;
104
- style: {
105
- stroke: string;
106
- lineWidth: number;
107
- };
108
- })[];
109
- };
110
- export { getResponsiveOption };
@@ -1,48 +0,0 @@
1
- import { getGridLines } from '@oanda/labs-widget-common';
2
-
3
- import {
4
- CHART_HEIGHT,
5
- CHART_WIDTH,
6
- LEGEND_HEIGHT,
7
- LEGEND_HEIGHT_MOBILE,
8
- X_LABEL_SIZE,
9
- X_LABEL_SIZE_MOBILE,
10
- Y_LABEL_SIZE,
11
- Y_LABEL_SIZE_MOBILE,
12
- } from './constants';
13
-
14
- const getResponsiveOption = (
15
- isDesktop: boolean,
16
- isMobile: boolean,
17
- isDark: boolean
18
- ) => {
19
- const baseGridLines = getGridLines({
20
- isDark,
21
- chartWidth: CHART_WIDTH,
22
- chartHeight: CHART_HEIGHT,
23
- xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,
24
- yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,
25
- bottomLeftBox: false,
26
- marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT,
27
- });
28
-
29
- return {
30
- yAxis: {
31
- axisLabel: {
32
- margin: isDesktop ? 8 : 6,
33
- },
34
- },
35
- grid: [
36
- {
37
- name: 'main-grid',
38
- top: '0px',
39
- left: '0px',
40
- right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,
41
- bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`,
42
- },
43
- ],
44
- graphic: [...baseGridLines],
45
- };
46
- };
47
-
48
- export { getResponsiveOption };