@pie-element/placement-ordering 14.2.0-beta.0 → 14.2.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 +57 -7
- package/configure/CHANGELOG.md +51 -7
- package/configure/package.json +4 -4
- package/controller/CHANGELOG.md +13 -1
- package/controller/package.json +1 -1
- package/lib/keyboard-coordinates.js +124 -0
- package/lib/keyboard-coordinates.js.map +1 -0
- package/lib/placement-ordering.js +43 -6
- package/lib/placement-ordering.js.map +1 -1
- package/package.json +4 -3
- package/configure/lib/__tests__/choice-editor.test.js +0 -376
- package/configure/lib/__tests__/choice-tile.test.js +0 -283
- package/configure/lib/__tests__/design.test.js +0 -268
- package/configure/lib/__tests__/help.test.js +0 -64
- package/configure/lib/__tests__/index.test.js +0 -77
- package/configure/lib/__tests__/utils.test.js +0 -493
- package/controller/lib/__tests__/index.test.js +0 -401
- package/controller/lib/__tests__/scoring.test.js +0 -165
- package/docs/demo/pie.manifest.json +0 -11
- package/lib/__tests__/index-test.js +0 -90
- package/lib/__tests__/ordering.test.js +0 -133
- package/lib/__tests__/placement-ordering.test.js +0 -445
package/CHANGELOG.md
CHANGED
|
@@ -3,20 +3,70 @@
|
|
|
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
|
-
# [14.2.0
|
|
6
|
+
# [14.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.8...@pie-element/placement-ordering@14.2.0) (2026-08-13)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **match-list/placement-ordering:** scroll the interactive region horizontally when it does not fit PIE-766 & PIE-768 ([f0395a9](https://github.com/pie-framework/pie-elements/commit/f0395a91b16a803c5609d5ece6d3f87208dee1b2))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **placement-ordering:** add Tab/Shift+Tab keyboard accessibility support PIE-767 ([6199e0e](https://github.com/pie-framework/pie-elements/commit/6199e0ef2689304d33d2fe576f4ab3f2788703b5))
|
|
15
|
+
|
|
16
|
+
## [14.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.7...@pie-element/placement-ordering@14.1.9) (2026-08-11)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- **placement-ordering:** adjust choice grid row height and center choices PIE-787 ([ad3e41e](https://github.com/pie-framework/pie-elements/commit/ad3e41e606a1e80b2c6ba2c37e18367cbb9ccda1))
|
|
21
|
+
|
|
22
|
+
## [14.1.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.7...@pie-element/placement-ordering@14.1.8) (2026-07-31)
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
- **placement-ordering:** adjust choice grid row height and center choices PIE-787 ([ad3e41e](https://github.com/pie-framework/pie-elements/commit/ad3e41e606a1e80b2c6ba2c37e18367cbb9ccda1))
|
|
27
|
+
|
|
28
|
+
## [14.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.6...@pie-element/placement-ordering@14.1.7) (2026-07-08)
|
|
7
29
|
|
|
8
30
|
### Bug Fixes
|
|
9
31
|
|
|
10
32
|
- bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
33
|
+
|
|
34
|
+
## [14.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.5...@pie-element/placement-ordering@14.1.6) (2026-07-02)
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
14
38
|
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
15
|
-
- bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
|
|
16
|
-
- handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
|
|
17
|
-
- **placement-ordering:** adjust choice grid row height and center choices PIE-787 ([ad3e41e](https://github.com/pie-framework/pie-elements/commit/ad3e41e606a1e80b2c6ba2c37e18367cbb9ccda1))
|
|
18
39
|
- sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
|
|
19
40
|
|
|
41
|
+
## [14.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.4...@pie-element/placement-ordering@14.1.5) (2026-06-22)
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
- bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
|
|
46
|
+
- handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
|
|
47
|
+
|
|
48
|
+
## [14.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.3...@pie-element/placement-ordering@14.1.4) (2026-06-17)
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
- bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
|
|
53
|
+
|
|
54
|
+
## [14.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.2...@pie-element/placement-ordering@14.1.3) (2026-06-12)
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
- bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
|
|
59
|
+
|
|
60
|
+
## [14.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.1...@pie-element/placement-ordering@14.1.2) (2026-06-04)
|
|
61
|
+
|
|
62
|
+
### Bug Fixes
|
|
63
|
+
|
|
64
|
+
- bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
|
|
65
|
+
|
|
66
|
+
## [14.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.0...@pie-element/placement-ordering@14.1.1) (2026-05-21)
|
|
67
|
+
|
|
68
|
+
**Note:** Version bump only for package @pie-element/placement-ordering
|
|
69
|
+
|
|
20
70
|
# [14.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering@14.1.0-next.1...@pie-element/placement-ordering@14.1.0) (2026-05-21)
|
|
21
71
|
|
|
22
72
|
### Bug Fixes
|
package/configure/CHANGELOG.md
CHANGED
|
@@ -3,20 +3,64 @@
|
|
|
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
|
-
|
|
6
|
+
## [11.1.10](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.8...@pie-element/placement-ordering-configure@11.1.10) (2026-08-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/placement-ordering-configure
|
|
9
|
+
|
|
10
|
+
## [11.1.9](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.7...@pie-element/placement-ordering-configure@11.1.9) (2026-08-11)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **placement-ordering:** adjust choice grid row height and center choices PIE-787 ([ad3e41e](https://github.com/pie-framework/pie-elements/commit/ad3e41e606a1e80b2c6ba2c37e18367cbb9ccda1))
|
|
15
|
+
|
|
16
|
+
## [11.1.8](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.7...@pie-element/placement-ordering-configure@11.1.8) (2026-07-31)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- **placement-ordering:** adjust choice grid row height and center choices PIE-787 ([ad3e41e](https://github.com/pie-framework/pie-elements/commit/ad3e41e606a1e80b2c6ba2c37e18367cbb9ccda1))
|
|
21
|
+
|
|
22
|
+
## [11.1.7](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.6...@pie-element/placement-ordering-configure@11.1.7) (2026-07-08)
|
|
7
23
|
|
|
8
24
|
### Bug Fixes
|
|
9
25
|
|
|
10
26
|
- bump libs & shared modules PIE-706, PIE-702, PIE-679, PIE-698 ([5b1a8c4](https://github.com/pie-framework/pie-elements/commit/5b1a8c4c3eba2126fc43d78fd0187e7cd11d5424))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
|
|
28
|
+
## [11.1.6](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.5...@pie-element/placement-ordering-configure@11.1.6) (2026-07-02)
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
14
32
|
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
15
|
-
- bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
|
|
16
|
-
- handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
|
|
17
|
-
- **placement-ordering:** adjust choice grid row height and center choices PIE-787 ([ad3e41e](https://github.com/pie-framework/pie-elements/commit/ad3e41e606a1e80b2c6ba2c37e18367cbb9ccda1))
|
|
18
33
|
- sync libs versions ([48b5be9](https://github.com/pie-framework/pie-elements/commit/48b5be9559eb5b5235ca05f51c5f0161032a7041))
|
|
19
34
|
|
|
35
|
+
## [11.1.5](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.4...@pie-element/placement-ordering-configure@11.1.5) (2026-06-22)
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
- bump shared modules and libs PIE-674, PIE-662, PIE-705, PIE-674, PIE-963 ([78a3f64](https://github.com/pie-framework/pie-elements/commit/78a3f64652c9581c61bd4159f3210fc1e32d8bcf))
|
|
40
|
+
- handle webcomponent lifecycle on every element that misses it PIE-703 ([9d5923f](https://github.com/pie-framework/pie-elements/commit/9d5923f973f0471e1e8f69ad4309cfc63d980d93))
|
|
41
|
+
|
|
42
|
+
## [11.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.3...@pie-element/placement-ordering-configure@11.1.4) (2026-06-17)
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
- bump shared modules and libs PIE-661 PIE-664 PIE-683 PIE-666 PIE-656 PIE-657 PIE-658 PIE-659 PIE-670 ([ebd6be4](https://github.com/pie-framework/pie-elements/commit/ebd6be4fd48fca41ad4c4908f606b25334731aed))
|
|
47
|
+
|
|
48
|
+
## [11.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.2...@pie-element/placement-ordering-configure@11.1.3) (2026-06-12)
|
|
49
|
+
|
|
50
|
+
### Bug Fixes
|
|
51
|
+
|
|
52
|
+
- bump shared modules and libsPIE-603, PIE-604, PIE-663, PIE-662, PIE-678 ([e61c7a7](https://github.com/pie-framework/pie-elements/commit/e61c7a7d23744586337dfbb17a18ebfc656c202f))
|
|
53
|
+
|
|
54
|
+
## [11.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.1...@pie-element/placement-ordering-configure@11.1.2) (2026-06-04)
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
- bump shared modules and libs PIE-600, PIE-602 ([ce99f6a](https://github.com/pie-framework/pie-elements/commit/ce99f6af50cb855b666a6df9340f9f5445fde4c4))
|
|
59
|
+
|
|
60
|
+
## [11.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.0...@pie-element/placement-ordering-configure@11.1.1) (2026-05-21)
|
|
61
|
+
|
|
62
|
+
**Note:** Version bump only for package @pie-element/placement-ordering-configure
|
|
63
|
+
|
|
20
64
|
# [11.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-configure@11.1.0-next.1...@pie-element/placement-ordering-configure@11.1.0) (2026-05-21)
|
|
21
65
|
|
|
22
66
|
### Bug Fixes
|
package/configure/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/placement-ordering-configure",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.10",
|
|
4
4
|
"private": true,
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"@mui/icons-material": "^7.3.4",
|
|
12
12
|
"@mui/material": "^7.3.4",
|
|
13
13
|
"@pie-framework/pie-configure-events": "^1.3.0",
|
|
14
|
-
"@pie-lib/config-ui": "13.
|
|
15
|
-
"@pie-lib/drag": "4.0
|
|
16
|
-
"@pie-lib/editable-html-tip-tap": "2.
|
|
14
|
+
"@pie-lib/config-ui": "13.0.14",
|
|
15
|
+
"@pie-lib/drag": "4.1.0",
|
|
16
|
+
"@pie-lib/editable-html-tip-tap": "2.1.12",
|
|
17
17
|
"@pie-lib/render-ui": "6.1.3",
|
|
18
18
|
"debug": "^4.1.1",
|
|
19
19
|
"lodash-es": "^4.17.23",
|
package/controller/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,24 @@
|
|
|
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
|
-
|
|
6
|
+
## [11.1.4](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-controller@11.1.2...@pie-element/placement-ordering-controller@11.1.4) (2026-08-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @pie-element/placement-ordering-controller
|
|
9
|
+
|
|
10
|
+
## [11.1.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-controller@11.1.2...@pie-element/placement-ordering-controller@11.1.3) (2026-08-11)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @pie-element/placement-ordering-controller
|
|
13
|
+
|
|
14
|
+
## [11.1.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-controller@11.1.1...@pie-element/placement-ordering-controller@11.1.2) (2026-07-02)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
|
9
17
|
|
|
10
18
|
- bump shared modules and libs PIE-695, PIE-697, PIE-699, PIE-680, PIE-714, PIE-665, PIE-656 ([4b76ae7](https://github.com/pie-framework/pie-elements/commit/4b76ae75d1c5ea6d55f7c6fb53f299dfcbda2b1f))
|
|
11
19
|
|
|
20
|
+
## [11.1.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-controller@11.1.0...@pie-element/placement-ordering-controller@11.1.1) (2026-05-21)
|
|
21
|
+
|
|
22
|
+
**Note:** Version bump only for package @pie-element/placement-ordering-controller
|
|
23
|
+
|
|
12
24
|
# [11.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/placement-ordering-controller@11.1.0-next.1...@pie-element/placement-ordering-controller@11.1.0) (2026-05-21)
|
|
13
25
|
|
|
14
26
|
### Bug Fixes
|
package/controller/package.json
CHANGED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.closestDroppableKeyboardCoordinates = void 0;
|
|
7
|
+
var _core = require("@dnd-kit/core");
|
|
8
|
+
/**
|
|
9
|
+
* Custom keyboard coordinate getter for placement-ordering's Tab-based placement mode
|
|
10
|
+
* (enabled only when the item is configured with `placementArea` / `includeTargets`).
|
|
11
|
+
*
|
|
12
|
+
* Tab/Shift+Tab cycle the dragged choice directly onto the next/previous enabled
|
|
13
|
+
* droppable (a placement/target tile, or an empty gap left behind in the choices row),
|
|
14
|
+
* in real on-screen position order, placing the dragged item's own top-left corner at
|
|
15
|
+
* the target's center-left point.
|
|
16
|
+
*
|
|
17
|
+
* Arrow keys are delegated to dnd-kit's own `defaultKeyboardCoordinateGetter` so the
|
|
18
|
+
* pre-existing free-form arrow-key dragging behavior is left completely unchanged.
|
|
19
|
+
*
|
|
20
|
+
* The tile currently being dragged already disables its own droppable
|
|
21
|
+
* (see `useDroppable({ disabled: isDragging })` in tile.jsx), so it's naturally
|
|
22
|
+
* excluded from the candidate list here without any extra bookkeeping.
|
|
23
|
+
*
|
|
24
|
+
* When picking up a choice from the choices row, the other not-yet-placed choice
|
|
25
|
+
* tiles are also registered droppables (tile.jsx disables a droppable only while it's
|
|
26
|
+
* the one being dragged), but dropping a choice onto another choice is a no-op in the
|
|
27
|
+
* reducer (ordering.js's updateResponse has no `choice -> choice` case) — so they're
|
|
28
|
+
* excluded from the Tab/Shift+Tab cycle, leaving only the real placement targets.
|
|
29
|
+
*/
|
|
30
|
+
const closestDroppableKeyboardCoordinates = (event, {
|
|
31
|
+
active,
|
|
32
|
+
context,
|
|
33
|
+
currentCoordinates
|
|
34
|
+
}) => {
|
|
35
|
+
const {
|
|
36
|
+
code
|
|
37
|
+
} = event;
|
|
38
|
+
const isTab = code === 'Tab';
|
|
39
|
+
const isArrow = code === _core.KeyboardCode.Down || code === _core.KeyboardCode.Up || code === _core.KeyboardCode.Left || code === _core.KeyboardCode.Right;
|
|
40
|
+
if (!isTab && !isArrow) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
if (isArrow) {
|
|
44
|
+
return (0, _core.defaultKeyboardCoordinateGetter)(event, {
|
|
45
|
+
context,
|
|
46
|
+
currentCoordinates
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
event.preventDefault();
|
|
50
|
+
const {
|
|
51
|
+
droppableRects,
|
|
52
|
+
droppableContainers,
|
|
53
|
+
collisionRect
|
|
54
|
+
} = context;
|
|
55
|
+
if (!droppableRects || droppableRects.size === 0) {
|
|
56
|
+
return currentCoordinates;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// `currentCoordinates` is the top-left of the dragged item's collision rect (not its
|
|
60
|
+
// center), so derive the dragged item's center in the same frame before comparing it
|
|
61
|
+
// against droppable centers below.
|
|
62
|
+
const draggedHalfSize = {
|
|
63
|
+
x: (collisionRect?.width || 0) / 2,
|
|
64
|
+
y: (collisionRect?.height || 0) / 2
|
|
65
|
+
};
|
|
66
|
+
const currentCenter = {
|
|
67
|
+
x: currentCoordinates.x + draggedHalfSize.x,
|
|
68
|
+
y: currentCoordinates.y + draggedHalfSize.y
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// Only exclude other choice tiles while dragging a choice; dragging a placed target
|
|
72
|
+
// back onto a choice-row gap is still a valid "return to pool" destination.
|
|
73
|
+
const activeType = active?.data?.current?.type;
|
|
74
|
+
const excludeChoiceDroppables = activeType === 'choice';
|
|
75
|
+
const targets = [];
|
|
76
|
+
for (const [id, container] of droppableContainers) {
|
|
77
|
+
if (container?.disabled) continue;
|
|
78
|
+
if (excludeChoiceDroppables && container?.data?.current?.type === 'choice') continue;
|
|
79
|
+
const rect = droppableRects.get(id);
|
|
80
|
+
if (!rect) continue;
|
|
81
|
+
const center = {
|
|
82
|
+
x: rect.left + rect.width / 2,
|
|
83
|
+
y: rect.top + rect.height / 2
|
|
84
|
+
};
|
|
85
|
+
// Land the dragged item's own top-left corner at the target's center-left point,
|
|
86
|
+
// rather than at the target's own top-left corner.
|
|
87
|
+
const dropPosition = {
|
|
88
|
+
x: rect.left,
|
|
89
|
+
y: rect.top + rect.height / 2
|
|
90
|
+
};
|
|
91
|
+
targets.push({
|
|
92
|
+
id,
|
|
93
|
+
dropPosition,
|
|
94
|
+
center
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (targets.length === 0) {
|
|
98
|
+
return currentCoordinates;
|
|
99
|
+
}
|
|
100
|
+
const reverse = event.shiftKey;
|
|
101
|
+
|
|
102
|
+
// Sort targets by real on-screen position (top to bottom, then left to right), so
|
|
103
|
+
// this works the same whether the tiler is laid out vertically or horizontally.
|
|
104
|
+
targets.sort((a, b) => {
|
|
105
|
+
if (Math.abs(a.center.y - b.center.y) > 10) return a.center.y - b.center.y;
|
|
106
|
+
return a.center.x - b.center.x;
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Find the current target (closest to current coordinates)
|
|
110
|
+
let currentIndex = 0;
|
|
111
|
+
let minDist = Infinity;
|
|
112
|
+
for (let i = 0; i < targets.length; i++) {
|
|
113
|
+
const dist = distance(currentCenter, targets[i].center);
|
|
114
|
+
if (dist < minDist) {
|
|
115
|
+
minDist = dist;
|
|
116
|
+
currentIndex = i;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const nextIndex = reverse ? (currentIndex - 1 + targets.length) % targets.length : (currentIndex + 1) % targets.length;
|
|
120
|
+
return targets[nextIndex].dropPosition;
|
|
121
|
+
};
|
|
122
|
+
exports.closestDroppableKeyboardCoordinates = closestDroppableKeyboardCoordinates;
|
|
123
|
+
const distance = (a, b) => Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);
|
|
124
|
+
//# sourceMappingURL=keyboard-coordinates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard-coordinates.js","names":["_core","require","closestDroppableKeyboardCoordinates","event","active","context","currentCoordinates","code","isTab","isArrow","KeyboardCode","Down","Up","Left","Right","undefined","defaultKeyboardCoordinateGetter","preventDefault","droppableRects","droppableContainers","collisionRect","size","draggedHalfSize","x","width","y","height","currentCenter","activeType","data","current","type","excludeChoiceDroppables","targets","id","container","disabled","rect","get","center","left","top","dropPosition","push","length","reverse","shiftKey","sort","a","b","Math","abs","currentIndex","minDist","Infinity","i","dist","distance","nextIndex","exports","sqrt"],"sources":["../src/keyboard-coordinates.js"],"sourcesContent":["import { defaultKeyboardCoordinateGetter, KeyboardCode } from '@dnd-kit/core';\n\n/**\n * Custom keyboard coordinate getter for placement-ordering's Tab-based placement mode\n * (enabled only when the item is configured with `placementArea` / `includeTargets`).\n *\n * Tab/Shift+Tab cycle the dragged choice directly onto the next/previous enabled\n * droppable (a placement/target tile, or an empty gap left behind in the choices row),\n * in real on-screen position order, placing the dragged item's own top-left corner at\n * the target's center-left point.\n *\n * Arrow keys are delegated to dnd-kit's own `defaultKeyboardCoordinateGetter` so the\n * pre-existing free-form arrow-key dragging behavior is left completely unchanged.\n *\n * The tile currently being dragged already disables its own droppable\n * (see `useDroppable({ disabled: isDragging })` in tile.jsx), so it's naturally\n * excluded from the candidate list here without any extra bookkeeping.\n *\n * When picking up a choice from the choices row, the other not-yet-placed choice\n * tiles are also registered droppables (tile.jsx disables a droppable only while it's\n * the one being dragged), but dropping a choice onto another choice is a no-op in the\n * reducer (ordering.js's updateResponse has no `choice -> choice` case) — so they're\n * excluded from the Tab/Shift+Tab cycle, leaving only the real placement targets.\n */\nexport const closestDroppableKeyboardCoordinates = (event, { active, context, currentCoordinates }) => {\n const { code } = event;\n const isTab = code === 'Tab';\n const isArrow =\n code === KeyboardCode.Down || code === KeyboardCode.Up || code === KeyboardCode.Left || code === KeyboardCode.Right;\n\n if (!isTab && !isArrow) {\n return undefined;\n }\n\n if (isArrow) {\n return defaultKeyboardCoordinateGetter(event, { context, currentCoordinates });\n }\n\n event.preventDefault();\n\n const { droppableRects, droppableContainers, collisionRect } = context;\n\n if (!droppableRects || droppableRects.size === 0) {\n return currentCoordinates;\n }\n\n // `currentCoordinates` is the top-left of the dragged item's collision rect (not its\n // center), so derive the dragged item's center in the same frame before comparing it\n // against droppable centers below.\n const draggedHalfSize = {\n x: (collisionRect?.width || 0) / 2,\n y: (collisionRect?.height || 0) / 2,\n };\n const currentCenter = {\n x: currentCoordinates.x + draggedHalfSize.x,\n y: currentCoordinates.y + draggedHalfSize.y,\n };\n\n // Only exclude other choice tiles while dragging a choice; dragging a placed target\n // back onto a choice-row gap is still a valid \"return to pool\" destination.\n const activeType = active?.data?.current?.type;\n const excludeChoiceDroppables = activeType === 'choice';\n\n const targets = [];\n\n for (const [id, container] of droppableContainers) {\n if (container?.disabled) continue;\n\n if (excludeChoiceDroppables && container?.data?.current?.type === 'choice') continue;\n\n const rect = droppableRects.get(id);\n\n if (!rect) continue;\n\n const center = {\n x: rect.left + rect.width / 2,\n y: rect.top + rect.height / 2,\n };\n // Land the dragged item's own top-left corner at the target's center-left point,\n // rather than at the target's own top-left corner.\n const dropPosition = {\n x: rect.left,\n y: rect.top + rect.height / 2,\n };\n\n targets.push({ id, dropPosition, center });\n }\n\n if (targets.length === 0) {\n return currentCoordinates;\n }\n\n const reverse = event.shiftKey;\n\n // Sort targets by real on-screen position (top to bottom, then left to right), so\n // this works the same whether the tiler is laid out vertically or horizontally.\n targets.sort((a, b) => {\n if (Math.abs(a.center.y - b.center.y) > 10) return a.center.y - b.center.y;\n return a.center.x - b.center.x;\n });\n\n // Find the current target (closest to current coordinates)\n let currentIndex = 0;\n let minDist = Infinity;\n\n for (let i = 0; i < targets.length; i++) {\n const dist = distance(currentCenter, targets[i].center);\n\n if (dist < minDist) {\n minDist = dist;\n currentIndex = i;\n }\n }\n\n const nextIndex = reverse\n ? (currentIndex - 1 + targets.length) % targets.length\n : (currentIndex + 1) % targets.length;\n\n return targets[nextIndex].dropPosition;\n};\n\nconst distance = (a, b) => Math.sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2);\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,mCAAmC,GAAGA,CAACC,KAAK,EAAE;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAmB,CAAC,KAAK;EACrG,MAAM;IAAEC;EAAK,CAAC,GAAGJ,KAAK;EACtB,MAAMK,KAAK,GAAGD,IAAI,KAAK,KAAK;EAC5B,MAAME,OAAO,GACXF,IAAI,KAAKG,kBAAY,CAACC,IAAI,IAAIJ,IAAI,KAAKG,kBAAY,CAACE,EAAE,IAAIL,IAAI,KAAKG,kBAAY,CAACG,IAAI,IAAIN,IAAI,KAAKG,kBAAY,CAACI,KAAK;EAErH,IAAI,CAACN,KAAK,IAAI,CAACC,OAAO,EAAE;IACtB,OAAOM,SAAS;EAClB;EAEA,IAAIN,OAAO,EAAE;IACX,OAAO,IAAAO,qCAA+B,EAACb,KAAK,EAAE;MAAEE,OAAO;MAAEC;IAAmB,CAAC,CAAC;EAChF;EAEAH,KAAK,CAACc,cAAc,CAAC,CAAC;EAEtB,MAAM;IAAEC,cAAc;IAAEC,mBAAmB;IAAEC;EAAc,CAAC,GAAGf,OAAO;EAEtE,IAAI,CAACa,cAA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,CAAC;AAACiB,OAAA,CAAAzD,mCAAA,GAAAA,mCAAA;AAEF,MAAMuD,QAAQ,GAAGA,CAACT,CAAC,EAAEC,CAAC,KAAKC,IAAI,CAACU,IAAI,CAAC,CAACZ,CAAC,CAACzB,CAAC,GAAG0B,CAAC,CAAC1B,CAAC,KAAK,CAAC,GAAG,CAACyB,CAAC,CAACvB,CAAC,GAAGwB,CAAC,CAACxB,CAAC,KAAK,CAAC,CAAC","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@ var _debug = _interopRequireDefault(require("debug"));
|
|
|
14
14
|
var _lodashEs = require("lodash-es");
|
|
15
15
|
var _styles = require("@mui/material/styles");
|
|
16
16
|
var _core = require("@dnd-kit/core");
|
|
17
|
+
var _modifiers = require("@dnd-kit/modifiers");
|
|
17
18
|
var _renderUi = require("@pie-lib/render-ui");
|
|
18
19
|
var _mathRendering = require("@pie-lib/math-rendering");
|
|
19
20
|
var _translator = _interopRequireDefault(require("@pie-lib/translator"));
|
|
@@ -22,6 +23,20 @@ var _drag = require("@pie-lib/drag");
|
|
|
22
23
|
var _tiler = require("./tiler");
|
|
23
24
|
var _ordering = require("./ordering");
|
|
24
25
|
var _utils = require("./utils");
|
|
26
|
+
var _keyboardCoordinates = require("./keyboard-coordinates");
|
|
27
|
+
const getKeyboardDragOptions = includeTargets => includeTargets ? {
|
|
28
|
+
keyboardCoordinateGetter: _keyboardCoordinates.closestDroppableKeyboardCoordinates,
|
|
29
|
+
keyboardCodes: {
|
|
30
|
+
start: ['Space', 'Enter'],
|
|
31
|
+
cancel: ['Escape'],
|
|
32
|
+
end: ['Space', 'Enter']
|
|
33
|
+
},
|
|
34
|
+
accessibility: {
|
|
35
|
+
screenReaderInstructions: {
|
|
36
|
+
draggable: 'Press Space or Enter to pick up this answer choice. Once picked up, use Tab or Shift+Tab to cycle through response areas, or use arrow keys to move it freely. Press Space or Enter to drop, or Escape to cancel.'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
} : {};
|
|
25
40
|
const {
|
|
26
41
|
translator
|
|
27
42
|
} = _translator.default;
|
|
@@ -34,6 +49,26 @@ const PlacementOrderingContainer = (0, _styles.styled)('div')({
|
|
|
34
49
|
alignItems: 'center',
|
|
35
50
|
boxSizing: 'border-box'
|
|
36
51
|
});
|
|
52
|
+
|
|
53
|
+
// The interactive region - the choices and answers columns for a vertical item, or the choices and
|
|
54
|
+
// answers rows for a horizontal one - scrolls horizontally when it does not fit the available width.
|
|
55
|
+
const InteractiveRegion = (0, _styles.styled)('div')({
|
|
56
|
+
// the ancestors centre their children, which shrink-wraps this box to its content. without a
|
|
57
|
+
// definite width it grows with the tiler and the overflow escapes outwards instead of scrolling.
|
|
58
|
+
alignSelf: 'stretch',
|
|
59
|
+
maxWidth: '100%',
|
|
60
|
+
overflowX: 'auto',
|
|
61
|
+
// tiles are dragged by transform, which counts towards scrollable overflow, so leaving this axis
|
|
62
|
+
// scrollable would pop a vertical scrollbar mid-drag
|
|
63
|
+
overflowY: 'hidden'
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// keeps the tiler at its natural width, and centred while it still fits
|
|
67
|
+
const InteractiveRegionContent = (0, _styles.styled)('div')({
|
|
68
|
+
display: 'flex',
|
|
69
|
+
justifyContent: 'center',
|
|
70
|
+
minWidth: 'min-content'
|
|
71
|
+
});
|
|
37
72
|
const StyledPrompt = (0, _styles.styled)('div')(({
|
|
38
73
|
theme
|
|
39
74
|
}) => ({
|
|
@@ -356,13 +391,15 @@ class PlacementOrdering extends _react.default.Component {
|
|
|
356
391
|
display: 'flex',
|
|
357
392
|
flexDirection: 'column',
|
|
358
393
|
alignItems: 'center',
|
|
359
|
-
boxSizing: 'border-box'
|
|
394
|
+
boxSizing: 'border-box',
|
|
395
|
+
width: '100%'
|
|
360
396
|
};
|
|
361
|
-
return /*#__PURE__*/_react.default.createElement(_drag.DragProvider, {
|
|
397
|
+
return /*#__PURE__*/_react.default.createElement(_drag.DragProvider, (0, _extends2.default)({
|
|
362
398
|
onDragStart: () => {},
|
|
363
399
|
onDragEnd: this.onDragEnd,
|
|
364
|
-
collisionDetection: _core.
|
|
365
|
-
|
|
400
|
+
collisionDetection: _core.rectIntersection,
|
|
401
|
+
modifiers: [_modifiers.restrictToParentElement]
|
|
402
|
+
}, getKeyboardDragOptions(includeTargets)), /*#__PURE__*/_react.default.createElement(PlacementOrderingContainer, null, /*#__PURE__*/_react.default.createElement(_renderUi.UiLayout, {
|
|
366
403
|
extraCSSRules: extraCSSRules,
|
|
367
404
|
style: containerStyle
|
|
368
405
|
}, showTeacherInstructions && /*#__PURE__*/_react.default.createElement(StyledCollapsible, {
|
|
@@ -380,7 +417,7 @@ class PlacementOrdering extends _react.default.Component {
|
|
|
380
417
|
toggled: showingCorrect,
|
|
381
418
|
onToggle: this.toggleCorrect,
|
|
382
419
|
language: language
|
|
383
|
-
}), /*#__PURE__*/_react.default.createElement(OrderingTiler, {
|
|
420
|
+
}), /*#__PURE__*/_react.default.createElement(InteractiveRegion, null, /*#__PURE__*/_react.default.createElement(InteractiveRegionContent, null, /*#__PURE__*/_react.default.createElement(OrderingTiler, {
|
|
384
421
|
instanceId: this.instanceId,
|
|
385
422
|
choiceLabel: config.choiceLabel,
|
|
386
423
|
targetLabel: config.targetLabel,
|
|
@@ -391,7 +428,7 @@ class PlacementOrdering extends _react.default.Component {
|
|
|
391
428
|
tileSize: config.tileSize,
|
|
392
429
|
includeTargets: includeTargets,
|
|
393
430
|
choiceLabelEnabled: model.config && model.config.choiceLabelEnabled
|
|
394
|
-
}), displayNote && /*#__PURE__*/_react.default.createElement(StyledNote, {
|
|
431
|
+
}))), displayNote && /*#__PURE__*/_react.default.createElement(StyledNote, {
|
|
395
432
|
dangerouslySetInnerHTML: {
|
|
396
433
|
__html: note
|
|
397
434
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"placement-ordering.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_debug","_lodashEs","_styles","_core","_renderUi","_mathRendering","_translator","_correctAnswerToggle","_drag","_tiler","_ordering","_utils","translator","Translator","log","debug","PlacementOrderingContainer","styled","color","text","backgroundColor","background","display","flexDirection","alignItems","boxSizing","StyledPrompt","theme","paddingBottom","spacing","StyledNote","StyledToggle","CorrectAnswerToggle","StyledCollapsible","Collapsible","marginBottom","alignSelf","OrderingTiler","props","tiler","Comp","ordering","onDropChoice","onRemoveChoice","compProps","default","createElement","_extends2","tiles","t","s","propTypes","PropTypes","func","any","PlacementOrdering","React","Component","constructor","_defineProperty2","showingCorrect","setState","model","session","areChoicesShuffled","config","choices","includeTargets","choicesIds","map","c","id","value","needsReset","sessionMissing","length","missingChoiceIds","difference","extraChoiceIds","isEqual","sessionIsMismatched","concat","Array","filter","cId","includes","console","warn","target","source","onSessionChange","from","find","type","index","to","update","reducer","sessionUpdate","Object","assign","response","state","orientation","buildState","correctResponse","outcome","allowSameChoiceInTargets","outcomes","event","over","active","createOrdering","draggedItem","data","current","droppedOnItem","instanceId","uniqueId","validateSession","env","mode","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","UNSAFE_componentWillReceiveProps","nextProps","nextModel","currentModel","nextChoices","newState","isLanguageChanged","language","isDefaultNote","note","lng","haveSameValuesButDifferentOrder","validatedSession","newSession","includeTargetsChanged","render","correctness","extraCSSRules","prompt","rationale","feedback","configs","showNote","disabled","teacherInstructions","showToggle","vertical","role","Tiler","VerticalTiler","HorizontalTiler","displayNote","showRationale","hasText","hasMedia","showTeacherInstructions","containerStyle","DragProvider","onDragStart","onDragEnd","collisionDetection","closestCenter","UiLayout","style","labels","hidden","visible","className","PreviewPrompt","show","toggled","onToggle","toggleCorrect","choiceLabel","targetLabel","addGuide","showOrdering","tileSize","choiceLabelEnabled","dangerouslySetInnerHTML","__html","Feedback","exports","isRequired","object","oneOfType","array","_default"],"sources":["../src/placement-ordering.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { difference, isEqual, uniqueId } from 'lodash-es';\nimport { styled } from '@mui/material/styles';\nimport { closestCenter } from '@dnd-kit/core';\n\nimport { Collapsible, color, Feedback, hasMedia, hasText, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport { HorizontalTiler, VerticalTiler } from './tiler';\nimport { buildState, reducer } from './ordering';\nimport { haveSameValuesButDifferentOrder } from './utils';\n\nconst { translator } = Translator;\n\nconst log = debug('pie-elements:placement-ordering');\n\nconst PlacementOrderingContainer = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n});\n\nconst StyledPrompt = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledNote = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nconst StyledToggle = styled(CorrectAnswerToggle)(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n alignSelf: 'flex-start',\n}));\n\nconst OrderingTiler = (props) => {\n const { tiler: Comp, ordering, onDropChoice, onRemoveChoice, ...compProps } = props;\n\n return (\n <Comp\n {...compProps}\n tiles={ordering.tiles}\n onDropChoice={(t, s) => onDropChoice(t, s, ordering)}\n onRemoveChoice={(t) => onRemoveChoice(t, ordering)}\n />\n );\n};\n\nOrderingTiler.propTypes = {\n tiler: PropTypes.func,\n ordering: PropTypes.any,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n};\n\nexport class PlacementOrdering extends React.Component {\n static propTypes = {\n onSessionChange: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n session: PropTypes.oneOfType([PropTypes.array.isRequired, PropTypes.object.isRequired]),\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n const { value, needsReset } = this.validateSession(props);\n\n this.state = {\n showingCorrect: false,\n };\n\n const { model } = props || {};\n const { env } = model || {};\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange({\n ...props.session,\n value,\n });\n }\n }\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n validateSession = ({ model, session }, areChoicesShuffled = false) => {\n const { config, choices } = model || {};\n const { includeTargets } = config || {};\n const choicesIds = choices.map((c) => c.id);\n\n let { value } = session || {};\n let needsReset;\n\n if (!includeTargets) {\n // Use all choice IDs if choices were shuffled or session is missing/invalid\n const sessionMissing = !value || !value.length;\n if (sessionMissing || areChoicesShuffled) {\n // if there's no value on session in No Targets Mode, we need to set an initial session\n value = choicesIds;\n } else {\n // in No Targets Mode, all choice ids need to be used\n const missingChoiceIds = difference(choicesIds, value);\n // this is the case that handles extra choice ids in session\n const extraChoiceIds = difference(value, choicesIds);\n\n if (missingChoiceIds.length || extraChoiceIds.length) {\n value = choicesIds;\n }\n }\n\n needsReset = !isEqual(session.value, value);\n } else {\n // in Targets Area selected, it's important to check the length of session\n const sessionIsMismatched = value && value.length !== choicesIds.length;\n if (sessionIsMismatched) {\n needsReset = true;\n\n // if choices were added, add value in session\n if (value.length < choicesIds.length) {\n value = value.concat(new Array(choicesIds.length - value.length));\n } else {\n // if choices were removed, make sure to remove from session as well\n value = value.filter((cId) => choicesIds.includes(cId));\n }\n }\n }\n\n if (needsReset) {\n // eslint-disable-next-line no-console\n console.warn('This session is not valid anymore. It will be reset.');\n }\n\n return { value, needsReset };\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: nextModel = {} } = nextProps || {};\n const { model: currentModel = {} } = this.props || {};\n const { correctResponse, config, choices: nextChoices = [], env } = nextModel;\n const { includeTargets } = config || {};\n\n const newState = {};\n\n const isLanguageChanged = currentModel.language && currentModel.language !== nextModel.language;\n const isDefaultNote =\n currentModel.note &&\n currentModel.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: currentModel.language });\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (isLanguageChanged && isDefaultNote) {\n currentModel.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n if (!correctResponse) {\n newState.showingCorrect = false;\n }\n\n //PD-4924\n // show student choices same order as in model when teacher changes student choices order\n // for cases when student view and instructor view are on same page\n const areChoicesShuffled = haveSameValuesButDifferentOrder(nextChoices, currentModel.choices);\n\n const validatedSession = this.validateSession(nextProps, areChoicesShuffled);\n let { value, needsReset } = validatedSession;\n\n const newSession = {\n ...nextProps.session,\n value,\n };\n const includeTargetsChanged = currentModel.config?.includeTargets !== includeTargets;\n\n if (includeTargets && includeTargetsChanged) {\n needsReset = true;\n\n delete newSession.value;\n }\n\n this.setState(newState, () => {\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange(newSession);\n }\n });\n }\n\n onDropChoice = (target, source, ordering) => {\n const { onSessionChange, session } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type && t.index === source.index);\n const to = target;\n log('[onDropChoice] ', from, to);\n const update = reducer({ type: 'move', from, to }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n\n onSessionChange(sessionUpdate);\n };\n\n onRemoveChoice = (target, ordering) => {\n const { onSessionChange, session } = this.props;\n log('[onRemoveChoice]', target);\n const update = reducer({ type: 'remove', target }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n onSessionChange(sessionUpdate);\n };\n\n createOrdering = () => {\n const { model, session } = this.props;\n const { showingCorrect } = this.state;\n const config = model.config || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { includeTargets } = config;\n\n return showingCorrect\n ? buildState(\n model.choices,\n model.correctResponse,\n model.correctResponse.map((id) => ({ id, outcome: 'correct' })),\n {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n },\n )\n : buildState(model.choices, session.value, model.outcomes, {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n });\n };\n\n onDragEnd = (event) => {\n const { over, active } = event;\n const ordering = this.createOrdering();\n\n if (over && active) {\n const draggedItem = active.data.current;\n const droppedOnItem = over.data.current;\n\n if (draggedItem && droppedOnItem && droppedOnItem.type === 'target') {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n return;\n }\n\n if (draggedItem && droppedOnItem) {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n }\n } else if (!over && active) {\n const draggedItem = active.data.current;\n if (draggedItem && draggedItem.type === 'target') {\n this.onRemoveChoice(draggedItem, ordering);\n }\n }\n };\n\n render() {\n const { model } = this.props;\n const {\n correctResponse,\n correctness,\n extraCSSRules,\n prompt,\n rationale,\n feedback,\n config: configs,\n note,\n showNote,\n env,\n disabled,\n teacherInstructions,\n language,\n } = model;\n const showToggle = correctResponse && correctResponse.length > 0;\n const { showingCorrect } = this.state;\n const config = configs || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { orientation, includeTargets } = config;\n const vertical = orientation === 'vertical';\n const ordering = this.createOrdering();\n const { mode, role } = env || {};\n\n const Tiler = vertical ? VerticalTiler : HorizontalTiler;\n const displayNote = (showingCorrect || (mode === 'view' && role === 'instructor')) && showNote && note;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const containerStyle = {\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n };\n\n return (\n <DragProvider onDragStart={() => { }} onDragEnd={this.onDragEnd} collisionDetection={closestCenter}>\n <PlacementOrderingContainer>\n <UiLayout extraCSSRules={extraCSSRules} style={containerStyle}>\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n <StyledPrompt>\n <PreviewPrompt prompt={prompt} />\n </StyledPrompt>\n\n <StyledToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n language={language}\n />\n\n <OrderingTiler\n instanceId={this.instanceId}\n choiceLabel={config.choiceLabel}\n targetLabel={config.targetLabel}\n ordering={ordering}\n tiler={Tiler}\n disabled={disabled}\n addGuide={config.showOrdering}\n tileSize={config.tileSize}\n includeTargets={includeTargets}\n choiceLabelEnabled={model.config && model.config.choiceLabelEnabled}\n />\n\n {displayNote && <StyledNote dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <StyledCollapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={rationale} />\n </StyledCollapsible>\n )}\n\n {!showingCorrect && <Feedback correctness={correctness} feedback={feedback} />}\n </UiLayout>\n </PlacementOrderingContainer>\n </DragProvider>\n );\n }\n}\n\nexport default PlacementOrdering;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,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InK,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAAChB,UAAU;MAAC4J,uBAAuB,EAAE;QAAEC,MAAM,EAAEnD;MAAK;IAAE,CAAE,CAAC,EAExEuB,aAAa,iBACZpK,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAACb,iBAAiB;MAChB0I,MAAM,EAAE;QAAEC,MAAM,EAAE,gBAAgB;QAAEC,OAAO,EAAE;MAAiB,CAAE;MAChEC,SAAS,EAAC;IAAa,gBAEvBnL,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAAC1C,SAAA,CAAA2K,aAAa;MAAC9B,MAAM,EAAEC;IAAU,CAAE,CAClB,CACpB,EAEA,CAACtF,cAAc,iBAAIjE,MAAA,CAAAkD,OAAA,CAAAC,aAAA,CAAC1C,SAAA,CAAAwL,QAAQ;MAAC7C,WAAW,EAAEA,WAAY;MAACI,QAAQ,EAAEA;IAAS,CAAE,CACrE,CACgB,CAChB,CAAC;EAEnB;AACF;AAAC0C,OAAA,CAAAtI,iBAAA,GAAAA,iBAAA;AAAA,IAAAI,gBAAA,CAAAd,OAAA,EAvTYU,iBAAiB,eACT;EACjBmC,eAAe,EAAEtC,kBAAS,CAACC,IAAI,CAACyI,UAAU;EAC1ChI,KAAK,EAAEV,kBAAS,CAAC2I,MAAM,CAACD,UAAU;EAClC/H,OAAO,EAAEX,kBAAS,CAAC4I,SAAS,CAAC,CAAC5I,kBAAS,CAAC6I,KAAK,CAACH,UAAU,EAAE1I,kBAAS,CAAC2I,MAAM,CAACD,UAAU,CAAC;AACxF,CAAC;AAAA,IAAAI,QAAA,GAAAL,OAAA,CAAAhJ,OAAA,GAoTYU,iBAAiB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"placement-ordering.js","names":["_react","_interopRequireDefault","require","_reactDom","_propTypes","_debug","_lodashEs","_styles","_core","_modifiers","_renderUi","_mathRendering","_translator","_correctAnswerToggle","_drag","_tiler","_ordering","_utils","_keyboardCoordinates","getKeyboardDragOptions","includeTargets","keyboardCoordinateGetter","closestDroppableKeyboardCoordinates","keyboardCodes","start","cancel","end","accessibility","screenReaderInstructions","draggable","translator","Translator","log","debug","PlacementOrderingContainer","styled","color","text","backgroundColor","background","display","flexDirection","alignItems","boxSizing","InteractiveRegion","alignSelf","maxWidth","overflowX","overflowY","InteractiveRegionContent","justifyContent","minWidth","StyledPrompt","theme","paddingBottom","spacing","StyledNote","StyledToggle","CorrectAnswerToggle","StyledCollapsible","Collapsible","marginBottom","OrderingTiler","props","tiler","Comp","ordering","onDropChoice","onRemoveChoice","compProps","default","createElement","_extends2","tiles","t","s","propTypes","PropTypes","func","any","PlacementOrdering","React","Component","constructor","_defineProperty2","showingCorrect","setState","model","session","areChoicesShuffled","config","choices","choicesIds","map","c","id","value","needsReset","sessionMissing","length","missingChoiceIds","difference","extraChoiceIds","isEqual","sessionIsMismatched","concat","Array","filter","cId","includes","console","warn","target","source","onSessionChange","from","find","type","index","to","update","reducer","sessionUpdate","Object","assign","response","state","orientation","buildState","correctResponse","outcome","allowSameChoiceInTargets","outcomes","event","over","active","createOrdering","draggedItem","data","current","droppedOnItem","instanceId","uniqueId","validateSession","env","mode","componentDidUpdate","domNode","ReactDOM","findDOMNode","renderMath","UNSAFE_componentWillReceiveProps","nextProps","nextModel","currentModel","nextChoices","newState","isLanguageChanged","language","isDefaultNote","note","lng","haveSameValuesButDifferentOrder","validatedSession","newSession","includeTargetsChanged","render","correctness","extraCSSRules","prompt","rationale","feedback","configs","showNote","disabled","teacherInstructions","showToggle","vertical","role","Tiler","VerticalTiler","HorizontalTiler","displayNote","showRationale","hasText","hasMedia","showTeacherInstructions","containerStyle","width","DragProvider","onDragStart","onDragEnd","collisionDetection","rectIntersection","modifiers","restrictToParentElement","UiLayout","style","labels","hidden","visible","className","PreviewPrompt","show","toggled","onToggle","toggleCorrect","choiceLabel","targetLabel","addGuide","showOrdering","tileSize","choiceLabelEnabled","dangerouslySetInnerHTML","__html","Feedback","exports","isRequired","object","oneOfType","array","_default"],"sources":["../src/placement-ordering.jsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport debug from 'debug';\nimport { difference, isEqual, uniqueId } from 'lodash-es';\nimport { styled } from '@mui/material/styles';\nimport { rectIntersection } from '@dnd-kit/core';\nimport { restrictToParentElement } from '@dnd-kit/modifiers';\n\nimport { Collapsible, color, Feedback, hasMedia, hasText, PreviewPrompt, UiLayout } from '@pie-lib/render-ui';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport Translator from '@pie-lib/translator';\nimport CorrectAnswerToggle from '@pie-lib/correct-answer-toggle';\nimport { DragProvider } from '@pie-lib/drag';\n\nimport { HorizontalTiler, VerticalTiler } from './tiler';\nimport { buildState, reducer } from './ordering';\nimport { haveSameValuesButDifferentOrder } from './utils';\nimport { closestDroppableKeyboardCoordinates } from './keyboard-coordinates';\n\nconst getKeyboardDragOptions = (includeTargets) =>\n includeTargets\n ? {\n keyboardCoordinateGetter: closestDroppableKeyboardCoordinates,\n keyboardCodes: {\n start: ['Space', 'Enter'],\n cancel: ['Escape'],\n end: ['Space', 'Enter'],\n },\n accessibility: {\n screenReaderInstructions: {\n draggable:\n 'Press Space or Enter to pick up this answer choice. Once picked up, use Tab or Shift+Tab to cycle through response areas, or use arrow keys to move it freely. Press Space or Enter to drop, or Escape to cancel.',\n },\n },\n }\n : {};\n\nconst { translator } = Translator;\n\nconst log = debug('pie-elements:placement-ordering');\n\nconst PlacementOrderingContainer = styled('div')({\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n});\n\n// The interactive region - the choices and answers columns for a vertical item, or the choices and\n// answers rows for a horizontal one - scrolls horizontally when it does not fit the available width.\nconst InteractiveRegion = styled('div')({\n // the ancestors centre their children, which shrink-wraps this box to its content. without a\n // definite width it grows with the tiler and the overflow escapes outwards instead of scrolling.\n alignSelf: 'stretch',\n maxWidth: '100%',\n overflowX: 'auto',\n // tiles are dragged by transform, which counts towards scrollable overflow, so leaving this axis\n // scrollable would pop a vertical scrollbar mid-drag\n overflowY: 'hidden',\n});\n\n// keeps the tiler at its natural width, and centred while it still fits\nconst InteractiveRegionContent = styled('div')({\n display: 'flex',\n justifyContent: 'center',\n minWidth: 'min-content',\n});\n\nconst StyledPrompt = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledNote = styled('div')(({ theme }) => ({\n paddingBottom: theme.spacing(2),\n}));\n\nconst StyledToggle = styled(CorrectAnswerToggle)(({ theme }) => ({\n paddingBottom: theme.spacing(1),\n}));\n\nconst StyledCollapsible = styled(Collapsible)(({ theme }) => ({\n marginBottom: theme.spacing(2),\n alignSelf: 'flex-start',\n}));\n\nconst OrderingTiler = (props) => {\n const { tiler: Comp, ordering, onDropChoice, onRemoveChoice, ...compProps } = props;\n\n return (\n <Comp\n {...compProps}\n tiles={ordering.tiles}\n onDropChoice={(t, s) => onDropChoice(t, s, ordering)}\n onRemoveChoice={(t) => onRemoveChoice(t, ordering)}\n />\n );\n};\n\nOrderingTiler.propTypes = {\n tiler: PropTypes.func,\n ordering: PropTypes.any,\n onDropChoice: PropTypes.func,\n onRemoveChoice: PropTypes.func,\n};\n\nexport class PlacementOrdering extends React.Component {\n static propTypes = {\n onSessionChange: PropTypes.func.isRequired,\n model: PropTypes.object.isRequired,\n session: PropTypes.oneOfType([PropTypes.array.isRequired, PropTypes.object.isRequired]),\n };\n\n constructor(props) {\n super(props);\n\n this.instanceId = uniqueId();\n\n const { value, needsReset } = this.validateSession(props);\n\n this.state = {\n showingCorrect: false,\n };\n\n const { model } = props || {};\n const { env } = model || {};\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange({\n ...props.session,\n value,\n });\n }\n }\n\n toggleCorrect = (showingCorrect) => this.setState({ showingCorrect });\n\n componentDidUpdate() {\n //eslint-disable-next-line\n const domNode = ReactDOM.findDOMNode(this);\n\n renderMath(domNode);\n }\n\n validateSession = ({ model, session }, areChoicesShuffled = false) => {\n const { config, choices } = model || {};\n const { includeTargets } = config || {};\n const choicesIds = choices.map((c) => c.id);\n\n let { value } = session || {};\n let needsReset;\n\n if (!includeTargets) {\n // Use all choice IDs if choices were shuffled or session is missing/invalid\n const sessionMissing = !value || !value.length;\n if (sessionMissing || areChoicesShuffled) {\n // if there's no value on session in No Targets Mode, we need to set an initial session\n value = choicesIds;\n } else {\n // in No Targets Mode, all choice ids need to be used\n const missingChoiceIds = difference(choicesIds, value);\n // this is the case that handles extra choice ids in session\n const extraChoiceIds = difference(value, choicesIds);\n\n if (missingChoiceIds.length || extraChoiceIds.length) {\n value = choicesIds;\n }\n }\n\n needsReset = !isEqual(session.value, value);\n } else {\n // in Targets Area selected, it's important to check the length of session\n const sessionIsMismatched = value && value.length !== choicesIds.length;\n if (sessionIsMismatched) {\n needsReset = true;\n\n // if choices were added, add value in session\n if (value.length < choicesIds.length) {\n value = value.concat(new Array(choicesIds.length - value.length));\n } else {\n // if choices were removed, make sure to remove from session as well\n value = value.filter((cId) => choicesIds.includes(cId));\n }\n }\n }\n\n if (needsReset) {\n // eslint-disable-next-line no-console\n console.warn('This session is not valid anymore. It will be reset.');\n }\n\n return { value, needsReset };\n };\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n const { model: nextModel = {} } = nextProps || {};\n const { model: currentModel = {} } = this.props || {};\n const { correctResponse, config, choices: nextChoices = [], env } = nextModel;\n const { includeTargets } = config || {};\n\n const newState = {};\n\n const isLanguageChanged = currentModel.language && currentModel.language !== nextModel.language;\n const isDefaultNote =\n currentModel.note &&\n currentModel.note === translator.t('common:commonCorrectAnswerWithAlternates', { lng: currentModel.language });\n\n // check if the note is the default one for prev language and change to the default one for new language\n // this check is necessary in order to diferanciate between default and authour defined note\n // and only change between languages for default ones\n if (isLanguageChanged && isDefaultNote) {\n currentModel.note = translator.t('common:commonCorrectAnswerWithAlternates', { lng: nextModel.language });\n }\n\n if (!correctResponse) {\n newState.showingCorrect = false;\n }\n\n //PD-4924\n // show student choices same order as in model when teacher changes student choices order\n // for cases when student view and instructor view are on same page\n const areChoicesShuffled = haveSameValuesButDifferentOrder(nextChoices, currentModel.choices);\n\n const validatedSession = this.validateSession(nextProps, areChoicesShuffled);\n let { value, needsReset } = validatedSession;\n\n const newSession = {\n ...nextProps.session,\n value,\n };\n const includeTargetsChanged = currentModel.config?.includeTargets !== includeTargets;\n\n if (includeTargets && includeTargetsChanged) {\n needsReset = true;\n\n delete newSession.value;\n }\n\n this.setState(newState, () => {\n const { mode } = env || {};\n\n if (needsReset && mode === 'gather') {\n this.props.onSessionChange(newSession);\n }\n });\n }\n\n onDropChoice = (target, source, ordering) => {\n const { onSessionChange, session } = this.props;\n const from = ordering.tiles.find((t) => t.id === source.id && t.type === source.type && t.index === source.index);\n const to = target;\n log('[onDropChoice] ', from, to);\n const update = reducer({ type: 'move', from, to }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n\n onSessionChange(sessionUpdate);\n };\n\n onRemoveChoice = (target, ordering) => {\n const { onSessionChange, session } = this.props;\n log('[onRemoveChoice]', target);\n const update = reducer({ type: 'remove', target }, ordering);\n const sessionUpdate = Object.assign({}, session, {\n value: update.response,\n });\n onSessionChange(sessionUpdate);\n };\n\n createOrdering = () => {\n const { model, session } = this.props;\n const { showingCorrect } = this.state;\n const config = model.config || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { includeTargets } = config;\n\n return showingCorrect\n ? buildState(\n model.choices,\n model.correctResponse,\n model.correctResponse.map((id) => ({ id, outcome: 'correct' })),\n {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n },\n )\n : buildState(model.choices, session.value, model.outcomes, {\n includeTargets,\n allowSameChoiceInTargets: model.config.allowSameChoiceInTargets,\n });\n };\n\n onDragEnd = (event) => {\n const { over, active } = event;\n const ordering = this.createOrdering();\n\n if (over && active) {\n const draggedItem = active.data.current;\n const droppedOnItem = over.data.current;\n\n if (draggedItem && droppedOnItem && droppedOnItem.type === 'target') {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n return;\n }\n\n if (draggedItem && droppedOnItem) {\n this.onDropChoice(droppedOnItem, draggedItem, ordering);\n }\n } else if (!over && active) {\n const draggedItem = active.data.current;\n if (draggedItem && draggedItem.type === 'target') {\n this.onRemoveChoice(draggedItem, ordering);\n }\n }\n };\n\n render() {\n const { model } = this.props;\n const {\n correctResponse,\n correctness,\n extraCSSRules,\n prompt,\n rationale,\n feedback,\n config: configs,\n note,\n showNote,\n env,\n disabled,\n teacherInstructions,\n language,\n } = model;\n const showToggle = correctResponse && correctResponse.length > 0;\n const { showingCorrect } = this.state;\n const config = configs || {\n orientation: 'vertical',\n includeTargets: true,\n };\n const { orientation, includeTargets } = config;\n const vertical = orientation === 'vertical';\n const ordering = this.createOrdering();\n const { mode, role } = env || {};\n\n const Tiler = vertical ? VerticalTiler : HorizontalTiler;\n const displayNote = (showingCorrect || (mode === 'view' && role === 'instructor')) && showNote && note;\n const showRationale = rationale && (hasText(rationale) || hasMedia(rationale));\n const showTeacherInstructions =\n teacherInstructions && (hasText(teacherInstructions) || hasMedia(teacherInstructions));\n\n const containerStyle = {\n color: color.text(),\n backgroundColor: color.background(),\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n boxSizing: 'border-box',\n width: '100%',\n };\n\n return (\n <DragProvider\n onDragStart={() => { }}\n onDragEnd={this.onDragEnd}\n collisionDetection={rectIntersection}\n modifiers={[restrictToParentElement]}\n {...getKeyboardDragOptions(includeTargets)}\n >\n <PlacementOrderingContainer>\n <UiLayout extraCSSRules={extraCSSRules} style={containerStyle}>\n {showTeacherInstructions && (\n <StyledCollapsible\n labels={{ hidden: 'Show Teacher Instructions', visible: 'Hide Teacher Instructions' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={teacherInstructions} />\n </StyledCollapsible>\n )}\n\n <StyledPrompt>\n <PreviewPrompt prompt={prompt} />\n </StyledPrompt>\n\n <StyledToggle\n show={showToggle}\n toggled={showingCorrect}\n onToggle={this.toggleCorrect}\n language={language}\n />\n\n <InteractiveRegion>\n <InteractiveRegionContent>\n <OrderingTiler\n instanceId={this.instanceId}\n choiceLabel={config.choiceLabel}\n targetLabel={config.targetLabel}\n ordering={ordering}\n tiler={Tiler}\n disabled={disabled}\n addGuide={config.showOrdering}\n tileSize={config.tileSize}\n includeTargets={includeTargets}\n choiceLabelEnabled={model.config && model.config.choiceLabelEnabled}\n />\n </InteractiveRegionContent>\n </InteractiveRegion>\n\n {displayNote && <StyledNote dangerouslySetInnerHTML={{ __html: note }} />}\n\n {showRationale && (\n <StyledCollapsible\n labels={{ hidden: 'Show Rationale', visible: 'Hide Rationale' }}\n className=\"collapsible\"\n >\n <PreviewPrompt prompt={rationale} />\n </StyledCollapsible>\n )}\n\n {!showingCorrect && <Feedback correctness={correctness} feedback={feedback} />}\n </UiLayout>\n </PlacementOrderingContainer>\n </DragProvider>\n );\n }\n}\n\nexport default PlacementOrdering;\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AAEA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,cAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,oBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,KAAA,GAAAZ,OAAA;AAEA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,SAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf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