@pie-element/match-list 8.0.3-next.20261007184841 → 8.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/delivery/index.js +2827 -2870
- package/dist/browser/delivery/index.js.map +1 -1
- package/dist/delivery/answer.js +122 -128
- package/dist/index.iife.js +22 -22
- package/package.json +10 -10
- package/dist/delivery/__tests__/math-control-names.test.d.ts +0 -1
package/dist/delivery/answer.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import e, {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { PlaceHolder as
|
|
5
|
-
import { useDraggable as
|
|
6
|
-
import { color as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { styled as
|
|
9
|
-
import { isEmpty as
|
|
10
|
-
import { sanitizeModelHtml as
|
|
1
|
+
import e, { useState as t } from "react";
|
|
2
|
+
import n from "debug";
|
|
3
|
+
import r from "prop-types";
|
|
4
|
+
import { PlaceHolder as i } from "@pie-lib/drag";
|
|
5
|
+
import { useDraggable as a, useDroppable as o } from "@dnd-kit/core";
|
|
6
|
+
import { color as s } from "@pie-lib/render-ui";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
|
+
import { styled as l } from "@mui/material/styles";
|
|
9
|
+
import { isEmpty as u } from "@pie-element/shared-lodash";
|
|
10
|
+
import { sanitizeModelHtml as d } from "@pie-element/shared-utils";
|
|
11
11
|
//#region src/delivery/answer.tsx
|
|
12
|
-
var
|
|
12
|
+
var f = n("pie-elements:match-title:answer"), p = s.v("pie"), m = l("div")(() => ({
|
|
13
13
|
width: "100%",
|
|
14
14
|
fontSize: "18px",
|
|
15
15
|
textAlign: "center",
|
|
16
16
|
color: "inherit"
|
|
17
|
-
})),
|
|
17
|
+
})), h = ({ index: e, isOver: t, disabled: n, type: r }) => /* @__PURE__ */ c(i, {
|
|
18
18
|
extraStyles: {
|
|
19
19
|
display: "flex",
|
|
20
20
|
padding: "0",
|
|
@@ -25,18 +25,18 @@ var m = r("pie-elements:match-title:answer"), h = c.v("pie"), g = d("div")(() =>
|
|
|
25
25
|
disabled: n,
|
|
26
26
|
isOver: t,
|
|
27
27
|
type: r,
|
|
28
|
-
children: e !== void 0 && /* @__PURE__ */
|
|
28
|
+
children: e !== void 0 && /* @__PURE__ */ c(m, { children: e })
|
|
29
29
|
});
|
|
30
|
-
|
|
31
|
-
index:
|
|
32
|
-
isOver:
|
|
33
|
-
disabled:
|
|
34
|
-
type:
|
|
30
|
+
h.propTypes = {
|
|
31
|
+
index: r.number,
|
|
32
|
+
isOver: r.bool,
|
|
33
|
+
disabled: r.bool,
|
|
34
|
+
type: r.string
|
|
35
35
|
};
|
|
36
|
-
var
|
|
37
|
-
color:
|
|
38
|
-
backgroundColor:
|
|
39
|
-
border: `1px solid ${i === "correct" ?
|
|
36
|
+
var g = l("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcome: i }) => ({
|
|
37
|
+
color: s.text(),
|
|
38
|
+
backgroundColor: p("background", s.defaults.WHITE),
|
|
39
|
+
border: `1px solid ${i === "correct" ? s.correct() : i === "incorrect" ? s.incorrect() : s.border()}`,
|
|
40
40
|
cursor: r ? "not-allowed" : "pointer",
|
|
41
41
|
width: "100%",
|
|
42
42
|
padding: "10px",
|
|
@@ -46,22 +46,22 @@ var v = d("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
46
46
|
wordBreak: "break-word",
|
|
47
47
|
opacity: (e || t) && !r ? .5 : n && !r ? .2 : 1,
|
|
48
48
|
touchAction: "none"
|
|
49
|
-
})),
|
|
50
|
-
let { isDragging: t, isSelected: n, isOver: r, title: i, disabled: a, empty: o, outcome: s, guideIndex:
|
|
51
|
-
return o ? /* @__PURE__ */
|
|
52
|
-
index:
|
|
49
|
+
})), _ = (e) => {
|
|
50
|
+
let { isDragging: t, isSelected: n, isOver: r, title: i, disabled: a, empty: o, outcome: s, guideIndex: l, type: u } = e;
|
|
51
|
+
return o ? /* @__PURE__ */ c(h, {
|
|
52
|
+
index: l,
|
|
53
53
|
isOver: r,
|
|
54
54
|
disabled: a,
|
|
55
|
-
type:
|
|
56
|
-
}) : /* @__PURE__ */
|
|
55
|
+
type: u
|
|
56
|
+
}) : /* @__PURE__ */ c(g, {
|
|
57
57
|
isDragging: t,
|
|
58
58
|
isSelected: n,
|
|
59
59
|
isOver: r,
|
|
60
60
|
disabled: a,
|
|
61
61
|
outcome: s,
|
|
62
|
-
dangerouslySetInnerHTML: { __html:
|
|
62
|
+
dangerouslySetInnerHTML: { __html: d(i) }
|
|
63
63
|
});
|
|
64
|
-
},
|
|
64
|
+
}, v = l("div")(({ correct: e, isSelected: t, isDragging: n, theme: r }) => ({
|
|
65
65
|
boxSizing: "border-box",
|
|
66
66
|
minHeight: 40,
|
|
67
67
|
minWidth: "200px",
|
|
@@ -70,19 +70,19 @@ var v = d("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
70
70
|
padding: "0px",
|
|
71
71
|
textAlign: "center",
|
|
72
72
|
height: "initial",
|
|
73
|
-
border: e === !0 ? `1px solid ${
|
|
74
|
-
})),
|
|
73
|
+
border: e === !0 ? `1px solid ${s.correct()}` : e === !1 ? `1px solid ${s.incorrect()}` : t && !n ? `2px solid ${s.buttonFocusOutline()}` : "none"
|
|
74
|
+
})), y = class extends e.Component {
|
|
75
75
|
static propTypes = {
|
|
76
|
-
className:
|
|
77
|
-
isDragging:
|
|
78
|
-
isSelected:
|
|
79
|
-
id:
|
|
80
|
-
title:
|
|
81
|
-
isOver:
|
|
82
|
-
empty:
|
|
83
|
-
type:
|
|
84
|
-
disabled:
|
|
85
|
-
correct:
|
|
76
|
+
className: r.string,
|
|
77
|
+
isDragging: r.bool,
|
|
78
|
+
isSelected: r.bool,
|
|
79
|
+
id: r.any,
|
|
80
|
+
title: r.string,
|
|
81
|
+
isOver: r.bool,
|
|
82
|
+
empty: r.bool,
|
|
83
|
+
type: r.string,
|
|
84
|
+
disabled: r.bool,
|
|
85
|
+
correct: r.bool
|
|
86
86
|
};
|
|
87
87
|
componentDidMount() {
|
|
88
88
|
this.ref && this.ref.addEventListener("touchstart", this.handleTouchStart, { passive: !0 });
|
|
@@ -92,18 +92,18 @@ var v = d("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
92
92
|
}
|
|
93
93
|
handleTouchStart = (e) => {};
|
|
94
94
|
render() {
|
|
95
|
-
let { id: e, title: t, isDragging: n = !1, isSelected: r = !1, className: i, disabled: a, isOver: o = !1, type: s, correct:
|
|
96
|
-
return
|
|
97
|
-
correct:
|
|
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;
|
|
96
|
+
return f("[render], props: ", this.props), /* @__PURE__ */ c(v, {
|
|
97
|
+
correct: l,
|
|
98
98
|
isSelected: r,
|
|
99
99
|
isDragging: n,
|
|
100
100
|
className: i,
|
|
101
101
|
ref: (e) => this.ref = e,
|
|
102
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ c(_, {
|
|
103
103
|
title: t,
|
|
104
104
|
id: e,
|
|
105
105
|
isOver: o,
|
|
106
|
-
empty:
|
|
106
|
+
empty: u(t),
|
|
107
107
|
isDragging: n,
|
|
108
108
|
isSelected: r,
|
|
109
109
|
disabled: a,
|
|
@@ -111,113 +111,107 @@ var v = d("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcom
|
|
|
111
111
|
})
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
},
|
|
115
|
-
function
|
|
116
|
-
let { id:
|
|
117
|
-
type:
|
|
118
|
-
id:
|
|
119
|
-
promptId:
|
|
120
|
-
}),
|
|
121
|
-
type:
|
|
122
|
-
id:
|
|
123
|
-
instanceId:
|
|
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({
|
|
117
|
+
type: d,
|
|
118
|
+
id: n,
|
|
119
|
+
promptId: i
|
|
120
|
+
}), g = i == null ? void 0 : `drop-${i}`, _ = {
|
|
121
|
+
type: d || "answer",
|
|
122
|
+
id: n,
|
|
123
|
+
instanceId: r,
|
|
124
124
|
value: e.title,
|
|
125
|
-
promptId:
|
|
126
|
-
},
|
|
125
|
+
promptId: i
|
|
126
|
+
}, v = g ? {
|
|
127
127
|
type: "drop-zone",
|
|
128
|
-
promptId:
|
|
129
|
-
instanceId:
|
|
130
|
-
} : void 0, { attributes:
|
|
131
|
-
id:
|
|
132
|
-
data:
|
|
133
|
-
disabled: !
|
|
134
|
-
attributes: { tabIndex:
|
|
135
|
-
}),
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}), N = M.setNodeRef, P = M.isOver, [F, I] = n(!1), L = !!m, R = P || L && F && !f, z = !!m && m.type === y.type && m.id === y.id && m.promptId === y.promptId, B = E ? `translate3d(${E.x}px, ${E.y}px, 0)` : void 0;
|
|
142
|
-
if (v) {
|
|
128
|
+
promptId: i,
|
|
129
|
+
instanceId: r
|
|
130
|
+
} : void 0, { attributes: x, listeners: S, setNodeRef: C, transform: w, transition: T, isDragging: E } = a({
|
|
131
|
+
id: h,
|
|
132
|
+
data: _,
|
|
133
|
+
disabled: !l || u,
|
|
134
|
+
attributes: { tabIndex: l && !u ? 0 : -1 }
|
|
135
|
+
}), D = o({
|
|
136
|
+
id: g,
|
|
137
|
+
data: v,
|
|
138
|
+
disabled: u || !g
|
|
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;
|
|
140
|
+
if (g) {
|
|
143
141
|
let t = () => {
|
|
144
|
-
|
|
145
|
-
}, n = !
|
|
146
|
-
return /* @__PURE__ */
|
|
147
|
-
ref:
|
|
142
|
+
u || (P ? p?.(_) : f ? m?.(v) : l && p?.(_));
|
|
143
|
+
}, n = !l && !u && M;
|
|
144
|
+
return /* @__PURE__ */ c("div", {
|
|
145
|
+
ref: O,
|
|
148
146
|
role: n ? "button" : "group",
|
|
149
|
-
"aria-labelledby":
|
|
147
|
+
"aria-labelledby": s,
|
|
150
148
|
tabIndex: n ? 0 : -1,
|
|
151
149
|
onClick: t,
|
|
152
150
|
onKeyDown: n ? (e) => {
|
|
153
151
|
(e.code === "Space" || e.code === "Enter") && (e.preventDefault(), t());
|
|
154
152
|
} : void 0,
|
|
155
|
-
onMouseEnter: () =>
|
|
156
|
-
onMouseLeave: () =>
|
|
153
|
+
onMouseEnter: () => j(!0),
|
|
154
|
+
onMouseLeave: () => j(!1),
|
|
157
155
|
style: {
|
|
158
156
|
flex: 1,
|
|
159
|
-
opacity:
|
|
160
|
-
backgroundColor:
|
|
161
|
-
cursor:
|
|
157
|
+
opacity: E ? .5 : 1,
|
|
158
|
+
backgroundColor: E || P || N ? "rgba(0,0,0,0.05)" : "transparent",
|
|
159
|
+
cursor: M && !u ? "pointer" : void 0
|
|
162
160
|
},
|
|
163
|
-
children: /* @__PURE__ */
|
|
164
|
-
ref:
|
|
165
|
-
...
|
|
166
|
-
...
|
|
167
|
-
|
|
168
|
-
"aria-label": A
|
|
169
|
-
} : {},
|
|
170
|
-
"data-tile-id": `${i}:${_}`,
|
|
161
|
+
children: /* @__PURE__ */ c("div", {
|
|
162
|
+
ref: C,
|
|
163
|
+
...S,
|
|
164
|
+
...l && !u ? x : {},
|
|
165
|
+
"data-tile-id": `${r}:${h}`,
|
|
171
166
|
style: {
|
|
172
|
-
transform:
|
|
173
|
-
transition:
|
|
167
|
+
transform: F,
|
|
168
|
+
transition: T
|
|
174
169
|
},
|
|
175
|
-
children: /* @__PURE__ */
|
|
170
|
+
children: /* @__PURE__ */ c(y, {
|
|
176
171
|
...e,
|
|
177
|
-
isDragging:
|
|
178
|
-
isSelected:
|
|
179
|
-
isOver:
|
|
172
|
+
isDragging: E,
|
|
173
|
+
isSelected: P,
|
|
174
|
+
isOver: N
|
|
180
175
|
})
|
|
181
176
|
})
|
|
182
177
|
});
|
|
183
178
|
}
|
|
184
|
-
let
|
|
185
|
-
|
|
179
|
+
let I = (e) => {
|
|
180
|
+
u || (e.stopPropagation(), p?.(_));
|
|
186
181
|
};
|
|
187
|
-
return /* @__PURE__ */
|
|
188
|
-
ref:
|
|
189
|
-
...
|
|
190
|
-
...
|
|
191
|
-
"
|
|
192
|
-
|
|
193
|
-
onClick: V,
|
|
182
|
+
return /* @__PURE__ */ c("div", {
|
|
183
|
+
ref: C,
|
|
184
|
+
...S,
|
|
185
|
+
...x,
|
|
186
|
+
"data-tile-id": `${r}:${h}`,
|
|
187
|
+
onClick: I,
|
|
194
188
|
style: {
|
|
195
|
-
transform:
|
|
196
|
-
transition:
|
|
197
|
-
cursor:
|
|
198
|
-
opacity:
|
|
199
|
-
touchAction:
|
|
189
|
+
transform: F,
|
|
190
|
+
transition: T,
|
|
191
|
+
cursor: u ? "not-allowed" : "grab",
|
|
192
|
+
opacity: E ? .5 : 1,
|
|
193
|
+
touchAction: l && !u ? "none" : "auto"
|
|
200
194
|
},
|
|
201
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ c(y, {
|
|
202
196
|
...e,
|
|
203
|
-
isDragging:
|
|
204
|
-
isSelected:
|
|
197
|
+
isDragging: E,
|
|
198
|
+
isSelected: P,
|
|
205
199
|
isOver: !1
|
|
206
200
|
})
|
|
207
201
|
});
|
|
208
202
|
}
|
|
209
|
-
|
|
210
|
-
id:
|
|
211
|
-
instanceId:
|
|
212
|
-
promptId:
|
|
213
|
-
labelId:
|
|
214
|
-
title:
|
|
215
|
-
draggable:
|
|
216
|
-
disabled:
|
|
217
|
-
type:
|
|
218
|
-
selectedAnswer:
|
|
219
|
-
onSelectClick:
|
|
220
|
-
onPlacementClick:
|
|
203
|
+
x.propTypes = {
|
|
204
|
+
id: r.any,
|
|
205
|
+
instanceId: r.string,
|
|
206
|
+
promptId: r.any,
|
|
207
|
+
labelId: r.string,
|
|
208
|
+
title: r.string,
|
|
209
|
+
draggable: r.bool,
|
|
210
|
+
disabled: r.bool,
|
|
211
|
+
type: r.string,
|
|
212
|
+
selectedAnswer: r.object,
|
|
213
|
+
onSelectClick: r.func,
|
|
214
|
+
onPlacementClick: r.func
|
|
221
215
|
};
|
|
222
216
|
//#endregion
|
|
223
|
-
export {
|
|
217
|
+
export { y as Answer, b as buildDragId, x as default };
|