@khanacademy/math-input 10.0.0 → 10.0.1
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/es/index.css +3 -5
- package/dist/index.css +3 -5
- package/less/overrides.less +8 -9
- package/package.json +1 -1
- package/src/full-math-input.stories.tsx +17 -18
package/CHANGELOG.md
CHANGED
package/dist/es/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.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/less/overrides.less
CHANGED
|
@@ -6,17 +6,18 @@
|
|
|
6
6
|
@emptyBlockBorderRadius: 1px;
|
|
7
7
|
@emptyBlockPadding: 4px;
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
// frequency for toggling the application of the .mq-blink class.
|
|
11
|
-
//
|
|
12
|
-
|
|
9
|
+
// Originally this was 500ms to match MathQuill's own
|
|
10
|
+
// frequency for toggling the application of the .mq-blink class.
|
|
11
|
+
// Due to the inconsistent nature of `setTimer` this caused weird
|
|
12
|
+
// flickering in the animation, so keeping this below MQ's animation.
|
|
13
|
+
@cursorAnimationDuration: 300ms;
|
|
13
14
|
|
|
14
15
|
.keypad-input {
|
|
15
16
|
outline: none !important;
|
|
16
17
|
|
|
17
18
|
.mq-editable-field {
|
|
18
19
|
.mq-root-block {
|
|
19
|
-
overflow-x:
|
|
20
|
+
overflow-x: auto;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
.mq-cursor:not(:only-child),
|
|
@@ -40,13 +41,12 @@
|
|
|
40
41
|
|
|
41
42
|
// Fade the cursor out, overriding MathQuill's default behavior.
|
|
42
43
|
opacity: 1 !important;
|
|
43
|
-
transition: opacity @cursorAnimationDuration ease
|
|
44
|
+
transition: opacity @cursorAnimationDuration ease !important;
|
|
44
45
|
visibility: visible !important;
|
|
45
46
|
|
|
46
47
|
&.mq-blink {
|
|
47
48
|
// And fade the cursor back in.
|
|
48
49
|
opacity: 0 !important;
|
|
49
|
-
transition: opacity @cursorAnimationDuration ease-in !important;
|
|
50
50
|
visibility: visible !important;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -58,13 +58,12 @@
|
|
|
58
58
|
border-radius: @emptyBlockBorderRadius;
|
|
59
59
|
opacity: 1 !important;
|
|
60
60
|
padding: 0 @emptyBlockPadding 0 @emptyBlockPadding;
|
|
61
|
-
transition: border-color @cursorAnimationDuration ease
|
|
61
|
+
transition: border-color @cursorAnimationDuration ease !important;
|
|
62
62
|
|
|
63
63
|
&.mq-blink {
|
|
64
64
|
// And animate it between blue and gray.
|
|
65
65
|
border-color: @wonderBlocksBlue !important;
|
|
66
66
|
opacity: 1 !important;
|
|
67
|
-
transition: border-color @cursorAnimationDuration ease-in !important;
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {INITIAL_VIEWPORTS} from "@storybook/addon-viewport";
|
|
2
1
|
import * as React from "react";
|
|
3
2
|
|
|
4
3
|
import type {KeypadAPI} from "./types";
|
|
@@ -16,7 +15,6 @@ export default {
|
|
|
16
15
|
{name: "light background", value: "lightgrey", default: true},
|
|
17
16
|
],
|
|
18
17
|
},
|
|
19
|
-
viewport: {defaultViewport: "iphone6", viewports: INITIAL_VIEWPORTS},
|
|
20
18
|
},
|
|
21
19
|
};
|
|
22
20
|
|
|
@@ -53,23 +51,24 @@ export const Basic = () => {
|
|
|
53
51
|
}, [keypadElement, expression]);
|
|
54
52
|
|
|
55
53
|
return (
|
|
56
|
-
<div style={{
|
|
57
|
-
<div
|
|
58
|
-
<
|
|
59
|
-
style={{textAlign: "center", margin: 20, display: "block"}}
|
|
60
|
-
>
|
|
54
|
+
<div style={{padding: "1rem 2rem"}}>
|
|
55
|
+
<div>
|
|
56
|
+
<div>
|
|
61
57
|
NOTE: To properly test the input interaction, you will need
|
|
62
|
-
to simulate a device using the dev tools.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
58
|
+
to simulate a device using the dev tools. MathInput requires
|
|
59
|
+
touch events (not click events).
|
|
60
|
+
</div>
|
|
61
|
+
<div style={{padding: "1rem 0"}}>
|
|
62
|
+
<button onClick={() => setExpression(!expression)}>
|
|
63
|
+
{`Use ${expression ? "Fraction" : "Expression"} Keypad`}
|
|
64
|
+
</button>
|
|
65
|
+
<button onClick={() => setV2Keypad(!v2Keypad)}>
|
|
66
|
+
{`Use ${v2Keypad ? "Legacy" : "New"} Keypad`}
|
|
67
|
+
</button>
|
|
68
|
+
<button onClick={() => toggleKeypad()}>
|
|
69
|
+
{`Toggle Keypad`}
|
|
70
|
+
</button>
|
|
71
|
+
</div>
|
|
73
72
|
</div>
|
|
74
73
|
|
|
75
74
|
<KeypadInput
|