@pie-lib/mask-markup 3.0.4-next.0 → 3.0.4-next.104
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 +17 -0
- package/CHANGELOG.md +1256 -0
- package/LICENSE.md +5 -0
- package/lib/choices/choice.js +120 -0
- package/lib/choices/choice.js.map +1 -0
- package/lib/choices/index.js +103 -0
- package/lib/choices/index.js.map +1 -0
- package/lib/componentize.js +21 -0
- package/lib/componentize.js.map +1 -0
- package/lib/components/blank.js +412 -0
- package/lib/components/blank.js.map +1 -0
- package/lib/components/correct-input.js +94 -0
- package/lib/components/correct-input.js.map +1 -0
- package/lib/components/dropdown.js +483 -0
- package/lib/components/dropdown.js.map +1 -0
- package/lib/components/input.js +50 -0
- package/lib/components/input.js.map +1 -0
- package/lib/constructed-response.js +101 -0
- package/lib/constructed-response.js.map +1 -0
- package/lib/customizable.js +42 -0
- package/lib/customizable.js.map +1 -0
- package/lib/drag-in-the-blank.js +254 -0
- package/lib/drag-in-the-blank.js.map +1 -0
- package/lib/index.js +55 -0
- package/lib/index.js.map +1 -0
- package/lib/inline-dropdown.js +40 -0
- package/lib/inline-dropdown.js.map +1 -0
- package/lib/mask.js +198 -0
- package/lib/mask.js.map +1 -0
- package/lib/serialization.js +261 -0
- package/lib/serialization.js.map +1 -0
- package/lib/with-mask.js +97 -0
- package/lib/with-mask.js.map +1 -0
- package/package.json +17 -35
- package/src/__tests__/drag-in-the-blank.test.js +111 -0
- package/src/__tests__/index.test.js +38 -0
- package/src/__tests__/mask.test.js +381 -0
- package/src/__tests__/serialization.test.js +54 -0
- package/src/__tests__/utils.js +1 -0
- package/src/__tests__/with-mask.test.js +76 -0
- package/src/choices/__tests__/index.test.js +109 -0
- package/src/choices/choice.jsx +100 -0
- package/src/choices/index.jsx +64 -0
- package/src/componentize.js +13 -0
- package/src/components/__tests__/blank.test.js +232 -0
- package/src/components/__tests__/correct-input.test.js +90 -0
- package/src/components/__tests__/dropdown.test.js +129 -0
- package/src/components/__tests__/input.test.js +102 -0
- package/src/components/blank.jsx +431 -0
- package/src/components/correct-input.jsx +82 -0
- package/src/components/dropdown.jsx +423 -0
- package/src/components/input.jsx +48 -0
- package/src/constructed-response.jsx +87 -0
- package/src/customizable.jsx +34 -0
- package/src/drag-in-the-blank.jsx +241 -0
- package/src/index.js +16 -0
- package/src/inline-dropdown.jsx +29 -0
- package/src/mask.jsx +172 -0
- package/src/serialization.js +260 -0
- package/src/with-mask.jsx +75 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -4
- package/dist/choices/choice.d.ts +0 -24
- package/dist/choices/choice.js +0 -77
- package/dist/choices/index.d.ts +0 -25
- package/dist/choices/index.js +0 -49
- package/dist/componentize.d.ts +0 -12
- package/dist/componentize.js +0 -4
- package/dist/components/blank.d.ts +0 -39
- package/dist/components/blank.js +0 -240
- package/dist/components/correct-input.d.ts +0 -11
- package/dist/components/dropdown.d.ts +0 -37
- package/dist/components/dropdown.js +0 -320
- package/dist/components/input.d.ts +0 -37
- package/dist/constructed-response.d.ts +0 -44
- package/dist/constructed-response.js +0 -55
- package/dist/customizable.d.ts +0 -43
- package/dist/customizable.js +0 -8
- package/dist/drag-in-the-blank.d.ts +0 -37
- package/dist/drag-in-the-blank.js +0 -164
- package/dist/index.d.ts +0 -15
- package/dist/index.js +0 -7
- package/dist/inline-dropdown.d.ts +0 -44
- package/dist/inline-dropdown.js +0 -24
- package/dist/mask.d.ts +0 -30
- package/dist/mask.js +0 -99
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +0 -17
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +0 -9
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +0 -26
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +0 -24
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +0 -32
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +0 -29
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +0 -14
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +0 -8
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +0 -12
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +0 -11
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +0 -10
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +0 -10
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +0 -55
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +0 -16
- package/dist/serialization.d.ts +0 -34
- package/dist/serialization.js +0 -132
- package/dist/with-mask.d.ts +0 -55
- package/dist/with-mask.js +0 -45
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _mathRendering = require("@pie-lib/math-rendering");
|
|
15
|
+
var _debug = _interopRequireDefault(require("debug"));
|
|
16
|
+
var _core = require("@dnd-kit/core");
|
|
17
|
+
var _utilities = require("@dnd-kit/utilities");
|
|
18
|
+
var _styles = require("@mui/material/styles");
|
|
19
|
+
var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
22
|
+
var _colors = require("@mui/material/colors");
|
|
23
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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); }
|
|
24
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
|
+
var log = (0, _debug["default"])('pie-lib:mask-markup:blank');
|
|
27
|
+
var StyledContent = (0, _styles.styled)('span')(function (_ref) {
|
|
28
|
+
var dragged = _ref.dragged,
|
|
29
|
+
over = _ref.over;
|
|
30
|
+
return _objectSpread(_objectSpread({
|
|
31
|
+
border: "solid 0px ".concat(_renderUi.color.primary()),
|
|
32
|
+
minWidth: '200px',
|
|
33
|
+
touchAction: 'none',
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
whiteSpace: 'nowrap',
|
|
36
|
+
opacity: 1
|
|
37
|
+
}, over && {
|
|
38
|
+
whiteSpace: 'nowrap',
|
|
39
|
+
overflow: 'hidden'
|
|
40
|
+
}), dragged && {
|
|
41
|
+
opacity: 0.5
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
var StyledChip = (0, _styles.styled)(_Chip["default"])(function () {
|
|
45
|
+
return {
|
|
46
|
+
backgroundColor: _renderUi.color.background(),
|
|
47
|
+
border: "2px dashed ".concat(_renderUi.color.text()),
|
|
48
|
+
touchAction: 'none',
|
|
49
|
+
color: _renderUi.color.text(),
|
|
50
|
+
fontSize: 'inherit',
|
|
51
|
+
maxWidth: '374px',
|
|
52
|
+
position: 'relative',
|
|
53
|
+
borderRadius: '3px',
|
|
54
|
+
'&.over': {
|
|
55
|
+
whiteSpace: 'nowrap',
|
|
56
|
+
overflow: 'hidden'
|
|
57
|
+
},
|
|
58
|
+
'&.parentOver': {
|
|
59
|
+
border: "1px solid ".concat(_colors.grey[500]),
|
|
60
|
+
backgroundColor: "".concat(_colors.grey[300])
|
|
61
|
+
},
|
|
62
|
+
'&.correct': {
|
|
63
|
+
border: "solid 1px ".concat(_renderUi.color.correct())
|
|
64
|
+
},
|
|
65
|
+
'&.incorrect': {
|
|
66
|
+
border: "solid 1px ".concat(_renderUi.color.incorrect())
|
|
67
|
+
},
|
|
68
|
+
'&.Mui-disabled': {
|
|
69
|
+
opacity: 1
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
var StyledChipLabel = (0, _styles.styled)('span')(function () {
|
|
74
|
+
return {
|
|
75
|
+
whiteSpace: 'normal',
|
|
76
|
+
// Added for touch devices, for image content.
|
|
77
|
+
// This will prevent the context menu from appearing and not allowing other interactions with the image.
|
|
78
|
+
// If interactions with the image in the token will be requested we should handle only the context Menu.
|
|
79
|
+
pointerEvents: 'none',
|
|
80
|
+
'& img': {
|
|
81
|
+
display: 'block',
|
|
82
|
+
padding: '2px 0'
|
|
83
|
+
},
|
|
84
|
+
// Remove default <p> margins to ensure consistent spacing across all wrapped content (p, span, div, math)
|
|
85
|
+
// Padding for top and bottom will instead be controlled by the container for consistent layout
|
|
86
|
+
// Ensures consistent behavior with pie-api-browser, where marginTop is already removed by a Bootstrap stylesheet
|
|
87
|
+
'& p': {
|
|
88
|
+
marginTop: '0',
|
|
89
|
+
marginBottom: '0'
|
|
90
|
+
},
|
|
91
|
+
'& mjx-frac': {
|
|
92
|
+
fontSize: '120% !important'
|
|
93
|
+
},
|
|
94
|
+
'& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn': {
|
|
95
|
+
fontSize: '120% !important'
|
|
96
|
+
},
|
|
97
|
+
'&.over': {
|
|
98
|
+
whiteSpace: 'nowrap',
|
|
99
|
+
overflow: 'hidden'
|
|
100
|
+
},
|
|
101
|
+
'&.hidden': {
|
|
102
|
+
color: 'transparent',
|
|
103
|
+
opacity: 0
|
|
104
|
+
},
|
|
105
|
+
'&.dragged': {
|
|
106
|
+
position: 'absolute',
|
|
107
|
+
left: 16,
|
|
108
|
+
maxWidth: '60px',
|
|
109
|
+
top: '50%',
|
|
110
|
+
transform: 'translateY(-50%)'
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
function BlankContent(_ref2) {
|
|
115
|
+
var _dragItem$choice, _frozenRef$current, _frozenRef$current2;
|
|
116
|
+
var disabled = _ref2.disabled,
|
|
117
|
+
choice = _ref2.choice,
|
|
118
|
+
isOver = _ref2.isOver,
|
|
119
|
+
isDragging = _ref2.isDragging,
|
|
120
|
+
dragItem = _ref2.dragItem,
|
|
121
|
+
correct = _ref2.correct,
|
|
122
|
+
emptyResponseAreaWidth = _ref2.emptyResponseAreaWidth,
|
|
123
|
+
emptyResponseAreaHeight = _ref2.emptyResponseAreaHeight;
|
|
124
|
+
var rootRef = (0, _react.useRef)(null);
|
|
125
|
+
var spanRef = (0, _react.useRef)(null);
|
|
126
|
+
var frozenRef = (0, _react.useRef)(null); // to use during dragging to prevent flickering
|
|
127
|
+
var measuringRef = (0, _react.useRef)(false); // guard against ResizeObserver feedback loops
|
|
128
|
+
var _useState = (0, _react.useState)({
|
|
129
|
+
height: 0,
|
|
130
|
+
width: 0
|
|
131
|
+
}),
|
|
132
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
133
|
+
dimensions = _useState2[0],
|
|
134
|
+
setDimensions = _useState2[1];
|
|
135
|
+
var handleImageLoad = function handleImageLoad() {
|
|
136
|
+
updateDimensions();
|
|
137
|
+
};
|
|
138
|
+
var handleElements = function handleElements() {
|
|
139
|
+
var _spanRef$current;
|
|
140
|
+
var imageElement = (_spanRef$current = spanRef.current) === null || _spanRef$current === void 0 ? void 0 : _spanRef$current.querySelector('img');
|
|
141
|
+
if (imageElement) {
|
|
142
|
+
imageElement.onload = handleImageLoad;
|
|
143
|
+
} else {
|
|
144
|
+
setTimeout(function () {
|
|
145
|
+
updateDimensions();
|
|
146
|
+
}, 300);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
var getMeasureNode = function getMeasureNode() {
|
|
150
|
+
if (!spanRef.current) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
var mjx = spanRef.current.querySelector('mjx-container');
|
|
154
|
+
if (mjx && spanRef.current.parentElement) {
|
|
155
|
+
return spanRef.current.parentElement;
|
|
156
|
+
}
|
|
157
|
+
var img = spanRef.current.querySelector('img');
|
|
158
|
+
if (img) {
|
|
159
|
+
// If there's text alongside the image, measure the full span to capture both dimensions
|
|
160
|
+
var hasTextContent = spanRef.current.textContent.trim().length > 0;
|
|
161
|
+
return hasTextContent ? spanRef.current : img;
|
|
162
|
+
}
|
|
163
|
+
return spanRef.current;
|
|
164
|
+
};
|
|
165
|
+
var updateDimensions = function updateDimensions() {
|
|
166
|
+
if (spanRef.current && rootRef.current && !measuringRef.current) {
|
|
167
|
+
measuringRef.current = true;
|
|
168
|
+
// Temporarily set rootRef width to 'auto' for natural measurement
|
|
169
|
+
rootRef.current.style.width = 'auto';
|
|
170
|
+
rootRef.current.style.height = 'auto';
|
|
171
|
+
rootRef.current.offsetHeight;
|
|
172
|
+
var measureNode = getMeasureNode();
|
|
173
|
+
var node = measureNode || spanRef.current;
|
|
174
|
+
var rect = node.getBoundingClientRect();
|
|
175
|
+
var width = node.offsetWidth || rect.width || 0;
|
|
176
|
+
var height = Math.max(node.offsetHeight || 0, rect.height || 0, node.scrollHeight || 0, spanRef.current.scrollHeight || 0);
|
|
177
|
+
var PADDING = 12;
|
|
178
|
+
var BORDER_WIDTH = 2;
|
|
179
|
+
var ADDITIONAL_SPACE = 1;
|
|
180
|
+
// padding and border on each side
|
|
181
|
+
var widthWithPadding = width + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;
|
|
182
|
+
// padding and border on top and bottom
|
|
183
|
+
var heightWithPadding = height + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;
|
|
184
|
+
var responseAreaWidth = parseFloat(emptyResponseAreaWidth) || 0;
|
|
185
|
+
var responseAreaHeight = parseFloat(emptyResponseAreaHeight) || 0;
|
|
186
|
+
var adjustedWidth = widthWithPadding <= responseAreaWidth ? responseAreaWidth : widthWithPadding;
|
|
187
|
+
var adjustedHeight = heightWithPadding <= responseAreaHeight ? responseAreaHeight : heightWithPadding;
|
|
188
|
+
setDimensions(function (prevState) {
|
|
189
|
+
return {
|
|
190
|
+
width: adjustedWidth > responseAreaWidth ? adjustedWidth : prevState.width,
|
|
191
|
+
height: adjustedHeight > responseAreaHeight ? adjustedHeight : prevState.height
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
var nextWidth = "".concat(adjustedWidth, "px");
|
|
195
|
+
var nextHeight = "".concat(adjustedHeight, "px");
|
|
196
|
+
if (rootRef.current.style.width !== nextWidth) {
|
|
197
|
+
rootRef.current.style.width = nextWidth;
|
|
198
|
+
}
|
|
199
|
+
if (rootRef.current.style.height !== nextHeight) {
|
|
200
|
+
rootRef.current.style.height = nextHeight;
|
|
201
|
+
}
|
|
202
|
+
measuringRef.current = false;
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var getRootDimensions = function getRootDimensions() {
|
|
206
|
+
// Handle potential non-numeric values
|
|
207
|
+
var responseAreaWidth = !isNaN(parseFloat(emptyResponseAreaWidth)) ? parseFloat(emptyResponseAreaWidth) : 0;
|
|
208
|
+
var responseAreaHeight = !isNaN(parseFloat(emptyResponseAreaHeight)) ? parseFloat(emptyResponseAreaHeight) : 0;
|
|
209
|
+
var rootStyle = {
|
|
210
|
+
height: dimensions.height || responseAreaHeight,
|
|
211
|
+
width: dimensions.width || responseAreaWidth
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// add minWidth, minHeight if width and height are not defined
|
|
215
|
+
return _objectSpread(_objectSpread(_objectSpread({}, rootStyle), responseAreaWidth ? {} : {
|
|
216
|
+
minWidth: 90
|
|
217
|
+
}), responseAreaHeight ? {} : {
|
|
218
|
+
minHeight: 32
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
(0, _react.useEffect)(function () {
|
|
222
|
+
handleElements();
|
|
223
|
+
}, []);
|
|
224
|
+
|
|
225
|
+
// Re-measure when the element first becomes visible — covers the tabbed-view case
|
|
226
|
+
// where the initial measurement happened while the tab was hidden (size 0).
|
|
227
|
+
(0, _react.useEffect)(function () {
|
|
228
|
+
if (typeof IntersectionObserver === 'undefined' || !rootRef.current) return undefined;
|
|
229
|
+
var io = new IntersectionObserver(function (entries) {
|
|
230
|
+
if (entries.some(function (e) {
|
|
231
|
+
return e.isIntersecting;
|
|
232
|
+
})) updateDimensions();
|
|
233
|
+
}, {
|
|
234
|
+
threshold: 0
|
|
235
|
+
});
|
|
236
|
+
io.observe(rootRef.current);
|
|
237
|
+
return function () {
|
|
238
|
+
return io.disconnect();
|
|
239
|
+
};
|
|
240
|
+
}, []);
|
|
241
|
+
|
|
242
|
+
// Render math for the placeholder/preview when dragging over
|
|
243
|
+
(0, _react.useEffect)(function () {
|
|
244
|
+
if (rootRef.current) {
|
|
245
|
+
(0, _mathRendering.renderMath)(rootRef.current);
|
|
246
|
+
}
|
|
247
|
+
}, [correct, isOver, dragItem === null || dragItem === void 0 || (_dragItem$choice = dragItem.choice) === null || _dragItem$choice === void 0 ? void 0 : _dragItem$choice.value]);
|
|
248
|
+
(0, _react.useEffect)(function () {
|
|
249
|
+
if (!choice) {
|
|
250
|
+
setDimensions({
|
|
251
|
+
height: 0,
|
|
252
|
+
width: 0
|
|
253
|
+
});
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
handleElements();
|
|
257
|
+
}, [choice === null || choice === void 0 ? void 0 : choice.value]);
|
|
258
|
+
(0, _react.useEffect)(function () {
|
|
259
|
+
if (!isOver && !isDragging) {
|
|
260
|
+
frozenRef.current = {
|
|
261
|
+
width: rootRef.current.offsetWidth,
|
|
262
|
+
height: rootRef.current.offsetHeight
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}, [choice, isOver, isDragging]);
|
|
266
|
+
var draggedLabel = dragItem && isOver && dragItem.choice && dragItem.choice.value;
|
|
267
|
+
var label = choice && choice.value;
|
|
268
|
+
var style = isOver || isDragging ? {
|
|
269
|
+
width: (_frozenRef$current = frozenRef.current) === null || _frozenRef$current === void 0 ? void 0 : _frozenRef$current.width,
|
|
270
|
+
height: (_frozenRef$current2 = frozenRef.current) === null || _frozenRef$current2 === void 0 ? void 0 : _frozenRef$current2.height
|
|
271
|
+
} : getRootDimensions();
|
|
272
|
+
return /*#__PURE__*/_react["default"].createElement(StyledChip, {
|
|
273
|
+
clickable: false,
|
|
274
|
+
disabled: disabled,
|
|
275
|
+
ref: rootRef,
|
|
276
|
+
component: "span",
|
|
277
|
+
label: /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(StyledChipLabel, {
|
|
278
|
+
ref: spanRef,
|
|
279
|
+
draggable: true,
|
|
280
|
+
className: (0, _classnames["default"])({
|
|
281
|
+
over: isOver,
|
|
282
|
+
hidden: draggedLabel
|
|
283
|
+
}),
|
|
284
|
+
dangerouslySetInnerHTML: {
|
|
285
|
+
__html: label || ''
|
|
286
|
+
}
|
|
287
|
+
}), draggedLabel && /*#__PURE__*/_react["default"].createElement(StyledChipLabel, {
|
|
288
|
+
draggable: true,
|
|
289
|
+
className: (0, _classnames["default"])({
|
|
290
|
+
over: isOver,
|
|
291
|
+
dragged: true
|
|
292
|
+
}),
|
|
293
|
+
dangerouslySetInnerHTML: {
|
|
294
|
+
__html: draggedLabel || ''
|
|
295
|
+
}
|
|
296
|
+
})),
|
|
297
|
+
className: (0, _classnames["default"])({
|
|
298
|
+
over: isOver,
|
|
299
|
+
parentOver: isOver,
|
|
300
|
+
correct: correct !== undefined && correct,
|
|
301
|
+
incorrect: correct !== undefined && !correct
|
|
302
|
+
}),
|
|
303
|
+
variant: disabled ? 'outlined' : undefined,
|
|
304
|
+
style: style
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
BlankContent.defaultProps = {
|
|
308
|
+
emptyResponseAreaWidth: 0,
|
|
309
|
+
emptyResponseAreaHeight: 0
|
|
310
|
+
};
|
|
311
|
+
BlankContent.propTypes = {
|
|
312
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
313
|
+
disabled: _propTypes["default"].bool,
|
|
314
|
+
duplicates: _propTypes["default"].bool,
|
|
315
|
+
choice: _propTypes["default"].object,
|
|
316
|
+
isOver: _propTypes["default"].bool,
|
|
317
|
+
dragItem: _propTypes["default"].object,
|
|
318
|
+
correct: _propTypes["default"].bool,
|
|
319
|
+
onChange: _propTypes["default"].func,
|
|
320
|
+
emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
321
|
+
emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
322
|
+
instanceId: _propTypes["default"].string
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
// New functional component using @dnd-kit hooks
|
|
326
|
+
function DragDropBlank(_ref3) {
|
|
327
|
+
var _dragItem$data;
|
|
328
|
+
var id = _ref3.id,
|
|
329
|
+
disabled = _ref3.disabled,
|
|
330
|
+
duplicates = _ref3.duplicates,
|
|
331
|
+
choice = _ref3.choice,
|
|
332
|
+
correct = _ref3.correct,
|
|
333
|
+
onChange = _ref3.onChange,
|
|
334
|
+
emptyResponseAreaWidth = _ref3.emptyResponseAreaWidth,
|
|
335
|
+
emptyResponseAreaHeight = _ref3.emptyResponseAreaHeight,
|
|
336
|
+
instanceId = _ref3.instanceId;
|
|
337
|
+
// Setup draggable functionality
|
|
338
|
+
var _useDraggable = (0, _core.useDraggable)({
|
|
339
|
+
id: "mask-blank-drag-".concat(id),
|
|
340
|
+
disabled: disabled || !choice,
|
|
341
|
+
data: {
|
|
342
|
+
id: id,
|
|
343
|
+
choice: choice,
|
|
344
|
+
instanceId: instanceId,
|
|
345
|
+
fromChoice: false,
|
|
346
|
+
// This is from a blank, not from choices
|
|
347
|
+
type: 'MaskBlank'
|
|
348
|
+
}
|
|
349
|
+
}),
|
|
350
|
+
dragAttributes = _useDraggable.attributes,
|
|
351
|
+
dragListeners = _useDraggable.listeners,
|
|
352
|
+
setDragNodeRef = _useDraggable.setNodeRef,
|
|
353
|
+
transform = _useDraggable.transform,
|
|
354
|
+
isDragging = _useDraggable.isDragging;
|
|
355
|
+
|
|
356
|
+
// Setup droppable functionality
|
|
357
|
+
var _useDroppable = (0, _core.useDroppable)({
|
|
358
|
+
id: "mask-blank-drop-".concat(id),
|
|
359
|
+
data: {
|
|
360
|
+
id: id,
|
|
361
|
+
accepts: ['MaskBlank'],
|
|
362
|
+
instanceId: instanceId
|
|
363
|
+
}
|
|
364
|
+
}),
|
|
365
|
+
setDropNodeRef = _useDroppable.setNodeRef,
|
|
366
|
+
isOver = _useDroppable.isOver,
|
|
367
|
+
dragItem = _useDroppable.active;
|
|
368
|
+
|
|
369
|
+
// Combine refs for both drag and drop
|
|
370
|
+
var setNodeRef = function setNodeRef(node) {
|
|
371
|
+
setDragNodeRef(node);
|
|
372
|
+
setDropNodeRef(node);
|
|
373
|
+
};
|
|
374
|
+
var style = {
|
|
375
|
+
transform: _utilities.CSS.Translate.toString(transform)
|
|
376
|
+
};
|
|
377
|
+
return /*#__PURE__*/_react["default"].createElement(StyledContent, (0, _extends2["default"])({
|
|
378
|
+
ref: setNodeRef,
|
|
379
|
+
style: style,
|
|
380
|
+
dragged: isDragging,
|
|
381
|
+
over: isOver
|
|
382
|
+
}, dragAttributes, dragListeners), /*#__PURE__*/_react["default"].createElement(BlankContent, {
|
|
383
|
+
id: id,
|
|
384
|
+
disabled: disabled,
|
|
385
|
+
duplicates: duplicates,
|
|
386
|
+
choice: choice,
|
|
387
|
+
isOver: isOver,
|
|
388
|
+
dragItem: dragItem === null || dragItem === void 0 || (_dragItem$data = dragItem.data) === null || _dragItem$data === void 0 ? void 0 : _dragItem$data.current,
|
|
389
|
+
correct: correct,
|
|
390
|
+
onChange: onChange,
|
|
391
|
+
emptyResponseAreaWidth: emptyResponseAreaWidth,
|
|
392
|
+
emptyResponseAreaHeight: emptyResponseAreaHeight,
|
|
393
|
+
instanceId: instanceId
|
|
394
|
+
}));
|
|
395
|
+
}
|
|
396
|
+
DragDropBlank.defaultProps = {
|
|
397
|
+
emptyResponseAreaWidth: 0,
|
|
398
|
+
emptyResponseAreaHeight: 0
|
|
399
|
+
};
|
|
400
|
+
DragDropBlank.propTypes = {
|
|
401
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
402
|
+
disabled: _propTypes["default"].bool,
|
|
403
|
+
duplicates: _propTypes["default"].bool,
|
|
404
|
+
choice: _propTypes["default"].object,
|
|
405
|
+
correct: _propTypes["default"].bool,
|
|
406
|
+
onChange: _propTypes["default"].func,
|
|
407
|
+
emptyResponseAreaWidth: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
408
|
+
emptyResponseAreaHeight: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
|
|
409
|
+
instanceId: _propTypes["default"].string
|
|
410
|
+
};
|
|
411
|
+
var _default = exports["default"] = DragDropBlank;
|
|
412
|
+
//# sourceMappingURL=blank.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blank.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_mathRendering","_debug","_core","_utilities","_styles","_Chip","_classnames","_renderUi","_colors","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","log","debug","StyledContent","styled","_ref","dragged","over","border","concat","color","primary","minWidth","touchAction","overflow","whiteSpace","opacity","StyledChip","Chip","backgroundColor","background","text","fontSize","maxWidth","position","borderRadius","grey","correct","incorrect","StyledChipLabel","pointerEvents","display","padding","marginTop","marginBottom","left","top","transform","BlankContent","_ref2","_dragItem$choice","_frozenRef$current","_frozenRef$current2","disabled","choice","isOver","isDragging","dragItem","emptyResponseAreaWidth","emptyResponseAreaHeight","rootRef","useRef","spanRef","frozenRef","measuringRef","_useState","useState","height","width","_useState2","_slicedToArray2","dimensions","setDimensions","handleImageLoad","updateDimensions","handleElements","_spanRef$current","imageElement","current","querySelector","onload","setTimeout","getMeasureNode","mjx","parentElement","img","hasTextContent","textContent","trim","style","offsetHeight","measureNode","node","rect","getBoundingClientRect","offsetWidth","Math","max","scrollHeight","PADDING","BORDER_WIDTH","ADDITIONAL_SPACE","widthWithPadding","heightWithPadding","responseAreaWidth","parseFloat","responseAreaHeight","adjustedWidth","adjustedHeight","prevState","nextWidth","nextHeight","getRootDimensions","isNaN","rootStyle","minHeight","useEffect","IntersectionObserver","undefined","io","entries","some","isIntersecting","threshold","observe","disconnect","renderMath","value","draggedLabel","label","createElement","clickable","ref","component","Fragment","draggable","className","classnames","hidden","dangerouslySetInnerHTML","__html","parentOver","variant","defaultProps","propTypes","id","PropTypes","oneOfType","string","number","bool","duplicates","object","onChange","func","instanceId","DragDropBlank","_ref3","_dragItem$data","_useDraggable","useDraggable","data","fromChoice","type","dragAttributes","attributes","dragListeners","listeners","setDragNodeRef","setNodeRef","_useDroppable","useDroppable","accepts","setDropNodeRef","active","CSS","Translate","toString","_extends2","_default","exports"],"sources":["../../src/components/blank.jsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport debug from 'debug';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport { CSS } from '@dnd-kit/utilities';\nimport { styled } from '@mui/material/styles';\nimport Chip from '@mui/material/Chip';\nimport classnames from 'classnames';\nimport { color } from '@pie-lib/render-ui';\nimport { grey } from '@mui/material/colors';\n\nconst log = debug('pie-lib:mask-markup:blank');\n\nconst StyledContent = styled('span')(({ dragged, over }) => ({\n border: `solid 0px ${color.primary()}`,\n minWidth: '200px',\n touchAction: 'none',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n opacity: 1,\n ...(over && {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n }),\n ...(dragged && {\n opacity: 0.5,\n }),\n}));\n\nconst StyledChip = styled(Chip)(() => ({\n backgroundColor: color.background(),\n border: `2px dashed ${color.text()}`,\n touchAction: 'none',\n color: color.text(),\n fontSize: 'inherit',\n maxWidth: '374px',\n position: 'relative',\n borderRadius: '3px',\n '&.over': {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n },\n '&.parentOver': {\n border: `1px solid ${grey[500]}`,\n backgroundColor: `${grey[300]}`,\n },\n '&.correct': {\n border: `solid 1px ${color.correct()}`,\n },\n '&.incorrect': {\n border: `solid 1px ${color.incorrect()}`,\n },\n '&.Mui-disabled': {\n opacity: 1,\n },\n}));\n\nconst StyledChipLabel = styled('span')(() => ({\n whiteSpace: 'normal',\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 '& img': {\n display: 'block',\n padding: '2px 0',\n },\n // Remove default <p> margins to ensure consistent spacing across all wrapped content (p, span, div, math)\n // Padding for top and bottom will instead be controlled by the container for consistent layout\n // Ensures consistent behavior with pie-api-browser, where marginTop is already removed by a Bootstrap stylesheet\n '& p': {\n marginTop: '0',\n marginBottom: '0',\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n '& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn': {\n fontSize: '120% !important',\n },\n '&.over': {\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n },\n '&.hidden': {\n color: 'transparent',\n opacity: 0,\n },\n '&.dragged': {\n position: 'absolute',\n left: 16,\n maxWidth: '60px',\n top: '50%',\n transform: 'translateY(-50%)',\n },\n}));\n\nfunction BlankContent({\n disabled,\n choice,\n isOver,\n isDragging,\n dragItem,\n correct,\n emptyResponseAreaWidth,\n emptyResponseAreaHeight,\n}) {\n const rootRef = useRef(null);\n const spanRef = useRef(null);\n const frozenRef = useRef(null); // to use during dragging to prevent flickering\n const measuringRef = useRef(false); // guard against ResizeObserver feedback loops\n const [dimensions, setDimensions] = useState({ height: 0, width: 0 });\n\n const handleImageLoad = () => {\n updateDimensions();\n };\n\n const handleElements = () => {\n const imageElement = spanRef.current?.querySelector('img');\n if (imageElement) {\n imageElement.onload = handleImageLoad;\n } else {\n setTimeout(() => {\n updateDimensions();\n }, 300);\n }\n };\n\n const getMeasureNode = () => {\n if (!spanRef.current) {\n return null;\n }\n\n const mjx = spanRef.current.querySelector('mjx-container');\n\n if (mjx && spanRef.current.parentElement) {\n return spanRef.current.parentElement;\n }\n\n const img = spanRef.current.querySelector('img');\n\n if (img) {\n // If there's text alongside the image, measure the full span to capture both dimensions\n const hasTextContent = spanRef.current.textContent.trim().length > 0;\n\n return hasTextContent ? spanRef.current : img;\n }\n\n return spanRef.current;\n };\n\n const updateDimensions = () => {\n if (spanRef.current && rootRef.current && !measuringRef.current) {\n measuringRef.current = true;\n // Temporarily set rootRef width to 'auto' for natural measurement\n rootRef.current.style.width = 'auto';\n rootRef.current.style.height = 'auto';\n rootRef.current.offsetHeight;\n\n const measureNode = getMeasureNode();\n const node = measureNode || spanRef.current;\n const rect = node.getBoundingClientRect();\n const width = node.offsetWidth || rect.width || 0;\n const height = Math.max(\n node.offsetHeight || 0,\n rect.height || 0,\n node.scrollHeight || 0,\n spanRef.current.scrollHeight || 0,\n );\n\n const PADDING = 12;\n const BORDER_WIDTH = 2;\n const ADDITIONAL_SPACE = 1;\n // padding and border on each side\n const widthWithPadding = width + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;\n // padding and border on top and bottom\n const heightWithPadding = height + 2 * PADDING + 2 * BORDER_WIDTH + ADDITIONAL_SPACE;\n\n const responseAreaWidth = parseFloat(emptyResponseAreaWidth) || 0;\n const responseAreaHeight = parseFloat(emptyResponseAreaHeight) || 0;\n\n const adjustedWidth = widthWithPadding <= responseAreaWidth ? responseAreaWidth : widthWithPadding;\n const adjustedHeight = heightWithPadding <= responseAreaHeight ? responseAreaHeight : heightWithPadding;\n\n setDimensions((prevState) => ({\n width: adjustedWidth > responseAreaWidth ? adjustedWidth : prevState.width,\n height: adjustedHeight > responseAreaHeight ? adjustedHeight : prevState.height,\n }));\n\n const nextWidth = `${adjustedWidth}px`;\n const nextHeight = `${adjustedHeight}px`;\n if (rootRef.current.style.width !== nextWidth) {\n rootRef.current.style.width = nextWidth;\n }\n if (rootRef.current.style.height !== nextHeight) {\n rootRef.current.style.height = nextHeight;\n }\n measuringRef.current = false;\n }\n };\n\n const getRootDimensions = () => {\n // Handle potential non-numeric values\n const responseAreaWidth = !isNaN(parseFloat(emptyResponseAreaWidth)) ? parseFloat(emptyResponseAreaWidth) : 0;\n const responseAreaHeight = !isNaN(parseFloat(emptyResponseAreaHeight)) ? parseFloat(emptyResponseAreaHeight) : 0;\n\n const rootStyle = {\n height: dimensions.height || responseAreaHeight,\n width: dimensions.width || responseAreaWidth,\n };\n\n // add minWidth, minHeight if width and height are not defined\n return {\n ...rootStyle,\n ...(responseAreaWidth ? {} : { minWidth: 90 }),\n ...(responseAreaHeight ? {} : { minHeight: 32 }),\n };\n };\n\n useEffect(() => {\n handleElements();\n }, []);\n\n // Re-measure when the element first becomes visible — covers the tabbed-view case\n // where the initial measurement happened while the tab was hidden (size 0).\n useEffect(() => {\n if (typeof IntersectionObserver === 'undefined' || !rootRef.current) return undefined;\n const io = new IntersectionObserver(\n (entries) => {\n if (entries.some((e) => e.isIntersecting)) updateDimensions();\n },\n { threshold: 0 },\n );\n io.observe(rootRef.current);\n return () => io.disconnect();\n }, []);\n\n // Render math for the placeholder/preview when dragging over\n useEffect(() => {\n if (rootRef.current) {\n renderMath(rootRef.current);\n }\n }, [correct, isOver, dragItem?.choice?.value]);\n\n useEffect(() => {\n if (!choice) {\n setDimensions({ height: 0, width: 0 });\n return;\n }\n handleElements();\n }, [choice?.value]);\n\n useEffect(() => {\n if (!isOver && !isDragging) {\n frozenRef.current = {\n width: rootRef.current.offsetWidth,\n height: rootRef.current.offsetHeight,\n };\n }\n }, [choice, isOver, isDragging]);\n\n const draggedLabel = dragItem && isOver && dragItem.choice && dragItem.choice.value;\n const label = choice && choice.value;\n const style =\n isOver || isDragging\n ? {\n width: frozenRef.current?.width,\n height: frozenRef.current?.height,\n }\n : getRootDimensions();\n\n return (\n <StyledChip\n clickable={false}\n disabled={disabled}\n ref={rootRef}\n component=\"span\"\n label={\n <React.Fragment>\n <StyledChipLabel\n ref={spanRef}\n draggable={true}\n className={classnames({\n over: isOver,\n hidden: draggedLabel,\n })}\n dangerouslySetInnerHTML={{ __html: label || '' }}\n />\n {draggedLabel && (\n <StyledChipLabel\n draggable={true}\n className={classnames({\n over: isOver,\n dragged: true,\n })}\n dangerouslySetInnerHTML={{ __html: draggedLabel || '' }}\n />\n )}\n </React.Fragment>\n }\n className={classnames({\n over: isOver,\n parentOver: isOver,\n correct: correct !== undefined && correct,\n incorrect: correct !== undefined && !correct,\n })}\n variant={disabled ? 'outlined' : undefined}\n style={style}\n />\n );\n}\n\nBlankContent.defaultProps = {\n emptyResponseAreaWidth: 0,\n emptyResponseAreaHeight: 0,\n};\n\nBlankContent.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n duplicates: PropTypes.bool,\n choice: PropTypes.object,\n isOver: PropTypes.bool,\n dragItem: PropTypes.object,\n correct: PropTypes.bool,\n onChange: PropTypes.func,\n emptyResponseAreaWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n emptyResponseAreaHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n instanceId: PropTypes.string,\n};\n\n// New functional component using @dnd-kit hooks\nfunction DragDropBlank({\n id,\n disabled,\n duplicates,\n choice,\n correct,\n onChange,\n emptyResponseAreaWidth,\n emptyResponseAreaHeight,\n instanceId,\n}) {\n // Setup draggable functionality\n const {\n attributes: dragAttributes,\n listeners: dragListeners,\n setNodeRef: setDragNodeRef,\n transform,\n isDragging,\n } = useDraggable({\n id: `mask-blank-drag-${id}`,\n disabled: disabled || !choice,\n data: {\n id: id,\n choice: choice,\n instanceId: instanceId,\n fromChoice: false, // This is from a blank, not from choices\n type: 'MaskBlank',\n },\n });\n\n // Setup droppable functionality\n const {\n setNodeRef: setDropNodeRef,\n isOver,\n active: dragItem,\n } = useDroppable({\n id: `mask-blank-drop-${id}`,\n data: {\n id: id,\n accepts: ['MaskBlank'],\n instanceId: instanceId,\n },\n });\n\n // Combine refs for both drag and drop\n const setNodeRef = (node) => {\n setDragNodeRef(node);\n setDropNodeRef(node);\n };\n\n const style = {\n transform: CSS.Translate.toString(transform),\n };\n\n return (\n <StyledContent\n ref={setNodeRef}\n style={style}\n dragged={isDragging}\n over={isOver}\n {...dragAttributes}\n {...dragListeners}\n >\n <BlankContent\n id={id}\n disabled={disabled}\n duplicates={duplicates}\n choice={choice}\n isOver={isOver}\n dragItem={dragItem?.data?.current}\n correct={correct}\n onChange={onChange}\n emptyResponseAreaWidth={emptyResponseAreaWidth}\n emptyResponseAreaHeight={emptyResponseAreaHeight}\n instanceId={instanceId}\n />\n </StyledContent>\n );\n}\n\nDragDropBlank.defaultProps = {\n emptyResponseAreaWidth: 0,\n emptyResponseAreaHeight: 0,\n};\n\nDragDropBlank.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n disabled: PropTypes.bool,\n duplicates: PropTypes.bool,\n choice: PropTypes.object,\n correct: PropTypes.bool,\n onChange: PropTypes.func,\n emptyResponseAreaWidth: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n emptyResponseAreaHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n instanceId: PropTypes.string,\n};\n\nexport default DragDropBlank;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IA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SAAS,CAAC,CAACD,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACG,MAAM,CAAC,CAAC;EAClFM,UAAU,EAAET,qBAAS,CAACE;AACxB,CAAC;AAAC,IAAA+B,QAAA,GAAAC,OAAA,cAEaxB,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
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 _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _OutlinedInput = _interopRequireDefault(require("@mui/material/OutlinedInput"));
|
|
13
|
+
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _renderUi = require("@pie-lib/render-ui");
|
|
16
|
+
var _excluded = ["correct", "charactersLimit", "disabled", "isBox", "isConstructedResponse", "width", "spellCheck"];
|
|
17
|
+
var StyledOutlinedInput = (0, _styles.styled)(_OutlinedInput["default"])(function () {
|
|
18
|
+
return {
|
|
19
|
+
padding: '2px',
|
|
20
|
+
borderRadius: '4px',
|
|
21
|
+
fontSize: 'inherit',
|
|
22
|
+
display: 'inline-block',
|
|
23
|
+
verticalAlign: 'middle',
|
|
24
|
+
'& fieldset': {
|
|
25
|
+
border: 0
|
|
26
|
+
},
|
|
27
|
+
'& .MuiOutlinedInput-input': {
|
|
28
|
+
color: _renderUi.color.text(),
|
|
29
|
+
backgroundColor: _renderUi.color.background(),
|
|
30
|
+
borderRadius: '4px !important',
|
|
31
|
+
borderWidth: '1px',
|
|
32
|
+
borderStyle: 'solid',
|
|
33
|
+
padding: '10px 20px 10px 10px',
|
|
34
|
+
'&:disabled': {
|
|
35
|
+
opacity: 0.8,
|
|
36
|
+
cursor: 'not-allowed !important'
|
|
37
|
+
},
|
|
38
|
+
'&:hover': {
|
|
39
|
+
borderColor: _renderUi.color.primary(),
|
|
40
|
+
'&:disabled': {
|
|
41
|
+
borderColor: 'initial'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
'&.Mui-focused': {
|
|
45
|
+
borderColor: _renderUi.color.primaryDark()
|
|
46
|
+
},
|
|
47
|
+
'&.crInput': {
|
|
48
|
+
padding: '8px !important'
|
|
49
|
+
},
|
|
50
|
+
'&.correct': {
|
|
51
|
+
borderColor: "".concat(_renderUi.color.correct(), " !important")
|
|
52
|
+
},
|
|
53
|
+
'&.incorrect': {
|
|
54
|
+
borderColor: "".concat(_renderUi.color.incorrect(), " !important")
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
var CorrectInput = function CorrectInput(props) {
|
|
60
|
+
var correct = props.correct,
|
|
61
|
+
charactersLimit = props.charactersLimit,
|
|
62
|
+
disabled = props.disabled,
|
|
63
|
+
isBox = props.isBox,
|
|
64
|
+
isConstructedResponse = props.isConstructedResponse,
|
|
65
|
+
width = props.width,
|
|
66
|
+
spellCheck = props.spellCheck,
|
|
67
|
+
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
68
|
+
var label = typeof correct === 'boolean' ? correct ? 'correct' : 'incorrect' : undefined;
|
|
69
|
+
var inputProps = charactersLimit ? {
|
|
70
|
+
maxLength: charactersLimit,
|
|
71
|
+
'aria-label': 'Enter answer'
|
|
72
|
+
} : {
|
|
73
|
+
'aria-label': 'Enter answer'
|
|
74
|
+
};
|
|
75
|
+
if (width) {
|
|
76
|
+
inputProps.style = {
|
|
77
|
+
width: "".concat(width + Math.round(width / 10) + 1, "ch") // added some extra space for capital letters
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return /*#__PURE__*/_react["default"].createElement(StyledOutlinedInput, (0, _extends2["default"])({
|
|
81
|
+
className: (0, _classnames2["default"])({
|
|
82
|
+
disabledInput: disabled,
|
|
83
|
+
box: isBox
|
|
84
|
+
}),
|
|
85
|
+
classes: {
|
|
86
|
+
input: (0, _classnames2["default"])((0, _defineProperty2["default"])((0, _defineProperty2["default"])({}, label, label), "crInput", isConstructedResponse))
|
|
87
|
+
},
|
|
88
|
+
inputProps: inputProps,
|
|
89
|
+
disabled: disabled,
|
|
90
|
+
spellCheck: spellCheck
|
|
91
|
+
}, rest));
|
|
92
|
+
};
|
|
93
|
+
var _default = exports["default"] = CorrectInput;
|
|
94
|
+
//# sourceMappingURL=correct-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correct-input.js","names":["_react","_interopRequireDefault","require","_OutlinedInput","_classnames2","_styles","_renderUi","_excluded","StyledOutlinedInput","styled","OutlinedInput","padding","borderRadius","fontSize","display","verticalAlign","border","color","text","backgroundColor","background","borderWidth","borderStyle","opacity","cursor","borderColor","primary","primaryDark","concat","correct","incorrect","CorrectInput","props","charactersLimit","disabled","isBox","isConstructedResponse","width","spellCheck","rest","_objectWithoutProperties2","label","undefined","inputProps","maxLength","style","Math","round","createElement","_extends2","className","classnames","disabledInput","box","classes","input","_defineProperty2","_default","exports"],"sources":["../../src/components/correct-input.jsx"],"sourcesContent":["import React from 'react';\nimport OutlinedInput from '@mui/material/OutlinedInput';\nimport classnames from 'classnames';\nimport { styled } from '@mui/material/styles';\nimport { color } from '@pie-lib/render-ui';\n\nconst StyledOutlinedInput = styled(OutlinedInput)(() => ({\n padding: '2px',\n borderRadius: '4px',\n fontSize: 'inherit',\n display: 'inline-block',\n verticalAlign: 'middle',\n '& fieldset': {\n border: 0,\n },\n '& .MuiOutlinedInput-input': {\n color: color.text(),\n backgroundColor: color.background(),\n borderRadius: '4px !important',\n borderWidth: '1px',\n borderStyle: 'solid',\n padding: '10px 20px 10px 10px',\n '&:disabled': {\n opacity: 0.8,\n cursor: 'not-allowed !important',\n },\n '&:hover': {\n borderColor: color.primary(),\n '&:disabled': {\n borderColor: 'initial',\n },\n },\n '&.Mui-focused': {\n borderColor: color.primaryDark(),\n },\n '&.crInput': {\n padding: '8px !important',\n },\n '&.correct': {\n borderColor: `${color.correct()} !important`,\n },\n '&.incorrect': {\n borderColor: `${color.incorrect()} !important`,\n },\n },\n}));\n\nconst CorrectInput = (props) => {\n const { correct, charactersLimit, disabled, isBox, isConstructedResponse, width, spellCheck, ...rest } = props;\n\n const label = typeof correct === 'boolean' ? (correct ? 'correct' : 'incorrect') : undefined;\n const inputProps = charactersLimit\n ? { maxLength: charactersLimit, 'aria-label': 'Enter answer' }\n : { 'aria-label': 'Enter answer' };\n\n if (width) {\n inputProps.style = {\n width: `${width + Math.round(width / 10) + 1}ch`, // added some extra space for capital letters\n };\n }\n\n return (\n <StyledOutlinedInput\n className={classnames({\n disabledInput: disabled,\n box: isBox,\n })}\n classes={{\n input: classnames({\n [label]: label,\n crInput: isConstructedResponse,\n }),\n }}\n inputProps={inputProps}\n disabled={disabled}\n spellCheck={spellCheck}\n {...rest}\n />\n );\n};\n\nexport default CorrectInput;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAA2C,IAAAK,SAAA;AAE3C,IAAMC,mBAAmB,GAAG,IAAAC,cAAM,EAACC,yBAAa,CAAC,CAAC;EAAA,OAAO;IACvDC,OAAO,EAAE,KAAK;IACdC,YAAY,EAAE,KAAK;IACnBC,QAAQ,EAAE,SAAS;IACnBC,OAAO,EAAE,cAAc;I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