@pie-lib/math-toolbar 3.0.3-next.38 → 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/dist/editor-and-pad.js
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import { markFractionBaseSuperscripts as e } from "./utils.js";
|
|
2
|
-
import t from "react";
|
|
3
|
-
import n from "prop-types";
|
|
4
|
-
import r from "debug";
|
|
5
|
-
import i from "@mui/material/Button";
|
|
6
|
-
import { styled as a } from "@mui/material/styles";
|
|
7
|
-
import o from "@mui/material/MenuItem";
|
|
8
|
-
import s from "@mui/material/Select";
|
|
9
|
-
import { isEqual as c } from "@pie-element/shared-lodash";
|
|
10
|
-
import l from "@mui/material/FormControl";
|
|
11
|
-
import u from "@mui/material/InputLabel";
|
|
12
|
-
import { HorizontalKeypad as d, mq as f, updateSpans as p } from "@pie-lib/math-input";
|
|
13
|
-
import { color as m } from "@pie-lib/render-ui";
|
|
14
|
-
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
15
|
-
//#region src/editor-and-pad.tsx
|
|
16
|
-
var { commonMqFontStyles: _, commonMqKeyboardStyles: v, longdivStyles: y, supsubStyles: b } = f.CommonMqStyles, x = r("@pie-lib:math-toolbar:editor-and-pad"), S = /\.|,/g, C = a("div")(({ theme: e }) => ({
|
|
17
|
-
zIndex: 9,
|
|
18
|
-
position: "relative",
|
|
19
|
-
textAlign: "center",
|
|
20
|
-
width: "auto",
|
|
21
|
-
"& > .mq-math-mode": { border: "solid 1px lightgrey" },
|
|
22
|
-
"& > .mq-focused": {
|
|
23
|
-
outline: "none",
|
|
24
|
-
boxShadow: "none",
|
|
25
|
-
border: `dotted 1px ${e.palette.primary.main}`,
|
|
26
|
-
borderRadius: "0px"
|
|
27
|
-
},
|
|
28
|
-
"& .mq-overarrow-inner": {
|
|
29
|
-
border: "none !important",
|
|
30
|
-
paddingTop: "0 !important"
|
|
31
|
-
},
|
|
32
|
-
"& .mq-overarrow-inner-right": { display: "none !important" },
|
|
33
|
-
"& .mq-overarrow-inner-left": { display: "none !important" },
|
|
34
|
-
"& .mq-longdiv-inner": {
|
|
35
|
-
borderTop: "1px solid !important",
|
|
36
|
-
paddingTop: "1.5px !important"
|
|
37
|
-
},
|
|
38
|
-
"& .mq-overarrow.mq-arrow-both": {
|
|
39
|
-
top: "7.8px",
|
|
40
|
-
marginTop: "0px",
|
|
41
|
-
minWidth: "1.23em"
|
|
42
|
-
},
|
|
43
|
-
"& .mq-parallelogram": { lineHeight: .85 }
|
|
44
|
-
})), w = a("div")(({ theme: e, hide: t }) => ({
|
|
45
|
-
display: t ? "none" : "flex",
|
|
46
|
-
alignItems: "center",
|
|
47
|
-
"& .mq-editable-field .mq-cursor": { top: "-4px" },
|
|
48
|
-
"& .mq-math-mode .mq-selection, .mq-editable-field .mq-selection": { paddingTop: "18px" },
|
|
49
|
-
"& .mq-math-mode .mq-overarrow": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" },
|
|
50
|
-
"& .mq-math-mode .mq-overline .mq-overline-inner": { paddingTop: "0.4em !important" },
|
|
51
|
-
"& .mq-overarrow.mq-arrow-both": {
|
|
52
|
-
minWidth: "1.23em",
|
|
53
|
-
"& *": { lineHeight: "1 !important" },
|
|
54
|
-
"&:before": {
|
|
55
|
-
top: "-0.45em",
|
|
56
|
-
left: "-1px"
|
|
57
|
-
},
|
|
58
|
-
"&:after": {
|
|
59
|
-
position: "absolute !important",
|
|
60
|
-
top: "0px !important",
|
|
61
|
-
right: "-2px"
|
|
62
|
-
},
|
|
63
|
-
"&.mq-empty:after": { top: "-0.45em" }
|
|
64
|
-
},
|
|
65
|
-
"& .mq-overarrow.mq-arrow-right": { "&:before": {
|
|
66
|
-
top: "-0.4em",
|
|
67
|
-
right: "-1px"
|
|
68
|
-
} },
|
|
69
|
-
"& *": {
|
|
70
|
-
..._,
|
|
71
|
-
...b,
|
|
72
|
-
...y,
|
|
73
|
-
"& .mq-math-mode .mq-sqrt-prefix": {
|
|
74
|
-
verticalAlign: "baseline !important",
|
|
75
|
-
top: "1px !important",
|
|
76
|
-
left: "-0.1em !important"
|
|
77
|
-
},
|
|
78
|
-
"& .mq-math-mode .mq-overarc ": { paddingTop: "0.45em !important" },
|
|
79
|
-
"& .mq-math-mode .mq-empty": { padding: "9px 1px !important" },
|
|
80
|
-
"& .mq-math-mode .mq-root-block": { paddingTop: "10px" },
|
|
81
|
-
"& .mq-scaled .mq-sqrt-prefix": { top: "0 !important" },
|
|
82
|
-
"& .mq-math-mode .mq-longdiv .mq-longdiv-inner": {
|
|
83
|
-
marginLeft: "4px !important",
|
|
84
|
-
paddingTop: "6px !important",
|
|
85
|
-
paddingLeft: "6px !important"
|
|
86
|
-
},
|
|
87
|
-
"& .mq-math-mode .mq-paren": {
|
|
88
|
-
verticalAlign: "top !important",
|
|
89
|
-
padding: "1px 0.1em !important"
|
|
90
|
-
},
|
|
91
|
-
"& .mq-math-mode .mq-sqrt-stem": {
|
|
92
|
-
borderTop: "0.07em solid",
|
|
93
|
-
marginLeft: "-1.5px",
|
|
94
|
-
marginTop: "-2px !important",
|
|
95
|
-
paddingTop: "5px !important"
|
|
96
|
-
},
|
|
97
|
-
"& .mq-math-mode .mq-denominator": {
|
|
98
|
-
marginTop: "-5px !important",
|
|
99
|
-
padding: "0.5em 0.1em 0.1em !important"
|
|
100
|
-
},
|
|
101
|
-
"& .mq-math-mode .mq-numerator, .mq-math-mode .mq-over": {
|
|
102
|
-
padding: "0 0.1em !important",
|
|
103
|
-
paddingBottom: "0 !important",
|
|
104
|
-
marginBottom: "-2px"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"& span[data-prime=\"true\"]": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" }
|
|
108
|
-
})), T = a(l)({
|
|
109
|
-
flex: "initial",
|
|
110
|
-
width: "25%",
|
|
111
|
-
minWidth: "100px",
|
|
112
|
-
marginLeft: "15px",
|
|
113
|
-
marginTop: "5px",
|
|
114
|
-
marginBottom: "5px",
|
|
115
|
-
marginRight: "5px",
|
|
116
|
-
"& label": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" },
|
|
117
|
-
"& div": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" }
|
|
118
|
-
}), E = a(u)(() => ({ backgroundColor: "transparent" })), D = a("div")(({ theme: e, error: t }) => ({
|
|
119
|
-
minWidth: "500px",
|
|
120
|
-
maxWidth: "900px",
|
|
121
|
-
minHeight: "30px",
|
|
122
|
-
width: "100%",
|
|
123
|
-
display: "flex",
|
|
124
|
-
marginTop: e.spacing(1),
|
|
125
|
-
marginBottom: e.spacing(1),
|
|
126
|
-
...t && { border: "2px solid red" },
|
|
127
|
-
"& .mq-sqrt-prefix .mq-scaled": { verticalAlign: "middle !important" }
|
|
128
|
-
})), O = a(f.Input)(({ controlledKeypadMode: e }) => ({
|
|
129
|
-
maxWidth: e ? "400px" : "500px",
|
|
130
|
-
color: m.text(),
|
|
131
|
-
backgroundColor: m.background(),
|
|
132
|
-
padding: "2px"
|
|
133
|
-
})), k = a(i)({
|
|
134
|
-
position: "absolute",
|
|
135
|
-
right: "12px",
|
|
136
|
-
border: "1px solid lightgrey",
|
|
137
|
-
color: m.text()
|
|
138
|
-
}), A = a("hr")(({ theme: e }) => ({
|
|
139
|
-
padding: 0,
|
|
140
|
-
margin: 0,
|
|
141
|
-
height: "1px",
|
|
142
|
-
border: "none",
|
|
143
|
-
borderBottom: `solid 1px ${e.palette.primary.main}`
|
|
144
|
-
})), j = a(d)(({ mode: e }) => ({
|
|
145
|
-
...v,
|
|
146
|
-
...e === "language" && { "& *": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" } }
|
|
147
|
-
})), M = (e) => {
|
|
148
|
-
if (!e) return;
|
|
149
|
-
let { type: t, value: n } = e;
|
|
150
|
-
return t === "command" || t === "cursor" ? e : t === "answer" ? {
|
|
151
|
-
type: "answer",
|
|
152
|
-
...e
|
|
153
|
-
} : n === "clear" ? { type: "clear" } : {
|
|
154
|
-
type: "write",
|
|
155
|
-
value: n
|
|
156
|
-
};
|
|
157
|
-
}, N = class extends t.Component {
|
|
158
|
-
static propTypes = {
|
|
159
|
-
classNames: n.object,
|
|
160
|
-
keypadMode: n.oneOfType([n.string, n.number]),
|
|
161
|
-
autoFocus: n.bool,
|
|
162
|
-
allowAnswerBlock: n.bool,
|
|
163
|
-
showKeypad: n.bool,
|
|
164
|
-
controlledKeypad: n.bool,
|
|
165
|
-
controlledKeypadMode: n.bool,
|
|
166
|
-
error: n.string,
|
|
167
|
-
noDecimal: n.bool,
|
|
168
|
-
hideInput: n.bool,
|
|
169
|
-
noLatexHandling: n.bool,
|
|
170
|
-
layoutForKeyPad: n.object,
|
|
171
|
-
maxResponseAreas: n.number,
|
|
172
|
-
additionalKeys: n.array,
|
|
173
|
-
latex: n.string.isRequired,
|
|
174
|
-
onAnswerBlockAdd: n.func,
|
|
175
|
-
onFocus: n.func,
|
|
176
|
-
onBlur: n.func,
|
|
177
|
-
onChange: n.func.isRequired,
|
|
178
|
-
setKeypadInteraction: n.func
|
|
179
|
-
};
|
|
180
|
-
constructor(e) {
|
|
181
|
-
super(e), this.state = {
|
|
182
|
-
equationEditor: "item-authoring",
|
|
183
|
-
addDisabled: !1
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
componentDidMount() {
|
|
187
|
-
this.input && this.props.autoFocus && this.input.focus();
|
|
188
|
-
}
|
|
189
|
-
onClick = (e) => {
|
|
190
|
-
let { noDecimal: t, noLatexHandling: n, onChange: r } = this.props, i = M(e);
|
|
191
|
-
if (x("mathChange: ", i), n) {
|
|
192
|
-
r(i.value);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
t && (i.value === "." || i.value === ",") || i && (i.type === "clear" ? (x("call clear..."), this.input.clear()) : i.type === "command" ? this.input.command(i.value) : i.type === "cursor" ? this.input.keystroke(i.value) : i.type === "answer" ? this.input.write("%response%") : this.input.write(i.value));
|
|
196
|
-
};
|
|
197
|
-
updateDisable = (e) => {
|
|
198
|
-
let { maxResponseAreas: t } = this.props;
|
|
199
|
-
if (t) {
|
|
200
|
-
let n = this.checkResponseAreasNumber(t, e);
|
|
201
|
-
this.setState({ addDisabled: n });
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
onAnswerBlockClick = () => {
|
|
205
|
-
this.props.onAnswerBlockAdd(), this.onClick({ type: "answer" }), this.updateDisable(!0);
|
|
206
|
-
};
|
|
207
|
-
onEditorChange = (t) => {
|
|
208
|
-
let { onChange: n, noDecimal: r } = this.props;
|
|
209
|
-
if (p(), e(), this.updateDisable(!0), r && (t.indexOf(".") !== -1 || t.indexOf(",") !== -1) && this.input) {
|
|
210
|
-
this.input.clear(), this.input.write(t.replace(S, ""));
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
let i = t.match(/[0-9]\\ \\frac\{[^\{]*\}\{ \}/);
|
|
214
|
-
if (this.input && i && i?.length) {
|
|
215
|
-
try {
|
|
216
|
-
this.input.mathField.__controller.cursor.insLeftOf(this.input.mathField.__controller.cursor.parent[-1].parent), this.input.mathField.el().dispatchEvent(new KeyboardEvent("keydown", { keyCode: 8 }));
|
|
217
|
-
} catch (e) {
|
|
218
|
-
console.error(e.toString());
|
|
219
|
-
}
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
n(t);
|
|
223
|
-
};
|
|
224
|
-
shouldComponentUpdate(e, t) {
|
|
225
|
-
let n = this.input.mathField.latex() !== e.latex;
|
|
226
|
-
return x("[shouldComponentUpdate] ", "inputIsDifferent: ", n), !c(this.props.error, e.error) || !n && this.props.keypadMode !== e.keypadMode || !n && this.props.noDecimal !== e.noDecimal || !n && this.state.equationEditor !== t.equationEditor ? !0 : !n && this.props.controlledKeypad ? this.props.showKeypad !== e.showKeypad : n;
|
|
227
|
-
}
|
|
228
|
-
onEditorTypeChange = (e) => {
|
|
229
|
-
this.setState({ equationEditor: e.target.value });
|
|
230
|
-
};
|
|
231
|
-
checkResponseAreasNumber = (e, t) => {
|
|
232
|
-
let { latex: n } = this.input && this.input.props || {};
|
|
233
|
-
if (n) {
|
|
234
|
-
let r = (n.match(/answerBlock/g) || []).length;
|
|
235
|
-
return t ? r === e - 1 : r === e;
|
|
236
|
-
}
|
|
237
|
-
return !1;
|
|
238
|
-
};
|
|
239
|
-
render() {
|
|
240
|
-
let { classNames: e, keypadMode: t, allowAnswerBlock: n, additionalKeys: r, controlledKeypad: i, controlledKeypadMode: a, showKeypad: c, setKeypadInteraction: l, noDecimal: u, hideInput: d, layoutForKeyPad: f, latex: p, onFocus: m, onBlur: _, error: v } = this.props, y = !i || i && c, { addDisabled: b } = this.state;
|
|
241
|
-
return x("[render]", p), /* @__PURE__ */ g(C, {
|
|
242
|
-
className: e.mathToolbar,
|
|
243
|
-
children: [
|
|
244
|
-
/* @__PURE__ */ g(w, {
|
|
245
|
-
hide: d,
|
|
246
|
-
children: [a && /* @__PURE__ */ g(T, {
|
|
247
|
-
variant: "standard",
|
|
248
|
-
children: [/* @__PURE__ */ h(E, {
|
|
249
|
-
id: "equation-editor-label",
|
|
250
|
-
children: "Equation Editor"
|
|
251
|
-
}), /* @__PURE__ */ g(s, {
|
|
252
|
-
labelId: "equation-editor-label",
|
|
253
|
-
id: "equation-editor-select",
|
|
254
|
-
name: "equationEditor",
|
|
255
|
-
label: "Equation Editor",
|
|
256
|
-
onChange: this.onEditorTypeChange,
|
|
257
|
-
value: this.state.equationEditor,
|
|
258
|
-
MenuProps: { transitionDuration: {
|
|
259
|
-
enter: 225,
|
|
260
|
-
exit: 195
|
|
261
|
-
} },
|
|
262
|
-
children: [
|
|
263
|
-
/* @__PURE__ */ h(o, {
|
|
264
|
-
value: "non-negative-integers",
|
|
265
|
-
children: "Numeric - Non-Negative Integers"
|
|
266
|
-
}),
|
|
267
|
-
/* @__PURE__ */ h(o, {
|
|
268
|
-
value: "integers",
|
|
269
|
-
children: "Numeric - Integers"
|
|
270
|
-
}),
|
|
271
|
-
/* @__PURE__ */ h(o, {
|
|
272
|
-
value: "decimals",
|
|
273
|
-
children: "Numeric - Decimals"
|
|
274
|
-
}),
|
|
275
|
-
/* @__PURE__ */ h(o, {
|
|
276
|
-
value: "fractions",
|
|
277
|
-
children: "Numeric - Fractions"
|
|
278
|
-
}),
|
|
279
|
-
/* @__PURE__ */ h(o, {
|
|
280
|
-
value: 1,
|
|
281
|
-
children: "Grade 1 - 2"
|
|
282
|
-
}),
|
|
283
|
-
/* @__PURE__ */ h(o, {
|
|
284
|
-
value: 3,
|
|
285
|
-
children: "Grade 3 - 5"
|
|
286
|
-
}),
|
|
287
|
-
/* @__PURE__ */ h(o, {
|
|
288
|
-
value: 6,
|
|
289
|
-
children: "Grade 6 - 7"
|
|
290
|
-
}),
|
|
291
|
-
/* @__PURE__ */ h(o, {
|
|
292
|
-
value: 8,
|
|
293
|
-
children: "Grade 8 - HS"
|
|
294
|
-
}),
|
|
295
|
-
/* @__PURE__ */ h(o, {
|
|
296
|
-
value: "geometry",
|
|
297
|
-
children: "Geometry"
|
|
298
|
-
}),
|
|
299
|
-
/* @__PURE__ */ h(o, {
|
|
300
|
-
value: "advanced-algebra",
|
|
301
|
-
children: "Advanced Algebra"
|
|
302
|
-
}),
|
|
303
|
-
/* @__PURE__ */ h(o, {
|
|
304
|
-
value: "statistics",
|
|
305
|
-
children: "Statistics"
|
|
306
|
-
}),
|
|
307
|
-
/* @__PURE__ */ h(o, {
|
|
308
|
-
value: "item-authoring",
|
|
309
|
-
children: "Item Authoring"
|
|
310
|
-
})
|
|
311
|
-
]
|
|
312
|
-
})]
|
|
313
|
-
}), /* @__PURE__ */ h(D, {
|
|
314
|
-
error: v,
|
|
315
|
-
children: /* @__PURE__ */ h(O, {
|
|
316
|
-
onFocus: () => {
|
|
317
|
-
m && m(), this.updateDisable(!1);
|
|
318
|
-
},
|
|
319
|
-
onBlur: (e) => {
|
|
320
|
-
this.updateDisable(!1), _ && _(e);
|
|
321
|
-
},
|
|
322
|
-
className: e && e.editor || "",
|
|
323
|
-
controlledKeypadMode: a,
|
|
324
|
-
ref: (e) => this.input = e,
|
|
325
|
-
latex: p,
|
|
326
|
-
onChange: this.onEditorChange
|
|
327
|
-
})
|
|
328
|
-
})]
|
|
329
|
-
}),
|
|
330
|
-
n && /* @__PURE__ */ h(k, {
|
|
331
|
-
type: "primary",
|
|
332
|
-
style: { bottom: y ? "320px" : "20px" },
|
|
333
|
-
onClick: this.onAnswerBlockClick,
|
|
334
|
-
disabled: b,
|
|
335
|
-
children: "+ Response Area"
|
|
336
|
-
}),
|
|
337
|
-
/* @__PURE__ */ h(A, {}),
|
|
338
|
-
y && /* @__PURE__ */ h(j, {
|
|
339
|
-
mode: a ? this.state.equationEditor : t,
|
|
340
|
-
controlledKeypadMode: a,
|
|
341
|
-
layoutForKeyPad: f,
|
|
342
|
-
additionalKeys: r,
|
|
343
|
-
onClick: this.onClick,
|
|
344
|
-
noDecimal: u,
|
|
345
|
-
setKeypadInteraction: l
|
|
346
|
-
})
|
|
347
|
-
]
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
//#endregion
|
|
352
|
-
export { N as default };
|
package/dist/index.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/math-toolbar/src/index.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
|
-
import MathPreview from './math-preview.js';
|
|
12
|
-
export { MathPreview };
|
|
13
|
-
export declare class MathToolbar extends React.Component {
|
|
14
|
-
static propTypes: {
|
|
15
|
-
autoFocus: PropTypes.Requireable<boolean>;
|
|
16
|
-
allowAnswerBlock: PropTypes.Requireable<boolean>;
|
|
17
|
-
controlledKeypad: PropTypes.Requireable<boolean>;
|
|
18
|
-
controlledKeypadMode: PropTypes.Requireable<boolean>;
|
|
19
|
-
keypadMode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
20
|
-
classNames: PropTypes.Requireable<object>;
|
|
21
|
-
error: PropTypes.Requireable<string>;
|
|
22
|
-
maxResponseAreas: PropTypes.Requireable<number>;
|
|
23
|
-
showKeypad: PropTypes.Requireable<boolean>;
|
|
24
|
-
noDecimal: PropTypes.Requireable<boolean>;
|
|
25
|
-
additionalKeys: PropTypes.Requireable<any[]>;
|
|
26
|
-
latex: PropTypes.Validator<string>;
|
|
27
|
-
onAnswerBlockAdd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
29
|
-
onDone: PropTypes.Validator<(...args: any[]) => any>;
|
|
30
|
-
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
31
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
32
|
-
hideDoneButton: PropTypes.Requireable<boolean>;
|
|
33
|
-
keyPadCharacterRef: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
-
setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
35
|
-
};
|
|
36
|
-
static defaultProps: {
|
|
37
|
-
classNames: {};
|
|
38
|
-
keypadMode: string;
|
|
39
|
-
autoFocus: boolean;
|
|
40
|
-
allowAnswerBlock: boolean;
|
|
41
|
-
controlledKeypad: boolean;
|
|
42
|
-
controlledKeypadMode: boolean;
|
|
43
|
-
noDecimal: boolean;
|
|
44
|
-
showKeypad: boolean;
|
|
45
|
-
additionalKeys: never[];
|
|
46
|
-
onChange: () => void;
|
|
47
|
-
onAnswerBlockAdd: () => void;
|
|
48
|
-
onFocus: () => void;
|
|
49
|
-
hideDoneButton: boolean;
|
|
50
|
-
};
|
|
51
|
-
constructor(props: any);
|
|
52
|
-
done: any;
|
|
53
|
-
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
54
|
-
onChange: any;
|
|
55
|
-
render(): React.JSX.Element;
|
|
56
|
-
}
|
|
57
|
-
export declare class RawPureToolbar extends React.Component {
|
|
58
|
-
static propTypes: {
|
|
59
|
-
classNames: PropTypes.Requireable<object>;
|
|
60
|
-
latex: PropTypes.Validator<string>;
|
|
61
|
-
keypadMode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
62
|
-
hideInput: PropTypes.Requireable<boolean>;
|
|
63
|
-
noLatexHandling: PropTypes.Requireable<boolean>;
|
|
64
|
-
layoutForKeyPad: PropTypes.Requireable<object>;
|
|
65
|
-
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
66
|
-
onDone: PropTypes.Validator<(...args: any[]) => any>;
|
|
67
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
68
|
-
onAnswerBlockAdd: PropTypes.Requireable<(...args: any[]) => any>;
|
|
69
|
-
additionalKeys: PropTypes.Requireable<any[]>;
|
|
70
|
-
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
71
|
-
autoFocus: PropTypes.Requireable<boolean>;
|
|
72
|
-
noDecimal: PropTypes.Requireable<boolean>;
|
|
73
|
-
allowAnswerBlock: PropTypes.Requireable<boolean>;
|
|
74
|
-
controlledKeypad: PropTypes.Requireable<boolean>;
|
|
75
|
-
controlledKeypadMode: PropTypes.Requireable<boolean>;
|
|
76
|
-
showKeypad: PropTypes.Requireable<boolean>;
|
|
77
|
-
hideDoneButton: PropTypes.Requireable<boolean>;
|
|
78
|
-
hideDoneButtonBackground: PropTypes.Requireable<boolean>;
|
|
79
|
-
error: PropTypes.Requireable<any>;
|
|
80
|
-
maxResponseAreas: PropTypes.Requireable<number>;
|
|
81
|
-
keyPadCharacterRef: PropTypes.Requireable<object>;
|
|
82
|
-
setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
83
|
-
};
|
|
84
|
-
static defaultProps: {
|
|
85
|
-
classNames: {};
|
|
86
|
-
hideDoneButtonBackground: boolean;
|
|
87
|
-
};
|
|
88
|
-
render(): React.JSX.Element;
|
|
89
|
-
}
|
|
90
|
-
export declare const PureToolbar: typeof RawPureToolbar;
|
package/dist/index.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import e from "./editor-and-pad.js";
|
|
2
|
-
import { DoneButton as t } from "./done-button.js";
|
|
3
|
-
import n from "./math-preview.js";
|
|
4
|
-
import r from "react";
|
|
5
|
-
import i from "prop-types";
|
|
6
|
-
import { styled as a } from "@mui/material/styles";
|
|
7
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
8
|
-
//#region src/index.tsx
|
|
9
|
-
var c = a("div")({
|
|
10
|
-
display: "flex",
|
|
11
|
-
width: "100%",
|
|
12
|
-
zIndex: 8,
|
|
13
|
-
alignItems: "center"
|
|
14
|
-
}), l = class extends r.Component {
|
|
15
|
-
static propTypes = {
|
|
16
|
-
autoFocus: i.bool,
|
|
17
|
-
allowAnswerBlock: i.bool,
|
|
18
|
-
controlledKeypad: i.bool,
|
|
19
|
-
controlledKeypadMode: i.bool,
|
|
20
|
-
keypadMode: i.oneOfType([i.string, i.number]),
|
|
21
|
-
classNames: i.object,
|
|
22
|
-
error: i.string,
|
|
23
|
-
maxResponseAreas: i.number,
|
|
24
|
-
showKeypad: i.bool,
|
|
25
|
-
noDecimal: i.bool,
|
|
26
|
-
additionalKeys: i.array,
|
|
27
|
-
latex: i.string.isRequired,
|
|
28
|
-
onAnswerBlockAdd: i.func,
|
|
29
|
-
onChange: i.func,
|
|
30
|
-
onDone: i.func.isRequired,
|
|
31
|
-
onFocus: i.func,
|
|
32
|
-
onBlur: i.func,
|
|
33
|
-
hideDoneButton: i.bool,
|
|
34
|
-
keyPadCharacterRef: i.func,
|
|
35
|
-
setKeypadInteraction: i.func
|
|
36
|
-
};
|
|
37
|
-
static defaultProps = {
|
|
38
|
-
classNames: {},
|
|
39
|
-
keypadMode: "item-authoring",
|
|
40
|
-
autoFocus: !1,
|
|
41
|
-
allowAnswerBlock: !1,
|
|
42
|
-
controlledKeypad: !1,
|
|
43
|
-
controlledKeypadMode: !1,
|
|
44
|
-
noDecimal: !1,
|
|
45
|
-
showKeypad: !0,
|
|
46
|
-
additionalKeys: [],
|
|
47
|
-
onChange: () => {},
|
|
48
|
-
onAnswerBlockAdd: () => {},
|
|
49
|
-
onFocus: () => {},
|
|
50
|
-
hideDoneButton: !1
|
|
51
|
-
};
|
|
52
|
-
constructor(e) {
|
|
53
|
-
super(e), this.state = { latex: e.latex };
|
|
54
|
-
}
|
|
55
|
-
done = () => {
|
|
56
|
-
this.props.onDone(this.state.latex);
|
|
57
|
-
};
|
|
58
|
-
UNSAFE_componentWillReceiveProps(e) {
|
|
59
|
-
this.setState({ latex: e.latex });
|
|
60
|
-
}
|
|
61
|
-
onChange = (e) => {
|
|
62
|
-
this.setState({ latex: e }), this.props.onChange(e);
|
|
63
|
-
};
|
|
64
|
-
render() {
|
|
65
|
-
let { latex: e } = this.state, { classNames: t, autoFocus: n, allowAnswerBlock: r, onAnswerBlockAdd: i, controlledKeypad: a, controlledKeypadMode: s, keypadMode: c, noDecimal: l, additionalKeys: u, showKeypad: f, onFocus: p, onBlur: m, hideDoneButton: h, error: g, keyPadCharacterRef: _, setKeypadInteraction: v, maxResponseAreas: y } = this.props;
|
|
66
|
-
return /* @__PURE__ */ o(d, {
|
|
67
|
-
autoFocus: n,
|
|
68
|
-
classNames: t,
|
|
69
|
-
onAnswerBlockAdd: i,
|
|
70
|
-
allowAnswerBlock: r,
|
|
71
|
-
latex: e,
|
|
72
|
-
additionalKeys: u,
|
|
73
|
-
noDecimal: l,
|
|
74
|
-
keypadMode: c,
|
|
75
|
-
keyPadCharacterRef: _,
|
|
76
|
-
setKeypadInteraction: v,
|
|
77
|
-
onChange: this.onChange,
|
|
78
|
-
onDone: this.done,
|
|
79
|
-
onFocus: p,
|
|
80
|
-
onBlur: m,
|
|
81
|
-
showKeypad: f,
|
|
82
|
-
controlledKeypad: a,
|
|
83
|
-
controlledKeypadMode: s,
|
|
84
|
-
hideDoneButton: h,
|
|
85
|
-
error: g,
|
|
86
|
-
maxResponseAreas: y
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}, u = class extends r.Component {
|
|
90
|
-
static propTypes = {
|
|
91
|
-
classNames: i.object,
|
|
92
|
-
latex: i.string.isRequired,
|
|
93
|
-
keypadMode: i.oneOfType([i.string, i.number]),
|
|
94
|
-
hideInput: i.bool,
|
|
95
|
-
noLatexHandling: i.bool,
|
|
96
|
-
layoutForKeyPad: i.object,
|
|
97
|
-
onChange: i.func.isRequired,
|
|
98
|
-
onDone: i.func.isRequired,
|
|
99
|
-
onBlur: i.func,
|
|
100
|
-
onAnswerBlockAdd: i.func,
|
|
101
|
-
additionalKeys: i.array,
|
|
102
|
-
onFocus: i.func,
|
|
103
|
-
autoFocus: i.bool,
|
|
104
|
-
noDecimal: i.bool,
|
|
105
|
-
allowAnswerBlock: i.bool,
|
|
106
|
-
controlledKeypad: i.bool,
|
|
107
|
-
controlledKeypadMode: i.bool,
|
|
108
|
-
showKeypad: i.bool,
|
|
109
|
-
hideDoneButton: i.bool,
|
|
110
|
-
hideDoneButtonBackground: i.bool,
|
|
111
|
-
error: i.any,
|
|
112
|
-
maxResponseAreas: i.number,
|
|
113
|
-
keyPadCharacterRef: i.object,
|
|
114
|
-
setKeypadInteraction: i.func
|
|
115
|
-
};
|
|
116
|
-
static defaultProps = {
|
|
117
|
-
classNames: {},
|
|
118
|
-
hideDoneButtonBackground: !1
|
|
119
|
-
};
|
|
120
|
-
render() {
|
|
121
|
-
let { classNames: n, autoFocus: r, allowAnswerBlock: i, onAnswerBlockAdd: a, controlledKeypad: l, controlledKeypadMode: u, additionalKeys: d, showKeypad: f, keypadMode: p, noDecimal: m, hideInput: h, noLatexHandling: g, layoutForKeyPad: _, keyPadCharacterRef: v, setKeypadInteraction: y, latex: b, onChange: x, onDone: S, onFocus: C, onBlur: w, hideDoneButton: T, hideDoneButtonBackground: E, error: D, maxResponseAreas: O } = this.props;
|
|
122
|
-
return /* @__PURE__ */ s(c, {
|
|
123
|
-
className: n && n.toolbar || "",
|
|
124
|
-
ref: v,
|
|
125
|
-
children: [
|
|
126
|
-
/* @__PURE__ */ o("div", {}),
|
|
127
|
-
/* @__PURE__ */ o(e, {
|
|
128
|
-
autoFocus: r,
|
|
129
|
-
keypadMode: p,
|
|
130
|
-
classNames: n || {},
|
|
131
|
-
controlledKeypad: l,
|
|
132
|
-
controlledKeypadMode: u,
|
|
133
|
-
noDecimal: m,
|
|
134
|
-
hideInput: h,
|
|
135
|
-
noLatexHandling: g,
|
|
136
|
-
layoutForKeyPad: _,
|
|
137
|
-
showKeypad: f,
|
|
138
|
-
additionalKeys: d,
|
|
139
|
-
allowAnswerBlock: i,
|
|
140
|
-
onAnswerBlockAdd: a,
|
|
141
|
-
latex: b,
|
|
142
|
-
onChange: x,
|
|
143
|
-
onFocus: C,
|
|
144
|
-
onBlur: w,
|
|
145
|
-
error: D,
|
|
146
|
-
maxResponseAreas: O,
|
|
147
|
-
setKeypadInteraction: y
|
|
148
|
-
}),
|
|
149
|
-
(!l || l && f) && !T && /* @__PURE__ */ o(t, {
|
|
150
|
-
hideBackground: E,
|
|
151
|
-
onClick: S
|
|
152
|
-
})
|
|
153
|
-
]
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}, d = u;
|
|
157
|
-
//#endregion
|
|
158
|
-
export { n as MathPreview, l as MathToolbar, d as PureToolbar, u as RawPureToolbar };
|
package/dist/math-preview.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/math-toolbar/src/math-preview.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 RawMathPreview extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
latex: PropTypes.Requireable<string>;
|
|
14
|
-
isSelected: PropTypes.Requireable<boolean>;
|
|
15
|
-
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
-
};
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
componentDidUpdate(prevProps: any): void;
|
|
20
|
-
render(): React.JSX.Element;
|
|
21
|
-
}
|
|
22
|
-
export default RawMathPreview;
|