@pie-lib/mask-markup 3.0.4-next.31 → 3.0.4-next.32
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/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/choices/choice.d.ts +24 -0
- package/dist/choices/choice.js +77 -0
- package/dist/choices/index.d.ts +25 -0
- package/dist/choices/index.js +49 -0
- package/dist/componentize.d.ts +12 -0
- package/dist/componentize.js +4 -0
- package/dist/components/blank.d.ts +39 -0
- package/dist/components/blank.js +240 -0
- package/dist/components/correct-input.d.ts +11 -0
- package/dist/components/dropdown.d.ts +37 -0
- package/dist/components/dropdown.js +320 -0
- package/dist/components/input.d.ts +37 -0
- package/dist/constructed-response.d.ts +44 -0
- package/dist/constructed-response.js +55 -0
- package/dist/customizable.d.ts +43 -0
- package/dist/customizable.js +8 -0
- package/dist/drag-in-the-blank.d.ts +37 -0
- package/dist/drag-in-the-blank.js +164 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +7 -0
- package/dist/inline-dropdown.d.ts +44 -0
- package/dist/inline-dropdown.js +24 -0
- package/dist/mask.d.ts +30 -0
- package/dist/mask.js +99 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
- package/dist/serialization.d.ts +34 -0
- package/dist/serialization.js +132 -0
- package/dist/with-mask.d.ts +55 -0
- package/dist/with-mask.js +45 -0
- package/package.json +39 -20
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1256
- package/LICENSE.md +0 -5
- package/lib/choices/choice.js +0 -116
- package/lib/choices/choice.js.map +0 -1
- package/lib/choices/index.js +0 -103
- package/lib/choices/index.js.map +0 -1
- package/lib/componentize.js +0 -21
- package/lib/componentize.js.map +0 -1
- package/lib/components/blank.js +0 -371
- package/lib/components/blank.js.map +0 -1
- package/lib/components/correct-input.js +0 -94
- package/lib/components/correct-input.js.map +0 -1
- package/lib/components/dropdown.js +0 -483
- package/lib/components/dropdown.js.map +0 -1
- package/lib/components/input.js +0 -50
- package/lib/components/input.js.map +0 -1
- package/lib/constructed-response.js +0 -101
- package/lib/constructed-response.js.map +0 -1
- package/lib/customizable.js +0 -42
- package/lib/customizable.js.map +0 -1
- package/lib/drag-in-the-blank.js +0 -254
- package/lib/drag-in-the-blank.js.map +0 -1
- package/lib/index.js +0 -55
- package/lib/index.js.map +0 -1
- package/lib/inline-dropdown.js +0 -40
- package/lib/inline-dropdown.js.map +0 -1
- package/lib/mask.js +0 -198
- package/lib/mask.js.map +0 -1
- package/lib/serialization.js +0 -261
- package/lib/serialization.js.map +0 -1
- package/lib/with-mask.js +0 -97
- package/lib/with-mask.js.map +0 -1
- package/src/__tests__/drag-in-the-blank.test.js +0 -111
- package/src/__tests__/index.test.js +0 -38
- package/src/__tests__/mask.test.js +0 -381
- package/src/__tests__/serialization.test.js +0 -54
- package/src/__tests__/utils.js +0 -1
- package/src/__tests__/with-mask.test.js +0 -76
- package/src/choices/__tests__/index.test.js +0 -75
- package/src/choices/choice.jsx +0 -97
- package/src/choices/index.jsx +0 -64
- package/src/componentize.js +0 -13
- package/src/components/__tests__/blank.test.js +0 -199
- package/src/components/__tests__/correct-input.test.js +0 -90
- package/src/components/__tests__/dropdown.test.js +0 -129
- package/src/components/__tests__/input.test.js +0 -102
- package/src/components/blank.jsx +0 -386
- package/src/components/correct-input.jsx +0 -82
- package/src/components/dropdown.jsx +0 -423
- package/src/components/input.jsx +0 -48
- package/src/constructed-response.jsx +0 -87
- package/src/customizable.jsx +0 -34
- package/src/drag-in-the-blank.jsx +0 -241
- package/src/index.js +0 -16
- package/src/inline-dropdown.jsx +0 -29
- package/src/mask.jsx +0 -172
- package/src/serialization.js +0 -260
- package/src/with-mask.jsx +0 -75
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import { renderMath as r } from "@pie-element/shared-math-rendering-mathjax";
|
|
5
|
+
import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
|
+
import * as s from "@pie-lib/render-ui";
|
|
7
|
+
import { InlineMenu as c, color as l } from "@pie-lib/render-ui";
|
|
8
|
+
import u from "@mui/material/Button";
|
|
9
|
+
import d from "@mui/material/InputLabel";
|
|
10
|
+
import f from "@mui/material/MenuItem";
|
|
11
|
+
import p from "@mui/icons-material/ArrowDropDown";
|
|
12
|
+
import m from "@mui/icons-material/ArrowDropUp";
|
|
13
|
+
import h from "@mui/icons-material/Close";
|
|
14
|
+
import g from "@mui/icons-material/Check";
|
|
15
|
+
//#region src/components/dropdown.tsx
|
|
16
|
+
function _(e) {
|
|
17
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
18
|
+
}
|
|
19
|
+
function v(e, t) {
|
|
20
|
+
return !e || _(e) ? e : _(e.default) ? e.default : t && _(e[t]) ? e[t] : t && _(e[t]?.default) ? e[t].default : e;
|
|
21
|
+
}
|
|
22
|
+
var y = v(c, "InlineMenu") || v(S.InlineMenu, "InlineMenu"), b = s, x = b.default, S = x && typeof x == "object" ? x : b, C = n(u)(() => ({
|
|
23
|
+
color: l.text(),
|
|
24
|
+
border: `1px solid ${l.borderGray()}`,
|
|
25
|
+
borderRadius: "4px",
|
|
26
|
+
justifyContent: "space-between",
|
|
27
|
+
backgroundColor: l.background(),
|
|
28
|
+
position: "relative",
|
|
29
|
+
height: "45px",
|
|
30
|
+
width: "fit-content",
|
|
31
|
+
margin: "2px",
|
|
32
|
+
textTransform: "none",
|
|
33
|
+
"& span": { paddingRight: "24px" },
|
|
34
|
+
"& svg": {
|
|
35
|
+
position: "absolute",
|
|
36
|
+
right: "4px",
|
|
37
|
+
top: "calc(50% - 12px)",
|
|
38
|
+
pointerEvents: "none",
|
|
39
|
+
color: l.text(),
|
|
40
|
+
marginLeft: "5px"
|
|
41
|
+
},
|
|
42
|
+
"&.Mui-focused": {
|
|
43
|
+
outline: `3px solid ${l.tertiary()}`,
|
|
44
|
+
outlineOffset: "2px",
|
|
45
|
+
borderWidth: "3px"
|
|
46
|
+
},
|
|
47
|
+
"&.disabledCorrect": {
|
|
48
|
+
borderWidth: "2px",
|
|
49
|
+
borderColor: l.correct(),
|
|
50
|
+
color: `${l.text()} !important`
|
|
51
|
+
},
|
|
52
|
+
"&.disabledIncorrect": {
|
|
53
|
+
borderWidth: "2px",
|
|
54
|
+
borderColor: l.incorrectWithIcon(),
|
|
55
|
+
color: `${l.text()} !important`
|
|
56
|
+
}
|
|
57
|
+
})), w = n(y)(() => ({
|
|
58
|
+
backgroundColor: l.background(),
|
|
59
|
+
border: `1px solid ${l.correct()} !important`,
|
|
60
|
+
"&:hover": {
|
|
61
|
+
border: `1px solid ${l.text()} `,
|
|
62
|
+
borderColor: "initial"
|
|
63
|
+
},
|
|
64
|
+
"&:focus": {
|
|
65
|
+
border: `1px solid ${l.text()}`,
|
|
66
|
+
borderColor: "initial"
|
|
67
|
+
},
|
|
68
|
+
"& .MuiList-root": { padding: 0 }
|
|
69
|
+
})), T = n(f)(() => ({
|
|
70
|
+
height: 24,
|
|
71
|
+
overflow: "hidden",
|
|
72
|
+
fontSize: "1rem",
|
|
73
|
+
fontWeight: 400,
|
|
74
|
+
fontFamily: "inherit",
|
|
75
|
+
lineHeight: "1.5em",
|
|
76
|
+
whiteSpace: "nowrap",
|
|
77
|
+
color: l.text(),
|
|
78
|
+
backgroundColor: l.background(),
|
|
79
|
+
"&.Mui-focusVisible": {
|
|
80
|
+
outline: `3px solid ${l.tertiary()}`,
|
|
81
|
+
outlineOffset: "-1px",
|
|
82
|
+
color: l.text(),
|
|
83
|
+
backgroundColor: l.background()
|
|
84
|
+
},
|
|
85
|
+
"&:hover": {
|
|
86
|
+
color: l.text(),
|
|
87
|
+
backgroundColor: l.dropdownBackground()
|
|
88
|
+
},
|
|
89
|
+
boxSizing: "border-box",
|
|
90
|
+
padding: "16px 8px",
|
|
91
|
+
borderRadius: "4px",
|
|
92
|
+
"&.selected": {
|
|
93
|
+
color: `${l.text()} !important`,
|
|
94
|
+
backgroundColor: `${l.background()} !important`,
|
|
95
|
+
"&:hover": {
|
|
96
|
+
color: l.text(),
|
|
97
|
+
backgroundColor: `${l.dropdownBackground()} !important`
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})), E = n("span")(() => ({ fontSize: "max(1rem, 14px)" })), D = n("span")(() => ({
|
|
101
|
+
fontSize: "max(1rem, 14px)",
|
|
102
|
+
flexShrink: 0,
|
|
103
|
+
paddingLeft: "8px"
|
|
104
|
+
})), O = n(d)(() => ({
|
|
105
|
+
position: "absolute",
|
|
106
|
+
left: "-10000px",
|
|
107
|
+
top: "auto",
|
|
108
|
+
width: "1px",
|
|
109
|
+
height: "1px",
|
|
110
|
+
overflow: "hidden"
|
|
111
|
+
})), k = n(g)(() => ({
|
|
112
|
+
color: `${l.white()} !important`,
|
|
113
|
+
position: "absolute",
|
|
114
|
+
top: "-8px !important",
|
|
115
|
+
left: "-8px",
|
|
116
|
+
marginLeft: "0 !important",
|
|
117
|
+
borderRadius: "50%",
|
|
118
|
+
fontSize: "16px",
|
|
119
|
+
padding: "2px",
|
|
120
|
+
"&.correct": { backgroundColor: l.correct() },
|
|
121
|
+
"&.incorrect": { backgroundColor: l.incorrectWithIcon() }
|
|
122
|
+
})), A = n(h)(() => ({
|
|
123
|
+
color: `${l.white()} !important`,
|
|
124
|
+
position: "absolute",
|
|
125
|
+
top: "-8px !important",
|
|
126
|
+
left: "-8px",
|
|
127
|
+
marginLeft: "0 !important",
|
|
128
|
+
borderRadius: "50%",
|
|
129
|
+
fontSize: "16px",
|
|
130
|
+
padding: "2px",
|
|
131
|
+
"&.correct": { backgroundColor: l.correct() },
|
|
132
|
+
"&.incorrect": { backgroundColor: l.incorrectWithIcon() }
|
|
133
|
+
})), j = class extends e.Component {
|
|
134
|
+
static propTypes = {
|
|
135
|
+
id: t.string,
|
|
136
|
+
value: t.string,
|
|
137
|
+
disabled: t.bool,
|
|
138
|
+
onChange: t.func,
|
|
139
|
+
correct: t.bool,
|
|
140
|
+
choices: t.arrayOf(t.shape({
|
|
141
|
+
value: t.string,
|
|
142
|
+
label: t.string
|
|
143
|
+
})),
|
|
144
|
+
showCorrectAnswer: t.bool,
|
|
145
|
+
singleQuery: t.bool,
|
|
146
|
+
correctValue: t.string
|
|
147
|
+
};
|
|
148
|
+
constructor(t) {
|
|
149
|
+
super(t), this.state = {
|
|
150
|
+
anchorEl: null,
|
|
151
|
+
highlightedOptionId: null,
|
|
152
|
+
menuWidth: null,
|
|
153
|
+
previewValue: null
|
|
154
|
+
}, this.hiddenRef = e.createRef(), this.buttonRef = e.createRef(), this.previewRef = e.createRef(), this.elementRefs = [];
|
|
155
|
+
}
|
|
156
|
+
componentDidMount() {
|
|
157
|
+
this.hiddenRef.current && this.state.menuWidth === null && this.setState({ menuWidth: this.hiddenRef.current.clientWidth });
|
|
158
|
+
}
|
|
159
|
+
componentDidUpdate(e, t) {
|
|
160
|
+
let n = this.hiddenRef.current;
|
|
161
|
+
if (!t.anchorEl && this.state.anchorEl && this.elementRefs.forEach((e) => {
|
|
162
|
+
if (!e) return;
|
|
163
|
+
let t = e.querySelector("[data-latex], [data-raw]"), n = e.querySelector("mjx-container"), i = e.querySelector("[data-math-handled=\"true\"]");
|
|
164
|
+
t && (!i || !n) && r(e);
|
|
165
|
+
}), n) {
|
|
166
|
+
let e = n.clientWidth;
|
|
167
|
+
e !== this.state.menuWidth && (this.elementRefs.forEach((e) => {
|
|
168
|
+
e && r(e);
|
|
169
|
+
}), r(n), this.setState({ menuWidth: e }));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
handleClick = (e) => {
|
|
173
|
+
let { id: t, value: n, choices: r } = this.props, i = null;
|
|
174
|
+
if (n) {
|
|
175
|
+
let e = (r || []).findIndex((e) => e.value === n);
|
|
176
|
+
e >= 0 && (i = `dropdown-option-${t}-${e}`);
|
|
177
|
+
}
|
|
178
|
+
this.setState({
|
|
179
|
+
anchorEl: e.currentTarget,
|
|
180
|
+
highlightedOptionId: i
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
handleClose = () => {
|
|
184
|
+
let { value: e } = this.props;
|
|
185
|
+
this.setState({
|
|
186
|
+
anchorEl: null,
|
|
187
|
+
previewValue: null,
|
|
188
|
+
highlightedOptionId: null
|
|
189
|
+
}), !e && this.previewRef.current && (this.previewRef.current.innerHTML = "");
|
|
190
|
+
};
|
|
191
|
+
handleHighlight = (e) => {
|
|
192
|
+
let t = { highlightedOptionId: `dropdown-option-${this.props.id}-${e}` };
|
|
193
|
+
this.props.value || (t.previewValue = this.props.choices[e].value), this.setState(t);
|
|
194
|
+
};
|
|
195
|
+
handleSelect = (e, t) => {
|
|
196
|
+
this.props.onChange(this.props.id, e), this.handleHighlight(t), this.handleClose();
|
|
197
|
+
};
|
|
198
|
+
handleHover = (e) => {
|
|
199
|
+
if (this.props.value) return;
|
|
200
|
+
let t = `dropdown-option-${this.props.id}-${e}`, n = this.state.previewValue;
|
|
201
|
+
this.setState({
|
|
202
|
+
highlightedOptionId: t,
|
|
203
|
+
previewValue: n
|
|
204
|
+
}, () => {
|
|
205
|
+
let t = this.elementRefs[e], n = this.previewRef.current;
|
|
206
|
+
t && n && (n.innerHTML = t.innerHTML);
|
|
207
|
+
});
|
|
208
|
+
};
|
|
209
|
+
getLabel(e, t) {
|
|
210
|
+
let n = (e || []).find((e) => e.value === t);
|
|
211
|
+
return n ? n.label.trim() : void 0;
|
|
212
|
+
}
|
|
213
|
+
render() {
|
|
214
|
+
let { id: e, correct: t, disabled: n, value: r, choices: s, showCorrectAnswer: c, singleQuery: l, correctValue: u } = this.props, { anchorEl: d } = this.state, f = !!d, h = `dropdown-button-${e}`, g = `dropdown-menu-${e}`, _ = `dropdown-value-${e}`, v;
|
|
215
|
+
this.elementRefs = [], n && t !== void 0 && (v = t || c ? "disabledCorrect" : "disabledIncorrect");
|
|
216
|
+
let y = parseInt(e, 10) + 1, b = l ? "Query-label" : `Query-label-${y}`, x = l ? "Query" : `Query ${y}`, S = null;
|
|
217
|
+
return n && t !== void 0 && (S = t || c ? /* @__PURE__ */ a(k, { className: "correct" }) : /* @__PURE__ */ a(A, { className: "incorrect" })), /* @__PURE__ */ o(i, { children: [
|
|
218
|
+
/* @__PURE__ */ a("div", {
|
|
219
|
+
ref: this.hiddenRef,
|
|
220
|
+
style: {
|
|
221
|
+
position: "absolute",
|
|
222
|
+
visibility: "hidden",
|
|
223
|
+
top: 0,
|
|
224
|
+
left: 0
|
|
225
|
+
},
|
|
226
|
+
tabIndex: -1,
|
|
227
|
+
"aria-hidden": "true",
|
|
228
|
+
children: (s || []).map((e, t) => /* @__PURE__ */ a(T, {
|
|
229
|
+
tabIndex: -1,
|
|
230
|
+
"aria-hidden": "true",
|
|
231
|
+
children: /* @__PURE__ */ a(E, { dangerouslySetInnerHTML: { __html: e.label } })
|
|
232
|
+
}, t))
|
|
233
|
+
}),
|
|
234
|
+
/* @__PURE__ */ a(O, {
|
|
235
|
+
id: b,
|
|
236
|
+
tabIndex: -1,
|
|
237
|
+
"aria-hidden": "true",
|
|
238
|
+
children: x
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ o(C, {
|
|
241
|
+
ref: this.buttonRef,
|
|
242
|
+
style: {
|
|
243
|
+
...this.state.menuWidth && { minWidth: `calc(${this.state.menuWidth}px + 8px)` },
|
|
244
|
+
borderWidth: f ? "2px" : "1px",
|
|
245
|
+
transition: "border-width 0.2s ease-in-out"
|
|
246
|
+
},
|
|
247
|
+
"aria-controls": f ? g : void 0,
|
|
248
|
+
"aria-haspopup": "listbox",
|
|
249
|
+
"aria-expanded": f ? "true" : void 0,
|
|
250
|
+
"aria-activedescendant": this.state.highlightedOptionId,
|
|
251
|
+
onClick: this.handleClick,
|
|
252
|
+
className: v,
|
|
253
|
+
disabled: n,
|
|
254
|
+
id: h,
|
|
255
|
+
role: "combobox",
|
|
256
|
+
"aria-label": `Select an option for ${x}`,
|
|
257
|
+
"aria-labelledby": _,
|
|
258
|
+
children: [
|
|
259
|
+
S,
|
|
260
|
+
/* @__PURE__ */ a(E, {
|
|
261
|
+
id: _,
|
|
262
|
+
ref: this.previewRef,
|
|
263
|
+
dangerouslySetInnerHTML: { __html: u || (f && this.state.previewValue ? this.getLabel(s, this.state.previewValue) : this.getLabel(s, r) || "") }
|
|
264
|
+
}),
|
|
265
|
+
a(f ? m : p, {})
|
|
266
|
+
]
|
|
267
|
+
}),
|
|
268
|
+
/* @__PURE__ */ a(w, {
|
|
269
|
+
id: g,
|
|
270
|
+
anchorEl: d,
|
|
271
|
+
keepMounted: !0,
|
|
272
|
+
open: f,
|
|
273
|
+
onClose: this.handleClose,
|
|
274
|
+
getContentAnchorEl: null,
|
|
275
|
+
anchorOrigin: {
|
|
276
|
+
vertical: "bottom",
|
|
277
|
+
horizontal: "left"
|
|
278
|
+
},
|
|
279
|
+
transformOrigin: {
|
|
280
|
+
vertical: "top",
|
|
281
|
+
horizontal: "left"
|
|
282
|
+
},
|
|
283
|
+
transitionDuration: {
|
|
284
|
+
enter: 225,
|
|
285
|
+
exit: 195
|
|
286
|
+
},
|
|
287
|
+
slotProps: {
|
|
288
|
+
paper: this.state.menuWidth ? { style: {
|
|
289
|
+
minWidth: this.state.menuWidth,
|
|
290
|
+
padding: "4px"
|
|
291
|
+
} } : void 0,
|
|
292
|
+
list: {
|
|
293
|
+
"aria-labelledby": h,
|
|
294
|
+
role: "listbox",
|
|
295
|
+
disablePadding: !0
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
children: (s || []).map((t, n) => {
|
|
299
|
+
let i = `dropdown-option-${e}-${n}`;
|
|
300
|
+
return /* @__PURE__ */ o(T, {
|
|
301
|
+
id: i,
|
|
302
|
+
className: t.value === r ? "selected" : "",
|
|
303
|
+
selected: t.value === r,
|
|
304
|
+
value: t.value,
|
|
305
|
+
onClick: () => this.handleSelect(t.value, n),
|
|
306
|
+
role: "option",
|
|
307
|
+
"aria-selected": this.state.highlightedOptionId === i ? "true" : void 0,
|
|
308
|
+
onMouseOver: () => this.handleHover(n),
|
|
309
|
+
children: [/* @__PURE__ */ a(E, {
|
|
310
|
+
ref: (e) => this.elementRefs[n] = e,
|
|
311
|
+
dangerouslySetInnerHTML: { __html: t.label }
|
|
312
|
+
}), /* @__PURE__ */ a(D, { dangerouslySetInnerHTML: { __html: t.value === r ? " ✓" : "" } })]
|
|
313
|
+
}, `${t.label}-${n}`);
|
|
314
|
+
})
|
|
315
|
+
})
|
|
316
|
+
] });
|
|
317
|
+
}
|
|
318
|
+
};
|
|
319
|
+
//#endregion
|
|
320
|
+
export { j as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/components/input.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
|
+
declare const Input: {
|
|
12
|
+
({ disabled, correct, charactersLimit, id, isConstructedResponse, value, onChange, showCorrectAnswer, spellCheck, width, }: {
|
|
13
|
+
disabled: any;
|
|
14
|
+
correct: any;
|
|
15
|
+
charactersLimit: any;
|
|
16
|
+
id: any;
|
|
17
|
+
isConstructedResponse: any;
|
|
18
|
+
value: any;
|
|
19
|
+
onChange: any;
|
|
20
|
+
showCorrectAnswer: any;
|
|
21
|
+
spellCheck: any;
|
|
22
|
+
width: any;
|
|
23
|
+
}): React.JSX.Element;
|
|
24
|
+
propTypes: {
|
|
25
|
+
id: PropTypes.Requireable<string>;
|
|
26
|
+
value: PropTypes.Requireable<string>;
|
|
27
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
28
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
29
|
+
spellCheck: PropTypes.Requireable<boolean>;
|
|
30
|
+
correct: PropTypes.Requireable<boolean>;
|
|
31
|
+
showCorrectAnswer: PropTypes.Requireable<boolean>;
|
|
32
|
+
charactersLimit: PropTypes.Requireable<number>;
|
|
33
|
+
width: PropTypes.Requireable<number>;
|
|
34
|
+
isConstructedResponse: PropTypes.Requireable<boolean>;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export default Input;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/constructed-response.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
|
+
declare const _default: {
|
|
11
|
+
new (props: any): {
|
|
12
|
+
componentDidUpdate(prevProps: any): void;
|
|
13
|
+
render(): React.JSX.Element;
|
|
14
|
+
context: unknown;
|
|
15
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
16
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
17
|
+
readonly props: Readonly<{}>;
|
|
18
|
+
state: Readonly<{}>;
|
|
19
|
+
refs: {
|
|
20
|
+
[key: string]: React.ReactInstance;
|
|
21
|
+
};
|
|
22
|
+
componentDidMount?(): void;
|
|
23
|
+
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
24
|
+
componentWillUnmount?(): void;
|
|
25
|
+
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
26
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
27
|
+
componentWillMount?(): void;
|
|
28
|
+
UNSAFE_componentWillMount?(): void;
|
|
29
|
+
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
30
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
31
|
+
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
33
|
+
};
|
|
34
|
+
propTypes: {
|
|
35
|
+
markup: import("prop-types").Requireable<string>;
|
|
36
|
+
layout: import("prop-types").Requireable<object>;
|
|
37
|
+
value: import("prop-types").Requireable<object>;
|
|
38
|
+
onChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
39
|
+
customMarkMarkupComponent: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
40
|
+
elementType: import("prop-types").Requireable<string>;
|
|
41
|
+
};
|
|
42
|
+
contextType?: React.Context<any> | undefined;
|
|
43
|
+
};
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { withMask as e } from "./with-mask.js";
|
|
2
|
+
import t from "./node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { styled as n } from "@mui/material/styles";
|
|
5
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
6
|
+
import { color as i } from "@pie-lib/render-ui";
|
|
7
|
+
import a from "@pie-lib/editable-html-tip-tap";
|
|
8
|
+
//#region src/constructed-response.tsx
|
|
9
|
+
var o = n(a)(() => ({
|
|
10
|
+
display: "inline-block",
|
|
11
|
+
verticalAlign: "middle",
|
|
12
|
+
margin: "4px",
|
|
13
|
+
borderRadius: "4px",
|
|
14
|
+
border: `1px solid ${i.black()}`,
|
|
15
|
+
"&.correct": { border: `1px solid ${i.correct()}` },
|
|
16
|
+
"&.incorrect": { border: `1px solid ${i.incorrect()}` }
|
|
17
|
+
})), s = e("input", (e) => (n, i) => {
|
|
18
|
+
let { adjustedLimit: a, disabled: s, feedback: c, showCorrectAnswer: l, maxLength: u, spellCheck: d, pluginProps: f, onChange: p } = e, m = n.data?.dataset || {};
|
|
19
|
+
if (m.component === "input") {
|
|
20
|
+
let h = (e.choices && m && e.choices[m.id] || [])[0], g = l ? h && h.label : i[m.id] || "", _ = u && u[m.id], v = c && c[m.id], y = l || v === "correct", b = !l && v === "incorrect";
|
|
21
|
+
return /* @__PURE__ */ r(o, {
|
|
22
|
+
id: m.id,
|
|
23
|
+
disabled: l || s,
|
|
24
|
+
disableUnderline: !0,
|
|
25
|
+
onChange: (e) => {
|
|
26
|
+
p({
|
|
27
|
+
...i,
|
|
28
|
+
[m.id]: e
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
markup: g || "",
|
|
32
|
+
charactersLimit: a ? _ : 25,
|
|
33
|
+
activePlugins: ["languageCharacters"],
|
|
34
|
+
pluginProps: f,
|
|
35
|
+
languageCharactersProps: [{ language: "spanish" }],
|
|
36
|
+
spellCheck: d,
|
|
37
|
+
adjustWidthForLimit: !0,
|
|
38
|
+
onKeyDown: (e) => {
|
|
39
|
+
if (e.key === "Enter" || e.keyCode === 13) return !0;
|
|
40
|
+
},
|
|
41
|
+
autoWidthToolbar: !0,
|
|
42
|
+
toolbarOpts: {
|
|
43
|
+
minWidth: "auto",
|
|
44
|
+
noBorder: !0,
|
|
45
|
+
isHidden: !!f?.characters?.disabled
|
|
46
|
+
},
|
|
47
|
+
className: t({
|
|
48
|
+
correct: y,
|
|
49
|
+
incorrect: b
|
|
50
|
+
})
|
|
51
|
+
}, `${n.type}-input-${m.id}`);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
//#endregion
|
|
55
|
+
export { s as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/customizable.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
|
+
declare const _default: {
|
|
10
|
+
new (props: any): {
|
|
11
|
+
componentDidUpdate(prevProps: any): void;
|
|
12
|
+
render(): import("react").JSX.Element;
|
|
13
|
+
context: unknown;
|
|
14
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
15
|
+
forceUpdate(callback?: (() => void) | undefined): void;
|
|
16
|
+
readonly props: Readonly<{}>;
|
|
17
|
+
state: Readonly<{}>;
|
|
18
|
+
refs: {
|
|
19
|
+
[key: string]: import("react").ReactInstance;
|
|
20
|
+
};
|
|
21
|
+
componentDidMount?(): void;
|
|
22
|
+
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
23
|
+
componentWillUnmount?(): void;
|
|
24
|
+
componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
|
|
25
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
26
|
+
componentWillMount?(): void;
|
|
27
|
+
UNSAFE_componentWillMount?(): void;
|
|
28
|
+
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
29
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
30
|
+
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
31
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
32
|
+
};
|
|
33
|
+
propTypes: {
|
|
34
|
+
markup: import("prop-types").Requireable<string>;
|
|
35
|
+
layout: import("prop-types").Requireable<object>;
|
|
36
|
+
value: import("prop-types").Requireable<object>;
|
|
37
|
+
onChange: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
38
|
+
customMarkMarkupComponent: import("prop-types").Requireable<(...args: any[]) => any>;
|
|
39
|
+
elementType: import("prop-types").Requireable<string>;
|
|
40
|
+
};
|
|
41
|
+
contextType?: import("react").Context<any> | undefined;
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { withMask as e } from "./with-mask.js";
|
|
2
|
+
//#region src/customizable.tsx
|
|
3
|
+
var t = e("input", (e) => (t, n, r) => {
|
|
4
|
+
let i = t.data && t.data.dataset || {};
|
|
5
|
+
if (i.component === "input") return e.customMarkMarkupComponent(i.id);
|
|
6
|
+
});
|
|
7
|
+
//#endregion
|
|
8
|
+
export { t as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/drag-in-the-blank.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 default class DragInTheBlank extends React.Component {
|
|
12
|
+
constructor(props: any);
|
|
13
|
+
static propTypes: {
|
|
14
|
+
markup: PropTypes.Requireable<string>;
|
|
15
|
+
layout: PropTypes.Requireable<object>;
|
|
16
|
+
choicesPosition: PropTypes.Requireable<string>;
|
|
17
|
+
choices: PropTypes.Requireable<any[]>;
|
|
18
|
+
value: PropTypes.Requireable<object>;
|
|
19
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
+
duplicates: PropTypes.Requireable<boolean>;
|
|
21
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
22
|
+
feedback: PropTypes.Requireable<object>;
|
|
23
|
+
correctResponse: PropTypes.Requireable<object>;
|
|
24
|
+
showCorrectAnswer: PropTypes.Requireable<boolean>;
|
|
25
|
+
emptyResponseAreaWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
26
|
+
emptyResponseAreaHeight: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
27
|
+
instanceId: PropTypes.Requireable<string>;
|
|
28
|
+
};
|
|
29
|
+
static defaultProps: {
|
|
30
|
+
instanceId: string;
|
|
31
|
+
};
|
|
32
|
+
handleDragStart: any;
|
|
33
|
+
renderDragOverlay: any;
|
|
34
|
+
handleDragEnd: any;
|
|
35
|
+
getPositionDirection: any;
|
|
36
|
+
render(): React.JSX.Element;
|
|
37
|
+
}
|