@pie-lib/mask-markup 4.0.3-next.20261007184841 → 4.0.3-next.20261007201108

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.
@@ -6,15 +6,15 @@ import { sanitizeModelHtml as a } from "@pie-element/shared-utils";
6
6
  import { jsx as o } from "react/jsx-runtime";
7
7
  import { useDraggable as s } from "@dnd-kit/core";
8
8
  import c from "@mui/material/Chip";
9
- import { color as l, useMathName as u } from "@pie-lib/render-ui";
9
+ import { color as l } from "@pie-lib/render-ui";
10
10
  //#region src/choices/choice.tsx
11
- var d = "MaskBlank", f = r("span")(({ theme: e, disabled: t }) => ({
11
+ var u = "MaskBlank", d = r("span")(({ theme: e, disabled: t }) => ({
12
12
  border: `solid 0px ${e.palette.primary.main}`,
13
13
  margin: e.spacing(.5),
14
14
  transform: "translate(0, 0)",
15
15
  display: "inline-flex",
16
16
  ...t && {}
17
- })), p = r(c)(({ selected: e }) => ({
17
+ })), f = r(c)(({ selected: e }) => ({
18
18
  backgroundColor: l.v("pie")("background", l.defaults.WHITE),
19
19
  border: e ? `solid 2px ${l.buttonFocusOutline()}` : `1px solid ${l.text()}`,
20
20
  opacity: e ? .7 : 1,
@@ -32,7 +32,7 @@ var d = "MaskBlank", f = r("span")(({ theme: e, disabled: t }) => ({
32
32
  paddingTop: "12px",
33
33
  paddingBottom: "12px",
34
34
  "&.Mui-disabled": { opacity: 1 }
35
- })), m = r("span")(() => ({
35
+ })), p = r("span")(() => ({
36
36
  whiteSpace: "normal",
37
37
  "& img": {
38
38
  display: "block",
@@ -41,50 +41,49 @@ var d = "MaskBlank", f = r("span")(({ theme: e, disabled: t }) => ({
41
41
  "& mjx-frac": { fontSize: "120% !important" },
42
42
  "& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn": { fontSize: "120% !important" }
43
43
  }));
44
- function h({ choice: n, disabled: r, instanceId: c, selectedItem: l, onSelectClick: h }) {
45
- let g = t(null), _ = u(g), { attributes: v, listeners: y, setNodeRef: b, isDragging: x } = s({
44
+ function m({ choice: n, disabled: r, instanceId: c, selectedItem: l, onSelectClick: m }) {
45
+ let h = t(null), { attributes: g, listeners: _, setNodeRef: v, isDragging: y } = s({
46
46
  id: `choice-${n.id}`,
47
47
  data: {
48
48
  choice: n,
49
49
  instanceId: c,
50
50
  fromChoice: !0,
51
- type: d
51
+ type: u
52
52
  },
53
53
  disabled: r
54
54
  });
55
55
  e(() => {
56
- i(g.current);
56
+ i(h.current);
57
57
  }, [n.value]);
58
- let S = !!l && l.fromChoice === !0 && l.choice.id === n.id;
59
- return /* @__PURE__ */ o(f, {
60
- ref: b,
61
- style: x ? {
62
- width: g.current?.offsetWidth || 90,
63
- height: g.current?.offsetHeight || 32
58
+ let b = !!l && l.fromChoice === !0 && l.choice.id === n.id;
59
+ return /* @__PURE__ */ o(d, {
60
+ ref: v,
61
+ style: y ? {
62
+ width: h.current?.offsetWidth || 90,
63
+ height: h.current?.offsetHeight || 32
64
64
  } : {},
65
65
  disabled: r,
66
- selected: S,
66
+ selected: b,
67
67
  onClick: (e) => {
68
- r || (e.stopPropagation(), h?.({
68
+ r || (e.stopPropagation(), m?.({
69
69
  choice: n,
70
70
  instanceId: c,
71
71
  fromChoice: !0,
72
- type: d
72
+ type: u
73
73
  }));
74
74
  },
75
- ...y,
76
- ...v,
77
- "aria-label": _,
78
- children: /* @__PURE__ */ o(p, {
75
+ ..._,
76
+ ...g,
77
+ children: /* @__PURE__ */ o(f, {
79
78
  clickable: !1,
80
79
  disabled: r,
81
- selected: S,
82
- ref: g,
83
- label: /* @__PURE__ */ o(m, { dangerouslySetInnerHTML: { __html: a(n.value) } })
80
+ selected: b,
81
+ ref: h,
82
+ label: /* @__PURE__ */ o(p, { dangerouslySetInnerHTML: { __html: a(n.value) } })
84
83
  })
85
84
  });
86
85
  }
87
- h.propTypes = {
86
+ m.propTypes = {
88
87
  choice: n.object.isRequired,
89
88
  disabled: n.bool,
90
89
  instanceId: n.oneOfType([n.string, n.number]),
@@ -92,4 +91,4 @@ h.propTypes = {
92
91
  onSelectClick: n.func
93
92
  };
94
93
  //#endregion
95
- export { d as DRAG_TYPE, h as default };
94
+ export { u as DRAG_TYPE, m as default };
@@ -8,13 +8,13 @@ import { sanitizeModelHtml as l } from "@pie-element/shared-utils";
8
8
  import { jsx as u, jsxs as d } from "react/jsx-runtime";
9
9
  import { useDraggable as f, useDroppable as p } from "@dnd-kit/core";
10
10
  import m from "@mui/material/Chip";
11
- import { color as h, useMathName as g } from "@pie-lib/render-ui";
12
- import _ from "@pie-lib/translator";
13
- import { grey as v } from "@mui/material/colors";
11
+ import { color as h } from "@pie-lib/render-ui";
12
+ import g from "@pie-lib/translator";
13
+ import { grey as _ } from "@mui/material/colors";
14
14
  //#region src/components/blank.tsx
15
- var { translator: y } = _;
15
+ var { translator: v } = g;
16
16
  c("pie-lib:mask-markup:blank");
17
- var b = o("span")(({ dragged: e, over: t, selected: n, showsPointerCursor: r }) => ({
17
+ var y = o("span")(({ dragged: e, over: t, selected: n, showsPointerCursor: r }) => ({
18
18
  border: `solid 0px ${h.primary()}`,
19
19
  display: "inline-flex",
20
20
  whiteSpace: "nowrap",
@@ -23,10 +23,10 @@ var b = o("span")(({ dragged: e, over: t, selected: n, showsPointerCursor: r })
23
23
  ...t && { whiteSpace: "nowrap" },
24
24
  ...(e || n) && { opacity: .5 },
25
25
  ...r && { "&:hover": { cursor: "pointer" } }
26
- })), x = o("span")({
26
+ })), b = o("span")({
27
27
  display: "inline-flex",
28
28
  touchAction: "none"
29
- }), S = o(m)(() => ({
29
+ }), x = o(m)(() => ({
30
30
  backgroundColor: h.background(),
31
31
  border: `2px dashed ${h.text()}`,
32
32
  touchAction: "none",
@@ -41,13 +41,13 @@ var b = o("span")(({ dragged: e, over: t, selected: n, showsPointerCursor: r })
41
41
  overflow: "hidden"
42
42
  },
43
43
  "&.parentOver": {
44
- border: `1px solid ${v[500]}`,
45
- backgroundColor: `${v[300]}`
44
+ border: `1px solid ${_[500]}`,
45
+ backgroundColor: `${_[300]}`
46
46
  },
47
47
  "&.correct": { border: `solid 1px ${h.correct()}` },
48
48
  "&.incorrect": { border: `solid 1px ${h.incorrect()}` },
49
49
  "&.Mui-disabled": { opacity: 1 }
50
- })), C = o("span")(() => ({
50
+ })), S = o("span")(() => ({
51
51
  whiteSpace: "normal",
52
52
  pointerEvents: "none",
53
53
  "& img": {
@@ -76,8 +76,8 @@ var b = o("span")(({ dragged: e, over: t, selected: n, showsPointerCursor: r })
76
76
  transform: "translateY(-50%)"
77
77
  }
78
78
  }));
79
- function w({ disabled: a, choice: o, isOver: c, isDragging: f, dragItem: p, correct: m, emptyResponseAreaWidth: h, emptyResponseAreaHeight: g }) {
80
- let _ = r(null), v = r(null), y = r(null), b = r(!1), [x, w] = i({
79
+ function C({ disabled: a, choice: o, isOver: c, isDragging: f, dragItem: p, correct: m, emptyResponseAreaWidth: h, emptyResponseAreaHeight: g }) {
80
+ let _ = r(null), v = r(null), y = r(null), b = r(!1), [C, w] = i({
81
81
  height: 0,
82
82
  width: 0
83
83
  }), T = () => {
@@ -106,8 +106,8 @@ function w({ disabled: a, choice: o, isOver: c, isDragging: f, dragItem: p, corr
106
106
  }, k = () => {
107
107
  let e = isNaN(parseFloat(h)) ? 0 : parseFloat(h), t = isNaN(parseFloat(g)) ? 0 : parseFloat(g);
108
108
  return {
109
- height: x.height || t,
110
- width: x.width || e,
109
+ height: C.height || t,
110
+ width: C.width || e,
111
111
  ...e ? {} : { minWidth: 90 },
112
112
  ...t ? {} : { minHeight: 32 }
113
113
  };
@@ -149,12 +149,12 @@ function w({ disabled: a, choice: o, isOver: c, isDragging: f, dragItem: p, corr
149
149
  width: y.current?.width,
150
150
  height: y.current?.height
151
151
  } : k();
152
- return /* @__PURE__ */ u(S, {
152
+ return /* @__PURE__ */ u(x, {
153
153
  clickable: !1,
154
154
  disabled: a,
155
155
  ref: _,
156
156
  component: "span",
157
- label: /* @__PURE__ */ d(t.Fragment, { children: [/* @__PURE__ */ u(C, {
157
+ label: /* @__PURE__ */ d(t.Fragment, { children: [/* @__PURE__ */ u(S, {
158
158
  ref: v,
159
159
  draggable: !0,
160
160
  className: e({
@@ -162,7 +162,7 @@ function w({ disabled: a, choice: o, isOver: c, isDragging: f, dragItem: p, corr
162
162
  hidden: A
163
163
  }),
164
164
  dangerouslySetInnerHTML: { __html: l(j) }
165
- }), A && /* @__PURE__ */ u(C, {
165
+ }), A && /* @__PURE__ */ u(S, {
166
166
  draggable: !0,
167
167
  className: e({
168
168
  over: c,
@@ -180,10 +180,10 @@ function w({ disabled: a, choice: o, isOver: c, isDragging: f, dragItem: p, corr
180
180
  style: M
181
181
  });
182
182
  }
183
- w.defaultProps = {
183
+ C.defaultProps = {
184
184
  emptyResponseAreaWidth: 0,
185
185
  emptyResponseAreaHeight: 0
186
- }, w.propTypes = {
186
+ }, C.propTypes = {
187
187
  id: a.oneOfType([a.string, a.number]),
188
188
  disabled: a.bool,
189
189
  duplicates: a.bool,
@@ -196,75 +196,70 @@ w.defaultProps = {
196
196
  emptyResponseAreaHeight: a.oneOfType([a.string, a.number]),
197
197
  instanceId: a.string
198
198
  };
199
- function T({ id: e, disabled: t, duplicates: n, choice: a, correct: o, onChange: s, emptyResponseAreaWidth: c, emptyResponseAreaHeight: l, instanceId: d, language: m, selectedItem: h, onSelectClick: _, onPlacementClick: v }) {
200
- let [S, C] = i(!1), T = r(null), E = g(T), D = {
199
+ function w({ id: e, disabled: t, duplicates: n, choice: r, correct: a, onChange: o, emptyResponseAreaWidth: s, emptyResponseAreaHeight: c, instanceId: l, language: d, selectedItem: m, onSelectClick: h, onPlacementClick: g }) {
200
+ let [_, x] = i(!1), S = {
201
201
  id: e,
202
- choice: a,
203
- instanceId: d,
202
+ choice: r,
203
+ instanceId: l,
204
204
  fromChoice: !1,
205
205
  type: "MaskBlank"
206
- }, { attributes: O, listeners: k, setNodeRef: A, isDragging: j } = f({
206
+ }, { attributes: w, listeners: T, setNodeRef: E, isDragging: D } = f({
207
207
  id: `mask-blank-drag-${e}`,
208
- disabled: t || !a,
209
- data: D,
210
- attributes: { tabIndex: a && !t ? 0 : -1 }
211
- }), { setNodeRef: M, isOver: N, active: P } = p({
208
+ disabled: t || !r,
209
+ data: S,
210
+ attributes: { tabIndex: r && !t ? 0 : -1 }
211
+ }), { setNodeRef: O, isOver: k, active: A } = p({
212
212
  id: `mask-blank-drop-${e}`,
213
213
  data: {
214
214
  id: e,
215
215
  accepts: ["MaskBlank"],
216
- instanceId: d
216
+ instanceId: l
217
217
  }
218
- }), F = !!h && h.fromChoice === !1 && h.id === e, I = () => {
219
- t || (F ? _?.(D) : h ? v?.(e) : a && _?.(D));
220
- }, L = !a && !t, R = !!a && !t, z = (e) => {
221
- (e.code === "Space" || e.code === "Enter") && (e.preventDefault(), I());
222
- }, B = !!h, V = P ? N : N || B && S && !t;
223
- return /* @__PURE__ */ u(b, {
224
- ref: M,
225
- role: L ? "button" : "group",
226
- "aria-label": y.t("dragInTheBlank.blank", {
227
- lng: m,
218
+ }), j = !!m && m.fromChoice === !1 && m.id === e, M = () => {
219
+ t || (j ? h?.(S) : m ? g?.(e) : r && h?.(S));
220
+ }, N = !r && !t, P = !!r && !t, F = (e) => {
221
+ (e.code === "Space" || e.code === "Enter") && (e.preventDefault(), M());
222
+ }, I = !!m, L = A ? k : k || I && _ && !t;
223
+ return /* @__PURE__ */ u(y, {
224
+ ref: O,
225
+ role: N ? "button" : "group",
226
+ "aria-label": v.t("dragInTheBlank.blank", {
227
+ lng: d,
228
228
  index: Number(e) + 1
229
229
  }),
230
- tabIndex: L ? 0 : -1,
231
- onClick: I,
232
- onKeyDown: L ? z : void 0,
233
- onMouseEnter: () => C(!0),
234
- onMouseLeave: () => C(!1),
235
- dragged: j,
236
- over: V,
237
- selected: F,
238
- showsPointerCursor: B && !t,
239
- children: /* @__PURE__ */ u(x, {
240
- ref: (e) => {
241
- T.current = e, A(e);
242
- },
243
- ...R ? {
244
- ...O,
245
- "aria-label": E
246
- } : {},
247
- ...k,
248
- children: /* @__PURE__ */ u(w, {
230
+ tabIndex: N ? 0 : -1,
231
+ onClick: M,
232
+ onKeyDown: N ? F : void 0,
233
+ onMouseEnter: () => x(!0),
234
+ onMouseLeave: () => x(!1),
235
+ dragged: D,
236
+ over: L,
237
+ selected: j,
238
+ showsPointerCursor: I && !t,
239
+ children: /* @__PURE__ */ u(b, {
240
+ ref: E,
241
+ ...P ? w : {},
242
+ ...T,
243
+ children: /* @__PURE__ */ u(C, {
249
244
  id: e,
250
245
  disabled: t,
251
246
  duplicates: n,
252
- choice: a,
253
- isOver: V,
254
- dragItem: P?.data?.current,
255
- correct: o,
256
- onChange: s,
257
- emptyResponseAreaWidth: c,
258
- emptyResponseAreaHeight: l,
259
- instanceId: d
247
+ choice: r,
248
+ isOver: L,
249
+ dragItem: A?.data?.current,
250
+ correct: a,
251
+ onChange: o,
252
+ emptyResponseAreaWidth: s,
253
+ emptyResponseAreaHeight: c,
254
+ instanceId: l
260
255
  })
261
256
  })
262
257
  });
263
258
  }
264
- T.defaultProps = {
259
+ w.defaultProps = {
265
260
  emptyResponseAreaWidth: 0,
266
261
  emptyResponseAreaHeight: 0
267
- }, T.propTypes = {
262
+ }, w.propTypes = {
268
263
  id: a.oneOfType([a.string, a.number]),
269
264
  disabled: a.bool,
270
265
  duplicates: a.bool,
@@ -280,4 +275,4 @@ T.defaultProps = {
280
275
  onPlacementClick: a.func
281
276
  };
282
277
  //#endregion
283
- export { T as default };
278
+ export { w as default };
@@ -1,32 +1,32 @@
1
- import e, { useRef as t } from "react";
2
- import n from "prop-types";
3
- import { styled as r } from "@mui/material/styles";
4
- import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
5
- import { sanitizeModelHtml as a } from "@pie-element/shared-utils";
6
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
- import * as l from "@pie-lib/render-ui";
8
- import { InlineMenu as u, MathName as d, color as f, createUniqueId as p, useMathName as m } from "@pie-lib/render-ui";
9
- import h from "@pie-lib/translator";
10
- import g from "@mui/material/Button";
11
- import _ from "@mui/material/InputLabel";
12
- import v from "@mui/material/MenuItem";
13
- import y from "@mui/icons-material/ArrowDropDown";
14
- import b from "@mui/icons-material/ArrowDropUp";
15
- import x from "@mui/icons-material/Close";
16
- import S from "@mui/icons-material/Check";
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 { sanitizeModelHtml as i } from "@pie-element/shared-utils";
6
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
7
+ import * as c from "@pie-lib/render-ui";
8
+ import { InlineMenu as l, color as u, createUniqueId as d } from "@pie-lib/render-ui";
9
+ import f from "@pie-lib/translator";
10
+ import p from "@mui/material/Button";
11
+ import m from "@mui/material/InputLabel";
12
+ import h from "@mui/material/MenuItem";
13
+ import g from "@mui/icons-material/ArrowDropDown";
14
+ import _ from "@mui/icons-material/ArrowDropUp";
15
+ import v from "@mui/icons-material/Close";
16
+ import y from "@mui/icons-material/Check";
17
17
  //#region src/components/dropdown.tsx
18
- function C(e) {
18
+ function b(e) {
19
19
  return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
20
20
  }
21
- function w(e, t) {
22
- return !e || C(e) ? e : C(e.default) ? e.default : t && C(e[t]) ? e[t] : t && C(e[t]?.default) ? e[t].default : e;
21
+ function x(e, t) {
22
+ return !e || b(e) ? e : b(e.default) ? e.default : t && b(e[t]) ? e[t] : t && b(e[t]?.default) ? e[t].default : e;
23
23
  }
24
- var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.default, O = D && typeof D == "object" ? D : E, { translator: k } = h, A = f.v("pie"), j = r(g)(() => ({
25
- color: f.text(),
26
- border: `1px solid ${f.borderGray()}`,
24
+ var S = x(l, "InlineMenu") || x(T.InlineMenu, "InlineMenu"), C = c, w = C.default, T = w && typeof w == "object" ? w : C, { translator: E } = f, D = u.v("pie"), O = n(p)(() => ({
25
+ color: u.text(),
26
+ border: `1px solid ${u.borderGray()}`,
27
27
  borderRadius: "4px",
28
28
  justifyContent: "space-between",
29
- backgroundColor: f.background(),
29
+ backgroundColor: u.background(),
30
30
  position: "relative",
31
31
  height: "45px",
32
32
  width: "fit-content",
@@ -38,29 +38,29 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
38
38
  right: "4px",
39
39
  top: "calc(50% - 12px)",
40
40
  pointerEvents: "none",
41
- color: f.text(),
41
+ color: u.text(),
42
42
  marginLeft: "5px"
43
43
  },
44
44
  "&.Mui-focusVisible": {
45
- outline: `3px solid ${f.tertiary()}`,
45
+ outline: `3px solid ${u.tertiary()}`,
46
46
  outlineOffset: "2px",
47
47
  borderWidth: "3px"
48
48
  },
49
- "&.Mui-disabled": { color: f.disabledText() },
49
+ "&.Mui-disabled": { color: u.disabledText() },
50
50
  "&.disabledCorrect": {
51
51
  borderWidth: "2px",
52
- borderColor: f.correct(),
53
- color: `${f.text()} !important`
52
+ borderColor: u.correct(),
53
+ color: `${u.text()} !important`
54
54
  },
55
55
  "&.disabledIncorrect": {
56
56
  borderWidth: "2px",
57
- borderColor: f.incorrectWithIcon(),
58
- color: `${f.text()} !important`
57
+ borderColor: u.incorrectWithIcon(),
58
+ color: `${u.text()} !important`
59
59
  }
60
- })), M = r(T)(() => ({
61
- "& .MuiPaper-root": { backgroundColor: A("background", f.defaults.WHITE) },
60
+ })), k = n(S)(() => ({
61
+ "& .MuiPaper-root": { backgroundColor: D("background", u.defaults.WHITE) },
62
62
  "& .MuiList-root": { padding: 0 }
63
- })), N = r(v)(() => ({
63
+ })), A = n(h)(() => ({
64
64
  height: 24,
65
65
  overflow: "hidden",
66
66
  fontSize: "1rem",
@@ -68,42 +68,42 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
68
68
  fontFamily: "inherit",
69
69
  lineHeight: "1.5em",
70
70
  whiteSpace: "nowrap",
71
- color: f.text(),
72
- backgroundColor: f.background(),
71
+ color: u.text(),
72
+ backgroundColor: u.background(),
73
73
  "&.Mui-focusVisible": {
74
- outline: `3px solid ${f.tertiary()}`,
74
+ outline: `3px solid ${u.tertiary()}`,
75
75
  outlineOffset: "-1px",
76
- color: f.text(),
77
- backgroundColor: f.background()
76
+ color: u.text(),
77
+ backgroundColor: u.background()
78
78
  },
79
79
  "&:hover": {
80
- color: f.text(),
81
- backgroundColor: f.dropdownBackground()
80
+ color: u.text(),
81
+ backgroundColor: u.dropdownBackground()
82
82
  },
83
83
  boxSizing: "border-box",
84
84
  padding: "16px 8px",
85
85
  borderRadius: "4px",
86
86
  "&.selected": {
87
- color: `${f.text()} !important`,
88
- backgroundColor: `${f.background()} !important`,
87
+ color: `${u.text()} !important`,
88
+ backgroundColor: `${u.background()} !important`,
89
89
  "&:hover": {
90
- color: f.text(),
91
- backgroundColor: `${f.dropdownBackground()} !important`
90
+ color: u.text(),
91
+ backgroundColor: `${u.dropdownBackground()} !important`
92
92
  }
93
93
  }
94
- })), P = r("span")(() => ({ fontSize: "max(1rem, 14px)" })), F = r("span")(() => ({
94
+ })), j = n("span")(() => ({ fontSize: "max(1rem, 14px)" })), M = n("span")(() => ({
95
95
  fontSize: "max(1rem, 14px)",
96
96
  flexShrink: 0,
97
97
  paddingLeft: "8px"
98
- })), I = r(_)(() => ({
98
+ })), N = n(m)(() => ({
99
99
  position: "absolute",
100
100
  left: "-10000px",
101
101
  top: "auto",
102
102
  width: "1px",
103
103
  height: "1px",
104
104
  overflow: "hidden"
105
- })), L = r(S)(() => ({
106
- color: `${f.white()} !important`,
105
+ })), P = n(y)(() => ({
106
+ color: `${u.white()} !important`,
107
107
  position: "absolute",
108
108
  top: "-8px !important",
109
109
  left: "-8px",
@@ -111,10 +111,10 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
111
111
  borderRadius: "50%",
112
112
  fontSize: "16px",
113
113
  padding: "2px",
114
- "&.correct": { backgroundColor: f.correct() },
115
- "&.incorrect": { backgroundColor: f.incorrectWithIcon() }
116
- })), R = r(x)(() => ({
117
- color: `${f.white()} !important`,
114
+ "&.correct": { backgroundColor: u.correct() },
115
+ "&.incorrect": { backgroundColor: u.incorrectWithIcon() }
116
+ })), F = n(v)(() => ({
117
+ color: `${u.white()} !important`,
118
118
  position: "absolute",
119
119
  top: "-8px !important",
120
120
  left: "-8px",
@@ -122,36 +122,23 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
122
122
  borderRadius: "50%",
123
123
  fontSize: "16px",
124
124
  padding: "2px",
125
- "&.correct": { backgroundColor: f.correct() },
126
- "&.incorrect": { backgroundColor: f.incorrectWithIcon() }
127
- })), z = ({ label: e, selected: n, labelRef: r, ...i }) => {
128
- let o = t(null), l = m(o);
129
- return /* @__PURE__ */ c(N, {
130
- ...i,
131
- selected: n,
132
- "aria-label": l,
133
- children: [/* @__PURE__ */ s(P, {
134
- ref: (e) => {
135
- o.current = e, r(e);
136
- },
137
- dangerouslySetInnerHTML: { __html: a(e) }
138
- }), /* @__PURE__ */ s(F, { dangerouslySetInnerHTML: { __html: n ? " ✓" : "" } })]
139
- });
140
- }, B = class extends e.Component {
125
+ "&.correct": { backgroundColor: u.correct() },
126
+ "&.incorrect": { backgroundColor: u.incorrectWithIcon() }
127
+ })), I = class extends e.Component {
141
128
  static propTypes = {
142
- id: n.string,
143
- value: n.string,
144
- disabled: n.bool,
145
- onChange: n.func,
146
- correct: n.bool,
147
- choices: n.arrayOf(n.shape({
148
- value: n.string,
149
- label: n.string
129
+ id: t.string,
130
+ value: t.string,
131
+ disabled: t.bool,
132
+ onChange: t.func,
133
+ correct: t.bool,
134
+ choices: t.arrayOf(t.shape({
135
+ value: t.string,
136
+ label: t.string
150
137
  })),
151
- showCorrectAnswer: n.bool,
152
- singleQuery: n.bool,
153
- correctValue: n.string,
154
- language: n.string
138
+ showCorrectAnswer: t.bool,
139
+ singleQuery: t.bool,
140
+ correctValue: t.string,
141
+ language: t.string
155
142
  };
156
143
  constructor(t) {
157
144
  super(t), this.state = {
@@ -159,7 +146,7 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
159
146
  highlightedOptionId: null,
160
147
  menuWidth: null,
161
148
  previewValue: null
162
- }, this.hiddenRef = e.createRef(), this.buttonRef = e.createRef(), this.previewRef = e.createRef(), this.elementRefs = [], this.idPrefix = p(`dropdown-${t.id}`);
149
+ }, this.hiddenRef = e.createRef(), this.buttonRef = e.createRef(), this.previewRef = e.createRef(), this.elementRefs = [], this.idPrefix = d(`dropdown-${t.id}`);
163
150
  }
164
151
  optionId = (e) => `${this.idPrefix}-option-${e}`;
165
152
  componentDidMount() {
@@ -169,13 +156,13 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
169
156
  let n = this.hiddenRef.current;
170
157
  if (!t.anchorEl && this.state.anchorEl && this.elementRefs.forEach((e) => {
171
158
  if (!e) return;
172
- let t = e.querySelector("[data-latex], [data-raw]"), n = e.querySelector("mjx-container"), r = e.querySelector("[data-math-handled=\"true\"]");
173
- t && (!r || !n) && i(e);
159
+ let t = e.querySelector("[data-latex], [data-raw]"), n = e.querySelector("mjx-container"), i = e.querySelector("[data-math-handled=\"true\"]");
160
+ t && (!i || !n) && r(e);
174
161
  }), n) {
175
162
  let e = n.clientWidth;
176
163
  e !== this.state.menuWidth && (this.elementRefs.forEach((e) => {
177
- e && i(e);
178
- }), i(n), this.setState({ menuWidth: e }));
164
+ e && r(e);
165
+ }), r(n), this.setState({ menuWidth: e }));
179
166
  }
180
167
  }
181
168
  handleClick = (e) => {
@@ -220,14 +207,14 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
220
207
  return n ? n.label.trim() : void 0;
221
208
  }
222
209
  render() {
223
- let { id: e, correct: t, disabled: n, value: r, choices: i, showCorrectAnswer: l, singleQuery: u, correctValue: f, language: p } = this.props, { anchorEl: m } = this.state, h = !!m, g = `${this.idPrefix}-button`, _ = `${this.idPrefix}-menu`, v = `${this.idPrefix}-listbox`, x = `${this.idPrefix}-value`, S = `${this.idPrefix}-value-name`, C;
224
- this.elementRefs = [], n && t !== void 0 && (C = t || l ? "disabledCorrect" : "disabledIncorrect");
225
- let w = parseInt(e, 10) + 1, T = `${this.idPrefix}-query-label`, E = u ? k.t("inlineDropdown.query", { lng: p }) : k.t("inlineDropdown.queryNumber", {
226
- lng: p,
227
- index: w
228
- }), D = null;
229
- return n && t !== void 0 && (D = t || l ? /* @__PURE__ */ s(L, { className: "correct" }) : /* @__PURE__ */ s(R, { className: "incorrect" })), /* @__PURE__ */ c(o, { children: [
230
- /* @__PURE__ */ s("div", {
210
+ let { id: e, correct: t, disabled: n, value: r, choices: c, showCorrectAnswer: l, singleQuery: u, correctValue: d, language: f } = this.props, { anchorEl: p } = this.state, m = !!p, h = `${this.idPrefix}-button`, v = `${this.idPrefix}-menu`, y = `${this.idPrefix}-listbox`, b = `${this.idPrefix}-value`, x;
211
+ this.elementRefs = [], n && t !== void 0 && (x = t || l ? "disabledCorrect" : "disabledIncorrect");
212
+ let S = parseInt(e, 10) + 1, C = `${this.idPrefix}-query-label`, w = u ? E.t("inlineDropdown.query", { lng: f }) : E.t("inlineDropdown.queryNumber", {
213
+ lng: f,
214
+ index: S
215
+ }), T = null;
216
+ return n && t !== void 0 && (T = t || l ? /* @__PURE__ */ o(P, { className: "correct" }) : /* @__PURE__ */ o(F, { className: "incorrect" })), /* @__PURE__ */ s(a, { children: [
217
+ /* @__PURE__ */ o("div", {
231
218
  ref: this.hiddenRef,
232
219
  style: {
233
220
  position: "absolute",
@@ -237,56 +224,50 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
237
224
  },
238
225
  tabIndex: -1,
239
226
  "aria-hidden": "true",
240
- children: (i || []).map((e, t) => /* @__PURE__ */ s(N, {
227
+ children: (c || []).map((e, t) => /* @__PURE__ */ o(A, {
241
228
  tabIndex: -1,
242
229
  "aria-hidden": "true",
243
- children: /* @__PURE__ */ s(P, { dangerouslySetInnerHTML: { __html: a(e.label) } })
230
+ children: /* @__PURE__ */ o(j, { dangerouslySetInnerHTML: { __html: i(e.label) } })
244
231
  }, t))
245
232
  }),
246
- /* @__PURE__ */ s(I, {
247
- id: T,
233
+ /* @__PURE__ */ o(N, {
234
+ id: C,
248
235
  tabIndex: -1,
249
236
  "aria-hidden": "true",
250
- children: E
237
+ children: w
251
238
  }),
252
- /* @__PURE__ */ s(d, { children: (e, t) => /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ c(j, {
239
+ /* @__PURE__ */ s(O, {
253
240
  ref: this.buttonRef,
254
241
  style: {
255
242
  ...this.state.menuWidth && { minWidth: `calc(${this.state.menuWidth}px + 8px)` },
256
- borderWidth: h ? "2px" : "1px",
243
+ borderWidth: m ? "2px" : "1px",
257
244
  transition: "border-width 0.2s ease-in-out"
258
245
  },
259
- "aria-controls": h ? v : void 0,
246
+ "aria-controls": m ? y : void 0,
260
247
  "aria-haspopup": "listbox",
261
- "aria-expanded": h ? "true" : "false",
248
+ "aria-expanded": m ? "true" : "false",
262
249
  "aria-activedescendant": this.state.highlightedOptionId,
263
250
  onClick: this.handleClick,
264
- className: C,
251
+ className: x,
265
252
  disabled: n,
266
- id: g,
253
+ id: h,
267
254
  role: "combobox",
268
- "aria-labelledby": `${T} ${e ? S : x}`,
255
+ "aria-labelledby": `${C} ${b}`,
269
256
  children: [
270
- D,
271
- /* @__PURE__ */ s(P, {
272
- id: x,
273
- ref: (e) => {
274
- this.previewRef.current = e, t.current = e;
275
- },
276
- dangerouslySetInnerHTML: { __html: a(f || (h && this.state.previewValue ? this.getLabel(i, this.state.previewValue) : this.getLabel(i, r) || "")) }
257
+ T,
258
+ /* @__PURE__ */ o(j, {
259
+ id: b,
260
+ ref: this.previewRef,
261
+ dangerouslySetInnerHTML: { __html: i(d || (m && this.state.previewValue ? this.getLabel(c, this.state.previewValue) : this.getLabel(c, r) || "")) }
277
262
  }),
278
- s(h ? b : y, {})
263
+ o(m ? _ : g, {})
279
264
  ]
280
- }), e ? /* @__PURE__ */ s("span", {
281
- id: S,
282
- hidden: !0,
283
- children: e
284
- }) : null] }) }),
285
- /* @__PURE__ */ s(M, {
286
- id: _,
287
- anchorEl: m,
265
+ }),
266
+ /* @__PURE__ */ o(k, {
267
+ id: v,
268
+ anchorEl: p,
288
269
  keepMounted: !0,
289
- open: h,
270
+ open: m,
290
271
  onClose: this.handleClose,
291
272
  getContentAnchorEl: null,
292
273
  anchorOrigin: {
@@ -307,15 +288,15 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
307
288
  padding: "4px"
308
289
  } } : void 0,
309
290
  list: {
310
- id: v,
311
- "aria-labelledby": T,
291
+ id: y,
292
+ "aria-labelledby": C,
312
293
  role: "listbox",
313
294
  disablePadding: !0
314
295
  }
315
296
  },
316
- children: (i || []).map((e, t) => {
297
+ children: (c || []).map((e, t) => {
317
298
  let n = this.optionId(t);
318
- return /* @__PURE__ */ s(z, {
299
+ return /* @__PURE__ */ s(A, {
319
300
  id: n,
320
301
  className: e.value === r ? "selected" : "",
321
302
  selected: e.value === r,
@@ -324,8 +305,10 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
324
305
  role: "option",
325
306
  "aria-selected": this.state.highlightedOptionId === n ? "true" : void 0,
326
307
  onMouseOver: () => this.handleHover(t),
327
- label: e.label,
328
- labelRef: (e) => this.elementRefs[t] = e
308
+ children: [/* @__PURE__ */ o(j, {
309
+ ref: (e) => this.elementRefs[t] = e,
310
+ dangerouslySetInnerHTML: { __html: i(e.label) }
311
+ }), /* @__PURE__ */ o(M, { dangerouslySetInnerHTML: { __html: e.value === r ? " ✓" : "" } })]
329
312
  }, `${e.label}-${t}`);
330
313
  })
331
314
  })
@@ -333,4 +316,4 @@ var T = w(u, "InlineMenu") || w(O.InlineMenu, "InlineMenu"), E = l, D = E.defaul
333
316
  }
334
317
  };
335
318
  //#endregion
336
- export { B as default };
319
+ export { I as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/mask-markup",
3
- "version": "4.0.3-next.20261007184841",
3
+ "version": "4.0.3-next.20261007201108",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,15 +13,15 @@
13
13
  "@mui/icons-material": "^7.3.4",
14
14
  "@mui/material": "^7.3.4",
15
15
  "@pie-element/shared-utils": "0.1.3-next.20261007184841",
16
- "@pie-lib/drag": "5.0.3-next.20261007184841",
17
- "@pie-lib/editable-html-tip-tap": "3.0.3-next.20261007184841",
18
- "@pie-lib/render-ui": "8.0.3-next.20261007184841",
16
+ "@pie-lib/drag": "5.0.3-next.20261007201108",
17
+ "@pie-lib/editable-html-tip-tap": "3.0.3-next.20261007201108",
18
+ "@pie-lib/render-ui": "8.0.3-next.20261007201108",
19
19
  "@pie-lib/translator": "5.0.2-next.20261006160832",
20
20
  "debug": "^4.1.1",
21
21
  "prop-types": "^15.7.2",
22
22
  "to-style": "^1.3.3",
23
23
  "@dnd-kit/core": "^6.3.1",
24
- "@pie-element/shared-math-rendering-mathjax": "0.1.4-next.20261007175429",
24
+ "@pie-element/shared-math-rendering-mathjax": "0.1.4-next.20261007201108",
25
25
  "@pie-element/shared-lodash": "0.1.3-next.20261006160832",
26
26
  "clsx": "^2.1.1"
27
27
  },
@@ -1 +0,0 @@
1
- export {};