@pie-lib/graphing-module 1.10.12 → 1.10.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/module/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import {_dll_prop_types, _dll_pie_lib__render_ui, _dll_material_ui__core_styles, _dll_react, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_material_ui__core, _dll_material_ui__core_styles_color_manipulator, _dll_material_ui__icons} from "../../shared-module@^1.5.42/module/index.js";
2
- import {_dll_pie_lib__editable_html} from "../../editable-html-module@^3.5.0/module/index.js";
3
- import {_dll_pie_lib__drag} from "../../drag-module@^2.0.13/module/index.js";
4
- import {_dll_pie_lib__config_ui} from "../../config-module@^2.4.0/module/index.js";
1
+ import {_dll_prop_types, _dll_pie_lib__render_ui, _dll_material_ui__core_styles, _dll_react, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_material_ui__core, _dll_material_ui__core_styles_color_manipulator, _dll_material_ui__icons} from "../../shared-module@^1.5.44/module/index.js";
2
+ import {_dll_pie_lib__editable_html} from "../../editable-html-module@^3.5.2/module/index.js";
3
+ import {_dll_pie_lib__drag} from "../../drag-module@^2.0.15/module/index.js";
4
+ import {_dll_pie_lib__config_ui} from "../../config-module@^2.4.2/module/index.js";
5
5
  const PropTypes$D = _dll_prop_types;
6
6
  const BaseDomainRangeType = {
7
7
  min: PropTypes$D.number.isRequired,
@@ -900,14 +900,14 @@ var Label$1 = withStyles$m(theme => ({
900
900
  axisLabel: {
901
901
  fontSize: theme.typography.fontSize - 2,
902
902
  textAlign: 'center',
903
- margin: '4px',
904
- padding: '4px 0'
903
+ margin: theme.spacing.unit / 2,
904
+ padding: `${theme.spacing.unit / 2}px 0`
905
905
  },
906
906
  chartLabel: {
907
907
  fontSize: theme.typography.fontSize + 2,
908
908
  textAlign: 'center',
909
- margin: '4px',
910
- padding: '4px 0'
909
+ margin: theme.spacing.unit / 2,
910
+ padding: `${theme.spacing.unit / 2}px 0`
911
911
  },
912
912
  disabledLabel: {
913
913
  pointerEvents: 'none',
@@ -1260,13 +1260,13 @@ const styles$9 = theme => ({
1260
1260
  graphTitle: {
1261
1261
  color: color$i.text(),
1262
1262
  fontSize: theme.typography.fontSize + 2,
1263
- padding: '12px 4px 0',
1263
+ padding: `${theme.spacing.unit * 1.5}px ${theme.spacing.unit / 2}px 0`,
1264
1264
  textAlign: 'center'
1265
1265
  },
1266
1266
  chartTitle: {
1267
1267
  color: color$i.text(),
1268
1268
  fontSize: theme.typography.fontSize + 4,
1269
- padding: '12px 4px 0',
1269
+ padding: `${theme.spacing.unit * 1.5}px ${theme.spacing.unit / 2}px 0`,
1270
1270
  textAlign: 'center'
1271
1271
  },
1272
1272
  disabledTitle: {
@@ -8526,11 +8526,11 @@ const PropTypes$w = _dll_prop_types;
8526
8526
  const classNames$f = _dll_classnames;
8527
8527
  const {withStyles: withStyles$k} = _dll_material_ui__core_styles;
8528
8528
  const _jsxFileName$u = "/home/circleci/repo/packages/graphing/src/axis/arrow.jsx";
8529
- const style = {
8529
+ const style = theme => ({
8530
8530
  root: {
8531
- fill: 'var(--arrow-color, black)'
8531
+ fill: `var(--arrow-color, ${theme.palette.common.black})`
8532
8532
  }
8533
- };
8533
+ });
8534
8534
  class Arrow$2 extends React$y.Component {
8535
8535
  render() {
8536
8536
  const {x, y, classes, className, scale} = this.props;
@@ -9847,21 +9847,21 @@ class Graph extends React$s.Component {
9847
9847
  __self: this,
9848
9848
  __source: {
9849
9849
  fileName: _jsxFileName$p,
9850
- lineNumber: 187
9850
+ lineNumber: 188
9851
9851
  }
9852
9852
  }, React$s.createElement('g', {
9853
9853
  transform: domain && domain.padding && domain.range ? `translate(${domain.padding}, ${range.padding})` : undefined,
9854
9854
  __self: this,
9855
9855
  __source: {
9856
9856
  fileName: _jsxFileName$p,
9857
- lineNumber: 202
9857
+ lineNumber: 203
9858
9858
  }
9859
9859
  }, React$s.createElement(Grid$1, {
9860
9860
  ...common,
9861
9861
  __self: this,
9862
9862
  __source: {
9863
9863
  fileName: _jsxFileName$p,
9864
- lineNumber: 207
9864
+ lineNumber: 208
9865
9865
  }
9866
9866
  }), React$s.createElement(Axes, {
9867
9867
  ...axesSettings,
@@ -9869,7 +9869,7 @@ class Graph extends React$s.Component {
9869
9869
  __self: this,
9870
9870
  __source: {
9871
9871
  fileName: _jsxFileName$p,
9872
- lineNumber: 208
9872
+ lineNumber: 209
9873
9873
  }
9874
9874
  }), React$s.createElement(Bg, {
9875
9875
  ...size,
@@ -9878,14 +9878,14 @@ class Graph extends React$s.Component {
9878
9878
  __self: this,
9879
9879
  __source: {
9880
9880
  fileName: _jsxFileName$p,
9881
- lineNumber: 209
9881
+ lineNumber: 210
9882
9882
  }
9883
9883
  }), React$s.createElement('mask', {
9884
9884
  id: "myMask",
9885
9885
  __self: this,
9886
9886
  __source: {
9887
9887
  fileName: _jsxFileName$p,
9888
- lineNumber: 210
9888
+ lineNumber: 211
9889
9889
  }
9890
9890
  }, React$s.createElement('rect', {
9891
9891
  ...maskSize,
@@ -9893,7 +9893,7 @@ class Graph extends React$s.Component {
9893
9893
  __self: this,
9894
9894
  __source: {
9895
9895
  fileName: _jsxFileName$p,
9896
- lineNumber: 211
9896
+ lineNumber: 212
9897
9897
  }
9898
9898
  }), " "), React$s.createElement('g', {
9899
9899
  id: "marks",
@@ -9901,7 +9901,7 @@ class Graph extends React$s.Component {
9901
9901
  __self: this,
9902
9902
  __source: {
9903
9903
  fileName: _jsxFileName$p,
9904
- lineNumber: 214
9904
+ lineNumber: 215
9905
9905
  }
9906
9906
  }, (backgroundMarks || []).map((m, index) => {
9907
9907
  const Component = this.getComponent(m);
@@ -9918,7 +9918,7 @@ class Graph extends React$s.Component {
9918
9918
  __self: this,
9919
9919
  __source: {
9920
9920
  fileName: _jsxFileName$p,
9921
- lineNumber: 220
9921
+ lineNumber: 221
9922
9922
  }
9923
9923
  });
9924
9924
  }), marks.map((m, index) => {
@@ -9939,7 +9939,7 @@ class Graph extends React$s.Component {
9939
9939
  __self: this,
9940
9940
  __source: {
9941
9941
  fileName: _jsxFileName$p,
9942
- lineNumber: 234
9942
+ lineNumber: 235
9943
9943
  }
9944
9944
  });
9945
9945
  }), React$s.createElement('foreignObject', {
@@ -11562,7 +11562,7 @@ const styles$8 = theme => ({
11562
11562
  fontFamily: theme.typography.fontFamily,
11563
11563
  fontSize: theme.typography.fontSize,
11564
11564
  borderRadius: '8px',
11565
- background: '#FFFFFF',
11565
+ background: theme.palette.common.white,
11566
11566
  color: color$c.primaryDark()
11567
11567
  },
11568
11568
  inputLabel: {
@@ -11646,12 +11646,19 @@ class RawBp extends React$n.Component {
11646
11646
  };
11647
11647
  }
11648
11648
  render() {
11649
- const {classes, className, coordinatesOnHover, x, y, disabled, correctness, graphProps, labelNode, ...rest} = this.props;
11649
+ const {classes, className, coordinatesOnHover, x, y, disabled, correctness, graphProps, labelNode, style, ...rest} = this.props;
11650
11650
  const {showCoordinates} = this.state;
11651
11651
  const {scale} = graphProps;
11652
11652
  const r = thinnerShapesNeeded(graphProps) ? 5 : 7;
11653
- return React$n.createElement('g', {
11654
- className: classNames$e(classes.point, disabled && classes.disabled, classes[correctness], className),
11653
+ return React$n.createElement(React$n.Fragment, null, React$n.createElement('circle', {
11654
+ style: {
11655
+ fill: 'transparent',
11656
+ cursor: 'pointer',
11657
+ pointerEvents: 'all'
11658
+ },
11659
+ r: r * 3,
11660
+ cx: scale.x(x),
11661
+ cy: scale.y(y),
11655
11662
  onMouseEnter: () => this.setState({
11656
11663
  showCoordinates: true
11657
11664
  }),
@@ -11662,28 +11669,31 @@ class RawBp extends React$n.Component {
11662
11669
  __self: this,
11663
11670
  __source: {
11664
11671
  fileName: _jsxFileName$n,
11665
- lineNumber: 45
11672
+ lineNumber: 47
11666
11673
  }
11667
- }, React$n.createElement('circle', {
11668
- style: {
11669
- fill: 'transparent'
11670
- },
11671
- r: r * 2,
11672
- cx: 2 * scale.x(x),
11673
- cy: 2 * scale.y(y),
11674
+ }), React$n.createElement('g', {
11675
+ className: classNames$e(classes.point, disabled && classes.disabled, classes[correctness], className),
11676
+ onMouseEnter: () => this.setState({
11677
+ showCoordinates: true
11678
+ }),
11679
+ onMouseLeave: () => this.setState({
11680
+ showCoordinates: false
11681
+ }),
11682
+ ...rest,
11674
11683
  __self: this,
11675
11684
  __source: {
11676
11685
  fileName: _jsxFileName$n,
11677
- lineNumber: 51
11686
+ lineNumber: 56
11678
11687
  }
11679
- }), React$n.createElement('circle', {
11688
+ }, React$n.createElement('circle', {
11689
+ ...rest,
11680
11690
  r: r,
11681
11691
  cx: scale.x(x),
11682
11692
  cy: scale.y(y),
11683
11693
  __self: this,
11684
11694
  __source: {
11685
11695
  fileName: _jsxFileName$n,
11686
- lineNumber: 52
11696
+ lineNumber: 62
11687
11697
  }
11688
11698
  }), labelNode && coordinatesOnHover && showCoordinates && ReactDOM$4.createPortal(React$n.createElement(CoordinatesLabel$1, {
11689
11699
  graphProps: graphProps,
@@ -11692,9 +11702,9 @@ class RawBp extends React$n.Component {
11692
11702
  __self: this,
11693
11703
  __source: {
11694
11704
  fileName: _jsxFileName$n,
11695
- lineNumber: 56
11705
+ lineNumber: 66
11696
11706
  }
11697
- }), labelNode));
11707
+ }), labelNode)));
11698
11708
  }
11699
11709
  }
11700
11710
  RawBp.__initStatic();
@@ -12231,8 +12241,8 @@ const {useState: useState} = _dll_react;
12231
12241
  const {useCallback: useCallback} = _dll_react;
12232
12242
  const {useEffect: useEffect} = _dll_react;
12233
12243
  const cn$1 = _dll_classnames;
12234
- const {withStyles: withStyles$e} = _dll_material_ui__core_styles;
12235
12244
  const PropTypes$i = _dll_prop_types;
12245
+ const {withStyles: withStyles$e} = _dll_material_ui__core_styles;
12236
12246
  const {color: color$a} = _dll_pie_lib__render_ui;
12237
12247
  const _jsxFileName$j = "/home/circleci/repo/packages/graphing/src/mark-label.jsx";
12238
12248
  const styles$6 = theme => ({
@@ -12247,11 +12257,11 @@ const styles$6 = theme => ({
12247
12257
  },
12248
12258
  disabled: {
12249
12259
  border: `solid 1px ${color$a.primaryDark()}`,
12250
- background: color$a.background()
12260
+ background: theme.palette.background.paper
12251
12261
  },
12252
12262
  disabledMark: {
12253
12263
  border: `solid 1px ${color$a.disabled()}`,
12254
- background: color$a.background(),
12264
+ background: theme.palette.background.paper,
12255
12265
  color: color$a.disabled()
12256
12266
  }
12257
12267
  });
@@ -12268,9 +12278,10 @@ const position = (graphProps, mark, rect) => {
12268
12278
  const v = bottomEdge >= scale.y(range.min) ? 'top' : 'bottom';
12269
12279
  return `${v}-${h}`;
12270
12280
  };
12271
- const coordinates = (graphProps, mark, rect, position) => {
12281
+ const coordinates = (graphProps, mark, rect, position, fontSize) => {
12272
12282
  const {scale} = graphProps;
12273
12283
  const shift = 10;
12284
+ const font = fontSize ? fontSize : 16;
12274
12285
  rect = rect || ({
12275
12286
  width: 0,
12276
12287
  height: 0
@@ -12279,29 +12290,29 @@ const coordinates = (graphProps, mark, rect, position) => {
12279
12290
  case 'bottom-right':
12280
12291
  {
12281
12292
  return {
12282
- left: scale.x(mark.x) + shift,
12283
- top: scale.y(mark.y) + shift
12293
+ left: `${(scale.x(mark.x) + shift) / font}rem`,
12294
+ top: `${(scale.y(mark.y) + shift) / font}rem`
12284
12295
  };
12285
12296
  }
12286
12297
  case 'bottom-left':
12287
12298
  {
12288
12299
  return {
12289
- left: scale.x(mark.x) - shift - rect.width,
12290
- top: scale.y(mark.y) + shift
12300
+ left: `${(scale.x(mark.x) - shift - rect.width) / font}rem`,
12301
+ top: `${(scale.y(mark.y) + shift) / font}rem`
12291
12302
  };
12292
12303
  }
12293
12304
  case 'top-left':
12294
12305
  {
12295
12306
  return {
12296
- left: scale.x(mark.x) - shift - rect.width,
12297
- top: scale.y(mark.y) - shift - rect.height
12307
+ left: `${(scale.x(mark.x) - shift - rect.width) / font}rem`,
12308
+ top: `${(scale.y(mark.y) - shift - rect.height) / font}rem`
12298
12309
  };
12299
12310
  }
12300
12311
  case 'top-right':
12301
12312
  {
12302
12313
  return {
12303
- left: scale.x(mark.x) + shift,
12304
- top: scale.y(mark.y) - shift - rect.height
12314
+ left: `${(scale.x(mark.x) + shift) / font}rem`,
12315
+ top: `${(scale.y(mark.y) - shift - rect.height) / font}rem`
12305
12316
  };
12306
12317
  }
12307
12318
  }
@@ -12309,7 +12320,7 @@ const coordinates = (graphProps, mark, rect, position) => {
12309
12320
  const MarkLabel = props => {
12310
12321
  const [input, setInput] = useState(null);
12311
12322
  const _ref = useCallback(node => setInput(node));
12312
- const {mark, graphProps, classes, disabled, inputRef: externalInputRef} = props;
12323
+ const {mark, graphProps, classes, disabled, inputRef: externalInputRef, theme} = props;
12313
12324
  const [label, setLabel] = useState(mark.label);
12314
12325
  const onChange = e => setLabel(e.target.value);
12315
12326
  const debouncedLabel = useDebounce(label, 200);
@@ -12321,14 +12332,15 @@ const MarkLabel = props => {
12321
12332
  props.onChange(debouncedLabel);
12322
12333
  }
12323
12334
  }, [debouncedLabel]);
12335
+ const fontSize = theme && theme.typography ? theme.typography.fontSize + 2 : 16;
12324
12336
  const rect = input ? input.getBoundingClientRect() : {
12325
12337
  width: 0,
12326
12338
  height: 0
12327
12339
  };
12328
12340
  const pos = position(graphProps, mark, rect);
12329
- const leftTop = coordinates(graphProps, mark, rect, pos);
12341
+ const leftTop = coordinates(graphProps, mark, rect, pos, fontSize);
12330
12342
  const style = {
12331
- position: 'absolute',
12343
+ position: 'fixed',
12332
12344
  pointerEvents: 'auto',
12333
12345
  ...leftTop
12334
12346
  };
@@ -12339,14 +12351,17 @@ const MarkLabel = props => {
12339
12351
  externalInputRef(r);
12340
12352
  },
12341
12353
  disabled: disabledInput,
12342
- inputClassName: cn$1(classes.input, disabled && classes.disabled, mark.disabled && classes.disabledMark),
12354
+ inputClassName: cn$1(classes.input, {
12355
+ [classes.disabled]: disabled,
12356
+ [classes.disabledMark]: mark.disabled
12357
+ }),
12343
12358
  value: label,
12344
12359
  style: style,
12345
12360
  onChange: onChange,
12346
12361
  __self: undefined,
12347
12362
  __source: {
12348
12363
  fileName: _jsxFileName$j,
12349
- lineNumber: 107
12364
+ lineNumber: 117
12350
12365
  }
12351
12366
  });
12352
12367
  };
@@ -12356,9 +12371,12 @@ MarkLabel.propTypes = {
12356
12371
  graphProps: GraphPropsType,
12357
12372
  classes: PropTypes$i.object,
12358
12373
  inputRef: PropTypes$i.func,
12359
- mark: PropTypes$i.object
12374
+ mark: PropTypes$i.object,
12375
+ theme: PropTypes$i.object
12360
12376
  };
12361
- var MarkLabel$1 = withStyles$e(styles$6)(MarkLabel);
12377
+ var MarkLabel$1 = withStyles$e(styles$6, {
12378
+ withTheme: true
12379
+ })(MarkLabel);
12362
12380
  const React$i = _dll_react;
12363
12381
  const ReactDOM$3 = _dll_react_dom;
12364
12382
  const {isEqual: isEqual$3} = _dll_lodash;
@@ -12473,6 +12491,14 @@ class Point extends React$i.Component {
12473
12491
  onDragStart: this.startDrag,
12474
12492
  onDragStop: this.stopDrag,
12475
12493
  onClick: this.clickPoint,
12494
+ onTouchStart: e => {
12495
+ e.stopPropagation();
12496
+ this.clickPoint();
12497
+ },
12498
+ onTouchEnd: e => {
12499
+ e.stopPropagation();
12500
+ this.clickPoint();
12501
+ },
12476
12502
  __self: this,
12477
12503
  __source: {
12478
12504
  fileName: _jsxFileName$i,
@@ -12487,7 +12513,7 @@ class Point extends React$i.Component {
12487
12513
  __self: this,
12488
12514
  __source: {
12489
12515
  fileName: _jsxFileName$i,
12490
- lineNumber: 92
12516
+ lineNumber: 94
12491
12517
  }
12492
12518
  }), labelNode));
12493
12519
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/graphing-module",
3
- "version": "1.10.12",
3
+ "version": "1.10.14",
4
4
  "mappings": {
5
5
  "@pie-lib/plot": "_dll_pie_lib__plot",
6
6
  "@pie-lib/graphing": "_dll_pie_lib__graphing",
@@ -13,7 +13,7 @@
13
13
  "version": "2.5.4"
14
14
  },
15
15
  "@pie-lib/graphing": {
16
- "version": "2.11.8"
16
+ "version": "2.11.9"
17
17
  },
18
18
  "d3-scale": {
19
19
  "version": "2.2.2"
@@ -22,24 +22,24 @@
22
22
  "version": "1.4.2"
23
23
  }
24
24
  },
25
- "hash": "922bb3325c0e6c9b14b952613220796241eae950"
25
+ "hash": "402b07a859a2f0dc231a8830c130024393cd998a"
26
26
  },
27
27
  "modules": [
28
28
  {
29
29
  "name": "@pie-lib/shared-module",
30
- "version": "^1.5.42"
30
+ "version": "^1.5.44"
31
31
  },
32
32
  {
33
33
  "name": "@pie-lib/editable-html-module",
34
- "version": "^3.5.0"
34
+ "version": "^3.5.2"
35
35
  },
36
36
  {
37
37
  "name": "@pie-lib/drag-module",
38
- "version": "^2.0.13"
38
+ "version": "^2.0.15"
39
39
  },
40
40
  {
41
41
  "name": "@pie-lib/config-module",
42
- "version": "^2.4.0"
42
+ "version": "^2.4.2"
43
43
  }
44
44
  ],
45
45
  "isLocal": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/graphing-module",
3
- "version": "1.10.12",
3
+ "version": "1.10.14",
4
4
  "module": "module/index.js",
5
5
  "repository": "pie-framework/pie-lib",
6
6
  "publishConfig": {