@pie-lib/charting 5.15.7-next.0 → 5.16.0-beta.1

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 (90) hide show
  1. package/CHANGELOG.md +35 -65
  2. package/NEXT.CHANGELOG.json +1 -0
  3. package/lib/axes.js +74 -29
  4. package/lib/axes.js.map +1 -1
  5. package/lib/bars/common/bars.js +35 -1
  6. package/lib/bars/common/bars.js.map +1 -1
  7. package/lib/chart-type.js +4 -4
  8. package/lib/chart-type.js.map +1 -1
  9. package/lib/chart-types.js +2 -2
  10. package/lib/chart-types.js.map +1 -1
  11. package/lib/chart.js +25 -10
  12. package/lib/chart.js.map +1 -1
  13. package/lib/common/drag-handle.js +11 -5
  14. package/lib/common/drag-handle.js.map +1 -1
  15. package/lib/common/drag-icon.js +7 -24
  16. package/lib/common/drag-icon.js.map +1 -1
  17. package/lib/line/common/drag-handle.js +9 -4
  18. package/lib/line/common/drag-handle.js.map +1 -1
  19. package/lib/line/line-cross.js +16 -5
  20. package/lib/line/line-cross.js.map +1 -1
  21. package/lib/line/line-dot.js +10 -2
  22. package/lib/line/line-dot.js.map +1 -1
  23. package/lib/mark-label.js +20 -11
  24. package/lib/mark-label.js.map +1 -1
  25. package/lib/plot/common/plot.js +3 -1
  26. package/lib/plot/common/plot.js.map +1 -1
  27. package/lib/plot/dot.js +1 -1
  28. package/lib/plot/dot.js.map +1 -1
  29. package/lib/plot/line.js +1 -1
  30. package/lib/plot/line.js.map +1 -1
  31. package/lib/tool-menu.js +0 -4
  32. package/lib/tool-menu.js.map +1 -1
  33. package/package.json +32 -5
  34. package/src/__tests__/__snapshots__/axes.test.jsx.snap +564 -0
  35. package/src/__tests__/__snapshots__/chart-type.test.jsx.snap +14 -0
  36. package/src/__tests__/__snapshots__/chart.test.jsx.snap +610 -0
  37. package/src/__tests__/__snapshots__/grid.test.jsx.snap +28 -0
  38. package/src/__tests__/__snapshots__/mark-label.test.jsx.snap +67 -0
  39. package/src/__tests__/axes.test.jsx +146 -0
  40. package/src/__tests__/chart-setup.test.jsx +47 -0
  41. package/src/__tests__/chart-type.test.jsx +29 -0
  42. package/src/__tests__/chart.test.jsx +87 -0
  43. package/src/__tests__/grid.test.jsx +25 -0
  44. package/src/__tests__/mark-label.test.jsx +31 -0
  45. package/src/__tests__/utils.js +30 -0
  46. package/src/__tests__/utils.test.js +100 -0
  47. package/src/axes.jsx +59 -23
  48. package/src/bars/__tests__/__snapshots__/bar.test.jsx.snap +43 -0
  49. package/src/bars/__tests__/__snapshots__/histogram.test.jsx.snap +45 -0
  50. package/src/bars/__tests__/bar.test.jsx +37 -0
  51. package/src/bars/__tests__/histogram.test.jsx +38 -0
  52. package/src/bars/__tests__/utils.js +30 -0
  53. package/src/bars/common/__tests__/__snapshots__/bars.test.jsx.snap +110 -0
  54. package/src/bars/common/__tests__/bars.test.jsx +69 -0
  55. package/src/bars/common/__tests__/utils.js +30 -0
  56. package/src/bars/common/bars.jsx +37 -1
  57. package/src/chart-type.js +7 -3
  58. package/src/chart-types.js +2 -2
  59. package/src/chart.jsx +15 -5
  60. package/src/common/__tests__/__snapshots__/drag-handle.test.jsx.snap +45 -0
  61. package/src/common/__tests__/drag-handle.test.jsx +88 -0
  62. package/src/common/__tests__/utils.js +30 -0
  63. package/src/common/drag-handle.jsx +18 -10
  64. package/src/common/drag-icon.jsx +6 -21
  65. package/src/line/__tests__/__snapshots__/line-cross.test.jsx.snap +45 -0
  66. package/src/line/__tests__/__snapshots__/line-dot.test.jsx.snap +45 -0
  67. package/src/line/__tests__/line-cross.test.jsx +38 -0
  68. package/src/line/__tests__/line-dot.test.jsx +38 -0
  69. package/src/line/__tests__/utils.js +30 -0
  70. package/src/line/common/__tests__/__snapshots__/drag-handle.test.jsx.snap +44 -0
  71. package/src/line/common/__tests__/__snapshots__/line.test.jsx.snap +141 -0
  72. package/src/line/common/__tests__/drag-handle.test.jsx +88 -0
  73. package/src/line/common/__tests__/line.test.jsx +82 -0
  74. package/src/line/common/__tests__/utils.js +30 -0
  75. package/src/line/common/drag-handle.jsx +9 -4
  76. package/src/line/line-cross.js +4 -1
  77. package/src/line/line-dot.js +17 -7
  78. package/src/mark-label.jsx +19 -7
  79. package/src/plot/__tests__/__snapshots__/dot.test.jsx.snap +45 -0
  80. package/src/plot/__tests__/__snapshots__/line.test.jsx.snap +45 -0
  81. package/src/plot/__tests__/dot.test.jsx +38 -0
  82. package/src/plot/__tests__/line.test.jsx +38 -0
  83. package/src/plot/__tests__/utils.js +30 -0
  84. package/src/plot/common/__tests__/__snapshots__/plot.test.jsx.snap +96 -0
  85. package/src/plot/common/__tests__/plot.test.jsx +70 -0
  86. package/src/plot/common/__tests__/utils.js +30 -0
  87. package/src/plot/common/plot.jsx +6 -1
  88. package/src/plot/dot.js +1 -1
  89. package/src/plot/line.js +1 -1
  90. package/src/tool-menu.jsx +0 -4
package/CHANGELOG.md CHANGED
@@ -3,136 +3,106 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [5.15.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.5...@pie-lib/charting@5.15.6) (2023-10-16)
7
-
6
+ # [5.16.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.1) (2025-07-20)
8
7
 
9
- ### Bug Fixes
8
+ **Note:** Version bump only for package @pie-lib/charting
10
9
 
11
- * **charting:** add sanity check for data PD-3223 ([f573866](https://github.com/pie-framework/pie-lib/commit/f57386626933cdb5b8b6a1c0f91b45b6ea1b9ca7))
12
- * **charting:** address overlap of drag handle with category labels in charts PD-3223 ([ebe212e](https://github.com/pie-framework/pie-lib/commit/ebe212ecd315d6445b1d676568482fa47b40ebdb))
13
- * **charting:** limit number of categories in Define Correct Response Chart to 20 ([0b0e8ab](https://github.com/pie-framework/pie-lib/commit/0b0e8ab339126e00703c1ae5218c714bbcdb6dbf))
14
- * **charting:** refine error message display to prevent overlapping with other elements and other messages PD-3121 ([f2de1ad](https://github.com/pie-framework/pie-lib/commit/f2de1adb4d19a44e403beb3d88cbb333e3c5adb9))
15
- * **charting:** use red boxes only and for all duplicated category names, reorder CSS selectors to resolve styling conflicts, only display the validation message a single time for duplicate categories and for empty labels PD-3121 ([7cae40b](https://github.com/pie-framework/pie-lib/commit/7cae40b48a1da661d7d7c97780098a07e5b1d336))
16
10
 
17
11
 
18
12
 
19
13
 
14
+ # [5.16.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.0) (2025-07-20)
20
15
 
21
- ## [5.15.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.4...@pie-lib/charting@5.15.5) (2023-09-28)
16
+ **Note:** Version bump only for package @pie-lib/charting
22
17
 
23
18
 
24
- ### Bug Fixes
25
19
 
26
- * **charting:** add drop shadow to evaluate bars PD-2790 ([328c730](https://github.com/pie-framework/pie-lib/commit/328c7308d026ca6e00575d47bdfaf1d9e4779d16))
27
20
 
28
21
 
22
+ # [5.17.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.17.0-beta.0) (2025-07-15)
29
23
 
24
+ **Note:** Version bump only for package @pie-lib/charting
30
25
 
26
+ # [5.16.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.6...@pie-lib/charting@5.16.0-beta.0) (2025-07-15)
31
27
 
32
- ## [5.15.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.3...@pie-lib/charting@5.15.4) (2023-09-28)
28
+ **Note:** Version bump only for package @pie-lib/charting
33
29
 
30
+ ## [5.15.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.5...@pie-lib/charting@5.15.6) (2023-10-16)
34
31
 
35
32
  ### Bug Fixes
36
33
 
37
- * **charting:** fix modal warnings ([34dbf3b](https://github.com/pie-framework/pie-lib/commit/34dbf3b04845773d23aa7c91a80fab57e1e78cd0))
38
- * **charting:** limit number of categories in Define Initial Chart Attributes to 20 PD-3128 ([b0da731](https://github.com/pie-framework/pie-lib/commit/b0da731a619c9d13a8b12e16a6e81dc924261396))
39
-
40
-
34
+ - **charting:** add sanity check for data PD-3223 ([f573866](https://github.com/pie-framework/pie-lib/commit/f57386626933cdb5b8b6a1c0f91b45b6ea1b9ca7))
35
+ - **charting:** address overlap of drag handle with category labels in charts PD-3223 ([ebe212e](https://github.com/pie-framework/pie-lib/commit/ebe212ecd315d6445b1d676568482fa47b40ebdb))
36
+ - **charting:** limit number of categories in Define Correct Response Chart to 20 ([0b0e8ab](https://github.com/pie-framework/pie-lib/commit/0b0e8ab339126e00703c1ae5218c714bbcdb6dbf))
37
+ - **charting:** refine error message display to prevent overlapping with other elements and other messages PD-3121 ([f2de1ad](https://github.com/pie-framework/pie-lib/commit/f2de1adb4d19a44e403beb3d88cbb333e3c5adb9))
38
+ - **charting:** use red boxes only and for all duplicated category names, reorder CSS selectors to resolve styling conflicts, only display the validation message a single time for duplicate categories and for empty labels PD-3121 ([7cae40b](https://github.com/pie-framework/pie-lib/commit/7cae40b48a1da661d7d7c97780098a07e5b1d336))
41
39
 
40
+ ## [5.15.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.4...@pie-lib/charting@5.15.5) (2023-09-28)
42
41
 
42
+ ### Bug Fixes
43
43
 
44
- ## [5.15.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.2...@pie-lib/charting@5.15.3) (2023-09-26)
44
+ - **charting:** add drop shadow to evaluate bars PD-2790 ([328c730](https://github.com/pie-framework/pie-lib/commit/328c7308d026ca6e00575d47bdfaf1d9e4779d16))
45
45
 
46
+ ## [5.15.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.3...@pie-lib/charting@5.15.4) (2023-09-28)
46
47
 
47
48
  ### Bug Fixes
48
49
 
49
- * **charting:** adjust icon for the drag handle PD-2790 ([fe670d7](https://github.com/pie-framework/pie-lib/commit/fe670d7a04f44da5c93dadbeec41b753ce50f9f6))
50
-
50
+ - **charting:** fix modal warnings ([34dbf3b](https://github.com/pie-framework/pie-lib/commit/34dbf3b04845773d23aa7c91a80fab57e1e78cd0))
51
+ - **charting:** limit number of categories in Define Initial Chart Attributes to 20 PD-3128 ([b0da731](https://github.com/pie-framework/pie-lib/commit/b0da731a619c9d13a8b12e16a6e81dc924261396))
51
52
 
53
+ ## [5.15.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.2...@pie-lib/charting@5.15.3) (2023-09-26)
52
54
 
55
+ ### Bug Fixes
53
56
 
57
+ - **charting:** adjust icon for the drag handle PD-2790 ([fe670d7](https://github.com/pie-framework/pie-lib/commit/fe670d7a04f44da5c93dadbeec41b753ce50f9f6))
54
58
 
55
59
  ## [5.15.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.1...@pie-lib/charting@5.15.2) (2023-09-25)
56
60
 
57
-
58
61
  ### Bug Fixes
59
62
 
60
- * add required packages for charting to work ([c7af164](https://github.com/pie-framework/pie-lib/commit/c7af16427245d0c0c5c041e296a1cfdf034b7b64))
61
-
62
-
63
-
64
-
63
+ - add required packages for charting to work ([c7af164](https://github.com/pie-framework/pie-lib/commit/c7af16427245d0c0c5c041e296a1cfdf034b7b64))
65
64
 
66
65
  ## [5.15.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.15.0...@pie-lib/charting@5.15.1) (2023-09-25)
67
66
 
68
-
69
67
  ### Bug Fixes
70
68
 
71
- * **charting:** add @mui/icons-material to package json PD-2790 ([0262857](https://github.com/pie-framework/pie-lib/commit/026285728f998e3fe31ec43c77e99f2311f9ad22))
72
-
73
-
74
-
75
-
69
+ - **charting:** add @mui/icons-material to package json PD-2790 ([0262857](https://github.com/pie-framework/pie-lib/commit/026285728f998e3fe31ec43c77e99f2311f9ad22))
76
70
 
77
71
  # [5.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.14.3...@pie-lib/charting@5.15.0) (2023-09-25)
78
72
 
79
-
80
73
  ### Bug Fixes
81
74
 
82
- * **charting:** set labelWidth to prevent outline from intersecting InputLabel for the ChartType menu PD-3166 ([ff9ca2b](https://github.com/pie-framework/pie-lib/commit/ff9ca2b9812d0afd209edccac2feecac396111cc))
83
-
75
+ - **charting:** set labelWidth to prevent outline from intersecting InputLabel for the ChartType menu PD-3166 ([ff9ca2b](https://github.com/pie-framework/pie-lib/commit/ff9ca2b9812d0afd209edccac2feecac396111cc))
84
76
 
85
77
  ### Features
86
78
 
87
- * **charting:** add hover effect for plot and bars PD-2790 ([af0d9ba](https://github.com/pie-framework/pie-lib/commit/af0d9bab03fa8146299bf0a1947dbe418e306f85))
88
- * **charting:** adjust y-coordinate in maskSize for better chart fitting after adding new design, tweaks in design PD-2790 ([0edf288](https://github.com/pie-framework/pie-lib/commit/0edf2880c8c8c0e0e51df080aa582d071f0f1e52))
89
- * **charting:** make style dynamic for drag icon PD-2790 ([aed8c81](https://github.com/pie-framework/pie-lib/commit/aed8c818cbc70910a7e31566c94dd731d068efa1))
90
- * **charting:** Replace drag-enabled horizontal bars with widget for author and gather mode PD-2790, refactor RawDragHandle component ([e0a369a](https://github.com/pie-framework/pie-lib/commit/e0a369ad2aaf9cf5d3aa3ac061c23316443b35fb))
91
-
92
-
93
-
94
-
79
+ - **charting:** add hover effect for plot and bars PD-2790 ([af0d9ba](https://github.com/pie-framework/pie-lib/commit/af0d9bab03fa8146299bf0a1947dbe418e306f85))
80
+ - **charting:** adjust y-coordinate in maskSize for better chart fitting after adding new design, tweaks in design PD-2790 ([0edf288](https://github.com/pie-framework/pie-lib/commit/0edf2880c8c8c0e0e51df080aa582d071f0f1e52))
81
+ - **charting:** make style dynamic for drag icon PD-2790 ([aed8c81](https://github.com/pie-framework/pie-lib/commit/aed8c818cbc70910a7e31566c94dd731d068efa1))
82
+ - **charting:** Replace drag-enabled horizontal bars with widget for author and gather mode PD-2790, refactor RawDragHandle component ([e0a369a](https://github.com/pie-framework/pie-lib/commit/e0a369ad2aaf9cf5d3aa3ac061c23316443b35fb))
95
83
 
96
84
  ## [5.14.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.14.2...@pie-lib/charting@5.14.3) (2023-09-18)
97
85
 
98
-
99
86
  ### Bug Fixes
100
87
 
101
- * **charting:** add tests for resetValues PD-3105 ([972a3cd](https://github.com/pie-framework/pie-lib/commit/972a3cd4b3787352ffe4073085cbd22f91895b43))
102
- * **charting:** wip PD-3105 ([9e21836](https://github.com/pie-framework/pie-lib/commit/9e21836ad8c89c7c839c6561db5edc0329a6a6af))
103
- * **charting:** wip PD-3105 ([f2f8234](https://github.com/pie-framework/pie-lib/commit/f2f82343a373ae1a8f669754a061963cbfdbeb08))
104
- * **charting:** wip PD-3105 revert push in develop ([6cce5e2](https://github.com/pie-framework/pie-lib/commit/6cce5e2d25d079c1c3eb195425dc2cf016fcd36e))
105
-
106
-
107
-
108
-
88
+ - **charting:** add tests for resetValues PD-3105 ([972a3cd](https://github.com/pie-framework/pie-lib/commit/972a3cd4b3787352ffe4073085cbd22f91895b43))
89
+ - **charting:** wip PD-3105 ([9e21836](https://github.com/pie-framework/pie-lib/commit/9e21836ad8c89c7c839c6561db5edc0329a6a6af))
90
+ - **charting:** wip PD-3105 ([f2f8234](https://github.com/pie-framework/pie-lib/commit/f2f82343a373ae1a8f669754a061963cbfdbeb08))
91
+ - **charting:** wip PD-3105 revert push in develop ([6cce5e2](https://github.com/pie-framework/pie-lib/commit/6cce5e2d25d079c1c3eb195425dc2cf016fcd36e))
109
92
 
110
93
  ## [5.14.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.14.1...@pie-lib/charting@5.14.2) (2023-08-07)
111
94
 
112
95
  **Note:** Version bump only for package @pie-lib/charting
113
96
 
114
-
115
-
116
-
117
-
118
97
  ## [5.14.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.14.0...@pie-lib/charting@5.14.1) (2023-06-24)
119
98
 
120
99
  **Note:** Version bump only for package @pie-lib/charting
121
100
 
122
-
123
-
124
-
125
-
126
101
  # [5.14.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.13.0...@pie-lib/charting@5.14.0) (2023-06-13)
127
102
 
128
-
129
103
  ### Features
130
104
 
131
- * **charting, translator:** add translator to charting. add missing text in translator ([2c722a2](https://github.com/pie-framework/pie-lib/commit/2c722a241deb1ad4b51aa22c6eba74a0ec8a5ec0))
132
-
133
-
134
-
135
-
105
+ - **charting, translator:** add translator to charting. add missing text in translator ([2c722a2](https://github.com/pie-framework/pie-lib/commit/2c722a241deb1ad4b51aa22c6eba74a0ec8a5ec0))
136
106
 
137
107
  # [5.13.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/charting@5.12.0...@pie-lib/charting@5.13.0) (2023-06-12)
138
108
 
@@ -0,0 +1 @@
1
+ []
package/lib/axes.js CHANGED
@@ -173,6 +173,13 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
173
173
  }
174
174
 
175
175
  (0, _createClass2["default"])(TickComponent, [{
176
+ key: "componentDidUpdate",
177
+ value: function componentDidUpdate(prevProps) {
178
+ if (this.props.autoFocus && !prevProps.autoFocus) {
179
+ this.props.onAutoFocusUsed();
180
+ }
181
+ }
182
+ }, {
176
183
  key: "render",
177
184
  value: function render() {
178
185
  var _this2 = this;
@@ -193,7 +200,9 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
193
200
  formattedValue = _this$props5.formattedValue,
194
201
  changeInteractiveEnabled = _this$props5.changeInteractiveEnabled,
195
202
  changeEditableEnabled = _this$props5.changeEditableEnabled,
196
- error = _this$props5.error;
203
+ error = _this$props5.error,
204
+ autoFocus = _this$props5.autoFocus,
205
+ hiddenLabelRef = _this$props5.hiddenLabelRef;
197
206
 
198
207
  if (!formattedValue) {
199
208
  return null;
@@ -213,9 +222,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
213
222
  editable = _ref2.editable,
214
223
  interactive = _ref2.interactive,
215
224
  label = _ref2.label,
216
- correctness = _ref2.correctness,
217
- autoFocus = _ref2.autoFocus,
218
- inDefineChart = _ref2.inDefineChart;
225
+ correctness = _ref2.correctness;
219
226
 
220
227
  var barX = xBand((0, _utils.bandKey)({
221
228
  label: label
@@ -225,7 +232,6 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
225
232
  var lengthB = b && b.label ? b.label.length : 0;
226
233
  return lengthA > lengthB ? a : b;
227
234
  });
228
- var longestLabel = longestCategory && longestCategory.label || '';
229
235
  var distinctMessages = error ? (0, _toConsumableArray2["default"])(new Set(Object.values(error))).join(' ') : '';
230
236
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("foreignObject", {
231
237
  x: bandWidth ? barX : x - barWidth / 2,
@@ -236,18 +242,15 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
236
242
  pointerEvents: 'none',
237
243
  overflow: 'visible'
238
244
  }
239
- }, index === 0 && /*#__PURE__*/_react["default"].createElement("div", {
240
- id: "hiddenLabel",
241
- style: {
242
- position: 'absolute',
243
- visibility: 'hidden',
244
- wordBreak: 'break-word',
245
- overflow: 'visible',
246
- maxWidth: barWidth,
247
- display: 'block'
248
- }
249
- }, longestLabel), /*#__PURE__*/_react["default"].createElement(_markLabel["default"], {
250
- autoFocus: inDefineChart ? defineChart && autoFocus : autoFocus,
245
+ }, index === 0 && /*#__PURE__*/_react["default"].createElement(_markLabel["default"], {
246
+ isHiddenLabel: true,
247
+ inputRef: hiddenLabelRef,
248
+ disabled: true,
249
+ mark: longestCategory,
250
+ graphProps: graphProps,
251
+ barWidth: barWidth
252
+ }), /*#__PURE__*/_react["default"].createElement(_markLabel["default"], {
253
+ autoFocus: defineChart && autoFocus,
251
254
  inputRef: function inputRef(r) {
252
255
  return _this2.input = r;
253
256
  },
@@ -334,6 +337,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
334
337
  overflow: 'visible'
335
338
  }
336
339
  }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
340
+ className: classes.customColor,
337
341
  style: {
338
342
  position: 'fixed'
339
343
  },
@@ -351,6 +355,7 @@ var TickComponent = /*#__PURE__*/function (_React$Component) {
351
355
  overflow: 'visible'
352
356
  }
353
357
  }, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
358
+ className: classes.customColor,
354
359
  style: {
355
360
  position: 'fixed'
356
361
  },
@@ -402,7 +407,9 @@ TickComponent.propTypes = {
402
407
  defineChart: _propTypes["default"].bool,
403
408
  chartingOptions: _propTypes["default"].object,
404
409
  changeInteractiveEnabled: _propTypes["default"].bool,
405
- changeEditableEnabled: _propTypes["default"].bool
410
+ changeEditableEnabled: _propTypes["default"].bool,
411
+ autoFocus: _propTypes["default"].bool,
412
+ onAutoFocusUsed: _propTypes["default"].func
406
413
  };
407
414
 
408
415
  var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
@@ -421,7 +428,8 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
421
428
 
422
429
  _this3 = _super2.call.apply(_super2, [this].concat(args));
423
430
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this3), "state", {
424
- height: 0
431
+ height: 0,
432
+ width: 0
425
433
  });
426
434
  return _this3;
427
435
  }
@@ -429,14 +437,32 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
429
437
  (0, _createClass2["default"])(RawChartAxes, [{
430
438
  key: "componentDidMount",
431
439
  value: function componentDidMount() {
432
- var height = document.getElementById('hiddenLabel') ? document.getElementById('hiddenLabel').offsetHeight : 0;
433
- this.setState({
434
- height: height
435
- });
440
+ if (this.hiddenLabelRef) {
441
+ var boundingClientRect = this.hiddenLabelRef.getBoundingClientRect();
442
+ this.setState({
443
+ height: Math.floor(boundingClientRect.height),
444
+ width: Math.floor(boundingClientRect.width)
445
+ });
446
+ }
447
+ }
448
+ }, {
449
+ key: "componentDidUpdate",
450
+ value: function componentDidUpdate(prevProps, prevState, snapshot) {
451
+ if (this.hiddenLabelRef) {
452
+ var width = Math.floor(this.hiddenLabelRef.getBoundingClientRect().width);
453
+
454
+ if (width !== this.state.width) {
455
+ this.setState({
456
+ width: width
457
+ });
458
+ }
459
+ }
436
460
  }
437
461
  }, {
438
462
  key: "render",
439
463
  value: function render() {
464
+ var _this4 = this;
465
+
440
466
  var _this$props6 = this.props,
441
467
  classes = _this$props6.classes,
442
468
  graphProps = _this$props6.graphProps,
@@ -452,6 +478,8 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
452
478
  changeInteractiveEnabled = _this$props6.changeInteractiveEnabled,
453
479
  changeEditableEnabled = _this$props6.changeEditableEnabled,
454
480
  theme = _this$props6.theme,
481
+ autoFocus = _this$props6.autoFocus,
482
+ onAutoFocusUsed = _this$props6.onAutoFocusUsed,
455
483
  error = _this$props6.error;
456
484
  var axis = classes.axis,
457
485
  axisLine = classes.axisLine,
@@ -467,7 +495,9 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
467
495
  _ref3$size = _ref3.size,
468
496
  size = _ref3$size === void 0 ? {} : _ref3$size;
469
497
 
470
- var height = this.state.height;
498
+ var _this$state = this.state,
499
+ height = _this$state.height,
500
+ width = _this$state.width;
471
501
  var bottomScale = xBand && typeof xBand.rangeRound === 'function' && xBand.rangeRound([0, size.width]);
472
502
  var bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth(); // for chartType "line", bandWidth will be 0, so we have to calculate it
473
503
 
@@ -475,8 +505,11 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
475
505
  var rowTickValues = (0, _utils.getTickValues)(_objectSpread(_objectSpread({}, range), {}, {
476
506
  step: range.labelStep
477
507
  }));
478
- var fontSize = theme && theme.typography ? theme.typography.fontSize : 14;
479
- var rotate = (0, _utils.getRotateAngle)(fontSize, height);
508
+ var fontSize = theme && theme.typography ? theme.typography.fontSize : 14; // this mostly applies for labels that are not editable
509
+
510
+ var rotateBecauseOfHeight = (0, _utils.getRotateAngle)(fontSize, height); // this applies for labels that are editable
511
+
512
+ var rotateBecauseOfWidth = width > barWidth ? 25 : 0;
480
513
 
481
514
  var getTickLabelProps = function getTickLabelProps(value) {
482
515
  return {
@@ -487,15 +520,20 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
487
520
 
488
521
  var getTickComponent = function getTickComponent(props) {
489
522
  var properties = {
523
+ hiddenLabelRef: function hiddenLabelRef(ref) {
524
+ _this4.hiddenLabelRef = ref;
525
+ },
490
526
  classes: classes,
491
527
  categories: categories,
492
528
  xBand: xBand,
493
529
  bandWidth: bandWidth,
494
530
  barWidth: barWidth,
495
- rotate: rotate,
531
+ rotate: rotateBecauseOfHeight || rotateBecauseOfWidth,
496
532
  top: top,
497
533
  defineChart: defineChart,
498
534
  chartingOptions: chartingOptions,
535
+ autoFocus: autoFocus,
536
+ onAutoFocusUsed: onAutoFocusUsed,
499
537
  error: error,
500
538
  onChangeCategory: onChangeCategory,
501
539
  changeInteractiveEnabled: changeInteractiveEnabled,
@@ -536,7 +574,9 @@ var RawChartAxes = /*#__PURE__*/function (_React$Component2) {
536
574
  tickFormat: function tickFormat(count) {
537
575
  return count;
538
576
  },
539
- tickComponent: getTickComponent
577
+ tickComponent: getTickComponent,
578
+ autoFocus: autoFocus,
579
+ onAutoFocusUsed: onAutoFocusUsed
540
580
  }));
541
581
  }
542
582
  }]);
@@ -559,7 +599,9 @@ exports.RawChartAxes = RawChartAxes;
559
599
  theme: _propTypes["default"].object,
560
600
  chartingOptions: _propTypes["default"].object,
561
601
  changeInteractiveEnabled: _propTypes["default"].bool,
562
- changeEditableEnabled: _propTypes["default"].bool
602
+ changeEditableEnabled: _propTypes["default"].bool,
603
+ autoFocus: _propTypes["default"].bool,
604
+ onAutoFocusUsed: _propTypes["default"].func
563
605
  });
564
606
  var ChartAxes = (0, _styles.withStyles)(function (theme) {
565
607
  return {
@@ -588,6 +630,9 @@ var ChartAxes = (0, _styles.withStyles)(function (theme) {
588
630
  error: {
589
631
  fontSize: theme.typography.fontSize - 2,
590
632
  fill: theme.palette.error.main
633
+ },
634
+ customColor: {
635
+ color: "".concat(_renderUi.color.tertiary(), " !important")
591
636
  }
592
637
  };
593
638
  }, {
package/lib/axes.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/axes.jsx"],"names":["TickComponent","props","open","callback","setState","dialog","index","newLabel","categories","onChangeCategory","category","label","onChange","slice","value","title","text","onConfirm","handleAlertDialog","interactive","onClose","editable","maxChar","chunks","length","indexToSplit","lastIndexOf","push","substring","trim","state","classes","xBand","bandWidth","barWidth","rotate","top","graphProps","defineChart","chartingOptions","x","y","formattedValue","changeInteractiveEnabled","changeEditableEnabled","error","changeEditable","changeInteractive","parseInt","split","deletable","correctness","autoFocus","inDefineChart","barX","longestCategory","reduce","a","b","lengthA","lengthB","longestLabel","distinctMessages","Set","Object","values","join","pointerEvents","overflow","position","visibility","wordBreak","maxWidth","display","r","input","changeCategory","dottedLine","deleteCategory","splitText","authoringLabel","map","word","e","target","checked","React","Component","PropTypes","bool","any","propTypes","array","func","number","object","string","RawChartAxes","height","document","getElementById","offsetHeight","leftAxis","theme","axis","axisLine","tick","scale","range","domain","size","bottomScale","rangeRound","width","bandwidth","max","rowTickValues","step","labelStep","fontSize","typography","getTickLabelProps","dy","dx","toLocaleString","getTickComponent","properties","min","textAnchor","count","isRequired","types","GraphPropsType","ChartAxes","stroke","color","primaryDark","strokeWidth","fill","fontFamily","body1","primaryLight","opacity","palette","main","withTheme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,a;;;;;AAMX,yBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,0GASC,UAACC,IAAD,EAAOC,QAAP;AAAA,aAClB,MAAKC,QAAL,CACE;AACEC,QAAAA,MAAM,EAAE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AAEnC,KAAK,CAACwC,OAAN,CAAclG,KAAd,CAAoBmG;AAFrB;AAvBG,GAAZ;AAAA,CADgB,EA6BhB;AAAEC,EAAAA,SAAS,EAAE;AAAb,CA7BgB,EA8BhBhD,YA9BgB,CAAlB;eAgCeoC,S","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport { AxisLeft, AxisBottom } from '@vx/axis';\nimport { bandKey, getTickValues, getRotateAngle } from './utils';\nimport MarkLabel from './mark-label';\nimport Checkbox from '@material-ui/core/Checkbox';\n\nexport class TickComponent extends React.Component {\n static propTypes = {\n defineChart: PropTypes.bool,\n error: PropTypes.any,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n dialog: {\n open: false,\n },\n };\n }\n\n handleAlertDialog = (open, callback) =>\n this.setState(\n {\n dialog: { open },\n },\n callback,\n );\n\n changeCategory = (index, newLabel) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n onChangeCategory(index, { ...category, label: newLabel });\n };\n\n deleteCategory = (index) => {\n const { categories, onChange } = this.props;\n\n if (index >= 0 && categories[index]) {\n onChange([...categories.slice(0, index), ...categories.slice(index + 1)]);\n }\n };\n\n changeInteractive = (index, value) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n if (!value) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: 'This will remove the correct answer value that has been defined for this category.',\n onConfirm: () =>\n this.handleAlertDialog(false, onChangeCategory(index, { ...category, interactive: !category.interactive })),\n onClose: () => this.handleAlertDialog(false),\n },\n });\n } else {\n onChangeCategory(index, { ...category, interactive: !category.interactive });\n }\n };\n\n changeEditable = (index, value) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n if (!value) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: 'This will remove the correct answer category name that has been defined for this category.',\n onConfirm: () =>\n this.handleAlertDialog(\n false,\n onChangeCategory(index, { ...category, editable: !category.editable || false }),\n ),\n onClose: () => this.handleAlertDialog(false),\n },\n });\n } else {\n onChangeCategory(index, { ...category, editable: !category.editable || false });\n }\n };\n\n splitText = (text, maxChar) => {\n let chunks = [];\n while ((text || '').length > 0) {\n let indexToSplit;\n if (text.length > maxChar) {\n indexToSplit = text.lastIndexOf(' ', maxChar);\n if (indexToSplit === -1) {\n indexToSplit = maxChar;\n }\n } else {\n indexToSplit = text.length;\n }\n chunks.push(text.substring(0, indexToSplit));\n text = text.substring(indexToSplit).trim();\n }\n return chunks;\n };\n\n render() {\n const {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n graphProps,\n defineChart,\n chartingOptions,\n x,\n y,\n formattedValue,\n changeInteractiveEnabled,\n changeEditableEnabled,\n error,\n } = this.props;\n\n if (!formattedValue) {\n return null;\n }\n\n const { dialog } = this.state;\n const { changeEditable, changeInteractive } = chartingOptions || {};\n const index = parseInt(formattedValue.split('-')[0], 10);\n const category = categories[index];\n const { deletable, editable, interactive, label, correctness, autoFocus, inDefineChart } = category || {};\n const barX = xBand(bandKey({ label }, index));\n const longestCategory = (categories || []).reduce((a, b) => {\n const lengthA = a && a.label ? a.label.length : 0;\n const lengthB = b && b.label ? b.label.length : 0;\n\n return lengthA > lengthB ? a : b;\n });\n\n const longestLabel = (longestCategory && longestCategory.label) || '';\n const distinctMessages = error ? [...new Set(Object.values(error))].join(' ') : '';\n\n return (\n <g>\n <foreignObject\n x={bandWidth ? barX : x - barWidth / 2}\n y={6}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'none', overflow: 'visible' }}\n >\n {index === 0 && (\n <div\n id=\"hiddenLabel\"\n style={{\n position: 'absolute',\n visibility: 'hidden',\n wordBreak: 'break-word',\n overflow: 'visible',\n maxWidth: barWidth,\n display: 'block',\n }}\n >\n {longestLabel}\n </div>\n )}\n\n <MarkLabel\n autoFocus={inDefineChart ? defineChart && autoFocus : autoFocus}\n inputRef={(r) => (this.input = r)}\n disabled={!defineChart && !editable}\n mark={category}\n graphProps={graphProps}\n onChange={(newLabel) => this.changeCategory(index, newLabel)}\n barWidth={barWidth}\n rotate={rotate}\n correctness={correctness}\n error={error && error[index]}\n />\n </foreignObject>\n\n {error && index === 0 && (\n <text className={classes.error} y={y + 23} height={6} textAnchor=\"start\">\n {distinctMessages}\n </text>\n )}\n\n {deletable && !correctness && (\n <line x1={x} y1={0} x2={x} y2={y + 4 + top} className={classes.dottedLine} strokeDasharray=\"4 2\" />\n )}\n\n {deletable && !correctness && (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n x={x - 8}\n y={y + 60 + top}\n width={16}\n height={16}\n viewBox=\"0 0 512 512\"\n onClick={() => this.deleteCategory(index)}\n >\n <path d=\"M128 405.429C128 428.846 147.198 448 170.667 448h170.667C364.802 448 384 428.846 384 405.429V160H128v245.429zM416 96h-80l-26.785-32H202.786L176 96H96v32h320V96z\" />\n </svg>\n )}\n\n {defineChart && index === 0 && (\n <svg\n x={-55}\n style={{\n overflow: 'visible',\n }}\n >\n {changeInteractiveEnabled && (\n <text\n y={y + 90 + top}\n width={barWidth}\n height={4}\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n wordBreak: 'break-word',\n maxWidth: barWidth,\n display: 'inline-block',\n }}\n >\n {this.splitText(changeInteractive?.authoringLabel, 20).map((word, index) => (\n <tspan key={index} x=\"0\" dy={`${index > 0 ? '1.2em' : '.6em'}`}>\n {word}\n </tspan>\n ))}\n </text>\n )}\n\n {changeEditableEnabled && (\n <text\n y={y + 145 + top}\n width={barWidth}\n height={4}\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n wordBreak: 'break-word',\n maxWidth: barWidth,\n display: 'inline-block',\n }}\n >\n {this.splitText(changeEditable?.authoringLabel, 20).map((word, index) => (\n <tspan key={index} x=\"0\" dy={`${index > 0 ? '1.2em' : '.6em'}`}>\n {word}\n </tspan>\n ))}\n </text>\n )}\n </svg>\n )}\n\n {defineChart && changeInteractiveEnabled && (\n <foreignObject\n x={x - 24}\n y={y + 80 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <Checkbox\n style={{ position: 'fixed' }}\n checked={interactive}\n onChange={(e) => this.changeInteractive(index, e.target.checked)}\n />\n </foreignObject>\n )}\n\n {defineChart && changeEditableEnabled && (\n <foreignObject\n x={x - 24}\n y={y + 130 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <Checkbox\n style={{ position: 'fixed' }}\n checked={editable}\n onChange={(e) => this.changeEditable(index, e.target.checked)}\n />\n </foreignObject>\n )}\n\n <foreignObject\n x={x - 24}\n y={y + 100 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <AlertDialog\n open={dialog.open}\n title={dialog.title}\n text={dialog.text}\n onClose={dialog.onClose}\n onConfirm={dialog.onConfirm}\n />\n </foreignObject>\n </g>\n );\n }\n}\n\nTickComponent.propTypes = {\n categories: PropTypes.array,\n xBand: PropTypes.func,\n bandWidth: PropTypes.number,\n barWidth: PropTypes.number,\n rotate: PropTypes.number,\n top: PropTypes.number,\n x: PropTypes.number,\n y: PropTypes.number,\n graphProps: PropTypes.object,\n formattedValue: PropTypes.string,\n onChangeCategory: PropTypes.func,\n onChange: PropTypes.func,\n classes: PropTypes.object,\n error: PropTypes.object,\n defineChart: PropTypes.bool,\n chartingOptions: PropTypes.object,\n changeInteractiveEnabled: PropTypes.bool,\n changeEditableEnabled: PropTypes.bool,\n};\n\nexport class RawChartAxes extends React.Component {\n static propTypes = {\n bottomScale: PropTypes.func,\n classes: PropTypes.object.isRequired,\n categories: PropTypes.array,\n defineChart: PropTypes.bool,\n error: PropTypes.any,\n graphProps: types.GraphPropsType.isRequired,\n xBand: PropTypes.func,\n leftAxis: PropTypes.bool,\n onChange: PropTypes.func,\n onChangeCategory: PropTypes.func,\n top: PropTypes.number,\n theme: PropTypes.object,\n chartingOptions: PropTypes.object,\n changeInteractiveEnabled: PropTypes.bool,\n changeEditableEnabled: PropTypes.bool,\n };\n\n state = { height: 0 };\n\n componentDidMount() {\n const height = document.getElementById('hiddenLabel') ? document.getElementById('hiddenLabel').offsetHeight : 0;\n\n this.setState({ height });\n }\n\n render() {\n const {\n classes,\n graphProps,\n xBand,\n leftAxis,\n onChange,\n onChangeCategory,\n categories = [],\n top,\n defineChart,\n chartingOptions,\n changeInteractiveEnabled,\n changeEditableEnabled,\n theme,\n error,\n } = this.props;\n\n const { axis, axisLine, tick } = classes;\n const { scale = {}, range = {}, domain = {}, size = {} } = graphProps || {};\n const { height } = this.state;\n\n const bottomScale = xBand && typeof xBand.rangeRound === 'function' && xBand.rangeRound([0, size.width]);\n\n const bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();\n // for chartType \"line\", bandWidth will be 0, so we have to calculate it\n const barWidth = bandWidth || (scale.x && scale.x(domain.max) / categories.length);\n\n const rowTickValues = getTickValues({ ...range, step: range.labelStep });\n const fontSize = theme && theme.typography ? theme.typography.fontSize : 14;\n const rotate = getRotateAngle(fontSize, height);\n\n const getTickLabelProps = (value) => ({\n dy: 4,\n dx: -10 - (value.toLocaleString().length || 1) * 5,\n });\n\n const getTickComponent = (props) => {\n const properties = {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n defineChart,\n chartingOptions,\n error,\n onChangeCategory,\n changeInteractiveEnabled,\n changeEditableEnabled,\n onChange,\n graphProps,\n x: props.x,\n y: props.y,\n formattedValue: props.formattedValue,\n };\n\n return <TickComponent {...properties} />;\n };\n\n return (\n <React.Fragment>\n {leftAxis && (\n <AxisLeft\n scale={scale.y}\n className={axis}\n axisLineClassName={axisLine}\n tickLength={10}\n tickClassName={tick}\n tickFormat={(value) => value}\n tickValues={rowTickValues}\n tickLabelProps={getTickLabelProps}\n />\n )}\n <AxisBottom\n axisLineClassName={axisLine}\n tickClassName={tick}\n scale={bottomScale}\n labelProps={{ y: 60 + top }}\n top={scale.y && scale.y(range.min)}\n textLabelProps={() => ({ textAnchor: 'middle' })}\n tickFormat={(count) => count}\n tickComponent={getTickComponent}\n />\n </React.Fragment>\n );\n }\n}\n\nconst ChartAxes = withStyles(\n (theme) => ({\n axis: {\n stroke: color.primaryDark(),\n strokeWidth: 2,\n },\n axisLine: {\n stroke: color.primaryDark(),\n strokeWidth: 2,\n },\n tick: {\n '& > line': {\n stroke: color.primaryDark(),\n strokeWidth: 2,\n },\n fill: color.primaryDark(),\n fontFamily: theme.typography.body1.fontFamily,\n fontSize: theme.typography.fontSize,\n textAnchor: 'middle',\n },\n dottedLine: {\n stroke: color.primaryLight(),\n opacity: 0.2,\n },\n error: {\n fontSize: theme.typography.fontSize - 2,\n fill: theme.palette.error.main,\n },\n }),\n { withTheme: true },\n)(RawChartAxes);\n\nexport default ChartAxes;\n"],"file":"axes.js"}
1
+ {"version":3,"sources":["../src/axes.jsx"],"names":["TickComponent","props","open","callback","setState","dialog","index","newLabel","categories","onChangeCategory","category","label","onChange","slice","value","title","text","onConfirm","handleAlertDialog","interactive","onClose","editable","maxChar","chunks","length","indexToSplit","lastIndexOf","push","substring","trim","state","prevProps","autoFocus","onAutoFocusUsed","classes","xBand","bandWidth","barWidth","rotate","top","graphProps","defineChart","chartingOptions","x","y","formattedValue","changeInteractiveEnabled","changeEditableEnabled","error","hiddenLabelRef","changeEditable","changeInteractive","parseInt","split","deletable","correctness","barX","longestCategory","reduce","a","b","lengthA","lengthB","distinctMessages","Set","Object","values","join","pointerEvents","overflow","r","input","changeCategory","dottedLine","deleteCategory","position","wordBreak","maxWidth","display","splitText","authoringLabel","map","word","customColor","e","target","checked","React","Component","PropTypes","bool","any","propTypes","array","func","number","object","string","RawChartAxes","height","width","boundingClientRect","getBoundingClientRect","Math","floor","prevState","snapshot","leftAxis","theme","axis","axisLine","tick","scale","range","domain","size","bottomScale","rangeRound","bandwidth","max","rowTickValues","step","labelStep","fontSize","typography","rotateBecauseOfHeight","rotateBecauseOfWidth","getTickLabelProps","dy","dx","toLocaleString","getTickComponent","properties","ref","min","textAnchor","count","isRequired","types","GraphPropsType","ChartAxes","stroke","color","primaryDark","strokeWidth","fill","fontFamily","body1","primaryLight","opacity","palette","main","tertiary","withTheme"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEaA,a;;;;;AAMX,yBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AACjB,8BAAMA,KAAN;AADiB,0GAeC,UAACC,IAAD,EAAOC,QAAP;AAAA,aAClB,MAAKC,QAAL,CACE;AACEC,QAAAA,MAAM,EAAE;AAAEH,UAAAA,IAAI,EAAJA;AAAF;AADV,OADF,EAIEC,QAJF,CADkB;AAAA,KAfD;AAAA,uGAuBF,UAACG,KAAD,EAAQC,QAAR,EAAqB;AACpC,wBAAyC,MAAKN,KAA9C;AAAA,UAAQO,UAAR,eAAQA,UAAR;AAAA,UAAoBC,gBAApB,eAAoBA,gBAApB;AACA,UAAMC,QAAQ,GAAGF,UAAU,CAACF,KAAD,CAA3B;AAEAG,MAAAA,gBAAgB,CAACH,KAAD,kCAAaI,QAAb;AAAuBC,QAAAA,KAAK,EAAEJ;AAA9B,SAAhB;AACD,KA5BkB;AAAA,uGA8BF,UAACD,KAAD,EAAW;AAC1B,yBAAiC,MAAKL,KAAtC;AAAA,UAAQO,UAAR,gBAAQA,UAAR;AAAA,UAAoBI,QAApB,gBAAoBA,QAApB;;AAEA,UAAIN,KAAK,IAAI,CAAT,IAAcE,UAAU,CAACF,KAAD,CAA5B,EAAqC;AACnCM,QAAAA,QAAQ,+CAAKJ,UAAU,CAACK,KAAX,CAAiB,CAAjB,EAAoBP,KAApB,CAAL,uCAAoCE,UAAU,CAACK,KAAX,CAAiBP,KAAK,GAAG,CAAzB,CAApC,GAAR;AACD;AACF,KAp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AN,EADE;AAEVC,QAAAA,WAAW,EAAE;AAFH,OADR;AAKJC,MAAAA,IAAI,EAAEH,gBAAMC,WAAN,EALF;AAMJG,MAAAA,UAAU,EAAEtC,KAAK,CAACgB,UAAN,CAAiBuB,KAAjB,CAAuBD,UAN/B;AAOJvB,MAAAA,QAAQ,EAAEf,KAAK,CAACgB,UAAN,CAAiBD,QAPvB;AAQJY,MAAAA,UAAU,EAAE;AARR,KATI;AAmBV9D,IAAAA,UAAU,EAAE;AACVoE,MAAAA,MAAM,EAAEC,gBAAMM,YAAN,EADE;AAEVC,MAAAA,OAAO,EAAE;AAFC,KAnBF;AAuBVrG,IAAAA,KAAK,EAAE;AACL2E,MAAAA,QAAQ,EAAEf,KAAK,CAACgB,UAAN,CAAiBD,QAAjB,GAA4B,CADjC;AAELsB,MAAAA,IAAI,EAAErC,KAAK,CAAC0C,OAAN,CAActG,KAAd,CAAoBuG;AAFrB,KAvBG;AA2BVpE,IAAAA,WAAW,EAAE;AACX2D,MAAAA,KAAK,YAAKA,gBAAMU,QAAN,EAAL;AADM;AA3BH,GAAZ;AAAA,CADgB,EAgChB;AAAEC,EAAAA,SAAS,EAAE;AAAb,CAhCgB,EAiChBvD,YAjCgB,CAAlB;eAmCe0C,S","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport { AlertDialog } from '@pie-lib/config-ui';\nimport { AxisLeft, AxisBottom } from '@vx/axis';\nimport { bandKey, getTickValues, getRotateAngle } from './utils';\nimport MarkLabel from './mark-label';\nimport Checkbox from '@material-ui/core/Checkbox';\n\nexport class TickComponent extends React.Component {\n static propTypes = {\n defineChart: PropTypes.bool,\n error: PropTypes.any,\n };\n\n constructor(props) {\n super(props);\n this.state = {\n dialog: {\n open: false,\n },\n };\n }\n\n componentDidUpdate(prevProps) {\n if (this.props.autoFocus && !prevProps.autoFocus) {\n this.props.onAutoFocusUsed();\n }\n }\n\n handleAlertDialog = (open, callback) =>\n this.setState(\n {\n dialog: { open },\n },\n callback,\n );\n\n changeCategory = (index, newLabel) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n onChangeCategory(index, { ...category, label: newLabel });\n };\n\n deleteCategory = (index) => {\n const { categories, onChange } = this.props;\n\n if (index >= 0 && categories[index]) {\n onChange([...categories.slice(0, index), ...categories.slice(index + 1)]);\n }\n };\n\n changeInteractive = (index, value) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n if (!value) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: 'This will remove the correct answer value that has been defined for this category.',\n onConfirm: () =>\n this.handleAlertDialog(false, onChangeCategory(index, { ...category, interactive: !category.interactive })),\n onClose: () => this.handleAlertDialog(false),\n },\n });\n } else {\n onChangeCategory(index, { ...category, interactive: !category.interactive });\n }\n };\n\n changeEditable = (index, value) => {\n const { categories, onChangeCategory } = this.props;\n const category = categories[index];\n\n if (!value) {\n this.setState({\n dialog: {\n open: true,\n title: 'Warning',\n text: 'This will remove the correct answer category name that has been defined for this category.',\n onConfirm: () =>\n this.handleAlertDialog(\n false,\n onChangeCategory(index, { ...category, editable: !category.editable || false }),\n ),\n onClose: () => this.handleAlertDialog(false),\n },\n });\n } else {\n onChangeCategory(index, { ...category, editable: !category.editable || false });\n }\n };\n\n splitText = (text, maxChar) => {\n let chunks = [];\n while ((text || '').length > 0) {\n let indexToSplit;\n if (text.length > maxChar) {\n indexToSplit = text.lastIndexOf(' ', maxChar);\n if (indexToSplit === -1) {\n indexToSplit = maxChar;\n }\n } else {\n indexToSplit = text.length;\n }\n chunks.push(text.substring(0, indexToSplit));\n text = text.substring(indexToSplit).trim();\n }\n return chunks;\n };\n\n render() {\n const {\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate,\n top,\n graphProps,\n defineChart,\n chartingOptions,\n x,\n y,\n formattedValue,\n changeInteractiveEnabled,\n changeEditableEnabled,\n error,\n autoFocus,\n hiddenLabelRef,\n } = this.props;\n\n if (!formattedValue) {\n return null;\n }\n\n const { dialog } = this.state;\n const { changeEditable, changeInteractive } = chartingOptions || {};\n const index = parseInt(formattedValue.split('-')[0], 10);\n const category = categories[index];\n const { deletable, editable, interactive, label, correctness } = category || {};\n const barX = xBand(bandKey({ label }, index));\n const longestCategory = (categories || []).reduce((a, b) => {\n const lengthA = a && a.label ? a.label.length : 0;\n const lengthB = b && b.label ? b.label.length : 0;\n\n return lengthA > lengthB ? a : b;\n });\n const distinctMessages = error ? [...new Set(Object.values(error))].join(' ') : '';\n\n return (\n <g>\n <foreignObject\n x={bandWidth ? barX : x - barWidth / 2}\n y={6}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'none', overflow: 'visible' }}\n >\n {index === 0 && (\n <MarkLabel\n isHiddenLabel={true}\n inputRef={hiddenLabelRef}\n disabled={true}\n mark={longestCategory}\n graphProps={graphProps}\n barWidth={barWidth}\n />\n )}\n\n <MarkLabel\n autoFocus={defineChart && autoFocus}\n inputRef={(r) => (this.input = r)}\n disabled={!defineChart && !editable}\n mark={category}\n graphProps={graphProps}\n onChange={(newLabel) => this.changeCategory(index, newLabel)}\n barWidth={barWidth}\n rotate={rotate}\n correctness={correctness}\n error={error && error[index]}\n />\n </foreignObject>\n\n {error && index === 0 && (\n <text className={classes.error} y={y + 23} height={6} textAnchor=\"start\">\n {distinctMessages}\n </text>\n )}\n\n {deletable && !correctness && (\n <line x1={x} y1={0} x2={x} y2={y + 4 + top} className={classes.dottedLine} strokeDasharray=\"4 2\" />\n )}\n\n {deletable && !correctness && (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n x={x - 8}\n y={y + 60 + top}\n width={16}\n height={16}\n viewBox=\"0 0 512 512\"\n onClick={() => this.deleteCategory(index)}\n >\n <path d=\"M128 405.429C128 428.846 147.198 448 170.667 448h170.667C364.802 448 384 428.846 384 405.429V160H128v245.429zM416 96h-80l-26.785-32H202.786L176 96H96v32h320V96z\" />\n </svg>\n )}\n\n {defineChart && index === 0 && (\n <svg\n x={-55}\n style={{\n overflow: 'visible',\n }}\n >\n {changeInteractiveEnabled && (\n <text\n y={y + 90 + top}\n width={barWidth}\n height={4}\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n wordBreak: 'break-word',\n maxWidth: barWidth,\n display: 'inline-block',\n }}\n >\n {this.splitText(changeInteractive?.authoringLabel, 20).map((word, index) => (\n <tspan key={index} x=\"0\" dy={`${index > 0 ? '1.2em' : '.6em'}`}>\n {word}\n </tspan>\n ))}\n </text>\n )}\n\n {changeEditableEnabled && (\n <text\n y={y + 145 + top}\n width={barWidth}\n height={4}\n style={{\n position: 'absolute',\n pointerEvents: 'none',\n wordBreak: 'break-word',\n maxWidth: barWidth,\n display: 'inline-block',\n }}\n >\n {this.splitText(changeEditable?.authoringLabel, 20).map((word, index) => (\n <tspan key={index} x=\"0\" dy={`${index > 0 ? '1.2em' : '.6em'}`}>\n {word}\n </tspan>\n ))}\n </text>\n )}\n </svg>\n )}\n\n {defineChart && changeInteractiveEnabled && (\n <foreignObject\n x={x - 24}\n y={y + 80 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <Checkbox\n className={classes.customColor}\n style={{ position: 'fixed' }}\n checked={interactive}\n onChange={(e) => this.changeInteractive(index, e.target.checked)}\n />\n </foreignObject>\n )}\n\n {defineChart && changeEditableEnabled && (\n <foreignObject\n x={x - 24}\n y={y + 130 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <Checkbox\n className={classes.customColor}\n style={{ position: 'fixed' }}\n checked={editable}\n onChange={(e) => this.changeEditable(index, e.target.checked)}\n />\n </foreignObject>\n )}\n\n <foreignObject\n x={x - 24}\n y={y + 100 + top}\n width={barWidth}\n height={4}\n style={{ pointerEvents: 'visible', overflow: 'visible' }}\n >\n <AlertDialog\n open={dialog.open}\n title={dialog.title}\n text={dialog.text}\n onClose={dialog.onClose}\n onConfirm={dialog.onConfirm}\n />\n </foreignObject>\n </g>\n );\n }\n}\n\nTickComponent.propTypes = {\n categories: PropTypes.array,\n xBand: PropTypes.func,\n bandWidth: PropTypes.number,\n barWidth: PropTypes.number,\n rotate: PropTypes.number,\n top: PropTypes.number,\n x: PropTypes.number,\n y: PropTypes.number,\n graphProps: PropTypes.object,\n formattedValue: PropTypes.string,\n onChangeCategory: PropTypes.func,\n onChange: PropTypes.func,\n classes: PropTypes.object,\n error: PropTypes.object,\n defineChart: PropTypes.bool,\n chartingOptions: PropTypes.object,\n changeInteractiveEnabled: PropTypes.bool,\n changeEditableEnabled: PropTypes.bool,\n autoFocus: PropTypes.bool,\n onAutoFocusUsed: PropTypes.func,\n};\n\nexport class RawChartAxes extends React.Component {\n static propTypes = {\n bottomScale: PropTypes.func,\n classes: PropTypes.object.isRequired,\n categories: PropTypes.array,\n defineChart: PropTypes.bool,\n error: PropTypes.any,\n graphProps: types.GraphPropsType.isRequired,\n xBand: PropTypes.func,\n leftAxis: PropTypes.bool,\n onChange: PropTypes.func,\n onChangeCategory: PropTypes.func,\n top: PropTypes.number,\n theme: PropTypes.object,\n chartingOptions: PropTypes.object,\n changeInteractiveEnabled: PropTypes.bool,\n changeEditableEnabled: PropTypes.bool,\n autoFocus: PropTypes.bool,\n onAutoFocusUsed: PropTypes.func,\n };\n\n state = { height: 0, width: 0 };\n\n componentDidMount() {\n if (this.hiddenLabelRef) {\n const boundingClientRect = this.hiddenLabelRef.getBoundingClientRect();\n this.setState({\n height: Math.floor(boundingClientRect.height),\n width: Math.floor(boundingClientRect.width),\n });\n }\n }\n\n componentDidUpdate(prevProps, prevState, snapshot) {\n if (this.hiddenLabelRef) {\n const width = Math.floor(this.hiddenLabelRef.getBoundingClientRect().width);\n\n if (width !== this.state.width) {\n this.setState({ width });\n }\n }\n }\n\n render() {\n const {\n classes,\n graphProps,\n xBand,\n leftAxis,\n onChange,\n onChangeCategory,\n categories = [],\n top,\n defineChart,\n chartingOptions,\n changeInteractiveEnabled,\n changeEditableEnabled,\n theme,\n autoFocus,\n onAutoFocusUsed,\n error,\n } = this.props;\n\n const { axis, axisLine, tick } = classes;\n const { scale = {}, range = {}, domain = {}, size = {} } = graphProps || {};\n const { height, width } = this.state;\n\n const bottomScale = xBand && typeof xBand.rangeRound === 'function' && xBand.rangeRound([0, size.width]);\n\n const bandWidth = xBand && typeof xBand.bandwidth === 'function' && xBand.bandwidth();\n // for chartType \"line\", bandWidth will be 0, so we have to calculate it\n const barWidth = bandWidth || (scale.x && scale.x(domain.max) / categories.length);\n\n const rowTickValues = getTickValues({ ...range, step: range.labelStep });\n const fontSize = theme && theme.typography ? theme.typography.fontSize : 14;\n // this mostly applies for labels that are not editable\n const rotateBecauseOfHeight = getRotateAngle(fontSize, height);\n // this applies for labels that are editable\n const rotateBecauseOfWidth = width > barWidth ? 25 : 0;\n\n const getTickLabelProps = (value) => ({\n dy: 4,\n dx: -10 - (value.toLocaleString().length || 1) * 5,\n });\n\n const getTickComponent = (props) => {\n const properties = {\n hiddenLabelRef: (ref) => {\n this.hiddenLabelRef = ref;\n },\n classes,\n categories,\n xBand,\n bandWidth,\n barWidth,\n rotate: rotateBecauseOfHeight || rotateBecauseOfWidth,\n top,\n defineChart,\n chartingOptions,\n autoFocus,\n onAutoFocusUsed,\n error,\n onChangeCategory,\n changeInteractiveEnabled,\n changeEditableEnabled,\n onChange,\n graphProps,\n x: props.x,\n y: props.y,\n formattedValue: props.formattedValue,\n };\n\n return <TickComponent {...properties} />;\n };\n\n return (\n <React.Fragment>\n {leftAxis && (\n <AxisLeft\n scale={scale.y}\n className={axis}\n axisLineClassName={axisLine}\n tickLength={10}\n tickClassName={tick}\n tickFormat={(value) => value}\n tickValues={rowTickValues}\n tickLabelProps={getTickLabelProps}\n />\n )}\n <AxisBottom\n axisLineClassName={axisLine}\n tickClassName={tick}\n scale={bottomScale}\n labelProps={{ y: 60 + top }}\n top={scale.y && scale.y(range.min)}\n textLabelProps={() => ({ textAnchor: 'middle' })}\n tickFormat={(count) => count}\n tickComponent={getTickComponent}\n autoFocus={autoFocus}\n onAutoFocusUsed={onAutoFocusUsed}\n />\n </React.Fragment>\n );\n }\n}\n\nconst ChartAxes = withStyles(\n (theme) => ({\n axis: {\n stroke: color.primaryDark(),\n strokeWidth: 2,\n },\n axisLine: {\n stroke: color.primaryDark(),\n strokeWidth: 2,\n },\n tick: {\n '& > line': {\n stroke: color.primaryDark(),\n strokeWidth: 2,\n },\n fill: color.primaryDark(),\n fontFamily: theme.typography.body1.fontFamily,\n fontSize: theme.typography.fontSize,\n textAnchor: 'middle',\n },\n dottedLine: {\n stroke: color.primaryLight(),\n opacity: 0.2,\n },\n error: {\n fontSize: theme.typography.fontSize - 2,\n fill: theme.palette.error.main,\n },\n customColor: {\n color: `${color.tertiary()} !important`,\n },\n }),\n { withTheme: true },\n)(RawChartAxes);\n\nexport default ChartAxes;\n"],"file":"axes.js"}
@@ -77,6 +77,23 @@ var RawBar = /*#__PURE__*/function (_React$Component) {
77
77
 
78
78
  (0, _classCallCheck2["default"])(this, RawBar);
79
79
  _this = _super.call(this, props);
80
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMouseMove", function (e) {
81
+ // Update mouse position
82
+ _this.mouseX = e.clientX;
83
+ _this.mouseY = e.clientY; // Check if the mouse is inside the <g> element
84
+
85
+ var isMouseInside = _this.isMouseInsideSvgElement();
86
+
87
+ _this.setState({
88
+ isHovered: isMouseInside
89
+ });
90
+ });
91
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "isMouseInsideSvgElement", function () {
92
+ var gBoundingBox = _this.gRef.getBoundingClientRect(); // Check if the mouse position is within the bounding box
93
+
94
+
95
+ return _this.mouseX >= gBoundingBox.left && _this.mouseX <= gBoundingBox.right && _this.mouseY >= gBoundingBox.top && _this.mouseY <= gBoundingBox.bottom;
96
+ });
80
97
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMouseEnter", function () {
81
98
  _this.setState({
82
99
  isHovered: true
@@ -117,10 +134,22 @@ var RawBar = /*#__PURE__*/function (_React$Component) {
117
134
  dragValue: undefined,
118
135
  isHovered: false
119
136
  };
137
+ _this.mouseX = 0;
138
+ _this.mouseY = 0;
120
139
  return _this;
121
140
  }
122
141
 
123
142
  (0, _createClass2["default"])(RawBar, [{
143
+ key: "componentDidMount",
144
+ value: function componentDidMount() {
145
+ window.addEventListener('mousemove', this.handleMouseMove);
146
+ }
147
+ }, {
148
+ key: "componentWillUnmount",
149
+ value: function componentWillUnmount() {
150
+ window.removeEventListener('mousemove', this.handleMouseMove);
151
+ }
152
+ }, {
124
153
  key: "render",
125
154
  value: function render() {
126
155
  var _this2 = this;
@@ -153,8 +182,13 @@ var RawBar = /*#__PURE__*/function (_React$Component) {
153
182
  log('label:', label, 'barX:', barX, 'v: ', v, 'barHeight:', barHeight, 'barWidth: ', barWidth);
154
183
  var Component = interactive ? _dragHandle["default"] : _dragHandle.DragHandle;
155
184
  return /*#__PURE__*/_react["default"].createElement("g", {
185
+ ref: function ref(_ref) {
186
+ return _this2.gRef = _ref;
187
+ },
156
188
  onMouseEnter: this.handleMouseEnter,
157
- onMouseLeave: this.handleMouseLeave
189
+ onMouseLeave: this.handleMouseLeave,
190
+ onTouchStart: this.handleMouseEnter,
191
+ onTouchEnd: this.handleMouseLeave
158
192
  }, /*#__PURE__*/_react["default"].createElement(_shape.Bar, {
159
193
  x: barX,
160
194
  y: scale.y(yy),