@oanda/labs-instrument-live-rate-widget 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/main/InstrumentLiveRateWidget/Main.js +4 -4
  3. package/dist/main/InstrumentLiveRateWidget/Main.js.map +1 -1
  4. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js +46 -0
  5. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js.map +1 -0
  6. package/dist/main/InstrumentLiveRateWidget/components/{InstrumentRateWithData → InstrumentRateWithChart}/index.js +4 -4
  7. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithChart/index.js.map +1 -0
  8. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithChart/types.js +6 -0
  9. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithChart/types.js.map +1 -0
  10. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithChart/utils.js.map +1 -0
  11. package/dist/main/InstrumentLiveRateWidget/components/LineChartWithData/LineChartWithData.js +7 -5
  12. package/dist/main/InstrumentLiveRateWidget/components/LineChartWithData/LineChartWithData.js.map +1 -1
  13. package/dist/main/InstrumentLiveRateWidget/components/LineChartWithData/types.js.map +1 -1
  14. package/dist/main/InstrumentLiveRateWidget/components/index.js +11 -0
  15. package/dist/main/InstrumentLiveRateWidget/components/index.js.map +1 -1
  16. package/dist/main/InstrumentLiveRateWidget/types.js.map +1 -1
  17. package/dist/main/InstrumentLiveRateWidget/utils.js.map +1 -1
  18. package/dist/module/InstrumentLiveRateWidget/Main.js +4 -4
  19. package/dist/module/InstrumentLiveRateWidget/Main.js.map +1 -1
  20. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js +38 -0
  21. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.js.map +1 -0
  22. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithChart/index.js +3 -0
  23. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithChart/index.js.map +1 -0
  24. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithChart/types.js +2 -0
  25. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithChart/types.js.map +1 -0
  26. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithChart/utils.js.map +1 -0
  27. package/dist/module/InstrumentLiveRateWidget/components/LineChartWithData/LineChartWithData.js +8 -6
  28. package/dist/module/InstrumentLiveRateWidget/components/LineChartWithData/LineChartWithData.js.map +1 -1
  29. package/dist/module/InstrumentLiveRateWidget/components/LineChartWithData/types.js.map +1 -1
  30. package/dist/module/InstrumentLiveRateWidget/components/index.js +1 -0
  31. package/dist/module/InstrumentLiveRateWidget/components/index.js.map +1 -1
  32. package/dist/module/InstrumentLiveRateWidget/types.js.map +1 -1
  33. package/dist/module/InstrumentLiveRateWidget/utils.js.map +1 -1
  34. package/dist/types/InstrumentLiveRateWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.d.ts +4 -0
  35. package/dist/types/InstrumentLiveRateWidget/components/InstrumentRateWithChart/index.d.ts +2 -0
  36. package/dist/types/InstrumentLiveRateWidget/components/InstrumentRateWithChart/types.d.ts +9 -0
  37. package/dist/types/InstrumentLiveRateWidget/components/LineChartWithData/types.d.ts +1 -2
  38. package/dist/types/InstrumentLiveRateWidget/components/index.d.ts +1 -0
  39. package/dist/types/InstrumentLiveRateWidget/types.d.ts +0 -22
  40. package/dist/types/InstrumentLiveRateWidget/utils.d.ts +2 -3
  41. package/package.json +3 -3
  42. package/src/InstrumentLiveRateWidget/Main.tsx +6 -5
  43. package/src/InstrumentLiveRateWidget/components/InstrumentRateWithChart/InstrumentRateWithChart.tsx +43 -0
  44. package/src/InstrumentLiveRateWidget/components/InstrumentRateWithChart/index.ts +2 -0
  45. package/src/InstrumentLiveRateWidget/components/InstrumentRateWithChart/types.ts +10 -0
  46. package/src/InstrumentLiveRateWidget/components/LineChartWithData/LineChartWithData.tsx +14 -15
  47. package/src/InstrumentLiveRateWidget/components/LineChartWithData/types.tsx +1 -2
  48. package/src/InstrumentLiveRateWidget/components/index.ts +1 -0
  49. package/src/InstrumentLiveRateWidget/types.tsx +0 -26
  50. package/src/InstrumentLiveRateWidget/utils.ts +2 -3
  51. package/test/components/{InstrumentRateWithData.test.tsx → InstrumentRateWithChart.test.tsx} +7 -7
  52. package/test/components/utils.test.ts +1 -1
  53. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.js +0 -83
  54. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.js.map +0 -1
  55. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithData/index.js.map +0 -1
  56. package/dist/main/InstrumentLiveRateWidget/components/InstrumentRateWithData/utils.js.map +0 -1
  57. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.js +0 -74
  58. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.js.map +0 -1
  59. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithData/index.js +0 -3
  60. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithData/index.js.map +0 -1
  61. package/dist/module/InstrumentLiveRateWidget/components/InstrumentRateWithData/utils.js.map +0 -1
  62. package/dist/types/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.d.ts +0 -4
  63. package/dist/types/InstrumentLiveRateWidget/components/InstrumentRateWithData/index.d.ts +0 -2
  64. package/src/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.tsx +0 -92
  65. package/src/InstrumentLiveRateWidget/components/InstrumentRateWithData/index.ts +0 -2
  66. /package/dist/main/InstrumentLiveRateWidget/components/{InstrumentRateWithData → InstrumentRateWithChart}/utils.js +0 -0
  67. /package/dist/module/InstrumentLiveRateWidget/components/{InstrumentRateWithData → InstrumentRateWithChart}/utils.js +0 -0
  68. /package/dist/types/InstrumentLiveRateWidget/components/{InstrumentRateWithData → InstrumentRateWithChart}/utils.d.ts +0 -0
  69. /package/src/InstrumentLiveRateWidget/components/{InstrumentRateWithData → InstrumentRateWithChart}/utils.ts +0 -0
@@ -19,25 +19,3 @@ export interface MainProps {
19
19
  division: Division;
20
20
  size?: 'compact' | 'full' | 'fullWithChart';
21
21
  }
22
- export interface Sentiment {
23
- shortPercent: number;
24
- longPercent: number;
25
- }
26
- export type EmptyRecord = Record<any, never>;
27
- export interface DataRecord {
28
- [key: string]: string | number | undefined;
29
- instrument: string;
30
- displayName: string;
31
- buy?: number;
32
- buyPriceMovement?: number;
33
- dailyPercentChange?: string;
34
- dailyPipsChange?: number;
35
- displayPrecision?: number;
36
- }
37
- export interface InstrumentRateWithDataProps {
38
- loading: boolean;
39
- record: DataRecord;
40
- target: EventTarget | null;
41
- division: Division;
42
- size?: 'compact' | 'full' | 'fullWithChart';
43
- }
@@ -1,11 +1,10 @@
1
- import { LiveRatesErrorMessage } from '@oanda/labs-widget-common';
2
- import { DataRecord, EmptyRecord } from './types';
1
+ import { DataRecord, LiveRatesErrorMessage } from '@oanda/labs-widget-common';
3
2
  import { ValidateInstrumentsQuery } from '../gql/types/graphql';
4
3
  declare const getRecords: (data: ValidateInstrumentsQuery) => {
5
4
  instrument: string;
6
5
  displayName: string;
7
6
  }[] | undefined;
8
- declare const useRecords: (record: DataRecord | EmptyRecord, target: EventTarget | null) => {
7
+ declare const useRecords: (record: DataRecord, target: EventTarget | null) => {
9
8
  updatedRecord: DataRecord;
10
9
  error: LiveRatesErrorMessage | null;
11
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oanda/labs-instrument-live-rate-widget",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Labs Instrument Live Rate Widget",
5
5
  "main": "dist/main/index.js",
6
6
  "module": "dist/module/index.js",
@@ -13,7 +13,7 @@
13
13
  "license": "UNLICENSED",
14
14
  "dependencies": {
15
15
  "@apollo/client": "3.9.9",
16
- "@oanda/labs-widget-common": "^1.0.140",
16
+ "@oanda/labs-widget-common": "^1.0.142",
17
17
  "@oanda/mono-i18n": "10.0.1",
18
18
  "graphql": "16.8.1"
19
19
  },
@@ -21,5 +21,5 @@
21
21
  "@graphql-codegen/cli": "5.0.0",
22
22
  "@graphql-codegen/client-preset": "4.1.0"
23
23
  },
24
- "gitHead": "82f18c5ff5a9f78a045bb1be3e07f638aac918ed"
24
+ "gitHead": "9becb5af1ce77db8d33586527932d58b50f0cfa1"
25
25
  }
@@ -2,22 +2,23 @@ import React, { useEffect, useState, useContext } from 'react';
2
2
  import { useQuery } from '@apollo/client';
3
3
  import {
4
4
  ChartError,
5
+ DataRecord,
5
6
  Size,
6
7
  ThemeContext,
7
8
  Tooltip,
8
9
  useLiveRatesQuery,
9
10
  } from '@oanda/labs-widget-common';
10
11
  import { getRecords } from './utils';
11
- import { DataRecord, MainProps } from './types';
12
+ import { MainProps } from './types';
12
13
  import { INSTRUMENT_TOOLTIP_ID } from './constant';
13
14
  import { validateInstruments } from '../gql/validateInstruments';
14
15
  import { ValidateInstrumentsQuery, ValidateInstrumentsQueryVariables } from '../gql/types/graphql';
15
- import { InstrumentRateWithData } from './components/InstrumentRateWithData';
16
+ import { InstrumentRateWithChart } from './components/InstrumentRateWithChart';
16
17
 
17
18
  const Main = ({
18
19
  instrument,
19
20
  division,
20
- size: widgetSize,
21
+ size: widgetSize = 'fullWithChart',
21
22
  }: MainProps) => {
22
23
  const { size } = useContext(ThemeContext);
23
24
  const isDesktop = size === Size.DESKTOP;
@@ -58,9 +59,9 @@ const Main = ({
58
59
  {records.length > 0 && (
59
60
  <div
60
61
  data-testid="instrument-live-rate-wrapper"
61
- className="lw-relative lw-border lw-border-solid lw-border-border-primary lw-text-sm lw-tracking-normal lw-text-text-primary"
62
+ className="lw-flex lw-border lw-border-solid lw-border-border-primary lw-px-4 lw-text-sm lw-tracking-normal lw-text-text-primary"
62
63
  >
63
- <InstrumentRateWithData
64
+ <InstrumentRateWithChart
64
65
  loading={loading}
65
66
  record={records[0]}
66
67
  target={target}
@@ -0,0 +1,43 @@
1
+ import React, { useContext } from 'react';
2
+ import { InstrumentRate, ThemeContext } from '@oanda/labs-widget-common';
3
+ import { InstrumentRateWithChartProps } from './types';
4
+ import { getChartColor, getColorIndicator } from './utils';
5
+ import { INSTRUMENT_TOOLTIP_ID } from '../../constant';
6
+ import { LineChartWithData } from '../LineChartWithData';
7
+ import { useRecords } from '../../utils';
8
+
9
+ const InstrumentRateWithChart = ({
10
+ loading,
11
+ record,
12
+ target,
13
+ division,
14
+ size,
15
+ }: InstrumentRateWithChartProps) => {
16
+ const { isDark } = useContext(ThemeContext);
17
+ const { updatedRecord, error } = useRecords(record, record.instrument ? target : null);
18
+
19
+ const indicator = getColorIndicator(updatedRecord.dailyPercentChange);
20
+
21
+ return (
22
+ <>
23
+ <InstrumentRate
24
+ isLoading={loading}
25
+ isError={!!error}
26
+ record={updatedRecord}
27
+ size={size}
28
+ tooltipId={INSTRUMENT_TOOLTIP_ID}
29
+ colorIndicator={indicator}
30
+ />
31
+ {size === 'fullWithChart' && (
32
+ <LineChartWithData
33
+ record={record}
34
+ isLoading={loading}
35
+ division={division}
36
+ color={getChartColor(indicator, isDark)}
37
+ />
38
+ )}
39
+ </>
40
+ );
41
+ };
42
+
43
+ export { InstrumentRateWithChart };
@@ -0,0 +1,2 @@
1
+ export * from './InstrumentRateWithChart';
2
+ export * from './utils';
@@ -0,0 +1,10 @@
1
+ import { DataRecord } from '@oanda/labs-widget-common';
2
+ import { Division } from '../../types';
3
+
4
+ export interface InstrumentRateWithChartProps {
5
+ loading: boolean;
6
+ record: DataRecord;
7
+ target: EventTarget | null;
8
+ division: Division;
9
+ size?: 'compact' | 'full' | 'fullWithChart'
10
+ }
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
2
  import { useQuery } from '@apollo/client';
3
- import {
4
- LineChart, Loader, LoaderSize,
5
- } from '@oanda/labs-widget-common';
3
+ import { LineChart } from '@oanda/labs-widget-common';
6
4
  import { LineChartWithDataProps } from './types';
7
5
  import { getInstrumentsChart } from '../../../gql/getInstrumentsChart';
8
6
  import { GetInstrumentsChartQuery, GetInstrumentsChartQueryVariables } from '../../../gql/types/graphql';
@@ -27,21 +25,22 @@ const LineChartWithData = ({
27
25
  skip: !record.instrument,
28
26
  });
29
27
 
30
- const showLoader = isLoading || loading;
28
+ const showChart = isLoading || loading;
31
29
  const chart = data?.topicalInstrumentsCharts?.[0].chart || [];
32
30
 
33
31
  return (
34
- <>
35
- {showLoader && <Loader size={LoaderSize.md} />}
36
- {!showLoader && (
37
- <LineChart
38
- padding={padding}
39
- size={size}
40
- color={color}
41
- data={chart}
42
- />
43
- )}
44
- </>
32
+ <div className="lw-relative">
33
+ {!showChart ? (
34
+ <div className="lw-absolute lw-bottom-0 lw-right-0">
35
+ <LineChart
36
+ padding={padding}
37
+ size={size}
38
+ color={color}
39
+ data={chart}
40
+ />
41
+ </div>
42
+ ) : null}
43
+ </div>
45
44
  );
46
45
  };
47
46
 
@@ -1,5 +1,4 @@
1
- import { LineChartSize } from '@oanda/labs-widget-common';
2
- import { DataRecord } from '../../types';
1
+ import { DataRecord, LineChartSize } from '@oanda/labs-widget-common';
3
2
  import { Division } from '../../../gql/types/graphql';
4
3
 
5
4
  export interface LineChartWithDataProps {
@@ -1 +1,2 @@
1
+ export * from './InstrumentRateWithChart';
1
2
  export * from './LineChartWithData';
@@ -22,29 +22,3 @@ export interface MainProps {
22
22
  division: Division;
23
23
  size?: 'compact' | 'full' | 'fullWithChart'
24
24
  }
25
-
26
- export interface Sentiment {
27
- shortPercent: number;
28
- longPercent: number;
29
- }
30
-
31
- export type EmptyRecord = Record<any, never>;
32
-
33
- export interface DataRecord {
34
- [key: string]: string | number | undefined;
35
- instrument: string;
36
- displayName: string;
37
- buy?: number;
38
- buyPriceMovement?: number;
39
- dailyPercentChange?: string;
40
- dailyPipsChange?: number;
41
- displayPrecision?: number;
42
- }
43
-
44
- export interface InstrumentRateWithDataProps {
45
- loading: boolean;
46
- record: DataRecord;
47
- target: EventTarget | null;
48
- division: Division;
49
- size?: 'compact' | 'full' | 'fullWithChart'
50
- }
@@ -1,6 +1,5 @@
1
1
  import { useState, useEffect } from 'react';
2
- import { LiveRatesErrorMessage, useLiveRatesMessage } from '@oanda/labs-widget-common';
3
- import { DataRecord, EmptyRecord } from './types';
2
+ import { DataRecord, LiveRatesErrorMessage, useLiveRatesMessage } from '@oanda/labs-widget-common';
4
3
  import { ValidateInstrumentsQuery } from '../gql/types/graphql';
5
4
 
6
5
  const getRecords = (data: ValidateInstrumentsQuery) => data?.mapInstrumentNames?.map((item) => ({
@@ -9,7 +8,7 @@ const getRecords = (data: ValidateInstrumentsQuery) => data?.mapInstrumentNames?
9
8
  }));
10
9
 
11
10
  const useRecords = (
12
- record: DataRecord | EmptyRecord,
11
+ record: DataRecord,
13
12
  target: EventTarget | null,
14
13
  ) => {
15
14
  const [updatedRecord, setUpdatedRecord] = useState<DataRecord>({
@@ -4,7 +4,7 @@
4
4
  import React from 'react';
5
5
  import { render } from '@testing-library/react';
6
6
  import { MockedProvider } from '@apollo/client/testing';
7
- import { InstrumentRateWithData } from '../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData';
7
+ import { InstrumentRateWithChart } from '../../src/InstrumentLiveRateWidget/components';
8
8
  import { getInstrumentsChart } from '../../src/gql/getInstrumentsChart';
9
9
  import { Division } from '../../src/gql/types/graphql';
10
10
 
@@ -35,7 +35,7 @@ const chartPointsMocks = [
35
35
  },
36
36
  ];
37
37
 
38
- describe('InstrumentRateWithData component', () => {
38
+ describe('InstrumentRateWithChart component', () => {
39
39
  const record = {
40
40
  instrument: 'EUR_USD',
41
41
  displayName: 'EUR_USD',
@@ -44,19 +44,19 @@ describe('InstrumentRateWithData component', () => {
44
44
  dailyPipsChange: 123,
45
45
  };
46
46
 
47
- it('should render table row', async () => {
48
- const { getAllByTestId, findByTestId } = render(
47
+ it('should render compact instrument rate', async () => {
48
+ const { getAllByTestId } = render(
49
49
  <MockedProvider mocks={chartPointsMocks}>
50
- <InstrumentRateWithData
50
+ <InstrumentRateWithChart
51
51
  loading={false}
52
52
  division={Division.Oc}
53
53
  record={record}
54
54
  target={null}
55
+ size="compact"
55
56
  />
56
57
  </MockedProvider>,
57
58
  );
58
59
 
59
- expect(await findByTestId('line-chart')).toBeInTheDocument();
60
- expect(getAllByTestId('label-wrapper').length).toEqual(4);
60
+ expect(getAllByTestId('label-wrapper').length).toEqual(2);
61
61
  });
62
62
  });
@@ -1,4 +1,4 @@
1
- import { getColorIndicator } from '../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData';
1
+ import { getColorIndicator } from '../../src/InstrumentLiveRateWidget/components/InstrumentRateWithChart';
2
2
 
3
3
  describe('getColorIndicator', () => {
4
4
  it('should return value greater than 0', () => {
@@ -1,83 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.InstrumentRateWithData = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _labsWidgetCommon = require("@oanda/labs-widget-common");
9
- var _classnames = _interopRequireDefault(require("classnames"));
10
- var _LineChartWithData = require("../LineChartWithData");
11
- var _utils = require("../../utils");
12
- var _constant = require("../../constant");
13
- var _utils2 = require("./utils");
14
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- const InstrumentRateWithData = _ref => {
18
- let {
19
- loading,
20
- record,
21
- target,
22
- division,
23
- size = 'fullWithChart'
24
- } = _ref;
25
- const {
26
- isDark
27
- } = (0, _react.useContext)(_labsWidgetCommon.ThemeContext);
28
- const {
29
- updatedRecord,
30
- error
31
- } = (0, _utils.useRecords)(record, record.instrument ? target : null);
32
- const checkLoading = id => loading || !error && updatedRecord?.[id] === undefined;
33
- const indicator = (0, _utils2.getColorIndicator)(updatedRecord.dailyPercentChange);
34
- return _react.default.createElement("div", {
35
- className: "lw-flex lw-flex-col lw-px-4 lw-pb-1 lw-pt-2"
36
- }, _react.default.createElement("div", {
37
- className: "lw-flex lw-items-center lw-gap-x-2"
38
- }, _react.default.createElement(_labsWidgetCommon.LabelWrapper, {
39
- isLoading: checkLoading('instrument'),
40
- isError: !!error
41
- }, _react.default.createElement("span", {
42
- className: "lw-text-xl lw-font-bold"
43
- }, _react.default.createElement(_labsWidgetCommon.Truncate, {
44
- maxWidth: 130,
45
- text: record.displayName,
46
- tooltipId: _constant.INSTRUMENT_TOOLTIP_ID
47
- }))), _react.default.createElement(_labsWidgetCommon.LabelWrapper, {
48
- isLoading: checkLoading('buy'),
49
- isError: !!error
50
- }, _react.default.createElement("div", {
51
- className: "lw-text-xl lw-font-bold"
52
- }, _react.default.createElement(_labsWidgetCommon.Price, {
53
- priceMovement: updatedRecord.buyPriceMovement,
54
- withoutArrow: true
55
- }, _react.default.createElement("span", null, updatedRecord.buy?.toFixed(updatedRecord.displayPrecision)))))), size !== 'compact' && _react.default.createElement("div", {
56
- className: "lw-mt-1 lw-flex lw-items-center lw-gap-x-2"
57
- }, _react.default.createElement(_labsWidgetCommon.LabelWrapper, {
58
- isLoading: checkLoading('dailyPercentChange'),
59
- isError: !!error
60
- }, _react.default.createElement("span", {
61
- className: (0, _classnames.default)('lw-font-bold', {
62
- 'lw-text-text-ok': indicator > 0,
63
- 'lw-text-text-danger': indicator < 0,
64
- 'lw-text-text-disabled': indicator === 0
65
- })
66
- }, updatedRecord.dailyPercentChange)), _react.default.createElement(_labsWidgetCommon.LabelWrapper, {
67
- isLoading: checkLoading('dailyPipsChange'),
68
- isError: !!error
69
- }, _react.default.createElement("span", {
70
- className: (0, _classnames.default)('lw-font-bold', {
71
- 'lw-text-text-ok': indicator > 0,
72
- 'lw-text-text-danger': indicator < 0,
73
- 'lw-text-text-disabled': indicator === 0
74
- })
75
- }, `(${updatedRecord.dailyPipsChange})`)), size === 'fullWithChart' && _react.default.createElement(_LineChartWithData.LineChartWithData, {
76
- record: updatedRecord,
77
- isLoading: checkLoading('instrument'),
78
- division: division,
79
- color: (0, _utils2.getChartColor)(indicator, isDark)
80
- })));
81
- };
82
- exports.InstrumentRateWithData = InstrumentRateWithData;
83
- //# sourceMappingURL=InstrumentRateWithData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InstrumentRateWithData.js","names":["_react","_interopRequireWildcard","require","_labsWidgetCommon","_classnames","_interopRequireDefault","_LineChartWithData","_utils","_constant","_utils2","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","InstrumentRateWithData","_ref","loading","record","target","division","size","isDark","useContext","ThemeContext","updatedRecord","error","useRecords","instrument","checkLoading","id","undefined","indicator","getColorIndicator","dailyPercentChange","createElement","className","LabelWrapper","isLoading","isError","Truncate","maxWidth","text","displayName","tooltipId","INSTRUMENT_TOOLTIP_ID","Price","priceMovement","buyPriceMovement","withoutArrow","buy","toFixed","displayPrecision","classNames","dailyPipsChange","LineChartWithData","color","getChartColor","exports"],"sources":["../../../../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport {\n LabelWrapper, Price, ThemeContext, Truncate,\n} from '@oanda/labs-widget-common';\nimport classNames from 'classnames';\nimport { InstrumentRateWithDataProps } from '../../types';\nimport { LineChartWithData } from '../LineChartWithData';\nimport { useRecords } from '../../utils';\nimport { INSTRUMENT_TOOLTIP_ID } from '../../constant';\nimport { getChartColor, getColorIndicator } from './utils';\n\nconst InstrumentRateWithData = ({\n loading,\n record,\n target,\n division,\n size = 'fullWithChart',\n}: InstrumentRateWithDataProps) => {\n const { isDark } = useContext(ThemeContext);\n const { updatedRecord, error } = useRecords(record, record.instrument ? target : null);\n\n const checkLoading = (id: string) => loading || (!error && updatedRecord?.[id] === undefined);\n\n const indicator = getColorIndicator(updatedRecord.dailyPercentChange);\n\n return (\n <div className=\"lw-flex lw-flex-col lw-px-4 lw-pb-1 lw-pt-2\">\n <div className=\"lw-flex lw-items-center lw-gap-x-2\">\n <LabelWrapper\n isLoading={checkLoading('instrument')}\n isError={!!error}\n >\n <span className=\"lw-text-xl lw-font-bold\">\n <Truncate maxWidth={130} text={record.displayName} tooltipId={INSTRUMENT_TOOLTIP_ID} />\n </span>\n </LabelWrapper>\n <LabelWrapper\n isLoading={checkLoading('buy')}\n isError={!!error}\n >\n <div className=\"lw-text-xl lw-font-bold\">\n <Price priceMovement={updatedRecord.buyPriceMovement} withoutArrow>\n <span>{updatedRecord.buy?.toFixed(updatedRecord.displayPrecision)}</span>\n </Price>\n </div>\n </LabelWrapper>\n </div>\n {size !== 'compact'\n && (\n <div className=\"lw-mt-1 lw-flex lw-items-center lw-gap-x-2\">\n <LabelWrapper\n isLoading={checkLoading('dailyPercentChange')}\n isError={!!error}\n >\n <span className={classNames('lw-font-bold', {\n 'lw-text-text-ok': indicator > 0,\n 'lw-text-text-danger': indicator < 0,\n 'lw-text-text-disabled': indicator === 0,\n })}\n >\n {updatedRecord.dailyPercentChange}\n </span>\n\n </LabelWrapper>\n <LabelWrapper\n isLoading={checkLoading('dailyPipsChange')}\n isError={!!error}\n >\n <span className={classNames('lw-font-bold', {\n 'lw-text-text-ok': indicator > 0,\n 'lw-text-text-danger': indicator < 0,\n 'lw-text-text-disabled': indicator === 0,\n })}\n >\n {`(${updatedRecord.dailyPipsChange})`}\n </span>\n </LabelWrapper>\n {size === 'fullWithChart' && (\n <LineChartWithData\n record={updatedRecord}\n isLoading={checkLoading('instrument')}\n division={division}\n color={getChartColor(indicator, isDark)}\n />\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport { InstrumentRateWithData };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAA2D,SAAAG,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAA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IAAAiB,mBAAU,EAAC,cAAc,EAAE;MAC1C,iBAAiB,EAAErB,SAAS,GAAG,CAAC;MAChC,qBAAqB,EAAEA,SAAS,GAAG,CAAC;MACpC,uBAAuB,EAAEA,SAAS,KAAK;IACzC,CAAC;EAAE,GAEAP,aAAa,CAACS,kBACX,CAEM,CAAC,EACfjD,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC/C,iBAAA,CAAAiD,YAAY;IACXC,SAAS,EAAET,YAAY,CAAC,iBAAiB,CAAE;IAC3CU,OAAO,EAAE,CAAC,CAACb;EAAM,GAEjBzC,MAAA,CAAAY,OAAA,CAAAsC,aAAA;IAAMC,SAAS,EAAE,IAAAiB,mBAAU,EAAC,cAAc,EAAE;MAC1C,iBAAiB,EAAErB,SAAS,GAAG,CAAC;MAChC,qBAAqB,EAAEA,SAAS,GAAG,CAAC;MACpC,uBAAuB,EAAEA,SAAS,KAAK;IACzC,CAAC;EAAE,GAEA,IAAIP,aAAa,CAAC6B,eAAe,GAC9B,CACM,CAAC,EACdjC,IAAI,KAAK,eAAe,IACzBpC,MAAA,CAAAY,OAAA,CAAAsC,aAAA,CAAC5C,kBAAA,CAAAgE,iBAAiB;IAChBrC,MAAM,EAAEO,aAAc;IACtBa,SAAS,EAAET,YAAY,CAAC,YAAY,CAAE;IACtCT,QAAQ,EAAEA,QAAS;IACnBoC,KAAK,EAAE,IAAAC,qBAAa,EAACzB,SAAS,EAAEV,MAAM;EAAE,CACzC,CAEE,CAEJ,CAAC;AAEV,CAAC;AAACoC,OAAA,CAAA3C,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_InstrumentRateWithData","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_utils"],"sources":["../../../../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData/index.ts"],"sourcesContent":["export * from './InstrumentRateWithData';\nexport * from './utils';\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;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["_labsWidgetCommon","require","getColorIndicator","dailyChange","numberValue","Number","substring","length","Math","sign","exports","getChartColor","indicator","isDarkMode","theme","darkTheme","lightTheme","textOk","textDanger","textDisabled"],"sources":["../../../../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData/utils.ts"],"sourcesContent":["import { lightTheme, darkTheme } from '@oanda/labs-widget-common';\n\nconst getColorIndicator = (dailyChange?: string) => {\n const numberValue = Number(dailyChange?.substring(0, dailyChange.length - 1));\n\n return Math.sign(numberValue);\n};\n\nconst getChartColor = (indicator?: number, isDarkMode?: boolean) => {\n const theme = isDarkMode ? darkTheme : lightTheme;\n\n switch (indicator) {\n case 1:\n return theme.textOk;\n case -1:\n return theme.textDanger;\n default:\n return theme.textDisabled;\n }\n};\n\nexport {\n getColorIndicator,\n getChartColor,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,MAAMC,iBAAiB,GAAIC,WAAoB,IAAK;EAClD,MAAMC,WAAW,GAAGC,MAAM,CAACF,WAAW,EAAEG,SAAS,CAAC,CAAC,EAAEH,WAAW,CAACI,MAAM,GAAG,CAAC,CAAC,CAAC;EAE7E,OAAOC,IAAI,CAACC,IAAI,CAACL,WAAW,CAAC;AAC/B,CAAC;AAACM,OAAA,CAAAR,iBAAA,GAAAA,iBAAA;AAEF,MAAMS,aAAa,GAAGA,CAACC,SAAkB,EAAEC,UAAoB,KAAK;EAClE,MAAMC,KAAK,GAAGD,UAAU,GAAGE,2BAAS,GAAGC,4BAAU;EAEjD,QAAQJ,SAAS;IACf,KAAK,CAAC;MACJ,OAAOE,KAAK,CAACG,MAAM;IACrB,KAAK,CAAC,CAAC;MACL,OAAOH,KAAK,CAACI,UAAU;IACzB;MACE,OAAOJ,KAAK,CAACK,YAAY;EAC7B;AACF,CAAC;AAACT,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -1,74 +0,0 @@
1
- import React, { useContext } from 'react';
2
- import { LabelWrapper, Price, ThemeContext, Truncate } from '@oanda/labs-widget-common';
3
- import classNames from 'classnames';
4
- import { LineChartWithData } from '../LineChartWithData';
5
- import { useRecords } from '../../utils';
6
- import { INSTRUMENT_TOOLTIP_ID } from '../../constant';
7
- import { getChartColor, getColorIndicator } from './utils';
8
- const InstrumentRateWithData = _ref => {
9
- let {
10
- loading,
11
- record,
12
- target,
13
- division,
14
- size = 'fullWithChart'
15
- } = _ref;
16
- const {
17
- isDark
18
- } = useContext(ThemeContext);
19
- const {
20
- updatedRecord,
21
- error
22
- } = useRecords(record, record.instrument ? target : null);
23
- const checkLoading = id => loading || !error && updatedRecord?.[id] === undefined;
24
- const indicator = getColorIndicator(updatedRecord.dailyPercentChange);
25
- return React.createElement("div", {
26
- className: "lw-flex lw-flex-col lw-px-4 lw-pb-1 lw-pt-2"
27
- }, React.createElement("div", {
28
- className: "lw-flex lw-items-center lw-gap-x-2"
29
- }, React.createElement(LabelWrapper, {
30
- isLoading: checkLoading('instrument'),
31
- isError: !!error
32
- }, React.createElement("span", {
33
- className: "lw-text-xl lw-font-bold"
34
- }, React.createElement(Truncate, {
35
- maxWidth: 130,
36
- text: record.displayName,
37
- tooltipId: INSTRUMENT_TOOLTIP_ID
38
- }))), React.createElement(LabelWrapper, {
39
- isLoading: checkLoading('buy'),
40
- isError: !!error
41
- }, React.createElement("div", {
42
- className: "lw-text-xl lw-font-bold"
43
- }, React.createElement(Price, {
44
- priceMovement: updatedRecord.buyPriceMovement,
45
- withoutArrow: true
46
- }, React.createElement("span", null, updatedRecord.buy?.toFixed(updatedRecord.displayPrecision)))))), size !== 'compact' && React.createElement("div", {
47
- className: "lw-mt-1 lw-flex lw-items-center lw-gap-x-2"
48
- }, React.createElement(LabelWrapper, {
49
- isLoading: checkLoading('dailyPercentChange'),
50
- isError: !!error
51
- }, React.createElement("span", {
52
- className: classNames('lw-font-bold', {
53
- 'lw-text-text-ok': indicator > 0,
54
- 'lw-text-text-danger': indicator < 0,
55
- 'lw-text-text-disabled': indicator === 0
56
- })
57
- }, updatedRecord.dailyPercentChange)), React.createElement(LabelWrapper, {
58
- isLoading: checkLoading('dailyPipsChange'),
59
- isError: !!error
60
- }, React.createElement("span", {
61
- className: classNames('lw-font-bold', {
62
- 'lw-text-text-ok': indicator > 0,
63
- 'lw-text-text-danger': indicator < 0,
64
- 'lw-text-text-disabled': indicator === 0
65
- })
66
- }, `(${updatedRecord.dailyPipsChange})`)), size === 'fullWithChart' && React.createElement(LineChartWithData, {
67
- record: updatedRecord,
68
- isLoading: checkLoading('instrument'),
69
- division: division,
70
- color: getChartColor(indicator, isDark)
71
- })));
72
- };
73
- export { InstrumentRateWithData };
74
- //# sourceMappingURL=InstrumentRateWithData.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InstrumentRateWithData.js","names":["React","useContext","LabelWrapper","Price","ThemeContext","Truncate","classNames","LineChartWithData","useRecords","INSTRUMENT_TOOLTIP_ID","getChartColor","getColorIndicator","InstrumentRateWithData","_ref","loading","record","target","division","size","isDark","updatedRecord","error","instrument","checkLoading","id","undefined","indicator","dailyPercentChange","createElement","className","isLoading","isError","maxWidth","text","displayName","tooltipId","priceMovement","buyPriceMovement","withoutArrow","buy","toFixed","displayPrecision","dailyPipsChange","color"],"sources":["../../../../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData/InstrumentRateWithData.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport {\n LabelWrapper, Price, ThemeContext, Truncate,\n} from '@oanda/labs-widget-common';\nimport classNames from 'classnames';\nimport { InstrumentRateWithDataProps } from '../../types';\nimport { LineChartWithData } from '../LineChartWithData';\nimport { useRecords } from '../../utils';\nimport { INSTRUMENT_TOOLTIP_ID } from '../../constant';\nimport { getChartColor, getColorIndicator } from './utils';\n\nconst InstrumentRateWithData = ({\n loading,\n record,\n target,\n division,\n size = 'fullWithChart',\n}: InstrumentRateWithDataProps) => {\n const { isDark } = useContext(ThemeContext);\n const { updatedRecord, error } = useRecords(record, record.instrument ? target : null);\n\n const checkLoading = (id: string) => loading || (!error && updatedRecord?.[id] === undefined);\n\n const indicator = getColorIndicator(updatedRecord.dailyPercentChange);\n\n return (\n <div className=\"lw-flex lw-flex-col lw-px-4 lw-pb-1 lw-pt-2\">\n <div className=\"lw-flex lw-items-center lw-gap-x-2\">\n <LabelWrapper\n isLoading={checkLoading('instrument')}\n isError={!!error}\n >\n <span className=\"lw-text-xl lw-font-bold\">\n <Truncate maxWidth={130} text={record.displayName} tooltipId={INSTRUMENT_TOOLTIP_ID} />\n </span>\n </LabelWrapper>\n <LabelWrapper\n isLoading={checkLoading('buy')}\n isError={!!error}\n >\n <div className=\"lw-text-xl lw-font-bold\">\n <Price priceMovement={updatedRecord.buyPriceMovement} withoutArrow>\n <span>{updatedRecord.buy?.toFixed(updatedRecord.displayPrecision)}</span>\n </Price>\n </div>\n </LabelWrapper>\n </div>\n {size !== 'compact'\n && (\n <div className=\"lw-mt-1 lw-flex lw-items-center lw-gap-x-2\">\n <LabelWrapper\n isLoading={checkLoading('dailyPercentChange')}\n isError={!!error}\n >\n <span className={classNames('lw-font-bold', {\n 'lw-text-text-ok': indicator > 0,\n 'lw-text-text-danger': indicator < 0,\n 'lw-text-text-disabled': indicator === 0,\n })}\n >\n {updatedRecord.dailyPercentChange}\n </span>\n\n </LabelWrapper>\n <LabelWrapper\n isLoading={checkLoading('dailyPipsChange')}\n isError={!!error}\n >\n <span className={classNames('lw-font-bold', {\n 'lw-text-text-ok': indicator > 0,\n 'lw-text-text-danger': indicator < 0,\n 'lw-text-text-disabled': indicator === 0,\n })}\n >\n {`(${updatedRecord.dailyPipsChange})`}\n </span>\n </LabelWrapper>\n {size === 'fullWithChart' && (\n <LineChartWithData\n record={updatedRecord}\n isLoading={checkLoading('instrument')}\n division={division}\n color={getChartColor(indicator, isDark)}\n />\n )}\n </div>\n )}\n </div>\n );\n};\n\nexport { InstrumentRateWithData };\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SACEC,YAAY,EAAEC,KAAK,EAAEC,YAAY,EAAEC,QAAQ,QACtC,2BAA2B;AAClC,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,iBAAiB,QAAQ,sBAAsB;AACxD,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,qBAAqB,QAAQ,gBAAgB;AACtD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,SAAS;AAE1D,MAAMC,sBAAsB,GAAGC,IAAA,IAMI;EAAA,IANH;IAC9BC,OAAO;IACPC,MAAM;IACNC,MAAM;IACNC,QAAQ;IACRC,IAAI,GAAG;EACoB,CAAC,GAAAL,IAAA;EAC5B,MAAM;IAAEM;EAAO,CAAC,GAAGlB,UAAU,CAACG,YAAY,CAAC;EAC3C,MAAM;IAAEgB,aAAa;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AA4C,GACzD7B,KAAA,CAAA4B,aAAA,CAAC1B,YAAY;IACX4B,SAAS,EAAEP,YAAY,CAAC,oBAAoB,CAAE;IAC9CQ,OAAO,EAAE,CAAC,CAACV;EAAM,GAEjBrB,KAAA,CAAA4B,aAAA;IAAMC,SAAS,EAAEvB,UAAU,CAAC,cAAc,EAAE;MAC1C,iBAAiB,EAAEoB,SAAS,GAAG,CAAC;MAChC,qBAAqB,EAAEA,SAAS,GAAG,CAAC;MACpC,uBAAuB,EAAEA,SAAS,KAAK;IACzC,CAAC;EAAE,GAEAN,aAAa,CAACO,kBACX,CAEM,CAAC,EACf3B,KAAA,CAAA4B,aAAA,CAAC1B,YAAY;IACX4B,SAAS,EAAEP,YAAY,CAAC,iBAAiB,CAAE;IAC3CQ,OAAO,EAAE,CAAC,CAACV;EAAM,GAEjBrB,KAAA,CAAA4B,aAAA;IAAMC,SAAS,EAAEvB,UAAU,CAAC,cAAc,EAAE;MAC1C,iBAAiB,EAAEoB,SAAS,GAAG,CAAC;MAChC,qBAAqB,EAAEA,SAAS,GAAG,CAAC;MACpC,uBAAuB,EAAEA,SAAS,KAAK;IACzC,CAAC;EAAE,GAEA,IAAIN,aAAa,CAACsB,eAAe,GAC9B,CACM,CAAC,EACdxB,IAAI,KAAK,eAAe,IACzBlB,KAAA,CAAA4B,aAAA,CAACrB,iBAAiB;IAChBQ,MAAM,EAAEK,aAAc;IACtBU,SAAS,EAAEP,YAAY,CAAC,YAAY,CAAE;IACtCN,QAAQ,EAAEA,QAAS;IACnB0B,KAAK,EAAEjC,aAAa,CAACgB,SAAS,EAAEP,MAAM;EAAE,CACzC,CAEE,CAEJ,CAAC;AAEV,CAAC;AAED,SAASP,sBAAsB","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- export * from './InstrumentRateWithData';
2
- export * from './utils';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData/index.ts"],"sourcesContent":["export * from './InstrumentRateWithData';\nexport * from './utils';\n"],"mappings":"AAAA,cAAc,0BAA0B;AACxC,cAAc,SAAS","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","names":["lightTheme","darkTheme","getColorIndicator","dailyChange","numberValue","Number","substring","length","Math","sign","getChartColor","indicator","isDarkMode","theme","textOk","textDanger","textDisabled"],"sources":["../../../../../src/InstrumentLiveRateWidget/components/InstrumentRateWithData/utils.ts"],"sourcesContent":["import { lightTheme, darkTheme } from '@oanda/labs-widget-common';\n\nconst getColorIndicator = (dailyChange?: string) => {\n const numberValue = Number(dailyChange?.substring(0, dailyChange.length - 1));\n\n return Math.sign(numberValue);\n};\n\nconst getChartColor = (indicator?: number, isDarkMode?: boolean) => {\n const theme = isDarkMode ? darkTheme : lightTheme;\n\n switch (indicator) {\n case 1:\n return theme.textOk;\n case -1:\n return theme.textDanger;\n default:\n return theme.textDisabled;\n }\n};\n\nexport {\n getColorIndicator,\n getChartColor,\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,2BAA2B;AAEjE,MAAMC,iBAAiB,GAAIC,WAAoB,IAAK;EAClD,MAAMC,WAAW,GAAGC,MAAM,CAACF,WAAW,EAAEG,SAAS,CAAC,CAAC,EAAEH,WAAW,CAACI,MAAM,GAAG,CAAC,CAAC,CAAC;EAE7E,OAAOC,IAAI,CAACC,IAAI,CAACL,WAAW,CAAC;AAC/B,CAAC;AAED,MAAMM,aAAa,GAAGA,CAACC,SAAkB,EAAEC,UAAoB,KAAK;EAClE,MAAMC,KAAK,GAAGD,UAAU,GAAGX,SAAS,GAAGD,UAAU;EAEjD,QAAQW,SAAS;IACf,KAAK,CAAC;MACJ,OAAOE,KAAK,CAACC,MAAM;IACrB,KAAK,CAAC,CAAC;MACL,OAAOD,KAAK,CAACE,UAAU;IACzB;MACE,OAAOF,KAAK,CAACG,YAAY;EAC7B;AACF,CAAC;AAED,SACEd,iBAAiB,EACjBQ,aAAa","ignoreList":[]}
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { InstrumentRateWithDataProps } from '../../types';
3
- declare const InstrumentRateWithData: ({ loading, record, target, division, size, }: InstrumentRateWithDataProps) => React.JSX.Element;
4
- export { InstrumentRateWithData };
@@ -1,2 +0,0 @@
1
- export * from './InstrumentRateWithData';
2
- export * from './utils';