@pie-lib/math-input 6.31.2-next.0 → 6.33.0-mui-update.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -7
- package/lib/horizontal-keypad.js +16 -44
- package/lib/horizontal-keypad.js.map +1 -1
- package/lib/index.js +3 -25
- package/lib/index.js.map +1 -1
- package/lib/keypad/index.js +250 -314
- package/lib/keypad/index.js.map +1 -1
- package/lib/keypad/keys-layout.js +2 -12
- package/lib/keypad/keys-layout.js.map +1 -1
- package/lib/keys/basic-operators.js +5 -13
- package/lib/keys/basic-operators.js.map +1 -1
- package/lib/keys/chars.js +5 -10
- package/lib/keys/chars.js.map +1 -1
- package/lib/keys/comparison.js +6 -16
- package/lib/keys/comparison.js.map +1 -1
- package/lib/keys/constants.js +4 -10
- package/lib/keys/constants.js.map +1 -1
- package/lib/keys/digits.js +1 -7
- package/lib/keys/digits.js.map +1 -1
- package/lib/keys/edit.js +1 -4
- package/lib/keys/edit.js.map +1 -1
- package/lib/keys/exponent.js +4 -10
- package/lib/keys/exponent.js.map +1 -1
- package/lib/keys/fractions.js +3 -8
- package/lib/keys/fractions.js.map +1 -1
- package/lib/keys/geometry.js +25 -54
- package/lib/keys/geometry.js.map +1 -1
- package/lib/keys/grades.js +10 -46
- package/lib/keys/grades.js.map +1 -1
- package/lib/keys/index.js +13 -32
- package/lib/keys/index.js.map +1 -1
- package/lib/keys/log.js +3 -8
- package/lib/keys/log.js.map +1 -1
- package/lib/keys/logic.js +2 -6
- package/lib/keys/logic.js.map +1 -1
- package/lib/keys/matrices.js +2 -6
- package/lib/keys/matrices.js.map +1 -1
- package/lib/keys/misc.js +10 -22
- package/lib/keys/misc.js.map +1 -1
- package/lib/keys/navigation.js +2 -7
- package/lib/keys/navigation.js.map +1 -1
- package/lib/keys/operators.js +1 -4
- package/lib/keys/operators.js.map +1 -1
- package/lib/keys/statistics.js +5 -12
- package/lib/keys/statistics.js.map +1 -1
- package/lib/keys/sub-sup.js +2 -6
- package/lib/keys/sub-sup.js.map +1 -1
- package/lib/keys/trigonometry.js +6 -14
- package/lib/keys/trigonometry.js.map +1 -1
- package/lib/keys/utils.js +7 -40
- package/lib/keys/utils.js.map +1 -1
- package/lib/keys/vars.js +3 -8
- package/lib/keys/vars.js.map +1 -1
- package/lib/math-input.js +52 -103
- package/lib/math-input.js.map +1 -1
- package/lib/mq/common-mq-styles.js +7 -18
- package/lib/mq/common-mq-styles.js.map +1 -1
- package/lib/mq/custom-elements.js +1 -4
- package/lib/mq/custom-elements.js.map +1 -1
- package/lib/mq/index.js +0 -4
- package/lib/mq/index.js.map +1 -1
- package/lib/mq/input.js +22 -75
- package/lib/mq/input.js.map +1 -1
- package/lib/mq/static.js +31 -92
- package/lib/mq/static.js.map +1 -1
- package/lib/shared/constants.js +3 -6
- package/lib/updateSpans.js +1 -5
- package/lib/updateSpans.js.map +1 -1
- package/package.json +9 -7
- package/src/keypad/index.jsx +156 -151
- package/src/math-input.jsx +35 -44
- package/src/mq/input.jsx +9 -9
package/lib/keypad/index.js
CHANGED
|
@@ -1,193 +1,165 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports["default"] = exports.KeyPad = void 0;
|
|
11
|
-
|
|
12
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
-
|
|
16
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
-
|
|
22
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
-
|
|
24
13
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
-
|
|
26
14
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
-
|
|
15
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
28
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
-
|
|
17
|
+
var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime/helpers/objectDestructuringEmpty"));
|
|
30
18
|
var _react = _interopRequireDefault(require("react"));
|
|
31
|
-
|
|
32
19
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
var _IconButton = _interopRequireDefault(require("@material-ui/core/IconButton"));
|
|
37
|
-
|
|
38
|
-
var _styles = require("@material-ui/core/styles");
|
|
39
|
-
|
|
20
|
+
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
21
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
22
|
+
var _styles = require("@mui/material/styles");
|
|
40
23
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
41
|
-
|
|
42
|
-
var _colorManipulator = require("@material-ui/core/styles/colorManipulator");
|
|
43
|
-
|
|
44
|
-
var _green = _interopRequireDefault(require("@material-ui/core/colors/green"));
|
|
45
|
-
|
|
46
24
|
var _debug = _interopRequireDefault(require("debug"));
|
|
47
|
-
|
|
48
25
|
var _lodash = _interopRequireDefault(require("lodash"));
|
|
49
|
-
|
|
50
26
|
var _mathquill = _interopRequireDefault(require("@pie-framework/mathquill"));
|
|
51
|
-
|
|
52
27
|
var mq = _interopRequireWildcard(require("../mq"));
|
|
53
|
-
|
|
54
28
|
var _keys = require("../keys");
|
|
55
|
-
|
|
56
29
|
var _constants = _interopRequireDefault(require("./../shared/constants"));
|
|
57
|
-
|
|
58
30
|
var _commonMqStyles = require("../mq/common-mq-styles");
|
|
59
|
-
|
|
60
31
|
var _keysLayout = require("./keys-layout");
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
function ownKeys(
|
|
67
|
-
|
|
68
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
69
|
-
|
|
70
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
71
|
-
|
|
72
|
-
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; } }
|
|
73
|
-
|
|
32
|
+
var _colors = require("@mui/material/colors");
|
|
33
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
34
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
35
|
+
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)); }
|
|
36
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
37
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
38
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
74
39
|
var log = (0, _debug["default"])('pie-lib:math-inline:keypad');
|
|
75
|
-
var
|
|
40
|
+
var StyledLatexButton = (0, _styles.styled)(_Button["default"])(function (_ref) {
|
|
41
|
+
(0, _objectDestructuringEmpty2["default"])(_ref);
|
|
76
42
|
return {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
43
|
+
textTransform: 'none',
|
|
44
|
+
padding: 0,
|
|
45
|
+
margin: 0,
|
|
46
|
+
fontSize: '110% !important'
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
var LatexButtonContent = (0, _styles.styled)(mq.Static)(function (_ref2) {
|
|
50
|
+
var theme = _ref2.theme,
|
|
51
|
+
latex = _ref2.latex;
|
|
52
|
+
var baseStyles = {
|
|
53
|
+
pointerEvents: 'none',
|
|
54
|
+
textTransform: 'none !important',
|
|
55
|
+
color: _renderUi.color.text(),
|
|
56
|
+
'& .mq-scaled.mq-sqrt-prefix': {
|
|
57
|
+
transform: 'scale(1, 0.9) !important'
|
|
82
58
|
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
'
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
borderTop: '2px solid black',
|
|
106
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
|
|
107
|
-
'&.mq-arrow-both': {
|
|
108
|
-
top: '0px !important',
|
|
109
|
-
'& *': {
|
|
110
|
-
lineHeight: '1 !important',
|
|
111
|
-
borderTop: 'none !important' // fixing PD-4873 - in OT, it has border-top 1px and adds extra line,
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
'&:before': {
|
|
115
|
-
fontSize: '80%',
|
|
116
|
-
left: 'calc(-13%) !important',
|
|
117
|
-
top: '-0.31em !important'
|
|
118
|
-
},
|
|
119
|
-
'&:after': {
|
|
120
|
-
fontSize: '80% !important',
|
|
121
|
-
right: 'calc(-13%) !important',
|
|
122
|
-
top: '-1.5em'
|
|
123
|
-
},
|
|
124
|
-
'&.mq-empty:before': {
|
|
125
|
-
fontSize: '80%',
|
|
126
|
-
left: 'calc(-13%)',
|
|
127
|
-
top: '-0.26em'
|
|
128
|
-
},
|
|
129
|
-
'&.mq-empty:after': {
|
|
130
|
-
fontSize: '80%',
|
|
131
|
-
right: 'calc(-13%)',
|
|
132
|
-
top: '-0.26em'
|
|
133
|
-
},
|
|
134
|
-
'&.mq-empty': {
|
|
135
|
-
minHeight: '1.4em'
|
|
136
|
-
}
|
|
59
|
+
'& .mq-sup-only .mq-sup': {
|
|
60
|
+
marginBottom: '0.9px !important'
|
|
61
|
+
},
|
|
62
|
+
'& .mq-empty': {
|
|
63
|
+
backgroundColor: "".concat((0, _styles.alpha)(_colors.pink[300], 0.4), " !important")
|
|
64
|
+
},
|
|
65
|
+
'& .mq-overline .mq-overline-inner': {
|
|
66
|
+
borderTop: '2px solid black'
|
|
67
|
+
},
|
|
68
|
+
'& .mq-non-leaf.mq-overline': {
|
|
69
|
+
borderTop: 'none !important'
|
|
70
|
+
},
|
|
71
|
+
'& .mq-overarrow': {
|
|
72
|
+
width: '30px',
|
|
73
|
+
marginTop: '0 !important',
|
|
74
|
+
borderTop: '2px solid black',
|
|
75
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
|
|
76
|
+
'&.mq-arrow-both': {
|
|
77
|
+
top: '0px !important',
|
|
78
|
+
'& *': {
|
|
79
|
+
lineHeight: '1 !important',
|
|
80
|
+
borderTop: 'none !important'
|
|
137
81
|
},
|
|
138
|
-
'
|
|
82
|
+
'&:before': {
|
|
139
83
|
fontSize: '80%',
|
|
84
|
+
left: 'calc(-13%) !important',
|
|
85
|
+
top: '-0.31em !important'
|
|
86
|
+
},
|
|
87
|
+
'&:after': {
|
|
88
|
+
fontSize: '80% !important',
|
|
140
89
|
right: 'calc(-13%) !important',
|
|
141
|
-
top: '-
|
|
90
|
+
top: '-1.5em'
|
|
91
|
+
},
|
|
92
|
+
'&.mq-empty:before': {
|
|
93
|
+
fontSize: '80%',
|
|
94
|
+
left: 'calc(-13%)',
|
|
95
|
+
top: '-0.26em'
|
|
142
96
|
},
|
|
143
|
-
'
|
|
144
|
-
|
|
97
|
+
'&.mq-empty:after': {
|
|
98
|
+
fontSize: '80%',
|
|
99
|
+
right: 'calc(-13%)',
|
|
100
|
+
top: '-0.26em'
|
|
145
101
|
},
|
|
146
|
-
'
|
|
147
|
-
|
|
102
|
+
'&.mq-empty': {
|
|
103
|
+
minHeight: '1.4em'
|
|
148
104
|
}
|
|
149
105
|
},
|
|
150
|
-
'
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
right: '-6px',
|
|
155
|
-
fontSize: '80% !important',
|
|
156
|
-
top: '-3px'
|
|
157
|
-
},
|
|
158
|
-
'& .mq-overarrow.mq-arrow-right.mq-empty:before': {
|
|
159
|
-
right: '-5px',
|
|
160
|
-
fontSize: '80% !important',
|
|
161
|
-
top: '-3px'
|
|
106
|
+
'&.mq-arrow-right:before': {
|
|
107
|
+
fontSize: '80%',
|
|
108
|
+
right: 'calc(-13%) !important',
|
|
109
|
+
top: '-0.26em !important'
|
|
162
110
|
},
|
|
163
|
-
'& .mq-overarrow
|
|
164
|
-
|
|
165
|
-
fontSize: '80% !important',
|
|
166
|
-
top: '-3px'
|
|
111
|
+
'& .mq-overarrow-inner': {
|
|
112
|
+
border: 'none !important'
|
|
167
113
|
},
|
|
168
|
-
'& .mq-
|
|
169
|
-
|
|
170
|
-
paddingTop: '1.5px !important'
|
|
171
|
-
},
|
|
172
|
-
'& .mq-parallelogram': {
|
|
173
|
-
lineHeight: 0.85
|
|
174
|
-
},
|
|
175
|
-
'& .mq-overarc': {
|
|
176
|
-
borderTop: '2px solid black !important',
|
|
177
|
-
'& .mq-overline': {
|
|
178
|
-
borderTop: 'none !important' // fixing PD-4873 - in OT, it has border-top 1px and adds extra line
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
'& .mq-overline-inner': {
|
|
182
|
-
borderTop: 'none !important',
|
|
183
|
-
paddingTop: '0 !important'
|
|
184
|
-
}
|
|
114
|
+
'& .mq-overarrow-inner .mq-overarrow-inner-right': {
|
|
115
|
+
display: 'none !important'
|
|
185
116
|
}
|
|
186
117
|
},
|
|
187
|
-
|
|
188
|
-
|
|
118
|
+
'& .mq-root-block': {
|
|
119
|
+
padding: '5px !important'
|
|
120
|
+
},
|
|
121
|
+
'& .mq-overarrow.mq-arrow-both.mq-empty:after': {
|
|
122
|
+
right: '-6px',
|
|
123
|
+
fontSize: '80% !important',
|
|
124
|
+
top: '-3px'
|
|
125
|
+
},
|
|
126
|
+
'& .mq-overarrow.mq-arrow-right.mq-empty:before': {
|
|
127
|
+
right: '-5px',
|
|
128
|
+
fontSize: '80% !important',
|
|
129
|
+
top: '-3px'
|
|
130
|
+
},
|
|
131
|
+
'& .mq-overarrow.mq-arrow-both.mq-empty:before': {
|
|
132
|
+
left: '-6px',
|
|
133
|
+
fontSize: '80% !important',
|
|
134
|
+
top: '-3px'
|
|
135
|
+
},
|
|
136
|
+
'& .mq-longdiv-inner': {
|
|
137
|
+
borderTop: '1px solid !important',
|
|
138
|
+
paddingTop: '1.5px !important'
|
|
139
|
+
},
|
|
140
|
+
'& .mq-parallelogram': {
|
|
141
|
+
lineHeight: 0.85
|
|
189
142
|
},
|
|
190
|
-
|
|
143
|
+
'& .mq-overarc': {
|
|
144
|
+
borderTop: '2px solid black !important',
|
|
145
|
+
'& .mq-overline': {
|
|
146
|
+
borderTop: 'none !important'
|
|
147
|
+
},
|
|
148
|
+
'& .mq-overline-inner': {
|
|
149
|
+
borderTop: 'none !important',
|
|
150
|
+
paddingTop: '0 !important'
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
// Add specific styles based on latex content
|
|
156
|
+
if (latex === '\\parallel') {
|
|
157
|
+
return _objectSpread(_objectSpread({}, baseStyles), {}, {
|
|
158
|
+
fontStyle: 'italic !important'
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
if (latex === '\\overleftrightarrow{\\overline{}}') {
|
|
162
|
+
return _objectSpread(_objectSpread({}, baseStyles), {}, {
|
|
191
163
|
'& .mq-overarrow.mq-arrow-both': {
|
|
192
164
|
'& .mq-overline-inner': {
|
|
193
165
|
borderTop: 'none !important',
|
|
@@ -198,22 +170,13 @@ var LatexButton = (0, _styles.withStyles)(function (theme) {
|
|
|
198
170
|
top: '0px !important'
|
|
199
171
|
}
|
|
200
172
|
}
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
})(function (props) {
|
|
204
|
-
var buttonClass;
|
|
205
|
-
|
|
206
|
-
if (props.latex === '\\parallel') {
|
|
207
|
-
buttonClass = (0, _classnames["default"])(props.classes.latexButton, props.mqClassName, props.classes.parallelButton);
|
|
208
|
-
} else if (props.latex === '\\overleftrightarrow{\\overline{}}') {
|
|
209
|
-
buttonClass = (0, _classnames["default"])(props.classes.latexButton, props.mqClassName, props.classes.leftRightArrowButton);
|
|
210
|
-
} else {
|
|
211
|
-
buttonClass = (0, _classnames["default"])(props.classes.latexButton, props.mqClassName);
|
|
173
|
+
});
|
|
212
174
|
}
|
|
213
|
-
|
|
175
|
+
return baseStyles;
|
|
176
|
+
});
|
|
177
|
+
var LatexButton = function LatexButton(props) {
|
|
214
178
|
try {
|
|
215
179
|
var MQ = _mathquill["default"].getInterface(2);
|
|
216
|
-
|
|
217
180
|
var span = document.createElement('span');
|
|
218
181
|
span.innerHTML = '';
|
|
219
182
|
var mathField = MQ.StaticMath(span);
|
|
@@ -223,17 +186,14 @@ var LatexButton = (0, _styles.withStyles)(function (theme) {
|
|
|
223
186
|
// received latex has errors - do not create button
|
|
224
187
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null);
|
|
225
188
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
className: (0, _classnames["default"])(props.classes.root, props.className),
|
|
189
|
+
return /*#__PURE__*/_react["default"].createElement(StyledLatexButton, {
|
|
190
|
+
className: props.className,
|
|
229
191
|
onClick: props.onClick,
|
|
230
192
|
"aria-label": props.ariaLabel
|
|
231
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
232
|
-
className: buttonClass,
|
|
193
|
+
}, /*#__PURE__*/_react["default"].createElement(LatexButtonContent, {
|
|
233
194
|
latex: props.latex
|
|
234
195
|
}));
|
|
235
|
-
}
|
|
236
|
-
|
|
196
|
+
};
|
|
237
197
|
var createCustomLayout = function createCustomLayout(layoutObj) {
|
|
238
198
|
if (layoutObj) {
|
|
239
199
|
return {
|
|
@@ -242,72 +202,144 @@ var createCustomLayout = function createCustomLayout(layoutObj) {
|
|
|
242
202
|
gridAutoFlow: 'initial'
|
|
243
203
|
};
|
|
244
204
|
}
|
|
245
|
-
|
|
246
205
|
return {};
|
|
247
206
|
};
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
207
|
+
var KeyPadContainer = (0, _styles.styled)('div')(function (_ref3) {
|
|
208
|
+
(0, _objectDestructuringEmpty2["default"])(_ref3);
|
|
209
|
+
return _objectSpread(_objectSpread({}, _commonMqStyles.commonMqKeyboardStyles), {}, {
|
|
210
|
+
width: '100%',
|
|
211
|
+
display: 'grid',
|
|
212
|
+
gridTemplateRows: 'repeat(5, minmax(40px, 60px))',
|
|
213
|
+
gridRowGap: '0px',
|
|
214
|
+
gridColumnGap: '0px',
|
|
215
|
+
gridAutoFlow: 'column',
|
|
216
|
+
'&.character': {
|
|
217
|
+
textTransform: 'initial !important',
|
|
218
|
+
gridTemplateRows: 'repeat(5, minmax(40px, 50px)) !important'
|
|
219
|
+
},
|
|
220
|
+
'&.language': {
|
|
221
|
+
gridTemplateRows: 'repeat(4, minmax(40px, 50px)) !important',
|
|
222
|
+
'& *': {
|
|
223
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
var StyledButton = (0, _styles.styled)(_Button["default"])(function (_ref4) {
|
|
229
|
+
var theme = _ref4.theme,
|
|
230
|
+
category = _ref4.category,
|
|
231
|
+
isDelete = _ref4.isDelete,
|
|
232
|
+
isComma = _ref4.isComma,
|
|
233
|
+
isDot = _ref4.isDot;
|
|
234
|
+
return _objectSpread({
|
|
235
|
+
minWidth: 'auto',
|
|
236
|
+
fontSize: isComma || isDot ? '200% !important' : '140% !important',
|
|
237
|
+
lineHeight: isComma || isDot ? '100%' : 'normal',
|
|
238
|
+
color: _renderUi.color.text(),
|
|
239
|
+
backgroundColor: category === 'operators' ? (0, _styles.lighten)(_colors.pink[300], 0.5) :
|
|
240
|
+
// this code with green seems to not be applied to current implementation, so I commented it out, but left it here just in case
|
|
241
|
+
// category === 'comparison' ? lighten(green[500], 0.5) :
|
|
242
|
+
(0, _styles.lighten)(_colors.indigo[300], 0.5),
|
|
243
|
+
'&:hover': {
|
|
244
|
+
backgroundColor: category === 'operators' ? (0, _styles.lighten)(_colors.pink[300], 0.7) :
|
|
245
|
+
// category === 'comparison' ? lighten(green[500], 0.7) :
|
|
246
|
+
(0, _styles.lighten)(_colors.indigo[300], 0.7)
|
|
247
|
+
},
|
|
248
|
+
borderRadius: 0
|
|
249
|
+
}, isDelete && {
|
|
250
|
+
'& > span': {
|
|
251
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
var StyledLatexButtonWrapper = (0, _styles.styled)(_Button["default"])(function (_ref5) {
|
|
256
|
+
var theme = _ref5.theme,
|
|
257
|
+
category = _ref5.category;
|
|
258
|
+
return {
|
|
259
|
+
minWidth: 'auto',
|
|
260
|
+
borderRadius: 0,
|
|
261
|
+
backgroundColor: category === 'operators' ? (0, _styles.lighten)(_colors.pink[300], 0.5) :
|
|
262
|
+
// category === 'comparison' ? lighten(green[500], 0.5) :
|
|
263
|
+
(0, _styles.lighten)(_colors.indigo[300], 0.5),
|
|
264
|
+
'&:hover': {
|
|
265
|
+
backgroundColor: category === 'operators' ? (0, _styles.lighten)(_colors.pink[300], 0.7) :
|
|
266
|
+
// category === 'comparison' ? lighten(green[500], 0.7) :
|
|
267
|
+
(0, _styles.lighten)(_colors.indigo[300], 0.7)
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
});
|
|
271
|
+
var StyledIconButton = (0, _styles.styled)(_IconButton["default"])(function (_ref6) {
|
|
272
|
+
var theme = _ref6.theme,
|
|
273
|
+
category = _ref6.category;
|
|
274
|
+
return {
|
|
275
|
+
minWidth: 'auto',
|
|
276
|
+
backgroundColor: category === 'operators' ? (0, _styles.lighten)(_colors.pink[300], 0.5) :
|
|
277
|
+
// category === 'comparison' ? lighten(green[500], 0.5) :
|
|
278
|
+
(0, _styles.lighten)(_colors.indigo[300], 0.5),
|
|
279
|
+
'&:hover': {
|
|
280
|
+
backgroundColor: category === 'operators' ? (0, _styles.lighten)(_colors.pink[300], 0.7) :
|
|
281
|
+
// category === 'comparison' ? lighten(green[500], 0.7) :
|
|
282
|
+
(0, _styles.lighten)(_colors.indigo[300], 0.7)
|
|
283
|
+
},
|
|
284
|
+
borderRadius: 0,
|
|
285
|
+
'& .icon': {
|
|
286
|
+
height: '30px'
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
});
|
|
290
|
+
var KeyPad = exports.KeyPad = /*#__PURE__*/function (_React$Component) {
|
|
254
291
|
function KeyPad(props) {
|
|
255
292
|
var _this;
|
|
256
|
-
|
|
257
293
|
(0, _classCallCheck2["default"])(this, KeyPad);
|
|
258
|
-
_this =
|
|
259
|
-
(0, _defineProperty2["default"])(
|
|
294
|
+
_this = _callSuper(this, KeyPad, [props]);
|
|
295
|
+
(0, _defineProperty2["default"])(_this, "handleKeypadInteraction", function () {
|
|
260
296
|
// Check if the setKeypadInteraction prop is available, which is used for both
|
|
261
297
|
// the language keypad and the special characters keypad
|
|
262
298
|
if (_this.props.setKeypadInteraction) {
|
|
263
299
|
_this.props.setKeypadInteraction(true);
|
|
264
300
|
}
|
|
265
301
|
});
|
|
266
|
-
(0, _defineProperty2["default"])(
|
|
302
|
+
(0, _defineProperty2["default"])(_this, "buttonClick", function (key) {
|
|
267
303
|
log('[buttonClick]', key);
|
|
268
304
|
var onPress = _this.props.onPress;
|
|
269
305
|
onPress(key);
|
|
270
306
|
});
|
|
271
|
-
(0, _defineProperty2["default"])(
|
|
307
|
+
(0, _defineProperty2["default"])(_this, "flowKeys", function (base, extras) {
|
|
272
308
|
var transposed = [].concat((0, _toConsumableArray2["default"])((0, _keysLayout.sortKeys)(base)), (0, _toConsumableArray2["default"])((0, _keysLayout.sortKeys)(extras)));
|
|
273
309
|
return _lodash["default"].flatten(transposed);
|
|
274
310
|
});
|
|
275
|
-
(0, _defineProperty2["default"])(
|
|
311
|
+
(0, _defineProperty2["default"])(_this, "keyIsNotAllowed", function (key) {
|
|
276
312
|
var noDecimal = _this.props.noDecimal;
|
|
277
|
-
|
|
278
313
|
if ((key.write === '.' && key.label === '.' || key.write === ',' && key.label === ',') && noDecimal) {
|
|
279
314
|
return true;
|
|
280
315
|
}
|
|
281
|
-
|
|
282
316
|
return false;
|
|
283
317
|
});
|
|
284
318
|
_this.keypadRef = /*#__PURE__*/_react["default"].createRef();
|
|
285
319
|
return _this;
|
|
286
320
|
}
|
|
287
|
-
|
|
288
|
-
(0, _createClass2["default"])(KeyPad, [{
|
|
321
|
+
(0, _inherits2["default"])(KeyPad, _React$Component);
|
|
322
|
+
return (0, _createClass2["default"])(KeyPad, [{
|
|
289
323
|
key: "componentDidMount",
|
|
290
324
|
value: function componentDidMount() {
|
|
291
325
|
var _this$keypadRef;
|
|
292
|
-
|
|
293
326
|
var keyPadElement = (_this$keypadRef = this.keypadRef) === null || _this$keypadRef === void 0 ? void 0 : _this$keypadRef.current;
|
|
294
327
|
var mainContainer = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest(".".concat(_constants["default"].MAIN_CONTAINER_CLASS));
|
|
295
|
-
var currentToolbar = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest('.pie-toolbar');
|
|
328
|
+
var currentToolbar = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest('.pie-toolbar');
|
|
296
329
|
|
|
330
|
+
// need only for math keyboard so we need also controlledKeypadMode
|
|
297
331
|
if (this.props.controlledKeypadMode && mainContainer && currentToolbar) {
|
|
298
332
|
var mainContainerPosition = mainContainer.getBoundingClientRect();
|
|
299
333
|
var currentToolbarPosition = currentToolbar.getBoundingClientRect();
|
|
300
334
|
var difference = mainContainerPosition.top + mainContainerPosition.height - (currentToolbarPosition.top + currentToolbarPosition.height);
|
|
301
|
-
|
|
302
335
|
if (difference < 0) {
|
|
303
|
-
var totalHeight = mainContainerPosition.height + mainContainerPosition.top - difference;
|
|
304
|
-
|
|
336
|
+
var totalHeight = mainContainerPosition.height + mainContainerPosition.top - difference;
|
|
337
|
+
// increase the height of the main container if keyboard needs it
|
|
305
338
|
if (mainContainer) {
|
|
306
339
|
mainContainer.style.height = "".concat(totalHeight, "px");
|
|
307
340
|
}
|
|
308
341
|
}
|
|
309
342
|
}
|
|
310
|
-
|
|
311
343
|
if (keyPadElement) {
|
|
312
344
|
keyPadElement.addEventListener('touchstart', this.handleKeypadInteraction, true);
|
|
313
345
|
keyPadElement.addEventListener('mousedown', this.handleKeypadInteraction, true);
|
|
@@ -317,17 +349,14 @@ var KeyPad = /*#__PURE__*/function (_React$Component) {
|
|
|
317
349
|
key: "componentWillUnmount",
|
|
318
350
|
value: function componentWillUnmount() {
|
|
319
351
|
var _this$keypadRef2;
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
352
|
+
var keyPadElement = (_this$keypadRef2 = this.keypadRef) === null || _this$keypadRef2 === void 0 ? void 0 : _this$keypadRef2.current;
|
|
353
|
+
// need only for math keyboard
|
|
323
354
|
if (this.props.controlledKeypadMode && keyPadElement) {
|
|
324
355
|
var mainContainer = keyPadElement.closest(".".concat(_constants["default"].MAIN_CONTAINER_CLASS));
|
|
325
|
-
|
|
326
356
|
if (mainContainer) {
|
|
327
357
|
mainContainer.style.height = 'unset';
|
|
328
358
|
}
|
|
329
359
|
}
|
|
330
|
-
|
|
331
360
|
if (keyPadElement) {
|
|
332
361
|
keyPadElement.removeEventListener('touchstart', this.handleKeypadInteraction, true);
|
|
333
362
|
keyPadElement.removeEventListener('mousedown', this.handleKeypadInteraction, true);
|
|
@@ -337,82 +366,69 @@ var KeyPad = /*#__PURE__*/function (_React$Component) {
|
|
|
337
366
|
key: "render",
|
|
338
367
|
value: function render() {
|
|
339
368
|
var _this2 = this;
|
|
340
|
-
|
|
341
369
|
var _this$props = this.props,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
mode = _this$props.mode;
|
|
370
|
+
className = _this$props.className,
|
|
371
|
+
baseSet = _this$props.baseSet,
|
|
372
|
+
additionalKeys = _this$props.additionalKeys,
|
|
373
|
+
layoutForKeyPad = _this$props.layoutForKeyPad,
|
|
374
|
+
onFocus = _this$props.onFocus,
|
|
375
|
+
mode = _this$props.mode;
|
|
349
376
|
var noBaseSet = ['non-negative-integers', 'integers', 'decimals', 'fractions', 'item-authoring', 'language'];
|
|
350
377
|
var keysWithoutBaseSet = noBaseSet.includes(mode);
|
|
351
|
-
var allKeys = keysWithoutBaseSet ? this.flowKeys([], additionalKeys || []) : this.flowKeys(baseSet, additionalKeys || []);
|
|
352
|
-
|
|
378
|
+
var allKeys = keysWithoutBaseSet ? this.flowKeys([], additionalKeys || []) : this.flowKeys(baseSet, additionalKeys || []);
|
|
353
379
|
var shift = allKeys.length % 5 ? 1 : 0;
|
|
354
|
-
|
|
355
380
|
var style = _objectSpread({
|
|
356
381
|
gridTemplateColumns: "repeat(".concat(Math.floor(allKeys.length / 5) + shift, ", minmax(min-content, 150px))")
|
|
357
382
|
}, createCustomLayout(layoutForKeyPad));
|
|
358
|
-
|
|
359
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
383
|
+
return /*#__PURE__*/_react["default"].createElement(KeyPadContainer, {
|
|
360
384
|
ref: this.keypadRef,
|
|
361
|
-
className: (0, _classnames["default"])(
|
|
385
|
+
className: (0, _classnames["default"])(className, mode),
|
|
362
386
|
style: style,
|
|
363
387
|
onFocus: onFocus
|
|
364
388
|
}, allKeys.map(function (k, index) {
|
|
365
389
|
var onClick = _this2.buttonClick.bind(_this2, k);
|
|
366
|
-
|
|
367
390
|
if (!k) {
|
|
368
391
|
return /*#__PURE__*/_react["default"].createElement("span", {
|
|
369
392
|
key: "empty-".concat(index)
|
|
370
393
|
});
|
|
371
394
|
}
|
|
372
|
-
|
|
373
395
|
var common = _objectSpread(_objectSpread({
|
|
374
396
|
onClick: onClick,
|
|
375
|
-
className: (0, _classnames["default"])(classes.labelButton, !keysWithoutBaseSet && classes[k.category], classes[k.extraClass], k.label === ',' && classes.comma, k.label === '.' && classes.dot),
|
|
376
397
|
disabled: _this2.keyIsNotAllowed(k),
|
|
377
398
|
key: "".concat(k.label || k.latex || k.command, "-").concat(index)
|
|
378
399
|
}, k.actions || {}), k.extraProps || {});
|
|
379
|
-
|
|
380
400
|
if (k.latex) {
|
|
381
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
},
|
|
385
|
-
|
|
386
|
-
ariaLabel: k.ariaLabel ? k.ariaLabel : k.name || k.label
|
|
401
|
+
return /*#__PURE__*/_react["default"].createElement(StyledLatexButtonWrapper, (0, _extends2["default"])({}, common, {
|
|
402
|
+
category: !keysWithoutBaseSet ? k.category : undefined,
|
|
403
|
+
"aria-label": k.ariaLabel ? k.ariaLabel : k.name || k.label
|
|
404
|
+
}), /*#__PURE__*/_react["default"].createElement(LatexButtonContent, {
|
|
405
|
+
latex: k.latex
|
|
387
406
|
}));
|
|
388
407
|
}
|
|
389
|
-
|
|
390
408
|
if (k.label) {
|
|
391
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
409
|
+
return /*#__PURE__*/_react["default"].createElement(StyledButton, (0, _extends2["default"])({}, common, {
|
|
410
|
+
category: !keysWithoutBaseSet ? k.category : undefined,
|
|
411
|
+
isDelete: k.label === '⌫',
|
|
412
|
+
isComma: k.label === ',',
|
|
413
|
+
isDot: k.label === '.',
|
|
395
414
|
"aria-label": k.ariaLabel ? k.ariaLabel : k.name || k.label
|
|
396
415
|
}), k.label);
|
|
397
416
|
} else {
|
|
398
417
|
var Icon = k.icon ? k.icon : 'div';
|
|
399
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
418
|
+
return /*#__PURE__*/_react["default"].createElement(StyledIconButton, (0, _extends2["default"])({
|
|
400
419
|
tabIndex: '-1'
|
|
401
420
|
}, common, {
|
|
402
|
-
|
|
421
|
+
category: !keysWithoutBaseSet ? k.category : undefined,
|
|
422
|
+
size: "large"
|
|
403
423
|
}), /*#__PURE__*/_react["default"].createElement(Icon, {
|
|
404
|
-
className:
|
|
424
|
+
className: "icon"
|
|
405
425
|
}));
|
|
406
426
|
}
|
|
407
427
|
}));
|
|
408
428
|
}
|
|
409
429
|
}]);
|
|
410
|
-
return KeyPad;
|
|
411
430
|
}(_react["default"].Component);
|
|
412
|
-
|
|
413
|
-
exports.KeyPad = KeyPad;
|
|
414
431
|
(0, _defineProperty2["default"])(KeyPad, "propTypes", {
|
|
415
|
-
classes: _propTypes["default"].object.isRequired,
|
|
416
432
|
className: _propTypes["default"].string,
|
|
417
433
|
controlledKeypadMode: _propTypes["default"].bool,
|
|
418
434
|
baseSet: _propTypes["default"].array,
|
|
@@ -428,85 +444,5 @@ exports.KeyPad = KeyPad;
|
|
|
428
444
|
baseSet: _keys.baseSet,
|
|
429
445
|
noDecimal: false
|
|
430
446
|
});
|
|
431
|
-
|
|
432
|
-
var styles = function styles(theme) {
|
|
433
|
-
return {
|
|
434
|
-
keys: _objectSpread(_objectSpread({}, _commonMqStyles.commonMqKeyboardStyles), {}, {
|
|
435
|
-
width: '100%',
|
|
436
|
-
display: 'grid',
|
|
437
|
-
gridTemplateRows: 'repeat(5, minmax(40px, 60px))',
|
|
438
|
-
gridRowGap: '0px',
|
|
439
|
-
gridColumnGap: '0px',
|
|
440
|
-
gridAutoFlow: 'column'
|
|
441
|
-
}),
|
|
442
|
-
character: {
|
|
443
|
-
textTransform: 'initial !important',
|
|
444
|
-
gridTemplateRows: 'repeat(5, minmax(40px, 50px)) !important'
|
|
445
|
-
},
|
|
446
|
-
language: {
|
|
447
|
-
gridTemplateRows: 'repeat(4, minmax(40px, 50px)) !important',
|
|
448
|
-
'& *': {
|
|
449
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
holder: {
|
|
453
|
-
position: 'relative',
|
|
454
|
-
width: '100%',
|
|
455
|
-
height: '100%',
|
|
456
|
-
backgroundColor: '#cef',
|
|
457
|
-
borderRadius: 0,
|
|
458
|
-
padding: "".concat(theme.spacing.unit, "px 0 ").concat(theme.spacing.unit, "px 0")
|
|
459
|
-
},
|
|
460
|
-
labelButton: {
|
|
461
|
-
minWidth: 'auto',
|
|
462
|
-
fontSize: '140% !important',
|
|
463
|
-
backgroundColor: (0, _colorManipulator.lighten)(theme.palette.primary.light, 0.5),
|
|
464
|
-
'&:hover': {
|
|
465
|
-
backgroundColor: (0, _colorManipulator.lighten)(theme.palette.primary.light, 0.7)
|
|
466
|
-
},
|
|
467
|
-
borderRadius: 0
|
|
468
|
-
},
|
|
469
|
-
latexButton: {
|
|
470
|
-
minWidth: 'auto',
|
|
471
|
-
borderRadius: 0,
|
|
472
|
-
backgroundColor: (0, _colorManipulator.lighten)(theme.palette.primary.light, 0.5),
|
|
473
|
-
'&:hover': {
|
|
474
|
-
backgroundColor: (0, _colorManipulator.lighten)(theme.palette.primary.light, 0.7)
|
|
475
|
-
}
|
|
476
|
-
},
|
|
477
|
-
deleteButton: {
|
|
478
|
-
'& > span': {
|
|
479
|
-
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important'
|
|
480
|
-
}
|
|
481
|
-
},
|
|
482
|
-
base: {},
|
|
483
|
-
operators: {
|
|
484
|
-
backgroundColor: (0, _colorManipulator.lighten)(theme.palette.secondary.light, 0.5),
|
|
485
|
-
'&:hover': {
|
|
486
|
-
backgroundColor: (0, _colorManipulator.lighten)(theme.palette.secondary.light, 0.7)
|
|
487
|
-
}
|
|
488
|
-
},
|
|
489
|
-
comparison: {
|
|
490
|
-
backgroundColor: (0, _colorManipulator.lighten)(_green["default"][500], 0.5),
|
|
491
|
-
'&:hover': {
|
|
492
|
-
backgroundColor: (0, _colorManipulator.lighten)(_green["default"][500], 0.7)
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
comma: {
|
|
496
|
-
fontSize: '200% !important',
|
|
497
|
-
lineHeight: '100%'
|
|
498
|
-
},
|
|
499
|
-
dot: {
|
|
500
|
-
fontSize: '200% !important',
|
|
501
|
-
lineHeight: '100%'
|
|
502
|
-
},
|
|
503
|
-
icon: {
|
|
504
|
-
height: '30px'
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
var _default = (0, _styles.withStyles)(styles)(KeyPad);
|
|
510
|
-
|
|
511
|
-
exports["default"] = _default;
|
|
447
|
+
var _default = exports["default"] = KeyPad;
|
|
512
448
|
//# sourceMappingURL=index.js.map
|