@pie-lib/config-ui 13.0.4-next.3 → 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,122 @@
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 } from "react/jsx-runtime";
5
+ import { isFinite as i } from "@pie-element/shared-lodash";
6
+ import a from "debug";
7
+ import o from "@mui/material/TextField";
8
+ import s from "@mui/material/InputAdornment";
9
+ //#region src/number-text-field.tsx
10
+ var c = a("@pie-lib:config-ui:number-text-field"), l = n(o)(({ theme: e }) => ({
11
+ marginRight: e.spacing(1),
12
+ "& .MuiInputLabel-root": {
13
+ width: "auto",
14
+ minWidth: "max-content",
15
+ maxWidth: "none",
16
+ whiteSpace: "nowrap",
17
+ overflow: "visible",
18
+ transform: "translate(0, 8px) scale(0.75)",
19
+ transformOrigin: "top left",
20
+ position: "relative"
21
+ },
22
+ "& .MuiInputBase-root, & .MuiInput-root, & .MuiFilledInput-root, & .MuiOutlinedInput-root": {
23
+ height: "auto",
24
+ minHeight: "auto",
25
+ marginTop: 0
26
+ },
27
+ "& .MuiInputBase-input": {
28
+ height: "auto",
29
+ minHeight: "auto",
30
+ padding: "6px 0 7px"
31
+ }
32
+ })), u = (e, t) => {
33
+ if (!i(e) && !i(t)) return 0;
34
+ if (!i(e) && i(t)) return t;
35
+ if (i(e)) return e;
36
+ }, d = class extends e.Component {
37
+ static propTypes = {
38
+ disabled: t.bool,
39
+ className: t.string,
40
+ inputClassName: t.string,
41
+ onChange: t.func.isRequired,
42
+ value: t.number,
43
+ min: t.number,
44
+ max: t.number,
45
+ label: t.string,
46
+ suffix: t.string,
47
+ showErrorWhenOutsideRange: t.bool,
48
+ disableUnderline: t.bool,
49
+ variant: t.string
50
+ };
51
+ static defaultProps = { showErrorWhenOutsideRange: !1 };
52
+ constructor(e) {
53
+ super(e);
54
+ let t = this.clamp(e.value);
55
+ this.state = { value: t }, t !== e.value && this.props.onChange({}, t), this.onChange = this.onChange.bind(this);
56
+ }
57
+ UNSAFE_componentWillReceiveProps(e) {
58
+ let t = this.clamp(e.value, e.min, e.max);
59
+ this.setState({ value: t });
60
+ }
61
+ clamp(e, t = this.props.min, n = this.props.max) {
62
+ return i(e) ? (i(n) && (e = Math.min(e, n)), i(t) && (e = Math.max(e, t)), e) : u(t, n);
63
+ }
64
+ onBlur = (e) => {
65
+ let t = e.target.value, n = parseFloat(t);
66
+ c("rawNumber: ", n);
67
+ let r = this.clamp(n);
68
+ c("number: ", r), r !== this.state.value && (c("trigger update..."), this.setState({ value: r.toString() }, () => {
69
+ this.props.onChange(e, r);
70
+ }));
71
+ };
72
+ onChange(e) {
73
+ let t = e.target.value;
74
+ this.setState({ value: t });
75
+ }
76
+ errorMessage = () => {
77
+ let { min: e, max: t } = this.props;
78
+ if (e && t) return `The value must be between ${e} and ${t}`;
79
+ if (e) return `The value must be greater than ${e}`;
80
+ if (t) return `The value must be less than ${t}`;
81
+ };
82
+ getError = () => {
83
+ let { value: e } = this.state, t = parseFloat(e);
84
+ if (this.clamp(t) !== t) return this.errorMessage();
85
+ };
86
+ render() {
87
+ let { className: e, label: t, disabled: n, suffix: i, min: a, max: o, inputClassName: c, disableUnderline: u, showErrorWhenOutsideRange: d, variant: f } = this.props, p = d && this.getError();
88
+ return /* @__PURE__ */ r(l, {
89
+ variant: u ? "filled" : f || "standard",
90
+ inputRef: (e) => {
91
+ this.inputRef = e;
92
+ },
93
+ disabled: n,
94
+ label: t,
95
+ InputLabelProps: { shrink: !0 },
96
+ value: this.state.value,
97
+ error: !!p,
98
+ helperText: p,
99
+ onChange: this.onChange,
100
+ onBlur: this.onBlur,
101
+ onKeyDown: (e) => {
102
+ e.key === "Enter" && this.inputRef && this.inputRef.blur();
103
+ },
104
+ type: "number",
105
+ className: e,
106
+ slotProps: { input: {
107
+ endAdornment: i && /* @__PURE__ */ r(s, {
108
+ position: "end",
109
+ children: i
110
+ }),
111
+ className: c,
112
+ inputProps: {
113
+ min: a,
114
+ max: o
115
+ }
116
+ } },
117
+ margin: "normal"
118
+ });
119
+ }
120
+ };
121
+ //#endregion
122
+ export { d as default };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/radio-with-label.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 RadioWithLabel: {
12
+ ({ label, value, checked, onChange }: {
13
+ label: any;
14
+ value: any;
15
+ checked: any;
16
+ onChange: any;
17
+ }): React.JSX.Element;
18
+ propTypes: {
19
+ label: PropTypes.Requireable<string>;
20
+ value: PropTypes.Requireable<string>;
21
+ checked: PropTypes.Requireable<boolean>;
22
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
23
+ };
24
+ };
25
+ export default RadioWithLabel;
@@ -0,0 +1,27 @@
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/Radio";
8
+ //#region src/radio-with-label.tsx
9
+ var o = t(i)(() => ({ "& .MuiFormControlLabel-label": {
10
+ left: "-5px",
11
+ position: "relative"
12
+ } })), s = t(a)(() => ({ color: `${r.tertiary()} !important` })), c = ({ label: e, value: t, checked: r, onChange: i }) => /* @__PURE__ */ n(o, {
13
+ value: t,
14
+ control: /* @__PURE__ */ n(s, {
15
+ checked: r,
16
+ onChange: i
17
+ }),
18
+ label: e
19
+ });
20
+ c.propTypes = {
21
+ label: e.string,
22
+ value: e.string,
23
+ checked: e.bool,
24
+ onChange: e.func
25
+ };
26
+ //#endregion
27
+ export { c as default };
@@ -0,0 +1,26 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/settings/display-size.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 DisplaySize: {
12
+ ({ size, label, onChange }: {
13
+ size: any;
14
+ label: any;
15
+ onChange: any;
16
+ }): React.JSX.Element;
17
+ propTypes: {
18
+ size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
19
+ width: PropTypes.Validator<number>;
20
+ height: PropTypes.Validator<number>;
21
+ }>>>;
22
+ label: PropTypes.Validator<string>;
23
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
24
+ };
25
+ };
26
+ export default DisplaySize;
@@ -0,0 +1,45 @@
1
+ import e from "../number-text-field.js";
2
+ import "react";
3
+ import t from "prop-types";
4
+ import { styled as n } from "@mui/material/styles";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ import a from "@mui/material/Typography";
7
+ //#region src/settings/display-size.tsx
8
+ var o = n("div")(({ theme: e }) => ({
9
+ display: "flex",
10
+ paddingTop: e.spacing(1)
11
+ })), s = ({ size: t, label: n, onChange: s }) => {
12
+ let c = (e, n) => {
13
+ s({
14
+ ...t,
15
+ [e]: n
16
+ });
17
+ };
18
+ return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(a, { children: n }), /* @__PURE__ */ i(o, { children: [/* @__PURE__ */ r(e, {
19
+ label: "Width",
20
+ type: "number",
21
+ variant: "outlined",
22
+ value: t.width,
23
+ min: 150,
24
+ max: 1e3,
25
+ onChange: (e, t) => c("width", t)
26
+ }), /* @__PURE__ */ r(e, {
27
+ label: "Height",
28
+ type: "number",
29
+ variant: "outlined",
30
+ min: 150,
31
+ max: 1e3,
32
+ value: t.height,
33
+ onChange: (e, t) => c("height", t)
34
+ })] })] });
35
+ };
36
+ s.propTypes = {
37
+ size: t.shape({
38
+ width: t.number.isRequired,
39
+ height: t.number.isRequired
40
+ }).isRequired,
41
+ label: t.string.isRequired,
42
+ onChange: t.func
43
+ };
44
+ //#endregion
45
+ export { s as default };
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/settings/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 Panel from './panel.js';
10
+ export { Panel };
11
+ export declare const textField: (label: any, isConfigProperty?: boolean) => {
12
+ label: any;
13
+ type: string;
14
+ isConfigProperty: boolean;
15
+ };
16
+ export declare const toggle: (label: any, isConfigProperty?: boolean, disabled?: boolean) => {
17
+ type: string;
18
+ label: any;
19
+ isConfigProperty: boolean;
20
+ disabled: boolean;
21
+ };
22
+ export declare const radio: () => {
23
+ type: string;
24
+ label: any;
25
+ choices: any;
26
+ isConfigProperty: any;
27
+ };
28
+ export declare const dropdown: (label: any, choices: any, isConfigProperty?: boolean) => {
29
+ type: string;
30
+ label: any;
31
+ choices: any;
32
+ isConfigProperty: boolean;
33
+ };
34
+ export declare const numberField: (label: any, options: any, isConfigProperty?: boolean) => any;
35
+ export declare const numberFields: (label: any, fields: any, isConfigProperty?: boolean) => {
36
+ type: string;
37
+ label: any;
38
+ fields: any;
39
+ };
40
+ export declare const checkbox: (label: any, settings: any, isConfigProperty?: boolean) => any;
41
+ export declare const checkboxes: (label: any, choices: any, isConfigProperty?: boolean) => {
42
+ type: string;
43
+ label: any;
44
+ choices: any;
45
+ };
@@ -0,0 +1,63 @@
1
+ import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
2
+ import t from "./panel.js";
3
+ //#region src/settings/index.ts
4
+ var n = /* @__PURE__ */ e({
5
+ Panel: () => t,
6
+ checkbox: () => u,
7
+ checkboxes: () => d,
8
+ dropdown: () => s,
9
+ numberField: () => c,
10
+ numberFields: () => l,
11
+ radio: () => o,
12
+ textField: () => r,
13
+ toggle: () => i
14
+ }), r = (e, t = !0) => ({
15
+ label: e,
16
+ type: "textField",
17
+ isConfigProperty: t
18
+ }), i = (e, t = !1, n = !1) => ({
19
+ type: "toggle",
20
+ label: e,
21
+ isConfigProperty: t,
22
+ disabled: n
23
+ }), a = (e) => typeof e == "string" ? {
24
+ label: e,
25
+ value: e
26
+ } : e, o = function() {
27
+ let [e, t, n = !1] = Array.prototype.slice.call(arguments);
28
+ return {
29
+ type: "radio",
30
+ label: e,
31
+ choices: t && t.map((e) => a(e)),
32
+ isConfigProperty: n
33
+ };
34
+ }, s = (e, t, n = !1) => ({
35
+ type: "dropdown",
36
+ label: e,
37
+ choices: t,
38
+ isConfigProperty: n
39
+ }), c = (e, t, n = !1) => ({
40
+ ...t,
41
+ label: e,
42
+ type: "numberField",
43
+ isConfigProperty: n
44
+ }), l = (e, t, n = !1) => (Object.keys(t).map((e) => {
45
+ t[e] = c(t[e].label, t[e], n);
46
+ }), {
47
+ type: "numberFields",
48
+ label: e,
49
+ fields: t
50
+ }), u = (e, t, n = !1) => ({
51
+ ...t,
52
+ label: e,
53
+ type: "checkbox",
54
+ isConfigProperty: n
55
+ }), d = (e, t, n = !1) => (Object.keys(t).map((e) => {
56
+ t[e] = u(t[e].label, t[e], n);
57
+ }), {
58
+ type: "checkboxes",
59
+ label: e,
60
+ choices: t
61
+ });
62
+ //#endregion
63
+ export { n as settings_exports };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/settings/panel.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 Panel extends React.Component {
12
+ static propTypes: {
13
+ model: PropTypes.Requireable<object>;
14
+ configuration: PropTypes.Requireable<object>;
15
+ groups: PropTypes.Requireable<object>;
16
+ onChangeModel: PropTypes.Requireable<(...args: any[]) => any>;
17
+ onChangeConfiguration: PropTypes.Requireable<(...args: any[]) => any>;
18
+ modal: PropTypes.Requireable<object>;
19
+ };
20
+ static defaultProps: {
21
+ onChangeModel: () => void;
22
+ onChangeConfiguration: () => void;
23
+ };
24
+ change: any;
25
+ render(): React.JSX.Element;
26
+ }
27
+ export default Panel;
@@ -0,0 +1,201 @@
1
+ import e from "../checkbox.js";
2
+ import t from "../number-text-field.js";
3
+ import { NChoice as n } from "../two-choice.js";
4
+ import r from "./toggle.js";
5
+ import i from "./settings-radio-label.js";
6
+ import a from "react";
7
+ import o from "prop-types";
8
+ import { styled as s } from "@mui/material/styles";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
10
+ import { get as u, set as d } from "@pie-element/shared-lodash";
11
+ import f from "@mui/material/Typography";
12
+ import p from "@mui/material/Input";
13
+ import m from "@mui/material/Select";
14
+ import h from "@mui/material/MenuItem";
15
+ import g from "debug";
16
+ //#region src/settings/panel.tsx
17
+ var _ = g("pie-lib:config-ui:settings:panel"), v = {
18
+ label: o.string,
19
+ value: o.string
20
+ }, y = {
21
+ label: o.string,
22
+ value: o.string,
23
+ onChange: o.func
24
+ }, b = ({ label: t, value: n, onChange: r }) => /* @__PURE__ */ c(e, {
25
+ checked: n,
26
+ label: t,
27
+ onChange: (e) => {
28
+ r(e.target.checked);
29
+ }
30
+ });
31
+ b.propTypes = {
32
+ label: o.string,
33
+ value: o.bool,
34
+ onChange: o.func
35
+ };
36
+ var x = s(n)(({ theme: e }) => ({
37
+ marginTop: e.spacing(.5),
38
+ paddingBottom: e.spacing(.5),
39
+ width: "100%",
40
+ "& > label": {
41
+ color: "rgba(0, 0, 0, 0.89)",
42
+ transform: "translate(0, 10px) scale(1)",
43
+ fontSize: "18px",
44
+ marginTop: e.spacing(2.5)
45
+ },
46
+ "& > div": { marginTop: e.spacing(2.5) }
47
+ })), S = ({ label: e, value: t, onChange: n, choices: r }) => /* @__PURE__ */ c(x, {
48
+ direction: "horizontal",
49
+ customLabel: i,
50
+ value: t,
51
+ header: e,
52
+ opts: r,
53
+ onChange: n
54
+ });
55
+ S.propTypes = {
56
+ ...y,
57
+ choices: o.arrayOf(o.shape(v))
58
+ };
59
+ var C = S, w = s("p")(({ theme: e }) => ({
60
+ margin: 0,
61
+ fontSize: e.typography.fontSize
62
+ })), T = s(m)(({ theme: e }) => ({
63
+ marginTop: e.spacing(.5),
64
+ border: "2px solid lightgrey",
65
+ padding: `0 ${e.spacing(1)}`,
66
+ borderRadius: "4px"
67
+ })), E = ({ label: e, value: t, onChange: n, choices: r = [] }) => {
68
+ let i = (e) => typeof e == "string" ? e : e.label, a = (e) => typeof e == "string" ? e : e.value;
69
+ return /* @__PURE__ */ l("div", { children: [e && /* @__PURE__ */ c(w, { children: e }), /* @__PURE__ */ c(T, {
70
+ value: t || r && r[0],
71
+ onChange: ({ target: e }) => n(e.value),
72
+ input: /* @__PURE__ */ c(p, { id: `dropdown-${e}` }),
73
+ disableUnderline: !0,
74
+ MenuProps: { transitionDuration: {
75
+ enter: 225,
76
+ exit: 195
77
+ } },
78
+ children: r.map((e, t) => /* @__PURE__ */ c(h, {
79
+ value: a(e),
80
+ children: i(e)
81
+ }, t))
82
+ })] });
83
+ };
84
+ E.propTypes = {
85
+ ...y,
86
+ choices: o.arrayOf(o.string)
87
+ };
88
+ var D = s(f)(({ theme: e }) => ({
89
+ marginRight: e.spacing(3),
90
+ marginTop: e.spacing(1)
91
+ })), O = ({ label: e }) => /* @__PURE__ */ c(D, { children: e }), k = s(t)(({ theme: e }) => ({
92
+ width: "35%",
93
+ marginRight: e.spacing(3),
94
+ marginTop: e.spacing(1),
95
+ "& .MuiInputBase-root": {
96
+ marginTop: e.spacing(.5),
97
+ border: "2px solid lightgrey",
98
+ borderRadius: "4px",
99
+ padding: `0 ${e.spacing(1)}`,
100
+ backgroundColor: "transparent"
101
+ }
102
+ })), A = ({ label: e, value: t, onChange: n = () => {}, suffix: r, min: i, max: a }) => /* @__PURE__ */ c(k, {
103
+ variant: "standard",
104
+ label: e || "Label",
105
+ value: t,
106
+ max: a,
107
+ min: i,
108
+ onChange: (e, t) => n(t),
109
+ suffix: r,
110
+ showErrorWhenOutsideRange: !0,
111
+ disableUnderline: !0
112
+ });
113
+ A.propTypes = {
114
+ ...y,
115
+ suffix: o.string,
116
+ min: o.number,
117
+ max: o.number,
118
+ value: o.number
119
+ }, O.propTypes = { ...y };
120
+ var j = ({ disabled: e, label: t, value: n, onChange: i }) => /* @__PURE__ */ c(r, {
121
+ label: t,
122
+ checked: !!n,
123
+ disabled: !!e,
124
+ toggle: i
125
+ });
126
+ j.propTypes = {
127
+ ...y,
128
+ value: o.bool
129
+ };
130
+ var M = {
131
+ toggle: j,
132
+ radio: C,
133
+ dropdown: E,
134
+ numberField: A,
135
+ checkbox: b,
136
+ textField: O
137
+ }, N = s("div")(({ theme: e }) => ({ margin: `0 0 ${e.spacing(2)} 0` })), P = s("div")(({ theme: e }) => ({
138
+ color: "#495B8F",
139
+ fontSize: e.typography.fontSize + 2,
140
+ fontWeight: 600,
141
+ marginBottom: e.spacing(1)
142
+ })), F = s("p")(({ theme: e }) => ({
143
+ fontSize: e.typography.fontSize,
144
+ marginBottom: 0
145
+ })), I = (e) => {
146
+ let { model: t, label: n, group: r, configuration: i, onChange: a } = e, o = (e, n, r) => {
147
+ let { isConfigProperty: o, ...s } = u(e, r || n), l = u(o ? i : t, n), d = {
148
+ ...s,
149
+ key: n,
150
+ value: l
151
+ }, f = M[d.type];
152
+ return /* @__PURE__ */ c(f, {
153
+ ...d,
154
+ onChange: (e) => a(n, e, o)
155
+ }, n);
156
+ }, s = (e, t) => {
157
+ let n = e[t];
158
+ if (!n) return null;
159
+ let { type: r, label: i, fields: a, choices: s } = n;
160
+ return r === "numberFields" ? /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c(F, { children: i }), Object.keys(a).map((n) => o(e, `${t}.${n}`, `${t}.fields.${n}`))] }, `numberField-${i}`) : r === "checkboxes" ? /* @__PURE__ */ l("div", { children: [/* @__PURE__ */ c("p", { children: i }), Object.keys(s).map((n) => o(e, `${t}.${n}`, `${t}.choices.${n}`))] }, `checkbox-${i}`) : o(e, t);
161
+ };
162
+ return /* @__PURE__ */ l(N, { children: [/* @__PURE__ */ c(P, { children: n }), Object.keys(r).map((e) => s(r, e))] });
163
+ };
164
+ I.propTypes = {
165
+ model: o.object,
166
+ label: o.string,
167
+ group: o.object,
168
+ configuration: o.object,
169
+ onChange: o.func
170
+ };
171
+ var L = class extends a.Component {
172
+ static propTypes = {
173
+ model: o.object,
174
+ configuration: o.object,
175
+ groups: o.object,
176
+ onChangeModel: o.func,
177
+ onChangeConfiguration: o.func,
178
+ modal: o.object
179
+ };
180
+ static defaultProps = {
181
+ onChangeModel: () => {},
182
+ onChangeConfiguration: () => {}
183
+ };
184
+ change = (e, t, n = !1) => {
185
+ _("[changeModel]", e, t);
186
+ let { onChangeModel: r, onChangeConfiguration: i } = this.props, a = { ...this.props.model }, o = { ...this.props.configuration };
187
+ n ? (d(o, e, t), i(o, e)) : (d(a, e, t), r(a, e));
188
+ };
189
+ render() {
190
+ let { groups: e, model: t, configuration: n, modal: r } = this.props;
191
+ return _("render:", t), /* @__PURE__ */ l("div", { children: [Object.keys(e || {}).map((r) => Object.entries(e[r]).some(([, e]) => !!e) ? /* @__PURE__ */ c(I, {
192
+ label: r,
193
+ model: t,
194
+ configuration: n,
195
+ group: e[r],
196
+ onChange: this.change
197
+ }, r) : null), r] });
198
+ }
199
+ };
200
+ //#endregion
201
+ export { L as default };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/settings/settings-radio-label.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 SettingsRadioLabel: {
12
+ ({ label, value, checked, onChange }: {
13
+ label: any;
14
+ value: any;
15
+ checked: any;
16
+ onChange: any;
17
+ }): React.JSX.Element;
18
+ propTypes: {
19
+ label: PropTypes.Requireable<string>;
20
+ value: PropTypes.Requireable<string>;
21
+ checked: PropTypes.Requireable<boolean>;
22
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
23
+ };
24
+ };
25
+ export default SettingsRadioLabel;
@@ -0,0 +1,29 @@
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/Radio";
8
+ //#region src/settings/settings-radio-label.tsx
9
+ var o = t(i)(({ theme: e }) => ({ "& .MuiFormControlLabel-label": {
10
+ color: "rgba(0, 0, 0, 0.89)",
11
+ fontSize: e.typography.fontSize - 2,
12
+ left: "-5px",
13
+ position: "relative"
14
+ } })), s = t(a)(() => ({ color: `${r.tertiary()} !important` })), c = ({ label: e, value: t, checked: r, onChange: i }) => /* @__PURE__ */ n(o, {
15
+ value: t,
16
+ control: /* @__PURE__ */ n(s, {
17
+ checked: r,
18
+ onChange: i
19
+ }),
20
+ label: e
21
+ });
22
+ c.propTypes = {
23
+ label: e.string,
24
+ value: e.string,
25
+ checked: e.bool,
26
+ onChange: e.func
27
+ };
28
+ //#endregion
29
+ export { c as default };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/settings/toggle.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 Toggle: {
12
+ ({ checked, disabled, label, toggle }: {
13
+ checked: any;
14
+ disabled: any;
15
+ label: any;
16
+ toggle: any;
17
+ }): React.JSX.Element;
18
+ propTypes: {
19
+ checked: PropTypes.Requireable<boolean>;
20
+ disabled: PropTypes.Requireable<boolean>;
21
+ label: PropTypes.Validator<string>;
22
+ toggle: PropTypes.Validator<(...args: any[]) => any>;
23
+ };
24
+ };
25
+ export default Toggle;