@pie-lib/charting 6.1.0-next.4 → 6.1.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NEXT.CHANGELOG.json +16 -1
- package/lib/actions-button.js +150 -0
- package/lib/actions-button.js.map +1 -0
- package/lib/axes.js +609 -0
- package/lib/axes.js.map +1 -0
- package/lib/bars/bar.js +60 -0
- package/lib/bars/bar.js.map +1 -0
- package/lib/bars/common/bars.js +290 -0
- package/lib/bars/common/bars.js.map +1 -0
- package/lib/bars/common/correct-check-icon.js +55 -0
- package/lib/bars/common/correct-check-icon.js.map +1 -0
- package/lib/bars/histogram.js +61 -0
- package/lib/bars/histogram.js.map +1 -0
- package/lib/chart-setup.js +401 -0
- package/lib/chart-setup.js.map +1 -0
- package/lib/chart-type.js +81 -0
- package/lib/chart-type.js.map +1 -0
- package/lib/chart-types.js +23 -0
- package/lib/chart-types.js.map +1 -0
- package/lib/chart.js +400 -0
- package/lib/chart.js.map +1 -0
- package/lib/common/correctness-indicators.js +160 -0
- package/lib/common/correctness-indicators.js.map +1 -0
- package/lib/common/drag-handle.js +161 -0
- package/lib/common/drag-handle.js.map +1 -0
- package/lib/common/drag-icon.js +54 -0
- package/lib/common/drag-icon.js.map +1 -0
- package/lib/common/styles.js +23 -0
- package/lib/common/styles.js.map +1 -0
- package/lib/grid.js +105 -0
- package/lib/grid.js.map +1 -0
- package/lib/index.js +43 -0
- package/lib/index.js.map +1 -0
- package/lib/key-legend.js +88 -0
- package/lib/key-legend.js.map +1 -0
- package/lib/line/common/drag-handle.js +148 -0
- package/lib/line/common/drag-handle.js.map +1 -0
- package/lib/line/common/line.js +231 -0
- package/lib/line/common/line.js.map +1 -0
- package/lib/line/line-cross.js +230 -0
- package/lib/line/line-cross.js.map +1 -0
- package/lib/line/line-dot.js +160 -0
- package/lib/line/line-dot.js.map +1 -0
- package/lib/mark-label.js +257 -0
- package/lib/mark-label.js.map +1 -0
- package/lib/plot/common/plot.js +361 -0
- package/lib/plot/common/plot.js.map +1 -0
- package/lib/plot/dot.js +113 -0
- package/lib/plot/dot.js.map +1 -0
- package/lib/plot/line.js +143 -0
- package/lib/plot/line.js.map +1 -0
- package/lib/tool-menu.js +117 -0
- package/lib/tool-menu.js.map +1 -0
- package/lib/utils.js +201 -0
- package/lib/utils.js.map +1 -0
- package/package.json +12 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correctness-indicators.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_Check","_Close","_renderUi","StyledCorrectIcon","styled","Check","_ref","theme","borderRadius","spacing","color","enumColor","defaults","WHITE","fontSize","width","height","padding","border","concat","stroke","boxSizing","backgroundColor","correct","display","StyledIncorrectIcon","Close","_ref2","incorrectWithIcon","CorrectnessIndicator","exports","_ref3","scale","x","y","correctness","interactive","cx","cy","isCorrect","value","createElement","title","label","SmallCorrectPointIndicator","_ref4","correctData","_correctData$find","correctVal","parseFloat","find","d","isNaN","correctPxY","yToRender","xToRender","className","TickCorrectnessIndicator","_ref5","propTypes","PropTypes","shape","func","number","isRequired","string","bool","arrayOf","oneOfType"],"sources":["../../src/common/correctness-indicators.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport Check from '@mui/icons-material/Check';\nimport Close from '@mui/icons-material/Close';\nimport { color as enumColor } from '@pie-lib/render-ui';\n\nconst StyledCorrectIcon = styled(Check)(({ theme }) => ({\n borderRadius: theme.spacing(2),\n color: enumColor.defaults.WHITE,\n fontSize: '16px',\n width: '16px',\n height: '16px',\n padding: '2px',\n border: `1px solid ${enumColor.defaults.WHITE}`,\n stroke: 'initial',\n boxSizing: 'unset', // to override the default border-box in IBX\n backgroundColor: enumColor.correct(),\n display: 'block',\n '&.small': {\n fontSize: '10px',\n width: '10px',\n height: '10px',\n },\n}));\n\nconst StyledIncorrectIcon = styled(Close)(({ theme }) => ({\n borderRadius: theme.spacing(2),\n color: enumColor.defaults.WHITE,\n fontSize: '16px',\n width: '16px',\n height: '16px',\n padding: '2px',\n border: `1px solid ${enumColor.defaults.WHITE}`,\n stroke: 'initial',\n boxSizing: 'unset', // to override the default border-box in IBX\n backgroundColor: enumColor.incorrectWithIcon(),\n display: 'block',\n '&.small': {\n fontSize: '10px',\n width: '10px',\n height: '10px',\n },\n}));\n\nexport const CorrectnessIndicator = ({ scale, x, y, correctness, interactive }) => {\n if (!correctness || !interactive) return null;\n const cx = scale ? scale.x(x) : x;\n const cy = scale ? scale.y(y) : y;\n const isCorrect = correctness.value === 'correct';\n\n // the icon is 16px + 2px padding + 1px border, so total size is 22px\n return (\n <foreignObject x={cx - 11} y={cy - 11} width={22} height={22}>\n {isCorrect ? (\n <StyledCorrectIcon title={correctness.label} />\n ) : (\n <StyledIncorrectIcon title={correctness.label} />\n )}\n </foreignObject>\n );\n};\n\nexport const SmallCorrectPointIndicator = ({ scale, x, correctness, correctData, label }) => {\n if (correctness && correctness.value === 'incorrect') {\n const correctVal = parseFloat(correctData.find((d) => d.label === label)?.value);\n if (isNaN(correctVal)) return null;\n const correctPxY = scale.y(correctVal);\n const yToRender = correctPxY - 7.5;\n const xToRender = scale.x(x) - 7.5;\n\n // small circle has 10px font + 2px padding + 1px border, so total size is 15px\n return (\n <foreignObject x={xToRender} y={yToRender} width={15} height={15}>\n <StyledCorrectIcon\n className=\"small\"\n title={correctness.label}\n />\n </foreignObject>\n );\n }\n\n return null;\n};\n\nexport const TickCorrectnessIndicator = ({ correctness, interactive }) => {\n if (!correctness || !interactive) return null;\n\n return correctness.value === 'correct' ? (\n <StyledCorrectIcon title={correctness.label} />\n ) : (\n <StyledIncorrectIcon title={correctness.label} />\n );\n};\n\nCorrectnessIndicator.propTypes = {\n scale: PropTypes.shape({\n x: PropTypes.func,\n y: PropTypes.func,\n }),\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string,\n }),\n interactive: PropTypes.bool,\n};\n\nSmallCorrectPointIndicator.propTypes = {\n scale: PropTypes.shape({\n x: PropTypes.func,\n y: PropTypes.func,\n }).isRequired,\n x: PropTypes.number.isRequired,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string,\n }),\n correctData: PropTypes.arrayOf(PropTypes.shape({\n label: PropTypes.string,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n })),\n label: PropTypes.string,\n};\n\nTickCorrectnessIndicator.propTypes = {\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string,\n }),\n interactive: PropTypes.bool,\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAEA,IAAMM,iBAAiB,GAAG,IAAAC,cAAM,EAACC,iBAAK,CAAC,CAAC,UAAAC,IAAA;EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;EAAA,OAAQ;IACtDC,YAAY,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC;IAC9BC,KAAK,EAAEC,eAAS,CAACC,QAAQ,CAACC,KAAK;IAC/BC,QAAQ,EAAE,MAAM;IAChBC,KAAK,EAAE,MAAM;IACbC,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE,KAAK;IACdC,MAAM,eAAAC,MAAA,CAAeR,eAAS,CAACC,QAAQ,CAACC,KAAK,CAAE;IAC/CO,MAAM,EAAE,SAAS;IACjBC,SAAS,EAAE,OAAO;IAAE;IACpBC,eAAe,EAAEX,eAAS,CAACY,OAAO,CAAC,CAAC;IACpCC,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE;MACTV,QA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WAAW,EAAEyB,qBAAS,CAACC,KAAK,CAAC;IAC3BrB,KAAK,EAAEoB,qBAAS,CAACK,MAAM;IACvBtB,KAAK,EAAEiB,qBAAS,CAACK;EACnB,CAAC,CAAC;EACF7B,WAAW,EAAEwB,qBAAS,CAACM;AACzB,CAAC;AAEDtB,0BAA0B,CAACe,SAAS,GAAG;EACrC3B,KAAK,EAAE4B,qBAAS,CAACC,KAAK,CAAC;IACrB5B,CAAC,EAAE2B,qBAAS,CAACE,IAAI;IACjB5B,CAAC,EAAE0B,qBAAS,CAACE;EACf,CAAC,CAAC,CAACE,UAAU;EACb/B,CAAC,EAAE2B,qBAAS,CAACG,MAAM,CAACC,UAAU;EAC9B7B,WAAW,EAAEyB,qBAAS,CAACC,KAAK,CAAC;IAC3BrB,KAAK,EAAEoB,qBAAS,CAACK,MAAM;IACvBtB,KAAK,EAAEiB,qBAAS,CAACK;EACnB,CAAC,CAAC;EACFnB,WAAW,EAAEc,qBAAS,CAACO,OAAO,CAACP,qBAAS,CAACC,KAAK,CAAC;IAC7ClB,KAAK,EAAEiB,qBAAS,CAACK,MAAM;IACvBzB,KAAK,EAAEoB,qBAAS,CAACQ,SAAS,CAAC,CAACR,qBAAS,CAACK,MAAM,EAAEL,qBAAS,CAACG,MAAM,CAAC;EACjE,CAAC,CAAC,CAAC;EACHpB,KAAK,EAAEiB,qBAAS,CAACK;AACnB,CAAC;AAEDR,wBAAwB,CAACE,SAAS,GAAG;EACnCxB,WAAW,EAAEyB,qBAAS,CAACC,KAAK,CAAC;IAC3BrB,KAAK,EAAEoB,qBAAS,CAACK,MAAM;IACvBtB,KAAK,EAAEiB,qBAAS,CAACK;EACnB,CAAC,CAAC;EACF7B,WAAW,EAAEwB,qBAAS,CAACM;AACzB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.DragHandle = exports.D = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
15
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
16
|
+
var _plot = require("@pie-lib/plot");
|
|
17
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
18
|
+
var _utils = require("../utils");
|
|
19
|
+
var _dragIcon = _interopRequireDefault(require("./drag-icon"));
|
|
20
|
+
var _excluded = ["x", "y", "width", "graphProps", "interactive", "isHovered", "correctness", "isPlot"];
|
|
21
|
+
var StyledSvg = (0, _styles.styled)('svg')(function () {
|
|
22
|
+
return {
|
|
23
|
+
overflow: 'visible !important'
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
var StyledEllipse = (0, _styles.styled)('ellipse')(function () {
|
|
27
|
+
return {
|
|
28
|
+
fill: 'transparent',
|
|
29
|
+
clipPath: 'polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)'
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
var StyledCorrectIcon = (0, _styles.styled)(_Check["default"])(function () {
|
|
33
|
+
return {
|
|
34
|
+
backgroundColor: _renderUi.color.correct(),
|
|
35
|
+
borderRadius: '16px',
|
|
36
|
+
// equivalent to theme.spacing(2) for most themes
|
|
37
|
+
color: _renderUi.color.defaults.WHITE,
|
|
38
|
+
fontSize: '16px',
|
|
39
|
+
padding: '2px',
|
|
40
|
+
border: "4px solid ".concat(_renderUi.color.defaults.WHITE),
|
|
41
|
+
width: '16px',
|
|
42
|
+
height: '16px',
|
|
43
|
+
boxSizing: 'unset' // to override the default border-box in IBX
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
var StyledIncorrectIcon = (0, _styles.styled)(_Close["default"])(function () {
|
|
47
|
+
return {
|
|
48
|
+
backgroundColor: _renderUi.color.incorrectWithIcon(),
|
|
49
|
+
borderRadius: '16px',
|
|
50
|
+
// equivalent to theme.spacing(2) for most themes
|
|
51
|
+
color: _renderUi.color.defaults.WHITE,
|
|
52
|
+
fontSize: '16px',
|
|
53
|
+
padding: '2px',
|
|
54
|
+
border: "4px solid ".concat(_renderUi.color.defaults.WHITE),
|
|
55
|
+
width: '16px',
|
|
56
|
+
height: '16px',
|
|
57
|
+
boxSizing: 'unset' // to override the default border-box in IBX
|
|
58
|
+
};
|
|
59
|
+
});
|
|
60
|
+
var RawDragHandle = function RawDragHandle(_ref) {
|
|
61
|
+
var _getScale;
|
|
62
|
+
var x = _ref.x,
|
|
63
|
+
y = _ref.y,
|
|
64
|
+
width = _ref.width,
|
|
65
|
+
graphProps = _ref.graphProps,
|
|
66
|
+
interactive = _ref.interactive,
|
|
67
|
+
isHovered = _ref.isHovered,
|
|
68
|
+
correctness = _ref.correctness,
|
|
69
|
+
isPlot = _ref.isPlot,
|
|
70
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
71
|
+
var scale = graphProps.scale;
|
|
72
|
+
var scaleValue = (_getScale = (0, _utils.getScale)(width)) === null || _getScale === void 0 ? void 0 : _getScale.scale;
|
|
73
|
+
return /*#__PURE__*/_react["default"].createElement(StyledSvg, {
|
|
74
|
+
x: x,
|
|
75
|
+
y: scale.y(y) - 10,
|
|
76
|
+
width: width,
|
|
77
|
+
overflow: "visible"
|
|
78
|
+
}, isHovered && !correctness && interactive && /*#__PURE__*/_react["default"].createElement(_dragIcon["default"], {
|
|
79
|
+
width: width,
|
|
80
|
+
scaleValue: scaleValue,
|
|
81
|
+
color: _renderUi.color.defaults.BORDER_GRAY
|
|
82
|
+
}), interactive && !correctness && /*#__PURE__*/_react["default"].createElement(StyledEllipse, (0, _extends2["default"])({
|
|
83
|
+
cx: width / 2,
|
|
84
|
+
cy: 10,
|
|
85
|
+
rx: width / 2
|
|
86
|
+
// the drag icon has a 22px fixed r value, so the ry value is 3 times that in order to cover all the area
|
|
87
|
+
,
|
|
88
|
+
ry: 66
|
|
89
|
+
}, rest)), /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("filter", {
|
|
90
|
+
id: "bottomShadow",
|
|
91
|
+
x: "0",
|
|
92
|
+
y: "0",
|
|
93
|
+
width: "140%",
|
|
94
|
+
height: "140%"
|
|
95
|
+
}, /*#__PURE__*/_react["default"].createElement("feGaussianBlur", {
|
|
96
|
+
"in": "SourceAlpha",
|
|
97
|
+
stdDeviation: "3"
|
|
98
|
+
}), /*#__PURE__*/_react["default"].createElement("feOffset", {
|
|
99
|
+
dx: "0",
|
|
100
|
+
dy: "5",
|
|
101
|
+
result: "offsetblur"
|
|
102
|
+
}), /*#__PURE__*/_react["default"].createElement("feFlood", {
|
|
103
|
+
floodColor: "#00000033"
|
|
104
|
+
}), /*#__PURE__*/_react["default"].createElement("feComposite", {
|
|
105
|
+
in2: "offsetblur",
|
|
106
|
+
operator: "in"
|
|
107
|
+
}), /*#__PURE__*/_react["default"].createElement("feMerge", null, /*#__PURE__*/_react["default"].createElement("feMergeNode", null), /*#__PURE__*/_react["default"].createElement("feMergeNode", {
|
|
108
|
+
"in": "SourceGraphic"
|
|
109
|
+
})))), correctness && interactive && !isPlot && /*#__PURE__*/_react["default"].createElement("foreignObject", {
|
|
110
|
+
x: width / 2 - 14,
|
|
111
|
+
y: 0,
|
|
112
|
+
width: 40,
|
|
113
|
+
height: 40
|
|
114
|
+
}, correctness.value === 'correct' ? /*#__PURE__*/_react["default"].createElement(StyledCorrectIcon, {
|
|
115
|
+
title: correctness.label
|
|
116
|
+
}) : /*#__PURE__*/_react["default"].createElement(StyledIncorrectIcon, {
|
|
117
|
+
title: correctness.label
|
|
118
|
+
})));
|
|
119
|
+
};
|
|
120
|
+
RawDragHandle.propTypes = {
|
|
121
|
+
x: _propTypes["default"].number.isRequired,
|
|
122
|
+
y: _propTypes["default"].number.isRequired,
|
|
123
|
+
width: _propTypes["default"].number,
|
|
124
|
+
graphProps: _plot.types.GraphPropsType.isRequired,
|
|
125
|
+
interactive: _propTypes["default"].bool,
|
|
126
|
+
isHovered: _propTypes["default"].bool,
|
|
127
|
+
correctness: _propTypes["default"].shape({
|
|
128
|
+
value: _propTypes["default"].string,
|
|
129
|
+
label: _propTypes["default"].string
|
|
130
|
+
}),
|
|
131
|
+
isPlot: _propTypes["default"].bool
|
|
132
|
+
};
|
|
133
|
+
var DragHandle = exports.DragHandle = RawDragHandle;
|
|
134
|
+
var D = exports.D = (0, _plot.gridDraggable)({
|
|
135
|
+
axis: 'y',
|
|
136
|
+
fromDelta: function fromDelta(props, delta) {
|
|
137
|
+
//TODO: should be in grid-draggable, if axis is y delta.x should always be 0.
|
|
138
|
+
delta.x = 0;
|
|
139
|
+
var newPoint = _plot.utils.point(props).add(_plot.utils.point(delta));
|
|
140
|
+
return newPoint.y;
|
|
141
|
+
},
|
|
142
|
+
bounds: function bounds(props, _ref2) {
|
|
143
|
+
var domain = _ref2.domain,
|
|
144
|
+
range = _ref2.range;
|
|
145
|
+
var area = {
|
|
146
|
+
left: 0,
|
|
147
|
+
top: props.y,
|
|
148
|
+
bottom: props.y,
|
|
149
|
+
right: 0
|
|
150
|
+
};
|
|
151
|
+
return _plot.utils.bounds(area, domain, range);
|
|
152
|
+
},
|
|
153
|
+
anchorPoint: function anchorPoint(props) {
|
|
154
|
+
return {
|
|
155
|
+
x: props.x,
|
|
156
|
+
y: props.y
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
})(DragHandle);
|
|
160
|
+
var _default = exports["default"] = D;
|
|
161
|
+
//# sourceMappingURL=drag-handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-handle.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_Check","_Close","_plot","_renderUi","_utils","_dragIcon","_excluded","StyledSvg","styled","overflow","StyledEllipse","fill","clipPath","StyledCorrectIcon","Check","backgroundColor","enumColor","correct","borderRadius","color","defaults","WHITE","fontSize","padding","border","concat","width","height","boxSizing","StyledIncorrectIcon","Close","incorrectWithIcon","RawDragHandle","_ref","_getScale","x","y","graphProps","interactive","isHovered","correctness","isPlot","rest","_objectWithoutProperties2","scale","scaleValue","getScale","createElement","BORDER_GRAY","_extends2","cx","cy","rx","ry","id","stdDeviation","dx","dy","result","floodColor","in2","operator","value","title","label","propTypes","PropTypes","number","isRequired","types","GraphPropsType","bool","shape","string","DragHandle","exports","D","gridDraggable","axis","fromDelta","props","delta","newPoint","utils","point","add","bounds","_ref2","domain","range","area","left","top","bottom","right","anchorPoint","_default"],"sources":["../../src/common/drag-handle.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport Check from '@mui/icons-material/Check';\nimport Close from '@mui/icons-material/Close';\n\nimport { gridDraggable, utils, types } from '@pie-lib/plot';\nimport { color as enumColor } from '@pie-lib/render-ui';\nimport { getScale } from '../utils';\nimport DragIcon from './drag-icon';\n\nconst StyledSvg = styled('svg')(() => ({\n overflow: 'visible !important',\n}));\n\nconst StyledEllipse = styled('ellipse')(() => ({\n fill: 'transparent',\n clipPath: 'polygon(50% 0%, 100% 0%, 100% 50%, 0% 50%, 0% 0%)',\n}));\n\nconst StyledCorrectIcon = styled(Check)(() => ({\n backgroundColor: enumColor.correct(),\n borderRadius: '16px', // equivalent to theme.spacing(2) for most themes\n color: enumColor.defaults.WHITE,\n fontSize: '16px',\n padding: '2px',\n border: `4px solid ${enumColor.defaults.WHITE}`,\n width: '16px',\n height: '16px',\n boxSizing: 'unset', // to override the default border-box in IBX\n}));\n\nconst StyledIncorrectIcon = styled(Close)(() => ({\n backgroundColor: enumColor.incorrectWithIcon(),\n borderRadius: '16px', // equivalent to theme.spacing(2) for most themes\n color: enumColor.defaults.WHITE,\n fontSize: '16px',\n padding: '2px',\n border: `4px solid ${enumColor.defaults.WHITE}`,\n width: '16px',\n height: '16px',\n boxSizing: 'unset', // to override the default border-box in IBX\n}));\n\nconst RawDragHandle = ({\n x,\n y,\n width,\n graphProps,\n interactive,\n isHovered,\n correctness,\n isPlot,\n ...rest\n}) => {\n const { scale } = graphProps;\n const scaleValue = getScale(width)?.scale;\n\n return (\n <StyledSvg x={x} y={scale.y(y) - 10} width={width} overflow=\"visible\">\n {isHovered && !correctness && interactive && (\n <DragIcon width={width} scaleValue={scaleValue} color={enumColor.defaults.BORDER_GRAY} />\n )}\n {interactive && !correctness && (\n <StyledEllipse\n cx={width / 2}\n cy={10}\n rx={width / 2}\n // the drag icon has a 22px fixed r value, so the ry value is 3 times that in order to cover all the area\n ry={66}\n {...rest}\n />\n )}\n\n <defs>\n <filter id=\"bottomShadow\" x=\"0\" y=\"0\" width=\"140%\" height=\"140%\">\n <feGaussianBlur in=\"SourceAlpha\" stdDeviation=\"3\" />\n <feOffset dx=\"0\" dy=\"5\" result=\"offsetblur\" />\n <feFlood floodColor=\"#00000033\" />\n <feComposite in2=\"offsetblur\" operator=\"in\" />\n <feMerge>\n <feMergeNode />\n <feMergeNode in=\"SourceGraphic\" />\n </feMerge>\n </filter>\n </defs>\n\n {correctness && interactive && !isPlot && (\n <foreignObject x={width / 2 - 14} y={0} width={40} height={40}>\n {correctness.value === 'correct' ? (\n <StyledCorrectIcon title={correctness.label} />\n ) : (\n <StyledIncorrectIcon title={correctness.label} />\n )}\n </foreignObject>\n )}\n </StyledSvg>\n );\n};\n\nRawDragHandle.propTypes = {\n x: PropTypes.number.isRequired,\n y: PropTypes.number.isRequired,\n width: PropTypes.number,\n graphProps: types.GraphPropsType.isRequired,\n interactive: PropTypes.bool,\n isHovered: PropTypes.bool,\n correctness: PropTypes.shape({\n value: PropTypes.string,\n label: PropTypes.string,\n }),\n isPlot: PropTypes.bool,\n};\n\nexport const DragHandle = RawDragHandle;\n\nexport const D = 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\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 D;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAT,sBAAA,CAAAC,OAAA;AAAmC,IAAAS,SAAA;AAEnC,IAAMC,SAAS,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EAAA,OAAO;IACrCC,QAAQ,EAAE;EACZ,CAAC;AAAA,CAAC,CAAC;AAEH,IAAMC,aAAa,GAAG,IAAAF,cAAM,EAAC,SAAS,CAAC,CAAC;EAAA,OAAO;IAC7CG,IAAI,EAAE,aAAa;IACnBC,QAAQ,EAAE;EACZ,CAAC;AAAA,CAAC,CAAC;AAEH,IAAMC,iBAAiB,GAAG,IAAAL,cAAM,EAACM,iBAAK,CAAC,CAAC;EAAA,OAAO;IAC7CC,eAAe,EAAEC,eAAS,CAACC,OAAO,CAAC,C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el/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
require("core-js/modules/es.array.concat.js");
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
var DragIcon = function DragIcon(_ref) {
|
|
14
|
+
var _getScale;
|
|
15
|
+
var width = _ref.width,
|
|
16
|
+
scaleValue = _ref.scaleValue,
|
|
17
|
+
color = _ref.color;
|
|
18
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
19
|
+
x: (0, _utils.getAdjustedX)(width, scaleValue),
|
|
20
|
+
y: (_getScale = (0, _utils.getScale)(width)) === null || _getScale === void 0 ? void 0 : _getScale.deltay,
|
|
21
|
+
color: color,
|
|
22
|
+
width: width,
|
|
23
|
+
height: width,
|
|
24
|
+
overflow: "visible",
|
|
25
|
+
viewBox: "0 0 ".concat(width, " ").concat(width),
|
|
26
|
+
style: {
|
|
27
|
+
overflow: 'visible !important'
|
|
28
|
+
}
|
|
29
|
+
}, /*#__PURE__*/_react["default"].createElement("g", {
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
fill: "currentColor",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
transform: "scale(".concat(scaleValue, ")")
|
|
34
|
+
}, /*#__PURE__*/_react["default"].createElement("circle", {
|
|
35
|
+
cx: "28.5",
|
|
36
|
+
cy: "23.5",
|
|
37
|
+
r: "22",
|
|
38
|
+
fill: "white",
|
|
39
|
+
stroke: "currentColor"
|
|
40
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
41
|
+
d: "M33.5 21.25H23.4609C22.7578 21.25 22.4062 20.4297 22.9141 19.9219L27.9141 14.9219C28.2266 14.6094 28.7344 14.6094 29.0469 14.9219L34.0469 19.9219C34.5547 20.4297 34.2031 21.25 33.5 21.25Z",
|
|
42
|
+
fill: "currentColor"
|
|
43
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
44
|
+
d: "M23.5 25.75L33.5391 25.75C34.2422 25.75 34.5938 26.5703 34.0859 27.0781L29.0859 32.0781C28.7734 32.3906 28.2656 32.3906 27.9531 32.0781L22.9531 27.0781C22.4453 26.5703 22.7969 25.75 23.5 25.75Z",
|
|
45
|
+
fill: "currentColor"
|
|
46
|
+
})));
|
|
47
|
+
};
|
|
48
|
+
DragIcon.propTypes = {
|
|
49
|
+
width: _propTypes["default"].number.isRequired,
|
|
50
|
+
scaleValue: _propTypes["default"].number.isRequired,
|
|
51
|
+
color: _propTypes["default"].string
|
|
52
|
+
};
|
|
53
|
+
var _default = exports["default"] = DragIcon;
|
|
54
|
+
//# sourceMappingURL=drag-icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-icon.js","names":["_react","_interopRequireDefault","require","_propTypes","_utils","DragIcon","_ref","_getScale","width","scaleValue","color","createElement","x","getAdjustedX","y","getScale","deltay","height","overflow","viewBox","concat","style","xmlns","fill","stroke","transform","cx","cy","r","d","propTypes","PropTypes","number","isRequired","string","_default","exports"],"sources":["../../src/common/drag-icon.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { getAdjustedX, getScale } from '../utils';\n\nconst DragIcon = ({ width, scaleValue, color }) => (\n <svg\n x={getAdjustedX(width, scaleValue)}\n y={getScale(width)?.deltay}\n color={color}\n width={width}\n height={width}\n overflow=\"visible\"\n viewBox={`0 0 ${width} ${width}`}\n style={{ overflow: 'visible !important' }}\n >\n <g xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" stroke=\"currentColor\" transform={`scale(${scaleValue})`}>\n <circle cx=\"28.5\" cy=\"23.5\" r=\"22\" fill=\"white\" stroke=\"currentColor\" />\n <path\n d=\"M33.5 21.25H23.4609C22.7578 21.25 22.4062 20.4297 22.9141 19.9219L27.9141 14.9219C28.2266 14.6094 28.7344 14.6094 29.0469 14.9219L34.0469 19.9219C34.5547 20.4297 34.2031 21.25 33.5 21.25Z\"\n fill=\"currentColor\"\n />\n <path\n d=\"M23.5 25.75L33.5391 25.75C34.2422 25.75 34.5938 26.5703 34.0859 27.0781L29.0859 32.0781C28.7734 32.3906 28.2656 32.3906 27.9531 32.0781L22.9531 27.0781C22.4453 26.5703 22.7969 25.75 23.5 25.75Z\"\n fill=\"currentColor\"\n />\n </g>\n </svg>\n);\n\nDragIcon.propTypes = {\n width: PropTypes.number.isRequired,\n scaleValue: PropTypes.number.isRequired,\n color: PropTypes.string,\n};\n\nexport default DragIcon;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEA,IAAMG,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA;EAAA,IAAAC,SAAA;EAAA,IAAMC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IAAEC,KAAK,GAAAJ,IAAA,CAALI,KAAK;EAAA,oBAC1CV,MAAA,YAAAW,aAAA;IACEC,CAAC,EAAE,IAAAC,mBAAY,EAACL,KAAK,EAAEC,UAAU,CAAE;IACnCK,CAAC,GAAAP,SAAA,GAAE,IAAAQ,eAAQ,EAACP,KAAK,CAAC,cAAAD,SAAA,uBAAfA,SAAA,CAAiBS,MAAO;IAC3BN,KAAK,EAAEA,KAAM;IACbF,KAAK,EAAEA,KAAM;IACbS,MAAM,EAAET,KAAM;IACdU,QAAQ,EAAC,SAAS;IAClBC,OAAO,SAAAC,MAAA,CAASZ,KAAK,OAAAY,MAAA,CAAIZ,KAAK,CAAG;IACjCa,KAAK,EAAE;MAAEH,QAAQ,EAAE;IAAqB;EAAE,gBAE1ClB,MAAA,YAAAW,aAAA;IAAGW,KAAK,EAAC,4BAA4B;IAACC,IAAI,EAAC,cAAc;IAACC,MAAM,EAAC,cAAc;IAACC,SAAS,WAAAL,MAAA,CAAWX,UAAU;EAAI,gBAChHT,MAAA,YAAAW,aAAA;IAAQe,EAAE,EAAC,MAAM;IAACC,EAAE,EAAC,MAAM;IAACC,CAAC,EAAC,IAAI;IAACL,IAAI,EAAC,OAAO;IAACC,MAAM,EAAC;EAAc,CAAE,CAAC,eACxExB,MAAA,YAAAW,aAAA;IACEkB,CAAC,EAAC,6LAA6L;IAC/LN,IAAI,EAAC;EAAc,CACpB,CAAC,eACFvB,MAAA,YAAAW,aAAA;IACEkB,CAAC,EAAC,mMAAmM;IACrMN,IAAI,EAAC;EAAc,CACpB,CACA,CACA,CAAC;AAAA,CACP;AAEDlB,QAAQ,CAACyB,SAAS,GAAG;EACnBtB,KAAK,EAAEuB,qBAAS,CAACC,MAAM,CAACC,UAAU;EAClCxB,UAAU,EAAEsB,qBAAS,CAACC,MAAM,CAACC,UAAU;EACvCvB,KAAK,EAAEqB,qBAAS,CAACG;AACnB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa/B,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.incorrect = exports.disabled = exports.correct = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
11
|
+
var disabled = exports.disabled = function disabled() {
|
|
12
|
+
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fill';
|
|
13
|
+
return (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, key, "var(--graph-disabled, ".concat(_renderUi.color.disabled(), ")")), "pointerEvents", 'none'), "border", 'none');
|
|
14
|
+
};
|
|
15
|
+
var correct = exports.correct = function correct() {
|
|
16
|
+
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fill';
|
|
17
|
+
return (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, key, _renderUi.color.correct()), "pointerEvents", 'none'), "border", "solid 1px ".concat(_renderUi.color.correct()));
|
|
18
|
+
};
|
|
19
|
+
var incorrect = exports.incorrect = function incorrect() {
|
|
20
|
+
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fill';
|
|
21
|
+
return (0, _defineProperty2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, key, _renderUi.color.incorrect()), "pointerEvents", 'none'), "border", "solid 1px ".concat(_renderUi.color.incorrect()));
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","names":["_renderUi","require","disabled","exports","key","arguments","length","undefined","_defineProperty2","concat","color","correct","incorrect"],"sources":["../../src/common/styles.js"],"sourcesContent":["import { color } from '@pie-lib/render-ui';\n\nexport const disabled = (key = 'fill') => ({\n [key]: `var(--graph-disabled, ${color.disabled()})`,\n pointerEvents: 'none',\n border: 'none',\n});\n\nexport const correct = (key = 'fill') => ({\n [key]: color.correct(),\n pointerEvents: 'none',\n border: `solid 1px ${color.correct()}`,\n});\n\nexport const incorrect = (key = 'fill') => ({\n [key]: color.incorrect(),\n pointerEvents: 'none',\n border: `solid 1px ${color.incorrect()}`,\n});"],"mappings":";;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAEO,IAAMC,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,SAAXA,QAAQA,CAAA;EAAA,IAAIE,GAAG,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,MAAM;EAAA,WAAAG,gBAAA,iBAAAA,gBAAA,iBAAAA,gBAAA,iBAClCJ,GAAG,2BAAAK,MAAA,CAA4BC,eAAK,CAACR,QAAQ,CAAC,CAAC,0BACjC,MAAM,aACb,MAAM;AAAA,CACd;AAEK,IAAMS,OAAO,GAAAR,OAAA,CAAAQ,OAAA,GAAG,SAAVA,OAAOA,CAAA;EAAA,IAAIP,GAAG,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,MAAM;EAAA,WAAAG,gBAAA,iBAAAA,gBAAA,iBAAAA,gBAAA,iBACjCJ,GAAG,EAAGM,eAAK,CAACC,OAAO,CAAC,CAAC,oBACP,MAAM,0BAAAF,MAAA,CACAC,eAAK,CAACC,OAAO,CAAC,CAAC;AAAA,CACpC;AAEK,IAAMC,SAAS,GAAAT,OAAA,CAAAS,SAAA,GAAG,SAAZA,SAASA,CAAA;EAAA,IAAIR,GAAG,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,MAAM;EAAA,WAAAG,gBAAA,iBAAAA,gBAAA,iBAAAA,gBAAA,iBACnCJ,GAAG,EAAGM,eAAK,CAACE,SAAS,CAAC,CAAC,oBACT,MAAM,0BAAAH,MAAA,CACAC,eAAK,CAACE,SAAS,CAAC,CAAC;AAAA,CACtC","ignoreList":[]}
|
package/lib/grid.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports["default"] = exports.Grid = void 0;
|
|
10
|
+
require("core-js/modules/es.array.reduce.js");
|
|
11
|
+
require("core-js/modules/es.object.to-string.js");
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
14
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
20
|
+
var _styles = require("@mui/material/styles");
|
|
21
|
+
var _grid = require("@visx/grid");
|
|
22
|
+
var _plot = require("@pie-lib/plot");
|
|
23
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
24
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
25
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
26
|
+
var StyledGridGroup = (0, _styles.styled)('g')(function () {
|
|
27
|
+
return {
|
|
28
|
+
stroke: _renderUi.color.primaryLight()
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
var Grid = exports.Grid = /*#__PURE__*/function (_React$Component) {
|
|
32
|
+
function Grid() {
|
|
33
|
+
(0, _classCallCheck2["default"])(this, Grid);
|
|
34
|
+
return _callSuper(this, Grid, arguments);
|
|
35
|
+
}
|
|
36
|
+
(0, _inherits2["default"])(Grid, _React$Component);
|
|
37
|
+
return (0, _createClass2["default"])(Grid, [{
|
|
38
|
+
key: "render",
|
|
39
|
+
value: function render() {
|
|
40
|
+
var _this$props = this.props,
|
|
41
|
+
graphProps = _this$props.graphProps,
|
|
42
|
+
xBand = _this$props.xBand,
|
|
43
|
+
rowTickValues = _this$props.rowTickValues,
|
|
44
|
+
columnTickValues = _this$props.columnTickValues;
|
|
45
|
+
var _ref = graphProps || {},
|
|
46
|
+
_ref$scale = _ref.scale,
|
|
47
|
+
scale = _ref$scale === void 0 ? {} : _ref$scale,
|
|
48
|
+
_ref$size = _ref.size,
|
|
49
|
+
size = _ref$size === void 0 ? {} : _ref$size,
|
|
50
|
+
_ref$range = _ref.range,
|
|
51
|
+
range = _ref$range === void 0 ? {} : _ref$range;
|
|
52
|
+
var _range$step = range.step,
|
|
53
|
+
step = _range$step === void 0 ? 0 : _range$step,
|
|
54
|
+
_range$labelStep = range.labelStep,
|
|
55
|
+
labelStep = _range$labelStep === void 0 ? 0 : _range$labelStep;
|
|
56
|
+
var highlightNonLabel = step && labelStep && step < labelStep;
|
|
57
|
+
// if highlightNonLabel is true, we need to separate the unlabled lines in order to render them in a different color
|
|
58
|
+
var _reduce = (rowTickValues || []).reduce(function (acc, value) {
|
|
59
|
+
if (highlightNonLabel && value % labelStep !== 0) {
|
|
60
|
+
acc.unlabeledLines.push(value);
|
|
61
|
+
} else {
|
|
62
|
+
acc.labeledLines.push(value);
|
|
63
|
+
}
|
|
64
|
+
return acc;
|
|
65
|
+
}, {
|
|
66
|
+
unlabeledLines: [],
|
|
67
|
+
labeledLines: []
|
|
68
|
+
}),
|
|
69
|
+
unlabeledLines = _reduce.unlabeledLines,
|
|
70
|
+
labeledLines = _reduce.labeledLines;
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(StyledGridGroup, null, /*#__PURE__*/_react["default"].createElement(_grid.GridRows, {
|
|
72
|
+
scale: scale.y,
|
|
73
|
+
width: size.width,
|
|
74
|
+
tickValues: unlabeledLines,
|
|
75
|
+
lineStyle: {
|
|
76
|
+
stroke: _renderUi.color.fadedPrimary(),
|
|
77
|
+
strokeWidth: 1
|
|
78
|
+
}
|
|
79
|
+
}), /*#__PURE__*/_react["default"].createElement(_grid.GridRows, {
|
|
80
|
+
scale: scale.y,
|
|
81
|
+
width: size.width,
|
|
82
|
+
tickValues: labeledLines,
|
|
83
|
+
lineStyle: {
|
|
84
|
+
stroke: _renderUi.color.visualElementsColors.GRIDLINES_COLOR,
|
|
85
|
+
strokeWidth: 1
|
|
86
|
+
}
|
|
87
|
+
}), /*#__PURE__*/_react["default"].createElement(_grid.GridColumns, {
|
|
88
|
+
scale: xBand,
|
|
89
|
+
height: size.height,
|
|
90
|
+
offset: xBand.bandwidth() / 2,
|
|
91
|
+
tickValues: columnTickValues
|
|
92
|
+
}));
|
|
93
|
+
}
|
|
94
|
+
}]);
|
|
95
|
+
}(_react["default"].Component);
|
|
96
|
+
(0, _defineProperty2["default"])(Grid, "propTypes", {
|
|
97
|
+
className: _propTypes["default"].string,
|
|
98
|
+
graphProps: _plot.types.GraphPropsType.isRequired,
|
|
99
|
+
xBand: _propTypes["default"].func,
|
|
100
|
+
columnTickValues: _propTypes["default"].array,
|
|
101
|
+
rowTickValues: _propTypes["default"].array
|
|
102
|
+
});
|
|
103
|
+
(0, _defineProperty2["default"])(Grid, "defaultProps", {});
|
|
104
|
+
var _default = exports["default"] = Grid;
|
|
105
|
+
//# sourceMappingURL=grid.js.map
|
package/lib/grid.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grid.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_grid","_plot","_renderUi","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","apply","Boolean","prototype","valueOf","call","StyledGridGroup","styled","stroke","color","primaryLight","Grid","exports","_React$Component","_classCallCheck2","arguments","_inherits2","_createClass2","key","value","render","_this$props","props","graphProps","xBand","rowTickValues","columnTickValues","_ref","_ref$scale","scale","_ref$size","size","_ref$range","range","_range$step","step","_range$labelStep","labelStep","highlightNonLabel","_reduce","reduce","acc","unlabeledLines","push","labeledLines","createElement","GridRows","y","width","tickValues","lineStyle","fadedPrimary","strokeWidth","visualElementsColors","GRIDLINES_COLOR","GridColumns","height","offset","bandwidth","React","Component","_defineProperty2","className","PropTypes","string","types","GraphPropsType","isRequired","func","array","_default"],"sources":["../src/grid.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { GridRows, GridColumns } from '@visx/grid';\n\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\n\nconst StyledGridGroup = styled('g')(() => ({\n stroke: color.primaryLight(),\n}));\n\nexport class Grid extends React.Component {\n static propTypes = {\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 { graphProps, xBand, rowTickValues, columnTickValues } = this.props;\n const { scale = {}, size = {}, range = {} } = graphProps || {};\n const { step = 0, labelStep = 0 } = range;\n const highlightNonLabel = step && labelStep && step < labelStep;\n // if highlightNonLabel is true, we need to separate the unlabled lines in order to render them in a different color\n const { unlabeledLines, labeledLines } = (rowTickValues || []).reduce(\n (acc, value) => {\n if (highlightNonLabel && value % labelStep !== 0) {\n acc.unlabeledLines.push(value);\n } else {\n acc.labeledLines.push(value);\n }\n return acc;\n },\n { unlabeledLines: [], labeledLines: [] },\n );\n\n return (\n <StyledGridGroup>\n <GridRows\n scale={scale.y}\n width={size.width}\n tickValues={unlabeledLines}\n lineStyle={{\n stroke: color.fadedPrimary(),\n strokeWidth: 1,\n }}\n />\n <GridRows\n scale={scale.y}\n width={size.width}\n tickValues={labeledLines}\n lineStyle={{\n stroke: color.visualElementsColors.GRIDLINES_COLOR,\n strokeWidth: 1,\n }}\n />\n <GridColumns scale={xBand} height={size.height} offset={xBand.bandwidth() / 2} tickValues={columnTickValues} />\n </StyledGridGroup>\n );\n }\n}\n\nexport default Grid;\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAA2C,SAAAM,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,EAAAK,yBAAA,KAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAAA,SAAAG,0BAAA,cAAAL,CAAA,IAAAU,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAP,OAAA,CAAAC,SAAA,CAAAG,OAAA,iCAAAV,CAAA,aAAAK,yBAAA,YAAAA,0BAAA,aAAAL,CAAA;AAE3C,IAAMc,eAAe,GAAG,IAAAC,cAAM,EAAC,GAAG,CAAC,CAAC;EAAA,OAAO;IACzCC,MAAM,EAAEC,eAAK,CAACC,YAAY,CAAC;EAC7B,CAAC;AAAA,CAAC,CAAC;AAAC,IAESC,IAAI,GAAAC,OAAA,CAAAD,IAAA,0BAAAE,gBAAA;EAAA,SAAAF,KAAA;IAAA,IAAAG,gBAAA,mBAAAH,IAAA;IAAA,OAAApB,UAAA,OAAAoB,IAAA,EAAAI,SAAA;EAAA;EAAA,IAAAC,UAAA,aAAAL,IAAA,EAAAE,gBAAA;E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CAACK,IAAI;EACrB1C,gBAAgB,EAAEqC,qBAAS,CAACM,KAAK;EACjC5C,aAAa,EAAEsC,qBAAS,CAACM;AAC3B,CAAC;AAAA,IAAAR,gBAAA,aAPUlD,IAAI,kBASO,CAAC,CAAC;AAAA,IAAA2D,QAAA,GAAA1D,OAAA,cA8CXD,IAAI","ignoreList":[]}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "Chart", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _chart["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "ChartType", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _chartType["default"];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "ConfigureChartPanel", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function get() {
|
|
23
|
+
return _chartSetup["default"];
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "KeyLegend", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function get() {
|
|
29
|
+
return _keyLegend["default"];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "chartTypes", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _chartTypes["default"];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
var _chart = _interopRequireDefault(require("./chart"));
|
|
39
|
+
var _chartTypes = _interopRequireDefault(require("./chart-types"));
|
|
40
|
+
var _chartSetup = _interopRequireDefault(require("./chart-setup"));
|
|
41
|
+
var _chartType = _interopRequireDefault(require("./chart-type"));
|
|
42
|
+
var _keyLegend = _interopRequireDefault(require("./key-legend"));
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["_chart","_interopRequireDefault","require","_chartTypes","_chartSetup","_chartType","_keyLegend"],"sources":["../src/index.js"],"sourcesContent":["import Chart from './chart';\nimport chartTypes from './chart-types';\nimport ConfigureChartPanel from './chart-setup';\nimport ChartType from './chart-type';\nimport KeyLegend from './key-legend';\n\nexport { Chart, chartTypes, ChartType, ConfigureChartPanel, KeyLegend };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.object.define-property.js");
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _styles = require("@mui/material/styles");
|
|
12
|
+
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
13
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
14
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
15
|
+
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
16
|
+
var StyledContainer = (0, _styles.styled)('div')(function (_ref) {
|
|
17
|
+
var theme = _ref.theme;
|
|
18
|
+
return {
|
|
19
|
+
backgroundColor: _renderUi.color.defaults.WHITE,
|
|
20
|
+
padding: theme.spacing(2),
|
|
21
|
+
width: '355px',
|
|
22
|
+
boxShadow: 'inset 0px 1px 5px 0px #9297A6',
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
gap: '16px'
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
var StyledRow = (0, _styles.styled)('div')(function () {
|
|
29
|
+
return {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
gap: '12px'
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
var StyledTitle = (0, _styles.styled)('div')(function (_ref2) {
|
|
36
|
+
var theme = _ref2.theme;
|
|
37
|
+
return {
|
|
38
|
+
fontSize: theme.typography.h6.fontSize,
|
|
39
|
+
fontWeight: '700'
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
var StyledSmallText = (0, _styles.styled)('div')(function () {
|
|
43
|
+
return {
|
|
44
|
+
marginLeft: '2px'
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
var StyledCorrectIcon = (0, _styles.styled)(_Check["default"])(function (_ref3) {
|
|
48
|
+
var theme = _ref3.theme;
|
|
49
|
+
return {
|
|
50
|
+
backgroundColor: _renderUi.color.correct(),
|
|
51
|
+
borderRadius: theme.spacing(2),
|
|
52
|
+
color: _renderUi.color.defaults.WHITE
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
var StyledIncorrectIcon = (0, _styles.styled)(_Close["default"])(function (_ref4) {
|
|
56
|
+
var theme = _ref4.theme;
|
|
57
|
+
return {
|
|
58
|
+
backgroundColor: _renderUi.color.incorrectWithIcon(),
|
|
59
|
+
borderRadius: theme.spacing(2),
|
|
60
|
+
color: _renderUi.color.defaults.WHITE
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
var StyledLastRow = (0, _styles.styled)('div')(function () {
|
|
64
|
+
return {
|
|
65
|
+
marginLeft: '3px',
|
|
66
|
+
display: 'flex',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
gap: '12px'
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
var translator = _translator["default"].translator;
|
|
72
|
+
var KeyLegend = function KeyLegend(_ref5) {
|
|
73
|
+
var language = _ref5.language;
|
|
74
|
+
return /*#__PURE__*/_react["default"].createElement(StyledContainer, null, /*#__PURE__*/_react["default"].createElement(StyledTitle, null, "Key"), /*#__PURE__*/_react["default"].createElement(StyledRow, null, /*#__PURE__*/_react["default"].createElement(StyledIncorrectIcon, null), /*#__PURE__*/_react["default"].createElement("div", null, translator.t('charting.keyLegend.incorrectAnswer', {
|
|
75
|
+
lng: language
|
|
76
|
+
}))), /*#__PURE__*/_react["default"].createElement(StyledRow, null, /*#__PURE__*/_react["default"].createElement(StyledCorrectIcon, null), /*#__PURE__*/_react["default"].createElement("div", null, translator.t('charting.keyLegend.correctAnswer', {
|
|
77
|
+
lng: language
|
|
78
|
+
}))), /*#__PURE__*/_react["default"].createElement(StyledLastRow, null, /*#__PURE__*/_react["default"].createElement(StyledCorrectIcon, {
|
|
79
|
+
fontSize: 'small'
|
|
80
|
+
}), /*#__PURE__*/_react["default"].createElement(StyledSmallText, null, translator.t('charting.keyLegend.correctKeyAnswer', {
|
|
81
|
+
lng: language
|
|
82
|
+
}))));
|
|
83
|
+
};
|
|
84
|
+
KeyLegend.propTypes = {
|
|
85
|
+
language: _propTypes["default"].string
|
|
86
|
+
};
|
|
87
|
+
var _default = exports["default"] = KeyLegend;
|
|
88
|
+
//# sourceMappingURL=key-legend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-legend.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_Check","_Close","_renderUi","_translator","StyledContainer","styled","_ref","theme","backgroundColor","color","defaults","WHITE","padding","spacing","width","boxShadow","display","flexDirection","gap","StyledRow","alignItems","StyledTitle","_ref2","fontSize","typography","h6","fontWeight","StyledSmallText","marginLeft","StyledCorrectIcon","Check","_ref3","correct","borderRadius","StyledIncorrectIcon","Close","_ref4","incorrectWithIcon","StyledLastRow","translator","Translator","KeyLegend","_ref5","language","createElement","t","lng","propTypes","PropTypes","string","_default","exports"],"sources":["../src/key-legend.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport Check from '@mui/icons-material/Check';\nimport Close from '@mui/icons-material/Close';\nimport { color } from '@pie-lib/render-ui';\nimport Translator from '@pie-lib/translator';\n\nconst StyledContainer = styled('div')(({ theme }) => ({\n backgroundColor: color.defaults.WHITE,\n padding: theme.spacing(2),\n width: '355px',\n boxShadow: 'inset 0px 1px 5px 0px #9297A6',\n display: 'flex',\n flexDirection: 'column',\n gap: '16px',\n}));\n\nconst StyledRow = styled('div')(() => ({\n display: 'flex',\n alignItems: 'center',\n gap: '12px',\n}));\n\nconst StyledTitle = styled('div')(({ theme }) => ({\n fontSize: theme.typography.h6.fontSize,\n fontWeight: '700',\n}));\n\nconst StyledSmallText = styled('div')(() => ({\n marginLeft: '2px',\n}));\n\nconst StyledCorrectIcon = styled(Check)(({ theme }) => ({\n backgroundColor: color.correct(),\n borderRadius: theme.spacing(2),\n color: color.defaults.WHITE,\n}));\n\nconst StyledIncorrectIcon = styled(Close)(({ theme }) => ({\n backgroundColor: color.incorrectWithIcon(),\n borderRadius: theme.spacing(2),\n color: color.defaults.WHITE,\n}));\n\nconst StyledLastRow = styled('div')(() => ({\n marginLeft: '3px',\n display: 'flex',\n alignItems: 'center',\n gap: '12px',\n}));\n\nconst { translator } = Translator;\n\nconst KeyLegend = ({ language }) => (\n <StyledContainer>\n <StyledTitle>Key</StyledTitle>\n <StyledRow>\n <StyledIncorrectIcon />\n <div>{translator.t('charting.keyLegend.incorrectAnswer', { lng: language })}</div>\n </StyledRow>\n <StyledRow>\n <StyledCorrectIcon />\n <div>{translator.t('charting.keyLegend.correctAnswer', { lng: language })}</div>\n </StyledRow>\n <StyledLastRow>\n <StyledCorrectIcon fontSize={'small'} />\n <StyledSmallText>{translator.t('charting.keyLegend.correctKeyAnswer', { lng: language })}</StyledSmallText>\n </StyledLastRow>\n </StyledContainer>\n);\n\nKeyLegend.propTypes = {\n language: PropTypes.string,\n};\n\nexport default KeyLegend;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAP,sBAAA,CAAAC,OAAA;AAEA,IAAMO,eAAe,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,UAAAC,IAAA;EAAA,IAAGC,KAAK,GAAAD,IAAA,CAALC,KAAK;EAAA,OAAQ;IACpDC,eAAe,EAAEC,eAAK,CAACC,QAAQ,CAACC,KAAK;IACrCC,OAAO,EAAEL,KAAK,CAACM,OAAO,CAAC,CAAC,CAAC;IACzBC,KAAK,EAAE,OAAO;IACdC,SAAS,EAAE,+BAA+B;IAC1CC,OAAO,EAAE,MAAM;IACfC,aAAa,EAAE,QAAQ;IACvBC,GAAG,EAAE;EACP,CAAC;AAAA,CAAC,CAAC;AAEH,IAAMC,SAAS,GAAG,IAAAd,cAAM,EAAC,KAAK,CAAC,CAAC;EAAA,OAAO;IACrCW,OAAO,EAAE,MAAM;IACfI,UAAU,EAAE,QAAQ;IACpBF,GAAG,EAAE;EACP,CAAC;AAAA,CAAC,CAAC;AAEH,IAAMG,WAAW,GAA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