-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roll v2 Keypad Onto Desktop Web (#711)
https://github.com/Khan/perseus/assets/23404711/b199ff5b-9db6-4394-8ef3-120531564ab3 Updates Perseus / Math Input to use keypad. Also changes how it's used: - Instead of a set of keys appearing on focus, the button on the right acts as a toggle. - Instead of a warning icon appearing when there is an parsing, the input shows a red "invalid" state and a tooltip appears with a friendly message. - `buttonsVisible` prop states changed: - `focused` default behavior, toggle off to start - `always` default behavior, toggle on to start - `never` toggle button disabled - `buttonSets` type was marked as deprecated - `keypadButtonSets` prop added that takes new type - `buttonSets` maps to `keypadButtonSets` - Also adds optional `extraKeys` prop that takes an array of `Keys`. Author: nedredmond Reviewers: jeremywiebe, nedredmond, handeyeco Required Reviewers: Approved By: jeremywiebe Checks: ✅ codecov/project, ✅ codecov/patch, ✅ Upload Coverage, ✅ Publish npm snapshot (ubuntu-latest, 16.x), ✅ Lint, Typecheck, Format, and Test (ubuntu-latest, 16.x), ✅ Cypress (ubuntu-latest, 16.x), ✅ Extract i18n strings (ubuntu-latest, 16.x), ✅ Jest Coverage (ubuntu-latest, 16.x), ✅ Check builds for changes in size (ubuntu-latest, 16.x), ✅ Publish Storybook to Chromatic (ubuntu-latest, 16.x), ✅ gerald, ✅ Check for .changeset entries for all changed files (ubuntu-latest, 16.x) Pull Request URL: #711
- Loading branch information
1 parent
3046780
commit 5bcf118
Showing
18 changed files
with
730 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
"@khanacademy/perseus": major | ||
"@khanacademy/perseus-editor": patch | ||
--- | ||
|
||
# Update MathInput | ||
|
||
- `buttonSets` is now deprecated in favor of `keypadButtonSets`, but currently maps to the new prop for backwards compatability. | ||
- `buttonsVisible` is now a bit misleading: "focused" is the default state with a toggle-able keypad and "always" shows the keypad by default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
"@khanacademy/perseus": minor | ||
"@khanacademy/math-input": minor | ||
"@khanacademy/perseus-editor": minor | ||
--- | ||
|
||
Desktop Expression Widget now uses v2 keypad |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,120 +1,123 @@ | ||
type Key = | ||
| "PLUS" | ||
| "MINUS" | ||
| "NEGATIVE" | ||
| "TIMES" | ||
| "DIVIDE" | ||
| "DECIMAL" | ||
| "PERIOD" | ||
| "PERCENT" | ||
| "CDOT" | ||
| "EQUAL" | ||
| "NEQ" | ||
| "GT" | ||
| "LT" | ||
| "GEQ" | ||
| "LEQ" // mobile native only | ||
| "FRAC_INCLUSIVE" // mobile native only | ||
| "FRAC_EXCLUSIVE" // mobile native only | ||
| "FRAC" | ||
| "EXP" | ||
| "EXP_2" | ||
| "EXP_3" | ||
| "SQRT" | ||
| "CUBE_ROOT" | ||
| "RADICAL" | ||
| "LEFT_PAREN" | ||
| "RIGHT_PAREN" | ||
| "LN" | ||
| "LOG" | ||
| "LOG_N" | ||
| "SIN" | ||
| "COS" // TODO(charlie): Add in additional Greek letters. | ||
| "TAN" | ||
| "PI" | ||
| "THETA" | ||
| "UP" | ||
| "RIGHT" | ||
| "DOWN" | ||
| "LEFT" | ||
| "BACKSPACE" | ||
| "DISMISS" | ||
| "JUMP_OUT_PARENTHESES" | ||
| "JUMP_OUT_EXPONENT" | ||
| "JUMP_OUT_BASE" | ||
| "JUMP_INTO_NUMERATOR" | ||
| "JUMP_OUT_NUMERATOR" | ||
| "JUMP_OUT_DENOMINATOR" // Multi-functional keys. | ||
| "NOOP" // mobile native only | ||
| "MANY" // A custom key that captures an arbitrary number of symbols but has no 'default' symbol or action. | ||
| "NUM_0" | ||
| "NUM_1" | ||
| "NUM_2" | ||
| "NUM_3" | ||
| "NUM_4" | ||
| "NUM_5" | ||
| "NUM_6" | ||
| "NUM_7" | ||
| "NUM_8" | ||
| "NUM_9" | ||
| "a" | ||
| "b" | ||
| "c" | ||
| "d" | ||
| "e" | ||
| "f" | ||
| "g" | ||
| "h" | ||
| "i" | ||
| "j" | ||
| "k" | ||
| "l" | ||
| "m" | ||
| "n" | ||
| "o" | ||
| "p" | ||
| "q" | ||
| "r" | ||
| "s" | ||
| "t" | ||
| "u" | ||
| "v" | ||
| "w" | ||
| "x" | ||
| "y" | ||
| "z" | ||
| "A" | ||
| "B" | ||
| "C" | ||
| "D" | ||
| "E" | ||
| "F" | ||
| "G" | ||
| "H" | ||
| "I" | ||
| "J" | ||
| "K" | ||
| "L" | ||
| "M" | ||
| "N" | ||
| "O" | ||
| "P" | ||
| "Q" | ||
| "R" | ||
| "S" | ||
| "T" | ||
| "U" | ||
| "V" | ||
| "W" | ||
| "X" | ||
| "Y" | ||
| "Z" | ||
export const KeyArray = [ | ||
"PLUS", | ||
"MINUS", | ||
"NEGATIVE", | ||
"TIMES", | ||
"DIVIDE", | ||
"DECIMAL", | ||
"PERIOD", | ||
"PERCENT", | ||
"CDOT", | ||
"EQUAL", | ||
"NEQ", | ||
"GT", | ||
"LT", | ||
"GEQ", | ||
"LEQ", // mobile native only | ||
"FRAC_INCLUSIVE", // mobile native only | ||
"FRAC_EXCLUSIVE", // mobile native only | ||
"FRAC", | ||
"EXP", | ||
"EXP_2", | ||
"EXP_3", | ||
"SQRT", | ||
"CUBE_ROOT", | ||
"RADICAL", | ||
"LEFT_PAREN", | ||
"RIGHT_PAREN", | ||
"LN", | ||
"LOG", | ||
"LOG_N", | ||
"SIN", | ||
"COS", // TODO(charlie): Add in additional Greek letters., | ||
"TAN", | ||
"PI", | ||
"THETA", | ||
"UP", | ||
"RIGHT", | ||
"DOWN", | ||
"LEFT", | ||
"BACKSPACE", | ||
"DISMISS", | ||
"JUMP_OUT_PARENTHESES", | ||
"JUMP_OUT_EXPONENT", | ||
"JUMP_OUT_BASE", | ||
"JUMP_INTO_NUMERATOR", | ||
"JUMP_OUT_NUMERATOR", | ||
"JUMP_OUT_DENOMINATOR", // Multi-functional keys. | ||
"NOOP", // mobile native only | ||
"MANY", // A custom key that captures an arbitrary number of symbols but has no 'default' symbol or action. | ||
"NUM_0", | ||
"NUM_1", | ||
"NUM_2", | ||
"NUM_3", | ||
"NUM_4", | ||
"NUM_5", | ||
"NUM_6", | ||
"NUM_7", | ||
"NUM_8", | ||
"NUM_9", | ||
"a", | ||
"b", | ||
"c", | ||
"d", | ||
"e", | ||
"f", | ||
"g", | ||
"h", | ||
"i", | ||
"j", | ||
"k", | ||
"l", | ||
"m", | ||
"n", | ||
"o", | ||
"p", | ||
"q", | ||
"r", | ||
"s", | ||
"t", | ||
"u", | ||
"v", | ||
"w", | ||
"x", | ||
"y", | ||
"z", | ||
"A", | ||
"B", | ||
"C", | ||
"D", | ||
"E", | ||
"F", | ||
"G", | ||
"H", | ||
"I", | ||
"J", | ||
"K", | ||
"L", | ||
"M", | ||
"N", | ||
"O", | ||
"P", | ||
"Q", | ||
"R", | ||
"S", | ||
"T", | ||
"U", | ||
"V", | ||
"W", | ||
"X", | ||
"Y", | ||
"Z", | ||
|
||
// Currently only used by | ||
// Perseus' Expression MathInput | ||
| "PHI" | ||
| "NTHROOT3" | ||
| "POW" | ||
| "LOG_B"; | ||
"PHI", | ||
"NTHROOT3", | ||
"POW", | ||
"LOG_B", | ||
] as const; | ||
|
||
type Key = typeof KeyArray[number]; | ||
|
||
export default Key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.