@khanacademy/math-input 10.0.0 → 10.1.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 +12 -0
- package/dist/components/keypad/keypad.d.ts +1 -0
- package/dist/components/keypad/mobile-keypad.d.ts +8 -0
- package/dist/components/keypad/navigation-button.d.ts +8 -0
- package/dist/components/keypad/navigation-pad.d.ts +6 -0
- package/dist/components/keypad/utils.d.ts +1 -0
- package/dist/es/index.css +3 -5
- package/dist/es/index.js +322 -29
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +3 -5
- package/dist/index.js +326 -29
- package/dist/index.js.map +1 -1
- package/less/overrides.less +8 -9
- package/package.json +1 -1
- package/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap +1855 -0
- package/src/components/keypad/__tests__/keypad.test.tsx +94 -0
- package/src/components/keypad/button-assets.tsx +77 -4
- package/src/components/keypad/keypad-button.tsx +1 -1
- package/src/components/keypad/keypad.stories.tsx +4 -0
- package/src/components/keypad/keypad.tsx +83 -53
- package/src/components/keypad/mobile-keypad.tsx +55 -1
- package/src/components/keypad/navigation-button.tsx +127 -0
- package/src/components/keypad/navigation-pad.stories.tsx +25 -0
- package/src/components/keypad/navigation-pad.tsx +67 -0
- package/src/components/keypad/utils.ts +4 -0
- package/src/components/keypad-legacy/keypad-button.tsx +2 -1
- package/src/full-math-input.stories.tsx +17 -18
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.css
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
outline: none !important;
|
|
45
45
|
}
|
|
46
46
|
.keypad-input .mq-editable-field .mq-root-block {
|
|
47
|
-
overflow-x:
|
|
47
|
+
overflow-x: auto;
|
|
48
48
|
}
|
|
49
49
|
.keypad-input .mq-editable-field .mq-cursor:not(:only-child),
|
|
50
50
|
.keypad-input .mq-editable-field .mq-root-block.mq-hasCursor > .mq-cursor:only-child {
|
|
@@ -63,12 +63,11 @@
|
|
|
63
63
|
margin-left: -1px !important;
|
|
64
64
|
margin-right: -1px !important;
|
|
65
65
|
opacity: 1 !important;
|
|
66
|
-
transition: opacity
|
|
66
|
+
transition: opacity 300ms ease !important;
|
|
67
67
|
visibility: visible !important;
|
|
68
68
|
}
|
|
69
69
|
.keypad-input .mq-editable-field .mq-cursor.mq-blink {
|
|
70
70
|
opacity: 0 !important;
|
|
71
|
-
transition: opacity 500ms ease-in !important;
|
|
72
71
|
visibility: visible !important;
|
|
73
72
|
}
|
|
74
73
|
.keypad-input .mq-editable-field .mq-non-leaf .mq-cursor:only-child {
|
|
@@ -77,12 +76,11 @@
|
|
|
77
76
|
border-radius: 1px;
|
|
78
77
|
opacity: 1 !important;
|
|
79
78
|
padding: 0 4px 0 4px;
|
|
80
|
-
transition: border-color
|
|
79
|
+
transition: border-color 300ms ease !important;
|
|
81
80
|
}
|
|
82
81
|
.keypad-input .mq-editable-field .mq-non-leaf .mq-cursor:only-child.mq-blink {
|
|
83
82
|
border-color: #1865f2 !important;
|
|
84
83
|
opacity: 1 !important;
|
|
85
|
-
transition: border-color 500ms ease-in !important;
|
|
86
84
|
}
|
|
87
85
|
.keypad-input .mq-empty {
|
|
88
86
|
background: transparent !important;
|
package/dist/index.js
CHANGED
|
@@ -98,7 +98,7 @@ class Text extends React__namespace.Component {
|
|
|
98
98
|
numberOfLines,
|
|
99
99
|
style
|
|
100
100
|
} = this.props;
|
|
101
|
-
const className = aphrodite.css(styles$
|
|
101
|
+
const className = aphrodite.css(styles$k.initial, ...(Array.isArray(style) ? style : [style]), numberOfLines === 1 && styles$k.singleLineStyle);
|
|
102
102
|
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
103
103
|
className: className,
|
|
104
104
|
style: this.props.dynamicStyle
|
|
@@ -107,7 +107,7 @@ class Text extends React__namespace.Component {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// https://github.com/necolas/react-native-web/blob/master/src/components/Text/index.js
|
|
110
|
-
const styles$
|
|
110
|
+
const styles$k = aphrodite.StyleSheet.create({
|
|
111
111
|
initial: {
|
|
112
112
|
color: "inherit",
|
|
113
113
|
display: "inline",
|
|
@@ -2144,7 +2144,7 @@ class MathInput extends React__namespace.Component {
|
|
|
2144
2144
|
// to the open the keyboard, and then remove the second half of this label.
|
|
2145
2145
|
const ariaLabel = i18n__namespace._("Math input box") + " " + i18n__namespace._("Tap with one or two fingers to open keyboard");
|
|
2146
2146
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
2147
|
-
style: styles$
|
|
2147
|
+
style: styles$j.input,
|
|
2148
2148
|
onTouchStart: this.handleTouchStart,
|
|
2149
2149
|
onTouchMove: this.handleTouchMove,
|
|
2150
2150
|
onTouchEnd: this.handleTouchEnd,
|
|
@@ -2190,7 +2190,7 @@ const numeralHeightPx = 20;
|
|
|
2190
2190
|
const totalDesiredPadding = 12;
|
|
2191
2191
|
const minHeightPx = numeralHeightPx + totalDesiredPadding * 2;
|
|
2192
2192
|
const minWidthPx = 64;
|
|
2193
|
-
const styles$
|
|
2193
|
+
const styles$j = aphrodite.StyleSheet.create({
|
|
2194
2194
|
input: {
|
|
2195
2195
|
position: "relative",
|
|
2196
2196
|
display: "inline-block",
|
|
@@ -2320,7 +2320,7 @@ const IconAsset = function (_ref) {
|
|
|
2320
2320
|
}
|
|
2321
2321
|
};
|
|
2322
2322
|
|
|
2323
|
-
const styles$
|
|
2323
|
+
const styles$i = aphrodite.StyleSheet.create({
|
|
2324
2324
|
base: {
|
|
2325
2325
|
display: "flex",
|
|
2326
2326
|
width: 44,
|
|
@@ -2391,7 +2391,7 @@ class TabbarItem extends React__namespace.Component {
|
|
|
2391
2391
|
onClick: onClick,
|
|
2392
2392
|
disabled: itemState === "disabled",
|
|
2393
2393
|
"aria-label": itemType,
|
|
2394
|
-
style: styles$
|
|
2394
|
+
style: styles$i.clickable,
|
|
2395
2395
|
"aria-selected": itemState === "active",
|
|
2396
2396
|
role: "tab"
|
|
2397
2397
|
}, _ref => {
|
|
@@ -2402,14 +2402,14 @@ class TabbarItem extends React__namespace.Component {
|
|
|
2402
2402
|
} = _ref;
|
|
2403
2403
|
const tintColor = imageTintColor(itemState, hovered, focused, pressed);
|
|
2404
2404
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
2405
|
-
style: [styles$
|
|
2405
|
+
style: [styles$i.base, itemState !== "disabled" && hovered && styles$i.hovered, focused && styles$i.focused, pressed && styles$i.pressed]
|
|
2406
2406
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
2407
|
-
style: [styles$
|
|
2407
|
+
style: [styles$i.innerBox, pressed && styles$i.innerBoxPressed]
|
|
2408
2408
|
}, /*#__PURE__*/React__namespace.createElement(IconAsset, {
|
|
2409
2409
|
type: itemType,
|
|
2410
2410
|
tintColor: tintColor
|
|
2411
2411
|
})), itemState === "active" && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
2412
|
-
style: [styles$
|
|
2412
|
+
style: [styles$i.activeIndicator, {
|
|
2413
2413
|
backgroundColor: tintColor
|
|
2414
2414
|
}]
|
|
2415
2415
|
}));
|
|
@@ -2417,7 +2417,7 @@ class TabbarItem extends React__namespace.Component {
|
|
|
2417
2417
|
}
|
|
2418
2418
|
}
|
|
2419
2419
|
|
|
2420
|
-
const styles$
|
|
2420
|
+
const styles$h = aphrodite.StyleSheet.create({
|
|
2421
2421
|
tabbar: {
|
|
2422
2422
|
display: "flex",
|
|
2423
2423
|
flexDirection: "row",
|
|
@@ -2439,10 +2439,10 @@ function Tabbar(props) {
|
|
|
2439
2439
|
style
|
|
2440
2440
|
} = props;
|
|
2441
2441
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
2442
|
-
style: [styles$
|
|
2442
|
+
style: [styles$h.tabbar, style],
|
|
2443
2443
|
role: "tablist"
|
|
2444
2444
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
2445
|
-
style: [styles$
|
|
2445
|
+
style: [styles$h.pages]
|
|
2446
2446
|
}, items.map(item => /*#__PURE__*/React__namespace.createElement(TabbarItem, {
|
|
2447
2447
|
key: "tabbar-item-".concat(item),
|
|
2448
2448
|
itemState: item === selectedItem ? "active" : "inactive",
|
|
@@ -4526,16 +4526,99 @@ function ButtonAsset(_ref) {
|
|
|
4526
4526
|
transform: "translate(8 19)",
|
|
4527
4527
|
d: "M0 0h12v2H0z"
|
|
4528
4528
|
}))));
|
|
4529
|
+
case "UP":
|
|
4530
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4531
|
+
width: "48",
|
|
4532
|
+
height: "48",
|
|
4533
|
+
viewBox: "0 0 48 48"
|
|
4534
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
4535
|
+
fill: "none",
|
|
4536
|
+
fillRule: "evenodd",
|
|
4537
|
+
transform: "rotate(90 24 24)"
|
|
4538
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4539
|
+
fill: "none",
|
|
4540
|
+
d: "M0 0h48v48H0z"
|
|
4541
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4542
|
+
fill: "none",
|
|
4543
|
+
d: "M12 12h24v24H12z"
|
|
4544
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4545
|
+
stroke: "#21242C",
|
|
4546
|
+
strokeWidth: "2",
|
|
4547
|
+
strokeLinecap: "round",
|
|
4548
|
+
strokeLinejoin: "round",
|
|
4549
|
+
d: "M22 18l-6 6 6 6M16 24h16"
|
|
4550
|
+
})));
|
|
4551
|
+
case "DOWN":
|
|
4552
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4553
|
+
width: "48",
|
|
4554
|
+
height: "48",
|
|
4555
|
+
viewBox: "0 0 48 48"
|
|
4556
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
4557
|
+
fill: "none",
|
|
4558
|
+
fillRule: "evenodd",
|
|
4559
|
+
transform: "rotate(270 24 24)"
|
|
4560
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4561
|
+
fill: "none",
|
|
4562
|
+
d: "M0 0h48v48H0z"
|
|
4563
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4564
|
+
fill: "none",
|
|
4565
|
+
d: "M12 12h24v24H12z"
|
|
4566
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4567
|
+
stroke: "#21242C",
|
|
4568
|
+
strokeWidth: "2",
|
|
4569
|
+
strokeLinecap: "round",
|
|
4570
|
+
strokeLinejoin: "round",
|
|
4571
|
+
d: "M22 18l-6 6 6 6M16 24h16"
|
|
4572
|
+
})));
|
|
4573
|
+
case "LEFT":
|
|
4574
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4575
|
+
width: "48",
|
|
4576
|
+
height: "48",
|
|
4577
|
+
viewBox: "0 0 48 48"
|
|
4578
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
4579
|
+
fill: "none",
|
|
4580
|
+
fillRule: "evenodd"
|
|
4581
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4582
|
+
fill: "none",
|
|
4583
|
+
d: "M0 0h48v48H0z"
|
|
4584
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4585
|
+
fill: "none",
|
|
4586
|
+
d: "M12 12h24v24H12z"
|
|
4587
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4588
|
+
stroke: "#21242C",
|
|
4589
|
+
strokeWidth: "2",
|
|
4590
|
+
strokeLinecap: "round",
|
|
4591
|
+
strokeLinejoin: "round",
|
|
4592
|
+
d: "M22 18l-6 6 6 6M16 24h16"
|
|
4593
|
+
})));
|
|
4594
|
+
case "RIGHT":
|
|
4595
|
+
return /*#__PURE__*/React__namespace.createElement("svg", {
|
|
4596
|
+
width: "48",
|
|
4597
|
+
height: "48",
|
|
4598
|
+
viewBox: "0 0 48 48"
|
|
4599
|
+
}, /*#__PURE__*/React__namespace.createElement("g", {
|
|
4600
|
+
fill: "none",
|
|
4601
|
+
fillRule: "evenodd",
|
|
4602
|
+
transform: "rotate(180 24 24)"
|
|
4603
|
+
}, /*#__PURE__*/React__namespace.createElement("path", {
|
|
4604
|
+
fill: "none",
|
|
4605
|
+
d: "M0 0h48v48H0z"
|
|
4606
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4607
|
+
fill: "none",
|
|
4608
|
+
d: "M12 12h24v24H12z"
|
|
4609
|
+
}), /*#__PURE__*/React__namespace.createElement("path", {
|
|
4610
|
+
stroke: "#21242C",
|
|
4611
|
+
strokeWidth: "2",
|
|
4612
|
+
strokeLinecap: "round",
|
|
4613
|
+
strokeLinejoin: "round",
|
|
4614
|
+
d: "M22 18l-6 6 6 6M16 24h16"
|
|
4615
|
+
})));
|
|
4529
4616
|
|
|
4530
4617
|
/**
|
|
4531
4618
|
* ANYTHING BELOW IS NOT YET HANDLED
|
|
4532
4619
|
*/
|
|
4533
4620
|
case "MANY":
|
|
4534
4621
|
case "NOOP":
|
|
4535
|
-
case "UP":
|
|
4536
|
-
case "DOWN":
|
|
4537
|
-
case "LEFT":
|
|
4538
|
-
case "RIGHT":
|
|
4539
4622
|
case "PHI":
|
|
4540
4623
|
case "NTHROOT3":
|
|
4541
4624
|
case "POW":
|
|
@@ -4583,7 +4666,7 @@ const KeypadButton$2 = _ref => {
|
|
|
4583
4666
|
}
|
|
4584
4667
|
}, /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
|
|
4585
4668
|
onClick: e => onClickKey(keyConfig.id, e),
|
|
4586
|
-
style: styles$
|
|
4669
|
+
style: styles$g.clickable,
|
|
4587
4670
|
"aria-label": keyConfig.ariaLabel
|
|
4588
4671
|
}, _ref2 => {
|
|
4589
4672
|
let {
|
|
@@ -4592,22 +4675,22 @@ const KeypadButton$2 = _ref => {
|
|
|
4592
4675
|
pressed
|
|
4593
4676
|
} = _ref2;
|
|
4594
4677
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
4595
|
-
style: [styles$
|
|
4678
|
+
style: [styles$g.outerBoxBase]
|
|
4596
4679
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
4597
|
-
style: [styles$
|
|
4680
|
+
style: [styles$g.base, tintColor != null ? {
|
|
4598
4681
|
background: tintColor
|
|
4599
|
-
} : undefined, hovered && styles$
|
|
4682
|
+
} : undefined, hovered && styles$g.hovered, focused && styles$g.focused, pressed && styles$g.pressed]
|
|
4600
4683
|
}, /*#__PURE__*/React__namespace.createElement(ButtonAsset, {
|
|
4601
4684
|
id: keyConfig.id
|
|
4602
4685
|
})));
|
|
4603
4686
|
}));
|
|
4604
4687
|
};
|
|
4605
|
-
const styles$
|
|
4688
|
+
const styles$g = aphrodite.StyleSheet.create({
|
|
4606
4689
|
base: {
|
|
4607
4690
|
display: "flex",
|
|
4608
4691
|
justifyContent: "center",
|
|
4609
4692
|
alignItems: "center",
|
|
4610
|
-
boxShadow: "0px 1px 0px
|
|
4693
|
+
boxShadow: "0px 1px 0px ".concat(Color__default["default"].offBlack32),
|
|
4611
4694
|
boxSizing: "border-box",
|
|
4612
4695
|
background: Color__default["default"].white,
|
|
4613
4696
|
borderRadius: 4,
|
|
@@ -4672,6 +4755,10 @@ function ExtrasPage(props) {
|
|
|
4672
4755
|
}));
|
|
4673
4756
|
}
|
|
4674
4757
|
|
|
4758
|
+
// This is just a magic number, I just played around with it
|
|
4759
|
+
// until the transition from expanded -> regular -> expanded felt natural
|
|
4760
|
+
const expandedViewThreshold$1 = 500;
|
|
4761
|
+
|
|
4675
4762
|
// This is a helper function that returns the correct context for the cursor
|
|
4676
4763
|
// based on the cursorContext prop. It is used in the keypad to determine
|
|
4677
4764
|
// which key to render as the "jump out" key.
|
|
@@ -4927,6 +5014,154 @@ function OperatorsPage(props) {
|
|
|
4927
5014
|
})));
|
|
4928
5015
|
}
|
|
4929
5016
|
|
|
5017
|
+
function getStyles(key) {
|
|
5018
|
+
switch (key) {
|
|
5019
|
+
case "UP":
|
|
5020
|
+
return styles$f.up;
|
|
5021
|
+
case "RIGHT":
|
|
5022
|
+
return styles$f.right;
|
|
5023
|
+
case "DOWN":
|
|
5024
|
+
return styles$f.down;
|
|
5025
|
+
case "LEFT":
|
|
5026
|
+
return styles$f.left;
|
|
5027
|
+
default:
|
|
5028
|
+
throw new Error("Invalid key: ".concat(key));
|
|
5029
|
+
}
|
|
5030
|
+
}
|
|
5031
|
+
function NavigationButton(_ref) {
|
|
5032
|
+
let {
|
|
5033
|
+
coord,
|
|
5034
|
+
keyConfig,
|
|
5035
|
+
onClickKey
|
|
5036
|
+
} = _ref;
|
|
5037
|
+
const key = keyConfig.id;
|
|
5038
|
+
const directionalStyles = getStyles(key);
|
|
5039
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5040
|
+
style: {
|
|
5041
|
+
gridColumn: coord[0] + 1,
|
|
5042
|
+
gridRow: coord[1] + 1
|
|
5043
|
+
}
|
|
5044
|
+
}, /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
|
|
5045
|
+
onClick: e => onClickKey(keyConfig.id, e),
|
|
5046
|
+
style: styles$f.clickable,
|
|
5047
|
+
"aria-label": keyConfig.ariaLabel
|
|
5048
|
+
}, _ref2 => {
|
|
5049
|
+
let {
|
|
5050
|
+
hovered,
|
|
5051
|
+
focused,
|
|
5052
|
+
pressed
|
|
5053
|
+
} = _ref2;
|
|
5054
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5055
|
+
style: styles$f.outerBoxBase
|
|
5056
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5057
|
+
style: [styles$f.base, directionalStyles, hovered && styles$f.hovered, focused && styles$f.focused, pressed && styles$f.pressed]
|
|
5058
|
+
}, /*#__PURE__*/React__namespace.createElement(ButtonAsset, {
|
|
5059
|
+
id: keyConfig.id
|
|
5060
|
+
})));
|
|
5061
|
+
}));
|
|
5062
|
+
}
|
|
5063
|
+
const borderRadiusPx$1 = 4;
|
|
5064
|
+
const styles$f = aphrodite.StyleSheet.create({
|
|
5065
|
+
clickable: {
|
|
5066
|
+
width: "100%",
|
|
5067
|
+
height: "100%",
|
|
5068
|
+
":focus": {
|
|
5069
|
+
outline: "none"
|
|
5070
|
+
}
|
|
5071
|
+
},
|
|
5072
|
+
outerBoxBase: {
|
|
5073
|
+
height: "100%",
|
|
5074
|
+
width: "100%"
|
|
5075
|
+
},
|
|
5076
|
+
base: {
|
|
5077
|
+
boxShadow: "0px 1px 0px ".concat(Color__default["default"].offBlack32),
|
|
5078
|
+
display: "flex",
|
|
5079
|
+
justifyContent: "center",
|
|
5080
|
+
alignItems: "center",
|
|
5081
|
+
background: Color__default["default"].white,
|
|
5082
|
+
borderWidth: 2,
|
|
5083
|
+
borderColor: Color__default["default"].white
|
|
5084
|
+
},
|
|
5085
|
+
up: {
|
|
5086
|
+
borderTopLeftRadius: borderRadiusPx$1,
|
|
5087
|
+
borderTopRightRadius: borderRadiusPx$1
|
|
5088
|
+
},
|
|
5089
|
+
right: {
|
|
5090
|
+
borderTopRightRadius: borderRadiusPx$1,
|
|
5091
|
+
borderBottomRightRadius: borderRadiusPx$1
|
|
5092
|
+
},
|
|
5093
|
+
down: {
|
|
5094
|
+
borderBottomLeftRadius: borderRadiusPx$1,
|
|
5095
|
+
borderBottomRightRadius: borderRadiusPx$1
|
|
5096
|
+
},
|
|
5097
|
+
left: {
|
|
5098
|
+
borderTopLeftRadius: borderRadiusPx$1,
|
|
5099
|
+
borderBottomLeftRadius: borderRadiusPx$1
|
|
5100
|
+
},
|
|
5101
|
+
hovered: {
|
|
5102
|
+
borderColor: Color__default["default"].blue,
|
|
5103
|
+
boxShadow: "none"
|
|
5104
|
+
},
|
|
5105
|
+
focused: {
|
|
5106
|
+
borderColor: Color__default["default"].blue,
|
|
5107
|
+
boxShadow: "none"
|
|
5108
|
+
},
|
|
5109
|
+
pressed: {
|
|
5110
|
+
border: "2px solid #1B50B3",
|
|
5111
|
+
background: "linear-gradient(0deg, rgba(24, 101, 242, 0.32), rgba(24, 101, 242, 0.32)), ".concat(Color__default["default"].white),
|
|
5112
|
+
boxShadow: "none"
|
|
5113
|
+
}
|
|
5114
|
+
});
|
|
5115
|
+
|
|
5116
|
+
function NavigationPad$1(props) {
|
|
5117
|
+
const {
|
|
5118
|
+
onClickKey
|
|
5119
|
+
} = props;
|
|
5120
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5121
|
+
style: styles$e.container
|
|
5122
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5123
|
+
style: styles$e.grid
|
|
5124
|
+
}, /*#__PURE__*/React__namespace.createElement(NavigationButton, {
|
|
5125
|
+
keyConfig: KeyConfigs.UP,
|
|
5126
|
+
onClickKey: onClickKey,
|
|
5127
|
+
coord: [1, 0]
|
|
5128
|
+
}), /*#__PURE__*/React__namespace.createElement(NavigationButton, {
|
|
5129
|
+
keyConfig: KeyConfigs.RIGHT,
|
|
5130
|
+
onClickKey: onClickKey,
|
|
5131
|
+
coord: [2, 1]
|
|
5132
|
+
}), /*#__PURE__*/React__namespace.createElement(NavigationButton, {
|
|
5133
|
+
keyConfig: KeyConfigs.DOWN,
|
|
5134
|
+
onClickKey: onClickKey,
|
|
5135
|
+
coord: [1, 2]
|
|
5136
|
+
}), /*#__PURE__*/React__namespace.createElement(NavigationButton, {
|
|
5137
|
+
keyConfig: KeyConfigs.LEFT,
|
|
5138
|
+
onClickKey: onClickKey,
|
|
5139
|
+
coord: [0, 1]
|
|
5140
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5141
|
+
style: styles$e.spacer
|
|
5142
|
+
})));
|
|
5143
|
+
}
|
|
5144
|
+
const styles$e = aphrodite.StyleSheet.create({
|
|
5145
|
+
container: {
|
|
5146
|
+
display: "flex",
|
|
5147
|
+
alignItems: "center",
|
|
5148
|
+
justifyContent: "center",
|
|
5149
|
+
padding: "0 1.5rem"
|
|
5150
|
+
},
|
|
5151
|
+
grid: {
|
|
5152
|
+
width: 140,
|
|
5153
|
+
height: 140,
|
|
5154
|
+
display: "grid",
|
|
5155
|
+
gridTemplateColumns: "repeat(3, 1fr)",
|
|
5156
|
+
gridTemplateRows: "repeat(3, 1fr)"
|
|
5157
|
+
},
|
|
5158
|
+
spacer: {
|
|
5159
|
+
gridColumn: 2,
|
|
5160
|
+
gridRow: 2,
|
|
5161
|
+
background: Color__default["default"].white
|
|
5162
|
+
}
|
|
5163
|
+
});
|
|
5164
|
+
|
|
4930
5165
|
function SharedKeys(props) {
|
|
4931
5166
|
const {
|
|
4932
5167
|
onClickKey,
|
|
@@ -5034,7 +5269,8 @@ function Keypad$2(props) {
|
|
|
5034
5269
|
advancedRelations,
|
|
5035
5270
|
showDismiss,
|
|
5036
5271
|
onAnalyticsEvent,
|
|
5037
|
-
fractionsOnly
|
|
5272
|
+
fractionsOnly,
|
|
5273
|
+
expandedView
|
|
5038
5274
|
} = props;
|
|
5039
5275
|
|
|
5040
5276
|
// Use a different grid for our fraction keypad
|
|
@@ -5066,15 +5302,20 @@ function Keypad$2(props) {
|
|
|
5066
5302
|
}
|
|
5067
5303
|
};
|
|
5068
5304
|
}, [onAnalyticsEvent, isMounted]);
|
|
5069
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View,
|
|
5305
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5306
|
+
style: expandedView ? styles$d.keypadOuterContainer : null
|
|
5307
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5308
|
+
style: [styles$d.wrapper, expandedView ? styles$d.expandedWrapper : null]
|
|
5309
|
+
}, /*#__PURE__*/React__namespace.createElement(Tabbar, {
|
|
5070
5310
|
items: availableTabs,
|
|
5071
5311
|
selectedItem: selectedPage,
|
|
5072
5312
|
onSelectItem: tabbarItem => {
|
|
5073
5313
|
setSelectedPage(tabbarItem);
|
|
5074
5314
|
},
|
|
5075
|
-
style: styles$d.tabbar,
|
|
5076
5315
|
onClickClose: showDismiss ? () => onClickKey("DISMISS") : undefined
|
|
5077
5316
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5317
|
+
style: styles$d.keypadInnerContainer
|
|
5318
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
5078
5319
|
style: [styles$d.keypadGrid, gridStyle],
|
|
5079
5320
|
role: "grid",
|
|
5080
5321
|
tabIndex: 0,
|
|
@@ -5101,17 +5342,34 @@ function Keypad$2(props) {
|
|
|
5101
5342
|
multiplicationDot: multiplicationDot,
|
|
5102
5343
|
divisionKey: divisionKey,
|
|
5103
5344
|
selectedPage: selectedPage
|
|
5104
|
-
}))
|
|
5345
|
+
})), expandedView && /*#__PURE__*/React__namespace.createElement(NavigationPad$1, {
|
|
5346
|
+
onClickKey: onClickKey
|
|
5347
|
+
}))));
|
|
5105
5348
|
}
|
|
5106
5349
|
Keypad$2.defaultProps = defaultProps;
|
|
5107
5350
|
const styles$d = aphrodite.StyleSheet.create({
|
|
5108
|
-
|
|
5351
|
+
keypadOuterContainer: {
|
|
5352
|
+
display: "flex",
|
|
5353
|
+
alignItems: "center"
|
|
5354
|
+
},
|
|
5355
|
+
wrapper: {
|
|
5109
5356
|
background: Color__default["default"].white
|
|
5110
5357
|
},
|
|
5358
|
+
expandedWrapper: {
|
|
5359
|
+
borderWidth: "1px 1px 0 1px",
|
|
5360
|
+
borderColor: Color__default["default"].offBlack32,
|
|
5361
|
+
maxWidth: expandedViewThreshold$1,
|
|
5362
|
+
borderRadius: "3px 3px 0 0"
|
|
5363
|
+
},
|
|
5364
|
+
keypadInnerContainer: {
|
|
5365
|
+
display: "flex",
|
|
5366
|
+
flexDirection: "row",
|
|
5367
|
+
backgroundColor: "#DBDCDD"
|
|
5368
|
+
},
|
|
5111
5369
|
keypadGrid: {
|
|
5112
5370
|
display: "grid",
|
|
5113
5371
|
gridTemplateRows: "repeat(4, 1fr)",
|
|
5114
|
-
|
|
5372
|
+
flex: 1
|
|
5115
5373
|
},
|
|
5116
5374
|
expressionGrid: {
|
|
5117
5375
|
gridTemplateColumns: "repeat(6, 1fr)"
|
|
@@ -5135,10 +5393,31 @@ const styles$d = aphrodite.StyleSheet.create({
|
|
|
5135
5393
|
class MobileKeypad extends React__namespace.Component {
|
|
5136
5394
|
constructor() {
|
|
5137
5395
|
super(...arguments);
|
|
5396
|
+
_defineProperty(this, "_containerRef", /*#__PURE__*/React__namespace.createRef());
|
|
5397
|
+
_defineProperty(this, "_containerResizeObserver", null);
|
|
5398
|
+
_defineProperty(this, "_throttleResize", false);
|
|
5138
5399
|
_defineProperty(this, "hasMounted", false);
|
|
5139
5400
|
_defineProperty(this, "state", {
|
|
5401
|
+
containerWidth: 0,
|
|
5140
5402
|
active: false
|
|
5141
5403
|
});
|
|
5404
|
+
_defineProperty(this, "_resize", () => {
|
|
5405
|
+
var _this$_containerRef$c;
|
|
5406
|
+
const containerWidth = ((_this$_containerRef$c = this._containerRef.current) === null || _this$_containerRef$c === void 0 ? void 0 : _this$_containerRef$c.clientWidth) || 0;
|
|
5407
|
+
this.setState({
|
|
5408
|
+
containerWidth
|
|
5409
|
+
});
|
|
5410
|
+
});
|
|
5411
|
+
_defineProperty(this, "_throttleResizeHandler", () => {
|
|
5412
|
+
if (this._throttleResize) {
|
|
5413
|
+
return;
|
|
5414
|
+
}
|
|
5415
|
+
this._throttleResize = true;
|
|
5416
|
+
setTimeout(() => {
|
|
5417
|
+
this._resize();
|
|
5418
|
+
this._throttleResize = false;
|
|
5419
|
+
}, 100);
|
|
5420
|
+
});
|
|
5142
5421
|
_defineProperty(this, "activate", () => {
|
|
5143
5422
|
this.setState({
|
|
5144
5423
|
active: true
|
|
@@ -5182,6 +5461,21 @@ class MobileKeypad extends React__namespace.Component {
|
|
|
5182
5461
|
return ReactDOM__default["default"].findDOMNode(this);
|
|
5183
5462
|
});
|
|
5184
5463
|
}
|
|
5464
|
+
componentDidMount() {
|
|
5465
|
+
this._resize();
|
|
5466
|
+
window.addEventListener("resize", this._throttleResizeHandler);
|
|
5467
|
+
window.addEventListener("orientationchange", this._throttleResizeHandler);
|
|
5468
|
+
this._containerResizeObserver = new ResizeObserver(this._throttleResizeHandler);
|
|
5469
|
+
if (this._containerRef.current) {
|
|
5470
|
+
this._containerResizeObserver.observe(this._containerRef.current);
|
|
5471
|
+
}
|
|
5472
|
+
}
|
|
5473
|
+
componentWillUnMount() {
|
|
5474
|
+
var _this$_containerResiz;
|
|
5475
|
+
window.removeEventListener("resize", this._throttleResizeHandler);
|
|
5476
|
+
window.removeEventListener("orientationchange", this._throttleResizeHandler);
|
|
5477
|
+
(_this$_containerResiz = this._containerResizeObserver) === null || _this$_containerResiz === void 0 ? void 0 : _this$_containerResiz.disconnect();
|
|
5478
|
+
}
|
|
5185
5479
|
_handleClickKey(key) {
|
|
5186
5480
|
var _this$state$keyHandle, _this$state;
|
|
5187
5481
|
if (key === "DISMISS") {
|
|
@@ -5199,6 +5493,7 @@ class MobileKeypad extends React__namespace.Component {
|
|
|
5199
5493
|
} = this.props;
|
|
5200
5494
|
const {
|
|
5201
5495
|
active,
|
|
5496
|
+
containerWidth,
|
|
5202
5497
|
cursor,
|
|
5203
5498
|
keypadConfig
|
|
5204
5499
|
} = this.state;
|
|
@@ -5210,6 +5505,7 @@ class MobileKeypad extends React__namespace.Component {
|
|
|
5210
5505
|
const isExpression = (keypadConfig === null || keypadConfig === void 0 ? void 0 : keypadConfig.keypadType) === "EXPRESSION";
|
|
5211
5506
|
return /*#__PURE__*/React__namespace.createElement(View, {
|
|
5212
5507
|
style: containerStyle,
|
|
5508
|
+
forwardRef: this._containerRef,
|
|
5213
5509
|
ref: element => {
|
|
5214
5510
|
if (!this.hasMounted && element) {
|
|
5215
5511
|
var _this$props$onElement, _this$props2;
|
|
@@ -5245,6 +5541,7 @@ class MobileKeypad extends React__namespace.Component {
|
|
|
5245
5541
|
logarithms: isExpression,
|
|
5246
5542
|
basicRelations: isExpression,
|
|
5247
5543
|
advancedRelations: isExpression,
|
|
5544
|
+
expandedView: containerWidth > expandedViewThreshold$1,
|
|
5248
5545
|
showDismiss: true
|
|
5249
5546
|
}));
|
|
5250
5547
|
}
|
|
@@ -6944,7 +7241,7 @@ const styles$6 = aphrodite.StyleSheet.create({
|
|
|
6944
7241
|
backgroundColor: wonderBlocksBlue
|
|
6945
7242
|
},
|
|
6946
7243
|
light: {
|
|
6947
|
-
backgroundColor: "
|
|
7244
|
+
backgroundColor: Color__default["default"].offBlack32
|
|
6948
7245
|
},
|
|
6949
7246
|
iconWrapper: {
|
|
6950
7247
|
zIndex: focusBoxZIndex + 1
|