@pie-element/multi-trait-rubric 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 (188) hide show
  1. package/dist/author/common.d.ts +91 -0
  2. package/dist/author/common.d.ts.map +1 -0
  3. package/dist/author/common.js +275 -0
  4. package/dist/author/defaults.d.ts +154 -0
  5. package/dist/author/defaults.d.ts.map +1 -0
  6. package/dist/author/defaults.js +113 -0
  7. package/dist/author/index.d.ts +23 -0
  8. package/dist/author/index.d.ts.map +1 -0
  9. package/dist/author/index.js +89 -0
  10. package/dist/author/main.d.ts +44 -0
  11. package/dist/author/main.d.ts.map +1 -0
  12. package/dist/author/main.js +249 -0
  13. package/dist/author/modals.d.ts +95 -0
  14. package/dist/author/modals.d.ts.map +1 -0
  15. package/dist/author/modals.js +171 -0
  16. package/dist/author/scale.d.ts +47 -0
  17. package/dist/author/scale.d.ts.map +1 -0
  18. package/dist/author/scale.js +280 -0
  19. package/dist/author/trait.d.ts +71 -0
  20. package/dist/author/trait.d.ts.map +1 -0
  21. package/dist/author/trait.js +202 -0
  22. package/dist/author/traitsHeader.d.ts +29 -0
  23. package/dist/author/traitsHeader.d.ts.map +1 -0
  24. package/dist/author/traitsHeader.js +172 -0
  25. package/dist/author/utils.d.ts +11 -0
  26. package/dist/author/utils.d.ts.map +1 -0
  27. package/dist/author/utils.js +41 -0
  28. package/dist/controller/defaults.d.ts +21 -0
  29. package/dist/controller/defaults.d.ts.map +1 -0
  30. package/dist/controller/defaults.js +14 -0
  31. package/dist/controller/index.d.ts +27 -0
  32. package/dist/controller/index.d.ts.map +1 -0
  33. package/dist/controller/index.js +57 -0
  34. package/dist/controller/utils.d.ts +10 -0
  35. package/dist/controller/utils.d.ts.map +1 -0
  36. package/dist/controller/utils.js +4 -0
  37. package/dist/delivery/index.d.ts +18 -0
  38. package/dist/delivery/index.d.ts.map +1 -0
  39. package/dist/delivery/index.js +37 -0
  40. package/dist/delivery/main.d.ts +16 -0
  41. package/dist/delivery/main.d.ts.map +1 -0
  42. package/dist/delivery/main.js +95 -0
  43. package/dist/delivery/scale.d.ts +18 -0
  44. package/dist/delivery/scale.d.ts.map +1 -0
  45. package/dist/delivery/scale.js +175 -0
  46. package/dist/delivery/trait.d.ts +28 -0
  47. package/dist/delivery/trait.d.ts.map +1 -0
  48. package/dist/delivery/trait.js +44 -0
  49. package/dist/index.d.ts +2 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.iife.d.ts +9 -0
  52. package/dist/index.iife.d.ts.map +1 -0
  53. package/dist/index.iife.js +145 -0
  54. package/dist/index.js +2 -0
  55. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_DataView.js +6 -0
  56. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Hash.js +16 -0
  57. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_ListCache.js +16 -0
  58. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Map.js +6 -0
  59. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_MapCache.js +16 -0
  60. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Promise.js +6 -0
  61. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Set.js +6 -0
  62. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Stack.js +13 -0
  63. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Symbol.js +5 -0
  64. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_Uint8Array.js +5 -0
  65. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_WeakMap.js +6 -0
  66. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayEach.js +7 -0
  67. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayFilter.js +10 -0
  68. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayLikeKeys.js +15 -0
  69. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_arrayPush.js +7 -0
  70. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assignValue.js +10 -0
  71. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_assocIndexOf.js +8 -0
  72. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssign.js +8 -0
  73. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignIn.js +8 -0
  74. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseAssignValue.js +12 -0
  75. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseClone.js +57 -0
  76. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseCreate.js +14 -0
  77. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetAllKeys.js +9 -0
  78. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseGetTag.js +10 -0
  79. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsArguments.js +9 -0
  80. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsMap.js +9 -0
  81. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsNative.js +11 -0
  82. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsSet.js +9 -0
  83. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseIsTypedArray.js +11 -0
  84. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeys.js +12 -0
  85. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseKeysIn.js +13 -0
  86. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTimes.js +7 -0
  87. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseTrim.js +8 -0
  88. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_baseUnary.js +8 -0
  89. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneArrayBuffer.js +8 -0
  90. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneBuffer.js +10 -0
  91. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneDataView.js +8 -0
  92. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneRegExp.js +8 -0
  93. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneSymbol.js +8 -0
  94. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_cloneTypedArray.js +8 -0
  95. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyArray.js +8 -0
  96. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copyObject.js +14 -0
  97. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbols.js +8 -0
  98. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_copySymbolsIn.js +8 -0
  99. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_coreJsData.js +5 -0
  100. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_defineProperty.js +10 -0
  101. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_freeGlobal.js +4 -0
  102. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeys.js +9 -0
  103. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getAllKeysIn.js +9 -0
  104. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getMapData.js +8 -0
  105. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getNative.js +9 -0
  106. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getPrototype.js +5 -0
  107. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getRawTag.js +14 -0
  108. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbols.js +10 -0
  109. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getSymbolsIn.js +11 -0
  110. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getTag.js +23 -0
  111. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_getValue.js +6 -0
  112. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashClear.js +7 -0
  113. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashDelete.js +7 -0
  114. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashGet.js +13 -0
  115. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashHas.js +9 -0
  116. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_hashSet.js +9 -0
  117. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneArray.js +8 -0
  118. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneByTag.js +33 -0
  119. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_initCloneObject.js +9 -0
  120. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isIndex.js +8 -0
  121. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isKeyable.js +7 -0
  122. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isMasked.js +11 -0
  123. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_isPrototype.js +8 -0
  124. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheClear.js +6 -0
  125. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheDelete.js +9 -0
  126. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheGet.js +8 -0
  127. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheHas.js +7 -0
  128. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_listCacheSet.js +8 -0
  129. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheClear.js +13 -0
  130. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheDelete.js +8 -0
  131. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheGet.js +7 -0
  132. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheHas.js +7 -0
  133. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_mapCacheSet.js +8 -0
  134. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeCreate.js +5 -0
  135. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeys.js +5 -0
  136. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nativeKeysIn.js +8 -0
  137. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_nodeUtil.js +9 -0
  138. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_objectToString.js +7 -0
  139. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_overArg.js +8 -0
  140. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_root.js +5 -0
  141. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackClear.js +7 -0
  142. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackDelete.js +7 -0
  143. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackGet.js +6 -0
  144. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackHas.js +6 -0
  145. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_stackSet.js +16 -0
  146. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_toSource.js +15 -0
  147. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/_trimmedEndIndex.js +8 -0
  148. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/cloneDeep.js +8 -0
  149. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/debounce.js +50 -0
  150. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/eq.js +6 -0
  151. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArguments.js +10 -0
  152. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArray.js +4 -0
  153. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isArrayLike.js +8 -0
  154. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isBuffer.js +6 -0
  155. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isEmpty.js +21 -0
  156. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isFunction.js +11 -0
  157. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isLength.js +7 -0
  158. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isMap.js +7 -0
  159. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObject.js +7 -0
  160. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isObjectLike.js +6 -0
  161. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSet.js +7 -0
  162. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isSymbol.js +9 -0
  163. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/isTypedArray.js +7 -0
  164. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keys.js +9 -0
  165. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/keysIn.js +9 -0
  166. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/now.js +7 -0
  167. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubArray.js +6 -0
  168. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/stubFalse.js +6 -0
  169. package/dist/node_modules/.bun/lodash-es@4.17.23/node_modules/lodash-es/toNumber.js +19 -0
  170. package/package.json +70 -0
  171. package/src/author/common.tsx +473 -0
  172. package/src/author/defaults.tsx +157 -0
  173. package/src/author/index.ts +174 -0
  174. package/src/author/main.tsx +407 -0
  175. package/src/author/modals.tsx +254 -0
  176. package/src/author/scale.tsx +453 -0
  177. package/src/author/trait.tsx +305 -0
  178. package/src/author/traitsHeader.tsx +301 -0
  179. package/src/author/utils.ts +83 -0
  180. package/src/controller/defaults.ts +21 -0
  181. package/src/controller/index.ts +137 -0
  182. package/src/controller/utils.ts +13 -0
  183. package/src/delivery/index.ts +61 -0
  184. package/src/delivery/main.tsx +140 -0
  185. package/src/delivery/scale.tsx +313 -0
  186. package/src/delivery/trait.tsx +86 -0
  187. package/src/index.iife.ts +16 -0
  188. package/src/index.ts +1 -0
@@ -0,0 +1,305 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/multi-trait-rubric/configure/src/trait.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 debug from 'debug';
13
+ import PropTypes from 'prop-types';
14
+ import { isEmpty } from 'lodash-es';
15
+ import { useDraggable, useDroppable } from '@dnd-kit/core';
16
+
17
+ import { styled } from '@mui/material/styles';
18
+ import { color } from '@pie-lib/render-ui';
19
+
20
+ import { Block, BlockWidth, ExpandedInput, PrimaryBlock, Row, SecondaryBlock, UnderlinedInput } from './common.js';
21
+
22
+ import IconButton from '@mui/material/IconButton';
23
+ import MoreVertIcon from '@mui/icons-material/MoreVert';
24
+ import { InlineMenu as Menu } from '@pie-lib/render-ui';
25
+ import MenuItem from '@mui/material/MenuItem';
26
+ import DragIndicatorIcon from '@mui/icons-material/DragIndicator';
27
+
28
+ const log = debug('@pie-element:placement-ordering:configure:trait-tile');
29
+
30
+ const ActionsIcon: any = styled(DragIndicatorIcon)({
31
+ color: color.text(),
32
+ });
33
+
34
+ const StyledPrimaryBlock: any = styled(PrimaryBlock)(({ theme }) => ({
35
+ display: 'flex',
36
+ flexDirection: 'column',
37
+ justifyContent: 'space-between',
38
+ marginBottom: theme.spacing(5),
39
+ touchAction: 'none',
40
+ }));
41
+
42
+ const Controls: any = styled('div')({
43
+ display: 'flex',
44
+ alignItems: 'center',
45
+ width: '100%',
46
+ cursor: 'pointer',
47
+ });
48
+
49
+ const Options: any = styled(IconButton)({
50
+ marginLeft: 'auto',
51
+ });
52
+
53
+ const RemoveLabel: any = styled('div')({
54
+ display: 'flex',
55
+ whiteSpace: 'break-spaces',
56
+ });
57
+
58
+ const ErrorText: any = styled('div')(({ theme }) => ({
59
+ fontSize: theme.typography.fontSize - 2,
60
+ color: theme.palette.error.main,
61
+ paddingBottom: theme.spacing(1),
62
+ }));
63
+
64
+ function TraitTile({
65
+ error,
66
+ trait: { name, standards, description, scorePointsDescriptors },
67
+ traitLabel,
68
+ scorePointsValues,
69
+ showStandards,
70
+ showDescription,
71
+ enableDragAndDrop,
72
+ currentPosition,
73
+ secondaryBlockWidth,
74
+ spellCheck,
75
+ maxPoints,
76
+ uploadSoundSupport,
77
+ mathMlOptions = {},
78
+ expandedPluginProps = {},
79
+ labelPluginProps = {},
80
+ imageSupport = {},
81
+ index,
82
+ onTraitChanged,
83
+ onTraitRemoved,
84
+ onTraitDropped,
85
+ }) {
86
+ const [anchorEl, setAnchorEl] = React.useState(null);
87
+ const secondaryBlockRef = React.useRef(null);
88
+
89
+ const {
90
+ attributes,
91
+ listeners,
92
+ setNodeRef: setDragRef,
93
+ transform,
94
+ isDragging,
95
+ } = useDraggable({
96
+ id: `trait-${index}`,
97
+ data: {
98
+ type: 'trait',
99
+ index,
100
+ name,
101
+ },
102
+ });
103
+
104
+ const { setNodeRef: setDropRef } = useDroppable({
105
+ id: `trait-drop-${index}`,
106
+ data: {
107
+ type: 'trait',
108
+ index,
109
+ },
110
+ });
111
+
112
+ React.useLayoutEffect(() => {
113
+ if (
114
+ currentPosition !== undefined &&
115
+ secondaryBlockRef.current
116
+ ) {
117
+ secondaryBlockRef.current.scrollTo({ left: currentPosition });
118
+ }
119
+ }, [currentPosition]);
120
+
121
+ const onTraitChangedHandler = (params) => {
122
+ if (isEmpty(params)) return;
123
+
124
+ const updatedTrait = { ...{ name, standards, description, scorePointsDescriptors }, ...params };
125
+ onTraitChanged(updatedTrait);
126
+ };
127
+
128
+ const onScorePointDescriptorChange = ({ descriptor, value }) => {
129
+ if (value < 0 || value >= scorePointsDescriptors.length) return;
130
+
131
+ const newDescriptors = [...scorePointsDescriptors];
132
+ newDescriptors[value] = descriptor;
133
+
134
+ onTraitChangedHandler({ scorePointsDescriptors: newDescriptors });
135
+ };
136
+
137
+ const handleClick = (event) => setAnchorEl(event.currentTarget);
138
+
139
+ const handleClose = () => setAnchorEl(null);
140
+
141
+ const openMenu = () => {
142
+ onTraitRemoved();
143
+ handleClose();
144
+ };
145
+
146
+ const dragStyle = transform
147
+ ? {
148
+ transform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,
149
+ opacity: isDragging ? 0.5 : 1,
150
+ }
151
+ : {};
152
+
153
+ return (
154
+ <div ref={setDropRef} style={dragStyle}>
155
+ <Row>
156
+ <StyledPrimaryBlock>
157
+ <Controls>
158
+ {enableDragAndDrop && (
159
+ <span ref={setDragRef} {...attributes} {...listeners}>
160
+ <ActionsIcon />
161
+ </span>
162
+ )}
163
+
164
+ <Options
165
+ aria-label="more"
166
+ aria-controls="long-menu"
167
+ aria-haspopup="true"
168
+ onClick={handleClick}
169
+ size="large"
170
+ >
171
+ <MoreVertIcon />
172
+ </Options>
173
+
174
+ <Menu
175
+ id="long-menu"
176
+ anchorEl={anchorEl}
177
+ keepMounted
178
+ open={!!anchorEl}
179
+ onClose={handleClose}
180
+ transitionDuration={{ enter: 225, exit: 195 }}
181
+ >
182
+ <MenuItem onClick={openMenu}>
183
+ <RemoveLabel dangerouslySetInnerHTML={{ __html: `Remove ${name || traitLabel}` }} />
184
+ </MenuItem>
185
+ </Menu>
186
+ </Controls>
187
+
188
+ <UnderlinedInput
189
+ markup={name}
190
+ error={error?.name || ''}
191
+ onChange={(name) => onTraitChangedHandler({ name })}
192
+ pluginProps={labelPluginProps}
193
+ placeholder={`Enter ${traitLabel}`}
194
+ spellCheck={spellCheck}
195
+ uploadSoundSupport={uploadSoundSupport}
196
+ mathMlOptions={mathMlOptions}
197
+ imageSupport={imageSupport}
198
+ />
199
+ {error && <ErrorText>{error.name || ''}</ErrorText>}
200
+ </StyledPrimaryBlock>
201
+
202
+ <SecondaryBlock
203
+ setRef={(ref) => {
204
+ secondaryBlockRef.current = ref;
205
+ }}
206
+ width={`${secondaryBlockWidth}px`}
207
+ >
208
+ {showStandards && standards && (
209
+ <Block>
210
+ <ExpandedInput
211
+ placeholder="Standards"
212
+ markup={standards.join(',')}
213
+ onChange={(standards) => onTraitChangedHandler({ standards: standards.split(',') })}
214
+ pluginProps={expandedPluginProps}
215
+ spellCheck={spellCheck}
216
+ uploadSoundSupport={uploadSoundSupport}
217
+ mathMlOptions={mathMlOptions}
218
+ imageSupport={imageSupport}
219
+ />
220
+ </Block>
221
+ )}
222
+
223
+ {showDescription && (
224
+ <Block>
225
+ <ExpandedInput
226
+ placeholder="Enter Description"
227
+ markup={description}
228
+ error={error?.description || ''}
229
+ onChange={(description) => onTraitChangedHandler({ description })}
230
+ pluginProps={expandedPluginProps}
231
+ spellCheck={spellCheck}
232
+ uploadSoundSupport={uploadSoundSupport}
233
+ mathMlOptions={mathMlOptions}
234
+ imageSupport={imageSupport}
235
+ />
236
+ {error && <ErrorText>{error.description || ''}</ErrorText>}
237
+ </Block>
238
+ )}
239
+
240
+ {(scorePointsValues || []).map((scorePointsValue, scoreIndex) => {
241
+ const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding
242
+ const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * scoreIndex + currentPosition - 98;
243
+ const value = scorePointsValues.length - scoreIndex - 1;
244
+ let scoreDescriptor;
245
+
246
+ try {
247
+ scoreDescriptor = scorePointsDescriptors[value] || '';
248
+ } catch (e) {
249
+ scoreDescriptor = '';
250
+ }
251
+
252
+ return (
253
+ <Block key={`key-key-${scoreIndex}`}>
254
+ <ExpandedInput
255
+ placeholder="Enter Descriptor"
256
+ markup={scoreDescriptor}
257
+ onChange={(descriptor) => onScorePointDescriptorChange({ descriptor, value })}
258
+ pluginProps={expandedPluginProps}
259
+ alignToRight={remainingSpace < 296 && scorePointsValue < maxPoints} // 296 is the space required for the toolbar
260
+ spellCheck={spellCheck}
261
+ uploadSoundSupport={uploadSoundSupport}
262
+ mathMlOptions={mathMlOptions}
263
+ imageSupport={imageSupport}
264
+ />
265
+ </Block>
266
+ );
267
+ })}
268
+ </SecondaryBlock>
269
+ </Row>
270
+ </div>
271
+ );
272
+ }
273
+
274
+ TraitTile.propTypes = {
275
+ error: PropTypes.object,
276
+ index: PropTypes.number.isRequired,
277
+ onTraitChanged: PropTypes.func.isRequired,
278
+ onTraitRemoved: PropTypes.func.isRequired,
279
+ onTraitDropped: PropTypes.func,
280
+ trait: PropTypes.shape({
281
+ name: PropTypes.string,
282
+ standards: PropTypes.arrayOf(PropTypes.string),
283
+ scorePointsDescriptors: PropTypes.arrayOf(PropTypes.string),
284
+ description: PropTypes.string,
285
+ }),
286
+ traitLabel: PropTypes.string,
287
+ scorePointsValues: PropTypes.arrayOf(PropTypes.number),
288
+ showStandards: PropTypes.bool,
289
+ showDescription: PropTypes.bool,
290
+ maxPoints: PropTypes.number,
291
+ enableDragAndDrop: PropTypes.bool,
292
+ currentPosition: PropTypes.number,
293
+ secondaryBlockWidth: PropTypes.number,
294
+ spellCheck: PropTypes.bool,
295
+ uploadSoundSupport: PropTypes.object,
296
+ mathMlOptions: PropTypes.object,
297
+ expandedPluginProps: PropTypes.object,
298
+ labelPluginProps: PropTypes.object,
299
+ imageSupport: PropTypes.shape({
300
+ add: PropTypes.func.isRequired,
301
+ delete: PropTypes.func.isRequired,
302
+ }),
303
+ };
304
+
305
+ export default TraitTile;
@@ -0,0 +1,301 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/multi-trait-rubric/configure/src/traitsHeader.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
+
14
+ import { styled } from '@mui/material/styles';
15
+ import IconButton from '@mui/material/IconButton';
16
+ import { InlineMenu as MenuImport } from '@pie-lib/render-ui';
17
+
18
+ function isRenderableReactInteropType(value: any) {
19
+ return (
20
+ typeof value === 'function' ||
21
+ (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
22
+ );
23
+ }
24
+
25
+ function unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {
26
+ if (!maybeSymbol) return maybeSymbol;
27
+ if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;
28
+ if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;
29
+ if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {
30
+ return maybeSymbol[namedExport];
31
+ }
32
+ if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {
33
+ return maybeSymbol[namedExport].default;
34
+ }
35
+ return maybeSymbol;
36
+ }
37
+ const Menu = unwrapReactInteropSymbol(MenuImport, 'InlineMenu') || unwrapReactInteropSymbol(renderUi.InlineMenu, 'InlineMenu');
38
+ import * as RenderUiNamespace from '@pie-lib/render-ui';
39
+ const renderUiNamespaceAny = RenderUiNamespace as any;
40
+ const renderUiDefaultMaybe = renderUiNamespaceAny['default'];
41
+ const renderUi =
42
+ renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'
43
+ ? renderUiDefaultMaybe
44
+ : renderUiNamespaceAny;
45
+ import MenuItem from '@mui/material/MenuItem';
46
+ import MoreVertIcon from '@mui/icons-material/MoreVert';
47
+ import { color } from '@pie-lib/render-ui';
48
+
49
+ import {
50
+ Block,
51
+ BlockWidth,
52
+ PrimaryBlockWidth,
53
+ SecondaryBlock,
54
+ ScorePoint,
55
+ MaxPointsPicker,
56
+ SimpleInput,
57
+ ScaleSettings,
58
+ HeaderHeight,
59
+ HeaderHeightLarge,
60
+ } from './common.js';
61
+
62
+ const Label: any = styled('div')({
63
+ width: '140px',
64
+ border: 'none',
65
+ padding: '10px 0',
66
+ display: 'flex',
67
+ alignItems: 'center',
68
+ justifyContent: 'space-around',
69
+ });
70
+
71
+ const GreyHeaderRow: any = styled('div')(({ height, theme }) => ({
72
+ background: color.secondaryBackground(),
73
+ borderRadius: '4px',
74
+ position: 'relative',
75
+ marginBottom: theme.spacing(2),
76
+ display: 'flex',
77
+ height: height,
78
+ }));
79
+
80
+ const PrimaryBlockGreyHeader: any = styled('div')(({ theme }) => ({
81
+ width: `${PrimaryBlockWidth}px`,
82
+ minWidth: `${PrimaryBlockWidth}px`,
83
+ position: 'relative',
84
+ padding: '0 10px',
85
+ boxSizing: 'border-box',
86
+ paddingTop: theme.spacing(1.5),
87
+ alignSelf: 'center'
88
+ }));
89
+
90
+ const ScorePointErrorText: any = styled('div')(({ theme }) => ({
91
+ position: 'absolute',
92
+ fontSize: theme.typography.fontSize - 2,
93
+ color: theme.palette.error.main,
94
+ paddingTop: theme.spacing(0.5),
95
+ }));
96
+
97
+ export class TraitsHeaderTile extends React.Component {
98
+ static propTypes = {
99
+ maxPointsEnabled: PropTypes.bool,
100
+ spellCheck: PropTypes.bool,
101
+ errors: PropTypes.object,
102
+ };
103
+
104
+ state = {
105
+ anchorEl: null,
106
+ };
107
+
108
+ UNSAFE_componentWillReceiveProps(nextProps) {
109
+ if (nextProps.currentPosition !== this.props.currentPosition) {
110
+ this.scrollToPosition(nextProps.currentPosition);
111
+ }
112
+ }
113
+
114
+ onScorePointLabelChange: any = ({ scorePointLabel, value }) => {
115
+ const { scorePointsLabels, onScaleChange } = this.props;
116
+
117
+ if (value < 0 || value >= scorePointsLabels.length) return;
118
+
119
+ scorePointsLabels[value] = scorePointLabel;
120
+
121
+ onScaleChange({ scorePointsLabels });
122
+ };
123
+
124
+ handleClick = (event) => this.setState({ anchorEl: event.currentTarget });
125
+
126
+ handleClose = () => this.setState({ anchorEl: null });
127
+
128
+ scrollToPosition: any = (position) => {
129
+ if (this.secondaryBlock) {
130
+ this.secondaryBlock.scrollTo({ left: position });
131
+ }
132
+ };
133
+
134
+ openMenu: any = () => {
135
+ this.props.showDeleteScaleModal();
136
+ this.handleClose();
137
+ };
138
+
139
+ render() {
140
+ const {
141
+ scorePointsValues,
142
+ scorePointsLabels,
143
+ traitLabel,
144
+ currentPosition,
145
+ showStandards,
146
+ onTraitLabelChange,
147
+ showDescription,
148
+ showLevelTagInput,
149
+ maxPoints,
150
+ updateMaxPointsFieldValue,
151
+ scaleIndex,
152
+ showScorePointLabels,
153
+ secondaryBlockWidth,
154
+ setSecondaryBlockRef,
155
+ spellCheck,
156
+ uploadSoundSupport,
157
+ maxPointsEnabled,
158
+ mathMlOptions = {},
159
+ errors = {},
160
+ maxMaxPoints,
161
+ labelPluginProps = {},
162
+ imageSupport = {},
163
+ } = this.props;
164
+ const { anchorEl } = this.state;
165
+
166
+ return (
167
+ <GreyHeaderRow height={showLevelTagInput ? HeaderHeightLarge : HeaderHeight}>
168
+ <PrimaryBlockGreyHeader>
169
+ {showLevelTagInput && (
170
+ <SimpleInput
171
+ markup={traitLabel || 'Trait'}
172
+ onChange={onTraitLabelChange}
173
+ pluginProps={labelPluginProps}
174
+ spellCheck={spellCheck}
175
+ label="Level Label"
176
+ uploadSoundSupport={uploadSoundSupport}
177
+ mathMlOptions={mathMlOptions}
178
+ imageSupport={imageSupport}
179
+ />
180
+ )}
181
+
182
+ <ScaleSettings>
183
+ <div>Scale {scaleIndex + 1}</div>
184
+
185
+ {maxPointsEnabled && (
186
+ <MaxPointsPicker maxPoints={maxPoints} maxMaxPoints={maxMaxPoints} onChange={updateMaxPointsFieldValue} />
187
+ )}
188
+
189
+ <div>
190
+ <IconButton
191
+ aria-label="more"
192
+ aria-controls="long-menu"
193
+ aria-haspopup="true"
194
+ onClick={this.handleClick}
195
+ size="large">
196
+ <MoreVertIcon />
197
+ </IconButton>
198
+ <Menu
199
+ id="long-menu"
200
+ anchorEl={anchorEl}
201
+ keepMounted
202
+ open={!!anchorEl}
203
+ onClose={this.handleClose}
204
+ transitionDuration={{ enter: 225, exit: 195 }}
205
+ >
206
+ {['Remove Scale'].map((option) => (
207
+ <MenuItem key={option} onClick={this.openMenu}>
208
+ {option}
209
+ </MenuItem>
210
+ ))}
211
+ </Menu>
212
+ </div>
213
+ </ScaleSettings>
214
+ </PrimaryBlockGreyHeader>
215
+ <SecondaryBlock
216
+ setRef={(ref) => {
217
+ if (ref) {
218
+ this.secondaryBlock = ref;
219
+ setSecondaryBlockRef(ref);
220
+ }
221
+ }}
222
+ width={`${secondaryBlockWidth}px`}
223
+ >
224
+ {showStandards && (
225
+ <Block>
226
+ <Label>Standard(s)</Label>
227
+ </Block>
228
+ )}
229
+
230
+ {showDescription && (
231
+ <Block>
232
+ <Label>Description</Label>
233
+ </Block>
234
+ )}
235
+
236
+ {scorePointsValues.map((scorePointsValue, index) => {
237
+ const adjustedBlockWidth = BlockWidth + 2 * 8; // 8 is padding
238
+ const remainingSpace = secondaryBlockWidth - adjustedBlockWidth * index + currentPosition - 128;
239
+ const value = scorePointsValues.length - index - 1;
240
+ let scoreDescriptor;
241
+ let error;
242
+
243
+ try {
244
+ scoreDescriptor = scorePointsLabels[value] || '';
245
+ error = errors[value] || '';
246
+ } catch (e) {
247
+ scoreDescriptor = '';
248
+ }
249
+
250
+ return (
251
+ <Block key={`secondary-block-part-${index}`}>
252
+ <ScorePoint
253
+ scorePointsValue={scorePointsValue}
254
+ error={error}
255
+ scoreDescriptor={scoreDescriptor}
256
+ pluginProps={labelPluginProps}
257
+ showScorePointLabels={showScorePointLabels}
258
+ onChange={(scorePointLabel) => this.onScorePointLabelChange({ scorePointLabel, value })}
259
+ alignToRight={remainingSpace < 296 && scorePointsValue < maxPoints} // 296 is the space required for the toolbar
260
+ spellCheck={spellCheck}
261
+ uploadSoundSupport={uploadSoundSupport}
262
+ mathMlOptions={mathMlOptions}
263
+ imageSupport={imageSupport}
264
+ />
265
+ {error && <ScorePointErrorText>{error}</ScorePointErrorText>}
266
+ </Block>
267
+ );
268
+ })}
269
+ </SecondaryBlock>
270
+ </GreyHeaderRow>
271
+ );
272
+ }
273
+ }
274
+
275
+ TraitsHeaderTile.propTypes = {
276
+ onTraitLabelChange: PropTypes.func,
277
+ onScaleChange: PropTypes.func,
278
+ scorePointsValues: PropTypes.arrayOf(PropTypes.number),
279
+ scorePointsLabels: PropTypes.arrayOf(PropTypes.string),
280
+ traitLabel: PropTypes.string,
281
+ showStandards: PropTypes.bool,
282
+ showLevelTagInput: PropTypes.bool,
283
+ showDescription: PropTypes.bool,
284
+ maxPoints: PropTypes.number,
285
+ updateMaxPointsFieldValue: PropTypes.func,
286
+ scaleIndex: PropTypes.number,
287
+ currentPosition: PropTypes.number,
288
+ secondaryBlockWidth: PropTypes.number,
289
+ showDeleteScaleModal: PropTypes.func,
290
+ showScorePointLabels: PropTypes.bool,
291
+ setSecondaryBlockRef: PropTypes.func,
292
+ uploadSoundSupport: PropTypes.object,
293
+ maxMaxPoints: PropTypes.number,
294
+ labelPluginProps: PropTypes.object,
295
+ imageSupport: PropTypes.shape({
296
+ add: PropTypes.func.isRequired,
297
+ delete: PropTypes.func.isRequired,
298
+ }),
299
+ };
300
+
301
+ export default TraitsHeaderTile;
@@ -0,0 +1,83 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/multi-trait-rubric/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
+ import { DEFAULT_PLUGINS } from '@pie-lib/editable-html-tip-tap';
12
+ import { excludeZeroTypes } from './modals.js';
13
+
14
+ export const filteredDefaultPlugins = (DEFAULT_PLUGINS || []).filter(
15
+ (p) => p !== 'table' && p !== 'bulleted-list' && p !== 'numbered-list',
16
+ );
17
+
18
+ export const addOrRemoveScaleColumn = (scales, excludeZeroType) => {
19
+ if (!scales || !scales.length) {
20
+ return [];
21
+ }
22
+
23
+ return scales.reduce((acc, scale) => {
24
+ let { scorePointsLabels, traits } = scale || {};
25
+
26
+ if (scorePointsLabels.length < 1) {
27
+ return acc;
28
+ }
29
+
30
+ switch (excludeZeroType) {
31
+ case excludeZeroTypes.remove0: {
32
+ // removes column 0
33
+ scorePointsLabels = scorePointsLabels.slice(1);
34
+ traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({
35
+ ...trait,
36
+ scorePointsDescriptors: scorePointsDescriptors.slice(1),
37
+ }));
38
+
39
+ break;
40
+ }
41
+
42
+ case excludeZeroTypes.add0: {
43
+ // adds empty column at start
44
+ scorePointsLabels = ['', ...scorePointsLabels];
45
+ traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({
46
+ ...trait,
47
+ scorePointsDescriptors: ['', ...scorePointsDescriptors],
48
+ }));
49
+
50
+ break;
51
+ }
52
+
53
+ case excludeZeroTypes.shiftLeft: {
54
+ // removes last column
55
+ scorePointsLabels = scorePointsLabels.slice(0, -1);
56
+ traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({
57
+ ...trait,
58
+ scorePointsDescriptors: scorePointsDescriptors.slice(0, -1),
59
+ }));
60
+
61
+ break;
62
+ }
63
+
64
+ case excludeZeroTypes.shiftRight: {
65
+ // adds empty column at end
66
+ scorePointsLabels = [...scorePointsLabels, ''];
67
+ traits = traits.map(({ scorePointsDescriptors, ...trait }) => ({
68
+ ...trait,
69
+ scorePointsDescriptors: [...scorePointsDescriptors, ''],
70
+ }));
71
+
72
+ break;
73
+ }
74
+
75
+ default:
76
+ break;
77
+ }
78
+
79
+ acc.push({ ...scale, scorePointsLabels, traits });
80
+
81
+ return acc;
82
+ }, []);
83
+ };
@@ -0,0 +1,21 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-elements/packages/multi-trait-rubric/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
+ export default {
12
+ addScaleEnabled: true,
13
+ description: false,
14
+ excludeZero: false,
15
+ halfScoring: false,
16
+ maxPointsEnabled: true,
17
+ pointLabels: true,
18
+ scales: [],
19
+ standards: false,
20
+ visibleToStudent: true,
21
+ };