@pie-lib/mask-markup 4.0.3-next.20261007064237 → 4.0.3-next.20261007175429

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