@pie-lib/mask-markup 2.1.0-next.2 → 2.1.0-next.30

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,6 +3,14 @@
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
+ # [2.1.0-next.4](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@2.1.0-next.2...@pie-lib/mask-markup@2.1.0-next.4) (2026-01-27)
7
+
8
+ **Note:** Version bump only for package @pie-lib/mask-markup
9
+
10
+
11
+
12
+
13
+
6
14
  # [2.1.0-next.2](https://github.com/pie-framework/pie-lib/compare/@pie-lib/mask-markup@2.1.0-next.1...@pie-lib/mask-markup@2.1.0-next.2) (2026-01-26)
7
15
 
8
16
 
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.js");
4
+ require("core-js/modules/es.array.filter.js");
5
+ require("core-js/modules/es.array.for-each.js");
6
+ require("core-js/modules/es.array.iterator.js");
7
+ require("core-js/modules/es.object.define-properties.js");
8
+ require("core-js/modules/es.object.define-property.js");
9
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
10
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
11
+ require("core-js/modules/es.object.keys.js");
12
+ require("core-js/modules/es.object.to-string.js");
13
+ require("core-js/modules/es.string.iterator.js");
14
+ require("core-js/modules/es.weak-map.js");
15
+ require("core-js/modules/web.dom-collections.for-each.js");
16
+ require("core-js/modules/web.dom-collections.iterator.js");
17
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
18
+ var _typeof = require("@babel/runtime/helpers/typeof");
19
+ Object.defineProperty(exports, "__esModule", {
20
+ value: true
21
+ });
22
+ exports.DRAG_TYPE = void 0;
23
+ exports["default"] = Choice;
24
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
25
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
26
+ var _react = _interopRequireWildcard(require("react"));
27
+ var _propTypes = _interopRequireDefault(require("prop-types"));
28
+ var _core = require("@dnd-kit/core");
29
+ var _styles = require("@mui/material/styles");
30
+ var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
31
+ var _mathRendering = require("@pie-lib/math-rendering");
32
+ var _renderUi = require("@pie-lib/render-ui");
33
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
34
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
36
+ var DRAG_TYPE = exports.DRAG_TYPE = 'MaskBlank';
37
+ var StyledChoice = (0, _styles.styled)('span')(function (_ref) {
38
+ var theme = _ref.theme,
39
+ disabled = _ref.disabled;
40
+ return _objectSpread({
41
+ border: "solid 0px ".concat(theme.palette.primary.main),
42
+ borderRadius: theme.spacing(2),
43
+ margin: theme.spacing(0.5),
44
+ transform: 'translate(0, 0)',
45
+ display: 'inline-flex'
46
+ }, disabled && {});
47
+ });
48
+ var StyledChip = (0, _styles.styled)(_Chip["default"])(function () {
49
+ return {
50
+ backgroundColor: _renderUi.color.white(),
51
+ border: "1px solid ".concat(_renderUi.color.text()),
52
+ color: _renderUi.color.text(),
53
+ alignItems: 'center',
54
+ display: 'inline-flex',
55
+ height: 'initial',
56
+ minHeight: '32px',
57
+ fontSize: 'inherit',
58
+ whiteSpace: 'pre-wrap',
59
+ maxWidth: '374px',
60
+ // Added for touch devices, for image content.
61
+ // This will prevent the context menu from appearing and not allowing other interactions with the image.
62
+ // If interactions with the image in the token will be requested we should handle only the context Menu.
63
+ pointerEvents: 'none',
64
+ borderRadius: '3px',
65
+ paddingTop: '12px',
66
+ paddingBottom: '12px',
67
+ '&.Mui-disabled': {
68
+ opacity: 1
69
+ }
70
+ };
71
+ });
72
+ var StyledChipLabel = (0, _styles.styled)('span')(function () {
73
+ return {
74
+ whiteSpace: 'normal',
75
+ '& img': {
76
+ display: 'block',
77
+ padding: '2px 0'
78
+ },
79
+ '& mjx-frac': {
80
+ fontSize: '120% !important'
81
+ }
82
+ };
83
+ });
84
+ function Choice(_ref2) {
85
+ var _rootRef$current, _rootRef$current2;
86
+ var choice = _ref2.choice,
87
+ disabled = _ref2.disabled,
88
+ instanceId = _ref2.instanceId;
89
+ var rootRef = (0, _react.useRef)(null);
90
+ var _useDraggable = (0, _core.useDraggable)({
91
+ id: "choice-".concat(choice.id),
92
+ data: {
93
+ choice: choice,
94
+ instanceId: instanceId,
95
+ fromChoice: true,
96
+ type: DRAG_TYPE
97
+ },
98
+ disabled: disabled
99
+ }),
100
+ attributes = _useDraggable.attributes,
101
+ listeners = _useDraggable.listeners,
102
+ setNodeRef = _useDraggable.setNodeRef,
103
+ isDragging = _useDraggable.isDragging;
104
+ (0, _react.useEffect)(function () {
105
+ (0, _mathRendering.renderMath)(rootRef.current);
106
+ }, [choice.value]);
107
+ return /*#__PURE__*/_react["default"].createElement(StyledChoice, (0, _extends2["default"])({
108
+ ref: setNodeRef,
109
+ style: isDragging ? {
110
+ width: (_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.offsetWidth,
111
+ height: (_rootRef$current2 = rootRef.current) === null || _rootRef$current2 === void 0 ? void 0 : _rootRef$current2.offsetHeight
112
+ } : {},
113
+ disabled: disabled
114
+ }, listeners, attributes), /*#__PURE__*/_react["default"].createElement(StyledChip, {
115
+ clickable: false,
116
+ disabled: disabled,
117
+ ref: rootRef,
118
+ label: /*#__PURE__*/_react["default"].createElement(StyledChipLabel, {
119
+ dangerouslySetInnerHTML: {
120
+ __html: choice.value
121
+ }
122
+ })
123
+ }));
124
+ }
125
+ Choice.propTypes = {
126
+ choice: _propTypes["default"].object.isRequired,
127
+ disabled: _propTypes["default"].bool,
128
+ instanceId: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
129
+ };
130
+ //# sourceMappingURL=choice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"choice.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_core","_styles","_Chip","_mathRendering","_renderUi","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","DRAG_TYPE","exports","StyledChoice","styled","_ref","theme","disabled","border","concat","palette","primary","main","borderRadius","spacing","margin","transform","display","StyledChip","Chip","backgroundColor","color","white","text","alignItems","height","minHeight","fontSize","whiteSpace","maxWidth","pointerEvents","paddingTop","paddingBottom","opacity","StyledChipLabel","padding","Choice","_ref2","_rootRef$current","_rootRef$current2","choice","instanceId","rootRef","useRef","_useDraggable","useDraggable","id","data","fromChoice","type","attributes","listeners","setNodeRef","isDragging","useEffect","renderMath","current","value","createElement","_extends2","ref","style","width","offsetWidth","offsetHeight","clickable","label","dangerouslySetInnerHTML","__html","propTypes","PropTypes","object","isRequired","bool","oneOfType","string","number"],"sources":["../../src/choices/choice.jsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { useDraggable } from '@dnd-kit/core';\nimport { styled } from '@mui/material/styles';\nimport Chip from '@mui/material/Chip';\nimport { renderMath } from '@pie-lib/math-rendering';\nimport { color } from '@pie-lib/render-ui';\n\nexport const DRAG_TYPE = 'MaskBlank';\n\nconst StyledChoice = styled('span')(({ theme, disabled }) => ({\n border: `solid 0px ${theme.palette.primary.main}`,\n borderRadius: theme.spacing(2),\n margin: theme.spacing(0.5),\n transform: 'translate(0, 0)',\n display: 'inline-flex',\n ...(disabled && {}),\n}));\n\nconst StyledChip = styled(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 '&.Mui-disabled': {\n opacity: 1,\n },\n}));\n\nconst StyledChipLabel = styled('span')(() => ({\n whiteSpace: 'normal',\n '& img': {\n display: 'block',\n padding: '2px 0',\n },\n '& mjx-frac': {\n fontSize: '120% !important',\n },\n}));\n\nexport default function Choice({ choice, disabled, instanceId }) {\n const rootRef = useRef(null);\n\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id: `choice-${choice.id}`,\n data: { choice, instanceId, fromChoice: true, type: DRAG_TYPE },\n disabled,\n });\n\n useEffect(() => {\n renderMath(rootRef.current);\n }, [choice.value]);\n\n return (\n <StyledChoice\n ref={setNodeRef}\n style={\n isDragging\n ? {\n width: rootRef.current?.offsetWidth,\n height: rootRef.current?.offsetHeight,\n }\n : {}\n }\n disabled={disabled}\n {...listeners}\n {...attributes}\n >\n <StyledChip\n clickable={false}\n disabled={disabled}\n ref={rootRef}\n label={<StyledChipLabel dangerouslySetInnerHTML={{ __html: choice.value }} />}\n />\n </StyledChoice>\n );\n}\n\nChoice.propTypes = {\n choice: PropTypes.object.isRequired,\n disabled: PropTypes.bool,\n instanceId: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAA2C,SAAAD,wBAAAS,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,wBAAAS,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,C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EAElB,oBACEpG,MAAA,YAAAqG,aAAA,CAACvD,YAAY,MAAAwD,SAAA;IACXC,GAAG,EAAER,UAAW;IAChBS,KAAK,EACHR,UAAU,GACN;MACES,KAAK,GAAAxB,gBAAA,GAAEI,OAAO,CAACc,OAAO,cAAAlB,gBAAA,uBAAfA,gBAAA,CAAiByB,WAAW;MACnCtC,MAAM,GAAAc,iBAAA,GAAEG,OAAO,CAACc,OAAO,cAAAjB,iBAAA,uBAAfA,iBAAA,CAAiByB;IAC3B,CAAC,GACD,CAAC,CACN;IACDzD,QAAQ,EAAEA;EAAS,GACf4C,SAAS,EACTD,UAAU,gBAEd7F,MAAA,YAAAqG,aAAA,CAACxC,UAAU;IACT+C,SAAS,EAAE,KAAM;IACjB1D,QAAQ,EAAEA,QAAS;IACnBqD,GAAG,EAAElB,OAAQ;IACbwB,KAAK,eAAE7G,MAAA,YAAAqG,aAAA,CAACxB,eAAe;MAACiC,uBAAuB,EAAE;QAAEC,MAAM,EAAE5B,MAAM,CAACiB;MAAM;IAAE,CAAE;EAAE,CAC/E,CACW,CAAC;AAEnB;AAEArB,MAAM,CAACiC,SAAS,GAAG;EACjB7B,MAAM,EAAE8B,qBAAS,CAACC,MAAM,CAACC,UAAU;EACnCjE,QAAQ,EAAE+D,qBAAS,CAACG,IAAI;EACxBhC,UAAU,EAAE6B,qBAAS,CAACI,SAAS,CAAC,CAACJ,qBAAS,CAACK,MAAM,EAAEL,qBAAS,CAACM,MAAM,CAAC;AACtE,CAAC","ignoreList":[]}
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.js");
4
+ require("core-js/modules/es.array.for-each.js");
5
+ require("core-js/modules/es.object.define-properties.js");
6
+ require("core-js/modules/es.object.define-property.js");
7
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
8
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
9
+ require("core-js/modules/es.object.keys.js");
10
+ require("core-js/modules/es.reflect.construct.js");
11
+ require("core-js/modules/web.dom-collections.for-each.js");
12
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
13
+ Object.defineProperty(exports, "__esModule", {
14
+ value: true
15
+ });
16
+ exports["default"] = void 0;
17
+ require("core-js/modules/es.array.concat.js");
18
+ require("core-js/modules/es.array.filter.js");
19
+ require("core-js/modules/es.array.map.js");
20
+ require("core-js/modules/es.object.to-string.js");
21
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
22
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
23
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
24
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
25
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
26
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
27
+ var _react = _interopRequireDefault(require("react"));
28
+ var _propTypes = _interopRequireDefault(require("prop-types"));
29
+ var _findKey = _interopRequireDefault(require("lodash/findKey"));
30
+ var _choice = _interopRequireDefault(require("./choice"));
31
+ var _drag = require("@pie-lib/drag");
32
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
33
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
34
+ function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
35
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
36
+ var Choices = exports["default"] = /*#__PURE__*/function (_React$Component) {
37
+ function Choices() {
38
+ var _this;
39
+ (0, _classCallCheck2["default"])(this, Choices);
40
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
41
+ args[_key] = arguments[_key];
42
+ }
43
+ _this = _callSuper(this, Choices, [].concat(args));
44
+ (0, _defineProperty2["default"])(_this, "getStyleForWrapper", function () {
45
+ var choicePosition = _this.props.choicePosition;
46
+ switch (choicePosition) {
47
+ case 'above':
48
+ return {
49
+ margin: '0 0 40px 0'
50
+ };
51
+ case 'below':
52
+ return {
53
+ margin: '40px 0 0 0'
54
+ };
55
+ case 'right':
56
+ return {
57
+ margin: '0 0 0 40px'
58
+ };
59
+ default:
60
+ return {
61
+ margin: '0 40px 0 0'
62
+ };
63
+ }
64
+ });
65
+ return _this;
66
+ }
67
+ (0, _inherits2["default"])(Choices, _React$Component);
68
+ return (0, _createClass2["default"])(Choices, [{
69
+ key: "render",
70
+ value: function render() {
71
+ var _this$props = this.props,
72
+ disabled = _this$props.disabled,
73
+ duplicates = _this$props.duplicates,
74
+ choices = _this$props.choices,
75
+ value = _this$props.value,
76
+ instanceId = _this$props.instanceId;
77
+ var filteredChoices = choices.filter(function (c) {
78
+ if (duplicates === true) {
79
+ return true;
80
+ }
81
+ var foundChoice = (0, _findKey["default"])(value, function (v) {
82
+ return v === c.id;
83
+ });
84
+ return foundChoice === undefined;
85
+ });
86
+ var elementStyle = _objectSpread(_objectSpread({}, this.getStyleForWrapper()), {}, {
87
+ minWidth: '100px'
88
+ });
89
+ return /*#__PURE__*/_react["default"].createElement("div", {
90
+ style: elementStyle
91
+ }, /*#__PURE__*/_react["default"].createElement(_drag.DragDroppablePlaceholder, {
92
+ disabled: disabled,
93
+ instanceId: instanceId
94
+ }, filteredChoices.map(function (c, index) {
95
+ return /*#__PURE__*/_react["default"].createElement(_choice["default"], {
96
+ key: "".concat(c.value, "-").concat(index),
97
+ disabled: disabled,
98
+ choice: c,
99
+ instanceId: instanceId
100
+ });
101
+ })));
102
+ }
103
+ }]);
104
+ }(_react["default"].Component);
105
+ (0, _defineProperty2["default"])(Choices, "propTypes", {
106
+ disabled: _propTypes["default"].bool,
107
+ duplicates: _propTypes["default"].bool,
108
+ choices: _propTypes["default"].arrayOf(_propTypes["default"].shape({
109
+ label: _propTypes["default"].string,
110
+ value: _propTypes["default"].string
111
+ })),
112
+ value: _propTypes["default"].object,
113
+ choicePosition: _propTypes["default"].string.isRequired,
114
+ instanceId: _propTypes["default"].string // Added for drag isolation
115
+ });
116
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_react","_interopRequireDefault","require","_propTypes","_findKey","_choice","_drag","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_callSuper","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct","Reflect","construct","constructor","Boolean","prototype","valueOf","call","Choices","exports","_React$Component","_this","_classCallCheck2","_len","args","Array","_key","concat","choicePosition","props","margin","_inherits2","_createClass2","key","value","render","_this$props","disabled","duplicates","choices","instanceId","filteredChoices","c","foundChoice","findKey","v","id","undefined","elementStyle","getStyleForWrapper","minWidth","createElement","style","DragDroppablePlaceholder","map","index","choice","React","Component","PropTypes","bool","arrayOf","shape","label","string","object","isRequired"],"sources":["../../src/choices/index.jsx"],"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 instanceId: PropTypes.string, // Added for drag isolation\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, instanceId } = 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} instanceId={instanceId}>\n {filteredChoices.map((c, index) => (\n <Choice \n key={`${c.value}-${index}`} \n disabled={disabled} \n choice={c} \n instanceId={instanceId}\n />\n ))}\n </DragDroppablePlaceholder>\n </div>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAAyD,SAAAK,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MA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EAAEJ,qBAAS,CAACK,MAAM;IAAE9B,KAAK,EAAEyB,qBAAS,CAACK;EAAO,CAAC,CAAC,CAAC;EACjG9B,KAAK,EAAEyB,qBAAS,CAACM,MAAM;EACvBrC,cAAc,EAAE+B,qBAAS,CAACK,MAAM,CAACE,UAAU;EAC3C1B,UAAU,EAAEmB,qBAAS,CAACK,MAAM,CAAE;AAChC,CAAC","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ require("core-js/modules/es.array.concat.js");
9
+ require("core-js/modules/es.regexp.exec.js");
10
+ require("core-js/modules/es.string.replace.js");
11
+ var REGEX = /\{\{(\d+)\}\}/g;
12
+ var _default = exports["default"] = function _default(s, t) {
13
+ if (!s) {
14
+ return {
15
+ markup: ''
16
+ };
17
+ }
18
+ var markup = s.replace(REGEX, function (match, g) {
19
+ return "<span data-component=\"".concat(t, "\" data-id=\"").concat(g, "\"></span>");
20
+ });
21
+ return {
22
+ markup: markup
23
+ };
24
+ };
25
+ //# sourceMappingURL=componentize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentize.js","names":["REGEX","_default","exports","s","t","markup","replace","match","g","concat"],"sources":["../src/componentize.js"],"sourcesContent":["const REGEX = /\\{\\{(\\d+)\\}\\}/g;\n\nexport default (s, t) => {\n if (!s) {\n return { markup: '' };\n }\n\n const markup = s.replace(REGEX, (match, g) => {\n return `<span data-component=\"${t}\" data-id=\"${g}\"></span>`;\n });\n\n return { markup };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAMA,KAAK,GAAG,gBAAgB;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEhB,SAAAD,SAACE,CAAC,EAAEC,CAAC,EAAK;EACvB,IAAI,CAACD,CAAC,EAAE;IACN,OAAO;MAAEE,MAAM,EAAE;IAAG,CAAC;EACvB;EAEA,IAAMA,MAAM,GAAGF,CAAC,CAACG,OAAO,CAACN,KAAK,EAAE,UAACO,KAAK,EAAEC,CAAC,EAAK;IAC5C,iCAAAC,MAAA,CAAgCL,CAAC,mBAAAK,MAAA,CAAcD,CAAC;EAClD,CAAC,CAAC;EAEF,OAAO;IAAEH,MAAM,EAANA;EAAO,CAAC;AACnB,CAAC","ignoreList":[]}