@pie-element/complex-rubric 2.19.6-next.0 → 2.19.6-next.7

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.
@@ -7,7 +7,7 @@
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
9
  "dependencies": {
10
- "@pie-lib/pie-toolbox": "1.32.0",
10
+ "@pie-lib/pie-toolbox": "1.32.1",
11
11
  "lodash": "^4.17.15"
12
12
  },
13
13
  "author": "",
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.24.4/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_classnames, _dll_react_dom, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.25.0/module/index.js";
2
2
  import RubricConfigure from '@pie-element/rubric/configure/lib';
3
3
  import {_dll_pie_lib__pie_toolbox_editable_html, _dll_pie_lib__pie_toolbox_render_ui, _dll_pie_lib__pie_toolbox_config_ui} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
4
4
  function _mergeNamespaces(n, m) {
@@ -135912,6 +135912,11 @@ const require$$24 = _dll_pie_framework__mathquill;
135912
135912
  var _this;
135913
135913
  (0, _classCallCheck2["default"])(this, KeyPad);
135914
135914
  _this = _super.call(this, props);
135915
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeypadInteraction", function () {
135916
+ if (_this.props.setKeypadInteraction) {
135917
+ _this.props.setKeypadInteraction(true);
135918
+ }
135919
+ });
135915
135920
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "buttonClick", function (key) {
135916
135921
  log('[buttonClick]', key);
135917
135922
  var onPress = _this.props.onPress;
@@ -135934,9 +135939,10 @@ const require$$24 = _dll_pie_framework__mathquill;
135934
135939
  (0, _createClass2["default"])(KeyPad, [{
135935
135940
  key: "componentDidMount",
135936
135941
  value: function componentDidMount() {
135937
- var _this$keypadRef, _this$keypadRef$curre, _this$keypadRef2, _this$keypadRef2$curr;
135938
- var mainContainer = (_this$keypadRef = this.keypadRef) === null || _this$keypadRef === void 0 ? void 0 : (_this$keypadRef$curre = _this$keypadRef.current) === null || _this$keypadRef$curre === void 0 ? void 0 : _this$keypadRef$curre.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
135939
- var currentToolbar = (_this$keypadRef2 = this.keypadRef) === null || _this$keypadRef2 === void 0 ? void 0 : (_this$keypadRef2$curr = _this$keypadRef2.current) === null || _this$keypadRef2$curr === void 0 ? void 0 : _this$keypadRef2$curr.closest('.pie-toolbar');
135942
+ var _this$keypadRef;
135943
+ var keyPadElement = (_this$keypadRef = this.keypadRef) === null || _this$keypadRef === void 0 ? void 0 : _this$keypadRef.current;
135944
+ var mainContainer = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
135945
+ var currentToolbar = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest('.pie-toolbar');
135940
135946
  if (this.props.controlledKeypadMode && mainContainer && currentToolbar) {
135941
135947
  var mainContainerPosition = mainContainer.getBoundingClientRect();
135942
135948
  var currentToolbarPosition = currentToolbar.getBoundingClientRect();
@@ -135948,16 +135954,26 @@ const require$$24 = _dll_pie_framework__mathquill;
135948
135954
  }
135949
135955
  }
135950
135956
  }
135957
+ if (keyPadElement) {
135958
+ keyPadElement.addEventListener('touchstart', this.handleKeypadInteraction, true);
135959
+ keyPadElement.addEventListener('mousedown', this.handleKeypadInteraction, true);
135960
+ }
135951
135961
  }
135952
135962
  }, {
135953
135963
  key: "componentWillUnmount",
135954
135964
  value: function componentWillUnmount() {
135955
- if (this.props.controlledKeypadMode && this.keypadRef && this.keypadRef.current) {
135956
- var mainContainer = this.keypadRef.current.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
135965
+ var _this$keypadRef2;
135966
+ var keyPadElement = (_this$keypadRef2 = this.keypadRef) === null || _this$keypadRef2 === void 0 ? void 0 : _this$keypadRef2.current;
135967
+ if (this.props.controlledKeypadMode && keyPadElement) {
135968
+ var mainContainer = keyPadElement.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
135957
135969
  if (mainContainer) {
135958
135970
  mainContainer.style.height = 'unset';
135959
135971
  }
135960
135972
  }
135973
+ if (keyPadElement) {
135974
+ keyPadElement.removeEventListener('touchstart', this.handleKeypadInteraction, true);
135975
+ keyPadElement.addEventListener('mousedown', this.handleKeypadInteraction, true);
135976
+ }
135961
135977
  }
135962
135978
  }, {
135963
135979
  key: "render",
@@ -136030,6 +136046,7 @@ const require$$24 = _dll_pie_framework__mathquill;
136030
136046
  onPress: _propTypes["default"].func.isRequired,
136031
136047
  onFocus: _propTypes["default"].func,
136032
136048
  noDecimal: _propTypes["default"].bool,
136049
+ setKeypadInteraction: _propTypes["default"].func,
136033
136050
  mode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
136034
136051
  });
136035
136052
  (0, _defineProperty2["default"])(KeyPad, "defaultProps", {
@@ -136194,7 +136211,7 @@ const require$$9$y = _dll_prop_types;
136194
136211
  (0, _createClass2["default"])(HorizontalKeypad, [{
136195
136212
  key: "render",
136196
136213
  value: function render() {
136197
- var _this$props = this.props, mode = _this$props.mode, onFocus = _this$props.onFocus, controlledKeypadMode = _this$props.controlledKeypadMode, noDecimal = _this$props.noDecimal, className = _this$props.className, additionalKeys = _this$props.additionalKeys, layoutForKeyPad = _this$props.layoutForKeyPad;
136214
+ var _this$props = this.props, mode = _this$props.mode, onFocus = _this$props.onFocus, controlledKeypadMode = _this$props.controlledKeypadMode, noDecimal = _this$props.noDecimal, className = _this$props.className, additionalKeys = _this$props.additionalKeys, layoutForKeyPad = _this$props.layoutForKeyPad, setKeypadInteraction = _this$props.setKeypadInteraction;
136198
136215
  var normalizedKeys = (0, _grades.normalizeAdditionalKeys)(additionalKeys);
136199
136216
  return _react["default"].createElement(_keypad["default"], {
136200
136217
  className: className,
@@ -136204,7 +136221,8 @@ const require$$9$y = _dll_prop_types;
136204
136221
  layoutForKeyPad: layoutForKeyPad,
136205
136222
  additionalKeys: (0, _utils.extendKeySet)((0, _grades.keysForGrade)(mode), normalizedKeys),
136206
136223
  onPress: this.keypadPress,
136207
- mode: mode
136224
+ mode: mode,
136225
+ setKeypadInteraction: setKeypadInteraction
136208
136226
  });
136209
136227
  }
136210
136228
  }]);
@@ -136219,7 +136237,8 @@ const require$$9$y = _dll_prop_types;
136219
136237
  onClick: _propTypes["default"].func.isRequired,
136220
136238
  onFocus: _propTypes["default"].func,
136221
136239
  noDecimal: _propTypes["default"].bool,
136222
- additionalKeys: _propTypes["default"].array
136240
+ additionalKeys: _propTypes["default"].array,
136241
+ setKeypadInteraction: _propTypes["default"].func
136223
136242
  });
136224
136243
  (0, _defineProperty2["default"])(HorizontalKeypad, "defaultProps", {
136225
136244
  mode: 'scientific',
@@ -136545,7 +136564,7 @@ const {isEqual: require$$18$3} = _dll_lodash;
136545
136564
  key: "render",
136546
136565
  value: function render() {
136547
136566
  var _this2 = this;
136548
- var _this$props3 = this.props, classNames = _this$props3.classNames, keypadMode = _this$props3.keypadMode, allowAnswerBlock = _this$props3.allowAnswerBlock, additionalKeys = _this$props3.additionalKeys, controlledKeypad = _this$props3.controlledKeypad, controlledKeypadMode = _this$props3.controlledKeypadMode, showKeypad = _this$props3.showKeypad, noDecimal = _this$props3.noDecimal, hideInput = _this$props3.hideInput, layoutForKeyPad = _this$props3.layoutForKeyPad, latex = _this$props3.latex, _onFocus = _this$props3.onFocus, _onBlur = _this$props3.onBlur, classes = _this$props3.classes, error = _this$props3.error;
136567
+ var _this$props3 = this.props, classNames = _this$props3.classNames, keypadMode = _this$props3.keypadMode, allowAnswerBlock = _this$props3.allowAnswerBlock, additionalKeys = _this$props3.additionalKeys, controlledKeypad = _this$props3.controlledKeypad, controlledKeypadMode = _this$props3.controlledKeypadMode, showKeypad = _this$props3.showKeypad, setKeypadInteraction = _this$props3.setKeypadInteraction, noDecimal = _this$props3.noDecimal, hideInput = _this$props3.hideInput, layoutForKeyPad = _this$props3.layoutForKeyPad, latex = _this$props3.latex, _onFocus = _this$props3.onFocus, _onBlur = _this$props3.onBlur, classes = _this$props3.classes, error = _this$props3.error;
136549
136568
  var shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
136550
136569
  var addDisabled = this.state.addDisabled;
136551
136570
  log('[render]', latex);
@@ -136618,7 +136637,8 @@ const {isEqual: require$$18$3} = _dll_lodash;
136618
136637
  additionalKeys: additionalKeys,
136619
136638
  mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
136620
136639
  onClick: this.onClick,
136621
- noDecimal: noDecimal
136640
+ noDecimal: noDecimal,
136641
+ setKeypadInteraction: setKeypadInteraction
136622
136642
  }));
136623
136643
  }
136624
136644
  }]);
@@ -136645,7 +136665,8 @@ const {isEqual: require$$18$3} = _dll_lodash;
136645
136665
  onFocus: _propTypes["default"].func,
136646
136666
  onBlur: _propTypes["default"].func,
136647
136667
  onChange: _propTypes["default"].func.isRequired,
136648
- classes: _propTypes["default"].object
136668
+ classes: _propTypes["default"].object,
136669
+ setKeypadInteraction: _propTypes["default"].func
136649
136670
  });
136650
136671
  var styles = function styles(theme) {
136651
136672
  return {
@@ -137339,7 +137360,7 @@ const require$$10$w = _dll_classnames;
137339
137360
  key: "render",
137340
137361
  value: function render() {
137341
137362
  var latex = this.state.latex;
137342
- var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, maxResponseAreas = _this$props.maxResponseAreas;
137363
+ var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, setKeypadInteraction = _this$props.setKeypadInteraction, maxResponseAreas = _this$props.maxResponseAreas;
137343
137364
  return _react["default"].createElement(PureToolbar, {
137344
137365
  autoFocus: autoFocus,
137345
137366
  classNames: classNames,
@@ -137350,6 +137371,7 @@ const require$$10$w = _dll_classnames;
137350
137371
  noDecimal: noDecimal,
137351
137372
  keypadMode: keypadMode,
137352
137373
  keyPadCharacterRef: keyPadCharacterRef,
137374
+ setKeypadInteraction: setKeypadInteraction,
137353
137375
  onChange: this.onChange,
137354
137376
  onDone: this.done,
137355
137377
  onFocus: onFocus,
@@ -137384,7 +137406,9 @@ const require$$10$w = _dll_classnames;
137384
137406
  onDone: _propTypes["default"].func.isRequired,
137385
137407
  onFocus: _propTypes["default"].func,
137386
137408
  onBlur: _propTypes["default"].func,
137387
- hideDoneButton: _propTypes["default"].bool
137409
+ hideDoneButton: _propTypes["default"].bool,
137410
+ keyPadCharacterRef: _propTypes["default"].func,
137411
+ setKeypadInteraction: _propTypes["default"].func
137388
137412
  });
137389
137413
  (0, _defineProperty2["default"])(MathToolbar, "defaultProps", {
137390
137414
  classNames: {},
@@ -137411,7 +137435,7 @@ const require$$10$w = _dll_classnames;
137411
137435
  (0, _createClass2["default"])(RawPureToolbar, [{
137412
137436
  key: "render",
137413
137437
  value: function render() {
137414
- var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
137438
+ var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, setKeypadInteraction = _this$props2.setKeypadInteraction, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
137415
137439
  return _react["default"].createElement("div", {
137416
137440
  className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar),
137417
137441
  ref: keyPadCharacterRef
@@ -137434,7 +137458,8 @@ const require$$10$w = _dll_classnames;
137434
137458
  onFocus: onFocus,
137435
137459
  onBlur: onBlur,
137436
137460
  error: error,
137437
- maxResponseAreas: maxResponseAreas
137461
+ maxResponseAreas: maxResponseAreas,
137462
+ setKeypadInteraction: setKeypadInteraction
137438
137463
  }), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && _react["default"].createElement(_doneButton.DoneButton, {
137439
137464
  hideBackground: hideDoneButtonBackground,
137440
137465
  onClick: onDone
@@ -137467,7 +137492,9 @@ const require$$10$w = _dll_classnames;
137467
137492
  hideDoneButton: _propTypes["default"].bool,
137468
137493
  hideDoneButtonBackground: _propTypes["default"].bool,
137469
137494
  error: _propTypes["default"].any,
137470
- maxResponseAreas: _propTypes["default"].number
137495
+ maxResponseAreas: _propTypes["default"].number,
137496
+ keyPadCharacterRef: _propTypes["default"].func,
137497
+ setKeypadInteraction: _propTypes["default"].func
137471
137498
  });
137472
137499
  (0, _defineProperty2["default"])(RawPureToolbar, "defaultProps", {
137473
137500
  classNames: {},
@@ -141069,7 +141096,8 @@ var RawDoneButton = function RawDoneButton(_ref) {
141069
141096
  doneButton.RawDoneButton = RawDoneButton;
141070
141097
  RawDoneButton.propTypes = {
141071
141098
  classes: _propTypes$16["default"].object.isRequired,
141072
- onClick: _propTypes$16["default"].func
141099
+ onClick: _propTypes$16["default"].func,
141100
+ doneButtonRef: _propTypes$16["default"].func
141073
141101
  };
141074
141102
  var styles$Y = {
141075
141103
  iconRoot: {
@@ -141227,7 +141255,8 @@ const require$$10$q = _dll_debug;
141227
141255
  onChange: _propTypes["default"].func,
141228
141256
  onClick: _propTypes["default"].func,
141229
141257
  type: _propTypes["default"].string,
141230
- value: _propTypes["default"].object
141258
+ value: _propTypes["default"].object,
141259
+ ariaLabel: _propTypes["default"].string
141231
141260
  };
141232
141261
  var isActiveToolbarPlugin = function isActiveToolbarPlugin(props) {
141233
141262
  return function (plugin) {
@@ -141284,7 +141313,11 @@ const require$$10$q = _dll_debug;
141284
141313
  onDone: _propTypes["default"].func.isRequired,
141285
141314
  showDone: _propTypes["default"].bool,
141286
141315
  addArea: _propTypes["default"].bool,
141287
- deletable: _propTypes["default"].bool
141316
+ deletable: _propTypes["default"].bool,
141317
+ isHtmlMode: _propTypes["default"].bool,
141318
+ doneButtonRef: _propTypes["default"].func,
141319
+ onBlur: _propTypes["default"].func,
141320
+ onFocus: _propTypes["default"].func
141288
141321
  };
141289
141322
  DefaultToolbar.defaultProps = {
141290
141323
  pluginProps: {}
@@ -148093,6 +148126,7 @@ const require$$11$l = _dll_prop_types;
148093
148126
  };
148094
148127
  var el = _react["default"].createElement(_mathToolbar.PureToolbar, {
148095
148128
  keyPadCharacterRef: opts.keyPadCharacterRef,
148129
+ setKeypadInteraction: opts.setKeypadInteraction,
148096
148130
  autoFocus: true,
148097
148131
  noDecimal: true,
148098
148132
  hideInput: true,
@@ -148532,7 +148566,10 @@ const {debounce: require$$16$2} = _dll_lodash;
148532
148566
  ref: _propTypes["default"].func,
148533
148567
  showDone: _propTypes["default"].bool
148534
148568
  }),
148535
- onDataChange: _propTypes["default"].func
148569
+ onDataChange: _propTypes["default"].func,
148570
+ doneButtonRef: _propTypes["default"].func,
148571
+ onBlur: _propTypes["default"].func,
148572
+ onFocus: _propTypes["default"].func
148536
148573
  });
148537
148574
  var style = {
148538
148575
  toolbar: {
@@ -148717,7 +148754,8 @@ const require$$13$5 = _dll_prop_types;
148717
148754
  }),
148718
148755
  focusToolbar: _propTypes["default"].bool.isRequired,
148719
148756
  onToolbarFocus: _propTypes["default"].func.isRequired,
148720
- onToolbarBlur: _propTypes["default"].func.isRequired
148757
+ onToolbarBlur: _propTypes["default"].func.isRequired,
148758
+ doneButtonRef: _propTypes["default"].func
148721
148759
  });
148722
148760
  var style = function style(theme) {
148723
148761
  return {
@@ -149370,7 +149408,8 @@ var buildPlugins = function buildPlugins(activePlugins, customPlugins, opts) {
149370
149408
  var respAreaPlugin = opts.responseArea && opts.responseArea.type && (0, _respArea["default"])(opts.responseArea, (0, _compact["default"])([mathPlugin]));
149371
149409
  var languageCharactersPlugins = ((opts === null || opts === void 0 ? void 0 : opts.languageCharacters) || []).map(function (config) {
149372
149410
  return (0, _characters["default"])(_objectSpread$4(_objectSpread$4({}, config), {}, {
149373
- keyPadCharacterRef: opts.keyPadCharacterRef
149411
+ keyPadCharacterRef: opts.keyPadCharacterRef,
149412
+ setKeypadInteraction: opts.setKeypadInteraction
149374
149413
  }));
149375
149414
  });
149376
149415
  var tablePlugins = [imagePlugin, mathPlugin, respAreaPlugin].concat((0, _toConsumableArray2$2["default"])(languageCharactersPlugins));
@@ -157812,6 +157851,11 @@ const require$$23 = _dll_classnames;
157812
157851
  var _this;
157813
157852
  (0, _classCallCheck2["default"])(this, Editor);
157814
157853
  _this = _super.call(this, _props);
157854
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setKeypadInteraction", function (interacted) {
157855
+ _this.setState({
157856
+ keypadInteractionDetected: interacted
157857
+ });
157858
+ });
157815
157859
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDialog", function (open) {
157816
157860
  var extraDialogProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
157817
157861
  var callback = arguments.length > 2 ? arguments[2] : undefined;
@@ -157956,6 +158000,7 @@ const require$$23 = _dll_classnames;
157956
158000
  },
157957
158001
  languageCharacters: props.languageCharactersProps,
157958
158002
  keyPadCharacterRef: _this.keyPadCharacterRef,
158003
+ setKeypadInteraction: _this.setKeypadInteraction,
157959
158004
  media: {
157960
158005
  focus: _this.focus,
157961
158006
  createChange: function createChange() {
@@ -158091,13 +158136,12 @@ const require$$23 = _dll_classnames;
158091
158136
  }
158092
158137
  });
158093
158138
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
158094
- var _this$keyPadCharacter;
158095
158139
  log('[onBlur]');
158096
158140
  var relatedTarget = event.relatedTarget;
158097
158141
  var toolbarElement = _this.toolbarRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]")));
158142
+ var keypadInteractionDetected = _this.state.keypadInteractionDetected;
158098
158143
  var isRawDoneButton = _this.doneButtonRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.doneButtonRef.className, "\"]")));
158099
- var isKeyPadCharacterButton = _this.keyPadCharacterRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat((_this$keyPadCharacter = _this.keyPadCharacterRef.current) === null || _this$keyPadCharacter === void 0 ? void 0 : _this$keyPadCharacter.className, "\"]")));
158100
- _this.skipBlurHandling = isKeyPadCharacterButton ? true : false;
158144
+ _this.skipBlurHandling = keypadInteractionDetected ? true : false;
158101
158145
  if (toolbarElement && !isRawDoneButton) {
158102
158146
  _this.setState({
158103
158147
  focusToolbar: true
@@ -158118,10 +158162,13 @@ const require$$23 = _dll_classnames;
158118
158162
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDomBlur", function (e) {
158119
158163
  var editorDOM = document.querySelector(("[data-key=\"").concat(_this.state.value.document.key, "\"]"));
158120
158164
  setTimeout(function () {
158121
- var stateValue = _this.state.value;
158165
+ var _this$state2 = _this.state, stateValue = _this$state2.value, keypadInteractionDetected = _this$state2.keypadInteractionDetected;
158122
158166
  if (!_this.wrapperRef) {
158123
158167
  return;
158124
158168
  }
158169
+ if (keypadInteractionDetected) {
158170
+ _this.setKeypadInteraction(false);
158171
+ }
158125
158172
  var editorElement = !editorDOM || document.activeElement.closest(("[class*=\"").concat(editorDOM.className, "\"]"));
158126
158173
  var toolbarElement = !_this.toolbarRef || document.activeElement.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]"));
158127
158174
  var isInCurrentComponent = _this.wrapperRef.contains(editorElement) || _this.wrapperRef.contains(toolbarElement);
@@ -158135,8 +158182,14 @@ const require$$23 = _dll_classnames;
158135
158182
  });
158136
158183
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function (event, change) {
158137
158184
  return new Promise(function (resolve) {
158185
+ var _navigator;
158138
158186
  var editorDOM = document.querySelector(("[data-key=\"").concat(_this.state.value.document.key, "\"]"));
158187
+ var isTouchDevice = typeof window !== 'undefined' && (('ontouchstart' in window) || ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.maxTouchPoints) > 0);
158188
+ var keypadInteractionDetected = _this.state.keypadInteractionDetected;
158139
158189
  log('[onFocus]', document.activeElement);
158190
+ if (keypadInteractionDetected && _this.__TEMPORARY_CHANGE_DATA) {
158191
+ _this.__TEMPORARY_CHANGE_DATA = null;
158192
+ }
158140
158193
  if (_this.__TEMPORARY_CHANGE_DATA) {
158141
158194
  var _this$__TEMPORARY_CHA = _this.__TEMPORARY_CHANGE_DATA, key = _this$__TEMPORARY_CHA.key, data = _this$__TEMPORARY_CHA.data;
158142
158195
  var domEl = document.querySelector(("[data-key=\"").concat(key, "\"]"));
@@ -158157,7 +158210,7 @@ const require$$23 = _dll_classnames;
158157
158210
  }
158158
158211
  _this.stashValue();
158159
158212
  _this.props.onFocus();
158160
- if (!_this.isRelatedTargetButton(event)) {
158213
+ if (!_this.isRelatedTargetButton(event) && !isTouchDevice) {
158161
158214
  change === null || change === void 0 ? void 0 : change.focus();
158162
158215
  }
158163
158216
  resolve();
@@ -158172,7 +158225,7 @@ const require$$23 = _dll_classnames;
158172
158225
  }
158173
158226
  });
158174
158227
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resetValue", function (force) {
158175
- var _this$state2 = _this.state, value = _this$state2.value, focusedNode = _this$state2.focusedNode;
158228
+ var _this$state3 = _this.state, value = _this$state3.value, focusedNode = _this$state3.focusedNode;
158176
158229
  var stopReset = _this.plugins.reduce(function (s, p) {
158177
158230
  return s || p.stopReset && p.stopReset(_this.state.value);
158178
158231
  }, false);
@@ -158401,6 +158454,7 @@ const require$$23 = _dll_classnames;
158401
158454
  isHtmlMode: false,
158402
158455
  isEditedInHtmlMode: false,
158403
158456
  focusToolbar: false,
158457
+ keypadInteractionDetected: false,
158404
158458
  dialog: {
158405
158459
  open: false
158406
158460
  }
@@ -158473,7 +158527,7 @@ const require$$23 = _dll_classnames;
158473
158527
  key: "UNSAFE_componentWillReceiveProps",
158474
158528
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
158475
158529
  var _nextProps$value, _nextProps$value$docu, _this$props$value;
158476
- var _this$state3 = this.state, isHtmlMode = _this$state3.isHtmlMode, toolbarOpts = _this$state3.toolbarOpts;
158530
+ var _this$state4 = this.state, isHtmlMode = _this$state4.isHtmlMode, toolbarOpts = _this$state4.toolbarOpts;
158477
158531
  var newToolbarOpts = createToolbarOpts(nextProps.toolbarOpts, nextProps.error, isHtmlMode);
158478
158532
  if (!(0, _isEqual["default"])(newToolbarOpts, toolbarOpts)) {
158479
158533
  this.setState({
@@ -158535,7 +158589,7 @@ const require$$23 = _dll_classnames;
158535
158589
  var _ref4 = pluginProps || ({});
158536
158590
  _ref4.customPlugins;
158537
158591
  var otherPluginProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
158538
- var _this$state4 = this.state, value = _this$state4.value, focusedNode = _this$state4.focusedNode, toolbarOpts = _this$state4.toolbarOpts, dialog = _this$state4.dialog, scheduled = _this$state4.scheduled;
158592
+ var _this$state5 = this.state, value = _this$state5.value, focusedNode = _this$state5.focusedNode, toolbarOpts = _this$state5.toolbarOpts, dialog = _this$state5.dialog, scheduled = _this$state5.scheduled;
158539
158593
  log('[render] value: ', value);
158540
158594
  var sizeStyle = this.buildSizeStyle();
158541
158595
  var names = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.withBg, highlightShape), (0, _defineProperty2["default"])(_classNames, classes.toolbarOnTop, toolbarOpts.alwaysVisible && toolbarOpts.position === 'top'), (0, _defineProperty2["default"])(_classNames, classes.scheduled, scheduled), _classNames), className);
package/module/element.js CHANGED
@@ -1,4 +1,4 @@
1
- import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.24.4/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.25.0/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -36659,6 +36659,11 @@ const require$$24 = _dll_pie_framework__mathquill;
36659
36659
  var _this;
36660
36660
  (0, _classCallCheck2["default"])(this, KeyPad);
36661
36661
  _this = _super.call(this, props);
36662
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeypadInteraction", function () {
36663
+ if (_this.props.setKeypadInteraction) {
36664
+ _this.props.setKeypadInteraction(true);
36665
+ }
36666
+ });
36662
36667
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "buttonClick", function (key) {
36663
36668
  log('[buttonClick]', key);
36664
36669
  var onPress = _this.props.onPress;
@@ -36681,9 +36686,10 @@ const require$$24 = _dll_pie_framework__mathquill;
36681
36686
  (0, _createClass2["default"])(KeyPad, [{
36682
36687
  key: "componentDidMount",
36683
36688
  value: function componentDidMount() {
36684
- var _this$keypadRef, _this$keypadRef$curre, _this$keypadRef2, _this$keypadRef2$curr;
36685
- var mainContainer = (_this$keypadRef = this.keypadRef) === null || _this$keypadRef === void 0 ? void 0 : (_this$keypadRef$curre = _this$keypadRef.current) === null || _this$keypadRef$curre === void 0 ? void 0 : _this$keypadRef$curre.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36686
- var currentToolbar = (_this$keypadRef2 = this.keypadRef) === null || _this$keypadRef2 === void 0 ? void 0 : (_this$keypadRef2$curr = _this$keypadRef2.current) === null || _this$keypadRef2$curr === void 0 ? void 0 : _this$keypadRef2$curr.closest('.pie-toolbar');
36689
+ var _this$keypadRef;
36690
+ var keyPadElement = (_this$keypadRef = this.keypadRef) === null || _this$keypadRef === void 0 ? void 0 : _this$keypadRef.current;
36691
+ var mainContainer = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36692
+ var currentToolbar = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest('.pie-toolbar');
36687
36693
  if (this.props.controlledKeypadMode && mainContainer && currentToolbar) {
36688
36694
  var mainContainerPosition = mainContainer.getBoundingClientRect();
36689
36695
  var currentToolbarPosition = currentToolbar.getBoundingClientRect();
@@ -36695,16 +36701,26 @@ const require$$24 = _dll_pie_framework__mathquill;
36695
36701
  }
36696
36702
  }
36697
36703
  }
36704
+ if (keyPadElement) {
36705
+ keyPadElement.addEventListener('touchstart', this.handleKeypadInteraction, true);
36706
+ keyPadElement.addEventListener('mousedown', this.handleKeypadInteraction, true);
36707
+ }
36698
36708
  }
36699
36709
  }, {
36700
36710
  key: "componentWillUnmount",
36701
36711
  value: function componentWillUnmount() {
36702
- if (this.props.controlledKeypadMode && this.keypadRef && this.keypadRef.current) {
36703
- var mainContainer = this.keypadRef.current.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36712
+ var _this$keypadRef2;
36713
+ var keyPadElement = (_this$keypadRef2 = this.keypadRef) === null || _this$keypadRef2 === void 0 ? void 0 : _this$keypadRef2.current;
36714
+ if (this.props.controlledKeypadMode && keyPadElement) {
36715
+ var mainContainer = keyPadElement.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36704
36716
  if (mainContainer) {
36705
36717
  mainContainer.style.height = 'unset';
36706
36718
  }
36707
36719
  }
36720
+ if (keyPadElement) {
36721
+ keyPadElement.removeEventListener('touchstart', this.handleKeypadInteraction, true);
36722
+ keyPadElement.addEventListener('mousedown', this.handleKeypadInteraction, true);
36723
+ }
36708
36724
  }
36709
36725
  }, {
36710
36726
  key: "render",
@@ -36777,6 +36793,7 @@ const require$$24 = _dll_pie_framework__mathquill;
36777
36793
  onPress: _propTypes["default"].func.isRequired,
36778
36794
  onFocus: _propTypes["default"].func,
36779
36795
  noDecimal: _propTypes["default"].bool,
36796
+ setKeypadInteraction: _propTypes["default"].func,
36780
36797
  mode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
36781
36798
  });
36782
36799
  (0, _defineProperty2["default"])(KeyPad, "defaultProps", {
@@ -36941,7 +36958,7 @@ const require$$9$G = _dll_prop_types;
36941
36958
  (0, _createClass2["default"])(HorizontalKeypad, [{
36942
36959
  key: "render",
36943
36960
  value: function render() {
36944
- var _this$props = this.props, mode = _this$props.mode, onFocus = _this$props.onFocus, controlledKeypadMode = _this$props.controlledKeypadMode, noDecimal = _this$props.noDecimal, className = _this$props.className, additionalKeys = _this$props.additionalKeys, layoutForKeyPad = _this$props.layoutForKeyPad;
36961
+ var _this$props = this.props, mode = _this$props.mode, onFocus = _this$props.onFocus, controlledKeypadMode = _this$props.controlledKeypadMode, noDecimal = _this$props.noDecimal, className = _this$props.className, additionalKeys = _this$props.additionalKeys, layoutForKeyPad = _this$props.layoutForKeyPad, setKeypadInteraction = _this$props.setKeypadInteraction;
36945
36962
  var normalizedKeys = (0, _grades.normalizeAdditionalKeys)(additionalKeys);
36946
36963
  return _react["default"].createElement(_keypad["default"], {
36947
36964
  className: className,
@@ -36951,7 +36968,8 @@ const require$$9$G = _dll_prop_types;
36951
36968
  layoutForKeyPad: layoutForKeyPad,
36952
36969
  additionalKeys: (0, _utils.extendKeySet)((0, _grades.keysForGrade)(mode), normalizedKeys),
36953
36970
  onPress: this.keypadPress,
36954
- mode: mode
36971
+ mode: mode,
36972
+ setKeypadInteraction: setKeypadInteraction
36955
36973
  });
36956
36974
  }
36957
36975
  }]);
@@ -36966,7 +36984,8 @@ const require$$9$G = _dll_prop_types;
36966
36984
  onClick: _propTypes["default"].func.isRequired,
36967
36985
  onFocus: _propTypes["default"].func,
36968
36986
  noDecimal: _propTypes["default"].bool,
36969
- additionalKeys: _propTypes["default"].array
36987
+ additionalKeys: _propTypes["default"].array,
36988
+ setKeypadInteraction: _propTypes["default"].func
36970
36989
  });
36971
36990
  (0, _defineProperty2["default"])(HorizontalKeypad, "defaultProps", {
36972
36991
  mode: 'scientific',
@@ -126611,7 +126630,7 @@ const {isEqual: require$$18$3} = _dll_lodash;
126611
126630
  key: "render",
126612
126631
  value: function render() {
126613
126632
  var _this2 = this;
126614
- var _this$props3 = this.props, classNames = _this$props3.classNames, keypadMode = _this$props3.keypadMode, allowAnswerBlock = _this$props3.allowAnswerBlock, additionalKeys = _this$props3.additionalKeys, controlledKeypad = _this$props3.controlledKeypad, controlledKeypadMode = _this$props3.controlledKeypadMode, showKeypad = _this$props3.showKeypad, noDecimal = _this$props3.noDecimal, hideInput = _this$props3.hideInput, layoutForKeyPad = _this$props3.layoutForKeyPad, latex = _this$props3.latex, _onFocus = _this$props3.onFocus, _onBlur = _this$props3.onBlur, classes = _this$props3.classes, error = _this$props3.error;
126633
+ var _this$props3 = this.props, classNames = _this$props3.classNames, keypadMode = _this$props3.keypadMode, allowAnswerBlock = _this$props3.allowAnswerBlock, additionalKeys = _this$props3.additionalKeys, controlledKeypad = _this$props3.controlledKeypad, controlledKeypadMode = _this$props3.controlledKeypadMode, showKeypad = _this$props3.showKeypad, setKeypadInteraction = _this$props3.setKeypadInteraction, noDecimal = _this$props3.noDecimal, hideInput = _this$props3.hideInput, layoutForKeyPad = _this$props3.layoutForKeyPad, latex = _this$props3.latex, _onFocus = _this$props3.onFocus, _onBlur = _this$props3.onBlur, classes = _this$props3.classes, error = _this$props3.error;
126615
126634
  var shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
126616
126635
  var addDisabled = this.state.addDisabled;
126617
126636
  log('[render]', latex);
@@ -126684,7 +126703,8 @@ const {isEqual: require$$18$3} = _dll_lodash;
126684
126703
  additionalKeys: additionalKeys,
126685
126704
  mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
126686
126705
  onClick: this.onClick,
126687
- noDecimal: noDecimal
126706
+ noDecimal: noDecimal,
126707
+ setKeypadInteraction: setKeypadInteraction
126688
126708
  }));
126689
126709
  }
126690
126710
  }]);
@@ -126711,7 +126731,8 @@ const {isEqual: require$$18$3} = _dll_lodash;
126711
126731
  onFocus: _propTypes["default"].func,
126712
126732
  onBlur: _propTypes["default"].func,
126713
126733
  onChange: _propTypes["default"].func.isRequired,
126714
- classes: _propTypes["default"].object
126734
+ classes: _propTypes["default"].object,
126735
+ setKeypadInteraction: _propTypes["default"].func
126715
126736
  });
126716
126737
  var styles = function styles(theme) {
126717
126738
  return {
@@ -127405,7 +127426,7 @@ const require$$10$x = _dll_classnames;
127405
127426
  key: "render",
127406
127427
  value: function render() {
127407
127428
  var latex = this.state.latex;
127408
- var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, maxResponseAreas = _this$props.maxResponseAreas;
127429
+ var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, setKeypadInteraction = _this$props.setKeypadInteraction, maxResponseAreas = _this$props.maxResponseAreas;
127409
127430
  return _react["default"].createElement(PureToolbar, {
127410
127431
  autoFocus: autoFocus,
127411
127432
  classNames: classNames,
@@ -127416,6 +127437,7 @@ const require$$10$x = _dll_classnames;
127416
127437
  noDecimal: noDecimal,
127417
127438
  keypadMode: keypadMode,
127418
127439
  keyPadCharacterRef: keyPadCharacterRef,
127440
+ setKeypadInteraction: setKeypadInteraction,
127419
127441
  onChange: this.onChange,
127420
127442
  onDone: this.done,
127421
127443
  onFocus: onFocus,
@@ -127450,7 +127472,9 @@ const require$$10$x = _dll_classnames;
127450
127472
  onDone: _propTypes["default"].func.isRequired,
127451
127473
  onFocus: _propTypes["default"].func,
127452
127474
  onBlur: _propTypes["default"].func,
127453
- hideDoneButton: _propTypes["default"].bool
127475
+ hideDoneButton: _propTypes["default"].bool,
127476
+ keyPadCharacterRef: _propTypes["default"].func,
127477
+ setKeypadInteraction: _propTypes["default"].func
127454
127478
  });
127455
127479
  (0, _defineProperty2["default"])(MathToolbar, "defaultProps", {
127456
127480
  classNames: {},
@@ -127477,7 +127501,7 @@ const require$$10$x = _dll_classnames;
127477
127501
  (0, _createClass2["default"])(RawPureToolbar, [{
127478
127502
  key: "render",
127479
127503
  value: function render() {
127480
- var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127504
+ var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, setKeypadInteraction = _this$props2.setKeypadInteraction, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127481
127505
  return _react["default"].createElement("div", {
127482
127506
  className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar),
127483
127507
  ref: keyPadCharacterRef
@@ -127500,7 +127524,8 @@ const require$$10$x = _dll_classnames;
127500
127524
  onFocus: onFocus,
127501
127525
  onBlur: onBlur,
127502
127526
  error: error,
127503
- maxResponseAreas: maxResponseAreas
127527
+ maxResponseAreas: maxResponseAreas,
127528
+ setKeypadInteraction: setKeypadInteraction
127504
127529
  }), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && _react["default"].createElement(_doneButton.DoneButton, {
127505
127530
  hideBackground: hideDoneButtonBackground,
127506
127531
  onClick: onDone
@@ -127533,7 +127558,9 @@ const require$$10$x = _dll_classnames;
127533
127558
  hideDoneButton: _propTypes["default"].bool,
127534
127559
  hideDoneButtonBackground: _propTypes["default"].bool,
127535
127560
  error: _propTypes["default"].any,
127536
- maxResponseAreas: _propTypes["default"].number
127561
+ maxResponseAreas: _propTypes["default"].number,
127562
+ keyPadCharacterRef: _propTypes["default"].func,
127563
+ setKeypadInteraction: _propTypes["default"].func
127537
127564
  });
127538
127565
  (0, _defineProperty2["default"])(RawPureToolbar, "defaultProps", {
127539
127566
  classNames: {},
@@ -131246,7 +131273,8 @@ var RawDoneButton = function RawDoneButton(_ref) {
131246
131273
  doneButton.RawDoneButton = RawDoneButton;
131247
131274
  RawDoneButton.propTypes = {
131248
131275
  classes: _propTypes$15["default"].object.isRequired,
131249
- onClick: _propTypes$15["default"].func
131276
+ onClick: _propTypes$15["default"].func,
131277
+ doneButtonRef: _propTypes$15["default"].func
131250
131278
  };
131251
131279
  var styles$V = {
131252
131280
  iconRoot: {
@@ -131404,7 +131432,8 @@ const require$$10$r = _dll_debug;
131404
131432
  onChange: _propTypes["default"].func,
131405
131433
  onClick: _propTypes["default"].func,
131406
131434
  type: _propTypes["default"].string,
131407
- value: _propTypes["default"].object
131435
+ value: _propTypes["default"].object,
131436
+ ariaLabel: _propTypes["default"].string
131408
131437
  };
131409
131438
  var isActiveToolbarPlugin = function isActiveToolbarPlugin(props) {
131410
131439
  return function (plugin) {
@@ -131461,7 +131490,11 @@ const require$$10$r = _dll_debug;
131461
131490
  onDone: _propTypes["default"].func.isRequired,
131462
131491
  showDone: _propTypes["default"].bool,
131463
131492
  addArea: _propTypes["default"].bool,
131464
- deletable: _propTypes["default"].bool
131493
+ deletable: _propTypes["default"].bool,
131494
+ isHtmlMode: _propTypes["default"].bool,
131495
+ doneButtonRef: _propTypes["default"].func,
131496
+ onBlur: _propTypes["default"].func,
131497
+ onFocus: _propTypes["default"].func
131465
131498
  };
131466
131499
  DefaultToolbar.defaultProps = {
131467
131500
  pluginProps: {}
@@ -146353,6 +146386,7 @@ const require$$11$l = _dll_prop_types;
146353
146386
  };
146354
146387
  var el = _react["default"].createElement(_mathToolbar.PureToolbar, {
146355
146388
  keyPadCharacterRef: opts.keyPadCharacterRef,
146389
+ setKeypadInteraction: opts.setKeypadInteraction,
146356
146390
  autoFocus: true,
146357
146391
  noDecimal: true,
146358
146392
  hideInput: true,
@@ -146792,7 +146826,10 @@ const {debounce: require$$16$2} = _dll_lodash;
146792
146826
  ref: _propTypes["default"].func,
146793
146827
  showDone: _propTypes["default"].bool
146794
146828
  }),
146795
- onDataChange: _propTypes["default"].func
146829
+ onDataChange: _propTypes["default"].func,
146830
+ doneButtonRef: _propTypes["default"].func,
146831
+ onBlur: _propTypes["default"].func,
146832
+ onFocus: _propTypes["default"].func
146796
146833
  });
146797
146834
  var style = {
146798
146835
  toolbar: {
@@ -146977,7 +147014,8 @@ const require$$13$5 = _dll_prop_types;
146977
147014
  }),
146978
147015
  focusToolbar: _propTypes["default"].bool.isRequired,
146979
147016
  onToolbarFocus: _propTypes["default"].func.isRequired,
146980
- onToolbarBlur: _propTypes["default"].func.isRequired
147017
+ onToolbarBlur: _propTypes["default"].func.isRequired,
147018
+ doneButtonRef: _propTypes["default"].func
146981
147019
  });
146982
147020
  var style = function style(theme) {
146983
147021
  return {
@@ -147630,7 +147668,8 @@ var buildPlugins = function buildPlugins(activePlugins, customPlugins, opts) {
147630
147668
  var respAreaPlugin = opts.responseArea && opts.responseArea.type && (0, _respArea["default"])(opts.responseArea, (0, _compact["default"])([mathPlugin]));
147631
147669
  var languageCharactersPlugins = ((opts === null || opts === void 0 ? void 0 : opts.languageCharacters) || []).map(function (config) {
147632
147670
  return (0, _characters["default"])(_objectSpread$4(_objectSpread$4({}, config), {}, {
147633
- keyPadCharacterRef: opts.keyPadCharacterRef
147671
+ keyPadCharacterRef: opts.keyPadCharacterRef,
147672
+ setKeypadInteraction: opts.setKeypadInteraction
147634
147673
  }));
147635
147674
  });
147636
147675
  var tablePlugins = [imagePlugin, mathPlugin, respAreaPlugin].concat((0, _toConsumableArray2$2["default"])(languageCharactersPlugins));
@@ -155877,6 +155916,11 @@ const require$$23 = _dll_classnames;
155877
155916
  var _this;
155878
155917
  (0, _classCallCheck2["default"])(this, Editor);
155879
155918
  _this = _super.call(this, _props);
155919
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setKeypadInteraction", function (interacted) {
155920
+ _this.setState({
155921
+ keypadInteractionDetected: interacted
155922
+ });
155923
+ });
155880
155924
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDialog", function (open) {
155881
155925
  var extraDialogProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
155882
155926
  var callback = arguments.length > 2 ? arguments[2] : undefined;
@@ -156021,6 +156065,7 @@ const require$$23 = _dll_classnames;
156021
156065
  },
156022
156066
  languageCharacters: props.languageCharactersProps,
156023
156067
  keyPadCharacterRef: _this.keyPadCharacterRef,
156068
+ setKeypadInteraction: _this.setKeypadInteraction,
156024
156069
  media: {
156025
156070
  focus: _this.focus,
156026
156071
  createChange: function createChange() {
@@ -156156,13 +156201,12 @@ const require$$23 = _dll_classnames;
156156
156201
  }
156157
156202
  });
156158
156203
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
156159
- var _this$keyPadCharacter;
156160
156204
  log('[onBlur]');
156161
156205
  var relatedTarget = event.relatedTarget;
156162
156206
  var toolbarElement = _this.toolbarRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]")));
156207
+ var keypadInteractionDetected = _this.state.keypadInteractionDetected;
156163
156208
  var isRawDoneButton = _this.doneButtonRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.doneButtonRef.className, "\"]")));
156164
- var isKeyPadCharacterButton = _this.keyPadCharacterRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat((_this$keyPadCharacter = _this.keyPadCharacterRef.current) === null || _this$keyPadCharacter === void 0 ? void 0 : _this$keyPadCharacter.className, "\"]")));
156165
- _this.skipBlurHandling = isKeyPadCharacterButton ? true : false;
156209
+ _this.skipBlurHandling = keypadInteractionDetected ? true : false;
156166
156210
  if (toolbarElement && !isRawDoneButton) {
156167
156211
  _this.setState({
156168
156212
  focusToolbar: true
@@ -156183,10 +156227,13 @@ const require$$23 = _dll_classnames;
156183
156227
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDomBlur", function (e) {
156184
156228
  var editorDOM = document.querySelector(("[data-key=\"").concat(_this.state.value.document.key, "\"]"));
156185
156229
  setTimeout(function () {
156186
- var stateValue = _this.state.value;
156230
+ var _this$state2 = _this.state, stateValue = _this$state2.value, keypadInteractionDetected = _this$state2.keypadInteractionDetected;
156187
156231
  if (!_this.wrapperRef) {
156188
156232
  return;
156189
156233
  }
156234
+ if (keypadInteractionDetected) {
156235
+ _this.setKeypadInteraction(false);
156236
+ }
156190
156237
  var editorElement = !editorDOM || document.activeElement.closest(("[class*=\"").concat(editorDOM.className, "\"]"));
156191
156238
  var toolbarElement = !_this.toolbarRef || document.activeElement.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]"));
156192
156239
  var isInCurrentComponent = _this.wrapperRef.contains(editorElement) || _this.wrapperRef.contains(toolbarElement);
@@ -156200,8 +156247,14 @@ const require$$23 = _dll_classnames;
156200
156247
  });
156201
156248
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function (event, change) {
156202
156249
  return new Promise(function (resolve) {
156250
+ var _navigator;
156203
156251
  var editorDOM = document.querySelector(("[data-key=\"").concat(_this.state.value.document.key, "\"]"));
156252
+ var isTouchDevice = typeof window !== 'undefined' && (('ontouchstart' in window) || ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.maxTouchPoints) > 0);
156253
+ var keypadInteractionDetected = _this.state.keypadInteractionDetected;
156204
156254
  log('[onFocus]', document.activeElement);
156255
+ if (keypadInteractionDetected && _this.__TEMPORARY_CHANGE_DATA) {
156256
+ _this.__TEMPORARY_CHANGE_DATA = null;
156257
+ }
156205
156258
  if (_this.__TEMPORARY_CHANGE_DATA) {
156206
156259
  var _this$__TEMPORARY_CHA = _this.__TEMPORARY_CHANGE_DATA, key = _this$__TEMPORARY_CHA.key, data = _this$__TEMPORARY_CHA.data;
156207
156260
  var domEl = document.querySelector(("[data-key=\"").concat(key, "\"]"));
@@ -156222,7 +156275,7 @@ const require$$23 = _dll_classnames;
156222
156275
  }
156223
156276
  _this.stashValue();
156224
156277
  _this.props.onFocus();
156225
- if (!_this.isRelatedTargetButton(event)) {
156278
+ if (!_this.isRelatedTargetButton(event) && !isTouchDevice) {
156226
156279
  change === null || change === void 0 ? void 0 : change.focus();
156227
156280
  }
156228
156281
  resolve();
@@ -156237,7 +156290,7 @@ const require$$23 = _dll_classnames;
156237
156290
  }
156238
156291
  });
156239
156292
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resetValue", function (force) {
156240
- var _this$state2 = _this.state, value = _this$state2.value, focusedNode = _this$state2.focusedNode;
156293
+ var _this$state3 = _this.state, value = _this$state3.value, focusedNode = _this$state3.focusedNode;
156241
156294
  var stopReset = _this.plugins.reduce(function (s, p) {
156242
156295
  return s || p.stopReset && p.stopReset(_this.state.value);
156243
156296
  }, false);
@@ -156466,6 +156519,7 @@ const require$$23 = _dll_classnames;
156466
156519
  isHtmlMode: false,
156467
156520
  isEditedInHtmlMode: false,
156468
156521
  focusToolbar: false,
156522
+ keypadInteractionDetected: false,
156469
156523
  dialog: {
156470
156524
  open: false
156471
156525
  }
@@ -156538,7 +156592,7 @@ const require$$23 = _dll_classnames;
156538
156592
  key: "UNSAFE_componentWillReceiveProps",
156539
156593
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
156540
156594
  var _nextProps$value, _nextProps$value$docu, _this$props$value;
156541
- var _this$state3 = this.state, isHtmlMode = _this$state3.isHtmlMode, toolbarOpts = _this$state3.toolbarOpts;
156595
+ var _this$state4 = this.state, isHtmlMode = _this$state4.isHtmlMode, toolbarOpts = _this$state4.toolbarOpts;
156542
156596
  var newToolbarOpts = createToolbarOpts(nextProps.toolbarOpts, nextProps.error, isHtmlMode);
156543
156597
  if (!(0, _isEqual["default"])(newToolbarOpts, toolbarOpts)) {
156544
156598
  this.setState({
@@ -156600,7 +156654,7 @@ const require$$23 = _dll_classnames;
156600
156654
  var _ref4 = pluginProps || ({});
156601
156655
  _ref4.customPlugins;
156602
156656
  var otherPluginProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
156603
- var _this$state4 = this.state, value = _this$state4.value, focusedNode = _this$state4.focusedNode, toolbarOpts = _this$state4.toolbarOpts, dialog = _this$state4.dialog, scheduled = _this$state4.scheduled;
156657
+ var _this$state5 = this.state, value = _this$state5.value, focusedNode = _this$state5.focusedNode, toolbarOpts = _this$state5.toolbarOpts, dialog = _this$state5.dialog, scheduled = _this$state5.scheduled;
156604
156658
  log('[render] value: ', value);
156605
156659
  var sizeStyle = this.buildSizeStyle();
156606
156660
  var names = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.withBg, highlightShape), (0, _defineProperty2["default"])(_classNames, classes.toolbarOnTop, toolbarOpts.alwaysVisible && toolbarOpts.position === 'top'), (0, _defineProperty2["default"])(_classNames, classes.scheduled, scheduled), _classNames), className);
@@ -4,7 +4,7 @@
4
4
  "modules": [
5
5
  {
6
6
  "name": "@pie-lib/pie-toolbox-math-rendering-module",
7
- "version": "1.24.4"
7
+ "version": "1.25.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_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.24.4/module/index.js";
1
+ import {_dll_react, _dll_prop_types, _dll_react_dom, _dll_classnames, _dll_debug, _dll_lodash, _dll_react_dom_server, _dll_pie_framework__mathquill} from "../../../@pie-lib/pie-toolbox-math-rendering-module@1.25.0/module/index.js";
2
2
  import {_dll_pie_lib__pie_toolbox_render_ui} from "../../../@pie-lib/pie-toolbox-module@4.24.3/module/index.js";
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -36659,6 +36659,11 @@ const require$$24 = _dll_pie_framework__mathquill;
36659
36659
  var _this;
36660
36660
  (0, _classCallCheck2["default"])(this, KeyPad);
36661
36661
  _this = _super.call(this, props);
36662
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleKeypadInteraction", function () {
36663
+ if (_this.props.setKeypadInteraction) {
36664
+ _this.props.setKeypadInteraction(true);
36665
+ }
36666
+ });
36662
36667
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "buttonClick", function (key) {
36663
36668
  log('[buttonClick]', key);
36664
36669
  var onPress = _this.props.onPress;
@@ -36681,9 +36686,10 @@ const require$$24 = _dll_pie_framework__mathquill;
36681
36686
  (0, _createClass2["default"])(KeyPad, [{
36682
36687
  key: "componentDidMount",
36683
36688
  value: function componentDidMount() {
36684
- var _this$keypadRef, _this$keypadRef$curre, _this$keypadRef2, _this$keypadRef2$curr;
36685
- var mainContainer = (_this$keypadRef = this.keypadRef) === null || _this$keypadRef === void 0 ? void 0 : (_this$keypadRef$curre = _this$keypadRef.current) === null || _this$keypadRef$curre === void 0 ? void 0 : _this$keypadRef$curre.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36686
- var currentToolbar = (_this$keypadRef2 = this.keypadRef) === null || _this$keypadRef2 === void 0 ? void 0 : (_this$keypadRef2$curr = _this$keypadRef2.current) === null || _this$keypadRef2$curr === void 0 ? void 0 : _this$keypadRef2$curr.closest('.pie-toolbar');
36689
+ var _this$keypadRef;
36690
+ var keyPadElement = (_this$keypadRef = this.keypadRef) === null || _this$keypadRef === void 0 ? void 0 : _this$keypadRef.current;
36691
+ var mainContainer = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36692
+ var currentToolbar = keyPadElement === null || keyPadElement === void 0 ? void 0 : keyPadElement.closest('.pie-toolbar');
36687
36693
  if (this.props.controlledKeypadMode && mainContainer && currentToolbar) {
36688
36694
  var mainContainerPosition = mainContainer.getBoundingClientRect();
36689
36695
  var currentToolbarPosition = currentToolbar.getBoundingClientRect();
@@ -36695,16 +36701,26 @@ const require$$24 = _dll_pie_framework__mathquill;
36695
36701
  }
36696
36702
  }
36697
36703
  }
36704
+ if (keyPadElement) {
36705
+ keyPadElement.addEventListener('touchstart', this.handleKeypadInteraction, true);
36706
+ keyPadElement.addEventListener('mousedown', this.handleKeypadInteraction, true);
36707
+ }
36698
36708
  }
36699
36709
  }, {
36700
36710
  key: "componentWillUnmount",
36701
36711
  value: function componentWillUnmount() {
36702
- if (this.props.controlledKeypadMode && this.keypadRef && this.keypadRef.current) {
36703
- var mainContainer = this.keypadRef.current.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36712
+ var _this$keypadRef2;
36713
+ var keyPadElement = (_this$keypadRef2 = this.keypadRef) === null || _this$keypadRef2 === void 0 ? void 0 : _this$keypadRef2.current;
36714
+ if (this.props.controlledKeypadMode && keyPadElement) {
36715
+ var mainContainer = keyPadElement.closest((".").concat(_constants.MAIN_CONTAINER_CLASS));
36704
36716
  if (mainContainer) {
36705
36717
  mainContainer.style.height = 'unset';
36706
36718
  }
36707
36719
  }
36720
+ if (keyPadElement) {
36721
+ keyPadElement.removeEventListener('touchstart', this.handleKeypadInteraction, true);
36722
+ keyPadElement.addEventListener('mousedown', this.handleKeypadInteraction, true);
36723
+ }
36708
36724
  }
36709
36725
  }, {
36710
36726
  key: "render",
@@ -36777,6 +36793,7 @@ const require$$24 = _dll_pie_framework__mathquill;
36777
36793
  onPress: _propTypes["default"].func.isRequired,
36778
36794
  onFocus: _propTypes["default"].func,
36779
36795
  noDecimal: _propTypes["default"].bool,
36796
+ setKeypadInteraction: _propTypes["default"].func,
36780
36797
  mode: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
36781
36798
  });
36782
36799
  (0, _defineProperty2["default"])(KeyPad, "defaultProps", {
@@ -36941,7 +36958,7 @@ const require$$9$G = _dll_prop_types;
36941
36958
  (0, _createClass2["default"])(HorizontalKeypad, [{
36942
36959
  key: "render",
36943
36960
  value: function render() {
36944
- var _this$props = this.props, mode = _this$props.mode, onFocus = _this$props.onFocus, controlledKeypadMode = _this$props.controlledKeypadMode, noDecimal = _this$props.noDecimal, className = _this$props.className, additionalKeys = _this$props.additionalKeys, layoutForKeyPad = _this$props.layoutForKeyPad;
36961
+ var _this$props = this.props, mode = _this$props.mode, onFocus = _this$props.onFocus, controlledKeypadMode = _this$props.controlledKeypadMode, noDecimal = _this$props.noDecimal, className = _this$props.className, additionalKeys = _this$props.additionalKeys, layoutForKeyPad = _this$props.layoutForKeyPad, setKeypadInteraction = _this$props.setKeypadInteraction;
36945
36962
  var normalizedKeys = (0, _grades.normalizeAdditionalKeys)(additionalKeys);
36946
36963
  return _react["default"].createElement(_keypad["default"], {
36947
36964
  className: className,
@@ -36951,7 +36968,8 @@ const require$$9$G = _dll_prop_types;
36951
36968
  layoutForKeyPad: layoutForKeyPad,
36952
36969
  additionalKeys: (0, _utils.extendKeySet)((0, _grades.keysForGrade)(mode), normalizedKeys),
36953
36970
  onPress: this.keypadPress,
36954
- mode: mode
36971
+ mode: mode,
36972
+ setKeypadInteraction: setKeypadInteraction
36955
36973
  });
36956
36974
  }
36957
36975
  }]);
@@ -36966,7 +36984,8 @@ const require$$9$G = _dll_prop_types;
36966
36984
  onClick: _propTypes["default"].func.isRequired,
36967
36985
  onFocus: _propTypes["default"].func,
36968
36986
  noDecimal: _propTypes["default"].bool,
36969
- additionalKeys: _propTypes["default"].array
36987
+ additionalKeys: _propTypes["default"].array,
36988
+ setKeypadInteraction: _propTypes["default"].func
36970
36989
  });
36971
36990
  (0, _defineProperty2["default"])(HorizontalKeypad, "defaultProps", {
36972
36991
  mode: 'scientific',
@@ -126611,7 +126630,7 @@ const {isEqual: require$$18$3} = _dll_lodash;
126611
126630
  key: "render",
126612
126631
  value: function render() {
126613
126632
  var _this2 = this;
126614
- var _this$props3 = this.props, classNames = _this$props3.classNames, keypadMode = _this$props3.keypadMode, allowAnswerBlock = _this$props3.allowAnswerBlock, additionalKeys = _this$props3.additionalKeys, controlledKeypad = _this$props3.controlledKeypad, controlledKeypadMode = _this$props3.controlledKeypadMode, showKeypad = _this$props3.showKeypad, noDecimal = _this$props3.noDecimal, hideInput = _this$props3.hideInput, layoutForKeyPad = _this$props3.layoutForKeyPad, latex = _this$props3.latex, _onFocus = _this$props3.onFocus, _onBlur = _this$props3.onBlur, classes = _this$props3.classes, error = _this$props3.error;
126633
+ var _this$props3 = this.props, classNames = _this$props3.classNames, keypadMode = _this$props3.keypadMode, allowAnswerBlock = _this$props3.allowAnswerBlock, additionalKeys = _this$props3.additionalKeys, controlledKeypad = _this$props3.controlledKeypad, controlledKeypadMode = _this$props3.controlledKeypadMode, showKeypad = _this$props3.showKeypad, setKeypadInteraction = _this$props3.setKeypadInteraction, noDecimal = _this$props3.noDecimal, hideInput = _this$props3.hideInput, layoutForKeyPad = _this$props3.layoutForKeyPad, latex = _this$props3.latex, _onFocus = _this$props3.onFocus, _onBlur = _this$props3.onBlur, classes = _this$props3.classes, error = _this$props3.error;
126615
126634
  var shouldShowKeypad = !controlledKeypad || controlledKeypad && showKeypad;
126616
126635
  var addDisabled = this.state.addDisabled;
126617
126636
  log('[render]', latex);
@@ -126684,7 +126703,8 @@ const {isEqual: require$$18$3} = _dll_lodash;
126684
126703
  additionalKeys: additionalKeys,
126685
126704
  mode: controlledKeypadMode ? this.state.equationEditor : keypadMode,
126686
126705
  onClick: this.onClick,
126687
- noDecimal: noDecimal
126706
+ noDecimal: noDecimal,
126707
+ setKeypadInteraction: setKeypadInteraction
126688
126708
  }));
126689
126709
  }
126690
126710
  }]);
@@ -126711,7 +126731,8 @@ const {isEqual: require$$18$3} = _dll_lodash;
126711
126731
  onFocus: _propTypes["default"].func,
126712
126732
  onBlur: _propTypes["default"].func,
126713
126733
  onChange: _propTypes["default"].func.isRequired,
126714
- classes: _propTypes["default"].object
126734
+ classes: _propTypes["default"].object,
126735
+ setKeypadInteraction: _propTypes["default"].func
126715
126736
  });
126716
126737
  var styles = function styles(theme) {
126717
126738
  return {
@@ -127405,7 +127426,7 @@ const require$$10$x = _dll_classnames;
127405
127426
  key: "render",
127406
127427
  value: function render() {
127407
127428
  var latex = this.state.latex;
127408
- var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, maxResponseAreas = _this$props.maxResponseAreas;
127429
+ var _this$props = this.props, classNames = _this$props.classNames, autoFocus = _this$props.autoFocus, allowAnswerBlock = _this$props.allowAnswerBlock, onAnswerBlockAdd = _this$props.onAnswerBlockAdd, controlledKeypad = _this$props.controlledKeypad, controlledKeypadMode = _this$props.controlledKeypadMode, keypadMode = _this$props.keypadMode, noDecimal = _this$props.noDecimal, additionalKeys = _this$props.additionalKeys, showKeypad = _this$props.showKeypad, onFocus = _this$props.onFocus, onBlur = _this$props.onBlur, hideDoneButton = _this$props.hideDoneButton, error = _this$props.error, keyPadCharacterRef = _this$props.keyPadCharacterRef, setKeypadInteraction = _this$props.setKeypadInteraction, maxResponseAreas = _this$props.maxResponseAreas;
127409
127430
  return _react["default"].createElement(PureToolbar, {
127410
127431
  autoFocus: autoFocus,
127411
127432
  classNames: classNames,
@@ -127416,6 +127437,7 @@ const require$$10$x = _dll_classnames;
127416
127437
  noDecimal: noDecimal,
127417
127438
  keypadMode: keypadMode,
127418
127439
  keyPadCharacterRef: keyPadCharacterRef,
127440
+ setKeypadInteraction: setKeypadInteraction,
127419
127441
  onChange: this.onChange,
127420
127442
  onDone: this.done,
127421
127443
  onFocus: onFocus,
@@ -127450,7 +127472,9 @@ const require$$10$x = _dll_classnames;
127450
127472
  onDone: _propTypes["default"].func.isRequired,
127451
127473
  onFocus: _propTypes["default"].func,
127452
127474
  onBlur: _propTypes["default"].func,
127453
- hideDoneButton: _propTypes["default"].bool
127475
+ hideDoneButton: _propTypes["default"].bool,
127476
+ keyPadCharacterRef: _propTypes["default"].func,
127477
+ setKeypadInteraction: _propTypes["default"].func
127454
127478
  });
127455
127479
  (0, _defineProperty2["default"])(MathToolbar, "defaultProps", {
127456
127480
  classNames: {},
@@ -127477,7 +127501,7 @@ const require$$10$x = _dll_classnames;
127477
127501
  (0, _createClass2["default"])(RawPureToolbar, [{
127478
127502
  key: "render",
127479
127503
  value: function render() {
127480
- var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127504
+ var _this$props2 = this.props, classNames = _this$props2.classNames, autoFocus = _this$props2.autoFocus, allowAnswerBlock = _this$props2.allowAnswerBlock, onAnswerBlockAdd = _this$props2.onAnswerBlockAdd, controlledKeypad = _this$props2.controlledKeypad, controlledKeypadMode = _this$props2.controlledKeypadMode, additionalKeys = _this$props2.additionalKeys, showKeypad = _this$props2.showKeypad, keypadMode = _this$props2.keypadMode, noDecimal = _this$props2.noDecimal, hideInput = _this$props2.hideInput, noLatexHandling = _this$props2.noLatexHandling, layoutForKeyPad = _this$props2.layoutForKeyPad, keyPadCharacterRef = _this$props2.keyPadCharacterRef, setKeypadInteraction = _this$props2.setKeypadInteraction, latex = _this$props2.latex, onChange = _this$props2.onChange, onDone = _this$props2.onDone, onFocus = _this$props2.onFocus, onBlur = _this$props2.onBlur, hideDoneButton = _this$props2.hideDoneButton, hideDoneButtonBackground = _this$props2.hideDoneButtonBackground, classes = _this$props2.classes, error = _this$props2.error, maxResponseAreas = _this$props2.maxResponseAreas;
127481
127505
  return _react["default"].createElement("div", {
127482
127506
  className: (0, _classnames["default"])(classes.pureToolbar, (classNames || ({})).toolbar),
127483
127507
  ref: keyPadCharacterRef
@@ -127500,7 +127524,8 @@ const require$$10$x = _dll_classnames;
127500
127524
  onFocus: onFocus,
127501
127525
  onBlur: onBlur,
127502
127526
  error: error,
127503
- maxResponseAreas: maxResponseAreas
127527
+ maxResponseAreas: maxResponseAreas,
127528
+ setKeypadInteraction: setKeypadInteraction
127504
127529
  }), (!controlledKeypad || controlledKeypad && showKeypad) && !hideDoneButton && _react["default"].createElement(_doneButton.DoneButton, {
127505
127530
  hideBackground: hideDoneButtonBackground,
127506
127531
  onClick: onDone
@@ -127533,7 +127558,9 @@ const require$$10$x = _dll_classnames;
127533
127558
  hideDoneButton: _propTypes["default"].bool,
127534
127559
  hideDoneButtonBackground: _propTypes["default"].bool,
127535
127560
  error: _propTypes["default"].any,
127536
- maxResponseAreas: _propTypes["default"].number
127561
+ maxResponseAreas: _propTypes["default"].number,
127562
+ keyPadCharacterRef: _propTypes["default"].func,
127563
+ setKeypadInteraction: _propTypes["default"].func
127537
127564
  });
127538
127565
  (0, _defineProperty2["default"])(RawPureToolbar, "defaultProps", {
127539
127566
  classNames: {},
@@ -131246,7 +131273,8 @@ var RawDoneButton = function RawDoneButton(_ref) {
131246
131273
  doneButton.RawDoneButton = RawDoneButton;
131247
131274
  RawDoneButton.propTypes = {
131248
131275
  classes: _propTypes$15["default"].object.isRequired,
131249
- onClick: _propTypes$15["default"].func
131276
+ onClick: _propTypes$15["default"].func,
131277
+ doneButtonRef: _propTypes$15["default"].func
131250
131278
  };
131251
131279
  var styles$V = {
131252
131280
  iconRoot: {
@@ -131404,7 +131432,8 @@ const require$$10$r = _dll_debug;
131404
131432
  onChange: _propTypes["default"].func,
131405
131433
  onClick: _propTypes["default"].func,
131406
131434
  type: _propTypes["default"].string,
131407
- value: _propTypes["default"].object
131435
+ value: _propTypes["default"].object,
131436
+ ariaLabel: _propTypes["default"].string
131408
131437
  };
131409
131438
  var isActiveToolbarPlugin = function isActiveToolbarPlugin(props) {
131410
131439
  return function (plugin) {
@@ -131461,7 +131490,11 @@ const require$$10$r = _dll_debug;
131461
131490
  onDone: _propTypes["default"].func.isRequired,
131462
131491
  showDone: _propTypes["default"].bool,
131463
131492
  addArea: _propTypes["default"].bool,
131464
- deletable: _propTypes["default"].bool
131493
+ deletable: _propTypes["default"].bool,
131494
+ isHtmlMode: _propTypes["default"].bool,
131495
+ doneButtonRef: _propTypes["default"].func,
131496
+ onBlur: _propTypes["default"].func,
131497
+ onFocus: _propTypes["default"].func
131465
131498
  };
131466
131499
  DefaultToolbar.defaultProps = {
131467
131500
  pluginProps: {}
@@ -146353,6 +146386,7 @@ const require$$11$l = _dll_prop_types;
146353
146386
  };
146354
146387
  var el = _react["default"].createElement(_mathToolbar.PureToolbar, {
146355
146388
  keyPadCharacterRef: opts.keyPadCharacterRef,
146389
+ setKeypadInteraction: opts.setKeypadInteraction,
146356
146390
  autoFocus: true,
146357
146391
  noDecimal: true,
146358
146392
  hideInput: true,
@@ -146792,7 +146826,10 @@ const {debounce: require$$16$2} = _dll_lodash;
146792
146826
  ref: _propTypes["default"].func,
146793
146827
  showDone: _propTypes["default"].bool
146794
146828
  }),
146795
- onDataChange: _propTypes["default"].func
146829
+ onDataChange: _propTypes["default"].func,
146830
+ doneButtonRef: _propTypes["default"].func,
146831
+ onBlur: _propTypes["default"].func,
146832
+ onFocus: _propTypes["default"].func
146796
146833
  });
146797
146834
  var style = {
146798
146835
  toolbar: {
@@ -146977,7 +147014,8 @@ const require$$13$5 = _dll_prop_types;
146977
147014
  }),
146978
147015
  focusToolbar: _propTypes["default"].bool.isRequired,
146979
147016
  onToolbarFocus: _propTypes["default"].func.isRequired,
146980
- onToolbarBlur: _propTypes["default"].func.isRequired
147017
+ onToolbarBlur: _propTypes["default"].func.isRequired,
147018
+ doneButtonRef: _propTypes["default"].func
146981
147019
  });
146982
147020
  var style = function style(theme) {
146983
147021
  return {
@@ -147630,7 +147668,8 @@ var buildPlugins = function buildPlugins(activePlugins, customPlugins, opts) {
147630
147668
  var respAreaPlugin = opts.responseArea && opts.responseArea.type && (0, _respArea["default"])(opts.responseArea, (0, _compact["default"])([mathPlugin]));
147631
147669
  var languageCharactersPlugins = ((opts === null || opts === void 0 ? void 0 : opts.languageCharacters) || []).map(function (config) {
147632
147670
  return (0, _characters["default"])(_objectSpread$4(_objectSpread$4({}, config), {}, {
147633
- keyPadCharacterRef: opts.keyPadCharacterRef
147671
+ keyPadCharacterRef: opts.keyPadCharacterRef,
147672
+ setKeypadInteraction: opts.setKeypadInteraction
147634
147673
  }));
147635
147674
  });
147636
147675
  var tablePlugins = [imagePlugin, mathPlugin, respAreaPlugin].concat((0, _toConsumableArray2$2["default"])(languageCharactersPlugins));
@@ -155877,6 +155916,11 @@ const require$$23 = _dll_classnames;
155877
155916
  var _this;
155878
155917
  (0, _classCallCheck2["default"])(this, Editor);
155879
155918
  _this = _super.call(this, _props);
155919
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setKeypadInteraction", function (interacted) {
155920
+ _this.setState({
155921
+ keypadInteractionDetected: interacted
155922
+ });
155923
+ });
155880
155924
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDialog", function (open) {
155881
155925
  var extraDialogProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
155882
155926
  var callback = arguments.length > 2 ? arguments[2] : undefined;
@@ -156021,6 +156065,7 @@ const require$$23 = _dll_classnames;
156021
156065
  },
156022
156066
  languageCharacters: props.languageCharactersProps,
156023
156067
  keyPadCharacterRef: _this.keyPadCharacterRef,
156068
+ setKeypadInteraction: _this.setKeypadInteraction,
156024
156069
  media: {
156025
156070
  focus: _this.focus,
156026
156071
  createChange: function createChange() {
@@ -156156,13 +156201,12 @@ const require$$23 = _dll_classnames;
156156
156201
  }
156157
156202
  });
156158
156203
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (event) {
156159
- var _this$keyPadCharacter;
156160
156204
  log('[onBlur]');
156161
156205
  var relatedTarget = event.relatedTarget;
156162
156206
  var toolbarElement = _this.toolbarRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]")));
156207
+ var keypadInteractionDetected = _this.state.keypadInteractionDetected;
156163
156208
  var isRawDoneButton = _this.doneButtonRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat(_this.doneButtonRef.className, "\"]")));
156164
- var isKeyPadCharacterButton = _this.keyPadCharacterRef && (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.closest(("[class*=\"").concat((_this$keyPadCharacter = _this.keyPadCharacterRef.current) === null || _this$keyPadCharacter === void 0 ? void 0 : _this$keyPadCharacter.className, "\"]")));
156165
- _this.skipBlurHandling = isKeyPadCharacterButton ? true : false;
156209
+ _this.skipBlurHandling = keypadInteractionDetected ? true : false;
156166
156210
  if (toolbarElement && !isRawDoneButton) {
156167
156211
  _this.setState({
156168
156212
  focusToolbar: true
@@ -156183,10 +156227,13 @@ const require$$23 = _dll_classnames;
156183
156227
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDomBlur", function (e) {
156184
156228
  var editorDOM = document.querySelector(("[data-key=\"").concat(_this.state.value.document.key, "\"]"));
156185
156229
  setTimeout(function () {
156186
- var stateValue = _this.state.value;
156230
+ var _this$state2 = _this.state, stateValue = _this$state2.value, keypadInteractionDetected = _this$state2.keypadInteractionDetected;
156187
156231
  if (!_this.wrapperRef) {
156188
156232
  return;
156189
156233
  }
156234
+ if (keypadInteractionDetected) {
156235
+ _this.setKeypadInteraction(false);
156236
+ }
156190
156237
  var editorElement = !editorDOM || document.activeElement.closest(("[class*=\"").concat(editorDOM.className, "\"]"));
156191
156238
  var toolbarElement = !_this.toolbarRef || document.activeElement.closest(("[class*=\"").concat(_this.toolbarRef.className, "\"]"));
156192
156239
  var isInCurrentComponent = _this.wrapperRef.contains(editorElement) || _this.wrapperRef.contains(toolbarElement);
@@ -156200,8 +156247,14 @@ const require$$23 = _dll_classnames;
156200
156247
  });
156201
156248
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onFocus", function (event, change) {
156202
156249
  return new Promise(function (resolve) {
156250
+ var _navigator;
156203
156251
  var editorDOM = document.querySelector(("[data-key=\"").concat(_this.state.value.document.key, "\"]"));
156252
+ var isTouchDevice = typeof window !== 'undefined' && (('ontouchstart' in window) || ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.maxTouchPoints) > 0);
156253
+ var keypadInteractionDetected = _this.state.keypadInteractionDetected;
156204
156254
  log('[onFocus]', document.activeElement);
156255
+ if (keypadInteractionDetected && _this.__TEMPORARY_CHANGE_DATA) {
156256
+ _this.__TEMPORARY_CHANGE_DATA = null;
156257
+ }
156205
156258
  if (_this.__TEMPORARY_CHANGE_DATA) {
156206
156259
  var _this$__TEMPORARY_CHA = _this.__TEMPORARY_CHANGE_DATA, key = _this$__TEMPORARY_CHA.key, data = _this$__TEMPORARY_CHA.data;
156207
156260
  var domEl = document.querySelector(("[data-key=\"").concat(key, "\"]"));
@@ -156222,7 +156275,7 @@ const require$$23 = _dll_classnames;
156222
156275
  }
156223
156276
  _this.stashValue();
156224
156277
  _this.props.onFocus();
156225
- if (!_this.isRelatedTargetButton(event)) {
156278
+ if (!_this.isRelatedTargetButton(event) && !isTouchDevice) {
156226
156279
  change === null || change === void 0 ? void 0 : change.focus();
156227
156280
  }
156228
156281
  resolve();
@@ -156237,7 +156290,7 @@ const require$$23 = _dll_classnames;
156237
156290
  }
156238
156291
  });
156239
156292
  (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resetValue", function (force) {
156240
- var _this$state2 = _this.state, value = _this$state2.value, focusedNode = _this$state2.focusedNode;
156293
+ var _this$state3 = _this.state, value = _this$state3.value, focusedNode = _this$state3.focusedNode;
156241
156294
  var stopReset = _this.plugins.reduce(function (s, p) {
156242
156295
  return s || p.stopReset && p.stopReset(_this.state.value);
156243
156296
  }, false);
@@ -156466,6 +156519,7 @@ const require$$23 = _dll_classnames;
156466
156519
  isHtmlMode: false,
156467
156520
  isEditedInHtmlMode: false,
156468
156521
  focusToolbar: false,
156522
+ keypadInteractionDetected: false,
156469
156523
  dialog: {
156470
156524
  open: false
156471
156525
  }
@@ -156538,7 +156592,7 @@ const require$$23 = _dll_classnames;
156538
156592
  key: "UNSAFE_componentWillReceiveProps",
156539
156593
  value: function UNSAFE_componentWillReceiveProps(nextProps) {
156540
156594
  var _nextProps$value, _nextProps$value$docu, _this$props$value;
156541
- var _this$state3 = this.state, isHtmlMode = _this$state3.isHtmlMode, toolbarOpts = _this$state3.toolbarOpts;
156595
+ var _this$state4 = this.state, isHtmlMode = _this$state4.isHtmlMode, toolbarOpts = _this$state4.toolbarOpts;
156542
156596
  var newToolbarOpts = createToolbarOpts(nextProps.toolbarOpts, nextProps.error, isHtmlMode);
156543
156597
  if (!(0, _isEqual["default"])(newToolbarOpts, toolbarOpts)) {
156544
156598
  this.setState({
@@ -156600,7 +156654,7 @@ const require$$23 = _dll_classnames;
156600
156654
  var _ref4 = pluginProps || ({});
156601
156655
  _ref4.customPlugins;
156602
156656
  var otherPluginProps = (0, _objectWithoutProperties2["default"])(_ref4, _excluded);
156603
- var _this$state4 = this.state, value = _this$state4.value, focusedNode = _this$state4.focusedNode, toolbarOpts = _this$state4.toolbarOpts, dialog = _this$state4.dialog, scheduled = _this$state4.scheduled;
156657
+ var _this$state5 = this.state, value = _this$state5.value, focusedNode = _this$state5.focusedNode, toolbarOpts = _this$state5.toolbarOpts, dialog = _this$state5.dialog, scheduled = _this$state5.scheduled;
156604
156658
  log('[render] value: ', value);
156605
156659
  var sizeStyle = this.buildSizeStyle();
156606
156660
  var names = (0, _classnames["default"])((_classNames = {}, (0, _defineProperty2["default"])(_classNames, classes.withBg, highlightShape), (0, _defineProperty2["default"])(_classNames, classes.toolbarOnTop, toolbarOpts.alwaysVisible && toolbarOpts.position === 'top'), (0, _defineProperty2["default"])(_classNames, classes.scheduled, scheduled), _classNames), className);
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@pie-element/complex-rubric",
3
3
  "repository": "pie-framework/pie-elements",
4
- "version": "2.19.6-next.0+b24cfebfd",
4
+ "version": "2.19.6-next.7+ef8e3d0d5",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
8
8
  "dependencies": {
9
9
  "@material-ui/core": "^3.9.2",
10
- "@pie-element/multi-trait-rubric": "^3.19.6-next.0+b24cfebfd",
11
- "@pie-element/rubric": "^3.19.6-next.0+b24cfebfd",
10
+ "@pie-element/multi-trait-rubric": "^3.19.6-next.7+ef8e3d0d5",
11
+ "@pie-element/rubric": "^3.19.6-next.7+ef8e3d0d5",
12
12
  "@pie-framework/pie-player-events": "^0.1.0",
13
13
  "classnames": "^2.2.5",
14
14
  "debug": "^4.1.1",
15
15
  "lodash": "^4.17.11",
16
16
  "prop-types": "^15.7.2"
17
17
  },
18
- "gitHead": "b24cfebfd92b21a6aa41db7759c8fd2214f88eee",
18
+ "gitHead": "ef8e3d0d5fca4ca57c89c7c8ef8e74ec5600551e",
19
19
  "scripts": {
20
20
  "postpublish": "../../scripts/postpublish"
21
21
  },