@pie-lib/config-ui 13.0.4-next.29 → 13.0.4-next.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/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 +61 -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 +31 -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 +33 -19
  73. package/CHANGELOG.json +0 -32
  74. package/CHANGELOG.md +0 -2419
  75. package/LICENSE.md +0 -5
  76. package/lib/alert-dialog.js +0 -68
  77. package/lib/alert-dialog.js.map +0 -1
  78. package/lib/checkbox.js +0 -84
  79. package/lib/checkbox.js.map +0 -1
  80. package/lib/choice-configuration/feedback-menu.js +0 -129
  81. package/lib/choice-configuration/feedback-menu.js.map +0 -1
  82. package/lib/choice-configuration/index.js +0 -381
  83. package/lib/choice-configuration/index.js.map +0 -1
  84. package/lib/choice-utils.js +0 -42
  85. package/lib/choice-utils.js.map +0 -1
  86. package/lib/feedback-config/feedback-selector.js +0 -155
  87. package/lib/feedback-config/feedback-selector.js.map +0 -1
  88. package/lib/feedback-config/group.js +0 -61
  89. package/lib/feedback-config/group.js.map +0 -1
  90. package/lib/feedback-config/index.js +0 -146
  91. package/lib/feedback-config/index.js.map +0 -1
  92. package/lib/form-section.js +0 -44
  93. package/lib/form-section.js.map +0 -1
  94. package/lib/help.js +0 -106
  95. package/lib/help.js.map +0 -1
  96. package/lib/index.js +0 -186
  97. package/lib/index.js.map +0 -1
  98. package/lib/input.js +0 -106
  99. package/lib/input.js.map +0 -1
  100. package/lib/inputs.js +0 -105
  101. package/lib/inputs.js.map +0 -1
  102. package/lib/langs.js +0 -136
  103. package/lib/langs.js.map +0 -1
  104. package/lib/layout/config-layout.js +0 -137
  105. package/lib/layout/config-layout.js.map +0 -1
  106. package/lib/layout/index.js +0 -21
  107. package/lib/layout/index.js.map +0 -1
  108. package/lib/layout/layout-contents.js +0 -160
  109. package/lib/layout/layout-contents.js.map +0 -1
  110. package/lib/layout/settings-box.js +0 -57
  111. package/lib/layout/settings-box.js.map +0 -1
  112. package/lib/mui-box/index.js +0 -63
  113. package/lib/mui-box/index.js.map +0 -1
  114. package/lib/number-text-field-custom.js +0 -376
  115. package/lib/number-text-field-custom.js.map +0 -1
  116. package/lib/number-text-field.js +0 -229
  117. package/lib/number-text-field.js.map +0 -1
  118. package/lib/radio-with-label.js +0 -48
  119. package/lib/radio-with-label.js.map +0 -1
  120. package/lib/settings/display-size.js +0 -61
  121. package/lib/settings/display-size.js.map +0 -1
  122. package/lib/settings/index.js +0 -110
  123. package/lib/settings/index.js.map +0 -1
  124. package/lib/settings/panel.js +0 -392
  125. package/lib/settings/panel.js.map +0 -1
  126. package/lib/settings/settings-radio-label.js +0 -51
  127. package/lib/settings/settings-radio-label.js.map +0 -1
  128. package/lib/settings/toggle.js +0 -63
  129. package/lib/settings/toggle.js.map +0 -1
  130. package/lib/tabs/index.js +0 -75
  131. package/lib/tabs/index.js.map +0 -1
  132. package/lib/tags-input/index.js +0 -149
  133. package/lib/tags-input/index.js.map +0 -1
  134. package/lib/two-choice.js +0 -136
  135. package/lib/two-choice.js.map +0 -1
  136. package/lib/with-stateful-model.js +0 -61
  137. package/lib/with-stateful-model.js.map +0 -1
  138. package/src/__tests__/alert-dialog.test.jsx +0 -183
  139. package/src/__tests__/checkbox.test.jsx +0 -152
  140. package/src/__tests__/choice-utils.test.js +0 -12
  141. package/src/__tests__/form-section.test.jsx +0 -328
  142. package/src/__tests__/help.test.jsx +0 -184
  143. package/src/__tests__/input.test.jsx +0 -156
  144. package/src/__tests__/langs.test.jsx +0 -376
  145. package/src/__tests__/number-text-field-custom.test.jsx +0 -255
  146. package/src/__tests__/number-text-field.test.jsx +0 -263
  147. package/src/__tests__/radio-with-label.test.jsx +0 -155
  148. package/src/__tests__/settings-panel.test.js +0 -187
  149. package/src/__tests__/settings.test.jsx +0 -452
  150. package/src/__tests__/tabs.test.jsx +0 -188
  151. package/src/__tests__/two-choice.test.js +0 -110
  152. package/src/__tests__/with-stateful-model.test.jsx +0 -139
  153. package/src/alert-dialog.jsx +0 -75
  154. package/src/checkbox.jsx +0 -61
  155. package/src/choice-configuration/__tests__/feedback-menu.test.jsx +0 -151
  156. package/src/choice-configuration/__tests__/index.test.jsx +0 -234
  157. package/src/choice-configuration/feedback-menu.jsx +0 -96
  158. package/src/choice-configuration/index.jsx +0 -357
  159. package/src/choice-utils.js +0 -30
  160. package/src/feedback-config/__tests__/feedback-config.test.jsx +0 -141
  161. package/src/feedback-config/__tests__/feedback-selector.test.jsx +0 -97
  162. package/src/feedback-config/feedback-selector.jsx +0 -112
  163. package/src/feedback-config/group.jsx +0 -51
  164. package/src/feedback-config/index.jsx +0 -111
  165. package/src/form-section.jsx +0 -31
  166. package/src/help.jsx +0 -79
  167. package/src/index.js +0 -55
  168. package/src/input.jsx +0 -72
  169. package/src/inputs.jsx +0 -69
  170. package/src/langs.jsx +0 -111
  171. package/src/layout/__tests__/config.layout.test.jsx +0 -59
  172. package/src/layout/__tests__/layout-content.test.jsx +0 -3
  173. package/src/layout/config-layout.jsx +0 -103
  174. package/src/layout/index.js +0 -4
  175. package/src/layout/layout-contents.jsx +0 -117
  176. package/src/layout/settings-box.jsx +0 -32
  177. package/src/mui-box/index.jsx +0 -56
  178. package/src/number-text-field-custom.jsx +0 -333
  179. package/src/number-text-field.jsx +0 -215
  180. package/src/radio-with-label.jsx +0 -30
  181. package/src/settings/display-size.jsx +0 -53
  182. package/src/settings/index.js +0 -83
  183. package/src/settings/panel.jsx +0 -333
  184. package/src/settings/settings-radio-label.jsx +0 -32
  185. package/src/settings/toggle.jsx +0 -46
  186. package/src/tabs/index.jsx +0 -47
  187. package/src/tags-input/__tests__/index.test.jsx +0 -113
  188. package/src/tags-input/index.jsx +0 -116
  189. package/src/two-choice.jsx +0 -90
  190. 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 } from "@pie-lib/render-ui";
9
+ //#region src/feedback-config/feedback-selector.tsx
10
+ function l(e) {
11
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
12
+ }
13
+ function u(e, t) {
14
+ return !e || l(e) ? e : l(e.default) ? e.default : t && l(e[t]) ? e[t] : t && l(e[t]?.default) ? e[t].default : e;
15
+ }
16
+ var d = u(c, "InputContainer") || u(m.InputContainer, "InputContainer"), f = s, p = f.default, m = p && typeof p == "object" ? p : f, h = r(o)(({ theme: e }) => ({ fontFamily: e.typography.fontFamily })), g = {
17
+ default: "Simple Feedback",
18
+ none: "No Feedback",
19
+ custom: "Customized Feedback"
20
+ }, _ = r("div")(({ theme: e }) => ({ marginBottom: e.spacing(1) })), v = r(d)(() => ({ paddingBottom: 0 })), y = r("div")(({ theme: e }) => ({
21
+ marginTop: "0px",
22
+ background: e.palette.grey[300],
23
+ padding: 0,
24
+ marginBottom: e.spacing(2),
25
+ borderRadius: "4px"
26
+ })), b = r("div")(({ theme: e }) => ({
27
+ marginTop: "0px",
28
+ background: e.palette.grey[300],
29
+ padding: e.spacing(2),
30
+ marginBottom: e.spacing(2),
31
+ borderRadius: "4px",
32
+ fontFamily: e.typography.fontFamily,
33
+ cursor: "default"
34
+ })), x = r(e)(({ theme: e }) => ({ paddingTop: e.spacing(1) })), S = {
35
+ type: n.oneOf([
36
+ "default",
37
+ "custom",
38
+ "none"
39
+ ]),
40
+ default: n.string,
41
+ custom: n.string
42
+ }, C = class extends t.Component {
43
+ static propTypes = {
44
+ keys: n.arrayOf(n.string),
45
+ label: n.string.isRequired,
46
+ feedback: n.shape(S).isRequired,
47
+ onChange: n.func.isRequired,
48
+ toolbarOpts: n.object,
49
+ mathMlOptions: n.object
50
+ };
51
+ changeType = (e) => {
52
+ let { onChange: t, feedback: n } = this.props;
53
+ t({
54
+ ...n,
55
+ type: e
56
+ });
57
+ };
58
+ changeCustom = (e) => {
59
+ let { onChange: t, feedback: n } = this.props;
60
+ t({
61
+ ...n,
62
+ type: "custom",
63
+ custom: e
64
+ });
65
+ };
66
+ render() {
67
+ let { keys: e, label: t, feedback: n, toolbarOpts: r, mathMlOptions: o = {} } = this.props;
68
+ return /* @__PURE__ */ a(_, { children: [
69
+ /* @__PURE__ */ i(v, {
70
+ label: t,
71
+ extraClasses: { label: { transform: "translateY(-20%)" } },
72
+ children: /* @__PURE__ */ i(x, {
73
+ keys: e || Object.keys(g),
74
+ label: t,
75
+ value: n.type,
76
+ onChange: this.changeType,
77
+ feedbackLabels: g
78
+ })
79
+ }),
80
+ n.type === "custom" && /* @__PURE__ */ i(y, { children: /* @__PURE__ */ i(h, {
81
+ onChange: this.changeCustom,
82
+ markup: n.custom || "",
83
+ toolbarOpts: r,
84
+ languageCharactersProps: [{ language: "spanish" }, { language: "special" }],
85
+ mathMlOptions: o
86
+ }) }),
87
+ n.type === "default" && /* @__PURE__ */ a(b, { children: [" ", n.default] })
88
+ ] });
89
+ }
90
+ };
91
+ //#endregion
92
+ export { S as FeedbackType, C as default };
@@ -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 e, { FeedbackType as t } from "./feedback-selector.js";
2
+ import n from "react";
3
+ import r from "prop-types";
4
+ import { styled as i } from "@mui/material/styles";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import { merge as s } from "@pie-element/shared-lodash";
7
+ import c from "@mui/material/Accordion";
8
+ import l from "@mui/material/AccordionSummary";
9
+ import u from "@mui/material/AccordionDetails";
10
+ import d from "@mui/material/Typography";
11
+ import f from "@mui/icons-material/ExpandMore";
12
+ //#region src/feedback-config/index.tsx
13
+ var p = i("div")(() => ({
14
+ display: "flex",
15
+ flex: 1,
16
+ flexDirection: "column"
17
+ })), m = i(u)(() => ({
18
+ paddingTop: 0,
19
+ paddingBottom: 0
20
+ })), h = (e) => s({}, {
21
+ correct: {
22
+ type: "default",
23
+ default: "Correct"
24
+ },
25
+ incorrect: {
26
+ type: "default",
27
+ default: "Incorrect"
28
+ },
29
+ partial: {
30
+ type: "default",
31
+ default: "Nearly"
32
+ }
33
+ }, e), g = class extends n.Component {
34
+ static propTypes = {
35
+ allowPartial: r.bool,
36
+ className: r.string,
37
+ feedback: r.shape({
38
+ correct: r.shape(t),
39
+ incorrect: r.shape(t),
40
+ partial: r.shape(t)
41
+ }),
42
+ onChange: r.func.isRequired,
43
+ toolbarOpts: r.object
44
+ };
45
+ static defaultProps = {
46
+ allowPartial: !0,
47
+ feedback: h()
48
+ };
49
+ onChange(e, t) {
50
+ let { feedback: n, onChange: r } = this.props;
51
+ r({
52
+ ...n,
53
+ [e]: t
54
+ });
55
+ }
56
+ onCorrectChange = this.onChange.bind(this, "correct");
57
+ onIncorrectChange = this.onChange.bind(this, "incorrect");
58
+ onPartialChange = this.onChange.bind(this, "partial");
59
+ render() {
60
+ let { className: t, allowPartial: n, feedback: r, toolbarOpts: i } = this.props;
61
+ return /* @__PURE__ */ a("div", {
62
+ className: t,
63
+ children: /* @__PURE__ */ o(c, {
64
+ slotProps: { transition: { timeout: {
65
+ enter: 225,
66
+ exit: 195
67
+ } } },
68
+ children: [/* @__PURE__ */ a(l, {
69
+ expandIcon: /* @__PURE__ */ a(f, {}),
70
+ children: /* @__PURE__ */ a(d, { children: "Feedback" })
71
+ }), /* @__PURE__ */ a(m, { children: /* @__PURE__ */ o(p, { children: [
72
+ /* @__PURE__ */ a(e, {
73
+ label: "If correct, show",
74
+ feedback: r.correct,
75
+ onChange: this.onCorrectChange,
76
+ toolbarOpts: i
77
+ }),
78
+ n && /* @__PURE__ */ a(e, {
79
+ label: "If partially correct, show",
80
+ feedback: r.partial,
81
+ onChange: this.onPartialChange,
82
+ toolbarOpts: i
83
+ }),
84
+ /* @__PURE__ */ a(e, {
85
+ label: "If incorrect, show",
86
+ feedback: r.incorrect,
87
+ onChange: this.onIncorrectChange,
88
+ toolbarOpts: i
89
+ })
90
+ ] }) })]
91
+ })
92
+ });
93
+ }
94
+ };
95
+ //#endregion
96
+ export { h as buildDefaults, g as default };
@@ -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,61 @@
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 a from "@mui/material/Dialog";
6
+ import o from "@mui/material/DialogTitle";
7
+ import s from "@mui/material/DialogContentText";
8
+ import c from "@mui/material/DialogContent";
9
+ import l from "@mui/material/DialogActions";
10
+ import u from "@mui/material/Button";
11
+ import d from "@mui/icons-material/Help";
12
+ import f from "@mui/material/IconButton";
13
+ //#region src/help.tsx
14
+ var p = n(f)(({ theme: e }) => ({ "&:hover": { color: e.palette.grey[300] } })), m = ({ onClick: e }) => /* @__PURE__ */ r(p, {
15
+ onClick: e,
16
+ size: "large",
17
+ children: /* @__PURE__ */ r(d, {})
18
+ });
19
+ m.propTypes = { onClick: t.func };
20
+ var h = ({ open: e, onClose: t, children: n, title: d }) => /* @__PURE__ */ i(a, {
21
+ open: e,
22
+ onClose: t,
23
+ children: [
24
+ /* @__PURE__ */ r(o, { children: d }),
25
+ /* @__PURE__ */ r(c, { children: /* @__PURE__ */ r(s, { children: n }) }),
26
+ /* @__PURE__ */ r(l, { children: /* @__PURE__ */ r(u, {
27
+ onClick: t,
28
+ color: "primary",
29
+ children: "OK"
30
+ }) })
31
+ ]
32
+ });
33
+ h.propTypes = {
34
+ open: t.bool,
35
+ onClose: t.func,
36
+ children: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired,
37
+ title: t.string.isRequired
38
+ };
39
+ var g = class extends e.Component {
40
+ static propTypes = {
41
+ children: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired,
42
+ title: t.string
43
+ };
44
+ constructor(e) {
45
+ super(e), this.state = { open: !1 };
46
+ }
47
+ render() {
48
+ let { children: e, title: t } = this.props;
49
+ return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(m, {
50
+ color: "accent",
51
+ onClick: () => this.setState({ open: !0 })
52
+ }), /* @__PURE__ */ r(h, {
53
+ open: this.state.open,
54
+ title: t,
55
+ onClose: () => this.setState({ open: !1 }),
56
+ children: e
57
+ })] });
58
+ }
59
+ };
60
+ //#endregion
61
+ export { g 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 t from "./feedback-config/feedback-selector.js";
3
+ import 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 s, { LanguageControls as c } from "./langs.js";
6
+ import 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 m from "./number-text-field.js";
12
+ import 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 y from "./tags-input/index.js";
16
+ import 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 };