@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,11 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ };
10
+ //#endregion
11
+ export { t as __exportAll };
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/alert-dialog.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 AlertDialog: {
12
+ ({ text, title, onClose, onConfirm, open, onCloseText, onConfirmText, disableAutoFocus, disableEnforceFocus, disableRestoreFocus, }: {
13
+ text: any;
14
+ title: any;
15
+ onClose: any;
16
+ onConfirm: any;
17
+ open: any;
18
+ onCloseText: any;
19
+ onConfirmText: any;
20
+ disableAutoFocus: any;
21
+ disableEnforceFocus: any;
22
+ disableRestoreFocus: any;
23
+ }): React.JSX.Element;
24
+ defaultProps: {
25
+ onCloseText: string;
26
+ onConfirmText: string;
27
+ disableAutoFocus: boolean;
28
+ disableEnforceFocus: boolean;
29
+ disableRestoreFocus: boolean;
30
+ };
31
+ propTypes: {
32
+ text: PropTypes.Requireable<NonNullable<string | object | null | undefined>>;
33
+ title: PropTypes.Requireable<string>;
34
+ onClose: PropTypes.Requireable<(...args: any[]) => any>;
35
+ onConfirm: PropTypes.Requireable<(...args: any[]) => any>;
36
+ open: PropTypes.Requireable<boolean>;
37
+ onConfirmText: PropTypes.Requireable<string>;
38
+ onCloseText: PropTypes.Requireable<string>;
39
+ disableAutoFocus: PropTypes.Requireable<boolean>;
40
+ disableEnforceFocus: PropTypes.Requireable<boolean>;
41
+ disableRestoreFocus: PropTypes.Requireable<boolean>;
42
+ };
43
+ };
44
+ export default AlertDialog;
@@ -0,0 +1,47 @@
1
+ import "react";
2
+ import e from "prop-types";
3
+ import { Button as t, Dialog as n, DialogActions as r, DialogContent as i, DialogContentText as a, DialogTitle as o } from "@mui/material";
4
+ import { styled as s } from "@mui/material/styles";
5
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
+ //#region src/alert-dialog.tsx
7
+ var u = s(o)(() => ({ fontSize: "max(1.25rem, 18px)" })), d = s(a)(() => ({ fontSize: "max(1rem, 14px)" })), f = ({ text: e, title: a, onClose: o, onConfirm: s, open: f, onCloseText: p, onConfirmText: m, disableAutoFocus: h, disableEnforceFocus: g, disableRestoreFocus: _ }) => /* @__PURE__ */ l(n, {
8
+ open: f,
9
+ disableAutoFocus: h,
10
+ disableEnforceFocus: g,
11
+ disableRestoreFocus: _,
12
+ onClose: o,
13
+ children: [
14
+ a && /* @__PURE__ */ c(u, { children: a }),
15
+ e && /* @__PURE__ */ c(i, { children: /* @__PURE__ */ c(d, { children: e }) }),
16
+ /* @__PURE__ */ l(r, { children: [o && /* @__PURE__ */ c(t, {
17
+ onClick: o,
18
+ color: "primary",
19
+ children: p
20
+ }), s && /* @__PURE__ */ c(t, {
21
+ autoFocus: !0,
22
+ onClick: s,
23
+ color: "primary",
24
+ children: m
25
+ })] })
26
+ ]
27
+ });
28
+ f.defaultProps = {
29
+ onCloseText: "CANCEL",
30
+ onConfirmText: "OK",
31
+ disableAutoFocus: !1,
32
+ disableEnforceFocus: !1,
33
+ disableRestoreFocus: !1
34
+ }, f.propTypes = {
35
+ text: e.oneOfType([e.string, e.object]),
36
+ title: e.string,
37
+ onClose: e.func,
38
+ onConfirm: e.func,
39
+ open: e.bool,
40
+ onConfirmText: e.string,
41
+ onCloseText: e.string,
42
+ disableAutoFocus: e.bool,
43
+ disableEnforceFocus: e.bool,
44
+ disableRestoreFocus: e.bool
45
+ };
46
+ //#endregion
47
+ export { f as default };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/checkbox.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 Checkbox: {
12
+ ({ mini, checked, onChange, value, label, error }: {
13
+ mini: any;
14
+ checked: any;
15
+ onChange: any;
16
+ value: any;
17
+ label: any;
18
+ error: any;
19
+ }): React.JSX.Element;
20
+ propTypes: {
21
+ mini: PropTypes.Requireable<boolean>;
22
+ checked: PropTypes.Validator<boolean>;
23
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
24
+ value: PropTypes.Requireable<string>;
25
+ label: PropTypes.Validator<string>;
26
+ error: PropTypes.Requireable<boolean>;
27
+ };
28
+ defaultProps: {
29
+ value: string;
30
+ mini: boolean;
31
+ error: boolean;
32
+ };
33
+ };
34
+ export default Checkbox;
@@ -0,0 +1,57 @@
1
+ import "react";
2
+ import e from "prop-types";
3
+ import { styled as t } from "@mui/material/styles";
4
+ import { jsx as n } from "react/jsx-runtime";
5
+ import { color as r } from "@pie-lib/render-ui";
6
+ import i from "@mui/material/FormControlLabel";
7
+ import a from "@mui/material/Checkbox";
8
+ import { grey as o } from "@mui/material/colors";
9
+ //#region src/checkbox.tsx
10
+ var s = t(i)(({ theme: e, mini: t }) => ({
11
+ margin: 0,
12
+ marginLeft: 0,
13
+ padding: 0,
14
+ "& .MuiFormControlLabel-label": {
15
+ fontSize: e.typography.fontSize - 1,
16
+ transform: "translate(-4%, 2%)",
17
+ color: "rgba(0,0,0,1.0)",
18
+ ...t && {
19
+ marginLeft: e.spacing(1),
20
+ color: o[700],
21
+ fontSize: e.typography.fontSize - 3
22
+ }
23
+ }
24
+ })), c = t(a)(({ theme: e, mini: t, error: n }) => ({
25
+ color: `${r.tertiary()} !important`,
26
+ ...t && {
27
+ margin: 0,
28
+ padding: 0,
29
+ width: e.spacing(3),
30
+ height: e.spacing(3)
31
+ },
32
+ ...n && { color: `${e.palette.error.main} !important` }
33
+ })), l = ({ mini: e, checked: t, onChange: r, value: i, label: a, error: o }) => /* @__PURE__ */ n(s, {
34
+ mini: e,
35
+ control: /* @__PURE__ */ n(c, {
36
+ checked: t,
37
+ onChange: r,
38
+ value: i,
39
+ mini: e,
40
+ error: o
41
+ }),
42
+ label: a
43
+ });
44
+ l.propTypes = {
45
+ mini: e.bool,
46
+ checked: e.bool.isRequired,
47
+ onChange: e.func.isRequired,
48
+ value: e.string,
49
+ label: e.string.isRequired,
50
+ error: e.bool
51
+ }, l.defaultProps = {
52
+ value: "",
53
+ mini: !1,
54
+ error: !1
55
+ };
56
+ //#endregion
57
+ export { l as default };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/choice-configuration/feedback-menu.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 class IconMenu extends React.Component {
12
+ static propTypes: {
13
+ opts: PropTypes.Requireable<object>;
14
+ onClick: PropTypes.Validator<(...args: any[]) => any>;
15
+ iconButtonElement: PropTypes.Requireable<any>;
16
+ };
17
+ constructor(props: any);
18
+ handleClick: any;
19
+ handleRequestClose: any;
20
+ render(): React.JSX.Element;
21
+ }
22
+ export default class FeedbackMenu extends React.Component {
23
+ static propTypes: {
24
+ value: PropTypes.Requireable<object>;
25
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
26
+ classes: PropTypes.Validator<object>;
27
+ };
28
+ static defaultProps: {
29
+ classes: {};
30
+ };
31
+ render(): React.JSX.Element;
32
+ }
@@ -0,0 +1,85 @@
1
+ import e from "react";
2
+ import t from "prop-types";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import * as i from "@pie-lib/render-ui";
5
+ import { InlineMenu as a } from "@pie-lib/render-ui";
6
+ import o from "@mui/material/MenuItem";
7
+ import s from "@mui/material/IconButton";
8
+ import c from "@mui/icons-material/Feedback";
9
+ //#region src/choice-configuration/feedback-menu.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(a, "InlineMenu") || u(m.InlineMenu, "InlineMenu"), f = i, p = f.default, m = p && typeof p == "object" ? p : f, h = class extends e.Component {
17
+ static propTypes = {
18
+ opts: t.object,
19
+ onClick: t.func.isRequired,
20
+ iconButtonElement: t.any
21
+ };
22
+ constructor(e) {
23
+ super(e), this.state = {
24
+ anchorEl: void 0,
25
+ open: !1
26
+ };
27
+ }
28
+ handleClick = (e) => {
29
+ this.setState({
30
+ open: !0,
31
+ anchorEl: e.currentTarget
32
+ });
33
+ };
34
+ handleRequestClose = () => {
35
+ this.setState({ open: !1 });
36
+ };
37
+ render() {
38
+ let { opts: e, onClick: t } = this.props, i = Object.keys(e), a = (e) => () => {
39
+ t(e), this.handleRequestClose();
40
+ };
41
+ return /* @__PURE__ */ r("div", { children: [/* @__PURE__ */ n("div", {
42
+ onClick: this.handleClick,
43
+ children: this.props.iconButtonElement
44
+ }), /* @__PURE__ */ n(d, {
45
+ id: "simple-menu",
46
+ anchorEl: this.state.anchorEl,
47
+ open: this.state.open,
48
+ onClose: this.handleRequestClose,
49
+ transitionDuration: {
50
+ enter: 225,
51
+ exit: 195
52
+ },
53
+ children: i.map((t, r) => /* @__PURE__ */ n(o, {
54
+ onClick: a(t),
55
+ children: e[t]
56
+ }, r))
57
+ })] });
58
+ }
59
+ }, g = class extends e.Component {
60
+ static propTypes = {
61
+ value: t.object,
62
+ onChange: t.func.isRequired,
63
+ classes: t.object.isRequired
64
+ };
65
+ static defaultProps = { classes: {} };
66
+ render() {
67
+ let { value: e, onChange: t, classes: r } = this.props, i = e && e.type, a = i === "custom" || i === "default" ? "primary" : "disabled", o = i === "custom" ? "Custom Feedback" : i === "default" ? "Default Feedback" : "Feedback disabled";
68
+ return /* @__PURE__ */ n(h, {
69
+ iconButtonElement: /* @__PURE__ */ n(s, {
70
+ className: r.icon,
71
+ "aria-label": o,
72
+ size: "large",
73
+ children: /* @__PURE__ */ n(c, { color: a })
74
+ }),
75
+ onClick: (e) => t(e),
76
+ opts: {
77
+ none: "No Feedback",
78
+ default: "Default",
79
+ custom: "Custom"
80
+ }
81
+ });
82
+ }
83
+ };
84
+ //#endregion
85
+ export { h as IconMenu, g as default };
@@ -0,0 +1,62 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/choice-configuration/index.jsx
3
+ * @auto-generated
4
+ *
5
+ * This file is automatically synced from pie-elements and converted to TypeScript.
6
+ * Manual edits will be overwritten on next sync.
7
+ * To make changes, edit the upstream JavaScript file and run sync again.
8
+ */
9
+ import React from 'react';
10
+ import PropTypes from 'prop-types';
11
+ export declare class ChoiceConfiguration extends React.Component {
12
+ static propTypes: {
13
+ noLabels: PropTypes.Requireable<boolean>;
14
+ useLetterOrdering: PropTypes.Requireable<boolean>;
15
+ className: PropTypes.Requireable<string>;
16
+ error: PropTypes.Requireable<string>;
17
+ mode: PropTypes.Requireable<string>;
18
+ defaultFeedback: PropTypes.Validator<object>;
19
+ disabled: PropTypes.Requireable<boolean>;
20
+ nonEmpty: PropTypes.Requireable<boolean>;
21
+ data: PropTypes.Requireable<PropTypes.InferProps<{
22
+ label: PropTypes.Validator<string>;
23
+ value: PropTypes.Validator<string>;
24
+ correct: PropTypes.Requireable<boolean>;
25
+ feedback: PropTypes.Requireable<PropTypes.InferProps<{
26
+ type: PropTypes.Requireable<string>;
27
+ value: PropTypes.Requireable<string>;
28
+ }>>;
29
+ }>>;
30
+ onDelete: PropTypes.Requireable<(...args: any[]) => any>;
31
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
32
+ index: PropTypes.Requireable<number>;
33
+ imageSupport: PropTypes.Requireable<PropTypes.InferProps<{
34
+ add: PropTypes.Validator<(...args: any[]) => any>;
35
+ delete: PropTypes.Validator<(...args: any[]) => any>;
36
+ }>>;
37
+ disableImageAlignmentButtons: PropTypes.Requireable<boolean>;
38
+ allowFeedBack: PropTypes.Requireable<boolean>;
39
+ allowDelete: PropTypes.Requireable<boolean>;
40
+ noCorrectAnswerError: PropTypes.Requireable<string>;
41
+ spellCheck: PropTypes.Requireable<boolean>;
42
+ pluginOpts: PropTypes.Requireable<object>;
43
+ toolbarOpts: PropTypes.Requireable<object>;
44
+ uploadSoundSupport: PropTypes.Requireable<object>;
45
+ maxImageWidth: PropTypes.Requireable<number>;
46
+ maxImageHeight: PropTypes.Requireable<number>;
47
+ };
48
+ static defaultProps: {
49
+ index: number;
50
+ noLabels: boolean;
51
+ useLetterOrdering: boolean;
52
+ allowFeedBack: boolean;
53
+ allowDelete: boolean;
54
+ };
55
+ _changeFn: (key: any) => (update: any) => void;
56
+ onLabelChange: (update: any) => void;
57
+ onCheckedChange: any;
58
+ onFeedbackValueChange: any;
59
+ onFeedbackTypeChange: any;
60
+ render(): React.JSX.Element;
61
+ }
62
+ export default ChoiceConfiguration;
@@ -0,0 +1,240 @@
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, color as d } from "@pie-lib/render-ui";
10
+ import f from "@mui/material/IconButton";
11
+ import p from "@mui/material/TextField";
12
+ import m from "@mui/icons-material/Delete";
13
+ import h from "@mui/icons-material/SubdirectoryArrowRight";
14
+ //#region src/choice-configuration/index.tsx
15
+ function g(e) {
16
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
17
+ }
18
+ function _(e, t) {
19
+ return !e || g(e) ? e : g(e.default) ? e.default : t && g(e[t]) ? e[t] : t && g(e[t]?.default) ? e[t].default : e;
20
+ }
21
+ var v = _(u, "InputContainer") || _(x.InputContainer, "InputContainer"), y = l, b = y.default, x = b && typeof b == "object" ? b : y, S = a("div")(({ theme: e }) => ({ marginTop: e.spacing(2) })), C = ({ 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: _ = {} }) => /* @__PURE__ */ o(v, {
22
+ label: e,
23
+ className: r,
24
+ children: /* @__PURE__ */ o(S, { 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: _
40
+ }) })
41
+ }), w = a("div")(() => ({ position: "relative" })), T = a(h)(() => ({
42
+ fill: d.border(),
43
+ left: -56,
44
+ position: "absolute",
45
+ top: 40
46
+ })), E = a(p)(({ theme: e }) => ({
47
+ width: "100%",
48
+ marginTop: e.spacing(2)
49
+ })), D = a(C)(({ theme: e }) => ({
50
+ width: "100%",
51
+ marginTop: e.spacing(2)
52
+ })), O = ({ value: e, onChange: t, type: n, correct: r, defaults: i, toolbarOpts: a, mathMlOptions: c = {} }) => !n || n === "none" ? null : n === "default" ? /* @__PURE__ */ s(w, { children: [/* @__PURE__ */ o(T, {}), /* @__PURE__ */ o(E, {
53
+ label: "Feedback Text",
54
+ value: r ? i.correct : i.incorrect,
55
+ variant: "standard"
56
+ })] }) : /* @__PURE__ */ s(w, { children: [/* @__PURE__ */ o(T, {}), /* @__PURE__ */ o(D, {
57
+ label: "Feedback Text",
58
+ value: e,
59
+ onChange: t,
60
+ toolbarOpts: a,
61
+ mathMlOptions: c
62
+ })] }), k = a("span")(({ theme: e }) => ({
63
+ paddingRight: e.spacing(1),
64
+ paddingTop: e.spacing(3)
65
+ })), A = a("div")(() => ({
66
+ display: "flex",
67
+ alignItems: "center"
68
+ })), j = 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
+ })), M = 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
+ })), N = a("div")(() => ({
81
+ margin: 0,
82
+ width: "inherit"
83
+ })), P = a("div")(() => ({
84
+ margin: 0,
85
+ width: "inherit"
86
+ })), F = a("div")(({ theme: e }) => ({
87
+ flex: "0 1 auto",
88
+ paddingTop: e.spacing(2),
89
+ paddingLeft: 0,
90
+ marginLeft: 0
91
+ })), I = a("div")(({ theme: e }) => ({
92
+ display: "flex",
93
+ flex: 1,
94
+ flexDirection: "column",
95
+ marginRight: e.spacing(1)
96
+ })), L = a("div")(({ theme: e }) => ({
97
+ fontSize: e.typography.fontSize - 2,
98
+ color: e.palette.error.main
99
+ })), R = 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: d, useLetterOrdering: p, imageSupport: h, disableImageAlignmentButtons: g, disabled: _, spellCheck: y, nonEmpty: b, allowFeedBack: x, allowDelete: S, pluginOpts: w, toolbarOpts: T, error: E, noCorrectAnswerError: D, uploadSoundSupport: R, maxImageWidth: z, maxImageHeight: B, mathMlOptions: V = {} } = this.props, H = i === "checkbox" ? e : t;
182
+ return /* @__PURE__ */ s(A, { children: [
183
+ l > 0 && /* @__PURE__ */ o(k, {
184
+ type: "title",
185
+ children: p ? String.fromCharCode(96 + l).toUpperCase() : l
186
+ }),
187
+ /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(H, {
188
+ onChange: this.onCheckedChange,
189
+ label: d ? "" : "Correct",
190
+ checked: !!r.correct,
191
+ error: D
192
+ }) }),
193
+ /* @__PURE__ */ s(I, { children: [
194
+ /* @__PURE__ */ o(C, {
195
+ label: d ? "" : "Label",
196
+ value: r.label,
197
+ onChange: this.onLabelChange,
198
+ imageSupport: h,
199
+ disableImageAlignmentButtons: g,
200
+ disabled: _,
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(L, { children: E }),
212
+ x && /* @__PURE__ */ o(O, {
213
+ ...r.feedback,
214
+ correct: r.correct,
215
+ defaults: c,
216
+ onChange: this.onFeedbackValueChange,
217
+ toolbarOpts: T
218
+ })
219
+ ] }),
220
+ x && /* @__PURE__ */ o(M, { children: /* @__PURE__ */ o(v, {
221
+ label: d ? "" : "Feedback",
222
+ children: /* @__PURE__ */ o(N, { children: /* @__PURE__ */ o(n, {
223
+ onChange: this.onFeedbackTypeChange,
224
+ value: r.feedback
225
+ }) })
226
+ }) }),
227
+ S && /* @__PURE__ */ o(F, { children: /* @__PURE__ */ o(v, {
228
+ label: d ? "" : "Delete",
229
+ children: /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(f, {
230
+ "aria-label": "delete",
231
+ onClick: a,
232
+ size: "large",
233
+ children: /* @__PURE__ */ o(m, {})
234
+ }) })
235
+ }) })
236
+ ] });
237
+ }
238
+ };
239
+ //#endregion
240
+ export { R as ChoiceConfiguration, R as default };
@@ -0,0 +1,21 @@
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;
@@ -0,0 +1,15 @@
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, i as firstAvailableIndex, r as normalizeChoices };
@@ -0,0 +1,33 @@
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;