@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
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
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; }
|
|
2
|
-
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; }
|
|
3
|
-
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; }
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
|
-
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); }
|
|
6
1
|
import { getLineCommons } from './sharedOptions';
|
|
7
2
|
export const getGridLines = _ref => {
|
|
8
3
|
let {
|
|
@@ -16,7 +11,8 @@ export const getGridLines = _ref => {
|
|
|
16
11
|
marginBottom = 0,
|
|
17
12
|
yLabelMarinTop = 0
|
|
18
13
|
} = _ref;
|
|
19
|
-
return [
|
|
14
|
+
return [{
|
|
15
|
+
...getLineCommons(isDark),
|
|
20
16
|
top: -2,
|
|
21
17
|
shape: {
|
|
22
18
|
x1: 0,
|
|
@@ -24,7 +20,8 @@ export const getGridLines = _ref => {
|
|
|
24
20
|
x2: chartWidth,
|
|
25
21
|
y2: 0
|
|
26
22
|
}
|
|
27
|
-
}
|
|
23
|
+
}, {
|
|
24
|
+
...getLineCommons(isDark),
|
|
28
25
|
right: -2,
|
|
29
26
|
shape: {
|
|
30
27
|
x1: 0,
|
|
@@ -32,7 +29,8 @@ export const getGridLines = _ref => {
|
|
|
32
29
|
x2: 0,
|
|
33
30
|
y2: chartHeight - marginBottom
|
|
34
31
|
}
|
|
35
|
-
}
|
|
32
|
+
}, {
|
|
33
|
+
...getLineCommons(isDark),
|
|
36
34
|
bottom: -2 + marginBottom,
|
|
37
35
|
shape: {
|
|
38
36
|
x1: 0,
|
|
@@ -40,7 +38,8 @@ export const getGridLines = _ref => {
|
|
|
40
38
|
x2: chartWidth,
|
|
41
39
|
y2: 0
|
|
42
40
|
}
|
|
43
|
-
}
|
|
41
|
+
}, {
|
|
42
|
+
...getLineCommons(isDark),
|
|
44
43
|
left: -2,
|
|
45
44
|
shape: {
|
|
46
45
|
x1: 0,
|
|
@@ -48,7 +47,8 @@ export const getGridLines = _ref => {
|
|
|
48
47
|
x2: 0,
|
|
49
48
|
y2: chartHeight - marginBottom
|
|
50
49
|
}
|
|
51
|
-
}
|
|
50
|
+
}, {
|
|
51
|
+
...getLineCommons(isDark),
|
|
52
52
|
right: yLabelSize - 3,
|
|
53
53
|
bottom: bottomLeftBox ? -2 + marginBottom : xLabelsSize - 3,
|
|
54
54
|
shape: {
|
|
@@ -57,7 +57,8 @@ export const getGridLines = _ref => {
|
|
|
57
57
|
x2: 0,
|
|
58
58
|
y2: chartHeight - yLabelMarinTop
|
|
59
59
|
}
|
|
60
|
-
}
|
|
60
|
+
}, {
|
|
61
|
+
...getLineCommons(isDark),
|
|
61
62
|
bottom: xLabelsSize - 3,
|
|
62
63
|
shape: {
|
|
63
64
|
x1: 0,
|
|
@@ -65,7 +66,8 @@ export const getGridLines = _ref => {
|
|
|
65
66
|
x2: chartWidth,
|
|
66
67
|
y2: 0
|
|
67
68
|
}
|
|
68
|
-
}
|
|
69
|
+
}, ...additionalLines.map(item => ({
|
|
70
|
+
...getLineCommons(isDark),
|
|
69
71
|
top: item.top,
|
|
70
72
|
bottom: item.bottom,
|
|
71
73
|
left: item.left,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGridLines.js","names":["getLineCommons","getGridLines","_ref","isDark","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","additionalLines","marginBottom","yLabelMarinTop","
|
|
1
|
+
{"version":3,"file":"getGridLines.js","names":["getLineCommons","getGridLines","_ref","isDark","chartWidth","chartHeight","xLabelsSize","yLabelSize","bottomLeftBox","additionalLines","marginBottom","yLabelMarinTop","top","shape","x1","y1","x2","y2","right","bottom","left","map","item"],"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,SAASA,cAAc,QAAQ,iBAAiB;AAEhD,OAAO,MAAMC,YAAY,GAAGC,IAAA;EAAA,IAAC;IAC3BC,MAAM;IACNC,UAAU;IACVC,WAAW;IACXC,WAAW;IACXC,UAAU;IACVC,aAAa,GAAG,IAAI;IACpBC,eAAe,GAAG,EAAE;IACpBC,YAAY,GAAG,CAAC;IAChBC,cAAc,GAAG;EAoBnB,CAAC,GAAAT,IAAA;EAAA,OAAK,CAEJ;IACE,GAAGF,cAAc,CAACG,MAAM,CAAC;IACzBS,GAAG,EAAE,CAAC,CAAC;IACPC,KAAK,EAAE;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAE,CAAC;MACLC,EAAE,EAAEZ,UAAU;MACda,EAAE,EAAE;IACN;EACF,CAAC,EAED;IACE,GAAGjB,cAAc,CAACG,MAAM,CAAC;IACzBe,KAAK,EAAE,CAAC,CAAC;IACTL,KAAK,EAAE;MACLC,EAAE,EAAE,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AAI,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","ignoreList":[]}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
const _excluded = ["variant", "size"];
|
|
2
1
|
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
2
|
import classNames from 'classnames';
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import { ButtonSize, ButtonVariant } from './types';
|
|
8
5
|
const Button = _ref => {
|
|
9
6
|
let {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
variant = ButtonVariant.primary,
|
|
8
|
+
size,
|
|
9
|
+
...props
|
|
10
|
+
} = _ref;
|
|
14
11
|
return React.createElement("button", _extends({}, props, {
|
|
15
12
|
className: classNames('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', {
|
|
16
13
|
'lw-bg-secondary lw-text-text-negative lw-border-secondary': variant === ButtonVariant.primary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["classNames","React","ButtonSize","ButtonVariant","Button","_ref","variant","primary","size","props","
|
|
1
|
+
{"version":3,"file":"Button.js","names":["classNames","React","ButtonSize","ButtonVariant","Button","_ref","variant","primary","size","props","createElement","_extends","className","secondary","xs","full","type"],"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,OAAOA,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,OAAO;AAGzB,SAASC,UAAU,EAAEC,aAAa,QAAQ,SAAS;AAEnD,MAAMC,MAAM,GAAGC,IAAA;EAAA,IAAC;IACdC,OAAO,GAAGH,aAAa,CAACI,OAAO;IAC/BC,IAAI;IACJ,GAAGC;EACQ,CAAC,GAAAJ,IAAA;EAAA,OACZJ,KAAA,CAAAS,aAAA,WAAAC,QAAA,KAEMF,KAAK;IACTG,SAAS,EAAEZ,UAAU,CACnB,kOAAkO,EAClO;MACE,2DAA2D,EACzDM,OAAO,KAAKH,aAAa,CAACI,OAAO;MACnC,8DAA8D,EAC5DD,OAAO,KAAKH,aAAa,CAACU,SAAS;MACrC,aAAa,EAAEL,IAAI,KAAKN,UAAU,CAACY,EAAE;MACrC,WAAW,EAAEN,IAAI,KAAKN,UAAU,CAACa;IACnC,CACF,CAAE;IACF,eAAY,QAAQ;IACpBC,IAAI,EAAC;EAAQ,EACd,CAAC;AAAA,CACH;AAED,SAASZ,MAAM","ignoreList":[]}
|
|
@@ -18,6 +18,6 @@ export const PriceCardRow = _ref => {
|
|
|
18
18
|
arrowPosition: ArrowPosition.left,
|
|
19
19
|
movementIndicator: "arrow",
|
|
20
20
|
priceMovement: priceMovement
|
|
21
|
-
}, React.createElement("span", null, price
|
|
21
|
+
}, React.createElement("span", null, price?.toFixed(displayPrecision))));
|
|
22
22
|
};
|
|
23
23
|
//# sourceMappingURL=PriceCardRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PriceCardRow.js","names":["React","ArrowPosition","Price","CardRow","PriceCardRow","_ref","priceMovement","price","displayPrecision","isLoading","isError","label","createElement","undefined","arrowPosition","left","movementIndicator","toFixed"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,aAAa,EAAEC,KAAK,QAAQ,aAAa;AAClD,SAASC,OAAO,QAAQ,SAAS;AAWjC,OAAO,MAAMC,YAAY,GAAGC,IAAA,IAOH;EAAA,IAPI;IAC3BC,aAAa;IACbC,KAAK;IACLC,gBAAgB;IAChBC,SAAS;IACTC,OAAO;IACPC;EACiB,CAAC,GAAAN,IAAA;EAClB,OACEL,KAAA,CAAAY,aAAA,CAACT,OAAO;IACNO,OAAO,EAAEA,OAAQ;IACjBD,SAAS,EAAEA,SAAS,IAAKF,KAAK,KAAKM,SAAS,IAAI,CAACH,OAAS;IAC1DC,KAAK,EAAEA;EAAM,GAEbX,KAAA,CAAAY,aAAA,CAACV,KAAK;IACJY,aAAa,EAAEb,aAAa,CAACc,IAAK;IAClCC,iBAAiB,EAAC,OAAO;IACzBV,aAAa,EAAEA;EAAc,GAE7BN,KAAA,CAAAY,aAAA,eAAOL,KAAK,
|
|
1
|
+
{"version":3,"file":"PriceCardRow.js","names":["React","ArrowPosition","Price","CardRow","PriceCardRow","_ref","priceMovement","price","displayPrecision","isLoading","isError","label","createElement","undefined","arrowPosition","left","movementIndicator","toFixed"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,aAAa,EAAEC,KAAK,QAAQ,aAAa;AAClD,SAASC,OAAO,QAAQ,SAAS;AAWjC,OAAO,MAAMC,YAAY,GAAGC,IAAA,IAOH;EAAA,IAPI;IAC3BC,aAAa;IACbC,KAAK;IACLC,gBAAgB;IAChBC,SAAS;IACTC,OAAO;IACPC;EACiB,CAAC,GAAAN,IAAA;EAClB,OACEL,KAAA,CAAAY,aAAA,CAACT,OAAO;IACNO,OAAO,EAAEA,OAAQ;IACjBD,SAAS,EAAEA,SAAS,IAAKF,KAAK,KAAKM,SAAS,IAAI,CAACH,OAAS;IAC1DC,KAAK,EAAEA;EAAM,GAEbX,KAAA,CAAAY,aAAA,CAACV,KAAK;IACJY,aAAa,EAAEb,aAAa,CAACc,IAAK;IAClCC,iBAAiB,EAAC,OAAO;IACzBV,aAAa,EAAEA;EAAc,GAE7BN,KAAA,CAAAY,aAAA,eAAOL,KAAK,EAAEU,OAAO,CAACT,gBAAgB,CAAQ,CACzC,CACA,CAAC;AAEd,CAAC","ignoreList":[]}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
const _excluded = ["label", "onIncrement", "onDecrement", "placeholder", "disabled", "decimalScale", "value", "withoutArrows"];
|
|
2
1
|
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
2
|
import React from 'react';
|
|
6
3
|
import { NumericFormat } from 'react-number-format';
|
|
7
4
|
import { ArrowDownIcon, ArrowUpIcon } from '../../images';
|
|
8
5
|
import { Label } from '../Label';
|
|
9
6
|
export const NumberInput = _ref => {
|
|
10
7
|
let {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
label,
|
|
9
|
+
onIncrement,
|
|
10
|
+
onDecrement,
|
|
11
|
+
placeholder,
|
|
12
|
+
disabled,
|
|
13
|
+
decimalScale = 2,
|
|
14
|
+
value,
|
|
15
|
+
withoutArrows,
|
|
16
|
+
...props
|
|
17
|
+
} = _ref;
|
|
21
18
|
return React.createElement("div", {
|
|
22
19
|
className: "lw-group lw-grid lw-w-full lw-max-w-full lw-items-center lw-gap-2 lw-text-text-primary"
|
|
23
20
|
}, React.createElement(Label, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.js","names":["React","NumericFormat","ArrowDownIcon","ArrowUpIcon","Label","NumberInput","_ref","label","onIncrement","onDecrement","placeholder","disabled","decimalScale","value","withoutArrows","props","
|
|
1
|
+
{"version":3,"file":"NumberInput.js","names":["React","NumericFormat","ArrowDownIcon","ArrowUpIcon","Label","NumberInput","_ref","label","onIncrement","onDecrement","placeholder","disabled","decimalScale","value","withoutArrows","props","createElement","className","htmlFor","_extends","allowNegative","thousandSeparator","type","onClick"],"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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAQ,qBAAqB;AAEnD,SAASC,aAAa,EAAEC,WAAW,QAAQ,cAAc;AACzD,SAASC,KAAK,QAAQ,UAAU;AAGhC,OAAO,MAAMC,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,OACCN,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAC;EAAwF,GACrGjB,KAAA,CAAAgB,aAAA,CAACZ,KAAK;IAACa,SAAS,EAAC,sBAAsB;IAACC,OAAO,EAAEX;EAAM,GACpDA,KACI,CAAC,EACRP,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAC;EAA4J,GACzKjB,KAAA,CAAAgB,aAAA,CAACf,aAAa,EAAAkB,QAAA,KACRJ,KAAK;IACTK,aAAa,EAAE,KAAM;IACrBH,SAAS,EAAC,gEAAgE;IAC1EL,YAAY,EAAEA,YAAa;IAC3BD,QAAQ,EAAEA,QAAS;IACnBD,WAAW,EAAEA,WAAY;IACzBW,iBAAiB,EAAC,GAAG;IACrBR,KAAK,EAAEA;EAAM,EACd,CAAC,EACD,CAACF,QAAQ,IAAI,CAACG,aAAa,IAC1Bd,KAAA,CAAAgB,aAAA;IAAKC,SAAS,EAAC;EAA6D,GAC1EjB,KAAA,CAAAgB,aAAA;IACEC,SAAS,EAAC,mDAAmD;IAC7DK,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAEf;EAAY,GAErBR,KAAA,CAAAgB,aAAA,CAACb,WAAW,MAAE,CACR,CAAC,EACTH,KAAA,CAAAgB,aAAA;IACEC,SAAS,EAAC,4CAA4C;IACtDK,IAAI,EAAC,QAAQ;IACbC,OAAO,EAAEd;EAAY,GAErBT,KAAA,CAAAgB,aAAA,CAACd,aAAa,MAAE,CACV,CACL,CAEJ,CACF,CAAC;AAAA,CACP","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ import { LabelSize, LabelWrapper } from '../LabelWrapper';
|
|
|
5
5
|
import { Price } from '../Price';
|
|
6
6
|
import { Truncate } from '../Truncate';
|
|
7
7
|
const InstrumentRate = _ref => {
|
|
8
|
-
var _record$buy;
|
|
9
8
|
let {
|
|
10
9
|
isError,
|
|
11
10
|
record,
|
|
@@ -17,7 +16,7 @@ const InstrumentRate = _ref => {
|
|
|
17
16
|
const {
|
|
18
17
|
isDark
|
|
19
18
|
} = useLayoutProvider();
|
|
20
|
-
const checkLoading = id => !isError &&
|
|
19
|
+
const checkLoading = id => !isError && record?.[id] === undefined;
|
|
21
20
|
const isExpanded = size === 'full' || size === 'fullWithChart';
|
|
22
21
|
return React.createElement("div", {
|
|
23
22
|
className: cn('lw-flex lw-flex-col', isExpanded && 'lw-h-full'),
|
|
@@ -44,7 +43,7 @@ const InstrumentRate = _ref => {
|
|
|
44
43
|
}, React.createElement(Price, {
|
|
45
44
|
movementIndicator: "text",
|
|
46
45
|
priceMovement: record.buyPriceMovement
|
|
47
|
-
}, React.createElement("span", null,
|
|
46
|
+
}, React.createElement("span", null, record.buy?.toFixed(record.displayPrecision)))))), isExpanded && React.createElement("div", {
|
|
48
47
|
className: 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'),
|
|
49
48
|
"data-testid": "instrument-rate-wrapper-expanded"
|
|
50
49
|
}, React.createElement(LabelWrapper, {
|
|
@@ -60,7 +59,7 @@ const InstrumentRate = _ref => {
|
|
|
60
59
|
size: LabelSize.sm
|
|
61
60
|
}, React.createElement("span", {
|
|
62
61
|
className: cn('lw-font-bold', indicator > 0 && 'lw-text-text-ok', indicator < 0 && 'lw-text-text-danger', indicator === 0 && 'lw-text-text-disabled')
|
|
63
|
-
},
|
|
62
|
+
}, `(${record.dailyPipsChange})`))));
|
|
64
63
|
};
|
|
65
64
|
export { InstrumentRate };
|
|
66
65
|
//# sourceMappingURL=InstrumentRate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstrumentRate.js","names":["React","useLayoutProvider","cn","LabelSize","LabelWrapper","Price","Truncate","InstrumentRate","_ref","
|
|
1
|
+
{"version":3,"file":"InstrumentRate.js","names":["React","useLayoutProvider","cn","LabelSize","LabelWrapper","Price","Truncate","InstrumentRate","_ref","isError","record","tooltipId","size","slim","colorIndicator","indicator","isDark","checkLoading","id","undefined","isExpanded","createElement","className","isLoading","lg","maxWidth","text","displayName","movementIndicator","priceMovement","buyPriceMovement","buy","toFixed","displayPrecision","sm","dailyPercentChange","withoutLoader","dailyPipsChange"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,EAAE,QAAQ,gBAAgB;AACnC,SAASC,SAAS,EAAEC,YAAY,QAAQ,iBAAiB;AACzD,SAASC,KAAK,QAAQ,UAAU;AAChC,SAASC,QAAQ,QAAQ,aAAa;AAGtC,MAAMC,cAAc,GAAGC,IAAA,IAOI;EAAA,IAPH;IACtBC,OAAO;IACPC,MAAM;IACNC,SAAS;IACTC,IAAI;IACJC,IAAI;IACJC,cAAc,EAAEC;EACG,CAAC,GAAAP,IAAA;EACpB,MAAM;IAAEQ;EAAO,CAAC,GAAGf,iBAAiB,CAAC,CAAC;EACtC,MAAMgB,YAAY,GAAIC,EAAU,IAAK,CAACT,OAAO,IAAIC,MAAM,GAAGQ,EAAE,CAAC,KAAKC,SAAS;EAC3E,MAAMC,UAAU,GAAGR,IAAI,KAAK,MAAM,IAAIA,IAAI,KAAK,eAAe;EAE9D,OACEZ,KAAA,CAAAqB,aAAA;IACEC,SAA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BAAoB,EAC9B,CAACH,IAAI,IAAI,SAAS,EAClBA,IAAI,IAAI,SACV,CAAE;IACF,eAAY;EAAkC,GAE9Cb,KAAA,CAAAqB,aAAA,CAACjB,YAAY;IACXK,OAAO,EAAE,CAAC,CAACA,OAAQ;IACnBc,SAAS,EAAEN,YAAY,CAAC,oBAAoB,CAAE;IAC9CL,IAAI,EAAET,SAAS,CAAC+B;EAAG,GAEnBlC,KAAA,CAAAqB,aAAA;IACEC,SAAS,EAAEpB,EAAE,CACX,cAAc,EACda,SAAS,GAAG,CAAC,IAAI,iBAAiB,EAClCA,SAAS,GAAG,CAAC,IAAI,qBAAqB,EACtCA,SAAS,KAAK,CAAC,IAAI,uBACrB;EAAE,GAEDL,MAAM,CAACyB,kBACJ,CACM,CAAC,EACfnC,KAAA,CAAAqB,aAAA,CAACjB,YAAY;IACXgC,aAAa;IACb3B,OAAO,EAAE,CAAC,CAACA,OAAQ;IACnBc,SAAS,EAAEN,YAAY,CAAC,iBAAiB,CAAE;IAC3CL,IAAI,EAAET,SAAS,CAAC+B;EAAG,GAEnBlC,KAAA,CAAAqB,aAAA;IACEC,SAAS,EAAEpB,EAAE,CACX,cAAc,EACda,SAAS,GAAG,CAAC,IAAI,iBAAiB,EAClCA,SAAS,GAAG,CAAC,IAAI,qBAAqB,EACtCA,SAAS,KAAK,CAAC,IAAI,uBACrB;EAAE,GAED,IAAIL,MAAM,CAAC2B,eAAe,GACvB,CACM,CACX,CAEJ,CAAC;AAEV,CAAC;AAED,SAAS9B,cAAc","ignoreList":[]}
|
|
@@ -19,7 +19,7 @@ function InstrumentRateWithChart(_ref) {
|
|
|
19
19
|
const {
|
|
20
20
|
updatedRecord,
|
|
21
21
|
error
|
|
22
|
-
} = useRecords(record, record
|
|
22
|
+
} = useRecords(record, record?.instrument ? target : null);
|
|
23
23
|
const indicator = getColorIndicator(updatedRecord.dailyPercentChange);
|
|
24
24
|
return React.createElement(React.Fragment, null, React.createElement(InstrumentRate, {
|
|
25
25
|
colorIndicator: indicator,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstrumentRateWithChart.js","names":["React","useRecords","useLayoutProvider","LineChartWithData","InstrumentRate","getChartColor","getColorIndicator","InstrumentRateWithChart","_ref","record","target","tooltipId","size","queryRef","slim","isDark","updatedRecord","error","instrument","indicator","dailyPercentChange","createElement","Fragment","colorIndicator","isError","color"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,SAAS;AAE1D,SAASC,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,GAAGb,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEc,aAAa;IAAEC;EAAM,CAAC,GAAGhB,UAAU,CACzCQ,MAAM,EACNA,MAAM,
|
|
1
|
+
{"version":3,"file":"InstrumentRateWithChart.js","names":["React","useRecords","useLayoutProvider","LineChartWithData","InstrumentRate","getChartColor","getColorIndicator","InstrumentRateWithChart","_ref","record","target","tooltipId","size","queryRef","slim","isDark","updatedRecord","error","instrument","indicator","dailyPercentChange","createElement","Fragment","colorIndicator","isError","color"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,SAAS;AAE1D,SAASC,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,GAAGb,iBAAiB,CAAC,CAAC;EACtC,MAAM;IAAEc,aAAa;IAAEC;EAAM,CAAC,GAAGhB,UAAU,CACzCQ,MAAM,EACNA,MAAM,EAAES,UAAU,GAAGR,MAAM,GAAG,IAChC,CAAC;EAED,MAAMS,SAAS,GAAGb,iBAAiB,CAACU,aAAa,CAACI,kBAAkB,CAAC;EAErE,OACEpB,KAAA,CAAAqB,aAAA,CAAArB,KAAA,CAAAsB,QAAA,QACEtB,KAAA,CAAAqB,aAAA,CAACjB,cAAc;IACbmB,cAAc,EAAEJ,SAAU;IAC1BK,OAAO,EAAE,CAAC,CAACP,KAAM;IACjBR,MAAM,EAAEO,aAAc;IACtBJ,IAAI,EAAEA,IAAK;IACXE,IAAI,EAAEA,IAAK;IACXH,SAAS,EAAEA;EAAU,CACtB,CAAC,EACDC,IAAI,KAAK,eAAe,IACvBZ,KAAA,CAAAqB,aAAA,CAAClB,iBAAiB;IAChBsB,KAAK,EAAEpB,aAAa,CAACc,SAAS,EAAEJ,MAAM,CAAE;IACxCF,QAAQ,EAAEA;EAAS,CACpB,CAEH,CAAC;AAEP;AAEA,SAASN,uBAAuB","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Theme, themeColors } from '@oanda/labs-widget-common';
|
|
2
2
|
const getColorIndicator = dailyChange => {
|
|
3
|
-
const numberValue = Number(dailyChange
|
|
3
|
+
const numberValue = Number(dailyChange?.substring(0, dailyChange.length - 1));
|
|
4
4
|
return Math.sign(numberValue);
|
|
5
5
|
};
|
|
6
6
|
const getChartColor = (indicator, isDarkMode) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["Theme","themeColors","getColorIndicator","dailyChange","numberValue","Number","substring","length","Math","sign","getChartColor","indicator","isDarkMode","theme","Dark","Light","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,SAASA,KAAK,EAAEC,WAAW,QAAQ,2BAA2B;AAE9D,MAAMC,iBAAiB,GAAIC,WAAoB,IAAK;EAClD,MAAMC,WAAW,GAAGC,MAAM,CAACF,WAAW,
|
|
1
|
+
{"version":3,"file":"utils.js","names":["Theme","themeColors","getColorIndicator","dailyChange","numberValue","Number","substring","length","Math","sign","getChartColor","indicator","isDarkMode","theme","Dark","Light","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,SAASA,KAAK,EAAEC,WAAW,QAAQ,2BAA2B;AAE9D,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,GAAGZ,KAAK,CAACc,IAAI,GAAGd,KAAK,CAACe,KAAK;EAEnD,QAAQJ,SAAS;IACf,KAAK,CAAC;MACJ,OAAOV,WAAW,CAACe,MAAM,CAACH,KAAK,CAAC;IAClC,KAAK,CAAC,CAAC;MACL,OAAOZ,WAAW,CAACgB,UAAU,CAACJ,KAAK,CAAC;IACtC;MACE,OAAOZ,WAAW,CAACiB,YAAY,CAACL,KAAK,CAAC;EAC1C;AACF,CAAC;AAED,SAASH,aAAa,EAAER,iBAAiB","ignoreList":[]}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
const _excluded = ["className"];
|
|
2
1
|
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); }
|
|
3
|
-
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; }
|
|
4
|
-
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; }
|
|
5
2
|
import React from 'react';
|
|
6
3
|
import { cn } from '../../tailwind';
|
|
7
4
|
const Label = React.forwardRef((_ref, ref) => {
|
|
8
5
|
let {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
} = _ref;
|
|
12
9
|
return React.createElement("label", _extends({}, props, {
|
|
13
10
|
ref: ref,
|
|
14
11
|
className: 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","cn","Label","forwardRef","_ref","ref","className","props","
|
|
1
|
+
{"version":3,"file":"Label.js","names":["React","cn","Label","forwardRef","_ref","ref","className","props","createElement","_extends","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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,EAAE,QAAQ,gBAAgB;AAInC,MAAMC,KAAK,GAAGF,KAAK,CAACG,UAAU,CAC5B,CAAAC,IAAA,EAA0BC,GAAG;EAAA,IAA5B;IAAEC,SAAS;IAAE,GAAGC;EAAM,CAAC,GAAAH,IAAA;EAAA,OACtBJ,KAAA,CAAAQ,aAAA,UAAAC,QAAA,KACMF,KAAK;IACTF,GAAG,EAAEA,GAAI;IACTC,SAAS,EAAEL,EAAE,CACX,0HAA0H,EAC1HK,SACF;EAAE,EACH,CAAC;AAAA,CAEN,CAAC;AACDJ,KAAK,CAACQ,WAAW,GAAG,OAAO;AAE3B,SAASR,KAAK","ignoreList":[]}
|
|
@@ -9,7 +9,7 @@ const LastUpdated = _ref => {
|
|
|
9
9
|
return React.createElement("span", {
|
|
10
10
|
className: "lw-ml-1 lw-font-sans lw-text-xs lw-font-bold",
|
|
11
11
|
"data-testid": "last-updated"
|
|
12
|
-
},
|
|
12
|
+
}, `${labelCallback('last_updated')}: ${timestamp?.endsWith('Z') ? formatUpdatedTimestamp(timestamp, labelCallback('today')) : EMPTY_VALUE}`);
|
|
13
13
|
};
|
|
14
14
|
export { LastUpdated };
|
|
15
15
|
//# sourceMappingURL=LastUpdated.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LastUpdated.js","names":["React","EMPTY_VALUE","formatUpdatedTimestamp","LastUpdated","_ref","timestamp","labelCallback","createElement","className","
|
|
1
|
+
{"version":3,"file":"LastUpdated.js","names":["React","EMPTY_VALUE","formatUpdatedTimestamp","LastUpdated","_ref","timestamp","labelCallback","createElement","className","endsWith"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,sBAAsB,QAAQ,aAAa;AAGpD,MAAMC,WAAW,GAAGC,IAAA;EAAA,IAAC;IAAEC,SAAS;IAAEC;EAAgC,CAAC,GAAAF,IAAA;EAAA,OACjEJ,KAAA,CAAAO,aAAA;IACEC,SAAS,EAAC,8CAA8C;IACxD,eAAY;EAAc,GAEzB,GAAGF,aAAa,CAAC,cAAc,CAAC,KAAKD,SAAS,EAAEI,QAAQ,CAAC,GAAG,CAAC,GAAGP,sBAAsB,CAACG,SAAS,EAAEC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAGL,WAAW,EACpI,CAAC;AAAA,CACR;AAED,SAASE,WAAW","ignoreList":[]}
|
|
@@ -31,10 +31,10 @@ const LineChart = _ref => {
|
|
|
31
31
|
className: "lw-font-sans",
|
|
32
32
|
"data-testid": "line-chart-empty-value"
|
|
33
33
|
}, CELL_EMPTY_VALUE), data.length >= CHART_DEFAULT_POINTS_NUMBER && React.createElement("div", {
|
|
34
|
-
className:
|
|
34
|
+
className: `${sizes[size].class}`,
|
|
35
35
|
"data-testid": "line-chart"
|
|
36
36
|
}, React.createElement("svg", {
|
|
37
|
-
viewBox:
|
|
37
|
+
viewBox: `0 0 ${sizes[size].width} ${sizes[size].height}`,
|
|
38
38
|
xmlns: "http://www.w3.org/2000/svg"
|
|
39
39
|
}, React.createElement("path", {
|
|
40
40
|
d: svgPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.js","names":["React","CELL_EMPTY_VALUE","CHART_DEFAULT_POINTS_NUMBER","LineChartSize","getSvgPath","sizes","xs","class","width","height","sm","LineChart","_ref","data","color","size","padding","svgPath","createElement","Fragment","length","className","
|
|
1
|
+
{"version":3,"file":"LineChart.js","names":["React","CELL_EMPTY_VALUE","CHART_DEFAULT_POINTS_NUMBER","LineChartSize","getSvgPath","sizes","xs","class","width","height","sm","LineChart","_ref","data","color","size","padding","svgPath","createElement","Fragment","length","className","viewBox","xmlns","d","fill","stroke","strokeLinecap","strokeWidth"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,gBAAgB,EAAEC,2BAA2B,QAAQ,aAAa;AAE3E,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,UAAU,QAAQ,SAAS;AAEpC,MAAMC,KAA6C,GAAG;EACpDC,EAAE,EAAE;IACFC,KAAK,EAAE,0BAA0B;IACjCC,KAAK,EAAE,GAAG;IACVC,MAAM,EAAE;EACV,CAAC;EACDC,EAAE,EAAE;IACFH,KAAK,EAAE,0BAA0B;IACjCC,KAAK,EAAE,GAAG;IACVC,MAAM,EAAE;EACV;AACF,CAAC;AAED,MAAME,SAAS,GAAGC,IAAA,IAKI;EAAA,IALH;IACjBC,IAAI;IACJC,KAAK;IACLC,IAAI,GAAGZ,aAAa,CAACO,EAAE;IACvBM,OAAO,GAAG;EACI,CAAC,GAAAJ,IAAA;EACf,MAAMK,OAAO,GAAGb,UAAU,CAAC;IACzBS,IAAI;IACJL,KAAK,EAAEH,KAAK,CAACU,IAAI,CAAC,CAACP,KAAK;IACxBC,MAAM,EAAEJ,KAAK,CAACU,IAAI,CAAC,CAACN,MAAM;IAC1BO;EACF,CAAC,CAAC;EAEF,OACEhB,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAmB,QAAA,QACGN,IAAI,CAACO,MAAM,GAAGlB,2BAA2B,IACxCF,KAAA,CAAAkB,aAAA;IAAMG,SAAS,EAAC,cAAc;IAAC,eAAY;EAAwB,GAChEpB,gBACG,CACP,EACAY,IAAI,CAACO,MAAM,IAAIlB,2BAA2B,IACzCF,KAAA,CAAAkB,aAAA;IAAKG,SAAS,EAAE,GAAGhB,KAAK,CAACU,IAAI,CAAC,CAACR,KAAK,EAAG;IAAC,eAAY;EAAY,GAC9DP,KAAA,CAAAkB,aAAA;IACEI,OAAO,EAAE,OAAOjB,KAAK,CAACU,IAAI,CAAC,CAACP,KAAK,IAAIH,KAAK,CAACU,IAAI,CAAC,CAACN,MAAM,EAAG;IAC1Dc,KAAK,EAAC;EAA4B,GAElCvB,KAAA,CAAAkB,aAAA;IACEM,CAAC,EAAEP,OAAQ;IACXQ,IAAI,EAAC,MAAM;IACXC,MAAM,EAAEZ,KAAM;IACda,aAAa,EAAC,OAAO;IACrBC,WAAW,EAAE;EAAE,CAChB,CACE,CACF,CAEP,CAAC;AAEP,CAAC;AAED,SAASjB,SAAS","ignoreList":[]}
|
|
@@ -17,12 +17,12 @@ export const getSvgPath = _ref => {
|
|
|
17
17
|
return data.map((item, index) => {
|
|
18
18
|
const x = usableWidth * (index / (length - 1)) + padding;
|
|
19
19
|
const y = min === max ? usableHeight / 2 : usableHeight - usableHeight * ((item - min) / (max - min)) + padding;
|
|
20
|
-
return index ?
|
|
20
|
+
return index ? `${x} ${y}` : `M${x} ${y}`;
|
|
21
21
|
}).join(' ');
|
|
22
22
|
};
|
|
23
23
|
export const getChartColor = (dailyChange, isDarkMode) => {
|
|
24
24
|
const theme = isDarkMode ? Theme.Dark : Theme.Light;
|
|
25
|
-
switch (dailyChange
|
|
25
|
+
switch (dailyChange?.charAt(0)) {
|
|
26
26
|
case '+':
|
|
27
27
|
return themeColors.ok[theme];
|
|
28
28
|
case '-':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["themeColors","Theme","getSvgPath","_ref","data","width","height","padding","min","Math","max","usableHeight","usableWidth","length","map","item","index","x","y","
|
|
1
|
+
{"version":3,"file":"utils.js","names":["themeColors","Theme","getSvgPath","_ref","data","width","height","padding","min","Math","max","usableHeight","usableWidth","length","map","item","index","x","y","join","getChartColor","dailyChange","isDarkMode","theme","Dark","Light","charAt","ok","danger","borderDisabled"],"sources":["../../../../src/components/LineChart/utils.tsx"],"sourcesContent":["import { themeColors } from '../../tailwind';\nimport { Theme } from '../../types';\n\nexport const getSvgPath = ({\n data,\n width,\n height,\n padding,\n}: {\n data: number[];\n width: number;\n height: number;\n padding: number;\n}) => {\n const min = Math.min(...data);\n const max = Math.max(...data);\n const usableHeight = height - padding * 2;\n const usableWidth = width - padding * 2;\n const { length } = data;\n\n return data\n .map((item, index) => {\n const x = usableWidth * (index / (length - 1)) + padding;\n const y =\n min === max\n ? usableHeight / 2\n : usableHeight -\n usableHeight * ((item - min) / (max - min)) +\n padding;\n\n return index ? `${x} ${y}` : `M${x} ${y}`;\n })\n .join(' ');\n};\n\nexport const getChartColor = (dailyChange?: string, isDarkMode?: boolean) => {\n const theme = isDarkMode ? Theme.Dark : Theme.Light;\n\n switch (dailyChange?.charAt(0)) {\n case '+':\n return themeColors.ok[theme];\n case '-':\n return themeColors.danger[theme];\n default:\n return themeColors.borderDisabled[theme];\n }\n};\n"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAC5C,SAASC,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9B,KAAK,GAAG;MACN,OAAOvB,WAAW,CAAC4B,MAAM,CAACL,KAAK,CAAC;IAClC;MACE,OAAOvB,WAAW,CAAC6B,cAAc,CAACN,KAAK,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
|
@@ -69,14 +69,14 @@ const Pagination = _ref => {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}, React.createElement(ChevronLeft, null))), pages.map((pageNumber, index) => pageNumber === undefined ? React.createElement("li", {
|
|
72
|
-
key:
|
|
72
|
+
key: `placeholder_${index + 1}`
|
|
73
73
|
}, React.createElement("span", {
|
|
74
74
|
className: "lw-block lw-h-[20px] lw-w-[20px] lw-justify-center lw-rounded-full lw-text-center lw-align-baseline lw-font-sans lw-text-xs lw-leading-[18px]"
|
|
75
75
|
}, '...')) : React.createElement("li", {
|
|
76
76
|
key: pageNumber
|
|
77
77
|
}, React.createElement("a", {
|
|
78
78
|
"aria-current": pageNumber === currentPage ? 'true' : undefined,
|
|
79
|
-
"aria-label":
|
|
79
|
+
"aria-label": `Goto Page ${pageNumber + 1}`,
|
|
80
80
|
className: cn('lw-flex lw-items-center lw-justify-center focus:lw-outline-primary lw-rounded-full', {
|
|
81
81
|
'lw-pointer-events-none': pageNumber === currentPage || disabled,
|
|
82
82
|
'lw-h-6 lw-w-6': isDesktop,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination.js","names":["useLocale","React","ChevronLeft","ChevronRight","useLayoutProvider","cn","Size","generatePaginationArray","Pagination","_ref","currentPage","onPageChange","totalRecords","recordsPerPage","disabled","lang","isDark","size","isDesktop","DESKTOP","totalPages","Math","ceil","lastPage","pages","recordsOnCurrentPage","createElement","className","firstItemOnPage","lastItemOnPage","itemCount","role","href","tabIndex","undefined","onClick","e","preventDefault","map","pageNumber","index","key","concat"],"sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/anchor-is-valid */\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { ChevronLeft, ChevronRight } from '../../images';\nimport { useLayoutProvider } from '../../providers';\nimport { cn } from '../../tailwind';\nimport { Size } from '../../types';\nimport type { PaginationProps } from './types';\nimport { generatePaginationArray } from './utils';\n\nconst Pagination = ({\n currentPage,\n onPageChange,\n totalRecords,\n recordsPerPage,\n disabled,\n}: PaginationProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const totalPages = Math.ceil(totalRecords / recordsPerPage);\n const lastPage = totalPages - 1;\n const pages = generatePaginationArray(totalPages, currentPage);\n\n const recordsOnCurrentPage =\n currentPage === lastPage\n ? totalRecords\n : recordsPerPage * (currentPage + 1);\n\n return (\n <div\n className={cn('lw-flex lw-items-center lw-justify-between', {\n 'lw-flex-row lw-px-6 lw-py-4': isDesktop,\n 'lw-flex-col': !isDesktop,\n })}\n data-testid=\"pagination\"\n >\n <div\n className={cn('lw-font-sans', {\n 'lw-my-3': !isDesktop,\n })}\n >\n <span>\n {lang('pagination_entries_range', {\n firstItemOnPage: currentPage * recordsPerPage + 1,\n lastItemOnPage: recordsOnCurrentPage,\n itemCount: totalRecords,\n })}\n </span>\n </div>\n <nav aria-label=\"Pagination Navigation\" role=\"navigation\">\n <ul\n className={cn(\n 'lw-flex lw-items-center lw-gap-1 lw-text-text-primary',\n {\n 'lw-my-0': isDesktop,\n 'lw-mb-6': !isDesktop,\n }\n )}\n >\n <li className=\"lw-font-sans lw-text-xs\">\n <a\n aria-label=\"Goto previous page\"\n className={cn(\n 'lw-text-xs lw-tracking-normal lw-flex lw-mr-1 lw-items-center lw-justify-center lw-rounded-full focus:lw-outline-primary',\n {\n 'hover:lw-bg-border-primary': isDark,\n 'hover:lw-bg-bg-secondary': !isDark,\n 'lw-pointer-events-none [&>svg]:lw-stroke-text-primary':\n isDark && (currentPage === 0 || disabled),\n 'lw-pointer-events-none [&>svg]:lw-stroke-border-disabled':\n !isDark && (currentPage === 0 || disabled),\n 'lw-h-[20px] lw-w-[20px]': isDesktop,\n 'lw-h-[30px] lw-w-[30px]': !isDesktop,\n }\n )}\n data-testid=\"pagination-button\"\n href=\"#\"\n tabIndex={currentPage === 0 || disabled ? -1 : undefined}\n onClick={(e) => {\n e.preventDefault();\n if (currentPage !== 0 && !disabled) {\n onPageChange(currentPage - 1);\n }\n }}\n >\n <ChevronLeft />\n </a>\n </li>\n {pages.map((pageNumber, index) =>\n pageNumber === undefined ? (\n <li key={`placeholder_${index + 1}`}>\n <span className=\"lw-block lw-h-[20px] lw-w-[20px] lw-justify-center lw-rounded-full lw-text-center lw-align-baseline lw-font-sans lw-text-xs lw-leading-[18px]\">\n {'...'}\n </span>\n </li>\n ) : (\n <li key={pageNumber}>\n <a\n aria-current={pageNumber === currentPage ? 'true' : undefined}\n aria-label={`Goto Page ${pageNumber + 1}`}\n className={cn(\n 'lw-flex lw-items-center lw-justify-center focus:lw-outline-primary lw-rounded-full',\n {\n 'lw-pointer-events-none':\n pageNumber === currentPage || disabled,\n 'lw-h-6 lw-w-6': isDesktop,\n 'lw-h-[40px] lw-w-[40px]': !isDesktop,\n }\n )}\n data-testid=\"pagination-button\"\n href=\"#\"\n tabIndex={\n pageNumber === currentPage || disabled ? -1 : undefined\n }\n onClick={(e) => {\n e.preventDefault();\n if (currentPage !== pageNumber && !disabled) {\n onPageChange(pageNumber);\n }\n }}\n >\n <span\n className={cn(\n 'lw-text-xs lw-text-center lw-font-sans lw-align-baseline lw-block lw-justify-center lw-rounded-full',\n {\n 'lw-bg-ok lw-font-bold':\n !isDark && pageNumber === currentPage,\n 'lw-bg-primary lw-text-text-negative lw-font-bold':\n isDark && pageNumber === currentPage,\n 'hover:lw-bg-border-primary':\n isDark && pageNumber !== currentPage,\n 'hover:lw-bg-bg-secondary':\n !isDark && pageNumber !== currentPage,\n 'lw-text-border-disabled': disabled,\n 'lw-bg-border-primary':\n isDark && pageNumber === currentPage && disabled,\n 'lw-bg-bg-secondary':\n !isDark && pageNumber === currentPage && disabled,\n 'lw-h-[20px] lw-w-[20px] lw-leading-[18px]': isDesktop,\n 'lw-h-[30px] lw-w-[30px] lw-leading-[28px]': !isDesktop,\n }\n )}\n >\n {pageNumber + 1}\n </span>\n </a>\n </li>\n )\n )}\n <li>\n <a\n aria-label=\"Goto next page\"\n className={cn(\n 'lw-text-xs lw-flex lw-ml-1 lw-items-center lw-justify-center lw-rounded-full focus:lw-outline-primary',\n {\n 'hover:lw-bg-border-primary': isDark,\n 'hover:lw-bg-bg-secondary': !isDark,\n 'lw-pointer-events-none [&>svg]:lw-stroke-text-primary':\n isDark && (currentPage === lastPage || disabled),\n 'lw-pointer-events-none [&>svg]:lw-stroke-border-disabled':\n !isDark && (currentPage === lastPage || disabled),\n 'lw-h-[20px] lw-w-[20px]': isDesktop,\n 'lw-h-[30px] lw-w-[30px]': !isDesktop,\n }\n )}\n data-testid=\"pagination-button\"\n href=\"#\"\n tabIndex={currentPage === lastPage || disabled ? -1 : undefined}\n onClick={(e) => {\n e.preventDefault();\n if (currentPage !== lastPage && !disabled) {\n onPageChange(currentPage + 1);\n }\n }}\n >\n <ChevronRight />\n </a>\n </li>\n </ul>\n </nav>\n </div>\n );\n};\n\nexport { Pagination };\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,EAAEC,YAAY,QAAQ,cAAc;AACxD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,EAAE,QAAQ,gBAAgB;AACnC,SAASC,IAAI,QAAQ,aAAa;AAElC,SAASC,uBAAuB,QAAQ,SAAS;AAEjD,MAAMC,UAAU,GAAGC,IAAA,IAMI;EAAA,IANH;IAClBC,WAAW;IACXC,YAAY;IACZC,YAAY;IACZC,cAAc;IACdC;EACe,CAAC,GAAAL,IAAA;EAChB,MAAM;IAAEM;EAAK,CAAC,GAAGf,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEgB,MAAM;IA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CAAC;MAClD,0DAA0D,EACxD,CAACE,MAAM,KAAKN,WAAW,KAAKa,QAAQ,IAAIT,QAAQ,CAAC;MACnD,yBAAyB,EAAEI,SAAS;MACpC,yBAAyB,EAAE,CAACA;IAC9B,CACF,CAAE;IACF,eAAY,mBAAmB;IAC/Bc,IAAI,EAAC,GAAG;IACRC,QAAQ,EAAEvB,WAAW,KAAKa,QAAQ,IAAIT,QAAQ,GAAG,CAAC,CAAC,GAAGoB,SAAU;IAChEC,OAAO,EAAGC,CAAC,IAAK;MACdA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClB,IAAI3B,WAAW,KAAKa,QAAQ,IAAI,CAACT,QAAQ,EAAE;QACzCH,YAAY,CAACD,WAAW,GAAG,CAAC,CAAC;MAC/B;IACF;EAAE,GAEFT,KAAA,CAAAyB,aAAA,CAACvB,YAAY,MAAE,CACd,CACD,CACF,CACD,CACF,CAAC;AAEV,CAAC;AAED,SAASK,UAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Pagination.js","names":["useLocale","React","ChevronLeft","ChevronRight","useLayoutProvider","cn","Size","generatePaginationArray","Pagination","_ref","currentPage","onPageChange","totalRecords","recordsPerPage","disabled","lang","isDark","size","isDesktop","DESKTOP","totalPages","Math","ceil","lastPage","pages","recordsOnCurrentPage","createElement","className","firstItemOnPage","lastItemOnPage","itemCount","role","href","tabIndex","undefined","onClick","e","preventDefault","map","pageNumber","index","key"],"sources":["../../../../src/components/Pagination/Pagination.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/anchor-is-valid */\nimport { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport { ChevronLeft, ChevronRight } from '../../images';\nimport { useLayoutProvider } from '../../providers';\nimport { cn } from '../../tailwind';\nimport { Size } from '../../types';\nimport type { PaginationProps } from './types';\nimport { generatePaginationArray } from './utils';\n\nconst Pagination = ({\n currentPage,\n onPageChange,\n totalRecords,\n recordsPerPage,\n disabled,\n}: PaginationProps) => {\n const { lang } = useLocale();\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const totalPages = Math.ceil(totalRecords / recordsPerPage);\n const lastPage = totalPages - 1;\n const pages = generatePaginationArray(totalPages, currentPage);\n\n const recordsOnCurrentPage =\n currentPage === lastPage\n ? totalRecords\n : recordsPerPage * (currentPage + 1);\n\n return (\n <div\n className={cn('lw-flex lw-items-center lw-justify-between', {\n 'lw-flex-row lw-px-6 lw-py-4': isDesktop,\n 'lw-flex-col': !isDesktop,\n })}\n data-testid=\"pagination\"\n >\n <div\n className={cn('lw-font-sans', {\n 'lw-my-3': !isDesktop,\n })}\n >\n <span>\n {lang('pagination_entries_range', {\n firstItemOnPage: currentPage * recordsPerPage + 1,\n lastItemOnPage: recordsOnCurrentPage,\n itemCount: totalRecords,\n })}\n </span>\n </div>\n <nav aria-label=\"Pagination Navigation\" role=\"navigation\">\n <ul\n className={cn(\n 'lw-flex lw-items-center lw-gap-1 lw-text-text-primary',\n {\n 'lw-my-0': isDesktop,\n 'lw-mb-6': !isDesktop,\n }\n )}\n >\n <li className=\"lw-font-sans lw-text-xs\">\n <a\n aria-label=\"Goto previous page\"\n className={cn(\n 'lw-text-xs lw-tracking-normal lw-flex lw-mr-1 lw-items-center lw-justify-center lw-rounded-full focus:lw-outline-primary',\n {\n 'hover:lw-bg-border-primary': isDark,\n 'hover:lw-bg-bg-secondary': !isDark,\n 'lw-pointer-events-none [&>svg]:lw-stroke-text-primary':\n isDark && (currentPage === 0 || disabled),\n 'lw-pointer-events-none [&>svg]:lw-stroke-border-disabled':\n !isDark && (currentPage === 0 || disabled),\n 'lw-h-[20px] lw-w-[20px]': isDesktop,\n 'lw-h-[30px] lw-w-[30px]': !isDesktop,\n }\n )}\n data-testid=\"pagination-button\"\n href=\"#\"\n tabIndex={currentPage === 0 || disabled ? -1 : undefined}\n onClick={(e) => {\n e.preventDefault();\n if (currentPage !== 0 && !disabled) {\n onPageChange(currentPage - 1);\n }\n }}\n >\n <ChevronLeft />\n </a>\n </li>\n {pages.map((pageNumber, index) =>\n pageNumber === undefined ? (\n <li key={`placeholder_${index + 1}`}>\n <span className=\"lw-block lw-h-[20px] lw-w-[20px] lw-justify-center lw-rounded-full lw-text-center lw-align-baseline lw-font-sans lw-text-xs lw-leading-[18px]\">\n {'...'}\n </span>\n </li>\n ) : (\n <li key={pageNumber}>\n <a\n aria-current={pageNumber === currentPage ? 'true' : undefined}\n aria-label={`Goto Page ${pageNumber + 1}`}\n className={cn(\n 'lw-flex lw-items-center lw-justify-center focus:lw-outline-primary lw-rounded-full',\n {\n 'lw-pointer-events-none':\n pageNumber === currentPage || disabled,\n 'lw-h-6 lw-w-6': isDesktop,\n 'lw-h-[40px] lw-w-[40px]': !isDesktop,\n }\n )}\n data-testid=\"pagination-button\"\n href=\"#\"\n tabIndex={\n pageNumber === currentPage || disabled ? -1 : undefined\n }\n onClick={(e) => {\n e.preventDefault();\n if (currentPage !== pageNumber && !disabled) {\n onPageChange(pageNumber);\n }\n }}\n >\n <span\n className={cn(\n 'lw-text-xs lw-text-center lw-font-sans lw-align-baseline lw-block lw-justify-center lw-rounded-full',\n {\n 'lw-bg-ok lw-font-bold':\n !isDark && pageNumber === currentPage,\n 'lw-bg-primary lw-text-text-negative lw-font-bold':\n isDark && pageNumber === currentPage,\n 'hover:lw-bg-border-primary':\n isDark && pageNumber !== currentPage,\n 'hover:lw-bg-bg-secondary':\n !isDark && pageNumber !== currentPage,\n 'lw-text-border-disabled': disabled,\n 'lw-bg-border-primary':\n isDark && pageNumber === currentPage && disabled,\n 'lw-bg-bg-secondary':\n !isDark && pageNumber === currentPage && disabled,\n 'lw-h-[20px] lw-w-[20px] lw-leading-[18px]': isDesktop,\n 'lw-h-[30px] lw-w-[30px] lw-leading-[28px]': !isDesktop,\n }\n )}\n >\n {pageNumber + 1}\n </span>\n </a>\n </li>\n )\n )}\n <li>\n <a\n aria-label=\"Goto next page\"\n className={cn(\n 'lw-text-xs lw-flex lw-ml-1 lw-items-center lw-justify-center lw-rounded-full focus:lw-outline-primary',\n {\n 'hover:lw-bg-border-primary': isDark,\n 'hover:lw-bg-bg-secondary': !isDark,\n 'lw-pointer-events-none [&>svg]:lw-stroke-text-primary':\n isDark && (currentPage === lastPage || disabled),\n 'lw-pointer-events-none [&>svg]:lw-stroke-border-disabled':\n !isDark && (currentPage === lastPage || disabled),\n 'lw-h-[20px] lw-w-[20px]': isDesktop,\n 'lw-h-[30px] lw-w-[30px]': !isDesktop,\n }\n )}\n data-testid=\"pagination-button\"\n href=\"#\"\n tabIndex={currentPage === lastPage || disabled ? -1 : undefined}\n onClick={(e) => {\n e.preventDefault();\n if (currentPage !== lastPage && !disabled) {\n onPageChange(currentPage + 1);\n }\n }}\n >\n <ChevronRight />\n </a>\n </li>\n </ul>\n </nav>\n </div>\n );\n};\n\nexport { Pagination };\n"],"mappings":"AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,EAAEC,YAAY,QAAQ,cAAc;AACxD,SAASC,iBAAiB,QAAQ,iBAAiB;AACnD,SAASC,EAAE,QAAQ,gBAAgB;AACnC,SAASC,IAAI,QAAQ,aAAa;AAElC,SAASC,uBAAuB,QAAQ,SAAS;AAEjD,MAAMC,UAAU,GAAGC,IAAA,IAMI;EAAA,IANH;IAClBC,WAAW;IACXC,YAAY;IACZC,YAAY;IACZC,cAAc;IACdC;EACe,CAAC,GAAAL,IAAA;EAChB,MAAM;IAAEM;EAAK,CAAC,GAAGf,SAAS,CAAC,CAAC;EAC5B,MAAM;IAAEgB,MAAM;IAAEC;EAAK,CAAC,GAAGb,iBAAiB,CAAC,CAAC;EAC5C,MAAMc,SAAS,GAAGD,IAAI,KAAKX,IAAI,CAACa,OAAO;EACvC,MAAMC,UAAU,GAAGC,IAAI,CAACC,IAAI,CAACV,YAAY,GAAGC,cAAc,CAAC;EAC3D,MAAMU,QAAQ,GAAGH,UAAU,GAAG,CAAC;EAC/B,MAAMI,KAAK,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,CAAC,CAAC,GAAGoB,SAAU;IAChEC,OAAO,EAAGC,CAAC,IAAK;MACdA,CAAC,CAACC,cAAc,CAAC,CAAC;MAClB,IAAI3B,WAAW,KAAKa,QAAQ,IAAI,CAACT,QAAQ,EAAE;QACzCH,YAAY,CAACD,WAAW,GAAG,CAAC,CAAC;MAC/B;IACF;EAAE,GAEFT,KAAA,CAAAyB,aAAA,CAACvB,YAAY,MAAE,CACd,CACD,CACF,CACD,CACF,CAAC;AAEV,CAAC;AAED,SAASK,UAAU","ignoreList":[]}
|
|
@@ -40,7 +40,7 @@ const Select = _ref => {
|
|
|
40
40
|
"data-testid": "single-option-select"
|
|
41
41
|
}, selectLabel && React.createElement("span", {
|
|
42
42
|
className: "lw-text-base lw-font-bold"
|
|
43
|
-
},
|
|
43
|
+
}, `${selectLabel}:`), React.createElement("div", {
|
|
44
44
|
className: "lw-flex lw-h-[50px] lw-w-full lw-items-center lw-rounded lw-border lw-px-3"
|
|
45
45
|
}, React.createElement(Truncate, {
|
|
46
46
|
maxWidth: 190,
|
|
@@ -51,7 +51,7 @@ const Select = _ref => {
|
|
|
51
51
|
"data-testid": "select"
|
|
52
52
|
}, selectLabel && React.createElement("span", {
|
|
53
53
|
className: "lw-text-base lw-font-bold"
|
|
54
|
-
},
|
|
54
|
+
}, `${selectLabel}:`), React.createElement("div", {
|
|
55
55
|
className: "lw-flex lw-w-full lw-items-center lw-justify-between lw-rounded lw-border lw-stroke-text-primary lw-px-3 lw-py-2 focus:lw-outline-primary",
|
|
56
56
|
role: "button",
|
|
57
57
|
tabIndex: 0,
|