@pie-lib/mask-markup 3.0.4-next.31 → 3.0.4-next.32
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/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/choices/choice.d.ts +24 -0
- package/dist/choices/choice.js +77 -0
- package/dist/choices/index.d.ts +25 -0
- package/dist/choices/index.js +49 -0
- package/dist/componentize.d.ts +12 -0
- package/dist/componentize.js +4 -0
- package/dist/components/blank.d.ts +39 -0
- package/dist/components/blank.js +240 -0
- package/dist/components/correct-input.d.ts +11 -0
- package/dist/components/dropdown.d.ts +37 -0
- package/dist/components/dropdown.js +320 -0
- package/dist/components/input.d.ts +37 -0
- package/dist/constructed-response.d.ts +44 -0
- package/dist/constructed-response.js +55 -0
- package/dist/customizable.d.ts +43 -0
- package/dist/customizable.js +8 -0
- package/dist/drag-in-the-blank.d.ts +37 -0
- package/dist/drag-in-the-blank.js +164 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +7 -0
- package/dist/inline-dropdown.d.ts +44 -0
- package/dist/inline-dropdown.js +24 -0
- package/dist/mask.d.ts +30 -0
- package/dist/mask.js +99 -0
- package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
- package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
- package/dist/serialization.d.ts +34 -0
- package/dist/serialization.js +132 -0
- package/dist/with-mask.d.ts +55 -0
- package/dist/with-mask.js +45 -0
- package/package.json +39 -20
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1256
- package/LICENSE.md +0 -5
- package/lib/choices/choice.js +0 -116
- package/lib/choices/choice.js.map +0 -1
- package/lib/choices/index.js +0 -103
- package/lib/choices/index.js.map +0 -1
- package/lib/componentize.js +0 -21
- package/lib/componentize.js.map +0 -1
- package/lib/components/blank.js +0 -371
- package/lib/components/blank.js.map +0 -1
- package/lib/components/correct-input.js +0 -94
- package/lib/components/correct-input.js.map +0 -1
- package/lib/components/dropdown.js +0 -483
- package/lib/components/dropdown.js.map +0 -1
- package/lib/components/input.js +0 -50
- package/lib/components/input.js.map +0 -1
- package/lib/constructed-response.js +0 -101
- package/lib/constructed-response.js.map +0 -1
- package/lib/customizable.js +0 -42
- package/lib/customizable.js.map +0 -1
- package/lib/drag-in-the-blank.js +0 -254
- package/lib/drag-in-the-blank.js.map +0 -1
- package/lib/index.js +0 -55
- package/lib/index.js.map +0 -1
- package/lib/inline-dropdown.js +0 -40
- package/lib/inline-dropdown.js.map +0 -1
- package/lib/mask.js +0 -198
- package/lib/mask.js.map +0 -1
- package/lib/serialization.js +0 -261
- package/lib/serialization.js.map +0 -1
- package/lib/with-mask.js +0 -97
- package/lib/with-mask.js.map +0 -1
- package/src/__tests__/drag-in-the-blank.test.js +0 -111
- package/src/__tests__/index.test.js +0 -38
- package/src/__tests__/mask.test.js +0 -381
- package/src/__tests__/serialization.test.js +0 -54
- package/src/__tests__/utils.js +0 -1
- package/src/__tests__/with-mask.test.js +0 -76
- package/src/choices/__tests__/index.test.js +0 -75
- package/src/choices/choice.jsx +0 -97
- package/src/choices/index.jsx +0 -64
- package/src/componentize.js +0 -13
- package/src/components/__tests__/blank.test.js +0 -199
- package/src/components/__tests__/correct-input.test.js +0 -90
- package/src/components/__tests__/dropdown.test.js +0 -129
- package/src/components/__tests__/input.test.js +0 -102
- package/src/components/blank.jsx +0 -386
- package/src/components/correct-input.jsx +0 -82
- package/src/components/dropdown.jsx +0 -423
- package/src/components/input.jsx +0 -48
- package/src/constructed-response.jsx +0 -87
- package/src/customizable.jsx +0 -34
- package/src/drag-in-the-blank.jsx +0 -241
- package/src/index.js +0 -16
- package/src/inline-dropdown.jsx +0 -29
- package/src/mask.jsx +0 -172
- package/src/serialization.js +0 -260
- package/src/with-mask.jsx +0 -75
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/choices/choice.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare const DRAG_TYPE = "MaskBlank";
|
|
12
|
+
declare function Choice({ choice, disabled, instanceId }: {
|
|
13
|
+
choice: any;
|
|
14
|
+
disabled: any;
|
|
15
|
+
instanceId: any;
|
|
16
|
+
}): React.JSX.Element;
|
|
17
|
+
declare namespace Choice {
|
|
18
|
+
var propTypes: {
|
|
19
|
+
choice: PropTypes.Validator<object>;
|
|
20
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
21
|
+
instanceId: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export default Choice;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t } from "react";
|
|
2
|
+
import n from "prop-types";
|
|
3
|
+
import { styled as r } from "@mui/material/styles";
|
|
4
|
+
import { renderMath as i } from "@pie-element/shared-math-rendering-mathjax";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
|
+
import { useDraggable as o } from "@dnd-kit/core";
|
|
7
|
+
import s from "@mui/material/Chip";
|
|
8
|
+
import { color as c } from "@pie-lib/render-ui";
|
|
9
|
+
//#region src/choices/choice.tsx
|
|
10
|
+
var l = "MaskBlank", u = r("span")(({ theme: e, disabled: t }) => ({
|
|
11
|
+
border: `solid 0px ${e.palette.primary.main}`,
|
|
12
|
+
borderRadius: e.spacing(2),
|
|
13
|
+
margin: e.spacing(.5),
|
|
14
|
+
transform: "translate(0, 0)",
|
|
15
|
+
display: "inline-flex",
|
|
16
|
+
...t && {}
|
|
17
|
+
})), d = r(s)(() => ({
|
|
18
|
+
backgroundColor: c.white(),
|
|
19
|
+
border: `1px solid ${c.text()}`,
|
|
20
|
+
color: c.text(),
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
display: "inline-flex",
|
|
23
|
+
height: "initial",
|
|
24
|
+
minHeight: "32px",
|
|
25
|
+
fontSize: "inherit",
|
|
26
|
+
whiteSpace: "pre-wrap",
|
|
27
|
+
maxWidth: "374px",
|
|
28
|
+
pointerEvents: "none",
|
|
29
|
+
borderRadius: "3px",
|
|
30
|
+
paddingTop: "12px",
|
|
31
|
+
paddingBottom: "12px",
|
|
32
|
+
"&.Mui-disabled": { opacity: 1 }
|
|
33
|
+
})), f = r("span")(() => ({
|
|
34
|
+
whiteSpace: "normal",
|
|
35
|
+
"& img": {
|
|
36
|
+
display: "block",
|
|
37
|
+
padding: "2px 0"
|
|
38
|
+
},
|
|
39
|
+
"& mjx-frac": { fontSize: "120% !important" }
|
|
40
|
+
}));
|
|
41
|
+
function p({ choice: n, disabled: r, instanceId: s }) {
|
|
42
|
+
let c = t(null), { attributes: p, listeners: m, setNodeRef: h, isDragging: g } = o({
|
|
43
|
+
id: `choice-${n.id}`,
|
|
44
|
+
data: {
|
|
45
|
+
choice: n,
|
|
46
|
+
instanceId: s,
|
|
47
|
+
fromChoice: !0,
|
|
48
|
+
type: l
|
|
49
|
+
},
|
|
50
|
+
disabled: r
|
|
51
|
+
});
|
|
52
|
+
return e(() => {
|
|
53
|
+
i(c.current);
|
|
54
|
+
}, [n.value]), /* @__PURE__ */ a(u, {
|
|
55
|
+
ref: h,
|
|
56
|
+
style: g ? {
|
|
57
|
+
width: c.current?.offsetWidth,
|
|
58
|
+
height: c.current?.offsetHeight
|
|
59
|
+
} : {},
|
|
60
|
+
disabled: r,
|
|
61
|
+
...m,
|
|
62
|
+
...p,
|
|
63
|
+
children: /* @__PURE__ */ a(d, {
|
|
64
|
+
clickable: !1,
|
|
65
|
+
disabled: r,
|
|
66
|
+
ref: c,
|
|
67
|
+
label: /* @__PURE__ */ a(f, { dangerouslySetInnerHTML: { __html: n.value } })
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
p.propTypes = {
|
|
72
|
+
choice: n.object.isRequired,
|
|
73
|
+
disabled: n.bool,
|
|
74
|
+
instanceId: n.oneOfType([n.string, n.number])
|
|
75
|
+
};
|
|
76
|
+
//#endregion
|
|
77
|
+
export { p as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/choices/index.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export default class Choices extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
14
|
+
duplicates: PropTypes.Requireable<boolean>;
|
|
15
|
+
choices: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
16
|
+
label: PropTypes.Requireable<string>;
|
|
17
|
+
value: PropTypes.Requireable<string>;
|
|
18
|
+
}> | null | undefined)[]>;
|
|
19
|
+
value: PropTypes.Requireable<object>;
|
|
20
|
+
choicePosition: PropTypes.Validator<string>;
|
|
21
|
+
instanceId: PropTypes.Requireable<string>;
|
|
22
|
+
};
|
|
23
|
+
getStyleForWrapper: any;
|
|
24
|
+
render(): React.JSX.Element;
|
|
25
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import e from "./choice.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { findKey as r } from "@pie-element/shared-lodash";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { DragDroppablePlaceholder as a } from "@pie-lib/drag";
|
|
7
|
+
//#region src/choices/index.tsx
|
|
8
|
+
var o = class extends t.Component {
|
|
9
|
+
static propTypes = {
|
|
10
|
+
disabled: n.bool,
|
|
11
|
+
duplicates: n.bool,
|
|
12
|
+
choices: n.arrayOf(n.shape({
|
|
13
|
+
label: n.string,
|
|
14
|
+
value: n.string
|
|
15
|
+
})),
|
|
16
|
+
value: n.object,
|
|
17
|
+
choicePosition: n.string.isRequired,
|
|
18
|
+
instanceId: n.string
|
|
19
|
+
};
|
|
20
|
+
getStyleForWrapper = () => {
|
|
21
|
+
let { choicePosition: e } = this.props;
|
|
22
|
+
switch (e) {
|
|
23
|
+
case "above": return { margin: "0 0 40px 0" };
|
|
24
|
+
case "below": return { margin: "40px 0 0 0" };
|
|
25
|
+
case "right": return { margin: "0 0 0 40px" };
|
|
26
|
+
default: return { margin: "0 40px 0 0" };
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
render() {
|
|
30
|
+
let { disabled: t, duplicates: n, choices: o, value: s, instanceId: c } = this.props, l = o.filter((e) => n === !0 ? !0 : r(s, (t) => t === e.id) === void 0);
|
|
31
|
+
return /* @__PURE__ */ i("div", {
|
|
32
|
+
style: {
|
|
33
|
+
...this.getStyleForWrapper(),
|
|
34
|
+
minWidth: "100px"
|
|
35
|
+
},
|
|
36
|
+
children: /* @__PURE__ */ i(a, {
|
|
37
|
+
disabled: t,
|
|
38
|
+
instanceId: c,
|
|
39
|
+
children: l.map((n, r) => /* @__PURE__ */ i(e, {
|
|
40
|
+
disabled: t,
|
|
41
|
+
choice: n,
|
|
42
|
+
instanceId: c
|
|
43
|
+
}, `${n.value}-${r}`))
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { o as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/componentize.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: (s: any, t: any) => {
|
|
10
|
+
markup: any;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/components/blank.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
declare function DragDropBlank({ id, disabled, duplicates, choice, correct, onChange, emptyResponseAreaWidth, emptyResponseAreaHeight, instanceId, }: {
|
|
12
|
+
id: any;
|
|
13
|
+
disabled: any;
|
|
14
|
+
duplicates: any;
|
|
15
|
+
choice: any;
|
|
16
|
+
correct: any;
|
|
17
|
+
onChange: any;
|
|
18
|
+
emptyResponseAreaWidth: any;
|
|
19
|
+
emptyResponseAreaHeight: any;
|
|
20
|
+
instanceId: any;
|
|
21
|
+
}): React.JSX.Element;
|
|
22
|
+
declare namespace DragDropBlank {
|
|
23
|
+
var defaultProps: {
|
|
24
|
+
emptyResponseAreaWidth: number;
|
|
25
|
+
emptyResponseAreaHeight: number;
|
|
26
|
+
};
|
|
27
|
+
var propTypes: {
|
|
28
|
+
id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
29
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
30
|
+
duplicates: PropTypes.Requireable<boolean>;
|
|
31
|
+
choice: PropTypes.Requireable<object>;
|
|
32
|
+
correct: PropTypes.Requireable<boolean>;
|
|
33
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
34
|
+
emptyResponseAreaWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
35
|
+
emptyResponseAreaHeight: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
36
|
+
instanceId: PropTypes.Requireable<string>;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export default DragDropBlank;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import e from "../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
|
|
2
|
+
import t, { useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
import a from "prop-types";
|
|
4
|
+
import { styled as o } from "@mui/material/styles";
|
|
5
|
+
import { renderMath as s } from "@pie-element/shared-math-rendering-mathjax";
|
|
6
|
+
import c from "debug";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
import { useDraggable as d, useDroppable as f } from "@dnd-kit/core";
|
|
9
|
+
import p from "@mui/material/Chip";
|
|
10
|
+
import { color as m } from "@pie-lib/render-ui";
|
|
11
|
+
import { CSS as h } from "@dnd-kit/utilities";
|
|
12
|
+
import { grey as g } from "@mui/material/colors";
|
|
13
|
+
//#region src/components/blank.tsx
|
|
14
|
+
c("pie-lib:mask-markup:blank");
|
|
15
|
+
var _ = o("span")(({ dragged: e, over: t }) => ({
|
|
16
|
+
border: `solid 0px ${m.primary()}`,
|
|
17
|
+
minWidth: "200px",
|
|
18
|
+
touchAction: "none",
|
|
19
|
+
overflow: "hidden",
|
|
20
|
+
whiteSpace: "nowrap",
|
|
21
|
+
opacity: 1,
|
|
22
|
+
...t && {
|
|
23
|
+
whiteSpace: "nowrap",
|
|
24
|
+
overflow: "hidden"
|
|
25
|
+
},
|
|
26
|
+
...e && { opacity: .5 }
|
|
27
|
+
})), v = o(p)(() => ({
|
|
28
|
+
backgroundColor: m.background(),
|
|
29
|
+
border: `2px dashed ${m.text()}`,
|
|
30
|
+
touchAction: "none",
|
|
31
|
+
color: m.text(),
|
|
32
|
+
fontSize: "inherit",
|
|
33
|
+
maxWidth: "374px",
|
|
34
|
+
position: "relative",
|
|
35
|
+
borderRadius: "3px",
|
|
36
|
+
"&.over": {
|
|
37
|
+
whiteSpace: "nowrap",
|
|
38
|
+
overflow: "hidden"
|
|
39
|
+
},
|
|
40
|
+
"&.parentOver": {
|
|
41
|
+
border: `1px solid ${g[500]}`,
|
|
42
|
+
backgroundColor: `${g[300]}`
|
|
43
|
+
},
|
|
44
|
+
"&.correct": { border: `solid 1px ${m.correct()}` },
|
|
45
|
+
"&.incorrect": { border: `solid 1px ${m.incorrect()}` },
|
|
46
|
+
"&.Mui-disabled": { opacity: 1 }
|
|
47
|
+
})), y = o("span")(() => ({
|
|
48
|
+
whiteSpace: "normal",
|
|
49
|
+
pointerEvents: "none",
|
|
50
|
+
"& img": {
|
|
51
|
+
display: "block",
|
|
52
|
+
padding: "2px 0"
|
|
53
|
+
},
|
|
54
|
+
"& p": {
|
|
55
|
+
marginTop: "0",
|
|
56
|
+
marginBottom: "0"
|
|
57
|
+
},
|
|
58
|
+
"& mjx-frac": { fontSize: "120% !important" },
|
|
59
|
+
"&.over": {
|
|
60
|
+
whiteSpace: "nowrap",
|
|
61
|
+
overflow: "hidden"
|
|
62
|
+
},
|
|
63
|
+
"&.hidden": {
|
|
64
|
+
color: "transparent",
|
|
65
|
+
opacity: 0
|
|
66
|
+
},
|
|
67
|
+
"&.dragged": {
|
|
68
|
+
position: "absolute",
|
|
69
|
+
left: 16,
|
|
70
|
+
maxWidth: "60px",
|
|
71
|
+
top: "50%",
|
|
72
|
+
transform: "translateY(-50%)"
|
|
73
|
+
}
|
|
74
|
+
}));
|
|
75
|
+
function b({ disabled: a, choice: o, isOver: c, isDragging: d, dragItem: f, correct: p, emptyResponseAreaWidth: m, emptyResponseAreaHeight: h }) {
|
|
76
|
+
let g = r(null), _ = r(null), b = r(null), [x, S] = i({
|
|
77
|
+
height: 0,
|
|
78
|
+
width: 0
|
|
79
|
+
}), C = () => {
|
|
80
|
+
E();
|
|
81
|
+
}, w = () => {
|
|
82
|
+
let e = _.current?.querySelector("img");
|
|
83
|
+
e ? e.onload = C : setTimeout(() => {
|
|
84
|
+
E();
|
|
85
|
+
}, 300);
|
|
86
|
+
}, T = () => _.current ? _.current.querySelector("mjx-container") && _.current.parentElement ? _.current.parentElement : _.current.querySelector("img") || _.current : null, E = () => {
|
|
87
|
+
if (_.current && g.current) {
|
|
88
|
+
g.current.style.width = "auto", g.current.style.height = "auto", g.current.offsetHeight;
|
|
89
|
+
let e = T() || _.current, t = e.getBoundingClientRect(), n = t.width || e.offsetWidth || 0, r = Math.max(t.height || 0, e.offsetHeight || 0, e.scrollHeight || 0, _.current.scrollHeight || 0), i = n + 24, a = r + 24, o = parseFloat(m) || 0, s = parseFloat(h) || 0, c = i <= o ? o : i, l = a <= s ? s : a;
|
|
90
|
+
S((e) => ({
|
|
91
|
+
width: c > o ? c : e.width,
|
|
92
|
+
height: l > s ? l : e.height
|
|
93
|
+
})), g.current.style.width = `${c}px`, g.current.style.height = `${l}px`;
|
|
94
|
+
}
|
|
95
|
+
}, D = () => {
|
|
96
|
+
let e = isNaN(parseFloat(m)) ? 0 : parseFloat(m), t = isNaN(parseFloat(h)) ? 0 : parseFloat(h);
|
|
97
|
+
return {
|
|
98
|
+
height: x.height || t,
|
|
99
|
+
width: x.width || e,
|
|
100
|
+
...e ? {} : { minWidth: 90 },
|
|
101
|
+
...t ? {} : { minHeight: 32 }
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
n(() => {
|
|
105
|
+
w();
|
|
106
|
+
}, []), n(() => {
|
|
107
|
+
g.current && s(g.current);
|
|
108
|
+
}, [
|
|
109
|
+
p,
|
|
110
|
+
c,
|
|
111
|
+
f?.choice?.value
|
|
112
|
+
]), n(() => {
|
|
113
|
+
if (!o) {
|
|
114
|
+
S({
|
|
115
|
+
height: 0,
|
|
116
|
+
width: 0
|
|
117
|
+
});
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
w();
|
|
121
|
+
}, [o]), n(() => {
|
|
122
|
+
!c && !d && (b.current = {
|
|
123
|
+
width: g.current.offsetWidth,
|
|
124
|
+
height: g.current.offsetHeight
|
|
125
|
+
});
|
|
126
|
+
}, [
|
|
127
|
+
o,
|
|
128
|
+
c,
|
|
129
|
+
d
|
|
130
|
+
]);
|
|
131
|
+
let O = f && c && f.choice && f.choice.value, k = o && o.value, A = c || d ? {
|
|
132
|
+
width: b.current?.width,
|
|
133
|
+
height: b.current?.height
|
|
134
|
+
} : D();
|
|
135
|
+
return /* @__PURE__ */ l(v, {
|
|
136
|
+
clickable: !1,
|
|
137
|
+
disabled: a,
|
|
138
|
+
ref: g,
|
|
139
|
+
component: "span",
|
|
140
|
+
label: /* @__PURE__ */ u(t.Fragment, { children: [/* @__PURE__ */ l(y, {
|
|
141
|
+
ref: _,
|
|
142
|
+
draggable: !0,
|
|
143
|
+
className: e({
|
|
144
|
+
over: c,
|
|
145
|
+
hidden: O
|
|
146
|
+
}),
|
|
147
|
+
dangerouslySetInnerHTML: { __html: k || "" }
|
|
148
|
+
}), O && /* @__PURE__ */ l(y, {
|
|
149
|
+
draggable: !0,
|
|
150
|
+
className: e({
|
|
151
|
+
over: c,
|
|
152
|
+
dragged: !0
|
|
153
|
+
}),
|
|
154
|
+
dangerouslySetInnerHTML: { __html: O || "" }
|
|
155
|
+
})] }),
|
|
156
|
+
className: e({
|
|
157
|
+
over: c,
|
|
158
|
+
parentOver: c,
|
|
159
|
+
correct: p !== void 0 && p,
|
|
160
|
+
incorrect: p !== void 0 && !p
|
|
161
|
+
}),
|
|
162
|
+
variant: a ? "outlined" : void 0,
|
|
163
|
+
style: A
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
b.defaultProps = {
|
|
167
|
+
emptyResponseAreaWidth: 0,
|
|
168
|
+
emptyResponseAreaHeight: 0
|
|
169
|
+
}, b.propTypes = {
|
|
170
|
+
id: a.oneOfType([a.string, a.number]),
|
|
171
|
+
disabled: a.bool,
|
|
172
|
+
duplicates: a.bool,
|
|
173
|
+
choice: a.object,
|
|
174
|
+
isOver: a.bool,
|
|
175
|
+
dragItem: a.object,
|
|
176
|
+
correct: a.bool,
|
|
177
|
+
onChange: a.func,
|
|
178
|
+
emptyResponseAreaWidth: a.oneOfType([a.string, a.number]),
|
|
179
|
+
emptyResponseAreaHeight: a.oneOfType([a.string, a.number]),
|
|
180
|
+
instanceId: a.string
|
|
181
|
+
};
|
|
182
|
+
function x({ id: e, disabled: t, duplicates: n, choice: r, correct: i, onChange: a, emptyResponseAreaWidth: o, emptyResponseAreaHeight: s, instanceId: c }) {
|
|
183
|
+
let { attributes: u, listeners: p, setNodeRef: m, transform: g, isDragging: v } = d({
|
|
184
|
+
id: `mask-blank-drag-${e}`,
|
|
185
|
+
disabled: t || !r,
|
|
186
|
+
data: {
|
|
187
|
+
id: e,
|
|
188
|
+
choice: r,
|
|
189
|
+
instanceId: c,
|
|
190
|
+
fromChoice: !1,
|
|
191
|
+
type: "MaskBlank"
|
|
192
|
+
}
|
|
193
|
+
}), { setNodeRef: y, isOver: x, active: S } = f({
|
|
194
|
+
id: `mask-blank-drop-${e}`,
|
|
195
|
+
data: {
|
|
196
|
+
id: e,
|
|
197
|
+
accepts: ["MaskBlank"],
|
|
198
|
+
instanceId: c
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
return /* @__PURE__ */ l(_, {
|
|
202
|
+
ref: (e) => {
|
|
203
|
+
m(e), y(e);
|
|
204
|
+
},
|
|
205
|
+
style: { transform: h.Translate.toString(g) },
|
|
206
|
+
dragged: v,
|
|
207
|
+
over: x,
|
|
208
|
+
...u,
|
|
209
|
+
...p,
|
|
210
|
+
children: /* @__PURE__ */ l(b, {
|
|
211
|
+
id: e,
|
|
212
|
+
disabled: t,
|
|
213
|
+
duplicates: n,
|
|
214
|
+
choice: r,
|
|
215
|
+
isOver: x,
|
|
216
|
+
dragItem: S?.data?.current,
|
|
217
|
+
correct: i,
|
|
218
|
+
onChange: a,
|
|
219
|
+
emptyResponseAreaWidth: o,
|
|
220
|
+
emptyResponseAreaHeight: s,
|
|
221
|
+
instanceId: c
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
x.defaultProps = {
|
|
226
|
+
emptyResponseAreaWidth: 0,
|
|
227
|
+
emptyResponseAreaHeight: 0
|
|
228
|
+
}, x.propTypes = {
|
|
229
|
+
id: a.oneOfType([a.string, a.number]),
|
|
230
|
+
disabled: a.bool,
|
|
231
|
+
duplicates: a.bool,
|
|
232
|
+
choice: a.object,
|
|
233
|
+
correct: a.bool,
|
|
234
|
+
onChange: a.func,
|
|
235
|
+
emptyResponseAreaWidth: a.oneOfType([a.string, a.number]),
|
|
236
|
+
emptyResponseAreaHeight: a.oneOfType([a.string, a.number]),
|
|
237
|
+
instanceId: a.string
|
|
238
|
+
};
|
|
239
|
+
//#endregion
|
|
240
|
+
export { x as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/components/correct-input.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
declare const CorrectInput: (props: any) => React.JSX.Element;
|
|
11
|
+
export default CorrectInput;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/mask-markup/src/components/dropdown.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
declare class Dropdown extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
id: PropTypes.Requireable<string>;
|
|
14
|
+
value: PropTypes.Requireable<string>;
|
|
15
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
16
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
correct: PropTypes.Requireable<boolean>;
|
|
18
|
+
choices: PropTypes.Requireable<(PropTypes.InferProps<{
|
|
19
|
+
value: PropTypes.Requireable<string>;
|
|
20
|
+
label: PropTypes.Requireable<string>;
|
|
21
|
+
}> | null | undefined)[]>;
|
|
22
|
+
showCorrectAnswer: PropTypes.Requireable<boolean>;
|
|
23
|
+
singleQuery: PropTypes.Requireable<boolean>;
|
|
24
|
+
correctValue: PropTypes.Requireable<string>;
|
|
25
|
+
};
|
|
26
|
+
constructor(props: any);
|
|
27
|
+
componentDidMount(): void;
|
|
28
|
+
componentDidUpdate(prevProps: any, prevState: any): void;
|
|
29
|
+
handleClick: any;
|
|
30
|
+
handleClose: any;
|
|
31
|
+
handleHighlight: any;
|
|
32
|
+
handleSelect: any;
|
|
33
|
+
handleHover: any;
|
|
34
|
+
getLabel(choices: any, value: any): any;
|
|
35
|
+
render(): React.JSX.Element;
|
|
36
|
+
}
|
|
37
|
+
export default Dropdown;
|