@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.
Files changed (30) hide show
  1. package/dist/browser/{editor-runtime/Radio-DunACTpA.js → Radio-CdxrHstE.js} +3324 -3361
  2. package/dist/browser/Radio-CdxrHstE.js.map +1 -0
  3. package/dist/browser/author/index.js +6696 -6696
  4. package/dist/browser/author/index.js.map +1 -1
  5. package/dist/browser/delivery/index.js +9 -9
  6. package/dist/browser/{Radio-D8xV6gXW.js → editor-runtime/Radio-BO3TWJnT.js} +3114 -3151
  7. package/dist/browser/editor-runtime/Radio-BO3TWJnT.js.map +1 -0
  8. package/dist/browser/editor-runtime/author/index.js +1659 -1659
  9. package/dist/browser/editor-runtime/author/index.js.map +1 -1
  10. package/dist/browser/editor-runtime/delivery/index.js +10 -10
  11. package/dist/browser/editor-runtime/{main-CrByvp15.js → main-nz8Bp_TJ.js} +348 -362
  12. package/dist/browser/editor-runtime/main-nz8Bp_TJ.js.map +1 -0
  13. package/dist/browser/editor-runtime/{mathjax-BKrHE4xs-CWQwfvI5.js → mathjax-BKrHE4xs-DtsPQ6Zq.js} +14 -14
  14. package/dist/browser/editor-runtime/{mathjax-BKrHE4xs-CWQwfvI5.js.map → mathjax-BKrHE4xs-DtsPQ6Zq.js.map} +1 -1
  15. package/dist/browser/editor-runtime/print/index.js +3 -3
  16. package/dist/browser/{main-Clsf7I8G.js → main-CIn-5xKa.js} +348 -362
  17. package/dist/browser/main-CIn-5xKa.js.map +1 -0
  18. package/dist/browser/{mathjax-BKrHE4xs-DVnrK6qA.js → mathjax-BKrHE4xs-CyELJtN1.js} +16 -16
  19. package/dist/browser/{mathjax-BKrHE4xs-DVnrK6qA.js.map → mathjax-BKrHE4xs-CyELJtN1.js.map} +1 -1
  20. package/dist/browser/print/index.js +2 -2
  21. package/dist/delivery/choice-input.js +91 -105
  22. package/dist/index.iife.js +21 -21
  23. package/module/print.js +977 -1028
  24. package/module/print.js.map +1 -1
  25. package/package.json +12 -12
  26. package/dist/browser/Radio-D8xV6gXW.js.map +0 -1
  27. package/dist/browser/editor-runtime/Radio-DunACTpA.js.map +0 -1
  28. package/dist/browser/editor-runtime/main-CrByvp15.js.map +0 -1
  29. package/dist/browser/main-Clsf7I8G.js.map +0 -1
  30. package/dist/delivery/__tests__/math-control-names.test.d.ts +0 -1
@@ -1,5 +1,5 @@
1
- import { P as e, W as t, Xt as n } from "../Radio-D8xV6gXW.js";
2
- import { t as r } from "../main-Clsf7I8G.js";
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, MathName as o, PreviewPrompt as s, color as c, createUniqueId as l } from "@pie-lib/render-ui";
7
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
8
- import { styled as p } from "@mui/material/styles";
9
- import m from "@mui/material/Box";
10
- import h from "@mui/material/FormControlLabel";
11
- import g from "@mui/material/Checkbox";
12
- import _ from "@mui/material/Radio";
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 v(e) {
14
+ function _(e) {
15
15
  return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
16
16
  }
17
- function y(e, t) {
18
- return !e || v(e) ? e : v(e.default) ? e.default : t && v(e[t]) ? e[t] : t && v(e[t]?.default) ? e[t].default : 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 b = y(s, "PreviewPrompt") || y(w.PreviewPrompt, "PreviewPrompt"), x = y(a, "Feedback") || y(w.Feedback, "Feedback"), S = i, C = S.default, w = C && typeof C == "object" ? C : S, T = "multiple-choice-component", E = p(m)({
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: c.background()
24
- }), D = p(m)({
23
+ backgroundColor: s.background()
24
+ }), E = f(p)({
25
25
  display: "flex",
26
26
  alignItems: "center",
27
- backgroundColor: c.background(),
27
+ backgroundColor: s.background(),
28
28
  flex: 1,
29
29
  "& .MuiFormControlLabel-root": { marginLeft: "-14px" },
30
30
  "& label": {
31
- color: c.text(),
31
+ color: s.text(),
32
32
  "& > span": { fontSize: "inherit" },
33
33
  "& > .MuiButtonBase-root": { padding: "12px" }
34
34
  }
35
- }), O = p("span")(({ theme: e }) => ({
35
+ }), D = f("span")(({ theme: e }) => ({
36
36
  display: "flex",
37
37
  alignItems: "center",
38
38
  "& > span": { marginLeft: `-${e.spacing(1)}` }
39
- })), k = p("span")({
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
- }), A = p(h)({
46
+ }), k = f(m)({
47
47
  "& .MuiFormControlLabel-label": {
48
- color: `${c.text()} !important`,
49
- backgroundColor: c.background(),
48
+ color: `${s.text()} !important`,
49
+ backgroundColor: s.background(),
50
50
  letterSpacing: "normal"
51
51
  },
52
52
  "&.Mui-disabled *": { cursor: "not-allowed !important" }
53
- }), j = (e, t) => ({ [`&.${T}`]: { color: `var(--choice-input-${e}, ${t}) !important` } }), M = (e) => {
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
- ...j("color", c.text()),
58
- ...e === "correct" ? j("correct-color", c.text()) : {},
59
- ...e === "incorrect" ? j("incorrect-color", c.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" ? j("correct-selected-color", c.correct()) : {},
63
- ...e === "incorrect" ? j("incorrect-checked", c.incorrect()) : {},
64
- ...e ? {} : j("selected-color", c.primary())
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
- ...j("disabled-color", c.text()),
68
- ...e === "correct" ? j("correct-disabled-color", c.disabled()) : {},
69
- ...e === "incorrect" ? j("incorrect-disabled-color", c.disabled()) : {},
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 ${c.focusOutline()}`,
75
+ outline: `2px solid ${s.focusOutline()}`,
76
76
  backgroundColor: "transparent"
77
77
  },
78
78
  focusVisibleChecked: {
79
- outline: `2px solid ${c.focusOutline()}`,
79
+ outline: `2px solid ${s.focusOutline()}`,
80
80
  backgroundColor: "transparent"
81
81
  }
82
82
  };
83
- }, N = p(g, { shouldForwardProp: (e) => e !== "correctness" })(({ correctness: e }) => {
84
- let t = M(e), n = (t) => e ? `${e}-${t}` : 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
- [`&.${T}`]: {
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 ${c.focusOutline()}`,
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
- }), P = (e) => {
101
- let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, onKeyDown: s, inputRef: c, ariaLabel: l } = e;
102
- return /* @__PURE__ */ d(N, {
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: T
112
+ className: w
116
113
  });
117
- }, F = p(_, { shouldForwardProp: (e) => e !== "correctness" })(({ correctness: e }) => {
118
- let t = M(e), n = (t) => e ? `${e}-${t}` : 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
- [`&.${T}`]: {
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 ${c.focusOutline()}`,
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
- }), I = (e) => {
137
- let { correctness: t, checked: n, onChange: r, disabled: i, value: a, id: o, tagName: s, inputRef: c, ariaLabel: l } = e;
138
- return /* @__PURE__ */ d(F, {
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: T,
144
+ className: w,
151
145
  name: s
152
146
  });
153
- }, L = class extends n.Component {
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 = l("choice"), this.descId = `${this.choiceId}-desc`;
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: s, correctness: c, className: l, rationale: p, hideTick: m, isEvaluateMode: h, choicesLayout: g, value: _, checked: v, tagName: y, isSelectionButtonBelow: S } = this.props, C = n === "checkbox" ? P : I, w = n === "checkbox" ? "checkbox" : "radio-button", j = {
204
- ...g === "horizontal" && { [`& .${T}`]: {
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
- ...S && g !== "grid" && { "& > label": { alignItems: "flex-start" } },
209
- ...S && g === "grid" && {
202
+ ...x && h !== "grid" && { "& > label": { alignItems: "flex-start" } },
203
+ ...x && h === "grid" && {
210
204
  justifyContent: "center",
211
205
  "& > label": { alignItems: "center" }
212
206
  }
213
- }, M = typeof s == "string" && (s.includes("<math") || s.includes("\\(") || s.includes("\\[") || s.includes("<img") || s.includes("data-latex") || s.includes("data-raw") || s.includes("<mjx-container")), N = i ? /* @__PURE__ */ d(k, {
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: M ? `Pick the answer below, ${i}` : i
216
- }) : null, F = /* @__PURE__ */ d(u, { children: i && !S ? /* @__PURE__ */ f(E, {
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__ */ f("span", {
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__ */ d(b, {
219
+ }), /* @__PURE__ */ u(y, {
226
220
  className: "prompt-label",
227
- prompt: s,
221
+ prompt: o,
228
222
  tagName: "span"
229
223
  })]
230
- }) : /* @__PURE__ */ d(b, {
224
+ }) : /* @__PURE__ */ u(y, {
231
225
  className: "prompt-label",
232
- prompt: s,
226
+ prompt: o,
233
227
  tagName: "span"
234
- }) }), L = {
228
+ }) }), I = {
235
229
  disabled: r,
236
- checked: v,
237
- correctness: c,
238
- tagName: y,
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
- ...N ? { "aria-describedby": this.descId } : {}
244
- }, R = (e) => S ? /* @__PURE__ */ f(O, { children: [
245
- N,
246
- /* @__PURE__ */ d(C, {
247
- ...L,
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__ */ d("span", {
244
+ /* @__PURE__ */ u("span", {
252
245
  "aria-hidden": "true",
253
246
  children: i ? `${i}.` : ""
254
247
  })
255
- ] }) : /* @__PURE__ */ f(u, { children: [N, /* @__PURE__ */ d(C, {
256
- ...L,
257
- ariaLabel: e
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__ */ f(E, { children: [!m && h && /* @__PURE__ */ d(t, { correctness: c }), /* @__PURE__ */ d(D, {
252
+ /* @__PURE__ */ d(T, { children: [!p && m && /* @__PURE__ */ u(t, { correctness: s }), /* @__PURE__ */ u(E, {
263
253
  className: "checkbox-holder",
264
- sx: j,
265
- children: /* @__PURE__ */ d(o, { children: (e, t) => /* @__PURE__ */ d(A, {
266
- label: /* @__PURE__ */ d("span", {
267
- ref: t,
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: S ? "top" : void 0,
274
- control: R(e)
275
- }) })
259
+ labelPlacement: x ? "top" : void 0,
260
+ control: L
261
+ })
276
262
  })] }),
277
- p && /* @__PURE__ */ d(b, {
263
+ f && /* @__PURE__ */ u(y, {
278
264
  className: "rationale",
279
265
  defaultClassName: "rationale",
280
- prompt: p
266
+ prompt: f
281
267
  }),
282
- /* @__PURE__ */ d(x, {
268
+ /* @__PURE__ */ u(b, {
283
269
  feedback: a,
284
- correctness: c
270
+ correctness: s
285
271
  })
286
272
  ]
287
273
  });
288
274
  }
289
275
  };
290
276
  //#endregion
291
- export { L as ChoiceInput, L as default, P as StyledCheckbox, A as StyledFormControlLabel, I as StyledRadio };
277
+ export { I as ChoiceInput, I as default, N as StyledCheckbox, k as StyledFormControlLabel, F as StyledRadio };