@oanda/labs-currency-power-balance-widget 1.0.1

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 (176) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/codegen.ts +15 -0
  3. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +46 -0
  4. package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -0
  5. package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +28 -0
  6. package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -0
  7. package/dist/main/CurrencyPowerBalanceWidget/Main.js +12 -0
  8. package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -0
  9. package/dist/main/CurrencyPowerBalanceWidget/Tool.js +28 -0
  10. package/dist/main/CurrencyPowerBalanceWidget/Tool.js.map +1 -0
  11. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +45 -0
  12. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -0
  13. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/index.js +17 -0
  14. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/index.js.map +1 -0
  15. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +31 -0
  16. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -0
  17. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +59 -0
  18. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -0
  19. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +103 -0
  20. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -0
  21. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +36 -0
  22. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -0
  23. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/index.js +28 -0
  24. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -0
  25. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/types.js +6 -0
  26. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -0
  27. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js +6 -0
  28. package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -0
  29. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +53 -0
  30. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -0
  31. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +46 -0
  32. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -0
  33. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js +17 -0
  34. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js.map +1 -0
  35. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js +6 -0
  36. package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -0
  37. package/dist/main/CurrencyPowerBalanceWidget/config.js +39 -0
  38. package/dist/main/CurrencyPowerBalanceWidget/config.js.map +1 -0
  39. package/dist/main/CurrencyPowerBalanceWidget/constants.js +8 -0
  40. package/dist/main/CurrencyPowerBalanceWidget/constants.js.map +1 -0
  41. package/dist/main/CurrencyPowerBalanceWidget/index.js +17 -0
  42. package/dist/main/CurrencyPowerBalanceWidget/index.js.map +1 -0
  43. package/dist/main/CurrencyPowerBalanceWidget/render.js +28 -0
  44. package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -0
  45. package/dist/main/CurrencyPowerBalanceWidget/types.js +6 -0
  46. package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -0
  47. package/dist/main/gql/getCurrencyPowerBalance.js +11 -0
  48. package/dist/main/gql/getCurrencyPowerBalance.js.map +1 -0
  49. package/dist/main/gql/types/fragment-masking.js +24 -0
  50. package/dist/main/gql/types/fragment-masking.js.map +1 -0
  51. package/dist/main/gql/types/gql.js +17 -0
  52. package/dist/main/gql/types/gql.js.map +1 -0
  53. package/dist/main/gql/types/graphql.js +171 -0
  54. package/dist/main/gql/types/graphql.js.map +1 -0
  55. package/dist/main/gql/types/index.js +28 -0
  56. package/dist/main/gql/types/index.js.map +1 -0
  57. package/dist/main/index.js +17 -0
  58. package/dist/main/index.js.map +1 -0
  59. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +39 -0
  60. package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -0
  61. package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +21 -0
  62. package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -0
  63. package/dist/module/CurrencyPowerBalanceWidget/Main.js +5 -0
  64. package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -0
  65. package/dist/module/CurrencyPowerBalanceWidget/Tool.js +20 -0
  66. package/dist/module/CurrencyPowerBalanceWidget/Tool.js.map +1 -0
  67. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +36 -0
  68. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -0
  69. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js +2 -0
  70. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/index.js.map +1 -0
  71. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +26 -0
  72. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -0
  73. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +52 -0
  74. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -0
  75. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +97 -0
  76. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -0
  77. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +30 -0
  78. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -0
  79. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js +3 -0
  80. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/index.js.map +1 -0
  81. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js +2 -0
  82. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -0
  83. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js +2 -0
  84. package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -0
  85. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +46 -0
  86. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -0
  87. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +39 -0
  88. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -0
  89. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js +2 -0
  90. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.js.map +1 -0
  91. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js +2 -0
  92. package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -0
  93. package/dist/module/CurrencyPowerBalanceWidget/config.js +34 -0
  94. package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -0
  95. package/dist/module/CurrencyPowerBalanceWidget/constants.js +2 -0
  96. package/dist/module/CurrencyPowerBalanceWidget/constants.js.map +1 -0
  97. package/dist/module/CurrencyPowerBalanceWidget/index.js +2 -0
  98. package/dist/module/CurrencyPowerBalanceWidget/index.js.map +1 -0
  99. package/dist/module/CurrencyPowerBalanceWidget/render.js +25 -0
  100. package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -0
  101. package/dist/module/CurrencyPowerBalanceWidget/types.js +2 -0
  102. package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -0
  103. package/dist/module/gql/getCurrencyPowerBalance.js +5 -0
  104. package/dist/module/gql/getCurrencyPowerBalance.js.map +1 -0
  105. package/dist/module/gql/types/fragment-masking.js +16 -0
  106. package/dist/module/gql/types/fragment-masking.js.map +1 -0
  107. package/dist/module/gql/types/gql.js +9 -0
  108. package/dist/module/gql/types/gql.js.map +1 -0
  109. package/dist/module/gql/types/graphql.js +165 -0
  110. package/dist/module/gql/types/graphql.js.map +1 -0
  111. package/dist/module/gql/types/index.js +3 -0
  112. package/dist/module/gql/types/index.js.map +1 -0
  113. package/dist/module/index.js +2 -0
  114. package/dist/module/index.js.map +1 -0
  115. package/dist/types/CurrencyPowerBalanceWidget/ChartWithData.d.ts +4 -0
  116. package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +4 -0
  117. package/dist/types/CurrencyPowerBalanceWidget/Main.d.ts +3 -0
  118. package/dist/types/CurrencyPowerBalanceWidget/Tool.d.ts +3 -0
  119. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/Chart.d.ts +4 -0
  120. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/index.d.ts +1 -0
  121. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/constants.d.ts +24 -0
  122. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/formatters.d.ts +5 -0
  123. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +74 -0
  124. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.d.ts +110 -0
  125. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/index.d.ts +2 -0
  126. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/types.d.ts +5 -0
  127. package/dist/types/CurrencyPowerBalanceWidget/components/Chart/types.d.ts +5 -0
  128. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.d.ts +4 -0
  129. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.d.ts +4 -0
  130. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.d.ts +1 -0
  131. package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.d.ts +12 -0
  132. package/dist/types/CurrencyPowerBalanceWidget/config.d.ts +11 -0
  133. package/dist/types/CurrencyPowerBalanceWidget/constants.d.ts +1 -0
  134. package/dist/types/CurrencyPowerBalanceWidget/index.d.ts +1 -0
  135. package/dist/types/CurrencyPowerBalanceWidget/render.d.ts +1 -0
  136. package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +12 -0
  137. package/dist/types/gql/getCurrencyPowerBalance.d.ts +1 -0
  138. package/dist/types/gql/types/fragment-masking.d.ts +15 -0
  139. package/dist/types/gql/types/gql.d.ts +36 -0
  140. package/dist/types/gql/types/graphql.d.ts +274 -0
  141. package/dist/types/gql/types/index.d.ts +2 -0
  142. package/dist/types/index.d.ts +1 -0
  143. package/index.ts +1 -0
  144. package/package.json +27 -0
  145. package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +48 -0
  146. package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +24 -0
  147. package/src/CurrencyPowerBalanceWidget/Main.tsx +10 -0
  148. package/src/CurrencyPowerBalanceWidget/Tool.tsx +27 -0
  149. package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +45 -0
  150. package/src/CurrencyPowerBalanceWidget/components/Chart/index.ts +1 -0
  151. package/src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx +41 -0
  152. package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +46 -0
  153. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +82 -0
  154. package/src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts +45 -0
  155. package/src/CurrencyPowerBalanceWidget/components/Chart/options/index.ts +2 -0
  156. package/src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts +5 -0
  157. package/src/CurrencyPowerBalanceWidget/components/Chart/types.ts +6 -0
  158. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx +24 -0
  159. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +58 -0
  160. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/index.ts +1 -0
  161. package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.ts +14 -0
  162. package/src/CurrencyPowerBalanceWidget/config.ts +30 -0
  163. package/src/CurrencyPowerBalanceWidget/constants.ts +1 -0
  164. package/src/CurrencyPowerBalanceWidget/index.ts +1 -0
  165. package/src/CurrencyPowerBalanceWidget/render.tsx +36 -0
  166. package/src/CurrencyPowerBalanceWidget/types.ts +15 -0
  167. package/src/gql/getCurrencyPowerBalance.ts +13 -0
  168. package/src/gql/types/fragment-masking.ts +66 -0
  169. package/src/gql/types/gql.ts +42 -0
  170. package/src/gql/types/graphql.ts +283 -0
  171. package/src/gql/types/index.ts +2 -0
  172. package/src/index.ts +1 -0
  173. package/test/Main.test.tsx +29 -0
  174. package/test/chartFormatters.test.ts +59 -0
  175. package/test/responsesMocks.ts +223 -0
  176. package/tsconfig.types.json +12 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.0.1 (2024-01-10)
7
+
8
+ **Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
package/codegen.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { CodegenConfig } from '@graphql-codegen/cli';
2
+
3
+ const config: CodegenConfig = {
4
+ overwrite: true,
5
+ schema: 'https://labs-api.uat.oanda.com/graphql',
6
+ documents: 'src/**/*.ts',
7
+ generates: {
8
+ 'src/gql/types/': {
9
+ preset: 'client',
10
+ plugins: [],
11
+ },
12
+ },
13
+ };
14
+
15
+ export default config;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ChartWithData = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _client = require("@apollo/client");
9
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
10
+ var _usehooksTs = require("usehooks-ts");
11
+ var _Chart = require("./components/Chart");
12
+ var _constants = require("./constants");
13
+ var _getCurrencyPowerBalance = require("../gql/getCurrencyPowerBalance");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ const ChartWithData = _ref => {
16
+ var _data$currencyPowerBa, _data$currencyPowerBa2;
17
+ let {
18
+ timeUnit
19
+ } = _ref;
20
+ const isDesktop = (0, _usehooksTs.useMediaQuery)('(min-width: 768px)');
21
+ const {
22
+ loading,
23
+ data,
24
+ error
25
+ } = (0, _client.useQuery)(_getCurrencyPowerBalance.getCurrencyPowerBalance, {
26
+ variables: {
27
+ timeUnit
28
+ }
29
+ });
30
+ const showChart = (data === null || data === void 0 ? void 0 : data.currencyPowerBalance) && (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) > 0;
31
+ const showError = (data === null || data === void 0 || (_data$currencyPowerBa2 = data.currencyPowerBalance) === null || _data$currencyPowerBa2 === void 0 ? void 0 : _data$currencyPowerBa2.length) === 0 || error;
32
+ return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
33
+ className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
34
+ }, _react.default.createElement(_labsWidgetCommon.Spinner, {
35
+ size: _labsWidgetCommon.SpinnerSize.lg
36
+ })), !loading && showChart && _react.default.createElement(_Chart.Chart, {
37
+ values: data === null || data === void 0 ? void 0 : data.currencyPowerBalance,
38
+ timeUnit: timeUnit
39
+ }), !loading && showError && _react.default.createElement("div", {
40
+ className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
41
+ }, _react.default.createElement(_labsWidgetCommon.ChartError, null)), isDesktop && _react.default.createElement(_labsWidgetCommon.Tooltip, {
42
+ id: _constants.CURRENCY_POWER_BALANCE_TOOLTIP_ID
43
+ }));
44
+ };
45
+ exports.ChartWithData = ChartWithData;
46
+ //# sourceMappingURL=ChartWithData.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartWithData.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_usehooksTs","_Chart","_constants","_getCurrencyPowerBalance","obj","__esModule","default","ChartWithData","_ref","_data$currencyPowerBa","_data$currencyPowerBa2","timeUnit","isDesktop","useMediaQuery","loading","data","error","useQuery","getCurrencyPowerBalance","variables","showChart","currencyPowerBalance","length","showError","createElement","Fragment","className","Spinner","size","SpinnerSize","lg","Chart","values","ChartError","Tooltip","id","CURRENCY_POWER_BALANCE_TOOLTIP_ID","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import React from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize, Tooltip,\n} from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport { ChartWithDataProps } from './types';\nimport { GetCurrencyPowerBalanceQuery, GetCurrencyPowerBalanceQueryVariables } from '../gql/types/graphql';\n\nconst ChartWithData = ({ timeUnit }: ChartWithDataProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n });\n\n const showChart = data?.currencyPowerBalance && data?.currencyPowerBalance?.length > 0;\n const showError = data?.currencyPowerBalance?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <Chart values={data?.currencyPowerBalance!} timeUnit={timeUnit} />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n {isDesktop && <Tooltip id={CURRENCY_POWER_BALANCE_TOOLTIP_ID} />}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAGA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,wBAAA,GAAAN,OAAA;AAAyE,SAAAD,uBAAAQ,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIzE,MAAMG,aAAa,GAAGC,IAAA,IAAsC;EAAA,IAAAC,qBAAA,EAAAC,sBAAA;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAH,IAAA;EACrD,MAAMI,SAAS,GAAG,IAAAC,yBAAa,EAAC,oBAAoB,CAAC;EACrD,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EA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,CAACzB,iBAAA,CAAAmC,OAAO;IAACC,EAAE,EAAEC;EAAkC,CAAE,CAC/D,CAAC;AAEP,CAAC;AAACC,OAAA,CAAA9B,aAAA,GAAAA,aAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CurrencyPowerBalance = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _client = require("@apollo/client");
9
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
10
+ var _Main = require("./Main");
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ const CurrencyPowerBalance = _ref => {
13
+ let {
14
+ graphqlUrl,
15
+ theme
16
+ } = _ref;
17
+ const client = new _client.ApolloClient({
18
+ uri: graphqlUrl,
19
+ cache: new _client.InMemoryCache()
20
+ });
21
+ return _react.default.createElement(_labsWidgetCommon.ThemeProvider, {
22
+ theme: theme
23
+ }, _react.default.createElement(_client.ApolloProvider, {
24
+ client: client
25
+ }, _react.default.createElement(_Main.Main, null)));
26
+ };
27
+ exports.CurrencyPowerBalance = CurrencyPowerBalance;
28
+ //# sourceMappingURL=CurrencyPowerBalance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_Main","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","ApolloProvider","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider } from '@oanda/labs-widget-common';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <ApolloProvider client={client}>\n <Main />\n </ApolloProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAA8B,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAG9B,MAAMG,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC;EACc,CAAC,GAAAF,IAAA;EAC3B,MAAMG,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEJ,UAAU;IACfK,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEjB,MAAA,CAAAQ,OAAA,CAAAU,aAAA,CAACd,iBAAA,CAAAe,aAAa;IAACP,KAAK,EAAEA;EAAM,GAC1BZ,MAAA,CAAAQ,OAAA,CAAAU,aAAA,CAACf,OAAA,CAAAiB,cAAc;IAACP,MAAM,EAAEA;EAAO,GAC7Bb,MAAA,CAAAQ,OAAA,CAAAU,aAAA,CAACb,KAAA,CAAAgB,IAAI,MAAE,CACO,CACH,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAAb,oBAAA,GAAAA,oBAAA"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Main = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _Tool = require("./Tool");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const Main = () => _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_Tool.Tool, null));
11
+ exports.Main = Main;
12
+ //# sourceMappingURL=Main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Main.js","names":["_react","_interopRequireDefault","require","_Tool","obj","__esModule","default","Main","createElement","Fragment","Tool","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import React from 'react';\nimport { Tool } from './Tool';\n\nconst Main = () => (\n <>\n <Tool />\n </>\n);\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAA8B,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9B,MAAMG,IAAI,GAAGA,CAAA,KACXP,MAAA,CAAAM,OAAA,CAAAE,aAAA,CAAAR,MAAA,CAAAM,OAAA,CAAAG,QAAA,QACET,MAAA,CAAAM,OAAA,CAAAE,aAAA,CAACL,KAAA,CAAAO,IAAI,MAAE,CACP,CACH;AAACC,OAAA,CAAAJ,IAAA,GAAAA,IAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Tool = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _config = require("./config");
9
+ var _TimeUnitSwitch = require("./components/TimeUnitSwitch");
10
+ var _ChartWithData = require("./ChartWithData");
11
+ var _graphql = require("../gql/types/graphql");
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
+ const Tool = () => {
15
+ const [selectedTimeUnit, setSelectedTimeUnit] = (0, _react.useState)(_graphql.CurrencyPowerBalanceTimeUnit.CurrentDay);
16
+ return _react.default.createElement("div", {
17
+ "data-testid": "currency-power-balance-wrapper",
18
+ className: "lw-flex lw-flex-col lw-overflow-hidden lw-text-sm lw-tracking-normal"
19
+ }, _react.default.createElement(_TimeUnitSwitch.TimeUnitSwitch, {
20
+ selected: selectedTimeUnit,
21
+ callback: setSelectedTimeUnit,
22
+ options: _config.timeUnitConfig
23
+ }), _react.default.createElement(_ChartWithData.ChartWithData, {
24
+ timeUnit: selectedTimeUnit
25
+ }));
26
+ };
27
+ exports.Tool = Tool;
28
+ //# sourceMappingURL=Tool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tool.js","names":["_react","_interopRequireWildcard","require","_config","_TimeUnitSwitch","_ChartWithData","_graphql","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","Tool","selectedTimeUnit","setSelectedTimeUnit","useState","CurrencyPowerBalanceTimeUnit","CurrentDay","createElement","className","TimeUnitSwitch","selected","callback","options","timeUnitConfig","ChartWithData","timeUnit","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Tool.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { timeUnitConfig } from './config';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { ChartWithData } from './ChartWithData';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nconst Tool = () => {\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(CurrencyPowerBalanceTimeUnit.CurrentDay);\n\n return (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-overflow-hidden lw-text-sm lw-tracking-normal\"\n >\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n />\n <ChartWithData\n timeUnit={selectedTimeUnit}\n />\n </div>\n );\n};\n\nexport { Tool };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAAoE,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEpE,MAAMY,IAAI,GAAGA,CAAA,KAAM;EACjB,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG,IAAAC,eAAQ,EAACC,qCAA4B,CAACC,UAAU,CAAC;EAEjG,OACEjC,MAAA,CAAAa,OAAA,CAAAqB,aAAA;IACE,eAAY,gCAAgC;IAC5CC,SAAS,EAAC;EAAsE,GAEhFnC,MAAA,CAAAa,OAAA,CAAAqB,aAAA,CAAC9B,eAAA,CAAAgC,cAAc;IACbC,QAAQ,EAAER,gBAAiB;IAC3BS,QAAQ,EAAER,mBAAoB;IAC9BS,OAAO,EAAEC;EAAe,CACzB,CAAC,EACFxC,MAAA,CAAAa,OAAA,CAAAqB,aAAA,CAAC7B,cAAA,CAAAoC,aAAa;IACZC,QAAQ,EAAEb;EAAiB,CAC5B,CACE,CAAC;AAEV,CAAC;AAACc,OAAA,CAAAf,IAAA,GAAAA,IAAA"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Chart = void 0;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _echartsForReact = _interopRequireDefault(require("echarts-for-react"));
9
+ var _echarts = require("echarts");
10
+ var _usehooksTs = require("usehooks-ts");
11
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
12
+ var _constants = require("./options/constants");
13
+ var _options = require("./options");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
+ (0, _echarts.registerTheme)('dark_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Dark));
18
+ (0, _echarts.registerTheme)('light_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Light));
19
+ const Chart = _ref => {
20
+ let {
21
+ values,
22
+ timeUnit
23
+ } = _ref;
24
+ const isDark = (0, _react.useContext)(_labsWidgetCommon.ThemeContext) === _labsWidgetCommon.Theme.Dark;
25
+ const echartRef = (0, _react.useRef)(null);
26
+ const isDesktop = (0, _usehooksTs.useMediaQuery)('(min-width: 768px)');
27
+ const isMobile = (0, _usehooksTs.useMediaQuery)('(max-width: 479px');
28
+ (0, _react.useEffect)(() => {
29
+ if (echartRef.current) {
30
+ const echartInstance = echartRef.current.getEchartsInstance();
31
+ echartInstance.setOption((0, _options.getResponsiveOption)(isDesktop, isMobile, isDark));
32
+ }
33
+ }, [echartRef, isDesktop, isMobile, isDark]);
34
+ return _react.default.createElement(_echartsForReact.default, {
35
+ ref: echartRef,
36
+ theme: isDark ? 'dark_theme' : 'light_theme',
37
+ style: {
38
+ height: "".concat(_constants.CHART_HEIGHT, "px"),
39
+ width: '100%'
40
+ },
41
+ option: (0, _options.getOption)(values, timeUnit, isDark)
42
+ });
43
+ };
44
+ exports.Chart = Chart;
45
+ //# sourceMappingURL=Chart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Chart.js","names":["_react","_interopRequireWildcard","require","_echartsForReact","_interopRequireDefault","_echarts","_usehooksTs","_labsWidgetCommon","_constants","_options","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","timeUnit","isDark","useContext","ThemeContext","echartRef","useRef","isDesktop","useMediaQuery","isMobile","useEffect","current","echartInstance","getEchartsInstance","setOption","getResponsiveOption","createElement","ref","theme","style","height","concat","CHART_HEIGHT","width","option","getOption","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useContext } from 'react';\nimport ReactECharts from 'echarts-for-react';\nimport { registerTheme, EChartsType } from 'echarts';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './options/constants';\nimport { getResponsiveOption, getOption } from './options';\nimport { ChartProps } from './types';\n\nregisterTheme('dark_theme', getChartTheme(Theme.Dark));\nregisterTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit }: ChartProps) => {\n const isDark = useContext(ThemeContext) === Theme.Dark;\n const echartRef = useRef(null);\n const isDesktop = useMediaQuery('(min-width: 768px)');\n const isMobile = useMediaQuery('(max-width: 479px');\n\n useEffect(() => {\n if (echartRef.current) {\n // @ts-ignore\n const echartInstance = echartRef.current.getEchartsInstance() as EChartsType;\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark),\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactECharts\n ref={echartRef}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\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AAY,OAAA,CAAA2C,aAAA,CAACpD,gBAAA,CAAAS,OAAY;IACX4C,GAAG,EAAEZ,SAAU;IACfa,KAAK,EAAEhB,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CiB,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKC,uBAAY,OAAI;MAC3BC,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAE,IAAAC,kBAAS,EAACzB,MAAM,EAAEC,QAAQ,EAAEC,MAAM;EAAE,CAC7C,CAAC;AAEN,CAAC;AAACwB,OAAA,CAAA5B,KAAA,GAAAA,KAAA"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _Chart = require("./Chart");
7
+ Object.keys(_Chart).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _Chart[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _Chart[key];
14
+ }
15
+ });
16
+ });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_Chart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Y_LABEL_SIZE_MOBILE = exports.Y_LABEL_SIZE = exports.X_LABEL_SIZE_MOBILE = exports.X_LABEL_SIZE = exports.VERTICAL_LINE_COUNT = exports.TOOLTIP_LINE_COLOR_CONFIG = exports.LEGEND_HEIGHT_MOBILE = exports.LEGEND_HEIGHT = exports.COLOR_CONFIG = exports.CHART_WIDTH = exports.CHART_HEIGHT = void 0;
7
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
8
+ const X_LABEL_SIZE = exports.X_LABEL_SIZE = 90;
9
+ const X_LABEL_SIZE_MOBILE = exports.X_LABEL_SIZE_MOBILE = 110;
10
+ const Y_LABEL_SIZE_MOBILE = exports.Y_LABEL_SIZE_MOBILE = 35;
11
+ const Y_LABEL_SIZE = exports.Y_LABEL_SIZE = 45;
12
+ const CHART_WIDTH = exports.CHART_WIDTH = 9999;
13
+ const CHART_HEIGHT = exports.CHART_HEIGHT = 425;
14
+ const LEGEND_HEIGHT = exports.LEGEND_HEIGHT = 50;
15
+ const LEGEND_HEIGHT_MOBILE = exports.LEGEND_HEIGHT_MOBILE = 70;
16
+ const VERTICAL_LINE_COUNT = exports.VERTICAL_LINE_COUNT = 10;
17
+ const COLOR_CONFIG = exports.COLOR_CONFIG = {
18
+ AUD: _labsWidgetCommon.colorPalette.orange,
19
+ JPY: _labsWidgetCommon.colorPalette.raspberryLight,
20
+ USD: _labsWidgetCommon.colorPalette.greenLight,
21
+ EUR: _labsWidgetCommon.colorPalette.turquoiseLight,
22
+ GBP: _labsWidgetCommon.colorPalette.violetLight,
23
+ CHF: _labsWidgetCommon.colorPalette.bottleGreen75Lighter,
24
+ CAD: _labsWidgetCommon.colorPalette.midnight75Lighter,
25
+ NZD: _labsWidgetCommon.colorPalette.gold
26
+ };
27
+ const TOOLTIP_LINE_COLOR_CONFIG = exports.TOOLTIP_LINE_COLOR_CONFIG = {
28
+ DARK: _labsWidgetCommon.colorPalette.orange,
29
+ LIGHT: _labsWidgetCommon.colorPalette.bottleGreenDark
30
+ };
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":["_labsWidgetCommon","require","X_LABEL_SIZE","exports","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","COLOR_CONFIG","AUD","colorPalette","orange","JPY","raspberryLight","USD","greenLight","EUR","turquoiseLight","GBP","violetLight","CHF","bottleGreen75Lighter","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nconst X_LABEL_SIZE = 90;\nconst X_LABEL_SIZE_MOBILE = 110;\nconst Y_LABEL_SIZE_MOBILE = 35;\nconst Y_LABEL_SIZE = 45;\nconst CHART_WIDTH = 9999;\nconst CHART_HEIGHT = 425;\nconst LEGEND_HEIGHT = 50;\nconst LEGEND_HEIGHT_MOBILE = 70;\nconst VERTICAL_LINE_COUNT = 10;\n\nconst COLOR_CONFIG = {\n AUD: colorPalette.orange,\n JPY: colorPalette.raspberryLight,\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n CHF: colorPalette.bottleGreen75Lighter,\n CAD: colorPalette.midnight75Lighter,\n NZD: colorPalette.gold,\n};\n\nconst TOOLTIP_LINE_COLOR_CONFIG = {\n DARK: colorPalette.orange,\n LIGHT: colorPalette.bottleGreenDark,\n};\n\nexport {\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n CHART_WIDTH,\n CHART_H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ACtB,CAAC"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.xAxisLabelFormatter = exports.tooltipFormatter = void 0;
7
+ const getDateAndTime = param => {
8
+ const dateAndTime = param.split('T');
9
+ return {
10
+ date: dateAndTime[0],
11
+ time: dateAndTime[1].substring(0, 5)
12
+ };
13
+ };
14
+ const dateFormat = date => "".concat(new Date(date).toLocaleDateString(undefined, {
15
+ month: 'numeric',
16
+ day: 'numeric'
17
+ }));
18
+ const dateTimeFormat = _ref => {
19
+ let {
20
+ date,
21
+ time
22
+ } = _ref;
23
+ return "".concat(new Date(date).toLocaleDateString(undefined, {
24
+ year: 'numeric',
25
+ month: 'numeric',
26
+ day: 'numeric'
27
+ }), ", ").concat(time, " UTC");
28
+ };
29
+ const xAxisLabelFormatter = (label, timeUnit) => {
30
+ const {
31
+ date,
32
+ time
33
+ } = getDateAndTime(label);
34
+ const isDateFormat = timeUnit.startsWith('M') || timeUnit.startsWith('W') || time === '00:00';
35
+ return isDateFormat ? dateFormat(date) : time;
36
+ };
37
+ exports.xAxisLabelFormatter = xAxisLabelFormatter;
38
+ const tooltipFormatter = values => {
39
+ const date = dateTimeFormat(getDateAndTime(values[0].value[0]));
40
+ const row = values.sort((_ref2, _ref3) => {
41
+ let {
42
+ value: valueA
43
+ } = _ref2;
44
+ let {
45
+ value: valueB
46
+ } = _ref3;
47
+ return Number(valueB[1]) - Number(valueA[1]);
48
+ }).map(_ref4 => {
49
+ let {
50
+ marker,
51
+ seriesName,
52
+ value
53
+ } = _ref4;
54
+ return "<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ".concat(marker, "\n <span>").concat(seriesName, "</span>\n </div>\n <span>").concat(value[1], "</span>\n </div>");
55
+ });
56
+ return "<div style=\"display:flex; flex-direction:column;\">\n <p style=\"margin-bottom:5px;\">".concat(date, "</p>\n ").concat(row.join('\n'), "\n </div>");
57
+ };
58
+ exports.tooltipFormatter = tooltipFormatter;
59
+ //# sourceMappingURL=formatters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatters.js","names":["getDateAndTime","param","dateAndTime","split","date","time","substring","dateFormat","concat","Date","toLocaleDateString","undefined","month","day","dateTimeFormat","_ref","year","xAxisLabelFormatter","label","timeUnit","isDateFormat","startsWith","exports","tooltipFormatter","values","value","row","sort","_ref2","_ref3","valueA","valueB","Number","map","_ref4","marker","seriesName","join"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport { TooltipFormatterParams } from './types';\n\nconst getDateAndTime = (param: string) => {\n const dateAndTime = param.split('T');\n\n return {\n date: dateAndTime[0],\n time: dateAndTime[1].substring(0, 5),\n };\n};\n\nconst dateFormat = (date: string) => `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nconst dateTimeFormat = ({ date, time }: { date: string, time: string }) => `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nconst xAxisLabelFormatter = (label: string, timeUnit: CurrencyPowerBalanceTimeUnit) => {\n const { date, time } = getDateAndTime(label);\n const isDateFormat = timeUnit.startsWith('M') || timeUnit.startsWith('W') || time === '00:00';\n\n return isDateFormat ? dateFormat(date) : time;\n};\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = dateTimeFormat(getDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(({ value: valueA }, { value: valueB }) => Number(valueB[1]) - Number(valueA[1]))\n .map(({ marker, seriesName, value }) => `<div style=\"display:flex;align-items:center;\">\n <div style=\"display:flex;align-items:center;width:50px;margin-right:10px;\">\n ${marker}\n <span>${seriesName}</span>\n </div>\n <span>${value[1]}</span>\n </div>`);\n\n return `<div style=\"display:flex; flex-direction:column;\">\n <p style=\"margin-bott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mBAAA,GAAAA,mBAAA;AAEF,MAAMM,gBAAgB,GAAIC,MAAgC,IAAK;EAC7D,MAAMpB,IAAI,GAAGU,cAAc,CAACd,cAAc,CAACwB,MAAM,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;EAE/D,MAAMC,GAAG,GAAGF,MAAM,CACfG,IAAI,CAAC,CAAAC,KAAA,EAAAC,KAAA;IAAA,IAAC;MAAEJ,KAAK,EAAEK;IAAO,CAAC,GAAAF,KAAA;IAAA,IAAE;MAAEH,KAAK,EAAEM;IAAO,CAAC,GAAAF,KAAA;IAAA,OAAKG,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC,CAAC,GAAGC,MAAM,CAACF,MAAM,CAAC,CAAC,CAAC,CAAC;EAAA,EAAC,CACrFG,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,MAAM;MAAEC,UAAU;MAAEX;IAAM,CAAC,GAAAS,KAAA;IAAA,yJAAA1B,MAAA,CAE7B2B,MAAM,sBAAA3B,MAAA,CACA4B,UAAU,yCAAA5B,MAAA,CAEZiB,KAAK,CAAC,CAAC,CAAC;EAAA,CACX,CAAC;EAEV,oGAAAjB,MAAA,CACkCJ,IAAI,gBAAAI,MAAA,CAClCkB,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AAEpB,CAAC;AAACf,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getOption = void 0;
7
+ var _constants = require("./constants");
8
+ var _formatters = require("./formatters");
9
+ const getOption = (values, timeUnit, isDark) => {
10
+ const seriesData = values.map(_ref => {
11
+ let {
12
+ currency,
13
+ power
14
+ } = _ref;
15
+ return {
16
+ name: currency,
17
+ type: 'line',
18
+ symbol: 'circle',
19
+ showSymbol: false,
20
+ itemStyle: {
21
+ color: _constants.COLOR_CONFIG[currency]
22
+ },
23
+ lineStyle: {
24
+ color: _constants.COLOR_CONFIG[currency]
25
+ },
26
+ data: power.map(_ref2 => {
27
+ let {
28
+ point,
29
+ price
30
+ } = _ref2;
31
+ return [point, price];
32
+ })
33
+ };
34
+ });
35
+ const legendData = values.map(_ref3 => {
36
+ let {
37
+ currency
38
+ } = _ref3;
39
+ return {
40
+ name: currency,
41
+ itemStyle: {
42
+ color: _constants.COLOR_CONFIG[currency]
43
+ }
44
+ };
45
+ });
46
+ return {
47
+ animation: false,
48
+ legend: {
49
+ data: legendData,
50
+ bottom: 10,
51
+ icon: 'circle'
52
+ },
53
+ tooltip: {
54
+ trigger: 'axis',
55
+ axisPointer: {
56
+ axis: 'x',
57
+ z: 0,
58
+ lineStyle: {
59
+ color: isDark ? _constants.TOOLTIP_LINE_COLOR_CONFIG.DARK : _constants.TOOLTIP_LINE_COLOR_CONFIG.LIGHT
60
+ }
61
+ },
62
+ formatter: _formatters.tooltipFormatter
63
+ },
64
+ xAxis: {
65
+ type: 'category',
66
+ axisTick: {
67
+ show: false
68
+ },
69
+ axisLine: {
70
+ show: false
71
+ },
72
+ splitLine: {
73
+ show: true
74
+ },
75
+ axisLabel: {
76
+ margin: 10,
77
+ showMinLabel: false,
78
+ rotate: -45,
79
+ interval: Math.round(seriesData[0].data.length / _constants.VERTICAL_LINE_COUNT),
80
+ formatter: label => (0, _formatters.xAxisLabelFormatter)(label, timeUnit)
81
+ }
82
+ },
83
+ yAxis: {
84
+ type: 'value',
85
+ position: 'right',
86
+ splitNumber: 5,
87
+ axisLine: {
88
+ show: false
89
+ },
90
+ axisTick: {
91
+ show: false
92
+ },
93
+ boundaryGap: ['10%', '10%'],
94
+ axisLabel: {
95
+ showMaxLabel: false,
96
+ showMinLabel: false
97
+ }
98
+ },
99
+ series: seriesData
100
+ };
101
+ };
102
+ exports.getOption = getOption;
103
+ //# sourceMappingURL=getOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOption.js","names":["_constants","require","_formatters","getOption","values","timeUnit","isDark","seriesData","map","_ref","currency","power","name","type","symbol","showSymbol","itemStyle","color","COLOR_CONFIG","lineStyle","data","_ref2","point","price","legendData","_ref3","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","formatter","tooltipFormatter","xAxis","axisTick","show","axisLine","splitLine","axisLabel","margin","showMinLabel","rotate","interval","Math","round","length","VERTICAL_LINE_COUNT","label","xAxisLabelFormatter","yAxis","position","splitNumber","boundaryGap","showMaxLabel","series","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT } from './constants';\nimport { tooltipFormatter, xAxisLabelFormatter } from './formatters';\nimport { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\n\nconst getOption = (\n values: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n) => {\n const seriesData = values.map(({ currency, power }) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n lineStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n }));\n\n const legendData = values.map(({ currency }) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n\n return {\n animation: false,\n legend: {\n data: legendData,\n bottom: 10,\n icon: 'circle',\n },\n tooltip: {\n trigger: 'axis',\n axisPointer: {\n axis: 'x',\n z: 0,\n lineStyle: {\n color: isDark ? TOOLTIP_LINE_COLOR_CONFIG.DARK : TOOLTIP_LINE_COLOR_CONFIG.LIGHT,\n },\n },\n formatter: tooltipFormatter,\n },\n xAxis: {\n type: 'category',\n axisTick: {\n show: false,\n },\n axisLine: { show: false },\n splitLine: {\n show: true,\n },\n axisLabel: {\n margin: 10,\n showMinLabel: false,\n rotate: -45,\n interval: Math.round(seriesData[0].data.length / VERTICAL_LINE_COUNT),\n formatter: (label: string) => xAxisLabelFormatter(label, timeUnit),\n },\n },\n yAxis: {\n type: 'value',\n position: 'right',\n splitNumber: 5,\n axisLine: { show: false },\n axisTick: { show: false },\n boundaryGap: ['10%', '10%'],\n axisLabel: {\n showMaxLabel: false,\n showMinLabel: false,\n },\n },\n series: seriesData,\n };\n};\n\nexport { getOption };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAGA,MAAME,SAAS,GAAGA,CAChBC,MAA8B,EAC9BC,QAAsC,EACtCC,MAAe,KACZ;EACH,MAAMC,UAAU,GAAGH,MAAM,CAACI,GAAG,CAACC,IAAA;IAAA,IAAC;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAAF,IAAA;IAAA,OAAM;MACtDG,IAAI,EAAEF,QAAQ;MACdG,IAAI,EAAE,MAAM;MACZC,MAAM,EAAE,QAAQ;MAChBC,UAAU,EAAE,KAAK;MACjBC,SAAS,EAAE;QACTC,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDS,SAAS,EAAE;QACTF,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B,CAAC;MACDU,IAAI,EAAET,KAAK,CAACH,GAAG,CAACa,KAAA;QAAA,IAAC;UAAEC,KAAK;UAAEC;QAAM,CAAC,GAAAF,KAAA;QAAA,OAAK,CAACC,KAAK,EAAEC,KAAK,CAAC;MAAA;IACtD,CAAC;EAAA,CAAC,CAAC;EAEH,MAAMC,UAAU,GAAGpB,MAAM,CAACI,GAAG,CAACiB,KAAA;IAAA,IAAC;MAAEf;IAAS,CAAC,GAAAe,KAAA;IAAA,OAAM;MAC/Cb,IAAI,EAAEF,QAAQ;MACdM,SAAS,EAAE;QACTC,KAAK,EAAEC,uBAAY,CAACR,QAAQ;MAC9B;IACF,CAAC;EAAA,CAAC,CAAC;E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tD;EACV,CAAC;AACH,CAAC;AAACuD,OAAA,CAAA3D,SAAA,GAAAA,SAAA"}
@@ -0,0 +1,36 @@
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: isDesktop,
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: "".concat(isMobile ? _constants.Y_LABEL_SIZE_MOBILE : _constants.Y_LABEL_SIZE, "px"),
30
+ bottom: "".concat(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
@@ -0,0 +1 @@
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","concat","bottom","graphic","exports"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\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 = (isDesktop: boolean, isMobile: boolean, isDark: boolean) => {\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: isDesktop,\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: [\n ...baseGridLines,\n ],\n };\n};\n\nexport { getResponsiveOption };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAWA,MAAME,mBAAmB,GAAGA,CAACC,SAAkB,EAAEC,QAAiB,EAAEC,MAAe,KAAK;EACtF,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,EAAEf,SAAS;IACxBgB,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,KAAAC,MAAA,CAAK1B,QAAQ,GAAGY,8BAAmB,GAAGC,uBAAY,OAAI;MAC3Dc,MAAM,KAAAD,MAAA,CAAK1B,QAAQ,GAAGS,8BAAmB,GAAGC,uBAAY;IAC1D,CAAC,CACF;IACDkB,OAAO,EAAE,CACP,GAAG1B,aAAa;EAEpB,CAAC;AACH,CAAC;AAAC2B,OAAA,CAAA/B,mBAAA,GAAAA,mBAAA"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _getOption = require("./getOption");
7
+ Object.keys(_getOption).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _getOption[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _getOption[key];
14
+ }
15
+ });
16
+ });
17
+ var _getResponsiveOption = require("./getResponsiveOption");
18
+ Object.keys(_getResponsiveOption).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _getResponsiveOption[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _getResponsiveOption[key];
25
+ }
26
+ });
27
+ });
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_getOption","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getResponsiveOption"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/index.ts"],"sourcesContent":["export * from './getOption';\nexport * from './getResponsiveOption';\n"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,oBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,oBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,oBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,oBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts"],"sourcesContent":["export interface TooltipFormatterParams {\n marker: string;\n seriesName: string;\n value: string[]\n}\n"],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/types.ts"],"sourcesContent":["import { CurrencyPowerBalance, CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nexport interface ChartProps {\n values: CurrencyPowerBalance[];\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}