@oanda/labs-crowd-view-widget 1.0.69 → 1.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +458 -5120
  2. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +2 -2
  3. package/dist/main/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
  4. package/dist/main/translations/sources/ja.json +19 -18
  5. package/dist/module/CrowdViewWidget/CrowdViewWidget.js +19 -12
  6. package/dist/module/CrowdViewWidget/CrowdViewWidget.js.map +1 -1
  7. package/dist/module/CrowdViewWidget/Main.js +37 -30
  8. package/dist/module/CrowdViewWidget/Main.js.map +1 -1
  9. package/dist/module/CrowdViewWidget/components/Chart/Chart.js +36 -29
  10. package/dist/module/CrowdViewWidget/components/Chart/Chart.js.map +1 -1
  11. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js +30 -23
  12. package/dist/module/CrowdViewWidget/components/Chart/ChartWithData.js.map +1 -1
  13. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js +11 -4
  14. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getDataZoomConfig.js.map +1 -1
  15. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js +10 -3
  16. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridConfig.js.map +1 -1
  17. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js +21 -14
  18. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getGridLines.js.map +1 -1
  19. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js +23 -15
  20. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getLabelsConfig.js.map +1 -1
  21. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js +16 -8
  22. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesCandlestickConfig.js.map +1 -1
  23. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js +10 -3
  24. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesHeatmapConfig.js.map +1 -1
  25. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js +10 -3
  26. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getSeriesSentimentConfig.js.map +1 -1
  27. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js +12 -5
  28. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getTooltipConfig.js.map +1 -1
  29. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js +13 -6
  30. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getVisualMapConfig.js.map +1 -1
  31. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js +13 -6
  32. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getXAxisConfig.js.map +1 -1
  33. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js +14 -7
  34. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/getYAxisConfig.js.map +1 -1
  35. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js +126 -11
  36. package/dist/module/CrowdViewWidget/components/Chart/chartOptions/index.js.map +1 -1
  37. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.js +8 -1
  38. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatFullDate.js.map +1 -1
  39. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js +8 -1
  40. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisAdditionalLabel.js.map +1 -1
  41. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js +11 -4
  42. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatXAxisLabel.js.map +1 -1
  43. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatYAxisLabel.js +10 -3
  44. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/formatYAxisLabel.js.map +1 -1
  45. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js +15 -8
  46. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.js.map +1 -1
  47. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js +11 -3
  48. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.js.map +1 -1
  49. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js +8 -1
  50. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getLabelData.js.map +1 -1
  51. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js +12 -5
  52. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getRectColor.js.map +1 -1
  53. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js +19 -12
  54. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.js.map +1 -1
  55. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js +16 -9
  56. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.js.map +1 -1
  57. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js +8 -1
  58. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.js.map +1 -1
  59. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js +148 -13
  60. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/index.js.map +1 -1
  61. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js +10 -3
  62. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/isDifferenceGreaterThanTwoWeeks.js.map +1 -1
  63. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.js +8 -1
  64. package/dist/module/CrowdViewWidget/components/Chart/chartUtils/normalizeLocale.js.map +1 -1
  65. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getBucketWidthMultiplayer.js +11 -4
  66. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getBucketWidthMultiplayer.js.map +1 -1
  67. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig.js +14 -7
  68. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getInstrumentConfig.js.map +1 -1
  69. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js +14 -7
  70. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/getTimeSpanForGranularity.js.map +1 -1
  71. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js +82 -7
  72. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/index.js.map +1 -1
  73. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js +8 -1
  74. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processOrderPositionBooks.js.map +1 -1
  75. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js +8 -1
  76. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processPriceCandles.js.map +1 -1
  77. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js +8 -1
  78. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/processSentiments.js.map +1 -1
  79. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js +8 -1
  80. package/dist/module/CrowdViewWidget/components/Chart/dataUtils/validateData.js.map +1 -1
  81. package/dist/module/CrowdViewWidget/components/Chart/getOption.js +27 -20
  82. package/dist/module/CrowdViewWidget/components/Chart/getOption.js.map +1 -1
  83. package/dist/module/CrowdViewWidget/components/Chart/index.js +71 -6
  84. package/dist/module/CrowdViewWidget/components/Chart/index.js.map +1 -1
  85. package/dist/module/CrowdViewWidget/components/Chart/types.js +5 -1
  86. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js +35 -28
  87. package/dist/module/CrowdViewWidget/components/Chart/useCrowdViewData.js.map +1 -1
  88. package/dist/module/CrowdViewWidget/components/Chart/useResizeObserver.js +13 -6
  89. package/dist/module/CrowdViewWidget/components/Chart/useResizeObserver.js.map +1 -1
  90. package/dist/module/CrowdViewWidget/components/Legend/Legend.js +23 -15
  91. package/dist/module/CrowdViewWidget/components/Legend/Legend.js.map +1 -1
  92. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js +17 -9
  93. package/dist/module/CrowdViewWidget/components/Legend/LegendBar.js.map +1 -1
  94. package/dist/module/CrowdViewWidget/components/Legend/index.js +27 -2
  95. package/dist/module/CrowdViewWidget/components/Legend/index.js.map +1 -1
  96. package/dist/module/CrowdViewWidget/components/index.js +27 -2
  97. package/dist/module/CrowdViewWidget/components/index.js.map +1 -1
  98. package/dist/module/CrowdViewWidget/constants.js +38 -31
  99. package/dist/module/CrowdViewWidget/constants.js.map +1 -1
  100. package/dist/module/CrowdViewWidget/index.js +27 -2
  101. package/dist/module/CrowdViewWidget/index.js.map +1 -1
  102. package/dist/module/CrowdViewWidget/render.js +13 -10
  103. package/dist/module/CrowdViewWidget/render.js.map +1 -1
  104. package/dist/module/CrowdViewWidget/selectConfig.js +49 -43
  105. package/dist/module/CrowdViewWidget/selectConfig.js.map +1 -1
  106. package/dist/module/CrowdViewWidget/types.js +7 -1
  107. package/dist/module/CrowdViewWidget/types.js.map +1 -1
  108. package/dist/module/gql/getOrderPositionBooks.js +8 -3
  109. package/dist/module/gql/getOrderPositionBooks.js.map +1 -1
  110. package/dist/module/gql/getPriceCandles.js +8 -3
  111. package/dist/module/gql/getPriceCandles.js.map +1 -1
  112. package/dist/module/gql/getSentiments.js +8 -3
  113. package/dist/module/gql/getSentiments.js.map +1 -1
  114. package/dist/module/gql/types/fragment-masking.js +11 -3
  115. package/dist/module/gql/types/fragment-masking.js.map +1 -1
  116. package/dist/module/gql/types/gql.js +9 -2
  117. package/dist/module/gql/types/gql.js.map +1 -1
  118. package/dist/module/gql/types/graphql.js +27 -21
  119. package/dist/module/gql/types/graphql.js.map +1 -1
  120. package/dist/module/gql/types/index.js +27 -2
  121. package/dist/module/gql/types/index.js.map +1 -1
  122. package/dist/module/index.js +16 -1
  123. package/dist/module/index.js.map +1 -1
  124. package/dist/module/translations/index.js +15 -8
  125. package/dist/module/translations/index.js.map +1 -1
  126. package/dist/module/translations/sources/ja.json +19 -18
  127. package/dist/module/translations/translations.js +7 -1
  128. package/dist/module/translations/translations.js.map +1 -1
  129. package/dist/types/gql/getOrderPositionBooks.d.ts +1 -1
  130. package/dist/types/gql/getPriceCandles.d.ts +1 -1
  131. package/dist/types/gql/getSentiments.d.ts +1 -1
  132. package/package.json +8 -4
  133. package/src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts +2 -2
  134. package/src/translations/sources/ja.json +19 -18
  135. package/tsconfig.types.json +2 -4
@@ -1,9 +1,16 @@
1
- import { CHART_CONFIG } from '../../../constants';
2
- export const formatYAxisLabel = value => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatYAxisLabel = void 0;
7
+ var _constants = require("../../../constants");
8
+ const formatYAxisLabel = value => {
3
9
  const absValue = Math.abs(value);
4
10
  const integerPart = Math.floor(absValue);
5
11
  const integerDigits = integerPart === 0 ? 1 : Math.floor(Math.log10(integerPart)) + 1;
6
- const axisLabelDisplayPrecision = Math.max(0, CHART_CONFIG.TARGET_DIGIT_COUNT - integerDigits);
12
+ const axisLabelDisplayPrecision = Math.max(0, _constants.CHART_CONFIG.TARGET_DIGIT_COUNT - integerDigits);
7
13
  return value.toFixed(axisLabelDisplayPrecision);
8
14
  };
15
+ exports.formatYAxisLabel = formatYAxisLabel;
9
16
  //# sourceMappingURL=formatYAxisLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatYAxisLabel.js","names":["CHART_CONFIG","formatYAxisLabel","value","absValue","Math","abs","integerPart","floor","integerDigits","log10","axisLabelDisplayPrecision","max","TARGET_DIGIT_COUNT","toFixed"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/formatYAxisLabel.ts"],"sourcesContent":["import { CHART_CONFIG } from '../../../constants';\n\nexport const formatYAxisLabel = (value: number): string => {\n const absValue = Math.abs(value);\n const integerPart = Math.floor(absValue);\n const integerDigits =\n integerPart === 0 ? 1 : Math.floor(Math.log10(integerPart)) + 1;\n const axisLabelDisplayPrecision = Math.max(\n 0,\n CHART_CONFIG.TARGET_DIGIT_COUNT - integerDigits\n );\n return value.toFixed(axisLabelDisplayPrecision);\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,oBAAoB;AAEjD,OAAO,MAAMC,gBAAgB,GAAIC,KAAa,IAAa;EACzD,MAAMC,QAAQ,GAAGC,IAAI,CAACC,GAAG,CAACH,KAAK,CAAC;EAChC,MAAMI,WAAW,GAAGF,IAAI,CAACG,KAAK,CAACJ,QAAQ,CAAC;EACxC,MAAMK,aAAa,GACjBF,WAAW,KAAK,CAAC,GAAG,CAAC,GAAGF,IAAI,CAACG,KAAK,CAACH,IAAI,CAACK,KAAK,CAACH,WAAW,CAAC,CAAC,GAAG,CAAC;EACjE,MAAMI,yBAAyB,GAAGN,IAAI,CAACO,GAAG,CACxC,CAAC,EACDX,YAAY,CAACY,kBAAkB,GAAGJ,aACpC,CAAC;EACD,OAAON,KAAK,CAACW,OAAO,CAACH,yBAAyB,CAAC;AACjD,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"formatYAxisLabel.js","names":["_constants","require","formatYAxisLabel","value","absValue","Math","abs","integerPart","floor","integerDigits","log10","axisLabelDisplayPrecision","max","CHART_CONFIG","TARGET_DIGIT_COUNT","toFixed","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/formatYAxisLabel.ts"],"sourcesContent":["import { CHART_CONFIG } from '../../../constants';\n\nexport const formatYAxisLabel = (value: number): string => {\n const absValue = Math.abs(value);\n const integerPart = Math.floor(absValue);\n const integerDigits =\n integerPart === 0 ? 1 : Math.floor(Math.log10(integerPart)) + 1;\n const axisLabelDisplayPrecision = Math.max(\n 0,\n CHART_CONFIG.TARGET_DIGIT_COUNT - integerDigits\n );\n return value.toFixed(axisLabelDisplayPrecision);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEO,MAAMC,gBAAgB,GAAIC,KAAa,IAAa;EACzD,MAAMC,QAAQ,GAAGC,IAAI,CAACC,GAAG,CAACH,KAAK,CAAC;EAChC,MAAMI,WAAW,GAAGF,IAAI,CAACG,KAAK,CAACJ,QAAQ,CAAC;EACxC,MAAMK,aAAa,GACjBF,WAAW,KAAK,CAAC,GAAG,CAAC,GAAGF,IAAI,CAACG,KAAK,CAACH,IAAI,CAACK,KAAK,CAACH,WAAW,CAAC,CAAC,GAAG,CAAC;EACjE,MAAMI,yBAAyB,GAAGN,IAAI,CAACO,GAAG,CACxC,CAAC,EACDC,uBAAY,CAACC,kBAAkB,GAAGL,aACpC,CAAC;EACD,OAAON,KAAK,CAACY,OAAO,CAACJ,yBAAyB,CAAC;AACjD,CAAC;AAACK,OAAA,CAAAd,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,12 +1,18 @@
1
- import { colorPalette } from '@oanda/labs-widget-common';
2
- export const getChartStyles = isDark => {
3
- const sentimentLongColor = isDark ? colorPalette.darkBlue90 : colorPalette.lightBlue90;
4
- const sentimentShortColor = isDark ? colorPalette.darkYellow90 : colorPalette.lightYellow90;
5
- const sentimentOutlineColor = isDark ? colorPalette.black : colorPalette.white;
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getChartStyles = void 0;
7
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
8
+ const getChartStyles = isDark => {
9
+ const sentimentLongColor = isDark ? _labsWidgetCommon.colorPalette.darkBlue90 : _labsWidgetCommon.colorPalette.lightBlue90;
10
+ const sentimentShortColor = isDark ? _labsWidgetCommon.colorPalette.darkYellow90 : _labsWidgetCommon.colorPalette.lightYellow90;
11
+ const sentimentOutlineColor = isDark ? _labsWidgetCommon.colorPalette.black : _labsWidgetCommon.colorPalette.white;
6
12
  const sentimentOutlineWidth = isDark ? 3 : 2;
7
- const candleLongColor = isDark ? colorPalette.bottleGreenDark : colorPalette.bottleGreenLight;
8
- const candleShortColor = isDark ? colorPalette.orange : colorPalette.raspberryLight;
9
- const tooltipLinesColor = isDark ? colorPalette.orange : colorPalette.bottleGreenLight;
13
+ const candleLongColor = isDark ? _labsWidgetCommon.colorPalette.bottleGreenDark : _labsWidgetCommon.colorPalette.bottleGreenLight;
14
+ const candleShortColor = isDark ? _labsWidgetCommon.colorPalette.orange : _labsWidgetCommon.colorPalette.raspberryLight;
15
+ const tooltipLinesColor = isDark ? _labsWidgetCommon.colorPalette.orange : _labsWidgetCommon.colorPalette.bottleGreenLight;
10
16
  return {
11
17
  sentimentLongColor,
12
18
  sentimentShortColor,
@@ -17,4 +23,5 @@ export const getChartStyles = isDark => {
17
23
  sentimentOutlineWidth
18
24
  };
19
25
  };
26
+ exports.getChartStyles = getChartStyles;
20
27
  //# sourceMappingURL=getChartStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getChartStyles.js","names":["colorPalette","getChartStyles","isDark","sentimentLongColor","darkBlue90","lightBlue90","sentimentShortColor","darkYellow90","lightYellow90","sentimentOutlineColor","black","white","sentimentOutlineWidth","candleLongColor","bottleGreenDark","bottleGreenLight","candleShortColor","orange","raspberryLight","tooltipLinesColor"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nexport interface ChartStyles {\n sentimentLongColor: string;\n sentimentShortColor: string;\n sentimentOutlineColor: string;\n candleLongColor: string;\n candleShortColor: string;\n tooltipLinesColor: string;\n sentimentOutlineWidth: number;\n}\n\nexport const getChartStyles = (isDark: boolean): ChartStyles => {\n const sentimentLongColor = isDark\n ? colorPalette.darkBlue90\n : colorPalette.lightBlue90;\n const sentimentShortColor = isDark\n ? colorPalette.darkYellow90\n : colorPalette.lightYellow90;\n\n const sentimentOutlineColor = isDark\n ? colorPalette.black\n : colorPalette.white;\n const sentimentOutlineWidth = isDark ? 3 : 2;\n\n const candleLongColor = isDark\n ? colorPalette.bottleGreenDark\n : colorPalette.bottleGreenLight;\n const candleShortColor = isDark\n ? colorPalette.orange\n : colorPalette.raspberryLight;\n const tooltipLinesColor = isDark\n ? colorPalette.orange\n : colorPalette.bottleGreenLight;\n\n return {\n sentimentLongColor,\n sentimentShortColor,\n sentimentOutlineColor,\n candleLongColor,\n candleShortColor,\n tooltipLinesColor,\n sentimentOutlineWidth,\n };\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAYxD,OAAO,MAAMC,cAAc,GAAIC,MAAe,IAAkB;EAC9D,MAAMC,kBAAkB,GAAGD,MAAM,GAC7BF,YAAY,CAACI,UAAU,GACvBJ,YAAY,CAACK,WAAW;EAC5B,MAAMC,mBAAmB,GAAGJ,MAAM,GAC9BF,YAAY,CAACO,YAAY,GACzBP,YAAY,CAACQ,aAAa;EAE9B,MAAMC,qBAAqB,GAAGP,MAAM,GAChCF,YAAY,CAACU,KAAK,GAClBV,YAAY,CAACW,KAAK;EACtB,MAAMC,qBAAqB,GAAGV,MAAM,GAAG,CAAC,GAAG,CAAC;EAE5C,MAAMW,eAAe,GAAGX,MAAM,GAC1BF,YAAY,CAACc,eAAe,GAC5Bd,YAAY,CAACe,gBAAgB;EACjC,MAAMC,gBAAgB,GAAGd,MAAM,GAC3BF,YAAY,CAACiB,MAAM,GACnBjB,YAAY,CAACkB,cAAc;EAC/B,MAAMC,iBAAiB,GAAGjB,MAAM,GAC5BF,YAAY,CAACiB,MAAM,GACnBjB,YAAY,CAACe,gBAAgB;EAEjC,OAAO;IACLZ,kBAAkB;IAClBG,mBAAmB;IACnBG,qBAAqB;IACrBI,eAAe;IACfG,gBAAgB;IAChBG,iBAAiB;IACjBP;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getChartStyles.js","names":["_labsWidgetCommon","require","getChartStyles","isDark","sentimentLongColor","colorPalette","darkBlue90","lightBlue90","sentimentShortColor","darkYellow90","lightYellow90","sentimentOutlineColor","black","white","sentimentOutlineWidth","candleLongColor","bottleGreenDark","bottleGreenLight","candleShortColor","orange","raspberryLight","tooltipLinesColor","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getChartStyles.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nexport interface ChartStyles {\n sentimentLongColor: string;\n sentimentShortColor: string;\n sentimentOutlineColor: string;\n candleLongColor: string;\n candleShortColor: string;\n tooltipLinesColor: string;\n sentimentOutlineWidth: number;\n}\n\nexport const getChartStyles = (isDark: boolean): ChartStyles => {\n const sentimentLongColor = isDark\n ? colorPalette.darkBlue90\n : colorPalette.lightBlue90;\n const sentimentShortColor = isDark\n ? colorPalette.darkYellow90\n : colorPalette.lightYellow90;\n\n const sentimentOutlineColor = isDark\n ? colorPalette.black\n : colorPalette.white;\n const sentimentOutlineWidth = isDark ? 3 : 2;\n\n const candleLongColor = isDark\n ? colorPalette.bottleGreenDark\n : colorPalette.bottleGreenLight;\n const candleShortColor = isDark\n ? colorPalette.orange\n : colorPalette.raspberryLight;\n const tooltipLinesColor = isDark\n ? colorPalette.orange\n : colorPalette.bottleGreenLight;\n\n return {\n sentimentLongColor,\n sentimentShortColor,\n sentimentOutlineColor,\n candleLongColor,\n candleShortColor,\n tooltipLinesColor,\n sentimentOutlineWidth,\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAYO,MAAMC,cAAc,GAAIC,MAAe,IAAkB;EAC9D,MAAMC,kBAAkB,GAAGD,MAAM,GAC7BE,8BAAY,CAACC,UAAU,GACvBD,8BAAY,CAACE,WAAW;EAC5B,MAAMC,mBAAmB,GAAGL,MAAM,GAC9BE,8BAAY,CAACI,YAAY,GACzBJ,8BAAY,CAACK,aAAa;EAE9B,MAAMC,qBAAqB,GAAGR,MAAM,GAChCE,8BAAY,CAACO,KAAK,GAClBP,8BAAY,CAACQ,KAAK;EACtB,MAAMC,qBAAqB,GAAGX,MAAM,GAAG,CAAC,GAAG,CAAC;EAE5C,MAAMY,eAAe,GAAGZ,MAAM,GAC1BE,8BAAY,CAACW,eAAe,GAC5BX,8BAAY,CAACY,gBAAgB;EACjC,MAAMC,gBAAgB,GAAGf,MAAM,GAC3BE,8BAAY,CAACc,MAAM,GACnBd,8BAAY,CAACe,cAAc;EAC/B,MAAMC,iBAAiB,GAAGlB,MAAM,GAC5BE,8BAAY,CAACc,MAAM,GACnBd,8BAAY,CAACY,gBAAgB;EAEjC,OAAO;IACLb,kBAAkB;IAClBI,mBAAmB;IACnBG,qBAAqB;IACrBI,eAAe;IACfG,gBAAgB;IAChBG,iBAAiB;IACjBP;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAApB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1,6 +1,14 @@
1
- import chroma from 'chroma-js';
2
- export const getGradientColor = (value, startColor, targetColor, minThreshold, maxThreshold) => {
3
- const colorScale = chroma.scale([startColor, targetColor]).domain([minThreshold, maxThreshold]).mode('rgb');
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getGradientColor = void 0;
7
+ var _chromaJs = _interopRequireDefault(require("chroma-js"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ const getGradientColor = (value, startColor, targetColor, minThreshold, maxThreshold) => {
10
+ const colorScale = _chromaJs.default.scale([startColor, targetColor]).domain([minThreshold, maxThreshold]).mode('rgb');
4
11
  return colorScale(value).hex();
5
12
  };
13
+ exports.getGradientColor = getGradientColor;
6
14
  //# sourceMappingURL=getGradientColor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getGradientColor.js","names":["chroma","getGradientColor","value","startColor","targetColor","minThreshold","maxThreshold","colorScale","scale","domain","mode","hex"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nexport const getGradientColor = (\n value: number,\n startColor: string,\n targetColor: string,\n minThreshold: number,\n maxThreshold: number\n): string => {\n const colorScale = chroma\n .scale([startColor, targetColor])\n .domain([minThreshold, maxThreshold])\n .mode('rgb');\n\n return colorScale(value).hex();\n};\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,WAAW;AAE9B,OAAO,MAAMC,gBAAgB,GAAGA,CAC9BC,KAAa,EACbC,UAAkB,EAClBC,WAAmB,EACnBC,YAAoB,EACpBC,YAAoB,KACT;EACX,MAAMC,UAAU,GAAGP,MAAM,CACtBQ,KAAK,CAAC,CAACL,UAAU,EAAEC,WAAW,CAAC,CAAC,CAChCK,MAAM,CAAC,CAACJ,YAAY,EAAEC,YAAY,CAAC,CAAC,CACpCI,IAAI,CAAC,KAAK,CAAC;EAEd,OAAOH,UAAU,CAACL,KAAK,CAAC,CAACS,GAAG,CAAC,CAAC;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getGradientColor.js","names":["_chromaJs","_interopRequireDefault","require","e","__esModule","default","getGradientColor","value","startColor","targetColor","minThreshold","maxThreshold","colorScale","chroma","scale","domain","mode","hex","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getGradientColor.ts"],"sourcesContent":["import chroma from 'chroma-js';\n\nexport const getGradientColor = (\n value: number,\n startColor: string,\n targetColor: string,\n minThreshold: number,\n maxThreshold: number\n): string => {\n const colorScale = chroma\n .scale([startColor, targetColor])\n .domain([minThreshold, maxThreshold])\n .mode('rgb');\n\n return colorScale(value).hex();\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA+B,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAExB,MAAMG,gBAAgB,GAAGA,CAC9BC,KAAa,EACbC,UAAkB,EAClBC,WAAmB,EACnBC,YAAoB,EACpBC,YAAoB,KACT;EACX,MAAMC,UAAU,GAAGC,iBAAM,CACtBC,KAAK,CAAC,CAACN,UAAU,EAAEC,WAAW,CAAC,CAAC,CAChCM,MAAM,CAAC,CAACL,YAAY,EAAEC,YAAY,CAAC,CAAC,CACpCK,IAAI,CAAC,KAAK,CAAC;EAEd,OAAOJ,UAAU,CAACL,KAAK,CAAC,CAACU,GAAG,CAAC,CAAC;AAChC,CAAC;AAACC,OAAA,CAAAZ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,4 +1,10 @@
1
- export const getLabelData = _ref => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLabelData = void 0;
7
+ const getLabelData = _ref => {
2
8
  let {
3
9
  dates,
4
10
  isGreaterThanTwoWeeks
@@ -13,4 +19,5 @@ export const getLabelData = _ref => {
13
19
  return isGreaterThanTwoWeeks ? currentDate.getDate() !== previousDate.getDate() : currentDate.getMonth() !== previousDate.getMonth();
14
20
  });
15
21
  };
22
+ exports.getLabelData = getLabelData;
16
23
  //# sourceMappingURL=getLabelData.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getLabelData.js","names":["getLabelData","_ref","dates","isGreaterThanTwoWeeks","filter","record","index","arr","previousTimestamp","currentDate","Date","previousDate","getDate","getMonth"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts"],"sourcesContent":["import type { GetLabelsDataProps } from '../types';\n\nexport const getLabelData = ({\n dates,\n isGreaterThanTwoWeeks,\n}: GetLabelsDataProps) =>\n dates.filter((record, index, arr) => {\n if (index === 0) {\n return false;\n }\n const previousTimestamp = arr[index - 1];\n const currentDate = new Date(record);\n const previousDate = new Date(previousTimestamp);\n\n return isGreaterThanTwoWeeks\n ? currentDate.getDate() !== previousDate.getDate()\n : currentDate.getMonth() !== previousDate.getMonth();\n });\n"],"mappings":"AAEA,OAAO,MAAMA,YAAY,GAAGC,IAAA;EAAA,IAAC;IAC3BC,KAAK;IACLC;EACkB,CAAC,GAAAF,IAAA;EAAA,OACnBC,KAAK,CAACE,MAAM,CAAC,CAACC,MAAM,EAAEC,KAAK,EAAEC,GAAG,KAAK;IACnC,IAAID,KAAK,KAAK,CAAC,EAAE;MACf,OAAO,KAAK;IACd;IACA,MAAME,iBAAiB,GAAGD,GAAG,CAACD,KAAK,GAAG,CAAC,CAAC;IACxC,MAAMG,WAAW,GAAG,IAAIC,IAAI,CAACL,MAAM,CAAC;IACpC,MAAMM,YAAY,GAAG,IAAID,IAAI,CAACF,iBAAiB,CAAC;IAEhD,OAAOL,qBAAqB,GACxBM,WAAW,CAACG,OAAO,CAAC,CAAC,KAAKD,YAAY,CAACC,OAAO,CAAC,CAAC,GAChDH,WAAW,CAACI,QAAQ,CAAC,CAAC,KAAKF,YAAY,CAACE,QAAQ,CAAC,CAAC;EACxD,CAAC,CAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"getLabelData.js","names":["getLabelData","_ref","dates","isGreaterThanTwoWeeks","filter","record","index","arr","previousTimestamp","currentDate","Date","previousDate","getDate","getMonth","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getLabelData.ts"],"sourcesContent":["import type { GetLabelsDataProps } from '../types';\n\nexport const getLabelData = ({\n dates,\n isGreaterThanTwoWeeks,\n}: GetLabelsDataProps) =>\n dates.filter((record, index, arr) => {\n if (index === 0) {\n return false;\n }\n const previousTimestamp = arr[index - 1];\n const currentDate = new Date(record);\n const previousDate = new Date(previousTimestamp);\n\n return isGreaterThanTwoWeeks\n ? currentDate.getDate() !== previousDate.getDate()\n : currentDate.getMonth() !== previousDate.getMonth();\n });\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,GAAGC,IAAA;EAAA,IAAC;IAC3BC,KAAK;IACLC;EACkB,CAAC,GAAAF,IAAA;EAAA,OACnBC,KAAK,CAACE,MAAM,CAAC,CAACC,MAAM,EAAEC,KAAK,EAAEC,GAAG,KAAK;IACnC,IAAID,KAAK,KAAK,CAAC,EAAE;MACf,OAAO,KAAK;IACd;IACA,MAAME,iBAAiB,GAAGD,GAAG,CAACD,KAAK,GAAG,CAAC,CAAC;IACxC,MAAMG,WAAW,GAAG,IAAIC,IAAI,CAACL,MAAM,CAAC;IACpC,MAAMM,YAAY,GAAG,IAAID,IAAI,CAACF,iBAAiB,CAAC;IAEhD,OAAOL,qBAAqB,GACxBM,WAAW,CAACG,OAAO,CAAC,CAAC,KAAKD,YAAY,CAACC,OAAO,CAAC,CAAC,GAChDH,WAAW,CAACI,QAAQ,CAAC,CAAC,KAAKF,YAAY,CAACE,QAAQ,CAAC,CAAC;EACxD,CAAC,CAAC;AAAA;AAACC,OAAA,CAAAd,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,7 +1,14 @@
1
- import { COLOR_MAP } from '../../../constants';
2
- import { getGradientColor } from './getGradientColor';
3
- export const getRectColor = (sentiment, isDark, minThreshold, maxThreshold) => {
4
- const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;
5
- return sentiment < 0 ? getGradientColor(sentiment * -1, colorPalette.short[0], colorPalette.short[1], minThreshold, maxThreshold) : getGradientColor(sentiment, colorPalette.long[0], colorPalette.long[1], minThreshold, maxThreshold);
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getRectColor = void 0;
7
+ var _constants = require("../../../constants");
8
+ var _getGradientColor = require("./getGradientColor");
9
+ const getRectColor = (sentiment, isDark, minThreshold, maxThreshold) => {
10
+ const colorPalette = isDark ? _constants.COLOR_MAP.dark : _constants.COLOR_MAP.light;
11
+ return sentiment < 0 ? (0, _getGradientColor.getGradientColor)(sentiment * -1, colorPalette.short[0], colorPalette.short[1], minThreshold, maxThreshold) : (0, _getGradientColor.getGradientColor)(sentiment, colorPalette.long[0], colorPalette.long[1], minThreshold, maxThreshold);
6
12
  };
13
+ exports.getRectColor = getRectColor;
7
14
  //# sourceMappingURL=getRectColor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRectColor.js","names":["COLOR_MAP","getGradientColor","getRectColor","sentiment","isDark","minThreshold","maxThreshold","colorPalette","dark","light","short","long"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts"],"sourcesContent":["import { COLOR_MAP } from '../../../constants';\nimport { getGradientColor } from './getGradientColor';\n\nexport const getRectColor = (\n sentiment: number,\n isDark: boolean,\n minThreshold: number,\n maxThreshold: number\n) => {\n const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;\n\n return sentiment < 0\n ? getGradientColor(\n sentiment * -1,\n colorPalette.short[0],\n colorPalette.short[1],\n minThreshold,\n maxThreshold\n )\n : getGradientColor(\n sentiment,\n colorPalette.long[0],\n colorPalette.long[1],\n minThreshold,\n maxThreshold\n );\n};\n"],"mappings":"AAAA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,gBAAgB,QAAQ,oBAAoB;AAErD,OAAO,MAAMC,YAAY,GAAGA,CAC1BC,SAAiB,EACjBC,MAAe,EACfC,YAAoB,EACpBC,YAAoB,KACjB;EACH,MAAMC,YAAY,GAAGH,MAAM,GAAGJ,SAAS,CAACQ,IAAI,GAAGR,SAAS,CAACS,KAAK;EAE9D,OAAON,SAAS,GAAG,CAAC,GAChBF,gBAAgB,CACdE,SAAS,GAAG,CAAC,CAAC,EACdI,YAAY,CAACG,KAAK,CAAC,CAAC,CAAC,EACrBH,YAAY,CAACG,KAAK,CAAC,CAAC,CAAC,EACrBL,YAAY,EACZC,YACF,CAAC,GACDL,gBAAgB,CACdE,SAAS,EACTI,YAAY,CAACI,IAAI,CAAC,CAAC,CAAC,EACpBJ,YAAY,CAACI,IAAI,CAAC,CAAC,CAAC,EACpBN,YAAY,EACZC,YACF,CAAC;AACP,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getRectColor.js","names":["_constants","require","_getGradientColor","getRectColor","sentiment","isDark","minThreshold","maxThreshold","colorPalette","COLOR_MAP","dark","light","getGradientColor","short","long","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getRectColor.ts"],"sourcesContent":["import { COLOR_MAP } from '../../../constants';\nimport { getGradientColor } from './getGradientColor';\n\nexport const getRectColor = (\n sentiment: number,\n isDark: boolean,\n minThreshold: number,\n maxThreshold: number\n) => {\n const colorPalette = isDark ? COLOR_MAP.dark : COLOR_MAP.light;\n\n return sentiment < 0\n ? getGradientColor(\n sentiment * -1,\n colorPalette.short[0],\n colorPalette.short[1],\n minThreshold,\n maxThreshold\n )\n : getGradientColor(\n sentiment,\n colorPalette.long[0],\n colorPalette.long[1],\n minThreshold,\n maxThreshold\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAEO,MAAME,YAAY,GAAGA,CAC1BC,SAAiB,EACjBC,MAAe,EACfC,YAAoB,EACpBC,YAAoB,KACjB;EACH,MAAMC,YAAY,GAAGH,MAAM,GAAGI,oBAAS,CAACC,IAAI,GAAGD,oBAAS,CAACE,KAAK;EAE9D,OAAOP,SAAS,GAAG,CAAC,GAChB,IAAAQ,kCAAgB,EACdR,SAAS,GAAG,CAAC,CAAC,EACdI,YAAY,CAACK,KAAK,CAAC,CAAC,CAAC,EACrBL,YAAY,CAACK,KAAK,CAAC,CAAC,CAAC,EACrBP,YAAY,EACZC,YACF,CAAC,GACD,IAAAK,kCAAgB,EACdR,SAAS,EACTI,YAAY,CAACM,IAAI,CAAC,CAAC,CAAC,EACpBN,YAAY,CAACM,IAAI,CAAC,CAAC,CAAC,EACpBR,YAAY,EACZC,YACF,CAAC;AACP,CAAC;AAACQ,OAAA,CAAAZ,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,6 +1,12 @@
1
- import { colorPalette } from '@oanda/labs-widget-common';
2
- import { BookType } from '../../../../gql/types/graphql';
3
- import { formatFullDate } from './formatFullDate';
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getTooltipFormatter = void 0;
7
+ var _labsWidgetCommon = require("@oanda/labs-widget-common");
8
+ var _graphql = require("../../../../gql/types/graphql");
9
+ var _formatFullDate = require("./formatFullDate");
4
10
  const SENTIMENT_DISPLAY_PRECISION = 2;
5
11
  const TOOLTIP_STYLES = {
6
12
  MOBILE_COLUMN_WIDTH: '33.3%',
@@ -22,9 +28,9 @@ const findSentimentSeriesParam = (params, sentimentLongs, sentimentShorts) => {
22
28
  };
23
29
  const getSentimentOverbalanceLabel = (sentiment, bookType) => {
24
30
  if (sentiment < 0) {
25
- return bookType === BookType.Order ? 'sell_overbalance' : 'short_overbalance';
31
+ return bookType === _graphql.BookType.Order ? 'sell_overbalance' : 'short_overbalance';
26
32
  }
27
- return bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance';
33
+ return bookType === _graphql.BookType.Order ? 'buy_overbalance' : 'long_overbalance';
28
34
  };
29
35
  const formatCandleData = (candleData, labelCallback, isDesktop) => {
30
36
  const [, open, close, low, high] = candleData;
@@ -55,7 +61,7 @@ const formatBookData = _ref => {
55
61
  labelCallback,
56
62
  isDesktop
57
63
  } = _ref;
58
- const bookLabelKey = bookType === BookType.Order ? 'orders' : 'trades';
64
+ const bookLabelKey = bookType === _graphql.BookType.Order ? 'orders' : 'trades';
59
65
  const priceRangeStart = matchedBucket.price.toFixed(bucketDisplayPrecision);
60
66
  const priceRangeEnd = (matchedBucket.price + bucketWidth).toFixed(bucketDisplayPrecision);
61
67
  const sentimentLabel = getSentimentOverbalanceLabel(matchedBucket.sentiment, bookType);
@@ -89,7 +95,7 @@ const findMatchingBucket = (buckets, bucketsIndex, selectedPrice, bucketWidth) =
89
95
  return selectedPrice >= price && selectedPrice < price + bucketWidth;
90
96
  });
91
97
  };
92
- export const getTooltipFormatter = _ref3 => {
98
+ const getTooltipFormatter = _ref3 => {
93
99
  let {
94
100
  params,
95
101
  buckets,
@@ -126,7 +132,7 @@ export const getTooltipFormatter = _ref3 => {
126
132
  if (!showCandles && !matchedBucket) {
127
133
  return '';
128
134
  }
129
- const timeFormatted = formatFullDate(time, locale);
135
+ const timeFormatted = (0, _formatFullDate.formatFullDate)(time, locale);
130
136
  const candleSection = showCandles ? formatCandleData(candleData, labelCallback, isDesktop) : '';
131
137
  const bookSection = matchedBucket ? formatBookData({
132
138
  matchedBucket,
@@ -155,6 +161,7 @@ export const getTooltipFormatter = _ref3 => {
155
161
  isDark
156
162
  });
157
163
  };
164
+ exports.getTooltipFormatter = getTooltipFormatter;
158
165
  const buildDesktopTooltip = _ref4 => {
159
166
  let {
160
167
  candleSection,
@@ -163,17 +170,17 @@ const buildDesktopTooltip = _ref4 => {
163
170
  isDark,
164
171
  isJapanese
165
172
  } = _ref4;
166
- const backgroundColor = isDark ? colorPalette.black : colorPalette.white;
173
+ const backgroundColor = isDark ? _labsWidgetCommon.colorPalette.black : _labsWidgetCommon.colorPalette.white;
167
174
  const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;
168
175
  return `<div style="width: ${fullWidth}; background-color: ${backgroundColor};">
169
176
  <div style="width: ${fullWidth}; display: flex; justify-content: space-between;">
170
177
  <div style="${isJapanese ? 'width: 45%;' : 'width: 40%;'}">
171
178
  ${candleSection}
172
179
  </div>
173
- <div style="${isJapanese ? 'width: 24%;' : 'width: 22%;'}">
180
+ <div style="${isJapanese ? 'width: 24%;' : 'width: 20%;'}">
174
181
  ${sentimentSection}
175
182
  </div>
176
- <div style="${isJapanese ? 'width: 31%;' : 'width: 38%;'}">
183
+ <div style="${isJapanese ? 'width: 31%;' : 'width: 40%;'}">
177
184
  ${bookSection}
178
185
  </div>
179
186
  </div>
@@ -187,7 +194,7 @@ const buildMobileTooltip = _ref5 => {
187
194
  bookSection,
188
195
  isDark
189
196
  } = _ref5;
190
- const backgroundColor = isDark ? colorPalette.black : colorPalette.white;
197
+ const backgroundColor = isDark ? _labsWidgetCommon.colorPalette.black : _labsWidgetCommon.colorPalette.white;
191
198
  const columnWidth = TOOLTIP_STYLES.MOBILE_COLUMN_WIDTH;
192
199
  const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;
193
200
  const padding = TOOLTIP_STYLES.PADDING_BOTTOM;
@@ -1 +1 @@
1
- {"version":3,"file":"getTooltipFormatter.js","names":["colorPalette","BookType","formatFullDate","SENTIMENT_DISPLAY_PRECISION","TOOLTIP_STYLES","MOBILE_COLUMN_WIDTH","PADDING_BOTTOM","FULL_WIDTH","calculateBucketDisplayPrecision","bucketWidth","toString","split","length","findSeriesParam","params","seriesId","find","series","findSentimentSeriesParam","sentimentLongs","sentimentShorts","index","dataIndex","sentimentLong","sentimentShort","getSentimentOverbalanceLabel","sentiment","bookType","Order","formatCandleData","candleData","labelCallback","isDesktop","open","close","low","high","candleLabel","openLabel","closeLabel","lowLabel","highLabel","formatBookData","_ref","matchedBucket","bucketDisplayPrecision","bookLabelKey","priceRangeStart","price","toFixed","priceRangeEnd","sentimentLabel","sentimentValue","Math","abs","formatSentimentData","hasValidCandleData","hasValidSentimentData","findMatchingBucket","buckets","bucketsIndex","selectedPrice","undefined","selectedBuckets","_ref2","getTooltipFormatter","_ref3","locale","isDark","isJapanese","Array","isArray","candleParam","booksParam","time","Date","axisValue","value","showCandles","showSentiment","timeFormatted","candleSection","bookSection","sentimentSection","buildDesktopTooltip","buildMobileTooltip","_ref4","backgroundColor","black","white","fullWidth","_ref5","columnWidth","padding"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nimport { BookType } from '../../../../gql/types/graphql';\nimport type { Bucket, TooltipParam } from '../types';\nimport { formatFullDate } from './formatFullDate';\n\nconst SENTIMENT_DISPLAY_PRECISION = 2;\n\nconst TOOLTIP_STYLES = {\n MOBILE_COLUMN_WIDTH: '33.3%',\n PADDING_BOTTOM: '4px',\n FULL_WIDTH: '100%',\n} as const;\n\nconst calculateBucketDisplayPrecision = (bucketWidth: number): number => {\n return bucketWidth.toString().split('.')[1]?.length || 0;\n};\n\nconst findSeriesParam = <T extends TooltipParam['seriesId']>(\n params: TooltipParam[],\n seriesId: T\n): Extract<TooltipParam, { seriesId: T }> | undefined => {\n return params.find(\n (series): series is Extract<TooltipParam, { seriesId: T }> =>\n series.seriesId === seriesId\n );\n};\n\nconst findSentimentSeriesParam = (\n params: TooltipParam[],\n sentimentLongs: (number | null)[],\n sentimentShorts: (number | null)[]\n): {\n sentimentLong: number | null;\n sentimentShort: number | null;\n} => {\n const index = params[0].dataIndex as number;\n\n return {\n sentimentLong: sentimentLongs[index] ?? null,\n sentimentShort: sentimentShorts[index] ?? null,\n };\n};\n\nconst getSentimentOverbalanceLabel = (\n sentiment: number,\n bookType: BookType\n): string => {\n if (sentiment < 0) {\n return bookType === BookType.Order\n ? 'sell_overbalance'\n : 'short_overbalance';\n }\n return bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance';\n};\n\nconst formatCandleData = (\n candleData: [number, number, number, number, number],\n labelCallback: (key: string) => string,\n isDesktop: boolean\n): string => {\n const [, open, close, low, high] = candleData;\n const candleLabel = labelCallback('candle');\n const openLabel = labelCallback('open');\n const closeLabel = labelCallback('close');\n const lowLabel = labelCallback('low');\n const highLabel = labelCallback('high');\n\n return isDesktop\n ? `<div><b>${candleLabel}:</b></div>\n<div style=\"display: flex; gap: 4px; margin-right: 4px;\">\n<div>${openLabel}: ${open} </div>\n<div>${highLabel}: ${high} </div>\n<div>${lowLabel}: ${low} </div>\n<div>${closeLabel}: ${close} </div>\n</div>`\n : `<div><b>${candleLabel}:</b></div>\n<div>${openLabel}: ${open} </div>\n<div>${highLabel}: ${high} </div>\n<div>${lowLabel}: ${low} </div>\n<div>${closeLabel}: ${close} </div>\n`;\n};\n\nconst formatBookData = ({\n matchedBucket,\n bucketWidth,\n bucketDisplayPrecision,\n bookType,\n labelCallback,\n isDesktop,\n}: {\n matchedBucket: Bucket;\n bucketWidth: number;\n bucketDisplayPrecision: number;\n bookType: BookType;\n labelCallback: (key: string) => string;\n isDesktop: boolean;\n}): string => {\n const bookLabelKey = bookType === BookType.Order ? 'orders' : 'trades';\n const priceRangeStart = matchedBucket.price.toFixed(bucketDisplayPrecision);\n const priceRangeEnd = (matchedBucket.price + bucketWidth).toFixed(\n bucketDisplayPrecision\n );\n const sentimentLabel = getSentimentOverbalanceLabel(\n matchedBucket.sentiment,\n bookType\n );\n const sentimentValue = Math.abs(matchedBucket.sentiment);\n\n return isDesktop\n ? `<div><b>${labelCallback(bookLabelKey)}:</b></div>\n<span style=\"margin-right: 4px;\">${labelCallback('price_range')}: ${priceRangeStart} - ${priceRangeEnd} </span>\n<span style=\"margin-right: 4px;\">${labelCallback(sentimentLabel)}: ${sentimentValue}% </span>`\n : `<div><b>${labelCallback(bookLabelKey)}:</b></div>\n<div>${labelCallback('price_range')}:</div>\n<div>${priceRangeStart} - ${priceRangeEnd} </div>\n<div>${labelCallback(sentimentLabel)}:</div>\n<div>${sentimentValue}% </div>`;\n};\n\nconst formatSentimentData = (\n sentimentLong: number,\n sentimentShort: number,\n labelCallback: (key: string) => string,\n isDesktop: boolean\n): string => {\n return isDesktop\n ? `<div><b>${labelCallback('sentiment')}:</b></div>\n <span style=\"margin-right: 4px;\">${labelCallback('long')}: ${sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </span>\n <span style=\"margin-right: 4px;\">${labelCallback('short')}: ${sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </span>`\n : `<div><b>${labelCallback('sentiment')}:</b></div>\n<div>${labelCallback('long')}: ${sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </div>\n<div>${labelCallback('short')}: ${sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </div>`;\n};\n\nconst hasValidCandleData = (\n candleData: [number, number, number, number, number]\n): boolean =>\n !!candleData[1] && !!candleData[2] && !!candleData[3] && !!candleData[4];\n\nconst hasValidSentimentData = (\n sentimentLong: number | null,\n sentimentShort: number | null\n): boolean => sentimentLong !== null && sentimentShort !== null;\n\nconst findMatchingBucket = (\n buckets: Bucket[][],\n bucketsIndex: number | undefined,\n selectedPrice: number,\n bucketWidth: number\n): Bucket | undefined => {\n if (bucketsIndex === undefined) {\n return undefined;\n }\n const selectedBuckets = buckets[bucketsIndex];\n return selectedBuckets?.find(\n ({ price }) => selectedPrice >= price && selectedPrice < price + bucketWidth\n );\n};\n\nexport const getTooltipFormatter = ({\n params,\n buckets,\n bucketWidth,\n selectedPrice,\n bookType,\n labelCallback,\n sentimentLongs,\n sentimentShorts,\n isDesktop,\n locale,\n isDark,\n isJapanese,\n}: {\n params: TooltipParam[];\n buckets: Bucket[][];\n bucketWidth: number;\n selectedPrice: number;\n bookType: BookType;\n labelCallback: (key: string) => string;\n sentimentLongs: (number | null)[];\n sentimentShorts: (number | null)[];\n isDesktop: boolean;\n locale: string;\n isDark: boolean;\n isJapanese: boolean;\n}) => {\n if (!params || !Array.isArray(params) || params.length === 0) {\n return '';\n }\n\n const candleParam = findSeriesParam(params, 'candlestick');\n const booksParam = findSeriesParam(params, 'heatmap');\n const { sentimentLong, sentimentShort } = findSentimentSeriesParam(\n params,\n sentimentLongs,\n sentimentShorts\n );\n\n if (!candleParam) {\n return '';\n }\n\n const bucketDisplayPrecision = calculateBucketDisplayPrecision(bucketWidth);\n const time = new Date(candleParam.axisValue as string);\n const candleData = candleParam.value;\n const bucketsIndex = booksParam?.value[2];\n const matchedBucket = findMatchingBucket(\n buckets,\n bucketsIndex,\n selectedPrice,\n bucketWidth\n );\n const showCandles = hasValidCandleData(candleData);\n const showSentiment = hasValidSentimentData(sentimentLong, sentimentShort);\n\n if (!showCandles && !matchedBucket) {\n return '';\n }\n\n const timeFormatted = formatFullDate(time, locale);\n const candleSection = showCandles\n ? formatCandleData(candleData, labelCallback, isDesktop)\n : '';\n\n const bookSection = matchedBucket\n ? formatBookData({\n matchedBucket,\n bucketWidth,\n bucketDisplayPrecision,\n bookType,\n labelCallback,\n isDesktop,\n })\n : '';\n\n const sentimentSection =\n showSentiment && sentimentLong && sentimentShort\n ? formatSentimentData(\n sentimentLong,\n sentimentShort,\n labelCallback,\n isDesktop\n )\n : '';\n\n if (isDesktop) {\n return buildDesktopTooltip({\n timeFormatted,\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n isJapanese,\n });\n }\n\n return buildMobileTooltip({\n timeFormatted,\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n });\n};\n\ninterface TooltipSections {\n timeFormatted: string;\n candleSection: string;\n sentimentSection: string;\n bookSection: string;\n}\n\nconst buildDesktopTooltip = ({\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n isJapanese,\n}: TooltipSections & {\n isDark: boolean;\n isJapanese: boolean;\n}): string => {\n const backgroundColor = isDark ? colorPalette.black : colorPalette.white;\n const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;\n\n return `<div style=\"width: ${fullWidth}; background-color: ${backgroundColor};\">\n <div style=\"width: ${fullWidth}; display: flex; justify-content: space-between;\">\n <div style=\"${isJapanese ? 'width: 45%;' : 'width: 40%;'}\">\n${candleSection}\n</div>\n<div style=\"${isJapanese ? 'width: 24%;' : 'width: 22%;'}\">\n${sentimentSection}\n</div>\n<div style=\"${isJapanese ? 'width: 31%;' : 'width: 38%;'}\">\n${bookSection}\n</div>\n</div>\n</div>`;\n};\n\nconst buildMobileTooltip = ({\n timeFormatted,\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n}: TooltipSections & { isDark: boolean }): string => {\n const backgroundColor = isDark ? colorPalette.black : colorPalette.white;\n const columnWidth = TOOLTIP_STYLES.MOBILE_COLUMN_WIDTH;\n const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;\n const padding = TOOLTIP_STYLES.PADDING_BOTTOM;\n\n return `<div style=\"width: ${fullWidth}; background-color: ${backgroundColor};\">\n <div style=\"padding-bottom: ${padding};\">${timeFormatted}</div>\n <div style=\"width: ${fullWidth}; display: flex; justify-content: space-between;\">\n <div style=\"width: ${columnWidth};\">\n${candleSection}\n</div>\n<div style=\"width: ${columnWidth};\">\n${sentimentSection}\n</div>\n<div style=\"width: ${columnWidth};\">\n${bookSection}\n</div>\n</div>\n</div>`;\n};\n"],"mappings":"AAAA,SAASA,YAAY,QAAQ,2BAA2B;AAExD,SAASC,QAAQ,QAAQ,+BAA+B;AAExD,SAASC,cAAc,QAAQ,kBAAkB;AAEjD,MAAMC,2BAA2B,GAAG,CAAC;AAErC,MAAMC,cAAc,GAAG;EACrBC,mBAAmB,EAAE,OAAO;EAC5BC,cAAc,EAAE,KAAK;EACrBC,UAAU,EAAE;AACd,CAAU;AAEV,MAAMC,+BAA+B,GAAIC,WAAmB,IAAa;EACvE,OAAOA,WAAW,CAACC,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAEC,MAAM,IAAI,CAAC;AAC1D,CAAC;AAED,MAAMC,eAAe,GAAGA,CACtBC,MAAsB,EACtBC,QAAW,KAC4C;EACvD,OAAOD,MAAM,CAACE,IAAI,CACfC,MAAM,IACLA,MAAM,CAACF,QAAQ,KAAKA,QACxB,CAAC;AACH,CAAC;AAED,MAAMG,wBAAwB,GAAGA,CAC/BJ,MAAsB,EACtBK,cAAiC,EACjCC,eAAkC,KAI/B;EACH,MAAMC,KAAK,GAAGP,MAAM,CAAC,CAAC,CAAC,CAACQ,SAAmB;EAE3C,OAAO;IACLC,aAAa,EAAEJ,cAAc,CAACE,KAAK,CAAC,IAAI,IAAI;IAC5CG,cAAc,EAAEJ,eAAe,CAACC,KAAK,CAAC,IAAI;EAC5C,CAAC;AACH,CAAC;AAED,MAAMI,4BAA4B,GAAGA,CACnCC,SAAiB,EACjBC,QAAkB,KACP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AsBoF,SAAS,uBAAuBH,eAAe;AAC9E,gCAAgCM,OAAO,MAAMb,aAAa;AAC1D,uBAAuBU,SAAS;AAChC,uBAAuBE,WAAW;AAClC,EAAEX,aAAa;AACf;AACA,qBAAqBW,WAAW;AAChC,EAAET,gBAAgB;AAClB;AACA,qBAAqBS,WAAW;AAChC,EAAEV,WAAW;AACb;AACA;AACA,OAAO;AACP,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"getTooltipFormatter.js","names":["_labsWidgetCommon","require","_graphql","_formatFullDate","SENTIMENT_DISPLAY_PRECISION","TOOLTIP_STYLES","MOBILE_COLUMN_WIDTH","PADDING_BOTTOM","FULL_WIDTH","calculateBucketDisplayPrecision","bucketWidth","toString","split","length","findSeriesParam","params","seriesId","find","series","findSentimentSeriesParam","sentimentLongs","sentimentShorts","index","dataIndex","sentimentLong","sentimentShort","getSentimentOverbalanceLabel","sentiment","bookType","BookType","Order","formatCandleData","candleData","labelCallback","isDesktop","open","close","low","high","candleLabel","openLabel","closeLabel","lowLabel","highLabel","formatBookData","_ref","matchedBucket","bucketDisplayPrecision","bookLabelKey","priceRangeStart","price","toFixed","priceRangeEnd","sentimentLabel","sentimentValue","Math","abs","formatSentimentData","hasValidCandleData","hasValidSentimentData","findMatchingBucket","buckets","bucketsIndex","selectedPrice","undefined","selectedBuckets","_ref2","getTooltipFormatter","_ref3","locale","isDark","isJapanese","Array","isArray","candleParam","booksParam","time","Date","axisValue","value","showCandles","showSentiment","timeFormatted","formatFullDate","candleSection","bookSection","sentimentSection","buildDesktopTooltip","buildMobileTooltip","exports","_ref4","backgroundColor","colorPalette","black","white","fullWidth","_ref5","columnWidth","padding"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/getTooltipFormatter.ts"],"sourcesContent":["import { colorPalette } from '@oanda/labs-widget-common';\n\nimport { BookType } from '../../../../gql/types/graphql';\nimport type { Bucket, TooltipParam } from '../types';\nimport { formatFullDate } from './formatFullDate';\n\nconst SENTIMENT_DISPLAY_PRECISION = 2;\n\nconst TOOLTIP_STYLES = {\n MOBILE_COLUMN_WIDTH: '33.3%',\n PADDING_BOTTOM: '4px',\n FULL_WIDTH: '100%',\n} as const;\n\nconst calculateBucketDisplayPrecision = (bucketWidth: number): number => {\n return bucketWidth.toString().split('.')[1]?.length || 0;\n};\n\nconst findSeriesParam = <T extends TooltipParam['seriesId']>(\n params: TooltipParam[],\n seriesId: T\n): Extract<TooltipParam, { seriesId: T }> | undefined => {\n return params.find(\n (series): series is Extract<TooltipParam, { seriesId: T }> =>\n series.seriesId === seriesId\n );\n};\n\nconst findSentimentSeriesParam = (\n params: TooltipParam[],\n sentimentLongs: (number | null)[],\n sentimentShorts: (number | null)[]\n): {\n sentimentLong: number | null;\n sentimentShort: number | null;\n} => {\n const index = params[0].dataIndex as number;\n\n return {\n sentimentLong: sentimentLongs[index] ?? null,\n sentimentShort: sentimentShorts[index] ?? null,\n };\n};\n\nconst getSentimentOverbalanceLabel = (\n sentiment: number,\n bookType: BookType\n): string => {\n if (sentiment < 0) {\n return bookType === BookType.Order\n ? 'sell_overbalance'\n : 'short_overbalance';\n }\n return bookType === BookType.Order ? 'buy_overbalance' : 'long_overbalance';\n};\n\nconst formatCandleData = (\n candleData: [number, number, number, number, number],\n labelCallback: (key: string) => string,\n isDesktop: boolean\n): string => {\n const [, open, close, low, high] = candleData;\n const candleLabel = labelCallback('candle');\n const openLabel = labelCallback('open');\n const closeLabel = labelCallback('close');\n const lowLabel = labelCallback('low');\n const highLabel = labelCallback('high');\n\n return isDesktop\n ? `<div><b>${candleLabel}:</b></div>\n<div style=\"display: flex; gap: 4px; margin-right: 4px;\">\n<div>${openLabel}: ${open} </div>\n<div>${highLabel}: ${high} </div>\n<div>${lowLabel}: ${low} </div>\n<div>${closeLabel}: ${close} </div>\n</div>`\n : `<div><b>${candleLabel}:</b></div>\n<div>${openLabel}: ${open} </div>\n<div>${highLabel}: ${high} </div>\n<div>${lowLabel}: ${low} </div>\n<div>${closeLabel}: ${close} </div>\n`;\n};\n\nconst formatBookData = ({\n matchedBucket,\n bucketWidth,\n bucketDisplayPrecision,\n bookType,\n labelCallback,\n isDesktop,\n}: {\n matchedBucket: Bucket;\n bucketWidth: number;\n bucketDisplayPrecision: number;\n bookType: BookType;\n labelCallback: (key: string) => string;\n isDesktop: boolean;\n}): string => {\n const bookLabelKey = bookType === BookType.Order ? 'orders' : 'trades';\n const priceRangeStart = matchedBucket.price.toFixed(bucketDisplayPrecision);\n const priceRangeEnd = (matchedBucket.price + bucketWidth).toFixed(\n bucketDisplayPrecision\n );\n const sentimentLabel = getSentimentOverbalanceLabel(\n matchedBucket.sentiment,\n bookType\n );\n const sentimentValue = Math.abs(matchedBucket.sentiment);\n\n return isDesktop\n ? `<div><b>${labelCallback(bookLabelKey)}:</b></div>\n<span style=\"margin-right: 4px;\">${labelCallback('price_range')}: ${priceRangeStart} - ${priceRangeEnd} </span>\n<span style=\"margin-right: 4px;\">${labelCallback(sentimentLabel)}: ${sentimentValue}% </span>`\n : `<div><b>${labelCallback(bookLabelKey)}:</b></div>\n<div>${labelCallback('price_range')}:</div>\n<div>${priceRangeStart} - ${priceRangeEnd} </div>\n<div>${labelCallback(sentimentLabel)}:</div>\n<div>${sentimentValue}% </div>`;\n};\n\nconst formatSentimentData = (\n sentimentLong: number,\n sentimentShort: number,\n labelCallback: (key: string) => string,\n isDesktop: boolean\n): string => {\n return isDesktop\n ? `<div><b>${labelCallback('sentiment')}:</b></div>\n <span style=\"margin-right: 4px;\">${labelCallback('long')}: ${sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </span>\n <span style=\"margin-right: 4px;\">${labelCallback('short')}: ${sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </span>`\n : `<div><b>${labelCallback('sentiment')}:</b></div>\n<div>${labelCallback('long')}: ${sentimentLong.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </div>\n<div>${labelCallback('short')}: ${sentimentShort.toFixed(SENTIMENT_DISPLAY_PRECISION)}% </div>`;\n};\n\nconst hasValidCandleData = (\n candleData: [number, number, number, number, number]\n): boolean =>\n !!candleData[1] && !!candleData[2] && !!candleData[3] && !!candleData[4];\n\nconst hasValidSentimentData = (\n sentimentLong: number | null,\n sentimentShort: number | null\n): boolean => sentimentLong !== null && sentimentShort !== null;\n\nconst findMatchingBucket = (\n buckets: Bucket[][],\n bucketsIndex: number | undefined,\n selectedPrice: number,\n bucketWidth: number\n): Bucket | undefined => {\n if (bucketsIndex === undefined) {\n return undefined;\n }\n const selectedBuckets = buckets[bucketsIndex];\n return selectedBuckets?.find(\n ({ price }) => selectedPrice >= price && selectedPrice < price + bucketWidth\n );\n};\n\nexport const getTooltipFormatter = ({\n params,\n buckets,\n bucketWidth,\n selectedPrice,\n bookType,\n labelCallback,\n sentimentLongs,\n sentimentShorts,\n isDesktop,\n locale,\n isDark,\n isJapanese,\n}: {\n params: TooltipParam[];\n buckets: Bucket[][];\n bucketWidth: number;\n selectedPrice: number;\n bookType: BookType;\n labelCallback: (key: string) => string;\n sentimentLongs: (number | null)[];\n sentimentShorts: (number | null)[];\n isDesktop: boolean;\n locale: string;\n isDark: boolean;\n isJapanese: boolean;\n}) => {\n if (!params || !Array.isArray(params) || params.length === 0) {\n return '';\n }\n\n const candleParam = findSeriesParam(params, 'candlestick');\n const booksParam = findSeriesParam(params, 'heatmap');\n const { sentimentLong, sentimentShort } = findSentimentSeriesParam(\n params,\n sentimentLongs,\n sentimentShorts\n );\n\n if (!candleParam) {\n return '';\n }\n\n const bucketDisplayPrecision = calculateBucketDisplayPrecision(bucketWidth);\n const time = new Date(candleParam.axisValue as string);\n const candleData = candleParam.value;\n const bucketsIndex = booksParam?.value[2];\n const matchedBucket = findMatchingBucket(\n buckets,\n bucketsIndex,\n selectedPrice,\n bucketWidth\n );\n const showCandles = hasValidCandleData(candleData);\n const showSentiment = hasValidSentimentData(sentimentLong, sentimentShort);\n\n if (!showCandles && !matchedBucket) {\n return '';\n }\n\n const timeFormatted = formatFullDate(time, locale);\n const candleSection = showCandles\n ? formatCandleData(candleData, labelCallback, isDesktop)\n : '';\n\n const bookSection = matchedBucket\n ? formatBookData({\n matchedBucket,\n bucketWidth,\n bucketDisplayPrecision,\n bookType,\n labelCallback,\n isDesktop,\n })\n : '';\n\n const sentimentSection =\n showSentiment && sentimentLong && sentimentShort\n ? formatSentimentData(\n sentimentLong,\n sentimentShort,\n labelCallback,\n isDesktop\n )\n : '';\n\n if (isDesktop) {\n return buildDesktopTooltip({\n timeFormatted,\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n isJapanese,\n });\n }\n\n return buildMobileTooltip({\n timeFormatted,\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n });\n};\n\ninterface TooltipSections {\n timeFormatted: string;\n candleSection: string;\n sentimentSection: string;\n bookSection: string;\n}\n\nconst buildDesktopTooltip = ({\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n isJapanese,\n}: TooltipSections & {\n isDark: boolean;\n isJapanese: boolean;\n}): string => {\n const backgroundColor = isDark ? colorPalette.black : colorPalette.white;\n const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;\n\n return `<div style=\"width: ${fullWidth}; background-color: ${backgroundColor};\">\n <div style=\"width: ${fullWidth}; display: flex; justify-content: space-between;\">\n <div style=\"${isJapanese ? 'width: 45%;' : 'width: 40%;'}\">\n${candleSection}\n</div>\n<div style=\"${isJapanese ? 'width: 24%;' : 'width: 20%;'}\">\n${sentimentSection}\n</div>\n<div style=\"${isJapanese ? 'width: 31%;' : 'width: 40%;'}\">\n${bookSection}\n</div>\n</div>\n</div>`;\n};\n\nconst buildMobileTooltip = ({\n timeFormatted,\n candleSection,\n sentimentSection,\n bookSection,\n isDark,\n}: TooltipSections & { isDark: boolean }): string => {\n const backgroundColor = isDark ? colorPalette.black : colorPalette.white;\n const columnWidth = TOOLTIP_STYLES.MOBILE_COLUMN_WIDTH;\n const fullWidth = TOOLTIP_STYLES.FULL_WIDTH;\n const padding = TOOLTIP_STYLES.PADDING_BOTTOM;\n\n return `<div style=\"width: ${fullWidth}; background-color: ${backgroundColor};\">\n <div style=\"padding-bottom: ${padding};\">${timeFormatted}</div>\n <div style=\"width: ${fullWidth}; display: flex; justify-content: space-between;\">\n <div style=\"width: ${columnWidth};\">\n${candleSection}\n</div>\n<div style=\"width: ${columnWidth};\">\n${sentimentSection}\n</div>\n<div style=\"width: ${columnWidth};\">\n${bookSection}\n</div>\n</div>\n</div>`;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAAE,eAAA,GAAAF,OAAA;AAEA,MAAMG,2BAA2B,GAAG,CAAC;AAErC,MAAMC,cAAc,GAAG;EACrBC,mBAAmB,EAAE,OAAO;EAC5BC,cAAc,EAAE,KAAK;EACrBC,UAAU,EAAE;AACd,CAAU;AAEV,MAAMC,+BAA+B,GAAIC,WAAmB,IAAa;EACvE,OAAOA,WAAW,CAACC,QAAQ,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAEC,MAAM,IAAI,CAAC;AAC1D,CAAC;AAED,MAAMC,eAAe,GAAGA,CACtBC,MAAsB,EACtBC,QAAW,KAC4C;EACvD,OAAOD,MAAM,CAACE,IAAI,CACfC,MAAM,IACLA,MAAM,CAACF,QAAQ,KAAKA,QACxB,CAAC;AACH,CAAC;AAED,MAAMG,wBAAwB,GAAGA,CAC/BJ,MAAsB,EACtBK,cAAiC,EACjCC,eAAkC,KAI/B;EACH,MAAMC,KAAK,GAAGP,MAAM,CAAC,CAAC,CAAC,CAACQ,SAAmB;EAE3C,OAAO;IACLC,aAAa,EAAEJ,cAAc,CAACE,KAAK,CAAC,IAAI,IAAI;IAC5CG,cAAc,EAAEJ,eAAe,CAACC,KAAK,CAAC,IAAI;EAC5C,CAAC;AACH,CAAC;AAED,MAAMI,4BAA4B,GAAGA,CACnCC,SAAiB,EACjBC,QAAkB,KACP;EACX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cAAc,CAACE,cAAc;EAE7C,OAAO,sBAAsBwF,SAAS,uBAAuBJ,eAAe;AAC9E,gCAAgCO,OAAO,MAAMhB,aAAa;AAC1D,uBAAuBa,SAAS;AAChC,uBAAuBE,WAAW;AAClC,EAAEb,aAAa;AACf;AACA,qBAAqBa,WAAW;AAChC,EAAEX,gBAAgB;AAClB;AACA,qBAAqBW,WAAW;AAChC,EAAEZ,WAAW;AACb;AACA;AACA,OAAO;AACP,CAAC","ignoreList":[]}
@@ -1,8 +1,14 @@
1
- import { formatXAxisAdditionalLabel } from './formatXAxisAdditionalLabel';
2
- import { formatXAxisLabel } from './formatXAxisLabel';
3
- import { getLabelData } from './getLabelData';
4
- import { isDifferenceGreaterThanTwoWeeks } from './isDifferenceGreaterThanTwoWeeks';
5
- export const handleLabelUpdate = (instance, mainData, labelTimerRef, isGreaterThanTwoWeeksRef, locale) => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleLabelUpdate = void 0;
7
+ var _formatXAxisAdditionalLabel = require("./formatXAxisAdditionalLabel");
8
+ var _formatXAxisLabel = require("./formatXAxisLabel");
9
+ var _getLabelData = require("./getLabelData");
10
+ var _isDifferenceGreaterThanTwoWeeks = require("./isDifferenceGreaterThanTwoWeeks");
11
+ const handleLabelUpdate = (instance, mainData, labelTimerRef, isGreaterThanTwoWeeksRef, locale) => {
6
12
  if (labelTimerRef.current) {
7
13
  clearTimeout(labelTimerRef.current);
8
14
  }
@@ -23,10 +29,10 @@ export const handleLabelUpdate = (instance, mainData, labelTimerRef, isGreaterTh
23
29
  if (!dates[startValue] || !dates[endValue]) {
24
30
  return;
25
31
  }
26
- const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(dates[startValue], dates[endValue]);
32
+ const isGreaterThanTwoWeeks = (0, _isDifferenceGreaterThanTwoWeeks.isDifferenceGreaterThanTwoWeeks)(dates[startValue], dates[endValue]);
27
33
  const wasGreaterThanTwoWeeks = isGreaterThanTwoWeeksRef.current ?? false;
28
34
  if (isGreaterThanTwoWeeks !== wasGreaterThanTwoWeeks) {
29
- const labelsData = getLabelData({
35
+ const labelsData = (0, _getLabelData.getLabelData)({
30
36
  dates,
31
37
  isGreaterThanTwoWeeks
32
38
  });
@@ -34,13 +40,13 @@ export const handleLabelUpdate = (instance, mainData, labelTimerRef, isGreaterTh
34
40
  xAxis: [{
35
41
  id: 'main-xAxis',
36
42
  axisLabel: {
37
- formatter: value => formatXAxisLabel(value, isGreaterThanTwoWeeks, locale)
43
+ formatter: value => (0, _formatXAxisLabel.formatXAxisLabel)(value, isGreaterThanTwoWeeks, locale)
38
44
  }
39
45
  }, {
40
46
  id: 'additional-xAxis',
41
47
  axisLabel: {
42
48
  customValues: labelsData,
43
- formatter: value => formatXAxisAdditionalLabel(value, isGreaterThanTwoWeeks, locale)
49
+ formatter: value => (0, _formatXAxisAdditionalLabel.formatXAxisAdditionalLabel)(value, isGreaterThanTwoWeeks, locale)
44
50
  }
45
51
  }]
46
52
  });
@@ -48,4 +54,5 @@ export const handleLabelUpdate = (instance, mainData, labelTimerRef, isGreaterTh
48
54
  }
49
55
  }, 50);
50
56
  };
57
+ exports.handleLabelUpdate = handleLabelUpdate;
51
58
  //# sourceMappingURL=handleLabelUpdate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleLabelUpdate.js","names":["formatXAxisAdditionalLabel","formatXAxisLabel","getLabelData","isDifferenceGreaterThanTwoWeeks","handleLabelUpdate","instance","mainData","labelTimerRef","isGreaterThanTwoWeeksRef","locale","current","clearTimeout","setTimeout","dates","dataZoom","getOption","Array","isArray","length","startValue","endValue","isGreaterThanTwoWeeks","wasGreaterThanTwoWeeks","labelsData","setOption","xAxis","id","axisLabel","formatter","value","customValues"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts"],"sourcesContent":["import type { EChartsType } from 'echarts';\nimport type { MutableRefObject } from 'react';\n\nimport type { ChartProps, DataZoomArray } from '../types';\nimport { formatXAxisAdditionalLabel } from './formatXAxisAdditionalLabel';\nimport { formatXAxisLabel } from './formatXAxisLabel';\nimport { getLabelData } from './getLabelData';\nimport { isDifferenceGreaterThanTwoWeeks } from './isDifferenceGreaterThanTwoWeeks';\n\nexport const handleLabelUpdate = (\n instance: EChartsType,\n mainData: ChartProps['mainData'],\n labelTimerRef: MutableRefObject<NodeJS.Timeout | null>,\n isGreaterThanTwoWeeksRef: MutableRefObject<boolean | null>,\n locale: string\n): void => {\n if (labelTimerRef.current) {\n clearTimeout(labelTimerRef.current);\n }\n labelTimerRef.current = setTimeout(() => {\n const { dates } = mainData;\n\n const { dataZoom } = instance.getOption();\n if (\n !Array.isArray(dataZoom) ||\n dataZoom.length === 0 ||\n !dataZoom[0] ||\n typeof dataZoom[0].startValue !== 'number' ||\n typeof dataZoom[0].endValue !== 'number'\n ) {\n return;\n }\n\n const { startValue, endValue } = dataZoom[0] as DataZoomArray[0];\n\n if (!dates[startValue] || !dates[endValue]) {\n return;\n }\n\n const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(\n dates[startValue],\n dates[endValue]\n );\n\n const wasGreaterThanTwoWeeks = isGreaterThanTwoWeeksRef.current ?? false;\n\n if (isGreaterThanTwoWeeks !== wasGreaterThanTwoWeeks) {\n const labelsData = getLabelData({\n dates,\n isGreaterThanTwoWeeks,\n });\n\n instance.setOption({\n xAxis: [\n {\n id: 'main-xAxis',\n axisLabel: {\n formatter: (value: string) =>\n formatXAxisLabel(value, isGreaterThanTwoWeeks, locale),\n },\n },\n {\n id: 'additional-xAxis',\n axisLabel: {\n customValues: labelsData,\n formatter: (value: unknown) =>\n formatXAxisAdditionalLabel(\n value,\n isGreaterThanTwoWeeks,\n locale\n ),\n },\n },\n ],\n });\n\n isGreaterThanTwoWeeksRef.current = isGreaterThanTwoWeeks;\n }\n }, 50);\n};\n"],"mappings":"AAIA,SAASA,0BAA0B,QAAQ,8BAA8B;AACzE,SAASC,gBAAgB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C;QACjBC,KAAK,EAAE,CACL;UACEC,EAAE,EAAE,YAAY;UAChBC,SAAS,EAAE;YACTC,SAAS,EAAGC,KAAa,IACvB5B,gBAAgB,CAAC4B,KAAK,EAAER,qBAAqB,EAAEZ,MAAM;UACzD;QACF,CAAC,EACD;UACEiB,EAAE,EAAE,kBAAkB;UACtBC,SAAS,EAAE;YACTG,YAAY,EAAEP,UAAU;YACxBK,SAAS,EAAGC,KAAc,IACxB7B,0BAA0B,CACxB6B,KAAK,EACLR,qBAAqB,EACrBZ,MACF;UACJ;QACF,CAAC;MAEL,CAAC,CAAC;MAEFD,wBAAwB,CAACE,OAAO,GAAGW,qBAAqB;IAC1D;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"handleLabelUpdate.js","names":["_formatXAxisAdditionalLabel","require","_formatXAxisLabel","_getLabelData","_isDifferenceGreaterThanTwoWeeks","handleLabelUpdate","instance","mainData","labelTimerRef","isGreaterThanTwoWeeksRef","locale","current","clearTimeout","setTimeout","dates","dataZoom","getOption","Array","isArray","length","startValue","endValue","isGreaterThanTwoWeeks","isDifferenceGreaterThanTwoWeeks","wasGreaterThanTwoWeeks","labelsData","getLabelData","setOption","xAxis","id","axisLabel","formatter","value","formatXAxisLabel","customValues","formatXAxisAdditionalLabel","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/handleLabelUpdate.ts"],"sourcesContent":["import type { EChartsType } from 'echarts';\nimport type { MutableRefObject } from 'react';\n\nimport type { ChartProps, DataZoomArray } from '../types';\nimport { formatXAxisAdditionalLabel } from './formatXAxisAdditionalLabel';\nimport { formatXAxisLabel } from './formatXAxisLabel';\nimport { getLabelData } from './getLabelData';\nimport { isDifferenceGreaterThanTwoWeeks } from './isDifferenceGreaterThanTwoWeeks';\n\nexport const handleLabelUpdate = (\n instance: EChartsType,\n mainData: ChartProps['mainData'],\n labelTimerRef: MutableRefObject<NodeJS.Timeout | null>,\n isGreaterThanTwoWeeksRef: MutableRefObject<boolean | null>,\n locale: string\n): void => {\n if (labelTimerRef.current) {\n clearTimeout(labelTimerRef.current);\n }\n labelTimerRef.current = setTimeout(() => {\n const { dates } = mainData;\n\n const { dataZoom } = instance.getOption();\n if (\n !Array.isArray(dataZoom) ||\n dataZoom.length === 0 ||\n !dataZoom[0] ||\n typeof dataZoom[0].startValue !== 'number' ||\n typeof dataZoom[0].endValue !== 'number'\n ) {\n return;\n }\n\n const { startValue, endValue } = dataZoom[0] as DataZoomArray[0];\n\n if (!dates[startValue] || !dates[endValue]) {\n return;\n }\n\n const isGreaterThanTwoWeeks = isDifferenceGreaterThanTwoWeeks(\n dates[startValue],\n dates[endValue]\n );\n\n const wasGreaterThanTwoWeeks = isGreaterThanTwoWeeksRef.current ?? false;\n\n if (isGreaterThanTwoWeeks !== wasGreaterThanTwoWeeks) {\n const labelsData = getLabelData({\n dates,\n isGreaterThanTwoWeeks,\n });\n\n instance.setOption({\n xAxis: [\n {\n id: 'main-xAxis',\n axisLabel: {\n formatter: (value: string) =>\n formatXAxisLabel(value, isGreaterThanTwoWeeks, locale),\n },\n },\n {\n id: 'additional-xAxis',\n axisLabel: {\n customValues: labelsData,\n formatter: (value: unknown) =>\n formatXAxisAdditionalLabel(\n value,\n isGreaterThanTwoWeeks,\n locale\n ),\n },\n },\n ],\n });\n\n isGreaterThanTwoWeeksRef.current = isGreaterThanTwoWeeks;\n }\n }, 50);\n};\n"],"mappings":";;;;;;AAIA,IAAAA,2BAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,gCAAA,GAAAH,OAAA;AAEO,MAAMI,iBAAiB,GAAGA,CAC/BC,QAAqB,EACrBC,QAAgC,EAChCC,aAAsD,EACtDC,wBAA0D,EAC1DC,MAAc,KACL;EACT,IAAIF,aAAa,CAACG,OAAO,EAAE;IACzBC,YAAY,CAACJ,aAAa,CAACG,OAAO,CAAC;EACrC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c,IACxB,IAAAG,sDAA0B,EACxBH,KAAK,EACLV,qBAAqB,EACrBZ,MACF;UACJ;QACF,CAAC;MAEL,CAAC,CAAC;MAEFD,wBAAwB,CAACE,OAAO,GAAGW,qBAAqB;IAC1D;EACF,CAAC,EAAE,EAAE,CAAC;AACR,CAAC;AAACc,OAAA,CAAA/B,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -1,4 +1,10 @@
1
- export const handleTooltipUpdate = (instance, zoomTimerRef, tooltipVisibleRef, canHover) => {
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleTooltipUpdate = void 0;
7
+ const handleTooltipUpdate = (instance, zoomTimerRef, tooltipVisibleRef, canHover) => {
2
8
  if (!canHover) {
3
9
  return;
4
10
  }
@@ -24,4 +30,5 @@ export const handleTooltipUpdate = (instance, zoomTimerRef, tooltipVisibleRef, c
24
30
  }
25
31
  }, 100);
26
32
  };
33
+ exports.handleTooltipUpdate = handleTooltipUpdate;
27
34
  //# sourceMappingURL=handleTooltipUpdate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleTooltipUpdate.js","names":["handleTooltipUpdate","instance","zoomTimerRef","tooltipVisibleRef","canHover","current","setOption","tooltip","show","clearTimeout","setTimeout"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts"],"sourcesContent":["import type { EChartsType } from 'echarts';\nimport type { MutableRefObject } from 'react';\n\nexport const handleTooltipUpdate = (\n instance: EChartsType,\n zoomTimerRef: MutableRefObject<NodeJS.Timeout | null>,\n tooltipVisibleRef: MutableRefObject<boolean>,\n canHover: boolean\n): void => {\n if (!canHover) {\n return;\n }\n\n if (tooltipVisibleRef.current) {\n instance.setOption({\n tooltip: {\n show: false,\n },\n });\n tooltipVisibleRef.current = false;\n }\n\n if (zoomTimerRef.current) {\n clearTimeout(zoomTimerRef.current);\n }\n\n zoomTimerRef.current = setTimeout(() => {\n if (!tooltipVisibleRef.current) {\n instance.setOption({\n tooltip: {\n show: true,\n },\n });\n tooltipVisibleRef.current = true;\n }\n }, 100);\n};\n"],"mappings":"AAGA,OAAO,MAAMA,mBAAmB,GAAGA,CACjCC,QAAqB,EACrBC,YAAqD,EACrDC,iBAA4C,EAC5CC,QAAiB,KACR;EACT,IAAI,CAACA,QAAQ,EAAE;IACb;EACF;EAEA,IAAID,iBAAiB,CAACE,OAAO,EAAE;IAC7BJ,QAAQ,CAACK,SAAS,CAAC;MACjBC,OAAO,EAAE;QACPC,IAAI,EAAE;MACR;IACF,CAAC,CAAC;IACFL,iBAAiB,CAACE,OAAO,GAAG,KAAK;EACnC;EAEA,IAAIH,YAAY,CAACG,OAAO,EAAE;IACxBI,YAAY,CAACP,YAAY,CAACG,OAAO,CAAC;EACpC;EAEAH,YAAY,CAACG,OAAO,GAAGK,UAAU,CAAC,MAAM;IACtC,IAAI,CAACP,iBAAiB,CAACE,OAAO,EAAE;MAC9BJ,QAAQ,CAACK,SAAS,CAAC;QACjBC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR;MACF,CAAC,CAAC;MACFL,iBAAiB,CAACE,OAAO,GAAG,IAAI;IAClC;EACF,CAAC,EAAE,GAAG,CAAC;AACT,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"handleTooltipUpdate.js","names":["handleTooltipUpdate","instance","zoomTimerRef","tooltipVisibleRef","canHover","current","setOption","tooltip","show","clearTimeout","setTimeout","exports"],"sources":["../../../../../../src/CrowdViewWidget/components/Chart/chartUtils/handleTooltipUpdate.ts"],"sourcesContent":["import type { EChartsType } from 'echarts';\nimport type { MutableRefObject } from 'react';\n\nexport const handleTooltipUpdate = (\n instance: EChartsType,\n zoomTimerRef: MutableRefObject<NodeJS.Timeout | null>,\n tooltipVisibleRef: MutableRefObject<boolean>,\n canHover: boolean\n): void => {\n if (!canHover) {\n return;\n }\n\n if (tooltipVisibleRef.current) {\n instance.setOption({\n tooltip: {\n show: false,\n },\n });\n tooltipVisibleRef.current = false;\n }\n\n if (zoomTimerRef.current) {\n clearTimeout(zoomTimerRef.current);\n }\n\n zoomTimerRef.current = setTimeout(() => {\n if (!tooltipVisibleRef.current) {\n instance.setOption({\n tooltip: {\n show: true,\n },\n });\n tooltipVisibleRef.current = true;\n }\n }, 100);\n};\n"],"mappings":";;;;;;AAGO,MAAMA,mBAAmB,GAAGA,CACjCC,QAAqB,EACrBC,YAAqD,EACrDC,iBAA4C,EAC5CC,QAAiB,KACR;EACT,IAAI,CAACA,QAAQ,EAAE;IACb;EACF;EAEA,IAAID,iBAAiB,CAACE,OAAO,EAAE;IAC7BJ,QAAQ,CAACK,SAAS,CAAC;MACjBC,OAAO,EAAE;QACPC,IAAI,EAAE;MACR;IACF,CAAC,CAAC;IACFL,iBAAiB,CAACE,OAAO,GAAG,KAAK;EACnC;EAEA,IAAIH,YAAY,CAACG,OAAO,EAAE;IACxBI,YAAY,CAACP,YAAY,CAACG,OAAO,CAAC;EACpC;EAEAH,YAAY,CAACG,OAAO,GAAGK,UAAU,CAAC,MAAM;IACtC,IAAI,CAACP,iBAAiB,CAACE,OAAO,EAAE;MAC9BJ,QAAQ,CAACK,SAAS,CAAC;QACjBC,OAAO,EAAE;UACPC,IAAI,EAAE;QACR;MACF,CAAC,CAAC;MACFL,iBAAiB,CAACE,OAAO,GAAG,IAAI;IAClC;EACF,CAAC,EAAE,GAAG,CAAC;AACT,CAAC;AAACM,OAAA,CAAAX,mBAAA,GAAAA,mBAAA","ignoreList":[]}