@pie-element/image-cloze-association 10.1.2-next.2 → 10.1.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/CHANGELOG.json +437 -0
- package/CHANGELOG.md +1997 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +197 -0
- package/configure/CHANGELOG.md +1600 -0
- package/configure/lib/defaults.js +86 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +99 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/root.js +135 -0
- package/configure/lib/root.js.map +1 -0
- package/configure/package.json +23 -0
- package/configure/src/__tests__/index.test.js +155 -0
- package/configure/src/defaults.js +59 -0
- package/configure/src/index.js +114 -0
- package/configure/src/root.jsx +116 -0
- package/controller/CHANGELOG.json +137 -0
- package/controller/CHANGELOG.md +1149 -0
- package/controller/lib/defaults.js +14 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +304 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +70 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +19 -0
- package/controller/src/__tests__/index.test.js +711 -0
- package/controller/src/defaults.js +7 -0
- package/controller/src/index.js +322 -0
- package/controller/src/utils.js +72 -0
- package/docs/config-schema.json +1382 -0
- package/docs/config-schema.json.md +1021 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +74 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +16 -0
- package/docs/pie-schema.json +1085 -0
- package/docs/pie-schema.json.md +810 -0
- package/lib/constants.js +12 -0
- package/lib/constants.js.map +1 -0
- package/lib/evaluation-icon.js +60 -0
- package/lib/evaluation-icon.js.map +1 -0
- package/lib/image-container.js +94 -0
- package/lib/image-container.js.map +1 -0
- package/lib/image-drop-target.js +130 -0
- package/lib/image-drop-target.js.map +1 -0
- package/lib/index.js +220 -0
- package/lib/index.js.map +1 -0
- package/lib/interactive-section.js +104 -0
- package/lib/interactive-section.js.map +1 -0
- package/lib/possible-response.js +161 -0
- package/lib/possible-response.js.map +1 -0
- package/lib/possible-responses.js +58 -0
- package/lib/possible-responses.js.map +1 -0
- package/lib/root.js +491 -0
- package/lib/root.js.map +1 -0
- package/lib/static-html-span.js +35 -0
- package/lib/static-html-span.js.map +1 -0
- package/lib/utils-correctness.js +89 -0
- package/lib/utils-correctness.js.map +1 -0
- package/package.json +21 -86
- package/src/__tests__/index.test.js +174 -0
- package/src/__tests__/root.test.jsx +99 -0
- package/src/__tests__/utils.test.js +207 -0
- package/src/constants.js +5 -0
- package/src/evaluation-icon.jsx +54 -0
- package/src/image-container.jsx +90 -0
- package/src/image-drop-target.jsx +140 -0
- package/src/index.js +245 -0
- package/src/interactive-section.jsx +94 -0
- package/src/possible-response.jsx +152 -0
- package/src/possible-responses.jsx +52 -0
- package/src/root.jsx +490 -0
- package/src/static-html-span.jsx +30 -0
- package/src/utils-correctness.js +95 -0
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/defaults.d.ts +0 -88
- package/dist/author/defaults.js +0 -58
- package/dist/author/index.d.ts +0 -34
- package/dist/author/index.js +0 -71
- package/dist/author/root.d.ts +0 -14
- package/dist/author/root.js +0 -80
- package/dist/browser/Check-DL1c-mLM.js +0 -10708
- package/dist/browser/Check-DL1c-mLM.js.map +0 -1
- package/dist/browser/author/index.js +0 -38597
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/controller/index.js +0 -171
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -2699
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-BphSS14E.js +0 -346
- package/dist/browser/dist-BphSS14E.js.map +0 -1
- package/dist/browser/humps-CZ4RCLab.js +0 -67
- package/dist/browser/humps-CZ4RCLab.js.map +0 -1
- package/dist/browser/image-cloze-association.css +0 -2
- package/dist/controller/defaults.d.ts +0 -16
- package/dist/controller/defaults.js +0 -10
- package/dist/controller/index.d.ts +0 -23
- package/dist/controller/index.js +0 -122
- package/dist/controller/utils.d.ts +0 -14
- package/dist/controller/utils.js +0 -36
- package/dist/delivery/constants.d.ts +0 -14
- package/dist/delivery/evaluation-icon.d.ts +0 -28
- package/dist/delivery/evaluation-icon.js +0 -38
- package/dist/delivery/image-container.d.ts +0 -13
- package/dist/delivery/image-container.js +0 -61
- package/dist/delivery/image-drop-target.d.ts +0 -45
- package/dist/delivery/image-drop-target.js +0 -90
- package/dist/delivery/index.d.ts +0 -20
- package/dist/delivery/index.js +0 -110
- package/dist/delivery/interactive-section.d.ts +0 -15
- package/dist/delivery/interactive-section.js +0 -72
- package/dist/delivery/possible-response.d.ts +0 -34
- package/dist/delivery/possible-response.js +0 -100
- package/dist/delivery/possible-responses.d.ts +0 -31
- package/dist/delivery/possible-responses.js +0 -41
- package/dist/delivery/root.d.ts +0 -21
- package/dist/delivery/root.js +0 -278
- package/dist/delivery/static-html-span.d.ts +0 -14
- package/dist/delivery/static-html-span.js +0 -22
- package/dist/delivery/utils-correctness.d.ts +0 -10
- package/dist/delivery/utils-correctness.js +0 -43
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -152
- package/dist/index.js +0 -2
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +0 -16
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
12
|
+
var _evaluationIcon = _interopRequireDefault(require("./evaluation-icon"));
|
|
13
|
+
const StyledContainer = (0, _styles.styled)('div')(({
|
|
14
|
+
theme
|
|
15
|
+
}) => ({
|
|
16
|
+
marginTop: theme.spacing(2),
|
|
17
|
+
display: 'flex',
|
|
18
|
+
width: 'fit-content',
|
|
19
|
+
'&.default': {
|
|
20
|
+
border: `1px solid ${_renderUi.color.disabled()}`
|
|
21
|
+
},
|
|
22
|
+
'&.correct': {
|
|
23
|
+
border: `2px solid ${_renderUi.color.correct()}`
|
|
24
|
+
},
|
|
25
|
+
'&.incorrect': {
|
|
26
|
+
border: `2px solid ${_renderUi.color.incorrect()}`
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
class InteractiveSection extends _react.default.Component {
|
|
30
|
+
getClassname() {
|
|
31
|
+
const {
|
|
32
|
+
responseCorrect
|
|
33
|
+
} = this.props;
|
|
34
|
+
let styleProp;
|
|
35
|
+
switch (responseCorrect) {
|
|
36
|
+
case undefined:
|
|
37
|
+
styleProp = 'default';
|
|
38
|
+
break;
|
|
39
|
+
case true:
|
|
40
|
+
styleProp = 'correct';
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
styleProp = 'incorrect';
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return styleProp;
|
|
47
|
+
}
|
|
48
|
+
getPositionDirection(choicePosition) {
|
|
49
|
+
let flexDirection;
|
|
50
|
+
switch (choicePosition) {
|
|
51
|
+
case 'left':
|
|
52
|
+
flexDirection = 'row-reverse';
|
|
53
|
+
break;
|
|
54
|
+
case 'right':
|
|
55
|
+
flexDirection = 'row';
|
|
56
|
+
break;
|
|
57
|
+
case 'top':
|
|
58
|
+
flexDirection = 'column-reverse';
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
// bottom
|
|
62
|
+
flexDirection = 'column';
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
return flexDirection;
|
|
66
|
+
}
|
|
67
|
+
render() {
|
|
68
|
+
const {
|
|
69
|
+
children,
|
|
70
|
+
responseCorrect,
|
|
71
|
+
uiStyle
|
|
72
|
+
} = this.props;
|
|
73
|
+
const classname = this.getClassname();
|
|
74
|
+
const {
|
|
75
|
+
possibilityListPosition = 'bottom'
|
|
76
|
+
} = uiStyle || {};
|
|
77
|
+
const style = {
|
|
78
|
+
flexDirection: this.getPositionDirection(possibilityListPosition)
|
|
79
|
+
};
|
|
80
|
+
const evaluationStyle = {
|
|
81
|
+
display: 'flex',
|
|
82
|
+
margin: '0 auto',
|
|
83
|
+
marginTop: -14
|
|
84
|
+
};
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(StyledContainer, {
|
|
86
|
+
className: classname,
|
|
87
|
+
style: style
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_evaluationIcon.default, {
|
|
89
|
+
containerStyle: evaluationStyle,
|
|
90
|
+
filled: true,
|
|
91
|
+
isCorrect: responseCorrect
|
|
92
|
+
}), children);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
InteractiveSection.propTypes = {
|
|
96
|
+
children: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.array]).isRequired,
|
|
97
|
+
responseCorrect: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.number]),
|
|
98
|
+
uiStyle: _propTypes.default.object
|
|
99
|
+
};
|
|
100
|
+
InteractiveSection.defaultProps = {
|
|
101
|
+
responseCorrect: undefined
|
|
102
|
+
};
|
|
103
|
+
var _default = exports.default = InteractiveSection;
|
|
104
|
+
//# sourceMappingURL=interactive-section.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactive-section.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_renderUi","_evaluationIcon","StyledContainer","styled","theme","marginTop","spacing","display","width","border","color","disabled","correct","incorrect","InteractiveSection","React","Component","getClassname","responseCorrect","props","styleProp","undefined","getPositionDirection","choicePosition","flexDirection","render","children","uiStyle","classname","possibilityListPosition","style","evaluationStyle","margin","default","createElement","className","containerStyle","filled","isCorrect","propTypes","PropTypes","oneOfType","element","array","isRequired","bool","number","object","defaultProps","_default","exports"],"sources":["../src/interactive-section.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\n\nimport EvaluationIcon from './evaluation-icon';\n\nconst StyledContainer = styled('div')(({ theme }) => ({\n marginTop: theme.spacing(2),\n display: 'flex',\n width: 'fit-content',\n '&.default': {\n border: `1px solid ${color.disabled()}`,\n },\n '&.correct': {\n border: `2px solid ${color.correct()}`,\n },\n '&.incorrect': {\n border: `2px solid ${color.incorrect()}`,\n },\n}));\n\nclass InteractiveSection extends React.Component {\n getClassname() {\n const { responseCorrect } = this.props;\n let styleProp;\n\n switch (responseCorrect) {\n case undefined:\n styleProp = 'default';\n break;\n case true:\n styleProp = 'correct';\n break;\n default:\n styleProp = 'incorrect';\n break;\n }\n return styleProp;\n }\n\n getPositionDirection(choicePosition) {\n let flexDirection;\n\n switch (choicePosition) {\n case 'left':\n flexDirection = 'row-reverse';\n break;\n case 'right':\n flexDirection = 'row';\n break;\n case 'top':\n flexDirection = 'column-reverse';\n break;\n default:\n // bottom\n flexDirection = 'column';\n break;\n }\n\n return flexDirection;\n }\n\n render() {\n const { children, responseCorrect, uiStyle } = this.props;\n const classname = this.getClassname();\n const { possibilityListPosition = 'bottom' } = uiStyle || {};\n const style = { flexDirection: this.getPositionDirection(possibilityListPosition) };\n const evaluationStyle = {\n display: 'flex',\n margin: '0 auto',\n marginTop: -14,\n };\n\n return (\n <StyledContainer className={classname} style={style}>\n <EvaluationIcon containerStyle={evaluationStyle} filled isCorrect={responseCorrect} />\n {children}\n </StyledContainer>\n );\n }\n}\n\nInteractiveSection.propTypes = {\n children: PropTypes.oneOfType([PropTypes.element, PropTypes.array]).isRequired,\n responseCorrect: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),\n uiStyle: PropTypes.object,\n};\n\nInteractiveSection.defaultProps = {\n responseCorrect: undefined,\n};\n\nexport default InteractiveSection;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AAEA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,MAAMK,eAAe,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC,CAAC;EAAEC;AAAM,CAAC,MAAM;EACpDC,SAAS,EAAED,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC;EAC3BC,OAAO,EAAE,MAAM;EACfC,KAAK,EAAE,aAAa;EACpB,WAAW,EAAE;IACXC,MAAM,EAAE,aAAaC,eAAK,CAACC,QAAQ,CAAC,CAAC;EACvC,CAAC;EACD,WAAW,EAAE;IACXF,MAAM,EAAE,aAAaC,eAAK,CAACE,OAAO,CAAC,CAAC;EACtC,CAAC;EACD,aAAa,EAAE;IACbH,MAAM,EAAE,aAAaC,eAAK,CAACG,SAAS,CAAC,CAAC;EACxC;AACF,CAAC,CAAC,CAAC;AAEH,MAAMC,kBAAkB,SAASC,cAAK,CAACC,SAAS,CAAC;EAC/CC,YAAYA,CAAA,EAAG;IACb,MAAM;MAAEC;IAAgB,CAAC,GAAG,IAAI,CAACC,KAAK;IACtC,IAAIC,SAAS;IAEb,QAAQF,eAAe;MACrB,KAAKG,SAAS;QACZD,SAAS,GAAG,SAAS;QACrB;MACF,KAAK,IAAI;QACPA,SAAS,GAAG,SAAS;QACrB;MACF;QACEA,SAAS,GAAG,WAAW;QACvB;IACJ;IACA,OAAOA,SAAS;EAClB;EAEAE,oBAAoBA,CAACC,cAAc,EAAE;IACnC,IAAIC,aAAa;IAEjB,QAAQD,cAAc;MACpB,KAAK,MAAM;QACTC,aAAa,GAAG,aAAa;QAC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AEDjC,kBAAkB,CAACkC,YAAY,GAAG;EAChC9B,eAAe,EAAEG;AACnB,CAAC;AAAC,IAAA4B,QAAA,GAAAC,OAAA,CAAAjB,OAAA,GAEanB,kBAAkB","ignoreList":[]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _core = require("@dnd-kit/core");
|
|
14
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
15
|
+
var _evaluationIcon = _interopRequireDefault(require("./evaluation-icon"));
|
|
16
|
+
var _staticHtmlSpan = _interopRequireDefault(require("./static-html-span"));
|
|
17
|
+
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); }
|
|
18
|
+
const BaseContainer = (0, _styles.styled)('div')(() => ({
|
|
19
|
+
position: 'relative',
|
|
20
|
+
backgroundColor: _renderUi.color.white(),
|
|
21
|
+
border: `1px solid ${_renderUi.color.borderDark()}`,
|
|
22
|
+
display: 'flex',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
minHeight: '28px',
|
|
26
|
+
width: 'fit-content',
|
|
27
|
+
'& span img': {
|
|
28
|
+
// Added for touch devices, for image content.
|
|
29
|
+
// This will prevent the context menu from appearing and not allowing other interactions with the image.
|
|
30
|
+
// If interactions with the image in the token will be requested we should handle only the context Menu.
|
|
31
|
+
pointerEvents: 'none'
|
|
32
|
+
},
|
|
33
|
+
'&.textAnswerChoiceStyle': {
|
|
34
|
+
padding: '0 10px',
|
|
35
|
+
margin: '4px 6px !important'
|
|
36
|
+
},
|
|
37
|
+
'&.answerChoiceTransparency': {
|
|
38
|
+
border: 'none',
|
|
39
|
+
backgroundColor: `${_renderUi.color.transparent()}`,
|
|
40
|
+
'&:hover': {
|
|
41
|
+
border: `1px solid ${_renderUi.color.borderDark()}`
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
'&.baseCorrect': {
|
|
45
|
+
border: `2px solid ${_renderUi.color.correct()} !important`
|
|
46
|
+
},
|
|
47
|
+
'&.baseIncorrect': {
|
|
48
|
+
border: `2px solid ${_renderUi.color.incorrect()} !important`
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
51
|
+
const StyledSpan = (0, _styles.styled)(_staticHtmlSpan.default)(() => ({
|
|
52
|
+
cursor: 'grab',
|
|
53
|
+
backgroundColor: _renderUi.color.background(),
|
|
54
|
+
'&.hiddenSpan': {
|
|
55
|
+
visibility: 'hidden'
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
const PossibleResponse = ({
|
|
59
|
+
canDrag,
|
|
60
|
+
containerStyle,
|
|
61
|
+
data,
|
|
62
|
+
onDragBegin,
|
|
63
|
+
answerChoiceTransparency,
|
|
64
|
+
isOverlay
|
|
65
|
+
}) => {
|
|
66
|
+
const rootRef = (0, _react.useRef)(null);
|
|
67
|
+
const longPressTimer = (0, _react.useRef)(null);
|
|
68
|
+
const {
|
|
69
|
+
setNodeRef,
|
|
70
|
+
attributes,
|
|
71
|
+
listeners,
|
|
72
|
+
isDragging
|
|
73
|
+
} = (0, _core.useDraggable)({
|
|
74
|
+
id: `possible-response-${data.id}`,
|
|
75
|
+
data: {
|
|
76
|
+
id: data.id,
|
|
77
|
+
value: data.value,
|
|
78
|
+
containerIndex: data.containerIndex
|
|
79
|
+
},
|
|
80
|
+
disabled: !canDrag
|
|
81
|
+
});
|
|
82
|
+
const handleTouchEnd = () => {
|
|
83
|
+
clearTimeout(longPressTimer.current);
|
|
84
|
+
};
|
|
85
|
+
const handleTouchMove = () => {
|
|
86
|
+
clearTimeout(longPressTimer.current);
|
|
87
|
+
};
|
|
88
|
+
const handleTouchStart = e => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
longPressTimer.current = setTimeout(() => {
|
|
91
|
+
if (canDrag && rootRef.current) {
|
|
92
|
+
onDragBegin(data);
|
|
93
|
+
}
|
|
94
|
+
}, 500); // start drag after 500ms (touch and hold duration) for chromebooks and other touch devices
|
|
95
|
+
};
|
|
96
|
+
(0, _react.useEffect)(() => {
|
|
97
|
+
const node = rootRef.current;
|
|
98
|
+
if (!node) return;
|
|
99
|
+
node.addEventListener('touchstart', handleTouchStart, {
|
|
100
|
+
passive: false
|
|
101
|
+
});
|
|
102
|
+
node.addEventListener('touchend', handleTouchEnd);
|
|
103
|
+
node.addEventListener('touchmove', handleTouchMove, {
|
|
104
|
+
passive: false
|
|
105
|
+
});
|
|
106
|
+
return () => {
|
|
107
|
+
node.removeEventListener('touchstart', handleTouchStart);
|
|
108
|
+
node.removeEventListener('touchend', handleTouchEnd);
|
|
109
|
+
node.removeEventListener('touchmove', handleTouchMove);
|
|
110
|
+
};
|
|
111
|
+
}, [canDrag, data]);
|
|
112
|
+
const {
|
|
113
|
+
isCorrect
|
|
114
|
+
} = data || {};
|
|
115
|
+
const evaluationStyle = {
|
|
116
|
+
fontSize: 14,
|
|
117
|
+
position: 'absolute',
|
|
118
|
+
bottom: '3px',
|
|
119
|
+
right: '3px'
|
|
120
|
+
};
|
|
121
|
+
const correctnessClass = isCorrect === true ? 'baseCorrect' : isCorrect === false ? 'baseIncorrect' : undefined;
|
|
122
|
+
const imgRegex = /<img[^>]+src="([^">]+)"/;
|
|
123
|
+
const containsImage = imgRegex.test(data.value);
|
|
124
|
+
const containerClassNames = (0, _classnames.default)({
|
|
125
|
+
answerChoiceTransparency: answerChoiceTransparency && !isDragging,
|
|
126
|
+
[correctnessClass]: !!correctnessClass,
|
|
127
|
+
textAnswerChoiceStyle: !containsImage && !isOverlay
|
|
128
|
+
});
|
|
129
|
+
const promptClassNames = (0, _classnames.default)({
|
|
130
|
+
hiddenSpan: data.hidden
|
|
131
|
+
});
|
|
132
|
+
return /*#__PURE__*/_react.default.createElement(BaseContainer, (0, _extends2.default)({
|
|
133
|
+
className: containerClassNames,
|
|
134
|
+
style: containerStyle,
|
|
135
|
+
ref: ref => {
|
|
136
|
+
rootRef.current = ref;
|
|
137
|
+
setNodeRef(ref);
|
|
138
|
+
}
|
|
139
|
+
}, listeners, attributes), /*#__PURE__*/_react.default.createElement(StyledSpan, {
|
|
140
|
+
html: data.value,
|
|
141
|
+
className: promptClassNames
|
|
142
|
+
}), /*#__PURE__*/_react.default.createElement(_evaluationIcon.default, {
|
|
143
|
+
isCorrect: data.isCorrect,
|
|
144
|
+
containerStyle: evaluationStyle
|
|
145
|
+
}));
|
|
146
|
+
};
|
|
147
|
+
PossibleResponse.propTypes = {
|
|
148
|
+
canDrag: _propTypes.default.bool.isRequired,
|
|
149
|
+
containerStyle: _propTypes.default.object,
|
|
150
|
+
data: _propTypes.default.object.isRequired,
|
|
151
|
+
onDragBegin: _propTypes.default.func.isRequired,
|
|
152
|
+
answerChoiceTransparency: _propTypes.default.bool,
|
|
153
|
+
isOverlay: _propTypes.default.bool
|
|
154
|
+
};
|
|
155
|
+
PossibleResponse.defaultProps = {
|
|
156
|
+
containerStyle: {},
|
|
157
|
+
answerChoiceTransparency: false,
|
|
158
|
+
isOverlay: false
|
|
159
|
+
};
|
|
160
|
+
var _default = exports.default = PossibleResponse;
|
|
161
|
+
//# sourceMappingURL=possible-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"possible-response.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_classnames","_styles","_core","_renderUi","_evaluationIcon","_staticHtmlSpan","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","BaseContainer","styled","position","backgroundColor","color","white","border","borderDark","display","alignItems","justifyContent","minHeight","width","pointerEvents","padding","margin","transparent","correct","incorrect","StyledSpan","StaticHTMLSpan","cursor","background","visibility","PossibleResponse","canDrag","containerStyle","data","onDragBegin","answerChoiceTransparency","isOverlay","rootRef","useRef","longPressTimer","setNodeRef","attributes","listeners","isDragging","useDraggable","id","value","containerIndex","disabled","handleTouchEnd","clearTimeout","current","handleTouchMove","handleTouchStart","preventDefault","setTimeout","useEffect","node","addEventListener","passive","removeEventListener","isCorrect","evaluationStyle","fontSize","bottom","right","correctnessClass","undefined","imgRegex","containsImage","test","containerClassNames","classNames","textAnswerChoiceStyle","promptClassNames","hiddenSpan","hidden","createElement","_extends2","className","style","ref","html","propTypes","PropTypes","bool","isRequired","object","func","defaultProps","_default","exports"],"sources":["../src/possible-response.jsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { styled } from '@mui/material/styles';\nimport { useDraggable } from '@dnd-kit/core';\nimport { color } from '@pie-lib/render-ui';\n\nimport EvaluationIcon from './evaluation-icon';\nimport StaticHTMLSpan from './static-html-span';\n\nconst BaseContainer = styled('div')(() => ({\n position: 'relative',\n backgroundColor: color.white(),\n border: `1px solid ${color.borderDark()}`,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: '28px',\n width: 'fit-content',\n '& span img': {\n // Added for touch devices, for image content.\n // This will prevent the context menu from appearing and not allowing other interactions with the image.\n // If interactions with the image in the token will be requested we should handle only the context Menu.\n pointerEvents: 'none',\n },\n '&.textAnswerChoiceStyle': {\n padding: '0 10px',\n margin: '4px 6px !important',\n },\n '&.answerChoiceTransparency': {\n border: 'none',\n backgroundColor: `${color.transparent()}`,\n '&:hover': {\n border: `1px solid ${color.borderDark()}`,\n },\n },\n '&.baseCorrect': {\n border: `2px solid ${color.correct()} !important`,\n },\n '&.baseIncorrect': {\n border: `2px solid ${color.incorrect()} !important`,\n },\n}));\n\nconst StyledSpan = styled(StaticHTMLSpan)(() => ({\n cursor: 'grab',\n backgroundColor: color.background(),\n '&.hiddenSpan': {\n visibility: 'hidden',\n },\n}));\n\nconst PossibleResponse = ({ canDrag, containerStyle, data, onDragBegin, answerChoiceTransparency, isOverlay }) => {\n const rootRef = useRef(null);\n const longPressTimer = useRef(null);\n\n const { setNodeRef, attributes, listeners, isDragging } = useDraggable({\n id: `possible-response-${data.id}`,\n data: {\n id: data.id,\n value: data.value,\n containerIndex: data.containerIndex,\n },\n disabled: !canDrag,\n });\n\n const handleTouchEnd = () => {\n clearTimeout(longPressTimer.current);\n };\n\n const handleTouchMove = () => {\n clearTimeout(longPressTimer.current);\n };\n\n const handleTouchStart = (e) => {\n e.preventDefault();\n longPressTimer.current = setTimeout(() => {\n if (canDrag && rootRef.current) {\n onDragBegin(data);\n }\n }, 500); // start drag after 500ms (touch and hold duration) for chromebooks and other touch devices\n };\n\n useEffect(() => {\n const node = rootRef.current;\n\n if (!node) return;\n\n node.addEventListener('touchstart', handleTouchStart, { passive: false });\n node.addEventListener('touchend', handleTouchEnd);\n node.addEventListener('touchmove', handleTouchMove, { passive: false });\n\n return () => {\n node.removeEventListener('touchstart', handleTouchStart);\n node.removeEventListener('touchend', handleTouchEnd);\n node.removeEventListener('touchmove', handleTouchMove);\n };\n }, [canDrag, data]);\n\n const { isCorrect } = data || {};\n const evaluationStyle = {\n fontSize: 14,\n position: 'absolute',\n bottom: '3px',\n right: '3px',\n };\n const correctnessClass = isCorrect === true ? 'baseCorrect' : isCorrect === false ? 'baseIncorrect' : undefined;\n\n const imgRegex = /<img[^>]+src=\"([^\">]+)\"/;\n const containsImage = imgRegex.test(data.value);\n\n const containerClassNames = classNames({\n answerChoiceTransparency: answerChoiceTransparency && !isDragging,\n [correctnessClass]: !!correctnessClass,\n textAnswerChoiceStyle: !containsImage && !isOverlay,\n });\n\n const promptClassNames = classNames({ hiddenSpan: data.hidden });\n\n return (\n <BaseContainer\n className={containerClassNames}\n style={containerStyle}\n ref={(ref) => {\n rootRef.current = ref;\n setNodeRef(ref);\n }}\n {...listeners}\n {...attributes}\n >\n <StyledSpan html={data.value} className={promptClassNames} />\n <EvaluationIcon isCorrect={data.isCorrect} containerStyle={evaluationStyle} />\n </BaseContainer>\n );\n};\n\nPossibleResponse.propTypes = {\n canDrag: PropTypes.bool.isRequired,\n containerStyle: PropTypes.object,\n data: PropTypes.object.isRequired,\n onDragBegin: PropTypes.func.isRequired,\n answerChoiceTransparency: PropTypes.bool,\n isOverlay: PropTypes.bool,\n};\n\nPossibleResponse.defaultProps = {\n containerStyle: {},\n answerChoiceTransparency: false,\n isOverlay: false,\n};\n\nexport default PossibleResponse;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAEA,IAAAO,eAAA,GAAAL,sBAAA,CAAAF,OAAA;AACA,IAAAQ,eAAA,GAAAN,sBAAA,CAAAF,OAAA;AAAgD,SAAAD,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAA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EpB,CAAC;AAEDhC,gBAAgB,CAACqD,SAAS,GAAG;EAC3BpD,OAAO,EAAEqD,kBAAS,CAACC,IAAI,CAACC,UAAU;EAClCtD,cAAc,EAAEoD,kBAAS,CAACG,MAAM;EAChCtD,IAAI,EAAEmD,kBAAS,CAACG,MAAM,CAACD,UAAU;EACjCpD,WAAW,EAAEkD,kBAAS,CAACI,IAAI,CAACF,UAAU;EACtCnD,wBAAwB,EAAEiD,kBAAS,CAACC,IAAI;EACxCjD,SAAS,EAAEgD,kBAAS,CAACC;AACvB,CAAC;AAEDvD,gBAAgB,CAAC2D,YAAY,GAAG;EAC9BzD,cAAc,EAAE,CAAC,CAAC;EAClBG,wBAAwB,EAAE,KAAK;EAC/BC,SAAS,EAAE;AACb,CAAC;AAAC,IAAAsD,QAAA,GAAAC,OAAA,CAAA9F,OAAA,GAEaiC,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
12
|
+
var _drag = require("@pie-lib/drag");
|
|
13
|
+
var _possibleResponse = _interopRequireDefault(require("./possible-response"));
|
|
14
|
+
const BaseContainer = (0, _styles.styled)('div')(({
|
|
15
|
+
theme
|
|
16
|
+
}) => ({
|
|
17
|
+
backgroundColor: _renderUi.color.background(),
|
|
18
|
+
margin: theme.spacing(2),
|
|
19
|
+
display: 'flex',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
width: 'fit-content'
|
|
22
|
+
}));
|
|
23
|
+
const PossibleResponses = ({
|
|
24
|
+
canDrag,
|
|
25
|
+
data,
|
|
26
|
+
onDragBegin,
|
|
27
|
+
answerChoiceTransparency,
|
|
28
|
+
customStyle,
|
|
29
|
+
isVertical,
|
|
30
|
+
minHeight
|
|
31
|
+
}) => /*#__PURE__*/_react.default.createElement(BaseContainer, {
|
|
32
|
+
style: customStyle
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_drag.ICADroppablePlaceholder, {
|
|
34
|
+
id: "ica-board",
|
|
35
|
+
disabled: !canDrag,
|
|
36
|
+
isVerticalPool: isVertical,
|
|
37
|
+
minHeight: minHeight
|
|
38
|
+
}, (data || []).map(item => /*#__PURE__*/_react.default.createElement(_possibleResponse.default, {
|
|
39
|
+
canDrag: canDrag,
|
|
40
|
+
key: item.id,
|
|
41
|
+
data: item,
|
|
42
|
+
onDragBegin: onDragBegin,
|
|
43
|
+
answerChoiceTransparency: answerChoiceTransparency,
|
|
44
|
+
containerStyle: {
|
|
45
|
+
margin: '4px'
|
|
46
|
+
}
|
|
47
|
+
}))));
|
|
48
|
+
PossibleResponses.propTypes = {
|
|
49
|
+
canDrag: _propTypes.default.bool.isRequired,
|
|
50
|
+
data: _propTypes.default.array.isRequired,
|
|
51
|
+
onDragBegin: _propTypes.default.func.isRequired,
|
|
52
|
+
answerChoiceTransparency: _propTypes.default.bool,
|
|
53
|
+
customStyle: _propTypes.default.object,
|
|
54
|
+
isVertical: _propTypes.default.bool,
|
|
55
|
+
minHeight: _propTypes.default.number
|
|
56
|
+
};
|
|
57
|
+
var _default = exports.default = PossibleResponses;
|
|
58
|
+
//# sourceMappingURL=possible-responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"possible-responses.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_renderUi","_drag","_possibleResponse","BaseContainer","styled","theme","backgroundColor","color","background","margin","spacing","display","alignItems","width","PossibleResponses","canDrag","data","onDragBegin","answerChoiceTransparency","customStyle","isVertical","minHeight","default","createElement","style","ICADroppablePlaceholder","id","disabled","isVerticalPool","map","item","key","containerStyle","propTypes","PropTypes","bool","isRequired","array","func","object","number","_default","exports"],"sources":["../src/possible-responses.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\nimport { ICADroppablePlaceholder } from '@pie-lib/drag';\n\nimport PossibleResponse from './possible-response';\n\nconst BaseContainer = styled('div')(({ theme }) => ({\n backgroundColor: color.background(),\n margin: theme.spacing(2),\n display: 'flex',\n alignItems: 'center',\n width: 'fit-content',\n}));\n\nconst PossibleResponses = ({\n canDrag,\n data,\n onDragBegin,\n answerChoiceTransparency,\n customStyle,\n isVertical,\n minHeight,\n}) => (\n <BaseContainer style={customStyle}>\n <ICADroppablePlaceholder id=\"ica-board\" disabled={!canDrag} isVerticalPool={isVertical} minHeight={minHeight}>\n {(data || []).map((item) => (\n <PossibleResponse\n canDrag={canDrag}\n key={item.id}\n data={item}\n onDragBegin={onDragBegin}\n answerChoiceTransparency={answerChoiceTransparency}\n containerStyle={{ margin: '4px' }}\n />\n ))}\n </ICADroppablePlaceholder>\n </BaseContainer>\n);\n\nPossibleResponses.propTypes = {\n canDrag: PropTypes.bool.isRequired,\n data: PropTypes.array.isRequired,\n onDragBegin: PropTypes.func.isRequired,\n answerChoiceTransparency: PropTypes.bool,\n customStyle: PropTypes.object,\n isVertical: PropTypes.bool,\n minHeight: PropTypes.number,\n};\n\nexport default PossibleResponses;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAEA,IAAAK,iBAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,MAAMM,aAAa,GAAG,IAAAC,cAAM,EAAC,KAAK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