@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,78 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/src/categorize/category.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 { styled } from '@mui/material/styles';
14
+
15
+ import Choice from './choice.js';
16
+ import PlaceHolder from './droppable-placeholder.js';
17
+
18
+ export const CategoryType = {
19
+ id: PropTypes.string.isRequired,
20
+ categoryId: PropTypes.string,
21
+ };
22
+
23
+ export class Category extends React.Component {
24
+ static propTypes = {
25
+ ...CategoryType,
26
+ className: PropTypes.string,
27
+ disabled: PropTypes.bool,
28
+ onDropChoice: PropTypes.func,
29
+ onRemoveChoice: PropTypes.func,
30
+ minRowHeight: PropTypes.string,
31
+ };
32
+
33
+ static defaultProps = {};
34
+
35
+ render() {
36
+ const {
37
+ className,
38
+ choices = [],
39
+ disabled,
40
+ onDropChoice,
41
+ onRemoveChoice,
42
+ id,
43
+ correct,
44
+ minRowHeight,
45
+ } = this.props;
46
+
47
+ return (
48
+ <StyledDiv className={className} id={id}>
49
+ <PlaceHolder
50
+ id={id}
51
+ onDropChoice={onDropChoice}
52
+ disabled={disabled}
53
+ correct={correct}
54
+ minRowHeight={minRowHeight}
55
+ >
56
+ {choices.map((c, index) => (
57
+ <Choice
58
+ onRemoveChoice={onRemoveChoice}
59
+ disabled={disabled}
60
+ key={index}
61
+ choiceIndex={index}
62
+ categoryId={id}
63
+ {...c}
64
+ />
65
+ ))}
66
+ </PlaceHolder>
67
+ </StyledDiv>
68
+ );
69
+ }
70
+ }
71
+
72
+ const StyledDiv: any = styled('div')(({ theme }) => ({
73
+ display: 'flex',
74
+ flexDirection: 'column',
75
+ flex: 2,
76
+ }));
77
+
78
+ export default Category;
@@ -0,0 +1,117 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/src/categorize/choice.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 debug from 'debug';
14
+ import { styled } from '@mui/material/styles';
15
+ import { useDraggable } from '@dnd-kit/core';
16
+ import { uid } from '@pie-lib/drag';
17
+ import Card from '@mui/material/Card';
18
+ import CardContent from '@mui/material/CardContent';
19
+ import { color } from '@pie-lib/render-ui';
20
+
21
+ const log = debug('@pie-ui:categorize:choice');
22
+
23
+ export const ChoiceType = {
24
+ content: PropTypes.string.isRequired,
25
+ id: PropTypes.string,
26
+ };
27
+
28
+ const ChoiceContainer: any = styled('div', {
29
+ shouldForwardProp: (prop) => !['isDragging', 'disabled', 'correct'].includes(prop),
30
+ })(({ isDragging, disabled, correct }) => ({
31
+ direction: 'initial',
32
+ cursor: disabled ? 'not-allowed' : isDragging ? 'move' : 'pointer',
33
+ width: '100%',
34
+ borderRadius: '6px',
35
+ ...(correct === true && {
36
+ border: `solid 2px ${color.correct()}`,
37
+ }),
38
+ ...(correct === false && {
39
+ border: `solid 2px ${color.incorrect()}`,
40
+ }),
41
+ }));
42
+
43
+ const StyledCard: any = styled(Card)({
44
+ color: color.text(),
45
+ backgroundColor: color.background(),
46
+ width: '100%',
47
+ });
48
+
49
+ const StyledCardContent: any = styled(CardContent)(({ theme }) => ({
50
+ color: color.text(),
51
+ backgroundColor: color.white(),
52
+ '&:last-child': {
53
+ paddingBottom: theme.spacing(2),
54
+ },
55
+ borderRadius: '4px',
56
+ border: '1px solid',
57
+ '& p': {
58
+ margin: '0px',
59
+ },
60
+ }));
61
+
62
+ export class Layout extends React.Component {
63
+ static propTypes = {
64
+ ...ChoiceType,
65
+ disabled: PropTypes.bool,
66
+ correct: PropTypes.bool,
67
+ isDragging: PropTypes.bool,
68
+ };
69
+ static defaultProps = {};
70
+ render() {
71
+ const { content, isDragging, disabled, correct } = this.props;
72
+
73
+ return (
74
+ <ChoiceContainer isDragging={isDragging} disabled={disabled} correct={correct}>
75
+ <StyledCard>
76
+ <StyledCardContent dangerouslySetInnerHTML={{ __html: content }} />
77
+ </StyledCard>
78
+ </ChoiceContainer>
79
+ );
80
+ }
81
+ }
82
+
83
+ const DraggableChoice = ({ id, content, disabled, correct, extraStyle, categoryId, choiceIndex }) => {
84
+ // Generate unique draggable ID for each instance
85
+ // If in choices board (categoryId is undefined), use 'board' suffix
86
+ // If in a category, include categoryId and choiceIndex to make it unique
87
+ const draggableId = categoryId !== undefined ? `choice-${id}-${categoryId}-${choiceIndex}` : `choice-${id}-board`;
88
+
89
+ const { attributes, listeners, setNodeRef, isDragging } = useDraggable({
90
+ id: draggableId,
91
+ data: {
92
+ id,
93
+ categoryId,
94
+ choiceIndex,
95
+ value: content,
96
+ itemType: 'categorize',
97
+ type: 'choice',
98
+ },
99
+ disabled,
100
+ });
101
+
102
+ return (
103
+ <div ref={setNodeRef} style={{ margin: '4px', ...extraStyle }} {...listeners} {...attributes}>
104
+ <Layout id={id} content={content} disabled={disabled} correct={correct} isDragging={isDragging} />
105
+ </div>
106
+ );
107
+ };
108
+
109
+ DraggableChoice.propTypes = {
110
+ ...ChoiceType,
111
+ extraStyle: PropTypes.object,
112
+ categoryId: PropTypes.string,
113
+ choiceIndex: PropTypes.number,
114
+ onRemoveChoice: PropTypes.func,
115
+ };
116
+
117
+ export default uid.withUid(DraggableChoice);
@@ -0,0 +1,95 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/src/categorize/choices.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 { styled } from '@mui/material/styles';
14
+ import Choice, { ChoiceType } from './choice.js';
15
+ import DroppablePlaceholder from './droppable-placeholder.js';
16
+ export { ChoiceType };
17
+
18
+ const Wrapper: any = styled('div')({
19
+ flex: 1,
20
+ touchAction: 'none',
21
+ });
22
+
23
+ const LabelHolder: any = styled('div')(({ theme }) => ({
24
+ margin: '0 auto',
25
+ textAlign: 'center',
26
+ paddingTop: theme.spacing(1),
27
+ }));
28
+
29
+ export class Choices extends React.Component {
30
+ static propTypes = {
31
+ choices: PropTypes.arrayOf(
32
+ PropTypes.oneOfType([PropTypes.shape(ChoiceType), PropTypes.shape({ empty: PropTypes.bool })]),
33
+ ),
34
+ model: PropTypes.shape({
35
+ categoriesPerRow: PropTypes.number,
36
+ choicesLabel: PropTypes.string,
37
+ }),
38
+ disabled: PropTypes.bool,
39
+ choicePosition: PropTypes.string,
40
+ onDropChoice: PropTypes.func,
41
+ onRemoveChoice: PropTypes.func,
42
+ correct: PropTypes.boolean,
43
+ };
44
+
45
+ static defaultProps = {
46
+ model: {
47
+ categoriesPerRow: 1,
48
+ choicesLabel: '',
49
+ },
50
+ };
51
+
52
+ render() {
53
+ const { choices = [], model, disabled, onDropChoice, onRemoveChoice, choicePosition, correct } = this.props;
54
+
55
+ let style = {
56
+ textAlign: 'center',
57
+ };
58
+
59
+ if (choicePosition === 'left') {
60
+ style.direction = 'rtl';
61
+ }
62
+
63
+ return (
64
+ <Wrapper>
65
+ <DroppablePlaceholder
66
+ id="choices-board"
67
+ onDropChoice={onDropChoice}
68
+ onRemoveChoice={onRemoveChoice}
69
+ disabled={disabled}
70
+ style={{ background: 'none' }}
71
+ choiceBoard={true}
72
+ correct={correct}
73
+ >
74
+ {model.choicesLabel && model.choicesLabel !== '' && (
75
+ <LabelHolder dangerouslySetInnerHTML={{ __html: model.choicesLabel }} />
76
+ )}
77
+ {choices.map((c, index) => {
78
+ return c.empty ? (
79
+ <div key={index} />
80
+ ) : (
81
+ <Choice
82
+ disabled={disabled}
83
+ key={index}
84
+ extraStyle={{ maxWidth: `${95 / model.categoriesPerRow}%` }}
85
+ {...c}
86
+ />
87
+ );
88
+ })}
89
+ </DroppablePlaceholder>
90
+ </Wrapper>
91
+ );
92
+ }
93
+ }
94
+
95
+ export default Choices;
@@ -0,0 +1,95 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/src/categorize/droppable-placeholder.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 debug from 'debug';
14
+ import { useTheme } from '@mui/material/styles';
15
+ import { useDroppable } from '@dnd-kit/core';
16
+ import { PlaceHolder } from '@pie-lib/drag';
17
+ import { color } from '@pie-lib/render-ui';
18
+
19
+ const log = debug('@pie-ui:categorize:droppable-placeholder');
20
+
21
+ const DroppablePlaceholder = ({
22
+ children,
23
+ grid,
24
+ disabled,
25
+ choiceBoard,
26
+ minRowHeight,
27
+ id,
28
+ correct
29
+ }) => {
30
+ const theme = useTheme();
31
+ const { setNodeRef, isOver } = useDroppable({
32
+ id,
33
+ data: {
34
+ itemType: 'categorize',
35
+ categoryId: id
36
+ },
37
+ disabled,
38
+ });
39
+
40
+ const extraStyles = {
41
+ padding: theme.spacing(0.5),
42
+ borderRadius: theme.spacing(0.5),
43
+ gridColumnGap: 0,
44
+ gridRowGap: 0,
45
+ display: 'flex',
46
+ flexWrap: 'wrap',
47
+ justifyContent: 'center',
48
+ alignItems: 'center',
49
+ alignContent: 'flex-start',
50
+ width: '100%',
51
+ height: '100%',
52
+ ...(correct === false && !choiceBoard && {
53
+ border: `solid 2px ${color.incorrect()}`,
54
+ }),
55
+ ...(correct === true && !choiceBoard && {
56
+ border: `solid 2px ${color.correct()}`,
57
+ }),
58
+ };
59
+
60
+ return (
61
+ <div
62
+ ref={setNodeRef}
63
+ style={{
64
+ flex: 1,
65
+ minHeight: minRowHeight || '80px',
66
+ position: 'relative',
67
+ touchAction: 'none',
68
+ }}
69
+ >
70
+ <PlaceHolder
71
+ isOver={isOver}
72
+ grid={grid}
73
+ disabled={disabled}
74
+ choiceBoard={choiceBoard}
75
+ isCategorize
76
+ extraStyles={extraStyles}
77
+ >
78
+ {children}
79
+ </PlaceHolder>
80
+ </div>
81
+ );
82
+ };
83
+
84
+ DroppablePlaceholder.propTypes = {
85
+ choiceBoard: PropTypes.bool,
86
+ children: PropTypes.node.isRequired,
87
+ grid: PropTypes.object,
88
+ disabled: PropTypes.bool,
89
+ minRowHeight: PropTypes.string,
90
+ onDropChoice: PropTypes.func,
91
+ id: PropTypes.string.isRequired,
92
+ correct: PropTypes.bool
93
+ };
94
+
95
+ export default DroppablePlaceholder;
@@ -0,0 +1,53 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/categorize/src/categorize/grid-content.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 { styled } from '@mui/material/styles';
14
+
15
+ export class GridContent extends React.Component {
16
+ static propTypes = {
17
+ className: PropTypes.string,
18
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
19
+ columns: PropTypes.number,
20
+ rows: PropTypes.number,
21
+ extraStyle: PropTypes.object,
22
+ };
23
+ static defaultProps = {
24
+ columns: 2,
25
+ rows: 2,
26
+ };
27
+
28
+ render() {
29
+ const { className, children, columns, extraStyle, rows } = this.props;
30
+ const style = {
31
+ gridTemplateColumns: `repeat(${columns}, 1fr)`,
32
+ gridTemplateRows: rows === 2 ? 'auto 1fr' : `repeat(${rows}, auto)`,
33
+ ...extraStyle,
34
+ };
35
+
36
+ return (
37
+ <StyledDiv style={style} className={className}>
38
+ {children}
39
+ </StyledDiv>
40
+ );
41
+ }
42
+ }
43
+
44
+ const StyledDiv: any = styled('div')(({ theme }) => ({
45
+ display: 'grid',
46
+ columnGap: theme.spacing(1),
47
+ gridColumnGap: theme.spacing(1),
48
+ rowGap: theme.spacing(1),
49
+ gridRowGap: theme.spacing(1),
50
+ gridAutoRows: '1fr',
51
+ }));
52
+
53
+ export default GridContent;