@oanda/labs-currency-power-balance-widget 1.0.3 → 1.0.5
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.
- package/CHANGELOG.md +44 -0
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +8 -2
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/Tool.js +6 -1
- package/dist/main/CurrencyPowerBalanceWidget/Tool.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +2 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +3 -2
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +2 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/config.js +3 -3
- package/dist/main/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js +8 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/main/translations/index.js +19 -0
- package/dist/main/translations/index.js.map +1 -0
- package/dist/main/translations/sources/en.json +18 -0
- package/dist/main/translations/sources/zh_TW.json +18 -0
- package/dist/main/translations/translations.js +25 -0
- package/dist/main/translations/translations.js.map +1 -0
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -3
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/Tool.js +6 -1
- package/dist/module/CurrencyPowerBalanceWidget/Tool.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +2 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +3 -2
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +2 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/config.js +3 -3
- package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js +8 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/module/translations/index.js +12 -0
- package/dist/module/translations/index.js.map +1 -0
- package/dist/module/translations/sources/en.json +18 -0
- package/dist/module/translations/sources/zh_TW.json +18 -0
- package/dist/module/translations/translations.js +19 -0
- package/dist/module/translations/translations.js.map +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +1 -0
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +3 -0
- package/dist/types/translations/index.d.ts +4 -0
- package/dist/types/translations/translations.d.ts +18 -0
- package/lokalise.config.json +18 -0
- package/package.json +4 -3
- package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +9 -5
- package/src/CurrencyPowerBalanceWidget/Tool.tsx +3 -0
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +1 -1
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +1 -0
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx +5 -2
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +1 -0
- package/src/CurrencyPowerBalanceWidget/config.ts +3 -3
- package/src/CurrencyPowerBalanceWidget/render.tsx +5 -0
- package/src/CurrencyPowerBalanceWidget/types.ts +3 -0
- package/src/translations/index.ts +13 -0
- package/src/translations/sources/en.json +18 -0
- package/src/translations/sources/zh_TW.json +18 -0
- package/src/translations/translations.ts +18 -0
- package/test/chartFormatters.test.ts +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,50 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.5 (2024-01-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## 1.0.65 (2024-01-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.0.64 (2024-01-11)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## 1.0.63 (2024-01-11)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.0.62 (2024-01-10)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.0.4 (2024-01-11)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## 1.0.64 (2024-01-11)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## 1.0.63 (2024-01-11)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 1.0.62 (2024-01-10)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @oanda/labs-currency-power-balance-widget
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
6
50
|
## 1.0.3 (2024-01-11)
|
|
7
51
|
|
|
8
52
|
|
|
@@ -7,12 +7,15 @@ exports.CurrencyPowerBalance = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _client = require("@apollo/client");
|
|
9
9
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
10
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
10
11
|
var _Main = require("./Main");
|
|
12
|
+
var _translations = require("../translations");
|
|
11
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
14
|
const CurrencyPowerBalance = _ref => {
|
|
13
15
|
let {
|
|
14
16
|
graphqlUrl,
|
|
15
|
-
theme
|
|
17
|
+
theme,
|
|
18
|
+
locale
|
|
16
19
|
} = _ref;
|
|
17
20
|
const client = new _client.ApolloClient({
|
|
18
21
|
uri: graphqlUrl,
|
|
@@ -20,9 +23,12 @@ const CurrencyPowerBalance = _ref => {
|
|
|
20
23
|
});
|
|
21
24
|
return _react.default.createElement(_labsWidgetCommon.ThemeProvider, {
|
|
22
25
|
theme: theme
|
|
26
|
+
}, _react.default.createElement(_monoI18n.LocaleProvider, {
|
|
27
|
+
locale: (0, _labsWidgetCommon.getLocale)(locale),
|
|
28
|
+
translations: _translations.translations
|
|
23
29
|
}, _react.default.createElement(_client.ApolloProvider, {
|
|
24
30
|
client: client
|
|
25
|
-
}, _react.default.createElement(_Main.Main, null)));
|
|
31
|
+
}, _react.default.createElement(_Main.Main, null))));
|
|
26
32
|
};
|
|
27
33
|
exports.CurrencyPowerBalance = CurrencyPowerBalance;
|
|
28
34
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +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
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["_react","_interopRequireDefault","require","_client","_labsWidgetCommon","_monoI18n","_Main","_translations","obj","__esModule","default","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","client","ApolloClient","uri","cache","InMemoryCache","createElement","ThemeProvider","LocaleProvider","getLocale","translations","ApolloProvider","Main","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n <Main />\n </ApolloProvider>\n </LocaleProvider>\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,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,aAAA,GAAAL,OAAA;AAA+C,SAAAD,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE/C,MAAMG,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC;EACO,CAAC,GAAAH,IAAA;EAC3B,MAAMI,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAEL,UAAU;IACfM,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEpB,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAACjB,iBAAA,CAAAkB,aAAa;IAACR,KAAK,EAAEA;EAAM,GAC1Bd,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAAChB,SAAA,CAAAkB,cAAc;IAACR,MAAM,EAAE,IAAAS,2BAAS,EAACT,MAAM,CAAE;IAACU,YAAY,EAAEA;EAAa,GACpEzB,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAAClB,OAAA,CAAAuB,cAAc;IAACV,MAAM,EAAEA;EAAO,GAC7BhB,MAAA,CAAAU,OAAA,CAAAW,aAAA,CAACf,KAAA,CAAAqB,IAAI,MAAE,CACO,CACF,CACH,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAAjB,oBAAA,GAAAA,oBAAA"}
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Tool = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
8
9
|
var _config = require("./config");
|
|
9
10
|
var _TimeUnitSwitch = require("./components/TimeUnitSwitch");
|
|
10
11
|
var _ChartWithData = require("./ChartWithData");
|
|
@@ -13,13 +14,17 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
13
14
|
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
15
|
const Tool = () => {
|
|
15
16
|
const [selectedTimeUnit, setSelectedTimeUnit] = (0, _react.useState)(_graphql.CurrencyPowerBalanceTimeUnit.CurrentDay);
|
|
17
|
+
const {
|
|
18
|
+
lang
|
|
19
|
+
} = (0, _monoI18n.useLocale)();
|
|
16
20
|
return _react.default.createElement("div", {
|
|
17
21
|
"data-testid": "currency-power-balance-wrapper",
|
|
18
22
|
className: "lw-flex lw-flex-col lw-text-sm lw-tracking-normal"
|
|
19
23
|
}, _react.default.createElement(_TimeUnitSwitch.TimeUnitSwitch, {
|
|
20
24
|
selected: selectedTimeUnit,
|
|
21
25
|
callback: setSelectedTimeUnit,
|
|
22
|
-
options: _config.timeUnitConfig
|
|
26
|
+
options: _config.timeUnitConfig,
|
|
27
|
+
labelCallback: lang
|
|
23
28
|
}), _react.default.createElement(_ChartWithData.ChartWithData, {
|
|
24
29
|
timeUnit: selectedTimeUnit
|
|
25
30
|
}));
|
|
@@ -1 +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-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,
|
|
1
|
+
{"version":3,"file":"Tool.js","names":["_react","_interopRequireWildcard","require","_monoI18n","_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","lang","useLocale","createElement","className","TimeUnitSwitch","selected","callback","options","timeUnitConfig","labelCallback","ChartWithData","timeUnit","exports"],"sources":["../../../src/CurrencyPowerBalanceWidget/Tool.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\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 const { lang } = useLocale();\n\n return (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n >\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n labelCallback={lang}\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,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAAoE,SAAAM,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,SAAAR,wBAAAQ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,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AAEV,mBAAoB;IAC9BW,OAAO,EAAEC,sBAAe;IACxBC,aAAa,EAAET;EAAK,CACrB,CAAC,EACFnC,MAAA,CAAAc,OAAA,CAAAuB,aAAA,CAAC/B,cAAA,CAAAuC,aAAa;IACZC,QAAQ,EAAEhB;EAAiB,CAC5B,CACE,CAAC;AAEV,CAAC;AAACiB,OAAA,CAAAlB,IAAA,GAAAA,IAAA"}
|
|
@@ -53,7 +53,7 @@ const tooltipFormatter = values => {
|
|
|
53
53
|
} = _ref4;
|
|
54
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
55
|
});
|
|
56
|
-
return "<div style=\"display:flex; flex-direction:column;\">\n <
|
|
56
|
+
return "<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">".concat(date, "</span>\n ").concat(row.join('\n'), "\n </div>");
|
|
57
57
|
};
|
|
58
58
|
exports.tooltipFormatter = tooltipFormatter;
|
|
59
59
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +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 <
|
|
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 <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nexport {\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":";;;;;;AAGA,MAAMA,cAAc,GAAIC,KAAa,IAAK;EACxC,MAAMC,WAAW,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC;EAEpC,OAAO;IACLC,IAAI,EAAEF,WAAW,CAAC,CAAC,CAAC;IACpBG,IAAI,EAAEH,WAAW,CAAC,CAAC,CAAC,CAACI,SAAS,CAAC,CAAC,EAAE,CAAC;EACrC,CAAC;AACH,CAAC;AAED,MAAMC,UAAU,GAAIH,IAAY,OAAAI,MAAA,CAAQ,IAAIC,IAAI,CAACL,IAAI,CAAC,CAACM,kBAAkB,CAACC,SAAS,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,GAAG,EAAE;AAAU,CAAC,CAAC,CAAE;AAE5H,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAAEX,IAAI;IAAEC;EAAqC,CAAC,GAAAU,IAAA;EAAA,UAAAP,MAAA,CAAQ,IAAIC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CAEZiB,KAAK,CAAC,CAAC,CAAC;EAAA,CACX,CAAC;EAEV,uGAAAjB,MAAA,CACqCJ,IAAI,mBAAAI,MAAA,CACrCkB,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AAEpB,CAAC;AAACf,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
|
|
@@ -59,7 +59,8 @@ const getOption = (values, timeUnit, isDark) => {
|
|
|
59
59
|
color: isDark ? _constants.TOOLTIP_LINE_COLOR_CONFIG.DARK : _constants.TOOLTIP_LINE_COLOR_CONFIG.LIGHT
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
formatter: _formatters.tooltipFormatter
|
|
62
|
+
formatter: _formatters.tooltipFormatter,
|
|
63
|
+
extraCssText: 'z-index: 1'
|
|
63
64
|
},
|
|
64
65
|
xAxis: {
|
|
65
66
|
type: 'category',
|
|
@@ -1 +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;EAEH,OAAO;IACLgB,SAAS,EAAE,KAAK;IAChBC,MAAM,EAAE;MACNP,IAAI,EAAEI,UAAU;MAChBI,MAAM,EAAE,EAAE;MACVC,IAAI,EAAE;IACR,CAAC;IACDC,OAAO,EAAE;MACPC,OAAO,EAAE,MAAM;MACfC,WAAW,EAAE;QACXC,IAAI,EAAE,GAAG;QACTC,CAAC,EAAE,CAAC;QACJf,SAAS,EAAE;UACTF,KAAK,EAAEX,MAAM,GAAG6B,oCAAyB,CAACC,IAAI,GAAGD,oCAAyB,CAACE;QAC7E;MACF,CAAC;MACDC,SAAS,EAAEC;
|
|
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","extraCssText","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 extraCssText: 'z-index: 1',\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;EAEH,OAAO;IACLgB,SAAS,EAAE,KAAK;IAChBC,MAAM,EAAE;MACNP,IAAI,EAAEI,UAAU;MAChBI,MAAM,EAAE,EAAE;MACVC,IAAI,EAAE;IACR,CAAC;IACDC,OAAO,EAAE;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11
|
let {
|
|
12
12
|
selected,
|
|
13
13
|
options,
|
|
14
|
-
callback
|
|
14
|
+
callback,
|
|
15
|
+
labelCallback
|
|
15
16
|
} = _ref;
|
|
16
17
|
const selectOptions = options.map(_ref2 => {
|
|
17
18
|
let {
|
|
@@ -21,7 +22,7 @@ const TimeUnitSelect = _ref => {
|
|
|
21
22
|
} = _ref2;
|
|
22
23
|
return {
|
|
23
24
|
id,
|
|
24
|
-
label: tooltip || label
|
|
25
|
+
label: labelCallback ? labelCallback(tooltip || label) : tooltip || label
|
|
25
26
|
};
|
|
26
27
|
});
|
|
27
28
|
const [{
|
package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnitSelect.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","obj","__esModule","default","TimeUnitSelect","_ref","selected","options","callback","selectOptions","map","_ref2","value","id","label","tooltip","selectedLabel","filter","_ref3","createElement","className","Select","selectedOption","setSelectedOption","_ref4","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx"],"sourcesContent":["import React from 'react';\nimport { Select } from '@oanda/labs-widget-common';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nconst TimeUnitSelect = ({\n selected, options, callback,\n}: TimeUnitSwitchProps) => {\n const selectOptions = options\n .map(({ value: id, label, tooltip }) => ({
|
|
1
|
+
{"version":3,"file":"TimeUnitSelect.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","obj","__esModule","default","TimeUnitSelect","_ref","selected","options","callback","labelCallback","selectOptions","map","_ref2","value","id","label","tooltip","selectedLabel","filter","_ref3","createElement","className","Select","selectedOption","setSelectedOption","_ref4","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx"],"sourcesContent":["import React from 'react';\nimport { Select } from '@oanda/labs-widget-common';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\n\nconst TimeUnitSelect = ({\n selected, options, callback, labelCallback,\n}: TimeUnitSwitchProps) => {\n const selectOptions = options\n .map(({ value: id, label, tooltip }) => ({\n id,\n label: labelCallback ? labelCallback(tooltip || label) : tooltip || label,\n }));\n const [{ label: selectedLabel }] = selectOptions.filter(({ id }) => id === selected);\n\n return (\n <div data-testid=\"time-unit-select\" className=\"lw-mb-6 lw-w-full\">\n <Select\n options={selectOptions}\n selectedOption={{ id: selected, label: selectedLabel }}\n setSelectedOption={({ id }) => callback(id as CurrencyPowerBalanceTimeUnit)}\n />\n </div>\n );\n};\n\nexport { TimeUnitSelect };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAAmD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAInD,MAAMG,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EACV,CAAC,GAAAJ,IAAA;EACpB,MAAMK,aAAa,GAAGH,OAAO,CAC1BI,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,KAAK,EAAEC,EAAE;MAAEC,KAAK;MAAEC;IAAQ,CAAC,GAAAJ,KAAA;IAAA,OAAM;MACvCE,EAAE;MACFC,KAAK,EAAEN,aAAa,GAAGA,aAAa,CAACO,OAAO,IAAID,KAAK,CAAC,GAAGC,OAAO,IAAID;IACtE,CAAC;EAAA,CAAC,CAAC;EACL,MAAM,CAAC;IAAEA,KAAK,EAAEE;EAAc,CAAC,CAAC,GAAGP,aAAa,CAACQ,MAAM,CAACC,KAAA;IAAA,IAAC;MAAEL;IAAG,CAAC,GAAAK,KAAA;IAAA,OAAKL,EAAE,KAAKR,QAAQ;EAAA,EAAC;EAEpF,OACET,MAAA,CAAAM,OAAA,CAAAiB,aAAA;IAAK,eAAY,kBAAkB;IAACC,SAAS,EAAC;EAAmB,GAC/DxB,MAAA,CAAAM,OAAA,CAAAiB,aAAA,CAACpB,iBAAA,CAAAsB,MAAM;IACLf,OAAO,EAAEG,aAAc;IACvBa,cAAc,EAAE;MAAET,EAAE,EAAER,QAAQ;MAAES,KAAK,EAAEE;IAAc,CAAE;IACvDO,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEX;MAAG,CAAC,GAAAW,KAAA;MAAA,OAAKjB,QAAQ,CAACM,EAAkC,CAAC;IAAA;EAAC,CAC7E,CACE,CAAC;AAEV,CAAC;AAACY,OAAA,CAAAtB,cAAA,GAAAA,cAAA"}
|
|
@@ -39,7 +39,8 @@ const TimeUnitSwitch = _ref => {
|
|
|
39
39
|
})) : _react.default.createElement(_TimeUnitSelect.TimeUnitSelect, {
|
|
40
40
|
selected: selected,
|
|
41
41
|
callback: callback,
|
|
42
|
-
options: options
|
|
42
|
+
options: options,
|
|
43
|
+
labelCallback: labelCallback
|
|
43
44
|
}));
|
|
44
45
|
};
|
|
45
46
|
exports.TimeUnitSwitch = TimeUnitSwitch;
|
package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnitSwitch.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_usehooksTs","_constants","_TimeUnitSelect","obj","__esModule","default","TimeUnitSwitch","_ref","selected","options","callback","labelCallback","isDesktop","useMediaQuery","handleButtonClick","e","currentTarget","value","createElement","Fragment","className","map","item","tooltip","label","Button","key","size","ButtonSize","full","variant","ButtonVariant","primary","secondary","onClick","CURRENCY_POWER_BALANCE_TOOLTIP_ID","TimeUnitSelect","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, ButtonSize, ButtonVariant } from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';\nimport { TimeUnitSelect } from './TimeUnitSelect';\n\nconst TimeUnitSwitch = ({\n selected, options, callback, labelCallback,\n}: TimeUnitSwitchProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\n\n const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n callback(e.currentTarget.value as CurrencyPowerBalanceTimeUnit);\n };\n\n return (\n <>\n {isDesktop\n ? (\n <div data-testid=\"time-unit-switch\" className=\"lw-mb-6 lw-flex lw-gap-1 lw-self-end\">\n {options.map((item) => {\n const tooltip = labelCallback && item.tooltip\n ? labelCallback(item.tooltip)\n : item.tooltip;\n const label = labelCallback ? labelCallback(item.label) : item.label;\n\n return (\n <Button\n key={item.value}\n size={ButtonSize.full}\n variant={selected === item.value\n ? ButtonVariant.primary\n : ButtonVariant.secondary}\n onClick={handleButtonClick}\n value={item.value}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n data-tooltip-content={tooltip}\n >\n {label}\n </Button>\n );\n })}\n </div>\n )\n : (\n <TimeUnitSelect\n selected={selected}\n callback={callback}\n options={options}\n />\n )}\n </>\n );\n};\n\nexport { TimeUnitSwitch };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAAkD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,U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,MAAA,CAAAS,OAAA,CAAAa,aAAA,CAAChB,eAAA,CAAAkC,cAAc;IACb5B,QAAQ,EAAEA,QAAS;IACnBE,QAAQ,EAAEA,QAAS;IACnBD,OAAO,EAAEA;
|
|
1
|
+
{"version":3,"file":"TimeUnitSwitch.js","names":["_react","_interopRequireDefault","require","_labsWidgetCommon","_usehooksTs","_constants","_TimeUnitSelect","obj","__esModule","default","TimeUnitSwitch","_ref","selected","options","callback","labelCallback","isDesktop","useMediaQuery","handleButtonClick","e","currentTarget","value","createElement","Fragment","className","map","item","tooltip","label","Button","key","size","ButtonSize","full","variant","ButtonVariant","primary","secondary","onClick","CURRENCY_POWER_BALANCE_TOOLTIP_ID","TimeUnitSelect","exports"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx"],"sourcesContent":["import React from 'react';\nimport { Button, ButtonSize, ButtonVariant } from '@oanda/labs-widget-common';\nimport { useMediaQuery } from 'usehooks-ts';\nimport { TimeUnitSwitchProps } from './types';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../gql/types/graphql';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from '../../constants';\nimport { TimeUnitSelect } from './TimeUnitSelect';\n\nconst TimeUnitSwitch = ({\n selected, options, callback, labelCallback,\n}: TimeUnitSwitchProps) => {\n const isDesktop = useMediaQuery('(min-width: 768px)');\n\n const handleButtonClick = (e: React.SyntheticEvent<HTMLButtonElement>) => {\n callback(e.currentTarget.value as CurrencyPowerBalanceTimeUnit);\n };\n\n return (\n <>\n {isDesktop\n ? (\n <div data-testid=\"time-unit-switch\" className=\"lw-mb-6 lw-flex lw-gap-1 lw-self-end\">\n {options.map((item) => {\n const tooltip = labelCallback && item.tooltip\n ? labelCallback(item.tooltip)\n : item.tooltip;\n const label = labelCallback ? labelCallback(item.label) : item.label;\n\n return (\n <Button\n key={item.value}\n size={ButtonSize.full}\n variant={selected === item.value\n ? ButtonVariant.primary\n : ButtonVariant.secondary}\n onClick={handleButtonClick}\n value={item.value}\n data-tooltip-id={CURRENCY_POWER_BALANCE_TOOLTIP_ID}\n data-tooltip-content={tooltip}\n >\n {label}\n </Button>\n );\n })}\n </div>\n )\n : (\n <TimeUnitSelect\n selected={selected}\n callback={callback}\n options={options}\n labelCallback={labelCallback}\n />\n )}\n </>\n );\n};\n\nexport { TimeUnitSwitch };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAGA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAAkD,SAAAD,uBAAAM,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElD,MAAMG,cAAc,GAAGC,IAAA,IAEI;EAAA,IAFH;IACtBC,QAAQ;IAAEC,OAAO;IAAEC,QAAQ;IAAEC;EACV,CAAC,GAAAJ,IAAA;EACpB,MAAMK,SAAS,GAAG,IAAAC,yBAAa,EAAC,oBAAoB,CAAC;EAErD,MAAMC,iBAAiB,GAAIC,CAA0C,IAAK;IACxEL,QAAQ,CAACK,CAAC,CAACC,aAAa,CAACC,KAAqC,CAAC;EACjE,CAAC;EAED,OACErB,MAAA,CAAAS,OAAA,CAAAa,aAAA,CAAAtB,MAAA,CAAAS,OAAA,CAAAc,QAAA,QACGP,SAAS,GAENhB,MAAA,CAAAS,OAAA,CAAAa,aAAA;IAAK,eAAY,kBAAkB;IAACE,SAAS,EAAC;EAAsC,GACjFX,OAAO,CAACY,GAAG,CAAEC,IAAI,IAAK;IACrB,MAAMC,OAAO,GAAGZ,aAAa,IAAIW,IAAI,CAACC,OAAO,GACzCZ,aAAa,CAACW,IAAI,CAACC,OAAO,CAAC,GAC3BD,IAAI,CAACC,OAAO;IAChB,MAAMC,KAAK,GAAGb,aAAa,GAAGA,aAAa,CAACW,IAAI,CAACE,KAAK,CAAC,GAAGF,IAAI,CAACE,KAAK;IAEpE,OACE5B,MAAA,CAAAS,OAAA,CAAAa,aAAA,CAACnB,iBAAA,CAAA0B,MAAM;MACLC,GAAG,EAAEJ,IAAI,CAACL,KAAM;MAChBU,IAAI,EAAEC,4BAAU,CAACC,IAAK;MACtBC,OAAO,EAAEtB,QAAQ,KAAKc,IAAI,CAACL,KAAK,GAC5Bc,+BAAa,CAACC,OAAO,GACrBD,+BAAa,CAACE,SAAU;MAC5BC,OAAO,EAAEpB,iBAAkB;MAC3BG,KAAK,EAAEK,IAAI,CAACL,KAAM;MAClB,mBAAiBkB,4CAAkC;MACnD,wBAAsBZ;IAAQ,GAE7BC,KACK,CAAC;EAEb,CAAC,CACE,CAAC,GAGN5B,MAAA,CAAAS,OAAA,CAAAa,aAAA,CAAChB,eAAA,CAAAkC,cAAc;IACb5B,QAAQ,EAAEA,QAAS;IACnBE,QAAQ,EAAEA,QAAS;IACnBD,OAAO,EAAEA,OAAQ;IACjBE,aAAa,EAAEA;EAAc,CAC9B,CAEL,CAAC;AAEP,CAAC;AAAC0B,OAAA,CAAA/B,cAAA,GAAAA,cAAA"}
|
|
@@ -20,7 +20,7 @@ const timeUnitConfig = exports.timeUnitConfig = [{
|
|
|
20
20
|
}, {
|
|
21
21
|
value: _graphql.CurrencyPowerBalanceTimeUnit.H24,
|
|
22
22
|
label: '24h',
|
|
23
|
-
tooltip: '
|
|
23
|
+
tooltip: '24_hours'
|
|
24
24
|
}, {
|
|
25
25
|
value: _graphql.CurrencyPowerBalanceTimeUnit.H8,
|
|
26
26
|
label: '8h',
|
|
@@ -31,9 +31,9 @@ const timeUnitConfig = exports.timeUnitConfig = [{
|
|
|
31
31
|
tooltip: '4_hours'
|
|
32
32
|
}, {
|
|
33
33
|
value: _graphql.CurrencyPowerBalanceTimeUnit.PreviousDay,
|
|
34
|
-
label: '
|
|
34
|
+
label: 'previous_business_day'
|
|
35
35
|
}, {
|
|
36
36
|
value: _graphql.CurrencyPowerBalanceTimeUnit.CurrentDay,
|
|
37
|
-
label: '
|
|
37
|
+
label: 'current_business_day'
|
|
38
38
|
}];
|
|
39
39
|
//# sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["_graphql","require","timeUnitConfig","exports","value","CurrencyPowerBalanceTimeUnit","M3","label","tooltip","M1","W1","H24","H8","H4","PreviousDay","CurrentDay"],"sources":["../../../src/CurrencyPowerBalanceWidget/config.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nconst timeUnitConfig = [\n {\n value: CurrencyPowerBalanceTimeUnit.M3,\n label: '3m',\n tooltip: '3_months',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.M1,\n label: '1m',\n tooltip: '1_month',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.W1,\n label: '1w',\n tooltip: '1_week',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H24,\n label: '24h',\n tooltip: '
|
|
1
|
+
{"version":3,"file":"config.js","names":["_graphql","require","timeUnitConfig","exports","value","CurrencyPowerBalanceTimeUnit","M3","label","tooltip","M1","W1","H24","H8","H4","PreviousDay","CurrentDay"],"sources":["../../../src/CurrencyPowerBalanceWidget/config.ts"],"sourcesContent":["import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nconst timeUnitConfig = [\n {\n value: CurrencyPowerBalanceTimeUnit.M3,\n label: '3m',\n tooltip: '3_months',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.M1,\n label: '1m',\n tooltip: '1_month',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.W1,\n label: '1w',\n tooltip: '1_week',\n },\n {\n value: CurrencyPowerBalanceTimeUnit.H24,\n label: '24h',\n tooltip: '24_hours',\n },\n { value: CurrencyPowerBalanceTimeUnit.H8, label: '8h', tooltip: '8_hours' },\n { value: CurrencyPowerBalanceTimeUnit.H4, label: '4h', tooltip: '4_hours' },\n { value: CurrencyPowerBalanceTimeUnit.PreviousDay, label: 'previous_business_day' },\n { value: CurrencyPowerBalanceTimeUnit.CurrentDay, label: 'current_business_day' },\n];\n\nexport { timeUnitConfig };\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG,CACrB;EACEE,KAAK,EAAEC,qCAA4B,CAACC,EAAE;EACtCC,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACI,EAAE;EACtCF,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACK,EAAE;EACtCH,KAAK,EAAE,IAAI;EACXC,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,KAAK,EAAEC,qCAA4B,CAACM,GAAG;EACvCJ,KAAK,EAAE,KAAK;EACZC,OAAO,EAAE;AACX,CAAC,EACD;EAAEJ,KAAK,EAAEC,qCAA4B,CAACO,EAAE;EAAEL,KAAK,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAU,CAAC,EAC3E;EAAEJ,KAAK,EAAEC,qCAA4B,CAACQ,EAAE;EAAEN,KAAK,EAAE,IAAI;EAAEC,OAAO,EAAE;AAAU,CAAC,EAC3E;EAAEJ,KAAK,EAAEC,qCAA4B,CAACS,WAAW;EAAEP,KAAK,EAAE;AAAwB,CAAC,EACnF;EAAEH,KAAK,EAAEC,qCAA4B,CAACU,UAAU;EAAER,KAAK,EAAE;AAAuB,CAAC,CAClF"}
|
|
@@ -6,7 +6,8 @@ var _CurrencyPowerBalance = require("./CurrencyPowerBalance");
|
|
|
6
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
7
7
|
const {
|
|
8
8
|
graphqlUrl: configGraphQl,
|
|
9
|
-
renderElementId: configRenderElementId
|
|
9
|
+
renderElementId: configRenderElementId,
|
|
10
|
+
locale: configLocale
|
|
10
11
|
} = window.currencyPowerBalanceWidgetConfig || {};
|
|
11
12
|
const {
|
|
12
13
|
graphqlUrl
|
|
@@ -14,14 +15,20 @@ const {
|
|
|
14
15
|
const currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');
|
|
15
16
|
if (currencyPowerBalanceParamsElements.length > 0) {
|
|
16
17
|
currencyPowerBalanceParamsElements.forEach(element => {
|
|
18
|
+
const params = element.getAttribute('data-currency-power-balance-params');
|
|
17
19
|
const mode = element.getAttribute('data-mode');
|
|
20
|
+
const {
|
|
21
|
+
locale
|
|
22
|
+
} = JSON.parse(params);
|
|
18
23
|
(0, _reactDom.render)(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
|
|
19
24
|
graphqlUrl: graphqlUrl,
|
|
25
|
+
locale: locale,
|
|
20
26
|
theme: mode
|
|
21
27
|
}), element);
|
|
22
28
|
});
|
|
23
29
|
} else {
|
|
24
30
|
(0, _reactDom.render)(_react.default.createElement(_CurrencyPowerBalance.CurrencyPowerBalance, {
|
|
31
|
+
locale: configLocale,
|
|
25
32
|
graphqlUrl: configGraphQl
|
|
26
33
|
}), document.getElementById(configRenderElementId));
|
|
27
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_CurrencyPowerBalance","obj","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireDefault","require","_reactDom","_CurrencyPowerBalance","obj","__esModule","default","graphqlUrl","configGraphQl","renderElementId","configRenderElementId","locale","configLocale","window","currencyPowerBalanceWidgetConfig","widgetsConfig","currencyPowerBalanceParamsElements","document","querySelectorAll","length","forEach","element","params","getAttribute","mode","JSON","parse","render","createElement","CurrencyPowerBalance","theme","getElementById"],"sources":["../../../src/CurrencyPowerBalanceWidget/render.tsx"],"sourcesContent":["import React from 'react';\nimport { render } from 'react-dom';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalance } from './CurrencyPowerBalance';\n\nconst {\n graphqlUrl: configGraphQl,\n renderElementId: configRenderElementId,\n locale: configLocale,\n} = window.currencyPowerBalanceWidgetConfig || {};\n\nconst {\n graphqlUrl,\n} = window.widgetsConfig || {};\n\nconst currencyPowerBalanceParamsElements = document.querySelectorAll('div[data-currency-power-balance-params]');\n\nif (currencyPowerBalanceParamsElements.length > 0) {\n currencyPowerBalanceParamsElements.forEach((element) => {\n const params = element.getAttribute('data-currency-power-balance-params');\n const mode = element.getAttribute('data-mode');\n const { locale } = JSON.parse(params as string);\n\n render(\n <CurrencyPowerBalance\n graphqlUrl={graphqlUrl}\n locale={locale}\n theme={mode as Theme}\n />,\n element,\n );\n });\n} else {\n render(\n <CurrencyPowerBalance\n locale={configLocale}\n graphqlUrl={configGraphQl}\n />,\n document.getElementById(configRenderElementId),\n );\n}\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,qBAAA,GAAAF,OAAA;AAA8D,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9D,MAAM;EACJG,UAAU,EAAEC,aAAa;EACzBC,eAAe,EAAEC,qBAAqB;EACtCC,MAAM,EAAEC;AACV,CAAC,GAAGC,MAAM,CAACC,gCAAgC,IAAI,CAAC,CAAC;AAEjD,MAAM;EACJP;AACF,CAAC,GAAGM,MAAM,CAACE,aAAa,IAAI,CAAC,CAAC;AAE9B,MAAMC,kCAAkC,GAAGC,QAAQ,CAACC,gBAAgB,CAAC,yCAAyC,CAAC;AAE/G,IAAIF,kCAAkC,CAACG,MAAM,GAAG,CAAC,EAAE;EACjDH,kCAAkC,CAACI,OAAO,CAAEC,OAAO,IAAK;IACtD,MAAMC,MAAM,GAAGD,OAAO,CAACE,YAAY,CAAC,oCAAoC,CAAC;IACzE,MAAMC,IAAI,GAAGH,OAAO,CAACE,YAAY,CAAC,WAAW,CAAC;IAC9C,MAAM;MAAEZ;IAAO,CAAC,GAAGc,IAAI,CAACC,KAAK,CAACJ,MAAgB,CAAC;IAE/C,IAAAK,gBAAM,EACJ5B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAACzB,qBAAA,CAAA0B,oBAAoB;MACnBtB,UAAU,EAAEA,UAAW;MACvBI,MAAM,EAAEA,MAAO;MACfmB,KAAK,EAAEN;IAAc,CACtB,CAAC,EACFH,OACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,MAAM;EACL,IAAAM,gBAAM,EACJ5B,MAAA,CAAAO,OAAA,CAAAsB,aAAA,CAACzB,qBAAA,CAAA0B,oBAAoB;IACnBlB,MAAM,EAAEC,YAAa;IACrBL,UAAU,EAAEC;EAAc,CAC3B,CAAC,EACFS,QAAQ,CAACc,cAAc,CAACrB,qBAAqB,CAC/C,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n theme?: Theme;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/CurrencyPowerBalanceWidget/types.ts"],"sourcesContent":["import { Locale } from '@oanda/mono-i18n';\nimport { Theme } from '@oanda/labs-widget-common';\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\n\nexport interface CurrencyPowerBalanceConfig {\n graphqlUrl: string;\n locale: Locale;\n theme?: Theme;\n}\n\nexport interface CurrencyPowerBalanceWrapperConfig extends CurrencyPowerBalanceConfig {\n renderElementId: string;\n locale: Locale;\n}\n\nexport interface ChartWithDataProps {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.translations = void 0;
|
|
7
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
8
|
+
var _en = _interopRequireDefault(require("./sources/en.json"));
|
|
9
|
+
var _zh_TW = _interopRequireDefault(require("./sources/zh_TW.json"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const translations = exports.translations = {
|
|
12
|
+
[_monoI18n.Locale.en]: {
|
|
13
|
+
translation: _en.default
|
|
14
|
+
},
|
|
15
|
+
[_monoI18n.Locale.zhTW]: {
|
|
16
|
+
translation: _zh_TW.default
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","_zh_TW","obj","__esModule","default","translations","exports","Locale","en","translation","zhTW"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import { Locale, Translations } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport zhTW from './sources/zh_TW.json';\n\nimport { defaultTranslations } from './translations';\n\nexport type TranslationKey = keyof typeof defaultTranslations;\n\nexport const translations: Translations = {\n [Locale.en]: { translation: en },\n [Locale.zhTW]: { translation: zhTW },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAwC,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMjC,MAAMG,YAA0B,GAAAC,OAAA,CAAAD,YAAA,GAAG;EACxC,CAACE,gBAAM,CAACC,EAAE,GAAG;IAAEC,WAAW,EAAED;EAAG,CAAC;EAChC,CAACD,gBAAM,CAACG,IAAI,GAAG;IAAED,WAAW,EAAEC;EAAK;AACrC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"1_month": "1 month",
|
|
3
|
+
"1_week": "1 week",
|
|
4
|
+
"1m": "1M",
|
|
5
|
+
"1w": "1W",
|
|
6
|
+
"24_hours": "24 hours",
|
|
7
|
+
"24h": "24H",
|
|
8
|
+
"3_months": "3 months",
|
|
9
|
+
"3m": "3M",
|
|
10
|
+
"4_hours": "4 hours",
|
|
11
|
+
"4h": "4H",
|
|
12
|
+
"8_hours": "8 hours",
|
|
13
|
+
"8h": "8H",
|
|
14
|
+
"current_business_day": "Current Business Day",
|
|
15
|
+
"data_unavailable": "Data unavailable",
|
|
16
|
+
"pagination_entries_range": "{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries",
|
|
17
|
+
"previous_business_day": "Previous Business Day"
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"1_month": "1 個月",
|
|
3
|
+
"1_week": "1星期",
|
|
4
|
+
"1m": "1M",
|
|
5
|
+
"1w": "1W",
|
|
6
|
+
"24_hours": "24小時",
|
|
7
|
+
"24h": "24H",
|
|
8
|
+
"3_months": "3 個月",
|
|
9
|
+
"3m": "3M",
|
|
10
|
+
"4_hours": "4小時",
|
|
11
|
+
"4h": "4H",
|
|
12
|
+
"8_hours": "8小時",
|
|
13
|
+
"8h": "8H",
|
|
14
|
+
"current_business_day": "目前營業日",
|
|
15
|
+
"data_unavailable": "沒有數據",
|
|
16
|
+
"pagination_entries_range": "{{itemCount}}个挂单中的{{firstItemOnPage}}-{{lastItemOnPage}}",
|
|
17
|
+
"previous_business_day": "前一營業日"
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultTranslations = void 0;
|
|
7
|
+
const defaultTranslations = exports.defaultTranslations = {
|
|
8
|
+
'1_month': '1 month',
|
|
9
|
+
'1_week': '1 week',
|
|
10
|
+
'1m': '1M',
|
|
11
|
+
'1w': '1W',
|
|
12
|
+
'24_hours': '24 hours',
|
|
13
|
+
'24h': '24H',
|
|
14
|
+
'3_months': '3 months',
|
|
15
|
+
'3m': '3M',
|
|
16
|
+
'4_hours': '4 hours',
|
|
17
|
+
'4h': '4H',
|
|
18
|
+
'8_hours': '8 hours',
|
|
19
|
+
'8h': '8H',
|
|
20
|
+
current_business_day: 'Current Business Day',
|
|
21
|
+
data_unavailable: 'Data unavailable',
|
|
22
|
+
pagination_entries_range: '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',
|
|
23
|
+
previous_business_day: 'Previous Business Day'
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=translations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.js","names":["defaultTranslations","exports","current_business_day","data_unavailable","pagination_entries_range","previous_business_day"],"sources":["../../../src/translations/translations.ts"],"sourcesContent":["export const defaultTranslations = {\n '1_month': '1 month',\n '1_week': '1 week',\n '1m': '1M',\n '1w': '1W',\n '24_hours': '24 hours',\n '24h': '24H',\n '3_months': '3 months',\n '3m': '3M',\n '4_hours': '4 hours',\n '4h': '4H',\n '8_hours': '8 hours',\n '8h': '8H',\n current_business_day: 'Current Business Day',\n data_unavailable: 'Data unavailable',\n pagination_entries_range: '{{firstItemOnPage}}-{{lastItemOnPage}} of {{itemCount}} entries',\n previous_business_day: 'Previous Business Day',\n};\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG;EACjC,SAAS,EAAE,SAAS;EACpB,QAAQ,EAAE,QAAQ;EAClB,IAAI,EAAE,IAAI;EACV,IAAI,EAAE,IAAI;EACV,UAAU,EAAE,UAAU;EACtB,KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,UAAU;EACtB,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,SAAS;EACpB,IAAI,EAAE,IAAI;EACV,SAAS,EAAE,SAAS;EACpB,IAAI,EAAE,IAAI;EACVE,oBAAoB,EAAE,sBAAsB;EAC5CC,gBAAgB,EAAE,kBAAkB;EACpCC,wBAAwB,EAAE,iEAAiE;EAC3FC,qBAAqB,EAAE;AACzB,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
3
|
-
import { ThemeProvider } from '@oanda/labs-widget-common';
|
|
3
|
+
import { ThemeProvider, getLocale } from '@oanda/labs-widget-common';
|
|
4
|
+
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
4
5
|
import { Main } from './Main';
|
|
6
|
+
import { translations } from '../translations';
|
|
5
7
|
const CurrencyPowerBalance = _ref => {
|
|
6
8
|
let {
|
|
7
9
|
graphqlUrl,
|
|
8
|
-
theme
|
|
10
|
+
theme,
|
|
11
|
+
locale
|
|
9
12
|
} = _ref;
|
|
10
13
|
const client = new ApolloClient({
|
|
11
14
|
uri: graphqlUrl,
|
|
@@ -13,9 +16,12 @@ const CurrencyPowerBalance = _ref => {
|
|
|
13
16
|
});
|
|
14
17
|
return React.createElement(ThemeProvider, {
|
|
15
18
|
theme: theme
|
|
19
|
+
}, React.createElement(LocaleProvider, {
|
|
20
|
+
locale: getLocale(locale),
|
|
21
|
+
translations: translations
|
|
16
22
|
}, React.createElement(ApolloProvider, {
|
|
17
23
|
client: client
|
|
18
|
-
}, React.createElement(Main, null)));
|
|
24
|
+
}, React.createElement(Main, null))));
|
|
19
25
|
};
|
|
20
26
|
export { CurrencyPowerBalance };
|
|
21
27
|
//# sourceMappingURL=CurrencyPowerBalance.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","ThemeProvider","Main","CurrencyPowerBalance","_ref","graphqlUrl","theme","client","uri","cache","createElement"],"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
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["React","ApolloClient","InMemoryCache","ApolloProvider","ThemeProvider","getLocale","LocaleProvider","Main","translations","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","client","uri","cache","createElement"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import React from 'react';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { Main } from './Main';\nimport { CurrencyPowerBalanceConfig } from './types';\nimport { translations } from '../translations';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl, theme, locale,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n <Main />\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AACpE,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,IAAI,QAAQ,QAAQ;AAE7B,SAASC,YAAY,QAAQ,iBAAiB;AAE9C,MAAMC,oBAAoB,GAAGC,IAAA,IAEK;EAAA,IAFJ;IAC5BC,UAAU;IAAEC,KAAK;IAAEC;EACO,CAAC,GAAAH,IAAA;EAC3B,MAAMI,MAAM,GAAG,IAAIb,YAAY,CAAC;IAC9Bc,GAAG,EAAEJ,UAAU;IACfK,KAAK,EAAE,IAAId,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEF,KAAA,CAAAiB,aAAA,CAACb,aAAa;IAACQ,KAAK,EAAEA;EAAM,GAC1BZ,KAAA,CAAAiB,aAAA,CAACX,cAAc;IAACO,MAAM,EAAER,SAAS,CAACQ,MAAM,CAAE;IAACL,YAAY,EAAEA;EAAa,GACpER,KAAA,CAAAiB,aAAA,CAACd,cAAc;IAACW,MAAM,EAAEA;EAAO,GAC7Bd,KAAA,CAAAiB,aAAA,CAACV,IAAI,MAAE,CACO,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASE,oBAAoB"}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
+
import { useLocale } from '@oanda/mono-i18n';
|
|
2
3
|
import { timeUnitConfig } from './config';
|
|
3
4
|
import { TimeUnitSwitch } from './components/TimeUnitSwitch';
|
|
4
5
|
import { ChartWithData } from './ChartWithData';
|
|
5
6
|
import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';
|
|
6
7
|
const Tool = () => {
|
|
7
8
|
const [selectedTimeUnit, setSelectedTimeUnit] = useState(CurrencyPowerBalanceTimeUnit.CurrentDay);
|
|
9
|
+
const {
|
|
10
|
+
lang
|
|
11
|
+
} = useLocale();
|
|
8
12
|
return React.createElement("div", {
|
|
9
13
|
"data-testid": "currency-power-balance-wrapper",
|
|
10
14
|
className: "lw-flex lw-flex-col lw-text-sm lw-tracking-normal"
|
|
11
15
|
}, React.createElement(TimeUnitSwitch, {
|
|
12
16
|
selected: selectedTimeUnit,
|
|
13
17
|
callback: setSelectedTimeUnit,
|
|
14
|
-
options: timeUnitConfig
|
|
18
|
+
options: timeUnitConfig,
|
|
19
|
+
labelCallback: lang
|
|
15
20
|
}), React.createElement(ChartWithData, {
|
|
16
21
|
timeUnit: selectedTimeUnit
|
|
17
22
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tool.js","names":["React","useState","timeUnitConfig","TimeUnitSwitch","ChartWithData","CurrencyPowerBalanceTimeUnit","Tool","selectedTimeUnit","setSelectedTimeUnit","CurrentDay","createElement","className","selected","callback","options","timeUnit"],"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-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,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,4BAA4B,QAAQ,sBAAsB;AAEnE,MAAMC,IAAI,GAAGA,CAAA,KAAM;EACjB,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"Tool.js","names":["React","useState","useLocale","timeUnitConfig","TimeUnitSwitch","ChartWithData","CurrencyPowerBalanceTimeUnit","Tool","selectedTimeUnit","setSelectedTimeUnit","CurrentDay","lang","createElement","className","selected","callback","options","labelCallback","timeUnit"],"sources":["../../../src/CurrencyPowerBalanceWidget/Tool.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\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 const { lang } = useLocale();\n\n return (\n <div\n data-testid=\"currency-power-balance-wrapper\"\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n >\n <TimeUnitSwitch\n selected={selectedTimeUnit}\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n labelCallback={lang}\n />\n <ChartWithData\n timeUnit={selectedTimeUnit}\n />\n </div>\n );\n};\n\nexport { Tool };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,cAAc,QAAQ,UAAU;AACzC,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,4BAA4B,QAAQ,sBAAsB;AAEnE,MAAMC,IAAI,GAAGA,CAAA,KAAM;EACjB,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGR,QAAQ,CAACK,4BAA4B,CAACI,UAAU,CAAC;EACjG,MAAM;IAAEC;EAAK,CAAC,GAAGT,SAAS,CAAC,CAAC;EAE5B,OACEF,KAAA,CAAAY,aAAA;IACE,eAAY,gCAAgC;IAC5CC,SAAS,EAAC;EAAmD,GAE7Db,KAAA,CAAAY,aAAA,CAACR,cAAc;IACbU,QAAQ,EAAEN,gBAAiB;IAC3BO,QAAQ,EAAEN,mBAAoB;IAC9BO,OAAO,EAAEb,cAAe;IACxBc,aAAa,EAAEN;EAAK,CACrB,CAAC,EACFX,KAAA,CAAAY,aAAA,CAACP,aAAa;IACZa,QAAQ,EAAEV;EAAiB,CAC5B,CACE,CAAC;AAEV,CAAC;AAED,SAASD,IAAI"}
|
|
@@ -46,7 +46,7 @@ const tooltipFormatter = values => {
|
|
|
46
46
|
} = _ref4;
|
|
47
47
|
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>");
|
|
48
48
|
});
|
|
49
|
-
return "<div style=\"display:flex; flex-direction:column;\">\n <
|
|
49
|
+
return "<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">".concat(date, "</span>\n ").concat(row.join('\n'), "\n </div>");
|
|
50
50
|
};
|
|
51
51
|
export { tooltipFormatter, xAxisLabelFormatter };
|
|
52
52
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +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","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 <
|
|
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","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 <span style=\"margin-bottom:5px;\">${date}</span>\n ${row.join('\\n')}\n </div>`;\n};\n\nexport {\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":"AAGA,MAAMA,cAAc,GAAIC,KAAa,IAAK;EACxC,MAAMC,WAAW,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC;EAEpC,OAAO;IACLC,IAAI,EAAEF,WAAW,CAAC,CAAC,CA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