@pie-lib/config-ui 13.1.0-beta.7 → 14.0.0-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 (233) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/alert-dialog.d.ts +44 -0
  3. package/dist/alert-dialog.js +47 -0
  4. package/dist/checkbox.d.ts +34 -0
  5. package/dist/checkbox.js +57 -0
  6. package/dist/choice-configuration/feedback-menu.d.ts +32 -0
  7. package/dist/choice-configuration/feedback-menu.js +85 -0
  8. package/dist/choice-configuration/index.d.ts +62 -0
  9. package/dist/choice-configuration/index.js +240 -0
  10. package/dist/choice-utils.d.ts +21 -0
  11. package/dist/choice-utils.js +15 -0
  12. package/dist/feedback-config/feedback-selector.d.ts +33 -0
  13. package/dist/feedback-config/feedback-selector.js +92 -0
  14. package/dist/feedback-config/group.d.ts +21 -0
  15. package/dist/feedback-config/group.js +33 -0
  16. package/dist/feedback-config/index.d.ts +48 -0
  17. package/dist/feedback-config/index.js +96 -0
  18. package/dist/form-section.d.ts +25 -0
  19. package/dist/form-section.js +25 -0
  20. package/dist/fraction-to-number.d.ts +7 -0
  21. package/dist/fraction-to-number.js +9 -0
  22. package/dist/help.d.ts +41 -0
  23. package/dist/help.js +62 -0
  24. package/dist/index.d.ts +31 -0
  25. package/dist/index.js +34 -0
  26. package/dist/input.d.ts +29 -0
  27. package/dist/input.js +65 -0
  28. package/dist/inputs.d.ts +63 -0
  29. package/dist/inputs.js +70 -0
  30. package/dist/langs.d.ts +41 -0
  31. package/dist/langs.js +76 -0
  32. package/dist/layout/config-layout.d.ts +10 -0
  33. package/dist/layout/config-layout.js +75 -0
  34. package/dist/layout/index.d.ts +11 -0
  35. package/dist/layout/index.js +10 -0
  36. package/dist/layout/layout-contents.d.ts +21 -0
  37. package/dist/layout/layout-contents.js +70 -0
  38. package/dist/layout/settings-box.d.ts +19 -0
  39. package/dist/layout/settings-box.js +32 -0
  40. package/dist/mui-box/index.d.ts +21 -0
  41. package/dist/mui-box/index.js +47 -0
  42. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  43. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  44. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  45. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  46. package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +122 -0
  47. package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +276 -0
  48. package/dist/number-text-field-custom.d.ts +51 -0
  49. package/dist/number-text-field-custom.js +192 -0
  50. package/dist/number-text-field.d.ts +47 -0
  51. package/dist/number-text-field.js +122 -0
  52. package/dist/radio-with-label.d.ts +25 -0
  53. package/dist/radio-with-label.js +27 -0
  54. package/dist/settings/display-size.d.ts +26 -0
  55. package/dist/settings/display-size.js +45 -0
  56. package/dist/settings/index.d.ts +45 -0
  57. package/dist/settings/index.js +63 -0
  58. package/dist/settings/panel.d.ts +27 -0
  59. package/dist/settings/panel.js +201 -0
  60. package/dist/settings/settings-radio-label.d.ts +25 -0
  61. package/dist/settings/settings-radio-label.js +29 -0
  62. package/dist/settings/toggle.d.ts +25 -0
  63. package/dist/settings/toggle.js +33 -0
  64. package/dist/tabs/index.d.ts +22 -0
  65. package/dist/tabs/index.js +39 -0
  66. package/dist/tags-input/index.d.ts +21 -0
  67. package/dist/tags-input/index.js +83 -0
  68. package/dist/two-choice.d.ts +43 -0
  69. package/dist/two-choice.js +79 -0
  70. package/dist/with-stateful-model.d.ts +42 -0
  71. package/dist/with-stateful-model.js +32 -0
  72. package/package.json +31 -19
  73. package/CHANGELOG.json +0 -32
  74. package/CHANGELOG.md +0 -2419
  75. package/lib/__tests__/alert-dialog.test.js +0 -262
  76. package/lib/__tests__/alert-dialog.test.js.map +0 -1
  77. package/lib/__tests__/checkbox.test.js +0 -227
  78. package/lib/__tests__/checkbox.test.js.map +0 -1
  79. package/lib/__tests__/choice-utils.test.js +0 -14
  80. package/lib/__tests__/choice-utils.test.js.map +0 -1
  81. package/lib/__tests__/form-section.test.js +0 -252
  82. package/lib/__tests__/form-section.test.js.map +0 -1
  83. package/lib/__tests__/help.test.js +0 -270
  84. package/lib/__tests__/help.test.js.map +0 -1
  85. package/lib/__tests__/input.test.js +0 -268
  86. package/lib/__tests__/input.test.js.map +0 -1
  87. package/lib/__tests__/langs.test.js +0 -541
  88. package/lib/__tests__/langs.test.js.map +0 -1
  89. package/lib/__tests__/number-text-field-custom.test.js +0 -362
  90. package/lib/__tests__/number-text-field-custom.test.js.map +0 -1
  91. package/lib/__tests__/number-text-field.test.js +0 -421
  92. package/lib/__tests__/number-text-field.test.js.map +0 -1
  93. package/lib/__tests__/radio-with-label.test.js +0 -233
  94. package/lib/__tests__/radio-with-label.test.js.map +0 -1
  95. package/lib/__tests__/settings-panel.test.js +0 -184
  96. package/lib/__tests__/settings-panel.test.js.map +0 -1
  97. package/lib/__tests__/settings.test.js +0 -653
  98. package/lib/__tests__/settings.test.js.map +0 -1
  99. package/lib/__tests__/tabs.test.js +0 -211
  100. package/lib/__tests__/tabs.test.js.map +0 -1
  101. package/lib/__tests__/two-choice.test.js +0 -124
  102. package/lib/__tests__/two-choice.test.js.map +0 -1
  103. package/lib/__tests__/with-stateful-model.test.js +0 -221
  104. package/lib/__tests__/with-stateful-model.test.js.map +0 -1
  105. package/lib/alert-dialog.js +0 -68
  106. package/lib/alert-dialog.js.map +0 -1
  107. package/lib/checkbox.js +0 -84
  108. package/lib/checkbox.js.map +0 -1
  109. package/lib/choice-configuration/__tests__/feedback-menu.test.js +0 -287
  110. package/lib/choice-configuration/__tests__/feedback-menu.test.js.map +0 -1
  111. package/lib/choice-configuration/__tests__/index.test.js +0 -253
  112. package/lib/choice-configuration/__tests__/index.test.js.map +0 -1
  113. package/lib/choice-configuration/feedback-menu.js +0 -129
  114. package/lib/choice-configuration/feedback-menu.js.map +0 -1
  115. package/lib/choice-configuration/index.js +0 -381
  116. package/lib/choice-configuration/index.js.map +0 -1
  117. package/lib/choice-utils.js +0 -42
  118. package/lib/choice-utils.js.map +0 -1
  119. package/lib/feedback-config/__tests__/feedback-config.test.js +0 -201
  120. package/lib/feedback-config/__tests__/feedback-config.test.js.map +0 -1
  121. package/lib/feedback-config/__tests__/feedback-selector.test.js +0 -177
  122. package/lib/feedback-config/__tests__/feedback-selector.test.js.map +0 -1
  123. package/lib/feedback-config/feedback-selector.js +0 -155
  124. package/lib/feedback-config/feedback-selector.js.map +0 -1
  125. package/lib/feedback-config/group.js +0 -61
  126. package/lib/feedback-config/group.js.map +0 -1
  127. package/lib/feedback-config/index.js +0 -146
  128. package/lib/feedback-config/index.js.map +0 -1
  129. package/lib/form-section.js +0 -44
  130. package/lib/form-section.js.map +0 -1
  131. package/lib/help.js +0 -106
  132. package/lib/help.js.map +0 -1
  133. package/lib/index.js +0 -186
  134. package/lib/index.js.map +0 -1
  135. package/lib/input.js +0 -106
  136. package/lib/input.js.map +0 -1
  137. package/lib/inputs.js +0 -105
  138. package/lib/inputs.js.map +0 -1
  139. package/lib/langs.js +0 -136
  140. package/lib/langs.js.map +0 -1
  141. package/lib/layout/__tests__/config.layout.test.js +0 -70
  142. package/lib/layout/__tests__/config.layout.test.js.map +0 -1
  143. package/lib/layout/__tests__/layout-content.test.js +0 -6
  144. package/lib/layout/__tests__/layout-content.test.js.map +0 -1
  145. package/lib/layout/config-layout.js +0 -137
  146. package/lib/layout/config-layout.js.map +0 -1
  147. package/lib/layout/index.js +0 -21
  148. package/lib/layout/index.js.map +0 -1
  149. package/lib/layout/layout-contents.js +0 -160
  150. package/lib/layout/layout-contents.js.map +0 -1
  151. package/lib/layout/settings-box.js +0 -57
  152. package/lib/layout/settings-box.js.map +0 -1
  153. package/lib/mui-box/index.js +0 -63
  154. package/lib/mui-box/index.js.map +0 -1
  155. package/lib/number-text-field-custom.js +0 -376
  156. package/lib/number-text-field-custom.js.map +0 -1
  157. package/lib/number-text-field.js +0 -229
  158. package/lib/number-text-field.js.map +0 -1
  159. package/lib/radio-with-label.js +0 -48
  160. package/lib/radio-with-label.js.map +0 -1
  161. package/lib/settings/display-size.js +0 -61
  162. package/lib/settings/display-size.js.map +0 -1
  163. package/lib/settings/index.js +0 -110
  164. package/lib/settings/index.js.map +0 -1
  165. package/lib/settings/panel.js +0 -392
  166. package/lib/settings/panel.js.map +0 -1
  167. package/lib/settings/settings-radio-label.js +0 -51
  168. package/lib/settings/settings-radio-label.js.map +0 -1
  169. package/lib/settings/toggle.js +0 -63
  170. package/lib/settings/toggle.js.map +0 -1
  171. package/lib/tabs/index.js +0 -75
  172. package/lib/tabs/index.js.map +0 -1
  173. package/lib/tags-input/__tests__/index.test.js +0 -183
  174. package/lib/tags-input/__tests__/index.test.js.map +0 -1
  175. package/lib/tags-input/index.js +0 -149
  176. package/lib/tags-input/index.js.map +0 -1
  177. package/lib/two-choice.js +0 -136
  178. package/lib/two-choice.js.map +0 -1
  179. package/lib/with-stateful-model.js +0 -61
  180. package/lib/with-stateful-model.js.map +0 -1
  181. package/src/__tests__/alert-dialog.test.jsx +0 -183
  182. package/src/__tests__/checkbox.test.jsx +0 -152
  183. package/src/__tests__/choice-utils.test.js +0 -12
  184. package/src/__tests__/form-section.test.jsx +0 -328
  185. package/src/__tests__/help.test.jsx +0 -184
  186. package/src/__tests__/input.test.jsx +0 -156
  187. package/src/__tests__/langs.test.jsx +0 -376
  188. package/src/__tests__/number-text-field-custom.test.jsx +0 -255
  189. package/src/__tests__/number-text-field.test.jsx +0 -263
  190. package/src/__tests__/radio-with-label.test.jsx +0 -155
  191. package/src/__tests__/settings-panel.test.js +0 -187
  192. package/src/__tests__/settings.test.jsx +0 -452
  193. package/src/__tests__/tabs.test.jsx +0 -188
  194. package/src/__tests__/two-choice.test.js +0 -110
  195. package/src/__tests__/with-stateful-model.test.jsx +0 -139
  196. package/src/alert-dialog.jsx +0 -75
  197. package/src/checkbox.jsx +0 -61
  198. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +0 -151
  199. package/src/choice-configuration/__tests__/index.test.jsx +0 -234
  200. package/src/choice-configuration/feedback-menu.jsx +0 -96
  201. package/src/choice-configuration/index.jsx +0 -357
  202. package/src/choice-utils.js +0 -30
  203. package/src/feedback-config/__tests__/feedback-config.test.jsx +0 -141
  204. package/src/feedback-config/__tests__/feedback-selector.test.jsx +0 -97
  205. package/src/feedback-config/feedback-selector.jsx +0 -112
  206. package/src/feedback-config/group.jsx +0 -51
  207. package/src/feedback-config/index.jsx +0 -111
  208. package/src/form-section.jsx +0 -31
  209. package/src/help.jsx +0 -79
  210. package/src/index.js +0 -55
  211. package/src/input.jsx +0 -72
  212. package/src/inputs.jsx +0 -69
  213. package/src/langs.jsx +0 -111
  214. package/src/layout/__tests__/config.layout.test.jsx +0 -59
  215. package/src/layout/__tests__/layout-content.test.jsx +0 -3
  216. package/src/layout/config-layout.jsx +0 -103
  217. package/src/layout/index.js +0 -4
  218. package/src/layout/layout-contents.jsx +0 -117
  219. package/src/layout/settings-box.jsx +0 -32
  220. package/src/mui-box/index.jsx +0 -56
  221. package/src/number-text-field-custom.jsx +0 -333
  222. package/src/number-text-field.jsx +0 -215
  223. package/src/radio-with-label.jsx +0 -30
  224. package/src/settings/display-size.jsx +0 -53
  225. package/src/settings/index.js +0 -83
  226. package/src/settings/panel.jsx +0 -333
  227. package/src/settings/settings-radio-label.jsx +0 -32
  228. package/src/settings/toggle.jsx +0 -46
  229. package/src/tabs/index.jsx +0 -47
  230. package/src/tags-input/__tests__/index.test.jsx +0 -113
  231. package/src/tags-input/index.jsx +0 -116
  232. package/src/two-choice.jsx +0 -90
  233. package/src/with-stateful-model.jsx +0 -36
@@ -0,0 +1,92 @@
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, color as l } from "@pie-lib/render-ui";
9
+ //#region src/feedback-config/feedback-selector.tsx
10
+ function u(e) {
11
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
12
+ }
13
+ function d(e, t) {
14
+ return !e || u(e) ? e : u(e.default) ? e.default : t && u(e[t]) ? e[t] : t && u(e[t]?.default) ? e[t].default : e;
15
+ }
16
+ var f = d(c, "InputContainer") || d(h.InputContainer, "InputContainer"), p = s, m = p.default, h = m && typeof m == "object" ? m : p, g = r(o)(({ theme: e }) => ({ fontFamily: e.typography.fontFamily })), _ = {
17
+ default: "Simple Feedback",
18
+ none: "No Feedback",
19
+ custom: "Customized Feedback"
20
+ }, v = r("div")(({ theme: e }) => ({ marginBottom: e.spacing(1) })), y = r(f)(() => ({ paddingBottom: 0 })), b = r("div")(({ theme: e }) => ({
21
+ marginTop: "0px",
22
+ background: l.backgroundDark(),
23
+ padding: 0,
24
+ marginBottom: e.spacing(2),
25
+ borderRadius: "4px"
26
+ })), x = r("div")(({ theme: e }) => ({
27
+ marginTop: "0px",
28
+ background: l.backgroundDark(),
29
+ padding: e.spacing(2),
30
+ marginBottom: e.spacing(2),
31
+ borderRadius: "4px",
32
+ fontFamily: e.typography.fontFamily,
33
+ cursor: "default"
34
+ })), S = r(e)(({ theme: e }) => ({ paddingTop: e.spacing(1) })), C = {
35
+ type: n.oneOf([
36
+ "default",
37
+ "custom",
38
+ "none"
39
+ ]),
40
+ default: n.string,
41
+ custom: n.string
42
+ }, w = class extends t.Component {
43
+ static propTypes = {
44
+ keys: n.arrayOf(n.string),
45
+ label: n.string.isRequired,
46
+ feedback: n.shape(C).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(v, { children: [
69
+ /* @__PURE__ */ i(y, {
70
+ label: t,
71
+ extraClasses: { label: { transform: "translateY(-20%)" } },
72
+ children: /* @__PURE__ */ i(S, {
73
+ keys: e || Object.keys(_),
74
+ label: t,
75
+ value: n.type,
76
+ onChange: this.changeType,
77
+ feedbackLabels: _
78
+ })
79
+ }),
80
+ n.type === "custom" && /* @__PURE__ */ i(b, { children: /* @__PURE__ */ i(g, {
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(x, { children: [" ", n.default] })
88
+ ] });
89
+ }
90
+ };
91
+ //#endregion
92
+ export { w as FeedbackSelector, w as default, C as FeedbackType };
@@ -0,0 +1,21 @@
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;
@@ -0,0 +1,33 @@
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 };
@@ -0,0 +1,48 @@
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;
@@ -0,0 +1,96 @@
1
+ import { FeedbackSelector as 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 { g as FeedbackConfig, g as default, e as FeedbackSelector, h as buildDefaults };
@@ -0,0 +1,25 @@
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;
@@ -0,0 +1,25 @@
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 };
@@ -0,0 +1,7 @@
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 {};
@@ -0,0 +1,9 @@
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 };
package/dist/help.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/help.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 HelpButton: {
12
+ ({ onClick }: {
13
+ onClick: any;
14
+ }): React.JSX.Element;
15
+ propTypes: {
16
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
17
+ };
18
+ };
19
+ export declare const HelpDialog: {
20
+ ({ open, onClose, children, title }: {
21
+ open: any;
22
+ onClose: any;
23
+ children: any;
24
+ title: any;
25
+ }): React.JSX.Element;
26
+ propTypes: {
27
+ open: PropTypes.Requireable<boolean>;
28
+ onClose: PropTypes.Requireable<(...args: any[]) => any>;
29
+ children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
30
+ title: PropTypes.Validator<string>;
31
+ };
32
+ };
33
+ declare class Help extends React.Component {
34
+ static propTypes: {
35
+ children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
36
+ title: PropTypes.Requireable<string>;
37
+ };
38
+ constructor(props: any);
39
+ render(): React.JSX.Element;
40
+ }
41
+ export default Help;
package/dist/help.js ADDED
@@ -0,0 +1,62 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { styled as n } from "@mui/material/styles";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { color as a } from "@pie-lib/render-ui";
6
+ import o from "@mui/material/Dialog";
7
+ import s from "@mui/material/DialogTitle";
8
+ import c from "@mui/material/DialogContentText";
9
+ import l from "@mui/material/DialogContent";
10
+ import u from "@mui/material/DialogActions";
11
+ import d from "@mui/material/Button";
12
+ import f from "@mui/icons-material/Help";
13
+ import p from "@mui/material/IconButton";
14
+ //#region src/help.tsx
15
+ var m = n(p)(() => ({ "&:hover": { color: a.borderLight() } })), h = ({ onClick: e }) => /* @__PURE__ */ r(m, {
16
+ onClick: e,
17
+ size: "large",
18
+ children: /* @__PURE__ */ r(f, {})
19
+ });
20
+ h.propTypes = { onClick: t.func };
21
+ var g = ({ open: e, onClose: t, children: n, title: a }) => /* @__PURE__ */ i(o, {
22
+ open: e,
23
+ onClose: t,
24
+ children: [
25
+ /* @__PURE__ */ r(s, { children: a }),
26
+ /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(c, { children: n }) }),
27
+ /* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(d, {
28
+ onClick: t,
29
+ color: "primary",
30
+ children: "OK"
31
+ }) })
32
+ ]
33
+ });
34
+ g.propTypes = {
35
+ open: t.bool,
36
+ onClose: t.func,
37
+ children: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired,
38
+ title: t.string.isRequired
39
+ };
40
+ var _ = class extends e.Component {
41
+ static propTypes = {
42
+ children: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired,
43
+ title: t.string
44
+ };
45
+ constructor(e) {
46
+ super(e), this.state = { open: !1 };
47
+ }
48
+ render() {
49
+ let { children: e, title: t } = this.props;
50
+ return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(h, {
51
+ color: "accent",
52
+ onClick: () => this.setState({ open: !0 })
53
+ }), /* @__PURE__ */ r(g, {
54
+ open: this.state.open,
55
+ title: t,
56
+ onClose: () => this.setState({ open: !1 }),
57
+ children: e
58
+ })] });
59
+ }
60
+ };
61
+ //#endregion
62
+ export { h as HelpButton, g as HelpDialog, _ as default };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/index.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
+ import AlertDialog from './alert-dialog.js';
10
+ import FeedbackConfig, { buildDefaults as feedbackConfigDefaults, FeedbackSelector } from './feedback-config/index.js';
11
+ import { InputCheckbox, InputRadio, InputSwitch } from './inputs.js';
12
+ import Langs, { LanguageControls } from './langs.js';
13
+ import Tabs from './tabs/index.js';
14
+ import Checkbox from './checkbox.js';
15
+ import FormSection from './form-section.js';
16
+ import Help from './help.js';
17
+ import Input from './input.js';
18
+ declare const InputContainer: any;
19
+ import NumberTextField from './number-text-field.js';
20
+ import NumberTextFieldCustom from './number-text-field-custom.js';
21
+ import TwoChoice, { NChoice } from './two-choice.js';
22
+ import TagsInput from './tags-input/index.js';
23
+ import MuiBox from './mui-box/index.js';
24
+ import ChoiceConfiguration from './choice-configuration/index.js';
25
+ import * as layout from './layout/index.js';
26
+ import * as choiceUtils from './choice-utils.js';
27
+ import withStatefulModel from './with-stateful-model.js';
28
+ import Toggle from './settings/toggle.js';
29
+ import DisplaySize from './settings/display-size.js';
30
+ import * as settings from './settings/index.js';
31
+ export { AlertDialog, FeedbackConfig, FeedbackSelector, feedbackConfigDefaults, InputCheckbox, InputSwitch, InputRadio, Langs, LanguageControls, Tabs, Checkbox, FormSection, Help, Input, InputContainer, NumberTextField, NumberTextFieldCustom, TwoChoice, NChoice, TagsInput, MuiBox, ChoiceConfiguration, layout, choiceUtils, withStatefulModel, Toggle, DisplaySize, settings, };
package/dist/index.js ADDED
@@ -0,0 +1,34 @@
1
+ import e from "./alert-dialog.js";
2
+ import { FeedbackSelector as t } from "./feedback-config/feedback-selector.js";
3
+ import { FeedbackConfig as n, buildDefaults as r } from "./feedback-config/index.js";
4
+ import { InputCheckbox as i, InputRadio as a, InputSwitch as o } from "./inputs.js";
5
+ import { Langs as s, LanguageControls as c } from "./langs.js";
6
+ import { Tabs as l } from "./tabs/index.js";
7
+ import u from "./checkbox.js";
8
+ import d from "./form-section.js";
9
+ import f from "./help.js";
10
+ import p from "./input.js";
11
+ import { NumberTextField as m } from "./number-text-field.js";
12
+ import { NumberTextFieldCustom as h } from "./number-text-field-custom.js";
13
+ import g, { NChoice as _ } from "./two-choice.js";
14
+ import v from "./mui-box/index.js";
15
+ import { TagsInput as y } from "./tags-input/index.js";
16
+ import { ChoiceConfiguration as b } from "./choice-configuration/index.js";
17
+ import { layout_exports as x } from "./layout/index.js";
18
+ import { choice_utils_exports as S } from "./choice-utils.js";
19
+ import C from "./with-stateful-model.js";
20
+ import w from "./settings/toggle.js";
21
+ import T from "./settings/display-size.js";
22
+ import { settings_exports as E } from "./settings/index.js";
23
+ import * as D from "@pie-lib/render-ui";
24
+ import { InputContainer as O } from "@pie-lib/render-ui";
25
+ //#region src/index.ts
26
+ function k(e) {
27
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
28
+ }
29
+ function A(e, t) {
30
+ return !e || k(e) ? e : k(e.default) ? e.default : t && k(e[t]) ? e[t] : t && k(e[t]?.default) ? e[t].default : e;
31
+ }
32
+ var j = A(O, "InputContainer") || A(P.InputContainer, "InputContainer"), M = D, N = M.default, P = N && typeof N == "object" ? N : M;
33
+ //#endregion
34
+ export { e as AlertDialog, u as Checkbox, b as ChoiceConfiguration, T as DisplaySize, n as FeedbackConfig, t as FeedbackSelector, d as FormSection, f as Help, p as Input, i as InputCheckbox, j as InputContainer, a as InputRadio, o as InputSwitch, s as Langs, c as LanguageControls, v as MuiBox, _ as NChoice, m as NumberTextField, h as NumberTextFieldCustom, l as Tabs, y as TagsInput, w as Toggle, g as TwoChoice, S as choiceUtils, r as feedbackConfigDefaults, x as layout, E as settings, C as withStatefulModel };
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/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 * as React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ export default class Input extends React.Component {
12
+ static propTypes: {
13
+ value: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
14
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
15
+ label: PropTypes.Requireable<string>;
16
+ type: PropTypes.Validator<string>;
17
+ error: PropTypes.Requireable<(...args: any[]) => any>;
18
+ noModelUpdateOnError: PropTypes.Requireable<boolean>;
19
+ };
20
+ static defaultProps: {
21
+ type: string;
22
+ error: (value: any, type: any) => boolean;
23
+ noModelUpdateOnError: boolean;
24
+ };
25
+ constructor(props: any);
26
+ UNSAFE_componentWillReceiveProps(newProps: any): void;
27
+ onChange: any;
28
+ render(): React.JSX.Element;
29
+ }
package/dist/input.js ADDED
@@ -0,0 +1,65 @@
1
+ import * as e from "react";
2
+ import t from "prop-types";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import * as r from "@pie-lib/render-ui";
5
+ import { InputContainer as i } from "@pie-lib/render-ui";
6
+ import a from "@mui/material/Input";
7
+ //#region src/input.tsx
8
+ function o(e) {
9
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
10
+ }
11
+ function s(e, t) {
12
+ return !e || o(e) ? e : o(e.default) ? e.default : t && o(e[t]) ? e[t] : t && o(e[t]?.default) ? e[t].default : e;
13
+ }
14
+ var c = s(i, "InputContainer") || s(d.InputContainer, "InputContainer"), l = r, u = l.default, d = u && typeof u == "object" ? u : l, f = class extends e.Component {
15
+ static propTypes = {
16
+ value: t.oneOfType([t.string, t.number]),
17
+ onChange: t.func.isRequired,
18
+ label: t.string,
19
+ type: t.string.isRequired,
20
+ error: t.func,
21
+ noModelUpdateOnError: t.bool
22
+ };
23
+ static defaultProps = {
24
+ type: "text",
25
+ error: (e, t) => t === "number" ? !e || isNaN(e) : !e,
26
+ noModelUpdateOnError: !1
27
+ };
28
+ constructor(e) {
29
+ super(e), this.state = { value: e.value };
30
+ }
31
+ UNSAFE_componentWillReceiveProps(e) {
32
+ this.setState({ value: e.value });
33
+ }
34
+ onChange = (e) => {
35
+ let { type: t, onChange: n, error: r } = this.props, i = e.target.value;
36
+ r(i, t) ? this.setState({
37
+ error: !0,
38
+ value: e.target.value
39
+ }) : (this.setState({
40
+ error: !1,
41
+ value: e.target.value
42
+ }), n(e));
43
+ };
44
+ render() {
45
+ let { label: e, type: t, noModelUpdateOnError: r, ...i } = this.props, { value: o, error: s } = this.state;
46
+ return e ? /* @__PURE__ */ n(c, {
47
+ label: e,
48
+ children: /* @__PURE__ */ n(a, {
49
+ type: t,
50
+ ...i,
51
+ value: o,
52
+ onChange: this.onChange,
53
+ error: s
54
+ })
55
+ }) : /* @__PURE__ */ n(a, {
56
+ type: t,
57
+ ...i,
58
+ value: o,
59
+ onChange: this.onChange,
60
+ error: s
61
+ });
62
+ }
63
+ };
64
+ //#endregion
65
+ export { f as default };