@pie-element/match-list 7.2.1 → 7.2.2-beta.10
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/CHANGELOG.md +51 -30
- package/controller/CHANGELOG.md +70 -6
- package/controller/package.json +1 -1
- package/lib/answer-area.js +7 -20
- package/lib/answer-area.js.map +1 -1
- package/lib/answer.js +27 -129
- package/lib/answer.js.map +1 -1
- package/lib/arrow.js +3 -8
- package/lib/arrow.js.map +1 -1
- package/lib/choices-list.js +4 -13
- package/lib/choices-list.js.map +1 -1
- package/lib/droppable-placeholder.js +1 -12
- package/lib/droppable-placeholder.js.map +1 -1
- package/lib/main.js +19 -223
- package/lib/main.js.map +1 -1
- package/package.json +5 -5
- package/lib/keyboard-coordinates.js +0 -154
- package/lib/keyboard-coordinates.js.map +0 -1
package/lib/answer.js
CHANGED
|
@@ -9,13 +9,12 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _core = require("@dnd-kit/core");
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _react =
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
13
|
var _debug = _interopRequireDefault(require("debug"));
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
15
|
var _drag = require("@pie-lib/drag");
|
|
16
16
|
var _lodashEs = require("lodash-es");
|
|
17
17
|
var _renderUi = require("@pie-lib/render-ui");
|
|
18
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
19
18
|
const log = (0, _debug.default)('pie-elements:match-title:answer');
|
|
20
19
|
const HolderNumber = (0, _styles.styled)('div')(({
|
|
21
20
|
theme
|
|
@@ -49,15 +48,15 @@ Holder.propTypes = {
|
|
|
49
48
|
type: _propTypes.default.string
|
|
50
49
|
};
|
|
51
50
|
const AnswerContentContainer = (0, _styles.styled)('div')(({
|
|
51
|
+
theme,
|
|
52
52
|
isDragging,
|
|
53
|
-
isSelected,
|
|
54
53
|
isOver,
|
|
55
54
|
disabled,
|
|
56
55
|
outcome
|
|
57
56
|
}) => ({
|
|
58
57
|
color: _renderUi.color.text(),
|
|
59
58
|
backgroundColor: _renderUi.color.white(),
|
|
60
|
-
border: `1px solid ${outcome === 'correct' ? _renderUi.color.correct() : outcome === 'incorrect' ? _renderUi.color.incorrect() :
|
|
59
|
+
border: `1px solid ${outcome === 'correct' ? _renderUi.color.correct() : outcome === 'incorrect' ? _renderUi.color.incorrect() : theme.palette.grey[400]}`,
|
|
61
60
|
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
62
61
|
width: '100%',
|
|
63
62
|
padding: '10px',
|
|
@@ -65,13 +64,12 @@ const AnswerContentContainer = (0, _styles.styled)('div')(({
|
|
|
65
64
|
overflow: 'hidden',
|
|
66
65
|
transition: 'opacity 200ms linear',
|
|
67
66
|
wordBreak: 'break-word',
|
|
68
|
-
opacity:
|
|
67
|
+
opacity: isDragging && !disabled ? 0.5 : isOver && !disabled ? 0.2 : 1,
|
|
69
68
|
touchAction: 'none'
|
|
70
69
|
}));
|
|
71
70
|
const AnswerContent = props => {
|
|
72
71
|
const {
|
|
73
72
|
isDragging,
|
|
74
|
-
isSelected,
|
|
75
73
|
isOver,
|
|
76
74
|
title,
|
|
77
75
|
disabled,
|
|
@@ -90,7 +88,6 @@ const AnswerContent = props => {
|
|
|
90
88
|
} else {
|
|
91
89
|
return /*#__PURE__*/_react.default.createElement(AnswerContentContainer, {
|
|
92
90
|
isDragging: isDragging,
|
|
93
|
-
isSelected: isSelected,
|
|
94
91
|
isOver: isOver,
|
|
95
92
|
disabled: disabled,
|
|
96
93
|
outcome: outcome,
|
|
@@ -142,7 +139,6 @@ class Answer extends _react.default.Component {
|
|
|
142
139
|
id,
|
|
143
140
|
title,
|
|
144
141
|
isDragging = false,
|
|
145
|
-
isSelected = false,
|
|
146
142
|
className,
|
|
147
143
|
disabled,
|
|
148
144
|
isOver = false,
|
|
@@ -160,7 +156,6 @@ class Answer extends _react.default.Component {
|
|
|
160
156
|
isOver: isOver,
|
|
161
157
|
empty: (0, _lodashEs.isEmpty)(title),
|
|
162
158
|
isDragging: isDragging,
|
|
163
|
-
isSelected: isSelected,
|
|
164
159
|
disabled: disabled,
|
|
165
160
|
type: type
|
|
166
161
|
}));
|
|
@@ -170,7 +165,6 @@ exports.Answer = Answer;
|
|
|
170
165
|
(0, _defineProperty2.default)(Answer, "propTypes", {
|
|
171
166
|
className: _propTypes.default.string,
|
|
172
167
|
isDragging: _propTypes.default.bool,
|
|
173
|
-
isSelected: _propTypes.default.bool,
|
|
174
168
|
id: _propTypes.default.any,
|
|
175
169
|
title: _propTypes.default.string,
|
|
176
170
|
isOver: _propTypes.default.bool,
|
|
@@ -186,29 +180,11 @@ function DragAndDropAnswer(props) {
|
|
|
186
180
|
promptId,
|
|
187
181
|
draggable = true,
|
|
188
182
|
disabled = false,
|
|
189
|
-
type
|
|
190
|
-
selectedAnswer,
|
|
191
|
-
onSelectClick,
|
|
192
|
-
onPlacementClick
|
|
183
|
+
type
|
|
193
184
|
} = props;
|
|
194
185
|
const dragId = `${type || 'answer'}-${id}`;
|
|
195
186
|
// droppable only if promptId exists
|
|
196
187
|
const dropId = promptId !== undefined && promptId !== null ? `drop-${promptId}` : undefined;
|
|
197
|
-
|
|
198
|
-
// Built once and reused for both dnd-kit's own data and the click handlers below, so
|
|
199
|
-
// a click carries exactly the same shape dnd-kit's onDragStart/onDragEnd would.
|
|
200
|
-
const activeData = {
|
|
201
|
-
type: type || 'answer',
|
|
202
|
-
id,
|
|
203
|
-
instanceId,
|
|
204
|
-
value: props.title,
|
|
205
|
-
promptId
|
|
206
|
-
};
|
|
207
|
-
const dropZoneData = dropId ? {
|
|
208
|
-
type: 'drop-zone',
|
|
209
|
-
promptId,
|
|
210
|
-
instanceId
|
|
211
|
-
} : undefined;
|
|
212
188
|
const {
|
|
213
189
|
attributes,
|
|
214
190
|
listeners,
|
|
@@ -218,138 +194,63 @@ function DragAndDropAnswer(props) {
|
|
|
218
194
|
isDragging
|
|
219
195
|
} = (0, _core.useDraggable)({
|
|
220
196
|
id: dragId,
|
|
221
|
-
data:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
// reachable/interactive, leaving the outer wrapper (for an empty drop-zone) or
|
|
230
|
-
// nothing (for a disabled choice) as the sole stop.
|
|
231
|
-
attributes: {
|
|
232
|
-
tabIndex: draggable && !disabled ? 0 : -1
|
|
233
|
-
}
|
|
197
|
+
data: {
|
|
198
|
+
type: type || 'answer',
|
|
199
|
+
id,
|
|
200
|
+
instanceId,
|
|
201
|
+
value: props.title,
|
|
202
|
+
promptId
|
|
203
|
+
},
|
|
204
|
+
disabled: !draggable || disabled
|
|
234
205
|
});
|
|
235
206
|
const droppable = (0, _core.useDroppable)({
|
|
236
207
|
id: dropId,
|
|
237
|
-
data:
|
|
208
|
+
data: dropId ? {
|
|
209
|
+
type: 'drop-zone',
|
|
210
|
+
promptId,
|
|
211
|
+
instanceId
|
|
212
|
+
} : undefined,
|
|
238
213
|
disabled: disabled || !dropId
|
|
239
214
|
});
|
|
240
215
|
const setDropRef = droppable.setNodeRef;
|
|
241
216
|
const isOver = droppable.isOver;
|
|
242
217
|
|
|
243
|
-
// dnd-kit's own isOver only reflects real collision detection during an active drag,
|
|
244
|
-
// so it stays false while an answer is merely click-selected (no drag in progress).
|
|
245
|
-
// Track hovering locally and fold it into the same isOver signal used everywhere
|
|
246
|
-
// below, so hovering a response area while something is selected gets the exact same
|
|
247
|
-
// treatment as hovering it during a real drag — one code path, no duplicated CSS.
|
|
248
|
-
const [isHovered, setIsHovered] = (0, _react.useState)(false);
|
|
249
|
-
const hasSelection = !!selectedAnswer;
|
|
250
|
-
const showsHoverEffect = isOver || hasSelection && isHovered && !disabled;
|
|
251
|
-
const isSelected = !!selectedAnswer && selectedAnswer.type === activeData.type && selectedAnswer.id === activeData.id && selectedAnswer.promptId === activeData.promptId;
|
|
252
|
-
|
|
253
218
|
// compute style: apply transform to the element that actually moves
|
|
254
219
|
const transformStyle = transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined;
|
|
255
220
|
|
|
256
221
|
// If this item is a drop-zone (prompt slot), we render an outer droppable wrapper.
|
|
257
|
-
//
|
|
258
|
-
// ("drop-{promptId}"), so it must stay untransformed — applying the drag transform
|
|
259
|
-
// there would make the slot's own droppable rect chase the dragged item during the
|
|
260
|
-
// drag, corrupting collision/keyboard-navigation results. The transform belongs on
|
|
261
|
-
// the inner draggable node instead.
|
|
222
|
+
// For droppable wrapper we apply style to the outer wrapper
|
|
262
223
|
if (dropId) {
|
|
263
|
-
const handleResponseAreaClick = () => {
|
|
264
|
-
if (disabled) return;
|
|
265
|
-
if (isSelected) {
|
|
266
|
-
// Clicking the already-selected placed answer again deselects it, same as
|
|
267
|
-
// for a choice in the pool.
|
|
268
|
-
onSelectClick?.(activeData);
|
|
269
|
-
} else if (selectedAnswer) {
|
|
270
|
-
// Something else is selected — place it here, same whether this area is
|
|
271
|
-
// currently empty or already occupied.
|
|
272
|
-
onPlacementClick?.(dropZoneData);
|
|
273
|
-
} else if (draggable) {
|
|
274
|
-
// Nothing selected yet, and this response area holds an answer — clicking it
|
|
275
|
-
// selects that answer for moving elsewhere, the same way Tab+Space/Enter does.
|
|
276
|
-
onSelectClick?.(activeData);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Empty response area clicked with nothing selected: nothing to place or select.
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
// An empty response area isn't draggable, so dnd-kit's own attributes (only
|
|
283
|
-
// applied to the inner node, and only when draggable) never make it tabbable —
|
|
284
|
-
// this outer wrapper needs its own focus/activation handling so "select a choice,
|
|
285
|
-
// then Tab to a response area and press Space/Enter" works even when the area is
|
|
286
|
-
// empty. This is independent of, and doesn't change, the existing in-drag
|
|
287
|
-
// Tab-cycling (that's driven by an active dnd-kit drag, not native focus).
|
|
288
|
-
//
|
|
289
|
-
// Only made a native Tab stop when NOT draggable (i.e. empty): when the target is
|
|
290
|
-
// filled, the inner node is already independently tabbable via dnd-kit's own
|
|
291
|
-
// attributes for the existing pick-up-to-move gesture, and adding a second,
|
|
292
|
-
// outer Tab stop for the same visual tile would add an extra stop to the existing
|
|
293
|
-
// Tab order. Placing into an occupied area is still fully reachable by mouse click
|
|
294
|
-
// here, or by the existing keyboard drag flow (Tab+Space/Enter on the choice,
|
|
295
|
-
// Tab-cycle to the occupied target, Space/Enter to swap).
|
|
296
|
-
const isNativeTabStop = !draggable && !disabled;
|
|
297
|
-
const handleResponseAreaKeyDown = e => {
|
|
298
|
-
if (e.code === 'Space' || e.code === 'Enter') {
|
|
299
|
-
e.preventDefault();
|
|
300
|
-
handleResponseAreaClick();
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
224
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
304
225
|
ref: setDropRef,
|
|
305
|
-
role: "button",
|
|
306
|
-
tabIndex: isNativeTabStop ? 0 : -1,
|
|
307
|
-
onClick: handleResponseAreaClick,
|
|
308
|
-
onKeyDown: isNativeTabStop ? handleResponseAreaKeyDown : undefined,
|
|
309
|
-
onMouseEnter: () => setIsHovered(true),
|
|
310
|
-
onMouseLeave: () => setIsHovered(false),
|
|
311
226
|
style: {
|
|
312
227
|
flex: 1,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
228
|
+
transform: transformStyle,
|
|
229
|
+
transition,
|
|
230
|
+
opacity: isDragging ? 0.5 : 1,
|
|
231
|
+
backgroundColor: isOver ? 'rgba(0,0,0,0.05)' : 'transparent'
|
|
316
232
|
}
|
|
317
233
|
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
318
234
|
ref: setDragRef
|
|
319
|
-
}, listeners, attributes, {
|
|
320
|
-
style: {
|
|
321
|
-
transform: transformStyle,
|
|
322
|
-
transition
|
|
323
|
-
}
|
|
324
|
-
}), /*#__PURE__*/_react.default.createElement(Answer, (0, _extends2.default)({}, props, {
|
|
235
|
+
}, listeners, attributes), /*#__PURE__*/_react.default.createElement(Answer, (0, _extends2.default)({}, props, {
|
|
325
236
|
isDragging: isDragging,
|
|
326
|
-
|
|
327
|
-
isOver: showsHoverEffect
|
|
237
|
+
isOver: isOver
|
|
328
238
|
}))));
|
|
329
239
|
}
|
|
330
|
-
const handleChoiceClick = e => {
|
|
331
|
-
if (disabled) {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
e.stopPropagation();
|
|
335
|
-
onSelectClick?.(activeData);
|
|
336
|
-
};
|
|
337
240
|
|
|
338
241
|
// if there is NO dropId (this is a choice / draggable-only), render only draggable node and apply transform to it.
|
|
339
242
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({
|
|
340
243
|
ref: setDragRef
|
|
341
244
|
}, listeners, attributes, {
|
|
342
|
-
onClick: handleChoiceClick,
|
|
343
245
|
style: {
|
|
344
246
|
transform: transformStyle,
|
|
345
247
|
transition,
|
|
346
248
|
cursor: disabled ? 'not-allowed' : 'grab',
|
|
347
|
-
opacity: isDragging
|
|
249
|
+
opacity: isDragging ? 0.5 : 1,
|
|
348
250
|
touchAction: draggable && !disabled ? 'none' : 'auto'
|
|
349
251
|
}
|
|
350
252
|
}), /*#__PURE__*/_react.default.createElement(Answer, (0, _extends2.default)({}, props, {
|
|
351
253
|
isDragging: isDragging,
|
|
352
|
-
isSelected: isSelected,
|
|
353
254
|
isOver: false
|
|
354
255
|
})));
|
|
355
256
|
}
|
|
@@ -360,10 +261,7 @@ DragAndDropAnswer.propTypes = {
|
|
|
360
261
|
title: _propTypes.default.string,
|
|
361
262
|
draggable: _propTypes.default.bool,
|
|
362
263
|
disabled: _propTypes.default.bool,
|
|
363
|
-
type: _propTypes.default.string
|
|
364
|
-
selectedAnswer: _propTypes.default.object,
|
|
365
|
-
onSelectClick: _propTypes.default.func,
|
|
366
|
-
onPlacementClick: _propTypes.default.func
|
|
264
|
+
type: _propTypes.default.string
|
|
367
265
|
};
|
|
368
266
|
var _default = exports.default = DragAndDropAnswer;
|
|
369
267
|
//# sourceMappingURL=answer.js.map
|
package/lib/answer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"answer.js","names":["_core","require","_propTypes","_interopRequireDefault","_react","_interopRequireWildcard","_debug","_styles","_drag","_lodashEs","_renderUi","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","log","debug","HolderNumber","styled","theme","width","fontSize","textAlign","color","palette","common","black","Holder","index","isOver","disabled","type","createElement","PlaceHolder","extraStyles","display","padding","alignItems","justifyContent","height","undefined","propTypes","PropTypes","number","bool","string","AnswerContentContainer","isDragging","isSelected","outcome","text","backgroundColor","white","border","correct","incorrect","cursor","boxSizing","overflow","transition","wordBreak","opacity","touchAction","AnswerContent","props","title","empty","guideIndex","dangerouslySetInnerHTML","__html","AnswerContainer","minHeight","minWidth","margin","spacing","Answer","React","Component","constructor","args","_defineProperty2","componentDidMount","ref","addEventListener","handleTouchStart","passive","componentWillUnmount","removeEventListener","render","id","className","isEmpty","exports","any","DragAndDropAnswer","instanceId","promptId","draggable","selectedAnswer","onSelectClick","onPlacementClick","dragId","dropId","activeData","value","dropZoneData","attributes","listeners","setNodeRef","setDragRef","transform","useDraggable","data","tabIndex","droppable","useDroppable","setDropRef","isHovered","setIsHovered","useState","hasSelection","showsHoverEffect","transformStyle","x","y","handleResponseAreaClick","isNativeTabStop","handleResponseAreaKeyDown","code","preventDefault","role","onClick","onKeyDown","onMouseEnter","onMouseLeave","style","flex","_extends2","handleChoiceClick","stopPropagation","object","func","_default"],"sources":["../src/answer.jsx"],"sourcesContent":["import { useDraggable, useDroppable } from '@dnd-kit/core';\nimport PropTypes from 'prop-types';\nimport React, { useState } from 'react';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { isEmpty } from 'lodash-es';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('pie-elements:match-title:answer');\n\nconst HolderNumber = styled('div')(({ theme }) => ({\n width: '100%',\n fontSize: '18px',\n textAlign: 'center',\n color: `rgba(${theme.palette.common.black}, 0.6)`,\n}));\n\nconst Holder = ({ index, isOver, disabled, type }) => (\n <PlaceHolder\n extraStyles={{\n display: 'flex',\n padding: '0',\n alignItems: 'center',\n justifyContent: 'center',\n height: '40px',\n }}\n disabled={disabled}\n isOver={isOver}\n type={type}\n >\n {index !== undefined && <HolderNumber>{index}</HolderNumber>}\n </PlaceHolder>\n);\n\nHolder.propTypes = {\n index: PropTypes.number,\n isOver: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n};\n\nconst AnswerContentContainer = styled('div')(({ isDragging, isSelected, isOver, disabled, outcome }) => ({\n color: color.text(),\n backgroundColor: color.white(),\n border: `1px solid ${\n outcome === 'correct' ? color.correct() : outcome === 'incorrect' ? color.incorrect() : color.border()\n }`,\n cursor: disabled ? 'not-allowed' : 'pointer',\n width: '100%',\n padding: '10px',\n boxSizing: 'border-box',\n overflow: 'hidden',\n transition: 'opacity 200ms linear',\n wordBreak: 'break-word',\n opacity: (isDragging || isSelected) && !disabled ? 0.5 : isOver && !disabled ? 0.2 : 1,\n touchAction: 'none',\n}));\n\nconst AnswerContent = (props) => {\n const { isDragging, isSelected, isOver, title, disabled, empty, outcome, guideIndex, type } = props;\n\n if (empty) {\n return <Holder index={guideIndex} isOver={isOver} disabled={disabled} type={type} />;\n } else {\n return (\n <AnswerContentContainer\n isDragging={isDragging}\n isSelected={isSelected}\n isOver={isOver}\n disabled={disabled}\n outcome={outcome}\n dangerouslySetInnerHTML={{ __html: title }}\n />\n );\n }\n};\n\nconst AnswerContainer = styled('div')(({ correct, theme }) => ({\n boxSizing: 'border-box',\n minHeight: 40,\n minWidth: '200px',\n overflow: 'hidden',\n margin: theme.spacing(0.5),\n padding: '0px',\n textAlign: 'center',\n height: 'initial',\n border:\n correct === true\n ? `1px solid var(--feedback-correct-bg-color, ${color.correct()})`\n : correct === false\n ? `1px solid var(--feedback-incorrect-bg-color, ${color.incorrect()})`\n : 'none',\n}));\n\nexport class Answer extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n isDragging: PropTypes.bool,\n isSelected: PropTypes.bool,\n id: PropTypes.any,\n title: PropTypes.string,\n isOver: PropTypes.bool,\n empty: PropTypes.bool,\n type: PropTypes.string,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n };\n\n componentDidMount() {\n if (this.ref) {\n // NOTE: preventing default on touchstart can block dnd-kit pointer handling on some devices.\n // Consider removing this if you have issues on touch devices.\n this.ref.addEventListener('touchstart', this.handleTouchStart, { passive: true });\n }\n }\n\n componentWillUnmount() {\n if (this.ref) {\n this.ref.removeEventListener('touchstart', this.handleTouchStart);\n }\n }\n\n handleTouchStart = (e) => {\n // do NOT call e.preventDefault() here — it prevents pointer events necessary for dnd-kit.\n // Keep this handler empty or remove it if you don't need it.\n // e.preventDefault();\n };\n\n render() {\n const {\n id,\n title,\n isDragging = false,\n isSelected = false,\n className,\n disabled,\n isOver = false,\n type,\n correct,\n } = this.props;\n\n log('[render], props: ', this.props);\n\n return (\n <AnswerContainer correct={correct} className={className} ref={(ref) => (this.ref = ref)}>\n <AnswerContent\n title={title}\n id={id}\n isOver={isOver}\n empty={isEmpty(title)}\n isDragging={isDragging}\n isSelected={isSelected}\n disabled={disabled}\n type={type}\n />\n </AnswerContainer>\n );\n }\n}\n\nfunction DragAndDropAnswer(props) {\n const {\n id,\n instanceId,\n promptId,\n draggable = true,\n disabled = false,\n type,\n selectedAnswer,\n onSelectClick,\n onPlacementClick,\n } = props;\n\n const dragId = `${type || 'answer'}-${id}`;\n // droppable only if promptId exists\n const dropId = promptId !== undefined && promptId !== null ? `drop-${promptId}` : undefined;\n\n // Built once and reused for both dnd-kit's own data and the click handlers below, so\n // a click carries exactly the same shape dnd-kit's onDragStart/onDragEnd would.\n const activeData = {\n type: type || 'answer',\n id,\n instanceId,\n value: props.title,\n promptId,\n };\n const dropZoneData = dropId\n ? {\n type: 'drop-zone',\n promptId,\n instanceId,\n }\n : undefined;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n transition,\n isDragging,\n } = useDraggable({\n id: dragId,\n data: activeData,\n disabled: !draggable || disabled,\n // dnd-kit's own `attributes` default tabIndex to 0 unconditionally, even when\n // `disabled` — so a non-draggable (empty) tile stays a native Tab stop of its own.\n // For a drop-zone (dropId set), that duplicates the outer wrapper's own tab stop\n // (see isNativeTabStop below) at the exact same position, so Tab/Shift+Tab has to\n // pass through both to move anywhere visibly, making every other press look like a\n // no-op. Drop it out of the tab order here whenever it isn't independently\n // reachable/interactive, leaving the outer wrapper (for an empty drop-zone) or\n // nothing (for a disabled choice) as the sole stop.\n attributes: { tabIndex: draggable && !disabled ? 0 : -1 },\n });\n\n const droppable = useDroppable({\n id: dropId,\n data: dropZoneData,\n disabled: disabled || !dropId,\n });\n\n const setDropRef = droppable.setNodeRef;\n const isOver = droppable.isOver;\n\n // dnd-kit's own isOver only reflects real collision detection during an active drag,\n // so it stays false while an answer is merely click-selected (no drag in progress).\n // Track hovering locally and fold it into the same isOver signal used everywhere\n // below, so hovering a response area while something is selected gets the exact same\n // treatment as hovering it during a real drag — one code path, no duplicated CSS.\n const [isHovered, setIsHovered] = useState(false);\n const hasSelection = !!selectedAnswer;\n const showsHoverEffect = isOver || (hasSelection && isHovered && !disabled);\n\n const isSelected =\n !!selectedAnswer &&\n selectedAnswer.type === activeData.type &&\n selectedAnswer.id === activeData.id &&\n selectedAnswer.promptId === activeData.promptId;\n\n // compute style: apply transform to the element that actually moves\n const transformStyle = transform ? `translate3d(${transform.x}px, ${transform.y}px, 0)` : undefined;\n\n // If this item is a drop-zone (prompt slot), we render an outer droppable wrapper.\n // The outer wrapper's rect is what dnd-kit measures for this slot's own droppable\n // (\"drop-{promptId}\"), so it must stay untransformed — applying the drag transform\n // there would make the slot's own droppable rect chase the dragged item during the\n // drag, corrupting collision/keyboard-navigation results. The transform belongs on\n // the inner draggable node instead.\n if (dropId) {\n const handleResponseAreaClick = () => {\n if (disabled) return;\n\n if (isSelected) {\n // Clicking the already-selected placed answer again deselects it, same as\n // for a choice in the pool.\n onSelectClick?.(activeData);\n } else if (selectedAnswer) {\n // Something else is selected — place it here, same whether this area is\n // currently empty or already occupied.\n onPlacementClick?.(dropZoneData);\n } else if (draggable) {\n // Nothing selected yet, and this response area holds an answer — clicking it\n // selects that answer for moving elsewhere, the same way Tab+Space/Enter does.\n onSelectClick?.(activeData);\n }\n\n // Empty response area clicked with nothing selected: nothing to place or select.\n };\n\n // An empty response area isn't draggable, so dnd-kit's own attributes (only\n // applied to the inner node, and only when draggable) never make it tabbable —\n // this outer wrapper needs its own focus/activation handling so \"select a choice,\n // then Tab to a response area and press Space/Enter\" works even when the area is\n // empty. This is independent of, and doesn't change, the existing in-drag\n // Tab-cycling (that's driven by an active dnd-kit drag, not native focus).\n //\n // Only made a native Tab stop when NOT draggable (i.e. empty): when the target is\n // filled, the inner node is already independently tabbable via dnd-kit's own\n // attributes for the existing pick-up-to-move gesture, and adding a second,\n // outer Tab stop for the same visual tile would add an extra stop to the existing\n // Tab order. Placing into an occupied area is still fully reachable by mouse click\n // here, or by the existing keyboard drag flow (Tab+Space/Enter on the choice,\n // Tab-cycle to the occupied target, Space/Enter to swap).\n const isNativeTabStop = !draggable && !disabled;\n\n const handleResponseAreaKeyDown = (e) => {\n if (e.code === 'Space' || e.code === 'Enter') {\n e.preventDefault();\n handleResponseAreaClick();\n }\n };\n\n return (\n <div\n ref={setDropRef}\n role=\"button\"\n tabIndex={isNativeTabStop ? 0 : -1}\n onClick={handleResponseAreaClick}\n onKeyDown={isNativeTabStop ? handleResponseAreaKeyDown : undefined}\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n style={{\n flex: 1,\n opacity: isDragging || isSelected ? 0.5 : 1,\n backgroundColor: isDragging || isSelected || showsHoverEffect ? 'rgba(0,0,0,0.05)' : 'transparent',\n cursor: hasSelection && !disabled ? 'pointer' : undefined,\n }}\n >\n <div ref={setDragRef} {...listeners} {...attributes} style={{ transform: transformStyle, transition }}>\n <Answer {...props} isDragging={isDragging} isSelected={isSelected} isOver={showsHoverEffect} />\n </div>\n </div>\n );\n }\n\n const handleChoiceClick = (e) => {\n if (disabled) {\n return;\n }\n\n e.stopPropagation();\n onSelectClick?.(activeData);\n };\n\n // if there is NO dropId (this is a choice / draggable-only), render only draggable node and apply transform to it.\n return (\n <div\n ref={setDragRef}\n {...listeners}\n {...attributes}\n onClick={handleChoiceClick}\n style={{\n transform: transformStyle,\n transition,\n cursor: disabled ? 'not-allowed' : 'grab',\n opacity: isDragging || isSelected ? 0.5 : 1,\n touchAction: draggable && !disabled ? 'none' : 'auto',\n }}\n >\n <Answer {...props} isDragging={isDragging} isSelected={isSelected} isOver={false} />\n </div>\n );\n}\n\nDragAndDropAnswer.propTypes = {\n id: PropTypes.any,\n instanceId: PropTypes.string,\n promptId: PropTypes.any,\n title: PropTypes.string,\n draggable: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n selectedAnswer: PropTypes.object,\n onSelectClick: PropTypes.func,\n onPlacementClick: PropTypes.func,\n};\n\nexport default DragAndDropAnswer;\n"],"mappings":";;;;;;;;;AAAA,IAA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,aAAa,EAAEzD,kBAAS,CAACmG,IAAI;EAC7BzC,gBAAgB,EAAE1D,kBAAS,CAACmG;AAC9B,CAAC;AAAC,IAAAC,QAAA,GAAAlD,OAAA,CAAAtF,OAAA,GAEawF,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"answer.js","names":["_core","require","_propTypes","_interopRequireDefault","_react","_debug","_styles","_drag","_lodashEs","_renderUi","log","debug","HolderNumber","styled","theme","width","fontSize","textAlign","color","palette","common","black","Holder","index","isOver","disabled","type","default","createElement","PlaceHolder","extraStyles","display","padding","alignItems","justifyContent","height","undefined","propTypes","PropTypes","number","bool","string","AnswerContentContainer","isDragging","outcome","text","backgroundColor","white","border","correct","incorrect","grey","cursor","boxSizing","overflow","transition","wordBreak","opacity","touchAction","AnswerContent","props","title","empty","guideIndex","dangerouslySetInnerHTML","__html","AnswerContainer","minHeight","minWidth","margin","spacing","Answer","React","Component","constructor","args","_defineProperty2","e","componentDidMount","ref","addEventListener","handleTouchStart","passive","componentWillUnmount","removeEventListener","render","id","className","isEmpty","exports","any","DragAndDropAnswer","instanceId","promptId","draggable","dragId","dropId","attributes","listeners","setNodeRef","setDragRef","transform","useDraggable","data","value","droppable","useDroppable","setDropRef","transformStyle","x","y","style","flex","_extends2","_default"],"sources":["../src/answer.jsx"],"sourcesContent":["import { useDraggable, useDroppable } from '@dnd-kit/core';\nimport PropTypes from 'prop-types';\nimport React from 'react';\nimport debug from 'debug';\nimport { styled } from '@mui/material/styles';\nimport { PlaceHolder } from '@pie-lib/drag';\nimport { isEmpty } from 'lodash-es';\nimport { color } from '@pie-lib/render-ui';\n\nconst log = debug('pie-elements:match-title:answer');\n\nconst HolderNumber = styled('div')(({ theme }) => ({\n width: '100%',\n fontSize: '18px',\n textAlign: 'center',\n color: `rgba(${theme.palette.common.black}, 0.6)`,\n}));\n\nconst Holder = ({ index, isOver, disabled, type }) => (\n <PlaceHolder\n extraStyles={{\n display: 'flex',\n padding: '0',\n alignItems: 'center',\n justifyContent: 'center',\n height: '40px',\n }}\n disabled={disabled}\n isOver={isOver}\n type={type}\n >\n {index !== undefined && <HolderNumber>{index}</HolderNumber>}\n </PlaceHolder>\n);\n\nHolder.propTypes = {\n index: PropTypes.number,\n isOver: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n};\n\nconst AnswerContentContainer = styled('div')(({ theme, isDragging, isOver, disabled, outcome }) => ({\n color: color.text(),\n backgroundColor: color.white(),\n border: `1px solid ${outcome === 'correct' ? color.correct() :\n outcome === 'incorrect' ? color.incorrect() :\n theme.palette.grey[400]\n }`,\n cursor: disabled ? 'not-allowed' : 'pointer',\n width: '100%',\n padding: '10px',\n boxSizing: 'border-box',\n overflow: 'hidden',\n transition: 'opacity 200ms linear',\n wordBreak: 'break-word',\n opacity: isDragging && !disabled ? 0.5 : isOver && !disabled ? 0.2 : 1,\n touchAction: 'none'\n}));\n\nconst AnswerContent = (props) => {\n const { isDragging, isOver, title, disabled, empty, outcome, guideIndex, type } = props;\n\n if (empty) {\n return <Holder\n index={guideIndex}\n isOver={isOver}\n disabled={disabled}\n type={type}\n\n />;\n } else {\n return (\n <AnswerContentContainer\n isDragging={isDragging}\n isOver={isOver}\n disabled={disabled}\n outcome={outcome}\n dangerouslySetInnerHTML={{ __html: title }}\n />\n );\n }\n};\n\nconst AnswerContainer = styled('div')(({ correct, theme }) => ({\n boxSizing: 'border-box',\n minHeight: 40,\n minWidth: '200px',\n overflow: 'hidden',\n margin: theme.spacing(0.5),\n padding: '0px',\n textAlign: 'center',\n height: 'initial',\n border: correct === true ? `1px solid var(--feedback-correct-bg-color, ${color.correct()})` :\n correct === false ? `1px solid var(--feedback-incorrect-bg-color, ${color.incorrect()})` :\n 'none',\n}));\n\nexport class Answer extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n isDragging: PropTypes.bool,\n id: PropTypes.any,\n title: PropTypes.string,\n isOver: PropTypes.bool,\n empty: PropTypes.bool,\n type: PropTypes.string,\n disabled: PropTypes.bool,\n correct: PropTypes.bool,\n };\n\n componentDidMount() {\n if (this.ref) {\n // NOTE: preventing default on touchstart can block dnd-kit pointer handling on some devices.\n // Consider removing this if you have issues on touch devices.\n this.ref.addEventListener('touchstart', this.handleTouchStart, { passive: true });\n }\n }\n\n componentWillUnmount() {\n if (this.ref) {\n this.ref.removeEventListener('touchstart', this.handleTouchStart);\n }\n }\n\n handleTouchStart = (e) => {\n // do NOT call e.preventDefault() here — it prevents pointer events necessary for dnd-kit.\n // Keep this handler empty or remove it if you don't need it.\n // e.preventDefault();\n };\n\n render() {\n const {\n id,\n title,\n isDragging = false,\n className,\n disabled,\n isOver = false,\n type,\n correct,\n } = this.props;\n\n log('[render], props: ', this.props);\n\n return (\n <AnswerContainer correct={correct} className={className} ref={(ref) => (this.ref = ref)}>\n <AnswerContent\n title={title}\n id={id}\n isOver={isOver}\n empty={isEmpty(title)}\n isDragging={isDragging}\n disabled={disabled}\n type={type}\n />\n </AnswerContainer>\n );\n }\n}\n\nfunction DragAndDropAnswer(props) {\n const { id, instanceId, promptId, draggable = true, disabled = false, type } = props;\n\n const dragId = `${type || 'answer'}-${id}`;\n // droppable only if promptId exists\n const dropId = promptId !== undefined && promptId !== null ? `drop-${promptId}` : undefined;\n\n const {\n attributes,\n listeners,\n setNodeRef: setDragRef,\n transform,\n transition,\n isDragging,\n } = useDraggable({\n id: dragId,\n data: {\n type: type || 'answer',\n id,\n instanceId,\n value: props.title,\n promptId,\n },\n disabled: !draggable || disabled,\n });\n\n const droppable = useDroppable({\n id: dropId,\n data: dropId ? { type: 'drop-zone', promptId, instanceId } : undefined,\n disabled: disabled || !dropId,\n });\n\n const setDropRef = droppable.setNodeRef;\n const isOver = droppable.isOver;\n\n // compute style: apply transform to the element that actually moves\n const transformStyle = transform\n ? `translate3d(${transform.x}px, ${transform.y}px, 0)`\n : undefined;\n\n // If this item is a drop-zone (prompt slot), we render an outer droppable wrapper.\n // For droppable wrapper we apply style to the outer wrapper\n if (dropId) {\n return (\n <div\n ref={setDropRef}\n style={{\n flex: 1,\n transform: transformStyle,\n transition,\n opacity: isDragging ? 0.5 : 1,\n backgroundColor: isOver ? 'rgba(0,0,0,0.05)' : 'transparent',\n }}\n >\n <div ref={setDragRef} {...listeners} {...attributes}>\n <Answer {...props} isDragging={isDragging} isOver={isOver} />\n </div>\n </div>\n );\n }\n\n // if there is NO dropId (this is a choice / draggable-only), render only draggable node and apply transform to it.\n return (\n <div\n ref={setDragRef}\n {...listeners}\n {...attributes}\n style={{\n transform: transformStyle,\n transition,\n cursor: disabled ? 'not-allowed' : 'grab',\n opacity: isDragging ? 0.5 : 1,\n touchAction: draggable && !disabled ? 'none' : 'auto',\n }}\n >\n <Answer {...props} isDragging={isDragging} isOver={false} />\n </div>\n );\n}\n\nDragAndDropAnswer.propTypes = {\n id: PropTypes.any,\n instanceId: PropTypes.string,\n promptId: PropTypes.any,\n title: PropTypes.string,\n draggable: PropTypes.bool,\n disabled: PropTypes.bool,\n type: PropTypes.string,\n};\n\nexport default DragAndDropAnswer;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAEA,MAAMS,GAAG,GAAG,IAAAC,cAAK,EAAC,iCAAiC,CAAC;AAEpD,MAAMC,YAAY,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACjDC,KAAK,EAAE,MAAM;EACbC,QAAQ,EAAE,MAAM;EAChBC,SAAS,EAAE,QAAQ;EACnBC,KAAK,EAAE,QAAQJ,KAAK,CAACK,OAAO,CAAC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ANGED
|
@@ -10,19 +10,16 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
12
12
|
var _styles = require("@mui/material/styles");
|
|
13
|
-
var _renderUi = require("@pie-lib/render-ui");
|
|
14
13
|
const ArrowContainer = (0, _styles.styled)('div')({
|
|
15
14
|
display: 'inline-block',
|
|
16
15
|
position: 'relative',
|
|
17
16
|
width: '100%'
|
|
18
17
|
});
|
|
19
|
-
|
|
20
|
-
// A 1px rule joining a prompt to its answer: it is the connector, so it needs to
|
|
21
|
-
// stay perceivable on every scheme's surface.
|
|
22
18
|
const Line = (0, _styles.styled)('span')(({
|
|
19
|
+
theme,
|
|
23
20
|
isRight
|
|
24
21
|
}) => ({
|
|
25
|
-
backgroundColor:
|
|
22
|
+
backgroundColor: theme.palette.grey[500],
|
|
26
23
|
bottom: isRight ? 20 : 19,
|
|
27
24
|
content: '""',
|
|
28
25
|
display: 'block',
|
|
@@ -44,9 +41,7 @@ class Arrow extends _react.default.Component {
|
|
|
44
41
|
}, /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, {
|
|
45
42
|
style: {
|
|
46
43
|
transform: 'rotate(90deg)',
|
|
47
|
-
|
|
48
|
-
// step together, or the arrow loses its point on a dark scheme.
|
|
49
|
-
color: _renderUi.color.border(),
|
|
44
|
+
color: '#979797',
|
|
50
45
|
fontSize: 40
|
|
51
46
|
}
|
|
52
47
|
}), /*#__PURE__*/_react.default.createElement(Line, {
|
package/lib/arrow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow.js","names":["_react","_interopRequireDefault","require","_propTypes","_ArrowDropDown","_styles","
|
|
1
|
+
{"version":3,"file":"arrow.js","names":["_react","_interopRequireDefault","require","_propTypes","_ArrowDropDown","_styles","ArrowContainer","styled","display","position","width","Line","theme","isRight","backgroundColor","palette","grey","bottom","content","height","left","Arrow","React","Component","render","direction","props","extraStyle","transform","default","createElement","style","color","fontSize","exports","_defineProperty2","PropTypes","string","_default"],"sources":["../src/arrow.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport ArrowHead from '@mui/icons-material/ArrowDropDown';\nimport { styled } from '@mui/material/styles';\n\nconst ArrowContainer = styled('div')({\n display: 'inline-block',\n position: 'relative',\n width: '100%',\n});\n\nconst Line = styled('span')(({ theme, isRight }) => ({\n backgroundColor: theme.palette.grey[500],\n bottom: isRight ? 20 : 19,\n content: '\"\"',\n display: 'block',\n height: 1,\n left: 20,\n position: 'absolute',\n width: '100%',\n}));\n\nexport class Arrow extends React.Component {\n static propTypes = {\n direction: PropTypes.string,\n };\n\n render() {\n const { direction } = this.props;\n\n const extraStyle =\n direction === 'left'\n ? {}\n : {\n transform: 'rotate(180deg)',\n };\n\n return (\n <ArrowContainer style={extraStyle}>\n <ArrowHead\n style={{\n transform: 'rotate(90deg)',\n color: '#979797',\n fontSize: 40,\n }}\n />\n <Line isRight={direction !== 'left'} />\n </ArrowContainer>\n );\n }\n}\n\nexport default Arrow;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,cAAc,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EACnCC,OAAO,EAAE,cAAc;EACvBC,QAAQ,EAAE,UAAU;EACpBC,KAAK,EAAE;AACT,CAAC,CAAC;AAEF,MAAMC,IAAI,GAAG,IAAAJ,cAAM,EAAC,MAAM,CAAC,CAAC,CAAC;EAAEK,KAAK;EAAEC;AAAQ,CAAC,MAAM;EACnDC,eAAe,EAAEF,KAAK,CAACG,OAAO,CAACC,IAAI,CAAC,GAAG,CAAC;EACxCC,MAAM,EAAEJ,OAAO,GAAG,EAAE,GAAG,EAAE;EACzBK,OAAO,EAAE,IAAI;EACbV,OAAO,EAAE,OAAO;EAChBW,MAAM,EAAE,CAAC;EACTC,IAAI,EAAE,EAAE;EACRX,QAAQ,EAAE,UAAU;EACpBC,KAAK,EAAE;AACT,CAAC,CAAC,CAAC;AAEI,MAAMW,KAAK,SAASC,cAAK,CAACC,SAAS,CAAC;EAKzCC,MAAMA,CAAA,EAAG;IACP,MAAM;MAAEC;IAAU,CAAC,GAAG,IAAI,CAACC,KAAK;IAEhC,MAAMC,UAAU,GACdF,SAAS,KAAK,MAAM,GAChB,CAAC,CAAC,GACF;MACEG,SAAS,EAAE;IACb,CAAC;IAEP,oBACE5B,MAAA,CAAA6B,OAAA,CAAAC,aAAA,CAACxB,cAAc;MAACyB,KAAK,EAAEJ;IAAW,gBAChC3B,MAAA,CAAA6B,OAAA,CAAAC,aAAA,CAAC1B,cAAA,CAAAyB,OAAS;MACRE,KAAK,EAAE;QACLH,SAAS,EAAE,eAAe;QAC1BI,KAAK,EAAE,SAAS;QAChBC,QAAQ,EAAE;MACZ;IAAE,CACH,CAAC,eACFjC,MAAA,CAAA6B,OAAA,CAAAC,aAAA,CAACnB,IAAI;MAACE,OAAO,EAAEY,SAAS,KAAK;IAAO,CAAE,CACxB,CAAC;EAErB;AACF;AAACS,OAAA,CAAAb,KAAA,GAAAA,KAAA;AAAA,IAAAc,gBAAA,CAAAN,OAAA,EA5BYR,KAAK,eACG;EACjBI,SAAS,EAAEW,kBAAS,CAACC;AACvB,CAAC;AAAA,IAAAC,QAAA,GAAAJ,OAAA,CAAAL,OAAA,GA2BYR,KAAK","ignoreList":[]}
|
package/lib/choices-list.js
CHANGED
|
@@ -25,10 +25,7 @@ class ChoicesList extends _react.default.Component {
|
|
|
25
25
|
disabled,
|
|
26
26
|
session,
|
|
27
27
|
instanceId,
|
|
28
|
-
onRemoveAnswer
|
|
29
|
-
selectedAnswer,
|
|
30
|
-
onChoiceClick,
|
|
31
|
-
onPlacementClick
|
|
28
|
+
onRemoveAnswer
|
|
32
29
|
} = this.props;
|
|
33
30
|
const {
|
|
34
31
|
config
|
|
@@ -42,15 +39,12 @@ class ChoicesList extends _react.default.Component {
|
|
|
42
39
|
draggable: true,
|
|
43
40
|
disabled: disabled,
|
|
44
41
|
session: session,
|
|
45
|
-
type: "choice"
|
|
46
|
-
selectedAnswer: selectedAnswer,
|
|
47
|
-
onSelectClick: onChoiceClick
|
|
42
|
+
type: "choice"
|
|
48
43
|
}, answer)));
|
|
49
44
|
return /*#__PURE__*/_react.default.createElement(ChoicesContainer, null, /*#__PURE__*/_react.default.createElement(_droppablePlaceholder.DroppablePlaceholder, {
|
|
50
45
|
id: "choices-pool",
|
|
51
46
|
disabled: disabled,
|
|
52
|
-
onRemoveAnswer: onRemoveAnswer
|
|
53
|
-
onPlacementClick: onPlacementClick
|
|
47
|
+
onRemoveAnswer: onRemoveAnswer
|
|
54
48
|
}, filteredAnswers));
|
|
55
49
|
}
|
|
56
50
|
}
|
|
@@ -60,10 +54,7 @@ exports.ChoicesList = ChoicesList;
|
|
|
60
54
|
instanceId: _propTypes.default.string.isRequired,
|
|
61
55
|
model: _propTypes.default.object.isRequired,
|
|
62
56
|
disabled: _propTypes.default.bool.isRequired,
|
|
63
|
-
onRemoveAnswer: _propTypes.default.func
|
|
64
|
-
selectedAnswer: _propTypes.default.object,
|
|
65
|
-
onChoiceClick: _propTypes.default.func,
|
|
66
|
-
onPlacementClick: _propTypes.default.func
|
|
57
|
+
onRemoveAnswer: _propTypes.default.func
|
|
67
58
|
});
|
|
68
59
|
var _default = exports.default = ChoicesList;
|
|
69
60
|
//# sourceMappingURL=choices-list.js.map
|
package/lib/choices-list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choices-list.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_lodashEs","_answer","_droppablePlaceholder","ChoicesContainer","styled","theme","marginBottom","spacing","ChoicesList","React","Component","render","model","disabled","session","instanceId","onRemoveAnswer","
|
|
1
|
+
{"version":3,"file":"choices-list.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_lodashEs","_answer","_droppablePlaceholder","ChoicesContainer","styled","theme","marginBottom","spacing","ChoicesList","React","Component","render","model","disabled","session","instanceId","onRemoveAnswer","props","config","duplicates","filteredAnswers","answers","filter","answer","isEmpty","value","isUndefined","find","val","id","map","default","createElement","_extends2","key","draggable","type","DroppablePlaceholder","exports","_defineProperty2","PropTypes","object","isRequired","string","bool","func","_default"],"sources":["../src/choices-list.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { find, isEmpty, isUndefined } from 'lodash-es';\nimport DragAndDropAnswer from './answer';\nimport { DroppablePlaceholder } from './droppable-placeholder';\n\nconst ChoicesContainer = styled('div')(({ theme }) => ({\n marginBottom: theme.spacing(2),\n}));\n\nexport class ChoicesList extends React.Component {\n static propTypes = {\n session: PropTypes.object.isRequired,\n instanceId: PropTypes.string.isRequired,\n model: PropTypes.object.isRequired,\n disabled: PropTypes.bool.isRequired,\n onRemoveAnswer: PropTypes.func,\n };\n\n render() {\n const { model, disabled, session, instanceId, onRemoveAnswer } = this.props;\n const { config } = model;\n const { duplicates } = config;\n\n const filteredAnswers = config.answers\n .filter(\n (answer) =>\n duplicates ||\n isEmpty(session) ||\n !session.value ||\n isUndefined(find(session.value, (val) => val === answer.id)),\n )\n .map((answer) => (\n <DragAndDropAnswer\n key={answer.id}\n instanceId={instanceId}\n draggable={true}\n disabled={disabled}\n session={session}\n type=\"choice\"\n {...answer}\n />\n ));\n\n return (\n <ChoicesContainer>\n <DroppablePlaceholder id=\"choices-pool\" disabled={disabled} onRemoveAnswer={onRemoveAnswer}>\n {filteredAnswers}\n </DroppablePlaceholder>\n </ChoicesContainer>\n );\n }\n}\n\nexport default ChoicesList;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,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b,MAAM,CACX,CACF,CAAC;IAEJ,oBACE5B,MAAA,CAAAoC,OAAA,CAAAC,aAAA,CAAC7B,gBAAgB,qBACfR,MAAA,CAAAoC,OAAA,CAAAC,aAAA,CAAC9B,qBAAA,CAAAmC,oBAAoB;MAACR,EAAE,EAAC,cAAc;MAAChB,QAAQ,EAAEA,QAAS;MAACG,cAAc,EAAEA;IAAe,GACxFI,eACmB,CACN,CAAC;EAEvB;AACF;AAACkB,OAAA,CAAA9B,WAAA,GAAAA,WAAA;AAAA,IAAA+B,gBAAA,CAAAR,OAAA,EA1CYvB,WAAW,eACH;EACjBM,OAAO,EAAE0B,kBAAS,CAACC,MAAM,CAACC,UAAU;EACpC3B,UAAU,EAAEyB,kBAAS,CAACG,MAAM,CAACD,UAAU;EACvC9B,KAAK,EAAE4B,kBAAS,CAACC,MAAM,CAACC,UAAU;EAClC7B,QAAQ,EAAE2B,kBAAS,CAACI,IAAI,CAACF,UAAU;EACnC1B,cAAc,EAAEwB,kBAAS,CAACK;AAC5B,CAAC;AAAA,IAAAC,QAAA,GAAAR,OAAA,CAAAP,OAAA,GAqCYvB,WAAW","ignoreList":[]}
|
|
@@ -29,7 +29,6 @@ function DroppablePlaceholder({
|
|
|
29
29
|
id,
|
|
30
30
|
disabled,
|
|
31
31
|
children,
|
|
32
|
-
onPlacementClick,
|
|
33
32
|
...rest
|
|
34
33
|
}) {
|
|
35
34
|
const {
|
|
@@ -42,17 +41,8 @@ function DroppablePlaceholder({
|
|
|
42
41
|
},
|
|
43
42
|
disabled
|
|
44
43
|
});
|
|
45
|
-
const handleClick = () => {
|
|
46
|
-
if (disabled) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
onPlacementClick?.({
|
|
50
|
-
type: 'choices-pool'
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
44
|
return /*#__PURE__*/_react.default.createElement(Container, (0, _extends2.default)({
|
|
54
45
|
ref: setNodeRef,
|
|
55
|
-
onClick: handleClick,
|
|
56
46
|
style: {
|
|
57
47
|
backgroundColor: isOver ? 'rgba(0,0,0,0.05)' : 'transparent'
|
|
58
48
|
}
|
|
@@ -64,8 +54,7 @@ function DroppablePlaceholder({
|
|
|
64
54
|
DroppablePlaceholder.propTypes = {
|
|
65
55
|
id: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
66
56
|
disabled: _propTypes.default.bool,
|
|
67
|
-
children: _propTypes.default.node
|
|
68
|
-
onPlacementClick: _propTypes.default.func
|
|
57
|
+
children: _propTypes.default.node
|
|
69
58
|
};
|
|
70
59
|
var _default = exports.default = DroppablePlaceholder;
|
|
71
60
|
//# sourceMappingURL=droppable-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"droppable-placeholder.js","names":["_react","_interopRequireDefault","require","_propTypes","_core","_styles","_drag","Container","styled","theme","alignItems","display","flexDirection","flexWrap","justifyContent","marginTop","spacing","marginBottom","minHeight","transition","DroppablePlaceholder","id","disabled","children","
|
|
1
|
+
{"version":3,"file":"droppable-placeholder.js","names":["_react","_interopRequireDefault","require","_propTypes","_core","_styles","_drag","Container","styled","theme","alignItems","display","flexDirection","flexWrap","justifyContent","marginTop","spacing","marginBottom","minHeight","transition","DroppablePlaceholder","id","disabled","children","rest","setNodeRef","isOver","useDroppable","data","type","default","createElement","_extends2","ref","style","backgroundColor","MatchDroppablePlaceholder","propTypes","PropTypes","oneOfType","string","number","bool","node","_default","exports"],"sources":["../src/droppable-placeholder.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useDroppable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\nimport { MatchDroppablePlaceholder } from '@pie-lib/drag';\n\nconst Container = styled('div')(({ theme }) => ({\n alignItems: 'center',\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'space-between',\n marginTop: theme.spacing(1),\n marginBottom: theme.spacing(1),\n minHeight: 50,\n transition: 'background-color 200ms ease',\n}));\n\nexport function DroppablePlaceholder({ id, disabled, children, ...rest }) {\n const { setNodeRef, isOver } = useDroppable({\n id: id || 'choices-pool',\n data: { type: 'choices-pool' },\n disabled,\n });\n\n return (\n <Container\n ref={setNodeRef}\n style={{ backgroundColor: isOver ? 'rgba(0,0,0,0.05)' : 'transparent' }}\n {...rest}\n >\n <MatchDroppablePlaceholder id={id} disabled={disabled}>\n {children}\n </MatchDroppablePlaceholder>\n </Container>\n );\n}\n\nDroppablePlaceholder.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n children: PropTypes.node,\n};\n\nexport default DroppablePlaceholder;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,MAAMK,SAAS,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EAC5CC,UAAU,EAAE,QAAQ;EACpBC,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE,KAAK;EACpBC,QAAQ,EAAE,MAAM;EAChBC,cAAc,EAAE,eAAe;EAC/BC,SAAS,EAAEN,KAAK,CAACO,OAAO,CAAC,CAAC,CAAC;EAC3BC,YAAY,EAAER,KAAK,CAACO,OAAO,CAAC,CAAC,CAAC;EAC9BE,SAAS,EAAE,EAAE;EACbC,UAAU,EAAE;AAChB,CAAC,CAAC,CAAC;AAEI,SAASC,oBAAoBA,CAAC;EAAEC,EAAE;EAAEC,QAAQ;EAAEC,QAAQ;EAAE,GAAGC;AAAK,CAAC,EAAE;EACtE,MAAM;IAAEC,UAAU;IAAEC;EAAO,CAAC,GAAG,IAAAC,kBAAY,EAAC;IACxCN,EAAE,EAAEA,EAAE,IAAI,cAAc;I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