@pie-lib/mask-markup 3.0.4-next.34 → 3.0.4-next.35

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.
Files changed (109) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +4 -0
  2. package/dist/choices/choice.d.ts +28 -0
  3. package/dist/choices/choice.js +91 -0
  4. package/dist/choices/index.d.ts +29 -0
  5. package/dist/choices/index.js +59 -0
  6. package/dist/componentize.d.ts +12 -0
  7. package/dist/componentize.js +4 -0
  8. package/dist/components/blank.d.ts +45 -0
  9. package/dist/components/blank.js +273 -0
  10. package/dist/components/correct-input.d.ts +11 -0
  11. package/dist/components/dropdown.d.ts +37 -0
  12. package/dist/components/dropdown.js +311 -0
  13. package/dist/components/input.d.ts +37 -0
  14. package/dist/constructed-response.d.ts +44 -0
  15. package/dist/constructed-response.js +56 -0
  16. package/dist/customizable.d.ts +43 -0
  17. package/dist/customizable.js +8 -0
  18. package/dist/drag-in-the-blank.d.ts +47 -0
  19. package/dist/drag-in-the-blank.js +220 -0
  20. package/dist/index.d.ts +15 -0
  21. package/dist/index.js +7 -0
  22. package/dist/inline-dropdown.d.ts +44 -0
  23. package/dist/inline-dropdown.js +24 -0
  24. package/dist/keyboard-coordinates.d.ts +25 -0
  25. package/dist/keyboard-coordinates.js +49 -0
  26. package/dist/mask.d.ts +30 -0
  27. package/dist/mask.js +95 -0
  28. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js +16 -0
  29. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/index.js +17 -0
  30. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssPrefix.js +9 -0
  31. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/cssUnitless.js +26 -0
  32. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/hasOwn.js +11 -0
  33. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isFunction.js +11 -0
  34. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/isObject.js +11 -0
  35. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixInfo.js +24 -0
  36. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixProperties.js +32 -0
  37. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/prefixer.js +29 -0
  38. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/camelize.js +14 -0
  39. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenRe.js +8 -0
  40. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/hyphenate.js +12 -0
  41. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/separate.js +11 -0
  42. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toLowerFirst.js +10 -0
  43. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/stringUtils/toUpperFirst.js +10 -0
  44. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleObject.js +55 -0
  45. package/dist/node_modules/.bun/to-style@1.3.3/node_modules/to-style/src/toStyleString.js +16 -0
  46. package/dist/serialization.d.ts +34 -0
  47. package/dist/serialization.js +132 -0
  48. package/dist/with-mask.d.ts +55 -0
  49. package/dist/with-mask.js +45 -0
  50. package/package.json +43 -20
  51. package/CHANGELOG.json +0 -17
  52. package/CHANGELOG.md +0 -1256
  53. package/LICENSE.md +0 -5
  54. package/lib/choices/choice.js +0 -116
  55. package/lib/choices/choice.js.map +0 -1
  56. package/lib/choices/index.js +0 -103
  57. package/lib/choices/index.js.map +0 -1
  58. package/lib/componentize.js +0 -21
  59. package/lib/componentize.js.map +0 -1
  60. package/lib/components/blank.js +0 -371
  61. package/lib/components/blank.js.map +0 -1
  62. package/lib/components/correct-input.js +0 -94
  63. package/lib/components/correct-input.js.map +0 -1
  64. package/lib/components/dropdown.js +0 -483
  65. package/lib/components/dropdown.js.map +0 -1
  66. package/lib/components/input.js +0 -50
  67. package/lib/components/input.js.map +0 -1
  68. package/lib/constructed-response.js +0 -101
  69. package/lib/constructed-response.js.map +0 -1
  70. package/lib/customizable.js +0 -42
  71. package/lib/customizable.js.map +0 -1
  72. package/lib/drag-in-the-blank.js +0 -254
  73. package/lib/drag-in-the-blank.js.map +0 -1
  74. package/lib/index.js +0 -55
  75. package/lib/index.js.map +0 -1
  76. package/lib/inline-dropdown.js +0 -40
  77. package/lib/inline-dropdown.js.map +0 -1
  78. package/lib/mask.js +0 -198
  79. package/lib/mask.js.map +0 -1
  80. package/lib/serialization.js +0 -261
  81. package/lib/serialization.js.map +0 -1
  82. package/lib/with-mask.js +0 -97
  83. package/lib/with-mask.js.map +0 -1
  84. package/src/__tests__/drag-in-the-blank.test.js +0 -111
  85. package/src/__tests__/index.test.js +0 -38
  86. package/src/__tests__/mask.test.js +0 -381
  87. package/src/__tests__/serialization.test.js +0 -54
  88. package/src/__tests__/utils.js +0 -1
  89. package/src/__tests__/with-mask.test.js +0 -76
  90. package/src/choices/__tests__/index.test.js +0 -75
  91. package/src/choices/choice.jsx +0 -97
  92. package/src/choices/index.jsx +0 -64
  93. package/src/componentize.js +0 -13
  94. package/src/components/__tests__/blank.test.js +0 -199
  95. package/src/components/__tests__/correct-input.test.js +0 -90
  96. package/src/components/__tests__/dropdown.test.js +0 -129
  97. package/src/components/__tests__/input.test.js +0 -102
  98. package/src/components/blank.jsx +0 -386
  99. package/src/components/correct-input.jsx +0 -82
  100. package/src/components/dropdown.jsx +0 -423
  101. package/src/components/input.jsx +0 -48
  102. package/src/constructed-response.jsx +0 -87
  103. package/src/customizable.jsx +0 -34
  104. package/src/drag-in-the-blank.jsx +0 -241
  105. package/src/index.js +0 -16
  106. package/src/inline-dropdown.jsx +0 -29
  107. package/src/mask.jsx +0 -172
  108. package/src/serialization.js +0 -260
  109. package/src/with-mask.jsx +0 -75
@@ -0,0 +1,4 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports);
3
+ //#endregion
4
+ export { e as __commonJSMin };
@@ -0,0 +1,28 @@
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, selectedItem, onSelectClick }: {
13
+ choice: any;
14
+ disabled: any;
15
+ instanceId: any;
16
+ selectedItem: any;
17
+ onSelectClick: any;
18
+ }): React.JSX.Element;
19
+ declare namespace Choice {
20
+ var propTypes: {
21
+ choice: PropTypes.Validator<object>;
22
+ disabled: PropTypes.Requireable<boolean>;
23
+ instanceId: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
24
+ selectedItem: PropTypes.Requireable<object>;
25
+ onSelectClick: PropTypes.Requireable<(...args: any[]) => any>;
26
+ };
27
+ }
28
+ export default Choice;
@@ -0,0 +1,91 @@
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, selected: n }) => ({
11
+ border: `solid 0px ${e.palette.primary.main}`,
12
+ margin: e.spacing(.5),
13
+ transform: "translate(0, 0)",
14
+ display: "inline-flex",
15
+ opacity: n ? .7 : 1,
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
+ "& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn": { fontSize: "120% !important" }
41
+ }));
42
+ function p({ choice: n, disabled: r, instanceId: s, selectedItem: c, onSelectClick: p }) {
43
+ let m = t(null), { attributes: h, listeners: g, setNodeRef: _, isDragging: v } = o({
44
+ id: `choice-${n.id}`,
45
+ data: {
46
+ choice: n,
47
+ instanceId: s,
48
+ fromChoice: !0,
49
+ type: l
50
+ },
51
+ disabled: r
52
+ });
53
+ e(() => {
54
+ i(m.current);
55
+ }, [n.value]);
56
+ let y = !!c && c.fromChoice === !0 && c.choice.id === n.id;
57
+ return /* @__PURE__ */ a(u, {
58
+ ref: _,
59
+ style: v ? {
60
+ width: m.current?.offsetWidth || 90,
61
+ height: m.current?.offsetHeight || 32
62
+ } : {},
63
+ disabled: r,
64
+ selected: y,
65
+ onClick: (e) => {
66
+ r || (e.stopPropagation(), p?.({
67
+ choice: n,
68
+ instanceId: s,
69
+ fromChoice: !0,
70
+ type: l
71
+ }));
72
+ },
73
+ ...g,
74
+ ...h,
75
+ children: /* @__PURE__ */ a(d, {
76
+ clickable: !1,
77
+ disabled: r,
78
+ ref: m,
79
+ label: /* @__PURE__ */ a(f, { dangerouslySetInnerHTML: { __html: n.value } })
80
+ })
81
+ });
82
+ }
83
+ p.propTypes = {
84
+ choice: n.object.isRequired,
85
+ disabled: n.bool,
86
+ instanceId: n.oneOfType([n.string, n.number]),
87
+ selectedItem: n.object,
88
+ onSelectClick: n.func
89
+ };
90
+ //#endregion
91
+ export { l as DRAG_TYPE, p as default };
@@ -0,0 +1,29 @@
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
+ selectedItem: PropTypes.Requireable<object>;
23
+ onSelectClick: PropTypes.Requireable<(...args: any[]) => any>;
24
+ onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
25
+ };
26
+ getStyleForWrapper: any;
27
+ handlePoolClick: any;
28
+ render(): React.JSX.Element;
29
+ }
@@ -0,0 +1,59 @@
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
+ selectedItem: n.object,
20
+ onSelectClick: n.func,
21
+ onPlacementClick: n.func
22
+ };
23
+ getStyleForWrapper = () => {
24
+ let { choicePosition: e } = this.props;
25
+ switch (e) {
26
+ case "above": return { margin: "0 0 40px 0" };
27
+ case "below": return { margin: "40px 0 0 0" };
28
+ case "right": return { margin: "0 0 0 40px" };
29
+ default: return { margin: "0 40px 0 0" };
30
+ }
31
+ };
32
+ handlePoolClick = () => {
33
+ let { disabled: e, selectedItem: t, onPlacementClick: n } = this.props;
34
+ e || t && n?.(void 0);
35
+ };
36
+ render() {
37
+ let { disabled: t, duplicates: n, choices: o, value: s, instanceId: c, selectedItem: l, onSelectClick: u } = this.props, d = o.filter((e) => n === !0 || r(s, (t) => t === e.id) === void 0);
38
+ return /* @__PURE__ */ i("div", {
39
+ style: {
40
+ ...this.getStyleForWrapper(),
41
+ minWidth: "100px"
42
+ },
43
+ onClick: this.handlePoolClick,
44
+ children: /* @__PURE__ */ i(a, {
45
+ disabled: t,
46
+ instanceId: c,
47
+ children: d.map((n, r) => /* @__PURE__ */ i(e, {
48
+ disabled: t,
49
+ choice: n,
50
+ instanceId: c,
51
+ selectedItem: l,
52
+ onSelectClick: u
53
+ }, `${n.value}-${r}`))
54
+ })
55
+ });
56
+ }
57
+ };
58
+ //#endregion
59
+ 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,4 @@
1
+ //#region src/componentize.tsx
2
+ var e = /\{\{(\d+)\}\}/g, t = (t, n) => t ? { markup: t.replace(e, (e, t) => `<span data-component="${n}" data-id="${t}"></span>`) } : { markup: "" };
3
+ //#endregion
4
+ export { t as default };
@@ -0,0 +1,45 @@
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, selectedItem, onSelectClick, onPlacementClick, }: {
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
+ selectedItem: any;
22
+ onSelectClick: any;
23
+ onPlacementClick: any;
24
+ }): React.JSX.Element;
25
+ declare namespace DragDropBlank {
26
+ var defaultProps: {
27
+ emptyResponseAreaWidth: number;
28
+ emptyResponseAreaHeight: number;
29
+ };
30
+ var propTypes: {
31
+ id: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
32
+ disabled: PropTypes.Requireable<boolean>;
33
+ duplicates: PropTypes.Requireable<boolean>;
34
+ choice: PropTypes.Requireable<object>;
35
+ correct: PropTypes.Requireable<boolean>;
36
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
37
+ emptyResponseAreaWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
38
+ emptyResponseAreaHeight: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
39
+ instanceId: PropTypes.Requireable<string>;
40
+ selectedItem: PropTypes.Requireable<object>;
41
+ onSelectClick: PropTypes.Requireable<(...args: any[]) => any>;
42
+ onPlacementClick: PropTypes.Requireable<(...args: any[]) => any>;
43
+ };
44
+ }
45
+ export default DragDropBlank;
@@ -0,0 +1,273 @@
1
+ import { clsx as 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 { grey as h } from "@mui/material/colors";
12
+ //#region src/components/blank.tsx
13
+ c("pie-lib:mask-markup:blank");
14
+ var g = o("span")(({ dragged: e, over: t, selected: n, showsPointerCursor: r }) => ({
15
+ border: `solid 0px ${m.primary()}`,
16
+ minWidth: "200px",
17
+ overflow: "hidden",
18
+ whiteSpace: "nowrap",
19
+ opacity: 1,
20
+ cursor: "default",
21
+ ...t && {
22
+ whiteSpace: "nowrap",
23
+ overflow: "hidden"
24
+ },
25
+ ...(e || n) && { opacity: .5 },
26
+ ...r && { "&:hover": { cursor: "pointer" } }
27
+ })), _ = o("span")({
28
+ display: "inline-flex",
29
+ touchAction: "none"
30
+ }), v = o(p)(() => ({
31
+ backgroundColor: m.background(),
32
+ border: `2px dashed ${m.text()}`,
33
+ touchAction: "none",
34
+ color: m.text(),
35
+ fontSize: "inherit",
36
+ maxWidth: "374px",
37
+ position: "relative",
38
+ borderRadius: "3px",
39
+ "&.over": {
40
+ whiteSpace: "nowrap",
41
+ overflow: "hidden"
42
+ },
43
+ "&.parentOver": {
44
+ border: `1px solid ${h[500]}`,
45
+ backgroundColor: `${h[300]}`
46
+ },
47
+ "&.correct": { border: `solid 1px ${m.correct()}` },
48
+ "&.incorrect": { border: `solid 1px ${m.incorrect()}` },
49
+ "&.Mui-disabled": { opacity: 1 }
50
+ })), y = o("span")(() => ({
51
+ whiteSpace: "normal",
52
+ pointerEvents: "none",
53
+ "& img": {
54
+ display: "block",
55
+ padding: "2px 0"
56
+ },
57
+ "& p": {
58
+ marginTop: "0",
59
+ marginBottom: "0"
60
+ },
61
+ "& mjx-frac": { fontSize: "120% !important" },
62
+ "& mjx-mn:has(~ mjx-mfrac), mjx-mfrac ~ mjx-mn": { fontSize: "120% !important" },
63
+ "&.over": {
64
+ whiteSpace: "nowrap",
65
+ overflow: "hidden"
66
+ },
67
+ "&.hidden": {
68
+ color: "transparent",
69
+ opacity: 0
70
+ },
71
+ "&.dragged": {
72
+ position: "absolute",
73
+ left: 16,
74
+ maxWidth: "60px",
75
+ top: "50%",
76
+ transform: "translateY(-50%)"
77
+ }
78
+ }));
79
+ function b({ disabled: a, choice: o, isOver: c, isDragging: d, dragItem: f, correct: p, emptyResponseAreaWidth: m, emptyResponseAreaHeight: h }) {
80
+ let g = r(null), _ = r(null), b = r(null), x = r(!1), [S, C] = i({
81
+ height: 0,
82
+ width: 0
83
+ }), w = () => {
84
+ D();
85
+ }, T = () => {
86
+ let e = _.current?.querySelector("img");
87
+ e ? e.onload = w : setTimeout(() => {
88
+ D();
89
+ }, 300);
90
+ }, E = () => {
91
+ if (!_.current) return null;
92
+ if (_.current.querySelector("mjx-container") && _.current.parentElement) return _.current.parentElement;
93
+ let e = _.current.querySelector("img");
94
+ return e ? _.current.textContent.trim().length > 0 ? _.current : e : _.current;
95
+ }, D = () => {
96
+ if (_.current && g.current && !x.current) {
97
+ x.current = !0, g.current.style.width = "auto", g.current.style.height = "auto", g.current.offsetHeight;
98
+ let e = E() || _.current, t = e.getBoundingClientRect(), n = e.offsetWidth || t.width || 0, r = Math.max(e.offsetHeight || 0, t.height || 0, e.scrollHeight || 0, _.current.scrollHeight || 0), i = n + 24 + 4 + 1, a = r + 24 + 4 + 1, o = parseFloat(m) || 0, s = parseFloat(h) || 0, c = i <= o ? o : i, l = a <= s ? s : a;
99
+ C((e) => ({
100
+ width: c > o ? c : e.width,
101
+ height: l > s ? l : e.height
102
+ }));
103
+ let u = `${c}px`, d = `${l}px`;
104
+ g.current.style.width !== u && (g.current.style.width = u), g.current.style.height !== d && (g.current.style.height = d), x.current = !1;
105
+ }
106
+ }, O = () => {
107
+ let e = isNaN(parseFloat(m)) ? 0 : parseFloat(m), t = isNaN(parseFloat(h)) ? 0 : parseFloat(h);
108
+ return {
109
+ height: S.height || t,
110
+ width: S.width || e,
111
+ ...e ? {} : { minWidth: 90 },
112
+ ...t ? {} : { minHeight: 32 }
113
+ };
114
+ };
115
+ n(() => {
116
+ T();
117
+ }, []), n(() => {
118
+ if (typeof IntersectionObserver > "u" || !g.current) return;
119
+ let e = new IntersectionObserver((e) => {
120
+ e.some((e) => e.isIntersecting) && D();
121
+ }, { threshold: 0 });
122
+ return e.observe(g.current), () => e.disconnect();
123
+ }, []), n(() => {
124
+ g.current && s(g.current);
125
+ }, [
126
+ p,
127
+ c,
128
+ f?.choice?.value
129
+ ]), n(() => {
130
+ if (!o) {
131
+ C({
132
+ height: 0,
133
+ width: 0
134
+ });
135
+ return;
136
+ }
137
+ T();
138
+ }, [o?.value]), n(() => {
139
+ !c && !d && (b.current = {
140
+ width: g.current.offsetWidth,
141
+ height: g.current.offsetHeight
142
+ });
143
+ }, [
144
+ o,
145
+ c,
146
+ d
147
+ ]);
148
+ let k = f && c && f.choice && f.choice.value, A = o && o.value, j = c || d ? {
149
+ width: b.current?.width,
150
+ height: b.current?.height
151
+ } : O();
152
+ return /* @__PURE__ */ l(v, {
153
+ clickable: !1,
154
+ disabled: a,
155
+ ref: g,
156
+ component: "span",
157
+ label: /* @__PURE__ */ u(t.Fragment, { children: [/* @__PURE__ */ l(y, {
158
+ ref: _,
159
+ draggable: !0,
160
+ className: e({
161
+ over: c,
162
+ hidden: k
163
+ }),
164
+ dangerouslySetInnerHTML: { __html: A || "" }
165
+ }), k && /* @__PURE__ */ l(y, {
166
+ draggable: !0,
167
+ className: e({
168
+ over: c,
169
+ dragged: !0
170
+ }),
171
+ dangerouslySetInnerHTML: { __html: k || "" }
172
+ })] }),
173
+ className: e({
174
+ over: c,
175
+ parentOver: c,
176
+ correct: p !== void 0 && p,
177
+ incorrect: p !== void 0 && !p
178
+ }),
179
+ variant: a ? "outlined" : void 0,
180
+ style: j
181
+ });
182
+ }
183
+ b.defaultProps = {
184
+ emptyResponseAreaWidth: 0,
185
+ emptyResponseAreaHeight: 0
186
+ }, b.propTypes = {
187
+ id: a.oneOfType([a.string, a.number]),
188
+ disabled: a.bool,
189
+ duplicates: a.bool,
190
+ choice: a.object,
191
+ isOver: a.bool,
192
+ dragItem: a.object,
193
+ correct: a.bool,
194
+ onChange: a.func,
195
+ emptyResponseAreaWidth: a.oneOfType([a.string, a.number]),
196
+ emptyResponseAreaHeight: a.oneOfType([a.string, a.number]),
197
+ instanceId: a.string
198
+ };
199
+ function x({ id: e, disabled: t, duplicates: n, choice: r, correct: a, onChange: o, emptyResponseAreaWidth: s, emptyResponseAreaHeight: c, instanceId: u, selectedItem: p, onSelectClick: m, onPlacementClick: h }) {
200
+ let [v, y] = i(!1), x = {
201
+ id: e,
202
+ choice: r,
203
+ instanceId: u,
204
+ fromChoice: !1,
205
+ type: "MaskBlank"
206
+ }, { attributes: S, listeners: C, setNodeRef: w, isDragging: T } = d({
207
+ id: `mask-blank-drag-${e}`,
208
+ disabled: t || !r,
209
+ data: x,
210
+ attributes: { tabIndex: r && !t ? 0 : -1 }
211
+ }), { setNodeRef: E, isOver: D, active: O } = f({
212
+ id: `mask-blank-drop-${e}`,
213
+ data: {
214
+ id: e,
215
+ accepts: ["MaskBlank"],
216
+ instanceId: u
217
+ }
218
+ }), k = !!p && p.fromChoice === !1 && p.id === e, A = () => {
219
+ t || (k ? m?.(x) : p ? h?.(e) : r && m?.(x));
220
+ }, j = !r && !t, M = !!r && !t, N = (e) => {
221
+ (e.code === "Space" || e.code === "Enter") && (e.preventDefault(), A());
222
+ }, P = !!p, F = D || P && v && !t;
223
+ return /* @__PURE__ */ l(g, {
224
+ ref: E,
225
+ role: j ? "button" : void 0,
226
+ tabIndex: j ? 0 : -1,
227
+ onClick: A,
228
+ onKeyDown: j ? N : void 0,
229
+ onMouseEnter: () => y(!0),
230
+ onMouseLeave: () => y(!1),
231
+ dragged: T,
232
+ over: F,
233
+ selected: k,
234
+ showsPointerCursor: P && !t,
235
+ children: /* @__PURE__ */ l(_, {
236
+ ref: w,
237
+ ...M ? S : {},
238
+ ...C,
239
+ children: /* @__PURE__ */ l(b, {
240
+ id: e,
241
+ disabled: t,
242
+ duplicates: n,
243
+ choice: r,
244
+ isOver: F,
245
+ dragItem: O?.data?.current,
246
+ correct: a,
247
+ onChange: o,
248
+ emptyResponseAreaWidth: s,
249
+ emptyResponseAreaHeight: c,
250
+ instanceId: u
251
+ })
252
+ })
253
+ });
254
+ }
255
+ x.defaultProps = {
256
+ emptyResponseAreaWidth: 0,
257
+ emptyResponseAreaHeight: 0
258
+ }, x.propTypes = {
259
+ id: a.oneOfType([a.string, a.number]),
260
+ disabled: a.bool,
261
+ duplicates: a.bool,
262
+ choice: a.object,
263
+ correct: a.bool,
264
+ onChange: a.func,
265
+ emptyResponseAreaWidth: a.oneOfType([a.string, a.number]),
266
+ emptyResponseAreaHeight: a.oneOfType([a.string, a.number]),
267
+ instanceId: a.string,
268
+ selectedItem: a.object,
269
+ onSelectClick: a.func,
270
+ onPlacementClick: a.func
271
+ };
272
+ //#endregion
273
+ 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;