@pie-lib/drag 2.31.0-mui-update.0 → 2.32.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 CHANGED
@@ -3,6 +3,18 @@
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.32.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.31.0-mui-update.0...@pie-lib/drag@2.32.0-mui-update.0) (2025-12-11)
7
+
8
+
9
+ ### Features
10
+
11
+ * drag changes for ditb ([fc79ecd](https://github.com/pie-framework/pie-lib/commit/fc79ecdacb5693f1b5dcf19c7114f9cd4bed83ba))
12
+ * updates for drag-in-the-blank ([0c096d8](https://github.com/pie-framework/pie-lib/commit/0c096d887f97edecd2dac68cda136b2d265dc7d5))
13
+
14
+
15
+
16
+
17
+
6
18
  # [2.31.0-mui-update.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/drag@2.30.0-mui-update.0...@pie-lib/drag@2.31.0-mui-update.0) (2025-12-02)
7
19
 
8
20
 
@@ -6,34 +6,61 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.DragInTheBlankDroppable = DragInTheBlankDroppable;
8
8
  exports["default"] = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
10
  var _react = _interopRequireDefault(require("react"));
12
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
- var _droppablePlaceholder = require("./droppable-placeholder");
14
- var _excluded = ["id", "children", "disabled", "onDrop"];
12
+ var _placeholder = _interopRequireDefault(require("./placeholder"));
13
+ var _core = require("@dnd-kit/core");
14
+ var _styles = require("@mui/material/styles");
15
+ var _excluded = ["children", "disabled", "classes", "isVerticalPool", "minHeight", "instanceId"];
15
16
  // With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback
16
17
  // This component now just wraps DroppablePlaceholder with drag-in-the-blank specific logic
17
18
 
19
+ var DroppablePlaceholderContainer = (0, _styles.styled)('div')({
20
+ minHeight: '100px'
21
+ });
18
22
  function DragInTheBlankDroppable(_ref) {
19
- var id = _ref.id,
20
- children = _ref.children,
23
+ var children = _ref.children,
21
24
  disabled = _ref.disabled,
22
- onDrop = _ref.onDrop,
25
+ classes = _ref.classes,
26
+ isVerticalPool = _ref.isVerticalPool,
27
+ minHeight = _ref.minHeight,
28
+ instanceId = _ref.instanceId,
23
29
  rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
24
30
  // The actual drop handling will be managed by the parent component
25
31
  // through the DragProvider's onDragEnd callback
26
-
27
- return /*#__PURE__*/_react["default"].createElement(_droppablePlaceholder.DroppablePlaceholder, (0, _extends2["default"])({
28
- id: id,
29
- disabled: disabled
30
- }, rest), children);
32
+ var _useDroppable = (0, _core.useDroppable)({
33
+ id: 'drag-in-the-blank-droppable',
34
+ data: {
35
+ type: 'MaskBlank',
36
+ accepts: ['MaskBlank'],
37
+ id: 'drag-in-the-blank-droppable',
38
+ toChoiceBoard: true,
39
+ instanceId: instanceId
40
+ }
41
+ }),
42
+ setNodeRef = _useDroppable.setNodeRef,
43
+ isOver = _useDroppable.isOver;
44
+ return /*#__PURE__*/_react["default"].createElement("div", {
45
+ ref: setNodeRef
46
+ }, /*#__PURE__*/_react["default"].createElement(DroppablePlaceholderContainer, null, /*#__PURE__*/_react["default"].createElement(_placeholder["default"], {
47
+ isOver: isOver,
48
+ choiceBoard: true,
49
+ className: classes,
50
+ isVerticalPool: isVerticalPool,
51
+ extraStyles: {
52
+ width: '100%',
53
+ minHeight: minHeight || 100,
54
+ height: 'auto'
55
+ }
56
+ }, children)));
31
57
  }
32
58
  DragInTheBlankDroppable.propTypes = {
33
59
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]).isRequired,
34
60
  children: _propTypes["default"].node,
35
61
  disabled: _propTypes["default"].bool,
36
- onDrop: _propTypes["default"].func
62
+ onDrop: _propTypes["default"].func,
63
+ instanceId: _propTypes["default"].string
37
64
  };
38
65
  var _default = exports["default"] = DragInTheBlankDroppable;
39
66
  //# sourceMappingURL=drag-in-the-blank-dp.js.map
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"file":"drag-in-the-blank-dp.js","names":["_react","_interopRequireDefault","require","_propTypes","_placeholder","_core","_styles","_excluded","DroppablePlaceholderContainer","styled","minHeight","DragInTheBlankDroppable","_ref","children","disabled","classes","isVerticalPool","instanceId","rest","_objectWithoutProperties2","_useDroppable","useDroppable","id","data","type","accepts","toChoiceBoard","setNodeRef","isOver","createElement","ref","choiceBoard","className","extraStyles","width","height","propTypes","PropTypes","oneOfType","string","number","isRequired","node","bool","onDrop","func","_default","exports"],"sources":["../src/drag-in-the-blank-dp.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport PlaceHolder from './placeholder';\nimport { useDroppable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\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\nconst DroppablePlaceholderContainer = styled('div')({\n minHeight: '100px',\n});\n\nexport function DragInTheBlankDroppable({\n children,\n disabled,\n classes,\n isVerticalPool,\n minHeight,\n instanceId,\n ...rest\n}) {\n // The actual drop handling will be managed by the parent component\n // through the DragProvider's onDragEnd callback\n const { setNodeRef, isOver } = useDroppable({\n id: 'drag-in-the-blank-droppable',\n data: {\n type: 'MaskBlank',\n accepts: ['MaskBlank'],\n id: 'drag-in-the-blank-droppable',\n toChoiceBoard: true,\n instanceId\n }\n });\n\n return (\n <div ref={setNodeRef} >\n <DroppablePlaceholderContainer>\n <PlaceHolder\n isOver={isOver}\n choiceBoard={true}\n className={classes}\n isVerticalPool={isVerticalPool}\n extraStyles={{\n width: '100%',\n minHeight: minHeight || 100,\n height: 'auto',\n }}\n >\n {children}\n </PlaceHolder>\n </DroppablePlaceholderContainer>\n </div>\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 instanceId: PropTypes.string,\n};\n\nexport default DragInTheBlankDroppable;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAA8C,IAAAK,SAAA;AAE9C;AACA;;AAEA,IAAMC,6BAA6B,GAAG,IAAAC,cAAM,EAAC,KAAK,CAAC,CAAC;EAClDC,SAAS,EAAE;AACb,CAAC,CAAC;AAEK,SAASC,uBAAuBA,CAAAC,IAAA,EAQpC;EAAA,IAPDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,OAAO,GAAAH,IAAA,CAAPG,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AEoB,qBAAS,CAACE;AACxB,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,cAEapC,uBAAuB","ignoreList":[]}
@@ -15,7 +15,9 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
15
15
  function DragProvider(_ref) {
16
16
  var children = _ref.children,
17
17
  onDragEnd = _ref.onDragEnd,
18
- onDragStart = _ref.onDragStart;
18
+ onDragStart = _ref.onDragStart,
19
+ collisionDetection = _ref.collisionDetection,
20
+ modifiers = _ref.modifiers;
19
21
  var _useState = (0, _react.useState)(null),
20
22
  _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
21
23
  activeId = _useState2[0],
@@ -40,13 +42,17 @@ function DragProvider(_ref) {
40
42
  return /*#__PURE__*/_react["default"].createElement(_core.DndContext, {
41
43
  sensors: sensors,
42
44
  onDragStart: handleDragStart,
43
- onDragEnd: handleDragEnd
45
+ onDragEnd: handleDragEnd,
46
+ collisionDetection: collisionDetection,
47
+ modifiers: modifiers
44
48
  }, children);
45
49
  }
46
50
  DragProvider.propTypes = {
47
51
  children: _propTypes["default"].node.isRequired,
48
52
  onDragEnd: _propTypes["default"].func,
49
- onDragStart: _propTypes["default"].func
53
+ onDragStart: _propTypes["default"].func,
54
+ collisionDetection: _propTypes["default"].func,
55
+ modifiers: _propTypes["default"].arrayOf(_propTypes["default"].func)
50
56
  };
51
57
  var _default = exports["default"] = DragProvider;
52
58
  //# sourceMappingURL=drag-provider.js.map
@@ -1 +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","onDragStart","_useState","useState","_useState2","_slicedToArray2","activeId","setActiveId","sensors","useSensors","useSensor","PointerSensor","activationConstraint","distance","KeyboardSensor","handleDragStart","event","active","id","handleDragEnd","createElement","DndContext","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, onDragStart }) {\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 if (onDragStart) {\n onDragStart(event);\n }\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 onDragStart: PropTypes.func,\n};\n\nexport default DragProvider;"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAiG,SAAAD,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,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,U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AAaA,CAAIH,KAAK,EAAK;IAC/BT,WAAW,CAAC,IAAI,CAAC;IACjB,IAAIP,SAAS,EAAE;MACbA,SAAS,CAACgB,KAAK,CAAC;IAClB;EACF,CAAC;EAED,oBACE7C,MAAA,YAAAiD,aAAA,CAAC5C,KAAA,CAAA6C,UAAU;IACTb,OAAO,EAAEA,OAAQ;IACjBP,WAAW,EAAEc,eAAgB;IAC7Bf,SAAS,EAAEmB;EAAc,GAExBpB,QACS,CAAC;AAEjB;AAEAF,YAAY,CAACyB,SAAS,GAAG;EACvBvB,QAAQ,EAAEwB,qBAAS,CAACC,IAAI,CAACC,UAAU;EACnCzB,SAAS,EAAEuB,qBAAS,CAACG,IAAI;EACzBzB,WAAW,EAAEsB,qBAAS,CAACG;AACzB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa/B,YAAY","ignoreList":[]}
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","onDragStart","collisionDetection","modifiers","_useState","useState","_useState2","_slicedToArray2","activeId","setActiveId","sensors","useSensors","useSensor","PointerSensor","activationConstraint","distance","KeyboardSensor","handleDragStart","event","active","id","handleDragEnd","createElement","DndContext","propTypes","PropTypes","node","isRequired","func","arrayOf","_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, onDragStart, collisionDetection, modifiers }) {\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 if (onDragStart) {\n onDragStart(event);\n }\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 collisionDetection={collisionDetection}\n modifiers={modifiers}\n >\n {children}\n </DndContext>\n );\n}\n\nDragProvider.propTypes = {\n children: PropTypes.node.isRequired,\n onDragEnd: PropTypes.func,\n onDragStart: PropTypes.func,\n collisionDetection: PropTypes.func,\n modifiers: PropTypes.arrayOf(PropTypes.func),\n};\n\nexport default DragProvider;"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAAiG,SAAAD,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,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KAAAD,MAA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AAC9C,KAAA,CAAA+C,UAAU;IACTb,OAAO,EAAEA,OAAQ;IACjBT,WAAW,EAAEgB,eAAgB;IAC7BjB,SAAS,EAAEqB,aAAc;IACzBnB,kBAAkB,EAAEA,kBAAmB;IACvCC,SAAS,EAAEA;EAAU,GAEpBJ,QACS,CAAC;AAEjB;AAEAF,YAAY,CAAC2B,SAAS,GAAG;EACvBzB,QAAQ,EAAE0B,qBAAS,CAACC,IAAI,CAACC,UAAU;EACnC3B,SAAS,EAAEyB,qBAAS,CAACG,IAAI;EACzB3B,WAAW,EAAEwB,qBAAS,CAACG,IAAI;EAC3B1B,kBAAkB,EAAEuB,qBAAS,CAACG,IAAI;EAClCzB,SAAS,EAAEsB,qBAAS,CAACI,OAAO,CAACJ,qBAAS,CAACG,IAAI;AAC7C,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,cAEalC,YAAY","ignoreList":[]}
package/lib/ica-dp.js CHANGED
@@ -11,7 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
  var _react = _interopRequireDefault(require("react"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _droppablePlaceholder = require("./droppable-placeholder");
14
- var _excluded = ["id", "children", "disabled", "onRemoveAnswer"];
14
+ var _excluded = ["id", "children", "disabled"];
15
15
  // With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback
16
16
  // This component now just wraps DroppablePlaceholder with ICA specific logic
17
17
 
@@ -19,20 +19,9 @@ function ICADroppable(_ref) {
19
19
  var id = _ref.id,
20
20
  children = _ref.children,
21
21
  disabled = _ref.disabled,
22
- onRemoveAnswer = _ref.onRemoveAnswer,
23
22
  rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
24
23
  // The actual drop handling will be managed by the parent component
25
24
  // 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
- // };
36
25
 
37
26
  return /*#__PURE__*/_react["default"].createElement(_droppablePlaceholder.DroppablePlaceholder, (0, _extends2["default"])({
38
27
  id: id,
@@ -42,8 +31,7 @@ function ICADroppable(_ref) {
42
31
  ICADroppable.propTypes = {
43
32
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]).isRequired,
44
33
  children: _propTypes["default"].node,
45
- disabled: _propTypes["default"].bool,
46
- onRemoveAnswer: _propTypes["default"].func
34
+ disabled: _propTypes["default"].bool
47
35
  };
48
36
  var _default = exports["default"] = ICADroppable;
49
37
  //# sourceMappingURL=ica-dp.js.map
package/lib/ica-dp.js.map CHANGED
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"file":"ica-dp.js","names":["_react","_interopRequireDefault","require","_propTypes","_droppablePlaceholder","_excluded","ICADroppable","_ref","id","children","disabled","rest","_objectWithoutProperties2","createElement","DroppablePlaceholder","_extends2","propTypes","PropTypes","oneOfType","string","number","isRequired","node","bool","_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({ id, children, disabled, ...rest }) {\n // The actual drop handling will be managed by the parent component\n // through the DragProvider's onDragEnd callback\n\n return (\n <DroppablePlaceholder id={id} disabled={disabled} {...rest}>\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};\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,EAAsC;EAAA,IAAnCC,EAAE,GAAAD,IAAA,CAAFC,EAAE;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IAAEC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAKC,IAAI,OAAAC,yBAAA,aAAAL,IAAA,EAAAF,SAAA;EAC5D;EACA;;EAEA,oBACEL,MAAA,YAAAa,aAAA,CAACT,qBAAA,CAAAU,oBAAoB,MAAAC,SAAA;IAACP,EAAE,EAAEA,EAAG;IAACE,QAAQ,EAAEA;EAAS,GAAKC,IAAI,GACvDF,QACmB,CAAC;AAE3B;AAEAH,YAAY,CAACU,SAAS,GAAG;EACvBR,EAAE,EAAES,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,MAAM,EAAEF,qBAAS,CAACG,MAAM,CAAC,CAAC,CAACC,UAAU;EACxEZ,QAAQ,EAAEQ,qBAAS,CAACK,IAAI;EACxBZ,QAAQ,EAAEO,qBAAS,CAACM;AACtB,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEanB,YAAY","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/drag",
3
- "version": "2.31.0-mui-update.0",
3
+ "version": "2.32.0-mui-update.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -12,8 +12,8 @@
12
12
  "@emotion/style": "^0.8.0",
13
13
  "@mui/icons-material": "^7.3.4",
14
14
  "@mui/material": "^7.3.4",
15
- "@pie-lib/math-rendering": "3.35.0-mui-update.0",
16
- "@pie-lib/render-ui": "4.44.0-mui-update.0",
15
+ "@pie-lib/math-rendering": "3.36.0-mui-update.0",
16
+ "@pie-lib/render-ui": "4.45.0-mui-update.0",
17
17
  "classnames": "^2.2.6",
18
18
  "lodash": "^4.17.11",
19
19
  "prop-types": "^15.7.2",
@@ -25,5 +25,5 @@
25
25
  "scripts": {},
26
26
  "author": "",
27
27
  "license": "ISC",
28
- "gitHead": "23a7cb8864b947778ac7e6dffdc6fa4a74af5927"
28
+ "gitHead": "56f71068deecd32adaab99fd03515f1133919d9d"
29
29
  }
@@ -1,28 +1,56 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { DroppablePlaceholder } from './droppable-placeholder';
3
+ import PlaceHolder from './placeholder';
4
+ import { useDroppable } from '@dnd-kit/core';
5
+ import { styled } from '@mui/material/styles';
4
6
 
5
7
  // With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback
6
8
  // This component now just wraps DroppablePlaceholder with drag-in-the-blank specific logic
7
9
 
8
- export function DragInTheBlankDroppable({
9
- id,
10
- children,
11
- disabled,
12
- onDrop,
13
- ...rest
10
+ const DroppablePlaceholderContainer = styled('div')({
11
+ minHeight: '100px',
12
+ });
13
+
14
+ export function DragInTheBlankDroppable({
15
+ children,
16
+ disabled,
17
+ classes,
18
+ isVerticalPool,
19
+ minHeight,
20
+ instanceId,
21
+ ...rest
14
22
  }) {
15
23
  // The actual drop handling will be managed by the parent component
16
24
  // through the DragProvider's onDragEnd callback
17
-
25
+ const { setNodeRef, isOver } = useDroppable({
26
+ id: 'drag-in-the-blank-droppable',
27
+ data: {
28
+ type: 'MaskBlank',
29
+ accepts: ['MaskBlank'],
30
+ id: 'drag-in-the-blank-droppable',
31
+ toChoiceBoard: true,
32
+ instanceId
33
+ }
34
+ });
35
+
18
36
  return (
19
- <DroppablePlaceholder
20
- id={id}
21
- disabled={disabled}
22
- {...rest}
23
- >
24
- {children}
25
- </DroppablePlaceholder>
37
+ <div ref={setNodeRef} >
38
+ <DroppablePlaceholderContainer>
39
+ <PlaceHolder
40
+ isOver={isOver}
41
+ choiceBoard={true}
42
+ className={classes}
43
+ isVerticalPool={isVerticalPool}
44
+ extraStyles={{
45
+ width: '100%',
46
+ minHeight: minHeight || 100,
47
+ height: 'auto',
48
+ }}
49
+ >
50
+ {children}
51
+ </PlaceHolder>
52
+ </DroppablePlaceholderContainer>
53
+ </div>
26
54
  );
27
55
  }
28
56
 
@@ -31,6 +59,7 @@ DragInTheBlankDroppable.propTypes = {
31
59
  children: PropTypes.node,
32
60
  disabled: PropTypes.bool,
33
61
  onDrop: PropTypes.func,
62
+ instanceId: PropTypes.string,
34
63
  };
35
64
 
36
65
  export default DragInTheBlankDroppable;
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { DndContext, PointerSensor, KeyboardSensor, useSensor, useSensors } from '@dnd-kit/core';
4
4
 
5
- export function DragProvider({ children, onDragEnd, onDragStart }) {
5
+ export function DragProvider({ children, onDragEnd, onDragStart, collisionDetection, modifiers }) {
6
6
  const [activeId, setActiveId] = useState(null);
7
7
 
8
8
  const sensors = useSensors(
@@ -29,6 +29,8 @@ export function DragProvider({ children, onDragEnd, onDragStart }) {
29
29
  sensors={sensors}
30
30
  onDragStart={handleDragStart}
31
31
  onDragEnd={handleDragEnd}
32
+ collisionDetection={collisionDetection}
33
+ modifiers={modifiers}
32
34
  >
33
35
  {children}
34
36
  </DndContext>
@@ -39,6 +41,8 @@ DragProvider.propTypes = {
39
41
  children: PropTypes.node.isRequired,
40
42
  onDragEnd: PropTypes.func,
41
43
  onDragStart: PropTypes.func,
44
+ collisionDetection: PropTypes.func,
45
+ modifiers: PropTypes.arrayOf(PropTypes.func),
42
46
  };
43
47
 
44
48
  export default DragProvider;
package/src/ica-dp.jsx CHANGED
@@ -5,32 +5,12 @@ import { DroppablePlaceholder } from './droppable-placeholder';
5
5
  // With @dnd-kit, the drop logic is handled in the DragProvider's onDragEnd callback
6
6
  // This component now just wraps DroppablePlaceholder with ICA specific logic
7
7
 
8
- export function ICADroppable({
9
- id,
10
- children,
11
- disabled,
12
- onRemoveAnswer,
13
- ...rest
14
- }) {
8
+ export function ICADroppable({ id, children, disabled, ...rest }) {
15
9
  // The actual drop handling will be managed by the parent component
16
10
  // through the DragProvider's onDragEnd callback
17
- // The onRemoveAnswer logic should be handled in the parent's onDragEnd:
18
- //
19
- // const handleDragEnd = (event) => {
20
- // if (event.over && event.active) {
21
- // const item = event.active.data.current;
22
- // if (onRemoveAnswer) {
23
- // onRemoveAnswer(item);
24
- // }
25
- // }
26
- // };
27
-
11
+
28
12
  return (
29
- <DroppablePlaceholder
30
- id={id}
31
- disabled={disabled}
32
- {...rest}
33
- >
13
+ <DroppablePlaceholder id={id} disabled={disabled} {...rest}>
34
14
  {children}
35
15
  </DroppablePlaceholder>
36
16
  );
@@ -40,7 +20,6 @@ ICADroppable.propTypes = {
40
20
  id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
41
21
  children: PropTypes.node,
42
22
  disabled: PropTypes.bool,
43
- onRemoveAnswer: PropTypes.func,
44
23
  };
45
24
 
46
25
  export default ICADroppable;