@oanda/labs-currency-strength-widget 1.0.170 → 1.0.172
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 +1309 -30347
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js +34 -27
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/CurrencyStrengthWidget.js +19 -12
- package/dist/module/CurrencyStrengthWidget/CurrencyStrengthWidget.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/Main.js +18 -11
- package/dist/module/CurrencyStrengthWidget/Main.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js +26 -18
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/constants.js +21 -15
- package/dist/module/CurrencyStrengthWidget/components/Chart/constants.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js +10 -3
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js +18 -11
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/index.js +16 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/index.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/components/Chart/types.js +5 -1
- package/dist/module/CurrencyStrengthWidget/index.js +16 -1
- package/dist/module/CurrencyStrengthWidget/index.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/render.js +11 -8
- package/dist/module/CurrencyStrengthWidget/render.js.map +1 -1
- package/dist/module/CurrencyStrengthWidget/types.js +5 -1
- package/dist/module/gql/getCurrencyStrength.js +8 -3
- package/dist/module/gql/getCurrencyStrength.js.map +1 -1
- package/dist/module/gql/types/fragment-masking.js +11 -3
- package/dist/module/gql/types/fragment-masking.js.map +1 -1
- package/dist/module/gql/types/gql.js +9 -2
- package/dist/module/gql/types/gql.js.map +1 -1
- package/dist/module/gql/types/graphql.js +21 -15
- package/dist/module/gql/types/graphql.js.map +1 -1
- package/dist/module/gql/types/index.js +27 -2
- package/dist/module/gql/types/index.js.map +1 -1
- package/dist/module/index.js +16 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/translations/index.js +21 -14
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js +7 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/types/gql/getCurrencyStrength.d.ts +1 -1
- package/package.json +8 -4
- package/tsconfig.types.json +2 -4
|
@@ -1,62 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChartWithData = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _getCurrencyStrength = require("../gql/getCurrencyStrength");
|
|
13
|
+
var _Chart = require("./components/Chart");
|
|
14
|
+
var _formatters = require("./components/Chart/formatters");
|
|
15
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
16
|
const ChartWithData = _ref => {
|
|
10
17
|
let {
|
|
11
18
|
currency
|
|
12
19
|
} = _ref;
|
|
13
20
|
const {
|
|
14
21
|
size
|
|
15
|
-
} = useLayoutProvider();
|
|
16
|
-
const isDesktop = size === Size.DESKTOP;
|
|
22
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
23
|
+
const isDesktop = size === _labsWidgetCommon.Size.DESKTOP;
|
|
17
24
|
const {
|
|
18
25
|
lang
|
|
19
|
-
} = useLocale();
|
|
26
|
+
} = (0, _monoI18n.useLocale)();
|
|
20
27
|
const {
|
|
21
28
|
loading,
|
|
22
29
|
data,
|
|
23
30
|
error
|
|
24
|
-
} = useQuery(getCurrencyStrength, {
|
|
31
|
+
} = (0, _client.useQuery)(_getCurrencyStrength.getCurrencyStrength, {
|
|
25
32
|
fetchPolicy: 'cache-and-network'
|
|
26
33
|
});
|
|
27
34
|
const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;
|
|
28
35
|
const showError = data?.currencyStrength?.length === 0 || error;
|
|
29
|
-
const currencyData = currency ? data?.currencyStrength?.filter(item => item.currency === currency) : data?.currencyStrength?.slice().sort(sortCurrencies);
|
|
30
|
-
return
|
|
31
|
-
className:
|
|
36
|
+
const currencyData = currency ? data?.currencyStrength?.filter(item => item.currency === currency) : data?.currencyStrength?.slice().sort(_formatters.sortCurrencies);
|
|
37
|
+
return _react.default.createElement(_react.default.Fragment, null, loading && _react.default.createElement("div", {
|
|
38
|
+
className: (0, _classnames.default)('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
32
39
|
'lw-h-[461px]': !currency,
|
|
33
40
|
'lw-h-[135px]': currency
|
|
34
41
|
})
|
|
35
|
-
},
|
|
36
|
-
size: SpinnerSize.lg
|
|
37
|
-
})), !loading && showChart &&
|
|
38
|
-
className:
|
|
42
|
+
}, _react.default.createElement(_labsWidgetCommon.Spinner, {
|
|
43
|
+
size: _labsWidgetCommon.SpinnerSize.lg
|
|
44
|
+
})), !loading && showChart && _react.default.createElement("div", {
|
|
45
|
+
className: (0, _classnames.default)('lw-grid lw-place-content-center lw-gap-7', {
|
|
39
46
|
'lw-grid-cols-3 ': isDesktop && !currency,
|
|
40
47
|
'lw-grid-cols-1': !isDesktop || currency
|
|
41
48
|
}),
|
|
42
49
|
"data-testid": "currency-strength-chart-wrapper"
|
|
43
|
-
}, currencyData && currencyData.map(item =>
|
|
50
|
+
}, currencyData && currencyData.map(item => _react.default.createElement("div", {
|
|
44
51
|
key: item.currency,
|
|
45
52
|
className: "lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center"
|
|
46
|
-
},
|
|
53
|
+
}, _react.default.createElement(_Chart.Chart, {
|
|
47
54
|
currency: item.currency,
|
|
48
|
-
values: item.strengthRelation?.slice().sort(sortCurrencies)
|
|
49
|
-
})))), !loading && showError &&
|
|
50
|
-
className:
|
|
55
|
+
values: item.strengthRelation?.slice().sort(_formatters.sortCurrencies)
|
|
56
|
+
})))), !loading && showError && _react.default.createElement("div", {
|
|
57
|
+
className: (0, _classnames.default)('lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary', {
|
|
51
58
|
'lw-h-[425px]': !currency,
|
|
52
59
|
'lw-h-[135px]': currency
|
|
53
60
|
})
|
|
54
|
-
},
|
|
61
|
+
}, _react.default.createElement(_labsWidgetCommon.ChartError, null)), !loading && !showError && _react.default.createElement("div", {
|
|
55
62
|
className: "lw-mt-2 lw-h-8"
|
|
56
|
-
},
|
|
63
|
+
}, _react.default.createElement(_labsWidgetCommon.LastUpdated, {
|
|
57
64
|
labelCallback: lang,
|
|
58
65
|
timestamp: data?.currencyStrength[0]?.updatedAt
|
|
59
66
|
})));
|
|
60
67
|
};
|
|
61
|
-
|
|
68
|
+
exports.ChartWithData = ChartWithData;
|
|
62
69
|
//# sourceMappingURL=ChartsWithData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartsWithData.js","names":["
|
|
1
|
+
{"version":3,"file":"ChartsWithData.js","names":["_client","require","_labsWidgetCommon","_monoI18n","_classnames","_interopRequireDefault","_react","_getCurrencyStrength","_Chart","_formatters","e","__esModule","default","ChartWithData","_ref","currency","size","useLayoutProvider","isDesktop","Size","DESKTOP","lang","useLocale","loading","data","error","useQuery","getCurrencyStrength","fetchPolicy","showChart","currencyStrength","length","showError","currencyData","filter","item","slice","sort","sortCurrencies","createElement","Fragment","className","classnames","Spinner","SpinnerSize","lg","map","key","Chart","values","strengthRelation","ChartError","LastUpdated","labelCallback","timestamp","updatedAt","exports"],"sources":["../../../src/CurrencyStrengthWidget/ChartsWithData.tsx"],"sourcesContent":["import { useQuery } from '@apollo/client';\nimport {\n ChartError,\n LastUpdated,\n Size,\n Spinner,\n SpinnerSize,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport classnames from 'classnames';\nimport React from 'react';\n\nimport { getCurrencyStrength } from '../gql/getCurrencyStrength';\nimport type { GetCurrencyStrengthQuery } from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\nimport { sortCurrencies } from './components/Chart/formatters';\nimport type { WidgetProps } from './types';\n\nconst ChartWithData = ({ currency }: WidgetProps) => {\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const { lang } = useLocale();\n const { loading, data, error } = useQuery<GetCurrencyStrengthQuery>(\n getCurrencyStrength,\n {\n fetchPolicy: 'cache-and-network',\n }\n );\n\n const showChart =\n data?.currencyStrength && data?.currencyStrength?.length > 0;\n const showError = data?.currencyStrength?.length === 0 || error;\n\n const currencyData = currency\n ? data?.currencyStrength?.filter((item) => item.currency === currency)\n : data?.currencyStrength?.slice().sort(sortCurrencies);\n\n return (\n <>\n {loading && (\n <div\n className={classnames(\n 'lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary',\n {\n 'lw-h-[461px]': !currency,\n 'lw-h-[135px]': currency,\n }\n )}\n >\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <div\n className={classnames('lw-grid lw-place-content-center lw-gap-7', {\n 'lw-grid-cols-3 ': isDesktop && !currency,\n 'lw-grid-cols-1': !isDesktop || currency,\n })}\n data-testid=\"currency-strength-chart-wrapper\"\n >\n {currencyData &&\n currencyData.map((item) => (\n <div\n key={item.currency}\n className=\"lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center\"\n >\n <Chart\n currency={item.currency}\n values={item.strengthRelation?.slice().sort(sortCurrencies)!}\n />\n </div>\n ))}\n </div>\n )}\n {!loading && showError && (\n <div\n className={classnames(\n 'lw-flex lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary',\n {\n 'lw-h-[425px]': !currency,\n 'lw-h-[135px]': currency,\n }\n )}\n >\n <ChartError />\n </div>\n )}\n {!loading && !showError && (\n <div className=\"lw-mt-2 lw-h-8\">\n <LastUpdated\n labelCallback={lang}\n timestamp={data?.currencyStrength![0]?.updatedAt}\n />\n </div>\n )}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAQA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAD,sBAAA,CAAAJ,OAAA;AAEA,IAAAM,oBAAA,GAAAN,OAAA;AAEA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AAA+D,SAAAI,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG/D,MAAMG,aAAa,GAAGC,IAAA,IAA+B;EAAA,IAA9B;IAAEC;EAAsB,CAAC,GAAAD,IAAA;EAC9C,MAAM;IAAEE;EAAK,CAAC,GAAG,IAAAC,mCAAiB,EAAC,CAAC;EACpC,MAAMC,SAAS,GAAGF,IAAI,KAAKG,sBAAI,CAACC,OAAO;EACvC,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAC5B,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAEC;EAAM,CAAC,GAAG,IAAAC,gBAAQ,EACvCC,wCAAmB,EACnB;IACEC,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S,EAAC;EAAkE,GAE5EnC,MAAA,CAAAM,OAAA,CAAA2B,aAAA,CAAC/B,MAAA,CAAAwC,KAAK;IACJjC,QAAQ,EAAEoB,IAAI,CAACpB,QAAS;IACxBkC,MAAM,EAAEd,IAAI,CAACe,gBAAgB,EAAEd,KAAK,CAAC,CAAC,CAACC,IAAI,CAACC,0BAAc;EAAG,CAC9D,CACE,CACN,CACA,CACN,EACA,CAACf,OAAO,IAAIS,SAAS,IACpB1B,MAAA,CAAAM,OAAA,CAAA2B,aAAA;IACEE,SAAS,EAAE,IAAAC,mBAAU,EACnB,sFAAsF,EACtF;MACE,cAAc,EAAE,CAAC3B,QAAQ;MACzB,cAAc,EAAEA;IAClB,CACF;EAAE,GAEFT,MAAA,CAAAM,OAAA,CAAA2B,aAAA,CAACrC,iBAAA,CAAAiD,UAAU,MAAE,CACV,CACN,EACA,CAAC5B,OAAO,IAAI,CAACS,SAAS,IACrB1B,MAAA,CAAAM,OAAA,CAAA2B,aAAA;IAAKE,SAAS,EAAC;EAAgB,GAC7BnC,MAAA,CAAAM,OAAA,CAAA2B,aAAA,CAACrC,iBAAA,CAAAkD,WAAW;IACVC,aAAa,EAAEhC,IAAK;IACpBiC,SAAS,EAAE9B,IAAI,EAAEM,gBAAgB,CAAE,CAAC,CAAC,EAAEyB;EAAU,CAClD,CACE,CAEP,CAAC;AAEP,CAAC;AAACC,OAAA,CAAA3C,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CurrencyStrengthWidget = void 0;
|
|
7
|
+
var _client = require("@apollo/client");
|
|
8
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _translations = require("../translations");
|
|
11
|
+
var _Main = require("./Main");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
13
|
const CurrencyStrengthWidget = _ref => {
|
|
7
14
|
let {
|
|
8
15
|
graphqlUrl,
|
|
@@ -12,23 +19,23 @@ const CurrencyStrengthWidget = _ref => {
|
|
|
12
19
|
isParamError,
|
|
13
20
|
logoLink
|
|
14
21
|
} = _ref;
|
|
15
|
-
const client = new ApolloClient({
|
|
22
|
+
const client = new _client.ApolloClient({
|
|
16
23
|
uri: graphqlUrl,
|
|
17
|
-
cache: new InMemoryCache()
|
|
24
|
+
cache: new _client.InMemoryCache()
|
|
18
25
|
});
|
|
19
|
-
return
|
|
26
|
+
return _react.default.createElement(_labsWidgetCommon.WidgetProvider, {
|
|
20
27
|
client: client,
|
|
21
28
|
locale: locale,
|
|
22
29
|
theme: theme,
|
|
23
|
-
translations: translations
|
|
24
|
-
},
|
|
30
|
+
translations: _translations.translations
|
|
31
|
+
}, _react.default.createElement(_labsWidgetCommon.WidgetWrapper, {
|
|
25
32
|
isParamError: isParamError,
|
|
26
33
|
linkArea: "logo",
|
|
27
34
|
logoLink: logoLink
|
|
28
|
-
},
|
|
35
|
+
}, _react.default.createElement(_Main.Main, {
|
|
29
36
|
currency: currency,
|
|
30
37
|
theme: theme
|
|
31
38
|
})));
|
|
32
39
|
};
|
|
33
|
-
|
|
40
|
+
exports.CurrencyStrengthWidget = CurrencyStrengthWidget;
|
|
34
41
|
//# sourceMappingURL=CurrencyStrengthWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrencyStrengthWidget.js","names":["
|
|
1
|
+
{"version":3,"file":"CurrencyStrengthWidget.js","names":["_client","require","_labsWidgetCommon","_react","_interopRequireDefault","_translations","_Main","e","__esModule","default","CurrencyStrengthWidget","_ref","graphqlUrl","currency","locale","theme","isParamError","logoLink","client","ApolloClient","uri","cache","InMemoryCache","createElement","WidgetProvider","translations","WidgetWrapper","linkArea","Main","exports"],"sources":["../../../src/CurrencyStrengthWidget/CurrencyStrengthWidget.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 { CurrencyStrengthConfig } from './types';\n\nconst CurrencyStrengthWidget = ({\n graphqlUrl,\n currency,\n locale,\n theme,\n isParamError,\n logoLink,\n}: CurrencyStrengthConfig) => {\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 currency={currency} theme={theme} />\n </WidgetWrapper>\n </WidgetProvider>\n );\n};\n\nexport { CurrencyStrengthWidget };\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAA8B,SAAAG,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG9B,MAAMG,sBAAsB,GAAGC,IAAA,IAOD;EAAA,IAPE;IAC9BC,UAAU;IACVC,QAAQ;IACRC,MAAM;IACNC,KAAK;IACLC,YAAY;IACZC;EACsB,CAAC,GAAAN,IAAA;EACvB,MAAMO,MAAM,GAAG,IAAIC,oBAAY,CAAC;IAC9BC,GAAG,EAAER,UAAU;IACfS,KAAK,EAAE,IAAIC,qBAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEnB,MAAA,CAAAM,OAAA,CAAAc,aAAA,CAACrB,iBAAA,CAAAsB,cAAc;IACbN,MAAM,EAAEA,MAAO;IACfJ,MAAM,EAAEA,MAAO;IACfC,KAAK,EAAEA,KAAM;IACbU,YAAY,EAAEA;EAAa,GAE3BtB,MAAA,CAAAM,OAAA,CAAAc,aAAA,CAACrB,iBAAA,CAAAwB,aAAa;IACZV,YAAY,EAAEA,YAAa;IAC3BW,QAAQ,EAAC,MAAM;IACfV,QAAQ,EAAEA;EAAS,GAEnBd,MAAA,CAAAM,OAAA,CAAAc,aAAA,CAACjB,KAAA,CAAAsB,IAAI;IAACf,QAAQ,EAAEA,QAAS;IAACE,KAAK,EAAEA;EAAM,CAAE,CAC5B,CACD,CAAC;AAErB,CAAC;AAACc,OAAA,CAAAnB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Main = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _ChartsWithData = require("./ChartsWithData");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
12
|
const Main = _ref => {
|
|
6
13
|
let {
|
|
7
14
|
currency
|
|
8
15
|
} = _ref;
|
|
9
16
|
const {
|
|
10
17
|
lang
|
|
11
|
-
} = useLocale();
|
|
18
|
+
} = (0, _monoI18n.useLocale)();
|
|
12
19
|
const {
|
|
13
20
|
size
|
|
14
|
-
} = useLayoutProvider();
|
|
15
|
-
return
|
|
21
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
22
|
+
return _react.default.createElement(_react.default.Fragment, null, size && _react.default.createElement("div", {
|
|
16
23
|
"data-testid": "currency-strength-wrapper"
|
|
17
|
-
},
|
|
24
|
+
}, _react.default.createElement("div", {
|
|
18
25
|
className: "lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
19
|
-
},
|
|
26
|
+
}, _react.default.createElement("span", null, `${lang('daily')} (${lang('minute', {
|
|
20
27
|
count: 5
|
|
21
|
-
})})`)),
|
|
28
|
+
})})`)), _react.default.createElement(_ChartsWithData.ChartWithData, {
|
|
22
29
|
currency: currency
|
|
23
30
|
})));
|
|
24
31
|
};
|
|
25
|
-
|
|
32
|
+
exports.Main = Main;
|
|
26
33
|
//# sourceMappingURL=Main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Main.js","names":["
|
|
1
|
+
{"version":3,"file":"Main.js","names":["_labsWidgetCommon","require","_monoI18n","_react","_interopRequireDefault","_ChartsWithData","e","__esModule","default","Main","_ref","currency","lang","useLocale","size","useLayoutProvider","createElement","Fragment","className","count","ChartWithData","exports"],"sources":["../../../src/CurrencyStrengthWidget/Main.tsx"],"sourcesContent":["import { useLayoutProvider } from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { ChartWithData } from './ChartsWithData';\nimport type { WidgetProps } from './types';\n\nconst Main = ({ currency }: WidgetProps) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n\n return (\n <>\n {size && (\n <div data-testid=\"currency-strength-wrapper\">\n <div className=\"lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold\">\n <span>{`${lang('daily')} (${lang('minute', { count: 5 })})`}</span>\n </div>\n <ChartWithData currency={currency} />\n </div>\n )}\n </>\n );\n};\n\nexport { Main };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,e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
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
9
|
+
var _charts = require("echarts/charts");
|
|
10
|
+
var _components = require("echarts/components");
|
|
11
|
+
var echarts = _interopRequireWildcard(require("echarts/core"));
|
|
12
|
+
var _renderers = require("echarts/renderers");
|
|
13
|
+
var _react = _interopRequireDefault(require("react"));
|
|
14
|
+
var _constants = require("./constants");
|
|
15
|
+
var _getOption = require("./getOption");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
|
+
echarts.use([_components.GridSimpleComponent, _components.GraphicComponent, _components.TooltipComponent, _components.TitleComponent, _charts.BarChart, _renderers.CanvasRenderer]);
|
|
19
|
+
echarts.registerTheme('dark_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Dark));
|
|
20
|
+
echarts.registerTheme('light_theme', (0, _labsWidgetCommon.getChartTheme)(_labsWidgetCommon.Theme.Light));
|
|
13
21
|
const Chart = _ref => {
|
|
14
22
|
let {
|
|
15
23
|
values,
|
|
@@ -17,15 +25,15 @@ const Chart = _ref => {
|
|
|
17
25
|
} = _ref;
|
|
18
26
|
const {
|
|
19
27
|
lang
|
|
20
|
-
} = useLocale();
|
|
28
|
+
} = (0, _monoI18n.useLocale)();
|
|
21
29
|
const {
|
|
22
30
|
isDark
|
|
23
|
-
} = useLayoutProvider();
|
|
24
|
-
return
|
|
25
|
-
chartHeight: CHART_HEIGHT,
|
|
31
|
+
} = (0, _labsWidgetCommon.useLayoutProvider)();
|
|
32
|
+
return _react.default.createElement(_labsWidgetCommon.BaseChart, {
|
|
33
|
+
chartHeight: _constants.CHART_HEIGHT,
|
|
26
34
|
echarts: echarts,
|
|
27
35
|
isDark: isDark,
|
|
28
|
-
option: getOption({
|
|
36
|
+
option: (0, _getOption.getOption)({
|
|
29
37
|
values,
|
|
30
38
|
currency,
|
|
31
39
|
lang,
|
|
@@ -33,5 +41,5 @@ const Chart = _ref => {
|
|
|
33
41
|
})
|
|
34
42
|
});
|
|
35
43
|
};
|
|
36
|
-
|
|
44
|
+
exports.Chart = Chart;
|
|
37
45
|
//# sourceMappingURL=Chart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["_labsWidgetCommon","require","_monoI18n","_charts","_components","echarts","_interopRequireWildcard","_renderers","_react","_interopRequireDefault","_constants","_getOption","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","use","GridSimpleComponent","GraphicComponent","TooltipComponent","TitleComponent","BarChart","CanvasRenderer","registerTheme","getChartTheme","Theme","Dark","Light","Chart","_ref","values","currency","lang","useLocale","isDark","useLayoutProvider","createElement","BaseChart","chartHeight","CHART_HEIGHT","option","getOption","exports"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/Chart.tsx"],"sourcesContent":["import {\n BaseChart,\n getChartTheme,\n Theme,\n useLayoutProvider,\n} from '@oanda/labs-widget-common';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { BarChart } from 'echarts/charts';\nimport {\n GraphicComponent,\n GridSimpleComponent,\n TitleComponent,\n TooltipComponent,\n} from 'echarts/components';\nimport * as echarts from 'echarts/core';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport React from 'react';\n\nimport { CHART_HEIGHT } from './constants';\nimport { getOption } from './getOption';\nimport type { ChartProps } from './types';\n\necharts.use([\n GridSimpleComponent,\n GraphicComponent,\n TooltipComponent,\n TitleComponent,\n BarChart,\n CanvasRenderer,\n]);\n\necharts.registerTheme('dark_theme', getChartTheme(Theme.Dark));\necharts.registerTheme('light_theme', getChartTheme(Theme.Light));\n\nconst Chart = ({ values, currency }: ChartProps) => {\n const { lang } = useLocale();\n const { isDark } = useLayoutProvider();\n\n return (\n <BaseChart\n chartHeight={CHART_HEIGHT}\n echarts={echarts}\n isDark={isDark}\n option={getOption({\n values,\n currency,\n lang,\n isDark,\n })}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAMA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAMA,IAAAI,OAAA,GAAAC,uBAAA,CAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAC,sBAAA,CAAAR,OAAA;AAEA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AAAwC,SAAAQ,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA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RC,WAAW,EAAEC,uBAAa;IAC1BjD,OAAO,EAAEA,OAAQ;IACjB4C,MAAM,EAAEA,MAAO;IACfM,MAAM,EAAE,IAAAC,oBAAS,EAAC;MAChBX,MAAM;MACNC,QAAQ;MACRC,IAAI;MACJE;IACF,CAAC;EAAE,CACJ,CAAC;AAEN,CAAC;AAACQ,OAAA,CAAAd,KAAA,GAAAA,KAAA","ignoreList":[]}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.lightBarColors = exports.instrumentsConfig = exports.darkBarColors = exports.Y_LABEL_SIZE = exports.X_LABEL_SIZE = exports.CHART_WIDTH = exports.CHART_HEIGHT = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _graphql = require("../../../gql/types/graphql");
|
|
9
|
+
const X_LABEL_SIZE = exports.X_LABEL_SIZE = 24;
|
|
10
|
+
const Y_LABEL_SIZE = exports.Y_LABEL_SIZE = 30;
|
|
11
|
+
const CHART_WIDTH = exports.CHART_WIDTH = 9999;
|
|
12
|
+
const CHART_HEIGHT = exports.CHART_HEIGHT = 135;
|
|
13
|
+
const darkBarColors = exports.darkBarColors = {
|
|
14
|
+
positive: _labsWidgetCommon.colorPalette.bottleGreenLight,
|
|
15
|
+
negative: _labsWidgetCommon.colorPalette.orange,
|
|
16
|
+
zero: _labsWidgetCommon.colorPalette.grayLight
|
|
11
17
|
};
|
|
12
|
-
|
|
13
|
-
positive: colorPalette.bottleGreenLight,
|
|
14
|
-
negative: colorPalette.raspberryDark,
|
|
15
|
-
zero: colorPalette.grayLight
|
|
18
|
+
const lightBarColors = exports.lightBarColors = {
|
|
19
|
+
positive: _labsWidgetCommon.colorPalette.bottleGreenLight,
|
|
20
|
+
negative: _labsWidgetCommon.colorPalette.raspberryDark,
|
|
21
|
+
zero: _labsWidgetCommon.colorPalette.grayLight
|
|
16
22
|
};
|
|
17
|
-
|
|
23
|
+
const instrumentsConfig = exports.instrumentsConfig = [_graphql.CurrencyName.Usd, _graphql.CurrencyName.Eur, _graphql.CurrencyName.Gbp, _graphql.CurrencyName.Cad, _graphql.CurrencyName.Aud, _graphql.CurrencyName.Chf, _graphql.CurrencyName.Jpy, _graphql.CurrencyName.Nzd];
|
|
18
24
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["
|
|
1
|
+
{"version":3,"file":"constants.js","names":["_labsWidgetCommon","require","_graphql","X_LABEL_SIZE","exports","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","darkBarColors","positive","colorPalette","bottleGreenLight","negative","orange","zero","grayLight","lightBarColors","raspberryDark","instrumentsConfig","CurrencyName","Usd","Eur","Gbp","Cad","Aud","Chf","Jpy","Nzd"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nimport { CurrencyName } from '../../../gql/types/graphql';\n\nexport const X_LABEL_SIZE = 24;\nexport const Y_LABEL_SIZE = 30;\nexport const CHART_WIDTH = 9999;\nexport const CHART_HEIGHT = 135;\n\nexport const darkBarColors = {\n positive: colorPalette.bottleGreenLight,\n negative: colorPalette.orange,\n zero: colorPalette.grayLight,\n};\n\nexport const lightBarColors = {\n positive: colorPalette.bottleGreenLight,\n negative: colorPalette.raspberryDark,\n zero: colorPalette.grayLight,\n};\n\nexport const instrumentsConfig = [\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"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,EAAE;AACvB,MAAME,YAAY,GAAAD,OAAA,CAAAC,YAAA,GAAG,EAAE;AACvB,MAAMC,WAAW,GAAAF,OAAA,CAAAE,WAAA,GAAG,IAAI;AACxB,MAAMC,YAAY,GAAAH,OAAA,CAAAG,YAAA,GAAG,GAAG;AAExB,MAAMC,aAAa,GAAAJ,OAAA,CAAAI,aAAA,GAAG;EAC3BC,QAAQ,EAAEC,8BAAY,CAACC,gBAAgB;EACvCC,QAAQ,EAAEF,8BAAY,CAACG,MAAM;EAC7BC,IAAI,EAAEJ,8BAAY,CAACK;AACrB,CAAC;AAEM,MAAMC,cAAc,GAAAZ,OAAA,CAAAY,cAAA,GAAG;EAC5BP,QAAQ,EAAEC,8BAAY,CAACC,gBAAgB;EACvCC,QAAQ,EAAEF,8BAAY,CAACO,aAAa;EACpCH,IAAI,EAAEJ,8BAAY,CAACK;AACrB,CAAC;AAEM,MAAMG,iBAAiB,GAAAd,OAAA,CAAAc,iBAAA,GAAG,CAC/BC,qBAAY,CAACC,GAAG,EAChBD,qBAAY,CAACE,GAAG,EAChBF,qBAAY,CAACG,GAAG,EAChBH,qBAAY,CAACI,GAAG,EAChBJ,qBAAY,CAACK,GAAG,EAChBL,qBAAY,CAACM,GAAG,EAChBN,qBAAY,CAACO,GAAG,EAChBP,qBAAY,CAACQ,GAAG,CACjB","ignoreList":[]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tooltipFormatter = exports.sortCurrencies = void 0;
|
|
7
|
+
var _constants = require("./constants");
|
|
2
8
|
const tooltipFormatter = _ref => {
|
|
3
9
|
let {
|
|
4
10
|
marker,
|
|
@@ -13,6 +19,7 @@ const tooltipFormatter = _ref => {
|
|
|
13
19
|
<div style="display:flex;align-items:center;">${marker} ${value}%</div>
|
|
14
20
|
</div>`;
|
|
15
21
|
};
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
exports.tooltipFormatter = tooltipFormatter;
|
|
23
|
+
const sortCurrencies = (a, b) => _constants.instrumentsConfig.indexOf(a.currency) - _constants.instrumentsConfig.indexOf(b.currency);
|
|
24
|
+
exports.sortCurrencies = sortCurrencies;
|
|
18
25
|
//# sourceMappingURL=formatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["_constants","require","tooltipFormatter","_ref","marker","name","value","currency","lang","exports","sortCurrencies","a","b","instrumentsConfig","indexOf"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/formatters.ts"],"sourcesContent":["import { instrumentsConfig } from './constants';\nimport type { SortingParams, TooltipFormatterParams } from './types';\n\nconst tooltipFormatter = ({\n marker,\n name,\n value,\n currency,\n lang,\n}: TooltipFormatterParams) => `\n<div>\n <div style=\"margin-bottom:5px;\">${currency} ${lang('vs')} ${name}</div>\n <div style=\"display:flex;align-items:center;\">${marker} ${value}%</div>\n</div>`;\n\nconst sortCurrencies = (a: SortingParams, b: SortingParams) =>\n instrumentsConfig.indexOf(a.currency) - instrumentsConfig.indexOf(b.currency);\n\nexport { sortCurrencies, tooltipFormatter };\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAGA,MAAMC,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IACxBC,MAAM;IACNC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC;EACsB,CAAC,GAAAL,IAAA;EAAA,OAAK;AAC9B;AACA,oCAAoCI,QAAQ,IAAIC,IAAI,CAAC,IAAI,CAAC,IAAIH,IAAI;AAClE,kDAAkDD,MAAM,IAAIE,KAAK;AACjE,OAAO;AAAA;AAACG,OAAA,CAAAP,gBAAA,GAAAA,gBAAA;AAER,MAAMQ,cAAc,GAAGA,CAACC,CAAgB,EAAEC,CAAgB,KACxDC,4BAAiB,CAACC,OAAO,CAACH,CAAC,CAACJ,QAAQ,CAAC,GAAGM,4BAAiB,CAACC,OAAO,CAACF,CAAC,CAACL,QAAQ,CAAC;AAACE,OAAA,CAAAC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getOption = void 0;
|
|
7
|
+
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
|
+
var _constants = require("./constants");
|
|
9
|
+
var _formatters = require("./formatters");
|
|
10
|
+
const getOption = _ref => {
|
|
5
11
|
let {
|
|
6
12
|
values,
|
|
7
13
|
currency,
|
|
@@ -10,11 +16,11 @@ export const getOption = _ref => {
|
|
|
10
16
|
} = _ref;
|
|
11
17
|
const currencies = values.map(item => item.currency);
|
|
12
18
|
const percentages = values.map(item => item.percentage);
|
|
13
|
-
const barColors = isDark ? darkBarColors : lightBarColors;
|
|
14
|
-
const gridLines = getGridLines({
|
|
19
|
+
const barColors = isDark ? _constants.darkBarColors : _constants.lightBarColors;
|
|
20
|
+
const gridLines = (0, _labsWidgetCommon.getGridLines)({
|
|
15
21
|
isDark,
|
|
16
|
-
chartWidth: CHART_WIDTH,
|
|
17
|
-
chartHeight: CHART_HEIGHT,
|
|
22
|
+
chartWidth: _constants.CHART_WIDTH,
|
|
23
|
+
chartHeight: _constants.CHART_HEIGHT,
|
|
18
24
|
xLabelsSize: -2,
|
|
19
25
|
yLabelSize: -3
|
|
20
26
|
});
|
|
@@ -34,8 +40,8 @@ export const getOption = _ref => {
|
|
|
34
40
|
name: 'main-grid',
|
|
35
41
|
top: '30px',
|
|
36
42
|
right: '0px',
|
|
37
|
-
left: `${Y_LABEL_SIZE}px`,
|
|
38
|
-
bottom: `${X_LABEL_SIZE}px`
|
|
43
|
+
left: `${_constants.Y_LABEL_SIZE}px`,
|
|
44
|
+
bottom: `${_constants.X_LABEL_SIZE}px`
|
|
39
45
|
}],
|
|
40
46
|
graphic: [...gridLines],
|
|
41
47
|
tooltip: {
|
|
@@ -46,7 +52,7 @@ export const getOption = _ref => {
|
|
|
46
52
|
name,
|
|
47
53
|
value
|
|
48
54
|
}] = _ref2;
|
|
49
|
-
return tooltipFormatter({
|
|
55
|
+
return (0, _formatters.tooltipFormatter)({
|
|
50
56
|
lang,
|
|
51
57
|
currency,
|
|
52
58
|
marker,
|
|
@@ -116,4 +122,5 @@ export const getOption = _ref => {
|
|
|
116
122
|
}]
|
|
117
123
|
};
|
|
118
124
|
};
|
|
125
|
+
exports.getOption = getOption;
|
|
119
126
|
//# sourceMappingURL=getOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOption.js","names":["
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["_labsWidgetCommon","require","_constants","_formatters","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","darkBarColors","lightBarColors","gridLines","getGridLines","chartWidth","CHART_WIDTH","chartHeight","CHART_HEIGHT","xLabelsSize","yLabelSize","animation","title","top","left","text","textStyle","fontSize","lineHeight","fontWeight","grid","name","right","Y_LABEL_SIZE","bottom","X_LABEL_SIZE","graphic","tooltip","trigger","formatter","_ref2","marker","value","tooltipFormatter","axisPointer","axis","extraCssText","xAxis","type","data","axisTick","show","axisLine","splitLine","axisLabel","yAxis","position","min","Math","floor","max","ceil","interval","series","emphasis","disabled","itemStyle","opacity","color","_ref3","positive","negative","zero","exports"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/getOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\n\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n darkBarColors,\n lightBarColors,\n X_LABEL_SIZE,\n Y_LABEL_SIZE,\n} from './constants';\nimport { tooltipFormatter } from './formatters';\nimport type { GetOptionProps } from './types';\n\nexport const getOption = ({\n values,\n currency,\n isDark,\n lang,\n}: GetOptionProps) => {\n const currencies = values.map((item) => item.currency);\n const percentages = values.map((item) => item.percentage);\n const barColors = isDark ? darkBarColors : lightBarColors;\n\n const gridLines = getGridLines({\n isDark,\n chartWidth: CHART_WIDTH,\n chartHeight: CHART_HEIGHT,\n xLabelsSize: -2,\n yLabelSize: -3,\n });\n\n return {\n animation: false,\n title: {\n top: '0px',\n left: 'center',\n text: `${currency} vs`,\n textStyle: {\n fontSize: 12,\n lineHeight: 20,\n fontWeight: 400,\n },\n },\n grid: [\n {\n name: 'main-grid',\n top: '30px',\n right: '0px',\n left: `${Y_LABEL_SIZE}px`,\n bottom: `${X_LABEL_SIZE}px`,\n },\n ],\n graphic: [...gridLines],\n tooltip: {\n trigger: 'axis',\n formatter: ([{ marker, name, value }]: {\n marker: string;\n name: string;\n value: number;\n }[]) =>\n tooltipFormatter({\n lang,\n currency,\n marker,\n name,\n value,\n }),\n axisPointer: {\n axis: 'x',\n },\n extraCssText: 'z-index: 1',\n },\n xAxis: {\n type: 'category',\n data: currencies,\n axisTick: { show: false },\n axisLine: { show: false },\n splitLine: { show: false },\n axisLabel: {\n fontSize: 10,\n },\n },\n yAxis: {\n type: 'value',\n position: 'left',\n min: Math.floor(Math.min(...percentages)),\n max: Math.ceil(Math.max(...percentages)),\n interval: 1,\n axisLine: { show: false },\n axisTick: { show: false },\n axisLabel: {\n formatter: '{value}%',\n fontSize: 10,\n },\n },\n series: [\n {\n data: percentages,\n type: 'bar',\n emphasis: {\n disabled: true,\n },\n itemStyle: {\n opacity: 1,\n color: ({ data }: { data: number }) => {\n if (data > 0) {\n return barColors.positive;\n }\n if (data < 0) {\n return barColors.negative;\n }\n return barColors.zero;\n },\n },\n },\n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/B;YAAEpB;UAAuB,CAAC,GAAAoB,KAAA;UAChC,IAAIpB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAOvC,SAAS,CAAC4D,QAAQ;UAC3B;UACA,IAAIrB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAOvC,SAAS,CAAC6D,QAAQ;UAC3B;UACA,OAAO7D,SAAS,CAAC8D,IAAI;QACvB;MACF;IACF,CAAC;EAEL,CAAC;AACH,CAAC;AAACC,OAAA,CAAA1E,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Chart = require("./Chart");
|
|
7
|
+
Object.keys(_Chart).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Chart[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Chart[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
2
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Chart","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _CurrencyStrengthWidget = require("./CurrencyStrengthWidget");
|
|
7
|
+
Object.keys(_CurrencyStrengthWidget).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _CurrencyStrengthWidget[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _CurrencyStrengthWidget[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
2
17
|
//# sourceMappingURL=index.js.map
|