@pie-lib/config-ui 0.1.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 (132) 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.d.ts.map +1 -0
  4. package/dist/alert-dialog.js +47 -0
  5. package/dist/checkbox.d.ts +34 -0
  6. package/dist/checkbox.d.ts.map +1 -0
  7. package/dist/checkbox.js +57 -0
  8. package/dist/choice-configuration/feedback-menu.d.ts +33 -0
  9. package/dist/choice-configuration/feedback-menu.d.ts.map +1 -0
  10. package/dist/choice-configuration/feedback-menu.js +85 -0
  11. package/dist/choice-configuration/index.d.ts +63 -0
  12. package/dist/choice-configuration/index.d.ts.map +1 -0
  13. package/dist/choice-configuration/index.js +240 -0
  14. package/dist/choice-utils.d.ts +22 -0
  15. package/dist/choice-utils.d.ts.map +1 -0
  16. package/dist/choice-utils.js +15 -0
  17. package/dist/feedback-config/feedback-selector.d.ts +34 -0
  18. package/dist/feedback-config/feedback-selector.d.ts.map +1 -0
  19. package/dist/feedback-config/feedback-selector.js +92 -0
  20. package/dist/feedback-config/group.d.ts +21 -0
  21. package/dist/feedback-config/group.d.ts.map +1 -0
  22. package/dist/feedback-config/group.js +33 -0
  23. package/dist/feedback-config/index.d.ts +49 -0
  24. package/dist/feedback-config/index.d.ts.map +1 -0
  25. package/dist/feedback-config/index.js +96 -0
  26. package/dist/form-section.d.ts +25 -0
  27. package/dist/form-section.d.ts.map +1 -0
  28. package/dist/form-section.js +25 -0
  29. package/dist/help.d.ts +42 -0
  30. package/dist/help.d.ts.map +1 -0
  31. package/dist/help.js +61 -0
  32. package/dist/index.d.ts +32 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +34 -0
  35. package/dist/input.d.ts +30 -0
  36. package/dist/input.d.ts.map +1 -0
  37. package/dist/input.js +65 -0
  38. package/dist/inputs.d.ts +63 -0
  39. package/dist/inputs.d.ts.map +1 -0
  40. package/dist/inputs.js +70 -0
  41. package/dist/langs.d.ts +42 -0
  42. package/dist/langs.d.ts.map +1 -0
  43. package/dist/langs.js +76 -0
  44. package/dist/layout/config-layout.d.ts +11 -0
  45. package/dist/layout/config-layout.d.ts.map +1 -0
  46. package/dist/layout/config-layout.js +75 -0
  47. package/dist/layout/index.d.ts +12 -0
  48. package/dist/layout/index.d.ts.map +1 -0
  49. package/dist/layout/index.js +10 -0
  50. package/dist/layout/layout-contents.d.ts +22 -0
  51. package/dist/layout/layout-contents.d.ts.map +1 -0
  52. package/dist/layout/layout-contents.js +70 -0
  53. package/dist/layout/settings-box.d.ts +20 -0
  54. package/dist/layout/settings-box.d.ts.map +1 -0
  55. package/dist/layout/settings-box.js +31 -0
  56. package/dist/mui-box/index.d.ts +21 -0
  57. package/dist/mui-box/index.d.ts.map +1 -0
  58. package/dist/mui-box/index.js +47 -0
  59. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
  60. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
  61. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
  62. package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
  63. package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +122 -0
  64. package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +276 -0
  65. package/dist/number-text-field-custom.d.ts +52 -0
  66. package/dist/number-text-field-custom.d.ts.map +1 -0
  67. package/dist/number-text-field-custom.js +192 -0
  68. package/dist/number-text-field.d.ts +48 -0
  69. package/dist/number-text-field.d.ts.map +1 -0
  70. package/dist/number-text-field.js +122 -0
  71. package/dist/radio-with-label.d.ts +25 -0
  72. package/dist/radio-with-label.d.ts.map +1 -0
  73. package/dist/radio-with-label.js +27 -0
  74. package/dist/settings/display-size.d.ts +26 -0
  75. package/dist/settings/display-size.d.ts.map +1 -0
  76. package/dist/settings/display-size.js +45 -0
  77. package/dist/settings/index.d.ts +46 -0
  78. package/dist/settings/index.d.ts.map +1 -0
  79. package/dist/settings/index.js +63 -0
  80. package/dist/settings/panel.d.ts +28 -0
  81. package/dist/settings/panel.d.ts.map +1 -0
  82. package/dist/settings/panel.js +201 -0
  83. package/dist/settings/settings-radio-label.d.ts +25 -0
  84. package/dist/settings/settings-radio-label.d.ts.map +1 -0
  85. package/dist/settings/settings-radio-label.js +29 -0
  86. package/dist/settings/toggle.d.ts +25 -0
  87. package/dist/settings/toggle.d.ts.map +1 -0
  88. package/dist/settings/toggle.js +33 -0
  89. package/dist/tabs/index.d.ts +23 -0
  90. package/dist/tabs/index.d.ts.map +1 -0
  91. package/dist/tabs/index.js +39 -0
  92. package/dist/tags-input/index.d.ts +22 -0
  93. package/dist/tags-input/index.d.ts.map +1 -0
  94. package/dist/tags-input/index.js +83 -0
  95. package/dist/two-choice.d.ts +44 -0
  96. package/dist/two-choice.d.ts.map +1 -0
  97. package/dist/two-choice.js +79 -0
  98. package/dist/with-stateful-model.d.ts +22 -0
  99. package/dist/with-stateful-model.d.ts.map +1 -0
  100. package/dist/with-stateful-model.js +32 -0
  101. package/package.json +40 -0
  102. package/src/alert-dialog.tsx +85 -0
  103. package/src/checkbox.tsx +71 -0
  104. package/src/choice-configuration/feedback-menu.tsx +134 -0
  105. package/src/choice-configuration/index.tsx +400 -0
  106. package/src/choice-utils.ts +40 -0
  107. package/src/feedback-config/feedback-selector.tsx +153 -0
  108. package/src/feedback-config/group.tsx +61 -0
  109. package/src/feedback-config/index.tsx +121 -0
  110. package/src/form-section.tsx +41 -0
  111. package/src/help.tsx +89 -0
  112. package/src/index.ts +93 -0
  113. package/src/input.tsx +109 -0
  114. package/src/inputs.tsx +107 -0
  115. package/src/langs.tsx +121 -0
  116. package/src/layout/config-layout.tsx +113 -0
  117. package/src/layout/index.ts +14 -0
  118. package/src/layout/layout-contents.tsx +127 -0
  119. package/src/layout/settings-box.tsx +42 -0
  120. package/src/mui-box/index.tsx +66 -0
  121. package/src/number-text-field-custom.tsx +343 -0
  122. package/src/number-text-field.tsx +229 -0
  123. package/src/radio-with-label.tsx +40 -0
  124. package/src/settings/display-size.tsx +63 -0
  125. package/src/settings/index.ts +93 -0
  126. package/src/settings/panel.tsx +343 -0
  127. package/src/settings/settings-radio-label.tsx +42 -0
  128. package/src/settings/toggle.tsx +56 -0
  129. package/src/tabs/index.tsx +57 -0
  130. package/src/tags-input/index.tsx +126 -0
  131. package/src/two-choice.tsx +128 -0
  132. package/src/with-stateful-model.tsx +46 -0
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/config-ui/src/number-text-field.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 NumberTextField extends React.Component {
12
+ static propTypes: {
13
+ disabled: PropTypes.Requireable<boolean>;
14
+ className: PropTypes.Requireable<string>;
15
+ inputClassName: PropTypes.Requireable<string>;
16
+ onChange: PropTypes.Validator<(...args: any[]) => any>;
17
+ value: PropTypes.Requireable<number>;
18
+ min: PropTypes.Requireable<number>;
19
+ max: PropTypes.Requireable<number>;
20
+ label: PropTypes.Requireable<string>;
21
+ suffix: PropTypes.Requireable<string>;
22
+ showErrorWhenOutsideRange: PropTypes.Requireable<boolean>;
23
+ disableUnderline: PropTypes.Requireable<boolean>;
24
+ variant: PropTypes.Requireable<string>;
25
+ };
26
+ static defaultProps: {
27
+ showErrorWhenOutsideRange: boolean;
28
+ };
29
+ constructor(props: any);
30
+ UNSAFE_componentWillReceiveProps(props: any): void;
31
+ clamp(value: any, min?: any, max?: any): any;
32
+ /**
33
+ * on Blur (this can be triggered by pressing Enter, see below)
34
+ * we check the entered value and reset it if needed
35
+ */
36
+ onBlur: any;
37
+ onChange(event: any): void;
38
+ errorMessage: any;
39
+ /**
40
+ * if the input has to show error when outside range,
41
+ * and the entered value is not matching the requirements
42
+ * we display error message
43
+ */
44
+ getError: any;
45
+ render(): JSX.Element;
46
+ }
47
+ export default NumberTextField;
48
+ //# sourceMappingURL=number-text-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"number-text-field.d.ts","sourceRoot":"","sources":["../src/number-text-field.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAkD1B,qBAAa,eAAgB,SAAQ,KAAK,CAAC,SAAS;IAClD,MAAM,CAAC,SAAS;;;;;;;;;;;;;MAad;IAEF,MAAM,CAAC,YAAY;;MAEjB;gBAEU,KAAK,KAAA;IAgBjB,gCAAgC,CAAC,KAAK,KAAA;IAMtC,KAAK,CAAC,KAAK,KAAA,EAAE,GAAG,MAAiB,EAAE,GAAG,MAAiB;IAgBvD;;;OAGG;IACH,MAAM,EAAE,GAAG,CAeT;IAEF,QAAQ,CAAC,KAAK,KAAA;IAKd,YAAY,EAAE,GAAG,CAWf;IAEF;;;;OAIG;IAEH,QAAQ,EAAE,GAAG,CAOX;IAEF,MAAM;CAqDP;AAED,eAAe,eAAe,CAAC"}
@@ -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 "lodash-es";
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
+ },
26
+ "& .MuiInputBase-input": {
27
+ height: "auto",
28
+ minHeight: "auto",
29
+ padding: "6px 0 7px"
30
+ },
31
+ "& .MuiInput-root, & .MuiFilledInput-root": { "&:before, &:after, &:hover:not(.Mui-disabled):before": { display: "none" } }
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 PropTypes from 'prop-types';
10
+ declare const RadioWithLabel: {
11
+ ({ label, value, checked, onChange }: {
12
+ label: any;
13
+ value: any;
14
+ checked: any;
15
+ onChange: any;
16
+ }): JSX.Element;
17
+ propTypes: {
18
+ label: PropTypes.Requireable<string>;
19
+ value: PropTypes.Requireable<string>;
20
+ checked: PropTypes.Requireable<boolean>;
21
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
22
+ };
23
+ };
24
+ export default RadioWithLabel;
25
+ //# sourceMappingURL=radio-with-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-with-label.d.ts","sourceRoot":"","sources":["../src/radio-with-label.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAKH,OAAO,SAAS,MAAM,YAAY,CAAC;AAenC,QAAA,MAAM,cAAc;;;;;;;;;;;;;CAEnB,CAAC;AASF,eAAe,cAAc,CAAC"}
@@ -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 PropTypes from 'prop-types';
10
+ declare const DisplaySize: {
11
+ ({ size, label, onChange }: {
12
+ size: any;
13
+ label: any;
14
+ onChange: any;
15
+ }): JSX.Element;
16
+ propTypes: {
17
+ size: PropTypes.Validator<NonNullable<PropTypes.InferProps<{
18
+ width: PropTypes.Validator<number>;
19
+ height: PropTypes.Validator<number>;
20
+ }>>>;
21
+ label: PropTypes.Validator<string>;
22
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
23
+ };
24
+ };
25
+ export default DisplaySize;
26
+ //# sourceMappingURL=display-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-size.d.ts","sourceRoot":"","sources":["../../src/settings/display-size.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAUnC,QAAA,MAAM,WAAW;;;;;;;;;;;;;;CA8BhB,CAAC;AAWF,eAAe,WAAW,CAAC"}
@@ -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,46 @@
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
+ };
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/settings/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,eAAO,MAAM,SAAS,GAAI,UAAK,EAAE,0BAAuB;;;;CAItD,CAAC;AAEH,eAAO,MAAM,MAAM,GAAI,UAAK,EAAE,0BAAwB,EAAE,kBAAgB;;;;;CAKtE,CAAC;AAUH,eAAO,MAAM,KAAK;;;;;CAUjB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,UAAK,EAAE,YAAO,EAAE,0BAAwB;;;;;CAOhE,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,UAAK,EAAE,YAAO,EAAE,0BAAwB,QAKlE,CAAC;AAEH,eAAO,MAAM,YAAY,GAAI,UAAK,EAAE,WAAM,EAAE,0BAAwB;;;;CAUnE,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,UAAK,EAAE,aAAQ,EAAE,0BAAwB,QAKhE,CAAC;AAEH,eAAO,MAAM,UAAU,GAAI,UAAK,EAAE,YAAO,EAAE,0BAAwB;;;;CAUlE,CAAC"}
@@ -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,28 @@
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(): JSX.Element;
26
+ }
27
+ export default Panel;
28
+ //# sourceMappingURL=panel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panel.d.ts","sourceRoot":"","sources":["../../src/settings/panel.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA2QnC,qBAAa,KAAM,SAAQ,KAAK,CAAC,SAAS;IACxC,MAAM,CAAC,SAAS;;;;;;;MAOd;IAEF,MAAM,CAAC,YAAY;;;MAGjB;IAEF,MAAM,EAAE,GAAG,CAcT;IAEF,MAAM;CA+BP;AAED,eAAe,KAAK,CAAC"}
@@ -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 "lodash-es";
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 PropTypes from 'prop-types';
10
+ declare const SettingsRadioLabel: {
11
+ ({ label, value, checked, onChange }: {
12
+ label: any;
13
+ value: any;
14
+ checked: any;
15
+ onChange: any;
16
+ }): JSX.Element;
17
+ propTypes: {
18
+ label: PropTypes.Requireable<string>;
19
+ value: PropTypes.Requireable<string>;
20
+ checked: PropTypes.Requireable<boolean>;
21
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
22
+ };
23
+ };
24
+ export default SettingsRadioLabel;
25
+ //# sourceMappingURL=settings-radio-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings-radio-label.d.ts","sourceRoot":"","sources":["../../src/settings/settings-radio-label.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAKH,OAAO,SAAS,MAAM,YAAY,CAAC;AAiBnC,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;CAEvB,CAAC;AASF,eAAe,kBAAkB,CAAC"}