@pie-element/ebsr 10.3.3-next.0 → 10.3.3-next.10

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.
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.1.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_lodash, _dll_react_dom} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.2.0/module/index.js";
2
2
  import MultipleChoiceConfigure from '@pie-element/multiple-choice/configure/lib';
3
3
  import {_dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@5.8.1/module/index.js";
4
4
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.1.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.2.0/module/index.js";
2
2
  import {_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";
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) {
@@ -12842,26 +12842,45 @@ class MultipleChoice$1 extends React$2.Component {
12842
12842
  lineNumber: 245
12843
12843
  }
12844
12844
  });
12845
+ const getMultipleChoiceMinSelectionErrorMessage = () => {
12846
+ if (minSelections && maxSelections) {
12847
+ return minSelections === maxSelections ? translator.t('translation:multipleChoice:minmaxSelections_equal', {
12848
+ lng: language,
12849
+ minSelections
12850
+ }) : translator.t('translation:multipleChoice:minmaxSelections_range', {
12851
+ lng: language,
12852
+ minSelections,
12853
+ maxSelections
12854
+ });
12855
+ }
12856
+ if (minSelections) {
12857
+ return translator.t('translation:multipleChoice:minSelections', {
12858
+ lng: language,
12859
+ minSelections
12860
+ });
12861
+ }
12862
+ return '';
12863
+ };
12845
12864
  return React$2.createElement('div', {
12846
12865
  className: classNames(classes.main, className, 'multiple-choice'),
12847
12866
  __self: this,
12848
12867
  __source: {
12849
12868
  fileName: _jsxFileName$1,
12850
- lineNumber: 254
12869
+ lineNumber: 268
12851
12870
  }
12852
12871
  }, partLabel && React$2.createElement('h3', {
12853
12872
  className: classes.partLabel,
12854
12873
  __self: this,
12855
12874
  __source: {
12856
12875
  fileName: _jsxFileName$1,
12857
- lineNumber: 255
12876
+ lineNumber: 269
12858
12877
  }
12859
12878
  }, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
12860
12879
  className: classes.teacherInstructions,
12861
12880
  __self: this,
12862
12881
  __source: {
12863
12882
  fileName: _jsxFileName$1,
12864
- lineNumber: 260
12883
+ lineNumber: 274
12865
12884
  }
12866
12885
  }, !animationsDisabled ? React$2.createElement(Collapsible, {
12867
12886
  labels: {
@@ -12871,14 +12890,14 @@ class MultipleChoice$1 extends React$2.Component {
12871
12890
  __self: this,
12872
12891
  __source: {
12873
12892
  fileName: _jsxFileName$1,
12874
- lineNumber: 262
12893
+ lineNumber: 276
12875
12894
  }
12876
12895
  }, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
12877
12896
  className: classes.fieldset,
12878
12897
  __self: this,
12879
12898
  __source: {
12880
12899
  fileName: _jsxFileName$1,
12881
- lineNumber: 276
12900
+ lineNumber: 290
12882
12901
  }
12883
12902
  }, React$2.createElement(PreviewPrompt, {
12884
12903
  className: "prompt",
@@ -12889,7 +12908,7 @@ class MultipleChoice$1 extends React$2.Component {
12889
12908
  __self: this,
12890
12909
  __source: {
12891
12910
  fileName: _jsxFileName$1,
12892
- lineNumber: 277
12911
+ lineNumber: 291
12893
12912
  }
12894
12913
  }), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
12895
12914
  show: showCorrectAnswerToggle,
@@ -12899,7 +12918,7 @@ class MultipleChoice$1 extends React$2.Component {
12899
12918
  __self: this,
12900
12919
  __source: {
12901
12920
  fileName: _jsxFileName$1,
12902
- lineNumber: 286
12921
+ lineNumber: 300
12903
12922
  }
12904
12923
  }), React$2.createElement('div', {
12905
12924
  className: classNames({
@@ -12910,7 +12929,7 @@ class MultipleChoice$1 extends React$2.Component {
12910
12929
  __self: this,
12911
12930
  __source: {
12912
12931
  fileName: _jsxFileName$1,
12913
- lineNumber: 294
12932
+ lineNumber: 308
12914
12933
  }
12915
12934
  }, choices.map((choice, index) => React$2.createElement(StyledChoice, {
12916
12935
  choicesLayout: this.props.choicesLayout,
@@ -12933,24 +12952,21 @@ class MultipleChoice$1 extends React$2.Component {
12933
12952
  __self: this,
12934
12953
  __source: {
12935
12954
  fileName: _jsxFileName$1,
12936
- lineNumber: 302
12955
+ lineNumber: 316
12937
12956
  }
12938
12957
  })))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
12939
12958
  className: classes.errorText,
12940
12959
  __self: this,
12941
12960
  __source: {
12942
12961
  fileName: _jsxFileName$1,
12943
- lineNumber: 326
12962
+ lineNumber: 340
12944
12963
  }
12945
- }, translator.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
12946
- lng: language,
12947
- minSelections
12948
- })), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12964
+ }, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12949
12965
  className: classes.errorText,
12950
12966
  __self: this,
12951
12967
  __source: {
12952
12968
  fileName: _jsxFileName$1,
12953
- lineNumber: 334
12969
+ lineNumber: 345
12954
12970
  }
12955
12971
  }, translator.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
12956
12972
  lng: language,
@@ -13069,7 +13085,8 @@ const debug$1 = _dll_debug;
13069
13085
  const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering;
13070
13086
  const log$1 = debug$1('pie-ui:multiple-choice');
13071
13087
  const isComplete = (session, model, audioComplete) => {
13072
- if (model.autoplayAudioEnabled && !audioComplete) {
13088
+ const {autoplayAudioEnabled, completeAudioEnabled} = model || ({});
13089
+ if (autoplayAudioEnabled && completeAudioEnabled && !audioComplete) {
13073
13090
  return false;
13074
13091
  }
13075
13092
  if (!session || !session.value) {
@@ -13185,12 +13202,12 @@ class MultipleChoice extends HTMLElement {
13185
13202
  }
13186
13203
  document.removeEventListener('click', enableAudio);
13187
13204
  };
13188
- if (audio.paused && !this.querySelector('#play-audio-info')) {
13189
- this.appendChild(info);
13190
- document.addEventListener('click', enableAudio);
13191
- } else {
13192
- document.removeEventListener('click', enableAudio);
13193
- }
13205
+ setTimeout(() => {
13206
+ if (audio.paused && !this.querySelector('#play-audio-info')) {
13207
+ this.appendChild(info);
13208
+ document.addEventListener('click', enableAudio);
13209
+ }
13210
+ }, 500);
13194
13211
  const handlePlaying = () => {
13195
13212
  const info = this.querySelector('#play-audio-info');
13196
13213
  if (info) {
@@ -4,7 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "3.1.1"
7
+ "version": "3.2.0"
8
8
  },
9
9
  {
10
10
  "name": "@pie-lib/pie-toolbox-module",
package/module/print.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.1.1/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_lodash, _dll_debug, _dll_pie_lib__pie_toolbox_math_rendering} from "../../../@pie-lib/pie-toolbox-math-rendering-module@3.2.0/module/index.js";
2
2
  import {_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";
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) {
@@ -12805,26 +12805,45 @@ class MultipleChoice$1 extends React$2.Component {
12805
12805
  lineNumber: 245
12806
12806
  }
12807
12807
  });
12808
+ const getMultipleChoiceMinSelectionErrorMessage = () => {
12809
+ if (minSelections && maxSelections) {
12810
+ return minSelections === maxSelections ? translator$1.t('translation:multipleChoice:minmaxSelections_equal', {
12811
+ lng: language,
12812
+ minSelections
12813
+ }) : translator$1.t('translation:multipleChoice:minmaxSelections_range', {
12814
+ lng: language,
12815
+ minSelections,
12816
+ maxSelections
12817
+ });
12818
+ }
12819
+ if (minSelections) {
12820
+ return translator$1.t('translation:multipleChoice:minSelections', {
12821
+ lng: language,
12822
+ minSelections
12823
+ });
12824
+ }
12825
+ return '';
12826
+ };
12808
12827
  return React$2.createElement('div', {
12809
12828
  className: classNames(classes.main, className, 'multiple-choice'),
12810
12829
  __self: this,
12811
12830
  __source: {
12812
12831
  fileName: _jsxFileName$1,
12813
- lineNumber: 254
12832
+ lineNumber: 268
12814
12833
  }
12815
12834
  }, partLabel && React$2.createElement('h3', {
12816
12835
  className: classes.partLabel,
12817
12836
  __self: this,
12818
12837
  __source: {
12819
12838
  fileName: _jsxFileName$1,
12820
- lineNumber: 255
12839
+ lineNumber: 269
12821
12840
  }
12822
12841
  }, partLabel), this.renderHeading(), teacherInstructions && React$2.createElement('div', {
12823
12842
  className: classes.teacherInstructions,
12824
12843
  __self: this,
12825
12844
  __source: {
12826
12845
  fileName: _jsxFileName$1,
12827
- lineNumber: 260
12846
+ lineNumber: 274
12828
12847
  }
12829
12848
  }, !animationsDisabled ? React$2.createElement(Collapsible, {
12830
12849
  labels: {
@@ -12834,14 +12853,14 @@ class MultipleChoice$1 extends React$2.Component {
12834
12853
  __self: this,
12835
12854
  __source: {
12836
12855
  fileName: _jsxFileName$1,
12837
- lineNumber: 262
12856
+ lineNumber: 276
12838
12857
  }
12839
12858
  }, teacherInstructionsDiv) : teacherInstructionsDiv), React$2.createElement('fieldset', {
12840
12859
  className: classes.fieldset,
12841
12860
  __self: this,
12842
12861
  __source: {
12843
12862
  fileName: _jsxFileName$1,
12844
- lineNumber: 276
12863
+ lineNumber: 290
12845
12864
  }
12846
12865
  }, React$2.createElement(PreviewPrompt, {
12847
12866
  className: "prompt",
@@ -12852,7 +12871,7 @@ class MultipleChoice$1 extends React$2.Component {
12852
12871
  __self: this,
12853
12872
  __source: {
12854
12873
  fileName: _jsxFileName$1,
12855
- lineNumber: 277
12874
+ lineNumber: 291
12856
12875
  }
12857
12876
  }), !alwaysShowCorrect && React$2.createElement(CorrectAnswerToggle, {
12858
12877
  show: showCorrectAnswerToggle,
@@ -12862,7 +12881,7 @@ class MultipleChoice$1 extends React$2.Component {
12862
12881
  __self: this,
12863
12882
  __source: {
12864
12883
  fileName: _jsxFileName$1,
12865
- lineNumber: 286
12884
+ lineNumber: 300
12866
12885
  }
12867
12886
  }), React$2.createElement('div', {
12868
12887
  className: classNames({
@@ -12873,7 +12892,7 @@ class MultipleChoice$1 extends React$2.Component {
12873
12892
  __self: this,
12874
12893
  __source: {
12875
12894
  fileName: _jsxFileName$1,
12876
- lineNumber: 294
12895
+ lineNumber: 308
12877
12896
  }
12878
12897
  }, choices.map((choice, index) => React$2.createElement(StyledChoice, {
12879
12898
  choicesLayout: this.props.choicesLayout,
@@ -12896,24 +12915,21 @@ class MultipleChoice$1 extends React$2.Component {
12896
12915
  __self: this,
12897
12916
  __source: {
12898
12917
  fileName: _jsxFileName$1,
12899
- lineNumber: 302
12918
+ lineNumber: 316
12900
12919
  }
12901
12920
  })))), choiceMode === 'checkbox' && selections < minSelections && React$2.createElement('div', {
12902
12921
  className: classes.errorText,
12903
12922
  __self: this,
12904
12923
  __source: {
12905
12924
  fileName: _jsxFileName$1,
12906
- lineNumber: 326
12925
+ lineNumber: 340
12907
12926
  }
12908
- }, translator$1.t(`translation:multipleChoice:minSelections_${minSelections === 1 ? 'one' : 'other'}`, {
12909
- lng: language,
12910
- minSelections
12911
- })), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12927
+ }, getMultipleChoiceMinSelectionErrorMessage()), choiceMode === 'checkbox' && maxSelectionsErrorState && React$2.createElement('div', {
12912
12928
  className: classes.errorText,
12913
12929
  __self: this,
12914
12930
  __source: {
12915
12931
  fileName: _jsxFileName$1,
12916
- lineNumber: 334
12932
+ lineNumber: 345
12917
12933
  }
12918
12934
  }, translator$1.t(`translation:multipleChoice:maxSelections_${maxSelections === 1 ? 'one' : 'other'}`, {
12919
12935
  lng: language,
@@ -13069,7 +13085,8 @@ const debug$1 = _dll_debug;
13069
13085
  const {renderMath: renderMath} = _dll_pie_lib__pie_toolbox_math_rendering;
13070
13086
  const log$1 = debug$1('pie-ui:multiple-choice');
13071
13087
  const isComplete = (session, model, audioComplete) => {
13072
- if (model.autoplayAudioEnabled && !audioComplete) {
13088
+ const {autoplayAudioEnabled, completeAudioEnabled} = model || ({});
13089
+ if (autoplayAudioEnabled && completeAudioEnabled && !audioComplete) {
13073
13090
  return false;
13074
13091
  }
13075
13092
  if (!session || !session.value) {
@@ -13185,12 +13202,12 @@ class MultipleChoice extends HTMLElement {
13185
13202
  }
13186
13203
  document.removeEventListener('click', enableAudio);
13187
13204
  };
13188
- if (audio.paused && !this.querySelector('#play-audio-info')) {
13189
- this.appendChild(info);
13190
- document.addEventListener('click', enableAudio);
13191
- } else {
13192
- document.removeEventListener('click', enableAudio);
13193
- }
13205
+ setTimeout(() => {
13206
+ if (audio.paused && !this.querySelector('#play-audio-info')) {
13207
+ this.appendChild(info);
13208
+ document.addEventListener('click', enableAudio);
13209
+ }
13210
+ }, 500);
13194
13211
  const handlePlaying = () => {
13195
13212
  const info = this.querySelector('#play-audio-info');
13196
13213
  if (info) {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@pie-element/ebsr",
3
- "version": "10.3.3-next.0+05d92c29d",
3
+ "version": "10.3.3-next.10+94407182a",
4
4
  "description": "",
5
5
  "repository": "pie-framework/pie-elements",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-element/multiple-choice": "^9.9.2-next.0+05d92c29d",
10
+ "@pie-element/multiple-choice": "^9.9.2-next.10+94407182a",
11
11
  "@pie-framework/pie-player-events": "^0.1.0",
12
12
  "@pie-lib/pie-toolbox": "2.8.0",
13
13
  "classnames": "^2.2.5",
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "author": "pie framework developers",
18
18
  "license": "ISC",
19
- "gitHead": "05d92c29de17495a5cf359fe895ac379b457ca3f",
19
+ "gitHead": "94407182a972d67e212e1fe33570a73ff00d14c6",
20
20
  "scripts": {
21
21
  "postpublish": "../../scripts/postpublish"
22
22
  },