@pie-lib/charting 5.36.2-next.0 → 5.38.0-mui-update.0

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 (77) hide show
  1. package/CHANGELOG.md +26 -15
  2. package/lib/actions-button.js +60 -90
  3. package/lib/actions-button.js.map +1 -1
  4. package/lib/axes.js +154 -234
  5. package/lib/axes.js.map +1 -1
  6. package/lib/bars/bar.js +13 -41
  7. package/lib/bars/bar.js.map +1 -1
  8. package/lib/bars/common/bars.js +55 -126
  9. package/lib/bars/common/bars.js.map +1 -1
  10. package/lib/bars/common/correct-check-icon.js +1 -6
  11. package/lib/bars/common/correct-check-icon.js.map +1 -1
  12. package/lib/bars/histogram.js +13 -41
  13. package/lib/bars/histogram.js.map +1 -1
  14. package/lib/chart-setup.js +110 -184
  15. package/lib/chart-setup.js.map +1 -1
  16. package/lib/chart-type.js +38 -43
  17. package/lib/chart-type.js.map +1 -1
  18. package/lib/chart-types.js +1 -10
  19. package/lib/chart-types.js.map +1 -1
  20. package/lib/chart.js +74 -146
  21. package/lib/chart.js.map +1 -1
  22. package/lib/common/correctness-indicators.js +74 -52
  23. package/lib/common/correctness-indicators.js.map +1 -1
  24. package/lib/common/drag-handle.js +67 -105
  25. package/lib/common/drag-handle.js.map +1 -1
  26. package/lib/common/drag-icon.js +6 -12
  27. package/lib/common/drag-icon.js.map +1 -1
  28. package/lib/common/styles.js +6 -24
  29. package/lib/common/styles.js.map +1 -1
  30. package/lib/grid.js +44 -81
  31. package/lib/grid.js.map +1 -1
  32. package/lib/index.js +0 -6
  33. package/lib/index.js.map +1 -1
  34. package/lib/key-legend.js +63 -87
  35. package/lib/key-legend.js.map +1 -1
  36. package/lib/line/common/drag-handle.js +69 -100
  37. package/lib/line/common/drag-handle.js.map +1 -1
  38. package/lib/line/common/line.js +43 -92
  39. package/lib/line/common/line.js.map +1 -1
  40. package/lib/line/line-cross.js +77 -87
  41. package/lib/line/line-cross.js.map +1 -1
  42. package/lib/line/line-dot.js +66 -78
  43. package/lib/line/line-dot.js.map +1 -1
  44. package/lib/mark-label.js +75 -117
  45. package/lib/mark-label.js.map +1 -1
  46. package/lib/plot/common/plot.js +76 -144
  47. package/lib/plot/common/plot.js.map +1 -1
  48. package/lib/plot/dot.js +31 -57
  49. package/lib/plot/dot.js.map +1 -1
  50. package/lib/plot/line.js +37 -62
  51. package/lib/plot/line.js.map +1 -1
  52. package/lib/tool-menu.js +48 -80
  53. package/lib/tool-menu.js.map +1 -1
  54. package/lib/utils.js +20 -77
  55. package/lib/utils.js.map +1 -1
  56. package/package.json +12 -9
  57. package/src/actions-button.jsx +44 -39
  58. package/src/axes.jsx +61 -75
  59. package/src/bars/common/bars.jsx +8 -23
  60. package/src/chart-setup.jsx +68 -78
  61. package/src/chart-type.js +29 -22
  62. package/src/chart.jsx +8 -20
  63. package/src/common/correctness-indicators.jsx +51 -13
  64. package/src/common/drag-handle.jsx +44 -59
  65. package/src/common/drag-icon.jsx +2 -2
  66. package/src/common/styles.js +1 -1
  67. package/src/grid.jsx +9 -13
  68. package/src/key-legend.jsx +62 -60
  69. package/src/line/common/drag-handle.jsx +57 -55
  70. package/src/line/common/line.jsx +16 -9
  71. package/src/line/line-cross.js +37 -12
  72. package/src/line/line-dot.js +30 -11
  73. package/src/mark-label.jsx +43 -44
  74. package/src/plot/common/plot.jsx +17 -22
  75. package/src/plot/dot.js +10 -3
  76. package/src/plot/line.js +14 -6
  77. package/src/tool-menu.jsx +20 -23
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
-
17
+ var _styles = require("@mui/material/styles");
32
18
  var _axis = require("@vx/axis");
33
-
34
- var _Checkbox = _interopRequireDefault(require("@material-ui/core/Checkbox"));
35
-
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));
@@ -265,8 +275,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
265
275
  interactive: interactive,
266
276
  classes: classes
267
277
  })
268
- })), error && index === 0 && /*#__PURE__*/_react["default"].createElement("text", {
269
- className: classes.error,
278
+ })), error && index === 0 && /*#__PURE__*/_react["default"].createElement(StyledErrorText, {
270
279
  y: y + 23,
271
280
  height: 6,
272
281
  textAnchor: "start"
@@ -318,8 +327,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
318
327
  pointerEvents: 'visible',
319
328
  overflow: 'visible'
320
329
  }
321
- }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
322
- className: classes.customColor,
330
+ }, /*#__PURE__*/_react["default"].createElement(StyledCheckbox, {
323
331
  style: {
324
332
  position: 'fixed'
325
333
  },
@@ -336,8 +344,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
336
344
  pointerEvents: 'visible',
337
345
  overflow: 'visible'
338
346
  }
339
- }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
340
- className: classes.customColor,
347
+ }, /*#__PURE__*/_react["default"].createElement(StyledCheckbox, {
341
348
  style: {
342
349
  position: 'fixed'
343
350
  },
@@ -363,10 +370,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
363
370
  })));
364
371
  }
365
372
  }]);
366
- return TickComponent;
367
373
  }(_react["default"].Component);
368
-
369
- exports.TickComponent = TickComponent;
370
374
  (0, _defineProperty2["default"])(TickComponent, "propTypes", {
371
375
  defineChart: _propTypes["default"].bool,
372
376
  error: _propTypes["default"].any
@@ -384,7 +388,6 @@ TickComponent.propTypes = {
384
388
  formattedValue: _propTypes["default"].string,
385
389
  onChangeCategory: _propTypes["default"].func,
386
390
  onChange: _propTypes["default"].func,
387
- classes: _propTypes["default"].object,
388
391
  error: _propTypes["default"].object,
389
392
  defineChart: _propTypes["default"].bool,
390
393
  chartingOptions: _propTypes["default"].object,
@@ -394,45 +397,36 @@ TickComponent.propTypes = {
394
397
  onAutoFocusUsed: _propTypes["default"].func,
395
398
  showCorrectness: _propTypes["default"].bool
396
399
  };
397
-
398
- var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
399
- (0, _inherits2["default"])(RawChartAxes, _React$Component2);
400
-
401
- var _super2 = _createSuper(RawChartAxes);
402
-
400
+ var RawChartAxes = exports.RawChartAxes = /*#__PURE__*/function (_React$Component2) {
403
401
  function RawChartAxes() {
404
402
  var _this3;
405
-
406
403
  (0, _classCallCheck2["default"])(this, RawChartAxes);
407
-
408
404
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
409
405
  args[_key] = arguments[_key];
410
406
  }
411
-
412
- _this3 = _super2.call.apply(_super2, [this].concat(args));
413
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "state", {
407
+ _this3 = _callSuper(this, RawChartAxes, [].concat(args));
408
+ (0, _defineProperty2["default"])(_this3, "state", {
414
409
  height: 0,
415
410
  width: 0
416
411
  });
417
412
  return _this3;
418
413
  }
419
-
420
- (0, _createClass2["default"])(RawChartAxes, [{
414
+ (0, _inherits2["default"])(RawChartAxes, _React$Component2);
415
+ return (0, _createClass2["default"])(RawChartAxes, [{
421
416
  key: "componentDidMount",
422
417
  value: function componentDidMount() {
423
418
  if (this.hiddenLabelRef) {
424
419
  var boundingClientRect = this.hiddenLabelRef.getBoundingClientRect();
425
- var hiddenEl = this.hiddenLabelRef.current; // same logic used in dropdown.jsx for hidden labels width calculation
420
+ var hiddenEl = this.hiddenLabelRef.current;
426
421
 
422
+ // same logic used in dropdown.jsx for hidden labels width calculation
427
423
  if (hiddenEl) {
428
424
  var containsLatex = hiddenEl.querySelector('[data-latex], [data-raw]');
429
425
  var hasMathJax = hiddenEl.querySelector('mjx-container');
430
426
  var mathHandled = hiddenEl.querySelector('[data-math-handled="true"]');
431
-
432
427
  if (containsLatex && (!mathHandled || !hasMathJax)) {
433
428
  (0, _mathRendering.renderMath)(this.hiddenLabelRef);
434
429
  }
435
-
436
430
  this.setState({
437
431
  height: Math.floor(boundingClientRect.height),
438
432
  width: Math.floor(boundingClientRect.width)
@@ -445,7 +439,6 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
445
439
  value: function componentDidUpdate(prevProps, prevState, snapshot) {
446
440
  if (this.hiddenLabelRef) {
447
441
  var width = Math.floor(this.hiddenLabelRef.getBoundingClientRect().width);
448
-
449
442
  if (width !== this.state.width) {
450
443
  this.setState({
451
444
  width: width
@@ -457,69 +450,59 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
457
450
  key: "render",
458
451
  value: function render() {
459
452
  var _this4 = this;
460
-
461
453
  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
-
454
+ graphProps = _this$props5.graphProps,
455
+ xBand = _this$props5.xBand,
456
+ leftAxis = _this$props5.leftAxis,
457
+ onChange = _this$props5.onChange,
458
+ onChangeCategory = _this$props5.onChangeCategory,
459
+ _this$props5$categori = _this$props5.categories,
460
+ categories = _this$props5$categori === void 0 ? [] : _this$props5$categori,
461
+ top = _this$props5.top,
462
+ defineChart = _this$props5.defineChart,
463
+ chartingOptions = _this$props5.chartingOptions,
464
+ changeInteractiveEnabled = _this$props5.changeInteractiveEnabled,
465
+ changeEditableEnabled = _this$props5.changeEditableEnabled,
466
+ theme = _this$props5.theme,
467
+ autoFocus = _this$props5.autoFocus,
468
+ onAutoFocusUsed = _this$props5.onAutoFocusUsed,
469
+ error = _this$props5.error,
470
+ showCorrectness = _this$props5.showCorrectness;
471
+ var _ref5 = graphProps || {},
472
+ _ref5$scale = _ref5.scale,
473
+ scale = _ref5$scale === void 0 ? {} : _ref5$scale,
474
+ _ref5$range = _ref5.range,
475
+ range = _ref5$range === void 0 ? {} : _ref5$range,
476
+ _ref5$domain = _ref5.domain,
477
+ domain = _ref5$domain === void 0 ? {} : _ref5$domain,
478
+ _ref5$size = _ref5.size,
479
+ size = _ref5$size === void 0 ? {} : _ref5$size;
494
480
  var _this$state = this.state,
495
- height = _this$state.height,
496
- width = _this$state.width;
481
+ height = _this$state.height,
482
+ width = _this$state.width;
497
483
  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
-
484
+ var bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();
485
+ // for chartType "line", bandWidth will be 0, so we have to calculate it
500
486
  var barWidth = bandWidth || scale.x && scale.x(domain.max) / categories.length;
501
487
  var rowTickValues = (0, _utils.getTickValues)(_objectSpread(_objectSpread({}, range), {}, {
502
488
  step: range.labelStep
503
489
  }));
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
-
490
+ var fontSize = theme && theme.typography ? theme.typography.fontSize : 14;
491
+ // this mostly applies for labels that are not editable
492
+ var rotateBecauseOfHeight = (0, _utils.getRotateAngle)(fontSize, height);
493
+ // this applies for labels that are editable
508
494
  var rotateBecauseOfWidth = width > barWidth ? 25 : 0;
509
-
510
495
  var getTickLabelProps = function getTickLabelProps(value) {
511
496
  return {
512
497
  dy: 4,
513
498
  dx: -10 - (value.toLocaleString().length || 1) * 5
514
499
  };
515
500
  };
516
-
517
501
  var getTickComponent = function getTickComponent(props) {
518
502
  var properties = {
519
503
  hiddenLabelRef: function hiddenLabelRef(ref) {
520
504
  _this4.hiddenLabelRef = ref;
521
505
  },
522
- classes: classes,
523
506
  categories: categories,
524
507
  xBand: xBand,
525
508
  bandWidth: bandWidth,
@@ -543,21 +526,15 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
543
526
  };
544
527
  return /*#__PURE__*/_react["default"].createElement(TickComponent, properties);
545
528
  };
546
-
547
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, leftAxis && /*#__PURE__*/_react["default"].createElement(_axis.AxisLeft, {
529
+ return /*#__PURE__*/_react["default"].createElement(StyledAxesGroup, null, leftAxis && /*#__PURE__*/_react["default"].createElement(_axis.AxisLeft, {
548
530
  scale: scale.y,
549
- className: axis,
550
- axisLineClassName: axisLine,
551
531
  tickLength: 10,
552
- tickClassName: tick,
553
532
  tickFormat: function tickFormat(value) {
554
533
  return value;
555
534
  },
556
535
  tickValues: rowTickValues,
557
536
  tickLabelProps: getTickLabelProps
558
537
  }), /*#__PURE__*/_react["default"].createElement(_axis.AxisBottom, {
559
- axisLineClassName: axisLine,
560
- tickClassName: tick,
561
538
  scale: bottomScale,
562
539
  labelProps: {
563
540
  y: 60 + top
@@ -577,13 +554,9 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
577
554
  }));
578
555
  }
579
556
  }]);
580
- return RawChartAxes;
581
557
  }(_react["default"].Component);
582
-
583
- exports.RawChartAxes = RawChartAxes;
584
558
  (0, _defineProperty2["default"])(RawChartAxes, "propTypes", {
585
559
  bottomScale: _propTypes["default"].func,
586
- classes: _propTypes["default"].object.isRequired,
587
560
  categories: _propTypes["default"].array,
588
561
  defineChart: _propTypes["default"].bool,
589
562
  error: _propTypes["default"].any,
@@ -601,62 +574,9 @@ exports.RawChartAxes = RawChartAxes;
601
574
  onAutoFocusUsed: _propTypes["default"].func,
602
575
  showCorrectness: _propTypes["default"].bool
603
576
  });
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;
577
+ var ChartAxes = (0, _styles.styled)(RawChartAxes)(function (_ref6) {
578
+ var theme = _ref6.theme;
579
+ return {};
580
+ });
581
+ var _default = exports["default"] = ChartAxes;
662
582
  //# sourceMappingURL=axes.js.map