@pie-element/categorize 0.1.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.
Files changed (238) hide show
  1. package/dist/author/defaults.d.ts +224 -0
  2. package/dist/author/defaults.d.ts.map +1 -0
  3. package/dist/author/defaults.js +170 -0
  4. package/dist/author/design/builder.d.ts +11 -0
  5. package/dist/author/design/builder.d.ts.map +1 -0
  6. package/dist/author/design/builder.js +24 -0
  7. package/dist/author/design/buttons.d.ts +29 -0
  8. package/dist/author/design/buttons.d.ts.map +1 -0
  9. package/dist/author/design/buttons.js +36 -0
  10. package/dist/author/design/categories/RowLabel.d.ts +24 -0
  11. package/dist/author/design/categories/RowLabel.d.ts.map +1 -0
  12. package/dist/author/design/categories/RowLabel.js +46 -0
  13. package/dist/author/design/categories/alternateResponses.d.ts +32 -0
  14. package/dist/author/design/categories/alternateResponses.d.ts.map +1 -0
  15. package/dist/author/design/categories/alternateResponses.js +62 -0
  16. package/dist/author/design/categories/category.d.ts +45 -0
  17. package/dist/author/design/categories/category.d.ts.map +1 -0
  18. package/dist/author/design/categories/category.js +102 -0
  19. package/dist/author/design/categories/choice-preview.d.ts +26 -0
  20. package/dist/author/design/categories/choice-preview.d.ts.map +1 -0
  21. package/dist/author/design/categories/choice-preview.js +60 -0
  22. package/dist/author/design/categories/droppable-placeholder.d.ts +11 -0
  23. package/dist/author/design/categories/droppable-placeholder.d.ts.map +1 -0
  24. package/dist/author/design/categories/droppable-placeholder.js +70 -0
  25. package/dist/author/design/categories/index.d.ts +42 -0
  26. package/dist/author/design/categories/index.d.ts.map +1 -0
  27. package/dist/author/design/categories/index.js +146 -0
  28. package/dist/author/design/choices/choice.d.ts +11 -0
  29. package/dist/author/design/choices/choice.d.ts.map +1 -0
  30. package/dist/author/design/choices/choice.js +129 -0
  31. package/dist/author/design/choices/config.d.ts +22 -0
  32. package/dist/author/design/choices/config.d.ts.map +1 -0
  33. package/dist/author/design/choices/config.js +33 -0
  34. package/dist/author/design/choices/index.d.ts +42 -0
  35. package/dist/author/design/choices/index.d.ts.map +1 -0
  36. package/dist/author/design/choices/index.js +110 -0
  37. package/dist/author/design/header.d.ts +25 -0
  38. package/dist/author/design/header.d.ts.map +1 -0
  39. package/dist/author/design/header.js +49 -0
  40. package/dist/author/design/index.d.ts +53 -0
  41. package/dist/author/design/index.d.ts.map +1 -0
  42. package/dist/author/design/index.js +410 -0
  43. package/dist/author/design/input-header.d.ts +40 -0
  44. package/dist/author/design/input-header.d.ts.map +1 -0
  45. package/dist/author/design/input-header.js +69 -0
  46. package/dist/author/design/utils.d.ts +10 -0
  47. package/dist/author/design/utils.d.ts.map +1 -0
  48. package/dist/author/design/utils.js +7 -0
  49. package/dist/author/index.d.ts +52 -0
  50. package/dist/author/index.d.ts.map +1 -0
  51. package/dist/author/index.js +87 -0
  52. package/dist/author/main.d.ts +24 -0
  53. package/dist/author/main.d.ts.map +1 -0
  54. package/dist/author/main.js +30 -0
  55. package/dist/author/utils.d.ts +17 -0
  56. package/dist/author/utils.d.ts.map +1 -0
  57. package/dist/author/utils.js +17 -0
  58. package/dist/controller/defaults.d.ts +35 -0
  59. package/dist/controller/defaults.d.ts.map +1 -0
  60. package/dist/controller/defaults.js +29 -0
  61. package/dist/controller/index.d.ts +62 -0
  62. package/dist/controller/index.d.ts.map +1 -0
  63. package/dist/controller/index.js +155 -0
  64. package/dist/controller/utils.d.ts +21 -0
  65. package/dist/controller/utils.d.ts.map +1 -0
  66. package/dist/controller/utils.js +35 -0
  67. package/dist/delivery/categorize/categories.d.ts +35 -0
  68. package/dist/delivery/categorize/categories.d.ts.map +1 -0
  69. package/dist/delivery/categorize/categories.js +66 -0
  70. package/dist/delivery/categorize/category.d.ts +29 -0
  71. package/dist/delivery/categorize/category.d.ts.map +1 -0
  72. package/dist/delivery/categorize/category.js +48 -0
  73. package/dist/delivery/categorize/choice.d.ts +28 -0
  74. package/dist/delivery/categorize/choice.d.ts.map +1 -0
  75. package/dist/delivery/categorize/choice.js +94 -0
  76. package/dist/delivery/categorize/choices.d.ts +40 -0
  77. package/dist/delivery/categorize/choices.d.ts.map +1 -0
  78. package/dist/delivery/categorize/choices.js +51 -0
  79. package/dist/delivery/categorize/droppable-placeholder.d.ts +33 -0
  80. package/dist/delivery/categorize/droppable-placeholder.d.ts.map +1 -0
  81. package/dist/delivery/categorize/droppable-placeholder.js +64 -0
  82. package/dist/delivery/categorize/grid-content.d.ts +26 -0
  83. package/dist/delivery/categorize/grid-content.d.ts.map +1 -0
  84. package/dist/delivery/categorize/grid-content.js +39 -0
  85. package/dist/delivery/categorize/index.d.ts +58 -0
  86. package/dist/delivery/categorize/index.d.ts.map +1 -0
  87. package/dist/delivery/categorize/index.js +260 -0
  88. package/dist/delivery/index.d.ts +28 -0
  89. package/dist/delivery/index.d.ts.map +1 -0
  90. package/dist/delivery/index.js +152 -0
  91. package/dist/index.d.ts +2 -0
  92. package/dist/index.d.ts.map +1 -0
  93. package/dist/index.iife.d.ts +9 -0
  94. package/dist/index.iife.d.ts.map +1 -0
  95. package/dist/index.iife.js +152 -0
  96. package/dist/index.js +2 -0
  97. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  98. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  99. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  100. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  101. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  102. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  103. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  104. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  105. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  106. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  107. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  108. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  109. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  110. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  111. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  112. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  113. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  114. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  115. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  116. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  117. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  118. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  119. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  170. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  171. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  172. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  173. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  174. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  175. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  176. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  177. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  178. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  179. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  180. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  181. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  182. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  183. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  184. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  185. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  186. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  187. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  188. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  189. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  190. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  191. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  192. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  193. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  194. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  195. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  196. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  197. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  198. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  199. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  200. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  201. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  202. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  203. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  204. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  205. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  206. package/package.json +74 -0
  207. package/src/author/defaults.ts +182 -0
  208. package/src/author/design/builder.ts +63 -0
  209. package/src/author/design/buttons.tsx +60 -0
  210. package/src/author/design/categories/RowLabel.tsx +91 -0
  211. package/src/author/design/categories/alternateResponses.tsx +127 -0
  212. package/src/author/design/categories/category.tsx +161 -0
  213. package/src/author/design/categories/choice-preview.tsx +112 -0
  214. package/src/author/design/categories/droppable-placeholder.tsx +114 -0
  215. package/src/author/design/categories/index.tsx +254 -0
  216. package/src/author/design/choices/choice.tsx +200 -0
  217. package/src/author/design/choices/config.tsx +58 -0
  218. package/src/author/design/choices/index.tsx +185 -0
  219. package/src/author/design/header.tsx +74 -0
  220. package/src/author/design/index.tsx +764 -0
  221. package/src/author/design/input-header.tsx +109 -0
  222. package/src/author/design/utils.ts +14 -0
  223. package/src/author/index.ts +171 -0
  224. package/src/author/main.tsx +45 -0
  225. package/src/author/utils.ts +46 -0
  226. package/src/controller/defaults.ts +37 -0
  227. package/src/controller/index.ts +469 -0
  228. package/src/controller/utils.ts +79 -0
  229. package/src/delivery/categorize/categories.tsx +139 -0
  230. package/src/delivery/categorize/category.tsx +78 -0
  231. package/src/delivery/categorize/choice.tsx +117 -0
  232. package/src/delivery/categorize/choices.tsx +95 -0
  233. package/src/delivery/categorize/droppable-placeholder.tsx +95 -0
  234. package/src/delivery/categorize/grid-content.tsx +53 -0
  235. package/src/delivery/categorize/index.tsx +515 -0
  236. package/src/delivery/index.ts +390 -0
  237. package/src/index.iife.ts +16 -0
  238. package/src/index.ts +1 -0
@@ -0,0 +1,764 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/configure/src/design/index.jsx
4
+ * @auto-generated
5
+ *
6
+ * This file is automatically synced from pie-elements and converted to TypeScript.
7
+ * Manual edits will be overwritten on next sync.
8
+ * To make changes, edit the upstream JavaScript file and run sync again.
9
+ */
10
+
11
+ import { getPluginProps } from './utils.js';
12
+ import React from 'react';
13
+ import PropTypes from 'prop-types';
14
+ import { styled } from '@mui/material/styles';
15
+ import { DragOverlay } from '@dnd-kit/core';
16
+ import { FeedbackConfig, InputContainer, layout, settings } from '@pie-lib/config-ui';
17
+ import {
18
+ countInAnswer,
19
+ ensureNoExtraChoicesInAnswer,
20
+ ensureNoExtraChoicesInAlternate,
21
+ moveChoiceToCategory,
22
+ moveChoiceToAlternate,
23
+ removeChoiceFromCategory,
24
+ removeChoiceFromAlternate,
25
+ verifyAllowMultiplePlacements,
26
+ } from '@pie-lib/categorize';
27
+ import EditableHtml from '@pie-lib/editable-html-tip-tap';
28
+ import { DragProvider, uid } from '@pie-lib/drag';
29
+ import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
30
+
31
+ import Categories from './categories/index.js';
32
+ import AlternateResponses from './categories/alternateResponses.js';
33
+ import Choices from './choices/index.js';
34
+ import Choice from './choices/choice.js';
35
+ import ChoicePreview from './categories/choice-preview.js';
36
+ import { buildAlternateResponses, buildCategories } from './builder.js';
37
+ import Header from './header.js';
38
+ import { getMaxCategoryChoices, multiplePlacements } from '../utils.js';
39
+ import { AlertDialog } from '@pie-lib/config-ui';
40
+ import Translator from '@pie-lib/translator';
41
+
42
+ const { translator } = Translator;
43
+ const { dropdown, Panel, toggle, radio, numberField } = settings;
44
+ const { Provider: IdProvider } = uid;
45
+
46
+ // Simple wrapper to render math in DragOverlay portal
47
+ class DragPreviewWrapper extends React.Component {
48
+ containerRef = React.createRef();
49
+
50
+ componentDidMount() {
51
+ if (this.containerRef.current) {
52
+ setTimeout(() => renderMath(this.containerRef.current), 0);
53
+ }
54
+ }
55
+
56
+ render() {
57
+ return <div ref={this.containerRef}>{this.props.children}</div>;
58
+ }
59
+ }
60
+
61
+ const StyledHeader: any = styled(Header)(({ theme }) => ({
62
+ marginBottom: theme.spacing(2),
63
+ }));
64
+
65
+ const StyledInputContainer: any = styled(InputContainer)(({ theme }) => ({
66
+ width: '100%',
67
+ paddingTop: theme.spacing(2),
68
+ marginBottom: theme.spacing(2),
69
+ }));
70
+
71
+ const ErrorText: any = styled('div')(({ theme }) => ({
72
+ fontSize: theme.typography.fontSize - 2,
73
+ color: theme.palette.error.main,
74
+ paddingTop: theme.spacing(1),
75
+ }));
76
+
77
+ export class Design extends React.Component {
78
+ static propTypes = {
79
+ configuration: PropTypes.object,
80
+ className: PropTypes.string,
81
+ onConfigurationChanged: PropTypes.func,
82
+ model: PropTypes.object.isRequired,
83
+ onChange: PropTypes.func.isRequired,
84
+ uid: PropTypes.string,
85
+ imageSupport: PropTypes.shape({
86
+ add: PropTypes.func.isRequired,
87
+ delete: PropTypes.func.isRequired,
88
+ }),
89
+ uploadSoundSupport: PropTypes.shape({
90
+ add: PropTypes.func.isRequired,
91
+ delete: PropTypes.func.isRequired,
92
+ }),
93
+ };
94
+
95
+ constructor(props) {
96
+ super(props);
97
+ this.uid = props.uid || uid.generateId();
98
+ this.state = {
99
+ activeDragItem: null,
100
+ };
101
+ }
102
+
103
+ updateModel: any = (props) => {
104
+ const { model, onChange } = this.props;
105
+
106
+ const updatedModel = {
107
+ ...model,
108
+ ...props,
109
+ };
110
+
111
+ updatedModel.choices = updatedModel.choices.map((c) => ({
112
+ ...c,
113
+ categoryCount: this.checkAllowMultiplePlacements(updatedModel.allowMultiplePlacementsEnabled, c),
114
+ }));
115
+
116
+ //Ensure that there are no extra choices in correctResponse, if the user has decided that only one choice may be used.
117
+ updatedModel.correctResponse = ensureNoExtraChoicesInAnswer(
118
+ updatedModel.correctResponse || [],
119
+ updatedModel.choices,
120
+ );
121
+
122
+ //Ensure that there are no extra choices in alternate responses, if the user has decided that only one choice may be used.
123
+ updatedModel.correctResponse = ensureNoExtraChoicesInAlternate(
124
+ updatedModel.correctResponse || [],
125
+ updatedModel.choices,
126
+ );
127
+
128
+ //clean categories
129
+ updatedModel.categories = updatedModel.categories.map((c) => ({
130
+ id: c.id,
131
+ label: c.label,
132
+ }));
133
+
134
+ updatedModel.choices = updatedModel.choices.map((h) => ({
135
+ id: h.id,
136
+ content: h.content,
137
+ categoryCount: h.categoryCount,
138
+ }));
139
+
140
+ // ensure that maxChoicesPerCategory is reset if author switch back the corresponding switch (allowMaxChoicesPerCategory)
141
+ updatedModel.maxChoicesPerCategory = updatedModel.allowMaxChoicesPerCategory
142
+ ? updatedModel.maxChoicesPerCategory
143
+ : 0;
144
+
145
+ onChange(updatedModel);
146
+ };
147
+
148
+ changeRationale: any = (rationale) => {
149
+ const { model, onChange } = this.props;
150
+
151
+ onChange({
152
+ ...model,
153
+ rationale,
154
+ });
155
+ };
156
+
157
+ changeTeacherInstructions: any = (teacherInstructions) => {
158
+ const { model, onChange } = this.props;
159
+
160
+ onChange({
161
+ ...model,
162
+ teacherInstructions,
163
+ });
164
+ };
165
+
166
+ changeFeedback: any = (feedback) => {
167
+ this.updateModel({ feedback });
168
+ };
169
+
170
+ onAddAlternateResponse: any = () => {
171
+ const {
172
+ model: { correctResponse },
173
+ } = this.props;
174
+
175
+ this.updateModel({
176
+ correctResponse: (correctResponse || []).map((cr) => ({
177
+ ...cr,
178
+ alternateResponses: [...(cr.alternateResponses || []), []],
179
+ })),
180
+ });
181
+ };
182
+
183
+ onPromptChanged = (prompt) => this.updateModel({ prompt });
184
+
185
+ onRemoveAlternateResponse: any = (index) => {
186
+ const {
187
+ model: { correctResponse },
188
+ } = this.props;
189
+
190
+ this.updateModel({
191
+ correctResponse: (correctResponse || []).map((cr) => ({
192
+ ...cr,
193
+ alternateResponses: (cr.alternateResponses || []).filter((alt, altIndex) => altIndex !== index),
194
+ })),
195
+ });
196
+ };
197
+
198
+ countChoiceInCorrectResponse: any = (choice) => {
199
+ const { model } = this.props;
200
+
201
+ return countInAnswer(choice.id, model.correctResponse);
202
+ };
203
+
204
+ checkAllowMultiplePlacements: any = (allowMultiplePlacements, c) => {
205
+ if (allowMultiplePlacements === multiplePlacements.enabled) {
206
+ return 0;
207
+ }
208
+
209
+ if (allowMultiplePlacements === multiplePlacements.disabled) {
210
+ return 1;
211
+ }
212
+
213
+ return c.categoryCount || 0;
214
+ };
215
+
216
+ isAlertModalOpened: any = () => {
217
+ const { model } = this.props;
218
+ const { maxChoicesPerCategory = 0 } = model || {};
219
+ const maxChoices = getMaxCategoryChoices(model);
220
+ // when maxChoicesPerCategory is set to 0, there is no limit so modal should not be opened
221
+ return maxChoicesPerCategory !== 0 ? maxChoices > maxChoicesPerCategory : false;
222
+ };
223
+
224
+ onAlertModalCancel: any = () => {
225
+ const { model } = this.props;
226
+ const maxChoices = getMaxCategoryChoices(model);
227
+ this.updateModel({ maxChoicesPerCategory: maxChoices });
228
+ };
229
+
230
+ onDragStart: any = (event) => {
231
+ const { active } = event;
232
+ const draggedItem = active.data.current;
233
+
234
+ this.setState({
235
+ activeDragItem: draggedItem,
236
+ });
237
+ };
238
+
239
+ onDragEnd: any = ({ active, over }) => {
240
+ this.setState({ activeDragItem: null });
241
+ if (!active) return;
242
+
243
+ const { model } = this.props;
244
+ const { allowAlternateEnabled, categories = [], choices = [] } = model;
245
+
246
+ const activeData = active?.data?.current;
247
+ const overData = over?.data?.current;
248
+
249
+ if (!activeData) return;
250
+
251
+ const choiceIndex = activeData.choiceIndex || 0;
252
+ const overType = overData?.type;
253
+ const isPreview = activeData.type === 'choice-preview';
254
+ const isNewChoice = activeData.type === 'choice';
255
+
256
+ const choiceId =
257
+ activeData.choice?.id || (typeof activeData.id === 'string' ? activeData.id.split('-')[0] : activeData.id);
258
+
259
+ if (isPreview && (!overData || overType === 'choice')) {
260
+ this.removeChoiceFromSource(activeData, choiceIndex, { allowAlternateEnabled, categories, choices });
261
+ return;
262
+ }
263
+
264
+ if (isPreview && overType === 'category') {
265
+ return this.moveChoice(choiceId, activeData.categoryId, overData.id, choiceIndex);
266
+ }
267
+
268
+ if (isNewChoice && overType === 'category') {
269
+ return this.addChoiceToCategory({ id: activeData.id }, overData.id);
270
+ }
271
+
272
+ if (isPreview && overType === 'category-alternate') {
273
+ return this.moveChoiceInAlternate(
274
+ choiceId,
275
+ activeData.categoryId,
276
+ overData.id,
277
+ choiceIndex,
278
+ overData.alternateResponseIndex,
279
+ );
280
+ }
281
+
282
+ if (allowAlternateEnabled && isNewChoice && overType === 'category-alternate') {
283
+ return this.addChoiceToAlternateCategory({ id: activeData.id }, overData.id, overData.alternateResponseIndex);
284
+ }
285
+ };
286
+
287
+ removeChoiceFromSource: any = (activeData, choiceIndex, { allowAlternateEnabled, categories, choices }) => {
288
+ const isAlternateSource = activeData.alternateResponseIndex !== undefined;
289
+
290
+ if (!isAlternateSource) {
291
+ this.deleteChoiceFromCategory(activeData.categoryId, activeData.choiceId, choiceIndex);
292
+ return;
293
+ }
294
+
295
+ if (!allowAlternateEnabled) return;
296
+
297
+ const category = categories?.find((c) => c.id === activeData.categoryId);
298
+ const choice = choices?.find((c) => c.id === activeData.choiceId);
299
+
300
+ if (category && choice) {
301
+ this.deleteChoiceFromAlternateCategory(category, choice, choiceIndex, activeData.alternateResponseIndex);
302
+ }
303
+ };
304
+
305
+ addChoiceToCategory: any = (addedChoice, categoryId) => {
306
+ const { model } = this.props;
307
+ let { choices = [], correctResponse = [], maxChoicesPerCategory = 0 } = model || {};
308
+ const choice = (choices || []).find((choice) => choice.id === addedChoice.id);
309
+
310
+ let newCorrectResponse = moveChoiceToCategory(addedChoice.id, undefined, categoryId, 0, correctResponse);
311
+
312
+ if (choice.categoryCount !== 0) {
313
+ newCorrectResponse = verifyAllowMultiplePlacements(addedChoice, categoryId, newCorrectResponse);
314
+ }
315
+ const maxCategoryChoices = getMaxCategoryChoices(model);
316
+
317
+ this.updateModel({
318
+ correctResponse: newCorrectResponse,
319
+ maxChoicesPerCategory:
320
+ maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices
321
+ ? maxChoicesPerCategory + 1
322
+ : maxChoicesPerCategory,
323
+ });
324
+ };
325
+
326
+ deleteChoiceFromCategory: any = (categoryId, choiceId, choiceIndex) => {
327
+ const { model } = this.props;
328
+ const correctResponse = removeChoiceFromCategory(choiceId, categoryId, choiceIndex, model.correctResponse);
329
+
330
+ this.updateModel({ correctResponse });
331
+ };
332
+
333
+ moveChoice: any = (choiceId, from, to, choiceIndex) => {
334
+ const { model } = this.props;
335
+ let { choices, correctResponse = [], maxChoicesPerCategory = 0 } = model || {};
336
+ const choice = (choices || []).find((choice) => choice.id === choiceId);
337
+ if (to === from || !choice) {
338
+ return;
339
+ }
340
+ if (choice.categoryCount !== 0) {
341
+ correctResponse = moveChoiceToCategory(choice.id, from, to, choiceIndex, correctResponse);
342
+ correctResponse = verifyAllowMultiplePlacements(choice, to, correctResponse);
343
+ } else if (choice.categoryCount === 0) {
344
+ correctResponse = moveChoiceToCategory(choice.id, undefined, to, 0, correctResponse);
345
+ }
346
+ const maxCategoryChoices = getMaxCategoryChoices(model);
347
+ // when maxChoicesPerCategory is set to 0, there is no limit so it should not be updated
348
+ this.updateModel({
349
+ correctResponse,
350
+ maxChoicesPerCategory:
351
+ maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices
352
+ ? maxChoicesPerCategory + 1
353
+ : maxChoicesPerCategory,
354
+ });
355
+ };
356
+
357
+ // methods for alternate responses
358
+ addChoiceToAlternateCategory: any = (addedChoice, categoryId, altIndex) => {
359
+ const { model } = this.props;
360
+ const { correctResponse, choices, maxChoicesPerCategory = 0 } = model;
361
+
362
+ const choice = choices.find((c) => c.id === addedChoice.id);
363
+
364
+ correctResponse.forEach((a) => {
365
+ if (a.category === categoryId) {
366
+ a.alternateResponses = a.alternateResponses || [];
367
+
368
+ if (a.alternateResponses[altIndex] === undefined) {
369
+ a.alternateResponses[altIndex] = [];
370
+ }
371
+
372
+ a.alternateResponses[altIndex].push(addedChoice.id);
373
+ if (choice.categoryCount && choice.categoryCount !== 0) {
374
+ a.alternateResponses[altIndex] = a.alternateResponses[altIndex].reduce((acc, currentValue) => {
375
+ if (currentValue === choice.id) {
376
+ const foundIndex = acc.findIndex((c) => c === choice.id);
377
+ if (foundIndex === -1) {
378
+ acc.push(currentValue);
379
+ }
380
+ } else {
381
+ acc.push(currentValue);
382
+ }
383
+
384
+ return acc;
385
+ }, []);
386
+ }
387
+
388
+ return a;
389
+ } else {
390
+ if (a.alternateResponses[altIndex] && choice.categoryCount !== 0) {
391
+ a.alternateResponses[altIndex] = a.alternateResponses[altIndex].filter((c) => c !== addedChoice.id);
392
+ return a;
393
+ }
394
+ }
395
+
396
+ return a;
397
+ });
398
+
399
+ const maxCategoryChoices = getMaxCategoryChoices(model);
400
+ // when maxChoicesPerCategory is set to 0, there is no limit so it should not be updated
401
+ this.updateModel({
402
+ correctResponse,
403
+ maxChoicesPerCategory:
404
+ maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices
405
+ ? maxChoicesPerCategory + 1
406
+ : maxChoicesPerCategory,
407
+ });
408
+ };
409
+
410
+ moveChoiceInAlternate: any = (choiceId, from, to, choiceIndex, alternateIndex) => {
411
+ const { model } = this.props;
412
+ let { choices, correctResponse = [], maxChoicesPerCategory = 0 } = model || {};
413
+ const choice = (choices || []).find((choice) => choice.id === choiceId);
414
+ correctResponse = moveChoiceToAlternate(
415
+ choiceId,
416
+ from,
417
+ to,
418
+ choiceIndex,
419
+ correctResponse,
420
+ alternateIndex,
421
+ choice?.categoryCount,
422
+ );
423
+
424
+ const maxCategoryChoices = getMaxCategoryChoices(model);
425
+ // when maxChoicesPerCategory is set to 0, there is no limit so it should not be updated
426
+ this.updateModel({
427
+ correctResponse,
428
+ maxChoicesPerCategory:
429
+ maxChoicesPerCategory !== 0 && maxChoicesPerCategory < maxCategoryChoices
430
+ ? maxChoicesPerCategory + 1
431
+ : maxChoicesPerCategory,
432
+ });
433
+ };
434
+
435
+ deleteChoiceFromAlternateCategory: any = (category, choice, choiceIndex, altIndex) => {
436
+ const { model } = this.props;
437
+
438
+ const correctResponse = removeChoiceFromAlternate(
439
+ choice.id,
440
+ category.id,
441
+ choiceIndex,
442
+ altIndex,
443
+ model.correctResponse,
444
+ );
445
+
446
+ this.updateModel({ correctResponse });
447
+ };
448
+
449
+ renderDragOverlay: any = () => {
450
+ const { activeDragItem } = this.state;
451
+ const { model, configuration } = this.props;
452
+
453
+ if (!activeDragItem) return null;
454
+
455
+ if (activeDragItem.type === 'choice') {
456
+ const choice = model.choices?.find((c) => c.id === activeDragItem.id);
457
+ if (!choice) return null;
458
+
459
+ return <Choice choice={choice} configuration={configuration} />;
460
+ } else if (activeDragItem.type === 'choice-preview' && activeDragItem.alternateResponseIndex === undefined) {
461
+ const choice = model.choices?.find((c) => c.id === activeDragItem.id);
462
+ if (!choice) return null;
463
+ return <ChoicePreview choice={choice} />;
464
+ } else if (activeDragItem.type === 'choice-preview' && activeDragItem.alternateResponseIndex !== undefined) {
465
+ const choice = model.choices?.find((c) => c.id === activeDragItem.id);
466
+ if (!choice) return null;
467
+ return <ChoicePreview choice={choice} alternateResponseIndex={activeDragItem.alternateResponseIndex} />;
468
+ }
469
+
470
+ return null;
471
+ };
472
+
473
+ render() {
474
+ const { configuration, imageSupport, model, uploadSoundSupport, onConfigurationChanged } = this.props;
475
+ const {
476
+ allowAlternate = {},
477
+ allowMultiplePlacements = {},
478
+ baseInputConfiguration = {},
479
+ categoriesPerRow = {},
480
+ choicesPosition = {},
481
+ contentDimensions = {},
482
+ feedback = {},
483
+ lockChoiceOrder = {},
484
+ maxImageHeight = {},
485
+ maxImageWidth = {},
486
+ maxPlacements = {},
487
+ minCategoriesPerRow = 1,
488
+ partialScoring = {},
489
+ prompt = {},
490
+ rationale = {},
491
+ scoringType = {},
492
+ settingsPanelDisabled,
493
+ spellCheck = {},
494
+ studentInstructions = {},
495
+ teacherInstructions = {},
496
+ withRubric = {},
497
+ mathMlOptions = {},
498
+ language = {},
499
+ languageChoices = {},
500
+ allowMaxAnswerChoices = {},
501
+ } = configuration || {};
502
+ const {
503
+ allowAlternateEnabled,
504
+ allowMaxChoicesPerCategory,
505
+ errors,
506
+ feedbackEnabled,
507
+ maxChoicesPerCategory,
508
+ promptEnabled,
509
+ rationaleEnabled,
510
+ spellCheckEnabled,
511
+ teacherInstructionsEnabled,
512
+ toolbarEditorPosition,
513
+ extraCSSRules,
514
+ } = model || {};
515
+ const {
516
+ prompt: promptError,
517
+ rationale: rationaleError,
518
+ teacherInstructions: teacherInstructionsError,
519
+ } = errors || {};
520
+
521
+ const toolbarOpts = {
522
+ position: toolbarEditorPosition === 'top' ? 'top' : 'bottom',
523
+ };
524
+
525
+ const config = model.config || {};
526
+ config.choices = config.choices || { label: '', columns: 2 };
527
+
528
+ const categories = buildCategories(model.categories || [], model.choices || [], model.correctResponse || []);
529
+
530
+ const alternateResponses = buildAlternateResponses(
531
+ model.categories || [],
532
+ model.choices || [],
533
+ model.correctResponse || [],
534
+ );
535
+
536
+ const choices = model.choices.map((c) => {
537
+ c.correctResponseCount = this.countChoiceInCorrectResponse(c);
538
+ // ensure categoryCount is set even though updatedModel hasn't been called
539
+ c.categoryCount = this.checkAllowMultiplePlacements(model.allowMultiplePlacementsEnabled, c);
540
+ return c;
541
+ });
542
+
543
+ const defaultImageMaxWidth = maxImageWidth && maxImageWidth.prompt;
544
+ const defaultImageMaxHeight = maxImageHeight && maxImageHeight.prompt;
545
+
546
+ const panelSettings = {
547
+ partialScoring: partialScoring.settings && toggle(partialScoring.label),
548
+ lockChoiceOrder: lockChoiceOrder.settings && toggle(lockChoiceOrder.label),
549
+ categoriesPerRow:
550
+ categoriesPerRow.settings &&
551
+ numberField(categoriesPerRow.label, {
552
+ label: categoriesPerRow.label,
553
+ min: minCategoriesPerRow,
554
+ max: 6,
555
+ }),
556
+ choicesPosition: choicesPosition.settings && radio(choicesPosition.label, ['below', 'above', 'left', 'right']),
557
+ allowMultiplePlacementsEnabled:
558
+ allowMultiplePlacements.settings &&
559
+ dropdown(allowMultiplePlacements.label, [
560
+ multiplePlacements.enabled,
561
+ multiplePlacements.disabled,
562
+ multiplePlacements.perChoice,
563
+ ]),
564
+ maxAnswerChoices:
565
+ allowMaxAnswerChoices.settings &&
566
+ numberField(allowMaxAnswerChoices.label, {
567
+ label: '',
568
+ min: choices?.length || 0,
569
+ max: 30,
570
+ }),
571
+ allowMaxChoicesPerCategory: maxPlacements.settings && toggle(maxPlacements.label),
572
+ maxChoicesPerCategory:
573
+ allowMaxChoicesPerCategory === true &&
574
+ numberField(maxPlacements.label, {
575
+ label: '',
576
+ min: 0,
577
+ max: 30,
578
+ }),
579
+ promptEnabled: prompt.settings && toggle(prompt.label),
580
+ feedbackEnabled: feedback.settings && toggle(feedback.label),
581
+ allowAlternateEnabled: allowAlternate.settings && toggle(allowAlternate.label),
582
+ 'language.enabled': language.settings && toggle(language.label, true),
583
+ language: language.settings && language.enabled && dropdown(languageChoices.label, languageChoices.options),
584
+ };
585
+
586
+ const panelProperties = {
587
+ teacherInstructionsEnabled: teacherInstructions.settings && toggle(teacherInstructions.label),
588
+ studentInstructionsEnabled: studentInstructions.settings && toggle(studentInstructions.label),
589
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
590
+ spellCheckEnabled: spellCheck.settings && toggle(spellCheck.label),
591
+ scoringType: scoringType.settings && radio(scoringType.label, ['auto', 'rubric']),
592
+ rubricEnabled: withRubric?.settings && toggle(withRubric?.label),
593
+ };
594
+
595
+ const isOpened = this.isAlertModalOpened();
596
+ const alertMaxChoicesMsg = translator.t('translation:categorize:maxChoicesPerCategoryRestriction', {
597
+ lng: model.language,
598
+ maxChoicesPerCategory,
599
+ });
600
+
601
+ return (
602
+ <DragProvider onDragStart={this.onDragStart} onDragEnd={this.onDragEnd}>
603
+ <IdProvider value={this.uid}>
604
+ <layout.ConfigLayout
605
+ extraCSSRules={extraCSSRules}
606
+ dimensions={contentDimensions}
607
+ hideSettings={settingsPanelDisabled}
608
+ settings={
609
+ <Panel
610
+ model={model}
611
+ onChangeModel={this.updateModel}
612
+ configuration={configuration}
613
+ onChangeConfiguration={onConfigurationChanged}
614
+ groups={{
615
+ Settings: panelSettings,
616
+ Properties: panelProperties,
617
+ }}
618
+ modal={
619
+ <AlertDialog
620
+ title={'Warning'}
621
+ text={alertMaxChoicesMsg}
622
+ open={isOpened}
623
+ onClose={this.onAlertModalCancel}
624
+ />
625
+ }
626
+ />
627
+ }
628
+ >
629
+ {teacherInstructionsEnabled && (
630
+ <StyledInputContainer label={teacherInstructions.label}>
631
+ <EditableHtml
632
+ markup={model.teacherInstructions || ''}
633
+ onChange={this.changeTeacherInstructions}
634
+ imageSupport={imageSupport}
635
+ error={teacherInstructionsError}
636
+ nonEmpty={false}
637
+ toolbarOpts={toolbarOpts}
638
+ pluginProps={getPluginProps(teacherInstructions?.inputConfiguration, baseInputConfiguration)}
639
+ spellCheck={spellCheckEnabled}
640
+ maxImageWidth={(maxImageWidth && maxImageWidth.teacherInstructions) || defaultImageMaxWidth}
641
+ maxImageHeight={(maxImageHeight && maxImageHeight.teacherInstructions) || defaultImageMaxHeight}
642
+ uploadSoundSupport={uploadSoundSupport}
643
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
644
+ mathMlOptions={mathMlOptions}
645
+ />
646
+ {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}
647
+ </StyledInputContainer>
648
+ )}
649
+
650
+ {promptEnabled && (
651
+ <StyledInputContainer label={prompt.label}>
652
+ <EditableHtml
653
+ markup={model.prompt || ''}
654
+ onChange={this.onPromptChanged}
655
+ imageSupport={imageSupport}
656
+ error={promptError}
657
+ nonEmpty={false}
658
+ disableUnderline
659
+ toolbarOpts={toolbarOpts}
660
+ pluginProps={getPluginProps(prompt?.inputConfiguration, baseInputConfiguration)}
661
+ spellCheck={spellCheckEnabled}
662
+ maxImageWidth={maxImageWidth && maxImageWidth.prompt}
663
+ maxImageHeight={maxImageHeight && maxImageHeight.prompt}
664
+ uploadSoundSupport={uploadSoundSupport}
665
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
666
+ mathMlOptions={mathMlOptions}
667
+ />
668
+ {promptError && <ErrorText>{promptError}</ErrorText>}
669
+ </StyledInputContainer>
670
+ )}
671
+
672
+ <Categories
673
+ imageSupport={imageSupport}
674
+ uploadSoundSupport={uploadSoundSupport}
675
+ model={model}
676
+ categories={categories || []}
677
+ onModelChanged={this.updateModel}
678
+ toolbarOpts={toolbarOpts}
679
+ spellCheck={spellCheckEnabled}
680
+ configuration={configuration}
681
+ defaultImageMaxWidth={defaultImageMaxWidth}
682
+ defaultImageMaxHeight={defaultImageMaxHeight}
683
+ mathMlOptions={mathMlOptions}
684
+ />
685
+
686
+ <Choices
687
+ imageSupport={imageSupport}
688
+ uploadSoundSupport={uploadSoundSupport}
689
+ choices={choices}
690
+ model={model}
691
+ onModelChanged={this.updateModel}
692
+ toolbarOpts={toolbarOpts}
693
+ spellCheck={spellCheckEnabled}
694
+ configuration={configuration}
695
+ defaultImageMaxWidth={defaultImageMaxWidth}
696
+ defaultImageMaxHeight={defaultImageMaxHeight}
697
+ />
698
+
699
+ {allowAlternateEnabled && (
700
+ <StyledHeader
701
+ label="Alternate Responses"
702
+ buttonLabel="ADD AN ALTERNATE RESPONSE"
703
+ onAdd={this.onAddAlternateResponse}
704
+ />
705
+ )}
706
+ {allowAlternateEnabled &&
707
+ alternateResponses.map((categoriesList, index) => {
708
+ return (
709
+ <React.Fragment key={index}>
710
+ <StyledHeader
711
+ variant={'subtitle1'}
712
+ label="Alternate Response"
713
+ buttonLabel="REMOVE ALTERNATE RESPONSE"
714
+ onAdd={() => this.onRemoveAlternateResponse(index)}
715
+ />
716
+ <AlternateResponses
717
+ altIndex={index}
718
+ imageSupport={imageSupport}
719
+ model={model}
720
+ configuration={configuration}
721
+ categories={categoriesList}
722
+ onModelChanged={this.updateModel}
723
+ uploadSoundSupport={uploadSoundSupport}
724
+ mathMlOptions={mathMlOptions}
725
+ />
726
+ </React.Fragment>
727
+ );
728
+ })}
729
+
730
+ {rationaleEnabled && (
731
+ <StyledInputContainer label={rationale.label}>
732
+ <EditableHtml
733
+ markup={model.rationale || ''}
734
+ onChange={this.changeRationale}
735
+ imageSupport={imageSupport}
736
+ error={rationaleError}
737
+ nonEmpty={false}
738
+ toolbarOpts={toolbarOpts}
739
+ pluginProps={getPluginProps(prompt?.inputConfiguration, baseInputConfiguration)}
740
+ spellCheck={spellCheckEnabled}
741
+ maxImageWidth={(maxImageWidth && maxImageWidth.rationale) || defaultImageMaxWidth}
742
+ maxImageHeight={(maxImageHeight && maxImageHeight.rationale) || defaultImageMaxHeight}
743
+ uploadSoundSupport={uploadSoundSupport}
744
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
745
+ mathMlOptions={mathMlOptions}
746
+ />
747
+ {rationaleError && <ErrorText>{rationaleError}</ErrorText>}
748
+ </StyledInputContainer>
749
+ )}
750
+
751
+ {feedbackEnabled && (
752
+ <FeedbackConfig feedback={model.feedback} onChange={this.changeFeedback} toolbarOpts={toolbarOpts} />
753
+ )}
754
+ </layout.ConfigLayout>
755
+ <DragOverlay>
756
+ <DragPreviewWrapper>{this.renderDragOverlay()}</DragPreviewWrapper>
757
+ </DragOverlay>
758
+ </IdProvider>
759
+ </DragProvider>
760
+ );
761
+ }
762
+ }
763
+
764
+ export default Design;