@pie-lib/config-ui 13.0.3-next.3 → 13.0.4-next.0

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 (188) 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/help.d.ts +41 -0
  21. package/dist/help.js +61 -0
  22. package/dist/index.d.ts +31 -0
  23. package/dist/index.js +34 -0
  24. package/dist/input.d.ts +29 -0
  25. package/dist/input.js +65 -0
  26. package/dist/inputs.d.ts +63 -0
  27. package/dist/inputs.js +70 -0
  28. package/dist/langs.d.ts +41 -0
  29. package/dist/langs.js +76 -0
  30. package/dist/layout/config-layout.d.ts +10 -0
  31. package/dist/layout/config-layout.js +75 -0
  32. package/dist/layout/index.d.ts +11 -0
  33. package/dist/layout/index.js +10 -0
  34. package/dist/layout/layout-contents.d.ts +21 -0
  35. package/dist/layout/layout-contents.js +70 -0
  36. package/dist/layout/settings-box.d.ts +19 -0
  37. package/dist/layout/settings-box.js +31 -0
  38. package/dist/mui-box/index.d.ts +21 -0
  39. package/dist/mui-box/index.js +47 -0
  40. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  41. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  42. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  43. package/dist/node_modules/.bun/@babel_runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  44. package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +122 -0
  45. package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +276 -0
  46. package/dist/number-text-field-custom.d.ts +51 -0
  47. package/dist/number-text-field-custom.js +192 -0
  48. package/dist/number-text-field.d.ts +47 -0
  49. package/dist/number-text-field.js +122 -0
  50. package/dist/radio-with-label.d.ts +25 -0
  51. package/dist/radio-with-label.js +27 -0
  52. package/dist/settings/display-size.d.ts +26 -0
  53. package/dist/settings/display-size.js +45 -0
  54. package/dist/settings/index.d.ts +45 -0
  55. package/dist/settings/index.js +63 -0
  56. package/dist/settings/panel.d.ts +27 -0
  57. package/dist/settings/panel.js +201 -0
  58. package/dist/settings/settings-radio-label.d.ts +25 -0
  59. package/dist/settings/settings-radio-label.js +29 -0
  60. package/dist/settings/toggle.d.ts +25 -0
  61. package/dist/settings/toggle.js +33 -0
  62. package/dist/tabs/index.d.ts +22 -0
  63. package/dist/tabs/index.js +39 -0
  64. package/dist/tags-input/index.d.ts +21 -0
  65. package/dist/tags-input/index.js +83 -0
  66. package/dist/two-choice.d.ts +43 -0
  67. package/dist/two-choice.js +79 -0
  68. package/dist/with-stateful-model.d.ts +42 -0
  69. package/dist/with-stateful-model.js +32 -0
  70. package/package.json +30 -18
  71. package/CHANGELOG.json +0 -32
  72. package/CHANGELOG.md +0 -2415
  73. package/LICENSE.md +0 -5
  74. package/lib/alert-dialog.js +0 -68
  75. package/lib/alert-dialog.js.map +0 -1
  76. package/lib/checkbox.js +0 -84
  77. package/lib/checkbox.js.map +0 -1
  78. package/lib/choice-configuration/feedback-menu.js +0 -129
  79. package/lib/choice-configuration/feedback-menu.js.map +0 -1
  80. package/lib/choice-configuration/index.js +0 -381
  81. package/lib/choice-configuration/index.js.map +0 -1
  82. package/lib/choice-utils.js +0 -42
  83. package/lib/choice-utils.js.map +0 -1
  84. package/lib/feedback-config/feedback-selector.js +0 -155
  85. package/lib/feedback-config/feedback-selector.js.map +0 -1
  86. package/lib/feedback-config/group.js +0 -61
  87. package/lib/feedback-config/group.js.map +0 -1
  88. package/lib/feedback-config/index.js +0 -146
  89. package/lib/feedback-config/index.js.map +0 -1
  90. package/lib/form-section.js +0 -44
  91. package/lib/form-section.js.map +0 -1
  92. package/lib/help.js +0 -106
  93. package/lib/help.js.map +0 -1
  94. package/lib/index.js +0 -186
  95. package/lib/index.js.map +0 -1
  96. package/lib/input.js +0 -106
  97. package/lib/input.js.map +0 -1
  98. package/lib/inputs.js +0 -105
  99. package/lib/inputs.js.map +0 -1
  100. package/lib/langs.js +0 -136
  101. package/lib/langs.js.map +0 -1
  102. package/lib/layout/config-layout.js +0 -137
  103. package/lib/layout/config-layout.js.map +0 -1
  104. package/lib/layout/index.js +0 -21
  105. package/lib/layout/index.js.map +0 -1
  106. package/lib/layout/layout-contents.js +0 -160
  107. package/lib/layout/layout-contents.js.map +0 -1
  108. package/lib/layout/settings-box.js +0 -57
  109. package/lib/layout/settings-box.js.map +0 -1
  110. package/lib/mui-box/index.js +0 -63
  111. package/lib/mui-box/index.js.map +0 -1
  112. package/lib/number-text-field-custom.js +0 -376
  113. package/lib/number-text-field-custom.js.map +0 -1
  114. package/lib/number-text-field.js +0 -229
  115. package/lib/number-text-field.js.map +0 -1
  116. package/lib/radio-with-label.js +0 -48
  117. package/lib/radio-with-label.js.map +0 -1
  118. package/lib/settings/display-size.js +0 -61
  119. package/lib/settings/display-size.js.map +0 -1
  120. package/lib/settings/index.js +0 -110
  121. package/lib/settings/index.js.map +0 -1
  122. package/lib/settings/panel.js +0 -392
  123. package/lib/settings/panel.js.map +0 -1
  124. package/lib/settings/settings-radio-label.js +0 -51
  125. package/lib/settings/settings-radio-label.js.map +0 -1
  126. package/lib/settings/toggle.js +0 -63
  127. package/lib/settings/toggle.js.map +0 -1
  128. package/lib/tabs/index.js +0 -75
  129. package/lib/tabs/index.js.map +0 -1
  130. package/lib/tags-input/index.js +0 -149
  131. package/lib/tags-input/index.js.map +0 -1
  132. package/lib/two-choice.js +0 -136
  133. package/lib/two-choice.js.map +0 -1
  134. package/lib/with-stateful-model.js +0 -61
  135. package/lib/with-stateful-model.js.map +0 -1
  136. package/src/__tests__/alert-dialog.test.jsx +0 -183
  137. package/src/__tests__/checkbox.test.jsx +0 -152
  138. package/src/__tests__/choice-utils.test.js +0 -12
  139. package/src/__tests__/form-section.test.jsx +0 -328
  140. package/src/__tests__/help.test.jsx +0 -184
  141. package/src/__tests__/input.test.jsx +0 -156
  142. package/src/__tests__/langs.test.jsx +0 -376
  143. package/src/__tests__/number-text-field-custom.test.jsx +0 -255
  144. package/src/__tests__/number-text-field.test.jsx +0 -263
  145. package/src/__tests__/radio-with-label.test.jsx +0 -155
  146. package/src/__tests__/settings-panel.test.js +0 -187
  147. package/src/__tests__/settings.test.jsx +0 -452
  148. package/src/__tests__/tabs.test.jsx +0 -188
  149. package/src/__tests__/two-choice.test.js +0 -110
  150. package/src/__tests__/with-stateful-model.test.jsx +0 -139
  151. package/src/alert-dialog.jsx +0 -75
  152. package/src/checkbox.jsx +0 -61
  153. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +0 -151
  154. package/src/choice-configuration/__tests__/index.test.jsx +0 -234
  155. package/src/choice-configuration/feedback-menu.jsx +0 -96
  156. package/src/choice-configuration/index.jsx +0 -357
  157. package/src/choice-utils.js +0 -30
  158. package/src/feedback-config/__tests__/feedback-config.test.jsx +0 -141
  159. package/src/feedback-config/__tests__/feedback-selector.test.jsx +0 -97
  160. package/src/feedback-config/feedback-selector.jsx +0 -112
  161. package/src/feedback-config/group.jsx +0 -51
  162. package/src/feedback-config/index.jsx +0 -111
  163. package/src/form-section.jsx +0 -31
  164. package/src/help.jsx +0 -79
  165. package/src/index.js +0 -55
  166. package/src/input.jsx +0 -72
  167. package/src/inputs.jsx +0 -69
  168. package/src/langs.jsx +0 -111
  169. package/src/layout/__tests__/config.layout.test.jsx +0 -59
  170. package/src/layout/__tests__/layout-content.test.jsx +0 -3
  171. package/src/layout/config-layout.jsx +0 -103
  172. package/src/layout/index.js +0 -4
  173. package/src/layout/layout-contents.jsx +0 -117
  174. package/src/layout/settings-box.jsx +0 -32
  175. package/src/mui-box/index.jsx +0 -56
  176. package/src/number-text-field-custom.jsx +0 -333
  177. package/src/number-text-field.jsx +0 -215
  178. package/src/radio-with-label.jsx +0 -30
  179. package/src/settings/display-size.jsx +0 -53
  180. package/src/settings/index.js +0 -83
  181. package/src/settings/panel.jsx +0 -333
  182. package/src/settings/settings-radio-label.jsx +0 -32
  183. package/src/settings/toggle.jsx +0 -46
  184. package/src/tabs/index.jsx +0 -47
  185. package/src/tags-input/__tests__/index.test.jsx +0 -113
  186. package/src/tags-input/index.jsx +0 -116
  187. package/src/two-choice.jsx +0 -90
  188. 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 { 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 } 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 };
@@ -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 "lodash-es";
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 };
@@ -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;