@pie-element/multiple-choice 14.0.3-next.20261007184841 → 14.0.3
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/browser/{editor-runtime/Radio-DunACTpA.js → Radio-CdxrHstE.js} +3324 -3361
- package/dist/browser/Radio-CdxrHstE.js.map +1 -0
- package/dist/browser/author/index.js +6696 -6696
- package/dist/browser/author/index.js.map +1 -1
- package/dist/browser/delivery/index.js +9 -9
- package/dist/browser/{Radio-D8xV6gXW.js → editor-runtime/Radio-BO3TWJnT.js} +3114 -3151
- package/dist/browser/editor-runtime/Radio-BO3TWJnT.js.map +1 -0
- package/dist/browser/editor-runtime/author/index.js +1659 -1659
- package/dist/browser/editor-runtime/author/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +10 -10
- package/dist/browser/editor-runtime/{main-CrByvp15.js → main-nz8Bp_TJ.js} +348 -362
- package/dist/browser/editor-runtime/main-nz8Bp_TJ.js.map +1 -0
- package/dist/browser/editor-runtime/{mathjax-BKrHE4xs-CWQwfvI5.js → mathjax-BKrHE4xs-DtsPQ6Zq.js} +14 -14
- package/dist/browser/editor-runtime/{mathjax-BKrHE4xs-CWQwfvI5.js.map → mathjax-BKrHE4xs-DtsPQ6Zq.js.map} +1 -1
- package/dist/browser/editor-runtime/print/index.js +3 -3
- package/dist/browser/{main-Clsf7I8G.js → main-CIn-5xKa.js} +348 -362
- package/dist/browser/main-CIn-5xKa.js.map +1 -0
- package/dist/browser/{mathjax-BKrHE4xs-DVnrK6qA.js → mathjax-BKrHE4xs-CyELJtN1.js} +16 -16
- package/dist/browser/{mathjax-BKrHE4xs-DVnrK6qA.js.map → mathjax-BKrHE4xs-CyELJtN1.js.map} +1 -1
- package/dist/browser/print/index.js +2 -2
- package/dist/delivery/choice-input.js +91 -105
- package/dist/index.iife.js +21 -21
- package/module/print.js +977 -1028
- package/module/print.js.map +1 -1
- package/package.json +12 -12
- package/dist/browser/Radio-D8xV6gXW.js.map +0 -1
- package/dist/browser/editor-runtime/Radio-DunACTpA.js.map +0 -1
- package/dist/browser/editor-runtime/main-CrByvp15.js.map +0 -1
- package/dist/browser/main-Clsf7I8G.js.map +0 -1
- package/dist/delivery/__tests__/math-control-names.test.d.ts +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as r } from "../main-
|
|
1
|
+
import { N as e, U as t, Yt as n } from "../Radio-CdxrHstE.js";
|
|
2
|
+
import { t as r } from "../main-CIn-5xKa.js";
|
|
3
3
|
import { a as i, p as a } from "../dist-DL6MQNxd.js";
|
|
4
4
|
import o from "react";
|
|
5
5
|
import { createRoot as s } from "react-dom/client";
|
|
@@ -3,92 +3,92 @@ import t from "./feedback-tick.js";
|
|
|
3
3
|
import n from "react";
|
|
4
4
|
import r from "prop-types";
|
|
5
5
|
import * as i from "@pie-lib/render-ui";
|
|
6
|
-
import { Feedback as a,
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { styled as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
6
|
+
import { Feedback as a, PreviewPrompt as o, color as s, createUniqueId as c } from "@pie-lib/render-ui";
|
|
7
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
import { styled as f } from "@mui/material/styles";
|
|
9
|
+
import p from "@mui/material/Box";
|
|
10
|
+
import m from "@mui/material/FormControlLabel";
|
|
11
|
+
import h from "@mui/material/Checkbox";
|
|
12
|
+
import g from "@mui/material/Radio";
|
|
13
13
|
//#region src/delivery/choice-input.tsx
|
|
14
|
-
function
|
|
14
|
+
function _(e) {
|
|
15
15
|
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return !e ||
|
|
17
|
+
function v(e, t) {
|
|
18
|
+
return !e || _(e) ? e : _(e.default) ? e.default : t && _(e[t]) ? e[t] : t && _(e[t]?.default) ? e[t].default : e;
|
|
19
19
|
}
|
|
20
|
-
var
|
|
20
|
+
var y = v(o, "PreviewPrompt") || v(C.PreviewPrompt, "PreviewPrompt"), b = v(a, "Feedback") || v(C.Feedback, "Feedback"), x = i, S = x.default, C = S && typeof S == "object" ? S : x, w = "multiple-choice-component", T = f(p)({
|
|
21
21
|
display: "flex",
|
|
22
22
|
alignItems: "center",
|
|
23
|
-
backgroundColor:
|
|
24
|
-
}),
|
|
23
|
+
backgroundColor: s.background()
|
|
24
|
+
}), E = f(p)({
|
|
25
25
|
display: "flex",
|
|
26
26
|
alignItems: "center",
|
|
27
|
-
backgroundColor:
|
|
27
|
+
backgroundColor: s.background(),
|
|
28
28
|
flex: 1,
|
|
29
29
|
"& .MuiFormControlLabel-root": { marginLeft: "-14px" },
|
|
30
30
|
"& label": {
|
|
31
|
-
color:
|
|
31
|
+
color: s.text(),
|
|
32
32
|
"& > span": { fontSize: "inherit" },
|
|
33
33
|
"& > .MuiButtonBase-root": { padding: "12px" }
|
|
34
34
|
}
|
|
35
|
-
}),
|
|
35
|
+
}), D = f("span")(({ theme: e }) => ({
|
|
36
36
|
display: "flex",
|
|
37
37
|
alignItems: "center",
|
|
38
38
|
"& > span": { marginLeft: `-${e.spacing(1)}` }
|
|
39
|
-
})),
|
|
39
|
+
})), O = f("span")({
|
|
40
40
|
position: "absolute",
|
|
41
41
|
left: "-10000px",
|
|
42
42
|
top: "auto",
|
|
43
43
|
width: "1px",
|
|
44
44
|
height: "1px",
|
|
45
45
|
overflow: "hidden"
|
|
46
|
-
}),
|
|
46
|
+
}), k = f(m)({
|
|
47
47
|
"& .MuiFormControlLabel-label": {
|
|
48
|
-
color: `${
|
|
49
|
-
backgroundColor:
|
|
48
|
+
color: `${s.text()} !important`,
|
|
49
|
+
backgroundColor: s.background(),
|
|
50
50
|
letterSpacing: "normal"
|
|
51
51
|
},
|
|
52
52
|
"&.Mui-disabled *": { cursor: "not-allowed !important" }
|
|
53
|
-
}),
|
|
53
|
+
}), A = (e, t) => ({ [`&.${w}`]: { color: `var(--choice-input-${e}, ${t}) !important` } }), j = (e) => {
|
|
54
54
|
let t = (t) => e ? `${e}-${t}` : t;
|
|
55
55
|
return {
|
|
56
56
|
[t("root")]: {
|
|
57
|
-
...
|
|
58
|
-
...e === "correct" ?
|
|
59
|
-
...e === "incorrect" ?
|
|
57
|
+
...A("color", s.text()),
|
|
58
|
+
...e === "correct" ? A("correct-color", s.text()) : {},
|
|
59
|
+
...e === "incorrect" ? A("incorrect-color", s.incorrect()) : {}
|
|
60
60
|
},
|
|
61
61
|
[t("checked")]: {
|
|
62
|
-
...e === "correct" ?
|
|
63
|
-
...e === "incorrect" ?
|
|
64
|
-
...e ? {} :
|
|
62
|
+
...e === "correct" ? A("correct-selected-color", s.correct()) : {},
|
|
63
|
+
...e === "incorrect" ? A("incorrect-checked", s.incorrect()) : {},
|
|
64
|
+
...e ? {} : A("selected-color", s.primary())
|
|
65
65
|
},
|
|
66
66
|
[t("disabled")]: {
|
|
67
|
-
...
|
|
68
|
-
...e === "correct" ?
|
|
69
|
-
...e === "incorrect" ?
|
|
67
|
+
...A("disabled-color", s.text()),
|
|
68
|
+
...e === "correct" ? A("correct-disabled-color", s.disabled()) : {},
|
|
69
|
+
...e === "incorrect" ? A("incorrect-disabled-color", s.disabled()) : {},
|
|
70
70
|
opacity: .6,
|
|
71
71
|
cursor: "not-allowed !important",
|
|
72
72
|
pointerEvents: "initial !important"
|
|
73
73
|
},
|
|
74
74
|
focusVisibleUnchecked: {
|
|
75
|
-
outline: `2px solid ${
|
|
75
|
+
outline: `2px solid ${s.focusOutline()}`,
|
|
76
76
|
backgroundColor: "transparent"
|
|
77
77
|
},
|
|
78
78
|
focusVisibleChecked: {
|
|
79
|
-
outline: `2px solid ${
|
|
79
|
+
outline: `2px solid ${s.focusOutline()}`,
|
|
80
80
|
backgroundColor: "transparent"
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
|
-
},
|
|
84
|
-
let t =
|
|
83
|
+
}, M = f(h, { shouldForwardProp: (e) => e !== "correctness" })(({ correctness: e }) => {
|
|
84
|
+
let t = j(e), n = (t) => e ? `${e}-${t}` : t;
|
|
85
85
|
return {
|
|
86
|
-
[`&.${
|
|
86
|
+
[`&.${w}`]: {
|
|
87
87
|
...t[n("root")],
|
|
88
88
|
"&.Mui-checked": t[n("checked")],
|
|
89
89
|
"&.Mui-disabled": e ? {} : t[n("disabled")],
|
|
90
90
|
"&:hover:not(.Mui-disabled) svg": {
|
|
91
|
-
boxShadow: `0px 0px 0px 2px ${
|
|
91
|
+
boxShadow: `0px 0px 0px 2px ${s.focusOutline()}`,
|
|
92
92
|
borderRadius: "4px"
|
|
93
93
|
}
|
|
94
94
|
},
|
|
@@ -97,14 +97,11 @@ var b = y(s, "PreviewPrompt") || y(w.PreviewPrompt, "PreviewPrompt"), x = y(a, "
|
|
|
97
97
|
"&.Mui-checked": t.focusVisibleChecked
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
}),
|
|
101
|
-
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, onKeyDown: s, inputRef: c
|
|
102
|
-
return /* @__PURE__ */
|
|
100
|
+
}), N = (e) => {
|
|
101
|
+
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, onKeyDown: s, inputRef: c } = e;
|
|
102
|
+
return /* @__PURE__ */ u(M, {
|
|
103
103
|
id: o,
|
|
104
|
-
slotProps: { input: {
|
|
105
|
-
ref: c,
|
|
106
|
-
"aria-label": l
|
|
107
|
-
} },
|
|
104
|
+
slotProps: { input: { ref: c } },
|
|
108
105
|
onKeyDown: s,
|
|
109
106
|
disableRipple: !0,
|
|
110
107
|
checked: n,
|
|
@@ -112,19 +109,19 @@ var b = y(s, "PreviewPrompt") || y(w.PreviewPrompt, "PreviewPrompt"), x = y(a, "
|
|
|
112
109
|
disabled: i,
|
|
113
110
|
value: a,
|
|
114
111
|
correctness: t,
|
|
115
|
-
className:
|
|
112
|
+
className: w
|
|
116
113
|
});
|
|
117
|
-
},
|
|
118
|
-
let t =
|
|
114
|
+
}, P = f(g, { shouldForwardProp: (e) => e !== "correctness" })(({ correctness: e }) => {
|
|
115
|
+
let t = j(e), n = (t) => e ? `${e}-${t}` : t;
|
|
119
116
|
return {
|
|
120
|
-
[`&.${
|
|
117
|
+
[`&.${w}`]: {
|
|
121
118
|
...t[n("root")],
|
|
122
119
|
"&.Mui-checked": t[n("checked")],
|
|
123
120
|
"&.Mui-disabled": e ? {} : t[n("disabled")],
|
|
124
121
|
"&.Mui-focusVisible:not(.Mui-checked)": t.focusVisibleUnchecked,
|
|
125
122
|
"&.Mui-focusVisible.Mui-checked": t.focusVisibleChecked,
|
|
126
123
|
"&:hover:not(.Mui-disabled) svg": {
|
|
127
|
-
boxShadow: `0px 0px 0px 2px ${
|
|
124
|
+
boxShadow: `0px 0px 0px 2px ${s.focusOutline()}`,
|
|
128
125
|
borderRadius: "50%"
|
|
129
126
|
}
|
|
130
127
|
},
|
|
@@ -133,24 +130,21 @@ var b = y(s, "PreviewPrompt") || y(w.PreviewPrompt, "PreviewPrompt"), x = y(a, "
|
|
|
133
130
|
"& .MuiTouchRipple-root": { display: "none" }
|
|
134
131
|
}
|
|
135
132
|
};
|
|
136
|
-
}),
|
|
137
|
-
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, tagName: s, inputRef: c
|
|
138
|
-
return /* @__PURE__ */
|
|
133
|
+
}), F = (e) => {
|
|
134
|
+
let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, tagName: s, inputRef: c } = e;
|
|
135
|
+
return /* @__PURE__ */ u(P, {
|
|
139
136
|
id: o,
|
|
140
|
-
slotProps: { input: {
|
|
141
|
-
ref: c,
|
|
142
|
-
"aria-label": l
|
|
143
|
-
} },
|
|
137
|
+
slotProps: { input: { ref: c } },
|
|
144
138
|
disableRipple: !0,
|
|
145
139
|
checked: n,
|
|
146
140
|
onChange: r,
|
|
147
141
|
disabled: i,
|
|
148
142
|
value: a,
|
|
149
143
|
correctness: t,
|
|
150
|
-
className:
|
|
144
|
+
className: w,
|
|
151
145
|
name: s
|
|
152
146
|
});
|
|
153
|
-
},
|
|
147
|
+
}, I = class extends n.Component {
|
|
154
148
|
static propTypes = {
|
|
155
149
|
choiceMode: r.oneOf(["radio", "checkbox"]),
|
|
156
150
|
displayKey: r.string,
|
|
@@ -179,7 +173,7 @@ var b = y(s, "PreviewPrompt") || y(w.PreviewPrompt, "PreviewPrompt"), x = y(a, "
|
|
|
179
173
|
isEvaluateMode: !1
|
|
180
174
|
};
|
|
181
175
|
constructor(e) {
|
|
182
|
-
super(e), this.onToggleChoice = this.onToggleChoice.bind(this), this.choiceId =
|
|
176
|
+
super(e), this.onToggleChoice = this.onToggleChoice.bind(this), this.choiceId = c("choice"), this.descId = `${this.choiceId}-desc`;
|
|
183
177
|
}
|
|
184
178
|
onToggleChoice(e) {
|
|
185
179
|
this.props.onChange(e);
|
|
@@ -200,92 +194,84 @@ var b = y(s, "PreviewPrompt") || y(w.PreviewPrompt, "PreviewPrompt"), x = y(a, "
|
|
|
200
194
|
c && c.focus();
|
|
201
195
|
};
|
|
202
196
|
render() {
|
|
203
|
-
let { choiceMode: n, disabled: r, displayKey: i, feedback: a, label:
|
|
204
|
-
...
|
|
197
|
+
let { choiceMode: n, disabled: r, displayKey: i, feedback: a, label: o, correctness: s, className: c, rationale: f, hideTick: p, isEvaluateMode: m, choicesLayout: h, value: g, checked: _, tagName: v, isSelectionButtonBelow: x } = this.props, S = n === "checkbox" ? N : F, C = n === "checkbox" ? "checkbox" : "radio-button", A = {
|
|
198
|
+
...h === "horizontal" && { [`& .${w}`]: {
|
|
205
199
|
padding: "8px",
|
|
206
200
|
margin: "4px 0 4px 4px"
|
|
207
201
|
} },
|
|
208
|
-
...
|
|
209
|
-
...
|
|
202
|
+
...x && h !== "grid" && { "& > label": { alignItems: "flex-start" } },
|
|
203
|
+
...x && h === "grid" && {
|
|
210
204
|
justifyContent: "center",
|
|
211
205
|
"& > label": { alignItems: "center" }
|
|
212
206
|
}
|
|
213
|
-
},
|
|
207
|
+
}, j = typeof o == "string" && (o.includes("<math") || o.includes("\\(") || o.includes("\\[") || o.includes("<img") || o.includes("data-latex") || o.includes("data-raw") || o.includes("<mjx-container")), M = i ? /* @__PURE__ */ u(O, {
|
|
214
208
|
id: this.descId,
|
|
215
|
-
children:
|
|
216
|
-
}) : null,
|
|
209
|
+
children: j ? `Pick the answer below, ${i}` : i
|
|
210
|
+
}) : null, P = /* @__PURE__ */ u(l, { children: i && !x ? /* @__PURE__ */ d(T, {
|
|
217
211
|
component: "span",
|
|
218
|
-
children: [/* @__PURE__ */
|
|
212
|
+
children: [/* @__PURE__ */ d("span", {
|
|
219
213
|
"aria-hidden": "true",
|
|
220
214
|
children: [
|
|
221
215
|
i,
|
|
222
216
|
".",
|
|
223
217
|
"\xA0"
|
|
224
218
|
]
|
|
225
|
-
}), /* @__PURE__ */
|
|
219
|
+
}), /* @__PURE__ */ u(y, {
|
|
226
220
|
className: "prompt-label",
|
|
227
|
-
prompt:
|
|
221
|
+
prompt: o,
|
|
228
222
|
tagName: "span"
|
|
229
223
|
})]
|
|
230
|
-
}) : /* @__PURE__ */
|
|
224
|
+
}) : /* @__PURE__ */ u(y, {
|
|
231
225
|
className: "prompt-label",
|
|
232
|
-
prompt:
|
|
226
|
+
prompt: o,
|
|
233
227
|
tagName: "span"
|
|
234
|
-
}) }),
|
|
228
|
+
}) }), I = {
|
|
235
229
|
disabled: r,
|
|
236
|
-
checked:
|
|
237
|
-
correctness:
|
|
238
|
-
tagName:
|
|
239
|
-
value:
|
|
230
|
+
checked: _,
|
|
231
|
+
correctness: s,
|
|
232
|
+
tagName: v,
|
|
233
|
+
value: g,
|
|
240
234
|
id: this.choiceId,
|
|
241
235
|
onChange: this.onToggleChoice,
|
|
242
236
|
onKeyDown: this.handleKeyDown,
|
|
243
|
-
...
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
...
|
|
248
|
-
ariaLabel: e,
|
|
237
|
+
...M ? { "aria-describedby": this.descId } : {}
|
|
238
|
+
}, L = x ? /* @__PURE__ */ d(D, { children: [
|
|
239
|
+
M,
|
|
240
|
+
/* @__PURE__ */ u(S, {
|
|
241
|
+
...I,
|
|
249
242
|
style: { padding: 0 }
|
|
250
243
|
}),
|
|
251
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ u("span", {
|
|
252
245
|
"aria-hidden": "true",
|
|
253
246
|
children: i ? `${i}.` : ""
|
|
254
247
|
})
|
|
255
|
-
] }) : /* @__PURE__ */
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
})] });
|
|
259
|
-
return /* @__PURE__ */ f("div", {
|
|
260
|
-
className: e(l, "corespring-" + w, "choice-input"),
|
|
248
|
+
] }) : /* @__PURE__ */ d(l, { children: [M, /* @__PURE__ */ u(S, { ...I })] });
|
|
249
|
+
return /* @__PURE__ */ d("div", {
|
|
250
|
+
className: e(c, "corespring-" + C, "choice-input"),
|
|
261
251
|
children: [
|
|
262
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ d(T, { children: [!p && m && /* @__PURE__ */ u(t, { correctness: s }), /* @__PURE__ */ u(E, {
|
|
263
253
|
className: "checkbox-holder",
|
|
264
|
-
sx:
|
|
265
|
-
children: /* @__PURE__ */
|
|
266
|
-
label:
|
|
267
|
-
|
|
268
|
-
style: { display: "contents" },
|
|
269
|
-
children: F
|
|
270
|
-
}),
|
|
271
|
-
value: _,
|
|
254
|
+
sx: A,
|
|
255
|
+
children: /* @__PURE__ */ u(k, {
|
|
256
|
+
label: P,
|
|
257
|
+
value: g,
|
|
272
258
|
htmlFor: this.choiceId,
|
|
273
|
-
labelPlacement:
|
|
274
|
-
control:
|
|
275
|
-
})
|
|
259
|
+
labelPlacement: x ? "top" : void 0,
|
|
260
|
+
control: L
|
|
261
|
+
})
|
|
276
262
|
})] }),
|
|
277
|
-
|
|
263
|
+
f && /* @__PURE__ */ u(y, {
|
|
278
264
|
className: "rationale",
|
|
279
265
|
defaultClassName: "rationale",
|
|
280
|
-
prompt:
|
|
266
|
+
prompt: f
|
|
281
267
|
}),
|
|
282
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ u(b, {
|
|
283
269
|
feedback: a,
|
|
284
|
-
correctness:
|
|
270
|
+
correctness: s
|
|
285
271
|
})
|
|
286
272
|
]
|
|
287
273
|
});
|
|
288
274
|
}
|
|
289
275
|
};
|
|
290
276
|
//#endregion
|
|
291
|
-
export {
|
|
277
|
+
export { I as ChoiceInput, I as default, N as StyledCheckbox, k as StyledFormControlLabel, F as StyledRadio };
|