@khanacademy/math-input 4.2.0 → 4.3.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 +6 -0
- package/dist/components/input/mathquill-types.d.ts +2 -0
- package/dist/components/input/mathquill-types.js.flow +2 -0
- package/dist/components/keypad/index.d.ts +8 -16
- package/dist/components/keypad/index.js.flow +10 -22
- package/dist/components/keypad/keypad-button.d.ts +12 -0
- package/dist/components/keypad/keypad-button.js.flow +18 -0
- package/dist/components/keypad/keypad-pages/extras-page.d.ts +9 -0
- package/dist/components/keypad/{operators-page/basic-relations-buttons.js.flow → keypad-pages/extras-page.js.flow} +3 -3
- package/dist/components/keypad/keypad-pages/geometry-page.d.ts +7 -0
- package/dist/components/keypad/{operators-page/logarithms-buttons.js.flow → keypad-pages/geometry-page.js.flow} +1 -3
- package/dist/components/keypad/keypad-pages/numbers-page.d.ts +7 -0
- package/dist/components/keypad/{operators-page/pre-algebra-buttons.js.flow → keypad-pages/numbers-page.js.flow} +1 -3
- package/dist/components/keypad/keypad-pages/operators-page.d.ts +11 -0
- package/dist/components/keypad/{operators-page/advanced-relations-buttons.js.flow → keypad-pages/operators-page.js.flow} +5 -3
- package/dist/components/keypad/shared-keys.d.ts +9 -0
- package/dist/components/keypad/{numbers-page/types.js.flow → shared-keys.js.flow} +4 -1
- package/dist/es/index.js +321 -465
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +319 -488
- package/dist/index.js.map +1 -1
- package/package.json +2 -3
- package/src/components/input/__tests__/test-math-wrapper.ts +2 -5
- package/src/components/input/mathquill-types.ts +6 -0
- package/src/components/keypad/__tests__/keypad-button.test.tsx +4 -2
- package/src/components/keypad/index.tsx +73 -49
- package/src/components/keypad/{button.stories.tsx → keypad-button.stories.tsx} +2 -1
- package/src/components/keypad/keypad-button.tsx +128 -0
- package/src/components/keypad/keypad-mathquill.stories.tsx +9 -3
- package/src/components/keypad/keypad-pages/extras-page.tsx +34 -0
- package/src/components/keypad/keypad-pages/geometry-page.tsx +33 -0
- package/src/components/keypad/keypad-pages/numbers-page.tsx +84 -0
- package/src/components/keypad/keypad-pages/operators-page.tsx +116 -0
- package/src/components/keypad/shared-keys.tsx +78 -0
- package/tsconfig-build.tsbuildinfo +1 -1
- package/dist/components/keypad/button.d.ts +0 -12
- package/dist/components/keypad/button.js.flow +0 -18
- package/dist/components/keypad/extras-page/index.d.ts +0 -10
- package/dist/components/keypad/extras-page/index.js.flow +0 -15
- package/dist/components/keypad/geometry-page/index.d.ts +0 -9
- package/dist/components/keypad/geometry-page/index.js.flow +0 -14
- package/dist/components/keypad/keypad-page-items.d.ts +0 -26
- package/dist/components/keypad/keypad-page-items.js.flow +0 -40
- package/dist/components/keypad/numbers-page/index.d.ts +0 -10
- package/dist/components/keypad/numbers-page/index.js.flow +0 -18
- package/dist/components/keypad/numbers-page/types.d.ts +0 -4
- package/dist/components/keypad/operators-page/advanced-relations-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/basic-relations-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/index.d.ts +0 -10
- package/dist/components/keypad/operators-page/index.js.flow +0 -18
- package/dist/components/keypad/operators-page/logarithms-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/pre-algebra-buttons.d.ts +0 -8
- package/dist/components/keypad/operators-page/types.d.ts +0 -6
- package/dist/components/keypad/operators-page/types.js.flow +0 -12
- package/src/components/keypad/__tests__/Button.test.tsx +0 -51
- package/src/components/keypad/button.tsx +0 -108
- package/src/components/keypad/extras-page/index.tsx +0 -27
- package/src/components/keypad/geometry-page/index.tsx +0 -89
- package/src/components/keypad/keypad-page-items.tsx +0 -118
- package/src/components/keypad/numbers-page/index.tsx +0 -136
- package/src/components/keypad/numbers-page/types.ts +0 -4
- package/src/components/keypad/operators-page/advanced-relations-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/basic-relations-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/index.tsx +0 -94
- package/src/components/keypad/operators-page/logarithms-buttons.tsx +0 -33
- package/src/components/keypad/operators-page/pre-algebra-buttons.tsx +0 -37
- package/src/components/keypad/operators-page/types.ts +0 -6
- /package/src/components/keypad/{keypad-pages.stories.tsx → keypad-pages/keypad-pages.stories.tsx} +0 -0
package/dist/es/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { getDecimalSeparator } from '@khanacademy/wonder-blocks-i18n';
|
|
|
4
4
|
import { entries } from '@khanacademy/wonder-stuff-core';
|
|
5
5
|
import { StyleSheet, css } from 'aphrodite';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import React__default from 'react';
|
|
8
7
|
import ReactDOM from 'react-dom';
|
|
9
8
|
import $ from 'jquery';
|
|
10
9
|
import MathQuill from 'mathquill';
|
|
@@ -7329,88 +7328,6 @@ class ProvidedKeypad extends React.Component {
|
|
|
7329
7328
|
}
|
|
7330
7329
|
}
|
|
7331
7330
|
|
|
7332
|
-
const styles$1 = StyleSheet.create({
|
|
7333
|
-
base: {
|
|
7334
|
-
display: "flex",
|
|
7335
|
-
justifyContent: "center",
|
|
7336
|
-
alignItems: "center",
|
|
7337
|
-
boxShadow: "0px 1px 0px rgba(33, 36, 44, 0.32)",
|
|
7338
|
-
boxSizing: "border-box",
|
|
7339
|
-
background: Color.white,
|
|
7340
|
-
borderRadius: 4,
|
|
7341
|
-
border: `1px solid transparent`,
|
|
7342
|
-
flex: 1,
|
|
7343
|
-
minHeight: 42,
|
|
7344
|
-
minWidth: 42,
|
|
7345
|
-
padding: 1
|
|
7346
|
-
},
|
|
7347
|
-
hovered: {
|
|
7348
|
-
border: `1px solid ${Color.blue}`,
|
|
7349
|
-
padding: 1,
|
|
7350
|
-
boxShadow: "none"
|
|
7351
|
-
},
|
|
7352
|
-
focused: {
|
|
7353
|
-
border: `2px solid ${Color.blue}`,
|
|
7354
|
-
padding: 0,
|
|
7355
|
-
boxShadow: "none"
|
|
7356
|
-
},
|
|
7357
|
-
pressed: {
|
|
7358
|
-
border: "2px solid #1B50B3",
|
|
7359
|
-
padding: 0,
|
|
7360
|
-
background: `linear-gradient(0deg, rgba(24, 101, 242, 0.32), rgba(24, 101, 242, 0.32)), ${Color.white}`,
|
|
7361
|
-
boxShadow: "none"
|
|
7362
|
-
},
|
|
7363
|
-
outerBoxBase: {
|
|
7364
|
-
padding: 1,
|
|
7365
|
-
height: "100%",
|
|
7366
|
-
width: "100%",
|
|
7367
|
-
boxSizing: "border-box",
|
|
7368
|
-
borderRadius: 7,
|
|
7369
|
-
border: "2px solid transparent"
|
|
7370
|
-
},
|
|
7371
|
-
outerBoxHover: {
|
|
7372
|
-
border: `2px solid ${Color.blue}`
|
|
7373
|
-
},
|
|
7374
|
-
outerBoxPressed: {
|
|
7375
|
-
border: "2px solid #1B50B3"
|
|
7376
|
-
},
|
|
7377
|
-
clickable: {
|
|
7378
|
-
width: "100%",
|
|
7379
|
-
height: "100%",
|
|
7380
|
-
boxSizing: "border-box"
|
|
7381
|
-
}
|
|
7382
|
-
});
|
|
7383
|
-
class Button extends React.Component {
|
|
7384
|
-
render() {
|
|
7385
|
-
const {
|
|
7386
|
-
onPress,
|
|
7387
|
-
ariaLabel,
|
|
7388
|
-
children,
|
|
7389
|
-
style,
|
|
7390
|
-
tintColor
|
|
7391
|
-
} = this.props;
|
|
7392
|
-
return /*#__PURE__*/React.createElement(View$1, {
|
|
7393
|
-
style: style
|
|
7394
|
-
}, /*#__PURE__*/React.createElement(Clickable, {
|
|
7395
|
-
onClick: onPress,
|
|
7396
|
-
style: styles$1.clickable,
|
|
7397
|
-
"aria-label": ariaLabel
|
|
7398
|
-
}, ({
|
|
7399
|
-
hovered,
|
|
7400
|
-
focused,
|
|
7401
|
-
pressed
|
|
7402
|
-
}) => {
|
|
7403
|
-
return /*#__PURE__*/React.createElement(View$1, {
|
|
7404
|
-
style: [styles$1.outerBoxBase, hovered && styles$1.outerBoxHover, pressed && styles$1.outerBoxPressed]
|
|
7405
|
-
}, /*#__PURE__*/React.createElement(View$1, {
|
|
7406
|
-
style: [styles$1.base, tintColor != null ? {
|
|
7407
|
-
background: tintColor
|
|
7408
|
-
} : undefined, hovered && styles$1.hovered, focused && styles$1.focused, pressed && styles$1.pressed]
|
|
7409
|
-
}, children));
|
|
7410
|
-
}));
|
|
7411
|
-
}
|
|
7412
|
-
}
|
|
7413
|
-
|
|
7414
7331
|
/*
|
|
7415
7332
|
The SVGs in this file should be treated as binary assets. If, in the future,
|
|
7416
7333
|
we need to make changes to update the color or size or shape of the glyph
|
|
@@ -8169,386 +8086,300 @@ function ButtonAsset({
|
|
|
8169
8086
|
}
|
|
8170
8087
|
}
|
|
8171
8088
|
|
|
8172
|
-
const KeypadPageContainer = ({
|
|
8173
|
-
children
|
|
8174
|
-
}) => /*#__PURE__*/React.createElement(View$1, {
|
|
8175
|
-
style: {
|
|
8176
|
-
backgroundColor: "#DBDCDD",
|
|
8177
|
-
width: "100%",
|
|
8178
|
-
height: 192,
|
|
8179
|
-
display: "grid",
|
|
8180
|
-
gridTemplateColumns: "repeat(6, 1fr)",
|
|
8181
|
-
gridTemplateRows: "repeat(4, 1fr)"
|
|
8182
|
-
}
|
|
8183
|
-
}, children);
|
|
8184
8089
|
const KeypadButton = ({
|
|
8090
|
+
coord,
|
|
8185
8091
|
keyConfig,
|
|
8186
8092
|
onClickKey,
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
tintColor:
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
})
|
|
8197
|
-
|
|
8198
|
-
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
}
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
}
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
|
|
8215
|
-
|
|
8216
|
-
}
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
|
|
8228
|
-
|
|
8093
|
+
style,
|
|
8094
|
+
secondary,
|
|
8095
|
+
action
|
|
8096
|
+
}) => {
|
|
8097
|
+
const tintColor = secondary ? "#F6F6F7" : action ? "#DBDCDD" : undefined;
|
|
8098
|
+
return /*#__PURE__*/React.createElement(View$1, {
|
|
8099
|
+
style: _extends({
|
|
8100
|
+
gridColumn: coord[0] + 1,
|
|
8101
|
+
gridRow: coord[1] + 1
|
|
8102
|
+
}, style)
|
|
8103
|
+
}, /*#__PURE__*/React.createElement(Clickable, {
|
|
8104
|
+
onClick: () => onClickKey(keyConfig.id),
|
|
8105
|
+
style: styles$1.clickable,
|
|
8106
|
+
"aria-label": keyConfig.ariaLabel
|
|
8107
|
+
}, ({
|
|
8108
|
+
hovered,
|
|
8109
|
+
focused,
|
|
8110
|
+
pressed
|
|
8111
|
+
}) => {
|
|
8112
|
+
return /*#__PURE__*/React.createElement(View$1, {
|
|
8113
|
+
style: [styles$1.outerBoxBase, hovered && styles$1.outerBoxHover, pressed && styles$1.outerBoxPressed]
|
|
8114
|
+
}, /*#__PURE__*/React.createElement(View$1, {
|
|
8115
|
+
style: [styles$1.base, tintColor != null ? {
|
|
8116
|
+
background: tintColor
|
|
8117
|
+
} : undefined, hovered && styles$1.hovered, focused && styles$1.focused, pressed && styles$1.pressed]
|
|
8118
|
+
}, /*#__PURE__*/React.createElement(ButtonAsset, {
|
|
8119
|
+
id: keyConfig.id
|
|
8120
|
+
})));
|
|
8121
|
+
}));
|
|
8122
|
+
};
|
|
8123
|
+
const styles$1 = StyleSheet.create({
|
|
8124
|
+
base: {
|
|
8125
|
+
display: "flex",
|
|
8126
|
+
justifyContent: "center",
|
|
8127
|
+
alignItems: "center",
|
|
8128
|
+
boxShadow: "0px 1px 0px rgba(33, 36, 44, 0.32)",
|
|
8129
|
+
boxSizing: "border-box",
|
|
8130
|
+
background: Color.white,
|
|
8131
|
+
borderRadius: 4,
|
|
8132
|
+
border: `1px solid transparent`,
|
|
8133
|
+
flex: 1,
|
|
8134
|
+
minHeight: 42,
|
|
8135
|
+
minWidth: 42,
|
|
8136
|
+
padding: 1
|
|
8137
|
+
},
|
|
8138
|
+
hovered: {
|
|
8139
|
+
border: `1px solid ${Color.blue}`,
|
|
8140
|
+
padding: 1,
|
|
8141
|
+
boxShadow: "none"
|
|
8142
|
+
},
|
|
8143
|
+
focused: {
|
|
8144
|
+
border: `2px solid ${Color.blue}`,
|
|
8145
|
+
padding: 0,
|
|
8146
|
+
boxShadow: "none"
|
|
8147
|
+
},
|
|
8148
|
+
pressed: {
|
|
8149
|
+
border: "2px solid #1B50B3",
|
|
8150
|
+
padding: 0,
|
|
8151
|
+
background: `linear-gradient(0deg, rgba(24, 101, 242, 0.32), rgba(24, 101, 242, 0.32)), ${Color.white}`,
|
|
8152
|
+
boxShadow: "none"
|
|
8153
|
+
},
|
|
8154
|
+
outerBoxBase: {
|
|
8155
|
+
padding: 1,
|
|
8229
8156
|
height: "100%",
|
|
8230
8157
|
width: "100%",
|
|
8231
8158
|
boxSizing: "border-box",
|
|
8232
8159
|
borderRadius: 7,
|
|
8233
|
-
border: "
|
|
8234
|
-
}
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8160
|
+
border: "2px solid transparent"
|
|
8161
|
+
},
|
|
8162
|
+
outerBoxHover: {
|
|
8163
|
+
border: `2px solid ${Color.blue}`
|
|
8164
|
+
},
|
|
8165
|
+
outerBoxPressed: {
|
|
8166
|
+
border: "2px solid #1B50B3"
|
|
8167
|
+
},
|
|
8168
|
+
clickable: {
|
|
8238
8169
|
width: "100%",
|
|
8239
8170
|
height: "100%",
|
|
8240
|
-
|
|
8241
|
-
border: `1px solid transparent`
|
|
8171
|
+
boxSizing: "border-box"
|
|
8242
8172
|
}
|
|
8243
|
-
})
|
|
8173
|
+
});
|
|
8244
8174
|
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8175
|
+
const columns = 4;
|
|
8176
|
+
function ExtrasPage(props) {
|
|
8177
|
+
const {
|
|
8178
|
+
extraKeys,
|
|
8179
|
+
onClickKey
|
|
8180
|
+
} = props;
|
|
8181
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, extraKeys.map((key, i) => {
|
|
8182
|
+
// Map 1D array to Cartesian coordinates
|
|
8183
|
+
const coordX = i % columns;
|
|
8184
|
+
const coordY = i / columns;
|
|
8185
|
+
return /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8252
8186
|
key: key,
|
|
8253
8187
|
keyConfig: KeyConfigs[key],
|
|
8254
|
-
onClickKey: onClickKey
|
|
8255
|
-
|
|
8256
|
-
|
|
8188
|
+
onClickKey: onClickKey,
|
|
8189
|
+
coord: [coordX, coordY]
|
|
8190
|
+
});
|
|
8191
|
+
}));
|
|
8257
8192
|
}
|
|
8258
8193
|
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
style: {
|
|
8277
|
-
gridColumn: 5
|
|
8278
|
-
}
|
|
8279
|
-
}), /*#__PURE__*/React.createElement(SecondaryKeypadButton, {
|
|
8280
|
-
keyConfig: KeyConfigs.RIGHT_PAREN,
|
|
8281
|
-
onClickKey: onClickKey,
|
|
8282
|
-
style: {
|
|
8283
|
-
gridColumn: 6
|
|
8284
|
-
}
|
|
8285
|
-
}), /*#__PURE__*/React.createElement(SecondaryKeypadButton, {
|
|
8286
|
-
keyConfig: KeyConfigs.x,
|
|
8287
|
-
onClickKey: onClickKey,
|
|
8288
|
-
style: {
|
|
8289
|
-
gridColumn: 5
|
|
8290
|
-
}
|
|
8291
|
-
}), /*#__PURE__*/React.createElement(SecondaryKeypadButton, {
|
|
8292
|
-
keyConfig: KeyConfigs.FRAC_INCLUSIVE,
|
|
8293
|
-
onClickKey: onClickKey,
|
|
8294
|
-
style: {
|
|
8295
|
-
gridColumn: 6
|
|
8296
|
-
}
|
|
8297
|
-
}), /*#__PURE__*/React.createElement(SecondaryKeypadButton, {
|
|
8298
|
-
keyConfig: KeyConfigs.PI,
|
|
8299
|
-
onClickKey: onClickKey,
|
|
8300
|
-
style: {
|
|
8301
|
-
gridColumn: 5
|
|
8302
|
-
}
|
|
8303
|
-
}), /*#__PURE__*/React.createElement(KeypadActionButton, {
|
|
8304
|
-
keyConfig: KeyConfigs.BACKSPACE,
|
|
8305
|
-
style: {
|
|
8306
|
-
gridColumn: "6"
|
|
8307
|
-
},
|
|
8308
|
-
onClickKey: onClickKey
|
|
8309
|
-
}), /*#__PURE__*/React.createElement(KeypadActionButton, {
|
|
8310
|
-
keyConfig: KeyConfigs.DISMISS,
|
|
8311
|
-
style: {
|
|
8312
|
-
gridColumn: "6"
|
|
8313
|
-
},
|
|
8314
|
-
onClickKey: onClickKey
|
|
8315
|
-
}));
|
|
8316
|
-
}
|
|
8194
|
+
function GeometryPage(props) {
|
|
8195
|
+
const {
|
|
8196
|
+
onClickKey
|
|
8197
|
+
} = props;
|
|
8198
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8199
|
+
keyConfig: KeyConfigs.SIN,
|
|
8200
|
+
onClickKey: onClickKey,
|
|
8201
|
+
coord: [0, 0]
|
|
8202
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8203
|
+
keyConfig: KeyConfigs.COS,
|
|
8204
|
+
onClickKey: onClickKey,
|
|
8205
|
+
coord: [1, 0]
|
|
8206
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8207
|
+
keyConfig: KeyConfigs.TAN,
|
|
8208
|
+
onClickKey: onClickKey,
|
|
8209
|
+
coord: [2, 0]
|
|
8210
|
+
}));
|
|
8317
8211
|
}
|
|
8318
8212
|
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
|
|
8346
|
-
|
|
8347
|
-
|
|
8348
|
-
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8353
|
-
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
keyConfig: KeyConfigs.FRAC_INCLUSIVE,
|
|
8373
|
-
onClickKey: onClickKey,
|
|
8374
|
-
style: {
|
|
8375
|
-
gridColumn: "5 / 7"
|
|
8376
|
-
}
|
|
8377
|
-
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8378
|
-
keyConfig: KeyConfigs.NUM_1,
|
|
8379
|
-
onClickKey: onClickKey
|
|
8380
|
-
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8381
|
-
keyConfig: KeyConfigs.NUM_2,
|
|
8382
|
-
onClickKey: onClickKey
|
|
8383
|
-
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8384
|
-
keyConfig: KeyConfigs.NUM_3,
|
|
8385
|
-
onClickKey: onClickKey
|
|
8386
|
-
}), /*#__PURE__*/React.createElement(SecondaryKeypadButton, {
|
|
8387
|
-
keyConfig: KeyConfigs.PLUS,
|
|
8388
|
-
style: this.props.divisionKey ? {
|
|
8389
|
-
gridColumn: "4",
|
|
8390
|
-
gridRow: "4"
|
|
8391
|
-
} : {
|
|
8392
|
-
gridColumn: "4",
|
|
8393
|
-
gridRowStart: "3",
|
|
8394
|
-
gridRowEnd: "5"
|
|
8395
|
-
},
|
|
8396
|
-
onClickKey: onClickKey
|
|
8397
|
-
}), /*#__PURE__*/React.createElement(KeypadActionButton, {
|
|
8398
|
-
keyConfig: KeyConfigs.BACKSPACE,
|
|
8399
|
-
style: {
|
|
8400
|
-
gridColumn: "6"
|
|
8401
|
-
},
|
|
8402
|
-
onClickKey: onClickKey
|
|
8403
|
-
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8404
|
-
keyConfig: KeyConfigs.NUM_0,
|
|
8405
|
-
onClickKey: onClickKey
|
|
8406
|
-
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8407
|
-
keyConfig: KeyConfigs.DECIMAL,
|
|
8408
|
-
onClickKey: onClickKey
|
|
8409
|
-
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8410
|
-
keyConfig: KeyConfigs.NEGATIVE,
|
|
8411
|
-
onClickKey: onClickKey
|
|
8412
|
-
}), /*#__PURE__*/React.createElement(KeypadActionButton, {
|
|
8413
|
-
keyConfig: KeyConfigs.DISMISS,
|
|
8414
|
-
style: {
|
|
8415
|
-
gridColumn: "6"
|
|
8416
|
-
},
|
|
8417
|
-
onClickKey: onClickKey
|
|
8418
|
-
}));
|
|
8419
|
-
}
|
|
8213
|
+
function NumbersPage(props) {
|
|
8214
|
+
const {
|
|
8215
|
+
onClickKey
|
|
8216
|
+
} = props;
|
|
8217
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8218
|
+
keyConfig: KeyConfigs.NUM_7,
|
|
8219
|
+
onClickKey: onClickKey,
|
|
8220
|
+
coord: [0, 0]
|
|
8221
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8222
|
+
keyConfig: KeyConfigs.NUM_8,
|
|
8223
|
+
onClickKey: onClickKey,
|
|
8224
|
+
coord: [1, 0]
|
|
8225
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8226
|
+
keyConfig: KeyConfigs.NUM_9,
|
|
8227
|
+
onClickKey: onClickKey,
|
|
8228
|
+
coord: [2, 0]
|
|
8229
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8230
|
+
keyConfig: KeyConfigs.NUM_4,
|
|
8231
|
+
onClickKey: onClickKey,
|
|
8232
|
+
coord: [0, 1]
|
|
8233
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8234
|
+
keyConfig: KeyConfigs.NUM_5,
|
|
8235
|
+
onClickKey: onClickKey,
|
|
8236
|
+
coord: [1, 1]
|
|
8237
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8238
|
+
keyConfig: KeyConfigs.NUM_6,
|
|
8239
|
+
onClickKey: onClickKey,
|
|
8240
|
+
coord: [2, 1]
|
|
8241
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8242
|
+
keyConfig: KeyConfigs.NUM_1,
|
|
8243
|
+
onClickKey: onClickKey,
|
|
8244
|
+
coord: [0, 2]
|
|
8245
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8246
|
+
keyConfig: KeyConfigs.NUM_2,
|
|
8247
|
+
onClickKey: onClickKey,
|
|
8248
|
+
coord: [1, 2]
|
|
8249
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8250
|
+
keyConfig: KeyConfigs.NUM_3,
|
|
8251
|
+
onClickKey: onClickKey,
|
|
8252
|
+
coord: [2, 2]
|
|
8253
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8254
|
+
keyConfig: KeyConfigs.NUM_0,
|
|
8255
|
+
onClickKey: onClickKey,
|
|
8256
|
+
coord: [0, 3]
|
|
8257
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8258
|
+
keyConfig: KeyConfigs.DECIMAL,
|
|
8259
|
+
onClickKey: onClickKey,
|
|
8260
|
+
coord: [1, 3]
|
|
8261
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8262
|
+
keyConfig: KeyConfigs.NEGATIVE,
|
|
8263
|
+
onClickKey: onClickKey,
|
|
8264
|
+
coord: [2, 3]
|
|
8265
|
+
}));
|
|
8420
8266
|
}
|
|
8421
8267
|
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8426
|
-
|
|
8427
|
-
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
|
|
8445
|
-
|
|
8446
|
-
}), /*#__PURE__*/
|
|
8447
|
-
|
|
8448
|
-
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
}), /*#__PURE__*/
|
|
8463
|
-
|
|
8464
|
-
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
}), /*#__PURE__*/
|
|
8479
|
-
|
|
8480
|
-
|
|
8481
|
-
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
-
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
|
|
8523
|
-
|
|
8524
|
-
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
onClickKey: onClickKey
|
|
8533
|
-
}), /*#__PURE__*/React.createElement(AdvancedRelations, {
|
|
8534
|
-
onClickKey: onClickKey,
|
|
8535
|
-
placeholder: !this.props.advancedRelations
|
|
8536
|
-
}), /*#__PURE__*/React.createElement(KeypadActionButton, {
|
|
8537
|
-
keyConfig: KeyConfigs.DISMISS,
|
|
8538
|
-
style: {
|
|
8539
|
-
gridColumn: "6"
|
|
8540
|
-
},
|
|
8541
|
-
onClickKey: onClickKey
|
|
8542
|
-
}));
|
|
8543
|
-
}
|
|
8268
|
+
function OperatorsPage(props) {
|
|
8269
|
+
const {
|
|
8270
|
+
onClickKey,
|
|
8271
|
+
preAlgebra,
|
|
8272
|
+
logarithms,
|
|
8273
|
+
basicRelations,
|
|
8274
|
+
advancedRelations
|
|
8275
|
+
} = props;
|
|
8276
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, preAlgebra && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8277
|
+
keyConfig: KeyConfigs.EXP_2,
|
|
8278
|
+
onClickKey: onClickKey,
|
|
8279
|
+
coord: [0, 0]
|
|
8280
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8281
|
+
keyConfig: KeyConfigs.EXP,
|
|
8282
|
+
onClickKey: onClickKey,
|
|
8283
|
+
coord: [1, 0]
|
|
8284
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8285
|
+
keyConfig: KeyConfigs.SQRT,
|
|
8286
|
+
onClickKey: onClickKey,
|
|
8287
|
+
coord: [2, 0]
|
|
8288
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8289
|
+
keyConfig: KeyConfigs.RADICAL,
|
|
8290
|
+
onClickKey: onClickKey,
|
|
8291
|
+
coord: [3, 0]
|
|
8292
|
+
})), logarithms && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8293
|
+
keyConfig: KeyConfigs.LOG,
|
|
8294
|
+
onClickKey: onClickKey,
|
|
8295
|
+
coord: [0, 1]
|
|
8296
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8297
|
+
keyConfig: KeyConfigs.LOG_N,
|
|
8298
|
+
onClickKey: onClickKey,
|
|
8299
|
+
coord: [1, 1]
|
|
8300
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8301
|
+
keyConfig: KeyConfigs.LN,
|
|
8302
|
+
onClickKey: onClickKey,
|
|
8303
|
+
coord: [2, 1]
|
|
8304
|
+
})), basicRelations && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8305
|
+
keyConfig: KeyConfigs.EQUAL,
|
|
8306
|
+
onClickKey: onClickKey,
|
|
8307
|
+
coord: [0, 2]
|
|
8308
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8309
|
+
keyConfig: KeyConfigs.LT,
|
|
8310
|
+
onClickKey: onClickKey,
|
|
8311
|
+
coord: [1, 2]
|
|
8312
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8313
|
+
keyConfig: KeyConfigs.GT,
|
|
8314
|
+
onClickKey: onClickKey,
|
|
8315
|
+
coord: [2, 2]
|
|
8316
|
+
})), advancedRelations && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8317
|
+
keyConfig: KeyConfigs.NEQ,
|
|
8318
|
+
onClickKey: onClickKey,
|
|
8319
|
+
coord: [0, 3]
|
|
8320
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8321
|
+
keyConfig: KeyConfigs.LEQ,
|
|
8322
|
+
onClickKey: onClickKey,
|
|
8323
|
+
coord: [1, 3]
|
|
8324
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8325
|
+
keyConfig: KeyConfigs.GEQ,
|
|
8326
|
+
onClickKey: onClickKey,
|
|
8327
|
+
coord: [2, 3]
|
|
8328
|
+
})));
|
|
8329
|
+
}
|
|
8330
|
+
|
|
8331
|
+
function SharedKeys(props) {
|
|
8332
|
+
const {
|
|
8333
|
+
onClickKey,
|
|
8334
|
+
divisionKey,
|
|
8335
|
+
multiplicationDot
|
|
8336
|
+
} = props;
|
|
8337
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8338
|
+
keyConfig: KeyConfigs.PLUS,
|
|
8339
|
+
onClickKey: onClickKey,
|
|
8340
|
+
coord: [4, 0],
|
|
8341
|
+
secondary: true
|
|
8342
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8343
|
+
keyConfig: KeyConfigs.MINUS,
|
|
8344
|
+
onClickKey: onClickKey,
|
|
8345
|
+
coord: [5, 0],
|
|
8346
|
+
secondary: true
|
|
8347
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8348
|
+
keyConfig: multiplicationDot ? KeyConfigs.CDOT : KeyConfigs.TIMES,
|
|
8349
|
+
onClickKey: onClickKey,
|
|
8350
|
+
coord: [4, 1],
|
|
8351
|
+
secondary: true
|
|
8352
|
+
}), divisionKey && /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8353
|
+
keyConfig: KeyConfigs.DIVIDE,
|
|
8354
|
+
onClickKey: onClickKey,
|
|
8355
|
+
coord: [5, 1],
|
|
8356
|
+
secondary: true
|
|
8357
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8358
|
+
keyConfig: KeyConfigs.LEFT_PAREN,
|
|
8359
|
+
onClickKey: onClickKey,
|
|
8360
|
+
coord: [4, 2],
|
|
8361
|
+
secondary: true
|
|
8362
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8363
|
+
keyConfig: KeyConfigs.RIGHT_PAREN,
|
|
8364
|
+
onClickKey: onClickKey,
|
|
8365
|
+
coord: [5, 2],
|
|
8366
|
+
secondary: true
|
|
8367
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8368
|
+
keyConfig: KeyConfigs.FRAC_INCLUSIVE,
|
|
8369
|
+
onClickKey: onClickKey,
|
|
8370
|
+
coord: [4, 3],
|
|
8371
|
+
secondary: true
|
|
8372
|
+
}), /*#__PURE__*/React.createElement(KeypadButton, {
|
|
8373
|
+
keyConfig: KeyConfigs.BACKSPACE,
|
|
8374
|
+
onClickKey: onClickKey,
|
|
8375
|
+
coord: [5, 3],
|
|
8376
|
+
action: true
|
|
8377
|
+
}));
|
|
8544
8378
|
}
|
|
8545
8379
|
|
|
8546
8380
|
function allPages(props) {
|
|
8547
8381
|
var _props$extraKeys;
|
|
8548
8382
|
const pages = ["Numbers"];
|
|
8549
|
-
if ((_props$extraKeys = props.extraKeys) != null && _props$extraKeys.length) {
|
|
8550
|
-
pages.push("Extras");
|
|
8551
|
-
}
|
|
8552
8383
|
if (
|
|
8553
8384
|
// OperatorsButtonSets
|
|
8554
8385
|
props.preAlgebra || props.logarithms || props.basicRelations || props.advancedRelations) {
|
|
@@ -8557,38 +8388,63 @@ function allPages(props) {
|
|
|
8557
8388
|
if (props.trigonometry) {
|
|
8558
8389
|
pages.push("Geometry");
|
|
8559
8390
|
}
|
|
8391
|
+
if ((_props$extraKeys = props.extraKeys) != null && _props$extraKeys.length) {
|
|
8392
|
+
pages.push("Extras");
|
|
8393
|
+
}
|
|
8560
8394
|
return pages;
|
|
8561
8395
|
}
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
}
|
|
8396
|
+
function Keypad(props) {
|
|
8397
|
+
const [selectedPage, setSelectedPage] = React.useState("Numbers");
|
|
8398
|
+
const availablePages = allPages(props);
|
|
8399
|
+
const {
|
|
8400
|
+
onClickKey,
|
|
8401
|
+
extraKeys = [],
|
|
8402
|
+
multiplicationDot,
|
|
8403
|
+
divisionKey,
|
|
8404
|
+
preAlgebra,
|
|
8405
|
+
logarithms,
|
|
8406
|
+
basicRelations,
|
|
8407
|
+
advancedRelations
|
|
8408
|
+
} = props;
|
|
8409
|
+
return /*#__PURE__*/React.createElement(View$1, null, /*#__PURE__*/React.createElement(Tabbar, {
|
|
8410
|
+
items: availablePages,
|
|
8411
|
+
selectedItem: selectedPage,
|
|
8412
|
+
onSelectItem: tabbarItem => {
|
|
8413
|
+
setSelectedPage(tabbarItem);
|
|
8414
|
+
},
|
|
8415
|
+
style: styles.tabbar
|
|
8416
|
+
}), /*#__PURE__*/React.createElement(View$1, {
|
|
8417
|
+
style: styles.grid
|
|
8418
|
+
}, selectedPage === "Numbers" && /*#__PURE__*/React.createElement(NumbersPage, {
|
|
8419
|
+
onClickKey: onClickKey
|
|
8420
|
+
}), selectedPage === "Extras" && /*#__PURE__*/React.createElement(ExtrasPage, {
|
|
8421
|
+
onClickKey: onClickKey,
|
|
8422
|
+
extraKeys: extraKeys
|
|
8423
|
+
}), selectedPage === "Operators" && /*#__PURE__*/React.createElement(OperatorsPage, {
|
|
8424
|
+
onClickKey: onClickKey,
|
|
8425
|
+
preAlgebra: preAlgebra,
|
|
8426
|
+
logarithms: logarithms,
|
|
8427
|
+
basicRelations: basicRelations,
|
|
8428
|
+
advancedRelations: advancedRelations
|
|
8429
|
+
}), selectedPage === "Geometry" && /*#__PURE__*/React.createElement(GeometryPage, {
|
|
8430
|
+
onClickKey: onClickKey
|
|
8431
|
+
}), /*#__PURE__*/React.createElement(SharedKeys, {
|
|
8432
|
+
onClickKey: onClickKey,
|
|
8433
|
+
multiplicationDot: multiplicationDot,
|
|
8434
|
+
divisionKey: divisionKey
|
|
8435
|
+
})));
|
|
8585
8436
|
}
|
|
8586
|
-
Keypad.defaultProps = {
|
|
8587
|
-
extraKeys: []
|
|
8588
|
-
};
|
|
8589
8437
|
const styles = StyleSheet.create({
|
|
8590
8438
|
tabbar: {
|
|
8591
8439
|
background: Color.white
|
|
8440
|
+
},
|
|
8441
|
+
grid: {
|
|
8442
|
+
display: "grid",
|
|
8443
|
+
gridTemplateColumns: "repeat(6, 1fr)",
|
|
8444
|
+
gridTemplateRows: "repeat(4, 1fr)",
|
|
8445
|
+
backgroundColor: "#DBDCDD",
|
|
8446
|
+
maxHeight: 200,
|
|
8447
|
+
maxWidth: 300
|
|
8592
8448
|
}
|
|
8593
8449
|
});
|
|
8594
8450
|
|