@pie-lib/mask-markup 3.1.4 → 4.0.0-next.37

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 (113) 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 +92 -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 +35 -19
  51. package/CHANGELOG.json +0 -17
  52. package/CHANGELOG.md +0 -1357
  53. package/LICENSE.md +0 -5
  54. package/lib/choices/choice.js +0 -138
  55. package/lib/choices/choice.js.map +0 -1
  56. package/lib/choices/index.js +0 -126
  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 -489
  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 -480
  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 -363
  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/keyboard-coordinates.js +0 -156
  79. package/lib/keyboard-coordinates.js.map +0 -1
  80. package/lib/mask.js +0 -203
  81. package/lib/mask.js.map +0 -1
  82. package/lib/serialization.js +0 -261
  83. package/lib/serialization.js.map +0 -1
  84. package/lib/with-mask.js +0 -97
  85. package/lib/with-mask.js.map +0 -1
  86. package/src/__tests__/drag-in-the-blank.test.js +0 -256
  87. package/src/__tests__/index.test.js +0 -38
  88. package/src/__tests__/keyboard-coordinates.test.js +0 -202
  89. package/src/__tests__/mask.test.js +0 -479
  90. package/src/__tests__/serialization.test.js +0 -54
  91. package/src/__tests__/utils.js +0 -1
  92. package/src/__tests__/with-mask.test.js +0 -76
  93. package/src/choices/__tests__/index.test.js +0 -212
  94. package/src/choices/choice.jsx +0 -113
  95. package/src/choices/index.jsx +0 -88
  96. package/src/componentize.js +0 -13
  97. package/src/components/__tests__/blank.test.js +0 -413
  98. package/src/components/__tests__/correct-input.test.js +0 -90
  99. package/src/components/__tests__/dropdown.test.js +0 -129
  100. package/src/components/__tests__/input.test.js +0 -102
  101. package/src/components/blank.jsx +0 -504
  102. package/src/components/correct-input.jsx +0 -82
  103. package/src/components/dropdown.jsx +0 -421
  104. package/src/components/input.jsx +0 -48
  105. package/src/constructed-response.jsx +0 -87
  106. package/src/customizable.jsx +0 -34
  107. package/src/drag-in-the-blank.jsx +0 -351
  108. package/src/index.js +0 -16
  109. package/src/inline-dropdown.jsx +0 -29
  110. package/src/keyboard-coordinates.js +0 -147
  111. package/src/mask.jsx +0 -174
  112. package/src/serialization.js +0 -260
  113. package/src/with-mask.jsx +0 -75
@@ -0,0 +1,311 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { styled as n } from "@mui/material/styles";
4
+ import { renderMath as r } from "@pie-element/shared-math-rendering-mathjax";
5
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import * as s from "@pie-lib/render-ui";
7
+ import { InlineMenu as c, color as l } from "@pie-lib/render-ui";
8
+ import u from "@mui/material/Button";
9
+ import d from "@mui/material/InputLabel";
10
+ import f from "@mui/material/MenuItem";
11
+ import p from "@mui/icons-material/ArrowDropDown";
12
+ import m from "@mui/icons-material/ArrowDropUp";
13
+ import h from "@mui/icons-material/Close";
14
+ import g from "@mui/icons-material/Check";
15
+ //#region src/components/dropdown.tsx
16
+ function _(e) {
17
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
18
+ }
19
+ function v(e, t) {
20
+ return !e || _(e) ? e : _(e.default) ? e.default : t && _(e[t]) ? e[t] : t && _(e[t]?.default) ? e[t].default : e;
21
+ }
22
+ var y = v(c, "InlineMenu") || v(S.InlineMenu, "InlineMenu"), b = s, x = b.default, S = x && typeof x == "object" ? x : b, C = l.v("pie"), w = n(u)(() => ({
23
+ color: l.text(),
24
+ border: `1px solid ${l.borderGray()}`,
25
+ borderRadius: "4px",
26
+ justifyContent: "space-between",
27
+ backgroundColor: l.background(),
28
+ position: "relative",
29
+ height: "45px",
30
+ width: "fit-content",
31
+ margin: "2px",
32
+ textTransform: "none",
33
+ "& span": { paddingRight: "24px" },
34
+ "& svg": {
35
+ position: "absolute",
36
+ right: "4px",
37
+ top: "calc(50% - 12px)",
38
+ pointerEvents: "none",
39
+ color: l.text(),
40
+ marginLeft: "5px"
41
+ },
42
+ "&.Mui-focused": {
43
+ outline: `3px solid ${l.tertiary()}`,
44
+ outlineOffset: "2px",
45
+ borderWidth: "3px"
46
+ },
47
+ "&.disabledCorrect": {
48
+ borderWidth: "2px",
49
+ borderColor: l.correct(),
50
+ color: `${l.text()} !important`
51
+ },
52
+ "&.disabledIncorrect": {
53
+ borderWidth: "2px",
54
+ borderColor: l.incorrectWithIcon(),
55
+ color: `${l.text()} !important`
56
+ }
57
+ })), T = n(y)(() => ({
58
+ "& .MuiPaper-root": { backgroundColor: C("background", l.defaults.WHITE) },
59
+ "& .MuiList-root": { padding: 0 }
60
+ })), E = n(f)(() => ({
61
+ height: 24,
62
+ overflow: "hidden",
63
+ fontSize: "1rem",
64
+ fontWeight: 400,
65
+ fontFamily: "inherit",
66
+ lineHeight: "1.5em",
67
+ whiteSpace: "nowrap",
68
+ color: l.text(),
69
+ backgroundColor: l.background(),
70
+ "&.Mui-focusVisible": {
71
+ outline: `3px solid ${l.tertiary()}`,
72
+ outlineOffset: "-1px",
73
+ color: l.text(),
74
+ backgroundColor: l.background()
75
+ },
76
+ "&:hover": {
77
+ color: l.text(),
78
+ backgroundColor: l.dropdownBackground()
79
+ },
80
+ boxSizing: "border-box",
81
+ padding: "16px 8px",
82
+ borderRadius: "4px",
83
+ "&.selected": {
84
+ color: `${l.text()} !important`,
85
+ backgroundColor: `${l.background()} !important`,
86
+ "&:hover": {
87
+ color: l.text(),
88
+ backgroundColor: `${l.dropdownBackground()} !important`
89
+ }
90
+ }
91
+ })), D = n("span")(() => ({ fontSize: "max(1rem, 14px)" })), O = n("span")(() => ({
92
+ fontSize: "max(1rem, 14px)",
93
+ flexShrink: 0,
94
+ paddingLeft: "8px"
95
+ })), k = n(d)(() => ({
96
+ position: "absolute",
97
+ left: "-10000px",
98
+ top: "auto",
99
+ width: "1px",
100
+ height: "1px",
101
+ overflow: "hidden"
102
+ })), A = n(g)(() => ({
103
+ color: `${l.white()} !important`,
104
+ position: "absolute",
105
+ top: "-8px !important",
106
+ left: "-8px",
107
+ marginLeft: "0 !important",
108
+ borderRadius: "50%",
109
+ fontSize: "16px",
110
+ padding: "2px",
111
+ "&.correct": { backgroundColor: l.correct() },
112
+ "&.incorrect": { backgroundColor: l.incorrectWithIcon() }
113
+ })), j = n(h)(() => ({
114
+ color: `${l.white()} !important`,
115
+ position: "absolute",
116
+ top: "-8px !important",
117
+ left: "-8px",
118
+ marginLeft: "0 !important",
119
+ borderRadius: "50%",
120
+ fontSize: "16px",
121
+ padding: "2px",
122
+ "&.correct": { backgroundColor: l.correct() },
123
+ "&.incorrect": { backgroundColor: l.incorrectWithIcon() }
124
+ })), M = class extends e.Component {
125
+ static propTypes = {
126
+ id: t.string,
127
+ value: t.string,
128
+ disabled: t.bool,
129
+ onChange: t.func,
130
+ correct: t.bool,
131
+ choices: t.arrayOf(t.shape({
132
+ value: t.string,
133
+ label: t.string
134
+ })),
135
+ showCorrectAnswer: t.bool,
136
+ singleQuery: t.bool,
137
+ correctValue: t.string
138
+ };
139
+ constructor(t) {
140
+ super(t), this.state = {
141
+ anchorEl: null,
142
+ highlightedOptionId: null,
143
+ menuWidth: null,
144
+ previewValue: null
145
+ }, this.hiddenRef = e.createRef(), this.buttonRef = e.createRef(), this.previewRef = e.createRef(), this.elementRefs = [];
146
+ }
147
+ componentDidMount() {
148
+ this.hiddenRef.current && this.state.menuWidth === null && this.setState({ menuWidth: this.hiddenRef.current.clientWidth });
149
+ }
150
+ componentDidUpdate(e, t) {
151
+ let n = this.hiddenRef.current;
152
+ if (!t.anchorEl && this.state.anchorEl && this.elementRefs.forEach((e) => {
153
+ if (!e) return;
154
+ let t = e.querySelector("[data-latex], [data-raw]"), n = e.querySelector("mjx-container"), i = e.querySelector("[data-math-handled=\"true\"]");
155
+ t && (!i || !n) && r(e);
156
+ }), n) {
157
+ let e = n.clientWidth;
158
+ e !== this.state.menuWidth && (this.elementRefs.forEach((e) => {
159
+ e && r(e);
160
+ }), r(n), this.setState({ menuWidth: e }));
161
+ }
162
+ }
163
+ handleClick = (e) => {
164
+ let { id: t, value: n, choices: r } = this.props, i = null;
165
+ if (n) {
166
+ let e = (r || []).findIndex((e) => e.value === n);
167
+ e >= 0 && (i = `dropdown-option-${t}-${e}`);
168
+ }
169
+ this.setState({
170
+ anchorEl: e.currentTarget,
171
+ highlightedOptionId: i
172
+ });
173
+ };
174
+ handleClose = () => {
175
+ let { value: e } = this.props;
176
+ this.setState({
177
+ anchorEl: null,
178
+ previewValue: null,
179
+ highlightedOptionId: null
180
+ }), !e && this.previewRef.current && (this.previewRef.current.innerHTML = "");
181
+ };
182
+ handleHighlight = (e) => {
183
+ let t = { highlightedOptionId: `dropdown-option-${this.props.id}-${e}` };
184
+ this.props.value || (t.previewValue = this.props.choices[e].value), this.setState(t);
185
+ };
186
+ handleSelect = (e, t) => {
187
+ this.props.onChange(this.props.id, e), this.handleHighlight(t), this.handleClose();
188
+ };
189
+ handleHover = (e) => {
190
+ if (this.props.value) return;
191
+ let t = `dropdown-option-${this.props.id}-${e}`, n = this.state.previewValue;
192
+ this.setState({
193
+ highlightedOptionId: t,
194
+ previewValue: n
195
+ }, () => {
196
+ let t = this.elementRefs[e], n = this.previewRef.current;
197
+ t && n && (n.innerHTML = t.innerHTML);
198
+ });
199
+ };
200
+ getLabel(e, t) {
201
+ let n = (e || []).find((e) => e.value === t);
202
+ return n ? n.label.trim() : void 0;
203
+ }
204
+ render() {
205
+ let { id: e, correct: t, disabled: n, value: r, choices: s, showCorrectAnswer: c, singleQuery: l, correctValue: u } = this.props, { anchorEl: d } = this.state, f = !!d, h = `dropdown-button-${e}`, g = `dropdown-menu-${e}`, _ = `dropdown-value-${e}`, v;
206
+ this.elementRefs = [], n && t !== void 0 && (v = t || c ? "disabledCorrect" : "disabledIncorrect");
207
+ let y = parseInt(e, 10) + 1, b = l ? "Query-label" : `Query-label-${y}`, x = l ? "Query" : `Query ${y}`, S = null;
208
+ return n && t !== void 0 && (S = t || c ? /* @__PURE__ */ a(A, { className: "correct" }) : /* @__PURE__ */ a(j, { className: "incorrect" })), /* @__PURE__ */ o(i, { children: [
209
+ /* @__PURE__ */ a("div", {
210
+ ref: this.hiddenRef,
211
+ style: {
212
+ position: "absolute",
213
+ visibility: "hidden",
214
+ top: 0,
215
+ left: 0
216
+ },
217
+ tabIndex: -1,
218
+ "aria-hidden": "true",
219
+ children: (s || []).map((e, t) => /* @__PURE__ */ a(E, {
220
+ tabIndex: -1,
221
+ "aria-hidden": "true",
222
+ children: /* @__PURE__ */ a(D, { dangerouslySetInnerHTML: { __html: e.label } })
223
+ }, t))
224
+ }),
225
+ /* @__PURE__ */ a(k, {
226
+ id: b,
227
+ tabIndex: -1,
228
+ "aria-hidden": "true",
229
+ children: x
230
+ }),
231
+ /* @__PURE__ */ o(w, {
232
+ ref: this.buttonRef,
233
+ style: {
234
+ ...this.state.menuWidth && { minWidth: `calc(${this.state.menuWidth}px + 8px)` },
235
+ borderWidth: f ? "2px" : "1px",
236
+ transition: "border-width 0.2s ease-in-out"
237
+ },
238
+ "aria-controls": f ? g : void 0,
239
+ "aria-haspopup": "listbox",
240
+ "aria-expanded": f ? "true" : void 0,
241
+ "aria-activedescendant": this.state.highlightedOptionId,
242
+ onClick: this.handleClick,
243
+ className: v,
244
+ disabled: n,
245
+ id: h,
246
+ role: "combobox",
247
+ "aria-label": `Select an option for ${x}`,
248
+ "aria-labelledby": _,
249
+ children: [
250
+ S,
251
+ /* @__PURE__ */ a(D, {
252
+ id: _,
253
+ ref: this.previewRef,
254
+ dangerouslySetInnerHTML: { __html: u || (f && this.state.previewValue ? this.getLabel(s, this.state.previewValue) : this.getLabel(s, r) || "") }
255
+ }),
256
+ a(f ? m : p, {})
257
+ ]
258
+ }),
259
+ /* @__PURE__ */ a(T, {
260
+ id: g,
261
+ anchorEl: d,
262
+ keepMounted: !0,
263
+ open: f,
264
+ onClose: this.handleClose,
265
+ getContentAnchorEl: null,
266
+ anchorOrigin: {
267
+ vertical: "bottom",
268
+ horizontal: "left"
269
+ },
270
+ transformOrigin: {
271
+ vertical: "top",
272
+ horizontal: "left"
273
+ },
274
+ transitionDuration: {
275
+ enter: 225,
276
+ exit: 195
277
+ },
278
+ slotProps: {
279
+ paper: this.state.menuWidth ? { style: {
280
+ minWidth: this.state.menuWidth,
281
+ padding: "4px"
282
+ } } : void 0,
283
+ list: {
284
+ "aria-labelledby": h,
285
+ role: "listbox",
286
+ disablePadding: !0
287
+ }
288
+ },
289
+ children: (s || []).map((t, n) => {
290
+ let i = `dropdown-option-${e}-${n}`;
291
+ return /* @__PURE__ */ o(E, {
292
+ id: i,
293
+ className: t.value === r ? "selected" : "",
294
+ selected: t.value === r,
295
+ value: t.value,
296
+ onClick: () => this.handleSelect(t.value, n),
297
+ role: "option",
298
+ "aria-selected": this.state.highlightedOptionId === i ? "true" : void 0,
299
+ onMouseOver: () => this.handleHover(n),
300
+ children: [/* @__PURE__ */ a(D, {
301
+ ref: (e) => this.elementRefs[n] = e,
302
+ dangerouslySetInnerHTML: { __html: t.label }
303
+ }), /* @__PURE__ */ a(O, { dangerouslySetInnerHTML: { __html: t.value === r ? " ✓" : "" } })]
304
+ }, `${t.label}-${n}`);
305
+ })
306
+ })
307
+ ] });
308
+ }
309
+ };
310
+ //#endregion
311
+ export { M as default };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/mask-markup/src/components/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
+ import PropTypes from 'prop-types';
11
+ declare const Input: {
12
+ ({ disabled, correct, charactersLimit, id, isConstructedResponse, value, onChange, showCorrectAnswer, spellCheck, width, }: {
13
+ disabled: any;
14
+ correct: any;
15
+ charactersLimit: any;
16
+ id: any;
17
+ isConstructedResponse: any;
18
+ value: any;
19
+ onChange: any;
20
+ showCorrectAnswer: any;
21
+ spellCheck: any;
22
+ width: any;
23
+ }): React.JSX.Element;
24
+ propTypes: {
25
+ id: PropTypes.Requireable<string>;
26
+ value: PropTypes.Requireable<string>;
27
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
28
+ disabled: PropTypes.Requireable<boolean>;
29
+ spellCheck: PropTypes.Requireable<boolean>;
30
+ correct: PropTypes.Requireable<boolean>;
31
+ showCorrectAnswer: PropTypes.Requireable<boolean>;
32
+ charactersLimit: PropTypes.Requireable<number>;
33
+ width: PropTypes.Requireable<number>;
34
+ isConstructedResponse: PropTypes.Requireable<boolean>;
35
+ };
36
+ };
37
+ export default Input;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/mask-markup/src/constructed-response.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 _default: {
11
+ new (props: any): {
12
+ componentDidUpdate(prevProps: any): void;
13
+ render(): React.JSX.Element;
14
+ context: unknown;
15
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
16
+ forceUpdate(callback?: (() => void) | undefined): void;
17
+ readonly props: Readonly<{}>;
18
+ state: Readonly<{}>;
19
+ refs: {
20
+ [key: string]: React.ReactInstance;
21
+ };
22
+ componentDidMount?(): void;
23
+ shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
24
+ componentWillUnmount?(): void;
25
+ componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
26
+ getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
27
+ componentWillMount?(): void;
28
+ UNSAFE_componentWillMount?(): void;
29
+ componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
30
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
31
+ componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
32
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
33
+ };
34
+ propTypes: {
35
+ markup: import("prop-types").Requireable<string>;
36
+ layout: import("prop-types").Requireable<object>;
37
+ value: import("prop-types").Requireable<object>;
38
+ onChange: import("prop-types").Requireable<(...args: any[]) => any>;
39
+ customMarkMarkupComponent: import("prop-types").Requireable<(...args: any[]) => any>;
40
+ elementType: import("prop-types").Requireable<string>;
41
+ };
42
+ contextType?: React.Context<any> | undefined;
43
+ };
44
+ export default _default;
@@ -0,0 +1,56 @@
1
+ import { withMask as e } from "./with-mask.js";
2
+ import { clsx as t } from "./node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js";
3
+ import "react";
4
+ import { styled as n } from "@mui/material/styles";
5
+ import { jsx as r } from "react/jsx-runtime";
6
+ import { color as i } from "@pie-lib/render-ui";
7
+ import a from "@pie-lib/editable-html-tip-tap";
8
+ //#region src/constructed-response.tsx
9
+ var o = n(a)(() => ({
10
+ display: "inline-block",
11
+ verticalAlign: "middle",
12
+ margin: "4px",
13
+ borderRadius: "4px",
14
+ border: `1px solid ${i.black()}`,
15
+ "&.correct": { border: `1px solid ${i.correct()}` },
16
+ "&.incorrect": { border: `1px solid ${i.incorrect()}` }
17
+ })), s = e("input", (e) => (n, i) => {
18
+ let { adjustedLimit: a, disabled: s, feedback: c, showCorrectAnswer: l, maxLength: u, spellCheck: d, pluginProps: f, onChange: p } = e, m = n.data?.dataset || {};
19
+ if (m.component === "input") {
20
+ let h = (e.choices && m && e.choices[m.id] || [])[0], g = l ? h && h.label : i[m.id] || "", _ = u && u[m.id], v = c && c[m.id], y = l || v === "correct", b = !l && v === "incorrect";
21
+ return /* @__PURE__ */ r(o, {
22
+ id: m.id,
23
+ disabled: l || s,
24
+ disableUnderline: !0,
25
+ onChange: (e) => {
26
+ let t = {
27
+ ...i,
28
+ [m.id]: e
29
+ };
30
+ p(t);
31
+ },
32
+ markup: g || "",
33
+ charactersLimit: a ? _ : 25,
34
+ activePlugins: ["languageCharacters"],
35
+ pluginProps: f,
36
+ languageCharactersProps: [{ language: "spanish" }],
37
+ spellCheck: d,
38
+ adjustWidthForLimit: !0,
39
+ onKeyDown: (e) => {
40
+ if (e.key === "Enter" || e.keyCode === 13) return !0;
41
+ },
42
+ autoWidthToolbar: !0,
43
+ toolbarOpts: {
44
+ minWidth: "auto",
45
+ noBorder: !0,
46
+ isHidden: !!f?.characters?.disabled
47
+ },
48
+ className: t({
49
+ correct: y,
50
+ incorrect: b
51
+ })
52
+ }, `${n.type}-input-${m.id}`);
53
+ }
54
+ });
55
+ //#endregion
56
+ export { s as default };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/mask-markup/src/customizable.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 _default: {
10
+ new (props: any): {
11
+ componentDidUpdate(prevProps: any): void;
12
+ render(): import("react").JSX.Element;
13
+ context: unknown;
14
+ setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
15
+ forceUpdate(callback?: (() => void) | undefined): void;
16
+ readonly props: Readonly<{}>;
17
+ state: Readonly<{}>;
18
+ refs: {
19
+ [key: string]: import("react").ReactInstance;
20
+ };
21
+ componentDidMount?(): void;
22
+ shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
23
+ componentWillUnmount?(): void;
24
+ componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
25
+ getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
26
+ componentWillMount?(): void;
27
+ UNSAFE_componentWillMount?(): void;
28
+ componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
29
+ UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
30
+ componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
31
+ UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
32
+ };
33
+ propTypes: {
34
+ markup: import("prop-types").Requireable<string>;
35
+ layout: import("prop-types").Requireable<object>;
36
+ value: import("prop-types").Requireable<object>;
37
+ onChange: import("prop-types").Requireable<(...args: any[]) => any>;
38
+ customMarkMarkupComponent: import("prop-types").Requireable<(...args: any[]) => any>;
39
+ elementType: import("prop-types").Requireable<string>;
40
+ };
41
+ contextType?: import("react").Context<any> | undefined;
42
+ };
43
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { withMask as e } from "./with-mask.js";
2
+ //#region src/customizable.tsx
3
+ var t = e("input", (e) => (t, n, r) => {
4
+ let i = t.data && t.data.dataset || {};
5
+ if (i.component === "input") return e.customMarkMarkupComponent(i.id);
6
+ });
7
+ //#endregion
8
+ export { t as default };
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/mask-markup/src/drag-in-the-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
+ export default class DragInTheBlank extends React.Component {
12
+ constructor(props: any);
13
+ static propTypes: {
14
+ markup: PropTypes.Requireable<string>;
15
+ layout: PropTypes.Requireable<object>;
16
+ choicesPosition: PropTypes.Requireable<string>;
17
+ choices: PropTypes.Requireable<any[]>;
18
+ value: PropTypes.Requireable<object>;
19
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
20
+ duplicates: PropTypes.Requireable<boolean>;
21
+ disabled: PropTypes.Requireable<boolean>;
22
+ feedback: PropTypes.Requireable<object>;
23
+ correctResponse: PropTypes.Requireable<object>;
24
+ showCorrectAnswer: PropTypes.Requireable<boolean>;
25
+ emptyResponseAreaWidth: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
26
+ emptyResponseAreaHeight: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
27
+ instanceId: PropTypes.Requireable<string>;
28
+ };
29
+ static defaultProps: {
30
+ instanceId: string;
31
+ };
32
+ handleDragStart: any;
33
+ renderDragOverlay: any;
34
+ commitPlacement: any;
35
+ handleDragEnd: any;
36
+ onDragCancel: any;
37
+ isSameItem: any;
38
+ toggleItemSelection: any;
39
+ cancelSelection: any;
40
+ endAnyLiveKeyboardDrag: any;
41
+ placeSelectedItem: any;
42
+ isClickSoonAfterDragEnd: () => boolean;
43
+ onItemClick: any;
44
+ onPlacementClick: any;
45
+ getPositionDirection: any;
46
+ render(): React.JSX.Element;
47
+ }