@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,109 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/configure/src/design/input-header.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 EditableHtml from '@pie-lib/editable-html-tip-tap';
16
+
17
+ const StyledEditableHtml: any = styled(EditableHtml)(({ theme }) => ({
18
+ flex: '1',
19
+ paddingBottom: theme.spacing(1),
20
+ maxWidth: '100%',
21
+ }));
22
+
23
+ const InputHeaderContainer: any = styled('div')({
24
+ display: 'flex',
25
+ justifyContent: 'space-between',
26
+ });
27
+
28
+ export class InputHeader extends React.Component {
29
+ static propTypes = {
30
+ configuration: PropTypes.object.isRequired,
31
+ deleteFocusedEl: PropTypes.func,
32
+ disabled: PropTypes.bool,
33
+ focusedEl: PropTypes.number,
34
+ index: PropTypes.number,
35
+ label: PropTypes.string,
36
+ maxImageWidth: PropTypes.object,
37
+ maxImageHeight: PropTypes.object,
38
+ onChange: PropTypes.func,
39
+ onDelete: PropTypes.func,
40
+ imageSupport: PropTypes.shape({
41
+ add: PropTypes.func.isRequired,
42
+ delete: PropTypes.func.isRequired,
43
+ }),
44
+ uploadSoundSupport: PropTypes.shape({
45
+ add: PropTypes.func.isRequired,
46
+ delete: PropTypes.func.isRequired,
47
+ }),
48
+ toolbarOpts: PropTypes.object,
49
+ error: PropTypes.string,
50
+ spellCheck: PropTypes.bool,
51
+ };
52
+
53
+ static defaultProps = {};
54
+
55
+ constructor(props) {
56
+ super(props);
57
+ }
58
+
59
+ render() {
60
+ const {
61
+ onChange,
62
+ configuration,
63
+ label,
64
+ deleteFocusedEl,
65
+ disabled,
66
+ imageSupport,
67
+ toolbarOpts,
68
+ spellCheck,
69
+ error,
70
+ maxImageWidth,
71
+ maxImageHeight,
72
+ uploadSoundSupport,
73
+ mathMlOptions = {},
74
+ focusedEl,
75
+ index,
76
+ } = this.props;
77
+
78
+ const { headers, baseInputConfiguration } = configuration;
79
+ const shouldAutoFocus = focusedEl !== null && focusedEl !== undefined && focusedEl === index;
80
+
81
+ return (
82
+ <InputHeaderContainer>
83
+ <StyledEditableHtml
84
+ imageSupport={imageSupport}
85
+ disabled={disabled}
86
+ autoFocus={shouldAutoFocus}
87
+ autoWidthToolbar
88
+ label={'label'}
89
+ markup={label}
90
+ onChange={onChange}
91
+ pluginProps={getPluginProps(headers?.inputConfiguration, baseInputConfiguration)}
92
+ toolbarOpts={toolbarOpts}
93
+ spellCheck={spellCheck}
94
+ error={error}
95
+ maxImageWidth={maxImageWidth}
96
+ maxImageHeight={maxImageHeight}
97
+ uploadSoundSupport={uploadSoundSupport}
98
+ languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
99
+ onDone={() => {
100
+ deleteFocusedEl && deleteFocusedEl();
101
+ }}
102
+ mathMlOptions={mathMlOptions}
103
+ />
104
+ </InputHeaderContainer>
105
+ );
106
+ }
107
+ }
108
+
109
+ export default InputHeader;
@@ -0,0 +1,14 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/configure/src/design/utils.js
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
+ export const getPluginProps = (props = {}, baseInputConfiguration = {}) => ({
12
+ ...baseInputConfiguration,
13
+ ...props,
14
+ });
@@ -0,0 +1,171 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/configure/src/index.js
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 React from 'react';
12
+ import { createRoot } from 'react-dom/client';
13
+ import {
14
+ ModelUpdatedEvent,
15
+ DeleteImageEvent,
16
+ InsertImageEvent,
17
+ InsertSoundEvent,
18
+ DeleteSoundEvent,
19
+ } from '@pie-element/shared-configure-events';
20
+ import { renderMath } from '@pie-element/shared-math-rendering-mathjax';
21
+
22
+ import Main from './main.js';
23
+
24
+ import defaults from './defaults.js';
25
+
26
+ export default class CategorizeConfigure extends HTMLElement {
27
+ static createDefaultModel = (model = {}) => ({
28
+ ...defaults.model,
29
+ ...model,
30
+ });
31
+
32
+ // PD-2960: make sure we don't have alternates in model or possibility to add them (temporary solution)
33
+ // this function is used in controller, too
34
+ static disableAlternateResponses = (m) => {
35
+ let { correctResponse } = m || {};
36
+ correctResponse = correctResponse || [];
37
+ const mappedCorrectResponse = correctResponse.map((cr) => {
38
+ const { alternateResponses, ...response } = cr;
39
+ return response;
40
+ });
41
+ return {
42
+ ...m,
43
+ correctResponse: mappedCorrectResponse,
44
+ allowAlternateEnabled: false,
45
+ };
46
+ };
47
+
48
+ constructor() {
49
+ super();
50
+ this._root = null;
51
+ this._model = CategorizeConfigure.createDefaultModel();
52
+ this._configuration = defaults.configuration;
53
+ }
54
+
55
+ set model(m) {
56
+ this._model = CategorizeConfigure.createDefaultModel(m);
57
+
58
+ if (m.choices && m.choices.length >= m.maxAnswerChoices) {
59
+ this._model.maxAnswerChoices = m.choices.length;
60
+ console.warn("Max Answer Choices can't be less than choices length!");
61
+ }
62
+
63
+ this.render();
64
+ }
65
+
66
+ set configuration(c) {
67
+ const newConfiguration = {
68
+ ...defaults.configuration,
69
+ ...c,
70
+ };
71
+
72
+ this._configuration = newConfiguration;
73
+
74
+ // if language:enabled is true, then the corresponding default item model should include a language value;
75
+ // if it is false, then the language field should be omitted from the item model.
76
+ // if a default item model includes a language value (e.g., en_US) and the corresponding authoring view settings have language:settings = true,
77
+ // then (a) language:enabled should also be true, and (b) that default language value should be represented in languageChoices[] (as a key).
78
+ if (newConfiguration?.language?.enabled) {
79
+ if (newConfiguration?.languageChoices?.options?.length) {
80
+ this._model.language = newConfiguration?.languageChoices.options[0].value;
81
+ }
82
+ } else if (newConfiguration.language.settings && this._model.language) {
83
+ this._configuration.language.enabled = true;
84
+
85
+ if (!this._configuration.languageChoices.options || !this._configuration.languageChoices.options.length) {
86
+ this._configuration.languageChoices.options = [];
87
+ }
88
+
89
+ // check if the language is already included in the languageChoices.options array
90
+ // and if not, then add it.
91
+ if (!this._configuration.languageChoices.options.find((option) => option.value === this._model.language)) {
92
+ this._configuration.languageChoices.options.push({
93
+ value: this._model.language,
94
+ label: this._model.language,
95
+ });
96
+ }
97
+ } else {
98
+ delete this._model.language;
99
+ }
100
+
101
+ this.render();
102
+ }
103
+
104
+ onModelChanged(m) {
105
+ this._model = m;
106
+
107
+ this.render();
108
+ this.dispatchEvent(new ModelUpdatedEvent(this._model, false));
109
+ }
110
+
111
+ onConfigurationChanged(c) {
112
+ this._configuration = c;
113
+ this.render();
114
+ }
115
+
116
+ connectedCallback() {
117
+ this.render();
118
+ }
119
+
120
+ /**
121
+ *
122
+ * @param {done, progress, file} handler
123
+ */
124
+ insertImage(handler) {
125
+ this.dispatchEvent(new InsertImageEvent(handler));
126
+ }
127
+
128
+ onDeleteImage(src, done) {
129
+ this.dispatchEvent(new DeleteImageEvent(src, done));
130
+ }
131
+
132
+ insertSound(handler) {
133
+ this.dispatchEvent(new InsertSoundEvent(handler));
134
+ }
135
+
136
+ onDeleteSound(src, done) {
137
+ this.dispatchEvent(new DeleteSoundEvent(src, done));
138
+ }
139
+
140
+ render() {
141
+ const el = React.createElement(Main, {
142
+ model: this._model,
143
+ configuration: this._configuration,
144
+ onModelChanged: this.onModelChanged.bind(this),
145
+ onConfigurationChanged: this.onConfigurationChanged.bind(this),
146
+ imageSupport: {
147
+ add: this.insertImage.bind(this),
148
+ delete: this.onDeleteImage.bind(this),
149
+ },
150
+ uploadSoundSupport: {
151
+ add: this.insertSound.bind(this),
152
+ delete: this.onDeleteSound.bind(this),
153
+ },
154
+ });
155
+
156
+ if (!this._root) {
157
+ this._root = createRoot(this);
158
+ }
159
+ this._root.render(el);
160
+
161
+ setTimeout(() => {
162
+ renderMath(this);
163
+ }, 0);
164
+ }
165
+
166
+ disconnectedCallback() {
167
+ if (this._root) {
168
+ this._root.unmount();
169
+ }
170
+ }
171
+ }
@@ -0,0 +1,45 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/configure/src/main.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 React from 'react';
12
+ import PropTypes from 'prop-types';
13
+ import Design from './design/index.js';
14
+
15
+ export class Main extends React.Component {
16
+ static propTypes = {
17
+ configuration: PropTypes.object,
18
+ onConfigurationChanged: PropTypes.func,
19
+ model: PropTypes.object.isRequired,
20
+ onModelChanged: PropTypes.func.isRequired,
21
+ imageSupport: PropTypes.object,
22
+ uploadSoundSupport: PropTypes.object,
23
+ };
24
+
25
+ static defaultProps = {};
26
+
27
+ render() {
28
+ const { model, onModelChanged, configuration, onConfigurationChanged, imageSupport, uploadSoundSupport } =
29
+ this.props;
30
+
31
+ return (
32
+ <Design
33
+ imageSupport={imageSupport}
34
+ uploadSoundSupport={uploadSoundSupport}
35
+ title="Design"
36
+ model={model}
37
+ configuration={configuration}
38
+ onChange={onModelChanged}
39
+ onConfigurationChanged={onConfigurationChanged}
40
+ />
41
+ );
42
+ }
43
+ }
44
+
45
+ export default Main;
@@ -0,0 +1,46 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/configure/src/utils.js
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
+ export const generateValidationMessage = (config) => {
12
+ let { minChoices, maxChoices, maxCategories } = config || {};
13
+ minChoices = minChoices || 1;
14
+
15
+ const validationMessage =
16
+ '\nThe choices content should ' +
17
+ 'not be empty and should be unique.\nThere should be at least 1 ' +
18
+ (maxCategories ? `and at most ${maxCategories} ` : '') +
19
+ 'category' +
20
+ (maxCategories ? 's' : '') +
21
+ ' defined.' +
22
+ (minChoices ? `\nThere should be at least ${minChoices} choices defined.` : '') +
23
+ (maxChoices ? `\nNo more than ${maxChoices} choices should be defined.` : '') +
24
+ '\nAt least one token should be assigned to at least one category.';
25
+
26
+ return 'Validation requirements:' + validationMessage;
27
+ };
28
+
29
+ // used in controller too, for consistency modify it there too
30
+ export const multiplePlacements = { enabled: 'Yes', disabled: 'No', perChoice: 'Set Per Choice' };
31
+
32
+ // Find the length of the largest array from an array
33
+ export const maxLength = (array) =>
34
+ (array || []).reduce((max, arr) => {
35
+ return Math.max(max, arr.length);
36
+ }, 0);
37
+
38
+ export const getMaxCategoryChoices = (model) => {
39
+ const { correctResponse = [] } = model || {};
40
+ return correctResponse.reduce((max, correctRes) => {
41
+ const correctRespLength = correctRes?.choices?.length || 0;
42
+ const alternates = correctRes?.alternateResponses || [];
43
+ const maxChoices = Math.max(correctRespLength, maxLength(alternates));
44
+ return maxChoices > max ? maxChoices : max;
45
+ }, 0);
46
+ };
@@ -0,0 +1,37 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/controller/src/defaults.js
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 { multiplePlacements } from './utils.js';
12
+
13
+ export default {
14
+ allowMultiplePlacementsEnabled: multiplePlacements.enabled,
15
+ alternates: [],
16
+ categories: [],
17
+ categoriesPerRow: 2,
18
+ choices: [],
19
+ choicesLabel: '',
20
+ choicesPosition: 'below',
21
+ correctResponse: [],
22
+ feedbackEnabled: false,
23
+ lockChoiceOrder: true,
24
+ maxAnswerChoices: 6,
25
+ maxChoicesPerCategory: 0,
26
+ partialScoring: true,
27
+ prompt: '',
28
+ promptEnabled: true,
29
+ rationale: '',
30
+ rationaleEnabled: true,
31
+ rowLabels: [''],
32
+ studentInstructionsEnabled: true,
33
+ teacherInstructions: '',
34
+ teacherInstructionsEnabled: true,
35
+ toolbarEditorPosition: 'bottom',
36
+ minRowHeight: '80px',
37
+ };