@pie-lib/config-ui 13.0.4-next.31 → 13.0.4-next.36

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 (190) hide show
  1. package/CHANGELOG.json +32 -0
  2. package/CHANGELOG.md +2419 -0
  3. package/LICENSE.md +5 -0
  4. package/lib/alert-dialog.js +68 -0
  5. package/lib/alert-dialog.js.map +1 -0
  6. package/lib/checkbox.js +84 -0
  7. package/lib/checkbox.js.map +1 -0
  8. package/lib/choice-configuration/feedback-menu.js +129 -0
  9. package/lib/choice-configuration/feedback-menu.js.map +1 -0
  10. package/lib/choice-configuration/index.js +381 -0
  11. package/lib/choice-configuration/index.js.map +1 -0
  12. package/lib/choice-utils.js +42 -0
  13. package/lib/choice-utils.js.map +1 -0
  14. package/lib/feedback-config/feedback-selector.js +155 -0
  15. package/lib/feedback-config/feedback-selector.js.map +1 -0
  16. package/lib/feedback-config/group.js +61 -0
  17. package/lib/feedback-config/group.js.map +1 -0
  18. package/lib/feedback-config/index.js +146 -0
  19. package/lib/feedback-config/index.js.map +1 -0
  20. package/lib/form-section.js +44 -0
  21. package/lib/form-section.js.map +1 -0
  22. package/lib/help.js +106 -0
  23. package/lib/help.js.map +1 -0
  24. package/lib/index.js +186 -0
  25. package/lib/index.js.map +1 -0
  26. package/lib/input.js +106 -0
  27. package/lib/input.js.map +1 -0
  28. package/lib/inputs.js +105 -0
  29. package/lib/inputs.js.map +1 -0
  30. package/lib/langs.js +136 -0
  31. package/lib/langs.js.map +1 -0
  32. package/lib/layout/config-layout.js +137 -0
  33. package/lib/layout/config-layout.js.map +1 -0
  34. package/lib/layout/index.js +21 -0
  35. package/lib/layout/index.js.map +1 -0
  36. package/lib/layout/layout-contents.js +160 -0
  37. package/lib/layout/layout-contents.js.map +1 -0
  38. package/lib/layout/settings-box.js +57 -0
  39. package/lib/layout/settings-box.js.map +1 -0
  40. package/lib/mui-box/index.js +63 -0
  41. package/lib/mui-box/index.js.map +1 -0
  42. package/lib/number-text-field-custom.js +376 -0
  43. package/lib/number-text-field-custom.js.map +1 -0
  44. package/lib/number-text-field.js +229 -0
  45. package/lib/number-text-field.js.map +1 -0
  46. package/lib/radio-with-label.js +48 -0
  47. package/lib/radio-with-label.js.map +1 -0
  48. package/lib/settings/display-size.js +61 -0
  49. package/lib/settings/display-size.js.map +1 -0
  50. package/lib/settings/index.js +110 -0
  51. package/lib/settings/index.js.map +1 -0
  52. package/lib/settings/panel.js +392 -0
  53. package/lib/settings/panel.js.map +1 -0
  54. package/lib/settings/settings-radio-label.js +51 -0
  55. package/lib/settings/settings-radio-label.js.map +1 -0
  56. package/lib/settings/toggle.js +63 -0
  57. package/lib/settings/toggle.js.map +1 -0
  58. package/lib/tabs/index.js +75 -0
  59. package/lib/tabs/index.js.map +1 -0
  60. package/lib/tags-input/index.js +149 -0
  61. package/lib/tags-input/index.js.map +1 -0
  62. package/lib/two-choice.js +136 -0
  63. package/lib/two-choice.js.map +1 -0
  64. package/lib/with-stateful-model.js +61 -0
  65. package/lib/with-stateful-model.js.map +1 -0
  66. package/package.json +19 -33
  67. package/src/__tests__/alert-dialog.test.jsx +183 -0
  68. package/src/__tests__/checkbox.test.jsx +152 -0
  69. package/src/__tests__/choice-utils.test.js +12 -0
  70. package/src/__tests__/form-section.test.jsx +328 -0
  71. package/src/__tests__/help.test.jsx +184 -0
  72. package/src/__tests__/input.test.jsx +156 -0
  73. package/src/__tests__/langs.test.jsx +376 -0
  74. package/src/__tests__/number-text-field-custom.test.jsx +255 -0
  75. package/src/__tests__/number-text-field.test.jsx +263 -0
  76. package/src/__tests__/radio-with-label.test.jsx +155 -0
  77. package/src/__tests__/settings-panel.test.js +187 -0
  78. package/src/__tests__/settings.test.jsx +452 -0
  79. package/src/__tests__/tabs.test.jsx +188 -0
  80. package/src/__tests__/two-choice.test.js +110 -0
  81. package/src/__tests__/with-stateful-model.test.jsx +139 -0
  82. package/src/alert-dialog.jsx +75 -0
  83. package/src/checkbox.jsx +61 -0
  84. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +151 -0
  85. package/src/choice-configuration/__tests__/index.test.jsx +234 -0
  86. package/src/choice-configuration/feedback-menu.jsx +96 -0
  87. package/src/choice-configuration/index.jsx +357 -0
  88. package/src/choice-utils.js +30 -0
  89. package/src/feedback-config/__tests__/feedback-config.test.jsx +141 -0
  90. package/src/feedback-config/__tests__/feedback-selector.test.jsx +97 -0
  91. package/src/feedback-config/feedback-selector.jsx +112 -0
  92. package/src/feedback-config/group.jsx +51 -0
  93. package/src/feedback-config/index.jsx +111 -0
  94. package/src/form-section.jsx +31 -0
  95. package/src/help.jsx +79 -0
  96. package/src/index.js +55 -0
  97. package/src/input.jsx +72 -0
  98. package/src/inputs.jsx +69 -0
  99. package/src/langs.jsx +111 -0
  100. package/src/layout/__tests__/config.layout.test.jsx +59 -0
  101. package/src/layout/__tests__/layout-content.test.jsx +3 -0
  102. package/src/layout/config-layout.jsx +103 -0
  103. package/src/layout/index.js +4 -0
  104. package/src/layout/layout-contents.jsx +117 -0
  105. package/src/layout/settings-box.jsx +32 -0
  106. package/src/mui-box/index.jsx +56 -0
  107. package/src/number-text-field-custom.jsx +333 -0
  108. package/src/number-text-field.jsx +215 -0
  109. package/src/radio-with-label.jsx +30 -0
  110. package/src/settings/display-size.jsx +53 -0
  111. package/src/settings/index.js +83 -0
  112. package/src/settings/panel.jsx +333 -0
  113. package/src/settings/settings-radio-label.jsx +32 -0
  114. package/src/settings/toggle.jsx +46 -0
  115. package/src/tabs/index.jsx +47 -0
  116. package/src/tags-input/__tests__/index.test.jsx +113 -0
  117. package/src/tags-input/index.jsx +116 -0
  118. package/src/two-choice.jsx +90 -0
  119. package/src/with-stateful-model.jsx +36 -0
  120. package/dist/_virtual/_rolldown/runtime.js +0 -11
  121. package/dist/alert-dialog.d.ts +0 -44
  122. package/dist/alert-dialog.js +0 -47
  123. package/dist/checkbox.d.ts +0 -34
  124. package/dist/checkbox.js +0 -57
  125. package/dist/choice-configuration/feedback-menu.d.ts +0 -32
  126. package/dist/choice-configuration/feedback-menu.js +0 -85
  127. package/dist/choice-configuration/index.d.ts +0 -62
  128. package/dist/choice-configuration/index.js +0 -240
  129. package/dist/choice-utils.d.ts +0 -21
  130. package/dist/choice-utils.js +0 -15
  131. package/dist/feedback-config/feedback-selector.d.ts +0 -33
  132. package/dist/feedback-config/feedback-selector.js +0 -92
  133. package/dist/feedback-config/group.d.ts +0 -21
  134. package/dist/feedback-config/group.js +0 -33
  135. package/dist/feedback-config/index.d.ts +0 -48
  136. package/dist/feedback-config/index.js +0 -96
  137. package/dist/form-section.d.ts +0 -25
  138. package/dist/form-section.js +0 -25
  139. package/dist/fraction-to-number.d.ts +0 -7
  140. package/dist/fraction-to-number.js +0 -9
  141. package/dist/help.d.ts +0 -41
  142. package/dist/help.js +0 -61
  143. package/dist/index.d.ts +0 -31
  144. package/dist/index.js +0 -34
  145. package/dist/input.d.ts +0 -29
  146. package/dist/input.js +0 -65
  147. package/dist/inputs.d.ts +0 -63
  148. package/dist/inputs.js +0 -70
  149. package/dist/langs.d.ts +0 -41
  150. package/dist/langs.js +0 -76
  151. package/dist/layout/config-layout.d.ts +0 -10
  152. package/dist/layout/config-layout.js +0 -75
  153. package/dist/layout/index.d.ts +0 -11
  154. package/dist/layout/index.js +0 -10
  155. package/dist/layout/layout-contents.d.ts +0 -21
  156. package/dist/layout/layout-contents.js +0 -70
  157. package/dist/layout/settings-box.d.ts +0 -19
  158. package/dist/layout/settings-box.js +0 -31
  159. package/dist/mui-box/index.d.ts +0 -21
  160. package/dist/mui-box/index.js +0 -47
  161. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +0 -12
  162. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -7
  163. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -12
  164. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -8
  165. package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +0 -122
  166. package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +0 -276
  167. package/dist/number-text-field-custom.d.ts +0 -51
  168. package/dist/number-text-field-custom.js +0 -192
  169. package/dist/number-text-field.d.ts +0 -47
  170. package/dist/number-text-field.js +0 -122
  171. package/dist/radio-with-label.d.ts +0 -25
  172. package/dist/radio-with-label.js +0 -27
  173. package/dist/settings/display-size.d.ts +0 -26
  174. package/dist/settings/display-size.js +0 -45
  175. package/dist/settings/index.d.ts +0 -45
  176. package/dist/settings/index.js +0 -63
  177. package/dist/settings/panel.d.ts +0 -27
  178. package/dist/settings/panel.js +0 -201
  179. package/dist/settings/settings-radio-label.d.ts +0 -25
  180. package/dist/settings/settings-radio-label.js +0 -29
  181. package/dist/settings/toggle.d.ts +0 -25
  182. package/dist/settings/toggle.js +0 -33
  183. package/dist/tabs/index.d.ts +0 -22
  184. package/dist/tabs/index.js +0 -39
  185. package/dist/tags-input/index.d.ts +0 -21
  186. package/dist/tags-input/index.js +0 -83
  187. package/dist/two-choice.d.ts +0 -43
  188. package/dist/two-choice.js +0 -79
  189. package/dist/with-stateful-model.d.ts +0 -42
  190. package/dist/with-stateful-model.js +0 -32
@@ -1,240 +0,0 @@
1
- import { InputCheckbox as e, InputRadio as t } from "../inputs.js";
2
- import n from "./feedback-menu.js";
3
- import r from "react";
4
- import i from "prop-types";
5
- import { styled as a } from "@mui/material/styles";
6
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
7
- import c from "@pie-lib/editable-html-tip-tap";
8
- import * as l from "@pie-lib/render-ui";
9
- import { InputContainer as u } from "@pie-lib/render-ui";
10
- import d from "@mui/material/IconButton";
11
- import f from "@mui/material/TextField";
12
- import p from "@mui/icons-material/Delete";
13
- import m from "@mui/icons-material/SubdirectoryArrowRight";
14
- //#region src/choice-configuration/index.tsx
15
- function h(e) {
16
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
17
- }
18
- function g(e, t) {
19
- return !e || h(e) ? e : h(e.default) ? e.default : t && h(e[t]) ? e[t] : t && h(e[t]?.default) ? e[t].default : e;
20
- }
21
- var _ = g(u, "InputContainer") || g(b.InputContainer, "InputContainer"), v = l, y = v.default, b = y && typeof y == "object" ? y : v, x = a("div")(({ theme: e }) => ({ marginTop: e.spacing(2) })), S = ({ label: e, onChange: t, value: n, className: r, imageSupport: i, disableImageAlignmentButtons: a, disabled: s, spellCheck: l, nonEmpty: u, pluginOpts: d, toolbarOpts: f, error: p, maxImageWidth: m, maxImageHeight: h, uploadSoundSupport: g, mathMlOptions: v = {} }) => /* @__PURE__ */ o(_, {
22
- label: e,
23
- className: r,
24
- children: /* @__PURE__ */ o(x, { children: /* @__PURE__ */ o(c, {
25
- markup: n || "",
26
- disabled: s,
27
- spellCheck: l,
28
- nonEmpty: u,
29
- onChange: t,
30
- imageSupport: i,
31
- disableImageAlignmentButtons: a,
32
- pluginProps: d || {},
33
- toolbarOpts: f,
34
- error: p,
35
- maxImageWidth: m,
36
- maxImageHeight: h,
37
- uploadSoundSupport: g,
38
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
39
- mathMlOptions: v
40
- }) })
41
- }), C = a("div")(() => ({ position: "relative" })), w = a(m)(({ theme: e }) => ({
42
- fill: e.palette.grey[400],
43
- left: -56,
44
- position: "absolute",
45
- top: 40
46
- })), T = a(f)(({ theme: e }) => ({
47
- width: "100%",
48
- marginTop: e.spacing(2)
49
- })), E = a(S)(({ theme: e }) => ({
50
- width: "100%",
51
- marginTop: e.spacing(2)
52
- })), D = ({ value: e, onChange: t, type: n, correct: r, defaults: i, toolbarOpts: a, mathMlOptions: c = {} }) => !n || n === "none" ? null : n === "default" ? /* @__PURE__ */ s(C, { children: [/* @__PURE__ */ o(w, {}), /* @__PURE__ */ o(T, {
53
- label: "Feedback Text",
54
- value: r ? i.correct : i.incorrect,
55
- variant: "standard"
56
- })] }) : /* @__PURE__ */ s(C, { children: [/* @__PURE__ */ o(w, {}), /* @__PURE__ */ o(E, {
57
- label: "Feedback Text",
58
- value: e,
59
- onChange: t,
60
- toolbarOpts: a,
61
- mathMlOptions: c
62
- })] }), O = a("span")(({ theme: e }) => ({
63
- paddingRight: e.spacing(1),
64
- paddingTop: e.spacing(3)
65
- })), k = a("div")(() => ({
66
- display: "flex",
67
- alignItems: "center"
68
- })), A = a("div")(({ theme: e }) => ({
69
- flex: "0 1 auto",
70
- paddingTop: e.spacing(.5),
71
- paddingBottom: 0,
72
- marginRight: 0,
73
- marginLeft: e.spacing(1)
74
- })), j = a("div")(({ theme: e }) => ({
75
- flex: "0 1 auto",
76
- paddingTop: e.spacing(2),
77
- paddingLeft: 0,
78
- marginLeft: 0,
79
- marginRight: e.spacing(1)
80
- })), M = a("div")(() => ({
81
- margin: 0,
82
- width: "inherit"
83
- })), N = a("div")(() => ({
84
- margin: 0,
85
- width: "inherit"
86
- })), P = a("div")(({ theme: e }) => ({
87
- flex: "0 1 auto",
88
- paddingTop: e.spacing(2),
89
- paddingLeft: 0,
90
- marginLeft: 0
91
- })), F = a("div")(({ theme: e }) => ({
92
- display: "flex",
93
- flex: 1,
94
- flexDirection: "column",
95
- marginRight: e.spacing(1)
96
- })), I = a("div")(({ theme: e }) => ({
97
- fontSize: e.typography.fontSize - 2,
98
- color: e.palette.error.main
99
- })), L = class extends r.Component {
100
- static propTypes = {
101
- noLabels: i.bool,
102
- useLetterOrdering: i.bool,
103
- className: i.string,
104
- error: i.string,
105
- mode: i.oneOf(["checkbox", "radio"]),
106
- defaultFeedback: i.object.isRequired,
107
- disabled: i.bool,
108
- nonEmpty: i.bool,
109
- data: i.shape({
110
- label: i.string.isRequired,
111
- value: i.string.isRequired,
112
- correct: i.bool,
113
- feedback: i.shape({
114
- type: i.string,
115
- value: i.string
116
- })
117
- }),
118
- onDelete: i.func,
119
- onChange: i.func,
120
- index: i.number,
121
- imageSupport: i.shape({
122
- add: i.func.isRequired,
123
- delete: i.func.isRequired
124
- }),
125
- disableImageAlignmentButtons: i.bool,
126
- allowFeedBack: i.bool,
127
- allowDelete: i.bool,
128
- noCorrectAnswerError: i.string,
129
- spellCheck: i.bool,
130
- pluginOpts: i.object,
131
- toolbarOpts: i.object,
132
- uploadSoundSupport: i.object,
133
- maxImageWidth: i.number,
134
- maxImageHeight: i.number
135
- };
136
- static defaultProps = {
137
- index: -1,
138
- noLabels: !1,
139
- useLetterOrdering: !1,
140
- allowFeedBack: !0,
141
- allowDelete: !0
142
- };
143
- _changeFn = (e) => (t) => {
144
- let { data: n, onChange: r } = this.props;
145
- r && r({
146
- ...n,
147
- [e]: t
148
- });
149
- };
150
- onLabelChange = this._changeFn("label");
151
- onCheckedChange = (e) => {
152
- let t = e.target.checked, { data: n, onChange: r } = this.props;
153
- r && r({
154
- ...n,
155
- correct: t
156
- });
157
- };
158
- onFeedbackValueChange = (e) => {
159
- let { data: t, onChange: n } = this.props;
160
- if (t.feedback.type !== "custom") return;
161
- let r = {
162
- ...t.feedback,
163
- value: e
164
- };
165
- n && n({
166
- ...t,
167
- feedback: r
168
- });
169
- };
170
- onFeedbackTypeChange = (e) => {
171
- let { data: t, onChange: n } = this.props, r = {
172
- ...t.feedback,
173
- type: e
174
- };
175
- r.type !== "custom" && (r.value = void 0), n && n({
176
- ...t,
177
- feedback: r
178
- });
179
- };
180
- render() {
181
- let { data: r, mode: i, onDelete: a, defaultFeedback: c, index: l, className: u, noLabels: f, useLetterOrdering: m, imageSupport: h, disableImageAlignmentButtons: g, disabled: v, spellCheck: y, nonEmpty: b, allowFeedBack: x, allowDelete: C, pluginOpts: w, toolbarOpts: T, error: E, noCorrectAnswerError: L, uploadSoundSupport: R, maxImageWidth: z, maxImageHeight: B, mathMlOptions: V = {} } = this.props, H = i === "checkbox" ? e : t;
182
- return /* @__PURE__ */ s(k, { children: [
183
- l > 0 && /* @__PURE__ */ o(O, {
184
- type: "title",
185
- children: m ? String.fromCharCode(96 + l).toUpperCase() : l
186
- }),
187
- /* @__PURE__ */ o(A, { children: /* @__PURE__ */ o(H, {
188
- onChange: this.onCheckedChange,
189
- label: f ? "" : "Correct",
190
- checked: !!r.correct,
191
- error: L
192
- }) }),
193
- /* @__PURE__ */ s(F, { children: [
194
- /* @__PURE__ */ o(S, {
195
- label: f ? "" : "Label",
196
- value: r.label,
197
- onChange: this.onLabelChange,
198
- imageSupport: h,
199
- disableImageAlignmentButtons: g,
200
- disabled: v,
201
- spellCheck: y,
202
- nonEmpty: b,
203
- pluginOpts: w,
204
- toolbarOpts: T,
205
- error: E,
206
- uploadSoundSupport: R,
207
- mathMlOptions: V,
208
- maxImageWidth: z,
209
- maxImageHeight: B
210
- }),
211
- E && /* @__PURE__ */ o(I, { children: E }),
212
- x && /* @__PURE__ */ o(D, {
213
- ...r.feedback,
214
- correct: r.correct,
215
- defaults: c,
216
- onChange: this.onFeedbackValueChange,
217
- toolbarOpts: T
218
- })
219
- ] }),
220
- x && /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(_, {
221
- label: f ? "" : "Feedback",
222
- children: /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(n, {
223
- onChange: this.onFeedbackTypeChange,
224
- value: r.feedback
225
- }) })
226
- }) }),
227
- C && /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(_, {
228
- label: f ? "" : "Delete",
229
- children: /* @__PURE__ */ o(N, { children: /* @__PURE__ */ o(d, {
230
- "aria-label": "delete",
231
- onClick: a,
232
- size: "large",
233
- children: /* @__PURE__ */ o(p, {})
234
- }) })
235
- }) })
236
- ] });
237
- }
238
- };
239
- //#endregion
240
- export { L as default };
@@ -1,21 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/config-ui/src/choice-utils.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
- /**
10
- * Add value to every model.choices.
11
- * @param {Object} model the model to normalize
12
- * @return {Object} the updated model
13
- */
14
- export declare const normalizeChoices: (model: any) => any;
15
- /**
16
- * Find the first available index.
17
- * @param {string[]} values
18
- * @param {number} index
19
- * @return {string}
20
- */
21
- export declare const firstAvailableIndex: (values: any, index: any) => any;
@@ -1,15 +0,0 @@
1
- import { __exportAll as e } from "./_virtual/_rolldown/runtime.js";
2
- import { includes as t } from "@pie-element/shared-lodash";
3
- //#region src/choice-utils.ts
4
- var n = /* @__PURE__ */ e({
5
- firstAvailableIndex: () => i,
6
- normalizeChoices: () => r
7
- }), r = (e) => {
8
- let t = e.choices.map((e, t) => (e.value ||= `${t}`, e));
9
- return {
10
- ...e,
11
- choices: t
12
- };
13
- }, i = (e, n) => t(e, `${n}`) ? i(e, n + 1) : `${n}`;
14
- //#endregion
15
- export { n as choice_utils_exports };
@@ -1,33 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/config-ui/src/feedback-config/feedback-selector.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
- import React from 'react';
11
- export declare const FeedbackType: {
12
- type: PropTypes.Requireable<string>;
13
- default: PropTypes.Requireable<string>;
14
- custom: PropTypes.Requireable<string>;
15
- };
16
- export declare class FeedbackSelector extends React.Component {
17
- static propTypes: {
18
- keys: PropTypes.Requireable<(string | null | undefined)[]>;
19
- label: PropTypes.Validator<string>;
20
- feedback: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
21
- type: PropTypes.Requireable<string>;
22
- default: PropTypes.Requireable<string>;
23
- custom: PropTypes.Requireable<string>;
24
- }>>>;
25
- onChange: PropTypes.Validator<(...args: any[]) => any>;
26
- toolbarOpts: PropTypes.Requireable<object>;
27
- mathMlOptions: PropTypes.Requireable<object>;
28
- };
29
- changeType: any;
30
- changeCustom: any;
31
- render(): React.JSX.Element;
32
- }
33
- export default FeedbackSelector;
@@ -1,92 +0,0 @@
1
- import e from "./group.js";
2
- import t from "react";
3
- import n from "prop-types";
4
- import { styled as r } from "@mui/material/styles";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- import o from "@pie-lib/editable-html-tip-tap";
7
- import * as s from "@pie-lib/render-ui";
8
- import { InputContainer as c } from "@pie-lib/render-ui";
9
- //#region src/feedback-config/feedback-selector.tsx
10
- function l(e) {
11
- return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
12
- }
13
- function u(e, t) {
14
- return !e || l(e) ? e : l(e.default) ? e.default : t && l(e[t]) ? e[t] : t && l(e[t]?.default) ? e[t].default : e;
15
- }
16
- var d = u(c, "InputContainer") || u(m.InputContainer, "InputContainer"), f = s, p = f.default, m = p && typeof p == "object" ? p : f, h = r(o)(({ theme: e }) => ({ fontFamily: e.typography.fontFamily })), g = {
17
- default: "Simple Feedback",
18
- none: "No Feedback",
19
- custom: "Customized Feedback"
20
- }, _ = r("div")(({ theme: e }) => ({ marginBottom: e.spacing(1) })), v = r(d)(() => ({ paddingBottom: 0 })), y = r("div")(({ theme: e }) => ({
21
- marginTop: "0px",
22
- background: e.palette.grey[300],
23
- padding: 0,
24
- marginBottom: e.spacing(2),
25
- borderRadius: "4px"
26
- })), b = r("div")(({ theme: e }) => ({
27
- marginTop: "0px",
28
- background: e.palette.grey[300],
29
- padding: e.spacing(2),
30
- marginBottom: e.spacing(2),
31
- borderRadius: "4px",
32
- fontFamily: e.typography.fontFamily,
33
- cursor: "default"
34
- })), x = r(e)(({ theme: e }) => ({ paddingTop: e.spacing(1) })), S = {
35
- type: n.oneOf([
36
- "default",
37
- "custom",
38
- "none"
39
- ]),
40
- default: n.string,
41
- custom: n.string
42
- }, C = class extends t.Component {
43
- static propTypes = {
44
- keys: n.arrayOf(n.string),
45
- label: n.string.isRequired,
46
- feedback: n.shape(S).isRequired,
47
- onChange: n.func.isRequired,
48
- toolbarOpts: n.object,
49
- mathMlOptions: n.object
50
- };
51
- changeType = (e) => {
52
- let { onChange: t, feedback: n } = this.props;
53
- t({
54
- ...n,
55
- type: e
56
- });
57
- };
58
- changeCustom = (e) => {
59
- let { onChange: t, feedback: n } = this.props;
60
- t({
61
- ...n,
62
- type: "custom",
63
- custom: e
64
- });
65
- };
66
- render() {
67
- let { keys: e, label: t, feedback: n, toolbarOpts: r, mathMlOptions: o = {} } = this.props;
68
- return /* @__PURE__ */ a(_, { children: [
69
- /* @__PURE__ */ i(v, {
70
- label: t,
71
- extraClasses: { label: { transform: "translateY(-20%)" } },
72
- children: /* @__PURE__ */ i(x, {
73
- keys: e || Object.keys(g),
74
- label: t,
75
- value: n.type,
76
- onChange: this.changeType,
77
- feedbackLabels: g
78
- })
79
- }),
80
- n.type === "custom" && /* @__PURE__ */ i(y, { children: /* @__PURE__ */ i(h, {
81
- onChange: this.changeCustom,
82
- markup: n.custom || "",
83
- toolbarOpts: r,
84
- languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
85
- mathMlOptions: o
86
- }) }),
87
- n.type === "default" && /* @__PURE__ */ a(b, { children: [" ", n.default] })
88
- ] });
89
- }
90
- };
91
- //#endregion
92
- export { S as FeedbackType, C as default };
@@ -1,21 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/config-ui/src/feedback-config/group.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
- import React from 'react';
11
- declare const Group: {
12
- (props: any): React.JSX.Element;
13
- propTypes: {
14
- className: PropTypes.Requireable<string>;
15
- feedbackLabels: PropTypes.Validator<object>;
16
- value: PropTypes.Validator<string>;
17
- keys: PropTypes.Requireable<(string | null | undefined)[]>;
18
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
19
- };
20
- };
21
- export default Group;
@@ -1,33 +0,0 @@
1
- import e from "../radio-with-label.js";
2
- import "react";
3
- import t from "prop-types";
4
- import { styled as n } from "@mui/material/styles";
5
- import { jsx as r } from "react/jsx-runtime";
6
- //#region src/feedback-config/group.tsx
7
- var i = n("div")(() => ({
8
- display: "flex",
9
- alignItems: "center"
10
- })), a = n("div")(() => ({
11
- display: "flex",
12
- alignItems: "center"
13
- })), o = n(e)(({ theme: e }) => ({ "& .MuiFormControlLabel-label": { fontSize: e.typography.fontSize - 2 } })), s = (e) => {
14
- let { feedbackLabels: t, value: n, className: s, onChange: c, keys: l } = e;
15
- return /* @__PURE__ */ r(i, {
16
- className: s,
17
- children: l.map((e) => /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(o, {
18
- value: e,
19
- checked: n === e,
20
- onChange: (e) => c(e.currentTarget.value),
21
- label: t[e]
22
- }) }, e))
23
- });
24
- };
25
- s.propTypes = {
26
- className: t.string,
27
- feedbackLabels: t.object.isRequired,
28
- value: t.string.isRequired,
29
- keys: t.arrayOf(t.string),
30
- onChange: t.func
31
- };
32
- //#endregion
33
- export { s as default };
@@ -1,48 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/config-ui/src/feedback-config/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 FeedbackSelector from './feedback-selector.js';
10
- import PropTypes from 'prop-types';
11
- import React from 'react';
12
- export { FeedbackSelector };
13
- export declare const buildDefaults: (input: any) => {};
14
- export declare class FeedbackConfig extends React.Component {
15
- static propTypes: {
16
- allowPartial: PropTypes.Requireable<boolean>;
17
- className: PropTypes.Requireable<string>;
18
- feedback: PropTypes.Requireable<PropTypes.InferProps<{
19
- correct: PropTypes.Requireable<PropTypes.InferProps<{
20
- type: PropTypes.Requireable<string>;
21
- default: PropTypes.Requireable<string>;
22
- custom: PropTypes.Requireable<string>;
23
- }>>;
24
- incorrect: PropTypes.Requireable<PropTypes.InferProps<{
25
- type: PropTypes.Requireable<string>;
26
- default: PropTypes.Requireable<string>;
27
- custom: PropTypes.Requireable<string>;
28
- }>>;
29
- partial: PropTypes.Requireable<PropTypes.InferProps<{
30
- type: PropTypes.Requireable<string>;
31
- default: PropTypes.Requireable<string>;
32
- custom: PropTypes.Requireable<string>;
33
- }>>;
34
- }>>;
35
- onChange: PropTypes.Validator<(...args: any[]) => any>;
36
- toolbarOpts: PropTypes.Requireable<object>;
37
- };
38
- static defaultProps: {
39
- allowPartial: boolean;
40
- feedback: {};
41
- };
42
- onChange(key: any, config: any): void;
43
- onCorrectChange: (config: any) => void;
44
- onIncorrectChange: (config: any) => void;
45
- onPartialChange: (config: any) => void;
46
- render(): React.JSX.Element;
47
- }
48
- export default FeedbackConfig;
@@ -1,96 +0,0 @@
1
- import e, { FeedbackType as t } from "./feedback-selector.js";
2
- import n from "react";
3
- import r from "prop-types";
4
- import { styled as i } from "@mui/material/styles";
5
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
- import { merge as s } from "@pie-element/shared-lodash";
7
- import c from "@mui/material/Accordion";
8
- import l from "@mui/material/AccordionSummary";
9
- import u from "@mui/material/AccordionDetails";
10
- import d from "@mui/material/Typography";
11
- import f from "@mui/icons-material/ExpandMore";
12
- //#region src/feedback-config/index.tsx
13
- var p = i("div")(() => ({
14
- display: "flex",
15
- flex: 1,
16
- flexDirection: "column"
17
- })), m = i(u)(() => ({
18
- paddingTop: 0,
19
- paddingBottom: 0
20
- })), h = (e) => s({}, {
21
- correct: {
22
- type: "default",
23
- default: "Correct"
24
- },
25
- incorrect: {
26
- type: "default",
27
- default: "Incorrect"
28
- },
29
- partial: {
30
- type: "default",
31
- default: "Nearly"
32
- }
33
- }, e), g = class extends n.Component {
34
- static propTypes = {
35
- allowPartial: r.bool,
36
- className: r.string,
37
- feedback: r.shape({
38
- correct: r.shape(t),
39
- incorrect: r.shape(t),
40
- partial: r.shape(t)
41
- }),
42
- onChange: r.func.isRequired,
43
- toolbarOpts: r.object
44
- };
45
- static defaultProps = {
46
- allowPartial: !0,
47
- feedback: h()
48
- };
49
- onChange(e, t) {
50
- let { feedback: n, onChange: r } = this.props;
51
- r({
52
- ...n,
53
- [e]: t
54
- });
55
- }
56
- onCorrectChange = this.onChange.bind(this, "correct");
57
- onIncorrectChange = this.onChange.bind(this, "incorrect");
58
- onPartialChange = this.onChange.bind(this, "partial");
59
- render() {
60
- let { className: t, allowPartial: n, feedback: r, toolbarOpts: i } = this.props;
61
- return /* @__PURE__ */ a("div", {
62
- className: t,
63
- children: /* @__PURE__ */ o(c, {
64
- slotProps: { transition: { timeout: {
65
- enter: 225,
66
- exit: 195
67
- } } },
68
- children: [/* @__PURE__ */ a(l, {
69
- expandIcon: /* @__PURE__ */ a(f, {}),
70
- children: /* @__PURE__ */ a(d, { children: "Feedback" })
71
- }), /* @__PURE__ */ a(m, { children: /* @__PURE__ */ o(p, { children: [
72
- /* @__PURE__ */ a(e, {
73
- label: "If correct, show",
74
- feedback: r.correct,
75
- onChange: this.onCorrectChange,
76
- toolbarOpts: i
77
- }),
78
- n && /* @__PURE__ */ a(e, {
79
- label: "If partially correct, show",
80
- feedback: r.partial,
81
- onChange: this.onPartialChange,
82
- toolbarOpts: i
83
- }),
84
- /* @__PURE__ */ a(e, {
85
- label: "If incorrect, show",
86
- feedback: r.incorrect,
87
- onChange: this.onIncorrectChange,
88
- toolbarOpts: i
89
- })
90
- ] }) })]
91
- })
92
- });
93
- }
94
- };
95
- //#endregion
96
- export { h as buildDefaults, g as default };
@@ -1,25 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/config-ui/src/form-section.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 FormSection: {
12
- ({ className, label, children, labelExtraStyle }: {
13
- className: any;
14
- label: any;
15
- children: any;
16
- labelExtraStyle: any;
17
- }): React.JSX.Element;
18
- propTypes: {
19
- className: PropTypes.Requireable<string>;
20
- label: PropTypes.Requireable<string>;
21
- children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
22
- labelExtraStyle: PropTypes.Requireable<object>;
23
- };
24
- };
25
- export default FormSection;
@@ -1,25 +0,0 @@
1
- import "react";
2
- import e from "prop-types";
3
- import { styled as t } from "@mui/material/styles";
4
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
5
- import i from "@mui/material/Typography";
6
- //#region src/form-section.tsx
7
- var a = t("div")(({ theme: e }) => ({
8
- marginTop: e.spacing(2),
9
- marginBottom: e.spacing(2)
10
- })), o = t(i)(({ theme: e }) => ({ marginBottom: e.spacing(1) })), s = ({ className: e, label: t, children: i, labelExtraStyle: s }) => /* @__PURE__ */ r(a, {
11
- className: e,
12
- children: [/* @__PURE__ */ n(o, {
13
- variant: "subtitle1",
14
- style: s,
15
- children: t
16
- }), i]
17
- });
18
- s.propTypes = {
19
- className: e.string,
20
- label: e.string,
21
- children: e.node,
22
- labelExtraStyle: e.object
23
- };
24
- //#endregion
25
- export { s as default };
@@ -1,7 +0,0 @@
1
- type FractionLike = {
2
- d: number;
3
- n: number;
4
- s?: number;
5
- };
6
- export declare const fractionToNumber: (value: FractionLike | number | string) => number;
7
- export {};
@@ -1,9 +0,0 @@
1
- //#region src/fraction-to-number.ts
2
- var e = (e) => typeof e == "object" && !!e && typeof e.n == "number" && typeof e.d == "number", t = (t) => {
3
- if (typeof t == "number") return t;
4
- if (e(t)) return (t.s ?? 1) * t.n / t.d;
5
- let n = String(t).trim(), r = n.match(/^([+-]?\d+)\s*\/\s*([+-]?\d+)$/);
6
- return r ? Number.parseInt(r[1] ?? "0", 10) / Number.parseInt(r[2] ?? "1", 10) : Number(n);
7
- };
8
- //#endregion
9
- export { t as fractionToNumber };