@pie-element/hotspot 4.10.13 → 4.10.16-next.1

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 (53) hide show
  1. package/CHANGELOG.md +0 -35
  2. package/configure/CHANGELOG.md +0 -32
  3. package/configure/lib/__tests__/hotspot-container.test.js +281 -0
  4. package/configure/lib/__tests__/hotspot-drawable.test.js +241 -0
  5. package/configure/lib/__tests__/index.test.js +224 -0
  6. package/configure/lib/__tests__/root.test.js +443 -0
  7. package/configure/lib/__tests__/utils.test.js +335 -0
  8. package/configure/lib/button.js +1 -1
  9. package/configure/lib/defaults.js +6 -1
  10. package/configure/lib/defaults.js.map +1 -1
  11. package/configure/lib/hotspot-container.js +3 -3
  12. package/configure/lib/hotspot-drawable.js +3 -3
  13. package/configure/lib/hotspot-drawable.js.map +1 -1
  14. package/configure/lib/hotspot-palette.js +1 -1
  15. package/configure/lib/hotspot-polygon.js +1 -1
  16. package/configure/lib/hotspot-rectangle.js +1 -1
  17. package/configure/lib/index.js +3 -3
  18. package/configure/lib/root.js +61 -10
  19. package/configure/lib/root.js.map +1 -1
  20. package/configure/lib/upload-control.js +1 -1
  21. package/configure/lib/utils.js +4 -4
  22. package/configure/package.json +3 -3
  23. package/configure/src/__tests__/__snapshots__/root.test.js.snap +6 -0
  24. package/configure/src/defaults.js +5 -0
  25. package/configure/src/root.jsx +43 -3
  26. package/controller/lib/__tests__/index.test.js +921 -0
  27. package/controller/lib/__tests__/utils.test.js +8 -0
  28. package/controller/lib/defaults.js +1 -1
  29. package/controller/lib/index.js +40 -4
  30. package/controller/lib/index.js.map +1 -1
  31. package/controller/lib/utils.js +1 -1
  32. package/controller/src/index.js +26 -0
  33. package/docs/demo/pie.manifest.json +11 -0
  34. package/docs/pie-schema.json +6 -0
  35. package/docs/pie-schema.json.md +4 -0
  36. package/lib/__tests__/container-test.js +185 -0
  37. package/lib/__tests__/image-test.js +63 -0
  38. package/lib/__tests__/polygon-test.js +99 -0
  39. package/lib/__tests__/rectangle-test.js +92 -0
  40. package/lib/__tests__/session-updater-test.js +78 -0
  41. package/lib/hotspot/container.js +1 -1
  42. package/lib/hotspot/icons.js +1 -1
  43. package/lib/hotspot/image.js +1 -1
  44. package/lib/hotspot/index.js +5 -1
  45. package/lib/hotspot/index.js.map +1 -1
  46. package/lib/hotspot/polygon.js +1 -1
  47. package/lib/hotspot/rectangle.js +1 -1
  48. package/lib/index.js +1 -1
  49. package/lib/index.js.map +1 -1
  50. package/lib/session-updater.js +1 -1
  51. package/package.json +4 -4
  52. package/src/hotspot/index.jsx +4 -0
  53. package/LICENSE.md +0 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pie-element/hotspot-configure",
3
3
  "private": true,
4
- "version": "4.6.12",
4
+ "version": "4.6.8",
5
5
  "description": "",
6
6
  "main": "lib/index.js",
7
7
  "module": "src/index.js",
@@ -10,8 +10,8 @@
10
10
  "@material-ui/core": "^3.9.2",
11
11
  "@material-ui/icons": "^3.0.2",
12
12
  "@pie-framework/pie-configure-events": "^1.2.0",
13
- "@pie-lib/config-ui": "^10.10.22",
14
- "@pie-lib/editable-html": "^7.19.1",
13
+ "@pie-lib/config-ui": "^10.10.24",
14
+ "@pie-lib/editable-html": "^7.19.3",
15
15
  "classnames": "^2.2.6",
16
16
  "debug": "^3.1.0",
17
17
  "konva": "^3.2.4",
@@ -28,6 +28,11 @@ exports[`Root render renders 1`] = `
28
28
  "label": "Rationale",
29
29
  "settings": true,
30
30
  },
31
+ "spellCheck": Object {
32
+ "enabled": true,
33
+ "label": "Spellcheck",
34
+ "settings": false,
35
+ },
31
36
  "teacherInstructions": Object {
32
37
  "label": "Teacher Instructions",
33
38
  "settings": true,
@@ -38,6 +43,7 @@ exports[`Root render renders 1`] = `
38
43
  Object {
39
44
  "Properties": Object {
40
45
  "rationaleEnabled": undefined,
46
+ "spellCheckEnabled": false,
41
47
  "teacherInstructionsEnabled": undefined,
42
48
  },
43
49
  "Settings": Object {
@@ -44,6 +44,11 @@ export default {
44
44
  settings: true,
45
45
  label: 'Prompt'
46
46
  },
47
+ spellCheck: {
48
+ label: 'Spellcheck',
49
+ settings:false,
50
+ enabled:true
51
+ },
47
52
  teacherInstructions: {
48
53
  settings: true,
49
54
  label: 'Teacher Instructions'
@@ -9,6 +9,8 @@ import PropTypes from 'prop-types';
9
9
  import EditableHtml from '@pie-lib/editable-html';
10
10
  import Typography from '@material-ui/core/Typography';
11
11
  import { withStyles } from '@material-ui/core/styles';
12
+ import Info from '@material-ui/icons/Info';
13
+ import Tooltip from '@material-ui/core/Tooltip';
12
14
 
13
15
  import HotspotPalette from './hotspot-palette';
14
16
  import HotspotContainer from './hotspot-container';
@@ -72,10 +74,20 @@ export class Root extends React.Component {
72
74
  prompt = {},
73
75
  teacherInstructions = {},
74
76
  rationale = {},
75
- preserveAspectRatio = {}
77
+ spellCheck = {},
78
+ preserveAspectRatio = {},
79
+ maxSelections,
80
+ minShapes,
81
+ maxShapes
76
82
  } = configuration || {};
77
- const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled } = model || {};
83
+ const { teacherInstructionsEnabled, promptEnabled, rationaleEnabled, spellCheckEnabled, errors } = model || {};
78
84
  const toolbarOpts = {};
85
+ const configSettings = maxSelections || minShapes || maxShapes;
86
+ const maxSelectionsValidation = maxSelections ? `\nNo more than ${maxSelections} shapes should be selected.` : '';
87
+ const minShapesValidation = minShapes ? `\nThere should be at least ${minShapes} shapes defined.` : '';
88
+ const maxShapesValidation = maxShapes ? `\nNo more than ${maxShapes} shapes should be defined.` : '';
89
+
90
+ const { shapesError, selectionsError } = errors || {};
79
91
 
80
92
  switch (model.toolbarEditorPosition) {
81
93
  case 'top':
@@ -107,7 +119,9 @@ export class Root extends React.Component {
107
119
  Properties: {
108
120
  teacherInstructionsEnabled:
109
121
  teacherInstructions.settings && toggle(teacherInstructions.label),
110
- rationaleEnabled: rationale.settings && toggle(rationale.label)
122
+ rationaleEnabled: rationale.settings && toggle(rationale.label),
123
+ spellCheckEnabled:
124
+ spellCheck.settings && toggle(spellCheck.label),
111
125
  }
112
126
  }}
113
127
  />
@@ -122,6 +136,7 @@ export class Root extends React.Component {
122
136
  imageSupport={imageSupport}
123
137
  nonEmpty={false}
124
138
  toolbarOpts={toolbarOpts}
139
+ spellCheck={spellCheckEnabled}
125
140
  />
126
141
  </InputContainer>
127
142
  )}
@@ -133,6 +148,7 @@ export class Root extends React.Component {
133
148
  imageSupport={imageSupport}
134
149
  nonEmpty={false}
135
150
  toolbarOpts={toolbarOpts}
151
+ spellCheck={spellCheckEnabled}
136
152
  />
137
153
  </InputContainer>
138
154
  )}
@@ -147,6 +163,7 @@ export class Root extends React.Component {
147
163
  onChange={onRationaleChanged}
148
164
  imageSupport={imageSupport}
149
165
  toolbarOpts={toolbarOpts}
166
+ spellCheck={spellCheckEnabled}
150
167
  />
151
168
  </InputContainer>
152
169
  )}
@@ -155,6 +172,19 @@ export class Root extends React.Component {
155
172
  Define Hotspot
156
173
  </Typography>
157
174
 
175
+ {configSettings && <Tooltip
176
+ classes={{tooltip: classes.tooltip}}
177
+ disableFocusListener
178
+ disableTouchListener
179
+ placement={'left'}
180
+ title={`Validation requirements:${maxSelectionsValidation}${minShapesValidation}${maxShapesValidation}`}
181
+ >
182
+ <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }}/>
183
+ </Tooltip>}
184
+
185
+ {shapesError && <div className={classes.errorText}>{shapesError}</div>}
186
+ {selectionsError && <div className={classes.errorText}>{selectionsError}</div>}
187
+
158
188
  <HotspotPalette
159
189
  hotspotColor={model.hotspotColor}
160
190
  hotspotList={model.hotspotList}
@@ -245,6 +275,16 @@ const styles = theme => ({
245
275
  switchElement: {
246
276
  justifyContent: 'space-between',
247
277
  margin: 0
278
+ },
279
+ tooltip: {
280
+ fontSize: '12px',
281
+ whiteSpace: 'pre',
282
+ maxWidth: '500px',
283
+ },
284
+ errorText: {
285
+ fontSize: '12px',
286
+ color: 'red',
287
+ padding: '5px 0'
248
288
  }
249
289
  });
250
290