@oanda/labs-widget-common 1.0.244 → 1.0.245
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 +968 -0
- package/dist/main/chart/BaseChart.js +6 -9
- package/dist/main/chart/BaseChart.js.map +1 -1
- package/dist/main/chart/formatters.js +4 -4
- package/dist/main/chart/formatters.js.map +1 -1
- package/dist/main/chart/getGridLines.js +14 -12
- package/dist/main/chart/getGridLines.js.map +1 -1
- package/dist/main/components/Button/Button.js +4 -7
- package/dist/main/components/Button/Button.js.map +1 -1
- package/dist/main/components/Card/rows/PriceCardRow.js +1 -1
- package/dist/main/components/Card/rows/PriceCardRow.js.map +1 -1
- package/dist/main/components/Input/NumberInput.js +10 -13
- package/dist/main/components/Input/NumberInput.js.map +1 -1
- package/dist/main/components/InstrumentRate/InstrumentRate.js +3 -4
- package/dist/main/components/InstrumentRate/InstrumentRate.js.map +1 -1
- package/dist/main/components/InstrumentRate/InstrumentRateWithChart.js +1 -1
- package/dist/main/components/InstrumentRate/InstrumentRateWithChart.js.map +1 -1
- package/dist/main/components/InstrumentRate/utils.js +1 -1
- package/dist/main/components/InstrumentRate/utils.js.map +1 -1
- package/dist/main/components/Label/Label.js +3 -6
- package/dist/main/components/Label/Label.js.map +1 -1
- package/dist/main/components/LastUpdated/LastUpdated.js +1 -1
- package/dist/main/components/LastUpdated/LastUpdated.js.map +1 -1
- package/dist/main/components/LineChart/LineChart.js +2 -2
- package/dist/main/components/LineChart/LineChart.js.map +1 -1
- package/dist/main/components/LineChart/utils.js +2 -2
- package/dist/main/components/LineChart/utils.js.map +1 -1
- package/dist/main/components/Pagination/Pagination.js +2 -2
- package/dist/main/components/Pagination/Pagination.js.map +1 -1
- package/dist/main/components/Select/Select.js +2 -2
- package/dist/main/components/Select/Select.js.map +1 -1
- package/dist/main/components/Sentiment/Sentiment.js +7 -7
- package/dist/main/components/Sentiment/Sentiment.js.map +1 -1
- package/dist/main/components/Sentiment/SentimentError.js +1 -1
- package/dist/main/components/Sentiment/SentimentError.js.map +1 -1
- package/dist/main/components/Sentiment/SentimentLoader.js +1 -1
- package/dist/main/components/Sentiment/SentimentLoader.js.map +1 -1
- package/dist/main/components/Sentiment/utils.js +3 -3
- package/dist/main/components/Sentiment/utils.js.map +1 -1
- package/dist/main/components/Switch/Switch.js +3 -3
- package/dist/main/components/Switch/Switch.js.map +1 -1
- package/dist/main/components/Table/TableCell.js +1 -1
- package/dist/main/components/Table/TableCell.js.map +1 -1
- package/dist/main/components/Table/TableHeader.js +1 -1
- package/dist/main/components/Table/TableHeader.js.map +1 -1
- package/dist/main/components/TableWidget/CardRecordRow.js +1 -2
- package/dist/main/components/TableWidget/CardRecordRow.js.map +1 -1
- package/dist/main/components/TableWidget/CardRenderer.js +3 -6
- package/dist/main/components/TableWidget/CardRenderer.js.map +1 -1
- package/dist/main/components/TableWidget/Cards.js +1 -1
- package/dist/main/components/TableWidget/Cards.js.map +1 -1
- package/dist/main/components/TableWidget/ColumnRenderer.js +4 -7
- package/dist/main/components/TableWidget/ColumnRenderer.js.map +1 -1
- package/dist/main/components/TableWidget/TableWidget.js +1 -1
- package/dist/main/components/TableWidget/TableWidget.js.map +1 -1
- package/dist/main/components/Tabs/Tabs.js +1 -1
- package/dist/main/components/Tabs/Tabs.js.map +1 -1
- package/dist/main/components/TextInput/TextInput.js +2 -3
- package/dist/main/components/TextInput/TextInput.js.map +1 -1
- package/dist/main/components/Truncate/Truncate.js +1 -1
- package/dist/main/components/Truncate/Truncate.js.map +1 -1
- package/dist/main/components/WidgetWrapper/WidgetWrapper.js +2 -2
- package/dist/main/components/WidgetWrapper/WidgetWrapper.js.map +1 -1
- package/dist/main/hooks/useLiveRatesMessage.js +7 -7
- package/dist/main/hooks/useLiveRatesMessage.js.map +1 -1
- package/dist/main/hooks/useLiveRatesQuery.js +3 -5
- package/dist/main/hooks/useLiveRatesQuery.js.map +1 -1
- package/dist/main/hooks/useRecords.js +5 -5
- package/dist/main/hooks/useRecords.js.map +1 -1
- package/dist/main/hooks/useVisibleLiveDataRecord.js +10 -10
- package/dist/main/hooks/useVisibleLiveDataRecord.js.map +1 -1
- package/dist/main/providers/LiveRates/LiveRatesProvider.js +20 -24
- package/dist/main/providers/LiveRates/LiveRatesProvider.js.map +1 -1
- package/dist/main/providers/Widget/WidgetProvider.js +4 -6
- package/dist/main/providers/Widget/WidgetProvider.js.map +1 -1
- package/dist/main/tailwind/preset.js +3 -7
- package/dist/main/tailwind/preset.js.map +1 -1
- package/dist/main/tailwind/themes/themeColors.js +5 -7
- package/dist/main/tailwind/themes/themeColors.js.map +1 -1
- package/dist/main/tailwind/utils.js +3 -7
- package/dist/main/tailwind/utils.js.map +1 -1
- package/dist/main/testUtils/index.js +2 -2
- package/dist/main/testUtils/index.js.map +1 -1
- package/dist/main/utils/dateUtils.js +3 -3
- package/dist/main/utils/dateUtils.js.map +1 -1
- package/dist/main/utils/getLocale.js +1 -1
- package/dist/main/utils/getLocale.js.map +1 -1
- package/dist/main/utils/liveRates/buildUrl.js +9 -11
- package/dist/main/utils/liveRates/buildUrl.js.map +1 -1
- package/dist/main/utils/liveRates/calculatePriceChangeFromOpen.js +1 -1
- package/dist/main/utils/liveRates/calculatePriceChangeFromOpen.js.map +1 -1
- package/dist/module/chart/BaseChart.js +6 -9
- package/dist/module/chart/BaseChart.js.map +1 -1
- package/dist/module/chart/formatters.js +4 -4
- package/dist/module/chart/formatters.js.map +1 -1
- package/dist/module/chart/getGridLines.js +14 -12
- package/dist/module/chart/getGridLines.js.map +1 -1
- package/dist/module/components/Button/Button.js +4 -7
- package/dist/module/components/Button/Button.js.map +1 -1
- package/dist/module/components/Card/rows/PriceCardRow.js +1 -1
- package/dist/module/components/Card/rows/PriceCardRow.js.map +1 -1
- package/dist/module/components/Input/NumberInput.js +10 -13
- package/dist/module/components/Input/NumberInput.js.map +1 -1
- package/dist/module/components/InstrumentRate/InstrumentRate.js +3 -4
- package/dist/module/components/InstrumentRate/InstrumentRate.js.map +1 -1
- package/dist/module/components/InstrumentRate/InstrumentRateWithChart.js +1 -1
- package/dist/module/components/InstrumentRate/InstrumentRateWithChart.js.map +1 -1
- package/dist/module/components/InstrumentRate/utils.js +1 -1
- package/dist/module/components/InstrumentRate/utils.js.map +1 -1
- package/dist/module/components/Label/Label.js +3 -6
- package/dist/module/components/Label/Label.js.map +1 -1
- package/dist/module/components/LastUpdated/LastUpdated.js +1 -1
- package/dist/module/components/LastUpdated/LastUpdated.js.map +1 -1
- package/dist/module/components/LineChart/LineChart.js +2 -2
- package/dist/module/components/LineChart/LineChart.js.map +1 -1
- package/dist/module/components/LineChart/utils.js +2 -2
- package/dist/module/components/LineChart/utils.js.map +1 -1
- package/dist/module/components/Pagination/Pagination.js +2 -2
- package/dist/module/components/Pagination/Pagination.js.map +1 -1
- package/dist/module/components/Select/Select.js +2 -2
- package/dist/module/components/Select/Select.js.map +1 -1
- package/dist/module/components/Sentiment/Sentiment.js +7 -7
- package/dist/module/components/Sentiment/Sentiment.js.map +1 -1
- package/dist/module/components/Sentiment/SentimentError.js +1 -1
- package/dist/module/components/Sentiment/SentimentError.js.map +1 -1
- package/dist/module/components/Sentiment/SentimentLoader.js +1 -1
- package/dist/module/components/Sentiment/SentimentLoader.js.map +1 -1
- package/dist/module/components/Sentiment/utils.js +3 -3
- package/dist/module/components/Sentiment/utils.js.map +1 -1
- package/dist/module/components/Switch/Switch.js +3 -3
- package/dist/module/components/Switch/Switch.js.map +1 -1
- package/dist/module/components/Table/TableCell.js +1 -1
- package/dist/module/components/Table/TableCell.js.map +1 -1
- package/dist/module/components/Table/TableHeader.js +1 -1
- package/dist/module/components/Table/TableHeader.js.map +1 -1
- package/dist/module/components/TableWidget/CardRecordRow.js +1 -2
- package/dist/module/components/TableWidget/CardRecordRow.js.map +1 -1
- package/dist/module/components/TableWidget/CardRenderer.js +3 -6
- package/dist/module/components/TableWidget/CardRenderer.js.map +1 -1
- package/dist/module/components/TableWidget/Cards.js +1 -1
- package/dist/module/components/TableWidget/Cards.js.map +1 -1
- package/dist/module/components/TableWidget/ColumnRenderer.js +4 -7
- package/dist/module/components/TableWidget/ColumnRenderer.js.map +1 -1
- package/dist/module/components/TableWidget/TableWidget.js +1 -1
- package/dist/module/components/TableWidget/TableWidget.js.map +1 -1
- package/dist/module/components/Tabs/Tabs.js +1 -1
- package/dist/module/components/Tabs/Tabs.js.map +1 -1
- package/dist/module/components/TextInput/TextInput.js +2 -3
- package/dist/module/components/TextInput/TextInput.js.map +1 -1
- package/dist/module/components/Truncate/Truncate.js +1 -1
- package/dist/module/components/Truncate/Truncate.js.map +1 -1
- package/dist/module/components/WidgetWrapper/WidgetWrapper.js +2 -2
- package/dist/module/components/WidgetWrapper/WidgetWrapper.js.map +1 -1
- package/dist/module/hooks/useLiveRatesMessage.js +7 -7
- package/dist/module/hooks/useLiveRatesMessage.js.map +1 -1
- package/dist/module/hooks/useLiveRatesQuery.js +3 -5
- package/dist/module/hooks/useLiveRatesQuery.js.map +1 -1
- package/dist/module/hooks/useRecords.js +5 -5
- package/dist/module/hooks/useRecords.js.map +1 -1
- package/dist/module/hooks/useVisibleLiveDataRecord.js +10 -10
- package/dist/module/hooks/useVisibleLiveDataRecord.js.map +1 -1
- package/dist/module/providers/LiveRates/LiveRatesProvider.js +20 -24
- package/dist/module/providers/LiveRates/LiveRatesProvider.js.map +1 -1
- package/dist/module/providers/Widget/WidgetProvider.js +4 -6
- package/dist/module/providers/Widget/WidgetProvider.js.map +1 -1
- package/dist/module/tailwind/preset.js +3 -7
- package/dist/module/tailwind/preset.js.map +1 -1
- package/dist/module/tailwind/themes/themeColors.js +5 -7
- package/dist/module/tailwind/themes/themeColors.js.map +1 -1
- package/dist/module/tailwind/utils.js +3 -7
- package/dist/module/tailwind/utils.js.map +1 -1
- package/dist/module/testUtils/index.js +2 -2
- package/dist/module/testUtils/index.js.map +1 -1
- package/dist/module/utils/dateUtils.js +3 -3
- package/dist/module/utils/dateUtils.js.map +1 -1
- package/dist/module/utils/getLocale.js +1 -1
- package/dist/module/utils/getLocale.js.map +1 -1
- package/dist/module/utils/liveRates/buildUrl.js +9 -11
- package/dist/module/utils/liveRates/buildUrl.js.map +1 -1
- package/dist/module/utils/liveRates/calculatePriceChangeFromOpen.js +1 -1
- package/dist/module/utils/liveRates/calculatePriceChangeFromOpen.js.map +1 -1
- package/package.json +2 -2
|
@@ -6,18 +6,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.BaseChart = void 0;
|
|
7
7
|
var _core = _interopRequireDefault(require("echarts-for-react/lib/core"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
const _excluded = ["isDark", "chartHeight"];
|
|
10
9
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
15
12
|
const BaseChart = exports.BaseChart = (0, _react.forwardRef)((_ref, ref) => {
|
|
16
13
|
let {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
isDark,
|
|
15
|
+
chartHeight,
|
|
16
|
+
...props
|
|
17
|
+
} = _ref;
|
|
21
18
|
const [ready, setReady] = (0, _react.useState)(false);
|
|
22
19
|
(0, _react.useEffect)(() => {
|
|
23
20
|
void document.fonts.ready.then(() => setReady(true));
|
|
@@ -26,7 +23,7 @@ const BaseChart = exports.BaseChart = (0, _react.forwardRef)((_ref, ref) => {
|
|
|
26
23
|
ref: ref,
|
|
27
24
|
"data-testid": "charts-container",
|
|
28
25
|
style: {
|
|
29
|
-
height:
|
|
26
|
+
height: `${chartHeight}px`,
|
|
30
27
|
width: '100%'
|
|
31
28
|
},
|
|
32
29
|
theme: isDark ? 'dark_theme' : 'light_theme'
|
|
@@ -34,7 +31,7 @@ const BaseChart = exports.BaseChart = (0, _react.forwardRef)((_ref, ref) => {
|
|
|
34
31
|
className: "lw-w-full",
|
|
35
32
|
"data-testid": "charts-placeholder",
|
|
36
33
|
style: {
|
|
37
|
-
height:
|
|
34
|
+
height: `${chartHeight}px`
|
|
38
35
|
}
|
|
39
36
|
}));
|
|
40
37
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChart.js","names":["_core","_interopRequireDefault","require","_react","_interopRequireWildcard","
|
|
1
|
+
{"version":3,"file":"BaseChart.js","names":["_core","_interopRequireDefault","require","_react","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","BaseChart","exports","forwardRef","_ref","ref","isDark","chartHeight","props","ready","setReady","useState","useEffect","document","fonts","then","createElement","Fragment","style","height","width","theme","className","displayName"],"sources":["../../../src/chart/BaseChart.tsx"],"sourcesContent":["import ReactEChartsCore from 'echarts-for-react/lib/core';\nimport type { EChartsReactProps } from 'echarts-for-react/lib/types';\nimport React, { forwardRef, useEffect, useState } from 'react';\n\nimport type { BaseChartRef } from './types';\n\ntype BaseChartProps = EChartsReactProps & {\n isDark: boolean;\n chartHeight: number;\n};\n\nexport const BaseChart = forwardRef<BaseChartRef, BaseChartProps>(\n ({ isDark, chartHeight, ...props }, ref) => {\n const [ready, setReady] = useState(false);\n\n useEffect(() => {\n void document.fonts.ready.then(() => setReady(true));\n }, []);\n\n return (\n <>\n {ready ? (\n <ReactEChartsCore\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n ref={ref}\n data-testid=\"charts-container\"\n style={{\n height: `${chartHeight}px`,\n width: '100%',\n }}\n theme={isDark ? 'dark_theme' : 'light_theme'}\n />\n ) : (\n <div\n className=\"lw-w-full\"\n data-testid=\"charts-placeholder\"\n style={{ height: `${chartHeight}px` }}\n />\n )}\n </>\n );\n }\n);\n\nBaseChart.displayName = 'BaseChart';\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAA+D,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,C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;EAAM,CAAC,GAAAJ,IAAA;EAChC,MAAM,CAACK,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAC,KAAK,CAAC;EAEzC,IAAAC,gBAAS,EAAC,MAAM;IACd,KAAKC,QAAQ,CAACC,KAAK,CAACL,KAAK,CAACM,IAAI,CAAC,MAAML,QAAQ,CAAC,IAAI,CAAC,CAAC;EACtD,CAAC,EAAE,EAAE,CAAC;EAEN,OACEpC,MAAA,CAAAY,OAAA,CAAA8B,aAAA,CAAA1C,MAAA,CAAAY,OAAA,CAAA+B,QAAA,QACGR,KAAK,GACJnC,MAAA,CAAAY,OAAA,CAAA8B,aAAA,CAAC7C,KAAA,CAAAe,OAAgB,EAAAS,QAAA,KAEXa,KAAK;IACTH,GAAG,EAAEA,GAAI;IACT,eAAY,kBAAkB;IAC9Ba,KAAK,EAAE;MACLC,MAAM,EAAE,GAAGZ,WAAW,IAAI;MAC1Ba,KAAK,EAAE;IACT,CAAE;IACFC,KAAK,EAAEf,MAAM,GAAG,YAAY,GAAG;EAAc,EAC9C,CAAC,GAEFhC,MAAA,CAAAY,OAAA,CAAA8B,aAAA;IACEM,SAAS,EAAC,WAAW;IACrB,eAAY,oBAAoB;IAChCJ,KAAK,EAAE;MAAEC,MAAM,EAAE,GAAGZ,WAAW;IAAK;EAAE,CACvC,CAEH,CAAC;AAEP,CACF,CAAC;AAEDN,SAAS,CAACsB,WAAW,GAAG,WAAW","ignoreList":[]}
|
|
@@ -4,21 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getChartDateAndTime = exports.chartDateTimeFormat = exports.chartDateFormat = void 0;
|
|
7
|
-
const chartDateFormat = date =>
|
|
7
|
+
const chartDateFormat = date => `${new Date(date).toLocaleDateString(undefined, {
|
|
8
8
|
month: 'numeric',
|
|
9
9
|
day: 'numeric'
|
|
10
|
-
})
|
|
10
|
+
})}`;
|
|
11
11
|
exports.chartDateFormat = chartDateFormat;
|
|
12
12
|
const chartDateTimeFormat = _ref => {
|
|
13
13
|
let {
|
|
14
14
|
date,
|
|
15
15
|
time
|
|
16
16
|
} = _ref;
|
|
17
|
-
return
|
|
17
|
+
return `${new Date(date).toLocaleDateString(undefined, {
|
|
18
18
|
year: 'numeric',
|
|
19
19
|
month: 'numeric',
|
|
20
20
|
day: 'numeric'
|
|
21
|
-
}),
|
|
21
|
+
})}, ${time} UTC`;
|
|
22
22
|
};
|
|
23
23
|
exports.chartDateTimeFormat = chartDateTimeFormat;
|
|
24
24
|
const getChartDateAndTime = param => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","names":["chartDateFormat","date","
|
|
1
|
+
{"version":3,"file":"formatters.js","names":["chartDateFormat","date","Date","toLocaleDateString","undefined","month","day","exports","chartDateTimeFormat","_ref","time","year","getChartDateAndTime","param","dateAndTime","split","substring"],"sources":["../../../src/chart/formatters.ts"],"sourcesContent":["export const chartDateFormat = (date: string) =>\n `${new Date(date).toLocaleDateString(undefined, { month: 'numeric', day: 'numeric' })}`;\n\nexport const chartDateTimeFormat = ({\n date,\n time,\n}: {\n date: string;\n time: string;\n}) =>\n `${new Date(date).toLocaleDateString(undefined, { year: 'numeric', month: 'numeric', day: 'numeric' })}, ${time} UTC`;\n\nexport const getChartDateAndTime = (param: string) => {\n const dateAndTime = param.split('T');\n\n return {\n date: dateAndTime[0],\n time: dateAndTime[1].substring(0, 5),\n };\n};\n"],"mappings":";;;;;;AAAO,MAAMA,eAAe,GAAIC,IAAY,IAC1C,GAAG,IAAIC,IAAI,CAACD,IAAI,CAAC,CAACE,kBAAkB,CAACC,SAAS,EAAE;EAAEC,KAAK,EAAE,SAAS;EAAEC,GAAG,EAAE;AAAU,CAAC,CAAC,EAAE;AAACC,OAAA,CAAAP,eAAA,GAAAA,eAAA;AAEnF,MAAMQ,mBAAmB,GAAGC,IAAA;EAAA,IAAC;IAClCR,IAAI;IACJS;EAIF,CAAC,GAAAD,IAAA;EAAA,OACC,GAAG,IAAIP,IAAI,CAACD,IAAI,CAAC,CAACE,kBAAkB,CAACC,SAAS,EAAE;IAAEO,IAAI,EAAE,SAAS;IAAEN,KAAK,EAAE,SAAS;IAAEC,GAAG,EAAE;EAAU,CAAC,CAAC,KAAKI,IAAI,MAAM;AAAA;AAACH,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAEjH,MAAMI,mBAAmB,GAAIC,KAAa,IAAK;EACpD,MAAMC,WAAW,GAAGD,KAAK,CAACE,KAAK,CAAC,GAAG,CAAC;EAEpC,OAAO;IACLd,IAAI,EAAEa,WAAW,CAAC,CAAC,CAAC;IACpBJ,IAAI,EAAEI,WAAW,CAAC,CAAC,CAAC,CAACE,SAAS,CAAC,CAAC,EAAE,CAAC;EACrC,CAAC;AACH,CAAC;AAACT,OAAA,CAAAK,mBAAA,GAAAA,mBAAA","ignoreList":[]}
|
|
@@ -5,11 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getGridLines = void 0;
|
|
7
7
|
var _sharedOptions = require("./sharedOptions");
|
|
8
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
8
|
const getGridLines = _ref => {
|
|
14
9
|
let {
|
|
15
10
|
isDark,
|
|
@@ -22,7 +17,8 @@ const getGridLines = _ref => {
|
|
|
22
17
|
marginBottom = 0,
|
|
23
18
|
yLabelMarinTop = 0
|
|
24
19
|
} = _ref;
|
|
25
|
-
return [
|
|
20
|
+
return [{
|
|
21
|
+
...(0, _sharedOptions.getLineCommons)(isDark),
|
|
26
22
|
top: -2,
|
|
27
23
|
shape: {
|
|
28
24
|
x1: 0,
|
|
@@ -30,7 +26,8 @@ const getGridLines = _ref => {
|
|
|
30
26
|
x2: chartWidth,
|
|
31
27
|
y2: 0
|
|
32
28
|
}
|
|
33
|
-
}
|
|
29
|
+
}, {
|
|
30
|
+
...(0, _sharedOptions.getLineCommons)(isDark),
|
|
34
31
|
right: -2,
|
|
35
32
|
shape: {
|
|
36
33
|
x1: 0,
|
|
@@ -38,7 +35,8 @@ const getGridLines = _ref => {
|
|
|
38
35
|
x2: 0,
|
|
39
36
|
y2: chartHeight - marginBottom
|
|
40
37
|
}
|
|
41
|
-
}
|
|
38
|
+
}, {
|
|
39
|
+
...(0, _sharedOptions.getLineCommons)(isDark),
|
|
42
40
|
bottom: -2 + marginBottom,
|
|
43
41
|
shape: {
|
|
44
42
|
x1: 0,
|
|
@@ -46,7 +44,8 @@ const getGridLines = _ref => {
|
|
|
46
44
|
x2: chartWidth,
|
|
47
45
|
y2: 0
|
|
48
46
|
}
|
|
49
|
-
}
|
|
47
|
+
}, {
|
|
48
|
+
...(0, _sharedOptions.getLineCommons)(isDark),
|
|
50
49
|
left: -2,
|
|
51
50
|
shape: {
|
|
52
51
|
x1: 0,
|
|
@@ -54,7 +53,8 @@ const getGridLines = _ref => {
|
|
|
54
53
|
x2: 0,
|
|
55
54
|
y2: chartHeight - marginBottom
|
|
56
55
|
}
|
|
57
|
-
}
|
|
56
|
+
}, {
|
|
57
|
+
...(0, _sharedOptions.getLineCommons)(isDark),
|
|
58
58
|
right: yLabelSize - 3,
|
|
59
59
|
bottom: bottomLeftBox ? -2 + marginBottom : xLabelsSize - 3,
|
|
60
60
|
shape: {
|
|
@@ -63,7 +63,8 @@ const getGridLines = _ref => {
|
|
|
63
63
|
x2: 0,
|
|
64
64
|
y2: chartHeight - yLabelMarinTop
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}, {
|
|
67
|
+
...(0, _sharedOptions.getLineCommons)(isDark),
|
|
67
68
|
bottom: xLabelsSize - 3,
|
|
68
69
|
shape: {
|
|
69
70
|
x1: 0,
|
|
@@ -71,7 +72,8 @@ const getGridLines = _ref => {
|
|
|
71
72
|
x2: chartWidth,
|
|
72
73
|
y2: 0
|
|
73
74
|
}
|
|
74
|
-
}
|
|
75
|
+
}, ...additionalLines.map(item => ({
|
|
76
|
+
...(0, _sharedOptions.getLineCommons)(isDark),
|
|
75
77
|
top: item.top,
|
|
76
78
|
bottom: item.bottom,
|
|
77
79
|
left: item.left,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGridLines.js","names":["_sharedOptions","require","
|
|
1
|
+
{"version":3,"file":"getGridLines.js","names":["_sharedOptions","require","getGridLines","_ref","isDark","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","additionalLines","marginBottom","yLabelMarinTop","getLineCommons","top","shape","x1","y1","x2","y2","right","bottom","left","map","item","exports"],"sources":["../../../src/chart/getGridLines.ts"],"sourcesContent":["import { getLineCommons } from './sharedOptions';\n\nexport const getGridLines = ({\n isDark,\n chartWidth,\n chartHeight,\n xLabelsSize,\n yLabelSize,\n bottomLeftBox = true,\n additionalLines = [],\n marginBottom = 0,\n yLabelMarinTop = 0,\n}: {\n isDark: boolean;\n chartWidth: number;\n chartHeight: number;\n xLabelsSize: number;\n yLabelSize: number;\n bottomLeftBox?: boolean;\n additionalLines?: {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n x1: number;\n y1: number;\n x2: number;\n y2: number;\n }[];\n marginBottom?: number;\n yLabelMarinTop?: number;\n}) => [\n // Top\n {\n ...getLineCommons(isDark),\n top: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: chartWidth,\n y2: 0,\n },\n },\n // Right\n {\n ...getLineCommons(isDark),\n right: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: chartHeight - marginBottom,\n },\n },\n // Bottom\n {\n ...getLineCommons(isDark),\n bottom: -2 + marginBottom,\n shape: {\n x1: 0,\n y1: 0,\n x2: chartWidth,\n y2: 0,\n },\n },\n // Left\n {\n ...getLineCommons(isDark),\n left: -2,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: chartHeight - marginBottom,\n },\n },\n // Y Label\n {\n ...getLineCommons(isDark),\n right: yLabelSize - 3,\n bottom: bottomLeftBox ? -2 + marginBottom : xLabelsSize - 3,\n shape: {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: chartHeight - yLabelMarinTop,\n },\n },\n // X Label\n {\n ...getLineCommons(isDark),\n bottom: xLabelsSize - 3,\n shape: {\n x1: 0,\n y1: 0,\n x2: chartWidth,\n y2: 0,\n },\n },\n ...additionalLines.map((item) => ({\n ...getLineCommons(isDark),\n top: item.top,\n bottom: item.bottom,\n left: item.left,\n right: item.right,\n shape: {\n x1: item.x1,\n y1: item.y1,\n x2: item.x2,\n y2: item.y2,\n },\n })),\n];\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEO,MAAMC,YAAY,GAAGC,IAAA;EAAA,IAAC;IAC3BC,MAAM;IACNC,UAAU;IACVC,WAAW;IACXC,WAAW;IACXC,U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EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEb,WAAW,GAAGM;IACpB;EACF,CAAC,EAED;IACE,GAAG,IAAAC,6BAAc,EAACT,MAAM,CAAC;IACzBiB,MAAM,EAAEd,WAAW,GAAG,CAAC;IACvBQ,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEb,UAAU;MACdc,EAAE,EAAE;IACN;EACF,CAAC,EACD,GAAGT,eAAe,CAACa,GAAG,CAAEC,IAAI,KAAM;IAChC,GAAG,IAAAX,6BAAc,EAACT,MAAM,CAAC;IACzBU,GAAG,EAAEU,IAAI,CAACV,GAAG;IACbO,MAAM,EAAEG,IAAI,CAACH,MAAM;IACnBC,IAAI,EAAEE,IAAI,CAACF,IAAI;IACfF,KAAK,EAAEI,IAAI,CAACJ,KAAK;IACjBL,KAAK,EAAE;MACLC,EAAE,EAAEQ,IAAI,CAACR,EAAE;MACXC,EAAE,EAAEO,IAAI,CAACP,EAAE;MACXC,EAAE,EAAEM,IAAI,CAACN,EAAE;MACXC,EAAE,EAAEK,IAAI,CAACL;IACX;EACF,CAAC,CAAC,CAAC,CACJ;AAAA;AAACM,OAAA,CAAAvB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -7,17 +7,14 @@ exports.Button = void 0;
|
|
|
7
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _types = require("./types");
|
|
10
|
-
const _excluded = ["variant", "size"];
|
|
11
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
11
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
13
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
14
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
15
12
|
const Button = _ref => {
|
|
16
13
|
let {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
variant = _types.ButtonVariant.primary,
|
|
15
|
+
size,
|
|
16
|
+
...props
|
|
17
|
+
} = _ref;
|
|
21
18
|
return _react.default.createElement("button", _extends({}, props, {
|
|
22
19
|
className: (0, _classnames.default)('lw-box-border lw-flex lw-justify-center lw-rounded lw-border lw-border-solid lw-px-4 lw-py-3 lw-text-center lw-font-sans lw-text-base lw-font-bold lw-leading-6 lw-tracking-normal focus:lw-outline-primary lw-whitespace-nowrap', {
|
|
23
20
|
'lw-bg-secondary lw-text-text-negative lw-border-secondary': variant === _types.ButtonVariant.primary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["_classnames","_interopRequireDefault","require","_react","_types","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["_classnames","_interopRequireDefault","require","_react","_types","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","Button","_ref","variant","ButtonVariant","primary","size","props","createElement","className","classNames","secondary","ButtonSize","xs","full","type","exports"],"sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport React from 'react';\n\nimport type { ButtonProps } from './types';\nimport { ButtonSize, ButtonVariant } from './types';\n\nconst Button = ({\n variant = ButtonVariant.primary,\n size,\n ...props\n}: ButtonProps) => (\n <button\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n className={classNames(\n 'lw-box-border lw-flex lw-justify-center lw-rounded lw-border lw-border-solid lw-px-4 lw-py-3 lw-text-center lw-font-sans lw-text-base lw-font-bold lw-leading-6 lw-tracking-normal focus:lw-outline-primary lw-whitespace-nowrap',\n {\n 'lw-bg-secondary lw-text-text-negative lw-border-secondary':\n variant === ButtonVariant.primary,\n 'lw-bg-bg-primary lw-text-text-primary lw-border-text-primary':\n variant === ButtonVariant.secondary,\n 'lw-w-[56px]': size === ButtonSize.xs,\n 'lw-w-full': size === ButtonSize.full,\n }\n )}\n data-testid=\"button\"\n type=\"button\"\n />\n);\n\nexport { Button };\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AAAoD,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAEpD,MAAMO,MAAM,GAAGC,IAAA;EAAA,IAAC;IACdC,OAAO,GAAGC,oBAAa,CAACC,OAAO;IAC/BC,IAAI;IACJ,GAAGC;EACQ,CAAC,GAAAL,IAAA;EAAA,OACZlB,MAAA,CAAAI,OAAA,CAAAoB,aAAA,WAAAnB,QAAA,KAEMkB,KAAK;IACTE,SAAS,EAAE,IAAAC,mBAAU,EACnB,kOAAkO,EAClO;MACE,2DAA2D,EACzDP,OAAO,KAAKC,oBAAa,CAACC,OAAO;MACnC,8DAA8D,EAC5DF,OAAO,KAAKC,oBAAa,CAACO,SAAS;MACrC,aAAa,EAAEL,IAAI,KAAKM,iBAAU,CAACC,EAAE;MACrC,WAAW,EAAEP,IAAI,KAAKM,iBAAU,CAACE;IACnC,CACF,CAAE;IACF,eAAY,QAAQ;IACpBC,IAAI,EAAC;EAAQ,EACd,CAAC;AAAA,CACH;AAACC,OAAA,CAAAf,MAAA,GAAAA,MAAA","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ const PriceCardRow = _ref => {
|
|
|
25
25
|
arrowPosition: _Price.ArrowPosition.left,
|
|
26
26
|
movementIndicator: "arrow",
|
|
27
27
|
priceMovement: priceMovement
|
|
28
|
-
}, _react.default.createElement("span", null, price
|
|
28
|
+
}, _react.default.createElement("span", null, price?.toFixed(displayPrecision))));
|
|
29
29
|
};
|
|
30
30
|
exports.PriceCardRow = PriceCardRow;
|
|
31
31
|
//# sourceMappingURL=PriceCardRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceCardRow.js","names":["_react","_interopRequireDefault","require","_Price","_Card","e","__esModule","default","PriceCardRow","_ref","priceMovement","price","displayPrecision","isLoading","isError","label","createElement","CardRow","undefined","Price","arrowPosition","ArrowPosition","left","movementIndicator","toFixed","exports"],"sources":["../../../../../src/components/Card/rows/PriceCardRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ArrowPosition, Price } from '../../Price';\nimport { CardRow } from '../Card';\n\ninterface PriceCardRowProps {\n priceMovement?: number;\n price?: number;\n displayPrecision?: number;\n isLoading?: boolean;\n isError: boolean;\n label: string;\n}\n\nexport const PriceCardRow = ({\n priceMovement,\n price,\n displayPrecision,\n isLoading,\n isError,\n label,\n}: PriceCardRowProps) => {\n return (\n <CardRow\n isError={isError}\n isLoading={isLoading || (price === undefined && !isError)}\n label={label}\n >\n <Price\n arrowPosition={ArrowPosition.left}\n movementIndicator=\"arrow\"\n priceMovement={priceMovement}\n >\n <span>{price?.toFixed(displayPrecision)}</span>\n </Price>\n </CardRow>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAkC,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAW3B,MAAMG,YAAY,GAAGC,IAAA,IAOH;EAAA,IAPI;IAC3BC,aAAa;IACbC,KAAK;IACLC,gBAAgB;IAChBC,SAAS;IACTC,OAAO;IACPC;EACiB,CAAC,GAAAN,IAAA;EAClB,OACET,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACZ,KAAA,CAAAa,OAAO;IACNH,OAAO,EAAEA,OAAQ;IACjBD,SAAS,EAAEA,SAAS,IAAKF,KAAK,KAAKO,SAAS,IAAI,CAACJ,OAAS;IAC1DC,KAAK,EAAEA;EAAM,GAEbf,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACb,MAAA,CAAAgB,KAAK;IACJC,aAAa,EAAEC,oBAAa,CAACC,IAAK;IAClCC,iBAAiB,EAAC,OAAO;IACzBb,aAAa,EAAEA;EAAc,GAE7BV,MAAA,CAAAO,OAAA,CAAAS,aAAA,eAAOL,KAAK,
|
|
1
|
+
{"version":3,"file":"PriceCardRow.js","names":["_react","_interopRequireDefault","require","_Price","_Card","e","__esModule","default","PriceCardRow","_ref","priceMovement","price","displayPrecision","isLoading","isError","label","createElement","CardRow","undefined","Price","arrowPosition","ArrowPosition","left","movementIndicator","toFixed","exports"],"sources":["../../../../../src/components/Card/rows/PriceCardRow.tsx"],"sourcesContent":["import React from 'react';\n\nimport { ArrowPosition, Price } from '../../Price';\nimport { CardRow } from '../Card';\n\ninterface PriceCardRowProps {\n priceMovement?: number;\n price?: number;\n displayPrecision?: number;\n isLoading?: boolean;\n isError: boolean;\n label: string;\n}\n\nexport const PriceCardRow = ({\n priceMovement,\n price,\n displayPrecision,\n isLoading,\n isError,\n label,\n}: PriceCardRowProps) => {\n return (\n <CardRow\n isError={isError}\n isLoading={isLoading || (price === undefined && !isError)}\n label={label}\n >\n <Price\n arrowPosition={ArrowPosition.left}\n movementIndicator=\"arrow\"\n priceMovement={priceMovement}\n >\n <span>{price?.toFixed(displayPrecision)}</span>\n </Price>\n </CardRow>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAAkC,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAW3B,MAAMG,YAAY,GAAGC,IAAA,IAOH;EAAA,IAPI;IAC3BC,aAAa;IACbC,KAAK;IACLC,gBAAgB;IAChBC,SAAS;IACTC,OAAO;IACPC;EACiB,CAAC,GAAAN,IAAA;EAClB,OACET,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACZ,KAAA,CAAAa,OAAO;IACNH,OAAO,EAAEA,OAAQ;IACjBD,SAAS,EAAEA,SAAS,IAAKF,KAAK,KAAKO,SAAS,IAAI,CAACJ,OAAS;IAC1DC,KAAK,EAAEA;EAAM,GAEbf,MAAA,CAAAO,OAAA,CAAAS,aAAA,CAACb,MAAA,CAAAgB,KAAK;IACJC,aAAa,EAAEC,oBAAa,CAACC,IAAK;IAClCC,iBAAiB,EAAC,OAAO;IACzBb,aAAa,EAAEA;EAAc,GAE7BV,MAAA,CAAAO,OAAA,CAAAS,aAAA,eAAOL,KAAK,EAAEa,OAAO,CAACZ,gBAAgB,CAAQ,CACzC,CACA,CAAC;AAEd,CAAC;AAACa,OAAA,CAAAjB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -8,23 +8,20 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _reactNumberFormat = require("react-number-format");
|
|
9
9
|
var _images = require("../../images");
|
|
10
10
|
var _Label = require("../Label");
|
|
11
|
-
const _excluded = ["label", "onIncrement", "onDecrement", "placeholder", "disabled", "decimalScale", "value", "withoutArrows"];
|
|
12
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
14
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
15
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
16
13
|
const NumberInput = _ref => {
|
|
17
14
|
let {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
label,
|
|
16
|
+
onIncrement,
|
|
17
|
+
onDecrement,
|
|
18
|
+
placeholder,
|
|
19
|
+
disabled,
|
|
20
|
+
decimalScale = 2,
|
|
21
|
+
value,
|
|
22
|
+
withoutArrows,
|
|
23
|
+
...props
|
|
24
|
+
} = _ref;
|
|
28
25
|
return _react.default.createElement("div", {
|
|
29
26
|
className: "lw-group lw-grid lw-w-full lw-max-w-full lw-items-center lw-gap-2 lw-text-text-primary"
|
|
30
27
|
}, _react.default.createElement(_Label.Label, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","names":["_react","_interopRequireDefault","require","_reactNumberFormat","_images","_Label","
|
|
1
|
+
{"version":3,"file":"NumberInput.js","names":["_react","_interopRequireDefault","require","_reactNumberFormat","_images","_Label","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","NumberInput","_ref","label","onIncrement","onDecrement","placeholder","disabled","decimalScale","value","withoutArrows","props","createElement","className","Label","htmlFor","NumericFormat","allowNegative","thousandSeparator","type","onClick","ArrowUpIcon","ArrowDownIcon","exports"],"sources":["../../../../src/components/Input/NumberInput.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\nimport type { FC } from 'react';\nimport React from 'react';\nimport { NumericFormat } from 'react-number-format';\n\nimport { ArrowDownIcon, ArrowUpIcon } from '../../images';\nimport { Label } from '../Label';\nimport type { NumberFormatInputProps } from './types';\n\nexport const NumberInput: FC<NumberFormatInputProps> = ({\n label,\n onIncrement,\n onDecrement,\n placeholder,\n disabled,\n decimalScale = 2,\n value,\n withoutArrows,\n ...props\n}) => (\n <div className=\"lw-group lw-grid lw-w-full lw-max-w-full lw-items-center lw-gap-2 lw-text-text-primary\">\n <Label className=\"lw-text-text-primary\" htmlFor={label}>\n {label}\n </Label>\n <div className=\"lw-flex lw-h-12 lw-w-full lw-rounded lw-border lw-px-3 lw-py-2 lw-text-sm lw-outline-2 lw-outline-offset-[-2px] lw-outline-primary focus-within:lw-outline\">\n <NumericFormat\n {...props}\n allowNegative={false}\n className=\"lw-w-full lw-bg-text-negative lw-text-sm focus:lw-outline-none\"\n decimalScale={decimalScale}\n disabled={disabled}\n placeholder={placeholder}\n thousandSeparator=\",\"\n value={value}\n />\n {!disabled && !withoutArrows && (\n <div className=\"lw-hidden lw-flex-col lw-justify-center group-hover:lw-flex\">\n <button\n className=\"lw-h-3 lw-justify-center focus:lw-outline-primary\"\n type=\"button\"\n onClick={onIncrement}\n >\n <ArrowUpIcon />\n </button>\n <button\n className=\"lw-justify-center focus:lw-outline-primary\"\n type=\"button\"\n onClick={onDecrement}\n >\n <ArrowDownIcon />\n </button>\n </div>\n )}\n </div>\n </div>\n);\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAiC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAG1B,MAAMO,WAAuC,GAAGC,IAAA;EAAA,IAAC;IACtDC,KAAK;IACLC,WAAW;IACXC,WAAW;IACXC,WAAW;IACXC,QAAQ;IACRC,YAAY,GAAG,CAAC;IAChBC,KAAK;IACLC,aAAa;IACb,GAAGC;EACL,CAAC,GAAAT,IAAA;EAAA,OACCtB,MAAA,CAAAQ,OAAA,CAAAwB,aAAA;IAAKC,SAAS,EAAC;EAAwF,GACrGjC,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC3B,MAAA,CAAA6B,KAAK;IAACD,SAAS,EAAC,sBAAsB;IAACE,OAAO,EAAEZ;EAAM,GACpDA,KACI,CAAC,EACRvB,MAAA,CAAAQ,OAAA,CAAAwB,aAAA;IAAKC,SAAS,EAAC;EAA4J,GACzKjC,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC7B,kBAAA,CAAAiC,aAAa,EAAA3B,QAAA,KACRsB,KAAK;IACTM,aAAa,EAAE,KAAM;IACrBJ,SAAS,EAAC,gEAAgE;IAC1EL,YAAY,EAAEA,YAAa;IAC3BD,QAAQ,EAAEA,QAAS;IACnBD,WAAW,EAAEA,WAAY;IACzBY,iBAAiB,EAAC,GAAG;IACrBT,KAAK,EAAEA;EAAM,EACd,CAAC,EACD,CAACF,QAAQ,IAAI,CAACG,aAAa,IAC1B9B,MAAA,CAAAQ,OAAA,CAAAwB,aAAA;IAAKC,SAAS,EAAC;EAA6D,GAC1EjC,MAAA,CAAAQ,OAAA,CAAAwB,aAAA;IACEC,SAAS,EAAC,mDAAmD;IAC7DM,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAEhB;EAAY,GAErBxB,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC5B,OAAA,CAAAqC,WAAW,MAAE,CACR,CAAC,EACTzC,MAAA,CAAAQ,OAAA,CAAAwB,aAAA;IACEC,SAAS,EAAC,4CAA4C;IACtDM,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAEf;EAAY,GAErBzB,MAAA,CAAAQ,OAAA,CAAAwB,aAAA,CAAC5B,OAAA,CAAAsC,aAAa,MAAE,CACV,CACL,CAEJ,CACF,CAAC;AAAA,CACP;AAACC,OAAA,CAAAtB,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -12,7 +12,6 @@ var _Price = require("../Price");
|
|
|
12
12
|
var _Truncate = require("../Truncate");
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
14
|
const InstrumentRate = _ref => {
|
|
15
|
-
var _record$buy;
|
|
16
15
|
let {
|
|
17
16
|
isError,
|
|
18
17
|
record,
|
|
@@ -24,7 +23,7 @@ const InstrumentRate = _ref => {
|
|
|
24
23
|
const {
|
|
25
24
|
isDark
|
|
26
25
|
} = (0, _providers.useLayoutProvider)();
|
|
27
|
-
const checkLoading = id => !isError &&
|
|
26
|
+
const checkLoading = id => !isError && record?.[id] === undefined;
|
|
28
27
|
const isExpanded = size === 'full' || size === 'fullWithChart';
|
|
29
28
|
return _react.default.createElement("div", {
|
|
30
29
|
className: (0, _tailwind.cn)('lw-flex lw-flex-col', isExpanded && 'lw-h-full'),
|
|
@@ -51,7 +50,7 @@ const InstrumentRate = _ref => {
|
|
|
51
50
|
}, _react.default.createElement(_Price.Price, {
|
|
52
51
|
movementIndicator: "text",
|
|
53
52
|
priceMovement: record.buyPriceMovement
|
|
54
|
-
}, _react.default.createElement("span", null,
|
|
53
|
+
}, _react.default.createElement("span", null, record.buy?.toFixed(record.displayPrecision)))))), isExpanded && _react.default.createElement("div", {
|
|
55
54
|
className: (0, _tailwind.cn)('lw-flex lw-h-1/2 lw-w-fit lw-items-center lw-gap-x-2 lw-pr-2.5', !isDark && 'lw-bg-whiteOpacity', isDark && 'lw-bg-blackOpacity', !slim && 'lw-py-1', slim && 'lw-pb-1'),
|
|
56
55
|
"data-testid": "instrument-rate-wrapper-expanded"
|
|
57
56
|
}, _react.default.createElement(_LabelWrapper.LabelWrapper, {
|
|
@@ -67,7 +66,7 @@ const InstrumentRate = _ref => {
|
|
|
67
66
|
size: _LabelWrapper.LabelSize.sm
|
|
68
67
|
}, _react.default.createElement("span", {
|
|
69
68
|
className: (0, _tailwind.cn)('lw-font-bold', indicator > 0 && 'lw-text-text-ok', indicator < 0 && 'lw-text-text-danger', indicator === 0 && 'lw-text-text-disabled')
|
|
70
|
-
},
|
|
69
|
+
}, `(${record.dailyPipsChange})`))));
|
|
71
70
|
};
|
|
72
71
|
exports.InstrumentRate = InstrumentRate;
|
|
73
72
|
//# sourceMappingURL=InstrumentRate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstrumentRate.js","names":["_react","_interopRequireDefault","require","_providers","_tailwind","_LabelWrapper","_Price","_Truncate","e","__esModule","default","InstrumentRate","_ref","
|
|
1
|
+
{"version":3,"file":"InstrumentRate.js","names":["_react","_interopRequireDefault","require","_providers","_tailwind","_LabelWrapper","_Price","_Truncate","e","__esModule","default","InstrumentRate","_ref","isError","record","tooltipId","size","slim","colorIndicator","indicator","isDark","useLayoutProvider","checkLoading","id","undefined","isExpanded","createElement","className","cn","LabelWrapper","isLoading","LabelSize","lg","Truncate","maxWidth","text","displayName","Price","movementIndicator","priceMovement","buyPriceMovement","buy","toFixed","displayPrecision","sm","dailyPercentChange","withoutLoader","dailyPipsChange","exports"],"sources":["../../../../src/components/InstrumentRate/InstrumentRate.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useLayoutProvider } from '../../providers';\nimport { cn } from '../../tailwind';\nimport { LabelSize, LabelWrapper } from '../LabelWrapper';\nimport { Price } from '../Price';\nimport { Truncate } from '../Truncate';\nimport type { InstrumentRateProps } from './types';\n\nconst InstrumentRate = ({\n isError,\n record,\n tooltipId,\n size,\n slim,\n colorIndicator: indicator,\n}: InstrumentRateProps) => {\n const { isDark } = useLayoutProvider();\n const checkLoading = (id: string) => !isError && record?.[id] === undefined;\n const isExpanded = size === 'full' || size === 'fullWithChart';\n\n return (\n <div\n className={cn('lw-flex lw-flex-col', isExpanded && 'lw-h-full')}\n data-testid=\"instrument-rate-wrapper\"\n >\n <div\n className={cn(\n 'lw-flex lw-gap-x-2 lw-text-xl',\n isExpanded && 'lw-h-1/2',\n !slim && 'lw-py-2',\n slim && 'lw-py-1'\n )}\n data-testid=\"instrument-rate-wrapper-label\"\n >\n <LabelWrapper\n isError={!!isError}\n isLoading={checkLoading('instrument')}\n size={LabelSize.lg}\n >\n <span className=\"lw-font-bold\">\n <Truncate\n maxWidth={100}\n text={record.displayName}\n tooltipId={tooltipId}\n />\n </span>\n </LabelWrapper>\n <LabelWrapper\n isError={!!isError}\n isLoading={checkLoading('buy')}\n size={LabelSize.lg}\n >\n <div className=\"lw-font-bold\">\n <Price\n movementIndicator=\"text\"\n priceMovement={record.buyPriceMovement}\n >\n <span>{record.buy?.toFixed(record.displayPrecision)}</span>\n </Price>\n </div>\n </LabelWrapper>\n </div>\n {isExpanded && (\n <div\n className={cn(\n 'lw-flex lw-h-1/2 lw-w-fit lw-items-center lw-gap-x-2 lw-pr-2.5',\n !isDark && 'lw-bg-whiteOpacity',\n isDark && 'lw-bg-blackOpacity',\n !slim && 'lw-py-1',\n slim && 'lw-pb-1'\n )}\n data-testid=\"instrument-rate-wrapper-expanded\"\n >\n <LabelWrapper\n isError={!!isError}\n isLoading={checkLoading('dailyPercentChange')}\n size={LabelSize.sm}\n >\n <span\n className={cn(\n 'lw-font-bold',\n indicator > 0 && 'lw-text-text-ok',\n indicator < 0 && 'lw-text-text-danger',\n indicator === 0 && 'lw-text-text-disabled'\n )}\n >\n {record.dailyPercentChange}\n </span>\n </LabelWrapper>\n <LabelWrapper\n withoutLoader\n isError={!!isError}\n isLoading={checkLoading('dailyPipsChange')}\n size={LabelSize.sm}\n >\n <span\n className={cn(\n 'lw-font-bold',\n indicator > 0 && 'lw-text-text-ok',\n indicator < 0 && 'lw-text-text-danger',\n indicator === 0 && 'lw-text-text-disabled'\n )}\n >\n {`(${record.dailyPipsChange})`}\n </span>\n </LabelWrapper>\n </div>\n )}\n </div>\n );\n};\n\nexport { InstrumentRate };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAAuC,SAAAD,uBAAAO,CAAA,WAA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B,kBACJ,CACM,CAAC,EACf7C,MAAA,CAAAU,OAAA,CAAAgB,aAAA,CAACrB,aAAA,CAAAwB,YAAY;IACXiB,aAAa;IACbjC,OAAO,EAAE,CAAC,CAACA,OAAQ;IACnBiB,SAAS,EAAER,YAAY,CAAC,iBAAiB,CAAE;IAC3CN,IAAI,EAAEe,uBAAS,CAACa;EAAG,GAEnB5C,MAAA,CAAAU,OAAA,CAAAgB,aAAA;IACEC,SAAS,EAAE,IAAAC,YAAE,EACX,cAAc,EACdT,SAAS,GAAG,CAAC,IAAI,iBAAiB,EAClCA,SAAS,GAAG,CAAC,IAAI,qBAAqB,EACtCA,SAAS,KAAK,CAAC,IAAI,uBACrB;EAAE,GAED,IAAIL,MAAM,CAACiC,eAAe,GACvB,CACM,CACX,CAEJ,CAAC;AAEV,CAAC;AAACC,OAAA,CAAArC,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -26,7 +26,7 @@ function InstrumentRateWithChart(_ref) {
|
|
|
26
26
|
const {
|
|
27
27
|
updatedRecord,
|
|
28
28
|
error
|
|
29
|
-
} = (0, _hooks.useRecords)(record, record
|
|
29
|
+
} = (0, _hooks.useRecords)(record, record?.instrument ? target : null);
|
|
30
30
|
const indicator = (0, _utils.getColorIndicator)(updatedRecord.dailyPercentChange);
|
|
31
31
|
return _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_InstrumentRate.InstrumentRate, {
|
|
32
32
|
colorIndicator: indicator,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstrumentRateWithChart.js","names":["_react","_interopRequireDefault","require","_hooks","_providers","_LineChart","_InstrumentRate","_utils","e","__esModule","default","InstrumentRateWithChart","_ref","record","target","tooltipId","size","queryRef","slim","isDark","useLayoutProvider","updatedRecord","error","useRecords","instrument","indicator","getColorIndicator","dailyPercentChange","createElement","Fragment","InstrumentRate","colorIndicator","isError","LineChartWithData","color","getChartColor"],"sources":["../../../../src/components/InstrumentRate/InstrumentRateWithChart.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useRecords } from '../../hooks';\nimport { useLayoutProvider } from '../../providers';\nimport { LineChartWithData } from '../LineChart';\nimport { InstrumentRate } from './InstrumentRate';\nimport type { InstrumentRateWithChartProps } from './types';\nimport { getChartColor, getColorIndicator } from './utils';\n\nfunction InstrumentRateWithChart<T>({\n record,\n target,\n tooltipId,\n size,\n queryRef,\n slim,\n}: InstrumentRateWithChartProps<T>) {\n const { isDark } = useLayoutProvider();\n const { updatedRecord, error } = useRecords(\n record,\n record?.instrument ? target : null\n );\n\n const indicator = getColorIndicator(updatedRecord.dailyPercentChange);\n\n return (\n <>\n <InstrumentRate\n colorIndicator={indicator}\n isError={!!error}\n record={updatedRecord}\n size={size}\n slim={slim}\n tooltipId={tooltipId}\n />\n {size === 'fullWithChart' && (\n <LineChartWithData<T>\n color={getChartColor(indicator, isDark)}\n queryRef={queryRef}\n />\n )}\n </>\n );\n}\n\nexport { InstrumentRateWithChart };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAA2D,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3D,SAASG,uBAAuBA,CAAAC,IAAA,EAOI;EAAA,IAPA;IAClCC,MAAM;IACNC,MAAM;IACNC,SAAS;IACTC,IAAI;IACJC,QAAQ;IACRC;EAC+B,CAAC,GAAAN,IAAA;EAChC,MAAM;IAAEO;EAAO,CAAC,GAAG,IAAAC,4BAAiB,EAAC,CAAC;EACtC,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAG,IAAAC,iBAAU,EACzCV,MAAM,EACNA,MAAM,
|
|
1
|
+
{"version":3,"file":"InstrumentRateWithChart.js","names":["_react","_interopRequireDefault","require","_hooks","_providers","_LineChart","_InstrumentRate","_utils","e","__esModule","default","InstrumentRateWithChart","_ref","record","target","tooltipId","size","queryRef","slim","isDark","useLayoutProvider","updatedRecord","error","useRecords","instrument","indicator","getColorIndicator","dailyPercentChange","createElement","Fragment","InstrumentRate","colorIndicator","isError","LineChartWithData","color","getChartColor"],"sources":["../../../../src/components/InstrumentRate/InstrumentRateWithChart.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useRecords } from '../../hooks';\nimport { useLayoutProvider } from '../../providers';\nimport { LineChartWithData } from '../LineChart';\nimport { InstrumentRate } from './InstrumentRate';\nimport type { InstrumentRateWithChartProps } from './types';\nimport { getChartColor, getColorIndicator } from './utils';\n\nfunction InstrumentRateWithChart<T>({\n record,\n target,\n tooltipId,\n size,\n queryRef,\n slim,\n}: InstrumentRateWithChartProps<T>) {\n const { isDark } = useLayoutProvider();\n const { updatedRecord, error } = useRecords(\n record,\n record?.instrument ? target : null\n );\n\n const indicator = getColorIndicator(updatedRecord.dailyPercentChange);\n\n return (\n <>\n <InstrumentRate\n colorIndicator={indicator}\n isError={!!error}\n record={updatedRecord}\n size={size}\n slim={slim}\n tooltipId={tooltipId}\n />\n {size === 'fullWithChart' && (\n <LineChartWithData<T>\n color={getChartColor(indicator, isDark)}\n queryRef={queryRef}\n />\n )}\n </>\n );\n}\n\nexport { InstrumentRateWithChart };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAA2D,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3D,SAASG,uBAAuBA,CAAAC,IAAA,EAOI;EAAA,IAPA;IAClCC,MAAM;IACNC,MAAM;IACNC,SAAS;IACTC,IAAI;IACJC,QAAQ;IACRC;EAC+B,CAAC,GAAAN,IAAA;EAChC,MAAM;IAAEO;EAAO,CAAC,GAAG,IAAAC,4BAAiB,EAAC,CAAC;EACtC,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAG,IAAAC,iBAAU,EACzCV,MAAM,EACNA,MAAM,EAAEW,UAAU,GAAGV,MAAM,GAAG,IAChC,CAAC;EAED,MAAMW,SAAS,GAAG,IAAAC,wBAAiB,EAACL,aAAa,CAACM,kBAAkB,CAAC;EAErE,OACE3B,MAAA,CAAAU,OAAA,CAAAkB,aAAA,CAAA5B,MAAA,CAAAU,OAAA,CAAAmB,QAAA,QACE7B,MAAA,CAAAU,OAAA,CAAAkB,aAAA,CAACtB,eAAA,CAAAwB,cAAc;IACbC,cAAc,EAAEN,SAAU;IAC1BO,OAAO,EAAE,CAAC,CAACV,KAAM;IACjBT,MAAM,EAAEQ,aAAc;IACtBL,IAAI,EAAEA,IAAK;IACXE,IAAI,EAAEA,IAAK;IACXH,SAAS,EAAEA;EAAU,CACtB,CAAC,EACDC,IAAI,KAAK,eAAe,IACvBhB,MAAA,CAAAU,OAAA,CAAAkB,aAAA,CAACvB,UAAA,CAAA4B,iBAAiB;IAChBC,KAAK,EAAE,IAAAC,oBAAa,EAACV,SAAS,EAAEN,MAAM,CAAE;IACxCF,QAAQ,EAAEA;EAAS,CACpB,CAEH,CAAC;AAEP","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getColorIndicator = exports.getChartColor = void 0;
|
|
7
7
|
var _labsWidgetCommon = require("@oanda/labs-widget-common");
|
|
8
8
|
const getColorIndicator = dailyChange => {
|
|
9
|
-
const numberValue = Number(dailyChange
|
|
9
|
+
const numberValue = Number(dailyChange?.substring(0, dailyChange.length - 1));
|
|
10
10
|
return Math.sign(numberValue);
|
|
11
11
|
};
|
|
12
12
|
exports.getColorIndicator = getColorIndicator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["_labsWidgetCommon","require","getColorIndicator","dailyChange","numberValue","Number","substring","length","Math","sign","exports","getChartColor","indicator","isDarkMode","theme","Theme","Dark","Light","themeColors","textOk","textDanger","textDisabled"],"sources":["../../../../src/components/InstrumentRate/utils.ts"],"sourcesContent":["import { Theme, themeColors } 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 ? Theme.Dark : Theme.Light;\n\n switch (indicator) {\n case 1:\n return themeColors.textOk[theme];\n case -1:\n return themeColors.textDanger[theme];\n default:\n return themeColors.textDisabled[theme];\n }\n};\n\nexport { getChartColor, getColorIndicator };\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,MAAMC,iBAAiB,GAAIC,WAAoB,IAAK;EAClD,MAAMC,WAAW,GAAGC,MAAM,CAACF,WAAW,
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_labsWidgetCommon","require","getColorIndicator","dailyChange","numberValue","Number","substring","length","Math","sign","exports","getChartColor","indicator","isDarkMode","theme","Theme","Dark","Light","themeColors","textOk","textDanger","textDisabled"],"sources":["../../../../src/components/InstrumentRate/utils.ts"],"sourcesContent":["import { Theme, themeColors } 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 ? Theme.Dark : Theme.Light;\n\n switch (indicator) {\n case 1:\n return themeColors.textOk[theme];\n case -1:\n return themeColors.textDanger[theme];\n default:\n return themeColors.textDisabled[theme];\n }\n};\n\nexport { getChartColor, getColorIndicator };\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,uBAAK,CAACC,IAAI,GAAGD,uBAAK,CAACE,KAAK;EAEnD,QAAQL,SAAS;IACf,KAAK,CAAC;MACJ,OAAOM,6BAAW,CAACC,MAAM,CAACL,KAAK,CAAC;IAClC,KAAK,CAAC,CAAC;MACL,OAAOI,6BAAW,CAACE,UAAU,CAACN,KAAK,CAAC;IACtC;MACE,OAAOI,6BAAW,CAACG,YAAY,CAACP,KAAK,CAAC;EAC1C;AACF,CAAC;AAACJ,OAAA,CAAAC,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -6,16 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Label = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _tailwind = require("../../tailwind");
|
|
9
|
-
const _excluded = ["className"];
|
|
10
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
10
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
13
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
14
11
|
const Label = exports.Label = _react.default.forwardRef((_ref, ref) => {
|
|
15
12
|
let {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
} = _ref;
|
|
19
16
|
return _react.default.createElement("label", _extends({}, props, {
|
|
20
17
|
ref: ref,
|
|
21
18
|
className: (0, _tailwind.cn)('lw-font-sans lw-text-base lw-font-medium lw-leading-none peer-disabled:lw-cursor-not-allowed peer-disabled:lw-opacity-70', className)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","names":["_react","_interopRequireDefault","require","_tailwind","
|
|
1
|
+
{"version":3,"file":"Label.js","names":["_react","_interopRequireDefault","require","_tailwind","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","Label","exports","React","forwardRef","_ref","ref","className","props","createElement","cn","displayName"],"sources":["../../../../src/components/Label/Label.tsx"],"sourcesContent":["/* eslint-disable react/jsx-props-no-spreading */\n/* eslint-disable jsx-a11y/label-has-associated-control */\nimport React from 'react';\n\nimport { cn } from '../../tailwind';\n\ninterface LabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {}\n\nconst Label = React.forwardRef<HTMLLabelElement, LabelProps>(\n ({ className, ...props }, ref) => (\n <label\n {...props}\n ref={ref}\n className={cn(\n 'lw-font-sans lw-text-base lw-font-medium lw-leading-none peer-disabled:lw-cursor-not-allowed peer-disabled:lw-opacity-70',\n className\n )}\n />\n )\n);\nLabel.displayName = 'Label';\n\nexport { Label };\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAAoC,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAP,CAAA,MAAAA,CAAA,GAAAQ,SAAA,CAAAC,MAAA,EAAAT,CAAA,UAAAU,CAAA,GAAAF,SAAA,CAAAR,CAAA,YAAAW,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD,CAAA,CAAAC,CAAA,aAAAJ,CAAA,KAAAJ,QAAA,CAAAW,KAAA,OAAAN,SAAA;AAIpC,MAAMO,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAGE,cAAK,CAACC,UAAU,CAC5B,CAAAC,IAAA,EAA0BC,GAAG;EAAA,IAA5B;IAAEC,SAAS;IAAE,GAAGC;EAAM,CAAC,GAAAH,IAAA;EAAA,OACtBvB,MAAA,CAAAM,OAAA,CAAAqB,aAAA,UAAApB,QAAA,KACMmB,KAAK;IACTF,GAAG,EAAEA,GAAI;IACTC,SAAS,EAAE,IAAAG,YAAE,EACX,0HAA0H,EAC1HH,SACF;EAAE,EACH,CAAC;AAAA,CAEN,CAAC;AACDN,KAAK,CAACU,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
@@ -16,7 +16,7 @@ const LastUpdated = _ref => {
|
|
|
16
16
|
return _react.default.createElement("span", {
|
|
17
17
|
className: "lw-ml-1 lw-font-sans lw-text-xs lw-font-bold",
|
|
18
18
|
"data-testid": "last-updated"
|
|
19
|
-
},
|
|
19
|
+
}, `${labelCallback('last_updated')}: ${timestamp?.endsWith('Z') ? (0, _utils.formatUpdatedTimestamp)(timestamp, labelCallback('today')) : _constants.EMPTY_VALUE}`);
|
|
20
20
|
};
|
|
21
21
|
exports.LastUpdated = LastUpdated;
|
|
22
22
|
//# sourceMappingURL=LastUpdated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LastUpdated.js","names":["_react","_interopRequireDefault","require","_constants","_utils","e","__esModule","default","LastUpdated","_ref","timestamp","labelCallback","createElement","className","
|
|
1
|
+
{"version":3,"file":"LastUpdated.js","names":["_react","_interopRequireDefault","require","_constants","_utils","e","__esModule","default","LastUpdated","_ref","timestamp","labelCallback","createElement","className","endsWith","formatUpdatedTimestamp","EMPTY_VALUE","exports"],"sources":["../../../../src/components/LastUpdated/LastUpdated.tsx"],"sourcesContent":["import React from 'react';\n\nimport { EMPTY_VALUE } from '../../constants';\nimport { formatUpdatedTimestamp } from '../../utils';\nimport type { LastUpdatedProps } from './types';\n\nconst LastUpdated = ({ timestamp, labelCallback }: LastUpdatedProps) => (\n <span\n className=\"lw-ml-1 lw-font-sans lw-text-xs lw-font-bold\"\n data-testid=\"last-updated\"\n >\n {`${labelCallback('last_updated')}: ${timestamp?.endsWith('Z') ? formatUpdatedTimestamp(timestamp, labelCallback('today')) : EMPTY_VALUE}`}\n </span>\n);\n\nexport { LastUpdated };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAAqD,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGrD,MAAMG,WAAW,GAAGC,IAAA;EAAA,IAAC;IAAEC,SAAS;IAAEC;EAAgC,CAAC,GAAAF,IAAA;EAAA,OACjET,MAAA,CAAAO,OAAA,CAAAK,aAAA;IACEC,SAAS,EAAC,8CAA8C;IACxD,eAAY;EAAc,GAEzB,GAAGF,aAAa,CAAC,cAAc,CAAC,KAAKD,SAAS,EAAEI,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAAC,6BAAsB,EAACL,SAAS,EAAEC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAGK,sBAAW,EACpI,CAAC;AAAA,CACR;AAACC,OAAA,CAAAT,WAAA,GAAAA,WAAA","ignoreList":[]}
|
|
@@ -38,10 +38,10 @@ const LineChart = _ref => {
|
|
|
38
38
|
className: "lw-font-sans",
|
|
39
39
|
"data-testid": "line-chart-empty-value"
|
|
40
40
|
}, _constant.CELL_EMPTY_VALUE), data.length >= _constant.CHART_DEFAULT_POINTS_NUMBER && _react.default.createElement("div", {
|
|
41
|
-
className:
|
|
41
|
+
className: `${sizes[size].class}`,
|
|
42
42
|
"data-testid": "line-chart"
|
|
43
43
|
}, _react.default.createElement("svg", {
|
|
44
|
-
viewBox:
|
|
44
|
+
viewBox: `0 0 ${sizes[size].width} ${sizes[size].height}`,
|
|
45
45
|
xmlns: "http://www.w3.org/2000/svg"
|
|
46
46
|
}, _react.default.createElement("path", {
|
|
47
47
|
d: svgPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.js","names":["_react","_interopRequireDefault","require","_constant","_types","_utils","e","__esModule","default","sizes","xs","class","width","height","sm","LineChart","_ref","data","color","size","LineChartSize","padding","svgPath","getSvgPath","createElement","Fragment","length","CHART_DEFAULT_POINTS_NUMBER","className","CELL_EMPTY_VALUE","
|
|
1
|
+
{"version":3,"file":"LineChart.js","names":["_react","_interopRequireDefault","require","_constant","_types","_utils","e","__esModule","default","sizes","xs","class","width","height","sm","LineChart","_ref","data","color","size","LineChartSize","padding","svgPath","getSvgPath","createElement","Fragment","length","CHART_DEFAULT_POINTS_NUMBER","className","CELL_EMPTY_VALUE","viewBox","xmlns","d","fill","stroke","strokeLinecap","strokeWidth","exports"],"sources":["../../../../src/components/LineChart/LineChart.tsx"],"sourcesContent":["import React from 'react';\n\nimport { CELL_EMPTY_VALUE, CHART_DEFAULT_POINTS_NUMBER } from '../constant';\nimport type { LineChartProps, SizeConfig } from './types';\nimport { LineChartSize } from './types';\nimport { getSvgPath } from './utils';\n\nconst sizes: { [key in LineChartSize]: SizeConfig } = {\n xs: {\n class: 'lw-h-[24px] lw-w-[100px]',\n width: 100,\n height: 24,\n },\n sm: {\n class: 'lw-h-[40px] lw-w-[100px]',\n width: 100,\n height: 40,\n },\n};\n\nconst LineChart = ({\n data,\n color,\n size = LineChartSize.sm,\n padding = 8,\n}: LineChartProps) => {\n const svgPath = getSvgPath({\n data,\n width: sizes[size].width,\n height: sizes[size].height,\n padding,\n });\n\n return (\n <>\n {data.length < CHART_DEFAULT_POINTS_NUMBER && (\n <span className=\"lw-font-sans\" data-testid=\"line-chart-empty-value\">\n {CELL_EMPTY_VALUE}\n </span>\n )}\n {data.length >= CHART_DEFAULT_POINTS_NUMBER && (\n <div className={`${sizes[size].class}`} data-testid=\"line-chart\">\n <svg\n viewBox={`0 0 ${sizes[size].width} ${sizes[size].height}`}\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d={svgPath}\n fill=\"none\"\n stroke={color}\n strokeLinecap=\"round\"\n strokeWidth={1}\n />\n </svg>\n </div>\n )}\n </>\n );\n};\n\nexport { LineChart };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAqC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAErC,MAAMG,KAA6C,GAAG;EACpDC,EAAE,EAAE;IACFC,KAAK,EAAE,0BAA0B;IACjCC,KA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