@oanda/labs-currency-strength-widget 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/codegen.ts +15 -0
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js +50 -0
- package/dist/main/CurrencyStrengthWidget/ChartsWithData.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/CurrencyStrengthWidget.js +37 -0
- package/dist/main/CurrencyStrengthWidget/CurrencyStrengthWidget.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/Main.js +22 -0
- package/dist/main/CurrencyStrengthWidget/Main.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/Chart.js +50 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/Chart.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/constants.js +22 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/constants.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js +18 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js +121 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/index.js +17 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/index.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/types.js +6 -0
- package/dist/main/CurrencyStrengthWidget/components/Chart/types.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/index.js +17 -0
- package/dist/main/CurrencyStrengthWidget/index.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/render.js +34 -0
- package/dist/main/CurrencyStrengthWidget/render.js.map +1 -0
- package/dist/main/CurrencyStrengthWidget/types.js +6 -0
- package/dist/main/CurrencyStrengthWidget/types.js.map +1 -0
- package/dist/main/gql/getCurrencyStrength.js +11 -0
- package/dist/main/gql/getCurrencyStrength.js.map +1 -0
- package/dist/main/gql/types/fragment-masking.js +24 -0
- package/dist/main/gql/types/fragment-masking.js.map +1 -0
- package/dist/main/gql/types/gql.js +17 -0
- package/dist/main/gql/types/gql.js.map +1 -0
- package/dist/main/gql/types/graphql.js +137 -0
- package/dist/main/gql/types/graphql.js.map +1 -0
- package/dist/main/gql/types/index.js +28 -0
- package/dist/main/gql/types/index.js.map +1 -0
- package/dist/main/index.js +17 -0
- package/dist/main/index.js.map +1 -0
- package/dist/main/translations/index.js +19 -0
- package/dist/main/translations/index.js.map +1 -0
- package/dist/main/translations/sources/en.json +6 -0
- package/dist/main/translations/sources/zh_TW.json +6 -0
- package/dist/main/translations/translations.js +8 -0
- package/dist/main/translations/translations.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js +41 -0
- package/dist/module/CurrencyStrengthWidget/ChartsWithData.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/CurrencyStrengthWidget.js +30 -0
- package/dist/module/CurrencyStrengthWidget/CurrencyStrengthWidget.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/Main.js +15 -0
- package/dist/module/CurrencyStrengthWidget/Main.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js +41 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/Chart.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/constants.js +16 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/constants.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js +11 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/formatters.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js +114 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/getOption.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/index.js +2 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/index.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/types.js +2 -0
- package/dist/module/CurrencyStrengthWidget/components/Chart/types.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/index.js +2 -0
- package/dist/module/CurrencyStrengthWidget/index.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/render.js +31 -0
- package/dist/module/CurrencyStrengthWidget/render.js.map +1 -0
- package/dist/module/CurrencyStrengthWidget/types.js +2 -0
- package/dist/module/CurrencyStrengthWidget/types.js.map +1 -0
- package/dist/module/gql/getCurrencyStrength.js +6 -0
- package/dist/module/gql/getCurrencyStrength.js.map +1 -0
- package/dist/module/gql/types/fragment-masking.js +16 -0
- package/dist/module/gql/types/fragment-masking.js.map +1 -0
- package/dist/module/gql/types/gql.js +9 -0
- package/dist/module/gql/types/gql.js.map +1 -0
- package/dist/module/gql/types/graphql.js +131 -0
- package/dist/module/gql/types/graphql.js.map +1 -0
- package/dist/module/gql/types/index.js +3 -0
- package/dist/module/gql/types/index.js.map +1 -0
- package/dist/module/index.js +2 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/translations/index.js +12 -0
- package/dist/module/translations/index.js.map +1 -0
- package/dist/module/translations/sources/en.json +6 -0
- package/dist/module/translations/sources/zh_TW.json +6 -0
- package/dist/module/translations/translations.js +2 -0
- package/dist/module/translations/translations.js.map +1 -0
- package/dist/types/CurrencyStrengthWidget/ChartsWithData.d.ts +3 -0
- package/dist/types/CurrencyStrengthWidget/CurrencyStrengthWidget.d.ts +4 -0
- package/dist/types/CurrencyStrengthWidget/Main.d.ts +3 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/Chart.d.ts +4 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/constants.d.ts +14 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/formatters.d.ts +2 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/getOption.d.ts +169 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/index.d.ts +1 -0
- package/dist/types/CurrencyStrengthWidget/components/Chart/types.d.ts +22 -0
- package/dist/types/CurrencyStrengthWidget/index.d.ts +1 -0
- package/dist/types/CurrencyStrengthWidget/render.d.ts +1 -0
- package/dist/types/CurrencyStrengthWidget/types.d.ts +11 -0
- package/dist/types/gql/getCurrencyStrength.d.ts +2 -0
- package/dist/types/gql/types/fragment-masking.d.ts +15 -0
- package/dist/types/gql/types/gql.d.ts +36 -0
- package/dist/types/gql/types/graphql.d.ts +282 -0
- package/dist/types/gql/types/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/translations/index.d.ts +4 -0
- package/dist/types/translations/translations.d.ts +1 -0
- package/index.ts +1 -0
- package/lokalise.config.json +18 -0
- package/package.json +29 -0
- package/src/CurrencyStrengthWidget/ChartsWithData.tsx +53 -0
- package/src/CurrencyStrengthWidget/CurrencyStrengthWidget.tsx +32 -0
- package/src/CurrencyStrengthWidget/Main.tsx +18 -0
- package/src/CurrencyStrengthWidget/components/Chart/Chart.tsx +48 -0
- package/src/CurrencyStrengthWidget/components/Chart/constants.tsx +18 -0
- package/src/CurrencyStrengthWidget/components/Chart/formatters.ts +13 -0
- package/src/CurrencyStrengthWidget/components/Chart/getOption.ts +109 -0
- package/src/CurrencyStrengthWidget/components/Chart/index.ts +1 -0
- package/src/CurrencyStrengthWidget/components/Chart/types.ts +25 -0
- package/src/CurrencyStrengthWidget/index.ts +1 -0
- package/src/CurrencyStrengthWidget/render.tsx +34 -0
- package/src/CurrencyStrengthWidget/types.ts +13 -0
- package/src/gql/getCurrencyStrength.ts +15 -0
- package/src/gql/types/fragment-masking.ts +66 -0
- package/src/gql/types/gql.ts +42 -0
- package/src/gql/types/graphql.ts +290 -0
- package/src/gql/types/index.ts +2 -0
- package/src/index.ts +1 -0
- package/src/translations/index.ts +13 -0
- package/src/translations/sources/en.json +6 -0
- package/src/translations/sources/zh_TW.json +6 -0
- package/src/translations/translations.ts +3 -0
- package/test/Main.test.tsx +28 -0
- package/test/chartOptions.test.ts +18 -0
- package/test/mocks/currencyStrengthMock.ts +270 -0
- package/test/mocks/index.ts +2 -0
- package/test/mocks/responsesMocks.ts +19 -0
- package/tsconfig.types.json +12 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VolatilityChartTimeUnit = exports.VolatilityChartTimeSpan = exports.TopicalSort = exports.Sort = exports.Region = exports.GetCurrencyStrengthDocument = exports.Division = exports.DataSource = exports.CurrencyPowerBalanceTimeUnit = exports.CurrencyName = exports.BookType = void 0;
|
|
7
|
+
let BookType = exports.BookType = function (BookType) {
|
|
8
|
+
BookType["Order"] = "ORDER";
|
|
9
|
+
BookType["Position"] = "POSITION";
|
|
10
|
+
return BookType;
|
|
11
|
+
}({});
|
|
12
|
+
let CurrencyName = exports.CurrencyName = function (CurrencyName) {
|
|
13
|
+
CurrencyName["Aud"] = "AUD";
|
|
14
|
+
CurrencyName["Cad"] = "CAD";
|
|
15
|
+
CurrencyName["Chf"] = "CHF";
|
|
16
|
+
CurrencyName["Eur"] = "EUR";
|
|
17
|
+
CurrencyName["Gbp"] = "GBP";
|
|
18
|
+
CurrencyName["Jpy"] = "JPY";
|
|
19
|
+
CurrencyName["Nzd"] = "NZD";
|
|
20
|
+
CurrencyName["Usd"] = "USD";
|
|
21
|
+
return CurrencyName;
|
|
22
|
+
}({});
|
|
23
|
+
let CurrencyPowerBalanceTimeUnit = exports.CurrencyPowerBalanceTimeUnit = function (CurrencyPowerBalanceTimeUnit) {
|
|
24
|
+
CurrencyPowerBalanceTimeUnit["CurrentDay"] = "CURRENT_DAY";
|
|
25
|
+
CurrencyPowerBalanceTimeUnit["H4"] = "H4";
|
|
26
|
+
CurrencyPowerBalanceTimeUnit["H8"] = "H8";
|
|
27
|
+
CurrencyPowerBalanceTimeUnit["H24"] = "H24";
|
|
28
|
+
CurrencyPowerBalanceTimeUnit["M1"] = "M1";
|
|
29
|
+
CurrencyPowerBalanceTimeUnit["M3"] = "M3";
|
|
30
|
+
CurrencyPowerBalanceTimeUnit["PreviousDay"] = "PREVIOUS_DAY";
|
|
31
|
+
CurrencyPowerBalanceTimeUnit["W1"] = "W1";
|
|
32
|
+
return CurrencyPowerBalanceTimeUnit;
|
|
33
|
+
}({});
|
|
34
|
+
let DataSource = exports.DataSource = function (DataSource) {
|
|
35
|
+
DataSource["Ny4"] = "NY4";
|
|
36
|
+
DataSource["Ty3"] = "TY3";
|
|
37
|
+
return DataSource;
|
|
38
|
+
}({});
|
|
39
|
+
let Division = exports.Division = function (Division) {
|
|
40
|
+
Division["Oap"] = "OAP";
|
|
41
|
+
Division["Oau"] = "OAU";
|
|
42
|
+
Division["Oc"] = "OC";
|
|
43
|
+
Division["Ocan"] = "OCAN";
|
|
44
|
+
Division["Oel"] = "OEL";
|
|
45
|
+
Division["Ogm"] = "OGM";
|
|
46
|
+
Division["Oj"] = "OJ";
|
|
47
|
+
Division["Otms"] = "OTMS";
|
|
48
|
+
return Division;
|
|
49
|
+
}({});
|
|
50
|
+
let Region = exports.Region = function (Region) {
|
|
51
|
+
Region["Amer"] = "AMER";
|
|
52
|
+
Region["Apac"] = "APAC";
|
|
53
|
+
Region["Emea"] = "EMEA";
|
|
54
|
+
return Region;
|
|
55
|
+
}({});
|
|
56
|
+
let Sort = exports.Sort = function (Sort) {
|
|
57
|
+
Sort["Bearish"] = "BEARISH";
|
|
58
|
+
Sort["Bullish"] = "BULLISH";
|
|
59
|
+
return Sort;
|
|
60
|
+
}({});
|
|
61
|
+
let TopicalSort = exports.TopicalSort = function (TopicalSort) {
|
|
62
|
+
TopicalSort["Bearish"] = "BEARISH";
|
|
63
|
+
TopicalSort["Bullish"] = "BULLISH";
|
|
64
|
+
TopicalSort["Hot"] = "HOT";
|
|
65
|
+
TopicalSort["Popular"] = "POPULAR";
|
|
66
|
+
TopicalSort["Volatile"] = "VOLATILE";
|
|
67
|
+
return TopicalSort;
|
|
68
|
+
}({});
|
|
69
|
+
let VolatilityChartTimeSpan = exports.VolatilityChartTimeSpan = function (VolatilityChartTimeSpan) {
|
|
70
|
+
VolatilityChartTimeSpan["D5"] = "D5";
|
|
71
|
+
VolatilityChartTimeSpan["D10"] = "D10";
|
|
72
|
+
VolatilityChartTimeSpan["M1"] = "M1";
|
|
73
|
+
VolatilityChartTimeSpan["M3"] = "M3";
|
|
74
|
+
VolatilityChartTimeSpan["W5"] = "W5";
|
|
75
|
+
VolatilityChartTimeSpan["W10"] = "W10";
|
|
76
|
+
return VolatilityChartTimeSpan;
|
|
77
|
+
}({});
|
|
78
|
+
let VolatilityChartTimeUnit = exports.VolatilityChartTimeUnit = function (VolatilityChartTimeUnit) {
|
|
79
|
+
VolatilityChartTimeUnit["D"] = "D";
|
|
80
|
+
VolatilityChartTimeUnit["H"] = "H";
|
|
81
|
+
VolatilityChartTimeUnit["W"] = "W";
|
|
82
|
+
return VolatilityChartTimeUnit;
|
|
83
|
+
}({});
|
|
84
|
+
const GetCurrencyStrengthDocument = exports.GetCurrencyStrengthDocument = {
|
|
85
|
+
"kind": "Document",
|
|
86
|
+
"definitions": [{
|
|
87
|
+
"kind": "OperationDefinition",
|
|
88
|
+
"operation": "query",
|
|
89
|
+
"name": {
|
|
90
|
+
"kind": "Name",
|
|
91
|
+
"value": "GetCurrencyStrength"
|
|
92
|
+
},
|
|
93
|
+
"selectionSet": {
|
|
94
|
+
"kind": "SelectionSet",
|
|
95
|
+
"selections": [{
|
|
96
|
+
"kind": "Field",
|
|
97
|
+
"name": {
|
|
98
|
+
"kind": "Name",
|
|
99
|
+
"value": "currencyStrength"
|
|
100
|
+
},
|
|
101
|
+
"selectionSet": {
|
|
102
|
+
"kind": "SelectionSet",
|
|
103
|
+
"selections": [{
|
|
104
|
+
"kind": "Field",
|
|
105
|
+
"name": {
|
|
106
|
+
"kind": "Name",
|
|
107
|
+
"value": "currency"
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
"kind": "Field",
|
|
111
|
+
"name": {
|
|
112
|
+
"kind": "Name",
|
|
113
|
+
"value": "strengthRelation"
|
|
114
|
+
},
|
|
115
|
+
"selectionSet": {
|
|
116
|
+
"kind": "SelectionSet",
|
|
117
|
+
"selections": [{
|
|
118
|
+
"kind": "Field",
|
|
119
|
+
"name": {
|
|
120
|
+
"kind": "Name",
|
|
121
|
+
"value": "currency"
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
"kind": "Field",
|
|
125
|
+
"name": {
|
|
126
|
+
"kind": "Name",
|
|
127
|
+
"value": "percentage"
|
|
128
|
+
}
|
|
129
|
+
}]
|
|
130
|
+
}
|
|
131
|
+
}]
|
|
132
|
+
}
|
|
133
|
+
}]
|
|
134
|
+
}
|
|
135
|
+
}]
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=graphql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql.js","names":["BookType","exports","CurrencyName","CurrencyPowerBalanceTimeUnit","DataSource","Division","Region","Sort","TopicalSort","VolatilityChartTimeSpan","VolatilityChartTimeUnit","GetCurrencyStrengthDocument"],"sources":["../../../../src/gql/types/graphql.ts"],"sourcesContent":["/* eslint-disable */\nimport { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';\nexport type Maybe<T> = T | null;\nexport type InputMaybe<T> = Maybe<T>;\nexport type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };\nexport type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };\nexport type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };\nexport type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };\nexport type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };\n/** All built-in and custom scalars, mapped to their actual values */\nexport type Scalars = {\n ID: { input: string; output: string; }\n String: { input: string; output: string; }\n Boolean: { input: boolean; output: boolean; }\n Int: { input: number; output: number; }\n Float: { input: number; output: number; }\n};\n\nexport type AssetClass = {\n __typename?: 'AssetClass';\n instruments?: Maybe<Array<Maybe<Instrument>>>;\n name?: Maybe<Scalars['String']['output']>;\n};\n\nexport enum BookType {\n Order = 'ORDER',\n Position = 'POSITION'\n}\n\nexport enum CurrencyName {\n Aud = 'AUD',\n Cad = 'CAD',\n Chf = 'CHF',\n Eur = 'EUR',\n Gbp = 'GBP',\n Jpy = 'JPY',\n Nzd = 'NZD',\n Usd = 'USD'\n}\n\nexport type CurrencyPower = {\n __typename?: 'CurrencyPower';\n /** UTC Timestamp */\n point: Scalars['String']['output'];\n price: Scalars['Float']['output'];\n};\n\nexport type CurrencyPowerBalance = {\n __typename?: 'CurrencyPowerBalance';\n currency: CurrencyName;\n power: Array<CurrencyPower>;\n};\n\nexport enum CurrencyPowerBalanceTimeUnit {\n CurrentDay = 'CURRENT_DAY',\n H4 = 'H4',\n H8 = 'H8',\n H24 = 'H24',\n M1 = 'M1',\n M3 = 'M3',\n PreviousDay = 'PREVIOUS_DAY',\n W1 = 'W1'\n}\n\nexport type CurrencyStrength = {\n __typename?: 'CurrencyStrength';\n currency: CurrencyName;\n strengthRelation?: Maybe<Array<StrengthRelation>>;\n};\n\nexport enum DataSource {\n Ny4 = 'NY4',\n Ty3 = 'TY3'\n}\n\nexport enum Division {\n Oap = 'OAP',\n Oau = 'OAU',\n Oc = 'OC',\n Ocan = 'OCAN',\n Oel = 'OEL',\n Ogm = 'OGM',\n Oj = 'OJ',\n Otms = 'OTMS'\n}\n\nexport type Instrument = {\n __typename?: 'Instrument';\n displayName?: Maybe<Scalars['String']['output']>;\n name?: Maybe<Scalars['String']['output']>;\n};\n\nexport type OrderPositionBucket = {\n __typename?: 'OrderPositionBucket';\n longCountPercent: Scalars['Float']['output'];\n price: Scalars['Float']['output'];\n shortCountPercent: Scalars['Float']['output'];\n};\n\nexport type OrderPositionData = {\n __typename?: 'OrderPositionData';\n bucketWidth: Scalars['Float']['output'];\n buckets: Array<Maybe<OrderPositionBucket>>;\n dataSource?: Maybe<Scalars['String']['output']>;\n instrument: Scalars['String']['output'];\n price?: Maybe<Scalars['Float']['output']>;\n region?: Maybe<Scalars['String']['output']>;\n time: Scalars['String']['output'];\n unixTime: Scalars['Int']['output'];\n};\n\nexport type Query = {\n __typename?: 'Query';\n assetClasses?: Maybe<Array<Maybe<AssetClass>>>;\n currencyPowerBalance?: Maybe<Array<CurrencyPowerBalance>>;\n currencyStrength?: Maybe<Array<CurrencyStrength>>;\n orderPositionBooks: Array<Maybe<OrderPositionData>>;\n sentiment?: Maybe<Array<SentimentInstrument>>;\n sentimentList?: Maybe<Array<SentimentInstrument>>;\n topicalInstruments?: Maybe<Array<TopicalInstrument>>;\n topicalInstrumentsCharts?: Maybe<Array<TopicalInstrumentChart>>;\n topicalInstrumentsTotalCount: Scalars['Int']['output'];\n volatilityChart?: Maybe<Array<Maybe<VolatilityChart>>>;\n volatilityChartAssetClasses?: Maybe<Array<VolatilityChartAssetClass>>;\n};\n\n\nexport type QueryAssetClassesArgs = {\n division: Division;\n};\n\n\nexport type QueryCurrencyPowerBalanceArgs = {\n timeUnit: CurrencyPowerBalanceTimeUnit;\n};\n\n\nexport type QueryOrderPositionBooksArgs = {\n bookType: BookType;\n dataSource?: InputMaybe<DataSource>;\n instrument: Scalars['String']['input'];\n recentHours?: InputMaybe<Scalars['Int']['input']>;\n region?: InputMaybe<Region>;\n};\n\n\nexport type QuerySentimentArgs = {\n division?: InputMaybe<Division>;\n name: Scalars['String']['input'];\n};\n\n\nexport type QuerySentimentListArgs = {\n division?: InputMaybe<Division>;\n sort?: InputMaybe<Sort>;\n};\n\n\nexport type QueryTopicalInstrumentsArgs = {\n count?: InputMaybe<Scalars['Int']['input']>;\n division?: InputMaybe<Division>;\n offset?: InputMaybe<Scalars['Int']['input']>;\n sort: TopicalSort;\n};\n\n\nexport type QueryTopicalInstrumentsChartsArgs = {\n division?: InputMaybe<Division>;\n instruments?: InputMaybe<Array<Scalars['String']['input']>>;\n};\n\n\nexport type QueryTopicalInstrumentsTotalCountArgs = {\n division?: InputMaybe<Division>;\n sort: TopicalSort;\n};\n\n\nexport type QueryVolatilityChartArgs = {\n division?: InputMaybe<Division>;\n instrument: Scalars['String']['input'];\n timeSpan: VolatilityChartTimeSpan;\n timeUnit: VolatilityChartTimeUnit;\n};\n\n\nexport type QueryVolatilityChartAssetClassesArgs = {\n division?: InputMaybe<Division>;\n};\n\nexport enum Region {\n Amer = 'AMER',\n Apac = 'APAC',\n Emea = 'EMEA'\n}\n\nexport type Sentiment = {\n __typename?: 'Sentiment';\n longPercent: Scalars['Float']['output'];\n shortPercent: Scalars['Float']['output'];\n};\n\nexport type SentimentInstrument = {\n __typename?: 'SentimentInstrument';\n displayName: Scalars['String']['output'];\n name: Scalars['String']['output'];\n sentiment: Sentiment;\n updatedAt: Scalars['String']['output'];\n};\n\nexport enum Sort {\n Bearish = 'BEARISH',\n Bullish = 'BULLISH'\n}\n\nexport type StrengthRelation = {\n __typename?: 'StrengthRelation';\n currency: CurrencyName;\n percentage: Scalars['Float']['output'];\n};\n\nexport type TopicalInstrument = {\n __typename?: 'TopicalInstrument';\n displayName: Scalars['String']['output'];\n name: Scalars['String']['output'];\n sentiment: Sentiment;\n updatedAt: Scalars['String']['output'];\n};\n\nexport type TopicalInstrumentChart = {\n __typename?: 'TopicalInstrumentChart';\n chart?: Maybe<Array<Scalars['Float']['output']>>;\n name: Scalars['String']['output'];\n};\n\nexport enum TopicalSort {\n Bearish = 'BEARISH',\n Bullish = 'BULLISH',\n Hot = 'HOT',\n Popular = 'POPULAR',\n Volatile = 'VOLATILE'\n}\n\nexport type VolatilityChart = {\n __typename?: 'VolatilityChart';\n pips: Scalars['Float']['output'];\n /** Time point - hour in format hh:mm, Date in UTC, Week in format 'Mo' */\n point: Scalars['String']['output'];\n};\n\nexport type VolatilityChartAssetClass = {\n __typename?: 'VolatilityChartAssetClass';\n instruments: Array<VolatilityChartInstrument>;\n name: Scalars['String']['output'];\n};\n\nexport type VolatilityChartInstrument = {\n __typename?: 'VolatilityChartInstrument';\n displayName: Scalars['String']['output'];\n name: Scalars['String']['output'];\n};\n\nexport enum VolatilityChartTimeSpan {\n /** Valid for: H */\n D5 = 'D5',\n /** Valid for: H */\n D10 = 'D10',\n /** Valid for: D */\n M1 = 'M1',\n /** Valid for: D */\n M3 = 'M3',\n /** Valid for: W */\n W5 = 'W5',\n /** Valid for: W */\n W10 = 'W10'\n}\n\nexport enum VolatilityChartTimeUnit {\n D = 'D',\n H = 'H',\n W = 'W'\n}\n\nexport type GetCurrencyStrengthQueryVariables = Exact<{ [key: string]: never; }>;\n\n\nexport type GetCurrencyStrengthQuery = { __typename?: 'Query', currencyStrength?: Array<{ __typename?: 'CurrencyStrength', currency: CurrencyName, strengthRelation?: Array<{ __typename?: 'StrengthRelation', currency: CurrencyName, percentage: number }> | null }> | null };\n\n\nexport const GetCurrencyStrengthDocument = {\"kind\":\"Document\",\"definitions\":[{\"kind\":\"OperationDefinition\",\"operation\":\"query\",\"name\":{\"kind\":\"Name\",\"value\":\"GetCurrencyStrength\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"currencyStrength\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"currency\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"strengthRelation\"},\"selectionSet\":{\"kind\":\"SelectionSet\",\"selections\":[{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"currency\"}},{\"kind\":\"Field\",\"name\":{\"kind\":\"Name\",\"value\":\"percentage\"}}]}}]}}]}}]} as unknown as DocumentNode<GetCurrencyStrengthQuery, GetCurrencyStrengthQueryVariables>;"],"mappings":";;;;;;IAwBYA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,aAARA,QAAQ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C;UAAC,CAAC;QAAC;MAAC,CAAC;IAAC;EAAC,CAAC;AAAC,CAAyF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _fragmentMasking = require("./fragment-masking");
|
|
7
|
+
Object.keys(_fragmentMasking).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _fragmentMasking[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _fragmentMasking[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _gql = require("./gql");
|
|
18
|
+
Object.keys(_gql).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _gql[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _gql[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_fragmentMasking","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_gql"],"sources":["../../../../src/gql/types/index.ts"],"sourcesContent":["export * from \"./fragment-masking\";\nexport * from \"./gql\";"],"mappings":";;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,gBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,gBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,gBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,IAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,IAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,IAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,IAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _CurrencyStrengthWidget = require("./CurrencyStrengthWidget/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
|
+
});
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_CurrencyStrengthWidget","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../src/index.ts"],"sourcesContent":["export * from './CurrencyStrengthWidget/CurrencyStrengthWidget';\n"],"mappings":";;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,uBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,uBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,uBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.translations = void 0;
|
|
7
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
8
|
+
var _en = _interopRequireDefault(require("./sources/en.json"));
|
|
9
|
+
var _zh_TW = _interopRequireDefault(require("./sources/zh_TW.json"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
const translations = exports.translations = {
|
|
12
|
+
[_monoI18n.Locale.en]: {
|
|
13
|
+
translation: _en.default
|
|
14
|
+
},
|
|
15
|
+
[_monoI18n.Locale.zhTW]: {
|
|
16
|
+
translation: _zh_TW.default
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_monoI18n","require","_en","_interopRequireDefault","_zh_TW","obj","__esModule","default","translations","exports","Locale","en","translation","zhTW"],"sources":["../../../src/translations/index.ts"],"sourcesContent":["import { Locale, Translations } from '@oanda/mono-i18n';\n\nimport en from './sources/en.json';\nimport zhTW from './sources/zh_TW.json';\n\nimport { defaultTranslations } from './translations';\n\nexport type TranslationKey = keyof typeof defaultTranslations;\n\nexport const translations: Translations = {\n [Locale.en]: { translation: en },\n [Locale.zhTW]: { translation: zhTW },\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEA,IAAAC,GAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAwC,SAAAE,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMjC,MAAMG,YAA0B,GAAAC,OAAA,CAAAD,YAAA,GAAG;EACxC,CAACE,gBAAM,CAACC,EAAE,GAAG;IAAEC,WAAW,EAAED;EAAG,CAAC;EAChC,CAACD,gBAAM,CAACG,IAAI,GAAG;IAAED,WAAW,EAAEC;EAAK;AACrC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translations.js","names":["defaultTranslations","exports"],"sources":["../../../src/translations/translations.ts"],"sourcesContent":["export const defaultTranslations = {\n\n};\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,CAEnC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { useQuery } from '@apollo/client';
|
|
3
|
+
import { ChartError, Spinner, SpinnerSize, ThemeContext } from '@oanda/labs-widget-common';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import { getCurrencyStrength } from '../gql/getCurrencyStrength';
|
|
6
|
+
import { Chart } from './components/Chart';
|
|
7
|
+
const ChartWithData = () => {
|
|
8
|
+
var _data$currencyStrengt, _data$currencyStrengt2, _data$currencyStrengt3;
|
|
9
|
+
const {
|
|
10
|
+
isDesktop
|
|
11
|
+
} = useContext(ThemeContext);
|
|
12
|
+
const {
|
|
13
|
+
loading,
|
|
14
|
+
data,
|
|
15
|
+
error
|
|
16
|
+
} = useQuery(getCurrencyStrength, {
|
|
17
|
+
fetchPolicy: 'cache-and-network'
|
|
18
|
+
});
|
|
19
|
+
const showChart = (data === null || data === void 0 ? void 0 : data.currencyStrength) && (data === null || data === void 0 || (_data$currencyStrengt = data.currencyStrength) === null || _data$currencyStrengt === void 0 ? void 0 : _data$currencyStrengt.length) > 0;
|
|
20
|
+
const showError = (data === null || data === void 0 || (_data$currencyStrengt2 = data.currencyStrength) === null || _data$currencyStrengt2 === void 0 ? void 0 : _data$currencyStrengt2.length) === 0 || error;
|
|
21
|
+
return React.createElement(React.Fragment, null, loading && React.createElement("div", {
|
|
22
|
+
className: "lw-flex lw-h-[461px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
23
|
+
}, React.createElement(Spinner, {
|
|
24
|
+
size: SpinnerSize.lg
|
|
25
|
+
})), !loading && showChart && React.createElement("div", {
|
|
26
|
+
"data-testid": "currency-strength-chart-wrapper",
|
|
27
|
+
className: classnames('lw-grid lw-place-content-center lw-gap-7', {
|
|
28
|
+
'lw-grid-cols-3 ': isDesktop,
|
|
29
|
+
'lw-grid-cols-1': !isDesktop
|
|
30
|
+
})
|
|
31
|
+
}, (_data$currencyStrengt3 = data.currencyStrength) === null || _data$currencyStrengt3 === void 0 ? void 0 : _data$currencyStrengt3.map(item => React.createElement("div", {
|
|
32
|
+
className: "lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center"
|
|
33
|
+
}, React.createElement(Chart, {
|
|
34
|
+
currency: item.currency,
|
|
35
|
+
values: item.strengthRelation
|
|
36
|
+
})))), !loading && showError && React.createElement("div", {
|
|
37
|
+
className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
38
|
+
}, React.createElement(ChartError, null)));
|
|
39
|
+
};
|
|
40
|
+
export { ChartWithData };
|
|
41
|
+
//# sourceMappingURL=ChartsWithData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartsWithData.js","names":["React","useContext","useQuery","ChartError","Spinner","SpinnerSize","ThemeContext","classnames","getCurrencyStrength","Chart","ChartWithData","_data$currencyStrengt","_data$currencyStrengt2","_data$currencyStrengt3","isDesktop","loading","data","error","fetchPolicy","showChart","currencyStrength","length","showError","createElement","Fragment","className","size","lg","map","item","currency","values","strengthRelation"],"sources":["../../../src/CurrencyStrengthWidget/ChartsWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport {\n ChartError, Spinner, SpinnerSize,\n ThemeContext,\n} from '@oanda/labs-widget-common';\nimport classnames from 'classnames';\nimport { getCurrencyStrength } from '../gql/getCurrencyStrength';\nimport { GetCurrencyStrengthQuery } from '../gql/types/graphql';\nimport { Chart } from './components/Chart';\n\nconst ChartWithData = () => {\n const { isDesktop } = useContext(ThemeContext);\n const { loading, data, error } = useQuery<GetCurrencyStrengthQuery>(getCurrencyStrength, {\n fetchPolicy: 'cache-and-network',\n });\n\n const showChart = data?.currencyStrength && data?.currencyStrength?.length > 0;\n const showError = data?.currencyStrength?.length === 0 || error;\n\n return (\n <>\n {loading\n && (\n <div className=\"lw-flex lw-h-[461px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <Spinner size={SpinnerSize.lg} />\n </div>\n )}\n {!loading && showChart && (\n <div\n data-testid=\"currency-strength-chart-wrapper\"\n className={classnames('lw-grid lw-place-content-center lw-gap-7', {\n 'lw-grid-cols-3 ': isDesktop,\n 'lw-grid-cols-1': !isDesktop,\n })}\n >\n {data.currencyStrength?.map((item) => (\n <div className=\"lw-flex lw-h-[135px] lw-flex-1 lw-items-center lw-justify-center\">\n <Chart currency={item.currency} values={item.strengthRelation!} />\n </div>\n ))}\n </div>\n )}\n {!loading && showError && (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n )}\n </>\n );\n};\n\nexport { ChartWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,g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AS;MAC5B,gBAAgB,EAAE,CAACA;IACrB,CAAC;EAAE,IAAAD,sBAAA,GAEFG,IAAI,CAACI,gBAAgB,cAAAP,sBAAA,uBAArBA,sBAAA,CAAuBe,GAAG,CAAEC,IAAI,IAC/B7B,KAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAC;EAAkE,GAC/EzB,KAAA,CAAAuB,aAAA,CAACd,KAAK;IAACqB,QAAQ,EAAED,IAAI,CAACC,QAAS;IAACC,MAAM,EAAEF,IAAI,CAACG;EAAkB,CAAE,CAC9D,CACN,CACE,CACN,EACA,CAACjB,OAAO,IAAIO,SAAS,IACpBtB,KAAA,CAAAuB,aAAA;IAAKE,SAAS,EAAC;EAAmG,GAChHzB,KAAA,CAAAuB,aAAA,CAACpB,UAAU,MAAE,CACV,CAEP,CAAC;AAEP,CAAC;AAED,SAASO,aAAa"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LocaleProvider } from '@oanda/mono-i18n';
|
|
3
|
+
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';
|
|
4
|
+
import { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';
|
|
5
|
+
import { translations } from '../translations';
|
|
6
|
+
import { Main } from './Main';
|
|
7
|
+
const CurrencyStrengthWidget = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
graphqlUrl,
|
|
10
|
+
locale,
|
|
11
|
+
theme,
|
|
12
|
+
isParamError
|
|
13
|
+
} = _ref;
|
|
14
|
+
const client = new ApolloClient({
|
|
15
|
+
uri: graphqlUrl,
|
|
16
|
+
cache: new InMemoryCache()
|
|
17
|
+
});
|
|
18
|
+
return React.createElement(ThemeProvider, {
|
|
19
|
+
theme: theme
|
|
20
|
+
}, React.createElement(LocaleProvider, {
|
|
21
|
+
locale: getLocale(locale),
|
|
22
|
+
translations: translations
|
|
23
|
+
}, React.createElement(ApolloProvider, {
|
|
24
|
+
client: client
|
|
25
|
+
}, isParamError ? React.createElement("div", {
|
|
26
|
+
className: "lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary"
|
|
27
|
+
}, React.createElement(ChartError, null)) : React.createElement(Main, null))));
|
|
28
|
+
};
|
|
29
|
+
export { CurrencyStrengthWidget };
|
|
30
|
+
//# sourceMappingURL=CurrencyStrengthWidget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CurrencyStrengthWidget.js","names":["React","LocaleProvider","ApolloClient","InMemoryCache","ApolloProvider","ChartError","ThemeProvider","getLocale","translations","Main","CurrencyStrengthWidget","_ref","graphqlUrl","locale","theme","isParamError","client","uri","cache","createElement","className"],"sources":["../../../src/CurrencyStrengthWidget/CurrencyStrengthWidget.tsx"],"sourcesContent":["import React from 'react';\nimport { LocaleProvider } from '@oanda/mono-i18n';\nimport { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';\nimport { ChartError, ThemeProvider, getLocale } from '@oanda/labs-widget-common';\nimport { VolatilityChartConfig } from './types';\nimport { translations } from '../translations';\nimport { Main } from './Main';\n\nconst CurrencyStrengthWidget = ({\n graphqlUrl, locale, theme, isParamError,\n}: VolatilityChartConfig) => {\n const client = new ApolloClient({\n uri: graphqlUrl,\n cache: new InMemoryCache(),\n });\n\n return (\n <ThemeProvider theme={theme}>\n <LocaleProvider locale={getLocale(locale)} translations={translations}>\n <ApolloProvider client={client}>\n {isParamError ? (\n <div className=\"lw-flex lw-h-[425px] lw-w-full lw-items-center lw-border lw-border-solid lw-border-border-primary\">\n <ChartError />\n </div>\n ) : <Main />}\n </ApolloProvider>\n </LocaleProvider>\n </ThemeProvider>\n );\n};\n\nexport { CurrencyStrengthWidget };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,YAAY,EAAEC,aAAa,EAAEC,cAAc,QAAQ,gBAAgB;AAC5E,SAASC,UAAU,EAAEC,aAAa,EAAEC,SAAS,QAAQ,2BAA2B;AAEhF,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,IAAI,QAAQ,QAAQ;AAE7B,MAAMC,sBAAsB,GAAGC,IAAA,IAEF;EAAA,IAFG;IAC9BC,UAAU;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EACN,CAAC,GAAAJ,IAAA;EACtB,MAAMK,MAAM,GAAG,IAAId,YAAY,CAAC;IAC9Be,GAAG,EAAEL,UAAU;IACfM,KAAK,EAAE,IAAIf,aAAa,CAAC;EAC3B,CAAC,CAAC;EAEF,OACEH,KAAA,CAAAmB,aAAA,CAACb,aAAa;IAACQ,KAAK,EAAEA;EAAM,GAC1Bd,KAAA,CAAAmB,aAAA,CAAClB,cAAc;IAACY,MAAM,EAAEN,SAAS,CAACM,MAAM,CAAE;IAACL,YAAY,EAAEA;EAAa,GACpER,KAAA,CAAAmB,aAAA,CAACf,cAAc;IAACY,MAAM,EAAEA;EAAO,GAC5BD,YAAY,GACXf,KAAA,CAAAmB,aAAA;IAAKC,SAAS,EAAC;EAAmG,GAChHpB,KAAA,CAAAmB,aAAA,CAACd,UAAU,MAAE,CACV,CAAC,GACJL,KAAA,CAAAmB,aAAA,CAACV,IAAI,MAAE,CACG,CACF,CACH,CAAC;AAEpB,CAAC;AAED,SAASC,sBAAsB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useLocale } from '@oanda/mono-i18n';
|
|
3
|
+
import { ChartWithData } from './ChartsWithData';
|
|
4
|
+
const Main = () => {
|
|
5
|
+
const {
|
|
6
|
+
lang
|
|
7
|
+
} = useLocale();
|
|
8
|
+
return React.createElement("div", {
|
|
9
|
+
"data-testid": "currency-strength-wrapper"
|
|
10
|
+
}, React.createElement("div", {
|
|
11
|
+
className: "lw-mb-8 lw-flex lw-justify-center lw-font-sans lw-text-lg lw-font-bold"
|
|
12
|
+
}, React.createElement("span", null, "".concat(lang('daily'), " (").concat(lang('5_minutes'), ")"))), React.createElement(ChartWithData, null));
|
|
13
|
+
};
|
|
14
|
+
export { Main };
|
|
15
|
+
//# sourceMappingURL=Main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Main.js","names":["React","useLocale","ChartWithData","Main","lang","createElement","className","concat"],"sources":["../../../src/CurrencyStrengthWidget/Main.tsx"],"sourcesContent":["import React from 'react';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { ChartWithData } from './ChartsWithData';\n\nconst Main = () => {\n const { lang } = useLocale();\n\n return (\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('5_minutes')})`}</span>\n </div>\n <ChartWithData />\n </div>\n );\n};\n\nexport { Main };\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,aAAa,QAAQ,kBAAkB;AAEhD,MAAMC,IAAI,GAAGA,CAAA,KAAM;EACjB,MAAM;IAAEC;EAAK,CAAC,GAAGH,SAAS,CAAC,CAAC;EAE5B,OACED,KAAA,CAAAK,aAAA;IAAK,eAAY;EAA2B,GAC1CL,KAAA,CAAAK,aAAA;IAAKC,SAAS,EAAC;EAAwE,GACrFN,KAAA,CAAAK,aAAA,kBAAAE,MAAA,CAAUH,IAAI,CAAC,OAAO,CAAC,QAAAG,MAAA,CAAKH,IAAI,CAAC,WAAW,CAAC,MAAU,CACpD,CAAC,EACNJ,KAAA,CAAAK,aAAA,CAACH,aAAa,MAAE,CACb,CAAC;AAEV,CAAC;AAED,SAASC,IAAI"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import ReactEChartsCore from 'echarts-for-react/lib/core';
|
|
3
|
+
import * as echarts from 'echarts/core';
|
|
4
|
+
import { BarChart } from 'echarts/charts';
|
|
5
|
+
import { CanvasRenderer } from 'echarts/renderers';
|
|
6
|
+
import { GridSimpleComponent, GraphicComponent, TooltipComponent, TitleComponent } from 'echarts/components';
|
|
7
|
+
import { useLocale } from '@oanda/mono-i18n';
|
|
8
|
+
import { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';
|
|
9
|
+
import { CHART_HEIGHT } from './constants';
|
|
10
|
+
import { getOption } from './getOption';
|
|
11
|
+
echarts.use([GridSimpleComponent, GraphicComponent, TooltipComponent, TitleComponent, BarChart, CanvasRenderer]);
|
|
12
|
+
echarts.registerTheme('dark_theme', getChartTheme(Theme.Dark));
|
|
13
|
+
echarts.registerTheme('light_theme', getChartTheme(Theme.Light));
|
|
14
|
+
const Chart = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
values,
|
|
17
|
+
currency
|
|
18
|
+
} = _ref;
|
|
19
|
+
const {
|
|
20
|
+
lang
|
|
21
|
+
} = useLocale();
|
|
22
|
+
const {
|
|
23
|
+
isDark
|
|
24
|
+
} = useContext(ThemeContext);
|
|
25
|
+
return React.createElement(ReactEChartsCore, {
|
|
26
|
+
echarts: echarts,
|
|
27
|
+
theme: isDark ? 'dark_theme' : 'light_theme',
|
|
28
|
+
style: {
|
|
29
|
+
height: "".concat(CHART_HEIGHT, "px"),
|
|
30
|
+
width: '100%'
|
|
31
|
+
},
|
|
32
|
+
option: getOption({
|
|
33
|
+
values,
|
|
34
|
+
currency,
|
|
35
|
+
lang,
|
|
36
|
+
isDark
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
export { Chart };
|
|
41
|
+
//# sourceMappingURL=Chart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["React","useContext","ReactEChartsCore","echarts","BarChart","CanvasRenderer","GridSimpleComponent","GraphicComponent","TooltipComponent","TitleComponent","useLocale","Theme","ThemeContext","getChartTheme","CHART_HEIGHT","getOption","use","registerTheme","Dark","Light","Chart","_ref","values","currency","lang","isDark","createElement","theme","style","height","concat","width","option"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/Chart.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport ReactEChartsCore from 'echarts-for-react/lib/core';\nimport * as echarts from 'echarts/core';\nimport { BarChart } from 'echarts/charts';\nimport { CanvasRenderer } from 'echarts/renderers';\nimport {\n GridSimpleComponent, GraphicComponent, TooltipComponent, TitleComponent,\n} from 'echarts/components';\nimport { useLocale } from '@oanda/mono-i18n';\nimport { Theme, ThemeContext, getChartTheme } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n} from './constants';\nimport { getOption } from './getOption';\nimport { 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 } = useContext(ThemeContext);\n\n return (\n <ReactEChartsCore\n echarts={echarts}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n style={{\n height: `${CHART_HEIGHT}px`,\n width: '100%',\n }}\n option={getOption({\n values, currency, lang, isDark,\n })}\n />\n );\n};\n\nexport { Chart };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,gBAAgB,MAAM,4BAA4B;AACzD,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,cAAc,QAAQ,mBAAmB;AAClD,SACEC,mBAAmB,EAAEC,gBAAgB,EAAEC,gBAAgB,EAAEC,cAAc,QAClE,oBAAoB;AAC3B,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,KAAK,EAAEC,YAAY,EAAEC,aAAa,QAAQ,2BAA2B;AAC9E,SACEC,YAAY,QACP,aAAa;AACpB,SAASC,SAAS,QAAQ,aAAa;AAGvCZ,OAAO,CAACa,GAAG,CAAC,CACVV,mBAAmB,EACnBC,gBAAgB,EAChBC,gBAAgB,EAChBC,cAAc,EACdL,QAAQ,EACRC,cAAc,CACf,CAAC;AAEFF,OAAO,CAACc,aAAa,CAAC,YAAY,EAAEJ,aAAa,CAACF,KAAK,CAACO,IAAI,CAAC,CAAC;AAC9Df,OAAO,CAACc,aAAa,CAAC,aAAa,EAAEJ,aAAa,CAACF,KAAK,CAACQ,KAAK,CAAC,CAAC;AAEhE,MAAMC,KAAK,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC,MAAM;IAAEC;EAAqB,CAAC,GAAAF,IAAA;EAC7C,MAAM;IAAEG;EAAK,CAAC,GAAGd,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEe;EAAO,CAAC,GAAGxB,UAAU,CAACW,YAAY,CAAC;EAE3C,OACEZ,KAAA,CAAA0B,aAAA,CAACxB,gBAAgB;IACfC,OAAO,EAAEA,OAAQ;IACjBwB,KAAK,EAAEF,MAAM,GAAG,YAAY,GAAG,aAAc;IAC7CG,KAAK,EAAE;MACLC,MAAM,KAAAC,MAAA,CAAKhB,YAAY,OAAI;MAC3BiB,KAAK,EAAE;IACT,CAAE;IACFC,MAAM,EAAEjB,SAAS,CAAC;MAChBO,MAAM;MAAEC,QAAQ;MAAEC,IAAI;MAAEC;IAC1B,CAAC;EAAE,CACJ,CAAC;AAEN,CAAC;AAED,SAASL,KAAK"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { colorPalette } from '@oanda/labs-widget-common';
|
|
2
|
+
export const X_LABEL_SIZE = 24;
|
|
3
|
+
export const Y_LABEL_SIZE = 30;
|
|
4
|
+
export const CHART_WIDTH = 9999;
|
|
5
|
+
export const CHART_HEIGHT = 135;
|
|
6
|
+
export const darkBarColors = {
|
|
7
|
+
positive: colorPalette.bottleGreenLight,
|
|
8
|
+
negative: colorPalette.orange,
|
|
9
|
+
zero: colorPalette.disabledGray
|
|
10
|
+
};
|
|
11
|
+
export const lightBarColors = {
|
|
12
|
+
positive: colorPalette.bottleGreenLight,
|
|
13
|
+
negative: colorPalette.raspberryDark,
|
|
14
|
+
zero: colorPalette.disabledGray
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["colorPalette","X_LABEL_SIZE","Y_LABEL_SIZE","CHART_WIDTH","CHART_HEIGHT","darkBarColors","positive","bottleGreenLight","negative","orange","zero","disabledGray","lightBarColors","raspberryDark"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/constants.tsx"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\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.disabledGray,\n};\n\nexport const lightBarColors = {\n positive: colorPalette.bottleGreenLight,\n negative: colorPalette.raspberryDark,\n zero: colorPalette.disabledGray,\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,OAAO,MAAMC,YAAY,GAAG,EAAE;AAC9B,OAAO,MAAMC,YAAY,GAAG,EAAE;AAC9B,OAAO,MAAMC,WAAW,GAAG,IAAI;AAC/B,OAAO,MAAMC,YAAY,GAAG,GAAG;AAE/B,OAAO,MAAMC,aAAa,GAAG;EAC3BC,QAAQ,EAAEN,YAAY,CAACO,gBAAgB;EACvCC,QAAQ,EAAER,YAAY,CAACS,MAAM;EAC7BC,IAAI,EAAEV,YAAY,CAACW;AACrB,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG;EAC5BN,QAAQ,EAAEN,YAAY,CAACO,gBAAgB;EACvCC,QAAQ,EAAER,YAAY,CAACa,aAAa;EACpCH,IAAI,EAAEV,YAAY,CAACW;AACrB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const tooltipFormatter = _ref => {
|
|
2
|
+
let {
|
|
3
|
+
marker,
|
|
4
|
+
name,
|
|
5
|
+
value,
|
|
6
|
+
currency,
|
|
7
|
+
lang
|
|
8
|
+
} = _ref;
|
|
9
|
+
return "\n<div>\n <div style=\"margin-bottom:5px;\">".concat(currency, " ").concat(lang('vs'), " ").concat(name, "</div>\n <div style=\"display:flex;align-items:center;\">").concat(marker, " ").concat(value, "%</div>\n</div>");
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["tooltipFormatter","_ref","marker","name","value","currency","lang","concat"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/formatters.ts"],"sourcesContent":["import { TooltipFormatterParams } from './types';\n\nexport const 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"],"mappings":"AAEA,OAAO,MAAMA,gBAAgB,GAAGC,IAAA;EAAA,IAAC;IAC/BC,MAAM;IACNC,IAAI;IACJC,KAAK;IACLC,QAAQ;IACRC;EACsB,CAAC,GAAAL,IAAA;EAAA,uDAAAM,MAAA,CAEWF,QAAQ,OAAAE,MAAA,CAAID,IAAI,CAAC,IAAI,CAAC,OAAAC,MAAA,CAAIJ,IAAI,gEAAAI,MAAA,CAChBL,MAAM,OAAAK,MAAA,CAAIH,KAAK;AAAA,CAC1D"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { getGridLines } from '@oanda/labs-widget-common';
|
|
2
|
+
import { CHART_HEIGHT, CHART_WIDTH, X_LABEL_SIZE, Y_LABEL_SIZE, darkBarColors, lightBarColors } from './constants';
|
|
3
|
+
import { tooltipFormatter } from './formatters';
|
|
4
|
+
export const getOption = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
values,
|
|
7
|
+
currency,
|
|
8
|
+
isDark,
|
|
9
|
+
lang
|
|
10
|
+
} = _ref;
|
|
11
|
+
const currencies = values.map(item => item.currency);
|
|
12
|
+
const percentages = values.map(item => item.percentage);
|
|
13
|
+
const barColors = isDark ? darkBarColors : lightBarColors;
|
|
14
|
+
const gridLines = getGridLines({
|
|
15
|
+
isDark,
|
|
16
|
+
chartWidth: CHART_WIDTH,
|
|
17
|
+
chartHeight: CHART_HEIGHT,
|
|
18
|
+
xLabelsSize: -2,
|
|
19
|
+
yLabelSize: -3
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
animation: false,
|
|
23
|
+
title: {
|
|
24
|
+
left: 'center',
|
|
25
|
+
text: "".concat(currency, " vs"),
|
|
26
|
+
textStyle: {
|
|
27
|
+
fontSize: 12,
|
|
28
|
+
lineHeight: 20,
|
|
29
|
+
fontWeight: 400
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
grid: [{
|
|
33
|
+
name: 'main-grid',
|
|
34
|
+
top: '30px',
|
|
35
|
+
right: '0px',
|
|
36
|
+
left: "".concat(Y_LABEL_SIZE, "px"),
|
|
37
|
+
bottom: "".concat(X_LABEL_SIZE, "px")
|
|
38
|
+
}],
|
|
39
|
+
graphic: [...gridLines],
|
|
40
|
+
tooltip: {
|
|
41
|
+
trigger: 'axis',
|
|
42
|
+
formatter: _ref2 => {
|
|
43
|
+
let [{
|
|
44
|
+
marker,
|
|
45
|
+
name,
|
|
46
|
+
value
|
|
47
|
+
}] = _ref2;
|
|
48
|
+
return tooltipFormatter({
|
|
49
|
+
lang,
|
|
50
|
+
currency,
|
|
51
|
+
marker,
|
|
52
|
+
name,
|
|
53
|
+
value
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
axisPointer: {
|
|
57
|
+
axis: 'x'
|
|
58
|
+
},
|
|
59
|
+
extraCssText: 'z-index: 1'
|
|
60
|
+
},
|
|
61
|
+
xAxis: {
|
|
62
|
+
type: 'category',
|
|
63
|
+
data: currencies,
|
|
64
|
+
axisTick: {
|
|
65
|
+
show: false
|
|
66
|
+
},
|
|
67
|
+
axisLine: {
|
|
68
|
+
show: false
|
|
69
|
+
},
|
|
70
|
+
splitLine: {
|
|
71
|
+
show: false
|
|
72
|
+
},
|
|
73
|
+
axisLabel: {
|
|
74
|
+
fontSize: 10
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
yAxis: {
|
|
78
|
+
type: 'value',
|
|
79
|
+
position: 'left',
|
|
80
|
+
min: Math.floor(Math.min(...percentages)),
|
|
81
|
+
max: Math.ceil(Math.max(...percentages)),
|
|
82
|
+
interval: 1,
|
|
83
|
+
axisLine: {
|
|
84
|
+
show: false
|
|
85
|
+
},
|
|
86
|
+
axisTick: {
|
|
87
|
+
show: false
|
|
88
|
+
},
|
|
89
|
+
axisLabel: {
|
|
90
|
+
formatter: '{value}%',
|
|
91
|
+
fontSize: 10
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
series: [{
|
|
95
|
+
data: percentages,
|
|
96
|
+
type: 'bar',
|
|
97
|
+
itemStyle: {
|
|
98
|
+
color: _ref3 => {
|
|
99
|
+
let {
|
|
100
|
+
data
|
|
101
|
+
} = _ref3;
|
|
102
|
+
if (data > 0) {
|
|
103
|
+
return barColors.positive;
|
|
104
|
+
}
|
|
105
|
+
if (data < 0) {
|
|
106
|
+
return barColors.negative;
|
|
107
|
+
}
|
|
108
|
+
return barColors.zero;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}]
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=getOption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getOption.js","names":["getGridLines","CHART_HEIGHT","CHART_WIDTH","X_LABEL_SIZE","Y_LABEL_SIZE","darkBarColors","lightBarColors","tooltipFormatter","getOption","_ref","values","currency","isDark","lang","currencies","map","item","percentages","percentage","barColors","gridLines","chartWidth","chartHeight","xLabelsSize","yLabelSize","animation","title","left","text","concat","textStyle","fontSize","lineHeight","fontWeight","grid","name","top","right","bottom","graphic","tooltip","trigger","formatter","_ref2","marker","value","axisPointer","axis","extraCssText","xAxis","type","data","axisTick","show","axisLine","splitLine","axisLabel","yAxis","position","min","Math","floor","max","ceil","interval","series","itemStyle","color","_ref3","positive","negative","zero"],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/getOption.ts"],"sourcesContent":["import { getGridLines } from '@oanda/labs-widget-common';\nimport {\n CHART_HEIGHT,\n CHART_WIDTH,\n X_LABEL_SIZE,\n Y_LABEL_SIZE,\n darkBarColors,\n lightBarColors,\n} from './constants';\nimport { GetOptionProps } from './types';\nimport { tooltipFormatter } from './formatters';\n\nexport const getOption = ({\n values, currency, isDark, 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 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: [\n ...gridLines,\n ],\n tooltip: {\n trigger: 'axis',\n formatter: (\n [{ marker, name, value }]\n : { marker: string, name: string, value: number }[],\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 itemStyle: {\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 ],\n };\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AACxD,SACEC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZC,aAAa,EACbC,cAAc,QACT,aAAa;AAEpB,SAASC,gBAAgB,QAAQ,cAAc;AAE/C,OAAO,MAAMC,SAAS,GAAGC,IAAA,IAEH;EAAA,IAFI;IACxBC,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC;EACZ,CAAC,GAAAJ,IAAA;EACf,MAAMK,UAAU,GAAGJ,MAAM,CAACK,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACL,QAAQ,CAAC;EACtD,MAAMM,WAAW,GAAGP,MAAM,CAACK,GAAG,CAAEC,IAAI,IAAKA,IAAI,CAACE,UAAU,CAAC;EACzD,MAAMC,SAAS,GAAGP,MAAM,GAAGP,aAAa,GAAGC,cAAc;EAEzD,MAAMc,SAAS,GAAGpB,YAAY,CAAC;IAC7BY,MAAM;IACNS,UAAU,EAAEnB,WAAW;IACvBoB,WAAW,EAAErB,YAAY;IACzBsB,WAAW,EAAE,CAAC,CAAC;IACfC,UAAU,EAAE,CAAC;EACf,CAAC,CAAC;EAEF,OAAO;IACLC,SAAS,EAAE,KAAK;IAChBC,KAAK,EAAE;MACLC,IAAI,EAAE,QAAQ;MACdC,IAAI,KAAAC,MAAA,CAAKlB,QAAQ,QAAK;MACtBmB,SAAS,EAAE;QACTC,QAAQ,EAAE,EAAE;QACZC,UAAU,EAA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AAM,CAAC;MACzBD,QAAQ,EAAE;QAAEC,IAAI,EAAE;MAAM,CAAC;MACzBG,SAAS,EAAE;QACTd,SAAS,EAAE,UAAU;QACrBX,QAAQ,EAAE;MACZ;IACF,CAAC;IACDkC,MAAM,EAAE,CACN;MACEd,IAAI,EAAElC,WAAW;MACjBiC,IAAI,EAAE,KAAK;MACXgB,SAAS,EAAE;QACTC,KAAK,EAAEC,KAAA,IAAiC;UAAA,IAAhC;YAAEjB;UAAwB,CAAC,GAAAiB,KAAA;UACjC,IAAIjB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAOhC,SAAS,CAACkD,QAAQ;UAC3B;UACA,IAAIlB,IAAI,GAAG,CAAC,EAAE;YACZ,OAAOhC,SAAS,CAACmD,QAAQ;UAC3B;UACA,OAAOnD,SAAS,CAACoD,IAAI;QACvB;MACF;IACF,CAAC;EAEL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/index.ts"],"sourcesContent":["export * from './Chart';\n"],"mappings":"AAAA,cAAc,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../../../src/CurrencyStrengthWidget/components/Chart/types.ts"],"sourcesContent":["import { CurrencyName } from '../../../gql/types/graphql';\n\nexport interface CPBChartDataValues {\n currency: CurrencyName;\n percentage: number;\n}\nexport interface ChartProps {\n values: CPBChartDataValues[];\n currency: CurrencyName;\n}\n\nexport interface TooltipFormatterParams {\n marker: string;\n name: string;\n value: number;\n currency: CurrencyName;\n lang: (label: string) => string;\n}\n\nexport type GetOptionProps = {\n values: CPBChartDataValues[],\n currency: CurrencyName,\n lang: (label: string) => string,\n isDark: boolean;\n};\n"],"mappings":""}
|