@pie-lib/drag 2.18.3-next.12 → 2.19.0-mui-update.0
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 +5 -24
- package/lib/drag-in-the-blank-dp.js +28 -24
- package/lib/drag-in-the-blank-dp.js.map +1 -1
- package/lib/drag-provider.js +47 -0
- package/lib/drag-provider.js.map +1 -0
- package/lib/drag-type.js +2 -3
- package/lib/drag-type.js.map +1 -1
- package/lib/draggable-choice.js +87 -0
- package/lib/draggable-choice.js.map +1 -0
- package/lib/droppable-placeholder.js +33 -65
- package/lib/droppable-placeholder.js.map +1 -1
- package/lib/ica-dp.js +38 -26
- package/lib/ica-dp.js.map +1 -1
- package/lib/index.js +7 -35
- package/lib/index.js.map +1 -1
- package/lib/match-list-dp.js +38 -26
- package/lib/match-list-dp.js.map +1 -1
- package/lib/placeholder.js +77 -102
- package/lib/placeholder.js.map +1 -1
- package/lib/preview-component.js +67 -107
- package/lib/preview-component.js.map +1 -1
- package/lib/swap.js +1 -7
- package/lib/swap.js.map +1 -1
- package/lib/uid-context.js +4 -18
- package/lib/uid-context.js.map +1 -1
- package/package.json +12 -10
- package/src/drag-in-the-blank-dp.jsx +32 -15
- package/src/drag-provider.jsx +40 -0
- package/src/drag-type.js +1 -1
- package/src/draggable-choice.jsx +87 -0
- package/src/droppable-placeholder.jsx +38 -28
- package/src/ica-dp.jsx +41 -18
- package/src/index.js +4 -8
- package/src/match-list-dp.jsx +41 -18
- package/src/placeholder.jsx +64 -71
- package/src/preview-component.jsx +62 -70
- package/lib/choice.js +0 -129
- package/lib/choice.js.map +0 -1
- package/lib/with-drag-context.js +0 -59
- package/lib/with-drag-context.js.map +0 -1
- package/src/choice.jsx +0 -76
- package/src/with-drag-context.js +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -3,33 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [2.
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @pie-lib/drag
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# [2.21.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.18.0...@pie-lib/drag@2.21.0) (2025-10-16)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @pie-lib/drag
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
# [2.19.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.18.2...@pie-lib/drag@2.19.0-mui-update.0) (2025-10-31)
|
|
19
7
|
|
|
20
8
|
|
|
9
|
+
### Features
|
|
21
10
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [2.19.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.18.0...@pie-lib/drag@2.19.0) (2025-10-16)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @pie-lib/drag
|
|
11
|
+
* drag library update ([fb7a4d0](https://github.com/pie-framework/pie-lib/commit/fb7a4d0ce761f2f4c1a122854cfa306abb8ea7c8))
|
|
12
|
+
* **drag:** update drag package to corresp to material v5 PD-5258 ([7400327](https://github.com/pie-framework/pie-lib/commit/740032735077939f4e05897aaf6b618bfa5b236d))
|
|
13
|
+
* bump react and react-dom ([01dc19e](https://github.com/pie-framework/pie-lib/commit/01dc19e88bbc8d372c561d1511df1a82937d45af))
|
|
33
14
|
|
|
34
15
|
|
|
35
16
|
|
|
@@ -1,35 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
7
|
+
exports.DragInTheBlankDroppable = DragInTheBlankDroppable;
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _droppablePlaceholder = require("./droppable-placeholder");
|
|
14
|
+
var _excluded = ["id", "children", "disabled", "onDrop"];
|
|
15
|
+
// With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback
|
|
16
|
+
// This component now just wraps DroppablePlaceholder with drag-in-the-blank specific logic
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
function DragInTheBlankDroppable(_ref) {
|
|
19
|
+
var id = _ref.id,
|
|
20
|
+
children = _ref.children,
|
|
21
|
+
disabled = _ref.disabled,
|
|
22
|
+
onDrop = _ref.onDrop,
|
|
23
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
24
|
+
// The actual drop handling will be managed by the parent component
|
|
25
|
+
// through the DragProvider's onDragEnd callback
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_droppablePlaceholder.DroppablePlaceholder, (0, _extends2["default"])({
|
|
28
|
+
id: id,
|
|
29
|
+
disabled: disabled
|
|
30
|
+
}, rest), children);
|
|
31
|
+
}
|
|
32
|
+
DragInTheBlankDroppable.propTypes = {
|
|
33
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]).isRequired,
|
|
34
|
+
children: _propTypes["default"].node,
|
|
35
|
+
disabled: _propTypes["default"].bool,
|
|
36
|
+
onDrop: _propTypes["default"].func
|
|
25
37
|
};
|
|
26
|
-
exports
|
|
27
|
-
var WithTarget = (0, _reactDnd.DropTarget)(_dragType["default"].types.db, spec, function (connect, monitor) {
|
|
28
|
-
return {
|
|
29
|
-
connectDropTarget: connect.dropTarget(),
|
|
30
|
-
isOver: monitor.isOver()
|
|
31
|
-
};
|
|
32
|
-
})(_droppablePlaceholder.DroppablePlaceholder);
|
|
33
|
-
var _default = WithTarget;
|
|
34
|
-
exports["default"] = _default;
|
|
38
|
+
var _default = exports["default"] = DragInTheBlankDroppable;
|
|
35
39
|
//# sourceMappingURL=drag-in-the-blank-dp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"drag-in-the-blank-dp.js","names":["_react","_interopRequireDefault","require","_propTypes","_droppablePlaceholder","_excluded","DragInTheBlankDroppable","_ref","id","children","disabled","onDrop","rest","_objectWithoutProperties2","createElement","DroppablePlaceholder","_extends2","propTypes","PropTypes","oneOfType","string","number","isRequired","node","bool","func","_default","exports"],"sources":["../src/drag-in-the-blank-dp.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { DroppablePlaceholder } from './droppable-placeholder';\n\n// With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback\n// This component now just wraps DroppablePlaceholder with drag-in-the-blank specific logic\n\nexport function DragInTheBlankDroppable({ \n id, \n children, \n disabled, \n onDrop,\n ...rest \n}) {\n // The actual drop handling will be managed by the parent component\n // through the DragProvider's onDragEnd callback\n \n return (\n <DroppablePlaceholder\n id={id}\n disabled={disabled}\n {...rest}\n >\n {children}\n </DroppablePlaceholder>\n );\n}\n\nDragInTheBlankDroppable.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n children: PropTypes.node,\n disabled: PropTypes.bool,\n onDrop: PropTypes.func,\n};\n\nexport default DragInTheBlankDroppable;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAA+D,IAAAG,SAAA;AAE/D;AACA;;AAEO,SAASC,uBAAuBA,CAAAC,IAAA,EAMpC;EAAA,IALDC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IACFC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACHC,IAAI,OAAAC,yBAAA,aAAAN,IAAA,EAAAF,SAAA;EAEP;EACA;;EAEA,oBACEL,MAAA,YAAAc,aAAA,CAACV,qBAAA,CAAAW,oBAAoB,MAAAC,SAAA;IACnBR,EAAE,EAAEA,EAAG;IACPE,QAAQ,EAAEA;EAAS,GACfE,IAAI,GAEPH,QACmB,CAAC;AAE3B;AAEAH,uBAAuB,CAACW,SAAS,GAAG;EAClCT,EAAE,EAAEU,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACG,MAAM,CAAC,CAAC,CAACC,UAAU;EACxEb,QAAQ,EAAES,qBAAS,CAACK,IAAI;EACxBb,QAAQ,EAAEQ,qBAAS,CAACM,IAAI;EACxBb,MAAM,EAAEO,qBAAS,CAACO;AACpB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEarB,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.DragProvider = DragProvider;
|
|
9
|
+
exports["default"] = void 0;
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _core = require("@dnd-kit/core");
|
|
14
|
+
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); }
|
|
15
|
+
function DragProvider(_ref) {
|
|
16
|
+
var children = _ref.children,
|
|
17
|
+
onDragEnd = _ref.onDragEnd;
|
|
18
|
+
var _useState = (0, _react.useState)(null),
|
|
19
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
20
|
+
activeId = _useState2[0],
|
|
21
|
+
setActiveId = _useState2[1];
|
|
22
|
+
var sensors = (0, _core.useSensors)((0, _core.useSensor)(_core.PointerSensor, {
|
|
23
|
+
activationConstraint: {
|
|
24
|
+
distance: 8
|
|
25
|
+
}
|
|
26
|
+
}), (0, _core.useSensor)(_core.KeyboardSensor));
|
|
27
|
+
var handleDragStart = function handleDragStart(event) {
|
|
28
|
+
setActiveId(event.active.id);
|
|
29
|
+
};
|
|
30
|
+
var handleDragEnd = function handleDragEnd(event) {
|
|
31
|
+
setActiveId(null);
|
|
32
|
+
if (onDragEnd) {
|
|
33
|
+
onDragEnd(event);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return /*#__PURE__*/_react["default"].createElement(_core.DndContext, {
|
|
37
|
+
sensors: sensors,
|
|
38
|
+
onDragStart: handleDragStart,
|
|
39
|
+
onDragEnd: handleDragEnd
|
|
40
|
+
}, children);
|
|
41
|
+
}
|
|
42
|
+
DragProvider.propTypes = {
|
|
43
|
+
children: _propTypes["default"].node.isRequired,
|
|
44
|
+
onDragEnd: _propTypes["default"].func
|
|
45
|
+
};
|
|
46
|
+
var _default = exports["default"] = DragProvider;
|
|
47
|
+
//# sourceMappingURL=drag-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-provider.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_core","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","DragProvider","_ref","children","onDragEnd","_useState","useState","_useState2","_slicedToArray2","activeId","setActiveId","sensors","useSensors","useSensor","PointerSensor","activationConstraint","distance","KeyboardSensor","handleDragStart","event","active","id","handleDragEnd","createElement","DndContext","onDragStart","propTypes","PropTypes","node","isRequired","func","_default","exports"],"sources":["../src/drag-provider.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { DndContext, PointerSensor, KeyboardSensor, useSensor, useSensors } from '@dnd-kit/core';\n\nexport function DragProvider({ children, onDragEnd }) {\n const [activeId, setActiveId] = useState(null);\n \n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 8 }}),\n useSensor(KeyboardSensor)\n );\n\n const handleDragStart = (event) => {\n setActiveId(event.active.id);\n };\n\n const handleDragEnd = (event) => {\n setActiveId(null);\n if (onDragEnd) {\n onDragEnd(event);\n }\n };\n\n return (\n <DndContext \n sensors={sensors} \n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n >\n {children}\n </DndContext>\n );\n}\n\nDragProvider.propTypes = {\n children: PropTypes.node.isRequired,\n onDragEnd: PropTypes.func,\n};\n\nexport default DragProvider;"],"mappings":";;;;;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AAgC,IAAAC,eAAQ,EAAC,IAAI,CAAC;IAAAC,UAAA,OAAAC,eAAA,aAAAH,SAAA;IAAvCI,QAAQ,GAAAF,UAAA;IAAEG,WAAW,GAAAH,UAAA;EAE5B,IAAMI,OAAO,GAAG,IAAAC,gBAAU,EACxB,IAAAC,eAAS,EAACC,mBAAa,EAAE;IAAEC,oBAAoB,EAAE;MAAEC,QAAQ,EAAE;IAAE;EAAC,CAAC,CAAC,EAClE,IAAAH,eAAS,EAACI,oBAAc,CAC1B,CAAC;EAED,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,KAAK,EAAK;IACjCT,WAAW,CAACS,KAAK,CAACC,MAAM,CAACC,EAAE,CAAC;EAC9B,CAAC;EAED,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAIH,KAAK,EAAK;IAC/BT,WAAW,CAAC,IAAI,CAAC;IACjB,IAAIN,SAAS,EAAE;MACbA,SAAS,CAACe,KAAK,CAAC;IAClB;EACF,CAAC;EAED,oBACE5C,MAAA,YAAAgD,aAAA,CAAC3C,KAAA,CAAA4C,UAAU;IACTb,OAAO,EAAEA,OAAQ;IACjBc,WAAW,EAAEP,eAAgB;IAC7Bd,SAAS,EAAEkB;EAAc,GAExBnB,QACS,CAAC;AAEjB;AAEAF,YAAY,CAACyB,SAAS,GAAG;EACvBvB,QAAQ,EAAEwB,qBAAS,CAACC,IAAI,CAACC,UAAU;EACnCzB,SAAS,EAAEuB,qBAAS,CAACG;AACvB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa/B,YAAY","ignoreList":[]}
|
package/lib/drag-type.js
CHANGED
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
var _default = {
|
|
7
|
+
var _default = exports["default"] = {
|
|
8
8
|
types: {
|
|
9
|
-
ica: '
|
|
9
|
+
ica: 'dnd-kit-response',
|
|
10
10
|
ml: 'Answer',
|
|
11
11
|
db: 'MaskBlank'
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
exports["default"] = _default;
|
|
15
14
|
//# sourceMappingURL=drag-type.js.map
|
package/lib/drag-type.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"drag-type.js","names":["types","ica","ml","db"],"sources":["../src/drag-type.js"],"sourcesContent":["export default {\n types: {\n ica: 'dnd-kit-response',\n ml: 'Answer',\n db: 'MaskBlank',\n },\n};\n"],"mappings":";;;;;;oCAAe;EACbA,KAAK,EAAE;IACLC,GAAG,EAAE,kBAAkB;IACvBC,EAAE,EAAE,QAAQ;IACZC,EAAE,EAAE;EACN;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.DRAG_TYPE = void 0;
|
|
8
|
+
exports.DraggableChoice = DraggableChoice;
|
|
9
|
+
exports["default"] = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _core = require("@dnd-kit/core");
|
|
15
|
+
var _utilities = require("@dnd-kit/utilities");
|
|
16
|
+
var _colors = require("@mui/material/colors");
|
|
17
|
+
var DRAG_TYPE = exports.DRAG_TYPE = 'CHOICE';
|
|
18
|
+
var StyledChoice = (0, _styles.styled)('div')(function (_ref) {
|
|
19
|
+
var theme = _ref.theme,
|
|
20
|
+
isDragging = _ref.isDragging;
|
|
21
|
+
return {
|
|
22
|
+
backgroundColor: theme.palette.background.paper,
|
|
23
|
+
border: "solid 1px ".concat(_colors.grey[400]),
|
|
24
|
+
padding: theme.spacing(1),
|
|
25
|
+
minHeight: '30px',
|
|
26
|
+
minWidth: theme.spacing(20),
|
|
27
|
+
maxWidth: theme.spacing(75),
|
|
28
|
+
cursor: 'grab',
|
|
29
|
+
opacity: isDragging ? 0.5 : 1,
|
|
30
|
+
'&:active': {
|
|
31
|
+
cursor: 'grabbing'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
function DraggableChoice(_ref2) {
|
|
36
|
+
var choice = _ref2.choice,
|
|
37
|
+
children = _ref2.children,
|
|
38
|
+
className = _ref2.className,
|
|
39
|
+
disabled = _ref2.disabled,
|
|
40
|
+
category = _ref2.category,
|
|
41
|
+
alternateResponseIndex = _ref2.alternateResponseIndex,
|
|
42
|
+
choiceIndex = _ref2.choiceIndex,
|
|
43
|
+
onRemoveChoice = _ref2.onRemoveChoice;
|
|
44
|
+
var _useDraggable = (0, _core.useDraggable)({
|
|
45
|
+
id: choice.id,
|
|
46
|
+
disabled: disabled,
|
|
47
|
+
data: {
|
|
48
|
+
value: choice.value,
|
|
49
|
+
choiceId: choice.id,
|
|
50
|
+
from: category === null || category === void 0 ? void 0 : category.id,
|
|
51
|
+
alternateResponseIndex: alternateResponseIndex,
|
|
52
|
+
choiceIndex: choiceIndex,
|
|
53
|
+
onRemoveChoice: onRemoveChoice
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
attributes = _useDraggable.attributes,
|
|
57
|
+
listeners = _useDraggable.listeners,
|
|
58
|
+
setNodeRef = _useDraggable.setNodeRef,
|
|
59
|
+
transform = _useDraggable.transform,
|
|
60
|
+
isDragging = _useDraggable.isDragging;
|
|
61
|
+
var style = {
|
|
62
|
+
transform: _utilities.CSS.Translate.toString(transform)
|
|
63
|
+
};
|
|
64
|
+
return /*#__PURE__*/_react["default"].createElement(StyledChoice, (0, _extends2["default"])({
|
|
65
|
+
ref: setNodeRef,
|
|
66
|
+
style: style,
|
|
67
|
+
className: className,
|
|
68
|
+
isDragging: isDragging
|
|
69
|
+
}, attributes, listeners), children);
|
|
70
|
+
}
|
|
71
|
+
DraggableChoice.propTypes = {
|
|
72
|
+
choice: _propTypes["default"].shape({
|
|
73
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]).isRequired,
|
|
74
|
+
value: _propTypes["default"].any
|
|
75
|
+
}).isRequired,
|
|
76
|
+
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]),
|
|
77
|
+
className: _propTypes["default"].string,
|
|
78
|
+
disabled: _propTypes["default"].bool,
|
|
79
|
+
category: _propTypes["default"].shape({
|
|
80
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
|
|
81
|
+
}),
|
|
82
|
+
alternateResponseIndex: _propTypes["default"].number,
|
|
83
|
+
choiceIndex: _propTypes["default"].number,
|
|
84
|
+
onRemoveChoice: _propTypes["default"].func
|
|
85
|
+
};
|
|
86
|
+
var _default = exports["default"] = DraggableChoice;
|
|
87
|
+
//# sourceMappingURL=draggable-choice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draggable-choice.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_core","_utilities","_colors","DRAG_TYPE","exports","StyledChoice","styled","_ref","theme","isDragging","backgroundColor","palette","background","paper","border","concat","grey","padding","spacing","minHeight","minWidth","maxWidth","cursor","opacity","DraggableChoice","_ref2","choice","children","className","disabled","category","alternateResponseIndex","choiceIndex","onRemoveChoice","_useDraggable","useDraggable","id","data","value","choiceId","from","attributes","listeners","setNodeRef","transform","style","CSS","Translate","toString","createElement","_extends2","ref","propTypes","PropTypes","shape","oneOfType","string","number","isRequired","any","arrayOf","node","bool","func","_default"],"sources":["../src/draggable-choice.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { styled } from '@mui/material/styles';\nimport { useDraggable } from '@dnd-kit/core';\nimport { CSS } from '@dnd-kit/utilities';\nimport { grey } from '@mui/material/colors';\n\nexport const DRAG_TYPE = 'CHOICE';\n\nconst StyledChoice = styled('div')(({ theme, isDragging }) => ({\n backgroundColor: theme.palette.background.paper,\n border: `solid 1px ${grey[400]}`,\n padding: theme.spacing(1),\n minHeight: '30px',\n minWidth: theme.spacing(20),\n maxWidth: theme.spacing(75),\n cursor: 'grab',\n opacity: isDragging ? 0.5 : 1,\n '&:active': {\n cursor: 'grabbing',\n },\n}));\n\nexport function DraggableChoice({ \n choice, \n children, \n className,\n disabled,\n category,\n alternateResponseIndex,\n choiceIndex,\n onRemoveChoice\n}) {\n const { \n attributes, \n listeners, \n setNodeRef, \n transform, \n isDragging \n } = useDraggable({\n id: choice.id,\n disabled: disabled,\n data: { \n value: choice.value,\n choiceId: choice.id,\n from: category?.id,\n alternateResponseIndex,\n choiceIndex,\n onRemoveChoice\n }\n });\n\n const style = {\n transform: CSS.Translate.toString(transform),\n };\n\n return (\n <StyledChoice \n ref={setNodeRef}\n style={style}\n className={className}\n isDragging={isDragging}\n {...attributes}\n {...listeners}\n >\n {children}\n </StyledChoice>\n );\n}\n\nDraggableChoice.propTypes = {\n choice: PropTypes.shape({\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n value: PropTypes.any,\n }).isRequired,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n className: PropTypes.string,\n disabled: PropTypes.bool,\n category: PropTypes.shape({\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n }),\n alternateResponseIndex: PropTypes.number,\n choiceIndex: PropTypes.number,\n onRemoveChoice: PropTypes.func,\n};\n\nexport default DraggableChoice;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;A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AAI,CAAC,CAAC;EAClFjC,SAAS,EAAEyB,qBAAS,CAACG,MAAM;EAC3B3B,QAAQ,EAAEwB,qBAAS,CAACS,IAAI;EACxBhC,QAAQ,EAAEuB,qBAAS,CAACC,KAAK,CAAC;IACxBlB,EAAE,EAAEiB,qBAAS,CAACE,SAAS,CAAC,CAACF,qBAAS,CAACG,MAAM,EAAEH,qBAAS,CAACI,MAAM,CAAC;EAC9D,CAAC,CAAC;EACF1B,sBAAsB,EAAEsB,qBAAS,CAACI,MAAM;EACxCzB,WAAW,EAAEqB,qBAAS,CAACI,MAAM;EAC7BxB,cAAc,EAAEoB,qBAAS,CAACU;AAC5B,CAAC;AAAC,IAAAC,QAAA,GAAA5D,OAAA,cAEaoB,eAAe","ignoreList":[]}
|
|
@@ -1,82 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.DroppablePlaceholder =
|
|
9
|
-
|
|
10
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
20
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
7
|
+
exports.DroppablePlaceholder = DroppablePlaceholder;
|
|
8
|
+
exports["default"] = void 0;
|
|
22
9
|
var _react = _interopRequireDefault(require("react"));
|
|
23
|
-
|
|
24
10
|
var _placeholder = _interopRequireDefault(require("./placeholder"));
|
|
25
|
-
|
|
26
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
29
|
-
|
|
30
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
|
-
|
|
12
|
+
var _core = require("@dnd-kit/core");
|
|
32
13
|
var preventInteractionStyle = {
|
|
33
14
|
flex: 1
|
|
34
15
|
};
|
|
35
|
-
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
choiceBoard: true,
|
|
63
|
-
className: classes,
|
|
64
|
-
isVerticalPool: isVerticalPool,
|
|
65
|
-
minHeight: minHeight
|
|
66
|
-
}, children)));
|
|
67
|
-
}
|
|
68
|
-
}]);
|
|
69
|
-
return DroppablePlaceholder;
|
|
70
|
-
}(_react["default"].Component);
|
|
71
|
-
|
|
72
|
-
exports.DroppablePlaceholder = DroppablePlaceholder;
|
|
73
|
-
(0, _defineProperty2["default"])(DroppablePlaceholder, "propTypes", {
|
|
74
|
-
classes: _propTypes["default"].object,
|
|
75
|
-
connectDropTarget: _propTypes["default"].func.isRequired,
|
|
76
|
-
isOver: _propTypes["default"].bool,
|
|
16
|
+
function DroppablePlaceholder(_ref) {
|
|
17
|
+
var id = _ref.id,
|
|
18
|
+
children = _ref.children,
|
|
19
|
+
disabled = _ref.disabled,
|
|
20
|
+
classes = _ref.classes,
|
|
21
|
+
isVerticalPool = _ref.isVerticalPool,
|
|
22
|
+
minHeight = _ref.minHeight;
|
|
23
|
+
var _useDroppable = (0, _core.useDroppable)({
|
|
24
|
+
id: id,
|
|
25
|
+
disabled: disabled
|
|
26
|
+
}),
|
|
27
|
+
setNodeRef = _useDroppable.setNodeRef,
|
|
28
|
+
isOver = _useDroppable.isOver;
|
|
29
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
30
|
+
ref: setNodeRef,
|
|
31
|
+
style: preventInteractionStyle
|
|
32
|
+
}, /*#__PURE__*/_react["default"].createElement(_placeholder["default"], {
|
|
33
|
+
disabled: disabled,
|
|
34
|
+
isOver: isOver,
|
|
35
|
+
choiceBoard: true,
|
|
36
|
+
className: classes,
|
|
37
|
+
isVerticalPool: isVerticalPool,
|
|
38
|
+
minHeight: minHeight
|
|
39
|
+
}, children));
|
|
40
|
+
}
|
|
41
|
+
DroppablePlaceholder.propTypes = {
|
|
42
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]).isRequired,
|
|
77
43
|
children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired,
|
|
78
44
|
disabled: _propTypes["default"].bool,
|
|
45
|
+
classes: _propTypes["default"].object,
|
|
79
46
|
isVerticalPool: _propTypes["default"].bool,
|
|
80
47
|
minHeight: _propTypes["default"].number
|
|
81
|
-
}
|
|
48
|
+
};
|
|
49
|
+
var _default = exports["default"] = DroppablePlaceholder;
|
|
82
50
|
//# sourceMappingURL=droppable-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"droppable-placeholder.js","names":["_react","_interopRequireDefault","require","_placeholder","_propTypes","_core","preventInteractionStyle","flex","DroppablePlaceholder","_ref","id","children","disabled","classes","isVerticalPool","minHeight","_useDroppable","useDroppable","setNodeRef","isOver","createElement","ref","style","choiceBoard","className","propTypes","PropTypes","oneOfType","string","number","isRequired","arrayOf","node","bool","object","_default","exports"],"sources":["../src/droppable-placeholder.jsx"],"sourcesContent":["import React from 'react';\nimport PlaceHolder from './placeholder';\nimport PropTypes from 'prop-types';\nimport { useDroppable } from '@dnd-kit/core';\n\nconst preventInteractionStyle = {\n flex: 1,\n};\n\nexport function DroppablePlaceholder({ \n id,\n children, \n disabled, \n classes, \n isVerticalPool, \n minHeight \n}) {\n const { setNodeRef, isOver } = useDroppable({ \n id,\n disabled \n });\n\n return (\n <div ref={setNodeRef} style={preventInteractionStyle}>\n <PlaceHolder\n disabled={disabled}\n isOver={isOver}\n choiceBoard={true}\n className={classes}\n isVerticalPool={isVerticalPool}\n minHeight={minHeight}\n >\n {children}\n </PlaceHolder>\n </div>\n );\n}\n\nDroppablePlaceholder.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,\n disabled: PropTypes.bool,\n classes: PropTypes.object,\n isVerticalPool: PropTypes.bool,\n minHeight: PropTypes.number,\n};\n\nexport default DroppablePlaceholder;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,O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O,EAAEa,qBAAS,CAACQ,MAAM;EACzBpB,cAAc,EAAEY,qBAAS,CAACO,IAAI;EAC9BlB,SAAS,EAAEW,qBAAS,CAACG;AACvB,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,cAEa5B,oBAAoB","ignoreList":[]}
|
package/lib/ica-dp.js
CHANGED
|
@@ -1,37 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports.
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
7
|
+
exports.ICADroppable = ICADroppable;
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
13
|
var _droppablePlaceholder = require("./droppable-placeholder");
|
|
14
|
+
var _excluded = ["id", "children", "disabled", "onRemoveAnswer"];
|
|
15
|
+
// With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback
|
|
16
|
+
// This component now just wraps DroppablePlaceholder with ICA specific logic
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
function ICADroppable(_ref) {
|
|
19
|
+
var id = _ref.id,
|
|
20
|
+
children = _ref.children,
|
|
21
|
+
disabled = _ref.disabled,
|
|
22
|
+
onRemoveAnswer = _ref.onRemoveAnswer,
|
|
23
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
24
|
+
// The actual drop handling will be managed by the parent component
|
|
25
|
+
// through the DragProvider's onDragEnd callback
|
|
26
|
+
// The onRemoveAnswer logic should be handled in the parent's onDragEnd:
|
|
27
|
+
//
|
|
28
|
+
// const handleDragEnd = (event) => {
|
|
29
|
+
// if (event.over && event.active) {
|
|
30
|
+
// const item = event.active.data.current;
|
|
31
|
+
// if (onRemoveAnswer) {
|
|
32
|
+
// onRemoveAnswer(item);
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
35
|
+
// };
|
|
22
36
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
37
|
+
return /*#__PURE__*/_react["default"].createElement(_droppablePlaceholder.DroppablePlaceholder, (0, _extends2["default"])({
|
|
38
|
+
id: id,
|
|
39
|
+
disabled: disabled
|
|
40
|
+
}, rest), children);
|
|
41
|
+
}
|
|
42
|
+
ICADroppable.propTypes = {
|
|
43
|
+
id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]).isRequired,
|
|
44
|
+
children: _propTypes["default"].node,
|
|
45
|
+
disabled: _propTypes["default"].bool,
|
|
46
|
+
onRemoveAnswer: _propTypes["default"].func
|
|
27
47
|
};
|
|
28
|
-
exports
|
|
29
|
-
var WithTarget = (0, _reactDnd.DropTarget)(_dragType["default"].types.ica, spec, function (connect, monitor) {
|
|
30
|
-
return {
|
|
31
|
-
connectDropTarget: connect.dropTarget(),
|
|
32
|
-
isOver: monitor.isOver()
|
|
33
|
-
};
|
|
34
|
-
})(_droppablePlaceholder.DroppablePlaceholder);
|
|
35
|
-
var _default = WithTarget;
|
|
36
|
-
exports["default"] = _default;
|
|
48
|
+
var _default = exports["default"] = ICADroppable;
|
|
37
49
|
//# sourceMappingURL=ica-dp.js.map
|
package/lib/ica-dp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"ica-dp.js","names":["_react","_interopRequireDefault","require","_propTypes","_droppablePlaceholder","_excluded","ICADroppable","_ref","id","children","disabled","onRemoveAnswer","rest","_objectWithoutProperties2","createElement","DroppablePlaceholder","_extends2","propTypes","PropTypes","oneOfType","string","number","isRequired","node","bool","func","_default","exports"],"sources":["../src/ica-dp.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { DroppablePlaceholder } from './droppable-placeholder';\n\n// With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback\n// This component now just wraps DroppablePlaceholder with ICA specific logic\n\nexport function ICADroppable({ \n id, \n children, \n disabled, \n onRemoveAnswer,\n ...rest \n}) {\n // The actual drop handling will be managed by the parent component\n // through the DragProvider's onDragEnd callback\n // The onRemoveAnswer logic should be handled in the parent's onDragEnd:\n // \n // const handleDragEnd = (event) => {\n // if (event.over && event.active) {\n // const item = event.active.data.current;\n // if (onRemoveAnswer) {\n // onRemoveAnswer(item);\n // }\n // }\n // };\n \n return (\n <DroppablePlaceholder\n id={id}\n disabled={disabled}\n {...rest}\n >\n {children}\n </DroppablePlaceholder>\n );\n}\n\nICADroppable.propTypes = {\n id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n children: PropTypes.node,\n disabled: PropTypes.bool,\n onRemoveAnswer: PropTypes.func,\n};\n\nexport default ICADroppable;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAA+D,IAAAG,SAAA;AAE/D;AACA;;AAEO,SAASC,YAAYA,CAAAC,IAAA,EAMzB;EAAA,IALDC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IACFC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IACRC,cAAc,GAAAJ,IAAA,CAAdI,cAAc;IACXC,IAAI,OAAAC,yBAAA,aAAAN,IAAA,EAAAF,SAAA;EAEP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,oBACEL,MAAA,YAAAc,aAAA,CAACV,qBAAA,CAAAW,oBAAoB,MAAAC,SAAA;IACnBR,EAAE,EAAEA,EAAG;IACPE,QAAQ,EAAEA;EAAS,GACfE,IAAI,GAEPH,QACmB,CAAC;AAE3B;AAEAH,YAAY,CAACW,SAAS,GAAG;EACvBT,EAAE,EAAEU,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACG,MAAM,CAAC,CAAC,CAACC,UAAU;EACxEb,QAAQ,EAAES,qBAAS,CAACK,IAAI;EACxBb,QAAQ,EAAEQ,qBAAS,CAACM,IAAI;EACxBb,cAAc,EAAEO,qBAAS,CAACO;AAC5B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEarB,YAAY","ignoreList":[]}
|
package/lib/index.js
CHANGED
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
Object.defineProperty(exports, "Choice", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _choice["default"];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
8
|
Object.defineProperty(exports, "DragDroppablePlaceholder", {
|
|
17
9
|
enumerable: true,
|
|
18
10
|
get: function get() {
|
|
19
11
|
return _dragInTheBlankDp["default"];
|
|
20
12
|
}
|
|
21
13
|
});
|
|
22
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "DragProvider", {
|
|
23
15
|
enumerable: true,
|
|
24
16
|
get: function get() {
|
|
25
|
-
return
|
|
17
|
+
return _dragProvider["default"];
|
|
26
18
|
}
|
|
27
19
|
});
|
|
28
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "DraggableChoice", {
|
|
29
21
|
enumerable: true,
|
|
30
22
|
get: function get() {
|
|
31
|
-
return
|
|
23
|
+
return _draggableChoice["default"];
|
|
32
24
|
}
|
|
33
25
|
});
|
|
34
26
|
Object.defineProperty(exports, "ICADroppablePlaceholder", {
|
|
@@ -56,34 +48,14 @@ Object.defineProperty(exports, "swap", {
|
|
|
56
48
|
}
|
|
57
49
|
});
|
|
58
50
|
exports.uid = void 0;
|
|
59
|
-
Object.defineProperty(exports, "withDragContext", {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
get: function get() {
|
|
62
|
-
return _withDragContext["default"];
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
var _reactDnd = require("react-dnd");
|
|
67
|
-
|
|
68
51
|
var _placeholder = _interopRequireDefault(require("./placeholder"));
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
var _withDragContext = _interopRequireDefault(require("./with-drag-context"));
|
|
73
|
-
|
|
52
|
+
var _draggableChoice = _interopRequireDefault(require("./draggable-choice"));
|
|
53
|
+
var _dragProvider = _interopRequireDefault(require("./drag-provider"));
|
|
74
54
|
var _swap = _interopRequireDefault(require("./swap"));
|
|
75
|
-
|
|
76
55
|
var uid = _interopRequireWildcard(require("./uid-context"));
|
|
77
|
-
|
|
78
56
|
exports.uid = uid;
|
|
79
|
-
|
|
80
57
|
var _matchListDp = _interopRequireDefault(require("./match-list-dp"));
|
|
81
|
-
|
|
82
58
|
var _dragInTheBlankDp = _interopRequireDefault(require("./drag-in-the-blank-dp"));
|
|
83
|
-
|
|
84
59
|
var _icaDp = _interopRequireDefault(require("./ica-dp"));
|
|
85
|
-
|
|
86
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
87
|
-
|
|
88
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
60
|
+
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); }
|
|
89
61
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_placeholder","_interopRequireDefault","require","_draggableChoice","_dragProvider","_swap","uid","_interopRequireWildcard","exports","_matchListDp","_dragInTheBlankDp","_icaDp","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../src/index.js"],"sourcesContent":["import PlaceHolder from './placeholder';\nimport DraggableChoice from './draggable-choice';\nimport DragProvider from './drag-provider';\nimport swap from './swap';\nimport * as uid from './uid-context';\nimport MatchDroppablePlaceholder from './match-list-dp';\nimport DragDroppablePlaceholder from './drag-in-the-blank-dp';\nimport ICADroppablePlaceholder from './ica-dp';\n\nexport {\n PlaceHolder,\n MatchDroppablePlaceholder,\n DragDroppablePlaceholder,\n ICADroppablePlaceholder,\n DragProvider,\n DraggableChoice,\n swap,\n uid,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,GAAA,GAAAC,uBAAA,CAAAL,OAAA;AAAqCM,OAAA,CAAAF,GAAA,GAAAA,GAAA;AACrC,IAAAG,YAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,iBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,MAAA,GAAAV,sBAAA,CAAAC,OAAA;AAA+C,SAAAK,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,wBAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAA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