@pie-lib/mask-markup 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- # [1.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.16.0) (2025-07-31)
6
+ # [1.18.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.18.0) (2025-07-31)
7
7
 
8
8
  **Note:** Version bump only for package @pie-lib/mask-markup
9
9
 
@@ -11,7 +11,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
11
11
 
12
12
 
13
13
 
14
- # [1.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.15.0) (2025-07-31)
14
+ # [1.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.17.0) (2025-07-31)
15
15
 
16
16
  **Note:** Version bump only for package @pie-lib/mask-markup
17
17
 
@@ -19,7 +19,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
19
19
 
20
20
 
21
21
 
22
- # [1.14.0-beta.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.8) (2025-07-25)
22
+ # [1.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.16.0) (2025-07-31)
23
23
 
24
24
  **Note:** Version bump only for package @pie-lib/mask-markup
25
25
 
@@ -27,7 +27,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
27
27
 
28
28
 
29
29
 
30
- # [1.14.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.7) (2025-07-25)
30
+ # [1.17.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.17.0) (2025-07-31)
31
31
 
32
32
  **Note:** Version bump only for package @pie-lib/mask-markup
33
33
 
@@ -35,7 +35,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
35
35
 
36
36
 
37
37
 
38
- # [1.14.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.7) (2025-07-25)
38
+ # [1.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.16.0) (2025-07-31)
39
39
 
40
40
  **Note:** Version bump only for package @pie-lib/mask-markup
41
41
 
@@ -43,7 +43,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
43
43
 
44
44
 
45
45
 
46
- # [1.14.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.6) (2025-07-25)
46
+ # [1.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.15.0) (2025-07-31)
47
47
 
48
48
  **Note:** Version bump only for package @pie-lib/mask-markup
49
49
 
@@ -51,118 +51,90 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
51
51
 
52
52
 
53
53
 
54
- # [1.14.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.6) (2025-07-25)
54
+ # [1.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.15.0) (2025-07-31)
55
55
 
56
56
  **Note:** Version bump only for package @pie-lib/mask-markup
57
57
 
58
+ # [1.16.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.16.0) (2025-07-31)
58
59
 
60
+ **Note:** Version bump only for package @pie-lib/mask-markup
59
61
 
60
-
61
-
62
- # [1.14.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.5) (2025-07-25)
62
+ # [1.15.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.15.0) (2025-07-31)
63
63
 
64
64
  **Note:** Version bump only for package @pie-lib/mask-markup
65
65
 
66
+ # [1.14.0-beta.8](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.8) (2025-07-25)
66
67
 
68
+ **Note:** Version bump only for package @pie-lib/mask-markup
67
69
 
70
+ # [1.14.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.7) (2025-07-25)
68
71
 
72
+ **Note:** Version bump only for package @pie-lib/mask-markup
69
73
 
70
- # [1.14.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.5) (2025-07-25)
74
+ # [1.14.0-beta.7](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.7) (2025-07-25)
71
75
 
72
76
  **Note:** Version bump only for package @pie-lib/mask-markup
73
77
 
78
+ # [1.14.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.6) (2025-07-25)
74
79
 
80
+ **Note:** Version bump only for package @pie-lib/mask-markup
75
81
 
82
+ # [1.14.0-beta.6](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.6) (2025-07-25)
76
83
 
84
+ **Note:** Version bump only for package @pie-lib/mask-markup
77
85
 
78
- # [1.14.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.4) (2025-07-25)
86
+ # [1.14.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.5) (2025-07-25)
79
87
 
80
88
  **Note:** Version bump only for package @pie-lib/mask-markup
81
89
 
90
+ # [1.14.0-beta.5](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.5) (2025-07-25)
82
91
 
92
+ **Note:** Version bump only for package @pie-lib/mask-markup
83
93
 
94
+ # [1.14.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.4) (2025-07-25)
84
95
 
96
+ **Note:** Version bump only for package @pie-lib/mask-markup
85
97
 
86
98
  # [1.14.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.3) (2025-07-25)
87
99
 
88
100
  **Note:** Version bump only for package @pie-lib/mask-markup
89
101
 
90
-
91
-
92
-
93
-
94
102
  # [1.14.0-beta.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.4) (2025-07-23)
95
103
 
96
104
  **Note:** Version bump only for package @pie-lib/mask-markup
97
105
 
98
-
99
-
100
-
101
-
102
106
  # [1.14.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.3) (2025-07-23)
103
107
 
104
108
  **Note:** Version bump only for package @pie-lib/mask-markup
105
109
 
106
-
107
-
108
-
109
-
110
110
  # [1.14.0-beta.3](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.3) (2025-07-20)
111
111
 
112
112
  **Note:** Version bump only for package @pie-lib/mask-markup
113
113
 
114
-
115
-
116
-
117
-
118
114
  # [1.14.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.2) (2025-07-20)
119
115
 
120
116
  **Note:** Version bump only for package @pie-lib/mask-markup
121
117
 
122
-
123
-
124
-
125
-
126
118
  # [1.14.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.1) (2025-07-20)
127
119
 
128
120
  **Note:** Version bump only for package @pie-lib/mask-markup
129
121
 
130
-
131
-
132
-
133
-
134
122
  # [1.14.0-beta.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.2) (2025-07-20)
135
123
 
136
124
  **Note:** Version bump only for package @pie-lib/mask-markup
137
125
 
138
-
139
-
140
-
141
-
142
126
  # [1.14.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.1) (2025-07-20)
143
127
 
144
128
  **Note:** Version bump only for package @pie-lib/mask-markup
145
129
 
146
-
147
-
148
-
149
-
150
130
  # [1.14.0-beta.1](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.1) (2025-07-20)
151
131
 
152
132
  **Note:** Version bump only for package @pie-lib/mask-markup
153
133
 
154
-
155
-
156
-
157
-
158
134
  # [1.14.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.14.0-beta.0) (2025-07-20)
159
135
 
160
136
  **Note:** Version bump only for package @pie-lib/mask-markup
161
137
 
162
-
163
-
164
-
165
-
166
138
  # [1.15.0-beta.0](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@1.13.46...@pie-lib/mask-markup@1.15.0-beta.0) (2025-07-15)
167
139
 
168
140
  **Note:** Version bump only for package @pie-lib/mask-markup
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-lib/mask-markup",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "src/index.js",
@@ -10,9 +10,10 @@
10
10
  "dependencies": {
11
11
  "@material-ui/core": "^3.9.3",
12
12
  "@material-ui/icons": "^3.0.2",
13
- "@pie-lib/drag": "beta",
14
- "@pie-lib/editable-html": "beta",
15
- "@pie-lib/math-rendering": "beta",
13
+ "@pie-lib/drag": "^2.7.0",
14
+ "@pie-lib/editable-html": "^11.6.0",
15
+ "@pie-lib/math-rendering": "^3.7.0",
16
+ "@pie-lib/render-ui": "^4.20.0",
16
17
  "classnames": "^2.2.6",
17
18
  "debug": "^4.1.1",
18
19
  "immutable": ">=3.8.1",
@@ -30,5 +31,5 @@
30
31
  "keywords": [],
31
32
  "author": "",
32
33
  "license": "ISC",
33
- "gitHead": "ecb1ca31aa1c24d23af00d5ad04ce73ed8871057"
34
+ "gitHead": "889a13bfea2c768b8a3a6eabfc6fe7b7725aa832"
34
35
  }
@@ -6,7 +6,7 @@ import Chip from '@material-ui/core/Chip';
6
6
  import classnames from 'classnames';
7
7
 
8
8
  import { renderMath } from '@pie-lib/math-rendering';
9
- import { color } from '../../../render-ui/src/index';
9
+ import { color } from '@pie-lib/render-ui';
10
10
  import { DragSource } from '@pie-lib/drag';
11
11
 
12
12
  export const DRAG_TYPE = 'MaskBlank';
@@ -8,7 +8,7 @@ import { DragSource, DropTarget } from '@pie-lib/drag';
8
8
  import { withStyles } from '@material-ui/core/styles';
9
9
  import Chip from '@material-ui/core/Chip';
10
10
  import classnames from 'classnames';
11
- import { color } from '../../../render-ui/src/index';
11
+ import { color } from '@pie-lib/render-ui';
12
12
 
13
13
  const log = debug('pie-lib:mask-markup:blank');
14
14
  export const DRAG_TYPE = 'MaskBlank';
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import OutlinedInput from '@material-ui/core/OutlinedInput';
3
3
  import classnames from 'classnames';
4
4
  import { withStyles } from '@material-ui/core/styles';
5
- import { color } from '../../../render-ui/src/index';
5
+ import { color } from '@pie-lib/render-ui';
6
6
 
7
7
  const correctStyle = (color) => ({
8
8
  borderColor: `${color} !important`,
@@ -12,7 +12,7 @@ import { withStyles } from '@material-ui/core/styles';
12
12
  import classNames from 'classnames';
13
13
  import isEqual from 'lodash/isEqual';
14
14
 
15
- import { color } from '../../../render-ui/src/index';
15
+ import { color } from '@pie-lib/render-ui';
16
16
  import { renderMath } from '@pie-lib/math-rendering';
17
17
 
18
18
  class Dropdown extends React.Component {
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { withStyles } from '@material-ui/core/styles';
3
3
  import classnames from 'classnames';
4
4
 
5
- import { color } from '../../render-ui/src/index';
5
+ import { color } from '@pie-lib/render-ui';
6
6
  import EditableHtml from '@pie-lib/editable-html';
7
7
  import { withMask } from './with-mask';
8
8
 
@@ -1,221 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = exports.DRAG_TYPE = exports.BlankContent = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
- var _react = _interopRequireDefault(require("react"));
25
-
26
- var _reactDom = _interopRequireDefault(require("react-dom"));
27
-
28
- var _propTypes = _interopRequireDefault(require("prop-types"));
29
-
30
- var _styles = require("@material-ui/core/styles");
31
-
32
- var _Chip = _interopRequireDefault(require("@material-ui/core/Chip"));
33
-
34
- var _classnames = _interopRequireDefault(require("classnames"));
35
-
36
- var _mathRendering = require("@pie-lib/math-rendering");
37
-
38
- var _index = require("./../shared/index");
39
-
40
- var _drag = require("@pie-lib/drag");
41
-
42
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
43
-
44
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
45
-
46
- var DRAG_TYPE = 'MaskBlank';
47
- exports.DRAG_TYPE = DRAG_TYPE;
48
-
49
- var BlankContentComp = /*#__PURE__*/function (_React$Component) {
50
- (0, _inherits2["default"])(BlankContentComp, _React$Component);
51
-
52
- var _super = _createSuper(BlankContentComp);
53
-
54
- function BlankContentComp() {
55
- var _this;
56
-
57
- (0, _classCallCheck2["default"])(this, BlankContentComp);
58
-
59
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
60
- args[_key] = arguments[_key];
61
- }
62
-
63
- _this = _super.call.apply(_super, [this].concat(args));
64
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "startDrag", function () {
65
- var _this$props = _this.props,
66
- connectDragSource = _this$props.connectDragSource,
67
- disabled = _this$props.disabled;
68
-
69
- if (!disabled) {
70
- connectDragSource(_this.dragContainerRef);
71
- }
72
- });
73
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleTouchStart", function (e) {
74
- e.preventDefault();
75
- _this.longPressTimer = setTimeout(function () {
76
- _this.startDrag(e);
77
- }, 500);
78
- });
79
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleTouchEnd", function () {
80
- clearTimeout(_this.longPressTimer);
81
- });
82
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleTouchMove", function () {
83
- clearTimeout(_this.longPressTimer);
84
- });
85
- return _this;
86
- }
87
-
88
- (0, _createClass2["default"])(BlankContentComp, [{
89
- key: "componentDidMount",
90
- value: function componentDidMount() {
91
- if (this.dragContainerRef) {
92
- this.dragContainerRef.addEventListener('touchstart', this.handleTouchStart, {
93
- passive: false
94
- });
95
- this.dragContainerRef.addEventListener('touchend', this.handleTouchEnd);
96
- this.dragContainerRef.addEventListener('touchmove', this.handleTouchMove);
97
- }
98
- }
99
- }, {
100
- key: "componentWillUnmount",
101
- value: function componentWillUnmount() {
102
- if (this.dragContainerRef) {
103
- this.dragContainerRef.removeEventListener('touchstart', this.handleTouchStart);
104
- this.dragContainerRef.removeEventListener('touchend', this.handleTouchEnd);
105
- this.dragContainerRef.removeEventListener('touchmove', this.handleTouchMove);
106
- }
107
- }
108
- }, {
109
- key: "componentDidUpdate",
110
- value: function componentDidUpdate() {
111
- (0, _mathRendering.renderMath)(this.rootRef);
112
- }
113
- }, {
114
- key: "render",
115
- value: function render() {
116
- var _this2 = this;
117
-
118
- var _this$props2 = this.props,
119
- connectDragSource = _this$props2.connectDragSource,
120
- choice = _this$props2.choice,
121
- classes = _this$props2.classes,
122
- disabled = _this$props2.disabled; // TODO the Chip element is causing drag problems on touch devices. Avoid using Chip and consider refactoring the code. Keep in mind that Chip is a span with a button role, which interferes with seamless touch device dragging.
123
-
124
- return connectDragSource( /*#__PURE__*/_react["default"].createElement("span", {
125
- className: (0, _classnames["default"])(classes.choice, disabled && classes.disabled),
126
- ref: function ref(_ref3) {
127
- //eslint-disable-next-line
128
- _this2.dragContainerRef = _reactDom["default"].findDOMNode(_ref3);
129
- }
130
- }, /*#__PURE__*/_react["default"].createElement(_Chip["default"], {
131
- clickable: false,
132
- disabled: true,
133
- ref: function ref(_ref2) {
134
- //eslint-disable-next-line
135
- _this2.rootRef = _reactDom["default"].findDOMNode(_ref2);
136
- },
137
- className: classes.chip,
138
- label: /*#__PURE__*/_react["default"].createElement("span", {
139
- className: classes.chipLabel,
140
- ref: function ref(_ref) {
141
- if (_ref) {
142
- _ref.innerHTML = choice.value || ' ';
143
- }
144
- }
145
- }, ' '),
146
- variant: disabled ? 'outlined' : undefined
147
- })), {});
148
- }
149
- }]);
150
- return BlankContentComp;
151
- }(_react["default"].Component);
152
-
153
- (0, _defineProperty2["default"])(BlankContentComp, "propTypes", {
154
- disabled: _propTypes["default"].bool,
155
- choice: _propTypes["default"].object,
156
- classes: _propTypes["default"].object,
157
- connectDragSource: _propTypes["default"].func
158
- });
159
- var BlankContent = (0, _styles.withStyles)(function (theme) {
160
- return {
161
- choice: {
162
- border: "solid 0px ".concat(theme.palette.primary.main),
163
- borderRadius: theme.spacing.unit * 2,
164
- margin: theme.spacing.unit / 2,
165
- transform: 'translate(0, 0)'
166
- },
167
- chip: {
168
- backgroundColor: _index.color.white(),
169
- border: "1px solid ".concat(_index.color.text()),
170
- color: _index.color.text(),
171
- alignItems: 'center',
172
- display: 'inline-flex',
173
- height: 'initial',
174
- minHeight: '32px',
175
- fontSize: 'inherit',
176
- whiteSpace: 'pre-wrap',
177
- maxWidth: '374px',
178
- // Added for touch devices, for image content.
179
- // This will prevent the context menu from appearing and not allowing other interactions with the image.
180
- // If interactions with the image in the token will be requested we should handle only the context Menu.
181
- pointerEvents: 'none',
182
- borderRadius: '3px',
183
- paddingTop: '12px',
184
- paddingBottom: '12px'
185
- },
186
- chipLabel: {
187
- whiteSpace: 'normal',
188
- '& img': {
189
- display: 'block',
190
- padding: '2px 0'
191
- },
192
- '& mjx-frac': {
193
- fontSize: '120% !important'
194
- }
195
- },
196
- disabled: {
197
- opacity: 0.6
198
- }
199
- };
200
- })(BlankContentComp);
201
- exports.BlankContent = BlankContent;
202
- var tileSource = {
203
- canDrag: function canDrag(props) {
204
- return !props.disabled;
205
- },
206
- beginDrag: function beginDrag(props) {
207
- return {
208
- choice: props.choice,
209
- instanceId: props.instanceId
210
- };
211
- }
212
- };
213
- var DragDropTile = (0, _drag.DragSource)(DRAG_TYPE, tileSource, function (connect, monitor) {
214
- return {
215
- connectDragSource: connect.dragSource(),
216
- isDragging: monitor.isDragging()
217
- };
218
- })(BlankContent);
219
- var _default = DragDropTile;
220
- exports["default"] = _default;
221
- //# sourceMappingURL=choice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/choices/choice.jsx"],"names":["DRAG_TYPE","BlankContentComp","props","connectDragSource","disabled","dragContainerRef","e","preventDefault","longPressTimer","setTimeout","startDrag","clearTimeout","addEventListener","handleTouchStart","passive","handleTouchEnd","handleTouchMove","removeEventListener","rootRef","choice","classes","ref","ReactDOM","findDOMNode","chip","chipLabel","innerHTML","value","undefined","React","Component","PropTypes","bool","object","func","BlankContent","theme","border","palette","primary","main","borderRadius","spacing","unit","margin","transform","backgroundColor","color","white","text","alignItems","display","height","minHeight","fontSize","whiteSpace","maxWidth","pointerEvents","paddingTop","paddingBottom","padding","opacity","tileSource","canDrag","beginDrag","instanceId","DragDropTile","connect","monitor","dragSource","isDragging"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAEO,IAAMA,SAAS,GAAG,WAAlB;;;IAEDC,gB;;;;;;;;;;;;;;;kGAQQ,YAAM;AAChB,wBAAwC,MAAKC,KAA7C;AAAA,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EAAAA,OADiB,mBACT7D,KADS,EACF;AACb,WAAO,CAACA,KAAK,CAACE,QAAd;AACD,GAHgB;AAIjB4D,EAAAA,SAJiB,qBAIP9D,KAJO,EAIA;AACf,WAAO;AACLiB,MAAAA,MAAM,EAAEjB,KAAK,CAACiB,MADT;AAEL8C,MAAAA,UAAU,EAAE/D,KAAK,CAAC+D;AAFb,KAAP;AAID;AATgB,CAAnB;AAYA,IAAMC,YAAY,GAAG,sBAAWlE,SAAX,EAAsB8D,UAAtB,EAAkC,UAACK,OAAD,EAAUC,OAAV;AAAA,SAAuB;AAC5EjE,IAAAA,iBAAiB,EAAEgE,OAAO,CAACE,UAAR,EADyD;AAE5EC,IAAAA,UAAU,EAAEF,OAAO,CAACE,UAAR;AAFgE,GAAvB;AAAA,CAAlC,EAGjBnC,YAHiB,CAArB;eAKe+B,Y","sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport Chip from '@material-ui/core/Chip';\nimport classnames from 'classnames';\n\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { color } from '../../../render-ui/src/index';\nimport { DragSource } from '@pie-lib/drag';\n\nexport const DRAG_TYPE = 'MaskBlank';\n\nclass BlankContentComp extends React.Component {\n static propTypes = {\n disabled: PropTypes.bool,\n choice: PropTypes.object,\n classes: PropTypes.object,\n connectDragSource: PropTypes.func,\n };\n\n startDrag = () => {\n const { connectDragSource, disabled } = this.props;\n if (!disabled) {\n connectDragSource(this.dragContainerRef);\n }\n };\n\n // start drag after 500ms (touch and hold duration) for chromebooks and other touch devices PD-4888\n handleTouchStart = (e) => {\n e.preventDefault();\n this.longPressTimer = setTimeout(() => {\n this.startDrag(e);\n }, 500);\n };\n\n handleTouchEnd = () => {\n clearTimeout(this.longPressTimer);\n };\n\n handleTouchMove = () => {\n clearTimeout(this.longPressTimer);\n };\n\n componentDidMount() {\n if (this.dragContainerRef) {\n this.dragContainerRef.addEventListener('touchstart', this.handleTouchStart, { passive: false });\n this.dragContainerRef.addEventListener('touchend', this.handleTouchEnd);\n this.dragContainerRef.addEventListener('touchmove', this.handleTouchMove);\n }\n }\n\n componentWillUnmount() {\n if (this.dragContainerRef) {\n this.dragContainerRef.removeEventListener('touchstart', this.handleTouchStart);\n this.dragContainerRef.removeEventListener('touchend', this.handleTouchEnd);\n this.dragContainerRef.removeEventListener('touchmove', this.handleTouchMove);\n }\n }\n\n componentDidUpdate() {\n renderMath(this.rootRef);\n }\n\n render() {\n const { connectDragSource, choice, classes, disabled } = this.props;\n\n // TODO the Chip element is causing drag problems on touch devices. Avoid using Chip and consider refactoring the code. Keep in mind that Chip is a span with a button role, which interferes with seamless touch device dragging.\n\n return connectDragSource(\n <span\n className={classnames(classes.choice, disabled && classes.disabled)}\n ref={(ref) => {\n //eslint-disable-next-line\n this.dragContainerRef = ReactDOM.findDOMNode(ref);\n }}\n >\n <Chip\n clickable={false}\n disabled={true}\n ref={(ref) => {\n //eslint-disable-next-line\n this.rootRef = ReactDOM.findDOMNode(ref);\n }}\n className={classes.chip}\n label={\n <span\n className={classes.chipLabel}\n ref={(ref) => {\n if (ref) {\n ref.innerHTML = choice.value || ' ';\n }\n }}\n >\n {' '}\n </span>\n }\n variant={disabled ? 'outlined' : undefined}\n />\n </span>,\n {},\n );\n }\n}\n\nexport const BlankContent = withStyles((theme) => ({\n choice: {\n border: `solid 0px ${theme.palette.primary.main}`,\n borderRadius: theme.spacing.unit * 2,\n margin: theme.spacing.unit / 2,\n transform: 'translate(0, 0)',\n },\n chip: {\n backgroundColor: color.white(),\n border: `1px solid ${color.text()}`,\n color: color.text(),\n alignItems: 'center',\n display: 'inline-flex',\n height: 'initial',\n minHeight: '32px',\n fontSize: 'inherit',\n whiteSpace: 'pre-wrap',\n maxWidth: '374px',\n // Added for touch devices, for image content.\n // This will prevent the context menu from appearing and not allowing other interactions with the image.\n // If interactions with the image in the token will be requested we should handle only the context Menu.\n pointerEvents: 'none',\n borderRadius: '3px',\n paddingTop: '12px',\n paddingBottom: '12px',\n },\n chipLabel: {\n whiteSpace: 'normal',\n '& img': {\n display: 'block',\n padding: '2px 0',\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n },\n disabled: {\n opacity: 0.6,\n },\n}))(BlankContentComp);\n\nconst tileSource = {\n canDrag(props) {\n return !props.disabled;\n },\n beginDrag(props) {\n return {\n choice: props.choice,\n instanceId: props.instanceId,\n };\n },\n};\n\nconst DragDropTile = DragSource(DRAG_TYPE, tileSource, (connect, monitor) => ({\n connectDragSource: connect.dragSource(),\n isDragging: monitor.isDragging(),\n}))(BlankContent);\n\nexport default DragDropTile;\n"],"file":"choice.js"}
@@ -1,135 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
- var _react = _interopRequireDefault(require("react"));
25
-
26
- var _propTypes = _interopRequireDefault(require("prop-types"));
27
-
28
- var _findKey = _interopRequireDefault(require("lodash/findKey"));
29
-
30
- var _choice = _interopRequireDefault(require("./choice"));
31
-
32
- var _drag = require("@pie-lib/drag");
33
-
34
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
35
-
36
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
37
-
38
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
39
-
40
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
41
-
42
- var Choices = /*#__PURE__*/function (_React$Component) {
43
- (0, _inherits2["default"])(Choices, _React$Component);
44
-
45
- var _super = _createSuper(Choices);
46
-
47
- function Choices() {
48
- var _this;
49
-
50
- (0, _classCallCheck2["default"])(this, Choices);
51
-
52
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
53
- args[_key] = arguments[_key];
54
- }
55
-
56
- _this = _super.call.apply(_super, [this].concat(args));
57
- (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getStyleForWrapper", function () {
58
- var choicePosition = _this.props.choicePosition;
59
-
60
- switch (choicePosition) {
61
- case 'above':
62
- return {
63
- margin: '0 0 40px 0'
64
- };
65
-
66
- case 'below':
67
- return {
68
- margin: '40px 0 0 0'
69
- };
70
-
71
- case 'right':
72
- return {
73
- margin: '0 0 0 40px'
74
- };
75
-
76
- default:
77
- return {
78
- margin: '0 40px 0 0'
79
- };
80
- }
81
- });
82
- return _this;
83
- }
84
-
85
- (0, _createClass2["default"])(Choices, [{
86
- key: "render",
87
- value: function render() {
88
- var _this$props = this.props,
89
- disabled = _this$props.disabled,
90
- duplicates = _this$props.duplicates,
91
- choices = _this$props.choices,
92
- value = _this$props.value;
93
- var filteredChoices = choices.filter(function (c) {
94
- if (duplicates === true) {
95
- return true;
96
- }
97
-
98
- var foundChoice = (0, _findKey["default"])(value, function (v) {
99
- return v === c.id;
100
- });
101
- return foundChoice === undefined;
102
- });
103
-
104
- var elementStyle = _objectSpread(_objectSpread({}, this.getStyleForWrapper()), {}, {
105
- minWidth: '100px'
106
- });
107
-
108
- return /*#__PURE__*/_react["default"].createElement("div", {
109
- style: elementStyle
110
- }, /*#__PURE__*/_react["default"].createElement(_drag.DragDroppablePlaceholder, {
111
- disabled: disabled
112
- }, filteredChoices.map(function (c, index) {
113
- return /*#__PURE__*/_react["default"].createElement(_choice["default"], {
114
- key: "".concat(c.value, "-").concat(index),
115
- disabled: disabled,
116
- choice: c
117
- });
118
- })));
119
- }
120
- }]);
121
- return Choices;
122
- }(_react["default"].Component);
123
-
124
- exports["default"] = Choices;
125
- (0, _defineProperty2["default"])(Choices, "propTypes", {
126
- disabled: _propTypes["default"].bool,
127
- duplicates: _propTypes["default"].bool,
128
- choices: _propTypes["default"].arrayOf(_propTypes["default"].shape({
129
- label: _propTypes["default"].string,
130
- value: _propTypes["default"].string
131
- })),
132
- value: _propTypes["default"].object,
133
- choicePosition: _propTypes["default"].string.isRequired
134
- });
135
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/choices/index.jsx"],"names":["Choices","choicePosition","props","margin","disabled","duplicates","choices","value","filteredChoices","filter","c","foundChoice","v","id","undefined","elementStyle","getStyleForWrapper","minWidth","map","index","React","Component","PropTypes","bool","arrayOf","shape","label","string","object","isRequired"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;IAEqBA,O;;;;;;;;;;;;;;;2GASE,YAAM;AACzB,UAAQC,cAAR,GAA2B,MAAKC,KAAhC,CAAQD,cAAR;;AAEA,cAAQA,cAAR;AACE,aAAK,OAAL;AACE,iBAAO;AACLE,YAAAA,MAAM,EAAE;AADH,WAAP;;AAIF,aAAK,OAAL;AACE,iBAAO;AACLA,YAAAA,MAAM,EAAE;AADH,WAAP;;AAIF,aAAK,OAAL;AACE,iBAAO;AACLA,YAAAA,MAAM,EAAE;AADH,WAAP;;AAIF;AACE,iBAAO;AACLA,YAAAA,MAAM,EAAE;AADH,WAAP;AAjBJ;AAqBD,K;;;;;;WAED,kBAAS;AACP,wBAAiD,KAAKD,KAAtD;AAAA,UAAQE,QAAR,eAAQA,QAAR;AAAA,UAAkBC,UAAlB,eAAkBA,UAAlB;AAAA,UAA8BC,OAA9B,eAA8BA,OAA9B;AAAA,UAAuCC,KAAvC,eAAuCA,KAAvC;AACA,UAAMC,eAAe,GAAGF,OAAO,CAACG,MAAR,CAAe,UAACC,CAAD,EAAO;AAC5C,YAAIL,UAAU,KAAK,IAAnB,EAAyB;AACvB,iBAAO,IAAP;AACD;;AACD,YAAMM,WAAW,GAAG,yBAAQJ,KAAR,EAAe,UAACK,CAAD;AAAA,iBAAOA,CAAC,KAAKF,CAAC,CAACG,EAAf;AAAA,SAAf,CAApB;AACA,eAAOF,WAAW,KAAKG,SAAvB;AACD,OANuB,CAAxB;;AAOA,UAAMC,YAAY,mCAAQ,KAAKC,kBAAL,EAAR;AAAmCC,QAAAA,QAAQ,EAAE;AAA7C,QAAlB;;AAEA,0BACE;AAAK,QAAA,KAAK,EAAEF;AAAZ,sBACE,gCAAC,8BAAD;AAA0B,QAAA,QAAQ,EAAEX;AAApC,SACGI,eAAe,CAACU,GAAhB,CAAoB,UAACR,CAAD,EAAIS,KAAJ;AAAA,4BACnB,gCAAC,kBAAD;AAAQ,UAAA,GAAG,YAAKT,CAAC,CAACH,KAAP,cAAgBY,KAAhB,CAAX;AAAoC,UAAA,QAAQ,EAAEf,QAA9C;AAAwD,UAAA,MAAM,EAAEM;AAAhE,UADmB;AAAA,OAApB,CADH,CADF,CADF;AASD;;;EAvDkCU,kBAAMC,S;;;iCAAtBrB,O,eACA;AACjBI,EAAAA,QAAQ,EAAEkB,sBAAUC,IADH;AAEjBlB,EAAAA,UAAU,EAAEiB,sBAAUC,IAFL;AAGjBjB,EAAAA,OAAO,EAAEgB,sBAAUE,OAAV,CAAkBF,sBAAUG,KAAV,CAAgB;AAAEC,IAAAA,KAAK,EAAEJ,sBAAUK,MAAnB;AAA2BpB,IAAAA,KAAK,EAAEe,sBAAUK;AAA5C,GAAhB,CAAlB,CAHQ;AAIjBpB,EAAAA,KAAK,EAAEe,sBAAUM,MAJA;AAKjB3B,EAAAA,cAAc,EAAEqB,sBAAUK,MAAV,CAAiBE;AALhB,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport findKey from 'lodash/findKey';\nimport Choice from './choice';\nimport { DragDroppablePlaceholder } from '@pie-lib/drag';\n\nexport default class Choices extends React.Component {\n static propTypes = {\n disabled: PropTypes.bool,\n duplicates: PropTypes.bool,\n choices: PropTypes.arrayOf(PropTypes.shape({ label: PropTypes.string, value: PropTypes.string })),\n value: PropTypes.object,\n choicePosition: PropTypes.string.isRequired,\n };\n\n getStyleForWrapper = () => {\n const { choicePosition } = this.props;\n\n switch (choicePosition) {\n case 'above':\n return {\n margin: '0 0 40px 0',\n };\n\n case 'below':\n return {\n margin: '40px 0 0 0',\n };\n\n case 'right':\n return {\n margin: '0 0 0 40px',\n };\n\n default:\n return {\n margin: '0 40px 0 0',\n };\n }\n };\n\n render() {\n const { disabled, duplicates, choices, value } = this.props;\n const filteredChoices = choices.filter((c) => {\n if (duplicates === true) {\n return true;\n }\n const foundChoice = findKey(value, (v) => v === c.id);\n return foundChoice === undefined;\n });\n const elementStyle = { ...this.getStyleForWrapper(), minWidth: '100px' };\n\n return (\n <div style={elementStyle}>\n <DragDroppablePlaceholder disabled={disabled}>\n {filteredChoices.map((c, index) => (\n <Choice key={`${c.value}-${index}`} disabled={disabled} choice={c} />\n ))}\n </DragDroppablePlaceholder>\n </div>\n );\n }\n}\n"],"file":"index.js"}