@khanacademy/math-input 6.0.2 → 7.0.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 +21 -0
- package/dist/components/input/math-input.d.ts +2 -2
- package/dist/components/input/math-input.js.flow +2 -2
- package/dist/components/keypad/index.d.ts +2 -26
- package/dist/components/keypad/index.js.flow +2 -31
- package/dist/components/keypad/keypad.d.ts +26 -0
- package/dist/components/keypad/keypad.js.flow +37 -0
- package/dist/components/keypad/mobile-keypad.d.ts +39 -0
- package/dist/components/keypad/mobile-keypad.js.flow +57 -0
- package/dist/components/keypad/shared-keys.d.ts +1 -1
- package/dist/components/keypad/shared-keys.js.flow +1 -1
- package/dist/components/keypad-legacy/index.d.ts +1 -0
- package/dist/components/keypad-legacy/index.js.flow +7 -0
- package/dist/components/keypad-legacy/provided-keypad.d.ts +2 -2
- package/dist/components/keypad-legacy/provided-keypad.js.flow +10 -2
- package/dist/components/keypad-legacy/touchable-keypad-button.d.ts +1 -1
- package/dist/components/keypad-legacy/touchable-keypad-button.js.flow +1 -1
- package/dist/components/keypad-legacy/two-page-keypad.d.ts +1 -1
- package/dist/components/keypad-legacy/two-page-keypad.js.flow +1 -1
- package/dist/components/tabbar/index.d.ts +2 -0
- package/dist/components/tabbar/index.js.flow +8 -0
- package/dist/es/index.js +306 -173
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +322 -187
- package/dist/index.js.flow +9 -9
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.js.flow +12 -0
- package/package.json +2 -2
- package/src/components/input/math-input.tsx +4 -5
- package/src/components/keypad/index.tsx +2 -173
- package/src/components/keypad/keypad.stories.tsx +2 -1
- package/src/components/keypad/keypad.tsx +171 -0
- package/src/components/keypad/mobile-keypad.tsx +165 -0
- package/src/components/keypad/shared-keys.tsx +1 -1
- package/src/components/keypad-legacy/index.ts +1 -0
- package/src/components/keypad-legacy/provided-keypad.tsx +7 -2
- package/src/components/keypad-legacy/two-page-keypad.tsx +3 -2
- package/src/components/prop-types.js +0 -1
- package/src/components/tabbar/index.ts +2 -0
- package/src/full-math-input.stories.tsx +78 -0
- package/src/index.ts +28 -9
- package/src/types.ts +11 -0
- package/tsconfig-build.tsbuildinfo +1 -1
- package/src/math-input.stories.tsx +0 -67
package/dist/es/index.js
CHANGED
|
@@ -8,46 +8,14 @@ import { useEffect } from 'react';
|
|
|
8
8
|
import ReactDOM from 'react-dom';
|
|
9
9
|
import $ from 'jquery';
|
|
10
10
|
import MathQuill from 'mathquill';
|
|
11
|
-
import PropTypes from 'prop-types';
|
|
12
11
|
import { connect, Provider } from 'react-redux';
|
|
13
12
|
import katex from 'katex';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
14
|
import { View as View$1 } from '@khanacademy/wonder-blocks-core';
|
|
15
15
|
import Clickable from '@khanacademy/wonder-blocks-clickable';
|
|
16
16
|
import { TransitionGroup, CSSTransition } from 'react-transition-group';
|
|
17
17
|
import * as Redux from 'redux';
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Enum that defines the various contexts in which a cursor can exist. The
|
|
21
|
-
* active context is determined first by looking at the cursor's siblings (e.g.,
|
|
22
|
-
* for the `BEFORE_FRACTION` context), and then at its direct parent. Though a
|
|
23
|
-
* cursor could in theory be nested in multiple contexts, we only care about the
|
|
24
|
-
* immediate context.
|
|
25
|
-
*
|
|
26
|
-
* TODO(charlie): Add a context to represent being inside of a radical. Right
|
|
27
|
-
* now, we show the dismiss button rather than allowing the user to jump out of
|
|
28
|
-
* the radical.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
const CursorContext = {
|
|
32
|
-
// The cursor is not in any of the other viable contexts.
|
|
33
|
-
NONE: "NONE",
|
|
34
|
-
// The cursor is within a set of parentheses.
|
|
35
|
-
IN_PARENS: "IN_PARENS",
|
|
36
|
-
// The cursor is within a superscript (e.g., an exponent).
|
|
37
|
-
IN_SUPER_SCRIPT: "IN_SUPER_SCRIPT",
|
|
38
|
-
// The cursor is within a subscript (e.g., the base of a custom logarithm).
|
|
39
|
-
IN_SUB_SCRIPT: "IN_SUB_SCRIPT",
|
|
40
|
-
// The cursor is in the numerator of a fraction.
|
|
41
|
-
IN_NUMERATOR: "IN_NUMERATOR",
|
|
42
|
-
// The cursor is in the denominator of a fraction.
|
|
43
|
-
IN_DENOMINATOR: "IN_DENOMINATOR",
|
|
44
|
-
// The cursor is sitting before a fraction; that is, the cursor is within
|
|
45
|
-
// what looks to be a mixed number preceding a fraction. This will only be
|
|
46
|
-
// the case when the only math between the cursor and the fraction to its
|
|
47
|
-
// write is non-leaf math (numbers and variables).
|
|
48
|
-
BEFORE_FRACTION: "BEFORE_FRACTION"
|
|
49
|
-
};
|
|
50
|
-
|
|
51
19
|
function _extends() {
|
|
52
20
|
_extends = Object.assign || function (target) {
|
|
53
21
|
for (var i = 1; i < arguments.length; i++) {
|
|
@@ -72,7 +40,7 @@ class Text extends React.Component {
|
|
|
72
40
|
numberOfLines,
|
|
73
41
|
style
|
|
74
42
|
} = this.props;
|
|
75
|
-
const className = css(styles$
|
|
43
|
+
const className = css(styles$i.initial, ...(Array.isArray(style) ? style : [style]), numberOfLines === 1 && styles$i.singleLineStyle);
|
|
76
44
|
return /*#__PURE__*/React.createElement("span", {
|
|
77
45
|
className: className,
|
|
78
46
|
style: this.props.dynamicStyle
|
|
@@ -81,7 +49,7 @@ class Text extends React.Component {
|
|
|
81
49
|
}
|
|
82
50
|
|
|
83
51
|
// https://github.com/necolas/react-native-web/blob/master/src/components/Text/index.js
|
|
84
|
-
const styles$
|
|
52
|
+
const styles$i = StyleSheet.create({
|
|
85
53
|
initial: {
|
|
86
54
|
color: "inherit",
|
|
87
55
|
display: "inline",
|
|
@@ -350,6 +318,38 @@ class DragListener {
|
|
|
350
318
|
}
|
|
351
319
|
}
|
|
352
320
|
|
|
321
|
+
/**
|
|
322
|
+
* Enum that defines the various contexts in which a cursor can exist. The
|
|
323
|
+
* active context is determined first by looking at the cursor's siblings (e.g.,
|
|
324
|
+
* for the `BEFORE_FRACTION` context), and then at its direct parent. Though a
|
|
325
|
+
* cursor could in theory be nested in multiple contexts, we only care about the
|
|
326
|
+
* immediate context.
|
|
327
|
+
*
|
|
328
|
+
* TODO(charlie): Add a context to represent being inside of a radical. Right
|
|
329
|
+
* now, we show the dismiss button rather than allowing the user to jump out of
|
|
330
|
+
* the radical.
|
|
331
|
+
*/
|
|
332
|
+
|
|
333
|
+
const CursorContext = {
|
|
334
|
+
// The cursor is not in any of the other viable contexts.
|
|
335
|
+
NONE: "NONE",
|
|
336
|
+
// The cursor is within a set of parentheses.
|
|
337
|
+
IN_PARENS: "IN_PARENS",
|
|
338
|
+
// The cursor is within a superscript (e.g., an exponent).
|
|
339
|
+
IN_SUPER_SCRIPT: "IN_SUPER_SCRIPT",
|
|
340
|
+
// The cursor is within a subscript (e.g., the base of a custom logarithm).
|
|
341
|
+
IN_SUB_SCRIPT: "IN_SUB_SCRIPT",
|
|
342
|
+
// The cursor is in the numerator of a fraction.
|
|
343
|
+
IN_NUMERATOR: "IN_NUMERATOR",
|
|
344
|
+
// The cursor is in the denominator of a fraction.
|
|
345
|
+
IN_DENOMINATOR: "IN_DENOMINATOR",
|
|
346
|
+
// The cursor is sitting before a fraction; that is, the cursor is within
|
|
347
|
+
// what looks to be a mixed number preceding a fraction. This will only be
|
|
348
|
+
// the case when the only math between the cursor and the fraction to its
|
|
349
|
+
// write is non-leaf math (numbers and variables).
|
|
350
|
+
BEFORE_FRACTION: "BEFORE_FRACTION"
|
|
351
|
+
};
|
|
352
|
+
|
|
353
353
|
// We only need one MathQuill instance (referred to as MQ in the docs)
|
|
354
354
|
// and that contains some MQ constants and the MathField constructor
|
|
355
355
|
const mathQuillInstance = MathQuill.getInterface(2);
|
|
@@ -1516,7 +1516,8 @@ class MathInput extends React.Component {
|
|
|
1516
1516
|
};
|
|
1517
1517
|
this._getKeypadBounds = () => {
|
|
1518
1518
|
if (!this._keypadBounds) {
|
|
1519
|
-
|
|
1519
|
+
var _this$props$keypadEle;
|
|
1520
|
+
const node = (_this$props$keypadEle = this.props.keypadElement) == null ? void 0 : _this$props$keypadEle.getDOMNode();
|
|
1520
1521
|
this._cacheKeypadBounds(node);
|
|
1521
1522
|
}
|
|
1522
1523
|
return this._keypadBounds;
|
|
@@ -1580,9 +1581,10 @@ class MathInput extends React.Component {
|
|
|
1580
1581
|
});
|
|
1581
1582
|
};
|
|
1582
1583
|
this.focus = () => {
|
|
1584
|
+
var _this$props$keypadEle2;
|
|
1583
1585
|
// Pass this component's handleKey method to the keypad so it can call
|
|
1584
1586
|
// it whenever it needs to trigger a keypress action.
|
|
1585
|
-
this.props.keypadElement.setKeyHandler(key => {
|
|
1587
|
+
(_this$props$keypadEle2 = this.props.keypadElement) == null ? void 0 : _this$props$keypadEle2.setKeyHandler(key => {
|
|
1586
1588
|
const cursor = this.mathField.pressKey(key);
|
|
1587
1589
|
|
|
1588
1590
|
// Trigger an `onChange` if the value in the input changed, and hide
|
|
@@ -2094,7 +2096,7 @@ class MathInput extends React.Component {
|
|
|
2094
2096
|
// to the open the keyboard, and then remove the second half of this label.
|
|
2095
2097
|
const ariaLabel = i18n._("Math input box") + " " + i18n._("Tap with one or two fingers to open keyboard");
|
|
2096
2098
|
return /*#__PURE__*/React.createElement(View, {
|
|
2097
|
-
style: styles$
|
|
2099
|
+
style: styles$h.input,
|
|
2098
2100
|
onTouchStart: this.handleTouchStart,
|
|
2099
2101
|
onTouchMove: this.handleTouchMove,
|
|
2100
2102
|
onTouchEnd: this.handleTouchEnd,
|
|
@@ -2140,7 +2142,7 @@ const numeralHeightPx = 20;
|
|
|
2140
2142
|
const totalDesiredPadding = 12;
|
|
2141
2143
|
const minHeightPx = numeralHeightPx + totalDesiredPadding * 2;
|
|
2142
2144
|
const minWidthPx = 64;
|
|
2143
|
-
const styles$
|
|
2145
|
+
const styles$h = StyleSheet.create({
|
|
2144
2146
|
input: {
|
|
2145
2147
|
position: "relative",
|
|
2146
2148
|
display: "inline-block",
|
|
@@ -2172,21 +2174,6 @@ const inlineStyles$1 = {
|
|
|
2172
2174
|
}
|
|
2173
2175
|
};
|
|
2174
2176
|
|
|
2175
|
-
/**
|
|
2176
|
-
* React PropTypes that may be shared between components.
|
|
2177
|
-
*/
|
|
2178
|
-
|
|
2179
|
-
// NOTE(jared): This is no longer guaranteed to be React element
|
|
2180
|
-
// NOTE(matthewc): only seems to be used in Perseus
|
|
2181
|
-
const keypadElementPropType = PropTypes.shape({
|
|
2182
|
-
activate: PropTypes.func.isRequired,
|
|
2183
|
-
dismiss: PropTypes.func.isRequired,
|
|
2184
|
-
configure: PropTypes.func.isRequired,
|
|
2185
|
-
setCursor: PropTypes.func.isRequired,
|
|
2186
|
-
setKeyHandler: PropTypes.func.isRequired,
|
|
2187
|
-
getDOMNode: PropTypes.func.isRequired
|
|
2188
|
-
});
|
|
2189
|
-
|
|
2190
2177
|
const getDefaultOperatorFields = ({
|
|
2191
2178
|
key,
|
|
2192
2179
|
keyType: _keyType = "OPERATOR",
|
|
@@ -2736,7 +2723,7 @@ class CornerDecal extends React.Component {
|
|
|
2736
2723
|
const {
|
|
2737
2724
|
style
|
|
2738
2725
|
} = this.props;
|
|
2739
|
-
const containerStyle = [styles$
|
|
2726
|
+
const containerStyle = [styles$g.container, ...(Array.isArray(style) ? style : [style])];
|
|
2740
2727
|
return /*#__PURE__*/React.createElement(View, {
|
|
2741
2728
|
style: containerStyle
|
|
2742
2729
|
}, /*#__PURE__*/React.createElement("svg", {
|
|
@@ -2752,7 +2739,7 @@ class CornerDecal extends React.Component {
|
|
|
2752
2739
|
}
|
|
2753
2740
|
|
|
2754
2741
|
const triangleSizePx = 7;
|
|
2755
|
-
const styles$
|
|
2742
|
+
const styles$g = StyleSheet.create({
|
|
2756
2743
|
container: {
|
|
2757
2744
|
position: "absolute",
|
|
2758
2745
|
top: 0,
|
|
@@ -2825,13 +2812,13 @@ class MathIcon extends React.Component {
|
|
|
2825
2812
|
const {
|
|
2826
2813
|
style
|
|
2827
2814
|
} = this.props;
|
|
2828
|
-
const containerStyle = [row$7, centered$4, styles$
|
|
2815
|
+
const containerStyle = [row$7, centered$4, styles$f.size, styles$f.base, ...(Array.isArray(style) ? style : [style])];
|
|
2829
2816
|
return /*#__PURE__*/React.createElement(View, {
|
|
2830
2817
|
style: containerStyle
|
|
2831
2818
|
});
|
|
2832
2819
|
}
|
|
2833
2820
|
}
|
|
2834
|
-
const styles$
|
|
2821
|
+
const styles$f = StyleSheet.create({
|
|
2835
2822
|
size: {
|
|
2836
2823
|
height: iconSizeHeightPx,
|
|
2837
2824
|
width: iconSizeWidthPx
|
|
@@ -4079,48 +4066,48 @@ const JumpOutDenominator = () => {
|
|
|
4079
4066
|
*/
|
|
4080
4067
|
|
|
4081
4068
|
var Iconography = /*#__PURE__*/Object.freeze({
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4069
|
+
__proto__: null,
|
|
4070
|
+
COS: Cos,
|
|
4071
|
+
LOG: Log,
|
|
4072
|
+
EQUAL: Equal,
|
|
4073
|
+
BACKSPACE: Backspace,
|
|
4074
|
+
SQRT: Sqrt,
|
|
4075
|
+
EXP: Exp,
|
|
4076
|
+
NEQ: Neq,
|
|
4077
|
+
GEQ: Geq,
|
|
4078
|
+
LN: Ln,
|
|
4079
|
+
DISMISS: Dismiss,
|
|
4080
|
+
SIN: Sin,
|
|
4081
|
+
LT: Lt,
|
|
4082
|
+
CUBE_ROOT: CubeRoot,
|
|
4083
|
+
PLUS: Plus,
|
|
4084
|
+
TAN: Tan,
|
|
4085
|
+
LEFT: Left,
|
|
4086
|
+
UP: Up,
|
|
4087
|
+
DOWN: Down,
|
|
4088
|
+
LEFT_PAREN: LeftParen,
|
|
4089
|
+
RIGHT_PAREN: RightParen,
|
|
4090
|
+
GT: Gt,
|
|
4091
|
+
DIVIDE: Divide,
|
|
4092
|
+
PERIOD: Period,
|
|
4093
|
+
PERCENT: Percent,
|
|
4094
|
+
TIMES: Times,
|
|
4095
|
+
EXP_3: Exp3,
|
|
4096
|
+
EXP_2: Exp2,
|
|
4097
|
+
RIGHT: Right,
|
|
4098
|
+
CDOT: Cdot,
|
|
4099
|
+
LOG_N: LogN,
|
|
4100
|
+
LEQ: Leq,
|
|
4101
|
+
MINUS: Minus,
|
|
4102
|
+
NEGATIVE: Minus,
|
|
4103
|
+
RADICAL: Radical,
|
|
4104
|
+
FRAC: FracInclusive,
|
|
4105
|
+
JUMP_OUT_PARENTHESES: JumpOutParentheses,
|
|
4106
|
+
JUMP_OUT_EXPONENT: JumpOutExponent,
|
|
4107
|
+
JUMP_OUT_BASE: JumpOutBase,
|
|
4108
|
+
JUMP_INTO_NUMERATOR: JumpIntoNumerator,
|
|
4109
|
+
JUMP_OUT_NUMERATOR: JumpOutNumerator,
|
|
4110
|
+
JUMP_OUT_DENOMINATOR: JumpOutDenominator
|
|
4124
4111
|
});
|
|
4125
4112
|
|
|
4126
4113
|
/**
|
|
@@ -4154,13 +4141,13 @@ class TextIcon extends React.Component {
|
|
|
4154
4141
|
character,
|
|
4155
4142
|
style
|
|
4156
4143
|
} = this.props;
|
|
4157
|
-
const containerStyle = [row$6, centered$3, styles$
|
|
4144
|
+
const containerStyle = [row$6, centered$3, styles$e.size, styles$e.base, ...(Array.isArray(style) ? style : [style])];
|
|
4158
4145
|
return /*#__PURE__*/React.createElement(View, {
|
|
4159
4146
|
style: containerStyle
|
|
4160
4147
|
}, /*#__PURE__*/React.createElement(Text, null, character));
|
|
4161
4148
|
}
|
|
4162
4149
|
}
|
|
4163
|
-
const styles$
|
|
4150
|
+
const styles$e = StyleSheet.create({
|
|
4164
4151
|
size: {
|
|
4165
4152
|
height: iconSizeHeightPx,
|
|
4166
4153
|
width: iconSizeWidthPx
|
|
@@ -4183,7 +4170,7 @@ class Icon extends React.PureComponent {
|
|
|
4183
4170
|
icon,
|
|
4184
4171
|
style
|
|
4185
4172
|
} = this.props;
|
|
4186
|
-
const styleWithFocus = [focused ? styles$
|
|
4173
|
+
const styleWithFocus = [focused ? styles$d.focused : styles$d.unfocused, ...(Array.isArray(style) ? style : [style])];
|
|
4187
4174
|
switch (icon.type) {
|
|
4188
4175
|
case IconType.MATH:
|
|
4189
4176
|
return /*#__PURE__*/React.createElement(MathIcon, {
|
|
@@ -4209,7 +4196,7 @@ class Icon extends React.PureComponent {
|
|
|
4209
4196
|
}
|
|
4210
4197
|
}
|
|
4211
4198
|
}
|
|
4212
|
-
const styles$
|
|
4199
|
+
const styles$d = StyleSheet.create({
|
|
4213
4200
|
unfocused: {
|
|
4214
4201
|
color: unfocusedColor
|
|
4215
4202
|
},
|
|
@@ -4251,19 +4238,19 @@ class MultiSymbolGrid extends React.Component {
|
|
|
4251
4238
|
focused: focused
|
|
4252
4239
|
});
|
|
4253
4240
|
} else {
|
|
4254
|
-
const primaryIconStyle = styles$
|
|
4255
|
-
const secondaryIconStyle = [styles$
|
|
4241
|
+
const primaryIconStyle = styles$c.base;
|
|
4242
|
+
const secondaryIconStyle = [styles$c.base, styles$c.secondary];
|
|
4256
4243
|
if (icons.length === 2) {
|
|
4257
4244
|
return /*#__PURE__*/React.createElement(View, {
|
|
4258
|
-
style: [row$5, styles$
|
|
4245
|
+
style: [row$5, styles$c.size]
|
|
4259
4246
|
}, /*#__PURE__*/React.createElement(View, {
|
|
4260
|
-
style: [column$3, centered$2, fullWidth$3, styles$
|
|
4247
|
+
style: [column$3, centered$2, fullWidth$3, styles$c.middleLeft]
|
|
4261
4248
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4262
4249
|
style: primaryIconStyle,
|
|
4263
4250
|
icon: icons[0],
|
|
4264
4251
|
focused: focused
|
|
4265
4252
|
})), /*#__PURE__*/React.createElement(View, {
|
|
4266
|
-
style: [column$3, centered$2, fullWidth$3, styles$
|
|
4253
|
+
style: [column$3, centered$2, fullWidth$3, styles$c.middleRight]
|
|
4267
4254
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4268
4255
|
style: secondaryIconStyle,
|
|
4269
4256
|
icon: icons[1],
|
|
@@ -4271,17 +4258,17 @@ class MultiSymbolGrid extends React.Component {
|
|
|
4271
4258
|
})));
|
|
4272
4259
|
} else if (icons.length >= 3) {
|
|
4273
4260
|
return /*#__PURE__*/React.createElement(View, {
|
|
4274
|
-
style: [column$3, styles$
|
|
4261
|
+
style: [column$3, styles$c.size]
|
|
4275
4262
|
}, /*#__PURE__*/React.createElement(View, {
|
|
4276
4263
|
style: row$5
|
|
4277
4264
|
}, /*#__PURE__*/React.createElement(View, {
|
|
4278
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4265
|
+
style: [centered$2, fullWidth$3, styles$c.topLeft]
|
|
4279
4266
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4280
4267
|
style: primaryIconStyle,
|
|
4281
4268
|
icon: icons[0],
|
|
4282
4269
|
focused: focused
|
|
4283
4270
|
})), /*#__PURE__*/React.createElement(View, {
|
|
4284
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4271
|
+
style: [centered$2, fullWidth$3, styles$c.topRight]
|
|
4285
4272
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4286
4273
|
style: secondaryIconStyle,
|
|
4287
4274
|
icon: icons[1],
|
|
@@ -4289,13 +4276,13 @@ class MultiSymbolGrid extends React.Component {
|
|
|
4289
4276
|
}))), /*#__PURE__*/React.createElement(View, {
|
|
4290
4277
|
style: row$5
|
|
4291
4278
|
}, /*#__PURE__*/React.createElement(View, {
|
|
4292
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4279
|
+
style: [centered$2, fullWidth$3, styles$c.bottomLeft]
|
|
4293
4280
|
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4294
4281
|
style: secondaryIconStyle,
|
|
4295
4282
|
icon: icons[2],
|
|
4296
4283
|
focused: focused
|
|
4297
4284
|
})), /*#__PURE__*/React.createElement(View, {
|
|
4298
|
-
style: [centered$2, fullWidth$3, styles$
|
|
4285
|
+
style: [centered$2, fullWidth$3, styles$c.bottomRight]
|
|
4299
4286
|
}, icons[3] && /*#__PURE__*/React.createElement(Icon, {
|
|
4300
4287
|
style: secondaryIconStyle,
|
|
4301
4288
|
icon: icons[3],
|
|
@@ -4308,7 +4295,7 @@ class MultiSymbolGrid extends React.Component {
|
|
|
4308
4295
|
}
|
|
4309
4296
|
const verticalInsetPx = 2;
|
|
4310
4297
|
const horizontalInsetPx = 4;
|
|
4311
|
-
const styles$
|
|
4298
|
+
const styles$c = StyleSheet.create({
|
|
4312
4299
|
size: {
|
|
4313
4300
|
height: iconSizeHeightPx,
|
|
4314
4301
|
width: iconSizeWidthPx
|
|
@@ -4369,29 +4356,29 @@ class KeypadButton$1 extends React.PureComponent {
|
|
|
4369
4356
|
this._getFocusStyle = type => {
|
|
4370
4357
|
let focusBackgroundStyle;
|
|
4371
4358
|
if (type === "INPUT_NAVIGATION" || type === "KEYPAD_NAVIGATION") {
|
|
4372
|
-
focusBackgroundStyle = styles$
|
|
4359
|
+
focusBackgroundStyle = styles$b.light;
|
|
4373
4360
|
} else {
|
|
4374
|
-
focusBackgroundStyle = styles$
|
|
4361
|
+
focusBackgroundStyle = styles$b.bright;
|
|
4375
4362
|
}
|
|
4376
|
-
return [styles$
|
|
4363
|
+
return [styles$b.focusBox, focusBackgroundStyle];
|
|
4377
4364
|
};
|
|
4378
4365
|
this._getButtonStyle = (type, borders, style) => {
|
|
4379
4366
|
// Select the appropriate style for the button.
|
|
4380
4367
|
let backgroundStyle;
|
|
4381
4368
|
switch (type) {
|
|
4382
4369
|
case "EMPTY":
|
|
4383
|
-
backgroundStyle = styles$
|
|
4370
|
+
backgroundStyle = styles$b.empty;
|
|
4384
4371
|
break;
|
|
4385
4372
|
case "MANY":
|
|
4386
4373
|
case "VALUE":
|
|
4387
|
-
backgroundStyle = styles$
|
|
4374
|
+
backgroundStyle = styles$b.value;
|
|
4388
4375
|
break;
|
|
4389
4376
|
case "OPERATOR":
|
|
4390
|
-
backgroundStyle = styles$
|
|
4377
|
+
backgroundStyle = styles$b.operator;
|
|
4391
4378
|
break;
|
|
4392
4379
|
case "INPUT_NAVIGATION":
|
|
4393
4380
|
case "KEYPAD_NAVIGATION":
|
|
4394
|
-
backgroundStyle = styles$
|
|
4381
|
+
backgroundStyle = styles$b.control;
|
|
4395
4382
|
break;
|
|
4396
4383
|
case "ECHO":
|
|
4397
4384
|
backgroundStyle = null;
|
|
@@ -4400,13 +4387,13 @@ class KeypadButton$1 extends React.PureComponent {
|
|
|
4400
4387
|
const borderStyle = [];
|
|
4401
4388
|
if (borders.includes(BorderDirection.LEFT)) {
|
|
4402
4389
|
// @ts-expect-error TS2345
|
|
4403
|
-
borderStyle.push(styles$
|
|
4390
|
+
borderStyle.push(styles$b.leftBorder);
|
|
4404
4391
|
}
|
|
4405
4392
|
if (borders.includes(BorderDirection.BOTTOM)) {
|
|
4406
4393
|
// @ts-expect-error TS2345
|
|
4407
|
-
borderStyle.push(styles$
|
|
4394
|
+
borderStyle.push(styles$b.bottomBorder);
|
|
4408
4395
|
}
|
|
4409
|
-
return [styles$
|
|
4396
|
+
return [styles$b.buttonBase, backgroundStyle, ...borderStyle, type === "ECHO" && styles$b.echo, this.buttonSizeStyle,
|
|
4410
4397
|
// React Native allows you to set the 'style' props on user defined
|
|
4411
4398
|
// components.
|
|
4412
4399
|
// See: https://facebook.github.io/react-native/docs/style.html
|
|
@@ -4451,7 +4438,7 @@ class KeypadButton$1 extends React.PureComponent {
|
|
|
4451
4438
|
const renderFocused = !disabled && focused || popoverEnabled || type === "ECHO";
|
|
4452
4439
|
const buttonStyle = this._getButtonStyle(type, borders, style);
|
|
4453
4440
|
const focusStyle = this._getFocusStyle(type);
|
|
4454
|
-
const iconWrapperStyle = [styles$
|
|
4441
|
+
const iconWrapperStyle = [styles$b.iconWrapper, disabled ? styles$b.disabled : undefined];
|
|
4455
4442
|
const eventHandlers = {
|
|
4456
4443
|
onTouchCancel,
|
|
4457
4444
|
onTouchEnd,
|
|
@@ -4462,7 +4449,7 @@ class KeypadButton$1 extends React.PureComponent {
|
|
|
4462
4449
|
style: focusStyle
|
|
4463
4450
|
});
|
|
4464
4451
|
const maybeCornerDecal = !renderFocused && !disabled && childKeys && childKeys.length > 0 && /*#__PURE__*/React.createElement(CornerDecal, {
|
|
4465
|
-
style: styles$
|
|
4452
|
+
style: styles$b.decalInset
|
|
4466
4453
|
});
|
|
4467
4454
|
if (type === "EMPTY") {
|
|
4468
4455
|
return /*#__PURE__*/React.createElement(View, _extends({
|
|
@@ -4511,7 +4498,7 @@ KeypadButton$1.defaultProps = {
|
|
|
4511
4498
|
};
|
|
4512
4499
|
const focusInsetPx = 4;
|
|
4513
4500
|
const focusBoxZIndex = 0;
|
|
4514
|
-
const styles$
|
|
4501
|
+
const styles$b = StyleSheet.create({
|
|
4515
4502
|
buttonBase: {
|
|
4516
4503
|
flex: 1,
|
|
4517
4504
|
cursor: "pointer",
|
|
@@ -4669,7 +4656,7 @@ class TouchableKeypadButton extends React.Component {
|
|
|
4669
4656
|
onTouchMove: evt => gestureManager.onTouchMove(evt),
|
|
4670
4657
|
onTouchCancel: evt => gestureManager.onTouchCancel(evt)
|
|
4671
4658
|
};
|
|
4672
|
-
const styleWithAddons = [...(Array.isArray(style) ? style : [style]), styles$
|
|
4659
|
+
const styleWithAddons = [...(Array.isArray(style) ? style : [style]), styles$a.preventScrolls];
|
|
4673
4660
|
return /*#__PURE__*/React.createElement(KeypadButton$2, _extends({
|
|
4674
4661
|
ref: node => gestureManager.registerDOMNode(id, ReactDOM.findDOMNode(node), childKeyIds),
|
|
4675
4662
|
borders: borders,
|
|
@@ -4720,7 +4707,7 @@ const mapStateToProps$5 = (state, ownProps) => {
|
|
|
4720
4707
|
childKeys
|
|
4721
4708
|
}, extractProps(useFirstChildProps ? childKeys[0] : keyConfig));
|
|
4722
4709
|
};
|
|
4723
|
-
const styles$
|
|
4710
|
+
const styles$a = StyleSheet.create({
|
|
4724
4711
|
preventScrolls: {
|
|
4725
4712
|
// Touch events that start in the touchable buttons shouldn't be
|
|
4726
4713
|
// allowed to produce page scrolls.
|
|
@@ -4868,7 +4855,7 @@ const IconAsset = function IconAsset({
|
|
|
4868
4855
|
}
|
|
4869
4856
|
};
|
|
4870
4857
|
|
|
4871
|
-
const styles$
|
|
4858
|
+
const styles$9 = StyleSheet.create({
|
|
4872
4859
|
base: {
|
|
4873
4860
|
display: "flex",
|
|
4874
4861
|
width: 44,
|
|
@@ -4939,7 +4926,7 @@ class TabbarItem extends React.Component {
|
|
|
4939
4926
|
onClick: onClick,
|
|
4940
4927
|
disabled: itemState === "disabled",
|
|
4941
4928
|
"aria-label": itemType,
|
|
4942
|
-
style: styles$
|
|
4929
|
+
style: styles$9.clickable,
|
|
4943
4930
|
"aria-selected": itemState === "active",
|
|
4944
4931
|
role: "tab"
|
|
4945
4932
|
}, ({
|
|
@@ -4949,14 +4936,14 @@ class TabbarItem extends React.Component {
|
|
|
4949
4936
|
}) => {
|
|
4950
4937
|
const tintColor = imageTintColor(itemState, hovered, focused, pressed);
|
|
4951
4938
|
return /*#__PURE__*/React.createElement(View$1, {
|
|
4952
|
-
style: [styles$
|
|
4939
|
+
style: [styles$9.base, itemState !== "disabled" && hovered && styles$9.hovered, focused && styles$9.focused, pressed && styles$9.pressed]
|
|
4953
4940
|
}, /*#__PURE__*/React.createElement(View$1, {
|
|
4954
|
-
style: [styles$
|
|
4941
|
+
style: [styles$9.innerBox, pressed && styles$9.innerBoxPressed]
|
|
4955
4942
|
}, /*#__PURE__*/React.createElement(IconAsset, {
|
|
4956
4943
|
type: itemType,
|
|
4957
4944
|
tintColor: tintColor
|
|
4958
4945
|
})), itemState === "active" && /*#__PURE__*/React.createElement(View$1, {
|
|
4959
|
-
style: [styles$
|
|
4946
|
+
style: [styles$9.activeIndicator, {
|
|
4960
4947
|
backgroundColor: tintColor
|
|
4961
4948
|
}]
|
|
4962
4949
|
}));
|
|
@@ -4964,7 +4951,7 @@ class TabbarItem extends React.Component {
|
|
|
4964
4951
|
}
|
|
4965
4952
|
}
|
|
4966
4953
|
|
|
4967
|
-
const styles$
|
|
4954
|
+
const styles$8 = StyleSheet.create({
|
|
4968
4955
|
tabbar: {
|
|
4969
4956
|
display: "flex",
|
|
4970
4957
|
flexDirection: "row",
|
|
@@ -4986,10 +4973,10 @@ function Tabbar(props) {
|
|
|
4986
4973
|
style
|
|
4987
4974
|
} = props;
|
|
4988
4975
|
return /*#__PURE__*/React.createElement(View$1, {
|
|
4989
|
-
style: [styles$
|
|
4976
|
+
style: [styles$8.tabbar, style],
|
|
4990
4977
|
role: "tablist"
|
|
4991
4978
|
}, /*#__PURE__*/React.createElement(View$1, {
|
|
4992
|
-
style: [styles$
|
|
4979
|
+
style: [styles$8.pages]
|
|
4993
4980
|
}, items.map(item => /*#__PURE__*/React.createElement(TabbarItem, {
|
|
4994
4981
|
key: `tabbar-item-${item}`,
|
|
4995
4982
|
itemState: item === selectedItem ? "active" : "inactive",
|
|
@@ -5139,7 +5126,7 @@ class MultiSymbolPopover extends React.Component {
|
|
|
5139
5126
|
// TODO(charlie): We have to require this lazily because of a cyclic
|
|
5140
5127
|
// dependence in our components.
|
|
5141
5128
|
return /*#__PURE__*/React.createElement(View, {
|
|
5142
|
-
style: styles$
|
|
5129
|
+
style: styles$7.container
|
|
5143
5130
|
}, keys.map(key => {
|
|
5144
5131
|
return /*#__PURE__*/React.createElement(TouchableKeypadButton$1, {
|
|
5145
5132
|
keyConfig: key,
|
|
@@ -5148,7 +5135,7 @@ class MultiSymbolPopover extends React.Component {
|
|
|
5148
5135
|
}));
|
|
5149
5136
|
}
|
|
5150
5137
|
}
|
|
5151
|
-
const styles$
|
|
5138
|
+
const styles$7 = StyleSheet.create({
|
|
5152
5139
|
container: {
|
|
5153
5140
|
flexDirection: "column-reverse",
|
|
5154
5141
|
position: "relative",
|
|
@@ -5431,7 +5418,7 @@ class TwoPageKeypad extends React.Component {
|
|
|
5431
5418
|
} = this.state;
|
|
5432
5419
|
if (paginationEnabled) {
|
|
5433
5420
|
return /*#__PURE__*/React.createElement(Keypad$2, {
|
|
5434
|
-
style: [column$2, styles$
|
|
5421
|
+
style: [column$2, styles$6.keypad]
|
|
5435
5422
|
}, /*#__PURE__*/React.createElement(Tabbar, {
|
|
5436
5423
|
items: ["Numbers", "Operators"],
|
|
5437
5424
|
selectedItem: selectedPage,
|
|
@@ -5440,24 +5427,24 @@ class TwoPageKeypad extends React.Component {
|
|
|
5440
5427
|
selectedPage: selectedItem
|
|
5441
5428
|
});
|
|
5442
5429
|
},
|
|
5443
|
-
style: styles$
|
|
5430
|
+
style: styles$6.tabbar
|
|
5444
5431
|
}), /*#__PURE__*/React.createElement(View, {
|
|
5445
|
-
style: styles$
|
|
5432
|
+
style: styles$6.borderTop
|
|
5446
5433
|
}, selectedPage === "Numbers" && rightPage, selectedPage === "Operators" && leftPage));
|
|
5447
5434
|
} else {
|
|
5448
5435
|
return /*#__PURE__*/React.createElement(Keypad$2, {
|
|
5449
|
-
style: styles$
|
|
5436
|
+
style: styles$6.keypad
|
|
5450
5437
|
}, /*#__PURE__*/React.createElement(View, {
|
|
5451
5438
|
style: row$4
|
|
5452
5439
|
}, /*#__PURE__*/React.createElement(View, {
|
|
5453
5440
|
style: fullWidth$2
|
|
5454
5441
|
}, leftPage), /*#__PURE__*/React.createElement(View, {
|
|
5455
|
-
style: [styles$
|
|
5442
|
+
style: [styles$6.borderLeft, fullWidth$2]
|
|
5456
5443
|
}, rightPage)));
|
|
5457
5444
|
}
|
|
5458
5445
|
}
|
|
5459
5446
|
}
|
|
5460
|
-
const styles$
|
|
5447
|
+
const styles$6 = StyleSheet.create({
|
|
5461
5448
|
keypad: {
|
|
5462
5449
|
// Set the background to light grey, so that when the user drags the
|
|
5463
5450
|
// keypad pages past the edges, there's a grey backdrop.
|
|
@@ -5543,7 +5530,7 @@ class ExpressionKeypad extends React.Component {
|
|
|
5543
5530
|
} else {
|
|
5544
5531
|
dismissOrJumpOutKey = KeyConfigs.DISMISS;
|
|
5545
5532
|
}
|
|
5546
|
-
const rightPageStyle = [row$3, fullWidth$1, styles$
|
|
5533
|
+
const rightPageStyle = [row$3, fullWidth$1, styles$5.rightPage, roundTopRight && roundedTopRight$1];
|
|
5547
5534
|
const rightPage = /*#__PURE__*/React.createElement(View, {
|
|
5548
5535
|
style: rightPageStyle
|
|
5549
5536
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -5615,7 +5602,7 @@ class ExpressionKeypad extends React.Component {
|
|
|
5615
5602
|
keyConfig: dismissOrJumpOutKey,
|
|
5616
5603
|
borders: BorderStyles.LEFT
|
|
5617
5604
|
})));
|
|
5618
|
-
const leftPageStyle = [row$3, fullWidth$1, styles$
|
|
5605
|
+
const leftPageStyle = [row$3, fullWidth$1, styles$5.leftPage, roundTopLeft && roundedTopLeft$2];
|
|
5619
5606
|
const leftPage = /*#__PURE__*/React.createElement(View, {
|
|
5620
5607
|
style: leftPageStyle
|
|
5621
5608
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -5695,7 +5682,7 @@ class ExpressionKeypad extends React.Component {
|
|
|
5695
5682
|
});
|
|
5696
5683
|
}
|
|
5697
5684
|
}
|
|
5698
|
-
const styles$
|
|
5685
|
+
const styles$5 = StyleSheet.create({
|
|
5699
5686
|
// NOTE(charlie): These backgrounds are applied to as to fill in some
|
|
5700
5687
|
// unfortunate 'cracks' in the layout. However, not all keys in the first
|
|
5701
5688
|
// page use this background color (namely, the 'command' keys, backspace and
|
|
@@ -5871,7 +5858,7 @@ class NavigationPad extends React.Component {
|
|
|
5871
5858
|
roundTopLeft,
|
|
5872
5859
|
style
|
|
5873
5860
|
} = this.props;
|
|
5874
|
-
const containerStyle = [column, centered$1, styles$
|
|
5861
|
+
const containerStyle = [column, centered$1, styles$4.container, roundTopLeft && roundedTopLeft, ...(Array.isArray(style) ? style : [style])];
|
|
5875
5862
|
return /*#__PURE__*/React.createElement(View, {
|
|
5876
5863
|
style: containerStyle
|
|
5877
5864
|
}, /*#__PURE__*/React.createElement(View, {
|
|
@@ -5879,32 +5866,32 @@ class NavigationPad extends React.Component {
|
|
|
5879
5866
|
}, /*#__PURE__*/React.createElement(TouchableKeypadButton$1, {
|
|
5880
5867
|
keyConfig: KeyConfigs.UP,
|
|
5881
5868
|
borders: BorderStyles.NONE,
|
|
5882
|
-
style: [styles$
|
|
5869
|
+
style: [styles$4.navigationKey, styles$4.topArrow]
|
|
5883
5870
|
})), /*#__PURE__*/React.createElement(View, {
|
|
5884
5871
|
style: [row$1, centered$1, stretch]
|
|
5885
5872
|
}, /*#__PURE__*/React.createElement(TouchableKeypadButton$1, {
|
|
5886
5873
|
keyConfig: KeyConfigs.LEFT,
|
|
5887
5874
|
borders: BorderStyles.NONE,
|
|
5888
|
-
style: [styles$
|
|
5875
|
+
style: [styles$4.navigationKey, styles$4.leftArrow]
|
|
5889
5876
|
}), /*#__PURE__*/React.createElement(View, {
|
|
5890
|
-
style: styles$
|
|
5877
|
+
style: styles$4.horizontalSpacer
|
|
5891
5878
|
}), /*#__PURE__*/React.createElement(TouchableKeypadButton$1, {
|
|
5892
5879
|
keyConfig: KeyConfigs.RIGHT,
|
|
5893
5880
|
borders: BorderStyles.NONE,
|
|
5894
|
-
style: [styles$
|
|
5881
|
+
style: [styles$4.navigationKey, styles$4.rightArrow]
|
|
5895
5882
|
})), /*#__PURE__*/React.createElement(View, {
|
|
5896
5883
|
style: [row$1, centered$1]
|
|
5897
5884
|
}, /*#__PURE__*/React.createElement(TouchableKeypadButton$1, {
|
|
5898
5885
|
keyConfig: KeyConfigs.DOWN,
|
|
5899
5886
|
borders: BorderStyles.NONE,
|
|
5900
|
-
style: [styles$
|
|
5887
|
+
style: [styles$4.navigationKey, styles$4.bottomArrow]
|
|
5901
5888
|
})));
|
|
5902
5889
|
}
|
|
5903
5890
|
}
|
|
5904
5891
|
const buttonSizePx = 48;
|
|
5905
5892
|
const borderRadiusPx = 4;
|
|
5906
5893
|
const borderWidthPx$1 = 1;
|
|
5907
|
-
const styles$
|
|
5894
|
+
const styles$4 = StyleSheet.create({
|
|
5908
5895
|
container: {
|
|
5909
5896
|
backgroundColor: controlGrey,
|
|
5910
5897
|
width: navigationPadWidthPx
|
|
@@ -6072,8 +6059,8 @@ class KeypadContainer extends React.Component {
|
|
|
6072
6059
|
if (!active && !hasBeenActivated) {
|
|
6073
6060
|
dynamicStyle = _extends({}, dynamicStyle, inlineStyles.invisible);
|
|
6074
6061
|
}
|
|
6075
|
-
const keypadContainerStyle = [row, centered, fullWidth, styles$
|
|
6076
|
-
const keypadStyle = [row, styles$
|
|
6062
|
+
const keypadContainerStyle = [row, centered, fullWidth, styles$3.keypadContainer, ...(Array.isArray(style) ? style : [style])];
|
|
6063
|
+
const keypadStyle = [row, styles$3.keypadBorder, layoutMode === LayoutMode.FULLSCREEN ? styles$3.fullscreen : styles$3.compact];
|
|
6077
6064
|
|
|
6078
6065
|
// TODO(charlie): When the keypad is shorter than the width of the
|
|
6079
6066
|
// screen, add a border on its left and right edges, and round out the
|
|
@@ -6092,15 +6079,15 @@ class KeypadContainer extends React.Component {
|
|
|
6092
6079
|
}
|
|
6093
6080
|
}, navigationPadEnabled && /*#__PURE__*/React.createElement(NavigationPad, {
|
|
6094
6081
|
roundTopLeft: layoutMode === LayoutMode.COMPACT,
|
|
6095
|
-
style: styles$
|
|
6082
|
+
style: styles$3.navigationPadContainer
|
|
6096
6083
|
}), /*#__PURE__*/React.createElement(View, {
|
|
6097
|
-
style: styles$
|
|
6084
|
+
style: styles$3.keypadLayout
|
|
6098
6085
|
}, this.renderKeypad())));
|
|
6099
6086
|
}
|
|
6100
6087
|
}
|
|
6101
6088
|
const keypadAnimationDurationMs = 300;
|
|
6102
6089
|
const borderWidthPx = 1;
|
|
6103
|
-
const styles$
|
|
6090
|
+
const styles$3 = StyleSheet.create({
|
|
6104
6091
|
keypadContainer: {
|
|
6105
6092
|
bottom: 0,
|
|
6106
6093
|
left: 0,
|
|
@@ -8262,7 +8249,7 @@ const KeypadButton = ({
|
|
|
8262
8249
|
}, style)
|
|
8263
8250
|
}, /*#__PURE__*/React.createElement(Clickable, {
|
|
8264
8251
|
onClick: () => onClickKey(keyConfig.id),
|
|
8265
|
-
style: styles$
|
|
8252
|
+
style: styles$2.clickable,
|
|
8266
8253
|
"aria-label": keyConfig.ariaLabel
|
|
8267
8254
|
}, ({
|
|
8268
8255
|
hovered,
|
|
@@ -8270,17 +8257,17 @@ const KeypadButton = ({
|
|
|
8270
8257
|
pressed
|
|
8271
8258
|
}) => {
|
|
8272
8259
|
return /*#__PURE__*/React.createElement(View$1, {
|
|
8273
|
-
style: [styles$
|
|
8260
|
+
style: [styles$2.outerBoxBase]
|
|
8274
8261
|
}, /*#__PURE__*/React.createElement(View$1, {
|
|
8275
|
-
style: [styles$
|
|
8262
|
+
style: [styles$2.base, tintColor != null ? {
|
|
8276
8263
|
background: tintColor
|
|
8277
|
-
} : undefined, hovered && styles$
|
|
8264
|
+
} : undefined, hovered && styles$2.hovered, focused && styles$2.focused, pressed && styles$2.pressed]
|
|
8278
8265
|
}, /*#__PURE__*/React.createElement(ButtonAsset, {
|
|
8279
8266
|
id: keyConfig.id
|
|
8280
8267
|
})));
|
|
8281
8268
|
}));
|
|
8282
8269
|
};
|
|
8283
|
-
const styles$
|
|
8270
|
+
const styles$2 = StyleSheet.create({
|
|
8284
8271
|
base: {
|
|
8285
8272
|
display: "flex",
|
|
8286
8273
|
justifyContent: "center",
|
|
@@ -8641,10 +8628,10 @@ function Keypad(props) {
|
|
|
8641
8628
|
onSelectItem: tabbarItem => {
|
|
8642
8629
|
setSelectedPage(tabbarItem);
|
|
8643
8630
|
},
|
|
8644
|
-
style: styles.tabbar,
|
|
8631
|
+
style: styles$1.tabbar,
|
|
8645
8632
|
onClickClose: showDismiss ? () => onClickKey("DISMISS") : undefined
|
|
8646
8633
|
}), /*#__PURE__*/React.createElement(View$1, {
|
|
8647
|
-
style: styles.grid,
|
|
8634
|
+
style: styles$1.grid,
|
|
8648
8635
|
role: "grid",
|
|
8649
8636
|
tabIndex: 0,
|
|
8650
8637
|
"aria-label": "Keypad"
|
|
@@ -8670,7 +8657,7 @@ function Keypad(props) {
|
|
|
8670
8657
|
})));
|
|
8671
8658
|
}
|
|
8672
8659
|
Keypad.defaultProps = defaultProps;
|
|
8673
|
-
const styles = StyleSheet.create({
|
|
8660
|
+
const styles$1 = StyleSheet.create({
|
|
8674
8661
|
tabbar: {
|
|
8675
8662
|
background: Color.white
|
|
8676
8663
|
},
|
|
@@ -8678,11 +8665,157 @@ const styles = StyleSheet.create({
|
|
|
8678
8665
|
display: "grid",
|
|
8679
8666
|
gridTemplateColumns: "repeat(6, 1fr)",
|
|
8680
8667
|
gridTemplateRows: "repeat(4, 1fr)",
|
|
8681
|
-
backgroundColor: "#DBDCDD"
|
|
8682
|
-
|
|
8683
|
-
|
|
8668
|
+
backgroundColor: "#DBDCDD"
|
|
8669
|
+
}
|
|
8670
|
+
});
|
|
8671
|
+
|
|
8672
|
+
/**
|
|
8673
|
+
* This is the v2 equivalent of v1's ProvidedKeypad. It follows the same
|
|
8674
|
+
* external API so that it can be hot-swapped with the v1 keypad and
|
|
8675
|
+
* is responsible for connecting the keypad with MathInput and the Renderer.
|
|
8676
|
+
*
|
|
8677
|
+
* Ideally this strategy of attaching methods on the class component for
|
|
8678
|
+
* other components to call will be replaced props/callbacks since React
|
|
8679
|
+
* doesn't support this type of code anymore (functional components
|
|
8680
|
+
* can't have methods attached to them).
|
|
8681
|
+
*/
|
|
8682
|
+
|
|
8683
|
+
class MobileKeypad extends React.Component {
|
|
8684
|
+
constructor(...args) {
|
|
8685
|
+
super(...args);
|
|
8686
|
+
this.hasMounted = false;
|
|
8687
|
+
this.state = {
|
|
8688
|
+
active: false
|
|
8689
|
+
};
|
|
8690
|
+
this.activate = () => {
|
|
8691
|
+
this.setState({
|
|
8692
|
+
active: true
|
|
8693
|
+
});
|
|
8694
|
+
};
|
|
8695
|
+
this.dismiss = () => {
|
|
8696
|
+
this.setState({
|
|
8697
|
+
active: false
|
|
8698
|
+
}, () => {
|
|
8699
|
+
var _this$props$onDismiss, _this$props;
|
|
8700
|
+
(_this$props$onDismiss = (_this$props = this.props).onDismiss) == null ? void 0 : _this$props$onDismiss.call(_this$props);
|
|
8701
|
+
});
|
|
8702
|
+
};
|
|
8703
|
+
this.configure = (configuration, cb) => {
|
|
8704
|
+
this.setState({
|
|
8705
|
+
keypadConfig: configuration
|
|
8706
|
+
});
|
|
8707
|
+
|
|
8708
|
+
// TODO(matthewc)[LC-1080]: this was brought in from v1's ProvidedKeypad.
|
|
8709
|
+
// We need to investigate whether we still need this.
|
|
8710
|
+
// HACK(charlie): In Perseus, triggering a focus causes the keypad to
|
|
8711
|
+
// animate into view and re-configure. We'd like to provide the option
|
|
8712
|
+
// to re-render the re-configured keypad before animating it into view,
|
|
8713
|
+
// to avoid jank in the animation. As such, we support passing a
|
|
8714
|
+
// callback into `configureKeypad`. However, implementing this properly
|
|
8715
|
+
// would require middleware, etc., so we just hack it on with
|
|
8716
|
+
// `setTimeout` for now.
|
|
8717
|
+
setTimeout(() => cb && cb());
|
|
8718
|
+
};
|
|
8719
|
+
this.setCursor = cursor => {
|
|
8720
|
+
this.setState({
|
|
8721
|
+
cursor
|
|
8722
|
+
});
|
|
8723
|
+
};
|
|
8724
|
+
this.setKeyHandler = keyHandler => {
|
|
8725
|
+
this.setState({
|
|
8726
|
+
keyHandler
|
|
8727
|
+
});
|
|
8728
|
+
};
|
|
8729
|
+
this.getDOMNode = () => {
|
|
8730
|
+
return ReactDOM.findDOMNode(this);
|
|
8731
|
+
};
|
|
8732
|
+
}
|
|
8733
|
+
_handleClickKey(key) {
|
|
8734
|
+
var _this$state$keyHandle, _this$state;
|
|
8735
|
+
if (key === "DISMISS") {
|
|
8736
|
+
this.dismiss();
|
|
8737
|
+
return;
|
|
8738
|
+
}
|
|
8739
|
+
const cursor = (_this$state$keyHandle = (_this$state = this.state).keyHandler) == null ? void 0 : _this$state$keyHandle.call(_this$state, key);
|
|
8740
|
+
this.setState({
|
|
8741
|
+
cursor
|
|
8742
|
+
});
|
|
8743
|
+
}
|
|
8744
|
+
render() {
|
|
8745
|
+
const {
|
|
8746
|
+
active,
|
|
8747
|
+
cursor,
|
|
8748
|
+
keypadConfig
|
|
8749
|
+
} = this.state;
|
|
8750
|
+
const containerStyle = [styles.keypadContainer, active ? styles.activeKeypadContainer : null];
|
|
8751
|
+
const isExpression = (keypadConfig == null ? void 0 : keypadConfig.keypadType) === "EXPRESSION";
|
|
8752
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
8753
|
+
style: containerStyle,
|
|
8754
|
+
ref: element => {
|
|
8755
|
+
if (!this.hasMounted && element) {
|
|
8756
|
+
var _this$props$onElement, _this$props2;
|
|
8757
|
+
// TODO(matthewc)[LC-1081]: clean up this weird
|
|
8758
|
+
// object and type the onElementMounted callback
|
|
8759
|
+
// Append the dispatch methods that we want to expose
|
|
8760
|
+
// externally to the returned React element.
|
|
8761
|
+
const elementWithDispatchMethods = _extends({}, element, {
|
|
8762
|
+
activate: this.activate,
|
|
8763
|
+
dismiss: this.dismiss,
|
|
8764
|
+
configure: this.configure,
|
|
8765
|
+
setCursor: this.setCursor,
|
|
8766
|
+
setKeyHandler: this.setKeyHandler,
|
|
8767
|
+
getDOMNode: this.getDOMNode
|
|
8768
|
+
});
|
|
8769
|
+
this.hasMounted = true;
|
|
8770
|
+
(_this$props$onElement = (_this$props2 = this.props).onElementMounted) == null ? void 0 : _this$props$onElement.call(_this$props2, elementWithDispatchMethods);
|
|
8771
|
+
}
|
|
8772
|
+
}
|
|
8773
|
+
}, /*#__PURE__*/React.createElement(Keypad
|
|
8774
|
+
// TODO(jeremy)
|
|
8775
|
+
, {
|
|
8776
|
+
sendEvent: async function () {},
|
|
8777
|
+
extraKeys: keypadConfig == null ? void 0 : keypadConfig.extraKeys,
|
|
8778
|
+
onClickKey: key => this._handleClickKey(key),
|
|
8779
|
+
cursorContext: cursor == null ? void 0 : cursor.context,
|
|
8780
|
+
multiplicationDot: isExpression,
|
|
8781
|
+
divisionKey: isExpression,
|
|
8782
|
+
trigonometry: isExpression,
|
|
8783
|
+
preAlgebra: isExpression,
|
|
8784
|
+
logarithms: isExpression,
|
|
8785
|
+
basicRelations: isExpression,
|
|
8786
|
+
advancedRelations: isExpression,
|
|
8787
|
+
showDismiss: true
|
|
8788
|
+
}));
|
|
8684
8789
|
}
|
|
8790
|
+
}
|
|
8791
|
+
const styles = StyleSheet.create({
|
|
8792
|
+
keypadContainer: {
|
|
8793
|
+
bottom: 0,
|
|
8794
|
+
left: 0,
|
|
8795
|
+
right: 0,
|
|
8796
|
+
position: "fixed",
|
|
8797
|
+
transition: `200ms ease-out`,
|
|
8798
|
+
transitionProperty: "transform",
|
|
8799
|
+
transform: "translate3d(0, 100%, 0)"
|
|
8800
|
+
},
|
|
8801
|
+
activeKeypadContainer: {
|
|
8802
|
+
transform: "translate3d(0, 0, 0)"
|
|
8803
|
+
}
|
|
8804
|
+
});
|
|
8805
|
+
|
|
8806
|
+
/**
|
|
8807
|
+
* React PropTypes that may be shared between components.
|
|
8808
|
+
*/
|
|
8809
|
+
|
|
8810
|
+
// NOTE(jared): This is no longer guaranteed to be React element
|
|
8811
|
+
const keypadElementPropType = PropTypes.shape({
|
|
8812
|
+
activate: PropTypes.func.isRequired,
|
|
8813
|
+
dismiss: PropTypes.func.isRequired,
|
|
8814
|
+
configure: PropTypes.func.isRequired,
|
|
8815
|
+
setCursor: PropTypes.func.isRequired,
|
|
8816
|
+
setKeyHandler: PropTypes.func.isRequired,
|
|
8817
|
+
getDOMNode: PropTypes.func.isRequired
|
|
8685
8818
|
});
|
|
8686
8819
|
|
|
8687
|
-
export { CursorContext, KeyConfigs, Keypad, MathInput as KeypadInput, KeypadType, ProvidedKeypad as LegacyKeypad, createMathField, getCursorContext, keyToMathquillMap as keyTranslator, keypadElementPropType, mathQuillInstance };
|
|
8820
|
+
export { CursorContext, KeyConfigs, Keypad, MathInput as KeypadInput, KeypadType, ProvidedKeypad as LegacyKeypad, MobileKeypad, createMathField, getCursorContext, keyToMathquillMap as keyTranslator, keypadElementPropType, mathQuillInstance };
|
|
8688
8821
|
//# sourceMappingURL=index.js.map
|