@pie-lib/charting 5.36.3-next.0 → 5.36.3-next.162

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 (114) hide show
  1. package/CHANGELOG.md +24 -87
  2. package/esm/package.json +3 -0
  3. package/lib/actions-button.js +60 -90
  4. package/lib/actions-button.js.map +1 -1
  5. package/lib/axes.js +162 -238
  6. package/lib/axes.js.map +1 -1
  7. package/lib/bars/bar.js +13 -41
  8. package/lib/bars/bar.js.map +1 -1
  9. package/lib/bars/common/bars.js +61 -137
  10. package/lib/bars/common/bars.js.map +1 -1
  11. package/lib/bars/common/correct-check-icon.js +5 -6
  12. package/lib/bars/common/correct-check-icon.js.map +1 -1
  13. package/lib/bars/histogram.js +13 -41
  14. package/lib/bars/histogram.js.map +1 -1
  15. package/lib/chart-setup.js +119 -195
  16. package/lib/chart-setup.js.map +1 -1
  17. package/lib/chart-type.js +52 -43
  18. package/lib/chart-type.js.map +1 -1
  19. package/lib/chart-types.js +1 -10
  20. package/lib/chart-types.js.map +1 -1
  21. package/lib/chart.js +73 -151
  22. package/lib/chart.js.map +1 -1
  23. package/lib/common/correctness-indicators.js +109 -52
  24. package/lib/common/correctness-indicators.js.map +1 -1
  25. package/lib/common/drag-handle.js +65 -108
  26. package/lib/common/drag-handle.js.map +1 -1
  27. package/lib/common/drag-icon.js +12 -12
  28. package/lib/common/drag-icon.js.map +1 -1
  29. package/lib/common/styles.js +6 -24
  30. package/lib/common/styles.js.map +1 -1
  31. package/lib/grid.js +43 -83
  32. package/lib/grid.js.map +1 -1
  33. package/lib/index.js +0 -6
  34. package/lib/index.js.map +1 -1
  35. package/lib/key-legend.js +63 -87
  36. package/lib/key-legend.js.map +1 -1
  37. package/lib/line/common/drag-handle.js +72 -100
  38. package/lib/line/common/drag-handle.js.map +1 -1
  39. package/lib/line/common/line.js +50 -96
  40. package/lib/line/common/line.js.map +1 -1
  41. package/lib/line/line-cross.js +79 -89
  42. package/lib/line/line-cross.js.map +1 -1
  43. package/lib/line/line-dot.js +58 -76
  44. package/lib/line/line-dot.js.map +1 -1
  45. package/lib/mark-label.js +84 -119
  46. package/lib/mark-label.js.map +1 -1
  47. package/lib/plot/common/plot.js +90 -148
  48. package/lib/plot/common/plot.js.map +1 -1
  49. package/lib/plot/dot.js +32 -58
  50. package/lib/plot/dot.js.map +1 -1
  51. package/lib/plot/line.js +39 -64
  52. package/lib/plot/line.js.map +1 -1
  53. package/lib/tool-menu.js +47 -83
  54. package/lib/tool-menu.js.map +1 -1
  55. package/lib/utils.js +31 -86
  56. package/lib/utils.js.map +1 -1
  57. package/package.json +30 -16
  58. package/src/__tests__/axes.test.jsx +85 -100
  59. package/src/__tests__/chart-type.test.jsx +5 -11
  60. package/src/__tests__/chart.test.jsx +41 -50
  61. package/src/__tests__/grid.test.jsx +23 -11
  62. package/src/__tests__/mark-label.test.jsx +13 -11
  63. package/src/__tests__/utils.js +8 -2
  64. package/src/actions-button.jsx +44 -39
  65. package/src/axes.jsx +67 -81
  66. package/src/bars/__tests__/bar.test.jsx +19 -11
  67. package/src/bars/__tests__/histogram.test.jsx +19 -12
  68. package/src/bars/common/__tests__/bars.test.jsx +23 -24
  69. package/src/bars/common/bars.jsx +42 -69
  70. package/src/bars/common/correct-check-icon.jsx +5 -0
  71. package/src/chart-setup.jsx +75 -88
  72. package/src/chart-type.js +45 -22
  73. package/src/chart.jsx +19 -34
  74. package/src/common/__tests__/drag-handle.test.jsx +16 -45
  75. package/src/common/correctness-indicators.jsx +91 -13
  76. package/src/common/drag-handle.jsx +44 -64
  77. package/src/common/drag-icon.jsx +9 -2
  78. package/src/common/styles.js +1 -1
  79. package/src/grid.jsx +10 -14
  80. package/src/key-legend.jsx +62 -60
  81. package/src/line/__tests__/line-cross.test.jsx +16 -13
  82. package/src/line/__tests__/line-dot.test.jsx +16 -13
  83. package/src/line/__tests__/utils.js +8 -2
  84. package/src/line/common/__tests__/drag-handle.test.jsx +20 -45
  85. package/src/line/common/__tests__/line.test.jsx +27 -30
  86. package/src/line/common/drag-handle.jsx +61 -55
  87. package/src/line/common/line.jsx +21 -11
  88. package/src/line/line-cross.js +39 -14
  89. package/src/line/line-dot.js +27 -32
  90. package/src/mark-label.jsx +51 -47
  91. package/src/plot/__tests__/dot.test.jsx +19 -12
  92. package/src/plot/__tests__/line.test.jsx +19 -12
  93. package/src/plot/common/__tests__/plot.test.jsx +23 -24
  94. package/src/plot/common/plot.jsx +29 -24
  95. package/src/plot/dot.js +11 -4
  96. package/src/plot/line.js +16 -8
  97. package/src/tool-menu.jsx +26 -30
  98. package/src/utils.js +13 -9
  99. package/src/__tests__/__snapshots__/axes.test.jsx.snap +0 -569
  100. package/src/__tests__/__snapshots__/chart-type.test.jsx.snap +0 -14
  101. package/src/__tests__/__snapshots__/chart.test.jsx.snap +0 -595
  102. package/src/__tests__/__snapshots__/grid.test.jsx.snap +0 -72
  103. package/src/__tests__/__snapshots__/mark-label.test.jsx.snap +0 -73
  104. package/src/bars/__tests__/__snapshots__/bar.test.jsx.snap +0 -43
  105. package/src/bars/__tests__/__snapshots__/histogram.test.jsx.snap +0 -45
  106. package/src/bars/common/__tests__/__snapshots__/bars.test.jsx.snap +0 -110
  107. package/src/common/__tests__/__snapshots__/drag-handle.test.jsx.snap +0 -48
  108. package/src/line/__tests__/__snapshots__/line-cross.test.jsx.snap +0 -45
  109. package/src/line/__tests__/__snapshots__/line-dot.test.jsx.snap +0 -45
  110. package/src/line/common/__tests__/__snapshots__/drag-handle.test.jsx.snap +0 -49
  111. package/src/line/common/__tests__/__snapshots__/line.test.jsx.snap +0 -143
  112. package/src/plot/__tests__/__snapshots__/dot.test.jsx.snap +0 -45
  113. package/src/plot/__tests__/__snapshots__/line.test.jsx.snap +0 -45
  114. package/src/plot/common/__tests__/__snapshots__/plot.test.jsx.snap +0 -97
package/lib/axes.js CHANGED
@@ -1,92 +1,109 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = exports.TickComponent = exports.RawChartAxes = void 0;
9
-
10
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
-
16
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
13
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
24
14
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
-
26
15
  var _react = _interopRequireDefault(require("react"));
27
-
28
16
  var _propTypes = _interopRequireDefault(require("prop-types"));
29
-
30
- var _styles = require("@material-ui/core/styles");
31
-
32
- var _axis = require("@vx/axis");
33
-
34
- var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
35
-
17
+ var _styles = require("@mui/material/styles");
18
+ var _axis = require("@visx/axis");
19
+ var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
36
20
  var _plot = require("@pie-lib/plot");
37
-
38
21
  var _renderUi = require("@pie-lib/render-ui");
39
-
40
22
  var _configUi = require("@pie-lib/config-ui");
41
-
42
23
  var _mathRendering = require("@pie-lib/math-rendering");
43
-
44
24
  var _correctnessIndicators = require("./common/correctness-indicators");
45
-
46
25
  var _utils = require("./utils");
47
-
48
26
  var _markLabel = _interopRequireDefault(require("./mark-label"));
49
-
50
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
51
-
52
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
53
-
54
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
55
-
56
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
57
-
58
- var TickComponent = /*#__PURE__*/function (_React$Component) {
59
- (0, _inherits2["default"])(TickComponent, _React$Component);
60
-
61
- var _super = _createSuper(TickComponent);
62
-
27
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
28
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
29
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
30
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
31
+ var StyledErrorText = (0, _styles.styled)('text')(function (_ref) {
32
+ var theme = _ref.theme;
33
+ return {
34
+ fontSize: theme.typography.fontSize - 2,
35
+ fill: theme.palette.error.main
36
+ };
37
+ });
38
+ var StyledCheckbox = (0, _styles.styled)(_Checkbox["default"])(function () {
39
+ return {
40
+ color: "".concat(_renderUi.color.tertiary(), " !important")
41
+ };
42
+ });
43
+ var StyledAxesGroup = (0, _styles.styled)('g')(function (_ref2) {
44
+ var _theme$typography$bod;
45
+ var theme = _ref2.theme;
46
+ return {
47
+ '& .vx-axis-line': {
48
+ stroke: _renderUi.color.visualElementsColors.AXIS_LINE_COLOR,
49
+ strokeWidth: 2
50
+ },
51
+ '& .vx-axis-tick': {
52
+ fill: _renderUi.color.visualElementsColors.AXIS_TICK_COLOR,
53
+ '& line': {
54
+ stroke: _renderUi.color.visualElementsColors.AXIS_TICK_COLOR,
55
+ strokeWidth: 2
56
+ },
57
+ fontFamily: (_theme$typography$bod = theme.typography.body1) === null || _theme$typography$bod === void 0 ? void 0 : _theme$typography$bod.fontFamily,
58
+ fontSize: theme.typography.fontSize,
59
+ textAnchor: 'middle'
60
+ }
61
+ };
62
+ });
63
+ var correctnessIconStyles = function correctnessIconStyles(theme) {
64
+ return {
65
+ borderRadius: theme.spacing(2),
66
+ color: _renderUi.color.defaults.WHITE,
67
+ fontSize: '16px',
68
+ width: '16px',
69
+ height: '16px',
70
+ padding: '2px',
71
+ border: "1px solid ".concat(_renderUi.color.defaults.WHITE),
72
+ boxSizing: 'unset' // to override the default border-box in IBX
73
+ };
74
+ };
75
+ var incorrectIconStyles = {
76
+ backgroundColor: _renderUi.color.incorrectWithIcon()
77
+ };
78
+ var correctIconStyles = {
79
+ backgroundColor: _renderUi.color.correct()
80
+ };
81
+ var TickComponent = exports.TickComponent = /*#__PURE__*/function (_React$Component) {
63
82
  function TickComponent(props) {
64
83
  var _this;
65
-
66
84
  (0, _classCallCheck2["default"])(this, TickComponent);
67
- _this = _super.call(this, props);
68
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleAlertDialog", function (open, callback) {
85
+ _this = _callSuper(this, TickComponent, [props]);
86
+ (0, _defineProperty2["default"])(_this, "handleAlertDialog", function (open, callback) {
69
87
  return _this.setState({
70
88
  dialog: {
71
89
  open: open
72
90
  }
73
91
  }, callback);
74
92
  });
75
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeCategory", function (index, newLabel) {
93
+ (0, _defineProperty2["default"])(_this, "changeCategory", function (index, newLabel) {
76
94
  var _this$props = _this.props,
77
- categories = _this$props.categories,
78
- onChangeCategory = _this$props.onChangeCategory;
95
+ categories = _this$props.categories,
96
+ onChangeCategory = _this$props.onChangeCategory;
79
97
  var category = categories[index];
80
98
  onChangeCategory(index, _objectSpread(_objectSpread({}, category), {}, {
81
99
  label: newLabel
82
100
  }));
83
101
  });
84
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeInteractive", function (index, value) {
102
+ (0, _defineProperty2["default"])(_this, "changeInteractive", function (index, value) {
85
103
  var _this$props2 = _this.props,
86
- categories = _this$props2.categories,
87
- onChangeCategory = _this$props2.onChangeCategory;
104
+ categories = _this$props2.categories,
105
+ onChangeCategory = _this$props2.onChangeCategory;
88
106
  var category = categories[index];
89
-
90
107
  if (!value) {
91
108
  _this.setState({
92
109
  dialog: {
@@ -109,12 +126,11 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
109
126
  }));
110
127
  }
111
128
  });
112
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "changeEditable", function (index, value) {
129
+ (0, _defineProperty2["default"])(_this, "changeEditable", function (index, value) {
113
130
  var _this$props3 = _this.props,
114
- categories = _this$props3.categories,
115
- onChangeCategory = _this$props3.onChangeCategory;
131
+ categories = _this$props3.categories,
132
+ onChangeCategory = _this$props3.onChangeCategory;
116
133
  var category = categories[index];
117
-
118
134
  if (!value) {
119
135
  _this.setState({
120
136
  dialog: {
@@ -137,26 +153,21 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
137
153
  }));
138
154
  }
139
155
  });
140
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "splitText", function (text, maxChar) {
156
+ (0, _defineProperty2["default"])(_this, "splitText", function (text, maxChar) {
141
157
  var chunks = [];
142
-
143
158
  while ((text || '').length > 0) {
144
159
  var indexToSplit = void 0;
145
-
146
160
  if (text.length > maxChar) {
147
161
  indexToSplit = text.lastIndexOf(' ', maxChar);
148
-
149
162
  if (indexToSplit === -1) {
150
163
  indexToSplit = maxChar;
151
164
  }
152
165
  } else {
153
166
  indexToSplit = text.length;
154
167
  }
155
-
156
168
  chunks.push(text.substring(0, indexToSplit));
157
169
  text = text.substring(indexToSplit).trim();
158
170
  }
159
-
160
171
  return chunks;
161
172
  });
162
173
  _this.state = {
@@ -166,8 +177,8 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
166
177
  };
167
178
  return _this;
168
179
  }
169
-
170
- (0, _createClass2["default"])(TickComponent, [{
180
+ (0, _inherits2["default"])(TickComponent, _React$Component);
181
+ return (0, _createClass2["default"])(TickComponent, [{
171
182
  key: "componentDidUpdate",
172
183
  value: function componentDidUpdate(prevProps) {
173
184
  if (this.props.autoFocus && !prevProps.autoFocus) {
@@ -178,47 +189,46 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
178
189
  key: "render",
179
190
  value: function render() {
180
191
  var _this2 = this;
181
-
182
192
  var _this$props4 = this.props,
183
- classes = _this$props4.classes,
184
- categories = _this$props4.categories,
185
- xBand = _this$props4.xBand,
186
- bandWidth = _this$props4.bandWidth,
187
- barWidth = _this$props4.barWidth,
188
- rotate = _this$props4.rotate,
189
- top = _this$props4.top,
190
- graphProps = _this$props4.graphProps,
191
- defineChart = _this$props4.defineChart,
192
- chartingOptions = _this$props4.chartingOptions,
193
- x = _this$props4.x,
194
- y = _this$props4.y,
195
- formattedValue = _this$props4.formattedValue,
196
- changeInteractiveEnabled = _this$props4.changeInteractiveEnabled,
197
- changeEditableEnabled = _this$props4.changeEditableEnabled,
198
- error = _this$props4.error,
199
- autoFocus = _this$props4.autoFocus,
200
- hiddenLabelRef = _this$props4.hiddenLabelRef,
201
- showCorrectness = _this$props4.showCorrectness;
202
-
193
+ categories = _this$props4.categories,
194
+ xBand = _this$props4.xBand,
195
+ bandWidth = _this$props4.bandWidth,
196
+ barWidth = _this$props4.barWidth,
197
+ rotate = _this$props4.rotate,
198
+ top = _this$props4.top,
199
+ graphProps = _this$props4.graphProps,
200
+ defineChart = _this$props4.defineChart,
201
+ chartingOptions = _this$props4.chartingOptions,
202
+ x = _this$props4.x,
203
+ y = _this$props4.y,
204
+ formattedValue = _this$props4.formattedValue,
205
+ changeInteractiveEnabled = _this$props4.changeInteractiveEnabled,
206
+ changeEditableEnabled = _this$props4.changeEditableEnabled,
207
+ error = _this$props4.error,
208
+ autoFocus = _this$props4.autoFocus,
209
+ hiddenLabelRef = _this$props4.hiddenLabelRef,
210
+ showCorrectness = _this$props4.showCorrectness;
203
211
  if (!formattedValue) {
204
212
  return null;
205
213
  }
206
214
 
215
+ // Create classes object for TickCorrectnessIndicator compatibility
216
+ var classes = {
217
+ correctnessIcon: correctnessIconStyles,
218
+ incorrectIcon: incorrectIconStyles,
219
+ correctIcon: correctIconStyles
220
+ };
207
221
  var dialog = this.state.dialog;
208
-
209
- var _ref = chartingOptions || {},
210
- changeEditable = _ref.changeEditable,
211
- changeInteractive = _ref.changeInteractive;
212
-
222
+ var _ref3 = chartingOptions || {},
223
+ changeEditable = _ref3.changeEditable,
224
+ changeInteractive = _ref3.changeInteractive;
213
225
  var index = parseInt(formattedValue.split('-')[0], 10);
214
226
  var category = categories[index];
215
-
216
- var _ref2 = category || {},
217
- editable = _ref2.editable,
218
- interactive = _ref2.interactive,
219
- label = _ref2.label,
220
- correctness = _ref2.correctness;
221
-
227
+ var _ref4 = category || {},
228
+ editable = _ref4.editable,
229
+ interactive = _ref4.interactive,
230
+ label = _ref4.label,
231
+ correctness = _ref4.correctness;
222
232
  var barX = xBand((0, _utils.bandKey)({
223
233
  label: label
224
234
  }, index));
@@ -226,6 +236,8 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
226
236
  var lengthA = a && a.label ? a.label.length : 0;
227
237
  var lengthB = b && b.label ? b.label.length : 0;
228
238
  return lengthA > lengthB ? a : b;
239
+ }, {
240
+ label: ''
229
241
  });
230
242
  var distinctMessages = error ? (0, _toConsumableArray2["default"])(new Set(Object.values(error))).join(' ') : '';
231
243
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("foreignObject", {
@@ -265,8 +277,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
265
277
  interactive: interactive,
266
278
  classes: classes
267
279
  })
268
- })), error && index === 0 && /*#__PURE__*/_react["default"].createElement("text", {
269
- className: classes.error,
280
+ })), error && index === 0 && /*#__PURE__*/_react["default"].createElement(StyledErrorText, {
270
281
  y: y + 23,
271
282
  height: 6,
272
283
  textAnchor: "start"
@@ -318,8 +329,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
318
329
  pointerEvents: 'visible',
319
330
  overflow: 'visible'
320
331
  }
321
- }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
322
- className: classes.customColor,
332
+ }, /*#__PURE__*/_react["default"].createElement(StyledCheckbox, {
323
333
  style: {
324
334
  position: 'fixed'
325
335
  },
@@ -336,8 +346,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
336
346
  pointerEvents: 'visible',
337
347
  overflow: 'visible'
338
348
  }
339
- }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
340
- className: classes.customColor,
349
+ }, /*#__PURE__*/_react["default"].createElement(StyledCheckbox, {
341
350
  style: {
342
351
  position: 'fixed'
343
352
  },
@@ -363,10 +372,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
363
372
  })));
364
373
  }
365
374
  }]);
366
- return TickComponent;
367
375
  }(_react["default"].Component);
368
-
369
- exports.TickComponent = TickComponent;
370
376
  (0, _defineProperty2["default"])(TickComponent, "propTypes", {
371
377
  defineChart: _propTypes["default"].bool,
372
378
  error: _propTypes["default"].any
@@ -384,7 +390,6 @@ TickComponent.propTypes = {
384
390
  formattedValue: _propTypes["default"].string,
385
391
  onChangeCategory: _propTypes["default"].func,
386
392
  onChange: _propTypes["default"].func,
387
- classes: _propTypes["default"].object,
388
393
  error: _propTypes["default"].object,
389
394
  defineChart: _propTypes["default"].bool,
390
395
  chartingOptions: _propTypes["default"].object,
@@ -392,47 +397,41 @@ TickComponent.propTypes = {
392
397
  changeEditableEnabled: _propTypes["default"].bool,
393
398
  autoFocus: _propTypes["default"].bool,
394
399
  onAutoFocusUsed: _propTypes["default"].func,
395
- showCorrectness: _propTypes["default"].bool
400
+ showCorrectness: _propTypes["default"].bool,
401
+ hiddenLabelRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
402
+ current: _propTypes["default"].instanceOf(Element)
403
+ })])
396
404
  };
397
-
398
- var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
399
- (0, _inherits2["default"])(RawChartAxes, _React$Component2);
400
-
401
- var _super2 = _createSuper(RawChartAxes);
402
-
405
+ var RawChartAxes = exports.RawChartAxes = /*#__PURE__*/function (_React$Component2) {
403
406
  function RawChartAxes() {
404
407
  var _this3;
405
-
406
408
  (0, _classCallCheck2["default"])(this, RawChartAxes);
407
-
408
409
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
409
410
  args[_key] = arguments[_key];
410
411
  }
411
-
412
- _this3 = _super2.call.apply(_super2, [this].concat(args));
413
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "state", {
412
+ _this3 = _callSuper(this, RawChartAxes, [].concat(args));
413
+ (0, _defineProperty2["default"])(_this3, "state", {
414
414
  height: 0,
415
415
  width: 0
416
416
  });
417
417
  return _this3;
418
418
  }
419
-
420
- (0, _createClass2["default"])(RawChartAxes, [{
419
+ (0, _inherits2["default"])(RawChartAxes, _React$Component2);
420
+ return (0, _createClass2["default"])(RawChartAxes, [{
421
421
  key: "componentDidMount",
422
422
  value: function componentDidMount() {
423
423
  if (this.hiddenLabelRef) {
424
424
  var boundingClientRect = this.hiddenLabelRef.getBoundingClientRect();
425
- var hiddenEl = this.hiddenLabelRef.current; // same logic used in dropdown.jsx for hidden labels width calculation
425
+ var hiddenEl = this.hiddenLabelRef;
426
426
 
427
+ // same logic used in dropdown.jsx for hidden labels width calculation
427
428
  if (hiddenEl) {
428
429
  var containsLatex = hiddenEl.querySelector('[data-latex], [data-raw]');
429
430
  var hasMathJax = hiddenEl.querySelector('mjx-container');
430
431
  var mathHandled = hiddenEl.querySelector('[data-math-handled="true"]');
431
-
432
432
  if (containsLatex && (!mathHandled || !hasMathJax)) {
433
433
  (0, _mathRendering.renderMath)(this.hiddenLabelRef);
434
434
  }
435
-
436
435
  this.setState({
437
436
  height: Math.floor(boundingClientRect.height),
438
437
  width: Math.floor(boundingClientRect.width)
@@ -442,10 +441,9 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
442
441
  }
443
442
  }, {
444
443
  key: "componentDidUpdate",
445
- value: function componentDidUpdate(prevProps, prevState, snapshot) {
444
+ value: function componentDidUpdate() {
446
445
  if (this.hiddenLabelRef) {
447
446
  var width = Math.floor(this.hiddenLabelRef.getBoundingClientRect().width);
448
-
449
447
  if (width !== this.state.width) {
450
448
  this.setState({
451
449
  width: width
@@ -457,69 +455,59 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
457
455
  key: "render",
458
456
  value: function render() {
459
457
  var _this4 = this;
460
-
461
458
  var _this$props5 = this.props,
462
- classes = _this$props5.classes,
463
- graphProps = _this$props5.graphProps,
464
- xBand = _this$props5.xBand,
465
- leftAxis = _this$props5.leftAxis,
466
- onChange = _this$props5.onChange,
467
- onChangeCategory = _this$props5.onChangeCategory,
468
- _this$props5$categori = _this$props5.categories,
469
- categories = _this$props5$categori === void 0 ? [] : _this$props5$categori,
470
- top = _this$props5.top,
471
- defineChart = _this$props5.defineChart,
472
- chartingOptions = _this$props5.chartingOptions,
473
- changeInteractiveEnabled = _this$props5.changeInteractiveEnabled,
474
- changeEditableEnabled = _this$props5.changeEditableEnabled,
475
- theme = _this$props5.theme,
476
- autoFocus = _this$props5.autoFocus,
477
- onAutoFocusUsed = _this$props5.onAutoFocusUsed,
478
- error = _this$props5.error,
479
- showCorrectness = _this$props5.showCorrectness;
480
- var axis = classes.axis,
481
- axisLine = classes.axisLine,
482
- tick = classes.tick;
483
-
484
- var _ref3 = graphProps || {},
485
- _ref3$scale = _ref3.scale,
486
- scale = _ref3$scale === void 0 ? {} : _ref3$scale,
487
- _ref3$range = _ref3.range,
488
- range = _ref3$range === void 0 ? {} : _ref3$range,
489
- _ref3$domain = _ref3.domain,
490
- domain = _ref3$domain === void 0 ? {} : _ref3$domain,
491
- _ref3$size = _ref3.size,
492
- size = _ref3$size === void 0 ? {} : _ref3$size;
493
-
459
+ graphProps = _this$props5.graphProps,
460
+ xBand = _this$props5.xBand,
461
+ leftAxis = _this$props5.leftAxis,
462
+ onChange = _this$props5.onChange,
463
+ onChangeCategory = _this$props5.onChangeCategory,
464
+ _this$props5$categori = _this$props5.categories,
465
+ categories = _this$props5$categori === void 0 ? [] : _this$props5$categori,
466
+ top = _this$props5.top,
467
+ defineChart = _this$props5.defineChart,
468
+ chartingOptions = _this$props5.chartingOptions,
469
+ changeInteractiveEnabled = _this$props5.changeInteractiveEnabled,
470
+ changeEditableEnabled = _this$props5.changeEditableEnabled,
471
+ theme = _this$props5.theme,
472
+ autoFocus = _this$props5.autoFocus,
473
+ onAutoFocusUsed = _this$props5.onAutoFocusUsed,
474
+ error = _this$props5.error,
475
+ showCorrectness = _this$props5.showCorrectness;
476
+ var _ref5 = graphProps || {},
477
+ _ref5$scale = _ref5.scale,
478
+ scale = _ref5$scale === void 0 ? {} : _ref5$scale,
479
+ _ref5$range = _ref5.range,
480
+ range = _ref5$range === void 0 ? {} : _ref5$range,
481
+ _ref5$domain = _ref5.domain,
482
+ domain = _ref5$domain === void 0 ? {} : _ref5$domain,
483
+ _ref5$size = _ref5.size,
484
+ size = _ref5$size === void 0 ? {} : _ref5$size;
494
485
  var _this$state = this.state,
495
- height = _this$state.height,
496
- width = _this$state.width;
486
+ height = _this$state.height,
487
+ width = _this$state.width;
497
488
  var bottomScale = xBand && typeof xBand.rangeRound === 'function' && xBand.rangeRound([0, size.width]);
498
- var bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth(); // for chartType "line", bandWidth will be 0, so we have to calculate it
499
-
489
+ var bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();
490
+ // for chartType "line", bandWidth will be 0, so we have to calculate it
500
491
  var barWidth = bandWidth || scale.x && scale.x(domain.max) / categories.length;
501
492
  var rowTickValues = (0, _utils.getTickValues)(_objectSpread(_objectSpread({}, range), {}, {
502
493
  step: range.labelStep
503
494
  }));
504
- var fontSize = theme && theme.typography ? theme.typography.fontSize : 14; // this mostly applies for labels that are not editable
505
-
506
- var rotateBecauseOfHeight = (0, _utils.getRotateAngle)(fontSize, height); // this applies for labels that are editable
507
-
495
+ var fontSize = theme && theme.typography ? theme.typography.fontSize : 14;
496
+ // this mostly applies for labels that are not editable
497
+ var rotateBecauseOfHeight = (0, _utils.getRotateAngle)(fontSize, height);
498
+ // this applies for labels that are editable
508
499
  var rotateBecauseOfWidth = width > barWidth ? 25 : 0;
509
-
510
500
  var getTickLabelProps = function getTickLabelProps(value) {
511
501
  return {
512
502
  dy: 4,
513
503
  dx: -10 - (value.toLocaleString().length || 1) * 5
514
504
  };
515
505
  };
516
-
517
506
  var getTickComponent = function getTickComponent(props) {
518
507
  var properties = {
519
508
  hiddenLabelRef: function hiddenLabelRef(ref) {
520
509
  _this4.hiddenLabelRef = ref;
521
510
  },
522
- classes: classes,
523
511
  categories: categories,
524
512
  xBand: xBand,
525
513
  bandWidth: bandWidth,
@@ -543,21 +531,15 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
543
531
  };
544
532
  return /*#__PURE__*/_react["default"].createElement(TickComponent, properties);
545
533
  };
546
-
547
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, leftAxis && /*#__PURE__*/_react["default"].createElement(_axis.AxisLeft, {
534
+ return /*#__PURE__*/_react["default"].createElement(StyledAxesGroup, null, leftAxis && /*#__PURE__*/_react["default"].createElement(_axis.AxisLeft, {
548
535
  scale: scale.y,
549
- className: axis,
550
- axisLineClassName: axisLine,
551
536
  tickLength: 10,
552
- tickClassName: tick,
553
537
  tickFormat: function tickFormat(value) {
554
538
  return value;
555
539
  },
556
540
  tickValues: rowTickValues,
557
541
  tickLabelProps: getTickLabelProps
558
542
  }), /*#__PURE__*/_react["default"].createElement(_axis.AxisBottom, {
559
- axisLineClassName: axisLine,
560
- tickClassName: tick,
561
543
  scale: bottomScale,
562
544
  labelProps: {
563
545
  y: 60 + top
@@ -577,13 +559,9 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
577
559
  }));
578
560
  }
579
561
  }]);
580
- return RawChartAxes;
581
562
  }(_react["default"].Component);
582
-
583
- exports.RawChartAxes = RawChartAxes;
584
563
  (0, _defineProperty2["default"])(RawChartAxes, "propTypes", {
585
564
  bottomScale: _propTypes["default"].func,
586
- classes: _propTypes["default"].object.isRequired,
587
565
  categories: _propTypes["default"].array,
588
566
  defineChart: _propTypes["default"].bool,
589
567
  error: _propTypes["default"].any,
@@ -599,64 +577,10 @@ exports.RawChartAxes = RawChartAxes;
599
577
  changeEditableEnabled: _propTypes["default"].bool,
600
578
  autoFocus: _propTypes["default"].bool,
601
579
  onAutoFocusUsed: _propTypes["default"].func,
602
- showCorrectness: _propTypes["default"].bool
580
+ showCorrectness: _propTypes["default"].bool,
581
+ hiddenLabelRef: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({
582
+ current: _propTypes["default"].instanceOf(Element)
583
+ })])
603
584
  });
604
- var ChartAxes = (0, _styles.withStyles)(function (theme) {
605
- return {
606
- axis: {
607
- stroke: _renderUi.color.primaryDark(),
608
- strokeWidth: 2
609
- },
610
- axisLine: {
611
- stroke: _renderUi.color.visualElementsColors.AXIS_LINE_COLOR,
612
- strokeWidth: 2
613
- },
614
- tick: {
615
- '& > line': {
616
- stroke: _renderUi.color.primaryDark(),
617
- strokeWidth: 2
618
- },
619
- fontFamily: theme.typography.body1.fontFamily,
620
- fontSize: theme.typography.fontSize,
621
- textAnchor: 'middle'
622
- },
623
- dottedLine: {
624
- stroke: _renderUi.color.primaryLight(),
625
- opacity: 0.2
626
- },
627
- error: {
628
- fontSize: theme.typography.fontSize - 2,
629
- fill: theme.palette.error.main
630
- },
631
- customColor: {
632
- color: "".concat(_renderUi.color.tertiary(), " !important")
633
- },
634
- correctnessIcon: {
635
- borderRadius: theme.spacing.unit * 2,
636
- color: _renderUi.color.defaults.WHITE,
637
- fontSize: '16px',
638
- width: '16px',
639
- height: '16px',
640
- padding: '2px',
641
- border: "1px solid ".concat(_renderUi.color.defaults.WHITE),
642
- boxSizing: 'unset' // to override the default border-box in IBX
643
-
644
- },
645
- incorrectIcon: {
646
- backgroundColor: _renderUi.color.incorrectWithIcon()
647
- },
648
- correctIcon: {
649
- backgroundColor: _renderUi.color.correct()
650
- },
651
- tickContainer: {
652
- display: 'flex',
653
- flexDirection: 'column',
654
- alignItems: 'center'
655
- }
656
- };
657
- }, {
658
- withTheme: true
659
- })(RawChartAxes);
660
- var _default = ChartAxes;
661
- exports["default"] = _default;
585
+ var _default = exports["default"] = RawChartAxes;
662
586
  //# sourceMappingURL=axes.js.map