@pie-element/math-inline 8.4.1-next.7 → 8.4.2-next.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.
package/module/print.js CHANGED
@@ -1,5 +1,5 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_pie_lib__pie_toolbox_math_rendering, _dll_lodash, _dll_pie_framework__mathquill, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.1.1/module/index.js";
2
- import {_dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.8.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_pie_lib__pie_toolbox_math_rendering, _dll_lodash, _dll_pie_framework__mathquill, _dll_debug} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.2.0/module/index.js";
2
+ import {_dll_pie_lib__pie_toolbox_math_toolbar, _dll_pie_lib__pie_toolbox_math_input, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_correct_answer_toggle} from "../../../@pie-lib/pie-toolbox-module@5.9.0/module/index.js";
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
  function getDefaultExportFromCjs(x) {
5
5
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -11309,10 +11309,11 @@ var en = {};
11309
11309
  primaryCorrectWithAlternates: 'Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct.'
11310
11310
  },
11311
11311
  multipleChoice: {
11312
- minSelections_one: 'This question requires at least {{minSelections}} answer.',
11313
- minSelections_other: 'This question requires at least {{minSelections}} answers.',
11312
+ minSelections: 'Select at least {{minSelections}}.',
11314
11313
  maxSelections_one: 'Only {{maxSelections}} answer is allowed.',
11315
- maxSelections_other: 'Only {{maxSelections}} answers are allowed.'
11314
+ maxSelections_other: 'Only {{maxSelections}} answers are allowed.',
11315
+ minmaxSelections_equal: 'Select {{minSelections}}.',
11316
+ minmaxSelections_range: 'Select between {{minSelections}} and {{maxSelections}}.'
11316
11317
  },
11317
11318
  selectText: {
11318
11319
  correctAnswerSelected: 'Correct answer selected',
@@ -11402,10 +11403,11 @@ var es = {};
11402
11403
  primaryCorrectWithAlternates: 'Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas.'
11403
11404
  },
11404
11405
  multipleChoice: {
11405
- minSelections_one: 'Esta pregunta requiere al menos {{minSelections}} respuesta.',
11406
- minSelections_other: 'Esta pregunta requiere al menos {{minSelections}} respuestas.',
11406
+ minSelections: 'Seleccione al menos {{minSelections}}.',
11407
11407
  maxSelections_one: 'Sólo se permite {{maxSelections}} respuesta.',
11408
- maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.'
11408
+ maxSelections_other: 'Sólo se permiten {{maxSelections}} respuestas.',
11409
+ minmaxSelections_equal: 'Seleccione {{minSelections}}.',
11410
+ minmaxSelections_range: 'Seleccione entre {{minSelections}} y {{maxSelections}}.'
11409
11411
  },
11410
11412
  selectText: {
11411
11413
  correctAnswerSelected: 'Respuesta correcta seleccionada',
@@ -11574,6 +11576,16 @@ function generateAdditionalKeys(keyData = []) {
11574
11576
  label: key
11575
11577
  }));
11576
11578
  }
11579
+ function isChildOfCurrentPieElement(child, parent) {
11580
+ let node = child;
11581
+ while (node !== null) {
11582
+ if (node === parent) {
11583
+ return true;
11584
+ }
11585
+ node = node.parentNode;
11586
+ }
11587
+ return false;
11588
+ }
11577
11589
  function getKeyPadWidth(additionalKeys = [], equationEditor) {
11578
11590
  return Math.floor(additionalKeys.length / 5) * 30 + (equationEditor === 'miscellaneous' ? 600 : 500);
11579
11591
  }
@@ -11799,10 +11811,14 @@ class Main extends React$1.Component {
11799
11811
  }
11800
11812
  __init4() {
11801
11813
  this.handleKeyDown = (event, id) => {
11814
+ const {config} = this.props.model;
11815
+ const myElement = document.getElementById(config.id);
11816
+ let isTrigerredFromActualPieElement = true;
11817
+ isTrigerredFromActualPieElement = isChildOfCurrentPieElement(event.target, myElement);
11802
11818
  const isAnswerInputFocused = document.activeElement.getAttribute('aria-label') === 'Enter answer.';
11803
11819
  const isClickOrTouchEvent = event.type === 'click' || event.type === 'touchstart';
11804
11820
  if (isAnswerInputFocused && (event.key === 'ArrowDown' || isClickOrTouchEvent)) {
11805
- if (this.state.activeAnswerBlock !== id) {
11821
+ if (this.state.activeAnswerBlock !== id && isTrigerredFromActualPieElement) {
11806
11822
  this.cleanupKeyDownListener();
11807
11823
  this.setState({
11808
11824
  activeAnswerBlock: id
@@ -11958,6 +11974,7 @@ class Main extends React$1.Component {
11958
11974
  __init16() {
11959
11975
  this.onBlur = e => {
11960
11976
  const {relatedTarget, currentTarget} = e || ({});
11977
+ const isKeypadOpen = currentTarget && currentTarget.closest('[role=tooltip]');
11961
11978
  function getParentWithRoleTooltip(element, depth = 0) {
11962
11979
  if (!element || depth >= 16) return null;
11963
11980
  const parent = element.offsetParent;
@@ -11979,9 +11996,11 @@ class Main extends React$1.Component {
11979
11996
  const parentWithTooltipRole = getParentWithRoleTooltip(relatedTarget);
11980
11997
  const childWithDataKeypad = parentWithTooltipRole ? getDeepChildDataKeypad(parentWithTooltipRole) : null;
11981
11998
  if (!relatedTarget || !currentTarget || !_optionalChain([childWithDataKeypad, 'optionalAccess', _16 => _16.attributes, 'access', _17 => _17['data-keypad']])) {
11982
- this.setState({
11983
- activeAnswerBlock: ''
11984
- });
11999
+ if (!isKeypadOpen) {
12000
+ this.setState({
12001
+ activeAnswerBlock: ''
12002
+ });
12003
+ }
11985
12004
  }
11986
12005
  };
11987
12006
  }
@@ -12003,7 +12022,7 @@ class Main extends React$1.Component {
12003
12022
  if (!config) {
12004
12023
  return null;
12005
12024
  }
12006
- const {showNote, note, prompt, responses, responseType, equationEditor, customKeys, env: {mode, role} = {}} = config || ({});
12025
+ const {showNote, note, prompt, responses, responseType, equationEditor, customKeys, id, env: {mode, role} = {}} = config || ({});
12007
12026
  const displayNote = (showCorrect || mode === 'view' && role === 'instructor') && showNote && note;
12008
12027
  const emptyResponse = isEmpty(responses);
12009
12028
  const showCorrectAnswerToggle = !emptyResponse && correctness && correctness.correctness !== 'correct';
@@ -12018,7 +12037,7 @@ class Main extends React$1.Component {
12018
12037
  __self: this,
12019
12038
  __source: {
12020
12039
  fileName: _jsxFileName,
12021
- lineNumber: 578
12040
+ lineNumber: 604
12022
12041
  }
12023
12042
  }, React$1.createElement(mq.Static, {
12024
12043
  className: classes.static,
@@ -12032,7 +12051,7 @@ class Main extends React$1.Component {
12032
12051
  __self: this,
12033
12052
  __source: {
12034
12053
  fileName: _jsxFileName,
12035
- lineNumber: 579
12054
+ lineNumber: 605
12036
12055
  }
12037
12056
  }));
12038
12057
  const midContent = React$1.createElement('div', {
@@ -12040,14 +12059,14 @@ class Main extends React$1.Component {
12040
12059
  __self: this,
12041
12060
  __source: {
12042
12061
  fileName: _jsxFileName,
12043
- lineNumber: 593
12062
+ lineNumber: 619
12044
12063
  }
12045
12064
  }, mode === 'gather' && React$1.createElement('h2', {
12046
12065
  className: classes.srOnly,
12047
12066
  __self: this,
12048
12067
  __source: {
12049
12068
  fileName: _jsxFileName,
12050
- lineNumber: 594
12069
+ lineNumber: 620
12051
12070
  }
12052
12071
  }, "Math Equation Response Question"), viewMode && teacherInstructions && hasText(teacherInstructions) && (!animationsDisabled ? React$1.createElement(Collapsible, {
12053
12072
  className: classes.collapsible,
@@ -12058,7 +12077,7 @@ class Main extends React$1.Component {
12058
12077
  __self: this,
12059
12078
  __source: {
12060
12079
  fileName: _jsxFileName,
12061
- lineNumber: 600
12080
+ lineNumber: 626
12062
12081
  }
12063
12082
  }, React$1.createElement('div', {
12064
12083
  dangerouslySetInnerHTML: {
@@ -12067,7 +12086,7 @@ class Main extends React$1.Component {
12067
12086
  __self: this,
12068
12087
  __source: {
12069
12088
  fileName: _jsxFileName,
12070
- lineNumber: 604
12089
+ lineNumber: 630
12071
12090
  }
12072
12091
  })) : React$1.createElement('div', {
12073
12092
  dangerouslySetInnerHTML: {
@@ -12076,28 +12095,28 @@ class Main extends React$1.Component {
12076
12095
  __self: this,
12077
12096
  __source: {
12078
12097
  fileName: _jsxFileName,
12079
- lineNumber: 607
12098
+ lineNumber: 633
12080
12099
  }
12081
12100
  })), prompt && React$1.createElement('div', {
12082
12101
  className: classes.promptContainer,
12083
12102
  __self: this,
12084
12103
  __source: {
12085
12104
  fileName: _jsxFileName,
12086
- lineNumber: 611
12105
+ lineNumber: 637
12087
12106
  }
12088
12107
  }, React$1.createElement(PreviewPrompt, {
12089
12108
  prompt: prompt,
12090
12109
  __self: this,
12091
12110
  __source: {
12092
12111
  fileName: _jsxFileName,
12093
- lineNumber: 612
12112
+ lineNumber: 638
12094
12113
  }
12095
12114
  })), studentPrintMode ? printView : React$1.createElement(Readable, {
12096
12115
  false: true,
12097
12116
  __self: this,
12098
12117
  __source: {
12099
12118
  fileName: _jsxFileName,
12100
- lineNumber: 619
12119
+ lineNumber: 645
12101
12120
  }
12102
12121
  }, React$1.createElement('div', {
12103
12122
  className: classes.inputAndKeypadContainer,
@@ -12105,7 +12124,7 @@ class Main extends React$1.Component {
12105
12124
  __self: this,
12106
12125
  __source: {
12107
12126
  fileName: _jsxFileName,
12108
- lineNumber: 620
12127
+ lineNumber: 646
12109
12128
  }
12110
12129
  }, responseType === ResponseTypes.simple && React$1.createElement(SimpleQuestionBlock, {
12111
12130
  onSimpleResponseChange: this.onSimpleResponseChange,
@@ -12118,7 +12137,7 @@ class Main extends React$1.Component {
12118
12137
  __self: this,
12119
12138
  __source: {
12120
12139
  fileName: _jsxFileName,
12121
- lineNumber: 622
12140
+ lineNumber: 648
12122
12141
  }
12123
12142
  }), responseType === ResponseTypes.advanced && React$1.createElement('div', {
12124
12143
  ref: tooltipContainerRef,
@@ -12132,7 +12151,7 @@ class Main extends React$1.Component {
12132
12151
  __self: this,
12133
12152
  __source: {
12134
12153
  fileName: _jsxFileName,
12135
- lineNumber: 634
12154
+ lineNumber: 660
12136
12155
  }
12137
12156
  }, React$1.createElement(Tooltip, {
12138
12157
  ref: ref => this.setTooltipRef(ref),
@@ -12166,7 +12185,7 @@ class Main extends React$1.Component {
12166
12185
  __self: this,
12167
12186
  __source: {
12168
12187
  fileName: _jsxFileName,
12169
- lineNumber: 669
12188
+ lineNumber: 695
12170
12189
  }
12171
12190
  }, React$1.createElement(HorizontalKeypad, {
12172
12191
  additionalKeys: additionalKeys,
@@ -12175,13 +12194,13 @@ class Main extends React$1.Component {
12175
12194
  __self: this,
12176
12195
  __source: {
12177
12196
  fileName: _jsxFileName,
12178
- lineNumber: 678
12197
+ lineNumber: 704
12179
12198
  }
12180
12199
  })) || null),
12181
12200
  __self: this,
12182
12201
  __source: {
12183
12202
  fileName: _jsxFileName,
12184
- lineNumber: 644
12203
+ lineNumber: 670
12185
12204
  }
12186
12205
  }, React$1.createElement(mq.Static, {
12187
12206
  className: classes.static,
@@ -12195,7 +12214,7 @@ class Main extends React$1.Component {
12195
12214
  __self: this,
12196
12215
  __source: {
12197
12216
  fileName: _jsxFileName,
12198
- lineNumber: 688
12217
+ lineNumber: 714
12199
12218
  }
12200
12219
  }))))), viewMode && displayNote && React$1.createElement('div', {
12201
12220
  className: classes.note,
@@ -12205,7 +12224,7 @@ class Main extends React$1.Component {
12205
12224
  __self: this,
12206
12225
  __source: {
12207
12226
  fileName: _jsxFileName,
12208
- lineNumber: 706
12227
+ lineNumber: 732
12209
12228
  }
12210
12229
  }), viewMode && rationale && hasText(rationale) && (!animationsDisabled ? React$1.createElement(Collapsible, {
12211
12230
  labels: {
@@ -12215,7 +12234,7 @@ class Main extends React$1.Component {
12215
12234
  __self: this,
12216
12235
  __source: {
12217
12236
  fileName: _jsxFileName,
12218
- lineNumber: 713
12237
+ lineNumber: 739
12219
12238
  }
12220
12239
  }, React$1.createElement('div', {
12221
12240
  dangerouslySetInnerHTML: {
@@ -12224,7 +12243,7 @@ class Main extends React$1.Component {
12224
12243
  __self: this,
12225
12244
  __source: {
12226
12245
  fileName: _jsxFileName,
12227
- lineNumber: 714
12246
+ lineNumber: 740
12228
12247
  }
12229
12248
  })) : React$1.createElement('div', {
12230
12249
  dangerouslySetInnerHTML: {
@@ -12233,16 +12252,17 @@ class Main extends React$1.Component {
12233
12252
  __self: this,
12234
12253
  __source: {
12235
12254
  fileName: _jsxFileName,
12236
- lineNumber: 717
12255
+ lineNumber: 743
12237
12256
  }
12238
12257
  })));
12239
12258
  if (tooltipModeEnabled && (showCorrectAnswerToggle || teacherInstructions && hasText(teacherInstructions) || rationale && hasText(rationale) || feedback)) {
12240
12259
  return React$1.createElement(UiLayout, {
12241
12260
  extraCSSRules: extraCSSRules,
12261
+ id: id,
12242
12262
  __self: this,
12243
12263
  __source: {
12244
12264
  fileName: _jsxFileName,
12245
- lineNumber: 730
12265
+ lineNumber: 756
12246
12266
  }
12247
12267
  }, React$1.createElement(Tooltip, {
12248
12268
  interactive: true,
@@ -12255,14 +12275,14 @@ class Main extends React$1.Component {
12255
12275
  __self: this,
12256
12276
  __source: {
12257
12277
  fileName: _jsxFileName,
12258
- lineNumber: 739
12278
+ lineNumber: 765
12259
12279
  }
12260
12280
  }, React$1.createElement('div', {
12261
12281
  className: classes.main,
12262
12282
  __self: this,
12263
12283
  __source: {
12264
12284
  fileName: _jsxFileName,
12265
- lineNumber: 740
12285
+ lineNumber: 766
12266
12286
  }
12267
12287
  }, showCorrectAnswerToggle && React$1.createElement(CorrectAnswerToggle, {
12268
12288
  language: language,
@@ -12273,7 +12293,7 @@ class Main extends React$1.Component {
12273
12293
  __self: this,
12274
12294
  __source: {
12275
12295
  fileName: _jsxFileName,
12276
- lineNumber: 742
12296
+ lineNumber: 768
12277
12297
  }
12278
12298
  })), teacherInstructions && hasText(teacherInstructions) && React$1.createElement(Collapsible, {
12279
12299
  className: classes.collapsible,
@@ -12285,14 +12305,14 @@ class Main extends React$1.Component {
12285
12305
  __self: this,
12286
12306
  __source: {
12287
12307
  fileName: _jsxFileName,
12288
- lineNumber: 753
12308
+ lineNumber: 779
12289
12309
  }
12290
12310
  }, React$1.createElement(PreviewPrompt, {
12291
12311
  prompt: teacherInstructions,
12292
12312
  __self: this,
12293
12313
  __source: {
12294
12314
  fileName: _jsxFileName,
12295
- lineNumber: 761
12315
+ lineNumber: 787
12296
12316
  }
12297
12317
  })), displayNote && hasText(note) && React$1.createElement(Collapsible, {
12298
12318
  className: classes.collapsible,
@@ -12308,14 +12328,14 @@ class Main extends React$1.Component {
12308
12328
  __self: this,
12309
12329
  __source: {
12310
12330
  fileName: _jsxFileName,
12311
- lineNumber: 765
12331
+ lineNumber: 791
12312
12332
  }
12313
12333
  }, React$1.createElement(PreviewPrompt, {
12314
12334
  prompt: note,
12315
12335
  __self: this,
12316
12336
  __source: {
12317
12337
  fileName: _jsxFileName,
12318
- lineNumber: 773
12338
+ lineNumber: 799
12319
12339
  }
12320
12340
  })), rationale && hasText(rationale) && React$1.createElement(Collapsible, {
12321
12341
  className: classes.collapsible,
@@ -12327,14 +12347,14 @@ class Main extends React$1.Component {
12327
12347
  __self: this,
12328
12348
  __source: {
12329
12349
  fileName: _jsxFileName,
12330
- lineNumber: 778
12350
+ lineNumber: 804
12331
12351
  }
12332
12352
  }, React$1.createElement(PreviewPrompt, {
12333
12353
  prompt: rationale,
12334
12354
  __self: this,
12335
12355
  __source: {
12336
12356
  fileName: _jsxFileName,
12337
- lineNumber: 786
12357
+ lineNumber: 812
12338
12358
  }
12339
12359
  })), feedback && React$1.createElement(Feedback, {
12340
12360
  correctness: correctness.correctness,
@@ -12342,13 +12362,13 @@ class Main extends React$1.Component {
12342
12362
  __self: this,
12343
12363
  __source: {
12344
12364
  fileName: _jsxFileName,
12345
- lineNumber: 790
12365
+ lineNumber: 816
12346
12366
  }
12347
12367
  })),
12348
12368
  __self: this,
12349
12369
  __source: {
12350
12370
  fileName: _jsxFileName,
12351
- lineNumber: 731
12371
+ lineNumber: 757
12352
12372
  }
12353
12373
  }, React$1.createElement('div', {
12354
12374
  className: classes.mainContainer,
@@ -12356,11 +12376,12 @@ class Main extends React$1.Component {
12356
12376
  __self: this,
12357
12377
  __source: {
12358
12378
  fileName: _jsxFileName,
12359
- lineNumber: 794
12379
+ lineNumber: 820
12360
12380
  }
12361
12381
  }, midContent)));
12362
12382
  }
12363
12383
  return React$1.createElement(UiLayout, {
12384
+ id: id,
12364
12385
  extraCSSRules: extraCSSRules,
12365
12386
  className: classes.mainContainer,
12366
12387
  ref: r => {
@@ -12370,7 +12391,7 @@ class Main extends React$1.Component {
12370
12391
  __self: this,
12371
12392
  __source: {
12372
12393
  fileName: _jsxFileName,
12373
- lineNumber: 803
12394
+ lineNumber: 829
12374
12395
  }
12375
12396
  }, midContent);
12376
12397
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "repository": "pie-framework/pie-elements",
7
- "version": "8.4.1-next.7+313c6ad33",
7
+ "version": "8.4.2-next.0+222649200",
8
8
  "main": "lib/index.js",
9
9
  "description": "",
10
10
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "@material-ui/core": "^3.9.2",
15
15
  "@pie-framework/mathquill": "^1.1.3",
16
16
  "@pie-framework/pie-player-events": "^0.1.0",
17
- "@pie-lib/pie-toolbox": "2.8.0",
17
+ "@pie-lib/pie-toolbox": "2.9.0",
18
18
  "classnames": "^2.2.5",
19
19
  "debug": "^4.1.1",
20
20
  "lodash": "^4.17.10",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "author": "",
26
26
  "license": "ISC",
27
- "gitHead": "313c6ad337831e7960342ce6aaa26bb36233c7bb",
27
+ "gitHead": "22264920035c004ecee9a90c99eb2863e3ce6c60",
28
28
  "module": "src/index.js",
29
29
  "exports": {
30
30
  ".": "./src/index.js",