@pie-lib/math-toolbar 3.0.3-next.37 → 3.0.3-next.57
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.json +17 -0
- package/CHANGELOG.md +1049 -0
- package/LICENSE.md +5 -0
- package/lib/done-button.js +51 -0
- package/lib/done-button.js.map +1 -0
- package/lib/editor-and-pad.js +528 -0
- package/lib/editor-and-pad.js.map +1 -0
- package/lib/index.js +241 -0
- package/lib/index.js.map +1 -0
- package/lib/math-preview.js +192 -0
- package/lib/math-preview.js.map +1 -0
- package/lib/utils.js +17 -0
- package/lib/utils.js.map +1 -0
- package/package.json +26 -32
- package/src/__tests__/editor-and-pad.test.js +16 -0
- package/src/__tests__/index.test.js +21 -0
- package/src/__tests__/math-preview.test.js +18 -0
- package/src/done-button.jsx +36 -0
- package/src/editor-and-pad.jsx +498 -0
- package/src/index.jsx +220 -0
- package/src/math-preview.jsx +162 -0
- package/src/utils.js +11 -0
- package/dist/done-button.d.ts +0 -30
- package/dist/done-button.js +0 -34
- package/dist/editor-and-pad.d.ts +0 -47
- package/dist/editor-and-pad.js +0 -352
- package/dist/index.d.ts +0 -90
- package/dist/index.js +0 -158
- package/dist/math-preview.d.ts +0 -22
- package/dist/math-preview.js +0 -125
- package/dist/utils.d.ts +0 -9
- package/dist/utils.js +0 -9
package/src/index.jsx
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import EditorAndPad from './editor-and-pad';
|
|
4
|
+
import { DoneButton } from './done-button';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import MathPreview from './math-preview';
|
|
7
|
+
|
|
8
|
+
export { MathPreview };
|
|
9
|
+
|
|
10
|
+
const PureToolbarContainer = styled('div')({
|
|
11
|
+
display: 'flex',
|
|
12
|
+
width: '100%',
|
|
13
|
+
zIndex: 8,
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export class MathToolbar extends React.Component {
|
|
18
|
+
static propTypes = {
|
|
19
|
+
autoFocus: PropTypes.bool,
|
|
20
|
+
allowAnswerBlock: PropTypes.bool,
|
|
21
|
+
controlledKeypad: PropTypes.bool,
|
|
22
|
+
controlledKeypadMode: PropTypes.bool,
|
|
23
|
+
keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
24
|
+
classNames: PropTypes.object,
|
|
25
|
+
error: PropTypes.string,
|
|
26
|
+
maxResponseAreas: PropTypes.number,
|
|
27
|
+
showKeypad: PropTypes.bool,
|
|
28
|
+
noDecimal: PropTypes.bool,
|
|
29
|
+
additionalKeys: PropTypes.array,
|
|
30
|
+
latex: PropTypes.string.isRequired,
|
|
31
|
+
onAnswerBlockAdd: PropTypes.func,
|
|
32
|
+
onChange: PropTypes.func,
|
|
33
|
+
onDone: PropTypes.func.isRequired,
|
|
34
|
+
onFocus: PropTypes.func,
|
|
35
|
+
onBlur: PropTypes.func,
|
|
36
|
+
hideDoneButton: PropTypes.bool,
|
|
37
|
+
keyPadCharacterRef: PropTypes.func,
|
|
38
|
+
setKeypadInteraction: PropTypes.func,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
static defaultProps = {
|
|
42
|
+
classNames: {},
|
|
43
|
+
keypadMode: 'item-authoring',
|
|
44
|
+
autoFocus: false,
|
|
45
|
+
allowAnswerBlock: false,
|
|
46
|
+
controlledKeypad: false,
|
|
47
|
+
controlledKeypadMode: false,
|
|
48
|
+
noDecimal: false,
|
|
49
|
+
showKeypad: true,
|
|
50
|
+
additionalKeys: [],
|
|
51
|
+
onChange: () => {},
|
|
52
|
+
onAnswerBlockAdd: () => {},
|
|
53
|
+
onFocus: () => {},
|
|
54
|
+
hideDoneButton: false,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
constructor(props) {
|
|
58
|
+
super(props);
|
|
59
|
+
this.state = {
|
|
60
|
+
latex: props.latex,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
done = () => {
|
|
65
|
+
this.props.onDone(this.state.latex);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
69
|
+
this.setState({ latex: nextProps.latex });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onChange = (latex) => {
|
|
73
|
+
this.setState({ latex });
|
|
74
|
+
this.props.onChange(latex);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
render() {
|
|
78
|
+
const { latex } = this.state;
|
|
79
|
+
const {
|
|
80
|
+
classNames,
|
|
81
|
+
autoFocus,
|
|
82
|
+
allowAnswerBlock,
|
|
83
|
+
onAnswerBlockAdd,
|
|
84
|
+
controlledKeypad,
|
|
85
|
+
controlledKeypadMode,
|
|
86
|
+
keypadMode,
|
|
87
|
+
noDecimal,
|
|
88
|
+
additionalKeys,
|
|
89
|
+
showKeypad,
|
|
90
|
+
onFocus,
|
|
91
|
+
onBlur,
|
|
92
|
+
hideDoneButton,
|
|
93
|
+
error,
|
|
94
|
+
keyPadCharacterRef,
|
|
95
|
+
setKeypadInteraction,
|
|
96
|
+
maxResponseAreas,
|
|
97
|
+
} = this.props;
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<PureToolbar
|
|
101
|
+
autoFocus={autoFocus}
|
|
102
|
+
classNames={classNames}
|
|
103
|
+
onAnswerBlockAdd={onAnswerBlockAdd}
|
|
104
|
+
allowAnswerBlock={allowAnswerBlock}
|
|
105
|
+
latex={latex}
|
|
106
|
+
additionalKeys={additionalKeys}
|
|
107
|
+
noDecimal={noDecimal}
|
|
108
|
+
keypadMode={keypadMode}
|
|
109
|
+
keyPadCharacterRef={keyPadCharacterRef}
|
|
110
|
+
setKeypadInteraction={setKeypadInteraction}
|
|
111
|
+
onChange={this.onChange}
|
|
112
|
+
onDone={this.done}
|
|
113
|
+
onFocus={onFocus}
|
|
114
|
+
onBlur={onBlur}
|
|
115
|
+
showKeypad={showKeypad}
|
|
116
|
+
controlledKeypad={controlledKeypad}
|
|
117
|
+
controlledKeypadMode={controlledKeypadMode}
|
|
118
|
+
hideDoneButton={hideDoneButton}
|
|
119
|
+
error={error}
|
|
120
|
+
maxResponseAreas={maxResponseAreas}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export class RawPureToolbar extends React.Component {
|
|
127
|
+
static propTypes = {
|
|
128
|
+
classNames: PropTypes.object,
|
|
129
|
+
latex: PropTypes.string.isRequired,
|
|
130
|
+
keypadMode: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
131
|
+
hideInput: PropTypes.bool,
|
|
132
|
+
noLatexHandling: PropTypes.bool,
|
|
133
|
+
layoutForKeyPad: PropTypes.object,
|
|
134
|
+
onChange: PropTypes.func.isRequired,
|
|
135
|
+
onDone: PropTypes.func.isRequired,
|
|
136
|
+
onBlur: PropTypes.func,
|
|
137
|
+
onAnswerBlockAdd: PropTypes.func,
|
|
138
|
+
additionalKeys: PropTypes.array,
|
|
139
|
+
onFocus: PropTypes.func,
|
|
140
|
+
autoFocus: PropTypes.bool,
|
|
141
|
+
noDecimal: PropTypes.bool,
|
|
142
|
+
allowAnswerBlock: PropTypes.bool,
|
|
143
|
+
controlledKeypad: PropTypes.bool,
|
|
144
|
+
controlledKeypadMode: PropTypes.bool,
|
|
145
|
+
showKeypad: PropTypes.bool,
|
|
146
|
+
hideDoneButton: PropTypes.bool,
|
|
147
|
+
hideDoneButtonBackground: PropTypes.bool,
|
|
148
|
+
error: PropTypes.any,
|
|
149
|
+
maxResponseAreas: PropTypes.number,
|
|
150
|
+
keyPadCharacterRef: PropTypes.object,
|
|
151
|
+
setKeypadInteraction: PropTypes.func,
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
static defaultProps = {
|
|
155
|
+
classNames: {},
|
|
156
|
+
hideDoneButtonBackground: false,
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
render() {
|
|
160
|
+
const {
|
|
161
|
+
classNames,
|
|
162
|
+
autoFocus,
|
|
163
|
+
allowAnswerBlock,
|
|
164
|
+
onAnswerBlockAdd,
|
|
165
|
+
controlledKeypad,
|
|
166
|
+
controlledKeypadMode,
|
|
167
|
+
additionalKeys,
|
|
168
|
+
showKeypad,
|
|
169
|
+
keypadMode,
|
|
170
|
+
noDecimal,
|
|
171
|
+
hideInput,
|
|
172
|
+
noLatexHandling,
|
|
173
|
+
layoutForKeyPad,
|
|
174
|
+
keyPadCharacterRef,
|
|
175
|
+
setKeypadInteraction,
|
|
176
|
+
latex,
|
|
177
|
+
onChange,
|
|
178
|
+
onDone,
|
|
179
|
+
onFocus,
|
|
180
|
+
onBlur,
|
|
181
|
+
hideDoneButton,
|
|
182
|
+
hideDoneButtonBackground,
|
|
183
|
+
error,
|
|
184
|
+
maxResponseAreas,
|
|
185
|
+
} = this.props;
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<PureToolbarContainer className={(classNames && classNames.toolbar) || ''} ref={keyPadCharacterRef}>
|
|
189
|
+
<div />
|
|
190
|
+
<EditorAndPad
|
|
191
|
+
autoFocus={autoFocus}
|
|
192
|
+
keypadMode={keypadMode}
|
|
193
|
+
classNames={classNames || {}}
|
|
194
|
+
controlledKeypad={controlledKeypad}
|
|
195
|
+
controlledKeypadMode={controlledKeypadMode}
|
|
196
|
+
noDecimal={noDecimal}
|
|
197
|
+
hideInput={hideInput}
|
|
198
|
+
noLatexHandling={noLatexHandling}
|
|
199
|
+
layoutForKeyPad={layoutForKeyPad}
|
|
200
|
+
showKeypad={showKeypad}
|
|
201
|
+
additionalKeys={additionalKeys}
|
|
202
|
+
allowAnswerBlock={allowAnswerBlock}
|
|
203
|
+
onAnswerBlockAdd={onAnswerBlockAdd}
|
|
204
|
+
latex={latex}
|
|
205
|
+
onChange={onChange}
|
|
206
|
+
onFocus={onFocus}
|
|
207
|
+
onBlur={onBlur}
|
|
208
|
+
error={error}
|
|
209
|
+
maxResponseAreas={maxResponseAreas}
|
|
210
|
+
setKeypadInteraction={setKeypadInteraction}
|
|
211
|
+
/>
|
|
212
|
+
{(!controlledKeypad || (controlledKeypad && showKeypad)) && !hideDoneButton && (
|
|
213
|
+
<DoneButton hideBackground={hideDoneButtonBackground} onClick={onDone} />
|
|
214
|
+
)}
|
|
215
|
+
</PureToolbarContainer>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export const PureToolbar = RawPureToolbar;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import debug from 'debug';
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { mq } from '@pie-lib/math-input';
|
|
6
|
+
import { markFractionBaseSuperscripts } from './utils';
|
|
7
|
+
|
|
8
|
+
const { commonMqFontStyles, longdivStyles, supsubStyles } = mq.CommonMqStyles;
|
|
9
|
+
|
|
10
|
+
const log = debug('@pie-lib:math-toolbar:math-preview');
|
|
11
|
+
|
|
12
|
+
const MathPreviewContainer = styled('div')(({ theme, isSelected }) => ({
|
|
13
|
+
display: 'inline-flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
position: 'relative',
|
|
16
|
+
'& *': commonMqFontStyles,
|
|
17
|
+
...supsubStyles,
|
|
18
|
+
...longdivStyles,
|
|
19
|
+
'& > .mq-math-mode': {
|
|
20
|
+
border: isSelected ? 'solid 0px lightgrey' : 'solid 1px lightgrey',
|
|
21
|
+
},
|
|
22
|
+
'& > .mq-focused': {
|
|
23
|
+
outline: 'none',
|
|
24
|
+
boxShadow: 'none',
|
|
25
|
+
border: 'solid 1px black',
|
|
26
|
+
borderRadius: '0px',
|
|
27
|
+
},
|
|
28
|
+
'& > .mq-math-mode .mq-root-block': {
|
|
29
|
+
paddingTop: '7px !important',
|
|
30
|
+
},
|
|
31
|
+
'& > .mq-math-mode .mq-overarc ': {
|
|
32
|
+
paddingTop: '0.45em !important',
|
|
33
|
+
},
|
|
34
|
+
'& > .mq-math-mode .mq-sqrt-prefix': {
|
|
35
|
+
verticalAlign: 'baseline !important',
|
|
36
|
+
top: '1px !important',
|
|
37
|
+
left: '-0.1em !important',
|
|
38
|
+
},
|
|
39
|
+
'& > .mq-math-mode .mq-denominator': {
|
|
40
|
+
marginTop: '-5px !important',
|
|
41
|
+
padding: '0.5em 0.1em 0.1em !important',
|
|
42
|
+
},
|
|
43
|
+
'& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over': {
|
|
44
|
+
padding: '0 0.1em !important',
|
|
45
|
+
paddingBottom: '0 !important',
|
|
46
|
+
marginBottom: '-2px',
|
|
47
|
+
},
|
|
48
|
+
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty': {
|
|
49
|
+
paddingTop: '6px !important',
|
|
50
|
+
paddingLeft: '4px !important',
|
|
51
|
+
},
|
|
52
|
+
'& > .mq-math-mode .mq-longdiv .mq-longdiv-inner': {
|
|
53
|
+
marginLeft: '0 !important',
|
|
54
|
+
},
|
|
55
|
+
'& > .mq-math-mode .mq-overarrow': {
|
|
56
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
|
|
57
|
+
},
|
|
58
|
+
'& > .mq-math-mode .mq-paren': {
|
|
59
|
+
verticalAlign: 'top !important',
|
|
60
|
+
padding: '1px 0.1em !important',
|
|
61
|
+
},
|
|
62
|
+
'& > .mq-math-mode .mq-sqrt-stem': {
|
|
63
|
+
borderTop: '0.07em solid',
|
|
64
|
+
marginLeft: '-1.5px',
|
|
65
|
+
marginTop: '-2px !important',
|
|
66
|
+
paddingTop: '5px !important',
|
|
67
|
+
},
|
|
68
|
+
'& .mq-overarrow-inner': {
|
|
69
|
+
paddingTop: '0 !important',
|
|
70
|
+
border: 'none !important',
|
|
71
|
+
},
|
|
72
|
+
'& .mq-editable-field .mq-cursor': {
|
|
73
|
+
marginTop: '-15px !important',
|
|
74
|
+
},
|
|
75
|
+
'& .mq-overarrow.mq-arrow-both': {
|
|
76
|
+
top: '7.5px',
|
|
77
|
+
marginTop: '0px',
|
|
78
|
+
minWidth: '1.23em',
|
|
79
|
+
'& *': {
|
|
80
|
+
lineHeight: '1 !important',
|
|
81
|
+
},
|
|
82
|
+
'&:before': {
|
|
83
|
+
top: '-0.4em',
|
|
84
|
+
left: '-1px',
|
|
85
|
+
},
|
|
86
|
+
'&:after': {
|
|
87
|
+
top: '0px !important',
|
|
88
|
+
position: 'absolute !important',
|
|
89
|
+
right: '-2px',
|
|
90
|
+
},
|
|
91
|
+
'&.mq-empty:after': {
|
|
92
|
+
top: '-0.45em',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
'& .mq-overarrow.mq-arrow-right': {
|
|
96
|
+
'&:before': {
|
|
97
|
+
top: '-0.4em',
|
|
98
|
+
right: '-1px',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
'& .mq-overarrow-inner-right': {
|
|
102
|
+
display: 'none !important',
|
|
103
|
+
},
|
|
104
|
+
'& .mq-overarrow-inner-left': {
|
|
105
|
+
display: 'none !important',
|
|
106
|
+
},
|
|
107
|
+
'& .mq-longdiv-inner': {
|
|
108
|
+
borderTop: '1px solid !important',
|
|
109
|
+
paddingTop: '1.5px !important',
|
|
110
|
+
},
|
|
111
|
+
'& .mq-parallelogram': {
|
|
112
|
+
lineHeight: 0.85,
|
|
113
|
+
},
|
|
114
|
+
'& span[data-prime="true"]': {
|
|
115
|
+
fontFamily: 'Roboto, Helvetica, Arial, sans-serif !important',
|
|
116
|
+
},
|
|
117
|
+
...(isSelected && {
|
|
118
|
+
border: `solid 1px ${theme.palette.primary.main}`,
|
|
119
|
+
}),
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
const InsideOverlay = styled('span')({
|
|
123
|
+
position: 'absolute',
|
|
124
|
+
bottom: 0,
|
|
125
|
+
left: 0,
|
|
126
|
+
right: 0,
|
|
127
|
+
top: 0,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export class RawMathPreview extends React.Component {
|
|
131
|
+
static propTypes = {
|
|
132
|
+
latex: PropTypes.string,
|
|
133
|
+
isSelected: PropTypes.bool,
|
|
134
|
+
onFocus: PropTypes.func,
|
|
135
|
+
onBlur: PropTypes.func,
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
componentDidMount() {
|
|
139
|
+
markFractionBaseSuperscripts();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
componentDidUpdate(prevProps) {
|
|
143
|
+
// Re-run only if LaTeX changed
|
|
144
|
+
if (this.props.latex !== prevProps.latex) {
|
|
145
|
+
markFractionBaseSuperscripts();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
render() {
|
|
150
|
+
const { isSelected, onFocus, onBlur, latex } = this.props;
|
|
151
|
+
log('[render] latex: ', latex);
|
|
152
|
+
return (
|
|
153
|
+
<MathPreviewContainer isSelected={isSelected}>
|
|
154
|
+
{' '}
|
|
155
|
+
<InsideOverlay />
|
|
156
|
+
<mq.Static latex={latex} onFocus={onFocus} onBlur={onBlur} />
|
|
157
|
+
</MathPreviewContainer>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export default RawMathPreview;
|
package/src/utils.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const markFractionBaseSuperscripts = () => {
|
|
2
|
+
document.querySelectorAll('.mq-supsub.mq-sup-only').forEach((supsub) => {
|
|
3
|
+
const prev = supsub.previousElementSibling;
|
|
4
|
+
|
|
5
|
+
if (prev && prev.classList.contains('mq-non-leaf') && prev.querySelector('.mq-fraction')) {
|
|
6
|
+
supsub.classList.add('mq-after-fraction-group');
|
|
7
|
+
} else {
|
|
8
|
+
supsub.classList.remove('mq-after-fraction-group');
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
};
|
package/dist/done-button.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/math-toolbar/src/done-button.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare const RawDoneButton: {
|
|
12
|
-
({ onClick, hideBackground }: {
|
|
13
|
-
onClick: any;
|
|
14
|
-
hideBackground: any;
|
|
15
|
-
}): React.JSX.Element;
|
|
16
|
-
propTypes: {
|
|
17
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
-
hideBackground: PropTypes.Requireable<boolean>;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export declare const DoneButton: {
|
|
22
|
-
({ onClick, hideBackground }: {
|
|
23
|
-
onClick: any;
|
|
24
|
-
hideBackground: any;
|
|
25
|
-
}): React.JSX.Element;
|
|
26
|
-
propTypes: {
|
|
27
|
-
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
-
hideBackground: PropTypes.Requireable<boolean>;
|
|
29
|
-
};
|
|
30
|
-
};
|
package/dist/done-button.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import "react";
|
|
2
|
-
import e from "prop-types";
|
|
3
|
-
import { styled as t } from "@mui/material/styles";
|
|
4
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
-
import r from "@mui/material/IconButton";
|
|
6
|
-
import i from "@mui/icons-material/Check";
|
|
7
|
-
//#region src/done-button.tsx
|
|
8
|
-
var a = t(r)(({ theme: e, hideBackground: t }) => ({
|
|
9
|
-
verticalAlign: "top",
|
|
10
|
-
width: "28px",
|
|
11
|
-
height: "28px",
|
|
12
|
-
color: "#00bb00",
|
|
13
|
-
...t && {
|
|
14
|
-
backgroundColor: e.palette.common.white,
|
|
15
|
-
"&:hover": { backgroundColor: e.palette.grey[200] }
|
|
16
|
-
},
|
|
17
|
-
"& .MuiIconButton-label": {
|
|
18
|
-
position: "absolute",
|
|
19
|
-
top: "2px"
|
|
20
|
-
}
|
|
21
|
-
})), o = ({ onClick: e, hideBackground: t }) => /* @__PURE__ */ n(a, {
|
|
22
|
-
"aria-label": "Done",
|
|
23
|
-
onClick: e,
|
|
24
|
-
hideBackground: t,
|
|
25
|
-
size: "large",
|
|
26
|
-
children: /* @__PURE__ */ n(i, {})
|
|
27
|
-
});
|
|
28
|
-
o.propTypes = {
|
|
29
|
-
onClick: e.func,
|
|
30
|
-
hideBackground: e.bool
|
|
31
|
-
};
|
|
32
|
-
var s = o;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { s as DoneButton };
|
package/dist/editor-and-pad.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/math-toolbar/src/editor-and-pad.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
export declare class EditorAndPad extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
classNames: PropTypes.Requireable<object>;
|
|
14
|
-
keypadMode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
15
|
-
autoFocus: PropTypes.Requireable<boolean>;
|
|
16
|
-
allowAnswerBlock: PropTypes.Requireable<boolean>;
|
|
17
|
-
showKeypad: PropTypes.Requireable<boolean>;
|
|
18
|
-
controlledKeypad: PropTypes.Requireable<boolean>;
|
|
19
|
-
controlledKeypadMode: PropTypes.Requireable<boolean>;
|
|
20
|
-
error: PropTypes.Requireable<string>;
|
|
21
|
-
noDecimal: PropTypes.Requireable<boolean>;
|
|
22
|
-
hideInput: PropTypes.Requireable<boolean>;
|
|
23
|
-
noLatexHandling: PropTypes.Requireable<boolean>;
|
|
24
|
-
layoutForKeyPad: PropTypes.Requireable<object>;
|
|
25
|
-
maxResponseAreas: PropTypes.Requireable<number>;
|
|
26
|
-
additionalKeys: PropTypes.Requireable<any[]>;
|
|
27
|
-
latex: PropTypes.Validator<string>;
|
|
28
|
-
onAnswerBlockAdd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
-
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
30
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
32
|
-
setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
|
-
};
|
|
34
|
-
constructor(props: any);
|
|
35
|
-
componentDidMount(): void;
|
|
36
|
-
onClick: any;
|
|
37
|
-
updateDisable: any;
|
|
38
|
-
onAnswerBlockClick: any;
|
|
39
|
-
onEditorChange: any;
|
|
40
|
-
/** Only render if the mathquill instance's latex is different
|
|
41
|
-
* or the keypad state changed from one state to the other (shown / hidden) */
|
|
42
|
-
shouldComponentUpdate(nextProps: any, nextState: any): boolean;
|
|
43
|
-
onEditorTypeChange: any;
|
|
44
|
-
checkResponseAreasNumber: any;
|
|
45
|
-
render(): React.JSX.Element;
|
|
46
|
-
}
|
|
47
|
-
export default EditorAndPad;
|