@oanda/labs-widget-common 1.0.252 → 1.0.254
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 +774 -62520
- package/dist/main/components/style.css +1 -1
- package/dist/module/chart/BaseChart.js +15 -7
- package/dist/module/chart/BaseChart.js.map +1 -1
- package/dist/module/chart/formatters.js +12 -3
- package/dist/module/chart/formatters.js.map +1 -1
- package/dist/module/chart/getGridLines.js +16 -9
- package/dist/module/chart/getGridLines.js.map +1 -1
- package/dist/module/chart/getTheme.js +38 -31
- package/dist/module/chart/getTheme.js.map +1 -1
- package/dist/module/chart/getZoomControls.js +12 -5
- package/dist/module/chart/getZoomControls.js.map +1 -1
- package/dist/module/chart/index.js +82 -7
- package/dist/module/chart/index.js.map +1 -1
- package/dist/module/chart/sharedOptions.js +11 -4
- package/dist/module/chart/sharedOptions.js.map +1 -1
- package/dist/module/chart/types.js +5 -1
- package/dist/module/components/Button/Button.js +18 -11
- package/dist/module/components/Button/Button.js.map +1 -1
- package/dist/module/components/Button/index.js +27 -2
- package/dist/module/components/Button/index.js.map +1 -1
- package/dist/module/components/Button/types.js +8 -2
- package/dist/module/components/Button/types.js.map +1 -1
- package/dist/module/components/Card/Card.js +24 -16
- package/dist/module/components/Card/Card.js.map +1 -1
- package/dist/module/components/Card/CardHeader.js +21 -14
- package/dist/module/components/Card/CardHeader.js.map +1 -1
- package/dist/module/components/Card/index.js +38 -3
- package/dist/module/components/Card/index.js.map +1 -1
- package/dist/module/components/Card/rows/DailyChangeCardRow.js +15 -7
- package/dist/module/components/Card/rows/DailyChangeCardRow.js.map +1 -1
- package/dist/module/components/Card/rows/LineChartCardRow.js +17 -10
- package/dist/module/components/Card/rows/LineChartCardRow.js.map +1 -1
- package/dist/module/components/Card/rows/PriceCardRow.js +16 -8
- package/dist/module/components/Card/rows/PriceCardRow.js.map +1 -1
- package/dist/module/components/Card/rows/SentimentCardRow.js +18 -10
- package/dist/module/components/Card/rows/SentimentCardRow.js.map +1 -1
- package/dist/module/components/Card/rows/SpreadCardRow.js +15 -7
- package/dist/module/components/Card/rows/SpreadCardRow.js.map +1 -1
- package/dist/module/components/Card/rows/index.js +60 -5
- package/dist/module/components/Card/rows/index.js.map +1 -1
- package/dist/module/components/Card/types.js +5 -1
- package/dist/module/components/Disclaimer/Disclaimer.js +32 -24
- package/dist/module/components/Disclaimer/Disclaimer.js.map +1 -1
- package/dist/module/components/Disclaimer/index.js +16 -1
- package/dist/module/components/Disclaimer/index.js.map +1 -1
- package/dist/module/components/Error/Error.js +27 -18
- package/dist/module/components/Error/Error.js.map +1 -1
- package/dist/module/components/Error/index.js +16 -1
- package/dist/module/components/Error/index.js.map +1 -1
- package/dist/module/components/InfoBox/InfoBox.js +10 -3
- package/dist/module/components/InfoBox/InfoBox.js.map +1 -1
- package/dist/module/components/InfoBox/index.js +27 -2
- package/dist/module/components/InfoBox/index.js.map +1 -1
- package/dist/module/components/InfoBox/types.js +5 -1
- package/dist/module/components/Input/NumberInput.js +21 -13
- package/dist/module/components/Input/NumberInput.js.map +1 -1
- package/dist/module/components/Input/index.js +38 -3
- package/dist/module/components/Input/index.js.map +1 -1
- package/dist/module/components/Input/types.js +5 -1
- package/dist/module/components/Input/useNumberFormat.js +11 -4
- package/dist/module/components/Input/useNumberFormat.js.map +1 -1
- package/dist/module/components/InstrumentRate/InstrumentRate.js +37 -30
- package/dist/module/components/InstrumentRate/InstrumentRate.js.map +1 -1
- package/dist/module/components/InstrumentRate/InstrumentRateWithChart.js +19 -13
- package/dist/module/components/InstrumentRate/InstrumentRateWithChart.js.map +1 -1
- package/dist/module/components/InstrumentRate/index.js +38 -3
- package/dist/module/components/InstrumentRate/index.js.map +1 -1
- package/dist/module/components/InstrumentRate/types.js +5 -1
- package/dist/module/components/InstrumentRate/utils.js +13 -6
- package/dist/module/components/InstrumentRate/utils.js.map +1 -1
- package/dist/module/components/Label/Label.js +12 -6
- package/dist/module/components/Label/Label.js.map +1 -1
- package/dist/module/components/Label/index.js +16 -1
- package/dist/module/components/Label/index.js.map +1 -1
- package/dist/module/components/LabelWrapper/LabelWrapper.js +24 -17
- package/dist/module/components/LabelWrapper/LabelWrapper.js.map +1 -1
- package/dist/module/components/LabelWrapper/index.js +27 -2
- package/dist/module/components/LabelWrapper/index.js.map +1 -1
- package/dist/module/components/LabelWrapper/types.js +7 -1
- package/dist/module/components/LabelWrapper/types.js.map +1 -1
- package/dist/module/components/LastUpdated/LastUpdated.js +13 -6
- package/dist/module/components/LastUpdated/LastUpdated.js.map +1 -1
- package/dist/module/components/LastUpdated/index.js +27 -2
- package/dist/module/components/LastUpdated/index.js.map +1 -1
- package/dist/module/components/LastUpdated/types.js +5 -1
- package/dist/module/components/LineChart/LineChart.js +18 -11
- package/dist/module/components/LineChart/LineChart.js.map +1 -1
- package/dist/module/components/LineChart/LineChartWithData.js +14 -8
- package/dist/module/components/LineChart/LineChartWithData.js.map +1 -1
- package/dist/module/components/LineChart/index.js +49 -4
- package/dist/module/components/LineChart/index.js.map +1 -1
- package/dist/module/components/LineChart/types.js +7 -1
- package/dist/module/components/LineChart/types.js.map +1 -1
- package/dist/module/components/LineChart/utils.js +16 -8
- package/dist/module/components/LineChart/utils.js.map +1 -1
- package/dist/module/components/Loader/Loader.js +18 -11
- package/dist/module/components/Loader/Loader.js.map +1 -1
- package/dist/module/components/Loader/index.js +27 -2
- package/dist/module/components/Loader/index.js.map +1 -1
- package/dist/module/components/Loader/types.js +7 -1
- package/dist/module/components/Loader/types.js.map +1 -1
- package/dist/module/components/Pagination/Pagination.js +40 -33
- package/dist/module/components/Pagination/Pagination.js.map +1 -1
- package/dist/module/components/Pagination/index.js +27 -2
- package/dist/module/components/Pagination/index.js.map +1 -1
- package/dist/module/components/Pagination/types.js +5 -1
- package/dist/module/components/Pagination/utils.js +8 -1
- package/dist/module/components/Pagination/utils.js.map +1 -1
- package/dist/module/components/Price/Price.js +23 -15
- package/dist/module/components/Price/Price.js.map +1 -1
- package/dist/module/components/Price/index.js +27 -2
- package/dist/module/components/Price/index.js.map +1 -1
- package/dist/module/components/Price/types.js +7 -1
- package/dist/module/components/Price/types.js.map +1 -1
- package/dist/module/components/SearchInput/SearchInput.js +12 -5
- package/dist/module/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/module/components/SearchInput/index.js +27 -2
- package/dist/module/components/SearchInput/index.js.map +1 -1
- package/dist/module/components/SearchInput/types.js +5 -1
- package/dist/module/components/Select/Select.js +44 -36
- package/dist/module/components/Select/Select.js.map +1 -1
- package/dist/module/components/Select/index.js +27 -2
- package/dist/module/components/Select/index.js.map +1 -1
- package/dist/module/components/Select/types.js +5 -1
- package/dist/module/components/Sentiment/Sentiment.js +28 -20
- package/dist/module/components/Sentiment/Sentiment.js.map +1 -1
- package/dist/module/components/Sentiment/SentimentError.js +17 -10
- package/dist/module/components/Sentiment/SentimentError.js.map +1 -1
- package/dist/module/components/Sentiment/SentimentLoader.js +17 -10
- package/dist/module/components/Sentiment/SentimentLoader.js.map +1 -1
- package/dist/module/components/Sentiment/index.js +38 -3
- package/dist/module/components/Sentiment/index.js.map +1 -1
- package/dist/module/components/Sentiment/types.js +7 -1
- package/dist/module/components/Sentiment/types.js.map +1 -1
- package/dist/module/components/Sentiment/utils.js +7 -1
- package/dist/module/components/Sentiment/utils.js.map +1 -1
- package/dist/module/components/Spinner/Spinner.js +18 -10
- package/dist/module/components/Spinner/Spinner.js.map +1 -1
- package/dist/module/components/Spinner/index.js +27 -2
- package/dist/module/components/Spinner/index.js.map +1 -1
- package/dist/module/components/Spinner/types.js +7 -1
- package/dist/module/components/Spinner/types.js.map +1 -1
- package/dist/module/components/Switch/Switch.js +26 -18
- package/dist/module/components/Switch/Switch.js.map +1 -1
- package/dist/module/components/Switch/SwitchItem.js +18 -10
- package/dist/module/components/Switch/SwitchItem.js.map +1 -1
- package/dist/module/components/Switch/constants.js +7 -1
- package/dist/module/components/Switch/constants.js.map +1 -1
- package/dist/module/components/Switch/index.js +16 -1
- package/dist/module/components/Switch/index.js.map +1 -1
- package/dist/module/components/Switch/types.js +5 -1
- package/dist/module/components/Table/Table.js +21 -14
- package/dist/module/components/Table/Table.js.map +1 -1
- package/dist/module/components/Table/TableCell.js +19 -12
- package/dist/module/components/Table/TableCell.js.map +1 -1
- package/dist/module/components/Table/TableHeader.js +20 -13
- package/dist/module/components/Table/TableHeader.js.map +1 -1
- package/dist/module/components/Table/TableRow.js +15 -8
- package/dist/module/components/Table/TableRow.js.map +1 -1
- package/dist/module/components/Table/columns/ChartColumn.js +20 -12
- package/dist/module/components/Table/columns/ChartColumn.js.map +1 -1
- package/dist/module/components/Table/columns/DailyChangeColumn.js +15 -7
- package/dist/module/components/Table/columns/DailyChangeColumn.js.map +1 -1
- package/dist/module/components/Table/columns/InstrumentColumn.js +19 -11
- package/dist/module/components/Table/columns/InstrumentColumn.js.map +1 -1
- package/dist/module/components/Table/columns/PriceColumn.js +16 -8
- package/dist/module/components/Table/columns/PriceColumn.js.map +1 -1
- package/dist/module/components/Table/columns/SentimentColumn.js +16 -8
- package/dist/module/components/Table/columns/SentimentColumn.js.map +1 -1
- package/dist/module/components/Table/columns/SpreadColumn.js +17 -9
- package/dist/module/components/Table/columns/SpreadColumn.js.map +1 -1
- package/dist/module/components/Table/columns/index.js +71 -6
- package/dist/module/components/Table/columns/index.js.map +1 -1
- package/dist/module/components/Table/index.js +60 -5
- package/dist/module/components/Table/index.js.map +1 -1
- package/dist/module/components/Table/types.js +5 -1
- package/dist/module/components/TableWidget/CardRecordRow.js +22 -14
- package/dist/module/components/TableWidget/CardRecordRow.js.map +1 -1
- package/dist/module/components/TableWidget/CardRenderer.js +20 -12
- package/dist/module/components/TableWidget/CardRenderer.js.map +1 -1
- package/dist/module/components/TableWidget/Cards.js +14 -6
- package/dist/module/components/TableWidget/Cards.js.map +1 -1
- package/dist/module/components/TableWidget/ColumnRenderer.js +42 -34
- package/dist/module/components/TableWidget/ColumnRenderer.js.map +1 -1
- package/dist/module/components/TableWidget/DataRecordRow.js +20 -12
- package/dist/module/components/TableWidget/DataRecordRow.js.map +1 -1
- package/dist/module/components/TableWidget/TableWidget.js +34 -26
- package/dist/module/components/TableWidget/TableWidget.js.map +1 -1
- package/dist/module/components/TableWidget/index.js +27 -2
- package/dist/module/components/TableWidget/index.js.map +1 -1
- package/dist/module/components/TableWidget/types.js +5 -1
- package/dist/module/components/TableWidget/utils.js +12 -4
- package/dist/module/components/TableWidget/utils.js.map +1 -1
- package/dist/module/components/Tabs/Tab.js +16 -10
- package/dist/module/components/Tabs/Tab.js.map +1 -1
- package/dist/module/components/Tabs/Tabs.js +11 -5
- package/dist/module/components/Tabs/Tabs.js.map +1 -1
- package/dist/module/components/Tabs/index.js +16 -1
- package/dist/module/components/Tabs/index.js.map +1 -1
- package/dist/module/components/Tabs/types.js +5 -1
- package/dist/module/components/TextInput/TextInput.js +17 -10
- package/dist/module/components/TextInput/TextInput.js.map +1 -1
- package/dist/module/components/TextInput/index.js +16 -1
- package/dist/module/components/TextInput/index.js.map +1 -1
- package/dist/module/components/TimeUnitSwitch/TimeUnitSelect.js +14 -7
- package/dist/module/components/TimeUnitSwitch/TimeUnitSelect.js.map +1 -1
- package/dist/module/components/TimeUnitSwitch/TimeUnitSwitch.js +22 -15
- package/dist/module/components/TimeUnitSwitch/TimeUnitSwitch.js.map +1 -1
- package/dist/module/components/TimeUnitSwitch/index.js +16 -1
- package/dist/module/components/TimeUnitSwitch/index.js.map +1 -1
- package/dist/module/components/TimeUnitSwitch/types.js +5 -1
- package/dist/module/components/Tooltip/Tooltip.js +11 -4
- package/dist/module/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/module/components/Tooltip/index.js +27 -2
- package/dist/module/components/Tooltip/index.js.map +1 -1
- package/dist/module/components/Tooltip/types.js +5 -1
- package/dist/module/components/Truncate/Truncate.js +18 -11
- package/dist/module/components/Truncate/Truncate.js.map +1 -1
- package/dist/module/components/Truncate/index.js +27 -2
- package/dist/module/components/Truncate/index.js.map +1 -1
- package/dist/module/components/Truncate/types.js +5 -1
- package/dist/module/components/WidgetWrapper/WidgetWrapper.js +14 -6
- package/dist/module/components/WidgetWrapper/WidgetWrapper.js.map +1 -1
- package/dist/module/components/WidgetWrapper/index.js +16 -1
- package/dist/module/components/WidgetWrapper/index.js.map +1 -1
- package/dist/module/components/constant.js +8 -2
- package/dist/module/components/constant.js.map +1 -1
- package/dist/module/components/index.js +292 -27
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/style.css +1 -1
- package/dist/module/constants/index.js +13 -7
- package/dist/module/constants/index.js.map +1 -1
- package/dist/module/fonts/index.js +27 -4
- package/dist/module/fonts/index.js.map +1 -1
- package/dist/module/hooks/index.js +71 -6
- package/dist/module/hooks/index.js.map +1 -1
- package/dist/module/hooks/useFetchCombinedDataRecords.js +14 -7
- package/dist/module/hooks/useFetchCombinedDataRecords.js.map +1 -1
- package/dist/module/hooks/useLiveRates.js +12 -5
- package/dist/module/hooks/useLiveRates.js.map +1 -1
- package/dist/module/hooks/useLiveRatesMessage.js +26 -19
- package/dist/module/hooks/useLiveRatesMessage.js.map +1 -1
- package/dist/module/hooks/useLiveRatesQuery.js +12 -5
- package/dist/module/hooks/useLiveRatesQuery.js.map +1 -1
- package/dist/module/hooks/useRecords.js +13 -7
- package/dist/module/hooks/useRecords.js.map +1 -1
- package/dist/module/hooks/useVisibleLiveDataRecord.js +16 -9
- package/dist/module/hooks/useVisibleLiveDataRecord.js.map +1 -1
- package/dist/module/images/index.js +111 -16
- package/dist/module/images/index.js.map +1 -1
- package/dist/module/index.js +126 -11
- package/dist/module/index.js.map +1 -1
- package/dist/module/providers/ConditionalProvider.js +11 -3
- package/dist/module/providers/ConditionalProvider.js.map +1 -1
- package/dist/module/providers/Layout/LayoutContext.js +12 -4
- package/dist/module/providers/Layout/LayoutContext.js.map +1 -1
- package/dist/module/providers/Layout/LayoutProvider.js +30 -22
- package/dist/module/providers/Layout/LayoutProvider.js.map +1 -1
- package/dist/module/providers/Layout/LayoutProvider.test.js +61 -58
- package/dist/module/providers/Layout/LayoutProvider.test.js.map +1 -1
- package/dist/module/providers/Layout/index.js +27 -2
- package/dist/module/providers/Layout/index.js.map +1 -1
- package/dist/module/providers/LiveRates/LiveRatesContext.js +11 -4
- package/dist/module/providers/LiveRates/LiveRatesContext.js.map +1 -1
- package/dist/module/providers/LiveRates/LiveRatesProvider.js +37 -29
- package/dist/module/providers/LiveRates/LiveRatesProvider.js.map +1 -1
- package/dist/module/providers/LiveRates/index.js +27 -2
- package/dist/module/providers/LiveRates/index.js.map +1 -1
- package/dist/module/providers/Widget/WidgetProvider.js +26 -18
- package/dist/module/providers/Widget/WidgetProvider.js.map +1 -1
- package/dist/module/providers/Widget/index.js +16 -1
- package/dist/module/providers/Widget/index.js.map +1 -1
- package/dist/module/providers/index.js +38 -3
- package/dist/module/providers/index.js.map +1 -1
- package/dist/module/tailwind/cn.js +11 -4
- package/dist/module/tailwind/cn.js.map +1 -1
- package/dist/module/tailwind/colors.js +9 -3
- package/dist/module/tailwind/colors.js.map +1 -1
- package/dist/module/tailwind/index.js +39 -3
- package/dist/module/tailwind/index.js.map +1 -1
- package/dist/module/tailwind/preset.js +11 -5
- package/dist/module/tailwind/preset.js.map +1 -1
- package/dist/module/tailwind/themes/background.js +14 -8
- package/dist/module/tailwind/themes/background.js.map +1 -1
- package/dist/module/tailwind/themes/border.js +10 -4
- package/dist/module/tailwind/themes/border.js.map +1 -1
- package/dist/module/tailwind/themes/index.js +12 -6
- package/dist/module/tailwind/themes/index.js.map +1 -1
- package/dist/module/tailwind/themes/text.js +18 -12
- package/dist/module/tailwind/themes/text.js.map +1 -1
- package/dist/module/tailwind/themes/themeColors.js +26 -20
- package/dist/module/tailwind/themes/themeColors.js.map +1 -1
- package/dist/module/tailwind/types.js +5 -1
- package/dist/module/tailwind/utils.js +8 -1
- package/dist/module/tailwind/utils.js.map +1 -1
- package/dist/module/testUtils/index.js +15 -7
- package/dist/module/testUtils/index.js.map +1 -1
- package/dist/module/translations/index.js +15 -8
- package/dist/module/translations/index.js.map +1 -1
- package/dist/module/translations/translations.js +7 -1
- package/dist/module/translations/translations.js.map +1 -1
- package/dist/module/types/dataTypes.js +7 -1
- package/dist/module/types/dataTypes.js.map +1 -1
- package/dist/module/types/index.js +36 -4
- package/dist/module/types/index.js.map +1 -1
- package/dist/module/types/liveRatesTypes.js +5 -1
- package/dist/module/utils/dateUtils.js +9 -1
- package/dist/module/utils/dateUtils.js.map +1 -1
- package/dist/module/utils/getLocale.js +20 -13
- package/dist/module/utils/getLocale.js.map +1 -1
- package/dist/module/utils/index.js +38 -3
- package/dist/module/utils/index.js.map +1 -1
- package/dist/module/utils/liveRates/buildUrl.js +8 -1
- package/dist/module/utils/liveRates/buildUrl.js.map +1 -1
- package/dist/module/utils/liveRates/calculatePipsChangeFromOpen.js +7 -1
- package/dist/module/utils/liveRates/calculatePipsChangeFromOpen.js.map +1 -1
- package/dist/module/utils/liveRates/calculatePriceChange.js +8 -1
- package/dist/module/utils/liveRates/calculatePriceChange.js.map +1 -1
- package/dist/module/utils/liveRates/calculatePriceChangeFromOpen.js +8 -1
- package/dist/module/utils/liveRates/calculatePriceChangeFromOpen.js.map +1 -1
- package/dist/module/utils/liveRates/calculateSpread.js +8 -1
- package/dist/module/utils/liveRates/calculateSpread.js.map +1 -1
- package/dist/module/utils/liveRates/decodeLiveRateMessage.js +9 -2
- package/dist/module/utils/liveRates/decodeLiveRateMessage.js.map +1 -1
- package/dist/module/utils/liveRates/decodeUtilities.js +18 -6
- package/dist/module/utils/liveRates/decodeUtilities.js.map +1 -1
- package/dist/module/utils/liveRates/index.js +82 -7
- package/dist/module/utils/liveRates/index.js.map +1 -1
- package/dist/module/utils/validateToolParams.js +7 -1
- package/dist/module/utils/validateToolParams.js.map +1 -1
- package/package.json +9 -4
- package/src/components/style.css +1 -1
- package/tsconfig.types.json +2 -4
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TableWidget = void 0;
|
|
7
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _providers = require("../../providers");
|
|
10
|
+
var _tailwind = require("../../tailwind");
|
|
11
|
+
var _types = require("../../types");
|
|
12
|
+
var _LastUpdated = require("../LastUpdated");
|
|
13
|
+
var _Table = require("../Table");
|
|
14
|
+
var _Tooltip = require("../Tooltip");
|
|
15
|
+
var _CardRecordRow = require("./CardRecordRow");
|
|
16
|
+
var _Cards = require("./Cards");
|
|
17
|
+
var _DataRecordRow = require("./DataRecordRow");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
const TableWidget = _ref => {
|
|
13
20
|
let {
|
|
14
21
|
testId,
|
|
15
22
|
toolTipId,
|
|
@@ -30,25 +37,25 @@ export const TableWidget = _ref => {
|
|
|
30
37
|
} = _ref;
|
|
31
38
|
const {
|
|
32
39
|
lang
|
|
33
|
-
} = useLocale();
|
|
40
|
+
} = (0, _monoI18n.useLocale)();
|
|
34
41
|
const {
|
|
35
42
|
size
|
|
36
|
-
} = useLayoutProvider();
|
|
37
|
-
const isDesktop = size === Size.DESKTOP;
|
|
43
|
+
} = (0, _providers.useLayoutProvider)();
|
|
44
|
+
const isDesktop = size === _types.Size.DESKTOP;
|
|
38
45
|
const isTable = viewType ? viewType === 'table' : isDesktop;
|
|
39
46
|
if (!size) {
|
|
40
47
|
return null;
|
|
41
48
|
}
|
|
42
|
-
return
|
|
49
|
+
return _react.default.createElement("div", {
|
|
43
50
|
className: "lw-relative lw-text-sm lw-tracking-normal lw-text-text-primary",
|
|
44
51
|
"data-testid": testId
|
|
45
|
-
}, TabsComponent, isTable ?
|
|
52
|
+
}, TabsComponent, isTable ? _react.default.createElement("div", {
|
|
46
53
|
className: "lw-border lw-border-solid lw-border-border-primary"
|
|
47
|
-
},
|
|
54
|
+
}, _react.default.createElement(_Table.Table, {
|
|
48
55
|
headerConfig: headerColumns,
|
|
49
56
|
isError: hasError,
|
|
50
57
|
records: records,
|
|
51
|
-
renderRow: (record, index, isScrolled) =>
|
|
58
|
+
renderRow: (record, index, isScrolled) => _react.default.createElement(_DataRecordRow.DataRecordRow, {
|
|
52
59
|
key: `row_${index}`,
|
|
53
60
|
activeColumns: activeColumns,
|
|
54
61
|
hasBackgroundColor: index % 2 === 0,
|
|
@@ -60,7 +67,7 @@ export const TableWidget = _ref => {
|
|
|
60
67
|
target: target,
|
|
61
68
|
toolTipId: toolTipId
|
|
62
69
|
})
|
|
63
|
-
})) :
|
|
70
|
+
})) : _react.default.createElement(_Cards.Cards, {
|
|
64
71
|
isError: hasError,
|
|
65
72
|
records: records,
|
|
66
73
|
renderCard: _ref2 => {
|
|
@@ -69,7 +76,7 @@ export const TableWidget = _ref => {
|
|
|
69
76
|
idx,
|
|
70
77
|
isLast
|
|
71
78
|
} = _ref2;
|
|
72
|
-
return
|
|
79
|
+
return _react.default.createElement(_CardRecordRow.CardRecordRow, {
|
|
73
80
|
activeColumns: activeColumns,
|
|
74
81
|
index: idx,
|
|
75
82
|
isChartLoading: isChartLoading,
|
|
@@ -81,17 +88,18 @@ export const TableWidget = _ref => {
|
|
|
81
88
|
});
|
|
82
89
|
},
|
|
83
90
|
startIndex: pageNumber * count
|
|
84
|
-
}), PaginationComponent && !hasError &&
|
|
85
|
-
className: cn('lw-border-solid lw-border-border-primary', {
|
|
91
|
+
}), PaginationComponent && !hasError && _react.default.createElement("div", {
|
|
92
|
+
className: (0, _tailwind.cn)('lw-border-solid lw-border-border-primary', {
|
|
86
93
|
'lw-border-x lw-border-b': isDesktop
|
|
87
94
|
})
|
|
88
|
-
}, PaginationComponent),
|
|
95
|
+
}, PaginationComponent), _react.default.createElement(_Tooltip.Tooltip, {
|
|
89
96
|
id: toolTipId
|
|
90
|
-
}), !hasError && timestamp &&
|
|
97
|
+
}), !hasError && timestamp && _react.default.createElement("div", {
|
|
91
98
|
className: "lw-mt-2 lw-h-8"
|
|
92
|
-
},
|
|
99
|
+
}, _react.default.createElement(_LastUpdated.LastUpdated, {
|
|
93
100
|
labelCallback: lang,
|
|
94
101
|
timestamp: timestamp
|
|
95
102
|
})));
|
|
96
103
|
};
|
|
104
|
+
exports.TableWidget = TableWidget;
|
|
97
105
|
//# sourceMappingURL=TableWidget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableWidget.js","names":["
|
|
1
|
+
{"version":3,"file":"TableWidget.js","names":["_monoI18n","require","_react","_interopRequireDefault","_providers","_tailwind","_types","_LastUpdated","_Table","_Tooltip","_CardRecordRow","_Cards","_DataRecordRow","e","__esModule","default","TableWidget","_ref","testId","toolTipId","PaginationComponent","hasError","TabsComponent","headerColumns","records","target","isLoading","isChartLoading","activeColumns","timestamp","pageNumber","count","viewType","instrumentColumnWidth","lang","useLocale","size","useLayoutProvider","isDesktop","Size","DESKTOP","isTable","createElement","className","Table","headerConfig","isError","renderRow","record","index","isScrolled","DataRecordRow","key","hasBackgroundColor","Cards","renderCard","_ref2","idx","isLast","CardRecordRow","tooltipId","startIndex","cn","Tooltip","id","LastUpdated","labelCallback","exports"],"sources":["../../../../src/components/TableWidget/TableWidget.tsx"],"sourcesContent":["import { useLocale } from '@oanda/mono-i18n';\nimport type { ReactElement } from 'react';\nimport React from 'react';\n\nimport { useLayoutProvider } from '../../providers';\nimport { cn } from '../../tailwind';\nimport type { DataRecord, DataRecordType } from '../../types';\nimport { Size } from '../../types';\nimport { LastUpdated } from '../LastUpdated';\nimport type { Pagination, PaginationProps } from '../Pagination';\nimport type { HeaderColumns } from '../Table';\nimport { Table } from '../Table';\nimport type { Tabs } from '../Tabs';\nimport type { TabsProps } from '../Tabs/types';\nimport { Tooltip } from '../Tooltip';\nimport { CardRecordRow } from './CardRecordRow';\nimport { Cards } from './Cards';\nimport { DataRecordRow } from './DataRecordRow';\n\ninterface TableWidgetProps<TTabs> {\n testId: string;\n toolTipId: string;\n hasError?: boolean;\n TabsComponent?: ReactElement<TabsProps<TTabs>, typeof Tabs<TTabs>>;\n PaginationComponent?: ReactElement<PaginationProps, typeof Pagination>;\n headerColumns: HeaderColumns[];\n records: DataRecord[];\n target: EventTarget | null;\n isLoading: boolean;\n isChartLoading?: boolean;\n activeColumns: DataRecordType[];\n timestamp?: string;\n pageNumber: number;\n count: number;\n viewType?: 'table' | 'cards';\n instrumentColumnWidth?: string;\n}\n\nexport const TableWidget = <TTabs,>({\n testId,\n toolTipId,\n PaginationComponent,\n hasError,\n TabsComponent,\n headerColumns,\n records,\n target,\n isLoading,\n isChartLoading,\n activeColumns,\n timestamp,\n pageNumber,\n count,\n viewType,\n instrumentColumnWidth,\n}: TableWidgetProps<TTabs>) => {\n const { lang } = useLocale();\n const { size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n const isTable = viewType ? viewType === 'table' : isDesktop;\n\n if (!size) {\n return null;\n }\n\n return (\n <div\n className=\"lw-relative lw-text-sm lw-tracking-normal lw-text-text-primary\"\n data-testid={testId}\n >\n {TabsComponent}\n\n {isTable ? (\n <div className=\"lw-border lw-border-solid lw-border-border-primary\">\n <Table<DataRecord>\n headerConfig={headerColumns}\n isError={hasError}\n records={records}\n renderRow={(record, index, isScrolled) => (\n <DataRecordRow\n key={`row_${index}`}\n activeColumns={activeColumns}\n hasBackgroundColor={index % 2 === 0}\n instrumentColumnWidth={instrumentColumnWidth}\n isChartLoading={isChartLoading}\n isLoading={isLoading}\n isScrolled={isScrolled}\n record={record}\n target={target}\n toolTipId={toolTipId}\n />\n )}\n />\n </div>\n ) : (\n <Cards\n isError={hasError}\n records={records}\n renderCard={({ record, idx, isLast }) => (\n <CardRecordRow\n activeColumns={activeColumns}\n index={idx}\n isChartLoading={isChartLoading}\n isLast={isLast}\n isLoading={isLoading}\n record={record}\n target={target}\n tooltipId={toolTipId}\n />\n )}\n startIndex={pageNumber * count}\n />\n )}\n\n {PaginationComponent && !hasError && (\n <div\n className={cn('lw-border-solid lw-border-border-primary', {\n 'lw-border-x lw-border-b': isDesktop,\n })}\n >\n {PaginationComponent}\n </div>\n )}\n\n <Tooltip id={toolTipId} />\n\n {!hasError && timestamp && (\n <div className=\"lw-mt-2 lw-h-8\">\n <LastUpdated labelCallback={lang} timestamp={timestamp} />\n </div>\n )}\n </div>\n );\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _TableWidget = require("./TableWidget");
|
|
7
|
+
Object.keys(_TableWidget).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _TableWidget[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _TableWidget[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _utils = require("./utils");
|
|
18
|
+
Object.keys(_utils).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _utils[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
3
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/TableWidget/index.ts"],"sourcesContent":["export * from './TableWidget';\nexport * from './utils';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_TableWidget","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_utils"],"sources":["../../../../src/components/TableWidget/index.ts"],"sourcesContent":["export * from './TableWidget';\nexport * from './utils';\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,MAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,MAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,MAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,MAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTableRowIndex = exports.getHeaderConfig = void 0;
|
|
7
|
+
var _types = require("../../types");
|
|
8
|
+
const getTableRowIndex = () => ({});
|
|
9
|
+
exports.getTableRowIndex = getTableRowIndex;
|
|
10
|
+
const getHeaderConfig = (activeColumns, headerConfig) => {
|
|
11
|
+
const columns = [_types.DataRecordType.INSTRUMENT, ...activeColumns];
|
|
5
12
|
return columns.map(item => headerConfig[item]).filter(headerCell => headerCell !== undefined);
|
|
6
13
|
};
|
|
14
|
+
exports.getHeaderConfig = getHeaderConfig;
|
|
7
15
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["
|
|
1
|
+
{"version":3,"file":"utils.js","names":["_types","require","getTableRowIndex","exports","getHeaderConfig","activeColumns","headerConfig","columns","DataRecordType","INSTRUMENT","map","item","filter","headerCell","undefined"],"sources":["../../../../src/components/TableWidget/utils.ts"],"sourcesContent":["import { DataRecordType } from '../../types';\nimport type { HeaderColumns, HeaderConfigType } from '../Table';\n\nexport const getTableRowIndex = () => ({});\n\nexport const getHeaderConfig = (\n activeColumns: DataRecordType[],\n headerConfig: HeaderConfigType\n): HeaderColumns[] => {\n const columns: DataRecordType[] = [\n DataRecordType.INSTRUMENT,\n ...activeColumns,\n ];\n\n return columns\n .map((item) => headerConfig[item])\n .filter((headerCell) => headerCell !== undefined);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGO,MAAMC,gBAAgB,GAAGA,CAAA,MAAO,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAD,gBAAA,GAAAA,gBAAA;AAEpC,MAAME,eAAe,GAAGA,CAC7BC,aAA+B,EAC/BC,YAA8B,KACV;EACpB,MAAMC,OAAyB,GAAG,CAChCC,qBAAc,CAACC,UAAU,EACzB,GAAGJ,aAAa,CACjB;EAED,OAAOE,OAAO,CACXG,GAAG,CAAEC,IAAI,IAAKL,YAAY,CAACK,IAAI,CAAC,CAAC,CACjCC,MAAM,CAAEC,UAAU,IAAKA,UAAU,KAAKC,SAAS,CAAC;AACrD,CAAC;AAACX,OAAA,CAAAC,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Tab = Tab;
|
|
7
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _providers = require("../../providers");
|
|
10
|
+
var _types = require("../../types");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
12
|
function Tab(_ref) {
|
|
6
13
|
let {
|
|
7
14
|
id,
|
|
@@ -13,10 +20,10 @@ function Tab(_ref) {
|
|
|
13
20
|
const {
|
|
14
21
|
isDark,
|
|
15
22
|
size
|
|
16
|
-
} = useLayoutProvider();
|
|
17
|
-
const isDesktop = size === Size.DESKTOP;
|
|
18
|
-
return
|
|
19
|
-
className:
|
|
23
|
+
} = (0, _providers.useLayoutProvider)();
|
|
24
|
+
const isDesktop = size === _types.Size.DESKTOP;
|
|
25
|
+
return _react.default.createElement("li", {
|
|
26
|
+
className: (0, _classnames.default)('lw-mb-0 lw-flex lw-min-w-[100px] lw-rounded lw-border lw-text-center lw-text-lg lw-tracking-normal', {
|
|
20
27
|
'lw-w-[calc(50%-0.5rem)]': mobileFullWidth,
|
|
21
28
|
'lw-border-primary lw-bg-primary lw-text-text-negative': isActive,
|
|
22
29
|
'lw-bg-bg-primary lw-text-text-primary': !isActive && isDark,
|
|
@@ -24,7 +31,7 @@ function Tab(_ref) {
|
|
|
24
31
|
'lw-flex-1': isDesktop
|
|
25
32
|
}),
|
|
26
33
|
"data-testid": "tab"
|
|
27
|
-
},
|
|
34
|
+
}, _react.default.createElement("button", {
|
|
28
35
|
"aria-current": isActive || undefined,
|
|
29
36
|
className: "lw-flex-1 lw-px-2.5 lw-py-2 lw-font-sans lw-capitalize focus:lw-outline-primary",
|
|
30
37
|
type: "button",
|
|
@@ -32,5 +39,4 @@ function Tab(_ref) {
|
|
|
32
39
|
onClick: handleClick
|
|
33
40
|
}, label));
|
|
34
41
|
}
|
|
35
|
-
export { Tab };
|
|
36
42
|
//# sourceMappingURL=Tab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","names":["
|
|
1
|
+
{"version":3,"file":"Tab.js","names":["_classnames","_interopRequireDefault","require","_react","_providers","_types","e","__esModule","default","Tab","_ref","id","label","isActive","handleClick","mobileFullWidth","isDark","size","useLayoutProvider","isDesktop","Size","DESKTOP","createElement","className","classnames","undefined","type","value","onClick"],"sources":["../../../../src/components/Tabs/Tab.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport React from 'react';\n\nimport { useLayoutProvider } from '../../providers';\nimport { Size } from '../../types';\nimport type { TabProps } from './types';\n\nfunction Tab<T>({\n id,\n label,\n isActive,\n handleClick,\n mobileFullWidth,\n}: TabProps<T>) {\n const { isDark, size } = useLayoutProvider();\n const isDesktop = size === Size.DESKTOP;\n\n return (\n <li\n className={classnames(\n 'lw-mb-0 lw-flex lw-min-w-[100px] lw-rounded lw-border lw-text-center lw-text-lg lw-tracking-normal',\n {\n 'lw-w-[calc(50%-0.5rem)]': mobileFullWidth,\n 'lw-border-primary lw-bg-primary lw-text-text-negative': isActive,\n 'lw-bg-bg-primary lw-text-text-primary': !isActive && isDark,\n 'lw-bg-bg-primary lw-text-text-secondary-75 hover:lw-text-text-secondary':\n !isActive && !isDark,\n 'lw-flex-1': isDesktop,\n }\n )}\n data-testid=\"tab\"\n >\n <button\n aria-current={isActive || undefined}\n className=\"lw-flex-1 lw-px-2.5 lw-py-2 lw-font-sans lw-capitalize focus:lw-outline-primary\"\n type=\"button\"\n value={id as string}\n onClick={handleClick}\n >\n {label as React.ReactNode}\n </button>\n </li>\n );\n}\n\nexport { Tab };\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAAmC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGnC,SAASG,GAAGA,CAAAC,IAAA,EAMI;EAAA,IANA;IACdC,EAAE;IACFC,KAAK;IACLC,QAAQ;IACRC,WAAW;IACXC;EACW,CAAC,GAAAL,IAAA;EACZ,MAAM;IAAEM,MAAM;IAAEC;EAAK,CAAC,GAAG,IAAAC,4BAAiB,EAAC,CAAC;EAC5C,MAAMC,SAAS,GAAGF,IAAI,KAAKG,WAAI,CAACC,OAAO;EAEvC,OACElB,MAAA,CAAAK,OAAA,CAAAc,aAAA;IACEC,SAAS,EAAE,IAAAC,mBAAU,EACnB,oGAAoG,EACpG;MACE,yBAAyB,EAAET,eAAe;MAC1C,uDAAuD,EAAEF,QAAQ;MACjE,uCAAuC,EAAE,CAACA,QAAQ,IAAIG,MAAM;MAC5D,yEAAyE,EACvE,CAACH,QAAQ,IAAI,CAACG,MAAM;MACtB,WAAW,EAAEG;IACf,CACF,CAAE;IACF,eAAY;EAAK,GAEjBhB,MAAA,CAAAK,OAAA,CAAAc,aAAA;IACE,gBAAcT,QAAQ,IAAIY,SAAU;IACpCF,SAAS,EAAC,iFAAiF;IAC3FG,IAAI,EAAC,QAAQ;IACbC,KAAK,EAAEhB,EAAa;IACpBiB,OAAO,EAAEd;EAAY,GAEpBF,KACK,CACN,CAAC;AAET","ignoreList":[]}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Tabs = Tabs;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _Tab = require("./Tab");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
3
10
|
function Tabs(_ref) {
|
|
4
11
|
let {
|
|
5
12
|
items,
|
|
@@ -8,7 +15,7 @@ function Tabs(_ref) {
|
|
|
8
15
|
handleClick,
|
|
9
16
|
mobileFullWidth
|
|
10
17
|
} = _ref;
|
|
11
|
-
return
|
|
18
|
+
return _react.default.createElement("ul", {
|
|
12
19
|
className: "lw-mx-0 lw-mb-8 lw-flex lw-flex-wrap lw-justify-center lw-gap-4 lw-px-px",
|
|
13
20
|
"data-testid": "tabs"
|
|
14
21
|
}, items.map(_ref2 => {
|
|
@@ -16,7 +23,7 @@ function Tabs(_ref) {
|
|
|
16
23
|
id,
|
|
17
24
|
label
|
|
18
25
|
} = _ref2;
|
|
19
|
-
return
|
|
26
|
+
return _react.default.createElement(_Tab.Tab, {
|
|
20
27
|
key: `${id}-item`,
|
|
21
28
|
handleClick: handleClick,
|
|
22
29
|
id: id,
|
|
@@ -26,5 +33,4 @@ function Tabs(_ref) {
|
|
|
26
33
|
});
|
|
27
34
|
}));
|
|
28
35
|
}
|
|
29
|
-
export { Tabs };
|
|
30
36
|
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","names":["
|
|
1
|
+
{"version":3,"file":"Tabs.js","names":["_react","_interopRequireDefault","require","_Tab","e","__esModule","default","Tabs","_ref","items","activeTab","labelCallback","handleClick","mobileFullWidth","createElement","className","map","_ref2","id","label","Tab","key","isActive"],"sources":["../../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Tab } from './Tab';\nimport type { TabsProps } from './types';\n\nfunction Tabs<T>({\n items,\n activeTab,\n labelCallback,\n handleClick,\n mobileFullWidth,\n}: TabsProps<T>) {\n return (\n <ul\n className=\"lw-mx-0 lw-mb-8 lw-flex lw-flex-wrap lw-justify-center lw-gap-4 lw-px-px\"\n data-testid=\"tabs\"\n >\n {items.map(({ id, label }) => (\n <Tab\n key={`${id}-item`}\n handleClick={handleClick}\n id={id}\n isActive={id === activeTab}\n label={labelCallback ? labelCallback(label) : label}\n mobileFullWidth={mobileFullWidth}\n />\n ))}\n </ul>\n );\n}\n\nexport { Tabs };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AAA4B,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAG5B,SAASG,IAAIA,CAAAC,IAAA,EAMI;EAAA,IANA;IACfC,KAAK;IACLC,SAAS;IACTC,aAAa;IACbC,WAAW;IACXC;EACY,CAAC,GAAAL,IAAA;EACb,OACER,MAAA,CAAAM,OAAA,CAAAQ,aAAA;IACEC,SAAS,EAAC,0EAA0E;IACpF,eAAY;EAAM,GAEjBN,KAAK,CAACO,GAAG,CAACC,KAAA;IAAA,IAAC;MAAEC,EAAE;MAAEC;IAAM,CAAC,GAAAF,KAAA;IAAA,OACvBjB,MAAA,CAAAM,OAAA,CAAAQ,aAAA,CAACX,IAAA,CAAAiB,GAAG;MACFC,GAAG,EAAE,GAAGH,EAAE,OAAQ;MAClBN,WAAW,EAAEA,WAAY;MACzBM,EAAE,EAAEA,EAAG;MACPI,QAAQ,EAAEJ,EAAE,KAAKR,SAAU;MAC3BS,KAAK,EAAER,aAAa,GAAGA,aAAa,CAACQ,KAAK,CAAC,GAAGA,KAAM;MACpDN,eAAe,EAAEA;IAAgB,CAClC,CAAC;EAAA,CACH,CACC,CAAC;AAET","ignoreList":[]}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _Tabs = require("./Tabs");
|
|
7
|
+
Object.keys(_Tabs).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _Tabs[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Tabs[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
2
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/Tabs/index.ts"],"sourcesContent":["export * from './Tabs';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Tabs","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../src/components/Tabs/index.ts"],"sourcesContent":["export * from './Tabs';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TextInput = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _images = require("../../images");
|
|
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); }
|
|
3
10
|
const TextInput = _ref => {
|
|
4
11
|
let {
|
|
5
12
|
value,
|
|
@@ -7,18 +14,18 @@ const TextInput = _ref => {
|
|
|
7
14
|
placeholder = '',
|
|
8
15
|
label
|
|
9
16
|
} = _ref;
|
|
10
|
-
const inputRef = useRef(null);
|
|
17
|
+
const inputRef = (0, _react.useRef)(null);
|
|
11
18
|
const handleReset = () => {
|
|
12
19
|
inputRef.current?.focus();
|
|
13
20
|
onChange('');
|
|
14
21
|
};
|
|
15
|
-
return
|
|
22
|
+
return _react.default.createElement("div", {
|
|
16
23
|
className: "lw-text-text-primary"
|
|
17
|
-
}, label &&
|
|
24
|
+
}, label && _react.default.createElement("div", null, _react.default.createElement("span", {
|
|
18
25
|
className: "lw-text-base lw-font-bold"
|
|
19
|
-
}, `${label}:`)),
|
|
26
|
+
}, `${label}:`)), _react.default.createElement("div", null), _react.default.createElement("div", {
|
|
20
27
|
className: "lw-relative"
|
|
21
|
-
},
|
|
28
|
+
}, _react.default.createElement("input", {
|
|
22
29
|
ref: inputRef,
|
|
23
30
|
className: "lw-flex lw-h-[50px] lw-w-full lw-items-center lw-justify-between lw-rounded lw-border lw-bg-transparent lw-stroke-text-primary lw-py-2 lw-pl-3 lw-pr-8 focus:lw-outline-primary",
|
|
24
31
|
"data-testid": "text-input",
|
|
@@ -26,11 +33,11 @@ const TextInput = _ref => {
|
|
|
26
33
|
type: "text",
|
|
27
34
|
value: value,
|
|
28
35
|
onChange: e => onChange(e.target.value)
|
|
29
|
-
}), value.length > 0 &&
|
|
36
|
+
}), value.length > 0 && _react.default.createElement("button", {
|
|
30
37
|
className: "lw-absolute lw-right-1 lw-top-1 lw-h-[42px] lw-cursor-pointer lw-rounded focus:lw-outline-primary [&>svg]:lw-stroke-text-primary",
|
|
31
38
|
"data-testid": "text-input-clear-button",
|
|
32
39
|
onClick: handleReset
|
|
33
|
-
},
|
|
40
|
+
}, _react.default.createElement(_images.CloseIcon, null))));
|
|
34
41
|
};
|
|
35
|
-
|
|
42
|
+
exports.TextInput = TextInput;
|
|
36
43
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","names":["
|
|
1
|
+
{"version":3,"file":"TextInput.js","names":["_react","_interopRequireWildcard","require","_images","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","TextInput","_ref","value","onChange","placeholder","label","inputRef","useRef","handleReset","current","focus","createElement","className","ref","type","target","length","onClick","CloseIcon","exports"],"sources":["../../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["import React, { useRef } from 'react';\n\nimport { CloseIcon } from '../../images';\n\ninterface TextInputProps {\n value: string;\n onChange: (val: string) => void;\n placeholder?: string;\n label?: string;\n}\n\nconst TextInput: React.FC<TextInputProps> = ({\n value,\n onChange,\n placeholder = '',\n label,\n}) => {\n const inputRef = useRef<HTMLInputElement>(null);\n\n const handleReset = () => {\n inputRef.current?.focus();\n onChange('');\n };\n return (\n <div className=\"lw-text-text-primary\">\n {label && (\n <div>\n <span className=\"lw-text-base lw-font-bold\">{`${label}:`}</span>\n </div>\n )}\n <div />\n <div className=\"lw-relative\">\n <input\n ref={inputRef}\n className=\"lw-flex lw-h-[50px] lw-w-full lw-items-center lw-justify-between lw-rounded lw-border lw-bg-transparent lw-stroke-text-primary lw-py-2 lw-pl-3 lw-pr-8 focus:lw-outline-primary\"\n data-testid=\"text-input\"\n placeholder={placeholder}\n type=\"text\"\n value={value}\n onChange={(e) => onChange(e.target.value)}\n />\n {value.length > 0 && (\n <button\n className=\"lw-absolute lw-right-1 lw-top-1 lw-h-[42px] lw-cursor-pointer lw-rounded focus:lw-outline-primary [&>svg]:lw-stroke-text-primary\"\n data-testid=\"text-input-clear-button\"\n onClick={handleReset}\n >\n <CloseIcon />\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport { TextInput };\nexport type { TextInputProps };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAyC,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,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,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AASzC,MAAMkB,SAAmC,GAAGC,IAAA,IAKtC;EAAA,IALuC;IAC3CC,KAAK;IACLC,QAAQ;IACRC,WAAW,GAAG,EAAE;IAChBC;EACF,CAAC,GAAAJ,IAAA;EACC,MAAMK,QAAQ,GAAG,IAAAC,aAAM,EAAmB,IAAI,CAAC;EAE/C,MAAMC,WAAW,GAAGA,CAAA,KAAM;IACxBF,QAAQ,CAACG,OAAO,EAAEC,KAAK,CAAC,CAAC;IACzBP,QAAQ,CAAC,EAAE,CAAC;EACd,CAAC;EACD,OACE1B,MAAA,CAAAc,OAAA,CAAAoB,aAAA;IAAKC,SAAS,EAAC;EAAsB,GAClCP,KAAK,IACJ5B,MAAA,CAAAc,OAAA,CAAAoB,aAAA,cACElC,MAAA,CAAAc,OAAA,CAAAoB,aAAA;IAAMC,SAAS,EAAC;EAA2B,GAAE,GAAGP,KAAK,GAAU,CAC5D,CACN,EACD5B,MAAA,CAAAc,OAAA,CAAAoB,aAAA,YAAM,CAAC,EACPlC,MAAA,CAAAc,OAAA,CAAAoB,aAAA;IAAKC,SAAS,EAAC;EAAa,GAC1BnC,MAAA,CAAAc,OAAA,CAAAoB,aAAA;IACEE,GAAG,EAAEP,QAAS;IACdM,SAAS,EAAC,iLAAiL;IAC3L,eAAY,YAAY;IACxBR,WAAW,EAAEA,WAAY;IACzBU,IAAI,EAAC,MAAM;IACXZ,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAGtB,CAAC,IAAKsB,QAAQ,CAACtB,CAAC,CAACkC,MAAM,CAACb,KAAK;EAAE,CAC3C,CAAC,EACDA,KAAK,CAACc,MAAM,GAAG,CAAC,IACfvC,MAAA,CAAAc,OAAA,CAAAoB,aAAA;IACEC,SAAS,EAAC,kIAAkI;IAC5I,eAAY,yBAAyB;IACrCK,OAAO,EAAET;EAAY,GAErB/B,MAAA,CAAAc,OAAA,CAAAoB,aAAA,CAAC/B,OAAA,CAAAsC,SAAS,MAAE,CACN,CAEP,CACF,CAAC;AAEV,CAAC;AAACC,OAAA,CAAAnB,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -1,2 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _TextInput = require("./TextInput");
|
|
7
|
+
Object.keys(_TextInput).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _TextInput[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _TextInput[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
2
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/TextInput/index.ts"],"sourcesContent":["export * from './TextInput';\n"],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["_TextInput","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["../../../../src/components/TextInput/index.ts"],"sourcesContent":["export * from './TextInput';\n"],"mappings":";;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,UAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,UAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,UAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TimeUnitSelect = void 0;
|
|
7
|
+
var _monoI18n = require("@oanda/mono-i18n");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Select = require("../Select");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
4
11
|
const TimeUnitSelect = _ref => {
|
|
5
12
|
let {
|
|
6
13
|
selected,
|
|
@@ -9,7 +16,7 @@ const TimeUnitSelect = _ref => {
|
|
|
9
16
|
} = _ref;
|
|
10
17
|
const {
|
|
11
18
|
lang
|
|
12
|
-
} = useLocale();
|
|
19
|
+
} = (0, _monoI18n.useLocale)();
|
|
13
20
|
const selectOptions = options.map(_ref2 => {
|
|
14
21
|
let {
|
|
15
22
|
value,
|
|
@@ -31,10 +38,10 @@ const TimeUnitSelect = _ref => {
|
|
|
31
38
|
} = _ref3;
|
|
32
39
|
return id === selected;
|
|
33
40
|
});
|
|
34
|
-
return
|
|
41
|
+
return _react.default.createElement("div", {
|
|
35
42
|
className: "lw-mb-6 lw-w-full",
|
|
36
43
|
"data-testid": "time-unit-select"
|
|
37
|
-
},
|
|
44
|
+
}, _react.default.createElement(_Select.Select, {
|
|
38
45
|
options: selectOptions,
|
|
39
46
|
searchPlaceholder: lang('search'),
|
|
40
47
|
selectedOption: {
|
|
@@ -49,5 +56,5 @@ const TimeUnitSelect = _ref => {
|
|
|
49
56
|
}
|
|
50
57
|
}));
|
|
51
58
|
};
|
|
52
|
-
|
|
59
|
+
exports.TimeUnitSelect = TimeUnitSelect;
|
|
53
60
|
//# sourceMappingURL=TimeUnitSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimeUnitSelect.js","names":["
|
|
1
|
+
{"version":3,"file":"TimeUnitSelect.js","names":["_monoI18n","require","_react","_interopRequireDefault","_Select","e","__esModule","default","TimeUnitSelect","_ref","selected","options","callback","lang","useLocale","selectOptions","map","_ref2","value","label","tooltipLabel","id","translationKey","count","selectedLabel","filter","_ref3","createElement","className","Select","searchPlaceholder","selectedOption","setSelectedOption","_ref4","exports"],"sources":["../../../../src/components/TimeUnitSwitch/TimeUnitSelect.tsx"],"sourcesContent":["import { useLocale } from '@oanda/mono-i18n';\nimport React from 'react';\n\nimport type { SelectOption } from '../Select';\nimport { Select } from '../Select';\nimport type { TimeUnitSwitchProps } from './types';\n\nconst TimeUnitSelect = <T extends string>({\n selected,\n options,\n callback,\n}: TimeUnitSwitchProps<T>) => {\n const { lang } = useLocale();\n\n const selectOptions: SelectOption[] = options.map(\n ({ value, label, tooltipLabel }) => ({\n id: value,\n label: tooltipLabel\n ? lang(tooltipLabel.translationKey, { count: tooltipLabel.count })\n : lang(label),\n })\n );\n\n const [{ label: selectedLabel }] = selectOptions.filter(\n ({ id }) => id === selected\n );\n\n return (\n <div className=\"lw-mb-6 lw-w-full\" data-testid=\"time-unit-select\">\n <Select\n options={selectOptions}\n searchPlaceholder={lang('search')}\n selectedOption={{ id: selected, label: selectedLabel }}\n setSelectedOption={({ id }) => callback(id as T)}\n />\n </div>\n );\n};\n\nexport { TimeUnitSelect };\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,IAAAG,OAAA,GAAAH,OAAA;AAAmC,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGnC,MAAMG,cAAc,GAAGC,IAAA,IAIO;EAAA,IAJY;IACxCC,QAAQ;IACRC,OAAO;IACPC;EACsB,CAAC,GAAAH,IAAA;EACvB,MAAM;IAAEI;EAAK,CAAC,GAAG,IAAAC,mBAAS,EAAC,CAAC;EAE5B,MAAMC,aAA6B,GAAGJ,OAAO,CAACK,GAAG,CAC/CC,KAAA;IAAA,IAAC;MAAEC,KAAK;MAAEC,KAAK;MAAEC;IAAa,CAAC,GAAAH,KAAA;IAAA,OAAM;MACnCI,EAAE,EAAEH,KAAK;MACTC,KAAK,EAAEC,YAAY,GACfP,IAAI,CAACO,YAAY,CAACE,cAAc,EAAE;QAAEC,KAAK,EAAEH,YAAY,CAACG;MAAM,CAAC,CAAC,GAChEV,IAAI,CAACM,KAAK;IAChB,CAAC;EAAA,CACH,CAAC;EAED,MAAM,CAAC;IAAEA,KAAK,EAAEK;EAAc,CAAC,CAAC,GAAGT,aAAa,CAACU,MAAM,CACrDC,KAAA;IAAA,IAAC;MAAEL;IAAG,CAAC,GAAAK,KAAA;IAAA,OAAKL,EAAE,KAAKX,QAAQ;EAAA,CAC7B,CAAC;EAED,OACER,MAAA,CAAAK,OAAA,CAAAoB,aAAA;IAAKC,SAAS,EAAC,mBAAmB;IAAC,eAAY;EAAkB,GAC/D1B,MAAA,CAAAK,OAAA,CAAAoB,aAAA,CAACvB,OAAA,CAAAyB,MAAM;IACLlB,OAAO,EAAEI,aAAc;IACvBe,iBAAiB,EAAEjB,IAAI,CAAC,QAAQ,CAAE;IAClCkB,cAAc,EAAE;MAAEV,EAAE,EAAEX,QAAQ;MAAES,KAAK,EAAEK;IAAc,CAAE;IACvDQ,iBAAiB,EAAEC,KAAA;MAAA,IAAC;QAAEZ;MAAG,CAAC,GAAAY,KAAA;MAAA,OAAKrB,QAAQ,CAACS,EAAO,CAAC;IAAA;EAAC,CAClD,CACE,CAAC;AAEV,CAAC;AAACa,OAAA,CAAA1B,cAAA,GAAAA,cAAA","ignoreList":[]}
|