@pie-element/match-list 7.1.2-next.0 → 7.1.2-next.10

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.
Files changed (162) hide show
  1. package/dist/browser/controller/index.js +18 -18
  2. package/dist/browser/controller/index.js.map +1 -1
  3. package/dist/browser/delivery/index.js +3861 -4704
  4. package/dist/browser/delivery/index.js.map +1 -1
  5. package/dist/browser/{isEmpty-Eo-n7WSl.js → dist-Cn8gDne6.js} +59 -168
  6. package/dist/browser/dist-Cn8gDne6.js.map +1 -0
  7. package/dist/controller/index.js +24 -24
  8. package/dist/delivery/answer-area.d.ts +3 -0
  9. package/dist/delivery/answer-area.js +51 -44
  10. package/dist/delivery/answer.d.ts +9 -0
  11. package/dist/delivery/answer.js +121 -85
  12. package/dist/delivery/arrow.js +14 -13
  13. package/dist/delivery/choices-list.d.ts +3 -0
  14. package/dist/delivery/choices-list.js +28 -24
  15. package/dist/delivery/droppable-placeholder.d.ts +3 -1
  16. package/dist/delivery/droppable-placeholder.js +11 -7
  17. package/dist/delivery/index.js +2 -2
  18. package/dist/delivery/keyboard-coordinates.d.ts +24 -0
  19. package/dist/delivery/keyboard-coordinates.js +63 -0
  20. package/dist/delivery/main.d.ts +11 -0
  21. package/dist/delivery/main.js +135 -74
  22. package/dist/index.iife.js +35 -35
  23. package/dist/runtime-support.d.ts +12 -0
  24. package/dist/runtime-support.js +12 -0
  25. package/package.json +18 -15
  26. package/dist/browser/isEmpty-Eo-n7WSl.js.map +0 -1
  27. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js +0 -6
  28. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js +0 -16
  29. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js +0 -16
  30. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Map.js +0 -6
  31. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js +0 -16
  32. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js +0 -6
  33. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Set.js +0 -6
  34. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js +0 -11
  35. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js +0 -14
  36. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js +0 -5
  37. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js +0 -5
  38. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js +0 -6
  39. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js +0 -10
  40. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js +0 -15
  41. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js +0 -7
  42. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js +0 -7
  43. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arrayReduce.js +0 -8
  44. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js +0 -7
  45. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js +0 -8
  46. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js +0 -6
  47. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindIndex.js +0 -7
  48. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFindKey.js +0 -9
  49. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js +0 -5
  50. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js +0 -8
  51. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js +0 -10
  52. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js +0 -9
  53. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js +0 -10
  54. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js +0 -6
  55. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js +0 -9
  56. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js +0 -8
  57. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js +0 -30
  58. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js +0 -26
  59. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js +0 -11
  60. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js +0 -11
  61. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js +0 -11
  62. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js +0 -12
  63. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js +0 -12
  64. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js +0 -17
  65. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js +0 -8
  66. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js +0 -9
  67. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseReduce.js +0 -8
  68. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js +0 -7
  69. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js +0 -15
  70. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js +0 -8
  71. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js +0 -8
  72. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js +0 -6
  73. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js +0 -10
  74. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js +0 -5
  75. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js +0 -12
  76. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js +0 -12
  77. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_createFind.js +0 -19
  78. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js +0 -35
  79. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js +0 -35
  80. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js +0 -32
  81. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js +0 -4
  82. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js +0 -9
  83. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js +0 -8
  84. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js +0 -16
  85. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js +0 -9
  86. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js +0 -14
  87. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js +0 -10
  88. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js +0 -23
  89. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js +0 -6
  90. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js +0 -18
  91. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js +0 -7
  92. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js +0 -7
  93. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js +0 -13
  94. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js +0 -9
  95. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js +0 -9
  96. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js +0 -8
  97. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js +0 -11
  98. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js +0 -7
  99. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js +0 -11
  100. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js +0 -8
  101. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js +0 -7
  102. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js +0 -6
  103. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js +0 -9
  104. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js +0 -8
  105. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js +0 -7
  106. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js +0 -8
  107. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js +0 -13
  108. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js +0 -8
  109. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js +0 -7
  110. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js +0 -7
  111. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js +0 -8
  112. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js +0 -9
  113. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js +0 -8
  114. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js +0 -11
  115. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js +0 -5
  116. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js +0 -5
  117. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js +0 -9
  118. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js +0 -7
  119. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js +0 -8
  120. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_root.js +0 -5
  121. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js +0 -7
  122. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js +0 -6
  123. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js +0 -9
  124. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js +0 -7
  125. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js +0 -7
  126. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js +0 -6
  127. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js +0 -6
  128. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js +0 -16
  129. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js +0 -10
  130. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js +0 -10
  131. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js +0 -15
  132. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js +0 -8
  133. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/eq.js +0 -6
  134. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/find.js +0 -6
  135. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findIndex.js +0 -13
  136. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/findKey.js +0 -9
  137. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/get.js +0 -8
  138. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js +0 -8
  139. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/identity.js +0 -6
  140. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js +0 -10
  141. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArray.js +0 -4
  142. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js +0 -8
  143. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js +0 -6
  144. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js +0 -21
  145. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js +0 -11
  146. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isLength.js +0 -7
  147. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObject.js +0 -7
  148. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js +0 -6
  149. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js +0 -9
  150. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js +0 -7
  151. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js +0 -6
  152. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/keys.js +0 -9
  153. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/memoize.js +0 -16
  154. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/property.js +0 -10
  155. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/reduce.js +0 -12
  156. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js +0 -6
  157. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js +0 -6
  158. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js +0 -8
  159. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js +0 -8
  160. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js +0 -19
  161. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/toString.js +0 -7
  162. package/dist/node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/uniqueId.js +0 -9
@@ -1,5 +1,4 @@
1
- import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
2
- import t from "react";
1
+ import e, { useState as t } from "react";
3
2
  import n from "debug";
4
3
  import r from "prop-types";
5
4
  import { PlaceHolder as i } from "@pie-lib/drag";
@@ -7,13 +6,14 @@ import { useDraggable as a, useDroppable as o } from "@dnd-kit/core";
7
6
  import { color as s } from "@pie-lib/render-ui";
8
7
  import { jsx as c } from "react/jsx-runtime";
9
8
  import { styled as l } from "@mui/material/styles";
9
+ import { isEmpty as u } from "@pie-element/shared-lodash";
10
10
  //#region src/delivery/answer.tsx
11
- var u = n("pie-elements:match-title:answer"), d = l("div")(({ theme: e }) => ({
11
+ var d = n("pie-elements:match-title:answer"), f = l("div")(({ theme: e }) => ({
12
12
  width: "100%",
13
13
  fontSize: "18px",
14
14
  textAlign: "center",
15
15
  color: `rgba(${e.palette.common.black}, 0.6)`
16
- })), f = ({ index: e, isOver: t, disabled: n, type: r }) => /* @__PURE__ */ c(i, {
16
+ })), p = ({ index: e, isOver: t, disabled: n, type: r }) => /* @__PURE__ */ c(i, {
17
17
  extraStyles: {
18
18
  display: "flex",
19
19
  padding: "0",
@@ -24,18 +24,18 @@ var u = n("pie-elements:match-title:answer"), d = l("div")(({ theme: e }) => ({
24
24
  disabled: n,
25
25
  isOver: t,
26
26
  type: r,
27
- children: e !== void 0 && /* @__PURE__ */ c(d, { children: e })
27
+ children: e !== void 0 && /* @__PURE__ */ c(f, { children: e })
28
28
  });
29
- f.propTypes = {
29
+ p.propTypes = {
30
30
  index: r.number,
31
31
  isOver: r.bool,
32
32
  disabled: r.bool,
33
33
  type: r.string
34
34
  };
35
- var p = l("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i }) => ({
35
+ var m = l("div")(({ isDragging: e, isSelected: t, isOver: n, disabled: r, outcome: i }) => ({
36
36
  color: s.text(),
37
37
  backgroundColor: s.white(),
38
- border: `1px solid ${i === "correct" ? s.correct() : i === "incorrect" ? s.incorrect() : e.palette.grey[400]}`,
38
+ border: `1px solid ${i === "correct" ? s.correct() : i === "incorrect" ? s.incorrect() : s.border()}`,
39
39
  cursor: r ? "not-allowed" : "pointer",
40
40
  width: "100%",
41
41
  padding: "10px",
@@ -43,36 +43,38 @@ var p = l("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i
43
43
  overflow: "hidden",
44
44
  transition: "opacity 200ms linear",
45
45
  wordBreak: "break-word",
46
- opacity: t && !r ? .5 : n && !r ? .2 : 1,
46
+ opacity: (e || t) && !r ? .5 : n && !r ? .2 : 1,
47
47
  touchAction: "none"
48
- })), m = (e) => {
49
- let { isDragging: t, isOver: n, title: r, disabled: i, empty: a, outcome: o, guideIndex: s, type: l } = e;
50
- return a ? /* @__PURE__ */ c(f, {
51
- index: s,
52
- isOver: n,
53
- disabled: i,
54
- type: l
55
- }) : /* @__PURE__ */ c(p, {
48
+ })), h = (e) => {
49
+ let { isDragging: t, isSelected: n, isOver: r, title: i, disabled: a, empty: o, outcome: s, guideIndex: l, type: u } = e;
50
+ return o ? /* @__PURE__ */ c(p, {
51
+ index: l,
52
+ isOver: r,
53
+ disabled: a,
54
+ type: u
55
+ }) : /* @__PURE__ */ c(m, {
56
56
  isDragging: t,
57
- isOver: n,
58
- disabled: i,
59
- outcome: o,
60
- dangerouslySetInnerHTML: { __html: r }
57
+ isSelected: n,
58
+ isOver: r,
59
+ disabled: a,
60
+ outcome: s,
61
+ dangerouslySetInnerHTML: { __html: i }
61
62
  });
62
- }, h = l("div")(({ correct: e, theme: t }) => ({
63
+ }, g = l("div")(({ correct: e, isSelected: t, isDragging: n, theme: r }) => ({
63
64
  boxSizing: "border-box",
64
65
  minHeight: 40,
65
66
  minWidth: "200px",
66
67
  overflow: "hidden",
67
- margin: t.spacing(.5),
68
+ margin: r.spacing(.5),
68
69
  padding: "0px",
69
70
  textAlign: "center",
70
71
  height: "initial",
71
- border: e === !0 ? `1px solid var(--feedback-correct-bg-color, ${s.correct()})` : e === !1 ? `1px solid var(--feedback-incorrect-bg-color, ${s.incorrect()})` : "none"
72
- })), g = class extends t.Component {
72
+ border: e === !0 ? `1px solid var(--feedback-correct-bg-color, ${s.correct()})` : e === !1 ? `1px solid var(--feedback-incorrect-bg-color, ${s.incorrect()})` : t && !n ? `2px solid ${s.buttonFocusOutline()}` : "none"
73
+ })), _ = class extends e.Component {
73
74
  static propTypes = {
74
75
  className: r.string,
75
76
  isDragging: r.bool,
77
+ isSelected: r.bool,
76
78
  id: r.any,
77
79
  title: r.string,
78
80
  isOver: r.bool,
@@ -89,88 +91,122 @@ var p = l("div")(({ theme: e, isDragging: t, isOver: n, disabled: r, outcome: i
89
91
  }
90
92
  handleTouchStart = (e) => {};
91
93
  render() {
92
- let { id: t, title: n, isDragging: r = !1, className: i, disabled: a, isOver: o = !1, type: s, correct: l } = this.props;
93
- return u("[render], props: ", this.props), /* @__PURE__ */ c(h, {
94
+ let { id: e, title: t, isDragging: n = !1, isSelected: r = !1, className: i, disabled: a, isOver: o = !1, type: s, correct: l } = this.props;
95
+ return d("[render], props: ", this.props), /* @__PURE__ */ c(g, {
94
96
  correct: l,
97
+ isSelected: r,
98
+ isDragging: n,
95
99
  className: i,
96
100
  ref: (e) => this.ref = e,
97
- children: /* @__PURE__ */ c(m, {
98
- title: n,
99
- id: t,
101
+ children: /* @__PURE__ */ c(h, {
102
+ title: t,
103
+ id: e,
100
104
  isOver: o,
101
- empty: e(n),
102
- isDragging: r,
105
+ empty: u(t),
106
+ isDragging: n,
107
+ isSelected: r,
103
108
  disabled: a,
104
109
  type: s
105
110
  })
106
111
  });
107
112
  }
108
- };
109
- function _(e) {
110
- let { id: t, instanceId: n, promptId: r, draggable: i = !0, disabled: s = !1, type: l } = e, u = `${l || "answer"}-${t}`, d = r == null ? void 0 : `drop-${r}`, { attributes: f, listeners: p, setNodeRef: m, transform: h, transition: _, isDragging: v } = a({
111
- id: u,
112
- data: {
113
- type: l || "answer",
114
- id: t,
115
- instanceId: n,
116
- value: e.title,
117
- promptId: r
118
- },
119
- disabled: !i || s
120
- }), y = o({
121
- id: d,
122
- data: d ? {
123
- type: "drop-zone",
124
- promptId: r,
125
- instanceId: n
126
- } : void 0,
127
- disabled: s || !d
128
- }), b = y.setNodeRef, x = y.isOver, S = h ? `translate3d(${h.x}px, ${h.y}px, 0)` : void 0;
129
- return d ? /* @__PURE__ */ c("div", {
130
- ref: b,
131
- style: {
132
- flex: 1,
133
- transform: S,
134
- transition: _,
135
- opacity: v ? .5 : 1,
136
- backgroundColor: x ? "rgba(0,0,0,0.05)" : "transparent"
137
- },
138
- children: /* @__PURE__ */ c("div", {
139
- ref: m,
140
- ...p,
141
- ...f,
142
- children: /* @__PURE__ */ c(g, {
143
- ...e,
144
- isDragging: v,
145
- isOver: x
113
+ }, v = ({ type: e, id: t, promptId: n }) => n == null ? `${e || "answer"}-${t}` : `${e || "answer"}-prompt-${n}`;
114
+ function y(e) {
115
+ let { id: n, instanceId: r, promptId: i, draggable: s = !0, disabled: l = !1, type: u, selectedAnswer: d, onSelectClick: f, onPlacementClick: p } = e, m = v({
116
+ type: u,
117
+ id: n,
118
+ promptId: i
119
+ }), h = i == null ? void 0 : `drop-${i}`, g = {
120
+ type: u || "answer",
121
+ id: n,
122
+ instanceId: r,
123
+ value: e.title,
124
+ promptId: i
125
+ }, y = h ? {
126
+ type: "drop-zone",
127
+ promptId: i,
128
+ instanceId: r
129
+ } : void 0, { attributes: b, listeners: x, setNodeRef: S, transform: C, transition: w, isDragging: T } = a({
130
+ id: m,
131
+ data: g,
132
+ disabled: !s || l,
133
+ attributes: { tabIndex: s && !l ? 0 : -1 }
134
+ }), E = o({
135
+ id: h,
136
+ data: y,
137
+ disabled: l || !h
138
+ }), D = E.setNodeRef, O = E.isOver, [k, A] = t(!1), j = !!d, M = O || j && k && !l, N = !!d && d.type === g.type && d.id === g.id && d.promptId === g.promptId, P = C ? `translate3d(${C.x}px, ${C.y}px, 0)` : void 0;
139
+ if (h) {
140
+ let t = () => {
141
+ l || (N ? f?.(g) : d ? p?.(y) : s && f?.(g));
142
+ }, n = !s && !l;
143
+ return /* @__PURE__ */ c("div", {
144
+ ref: D,
145
+ role: "button",
146
+ tabIndex: n ? 0 : -1,
147
+ onClick: t,
148
+ onKeyDown: n ? (e) => {
149
+ (e.code === "Space" || e.code === "Enter") && (e.preventDefault(), t());
150
+ } : void 0,
151
+ onMouseEnter: () => A(!0),
152
+ onMouseLeave: () => A(!1),
153
+ style: {
154
+ flex: 1,
155
+ opacity: T ? .5 : 1,
156
+ backgroundColor: T || N || M ? "rgba(0,0,0,0.05)" : "transparent",
157
+ cursor: j && !l ? "pointer" : void 0
158
+ },
159
+ children: /* @__PURE__ */ c("div", {
160
+ ref: S,
161
+ ...x,
162
+ ...b,
163
+ style: {
164
+ transform: P,
165
+ transition: w
166
+ },
167
+ children: /* @__PURE__ */ c(_, {
168
+ ...e,
169
+ isDragging: T,
170
+ isSelected: N,
171
+ isOver: M
172
+ })
146
173
  })
147
- })
148
- }) : /* @__PURE__ */ c("div", {
149
- ref: m,
150
- ...p,
151
- ...f,
174
+ });
175
+ }
176
+ let F = (e) => {
177
+ l || (e.stopPropagation(), f?.(g));
178
+ };
179
+ return /* @__PURE__ */ c("div", {
180
+ ref: S,
181
+ ...x,
182
+ ...b,
183
+ onClick: F,
152
184
  style: {
153
- transform: S,
154
- transition: _,
155
- cursor: s ? "not-allowed" : "grab",
156
- opacity: v ? .5 : 1,
157
- touchAction: i && !s ? "none" : "auto"
185
+ transform: P,
186
+ transition: w,
187
+ cursor: l ? "not-allowed" : "grab",
188
+ opacity: T ? .5 : 1,
189
+ touchAction: s && !l ? "none" : "auto"
158
190
  },
159
- children: /* @__PURE__ */ c(g, {
191
+ children: /* @__PURE__ */ c(_, {
160
192
  ...e,
161
- isDragging: v,
193
+ isDragging: T,
194
+ isSelected: N,
162
195
  isOver: !1
163
196
  })
164
197
  });
165
198
  }
166
- _.propTypes = {
199
+ y.propTypes = {
167
200
  id: r.any,
168
201
  instanceId: r.string,
169
202
  promptId: r.any,
170
203
  title: r.string,
171
204
  draggable: r.bool,
172
205
  disabled: r.bool,
173
- type: r.string
206
+ type: r.string,
207
+ selectedAnswer: r.object,
208
+ onSelectClick: r.func,
209
+ onPlacementClick: r.func
174
210
  };
175
211
  //#endregion
176
- export { g as Answer, _ as default };
212
+ export { _ as Answer, v as buildDragId, y as default };
@@ -1,35 +1,36 @@
1
1
  import e from "react";
2
2
  import t from "prop-types";
3
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
- import { styled as i } from "@mui/material/styles";
5
- import a from "@mui/icons-material/ArrowDropDown";
3
+ import { color as n } from "@pie-lib/render-ui";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { styled as a } from "@mui/material/styles";
6
+ import o from "@mui/icons-material/ArrowDropDown";
6
7
  //#region src/delivery/arrow.tsx
7
- var o = i("div")({
8
+ var s = a("div")({
8
9
  display: "inline-block",
9
10
  position: "relative",
10
11
  width: "100%"
11
- }), s = i("span")(({ theme: e, isRight: t }) => ({
12
- backgroundColor: e.palette.grey[500],
13
- bottom: t ? 20 : 19,
12
+ }), c = a("span")(({ isRight: e }) => ({
13
+ backgroundColor: n.border(),
14
+ bottom: e ? 20 : 19,
14
15
  content: "\"\"",
15
16
  display: "block",
16
17
  height: 1,
17
18
  left: 20,
18
19
  position: "absolute",
19
20
  width: "100%"
20
- })), c = class extends e.Component {
21
+ })), l = class extends e.Component {
21
22
  static propTypes = { direction: t.string };
22
23
  render() {
23
24
  let { direction: e } = this.props;
24
- return /* @__PURE__ */ r(o, {
25
+ return /* @__PURE__ */ i(s, {
25
26
  style: e === "left" ? {} : { transform: "rotate(180deg)" },
26
- children: [/* @__PURE__ */ n(a, { style: {
27
+ children: [/* @__PURE__ */ r(o, { style: {
27
28
  transform: "rotate(90deg)",
28
- color: "#979797",
29
+ color: n.border(),
29
30
  fontSize: 40
30
- } }), /* @__PURE__ */ n(s, { isRight: e !== "left" })]
31
+ } }), /* @__PURE__ */ r(c, { isRight: e !== "left" })]
31
32
  });
32
33
  }
33
34
  };
34
35
  //#endregion
35
- export { c as default };
36
+ export { l as Arrow, l as default };
@@ -15,6 +15,9 @@ export declare class ChoicesList extends React.Component {
15
15
  model: PropTypes.Validator<object>;
16
16
  disabled: PropTypes.Validator<boolean>;
17
17
  onRemoveAnswer: PropTypes.Requireable<(...args: any[]) => any>;
18
+ selectedAnswer: PropTypes.Requireable<object>;
19
+ onChoiceClick: PropTypes.Requireable<(...args: any[]) => any>;
20
+ onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
18
21
  };
19
22
  render(): React.JSX.Element;
20
23
  }
@@ -1,37 +1,41 @@
1
- import e from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/find.js";
2
- import t from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isEmpty.js";
3
- import n from "../node_modules/.bun/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js";
4
- import r from "./answer.js";
5
- import i from "./droppable-placeholder.js";
6
- import a from "react";
7
- import o from "prop-types";
8
- import { jsx as s } from "react/jsx-runtime";
9
- import { styled as c } from "@mui/material/styles";
1
+ import e from "./answer.js";
2
+ import { DroppablePlaceholder as t } from "./droppable-placeholder.js";
3
+ import n from "react";
4
+ import r from "prop-types";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ import { styled as a } from "@mui/material/styles";
7
+ import { find as o, isEmpty as s, isUndefined as c } from "@pie-element/shared-lodash";
10
8
  //#region src/delivery/choices-list.tsx
11
- var l = c("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), u = class extends a.Component {
9
+ var l = a("div")(({ theme: e }) => ({ marginBottom: e.spacing(2) })), u = class extends n.Component {
12
10
  static propTypes = {
13
- session: o.object.isRequired,
14
- instanceId: o.string.isRequired,
15
- model: o.object.isRequired,
16
- disabled: o.bool.isRequired,
17
- onRemoveAnswer: o.func
11
+ session: r.object.isRequired,
12
+ instanceId: r.string.isRequired,
13
+ model: r.object.isRequired,
14
+ disabled: r.bool.isRequired,
15
+ onRemoveAnswer: r.func,
16
+ selectedAnswer: r.object,
17
+ onChoiceClick: r.func,
18
+ onPlacementClick: r.func
18
19
  };
19
20
  render() {
20
- let { model: a, disabled: o, session: c, instanceId: u, onRemoveAnswer: d } = this.props, { config: f } = a, { duplicates: p } = f;
21
- return /* @__PURE__ */ s(l, { children: /* @__PURE__ */ s(i, {
21
+ let { model: n, disabled: r, session: a, instanceId: u, onRemoveAnswer: d, selectedAnswer: f, onChoiceClick: p, onPlacementClick: m } = this.props, { config: h } = n, { duplicates: g } = h;
22
+ return /* @__PURE__ */ i(l, { children: /* @__PURE__ */ i(t, {
22
23
  id: "choices-pool",
23
- disabled: o,
24
+ disabled: r,
24
25
  onRemoveAnswer: d,
25
- children: f.answers.filter((r) => p || t(c) || !c.value || n(e(c.value, (e) => e === r.id))).map((e) => /* @__PURE__ */ s(r, {
26
+ onPlacementClick: m,
27
+ children: h.answers.filter((e) => g || s(a) || !a.value || c(o(a.value, (t) => t === e.id))).map((t) => /* @__PURE__ */ i(e, {
26
28
  instanceId: u,
27
29
  draggable: !0,
28
- disabled: o,
29
- session: c,
30
+ disabled: r,
31
+ session: a,
30
32
  type: "choice",
31
- ...e
32
- }, e.id))
33
+ selectedAnswer: f,
34
+ onSelectClick: p,
35
+ ...t
36
+ }, t.id))
33
37
  }) });
34
38
  }
35
39
  };
36
40
  //#endregion
37
- export { u as default };
41
+ export { u as ChoicesList, u as default };
@@ -8,17 +8,19 @@
8
8
  */
9
9
  import React from 'react';
10
10
  import PropTypes from 'prop-types';
11
- export declare function DroppablePlaceholder({ id, disabled, children, ...rest }: {
11
+ export declare function DroppablePlaceholder({ id, disabled, children, onPlacementClick, ...rest }: {
12
12
  [x: string]: any;
13
13
  id: any;
14
14
  disabled: any;
15
15
  children: any;
16
+ onPlacementClick: any;
16
17
  }): React.JSX.Element;
17
18
  export declare namespace DroppablePlaceholder {
18
19
  var propTypes: {
19
20
  id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
20
21
  disabled: PropTypes.Requireable<boolean>;
21
22
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
23
+ onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
22
24
  };
23
25
  }
24
26
  export default DroppablePlaceholder;
@@ -16,16 +16,19 @@ var a = i("div")(({ theme: e }) => ({
16
16
  minHeight: 50,
17
17
  transition: "background-color 200ms ease"
18
18
  }));
19
- function o({ id: e, disabled: i, children: o, ...s }) {
20
- let { setNodeRef: c, isOver: l } = n({
19
+ function o({ id: e, disabled: i, children: o, onPlacementClick: s, ...c }) {
20
+ let { setNodeRef: l, isOver: u } = n({
21
21
  id: e || "choices-pool",
22
22
  data: { type: "choices-pool" },
23
23
  disabled: i
24
24
  });
25
25
  return /* @__PURE__ */ r(a, {
26
- ref: c,
27
- style: { backgroundColor: l ? "rgba(0,0,0,0.05)" : "transparent" },
28
- ...s,
26
+ ref: l,
27
+ onClick: () => {
28
+ i || s?.({ type: "choices-pool" });
29
+ },
30
+ style: { backgroundColor: u ? "rgba(0,0,0,0.05)" : "transparent" },
31
+ ...c,
29
32
  children: /* @__PURE__ */ r(t, {
30
33
  id: e,
31
34
  disabled: i,
@@ -36,7 +39,8 @@ function o({ id: e, disabled: i, children: o, ...s }) {
36
39
  o.propTypes = {
37
40
  id: e.oneOfType([e.string, e.number]),
38
41
  disabled: e.bool,
39
- children: e.node
42
+ children: e.node,
43
+ onPlacementClick: e.func
40
44
  };
41
45
  //#endregion
42
- export { o as default };
46
+ export { o as DroppablePlaceholder, o as default };
@@ -1,4 +1,4 @@
1
- import e from "./main.js";
1
+ import { Main as e } from "./main.js";
2
2
  import t from "react";
3
3
  import { createRoot as n } from "react-dom/client";
4
4
  import r from "debug";
@@ -42,7 +42,7 @@ var o = r("pie-ui:graph-lines"), s = (e, t) => {
42
42
  });
43
43
  }
44
44
  disconnectedCallback() {
45
- this._root && this._root.unmount();
45
+ this._root &&= (this._root.unmount(), null);
46
46
  }
47
47
  };
48
48
  //#endregion
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @synced-from pie-elements/packages/match-list/src/keyboard-coordinates.js
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ /**
10
+ * Custom keyboard coordinate getter for non-sortable drag-and-drop.
11
+ *
12
+ * Tab/Shift+Tab cycle the dragged item directly onto the next/previous droppable
13
+ * (response area or the choices pool), in DOM order, placing the dragged item's own
14
+ * top-left corner at the target's center-left point. Arrow keys are left doing plain
15
+ * free-form movement (nudging the dragged item by a fixed step, same as dnd-kit's own
16
+ * default keyboard behavior) rather than jumping between droppables — collision
17
+ * detection (rectIntersection) still picks up whatever the item ends up actually
18
+ * overlapping.
19
+ */
20
+ export declare const closestDroppableKeyboardCoordinates: (event: any, { active, context, currentCoordinates }: {
21
+ active: any;
22
+ context: any;
23
+ currentCoordinates: any;
24
+ }) => any;
@@ -0,0 +1,63 @@
1
+ import { KeyboardCode as e } from "@dnd-kit/core";
2
+ //#region src/delivery/keyboard-coordinates.ts
3
+ var t = 25, n = (n, { active: i, context: a, currentCoordinates: o }) => {
4
+ let { code: s } = n, c = s === "Tab", l = s === e.Down || s === e.Up || s === e.Left || s === e.Right;
5
+ if (!c && !l) return;
6
+ if (n.preventDefault(), l) switch (s) {
7
+ case e.Down: return {
8
+ ...o,
9
+ y: o.y + t
10
+ };
11
+ case e.Up: return {
12
+ ...o,
13
+ y: o.y - t
14
+ };
15
+ case e.Right: return {
16
+ ...o,
17
+ x: o.x + t
18
+ };
19
+ case e.Left: return {
20
+ ...o,
21
+ x: o.x - t
22
+ };
23
+ default: return o;
24
+ }
25
+ let { droppableRects: u, droppableContainers: d, collisionRect: f } = a;
26
+ if (!u || u.size === 0) return o;
27
+ let p = i?.data?.current, m = p?.promptId == null ? void 0 : `drop-${p.promptId}`, h = [];
28
+ for (let [e, t] of d) {
29
+ if (t?.disabled || e === m) continue;
30
+ let n = t?.node?.current?.getBoundingClientRect() ?? u.get(e);
31
+ if (!n) continue;
32
+ let r = {
33
+ x: n.left + n.width / 2,
34
+ y: n.top + n.height / 2
35
+ }, i = f?.height ?? 0, a = {
36
+ x: n.left,
37
+ y: n.top + n.height / 2 - i / 2
38
+ };
39
+ h.push({
40
+ id: e,
41
+ rect: n,
42
+ dropPosition: a,
43
+ center: r
44
+ });
45
+ }
46
+ if (h.length === 0) return o;
47
+ let g = n.shiftKey;
48
+ h.sort((e, t) => Math.abs(e.center.y - t.center.y) > 10 ? e.center.y - t.center.y : e.center.x - t.center.x);
49
+ let _ = f ? {
50
+ x: f.left + f.width / 2,
51
+ y: f.top + f.height / 2
52
+ } : o, v = h.findIndex((e) => _.x >= e.rect.left && _.x <= e.rect.right && _.y >= e.rect.top && _.y <= e.rect.bottom);
53
+ if (v === -1) {
54
+ let e = Infinity;
55
+ for (let t = 0; t < h.length; t++) {
56
+ let n = r(o, h[t].dropPosition);
57
+ n < e && (e = n, v = t);
58
+ }
59
+ }
60
+ return h[g ? (v - 1 + h.length) % h.length : (v + 1) % h.length].dropPosition;
61
+ }, r = (e, t) => Math.sqrt((e.x - t.x) ** 2 + (e.y - t.y) ** 2);
62
+ //#endregion
63
+ export { n as closestDroppableKeyboardCoordinates };
@@ -18,7 +18,18 @@ export declare class Main extends React.Component {
18
18
  constructor(props: any);
19
19
  onRemoveAnswer(id: any): void;
20
20
  onDragStart: any;
21
+ onDragCancel: any;
22
+ placeAnswer: any;
21
23
  onPlaceAnswer: any;
24
+ isSameAnswer: (a: any, b: any) => boolean;
25
+ selectAnswer: any;
26
+ toggleAnswerSelection: any;
27
+ cancelSelection: any;
28
+ endAnyLiveKeyboardDrag: any;
29
+ placeSelectedAnswer: any;
30
+ isClickSoonAfterDragEnd: () => boolean;
31
+ onChoiceClick: any;
32
+ onPlacementClick: any;
22
33
  toggleShowCorrect: any;
23
34
  renderDragOverlay: any;
24
35
  render(): React.JSX.Element;