@pie-element/hotspot 9.1.0 → 9.2.0-mui-update.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 (117) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/configure/CHANGELOG.md +66 -0
  3. package/configure/lib/DeleteWidget.js +31 -44
  4. package/configure/lib/DeleteWidget.js.map +1 -1
  5. package/configure/lib/__tests__/DeleteWidget.test.js +60 -0
  6. package/configure/lib/__tests__/hotspot-container.test.js +377 -0
  7. package/configure/lib/__tests__/hotspot-drawable.test.js +233 -0
  8. package/configure/lib/__tests__/index.test.js +211 -0
  9. package/configure/lib/__tests__/root.test.js +440 -0
  10. package/configure/lib/__tests__/utils.test.js +287 -0
  11. package/configure/lib/button.js +27 -46
  12. package/configure/lib/button.js.map +1 -1
  13. package/configure/lib/buttons/circle.js +21 -28
  14. package/configure/lib/buttons/circle.js.map +1 -1
  15. package/configure/lib/buttons/polygon.js +27 -34
  16. package/configure/lib/buttons/polygon.js.map +1 -1
  17. package/configure/lib/buttons/rectangle.js +27 -34
  18. package/configure/lib/buttons/rectangle.js.map +1 -1
  19. package/configure/lib/defaults.js +3 -4
  20. package/configure/lib/defaults.js.map +1 -1
  21. package/configure/lib/hotspot-circle.js +133 -199
  22. package/configure/lib/hotspot-circle.js.map +1 -1
  23. package/configure/lib/hotspot-container.js +251 -356
  24. package/configure/lib/hotspot-container.js.map +1 -1
  25. package/configure/lib/hotspot-drawable.js +361 -473
  26. package/configure/lib/hotspot-drawable.js.map +1 -1
  27. package/configure/lib/hotspot-palette.js +93 -140
  28. package/configure/lib/hotspot-palette.js.map +1 -1
  29. package/configure/lib/hotspot-polygon.js +213 -318
  30. package/configure/lib/hotspot-polygon.js.map +1 -1
  31. package/configure/lib/hotspot-rectangle.js +129 -193
  32. package/configure/lib/hotspot-rectangle.js.map +1 -1
  33. package/configure/lib/icons.js +1 -1
  34. package/configure/lib/icons.js.map +1 -1
  35. package/configure/lib/image-konva.js +47 -87
  36. package/configure/lib/image-konva.js.map +1 -1
  37. package/configure/lib/index.js +163 -223
  38. package/configure/lib/index.js.map +1 -1
  39. package/configure/lib/root.js +302 -394
  40. package/configure/lib/root.js.map +1 -1
  41. package/configure/lib/shapes/circle.js +70 -102
  42. package/configure/lib/shapes/circle.js.map +1 -1
  43. package/configure/lib/shapes/index.js +5 -13
  44. package/configure/lib/shapes/index.js.map +1 -1
  45. package/configure/lib/shapes/polygon.js +65 -97
  46. package/configure/lib/shapes/polygon.js.map +1 -1
  47. package/configure/lib/shapes/rectagle.js +70 -102
  48. package/configure/lib/shapes/rectagle.js.map +1 -1
  49. package/configure/lib/shapes/utils.js +3 -9
  50. package/configure/lib/shapes/utils.js.map +1 -1
  51. package/configure/lib/upload-control.js +26 -53
  52. package/configure/lib/upload-control.js.map +1 -1
  53. package/configure/lib/utils.js +85 -138
  54. package/configure/lib/utils.js.map +1 -1
  55. package/configure/package.json +11 -10
  56. package/configure/src/__tests__/index.test.js +11 -5
  57. package/configure/src/button.jsx +12 -20
  58. package/configure/src/hotspot-circle.jsx +5 -18
  59. package/configure/src/hotspot-container.jsx +82 -98
  60. package/configure/src/hotspot-drawable.jsx +43 -45
  61. package/configure/src/hotspot-palette.jsx +45 -37
  62. package/configure/src/hotspot-polygon.jsx +4 -20
  63. package/configure/src/hotspot-rectangle.jsx +4 -17
  64. package/configure/src/index.js +12 -2
  65. package/configure/src/root.jsx +85 -79
  66. package/configure/src/upload-control.jsx +6 -16
  67. package/controller/CHANGELOG.md +52 -0
  68. package/controller/lib/__tests__/index.test.js +586 -0
  69. package/controller/lib/__tests__/utils.test.js +8 -0
  70. package/controller/lib/defaults.js +3 -4
  71. package/controller/lib/defaults.js.map +1 -1
  72. package/controller/lib/index.js +152 -206
  73. package/controller/lib/index.js.map +1 -1
  74. package/controller/lib/utils.js +15 -35
  75. package/controller/lib/utils.js.map +1 -1
  76. package/controller/package.json +2 -2
  77. package/docs/demo/pie.manifest.json +11 -0
  78. package/lib/__tests__/container.test.js +221 -0
  79. package/lib/__tests__/index.test.js +113 -0
  80. package/lib/__tests__/polygon.test.js +245 -0
  81. package/lib/__tests__/rectangle.test.js +236 -0
  82. package/lib/__tests__/session-updater.test.js +69 -0
  83. package/lib/hotspot/circle.js +111 -170
  84. package/lib/hotspot/circle.js.map +1 -1
  85. package/lib/hotspot/container.js +175 -261
  86. package/lib/hotspot/container.js.map +1 -1
  87. package/lib/hotspot/icons.js +1 -1
  88. package/lib/hotspot/icons.js.map +1 -1
  89. package/lib/hotspot/image-konva-tooltip.js +66 -113
  90. package/lib/hotspot/image-konva-tooltip.js.map +1 -1
  91. package/lib/hotspot/index.js +136 -199
  92. package/lib/hotspot/index.js.map +1 -1
  93. package/lib/hotspot/polygon.js +151 -215
  94. package/lib/hotspot/polygon.js.map +1 -1
  95. package/lib/hotspot/rectangle.js +130 -186
  96. package/lib/hotspot/rectangle.js.map +1 -1
  97. package/lib/index.js +188 -257
  98. package/lib/index.js.map +1 -1
  99. package/lib/session-updater.js +13 -19
  100. package/lib/session-updater.js.map +1 -1
  101. package/package.json +14 -11
  102. package/src/hotspot/circle.jsx +2 -13
  103. package/src/hotspot/container.jsx +35 -50
  104. package/src/hotspot/index.jsx +16 -28
  105. package/src/hotspot/polygon.jsx +4 -13
  106. package/src/hotspot/rectangle.jsx +4 -13
  107. package/src/index.js +21 -12
  108. package/LICENSE.md +0 -5
  109. package/configure/node_modules/debug/CHANGELOG.md +0 -395
  110. package/configure/node_modules/debug/LICENSE +0 -19
  111. package/configure/node_modules/debug/README.md +0 -437
  112. package/configure/node_modules/debug/node.js +0 -1
  113. package/configure/node_modules/debug/package.json +0 -51
  114. package/configure/node_modules/debug/src/browser.js +0 -180
  115. package/configure/node_modules/debug/src/common.js +0 -249
  116. package/configure/node_modules/debug/src/index.js +0 -12
  117. package/configure/node_modules/debug/src/node.js +0 -177
@@ -2,16 +2,56 @@ import React from 'react';
2
2
  import { settings, layout, InputContainer, NumberTextField } from '@pie-lib/config-ui';
3
3
  import PropTypes from 'prop-types';
4
4
  import EditableHtml from '@pie-lib/editable-html';
5
- import { withStyles } from '@material-ui/core/styles';
6
- import Typography from '@material-ui/core/Typography';
7
- import Info from '@material-ui/icons/Info';
8
- import Tooltip from '@material-ui/core/Tooltip';
5
+ import { styled } from '@mui/material/styles';
6
+ import Typography from '@mui/material/Typography';
7
+ import Info from '@mui/icons-material/Info';
8
+ import Tooltip from '@mui/material/Tooltip';
9
9
  import HotspotPalette from './hotspot-palette';
10
10
  import HotspotContainer from './hotspot-container';
11
11
  import { updateImageDimensions, generateValidationMessage, getUpdatedShapes, getAllShapes, groupShapes } from './utils';
12
12
 
13
13
  const { Panel, toggle, dropdown } = settings;
14
14
 
15
+ const DimensionsContainer = styled('div')(({ theme }) => ({
16
+ display: 'flex',
17
+ marginBottom: theme.spacing(1.5),
18
+ }));
19
+
20
+ const FieldContainer = styled('div')({
21
+ flex: 1,
22
+ width: '90%',
23
+ });
24
+
25
+ const PromptContainer = styled(InputContainer)(({ theme }) => ({
26
+ paddingTop: theme.spacing(1),
27
+ marginTop: theme.spacing(2),
28
+ marginBottom: theme.spacing(2),
29
+ width: '100%',
30
+ }));
31
+
32
+ const SubHeading = styled(Typography)(({ theme }) => ({
33
+ marginRight: theme.spacing(1),
34
+ }));
35
+
36
+ const FlexContainer = styled('div')({
37
+ display: 'flex',
38
+ alignItems: 'center',
39
+ });
40
+
41
+ const StyledTooltip = styled(Tooltip)(({ theme }) => ({
42
+ '& .MuiTooltip-tooltip': {
43
+ fontSize: theme.typography.fontSize - 2,
44
+ whiteSpace: 'pre',
45
+ maxWidth: '500px',
46
+ },
47
+ }));
48
+
49
+ const ErrorText = styled('div')(({ theme }) => ({
50
+ fontSize: theme.typography.fontSize - 2,
51
+ color: theme.palette.error.main,
52
+ paddingTop: theme.spacing(1),
53
+ }));
54
+
15
55
  export class Root extends React.Component {
16
56
  handleColorChange = (fieldType, color) => {
17
57
  const { onColorChanged } = this.props;
@@ -49,7 +89,6 @@ export class Root extends React.Component {
49
89
 
50
90
  render() {
51
91
  const {
52
- classes,
53
92
  configuration,
54
93
  model,
55
94
  imageSupport,
@@ -144,7 +183,7 @@ export class Root extends React.Component {
144
183
  }
145
184
  >
146
185
  {teacherInstructionsEnabled && (
147
- <InputContainer label={teacherInstructions.label} className={classes.promptContainer}>
186
+ <PromptContainer label={teacherInstructions.label}>
148
187
  <EditableHtml
149
188
  markup={model.teacherInstructions || ''}
150
189
  onChange={onTeacherInstructionsChanged}
@@ -160,12 +199,12 @@ export class Root extends React.Component {
160
199
  languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
161
200
  mathMlOptions={mathMlOptions}
162
201
  />
163
- {teacherInstructionsError && <div className={classes.errorText}>{teacherInstructionsError}</div>}
164
- </InputContainer>
202
+ {teacherInstructionsError && <ErrorText>{teacherInstructionsError}</ErrorText>}
203
+ </PromptContainer>
165
204
  )}
166
205
 
167
206
  {promptEnabled && (
168
- <InputContainer label={prompt.label} className={classes.promptContainer}>
207
+ <PromptContainer label={prompt.label}>
169
208
  <EditableHtml
170
209
  markup={model.prompt || ''}
171
210
  onChange={onPromptChanged}
@@ -181,24 +220,23 @@ export class Root extends React.Component {
181
220
  languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
182
221
  mathMlOptions={mathMlOptions}
183
222
  />
184
- {promptError && <div className={classes.errorText}>{promptError}</div>}
185
- </InputContainer>
223
+ {promptError && <ErrorText>{promptError}</ErrorText>}
224
+ </PromptContainer>
186
225
  )}
187
226
 
188
- <div className={classes.flexContainer}>
189
- <Typography className={classes.subheading} variant="subheading">
227
+ <FlexContainer>
228
+ <SubHeading variant="h6">
190
229
  Define Hotspot
191
- </Typography>
192
- <Tooltip
193
- classes={{ tooltip: classes.tooltip }}
230
+ </SubHeading>
231
+ <StyledTooltip
194
232
  disableFocusListener
195
233
  disableTouchListener
196
234
  placement={'left'}
197
235
  title={validationMessage}
198
236
  >
199
237
  <Info fontSize={'small'} color={'primary'} style={{ float: 'right' }} />
200
- </Tooltip>
201
- </div>
238
+ </StyledTooltip>
239
+ </FlexContainer>
202
240
 
203
241
  <HotspotPalette
204
242
  hotspotColor={model.hotspotColor}
@@ -226,39 +264,41 @@ export class Root extends React.Component {
226
264
  preserveAspectRatioEnabled={preserveAspectRatio.enabled}
227
265
  insertImage={imageSupport && imageSupport.add}
228
266
  />
229
- {shapesError && <div className={classes.errorText}>{shapesError}</div>}
230
- {selectionsError && <div className={classes.errorText}>{selectionsError}</div>}
267
+ {shapesError && <ErrorText>{shapesError}</ErrorText>}
268
+ {selectionsError && <ErrorText>{selectionsError}</ErrorText>}
231
269
 
232
270
  {model.imageUrl && (
233
271
  <React.Fragment>
234
- <Typography variant="subheading">Image Dimensions</Typography>
272
+ <Typography variant="h6">Image Dimensions</Typography>
235
273
 
236
- <div className={classes.dimensions}>
237
- <NumberTextField
238
- key="hotspot-manual-width"
239
- label="Width"
240
- value={model.dimensions.width}
241
- min={0}
242
- onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}
243
- showErrorWhenOutsideRange
244
- className={classes.field}
245
- />
274
+ <DimensionsContainer>
275
+ <FieldContainer>
276
+ <NumberTextField
277
+ key="hotspot-manual-width"
278
+ label="Width"
279
+ value={model.dimensions.width}
280
+ min={0}
281
+ onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'width')}
282
+ showErrorWhenOutsideRange
283
+ />
284
+ </FieldContainer>
246
285
 
247
- <NumberTextField
248
- key="hotspot-manual-height"
249
- label="Height"
250
- value={model.dimensions.height}
251
- min={0}
252
- onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}
253
- showErrorWhenOutsideRange
254
- className={classes.field}
255
- />
256
- </div>
286
+ <FieldContainer>
287
+ <NumberTextField
288
+ key="hotspot-manual-height"
289
+ label="Height"
290
+ value={model.dimensions.height}
291
+ min={0}
292
+ onChange={(e, value) => this.handleOnUpdateImageDimensions(value, 'height')}
293
+ showErrorWhenOutsideRange
294
+ />
295
+ </FieldContainer>
296
+ </DimensionsContainer>
257
297
  </React.Fragment>
258
298
  )}
259
299
 
260
300
  {rationaleEnabled && (
261
- <InputContainer label={rationale.label} className={classes.promptContainer}>
301
+ <PromptContainer label={rationale.label}>
262
302
  <EditableHtml
263
303
  markup={model.rationale || ''}
264
304
  onChange={onRationaleChanged}
@@ -273,49 +313,15 @@ export class Root extends React.Component {
273
313
  languageCharactersProps={[{ language: 'spanish' }, { language: 'special' }]}
274
314
  mathMlOptions={mathMlOptions}
275
315
  />
276
- {rationaleError && <div className={classes.errorText}>{rationaleError}</div>}
277
- </InputContainer>
316
+ {rationaleError && <ErrorText>{rationaleError}</ErrorText>}
317
+ </PromptContainer>
278
318
  )}
279
319
  </layout.ConfigLayout>
280
320
  );
281
321
  }
282
322
  }
283
323
 
284
- const styles = (theme) => ({
285
- dimensions: {
286
- display: 'flex',
287
- marginBottom: theme.spacing.unit * 1.5,
288
- },
289
- field: {
290
- flex: 1,
291
- width: '90%',
292
- },
293
- promptContainer: {
294
- paddingTop: theme.spacing.unit * 2,
295
- marginBottom: theme.spacing.unit * 2,
296
- width: '100%',
297
- },
298
- subheading: {
299
- marginRight: theme.spacing.unit,
300
- },
301
- flexContainer: {
302
- display: 'flex',
303
- alignItems: 'center',
304
- },
305
- tooltip: {
306
- fontSize: theme.typography.fontSize - 2,
307
- whiteSpace: 'pre',
308
- maxWidth: '500px',
309
- },
310
- errorText: {
311
- fontSize: theme.typography.fontSize - 2,
312
- color: theme.palette.error.main,
313
- paddingTop: theme.spacing.unit,
314
- },
315
- });
316
-
317
324
  Root.propTypes = {
318
- classes: PropTypes.object.isRequired,
319
325
  configuration: PropTypes.object,
320
326
  model: PropTypes.object.isRequired,
321
327
  imageSupport: PropTypes.shape({
@@ -337,4 +343,4 @@ Root.propTypes = {
337
343
  onTeacherInstructionsChanged: PropTypes.func.isRequired,
338
344
  };
339
345
 
340
- export default withStyles(styles)(Root);
346
+ export default Root;
@@ -1,34 +1,24 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { withStyles } from '@material-ui/core/styles/index';
4
3
 
5
4
  import Button from './button';
6
5
 
7
- const UploadControl = ({ classNameButton, classNameSection, classes, label, onInputClick, onUploadImage, setRef }) => (
8
- <div className={classNameSection}>
9
- <Button className={classNameButton} label={label} onClick={onInputClick} />
6
+ const UploadControl = ({ label, onInputClick, onUploadImage, setRef }) => (
7
+ <>
8
+ <Button label={label} onClick={onInputClick} />
10
9
  <input
11
10
  accept="image/*"
12
- className={classes.input}
11
+ style={{ display: 'none' }}
13
12
  onChange={onUploadImage}
14
13
  ref={(ref) => {
15
14
  setRef(ref);
16
15
  }}
17
16
  type="file"
18
17
  />
19
- </div>
18
+ </>
20
19
  );
21
20
 
22
- const styles = () => ({
23
- input: {
24
- display: 'none',
25
- },
26
- });
27
-
28
21
  UploadControl.propTypes = {
29
- classes: PropTypes.object.isRequired,
30
- classNameButton: PropTypes.string,
31
- classNameSection: PropTypes.string,
32
22
  label: PropTypes.string.isRequired,
33
23
  onInputClick: PropTypes.func.isRequired,
34
24
  onUploadImage: PropTypes.func.isRequired,
@@ -40,4 +30,4 @@ UploadControl.defaultProps = {
40
30
  classNameSection: '',
41
31
  };
42
32
 
43
- export default withStyles(styles)(UploadControl);
33
+ export default UploadControl;
@@ -3,6 +3,58 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [6.3.3](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.3.2...@pie-element/hotspot-controller@6.3.3) (2025-11-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * bump libs PD-5274, PD-5211, PD-5248 ([7610b25](https://github.com/pie-framework/pie-elements/commit/7610b25423956b6492f33322513b3430051fca77))
12
+
13
+
14
+
15
+
16
+
17
+ ## [6.3.2](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.3.1...@pie-element/hotspot-controller@6.3.2) (2025-10-22)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * bump libs PD-5265 ([184a978](https://github.com/pie-framework/pie-elements/commit/184a978f57a2a84dc6ba87c1eba0b92d5cdd9eae))
23
+
24
+
25
+
26
+
27
+
28
+ ## [6.3.1](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.2.0...@pie-element/hotspot-controller@6.3.1) (2025-10-16)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * bump pie-lib versions and pslb module versions ([393d39f](https://github.com/pie-framework/pie-elements/commit/393d39fb850ad055568f4d20464213e9043f208f))
34
+
35
+
36
+
37
+
38
+
39
+ # [6.3.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.2.0...@pie-element/hotspot-controller@6.3.0) (2025-10-15)
40
+
41
+ **Note:** Version bump only for package @pie-element/hotspot-controller
42
+
43
+
44
+
45
+
46
+
47
+ # [6.2.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.0.1...@pie-element/hotspot-controller@6.2.0) (2025-10-10)
48
+
49
+
50
+ ### Features
51
+
52
+ * update libs PD-5208, PD-5211, PD-5199, PD-5218, PD-5217 ([da327fa](https://github.com/pie-framework/pie-elements/commit/da327fa501f6e9eff1c0b30b5ef092426a91f78b))
53
+
54
+
55
+
56
+
57
+
6
58
  # [6.1.0](https://github.com/pie-framework/pie-elements/compare/@pie-element/hotspot-controller@6.0.0...@pie-element/hotspot-controller@6.1.0) (2025-10-07)
7
59
 
8
60
  **Note:** Version bump only for package @pie-element/hotspot-controller