@pie-element/match-list 8.0.2-next.20261007003844 → 8.0.2
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/delivery/index.js +3759 -2836
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/delivery/answer-area.js +25 -24
- package/dist/delivery/answer.js +25 -24
- package/dist/index.iife.js +52 -50
- package/package.json +10 -9
|
@@ -6,14 +6,15 @@ import { color as i } from "@pie-lib/render-ui";
|
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
7
|
import { styled as s } from "@mui/material/styles";
|
|
8
8
|
import { isEmpty as c, isUndefined as l, reduce as u } from "@pie-element/shared-lodash";
|
|
9
|
+
import { sanitizeModelHtml as d } from "@pie-element/shared-utils";
|
|
9
10
|
//#region src/delivery/answer-area.tsx
|
|
10
|
-
var
|
|
11
|
+
var f = 200, p = s("div")({
|
|
11
12
|
alignItems: "normal",
|
|
12
13
|
display: "flex",
|
|
13
14
|
flexShrink: 0,
|
|
14
15
|
height: 40,
|
|
15
16
|
margin: "10px 20px"
|
|
16
|
-
}),
|
|
17
|
+
}), m = s("div")(({ theme: e }) => ({
|
|
17
18
|
alignItems: "flex-start",
|
|
18
19
|
display: "flex",
|
|
19
20
|
flex: 1,
|
|
@@ -21,24 +22,24 @@ var d = 200, f = s("div")({
|
|
|
21
22
|
justifyContent: "space-between",
|
|
22
23
|
marginTop: e.spacing(2),
|
|
23
24
|
marginBottom: e.spacing(2)
|
|
24
|
-
})),
|
|
25
|
+
})), h = s("div")(() => ({
|
|
25
26
|
border: `1px solid ${i.border()}`,
|
|
26
27
|
boxSizing: "border-box",
|
|
27
28
|
flex: 1,
|
|
28
29
|
margin: "10px 0",
|
|
29
30
|
minHeight: 40,
|
|
30
|
-
minWidth:
|
|
31
|
+
minWidth: f,
|
|
31
32
|
overflow: "hidden",
|
|
32
33
|
padding: 10,
|
|
33
34
|
textAlign: "center",
|
|
34
35
|
width: "100%",
|
|
35
36
|
wordBreak: "break-word"
|
|
36
|
-
})),
|
|
37
|
+
})), g = s("div")({
|
|
37
38
|
alignItems: "center",
|
|
38
39
|
display: "flex",
|
|
39
40
|
justifyContent: "space-between",
|
|
40
41
|
width: "100%"
|
|
41
|
-
}),
|
|
42
|
+
}), _ = class extends n.Component {
|
|
42
43
|
static propTypes = {
|
|
43
44
|
session: r.object.isRequired,
|
|
44
45
|
showCorrect: r.bool.isRequired,
|
|
@@ -74,35 +75,35 @@ var d = 200, f = s("div")({
|
|
|
74
75
|
});
|
|
75
76
|
};
|
|
76
77
|
render() {
|
|
77
|
-
let { disabled: n, instanceId: r, onRemoveAnswer: i, selectedAnswer: s, onChoiceClick: l, onPlacementClick: u } = this.props,
|
|
78
|
-
return /* @__PURE__ */ a(
|
|
79
|
-
let
|
|
80
|
-
return /* @__PURE__ */ o(
|
|
81
|
-
/* @__PURE__ */ a(
|
|
82
|
-
id:
|
|
83
|
-
dangerouslySetInnerHTML: { __html:
|
|
78
|
+
let { disabled: n, instanceId: r, onRemoveAnswer: i, selectedAnswer: s, onChoiceClick: l, onPlacementClick: u } = this.props, f = this.buildRows(), _ = this.getCorrectOrIncorrectMap();
|
|
79
|
+
return /* @__PURE__ */ a(m, { children: f.map(({ sessionAnswer: f, title: m, id: v }, y) => {
|
|
80
|
+
let b = `${r}-prompt-label-${v}`;
|
|
81
|
+
return /* @__PURE__ */ o(g, { children: [
|
|
82
|
+
/* @__PURE__ */ a(h, {
|
|
83
|
+
id: b,
|
|
84
|
+
dangerouslySetInnerHTML: { __html: d(m) }
|
|
84
85
|
}),
|
|
85
|
-
/* @__PURE__ */ o(
|
|
86
|
+
/* @__PURE__ */ o(p, { children: [/* @__PURE__ */ a(e, { direction: "left" }), /* @__PURE__ */ a(e, {})] }),
|
|
86
87
|
/* @__PURE__ */ a(t, {
|
|
87
88
|
className: "answer",
|
|
88
|
-
index:
|
|
89
|
-
promptId:
|
|
90
|
-
labelId:
|
|
91
|
-
correct:
|
|
92
|
-
draggable: !c(
|
|
89
|
+
index: y,
|
|
90
|
+
promptId: v,
|
|
91
|
+
labelId: b,
|
|
92
|
+
correct: _[v],
|
|
93
|
+
draggable: !c(f),
|
|
93
94
|
disabled: n,
|
|
94
95
|
instanceId: r,
|
|
95
|
-
id:
|
|
96
|
-
title:
|
|
96
|
+
id: f.id,
|
|
97
|
+
title: f.title,
|
|
97
98
|
type: "target",
|
|
98
|
-
onRemoveChoice: () => i(
|
|
99
|
+
onRemoveChoice: () => i(v),
|
|
99
100
|
selectedAnswer: s,
|
|
100
101
|
onSelectClick: l,
|
|
101
102
|
onPlacementClick: u
|
|
102
103
|
})
|
|
103
|
-
] },
|
|
104
|
+
] }, v);
|
|
104
105
|
}) });
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
//#endregion
|
|
108
|
-
export {
|
|
109
|
+
export { _ as AnswerArea, _ as default };
|
package/dist/delivery/answer.js
CHANGED
|
@@ -7,13 +7,14 @@ import { color as s } from "@pie-lib/render-ui";
|
|
|
7
7
|
import { jsx as c } from "react/jsx-runtime";
|
|
8
8
|
import { styled as l } from "@mui/material/styles";
|
|
9
9
|
import { isEmpty as u } from "@pie-element/shared-lodash";
|
|
10
|
+
import { sanitizeModelHtml as d } from "@pie-element/shared-utils";
|
|
10
11
|
//#region src/delivery/answer.tsx
|
|
11
|
-
var
|
|
12
|
+
var f = n("pie-elements:match-title:answer"), p = s.v("pie"), m = l("div")(() => ({
|
|
12
13
|
width: "100%",
|
|
13
14
|
fontSize: "18px",
|
|
14
15
|
textAlign: "center",
|
|
15
16
|
color: "inherit"
|
|
16
|
-
})),
|
|
17
|
+
})), h = ({ index: e, isOver: t, disabled: n, type: r }) => /* @__PURE__ */ c(i, {
|
|
17
18
|
extraStyles: {
|
|
18
19
|
display: "flex",
|
|
19
20
|
padding: "0",
|
|
@@ -24,17 +25,17 @@ var d = n("pie-elements:match-title:answer"), f = s.v("pie"), p = l("div")(() =>
|
|
|
24
25
|
disabled: n,
|
|
25
26
|
isOver: t,
|
|
26
27
|
type: r,
|
|
27
|
-
children: e !== void 0 && /* @__PURE__ */ c(
|
|
28
|
+
children: e !== void 0 && /* @__PURE__ */ c(m, { children: e })
|
|
28
29
|
});
|
|
29
|
-
|
|
30
|
+
h.propTypes = {
|
|
30
31
|
index: r.number,
|
|
31
32
|
isOver: r.bool,
|
|
32
33
|
disabled: r.bool,
|
|
33
34
|
type: r.string
|
|
34
35
|
};
|
|
35
|
-
var
|
|
36
|
+
var g = l("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcome: i }) => ({
|
|
36
37
|
color: s.text(),
|
|
37
|
-
backgroundColor:
|
|
38
|
+
backgroundColor: p("background", s.defaults.WHITE),
|
|
38
39
|
border: `1px solid ${i === "correct" ? s.correct() : i === "incorrect" ? s.incorrect() : s.border()}`,
|
|
39
40
|
cursor: r ? "not-allowed" : "pointer",
|
|
40
41
|
width: "100%",
|
|
@@ -45,22 +46,22 @@ var h = l("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
45
46
|
wordBreak: "break-word",
|
|
46
47
|
opacity: (e || t) && !r ? .5 : n && !r ? .2 : 1,
|
|
47
48
|
touchAction: "none"
|
|
48
|
-
})),
|
|
49
|
+
})), _ = (e) => {
|
|
49
50
|
let { isDragging: t, isSelected: n, isOver: r, title: i, disabled: a, empty: o, outcome: s, guideIndex: l, type: u } = e;
|
|
50
|
-
return o ? /* @__PURE__ */ c(
|
|
51
|
+
return o ? /* @__PURE__ */ c(h, {
|
|
51
52
|
index: l,
|
|
52
53
|
isOver: r,
|
|
53
54
|
disabled: a,
|
|
54
55
|
type: u
|
|
55
|
-
}) : /* @__PURE__ */ c(
|
|
56
|
+
}) : /* @__PURE__ */ c(g, {
|
|
56
57
|
isDragging: t,
|
|
57
58
|
isSelected: n,
|
|
58
59
|
isOver: r,
|
|
59
60
|
disabled: a,
|
|
60
61
|
outcome: s,
|
|
61
|
-
dangerouslySetInnerHTML: { __html: i }
|
|
62
|
+
dangerouslySetInnerHTML: { __html: d(i) }
|
|
62
63
|
});
|
|
63
|
-
},
|
|
64
|
+
}, v = l("div")(({ correct: e, isSelected: t, isDragging: n, theme: r }) => ({
|
|
64
65
|
boxSizing: "border-box",
|
|
65
66
|
minHeight: 40,
|
|
66
67
|
minWidth: "200px",
|
|
@@ -70,7 +71,7 @@ var h = l("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
70
71
|
textAlign: "center",
|
|
71
72
|
height: "initial",
|
|
72
73
|
border: e === !0 ? `1px solid ${s.correct()}` : e === !1 ? `1px solid ${s.incorrect()}` : t && !n ? `2px solid ${s.buttonFocusOutline()}` : "none"
|
|
73
|
-
})),
|
|
74
|
+
})), y = class extends e.Component {
|
|
74
75
|
static propTypes = {
|
|
75
76
|
className: r.string,
|
|
76
77
|
isDragging: r.bool,
|
|
@@ -92,13 +93,13 @@ var h = l("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
92
93
|
handleTouchStart = (e) => {};
|
|
93
94
|
render() {
|
|
94
95
|
let { id: e, title: t, isDragging: n = !1, isSelected: r = !1, className: i, disabled: a, isOver: o = !1, type: s, correct: l } = this.props;
|
|
95
|
-
return
|
|
96
|
+
return f("[render], props: ", this.props), /* @__PURE__ */ c(v, {
|
|
96
97
|
correct: l,
|
|
97
98
|
isSelected: r,
|
|
98
99
|
isDragging: n,
|
|
99
100
|
className: i,
|
|
100
101
|
ref: (e) => this.ref = e,
|
|
101
|
-
children: /* @__PURE__ */ c(
|
|
102
|
+
children: /* @__PURE__ */ c(_, {
|
|
102
103
|
title: t,
|
|
103
104
|
id: e,
|
|
104
105
|
isOver: o,
|
|
@@ -110,9 +111,9 @@ var h = l("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
110
111
|
})
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
|
-
},
|
|
114
|
-
function
|
|
115
|
-
let { id: n, instanceId: r, promptId: i, labelId: s, draggable: l = !0, disabled: u = !1, type: d, selectedAnswer: f, onSelectClick: p, onPlacementClick: m } = e, h =
|
|
114
|
+
}, b = ({ type: e, id: t, promptId: n }) => n == null ? `${e || "answer"}-${t}` : `${e || "answer"}-prompt-${n}`;
|
|
115
|
+
function x(e) {
|
|
116
|
+
let { id: n, instanceId: r, promptId: i, labelId: s, draggable: l = !0, disabled: u = !1, type: d, selectedAnswer: f, onSelectClick: p, onPlacementClick: m } = e, h = b({
|
|
116
117
|
type: d,
|
|
117
118
|
id: n,
|
|
118
119
|
promptId: i
|
|
@@ -122,7 +123,7 @@ function b(e) {
|
|
|
122
123
|
instanceId: r,
|
|
123
124
|
value: e.title,
|
|
124
125
|
promptId: i
|
|
125
|
-
},
|
|
126
|
+
}, v = g ? {
|
|
126
127
|
type: "drop-zone",
|
|
127
128
|
promptId: i,
|
|
128
129
|
instanceId: r
|
|
@@ -133,12 +134,12 @@ function b(e) {
|
|
|
133
134
|
attributes: { tabIndex: l && !u ? 0 : -1 }
|
|
134
135
|
}), D = o({
|
|
135
136
|
id: g,
|
|
136
|
-
data:
|
|
137
|
+
data: v,
|
|
137
138
|
disabled: u || !g
|
|
138
139
|
}), O = D.setNodeRef, k = D.isOver, [A, j] = t(!1), M = !!f, N = k || M && A && !u, P = !!f && f.type === _.type && f.id === _.id && f.promptId === _.promptId, F = w ? `translate3d(${w.x}px, ${w.y}px, 0)` : void 0;
|
|
139
140
|
if (g) {
|
|
140
141
|
let t = () => {
|
|
141
|
-
u || (P ? p?.(_) : f ? m?.(
|
|
142
|
+
u || (P ? p?.(_) : f ? m?.(v) : l && p?.(_));
|
|
142
143
|
}, n = !l && !u && M;
|
|
143
144
|
return /* @__PURE__ */ c("div", {
|
|
144
145
|
ref: O,
|
|
@@ -166,7 +167,7 @@ function b(e) {
|
|
|
166
167
|
transform: F,
|
|
167
168
|
transition: T
|
|
168
169
|
},
|
|
169
|
-
children: /* @__PURE__ */ c(
|
|
170
|
+
children: /* @__PURE__ */ c(y, {
|
|
170
171
|
...e,
|
|
171
172
|
isDragging: E,
|
|
172
173
|
isSelected: P,
|
|
@@ -191,7 +192,7 @@ function b(e) {
|
|
|
191
192
|
opacity: E ? .5 : 1,
|
|
192
193
|
touchAction: l && !u ? "none" : "auto"
|
|
193
194
|
},
|
|
194
|
-
children: /* @__PURE__ */ c(
|
|
195
|
+
children: /* @__PURE__ */ c(y, {
|
|
195
196
|
...e,
|
|
196
197
|
isDragging: E,
|
|
197
198
|
isSelected: P,
|
|
@@ -199,7 +200,7 @@ function b(e) {
|
|
|
199
200
|
})
|
|
200
201
|
});
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
+
x.propTypes = {
|
|
203
204
|
id: r.any,
|
|
204
205
|
instanceId: r.string,
|
|
205
206
|
promptId: r.any,
|
|
@@ -213,4 +214,4 @@ b.propTypes = {
|
|
|
213
214
|
onPlacementClick: r.func
|
|
214
215
|
};
|
|
215
216
|
//#endregion
|
|
216
|
-
export {
|
|
217
|
+
export { y as Answer, b as buildDragId, x as default };
|