@pie-lib/charting 4.5.13 → 4.5.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/lib/grid.js CHANGED
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -21,35 +23,37 @@ var _renderUi = require("@pie-lib/render-ui");
21
23
 
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
25
 
24
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
25
-
26
26
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
27
 
28
28
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
29
29
 
30
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
30
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
31
 
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
32
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
33
 
34
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
34
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
35
 
36
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
36
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
37
37
 
38
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
38
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
39
39
 
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
40
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
+
42
+ 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; } }
43
+
44
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
41
45
 
42
46
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
43
47
 
44
- var Grid =
45
- /*#__PURE__*/
46
- function (_React$Component) {
48
+ var Grid = /*#__PURE__*/function (_React$Component) {
47
49
  _inherits(Grid, _React$Component);
48
50
 
51
+ var _super = _createSuper(Grid);
52
+
49
53
  function Grid() {
50
54
  _classCallCheck(this, Grid);
51
55
 
52
- return _possibleConstructorReturn(this, _getPrototypeOf(Grid).apply(this, arguments));
56
+ return _super.apply(this, arguments);
53
57
  }
54
58
 
55
59
  _createClass(Grid, [{
@@ -69,7 +73,7 @@ function (_React$Component) {
69
73
  _ref$size = _ref.size,
70
74
  size = _ref$size === void 0 ? {} : _ref$size;
71
75
 
72
- return _react["default"].createElement(_grid.Grid, {
76
+ return /*#__PURE__*/_react["default"].createElement(_grid.Grid, {
73
77
  xScale: xBand,
74
78
  yScale: scale.y,
75
79
  className: (0, _classnames["default"])(classes.grid, className),
package/lib/grid.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/grid.jsx"],"names":["Grid","props","classes","className","graphProps","xBand","rowTickValues","columnTickValues","scale","size","y","grid","width","height","bandwidth","React","Component","PropTypes","object","isRequired","string","types","GraphPropsType","func","array","styles","stroke","color","primaryLight"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;A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Bd,IAAAA,IAAI,EAAE;AACJe,MAAAA,MAAM,EAAEC,gBAAMC,YAAN;AADJ;AADc,GAAP;AAAA,CAAf;;eAMe,wBAAWH,MAAX,EAAmBzB,IAAnB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nimport { Grid as VxGrid } from '@vx/grid';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\n\nexport class Grid extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n graphProps: types.GraphPropsType.isRequired,\n xBand: PropTypes.func,\n columnTickValues: PropTypes.array,\n rowTickValues: PropTypes.array\n };\n\n static defaultProps = {};\n\n render() {\n const { classes, className, graphProps, xBand, rowTickValues, columnTickValues } = this.props;\n const { scale = {}, size = {} } = graphProps || {};\n\n return (\n <VxGrid\n xScale={xBand}\n yScale={scale.y}\n className={classNames(classes.grid, className)}\n width={size.width}\n height={size.height}\n xOffset={xBand.bandwidth() / 2}\n rowTickValues={rowTickValues}\n columnTickValues={columnTickValues}\n />\n );\n }\n}\n\nconst styles = () => ({\n grid: {\n stroke: color.primaryLight()\n }\n});\n\nexport default withStyles(styles)(Grid);\n"],"file":"grid.js"}
1
+ {"version":3,"sources":["../src/grid.jsx"],"names":["Grid","props","classes","className","graphProps","xBand","rowTickValues","columnTickValues","scale","size","y","grid","width","height","bandwidth","React","Component","PropTypes","object","isRequired","string","types","GraphPropsType","func","array","styles","stroke","color","primaryLight"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;IAEaA,I;;;;;;;;;;;;;WAYX,kBAAS;AACP,wBAAmF,KAAKC,KAAxF;AAAA,UAAQC,OAAR,eAAQA,OAAR;AAAA,UAAiBC,SAAjB,eAAiBA,SAAjB;AAAA,UAA4BC,UAA5B,eAA4BA,UAA5B;AAAA,UAAwCC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-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nimport { Grid as VxGrid } from '@vx/grid';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\n\nexport class Grid extends React.Component {\n static propTypes = {\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n graphProps: types.GraphPropsType.isRequired,\n xBand: PropTypes.func,\n columnTickValues: PropTypes.array,\n rowTickValues: PropTypes.array\n };\n\n static defaultProps = {};\n\n render() {\n const { classes, className, graphProps, xBand, rowTickValues, columnTickValues } = this.props;\n const { scale = {}, size = {} } = graphProps || {};\n\n return (\n <VxGrid\n xScale={xBand}\n yScale={scale.y}\n className={classNames(classes.grid, className)}\n width={size.width}\n height={size.height}\n xOffset={xBand.bandwidth() / 2}\n rowTickValues={rowTickValues}\n columnTickValues={columnTickValues}\n />\n );\n }\n}\n\nconst styles = () => ({\n grid: {\n stroke: color.primaryLight()\n }\n});\n\nexport default withStyles(styles)(Grid);\n"],"file":"grid.js"}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -19,9 +21,9 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
19
21
 
20
22
  var _styles = require("../../common/styles");
21
23
 
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
24
+ var _excluded = ["x", "y", "graphProps", "classes", "className", "interactive", "CustomDraggableComponent", "correctness"];
23
25
 
24
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
27
 
26
28
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
27
29
 
@@ -33,29 +35,33 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
33
35
 
34
36
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
35
37
 
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
38
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
37
39
 
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
40
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
41
 
40
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
42
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
43
 
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
44
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
43
45
 
44
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
46
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
45
47
 
46
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
48
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
+
50
+ 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; } }
51
+
52
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
47
53
 
48
54
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
49
55
 
50
- var RawDragHandle =
51
- /*#__PURE__*/
52
- function (_React$Component) {
56
+ var RawDragHandle = /*#__PURE__*/function (_React$Component) {
53
57
  _inherits(RawDragHandle, _React$Component);
54
58
 
59
+ var _super = _createSuper(RawDragHandle);
60
+
55
61
  function RawDragHandle() {
56
62
  _classCallCheck(this, RawDragHandle);
57
63
 
58
- return _possibleConstructorReturn(this, _getPrototypeOf(RawDragHandle).apply(this, arguments));
64
+ return _super.apply(this, arguments);
59
65
  }
60
66
 
61
67
  _createClass(RawDragHandle, [{
@@ -70,10 +76,10 @@ function (_React$Component) {
70
76
  interactive = _this$props.interactive,
71
77
  CustomDraggableComponent = _this$props.CustomDraggableComponent,
72
78
  correctness = _this$props.correctness,
73
- rest = _objectWithoutProperties(_this$props, ["x", "y", "graphProps", "classes", "className", "interactive", "CustomDraggableComponent", "correctness"]);
79
+ rest = _objectWithoutProperties(_this$props, _excluded);
74
80
 
75
81
  var scale = graphProps.scale;
76
- return _react["default"].createElement(CustomDraggableComponent, _extends({
82
+ return /*#__PURE__*/_react["default"].createElement(CustomDraggableComponent, _extends({
77
83
  scale: scale,
78
84
  x: x,
79
85
  y: y,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/common/drag-handle.jsx"],"names":["RawDragHandle","props","x","y","graphProps","classes","className","interactive","CustomDraggableComponent","correctness","rest","scale","React","Component","PropTypes","number","isRequired","width","types","GraphPropsType","object","string","bool","func","shape","value","label","DragHandle","theme","handle","fill","color","secondary","transition","secondaryDark","line","stroke","DraggableHandle","axis","fromDelta","delta","newPoint","utils","point","add","bounds","domain","range","area","left","top","bottom","right","anchorPoint"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEMA,a;;;;;;;;;;;;;6BAgBK;AAAA,wBAWH,KAAKC,KAXF;AAAA,UAELC,CAFK,eAELA,CAFK;AAAA,UAGLC,CAHK,eAGLA,CA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EAAE;AAAjD,KAAb;AACA,WAAOV,YAAMG,MAAN,CAAaG,IAAb,EAAmBF,MAAnB,EAA2BC,KAA3B,CAAP;AACD,GAXmC;AAYpCM,EAAAA,WAAW,EAAE,qBAAApD,KAAK,EAAI;AACpB,WAAO;AAAEC,MAAAA,CAAC,EAAED,KAAK,CAACC,CAAX;AAAcC,MAAAA,CAAC,EAAEF,KAAK,CAACE;AAAvB,KAAP;AACD;AAdmC,CAAd,EAerBwB,UAfqB,CAAxB;eAiBeU,e","sourcesContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { gridDraggable, utils, types } from '@pie-lib/plot';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport { color } from '@pie-lib/render-ui';\nimport PropTypes from 'prop-types';\nimport { correct, incorrect, disabled } from '../../common/styles';\n\nclass RawDragHandle extends React.Component {\n static propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n width: PropTypes.number,\n graphProps: types.GraphPropsType.isRequired,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n interactive: PropTypes.bool,\n CustomDraggableComponent: PropTypes.func,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n };\n\n render() {\n const {\n x,\n y,\n graphProps,\n classes,\n className,\n interactive,\n CustomDraggableComponent,\n correctness,\n ...rest\n } = this.props;\n const { scale } = graphProps;\n return (\n <CustomDraggableComponent\n scale={scale}\n x={x}\n y={y}\n classes={classes}\n className={classNames(className, !interactive && 'non-interactive')}\n correctness={interactive && correctness}\n {...rest}\n />\n );\n }\n}\n\nexport const DragHandle = withStyles(theme => ({\n handle: {\n fill: color.secondary(),\n transition: 'fill 200ms linear, height 200ms linear',\n '&:hover': {\n fill: color.secondaryDark()\n },\n '&.correct': correct('fill'),\n '&.incorrect': incorrect('fill'),\n '&.non-interactive': disabled('fill')\n },\n line: {\n stroke: color.secondary(),\n transition: 'fill 200ms linear, height 200ms linear',\n '&:hover': {\n stroke: color.secondaryDark()\n },\n '&.non-interactive': disabled('stroke'),\n '&.correct': correct('stroke'),\n '&.incorrect': incorrect('stroke')\n }\n}))(RawDragHandle);\n\nconst DraggableHandle = gridDraggable({\n axis: 'y',\n fromDelta: (props, delta) => {\n //TODO: should be in grid-draggable, if axis is y delta.x should always be 0.\n delta.x = 0;\n const newPoint = utils.point(props).add(utils.point(delta));\n return newPoint.y;\n },\n bounds: (props, { domain, range }) => {\n const area = { left: 0, top: props.y, bottom: props.y, right: 0 };\n return utils.bounds(area, domain, range);\n },\n anchorPoint: props => {\n return { x: props.x, y: props.y };\n }\n})(DragHandle);\n\nexport default DraggableHandle;\n"],"file":"drag-handle.js"}
1
+ {"version":3,"sources":["../../../src/line/common/drag-handle.jsx"],"names":["RawDragHandle","props","x","y","graphProps","classes","className","interactive","CustomDraggableComponent","correctness","rest","scale","React","Component","PropTypes","number","isRequired","width","types","GraphPropsType","object","string","bool","func","shape","value","label","DragHandle","theme","handle","fill","color","secondary","transition","secondaryDark","line","stroke","DraggableHandle","axis","fromDelta","delta","newPoint","utils","point","add","bounds","domain","range","area","left","top","bottom","right","anchorPoint"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEMA,a;;;;;;;;;;;;;WAgBJ,kBAAS;AACP,wBAUI,KAAKC,KAVT;AAAA,UACEC,CADF,eACEA,CADF;AAAA,UAEEC,CAFF,eAEEA,CAFF;AAAA,UAGEC,UAHF,eAGEA,UAHF;AAAA,UAIEC,OAJF,eAIEA,OAJF;AAAA,UAKEC,SALF,eAKEA,SALF;AAAA,UAMEC,WANF,eAMEA,WANF;AAAA,UAOEC,wBAPF,eAOEA,wBAPF;AAAA,UAQEC,WARF,eAQEA,WARF;AAAA,UASKC,IATL;;AAWA,UAAQC,KAAR,GAAkBP,UAAlB,CAAQO,KAAR;AACA,0BACE,gCAAC,wBAAD;AACE,QAAA,KAAK,EAAEA,KADT;AAEE,QAAA,C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esContent":["import React from 'react';\nimport classNames from 'classnames';\nimport { gridDraggable, utils, types } from '@pie-lib/plot';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport { color } from '@pie-lib/render-ui';\nimport PropTypes from 'prop-types';\nimport { correct, incorrect, disabled } from '../../common/styles';\n\nclass RawDragHandle extends React.Component {\n static propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n width: PropTypes.number,\n graphProps: types.GraphPropsType.isRequired,\n classes: PropTypes.object.isRequired,\n className: PropTypes.string,\n interactive: PropTypes.bool,\n CustomDraggableComponent: PropTypes.func,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n };\n\n render() {\n const {\n x,\n y,\n graphProps,\n classes,\n className,\n interactive,\n CustomDraggableComponent,\n correctness,\n ...rest\n } = this.props;\n const { scale } = graphProps;\n return (\n <CustomDraggableComponent\n scale={scale}\n x={x}\n y={y}\n classes={classes}\n className={classNames(className, !interactive && 'non-interactive')}\n correctness={interactive && correctness}\n {...rest}\n />\n );\n }\n}\n\nexport const DragHandle = withStyles(theme => ({\n handle: {\n fill: color.secondary(),\n transition: 'fill 200ms linear, height 200ms linear',\n '&:hover': {\n fill: color.secondaryDark()\n },\n '&.correct': correct('fill'),\n '&.incorrect': incorrect('fill'),\n '&.non-interactive': disabled('fill')\n },\n line: {\n stroke: color.secondary(),\n transition: 'fill 200ms linear, height 200ms linear',\n '&:hover': {\n stroke: color.secondaryDark()\n },\n '&.non-interactive': disabled('stroke'),\n '&.correct': correct('stroke'),\n '&.incorrect': incorrect('stroke')\n }\n}))(RawDragHandle);\n\nconst DraggableHandle = gridDraggable({\n axis: 'y',\n fromDelta: (props, delta) => {\n //TODO: should be in grid-draggable, if axis is y delta.x should always be 0.\n delta.x = 0;\n const newPoint = utils.point(props).add(utils.point(delta));\n return newPoint.y;\n },\n bounds: (props, { domain, range }) => {\n const area = { left: 0, top: props.y, bottom: props.y, right: 0 };\n return utils.bounds(area, domain, range);\n },\n anchorPoint: props => {\n return { x: props.x, y: props.y };\n }\n})(DragHandle);\n\nexport default DraggableHandle;\n"],"file":"drag-handle.js"}
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports["default"] = exports.Line = exports.RawLine = void 0;
8
+ exports["default"] = exports.RawLine = exports.Line = void 0;
7
9
 
8
10
  var _react = _interopRequireDefault(require("react"));
9
11
 
@@ -23,41 +25,49 @@ var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
23
25
 
24
26
  var _renderUi = require("@pie-lib/render-ui");
25
27
 
26
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
28
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
29
 
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
30
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
31
 
30
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
31
33
 
32
34
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
33
35
 
34
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
36
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
37
+
38
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
39
 
36
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
40
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
41
 
38
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
42
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
39
43
 
40
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
44
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
45
+
46
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
41
47
 
42
48
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43
49
 
44
50
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
45
51
 
46
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
52
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
47
53
 
48
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
54
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
49
55
 
50
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
56
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
57
+
58
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
59
+
60
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
51
61
 
52
62
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
53
63
 
54
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
64
+ 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; } }
55
65
 
56
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
66
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
57
67
 
58
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
68
+ 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; }
59
69
 
60
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
70
+ 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) { _defineProperty(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; }
61
71
 
62
72
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
63
73
 
@@ -72,24 +82,24 @@ var getData = function getData(data, domain) {
72
82
  }
73
83
 
74
84
  return data.map(function (el, i) {
75
- return _objectSpread({}, el, {
85
+ return _objectSpread(_objectSpread({}, el), {}, {
76
86
  x: length > 1 ? i * (max / (length - 1)) : 0.5,
77
87
  y: el.value
78
88
  });
79
89
  });
80
90
  };
81
91
 
82
- var RawLine =
83
- /*#__PURE__*/
84
- function (_React$Component) {
92
+ var RawLine = /*#__PURE__*/function (_React$Component) {
85
93
  _inherits(RawLine, _React$Component);
86
94
 
95
+ var _super = _createSuper(RawLine);
96
+
87
97
  function RawLine(props) {
88
98
  var _this;
89
99
 
90
100
  _classCallCheck(this, RawLine);
91
101
 
92
- _this = _possibleConstructorReturn(this, _getPrototypeOf(RawLine).call(this, props));
102
+ _this = _super.call(this, props);
93
103
 
94
104
  _defineProperty(_assertThisInitialized(_this), "setDragValue", function (line) {
95
105
  return _this.setState({
@@ -146,7 +156,7 @@ function (_React$Component) {
146
156
  dragging = _this$state.dragging;
147
157
  var scale = graphProps.scale;
148
158
  var lineToUse = dragging ? lineState : getData(data, graphProps.domain);
149
- return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(_shape.LinePath, {
159
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_shape.LinePath, {
150
160
  data: lineToUse,
151
161
  x: function x(d) {
152
162
  return scale.x(d.x);
@@ -158,7 +168,7 @@ function (_React$Component) {
158
168
  }), lineToUse && lineToUse.map(function (point, i) {
159
169
  var r = 6;
160
170
  var Component = point.interactive ? _dragHandle["default"] : _dragHandle.DragHandle;
161
- return _react["default"].createElement(Component, {
171
+ return /*#__PURE__*/_react["default"].createElement(Component, {
162
172
  key: "point-".concat(point.x, "-").concat(i),
163
173
  x: point.x,
164
174
  y: point.dragValue !== undefined ? point.dragValue : point.y,
@@ -222,14 +232,12 @@ var StyledLine = (0, _index.withStyles)(function (theme) {
222
232
  };
223
233
  })(RawLine);
224
234
 
225
- var Line =
226
- /*#__PURE__*/
227
- function (_React$Component2) {
235
+ var Line = /*#__PURE__*/function (_React$Component2) {
228
236
  _inherits(Line, _React$Component2);
229
237
 
230
- function Line() {
231
- var _getPrototypeOf2;
238
+ var _super2 = _createSuper(Line);
232
239
 
240
+ function Line() {
233
241
  var _this3;
234
242
 
235
243
  _classCallCheck(this, Line);
@@ -238,7 +246,7 @@ function (_React$Component2) {
238
246
  args[_key] = arguments[_key];
239
247
  }
240
248
 
241
- _this3 = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(Line)).call.apply(_getPrototypeOf2, [this].concat(args)));
249
+ _this3 = _super2.call.apply(_super2, [this].concat(args));
242
250
 
243
251
  _defineProperty(_assertThisInitialized(_this3), "changeLine", function (index, category) {
244
252
  var onChange = _this3.props.onChange;
@@ -258,7 +266,7 @@ function (_React$Component2) {
258
266
  key: "render",
259
267
  value: function render() {
260
268
  var props = this.props;
261
- return _react["default"].createElement(_group.Group, null, _react["default"].createElement(StyledLine, _extends({}, props, {
269
+ return /*#__PURE__*/_react["default"].createElement(_group.Group, null, /*#__PURE__*/_react["default"].createElement(StyledLine, _extends({}, props, {
262
270
  onChange: this.changeLine
263
271
  })));
264
272
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/line/common/line.jsx"],"names":["getData","data","domain","max","length","map","el","i","x","y","value","RawLine","props","line","setState","index","onChange","dragging","state","existing","next","newLine","dragValue","setDragValue","undefined","graphProps","nextProps","classes","CustomDraggableComponent","lineState","scale","lineToUse","d","point","r","Component","interactive","DraggableHandle","DragHandle","v","dragStop","correctness","React","PropTypes","func","number","object","label","string","xBand","isRequired","types","GraphPropsType","arrayOf","shape","StyledLine","theme","fill","stroke","color","primaryLight","strokeWidth","transition","primaryDark","Line","category","changeLine","array"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,MAAP,EAAkB;AAAA,aAChBA,MAAM,IAAI,EADM;AAAA,MACxBC,GADwB,QACxBA,GADw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,KAAD,CAAP,CAAeL,KAAf,GAAuBY,SAAS,IAAI,CAAb,GAAiBA,SAAjB,GAA6BZ,KAApD;AAEAM,MAAAA,QAAQ,CAACK,OAAD,CAAR;AACD,K;;;;;;;6BAEQ;AACP,UAAMT,KAAK,GAAG,KAAKA,KAAnB;AAEA,aACE,gCAAC,YAAD,QACE,gCAAC,UAAD,eAAgBA,KAAhB;AAAuB,QAAA,QAAQ,EAAE,KAAKsD;AAAtC,SADF,CADF;AAKD;;;;EA1BuBxB,kBAAMP,S;;;;gBAAnB6B,I,eACQ;AACjB/D,EAAAA,IAAI,EAAE0C,sBAAUwB,KADC;AAEjBnD,EAAAA,QAAQ,EAAE2B,sBAAUC,IAFH;AAGjBK,EAAAA,KAAK,EAAEN,sBAAUC,IAHA;AAIjBnB,EAAAA,UAAU,EAAE0B,YAAMC,cAAN,CAAqBF;AAJhB,C;;eA4BNc,I","sourcesContent":["import React from 'react';\nimport { Group } from '@vx/group';\nimport { LinePath } from '@vx/shape';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport DraggableHandle, { DragHandle } from './drag-handle';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport isEqual from 'lodash/isEqual';\nimport { color } from '@pie-lib/render-ui';\n\nconst getData = (data, domain) => {\n const { max } = domain || {};\n const length = data.length;\n\n if (!max || !length) {\n return [];\n }\n\n return data.map((el, i) => ({\n ...el,\n x: length > 1 ? i * (max / (length - 1)) : 0.5,\n y: el.value\n }));\n};\n\nexport class RawLine extends React.Component {\n static propTypes = {\n onChange: PropTypes.func,\n value: PropTypes.number,\n classes: PropTypes.object,\n label: PropTypes.string,\n xBand: PropTypes.func,\n index: PropTypes.number.isRequired,\n graphProps: types.GraphPropsType.isRequired,\n data: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.number\n })\n ),\n CustomDraggableComponent: PropTypes.func\n };\n\n static defaultProps = {\n index: 0\n };\n\n constructor(props) {\n super(props);\n this.state = {\n dragValue: undefined,\n line: getData(props.data, props.graphProps.domain)\n };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!isEqual(this.props.data, nextProps.data)) {\n this.setState({\n line: getData(nextProps.data, nextProps.graphProps.domain)\n });\n }\n }\n\n setDragValue = line => this.setState({ line });\n\n dragStop = index => {\n const { onChange } = this.props;\n this.setState({ dragging: false }, () => {\n onChange(index, this.state.line[index]);\n });\n };\n\n dragValue = (index, existing, next) => {\n const newLine = [...this.state.line];\n newLine[index].dragValue = next;\n this.setDragValue(newLine);\n };\n\n render() {\n const { graphProps, data, classes, CustomDraggableComponent } = this.props;\n const { line: lineState, dragging } = this.state;\n const { scale } = graphProps;\n const lineToUse = dragging ? lineState : getData(data, graphProps.domain);\n\n return (\n <React.Fragment>\n <LinePath\n data={lineToUse}\n x={d => scale.x(d.x)}\n y={d => scale.y(d.dragValue !== undefined ? d.dragValue : d.y)}\n className={classes.line}\n />\n {lineToUse &&\n lineToUse.map((point, i) => {\n const r = 6;\n const Component = point.interactive ? DraggableHandle : DragHandle;\n\n return (\n <Component\n key={`point-${point.x}-${i}`}\n x={point.x}\n y={point.dragValue !== undefined ? point.dragValue : point.y}\n interactive={point.interactive}\n r={r}\n onDragStart={() => this.setState({ dragging: true })}\n onDrag={v =>\n this.dragValue(i, point.dragValue !== undefined ? point.dragValue : point.y, v)\n }\n onDragStop={() => this.dragStop(i)}\n graphProps={graphProps}\n CustomDraggableComponent={CustomDraggableComponent}\n correctness={point.correctness}\n />\n );\n })}\n </React.Fragment>\n );\n }\n}\n\nconst StyledLine = withStyles(theme => ({\n line: {\n fill: 'transparent',\n stroke: color.primaryLight(),\n strokeWidth: 3,\n transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',\n '&:hover': {\n strokeWidth: 6,\n stroke: color.primaryDark()\n }\n }\n}))(RawLine);\n\nexport class Line extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n xBand: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n changeLine = (index, category) => {\n const { onChange } = this.props;\n const newLine = [...this.props.data];\n const { dragValue, value } = category;\n\n newLine[index].value = dragValue >= 0 ? dragValue : value;\n\n onChange(newLine);\n };\n\n render() {\n const props = this.props;\n\n return (\n <Group>\n <StyledLine {...props} onChange={this.changeLine} />\n </Group>\n );\n }\n}\n\nexport default Line;\n"],"file":"line.js"}
1
+ {"version":3,"sources":["../../../src/line/common/line.jsx"],"names":["getData","data","domain","max","length","map","el","i","x","y","value","RawLine","props","line","setState","index","onChange","dragging","state","existing","next","newLine","dragValue","setDragValue","undefined","graphProps","nextProps","classes","CustomDraggableComponent","lineState","scale","lineToUse","d","point","r","Component","interactive","DraggableHandle","DragHandle","v","dragStop","correctness","React","PropTypes","func","number","object","label","string","xBand","isRequired","types","GraphPropsType","arrayOf","shape","StyledLine","theme","fill","stroke","color","primaryLight","strokeWidth","transition","primaryDark","Line","category","changeLine","array"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAAOC,MAAP,EAAkB;AAChC,aAAgBA,MAAM,IAAI,EAA1B;AAAA,MAAQC,GAAR,QAAQA,GAAR;;AACA,MAAMC,MAAM,GAAGH,IAAI,CAACG,MAApB;;AAEA,MAAI,CAACD,GAAD,IAAQ,CAACC,MAAb,EAAqB;AACnB,WAAO,EAAP;AACD;;AAED,SAAOH,IAAI,CAACI,GAAL,CAAS,UAACC,EAAD,EAAKC,CAAL;AAAA,2CACXD,EADW;AAEdE,MAAAA,CAAC,EAAEJ,MAAM,GAAG,CAAT,GAAaG,CAAC,IAAIJ,GAAG,IAAIC,MAAM,GAAG,CAAb,CAAP,CAAd,GAAwC,GAF7B;AAGdK,MAAAA,CAAC,EAAEH,EAAE,CAACI;AAHQ;AAAA,GAAT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6B,I,eACQ;AACjB/D,EAAAA,IAAI,EAAE0C,sBAAUwB,KADC;AAEjBnD,EAAAA,QAAQ,EAAE2B,sBAAUC,IAFH;AAGjBK,EAAAA,KAAK,EAAEN,sBAAUC,IAHA;AAIjBnB,EAAAA,UAAU,EAAE0B,YAAMC,cAAN,CAAqBF;AAJhB,C;;eA4BNc,I","sourcesContent":["import React from 'react';\nimport { Group } from '@vx/group';\nimport { LinePath } from '@vx/shape';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport DraggableHandle, { DragHandle } from './drag-handle';\nimport { withStyles } from '@material-ui/core/styles/index';\nimport isEqual from 'lodash/isEqual';\nimport { color } from '@pie-lib/render-ui';\n\nconst getData = (data, domain) => {\n const { max } = domain || {};\n const length = data.length;\n\n if (!max || !length) {\n return [];\n }\n\n return data.map((el, i) => ({\n ...el,\n x: length > 1 ? i * (max / (length - 1)) : 0.5,\n y: el.value\n }));\n};\n\nexport class RawLine extends React.Component {\n static propTypes = {\n onChange: PropTypes.func,\n value: PropTypes.number,\n classes: PropTypes.object,\n label: PropTypes.string,\n xBand: PropTypes.func,\n index: PropTypes.number.isRequired,\n graphProps: types.GraphPropsType.isRequired,\n data: PropTypes.arrayOf(\n PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.number\n })\n ),\n CustomDraggableComponent: PropTypes.func\n };\n\n static defaultProps = {\n index: 0\n };\n\n constructor(props) {\n super(props);\n this.state = {\n dragValue: undefined,\n line: getData(props.data, props.graphProps.domain)\n };\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n if (!isEqual(this.props.data, nextProps.data)) {\n this.setState({\n line: getData(nextProps.data, nextProps.graphProps.domain)\n });\n }\n }\n\n setDragValue = line => this.setState({ line });\n\n dragStop = index => {\n const { onChange } = this.props;\n this.setState({ dragging: false }, () => {\n onChange(index, this.state.line[index]);\n });\n };\n\n dragValue = (index, existing, next) => {\n const newLine = [...this.state.line];\n newLine[index].dragValue = next;\n this.setDragValue(newLine);\n };\n\n render() {\n const { graphProps, data, classes, CustomDraggableComponent } = this.props;\n const { line: lineState, dragging } = this.state;\n const { scale } = graphProps;\n const lineToUse = dragging ? lineState : getData(data, graphProps.domain);\n\n return (\n <React.Fragment>\n <LinePath\n data={lineToUse}\n x={d => scale.x(d.x)}\n y={d => scale.y(d.dragValue !== undefined ? d.dragValue : d.y)}\n className={classes.line}\n />\n {lineToUse &&\n lineToUse.map((point, i) => {\n const r = 6;\n const Component = point.interactive ? DraggableHandle : DragHandle;\n\n return (\n <Component\n key={`point-${point.x}-${i}`}\n x={point.x}\n y={point.dragValue !== undefined ? point.dragValue : point.y}\n interactive={point.interactive}\n r={r}\n onDragStart={() => this.setState({ dragging: true })}\n onDrag={v =>\n this.dragValue(i, point.dragValue !== undefined ? point.dragValue : point.y, v)\n }\n onDragStop={() => this.dragStop(i)}\n graphProps={graphProps}\n CustomDraggableComponent={CustomDraggableComponent}\n correctness={point.correctness}\n />\n );\n })}\n </React.Fragment>\n );\n }\n}\n\nconst StyledLine = withStyles(theme => ({\n line: {\n fill: 'transparent',\n stroke: color.primaryLight(),\n strokeWidth: 3,\n transition: 'stroke 200ms ease-in, stroke-width 200ms ease-in',\n '&:hover': {\n strokeWidth: 6,\n stroke: color.primaryDark()\n }\n }\n}))(RawLine);\n\nexport class Line extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n xBand: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n changeLine = (index, category) => {\n const { onChange } = this.props;\n const newLine = [...this.props.data];\n const { dragValue, value } = category;\n\n newLine[index].value = dragValue >= 0 ? dragValue : value;\n\n onChange(newLine);\n };\n\n render() {\n const props = this.props;\n\n return (\n <Group>\n <StyledLine {...props} onChange={this.changeLine} />\n </Group>\n );\n }\n}\n\nexport default Line;\n"],"file":"line.js"}
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
@@ -21,25 +23,29 @@ var _utils = require("../utils");
21
23
 
22
24
  var _line = _interopRequireDefault(require("./common/line"));
23
25
 
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
26
+ var _excluded = ["classes", "className", "scale", "x", "y", "r", "correctness"];
25
27
 
26
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
27
29
 
28
30
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
31
 
30
32
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
31
33
 
32
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
34
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
33
35
 
34
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
36
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
35
37
 
36
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
38
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
37
39
 
38
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
40
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
39
41
 
40
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
42
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
41
43
 
42
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
44
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
45
+
46
+ 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; } }
47
+
48
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
49
 
44
50
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
51
 
@@ -58,11 +64,11 @@ var DraggableComponent = function DraggableComponent(props) {
58
64
  y = props.y,
59
65
  r = props.r,
60
66
  correctness = props.correctness,
61
- rest = _objectWithoutProperties(props, ["classes", "className", "scale", "x", "y", "r", "correctness"]);
67
+ rest = _objectWithoutProperties(props, _excluded);
62
68
 
63
- return _react["default"].createElement(_group.Group, _extends({}, rest, {
69
+ return /*#__PURE__*/_react["default"].createElement(_group.Group, _extends({}, rest, {
64
70
  className: (0, _classnames["default"])(className, classes.line, correctness && correctness.value)
65
- }), _react["default"].createElement(_shape.LinePath, {
71
+ }), /*#__PURE__*/_react["default"].createElement(_shape.LinePath, {
66
72
  data: [{
67
73
  x: scale.x(x) - r,
68
74
  y: scale.y(y) + r
@@ -78,7 +84,7 @@ var DraggableComponent = function DraggableComponent(props) {
78
84
  return d.y;
79
85
  },
80
86
  strokeWidth: 5
81
- }), _react["default"].createElement(_shape.LinePath, {
87
+ }), /*#__PURE__*/_react["default"].createElement(_shape.LinePath, {
82
88
  data: [{
83
89
  x: scale.x(x) - r,
84
90
  y: scale.y(y) - r
@@ -110,15 +116,15 @@ DraggableComponent.propTypes = {
110
116
  })
111
117
  };
112
118
 
113
- var LineCross =
114
- /*#__PURE__*/
115
- function (_React$Component) {
119
+ var LineCross = /*#__PURE__*/function (_React$Component) {
116
120
  _inherits(LineCross, _React$Component);
117
121
 
122
+ var _super = _createSuper(LineCross);
123
+
118
124
  function LineCross() {
119
125
  _classCallCheck(this, LineCross);
120
126
 
121
- return _possibleConstructorReturn(this, _getPrototypeOf(LineCross).apply(this, arguments));
127
+ return _super.apply(this, arguments);
122
128
  }
123
129
 
124
130
  _createClass(LineCross, [{
@@ -135,7 +141,7 @@ function (_React$Component) {
135
141
  size = _ref$size === void 0 ? {} : _ref$size;
136
142
 
137
143
  var xBand = (0, _utils.dataToXBand)(scale.x, data, size.width, 'lineCross');
138
- return _react["default"].createElement(_line["default"], _extends({}, props, {
144
+ return /*#__PURE__*/_react["default"].createElement(_line["default"], _extends({}, props, {
139
145
  xBand: xBand,
140
146
  CustomDraggableComponent: DraggableComponent
141
147
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/line/line-cross.js"],"names":["DraggableComponent","props","classes","className","scale","x","y","r","correctness","rest","line","value","d","propTypes","PropTypes","object","number","string","shape","label","LineCross","data","graphProps","size","xBand","width","React","Component","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAAAC,KAAK,EAAI;AAAA,uBACwCA,KADxC,CAC1BC,OAD0B;AAAA,MAC1BA,OAD0B,+BAChB,EADgB;AAAA,MACZC,SADY,GACwCF,KADxC,CACZE,SADY;AAAA,MACDC,KADC,GACwCH,KADxC,CACDG,KADC;AAAA,MACMC,CADN,GACwCJ,KADxC,CACMI,CADN;AAAA,MACSC,CADT,GACwCL,KADxC,CACSK,CADT;AAAA,MACYC,CADZ,GACwCN,KADxC,CACYM,CADZ;AAAA,MACeC,WADf,GACwCP,KADxC,CACeO,WADf;AAAA,MAC+BC,IAD/B,4BACwCR,KADxC;;AAGlC,SACE,gCAAC,YAAD,eACMQ,IADN;AAEE,IAAA,SAAS,EAAE,4BAAWN,SAAX,EAAsBD,OAAO,CAACQ,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A,UAAU,EAAES,YAAMC,cAAN,CAAqBC;AAHhB,C;;eAgBN;AAAA,SAAO;AACpBC,IAAAA,IAAI,EAAE,WADc;AAEpBP,IAAAA,SAAS,EAAEP,SAFS;AAGpBe,IAAAA,IAAI,EAAE;AAHc,GAAP;AAAA,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { LinePath } from '@vx/shape';\nimport { Group } from '@vx/group';\nimport classNames from 'classnames';\nimport { dataToXBand } from '../utils';\nimport RawLine from './common/line';\n\nconst DraggableComponent = props => {\n const { classes = {}, className, scale, x, y, r, correctness, ...rest } = props;\n\n return (\n <Group\n {...rest}\n className={classNames(className, classes.line, correctness && correctness.value)}\n >\n <LinePath\n data={[{ x: scale.x(x) - r, y: scale.y(y) + r }, { x: scale.x(x) + r, y: scale.y(y) - r }]}\n key={`point-${x}-${y}-1`}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={5}\n />\n <LinePath\n data={[{ x: scale.x(x) - r, y: scale.y(y) - r }, { x: scale.x(x) + r, y: scale.y(y) + r }]}\n key={`point-${x}-${y}-2`}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={5}\n />\n </Group>\n );\n};\n\nDraggableComponent.propTypes = {\n scale: PropTypes.object,\n x: PropTypes.number,\n y: PropTypes.number,\n r: PropTypes.number,\n className: PropTypes.string,\n classes: PropTypes.object,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n};\n\nexport class LineCross extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'lineCross');\n\n return <RawLine {...props} xBand={xBand} CustomDraggableComponent={DraggableComponent} />;\n }\n}\n\nexport default () => ({\n type: 'lineCross',\n Component: LineCross,\n name: 'Line Cross'\n});\n"],"file":"line-cross.js"}
1
+ {"version":3,"sources":["../../src/line/line-cross.js"],"names":["DraggableComponent","props","classes","className","scale","x","y","r","correctness","rest","line","value","d","propTypes","PropTypes","object","number","string","shape","label","LineCross","data","graphProps","size","xBand","width","React","Component","array","onChange","func","types","GraphPropsType","isRequired","type","name"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB,CAAAC,KAAK,EAAI;AAClC,uBAA0EA,KAA1E,CAAQC,OAAR;AAAA,MAAQA,OAAR,+BAAkB,EAAlB;AAAA,MAAsBC,SAAtB,GAA0EF,KAA1E,CAAsBE,SAAtB;AAAA,MAAiCC,KAAjC,GAA0EH,KAA1E,CAAiCG,KAAjC;AAAA,MAAwCC,CAAxC,GAA0EJ,KAA1E,CAAwCI,CAAxC;AAAA,MAA2CC,CAA3C,GAA0EL,KAA1E,CAA2CK,CAA3C;AAAA,MAA8CC,CAA9C,GAA0EN,KAA1E,CAA8CM,CAA9C;AAAA,MAAiDC,WAAjD,GAA0EP,KAA1E,CAAiDO,WAAjD;AAAA,MAAiEC,IAAjE,4BAA0ER,KAA1E;;AAEA,sBACE,gCAAC,YAAD,eACMQ,IADN;AAEE,IAAA,SAAS,EAAE,4BAAWN,SAAX,EAAsBD,OAAO,CAACQ,IAA9B,EAAoCF,WAAW,IAAIA,WAAW,CAACG,KAA/D;AAFb,mBAIE,gCAAC,eAAD;AACE,IAAA,IAAI,EAAE,CAAC;AAAEN,MAAAA,CAAC,EAAED,KAAK,CAACC,CAAN,CAAQA,CAAR,IAAaE,CAAlB;AAAqBD,MAAAA,CAAC,EAAEF,KAAK,CAACE,CAAN,CAAQA,CAAR,IAAaC;AAArC,KAAD,EAA2C;AAAEF,MAAAA,CAAC,EAAED,KAAK,CAACC,CAAN,CAAQA,CAAR,IAAaE,CAAlB;AAAqBD,MAA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OAAO,EAAEY,sBAAUC,MANU;AAO7BP,EAAAA,WAAW,EAAEM,sBAAUI,KAAV,CAAgB;AAC3BP,IAAAA,KAAK,EAAEG,sBAAUG,MADU;AAE3BE,IAAAA,KAAK,EAAEL,sBAAUG;AAFU,GAAhB;AAPgB,CAA/B;;IAaaG,S;;;;;;;;;;;;;WAOX,kBAAS;AACP,UAAMnB,KAAK,GAAG,KAAKA,KAAnB;AACA,UAAQoB,IAAR,GAA6BpB,KAA7B,CAAQoB,IAAR;AAAA,UAAcC,UAAd,GAA6BrB,KAA7B,CAAcqB,UAAd;;AACA,iBAAkCA,UAAU,IAAI,EAAhD;AAAA,4BAAQlB,KAAR;AAAA,UAAQA,KAAR,2BAAgB,EAAhB;AAAA,2BAAoBmB,IAApB;AAAA,UAAoBA,IAApB,0BAA2B,EAA3B;;AACA,UAAMC,KAAK,GAAG,wBAAYpB,KAAK,CAACC,CAAlB,EAAqBgB,IAArB,EAA2BE,IAAI,CAACE,KAAhC,EAAuC,WAAvC,CAAd;AAEA,0BAAO,gCAAC,gBAAD,eAAaxB,KAAb;AAAoB,QAAA,KAAK,EAAEuB,KAA3B;AAAkC,QAAA,wBAAwB,EAAExB;AAA5D,SAAP;AACD;;;;EAd4B0B,kBAAMC,S;;;;gBAAxBP,S,eACQ;AACjBC,EAAAA,IAAI,EAAEP,sBAAUc,KADC;AAEjBC,EAAAA,QAAQ,EAAEf,sBAAUgB,IAFH;AAGjBR,EAAAA,UAAU,EAAES,YAAMC,cAAN,CAAqBC;AAHhB,C;;eAgBN;AAAA,SAAO;AACpBC,IAAAA,IAAI,EAAE,WADc;AAEpBP,IAAAA,SAAS,EAAEP,SAFS;AAGpBe,IAAAA,IAAI,EAAE;AAHc,GAAP;AAAA,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { types } from '@pie-lib/plot';\nimport { LinePath } from '@vx/shape';\nimport { Group } from '@vx/group';\nimport classNames from 'classnames';\nimport { dataToXBand } from '../utils';\nimport RawLine from './common/line';\n\nconst DraggableComponent = props => {\n const { classes = {}, className, scale, x, y, r, correctness, ...rest } = props;\n\n return (\n <Group\n {...rest}\n className={classNames(className, classes.line, correctness && correctness.value)}\n >\n <LinePath\n data={[{ x: scale.x(x) - r, y: scale.y(y) + r }, { x: scale.x(x) + r, y: scale.y(y) - r }]}\n key={`point-${x}-${y}-1`}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={5}\n />\n <LinePath\n data={[{ x: scale.x(x) - r, y: scale.y(y) - r }, { x: scale.x(x) + r, y: scale.y(y) + r }]}\n key={`point-${x}-${y}-2`}\n x={d => d.x}\n y={d => d.y}\n strokeWidth={5}\n />\n </Group>\n );\n};\n\nDraggableComponent.propTypes = {\n scale: PropTypes.object,\n x: PropTypes.number,\n y: PropTypes.number,\n r: PropTypes.number,\n className: PropTypes.string,\n classes: PropTypes.object,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string\n })\n};\n\nexport class LineCross extends React.Component {\n static propTypes = {\n data: PropTypes.array,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType.isRequired\n };\n\n render() {\n const props = this.props;\n const { data, graphProps } = props;\n const { scale = {}, size = {} } = graphProps || {};\n const xBand = dataToXBand(scale.x, data, size.width, 'lineCross');\n\n return <RawLine {...props} xBand={xBand} CustomDraggableComponent={DraggableComponent} />;\n }\n}\n\nexport default () => ({\n type: 'lineCross',\n Component: LineCross,\n name: 'Line Cross'\n});\n"],"file":"line-cross.js"}