@pie-lib/mask-markup 0.1.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/dist/_virtual/_rolldown/runtime.js +4 -0
- package/dist/choices/choice.d.ts +24 -0
- package/dist/choices/choice.d.ts.map +1 -0
- package/dist/choices/choice.js +77 -0
- package/dist/choices/index.d.ts +26 -0
- package/dist/choices/index.d.ts.map +1 -0
- package/dist/choices/index.js +49 -0
- package/dist/componentize.d.ts +13 -0
- package/dist/componentize.d.ts.map +1 -0
- package/dist/componentize.js +4 -0
- package/dist/components/blank.d.ts +39 -0
- package/dist/components/blank.d.ts.map +1 -0
- package/dist/components/blank.js +236 -0
- package/dist/components/correct-input.d.ts +11 -0
- package/dist/components/correct-input.d.ts.map +1 -0
- package/dist/components/dropdown.d.ts +38 -0
- package/dist/components/dropdown.d.ts.map +1 -0
- package/dist/components/dropdown.js +309 -0
- package/dist/components/input.d.ts +37 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/constructed-response.d.ts +24 -0
- package/dist/constructed-response.d.ts.map +1 -0
- package/dist/constructed-response.js +55 -0
- package/dist/customizable.d.ts +24 -0
- package/dist/customizable.d.ts.map +1 -0
- package/dist/customizable.js +8 -0
- package/dist/drag-in-the-blank.d.ts +38 -0
- package/dist/drag-in-the-blank.d.ts.map +1 -0
- package/dist/drag-in-the-blank.js +164 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/inline-dropdown.d.ts +24 -0
- package/dist/inline-dropdown.d.ts.map +1 -0
- package/dist/inline-dropdown.js +24 -0
- package/dist/mask.d.ts +31 -0
- package/dist/mask.d.ts.map +1 -0
- package/dist/mask.js +98 -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 +35 -0
- package/dist/serialization.d.ts.map +1 -0
- package/dist/serialization.js +132 -0
- package/dist/with-mask.d.ts +35 -0
- package/dist/with-mask.d.ts.map +1 -0
- package/dist/with-mask.js +45 -0
- package/package.json +44 -0
- package/src/choices/choice.tsx +107 -0
- package/src/choices/index.tsx +74 -0
- package/src/componentize.tsx +23 -0
- package/src/components/blank.tsx +396 -0
- package/src/components/correct-input.tsx +92 -0
- package/src/components/dropdown.tsx +448 -0
- package/src/components/input.tsx +58 -0
- package/src/constructed-response.tsx +91 -0
- package/src/customizable.tsx +44 -0
- package/src/drag-in-the-blank.tsx +251 -0
- package/src/index.ts +26 -0
- package/src/inline-dropdown.tsx +39 -0
- package/src/mask.tsx +178 -0
- package/src/serialization.ts +270 -0
- package/src/with-mask.tsx +85 -0
|
@@ -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 PropTypes from 'prop-types';
|
|
10
|
+
export declare const DRAG_TYPE = "MaskBlank";
|
|
11
|
+
declare function Choice({ choice, disabled, instanceId }: {
|
|
12
|
+
choice: any;
|
|
13
|
+
disabled: any;
|
|
14
|
+
instanceId: any;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
declare namespace Choice {
|
|
17
|
+
var propTypes: {
|
|
18
|
+
choice: PropTypes.Validator<object>;
|
|
19
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
20
|
+
instanceId: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export default Choice;
|
|
24
|
+
//# sourceMappingURL=choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"choice.d.ts","sourceRoot":"","sources":["../../src/choices/choice.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAOnC,eAAO,MAAM,SAAS,cAAc,CAAC;AA8CrC,iBAAwB,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE;;;;CAAA,eAoC9D;kBApCuB,MAAM;;;;;;;eAAN,MAAM"}
|
|
@@ -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,26 @@
|
|
|
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(): JSX.Element;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/choices/index.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,KAAK,CAAC,SAAS;IAClD,MAAM,CAAC,SAAS;;;;;;;;;;MAOd;IAEF,kBAAkB,EAAE,GAAG,CAwBrB;IAEF,MAAM;CAqBP"}
|
|
@@ -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 "lodash-es";
|
|
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,13 @@
|
|
|
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;
|
|
13
|
+
//# sourceMappingURL=componentize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentize.d.ts","sourceRoot":"","sources":["../src/componentize.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;yBAIa,MAAC,EAAE,MAAC;;;AAApB,wBAUE"}
|
|
@@ -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 PropTypes from 'prop-types';
|
|
10
|
+
declare function DragDropBlank({ id, disabled, duplicates, choice, correct, onChange, emptyResponseAreaWidth, emptyResponseAreaHeight, instanceId, }: {
|
|
11
|
+
id: any;
|
|
12
|
+
disabled: any;
|
|
13
|
+
duplicates: any;
|
|
14
|
+
choice: any;
|
|
15
|
+
correct: any;
|
|
16
|
+
onChange: any;
|
|
17
|
+
emptyResponseAreaWidth: any;
|
|
18
|
+
emptyResponseAreaHeight: any;
|
|
19
|
+
instanceId: any;
|
|
20
|
+
}): JSX.Element;
|
|
21
|
+
declare namespace DragDropBlank {
|
|
22
|
+
var defaultProps: {
|
|
23
|
+
emptyResponseAreaWidth: number;
|
|
24
|
+
emptyResponseAreaHeight: number;
|
|
25
|
+
};
|
|
26
|
+
var propTypes: {
|
|
27
|
+
id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
28
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
29
|
+
duplicates: PropTypes.Requireable<boolean>;
|
|
30
|
+
choice: PropTypes.Requireable<object>;
|
|
31
|
+
correct: PropTypes.Requireable<boolean>;
|
|
32
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
33
|
+
emptyResponseAreaWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
34
|
+
emptyResponseAreaHeight: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
35
|
+
instanceId: PropTypes.Requireable<string>;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export default DragDropBlank;
|
|
39
|
+
//# sourceMappingURL=blank.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blank.d.ts","sourceRoot":"","sources":["../../src/components/blank.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AA+RnC,iBAAS,aAAa,CAAC,EACrB,EAAE,EACF,QAAQ,EACR,UAAU,EACV,MAAM,EACN,OAAO,EACP,QAAQ,EACR,sBAAsB,EACtB,uBAAuB,EACvB,UAAU,GACX;;;;;;;;;;CAAA,eAoEA;kBA9EQ,aAAa;;;;;;;;;;;;;;;;;AAiGtB,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import e, { useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
import i from "prop-types";
|
|
3
|
+
import { styled as a } from "@mui/material/styles";
|
|
4
|
+
import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
|
|
5
|
+
import s from "debug";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { useDraggable as u, useDroppable as d } from "@dnd-kit/core";
|
|
8
|
+
import f from "@mui/material/Chip";
|
|
9
|
+
import { color as p } from "@pie-lib/render-ui";
|
|
10
|
+
import { CSS as m } from "@dnd-kit/utilities";
|
|
11
|
+
import h from "classnames";
|
|
12
|
+
import { grey as g } from "@mui/material/colors";
|
|
13
|
+
//#region src/components/blank.tsx
|
|
14
|
+
s("pie-lib:mask-markup:blank");
|
|
15
|
+
var _ = a("span")(({ dragged: e, over: t }) => ({
|
|
16
|
+
border: `solid 0px ${p.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 = a(f)(() => ({
|
|
28
|
+
backgroundColor: p.background(),
|
|
29
|
+
border: `2px dashed ${p.text()}`,
|
|
30
|
+
touchAction: "none",
|
|
31
|
+
color: p.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 ${p.correct()}` },
|
|
45
|
+
"&.incorrect": { border: `solid 1px ${p.incorrect()}` },
|
|
46
|
+
"&.Mui-disabled": { opacity: 1 }
|
|
47
|
+
})), y = a("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: i, choice: a, isOver: s, isDragging: u, dragItem: d, correct: f, emptyResponseAreaWidth: p, emptyResponseAreaHeight: m }) {
|
|
76
|
+
let g = n(null), _ = n(null), b = n(null), [x, S] = r({
|
|
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(p) || 0, s = parseFloat(m) || 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(p)) ? 0 : parseFloat(p), t = isNaN(parseFloat(m)) ? 0 : parseFloat(m);
|
|
97
|
+
return {
|
|
98
|
+
height: x.height || t,
|
|
99
|
+
width: x.width || e,
|
|
100
|
+
...e ? {} : { minWidth: 90 },
|
|
101
|
+
...t ? {} : { minHeight: 32 }
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
t(() => {
|
|
105
|
+
w();
|
|
106
|
+
}, []), t(() => {
|
|
107
|
+
g.current && o(g.current);
|
|
108
|
+
}, [s, d?.choice?.value]), t(() => {
|
|
109
|
+
if (!a) {
|
|
110
|
+
S({
|
|
111
|
+
height: 0,
|
|
112
|
+
width: 0
|
|
113
|
+
});
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
w();
|
|
117
|
+
}, [a]), t(() => {
|
|
118
|
+
!s && !u && (b.current = {
|
|
119
|
+
width: g.current.offsetWidth,
|
|
120
|
+
height: g.current.offsetHeight
|
|
121
|
+
});
|
|
122
|
+
}, [
|
|
123
|
+
a,
|
|
124
|
+
s,
|
|
125
|
+
u
|
|
126
|
+
]);
|
|
127
|
+
let O = d && s && d.choice && d.choice.value, k = a && a.value, A = s || u ? {
|
|
128
|
+
width: b.current?.width,
|
|
129
|
+
height: b.current?.height
|
|
130
|
+
} : D();
|
|
131
|
+
return /* @__PURE__ */ c(v, {
|
|
132
|
+
clickable: !1,
|
|
133
|
+
disabled: i,
|
|
134
|
+
ref: g,
|
|
135
|
+
component: "span",
|
|
136
|
+
label: /* @__PURE__ */ l(e.Fragment, { children: [/* @__PURE__ */ c(y, {
|
|
137
|
+
ref: _,
|
|
138
|
+
draggable: !0,
|
|
139
|
+
className: h({
|
|
140
|
+
over: s,
|
|
141
|
+
hidden: O
|
|
142
|
+
}),
|
|
143
|
+
dangerouslySetInnerHTML: { __html: k || "" }
|
|
144
|
+
}), O && /* @__PURE__ */ c(y, {
|
|
145
|
+
draggable: !0,
|
|
146
|
+
className: h({
|
|
147
|
+
over: s,
|
|
148
|
+
dragged: !0
|
|
149
|
+
}),
|
|
150
|
+
dangerouslySetInnerHTML: { __html: O || "" }
|
|
151
|
+
})] }),
|
|
152
|
+
className: h({
|
|
153
|
+
over: s,
|
|
154
|
+
parentOver: s,
|
|
155
|
+
correct: f !== void 0 && f,
|
|
156
|
+
incorrect: f !== void 0 && !f
|
|
157
|
+
}),
|
|
158
|
+
variant: i ? "outlined" : void 0,
|
|
159
|
+
style: A
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
b.defaultProps = {
|
|
163
|
+
emptyResponseAreaWidth: 0,
|
|
164
|
+
emptyResponseAreaHeight: 0
|
|
165
|
+
}, b.propTypes = {
|
|
166
|
+
id: i.oneOfType([i.string, i.number]),
|
|
167
|
+
disabled: i.bool,
|
|
168
|
+
duplicates: i.bool,
|
|
169
|
+
choice: i.object,
|
|
170
|
+
isOver: i.bool,
|
|
171
|
+
dragItem: i.object,
|
|
172
|
+
correct: i.bool,
|
|
173
|
+
onChange: i.func,
|
|
174
|
+
emptyResponseAreaWidth: i.oneOfType([i.string, i.number]),
|
|
175
|
+
emptyResponseAreaHeight: i.oneOfType([i.string, i.number]),
|
|
176
|
+
instanceId: i.string
|
|
177
|
+
};
|
|
178
|
+
function x({ id: e, disabled: t, duplicates: n, choice: r, correct: i, onChange: a, emptyResponseAreaWidth: o, emptyResponseAreaHeight: s, instanceId: l }) {
|
|
179
|
+
let { attributes: f, listeners: p, setNodeRef: h, transform: g, isDragging: v } = u({
|
|
180
|
+
id: `mask-blank-drag-${e}`,
|
|
181
|
+
disabled: t || !r,
|
|
182
|
+
data: {
|
|
183
|
+
id: e,
|
|
184
|
+
choice: r,
|
|
185
|
+
instanceId: l,
|
|
186
|
+
fromChoice: !1,
|
|
187
|
+
type: "MaskBlank"
|
|
188
|
+
}
|
|
189
|
+
}), { setNodeRef: y, isOver: x, active: S } = d({
|
|
190
|
+
id: `mask-blank-drop-${e}`,
|
|
191
|
+
data: {
|
|
192
|
+
id: e,
|
|
193
|
+
accepts: ["MaskBlank"],
|
|
194
|
+
instanceId: l
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return /* @__PURE__ */ c(_, {
|
|
198
|
+
ref: (e) => {
|
|
199
|
+
h(e), y(e);
|
|
200
|
+
},
|
|
201
|
+
style: { transform: m.Translate.toString(g) },
|
|
202
|
+
dragged: v,
|
|
203
|
+
over: x,
|
|
204
|
+
...f,
|
|
205
|
+
...p,
|
|
206
|
+
children: /* @__PURE__ */ c(b, {
|
|
207
|
+
id: e,
|
|
208
|
+
disabled: t,
|
|
209
|
+
duplicates: n,
|
|
210
|
+
choice: r,
|
|
211
|
+
isOver: x,
|
|
212
|
+
dragItem: S?.data?.current,
|
|
213
|
+
correct: i,
|
|
214
|
+
onChange: a,
|
|
215
|
+
emptyResponseAreaWidth: o,
|
|
216
|
+
emptyResponseAreaHeight: s,
|
|
217
|
+
instanceId: l
|
|
218
|
+
})
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
x.defaultProps = {
|
|
222
|
+
emptyResponseAreaWidth: 0,
|
|
223
|
+
emptyResponseAreaHeight: 0
|
|
224
|
+
}, x.propTypes = {
|
|
225
|
+
id: i.oneOfType([i.string, i.number]),
|
|
226
|
+
disabled: i.bool,
|
|
227
|
+
duplicates: i.bool,
|
|
228
|
+
choice: i.object,
|
|
229
|
+
correct: i.bool,
|
|
230
|
+
onChange: i.func,
|
|
231
|
+
emptyResponseAreaWidth: i.oneOfType([i.string, i.number]),
|
|
232
|
+
emptyResponseAreaHeight: i.oneOfType([i.string, i.number]),
|
|
233
|
+
instanceId: i.string
|
|
234
|
+
};
|
|
235
|
+
//#endregion
|
|
236
|
+
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
|
+
declare const CorrectInput: (props: any) => JSX.Element;
|
|
10
|
+
export default CorrectInput;
|
|
11
|
+
//# sourceMappingURL=correct-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"correct-input.d.ts","sourceRoot":"","sources":["../../src/components/correct-input.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAiDH,QAAA,MAAM,YAAY,GAAI,UAAK,gBAgC1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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: (event: any) => any;
|
|
30
|
+
handleClose: any;
|
|
31
|
+
handleHighlight: any;
|
|
32
|
+
handleSelect: any;
|
|
33
|
+
handleHover: any;
|
|
34
|
+
getLabel(choices: any, value: any): any;
|
|
35
|
+
render(): JSX.Element;
|
|
36
|
+
}
|
|
37
|
+
export default Dropdown;
|
|
38
|
+
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../src/components/dropdown.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA2LnC,cAAM,QAAS,SAAQ,KAAK,CAAC,SAAS;IACpC,MAAM,CAAC,SAAS;;;;;;;;;;;;;MAUd;gBAEU,KAAK,KAAA;IAejB,iBAAiB;IAOjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA;IA+BvC,WAAW,GAAI,UAAK,SAAsD;IAE1E,WAAW,EAAE,GAAG,CAOd;IAEF,eAAe,EAAE,GAAG,CASlB;IAEF,YAAY,EAAE,GAAG,CAIf;IAEF,WAAW,EAAE,GAAG,CAiBd;IAEF,QAAQ,CAAC,OAAO,KAAA,EAAE,KAAK,KAAA;IAMvB,MAAM;CAgIP;AAED,eAAe,QAAQ,CAAC"}
|