@oanda/labs-currency-power-balance-widget 1.0.112 → 1.0.114
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 +916 -0
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js +9 -8
- package/dist/main/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -9
- package/dist/main/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/Main.js +12 -12
- package/dist/main/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js +12 -12
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +6 -15
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +2 -2
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +4 -4
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +9 -9
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/constants.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/render.js +8 -8
- package/dist/main/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/main/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/main/gql/getCurrencyPowerBalance.js +3 -12
- package/dist/main/gql/getCurrencyPowerBalance.js.map +1 -1
- package/dist/main/gql/types/fragment-masking.js +3 -2
- package/dist/main/gql/types/fragment-masking.js.map +1 -1
- package/dist/main/gql/types/gql.js +3 -2
- package/dist/main/gql/types/gql.js.map +1 -1
- package/dist/main/gql/types/graphql.js +64 -64
- package/dist/main/gql/types/graphql.js.map +1 -1
- package/dist/main/gql/types/index.js.map +1 -1
- package/dist/main/translations/index.js +1 -1
- package/dist/main/translations/index.js.map +1 -1
- package/dist/main/translations/translations.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js +9 -8
- package/dist/module/CurrencyPowerBalanceWidget/ChartWithData.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js +9 -9
- package/dist/module/CurrencyPowerBalanceWidget/CurrencyPowerBalance.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/Main.js +12 -12
- package/dist/module/CurrencyPowerBalanceWidget/Main.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js +11 -11
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js +8 -17
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/formatters.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js +2 -2
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js +2 -2
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/utils.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/Chart/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js +4 -4
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js +10 -10
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/config.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/constants.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/render.js +8 -8
- package/dist/module/CurrencyPowerBalanceWidget/render.js.map +1 -1
- package/dist/module/CurrencyPowerBalanceWidget/types.js.map +1 -1
- package/dist/module/gql/getCurrencyPowerBalance.js +3 -12
- package/dist/module/gql/getCurrencyPowerBalance.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +3 -2
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +3 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +64 -64
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +2 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/translations/index.js +1 -1
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/ChartWithData.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/CurrencyPowerBalance.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/Main.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/Chart.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/constants.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/formatters.d.ts +4 -3
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/getOption.d.ts +2 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/options/utils.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/Chart/types.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.d.ts +1 -1
- package/dist/types/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.d.ts +3 -3
- package/dist/types/CurrencyPowerBalanceWidget/types.d.ts +2 -2
- package/dist/types/gql/types/gql.d.ts +2 -2
- package/dist/types/gql/types/index.d.ts +2 -2
- package/dist/types/translations/index.d.ts +2 -2
- package/package.json +3 -3
- package/src/CurrencyPowerBalanceWidget/ChartWithData.tsx +31 -17
- package/src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx +16 -9
- package/src/CurrencyPowerBalanceWidget/Main.tsx +18 -9
- package/src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx +25 -20
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts +11 -10
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts +42 -22
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts +59 -44
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts +7 -4
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/types.ts +1 -1
- package/src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts +10 -9
- package/src/CurrencyPowerBalanceWidget/components/Chart/types.ts +4 -1
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSelect.tsx +21 -15
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/TimeUnitSwitch.tsx +47 -37
- package/src/CurrencyPowerBalanceWidget/components/TimeUnitSwitch/types.ts +3 -3
- package/src/CurrencyPowerBalanceWidget/config.ts +8 -2
- package/src/CurrencyPowerBalanceWidget/constants.ts +2 -1
- package/src/CurrencyPowerBalanceWidget/render.tsx +24 -20
- package/src/CurrencyPowerBalanceWidget/types.ts +5 -3
- package/src/gql/types/fragment-masking.ts +41 -21
- package/src/gql/types/gql.ts +7 -3
- package/src/gql/types/graphql.ts +117 -44
- package/src/gql/types/index.ts +2 -2
- package/src/translations/index.ts +4 -4
- package/src/translations/translations.ts +2 -1
- package/test/Main.test.tsx +28 -14
- package/test/chartFormatters.test.ts +84 -24
- package/test/responsesMocks.ts +254 -255
- package/test/utils.test.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","_es","_th","_zh_TW","e","__esModule","default","translations","exports","Locale","en","translation","zhTW","es","th"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import type { Translations } from '@oanda/mono-i18n';\nimport { Locale } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport es from './sources/es.json';\nimport th from './sources/th.json';\nimport zhTW from './sources/zh_TW.json';\nimport type { 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 [Locale.es]: { translation: es },\n [Locale.th]: { translation: th },\n};\n"],"mappings":";;;;;;AACA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,GAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,GAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,MAAA,GAAAH,sBAAA,CAAAF,OAAA;AAAwC,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAKjC,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,CAAC;EACpC,CAACH,gBAAM,CAACI,EAAE,GAAG;IAAEF,WAAW,EAAEE;EAAG,CAAC;EAChC,CAACJ,gBAAM,CAACK,EAAE,GAAG;IAAEH,WAAW,EAAEG;EAAG;AACjC,CAAC","ignoreList":[]}
|
|
@@ -1 +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
|
|
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:\n '{{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,EACtB,iEAAiE;EACnEC,qBAAqB,EAAE;AACzB,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { useQuery } from '@apollo/client';
|
|
2
|
+
import { ChartError, LastUpdated, Size, Spinner, SpinnerSize, Tooltip, useLayoutProvider } from '@oanda/labs-widget-common';
|
|
3
3
|
import { useLocale } from '@oanda/mono-i18n';
|
|
4
|
-
import
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';
|
|
5
6
|
import { Chart } from './components/Chart';
|
|
6
7
|
import { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';
|
|
7
|
-
import { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';
|
|
8
8
|
const ChartWithData = _ref => {
|
|
9
|
+
var _data$currencyPowerBa, _;
|
|
9
10
|
let {
|
|
10
11
|
timeUnit,
|
|
11
12
|
currencies
|
|
@@ -27,15 +28,15 @@ const ChartWithData = _ref => {
|
|
|
27
28
|
},
|
|
28
29
|
fetchPolicy: 'cache-and-network'
|
|
29
30
|
});
|
|
30
|
-
const showError = data
|
|
31
|
+
const showError = (data === null || data === void 0 || (_data$currencyPowerBa = data.currencyPowerBalance) === null || _data$currencyPowerBa === void 0 ? void 0 : _data$currencyPowerBa.length) === 0 || error || currencies && (currencies.length === 0 || currencies.length === 1);
|
|
31
32
|
return React.createElement(React.Fragment, null, loading && React.createElement("div", {
|
|
32
33
|
className: "lw-mb-[50px] lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
33
34
|
}, React.createElement(Spinner, {
|
|
34
35
|
size: SpinnerSize.lg
|
|
35
36
|
})), !loading && !showError && React.createElement(Chart, {
|
|
36
|
-
|
|
37
|
+
currencies: currencies,
|
|
37
38
|
timeUnit: timeUnit,
|
|
38
|
-
|
|
39
|
+
values: data === null || data === void 0 ? void 0 : data.currencyPowerBalance
|
|
39
40
|
}), !loading && showError && React.createElement("div", {
|
|
40
41
|
className: "lw-flex lw-h-[375px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
41
42
|
}, React.createElement(ChartError, null)), isDesktop && React.createElement(Tooltip, {
|
|
@@ -43,8 +44,8 @@ const ChartWithData = _ref => {
|
|
|
43
44
|
}), React.createElement("div", {
|
|
44
45
|
className: "lw-mt-2 lw-h-8"
|
|
45
46
|
}, !loading && !showError && React.createElement(LastUpdated, {
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
labelCallback: lang,
|
|
48
|
+
timestamp: data === null || data === void 0 || (_ = data.currencyPowerBalance[0]) === null || _ === void 0 ? void 0 : _.updatedAt
|
|
48
49
|
})));
|
|
49
50
|
};
|
|
50
51
|
export { ChartWithData };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartWithData.js","names":["
|
|
1
|
+
{"version":3,"file":"ChartWithData.js","names":["useQuery","ChartError","LastUpdated","Size","Spinner","SpinnerSize","Tooltip","useLayoutProvider","useLocale","React","getCurrencyPowerBalance","Chart","CURRENCY_POWER_BALANCE_TOOLTIP_ID","ChartWithData","_ref","_data$currencyPowerBa","_","timeUnit","currencies","size","isDesktop","DESKTOP","lang","loading","data","error","variables","fetchPolicy","showError","currencyPowerBalance","length","createElement","Fragment","className","lg","values","id","labelCallback","timestamp","updatedAt"],"sources":["../../../src/CurrencyPowerBalanceWidget/ChartWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n Tooltip,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { getCurrencyPowerBalance } from '../gql/getCurrencyPowerBalance';\nimport type {\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables,\n} from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { CURRENCY_POWER_BALANCE_TOOLTIP_ID } from './constants';\nimport type { ChartWithDataProps } from './types';\n\nconst ChartWithData = ({ timeUnit, currencies }: ChartWithDataProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<\n GetCurrencyPowerBalanceQuery,\n GetCurrencyPowerBalanceQueryVariables\n >(getCurrencyPowerBalance, {\n variables: {\n timeUnit,\n },\n fetchPolicy: 'cache-and-network',\n });\n\n const showError =\n data?.currencyPowerBalance?.length === 0 ||\n error ||\n (currencies && (currencies.length === 0 || currencies.length === 1));\n\n return (\n <>\n {loading && (\n <div className=\"lw-mb-[50px] lw-flex lw-h-[375px] 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 && !showError && (\n <Chart\n currencies={currencies}\n timeUnit={timeUnit}\n values={data?.currencyPowerBalance!}\n />\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[375px] 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 <div className=\"lw-mt-2 lw-h-8\">\n {!loading && !showError && (\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyPowerBalance![0]?.updatedAt}\n />\n )}\n </div>\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAgB;AACzC,SACEC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,OAAO,EACPC,WAAW,EACXC,OAAO,EACPC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,uBAAuB,QAAQ,gCAAgC;AAKxE,SAASC,KAAK,QAAQ,oBAAoB;AAC1C,SAASC,iCAAiC,QAAQ,aAAa;AAG/D,MAAMC,aAAa,GAAGC,IAAA,IAAkD;EAAA,IAAAC,qBAAA,EAAAC,CAAA;EAAA,IAAjD;IAAEC,QAAQ;IAAEC;EAA+B,CAAC,GAAAJ,IAAA;EACjE,MAAM;IAAEK;EAAK,CAAC,GAAGZ,iBAAiB,CAAC,CAAC;EACpC,MAAMa,SAAS,GAAGD,IAAI,KAAKhB,IAAI,CAACkB,OAAO;EACvC,MAAM;IAAEC;EAAK,CAAC,GAAGd,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEe,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAGzB,QA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AJA,IAAI,gBAAAR,CAAA,GAAJQ,IAAI,CAAEK,oBAAoB,CAAE,CAAC,CAAC,cAAAb,CAAA,uBAA9BA,CAAA,CAAgCuB;EAAU,CACtD,CAEA,CACL,CAAC;AAEP,CAAC;AAED,SAAS1B,aAAa","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ApolloClient, InMemoryCache } from '@apollo/client';
|
|
3
2
|
import { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';
|
|
4
|
-
import
|
|
3
|
+
import React from 'react';
|
|
5
4
|
import { translations } from '../translations';
|
|
5
|
+
import { Main } from './Main';
|
|
6
6
|
const CurrencyPowerBalance = _ref => {
|
|
7
7
|
let {
|
|
8
8
|
graphqlUrl,
|
|
@@ -18,17 +18,17 @@ const CurrencyPowerBalance = _ref => {
|
|
|
18
18
|
cache: new InMemoryCache()
|
|
19
19
|
});
|
|
20
20
|
return React.createElement(WidgetProvider, {
|
|
21
|
-
locale: locale,
|
|
22
|
-
translations: translations,
|
|
23
21
|
client: client,
|
|
24
|
-
|
|
22
|
+
locale: locale,
|
|
23
|
+
theme: theme,
|
|
24
|
+
translations: translations
|
|
25
25
|
}, React.createElement(WidgetWrapper, {
|
|
26
|
-
|
|
26
|
+
isParamError: isParamError,
|
|
27
27
|
linkArea: "logo",
|
|
28
|
-
|
|
28
|
+
logoLink: logoLink
|
|
29
29
|
}, React.createElement(Main, {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
currencies: currencies,
|
|
31
|
+
timeUnit: timeUnit
|
|
32
32
|
})));
|
|
33
33
|
};
|
|
34
34
|
export { CurrencyPowerBalance };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyPowerBalance.js","names":["
|
|
1
|
+
{"version":3,"file":"CurrencyPowerBalance.js","names":["ApolloClient","InMemoryCache","WidgetProvider","WidgetWrapper","React","translations","Main","CurrencyPowerBalance","_ref","graphqlUrl","theme","locale","timeUnit","currencies","isParamError","logoLink","client","uri","cache","createElement","linkArea"],"sources":["../../../src/CurrencyPowerBalanceWidget/CurrencyPowerBalance.tsx"],"sourcesContent":["import { ApolloClient, InMemoryCache } from '@apollo/client';\nimport { WidgetProvider, WidgetWrapper } from '@oanda/labs-widget-common';\nimport React from 'react';\n\nimport { translations } from '../translations';\nimport { Main } from './Main';\nimport type { CurrencyPowerBalanceConfig } from './types';\n\nconst CurrencyPowerBalance = ({\n graphqlUrl,\n theme,\n locale,\n timeUnit,\n currencies,\n isParamError,\n logoLink,\n}: CurrencyPowerBalanceConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <WidgetProvider\n client={client}\n locale={locale}\n theme={theme}\n translations={translations}\n >\n <WidgetWrapper\n isParamError={isParamError}\n linkArea=\"logo\"\n logoLink={logoLink}\n >\n <Main currencies={currencies} timeUnit={timeUnit} />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyPowerBalance };\n"],"mappings":"AAAA,SAASA,YAAY,EAAEC,aAAa,QAAQ,gBAAgB;AAC5D,SAASC,cAAc,EAAEC,aAAa,QAAQ,2BAA2B;AACzE,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,IAAI,QAAQ,QAAQ;AAG7B,MAAMC,oBAAoB,GAAGC,IAAA,IAQK;EAAA,IARJ;IAC5BC,UAAU;IACVC,KAAK;IACLC,MAAM;IACNC,QAAQ;IACRC,UAAU;IACVC,YAAY;IACZC;EAC0B,CAAC,GAAAP,IAAA;EAC3B,MAAMQ,MAAM,GAAG,IAAIhB,YAAY,CAAC;IAC9BiB,GAAG,EAAER,UAAU;IACfS,KAAK,EAAE,IAAIjB,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEG,KAAA,CAAAe,aAAA,CAACjB,cAAc;IACbc,MAAM,EAAEA,MAAO;IACfL,MAAM,EAAEA,MAAO;IACfD,KAAK,EAAEA,KAAM;IACbL,YAAY,EAAEA;EAAa,GAE3BD,KAAA,CAAAe,aAAA,CAAChB,aAAa;IACZW,YAAY,EAAEA,YAAa;IAC3BM,QAAQ,EAAC,MAAM;IACfL,QAAQ,EAAEA;EAAS,GAEnBX,KAAA,CAAAe,aAAA,CAACb,IAAI;IAACO,UAAU,EAAEA,UAAW;IAACD,QAAQ,EAAEA;EAAS,CAAE,CACtC,CACD,CAAC;AAErB,CAAC;AAED,SAASL,oBAAoB","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
1
|
import { useLayoutProvider } from '@oanda/labs-widget-common';
|
|
3
2
|
import { useLocale } from '@oanda/mono-i18n';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
4
|
import { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';
|
|
5
|
+
import { ChartWithData } from './ChartWithData';
|
|
5
6
|
import { TimeUnitSwitch } from './components/TimeUnitSwitch';
|
|
6
7
|
import { timeUnitConfig } from './config';
|
|
7
|
-
import { ChartWithData } from './ChartWithData';
|
|
8
8
|
const Main = _ref => {
|
|
9
9
|
let {
|
|
10
10
|
timeUnit,
|
|
@@ -18,8 +18,8 @@ const Main = _ref => {
|
|
|
18
18
|
} = useLocale();
|
|
19
19
|
const [selectedTimeUnit, setSelectedTimeUnit] = useState(timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay);
|
|
20
20
|
return React.createElement(React.Fragment, null, size && React.createElement("div", {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
className: "lw-flex lw-flex-col lw-text-sm lw-tracking-normal",
|
|
22
|
+
"data-testid": "currency-power-balance-wrapper"
|
|
23
23
|
}, timeUnit && currencies ? React.createElement(React.Fragment, null, timeUnitConfig.filter(_ref2 => {
|
|
24
24
|
let {
|
|
25
25
|
value
|
|
@@ -31,19 +31,19 @@ const Main = _ref => {
|
|
|
31
31
|
label
|
|
32
32
|
} = _ref3;
|
|
33
33
|
return React.createElement("div", {
|
|
34
|
-
"data-testid": "time-unit-label",
|
|
35
34
|
key: label,
|
|
36
|
-
className: "lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
37
|
-
|
|
35
|
+
className: "lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold",
|
|
36
|
+
"data-testid": "time-unit-label"
|
|
37
|
+
}, tooltipLabel ? React.createElement("span", null, "".concat(lang(tooltipLabel.translationKey, {
|
|
38
38
|
count: tooltipLabel.count
|
|
39
|
-
})
|
|
39
|
+
}))) : React.createElement("span", null, "".concat(lang(label))));
|
|
40
40
|
})) : React.createElement(TimeUnitSwitch, {
|
|
41
|
-
selected: selectedTimeUnit,
|
|
42
41
|
callback: setSelectedTimeUnit,
|
|
43
|
-
options: timeUnitConfig
|
|
42
|
+
options: timeUnitConfig,
|
|
43
|
+
selected: selectedTimeUnit
|
|
44
44
|
}), React.createElement(ChartWithData, {
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
currencies: timeUnit && currencies,
|
|
46
|
+
timeUnit: selectedTimeUnit
|
|
47
47
|
})));
|
|
48
48
|
};
|
|
49
49
|
export { Main };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["
|
|
1
|
+
{"version":3,"file":"Main.js","names":["useLayoutProvider","useLocale","React","useState","CurrencyPowerBalanceTimeUnit","ChartWithData","TimeUnitSwitch","timeUnitConfig","Main","_ref","timeUnit","currencies","size","lang","selectedTimeUnit","setSelectedTimeUnit","CurrentDay","createElement","Fragment","className","filter","_ref2","value","map","_ref3","tooltipLabel","label","key","concat","translationKey","count","callback","options","selected"],"sources":["../../../src/CurrencyPowerBalanceWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React, { useState } from 'react';\n\nimport { CurrencyPowerBalanceTimeUnit } from '../gql/types/graphql';\nimport { ChartWithData } from './ChartWithData';\nimport { TimeUnitSwitch } from './components/TimeUnitSwitch';\nimport { timeUnitConfig } from './config';\nimport type { MainProps } from './types';\n\nconst Main = ({ timeUnit, currencies }: MainProps) => {\n const { size } = useLayoutProvider();\n const { lang } = useLocale();\n const [selectedTimeUnit, setSelectedTimeUnit] = useState(\n timeUnit || CurrencyPowerBalanceTimeUnit.CurrentDay\n );\n return (\n <>\n {size && (\n <div\n className=\"lw-flex lw-flex-col lw-text-sm lw-tracking-normal\"\n data-testid=\"currency-power-balance-wrapper\"\n >\n {timeUnit && currencies ? (\n <>\n {timeUnitConfig\n .filter(({ value }) => value === selectedTimeUnit)\n .map(({ tooltipLabel, label }) => (\n <div\n key={label}\n className=\"lw-mb-6 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\"\n data-testid=\"time-unit-label\"\n >\n {tooltipLabel ? (\n <span>{`${lang(tooltipLabel!.translationKey, { count: tooltipLabel!.count })}`}</span>\n ) : (\n <span>{`${lang(label)}`}</span>\n )}\n </div>\n ))}\n </>\n ) : (\n <TimeUnitSwitch\n callback={setSelectedTimeUnit}\n options={timeUnitConfig}\n selected={selectedTimeUnit}\n />\n )}\n <ChartWithData\n currencies={timeUnit && currencies}\n timeUnit={selectedTimeUnit}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,2BAA2B;AAC7D,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AAEvC,SAASC,4BAA4B,QAAQ,sBAAsB;AACnE,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,cAAc,QAAQ,UAAU;AAGzC,MAAMC,IAAI,GAAGC,IAAA,IAAyC;EAAA,IAAxC;IAAEC,QAAQ;IAAEC;EAAsB,CAAC,GAAAF,IAAA;EAC/C,MAAM;IAAEG;EAAK,CAAC,GAA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,UAAW;IACnCD,QAAQ,EAAEI;EAAiB,CAC5B,CACE,CAEP,CAAC;AAEP,CAAC;AAED,SAASN,IAAI","ignoreList":[]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as echarts from 'echarts/core';
|
|
1
|
+
import { getChartTheme, Size, Theme, useLayoutProvider } from '@oanda/labs-widget-common';
|
|
2
|
+
import { useLocale } from '@oanda/mono-i18n';
|
|
4
3
|
import { LineChart } from 'echarts/charts';
|
|
4
|
+
import { GraphicComponent, GridSimpleComponent, LegendPlainComponent, MarkLineComponent, TooltipComponent } from 'echarts/components';
|
|
5
|
+
import * as echarts from 'echarts/core';
|
|
5
6
|
import { CanvasRenderer } from 'echarts/renderers';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
7
|
+
import ReactEChartsCore from 'echarts-for-react/lib/core';
|
|
8
|
+
import React, { useEffect, useRef } from 'react';
|
|
9
|
+
import { getOption, getResponsiveOption } from './options';
|
|
9
10
|
import { CHART_HEIGHT } from './options/constants';
|
|
10
|
-
import { getResponsiveOption, getOption } from './options';
|
|
11
11
|
echarts.use([GridSimpleComponent, GraphicComponent, TooltipComponent, LegendPlainComponent, LineChart, CanvasRenderer, MarkLineComponent]);
|
|
12
12
|
echarts.registerTheme('dark_theme', getChartTheme(Theme.Dark));
|
|
13
13
|
echarts.registerTheme('light_theme', getChartTheme(Theme.Light));
|
|
@@ -40,14 +40,14 @@ const Chart = _ref => {
|
|
|
40
40
|
}
|
|
41
41
|
}, [echartRef, isDesktop, isMobile, isDark]);
|
|
42
42
|
return React.createElement(ReactEChartsCore, {
|
|
43
|
-
echarts: echarts,
|
|
44
43
|
ref: echartRef,
|
|
45
|
-
|
|
44
|
+
echarts: echarts,
|
|
45
|
+
option: getOption(chartData, timeUnit, isDark, lang),
|
|
46
46
|
style: {
|
|
47
|
-
height:
|
|
47
|
+
height: "".concat(CHART_HEIGHT, "px"),
|
|
48
48
|
width: '100%'
|
|
49
49
|
},
|
|
50
|
-
|
|
50
|
+
theme: isDark ? 'dark_theme' : 'light_theme'
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
export { Chart };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["getChartTheme","Size","Theme","useLayoutProvider","useLocale","LineChart","GraphicComponent","GridSimpleComponent","LegendPlainComponent","MarkLineComponent","TooltipComponent","echarts","CanvasRenderer","ReactEChartsCore","React","useEffect","useRef","getOption","getResponsiveOption","CHART_HEIGHT","use","registerTheme","Dark","Light","Chart","_ref","values","timeUnit","currencies","lang","isDark","size","isDesktop","DESKTOP","isMobile","MOBILE","echartRef","chartData","filter","_ref2","currency","includes","current","echartInstance","getEchartsInstance","setOption","createElement","ref","option","style","height","concat","width","theme"],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/Chart.tsx"],"sourcesContent":["import {\n getChartTheme,\n Size,\n Theme,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { LineChart } from 'echarts/charts';\nimport {\n GraphicComponent,\n GridSimpleComponent,\n LegendPlainComponent,\n MarkLineComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport * as echarts from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport React, { useEffect, useRef } from 'react';\n\nimport { getOption, getResponsiveOption } from './options';\nimport { CHART_HEIGHT } from './options/constants';\nimport type { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n LegendPlainComponent,\n LineChart,\n CanvasRenderer,\n MarkLineComponent,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, timeUnit, currencies }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isMobile = size === Size.MOBILE;\n\n const echartRef = useRef<ReactEChartsCore | null>(null);\n\n const chartData = currencies\n ? values.filter(({ currency }) => currencies.includes(currency))\n : values;\n\n useEffect(() => {\n if (echartRef.current) {\n const echartInstance = echartRef.current.getEchartsInstance();\n\n echartInstance.setOption(\n getResponsiveOption(isDesktop, isMobile, isDark)\n );\n }\n }, [echartRef, isDesktop, isMobile, isDark]);\n\n return (\n <ReactEChartsCore\n ref={echartRef}\n echarts={echarts}\n option={getOption(chartData, timeUnit, isDark, lang)}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,SACEA,aAAa,EACbC,IAAI,EACJC,KAAK,EACLC,iBAAiB,QACZ,2BAA2B;AAClC,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,SAAS,QAAQ,gBAAgB;AAC1C,SACEC,gBAAgB,EAChBC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,gBAAgB,QACX,oBAAoB;AAC3B,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAOC,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEhD,SAASC,SAAS,EAAEC,mBAAmB,QAAQ,WAAW;AAC1D,SAASC,YAAY,QAAQ,qBAAqB;AAGlDR,OAAO,CAACS,GAAG,CAAC,CACVb,mBAAmB,EACnBD,gBAAgB,EAChBI,gBAAgB,EAChBF,oBAAoB,EACpBH,SAAS,EACTO,cAAc,EACdH,iBAAiB,CAClB,CAAC;AAEFE,OAAO,CAACU,aAAa,CAAC,YAAY,EAAErB,aAAa,CAACE,KAAK,CAACoB,IAAI,CAAC,CAAC;AAC9DX,OAAO,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C,MAAM,KAAAC,MAAA,CAAKhC,YAAY,OAAI;MAC3BiC,KAAK,EAAE;IACT,CAAE;IACFC,KAAK,EAAEvB,MAAM,GAAG,YAAY,GAAG;EAAc,CAC9C,CAAC;AAEN,CAAC;AAED,SAASN,KAAK","ignoreList":[]}
|
|
@@ -27,5 +27,5 @@ const TOOLTIP_LINE_COLOR_CONFIG = {
|
|
|
27
27
|
DARK: colorPalette.orange,
|
|
28
28
|
LIGHT: colorPalette.bottleGreenDark
|
|
29
29
|
};
|
|
30
|
-
export {
|
|
30
|
+
export { CANDLE_MINUTE, CANDLE_NUMBER_HOUR, CHART_HEIGHT, CHART_WIDTH, COLOR_CONFIG, CURRENCIES_ORDER, LEGEND_HEIGHT, LEGEND_HEIGHT_MOBILE, TOOLTIP_LINE_COLOR_CONFIG, VERTICAL_LINE_COUNT, WEEKEND_DURATION, X_LABEL_SIZE, X_LABEL_SIZE_MOBILE, Y_LABEL_SIZE, Y_LABEL_SIZE_MOBILE };
|
|
31
31
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["colorPalette","CurrencyName","WEEKEND_DURATION","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","CANDLE_NUMBER_HOUR","CANDLE_MINUTE","CURRENCIES_ORDER","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd","COLOR_CONFIG","USD","greenLight","EUR","turquoiseLight","GBP","violetLight","JPY","raspberryLight","CHF","bottleGreenLight75","AUD","orange","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\nimport { CurrencyName } from '../../../../gql/types/graphql';\n\nconst WEEKEND_DURATION = 172800000;\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;\nconst CANDLE_NUMBER_HOUR = 12;\nconst CANDLE_MINUTE = 5;\n\nconst CURRENCIES_ORDER: CurrencyName[] = [\n CurrencyName.Usd,\n CurrencyName.Eur,\n CurrencyName.Gbp,\n CurrencyName.Cad,\n CurrencyName.Aud,\n CurrencyName.Chf,\n CurrencyName.Jpy,\n CurrencyName.Nzd,\n];\n\nconst COLOR_CONFIG = {\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n JPY: colorPalette.raspberryLight,\n CHF: colorPalette.bottleGreenLight75,\n AUD: colorPalette.orange,\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
|
|
1
|
+
{"version":3,"file":"constants.js","names":["colorPalette","CurrencyName","WEEKEND_DURATION","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","VERTICAL_LINE_COUNT","CANDLE_NUMBER_HOUR","CANDLE_MINUTE","CURRENCIES_ORDER","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd","COLOR_CONFIG","USD","greenLight","EUR","turquoiseLight","GBP","violetLight","JPY","raspberryLight","CHF","bottleGreenLight75","AUD","orange","CAD","midnight75Lighter","NZD","gold","TOOLTIP_LINE_COLOR_CONFIG","DARK","LIGHT","bottleGreenDark"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/constants.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nimport { CurrencyName } from '../../../../gql/types/graphql';\n\nconst WEEKEND_DURATION = 172800000;\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;\nconst CANDLE_NUMBER_HOUR = 12;\nconst CANDLE_MINUTE = 5;\n\nconst CURRENCIES_ORDER: CurrencyName[] = [\n CurrencyName.Usd,\n CurrencyName.Eur,\n CurrencyName.Gbp,\n CurrencyName.Cad,\n CurrencyName.Aud,\n CurrencyName.Chf,\n CurrencyName.Jpy,\n CurrencyName.Nzd,\n];\n\nconst COLOR_CONFIG = {\n USD: colorPalette.greenLight,\n EUR: colorPalette.turquoiseLight,\n GBP: colorPalette.violetLight,\n JPY: colorPalette.raspberryLight,\n CHF: colorPalette.bottleGreenLight75,\n AUD: colorPalette.orange,\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 CANDLE_MINUTE,\n CANDLE_NUMBER_HOUR,\n CHART_HEIGHT,\n CHART_WIDTH,\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n TOOLTIP_LINE_COLOR_CONFIG,\n VERTICAL_LINE_COUNT,\n WEEKEND_DURATION,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL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AACtB,CAAC;AAED,SACE9B,aAAa,EACbD,kBAAkB,EAClBJ,YAAY,EACZD,WAAW,EACXgB,YAAY,EACZT,gBAAgB,EAChBL,aAAa,EACbC,oBAAoB,EACpB8B,yBAAyB,EACzB7B,mBAAmB,EACnBT,gBAAgB,EAChBC,YAAY,EACZC,mBAAmB,EACnBE,YAAY,EACZD,mBAAmB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';
|
|
2
|
-
import {
|
|
2
|
+
import { COLOR_CONFIG, CURRENCIES_ORDER, VERTICAL_LINE_COUNT } from './constants';
|
|
3
3
|
const getDateAndTime = param => {
|
|
4
4
|
const dateAndTime = param.split('T');
|
|
5
5
|
return {
|
|
@@ -7,20 +7,20 @@ const getDateAndTime = param => {
|
|
|
7
7
|
time: dateAndTime[1].substring(0, 5)
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
const dateFormat = date =>
|
|
10
|
+
const dateFormat = date => "".concat(new Date(date).toLocaleDateString(undefined, {
|
|
11
11
|
month: 'numeric',
|
|
12
12
|
day: 'numeric'
|
|
13
|
-
})
|
|
13
|
+
}));
|
|
14
14
|
const dateTimeFormat = _ref => {
|
|
15
15
|
let {
|
|
16
16
|
date,
|
|
17
17
|
time
|
|
18
18
|
} = _ref;
|
|
19
|
-
return
|
|
19
|
+
return "".concat(new Date(date).toLocaleDateString(undefined, {
|
|
20
20
|
year: 'numeric',
|
|
21
21
|
month: 'numeric',
|
|
22
22
|
day: 'numeric'
|
|
23
|
-
})
|
|
23
|
+
}), ", ").concat(time, " UTC");
|
|
24
24
|
};
|
|
25
25
|
const isMonthWeek = timeUnit => timeUnit === CurrencyPowerBalanceTimeUnit.M3 || timeUnit === CurrencyPowerBalanceTimeUnit.M1 || timeUnit === CurrencyPowerBalanceTimeUnit.W1;
|
|
26
26
|
const xAxisLabelFormatter = (label, timeUnit) => {
|
|
@@ -48,18 +48,9 @@ const tooltipFormatter = values => {
|
|
|
48
48
|
seriesName,
|
|
49
49
|
value
|
|
50
50
|
} = _ref4;
|
|
51
|
-
return
|
|
52
|
-
<div style="display:flex;align-items:center;width:50px;margin-right:10px;">
|
|
53
|
-
${marker}
|
|
54
|
-
<span>${seriesName}</span>
|
|
55
|
-
</div>
|
|
56
|
-
<span>${value[1]}</span>
|
|
57
|
-
</div>`;
|
|
51
|
+
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>");
|
|
58
52
|
});
|
|
59
|
-
return
|
|
60
|
-
<span style="margin-bottom:5px;">${date}</span>
|
|
61
|
-
${row.join('\n')}
|
|
62
|
-
</div>`;
|
|
53
|
+
return "<div style=\"display:flex; flex-direction:column;\">\n <span style=\"margin-bottom:5px;\">".concat(date, "</span>\n ").concat(row.join('\n'), "\n </div>");
|
|
63
54
|
};
|
|
64
55
|
const formatLegendData = values => {
|
|
65
56
|
const dataCurrencies = values.map(_ref5 => {
|
|
@@ -76,5 +67,5 @@ const formatLegendData = values => {
|
|
|
76
67
|
}
|
|
77
68
|
}));
|
|
78
69
|
};
|
|
79
|
-
export {
|
|
70
|
+
export { formatLegendData, intervalFormatter, isMonthWeek, tooltipFormatter, xAxisLabelFormatter };
|
|
80
71
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["CurrencyPowerBalanceTimeUnit","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["CurrencyPowerBalanceTimeUnit","COLOR_CONFIG","CURRENCIES_ORDER","VERTICAL_LINE_COUNT","getDateAndTime","param","dateAndTime","split","date","time","substring","dateFormat","concat","Date","toLocaleDateString","undefined","month","day","dateTimeFormat","_ref","year","isMonthWeek","timeUnit","M3","M1","W1","xAxisLabelFormatter","label","isDateFormat","intervalFormatter","dataLength","Math","round","tooltipFormatter","values","value","row","sort","_ref2","_ref3","valueA","valueB","Number","map","_ref4","marker","seriesName","join","formatLegendData","dataCurrencies","_ref5","currency","list","length","filter","includes","name","itemStyle","color"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/formatters.ts"],"sourcesContent":["import type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport {\n COLOR_CONFIG,\n CURRENCIES_ORDER,\n VERTICAL_LINE_COUNT,\n} from './constants';\nimport type { 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) =>\n `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nconst dateTimeFormat = ({ date, time }: { date: string; time: string }) =>\n `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nconst isMonthWeek = (timeUnit: CurrencyPowerBalanceTimeUnit) =>\n timeUnit === CurrencyPowerBalanceTimeUnit.M3 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.M1 ||\n timeUnit === CurrencyPowerBalanceTimeUnit.W1;\n\nconst xAxisLabelFormatter = (\n label: string,\n timeUnit: CurrencyPowerBalanceTimeUnit\n) => {\n const { date, time } = getDateAndTime(label);\n const isDateFormat = isMonthWeek(timeUnit) || time === '00:00';\n\n return isDateFormat ? dateFormat(date) : time;\n};\n\nconst intervalFormatter = (dataLength: number) =>\n Math.round(dataLength / VERTICAL_LINE_COUNT);\n\nconst tooltipFormatter = (values: TooltipFormatterParams[]) => {\n const date = dateTimeFormat(getDateAndTime(values[0].value[0]));\n\n const row = values\n .sort(\n ({ value: valueA }, { value: valueB }) =>\n Number(valueB[1]) - Number(valueA[1])\n )\n .map(\n ({\n marker,\n seriesName,\n value,\n }) => `<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\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\nconst formatLegendData = (values: CurrencyPowerBalance[]) => {\n const dataCurrencies = values.map(({ currency }) => currency);\n\n const list =\n dataCurrencies.length === CURRENCIES_ORDER.length\n ? CURRENCIES_ORDER\n : CURRENCIES_ORDER.filter((currency) =>\n dataCurrencies.includes(currency)\n );\n\n return list.map((currency) => ({\n name: currency,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n }));\n};\n\nexport {\n formatLegendData,\n intervalFormatter,\n isMonthWeek,\n tooltipFormatter,\n xAxisLabelFormatter,\n};\n"],"mappings":"AACA,SAASA,4BAA4B,QAAQ,+BAA+B;AAC5E,SACEC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,QACd,aAAa;AAGpB,MAAMC,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,CAC3B,IAAIC,IAAI,CAACL,IAAI,CAAC,CAACM,kBAAkB,CAACC,SAAS,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,GAAG,EAAE;AAAU,CAAC,CAAC,CAAE;AAEzF,MAAMC,cAAc,GAAGC,IAAA;EAAA,IAAC;IAAEX,IAAI;IAAEC;EAAqC,CAAC,GAAAU,IAAA;EAAA,UAAAP,MAAA,CACjE,IAAIC,IAAI,C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GAAG,CACFC,KAAA;IAAA,IAAC;MACCC,MAAM;MACNC,UAAU;MACVX;IACF,CAAC,GAAAS,KAAA;IAAA,yJAAAhC,MAAA,CAEGiC,MAAM,sBAAAjC,MAAA,CACAkC,UAAU,yCAAAlC,MAAA,CAEZuB,KAAK,CAAC,CAAC,CAAC;EAAA,CAElB,CAAC;EAEH,uGAAAvB,MAAA,CACqCJ,IAAI,mBAAAI,MAAA,CACrCwB,GAAG,CAACW,IAAI,CAAC,IAAI,CAAC;AAEpB,CAAC;AAED,MAAMC,gBAAgB,GAAId,MAA8B,IAAK;EAC3D,MAAMe,cAAc,GAAGf,MAAM,CAACS,GAAG,CAACO,KAAA;IAAA,IAAC;MAAEC;IAAS,CAAC,GAAAD,KAAA;IAAA,OAAKC,QAAQ;EAAA,EAAC;EAE7D,MAAMC,IAAI,GACRH,cAAc,CAACI,MAAM,KAAKnD,gBAAgB,CAACmD,MAAM,GAC7CnD,gBAAgB,GAChBA,gBAAgB,CAACoD,MAAM,CAAEH,QAAQ,IAC/BF,cAAc,CAACM,QAAQ,CAACJ,QAAQ,CAClC,CAAC;EAEP,OAAOC,IAAI,CAACT,GAAG,CAAEQ,QAAQ,KAAM;IAC7BK,IAAI,EAAEL,QAAQ;IACdM,SAAS,EAAE;MACTC,KAAK,EAAEzD,YAAY,CAACkD,QAAQ;IAC9B;EACF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SACEH,gBAAgB,EAChBnB,iBAAiB,EACjBR,WAAW,EACXY,gBAAgB,EAChBP,mBAAmB","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { darkTheme, lightTheme } from '@oanda/labs-widget-common';
|
|
2
|
-
import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';
|
|
3
|
-
import { intervalFormatter, tooltipFormatter, xAxisLabelFormatter, formatLegendData } from './formatters';
|
|
4
2
|
import { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';
|
|
3
|
+
import { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';
|
|
4
|
+
import { formatLegendData, intervalFormatter, tooltipFormatter, xAxisLabelFormatter } from './formatters';
|
|
5
5
|
import { findLastIndexesBeforeWeekend } from './utils';
|
|
6
6
|
const getOption = (chartData, timeUnit, isDark, lang) => {
|
|
7
7
|
const currentTheme = isDark ? darkTheme : lightTheme;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["darkTheme","lightTheme","
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["darkTheme","lightTheme","CurrencyPowerBalanceTimeUnit","COLOR_CONFIG","TOOLTIP_LINE_COLOR_CONFIG","formatLegendData","intervalFormatter","tooltipFormatter","xAxisLabelFormatter","findLastIndexesBeforeWeekend","getOption","chartData","timeUnit","isDark","lang","currentTheme","dataTimestamps","power","map","x","Date","point","getTime","weekendsIndexes","disableWeekendsIndicator","CurrentDay","PreviousDay","M3","includes","length","weekendsMarks","item","xAxis","label","formatter","seriesData","_ref","index","currency","name","type","symbol","showSymbol","itemStyle","color","data","_ref2","price","markLine","show","position","align","distance","padding","fontSize","shadowBlur","shadowOffsetX","shadowOffsetY","borderWidth","textPrimary","shadowColor","borderRadius","backgroundColor","borderPrimary","backgroundSecondary","emphasis","lineStyle","width","opacity","undefined","legendData","animation","legend","bottom","icon","tooltip","trigger","axisPointer","axis","z","DARK","LIGHT","extraCssText","axisTick","axisLine","splitLine","axisLabel","margin","rotate","interval","yAxis","splitNumber","boundaryGap","showMaxLabel","showMinLabel","series"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getOption.ts"],"sourcesContent":["import { darkTheme, lightTheme } from '@oanda/labs-widget-common';\n\nimport type { CurrencyPowerBalance } from '../../../../gql/types/graphql';\nimport { CurrencyPowerBalanceTimeUnit } from '../../../../gql/types/graphql';\nimport { COLOR_CONFIG, TOOLTIP_LINE_COLOR_CONFIG } from './constants';\nimport {\n formatLegendData,\n intervalFormatter,\n tooltipFormatter,\n xAxisLabelFormatter,\n} from './formatters';\nimport { findLastIndexesBeforeWeekend } from './utils';\n\nconst getOption = (\n chartData: CurrencyPowerBalance[],\n timeUnit: CurrencyPowerBalanceTimeUnit,\n isDark: boolean,\n lang: (key: string) => string\n) => {\n const currentTheme = isDark ? darkTheme : lightTheme;\n const dataTimestamps = chartData[0].power.map((x) =>\n new Date(x.point).getTime()\n );\n const weekendsIndexes = findLastIndexesBeforeWeekend(dataTimestamps);\n const disableWeekendsIndicator =\n [\n CurrencyPowerBalanceTimeUnit.CurrentDay,\n CurrencyPowerBalanceTimeUnit.PreviousDay,\n CurrencyPowerBalanceTimeUnit.M3,\n ].includes(timeUnit) || weekendsIndexes.length === 0;\n\n const weekendsMarks = weekendsIndexes.map((item) => ({\n xAxis: item,\n label: {\n formatter: () => lang('market_closed'),\n },\n }));\n\n const seriesData = chartData.map(({ currency, power }, index) => ({\n name: currency,\n type: 'line',\n symbol: 'circle',\n showSymbol: false,\n itemStyle: {\n color: COLOR_CONFIG[currency],\n },\n data: power.map(({ point, price }) => [point, price]),\n markLine:\n index === chartData.length - 1 && !disableWeekendsIndicator\n ? {\n label: {\n show: false,\n position: 'end',\n align: 'center',\n distance: -32,\n padding: [8, 8],\n fontSize: 12,\n shadowBlur: 24,\n shadowOffsetX: 0,\n shadowOffsetY: 6,\n borderWidth: 0,\n color: currentTheme.textPrimary,\n shadowColor: 'rgba(0,0,0,0.1)',\n borderRadius: 4,\n backgroundColor: isDark\n ? currentTheme.borderPrimary\n : currentTheme.backgroundSecondary,\n },\n show: false,\n emphasis: {\n label: {\n show: true,\n },\n lineStyle: {\n width: 1,\n opacity: 0,\n color: currentTheme.borderPrimary,\n },\n },\n symbol: ['none', 'none'],\n itemStyle: {\n color: currentTheme.borderPrimary,\n },\n data: weekendsMarks,\n }\n : undefined,\n }));\n\n const legendData = formatLegendData(chartData);\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\n ? TOOLTIP_LINE_COLOR_CONFIG.DARK\n : 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 padding: [0, 0, 0, 4],\n align: 'left',\n margin: 10,\n rotate: -45,\n interval: intervalFormatter(seriesData[0].data.length),\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,SAASA,SAAS,EAAEC,UAAU,QAAQ,2BAA2B;AAGjE,SAASC,4BAA4B,QAAQ,+BAA+B;AAC5E,SAASC,YAAY,EAAEC,yBAAyB,QAAQ,aAAa;AACrE,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,gBAAgB,EAChBC,mBAAmB,QACd,cAAc;AACrB,SAASC,4BAA4B,QAAQ,SAAS;AAEtD,MAAMC,SAAS,GAAGA,CAChBC,SAAiC,EACjCC,QAAsC,EACtCC,MAAe,EACfC,IAA6B,KAC1B;EACH,MAAMC,YAAY,GAAGF,MAAM,GAAGb,SAAS,GAAGC,UAAU;EACpD,MAAMe,cAAc,GAAGL,SAAS,CAAC,CAAC,CAAC,CAACM,KAAK,CAACC,GAAG,CAAEC,CAAC,IAC9C,IAAIC,IAAI,CAACD,CAAC,CAACE,KAAK,CAAC,CAACC,OAAO,CAAC,CAC5B,CAAC;EACD,MAAMC,eAAe,GAAGd,4BAA4B,CAACO,cAAc,CAAC;EACpE,MAAMQ,wBAAwB,GAC5B,CAC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AS,EAAE;QACTpC,IAAI,EAAE;MACR,CAAC;MACDqC,SAAS,EAAE;QACTjC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrBF,KAAK,EAAE,MAAM;QACboC,MAAM,EAAE,EAAE;QACVC,MAAM,EAAE,CAAC,EAAE;QACXC,QAAQ,EAAEnF,iBAAiB,CAAC6B,UAAU,CAAC,CAAC,CAAC,CAACU,IAAI,CAAChB,MAAM,CAAC;QACtDK,SAAS,EAAGD,KAAa,IAAKzB,mBAAmB,CAACyB,KAAK,EAAErB,QAAQ;MACnE;IACF,CAAC;IACD8E,KAAK,EAAE;MACLlD,IAAI,EAAE,OAAO;MACbU,QAAQ,EAAE,OAAO;MACjByC,WAAW,EAAE,CAAC;MACdP,QAAQ,EAAE;QAAEnC,IAAI,EAAE;MAAM,CAAC;MACzBkC,QAAQ,EAAE;QAAElC,IAAI,EAAE;MAAM,CAAC;MACzB2C,WAAW,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;MAC3BN,SAAS,EAAE;QACTO,YAAY,EAAE,KAAK;QACnBC,YAAY,EAAE;MAChB;IACF,CAAC;IACDC,MAAM,EAAE5D;EACV,CAAC;AACH,CAAC;AAED,SAASzB,SAAS","ignoreList":[]}
|
package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js
CHANGED
|
@@ -20,8 +20,8 @@ const getResponsiveOption = (isDesktop, isMobile, isDark) => {
|
|
|
20
20
|
name: 'main-grid',
|
|
21
21
|
top: '0px',
|
|
22
22
|
left: '0px',
|
|
23
|
-
right:
|
|
24
|
-
bottom:
|
|
23
|
+
right: "".concat(isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE, "px"),
|
|
24
|
+
bottom: "".concat(isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE, "px")
|
|
25
25
|
}],
|
|
26
26
|
graphic: [...baseGridLines]
|
|
27
27
|
};
|
package/dist/module/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getResponsiveOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","Y_LABEL_SIZE_MOBILE","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","yAxis","axisLabel","margin","grid","name","top","left","right","bottom","graphic"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\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
|
|
1
|
+
{"version":3,"file":"getResponsiveOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","LEGEND_HEIGHT","LEGEND_HEIGHT_MOBILE","X_LABEL_SIZE","X_LABEL_SIZE_MOBILE","Y_LABEL_SIZE","Y_LABEL_SIZE_MOBILE","getResponsiveOption","isDesktop","isMobile","isDark","baseGridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","marginBottom","yAxis","axisLabel","margin","grid","name","top","left","right","concat","bottom","graphic"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/getResponsiveOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n LEGEND_HEIGHT,\n LEGEND_HEIGHT_MOBILE,\n X_LABEL_SIZE,\n X_LABEL_SIZE_MOBILE,\n Y_LABEL_SIZE,\n Y_LABEL_SIZE_MOBILE,\n} from './constants';\n\nconst getResponsiveOption = (\n isDesktop: boolean,\n isMobile: boolean,\n isDark: boolean\n) => {\n const baseGridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE,\n yLabelSize: isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE,\n bottomLeftBox: false,\n marginBottom: isMobile ? LEGEND_HEIGHT_MOBILE : LEGEND_HEIGHT,\n });\n\n return {\n yAxis: {\n axisLabel: {\n margin: isDesktop ? 8 : 6,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '0px',\n left: '0px',\n right: `${isMobile ? Y_LABEL_SIZE_MOBILE : Y_LABEL_SIZE}px`,\n bottom: `${isMobile ? X_LABEL_SIZE_MOBILE : X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...baseGridLines],\n };\n};\n\nexport { getResponsiveOption };\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,SACEC,YAAY,EACZC,WAAW,EACXC,aAAa,EACbC,oBAAoB,EACpBC,YAAY,EACZC,mBAAmB,EACnBC,YAAY,EACZC,mBAAmB,QACd,aAAa;AAEpB,MAAMC,mBAAmB,GAAGA,CAC1BC,SAAkB,EAClBC,QAAiB,EACjBC,MAAe,KACZ;EACH,MAAMC,aAAa,GAAGb,YAAY,CAAC;IACjCY,MAAM;IACNE,UAAU,EAAEZ,WAAW;IACvBa,WAAW,EAAEd,YAAY;IACzBe,WAAW,EAAEL,QAAQ,GAAGL,mBAAmB,GAAGD,YAAY;IAC1DY,UAAU,EAAEN,QAAQ,GAAGH,mBAAmB,GAAGD,YAAY;IACzDW,aAAa,EAAE,KAAK;IACpBC,YAAY,EAAER,QAAQ,GAAGP,oBAAoB,GAAGD;EAClD,CAAC,CAAC;EAEF,OAAO;IACLiB,KAAK,EAAE;MACLC,SAAS,EAAE;QACTC,MAAM,EAAEZ,SAAS,GAAG,CAAC,GAAG;MAC1B;IACF,CAAC;IACDa,IAAI,EAAE,CACJ;MACEC,IAAI,EAAE,WAAW;MACjBC,GAAG,EAAE,KAAK;MACVC,IAAI,EAAE,KAAK;MACXC,KAAK,KAAAC,MAAA,CAAKjB,QAAQ,GAAGH,mBAAmB,GAAGD,YAAY,OAAI;MAC3DsB,MAAM,KAAAD,MAAA,CAAKjB,QAAQ,GAAGL,mBAAmB,GAAGD,YAAY;IAC1D,CAAC,CACF;IACDyB,OAAO,EAAE,CAAC,GAAGjB,aAAa;EAC5B,CAAC;AACH,CAAC;AAED,SAASJ,mBAAmB","ignoreList":[]}
|
|
@@ -1 +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[]
|
|
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":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["WEEKEND_DURATION","findLastIndexesBeforeWeekend","timestamps","reduce","acc","timestamp","index","length"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts"],"sourcesContent":["import { WEEKEND_DURATION } from './constants';\n\nconst findLastIndexesBeforeWeekend = (timestamps: number[])
|
|
1
|
+
{"version":3,"file":"utils.js","names":["WEEKEND_DURATION","findLastIndexesBeforeWeekend","timestamps","reduce","acc","timestamp","index","length"],"sources":["../../../../../../src/CurrencyPowerBalanceWidget/components/Chart/options/utils.ts"],"sourcesContent":["import { WEEKEND_DURATION } from './constants';\n\nconst findLastIndexesBeforeWeekend = (timestamps: number[]) =>\n timestamps.reduce(\n (acc, timestamp, index) =>\n timestamps.length - 1 !== index &&\n timestamps[index + 1] - timestamp >= WEEKEND_DURATION\n ? [...acc, index]\n : acc,\n [] as number[]\n );\n\nexport { findLastIndexesBeforeWeekend };\n"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,aAAa;AAE9C,MAAMC,4BAA4B,GAAIC,UAAoB,IACxDA,UAAU,CAACC,MAAM,CACf,CAACC,GAAG,EAAEC,SAAS,EAAEC,KAAK,KACpBJ,UAAU,CAACK,MAAM,GAAG,CAAC,KAAKD,KAAK,IAC/BJ,UAAU,CAACI,KAAK,GAAG,CAAC,CAAC,GAAGD,SAAS,IAAIL,gBAAgB,GACjD,CAAC,GAAGI,GAAG,EAAEE,KAAK,CAAC,GACfF,GAAG,EACT,EACF,CAAC;AAEH,SAASH,4BAA4B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/types.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyPowerBalanceWidget/components/Chart/types.ts"],"sourcesContent":["import type {\n CurrencyPowerBalance,\n CurrencyPowerBalanceTimeUnit,\n} from '../../../gql/types/graphql';\n\nexport interface ChartProps {\n values: CurrencyPowerBalance[];\n timeUnit: CurrencyPowerBalanceTimeUnit;\n currencies?: string[];\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Select } from '@oanda/labs-widget-common';
|
|
3
2
|
import { useLocale } from '@oanda/mono-i18n';
|
|
3
|
+
import React from 'react';
|
|
4
4
|
const TimeUnitSelect = _ref => {
|
|
5
5
|
let {
|
|
6
6
|
selected,
|
|
@@ -32,11 +32,11 @@ const TimeUnitSelect = _ref => {
|
|
|
32
32
|
return id === selected;
|
|
33
33
|
});
|
|
34
34
|
return React.createElement("div", {
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
className: "lw-mb-6 lw-w-full",
|
|
36
|
+
"data-testid": "time-unit-select"
|
|
37
37
|
}, React.createElement(Select, {
|
|
38
|
-
searchPlaceholder: lang('search'),
|
|
39
38
|
options: selectOptions,
|
|
39
|
+
searchPlaceholder: lang('search'),
|
|
40
40
|
selectedOption: {
|
|
41
41
|
id: selected,
|
|
42
42
|
label: selectedLabel
|