@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.
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/alert-dialog.d.ts +44 -0
- package/dist/alert-dialog.d.ts.map +1 -0
- package/dist/alert-dialog.js +47 -0
- package/dist/checkbox.d.ts +34 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +57 -0
- package/dist/choice-configuration/feedback-menu.d.ts +33 -0
- package/dist/choice-configuration/feedback-menu.d.ts.map +1 -0
- package/dist/choice-configuration/feedback-menu.js +85 -0
- package/dist/choice-configuration/index.d.ts +63 -0
- package/dist/choice-configuration/index.d.ts.map +1 -0
- package/dist/choice-configuration/index.js +240 -0
- package/dist/choice-utils.d.ts +22 -0
- package/dist/choice-utils.d.ts.map +1 -0
- package/dist/choice-utils.js +15 -0
- package/dist/feedback-config/feedback-selector.d.ts +34 -0
- package/dist/feedback-config/feedback-selector.d.ts.map +1 -0
- package/dist/feedback-config/feedback-selector.js +92 -0
- package/dist/feedback-config/group.d.ts +21 -0
- package/dist/feedback-config/group.d.ts.map +1 -0
- package/dist/feedback-config/group.js +33 -0
- package/dist/feedback-config/index.d.ts +49 -0
- package/dist/feedback-config/index.d.ts.map +1 -0
- package/dist/feedback-config/index.js +96 -0
- package/dist/form-section.d.ts +25 -0
- package/dist/form-section.d.ts.map +1 -0
- package/dist/form-section.js +25 -0
- package/dist/help.d.ts +42 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +61 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/input.d.ts +30 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.js +65 -0
- package/dist/inputs.d.ts +63 -0
- package/dist/inputs.d.ts.map +1 -0
- package/dist/inputs.js +70 -0
- package/dist/langs.d.ts +42 -0
- package/dist/langs.d.ts.map +1 -0
- package/dist/langs.js +76 -0
- package/dist/layout/config-layout.d.ts +11 -0
- package/dist/layout/config-layout.d.ts.map +1 -0
- package/dist/layout/config-layout.js +75 -0
- package/dist/layout/index.d.ts +12 -0
- package/dist/layout/index.d.ts.map +1 -0
- package/dist/layout/index.js +10 -0
- package/dist/layout/layout-contents.d.ts +22 -0
- package/dist/layout/layout-contents.d.ts.map +1 -0
- package/dist/layout/layout-contents.js +70 -0
- package/dist/layout/settings-box.d.ts +20 -0
- package/dist/layout/settings-box.d.ts.map +1 -0
- package/dist/layout/settings-box.js +31 -0
- package/dist/mui-box/index.d.ts +21 -0
- package/dist/mui-box/index.d.ts.map +1 -0
- package/dist/mui-box/index.js +47 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +7 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
- package/dist/node_modules/.bun/@babel_runtime@7.28.6/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +8 -0
- package/dist/node_modules/.bun/react-measure@2.5.2_6dbf9a050bc9aadb/node_modules/react-measure/dist/index.esm.js +122 -0
- package/dist/node_modules/.bun/resize-observer-polyfill@1.5.1/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +276 -0
- package/dist/number-text-field-custom.d.ts +52 -0
- package/dist/number-text-field-custom.d.ts.map +1 -0
- package/dist/number-text-field-custom.js +192 -0
- package/dist/number-text-field.d.ts +48 -0
- package/dist/number-text-field.d.ts.map +1 -0
- package/dist/number-text-field.js +122 -0
- package/dist/radio-with-label.d.ts +25 -0
- package/dist/radio-with-label.d.ts.map +1 -0
- package/dist/radio-with-label.js +27 -0
- package/dist/settings/display-size.d.ts +26 -0
- package/dist/settings/display-size.d.ts.map +1 -0
- package/dist/settings/display-size.js +45 -0
- package/dist/settings/index.d.ts +46 -0
- package/dist/settings/index.d.ts.map +1 -0
- package/dist/settings/index.js +63 -0
- package/dist/settings/panel.d.ts +28 -0
- package/dist/settings/panel.d.ts.map +1 -0
- package/dist/settings/panel.js +201 -0
- package/dist/settings/settings-radio-label.d.ts +25 -0
- package/dist/settings/settings-radio-label.d.ts.map +1 -0
- package/dist/settings/settings-radio-label.js +29 -0
- package/dist/settings/toggle.d.ts +25 -0
- package/dist/settings/toggle.d.ts.map +1 -0
- package/dist/settings/toggle.js +33 -0
- package/dist/tabs/index.d.ts +23 -0
- package/dist/tabs/index.d.ts.map +1 -0
- package/dist/tabs/index.js +39 -0
- package/dist/tags-input/index.d.ts +22 -0
- package/dist/tags-input/index.d.ts.map +1 -0
- package/dist/tags-input/index.js +83 -0
- package/dist/two-choice.d.ts +44 -0
- package/dist/two-choice.d.ts.map +1 -0
- package/dist/two-choice.js +79 -0
- package/dist/with-stateful-model.d.ts +22 -0
- package/dist/with-stateful-model.d.ts.map +1 -0
- package/dist/with-stateful-model.js +32 -0
- package/package.json +40 -0
- package/src/alert-dialog.tsx +85 -0
- package/src/checkbox.tsx +71 -0
- package/src/choice-configuration/feedback-menu.tsx +134 -0
- package/src/choice-configuration/index.tsx +400 -0
- package/src/choice-utils.ts +40 -0
- package/src/feedback-config/feedback-selector.tsx +153 -0
- package/src/feedback-config/group.tsx +61 -0
- package/src/feedback-config/index.tsx +121 -0
- package/src/form-section.tsx +41 -0
- package/src/help.tsx +89 -0
- package/src/index.ts +93 -0
- package/src/input.tsx +109 -0
- package/src/inputs.tsx +107 -0
- package/src/langs.tsx +121 -0
- package/src/layout/config-layout.tsx +113 -0
- package/src/layout/index.ts +14 -0
- package/src/layout/layout-contents.tsx +127 -0
- package/src/layout/settings-box.tsx +42 -0
- package/src/mui-box/index.tsx +66 -0
- package/src/number-text-field-custom.tsx +343 -0
- package/src/number-text-field.tsx +229 -0
- package/src/radio-with-label.tsx +40 -0
- package/src/settings/display-size.tsx +63 -0
- package/src/settings/index.ts +93 -0
- package/src/settings/panel.tsx +343 -0
- package/src/settings/settings-radio-label.tsx +42 -0
- package/src/settings/toggle.tsx +56 -0
- package/src/tabs/index.tsx +57 -0
- package/src/tags-input/index.tsx +126 -0
- package/src/two-choice.tsx +128 -0
- package/src/with-stateful-model.tsx +46 -0
|
@@ -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 PropTypes from 'prop-types';
|
|
10
|
+
declare const Toggle: {
|
|
11
|
+
({ checked, disabled, label, toggle }: {
|
|
12
|
+
checked: any;
|
|
13
|
+
disabled: any;
|
|
14
|
+
label: any;
|
|
15
|
+
toggle: any;
|
|
16
|
+
}): JSX.Element;
|
|
17
|
+
propTypes: {
|
|
18
|
+
checked: PropTypes.Requireable<boolean>;
|
|
19
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
20
|
+
label: PropTypes.Validator<string>;
|
|
21
|
+
toggle: PropTypes.Validator<(...args: any[]) => any>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default Toggle;
|
|
25
|
+
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/settings/toggle.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AA8BnC,QAAA,MAAM,MAAM;;;;;;;;;;;;;CAKX,CAAC;AASF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { color as i } from "@pie-lib/render-ui";
|
|
6
|
+
import a from "@mui/material/Switch";
|
|
7
|
+
import o from "@mui/material/InputLabel";
|
|
8
|
+
//#region src/settings/toggle.tsx
|
|
9
|
+
var s = t("div")(() => ({
|
|
10
|
+
display: "flex",
|
|
11
|
+
width: "100%",
|
|
12
|
+
justifyContent: "space-between"
|
|
13
|
+
})), c = t(o)(({ theme: e }) => ({
|
|
14
|
+
color: "rgba(0, 0, 0, 0.89)",
|
|
15
|
+
fontSize: e.typography.fontSize,
|
|
16
|
+
paddingTop: e.spacing(2)
|
|
17
|
+
})), l = t(a)(({ checked: e }) => ({
|
|
18
|
+
"&.Mui-checked .MuiSwitch-thumb": { color: `${i.tertiary()} !important` },
|
|
19
|
+
"&.Mui-checked .MuiSwitch-track": { backgroundColor: `${i.tertiaryLight()} !important` },
|
|
20
|
+
"& .MuiSwitch-track": { backgroundColor: e ? `${i.tertiaryLight()} !important` : void 0 }
|
|
21
|
+
})), u = ({ checked: e, disabled: t, label: i, toggle: a }) => /* @__PURE__ */ r(s, { children: [/* @__PURE__ */ n(c, { children: i }), /* @__PURE__ */ n(l, {
|
|
22
|
+
checked: e,
|
|
23
|
+
disabled: t,
|
|
24
|
+
onChange: (e) => a(e.target.checked)
|
|
25
|
+
})] });
|
|
26
|
+
u.propTypes = {
|
|
27
|
+
checked: e.bool,
|
|
28
|
+
disabled: e.bool,
|
|
29
|
+
label: e.string.isRequired,
|
|
30
|
+
toggle: e.func.isRequired
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { u as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/config-ui/src/tabs/index.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class Tabs extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
className: PropTypes.Requireable<string>;
|
|
14
|
+
contentClassName: PropTypes.Requireable<string>;
|
|
15
|
+
contentStyle: PropTypes.Requireable<object>;
|
|
16
|
+
children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
|
|
17
|
+
};
|
|
18
|
+
constructor(props: any);
|
|
19
|
+
handleChange: any;
|
|
20
|
+
render(): JSX.Element;
|
|
21
|
+
}
|
|
22
|
+
export default Tabs;
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tabs/index.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAKnC,qBAAa,IAAK,SAAQ,KAAK,CAAC,SAAS;IACvC,MAAM,CAAC,SAAS;;;;;MAKd;gBAEU,KAAK,KAAA;IAKjB,YAAY,EAAE,GAAG,CAEf;IAEF,MAAM;CAkBP;AAED,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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/Tabs";
|
|
6
|
+
import o from "@mui/material/Tab";
|
|
7
|
+
//#region src/tabs/index.tsx
|
|
8
|
+
var s = n(o)(() => ({})), c = class extends e.Component {
|
|
9
|
+
static propTypes = {
|
|
10
|
+
className: t.string,
|
|
11
|
+
contentClassName: t.string,
|
|
12
|
+
contentStyle: t.object,
|
|
13
|
+
children: t.oneOfType([t.arrayOf(t.node), t.node]).isRequired
|
|
14
|
+
};
|
|
15
|
+
constructor(e) {
|
|
16
|
+
super(e), this.state = { value: 0 };
|
|
17
|
+
}
|
|
18
|
+
handleChange = (e, t) => {
|
|
19
|
+
this.setState({ value: t });
|
|
20
|
+
};
|
|
21
|
+
render() {
|
|
22
|
+
let { value: t } = this.state, { children: n, className: o, contentClassName: c, contentStyle: l = {} } = this.props;
|
|
23
|
+
return /* @__PURE__ */ i("div", {
|
|
24
|
+
className: o,
|
|
25
|
+
children: [/* @__PURE__ */ r(a, {
|
|
26
|
+
indicatorColor: "primary",
|
|
27
|
+
value: t,
|
|
28
|
+
onChange: this.handleChange,
|
|
29
|
+
children: e.Children.map(n, (e, t) => e && e.props.title ? /* @__PURE__ */ r(s, { label: e.props.title }, t) : null)
|
|
30
|
+
}), /* @__PURE__ */ r("div", {
|
|
31
|
+
className: c,
|
|
32
|
+
style: l,
|
|
33
|
+
children: n[t]
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { c as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/config-ui/src/tags-input/index.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class TagsInput extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
tags: PropTypes.Validator<(string | null | undefined)[]>;
|
|
14
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
|
+
};
|
|
16
|
+
constructor(props: any);
|
|
17
|
+
onFocus: any;
|
|
18
|
+
onBlur: any;
|
|
19
|
+
render(): JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
export default TagsInput;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tags-input/index.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AA0CnC,qBAAa,SAAU,SAAQ,KAAK,CAAC,SAAS;IAC5C,MAAM,CAAC,SAAS;;;MAGd;gBAEU,KAAK,KAAA;IAmCjB,OAAO,EAAE,GAAG,CAEV;IAEF,MAAM,EAAE,GAAG,CAET;IAEF,MAAM;CAqBP;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import e from "../mui-box/index.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 { uniq as o } from "lodash-es";
|
|
7
|
+
import s from "@mui/material/Chip";
|
|
8
|
+
//#region src/tags-input/index.tsx
|
|
9
|
+
var c = 13, l = r(s)(() => ({
|
|
10
|
+
padding: "0px",
|
|
11
|
+
margin: "1px"
|
|
12
|
+
})), u = ({ label: e, onDelete: t }) => /* @__PURE__ */ i(l, {
|
|
13
|
+
label: e,
|
|
14
|
+
onDelete: t
|
|
15
|
+
});
|
|
16
|
+
u.propTypes = {
|
|
17
|
+
label: n.string.isRequired,
|
|
18
|
+
onDelete: n.func.isRequired
|
|
19
|
+
};
|
|
20
|
+
var d = r("div")(({ theme: e }) => ({
|
|
21
|
+
border: `0px solid ${e.palette.background.paper}`,
|
|
22
|
+
display: "flex",
|
|
23
|
+
flexWrap: "wrap"
|
|
24
|
+
})), f = r("input")(({ theme: e }) => ({
|
|
25
|
+
padding: "2px",
|
|
26
|
+
margin: "1px",
|
|
27
|
+
minWidth: "30px",
|
|
28
|
+
width: "100%",
|
|
29
|
+
flex: "1",
|
|
30
|
+
border: `0px solid ${e.palette.background.paper}`,
|
|
31
|
+
height: "28px",
|
|
32
|
+
fontSize: e.typography.fontSize,
|
|
33
|
+
fontFamily: e.typography.fontFamily,
|
|
34
|
+
outline: "none",
|
|
35
|
+
"&:focus": { outline: "none" }
|
|
36
|
+
})), p = class extends t.Component {
|
|
37
|
+
static propTypes = {
|
|
38
|
+
tags: n.arrayOf(n.string).isRequired,
|
|
39
|
+
onChange: n.func.isRequired
|
|
40
|
+
};
|
|
41
|
+
constructor(e) {
|
|
42
|
+
super(e), this.state = {
|
|
43
|
+
value: "",
|
|
44
|
+
focused: !1
|
|
45
|
+
}, this.onKeyDown = (e) => {
|
|
46
|
+
if (e.keyCode === c && this.state.value !== "") {
|
|
47
|
+
let e = this.state.value.trim(), t = o(this.props.tags.concat([e]));
|
|
48
|
+
t.length !== this.props.tags.length && (this.props.onChange(t), this.setState({ value: "" }));
|
|
49
|
+
}
|
|
50
|
+
}, this.onChange = (e) => {
|
|
51
|
+
this.setState({ value: e.target.value });
|
|
52
|
+
}, this.deleteTag = (e) => {
|
|
53
|
+
let { tags: t } = this.props, n = t.indexOf(e);
|
|
54
|
+
n !== -1 && (t.splice(n, 1), this.props.onChange(t), this.input.focus());
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
onFocus = () => {
|
|
58
|
+
this.setState({ focused: !0 });
|
|
59
|
+
};
|
|
60
|
+
onBlur = () => {
|
|
61
|
+
this.setState({ focused: !1 });
|
|
62
|
+
};
|
|
63
|
+
render() {
|
|
64
|
+
let { tags: t } = this.props;
|
|
65
|
+
return /* @__PURE__ */ i(e, {
|
|
66
|
+
focused: this.state.focused,
|
|
67
|
+
children: /* @__PURE__ */ a(d, { children: [(t || []).map((e, t) => /* @__PURE__ */ i(u, {
|
|
68
|
+
label: e,
|
|
69
|
+
onDelete: () => this.deleteTag(e)
|
|
70
|
+
}, t)), /* @__PURE__ */ i(f, {
|
|
71
|
+
ref: (e) => this.input = e,
|
|
72
|
+
onKeyDown: this.onKeyDown,
|
|
73
|
+
onChange: this.onChange,
|
|
74
|
+
value: this.state.value,
|
|
75
|
+
onFocus: this.onFocus,
|
|
76
|
+
onBlur: this.onBlur,
|
|
77
|
+
type: "text"
|
|
78
|
+
})] })
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { p as default };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/config-ui/src/two-choice.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 class NChoice extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
header: PropTypes.Validator<string>;
|
|
14
|
+
className: PropTypes.Requireable<string>;
|
|
15
|
+
customLabel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
+
opts: PropTypes.Validator<any[]>;
|
|
17
|
+
value: PropTypes.Requireable<string>;
|
|
18
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
+
direction: PropTypes.Requireable<string>;
|
|
20
|
+
};
|
|
21
|
+
handleChange: any;
|
|
22
|
+
render(): JSX.Element;
|
|
23
|
+
}
|
|
24
|
+
export { NChoice };
|
|
25
|
+
declare class TwoChoice extends React.Component {
|
|
26
|
+
static propTypes: {
|
|
27
|
+
header: PropTypes.Validator<string>;
|
|
28
|
+
value: PropTypes.Validator<string>;
|
|
29
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
30
|
+
one: PropTypes.Requireable<NonNullable<string | PropTypes.InferProps<{
|
|
31
|
+
label: PropTypes.Requireable<string>;
|
|
32
|
+
value: PropTypes.Requireable<string>;
|
|
33
|
+
}> | null | undefined>>;
|
|
34
|
+
two: PropTypes.Requireable<NonNullable<string | PropTypes.InferProps<{
|
|
35
|
+
label: PropTypes.Requireable<string>;
|
|
36
|
+
value: PropTypes.Requireable<string>;
|
|
37
|
+
}> | null | undefined>>;
|
|
38
|
+
className: PropTypes.Requireable<string>;
|
|
39
|
+
customLabel: PropTypes.Requireable<(...args: any[]) => any>;
|
|
40
|
+
};
|
|
41
|
+
render(): JSX.Element;
|
|
42
|
+
}
|
|
43
|
+
export default TwoChoice;
|
|
44
|
+
//# sourceMappingURL=two-choice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"two-choice.d.ts","sourceRoot":"","sources":["../src/two-choice.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AA+BH,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,cAAM,OAAQ,SAAQ,KAAK,CAAC,SAAS;IACnC,MAAM,CAAC,SAAS;;;;;;;;MAQd;IAEF,YAAY,EAAE,GAAG,CAEf;IAEF,MAAM;CAwBP;AAED,OAAO,EAAE,OAAO,EAAE,CAAC;AAInB,cAAM,SAAU,SAAQ,KAAK,CAAC,SAAS;IACrC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;MAQd;IAEF,MAAM;CAeP;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import e from "./radio-with-label.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 } from "react/jsx-runtime";
|
|
6
|
+
import * as a from "@pie-lib/render-ui";
|
|
7
|
+
import { InputContainer as o } from "@pie-lib/render-ui";
|
|
8
|
+
//#region src/two-choice.tsx
|
|
9
|
+
function s(e) {
|
|
10
|
+
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
11
|
+
}
|
|
12
|
+
function c(e, t) {
|
|
13
|
+
return !e || s(e) ? e : s(e.default) ? e.default : t && s(e[t]) ? e[t] : t && s(e[t]?.default) ? e[t].default : e;
|
|
14
|
+
}
|
|
15
|
+
var l = c(o, "InputContainer") || c(f.InputContainer, "InputContainer"), u = a, d = u.default, f = d && typeof d == "object" ? d : u, p = r("div")(({ theme: e, direction: t }) => ({
|
|
16
|
+
display: "flex",
|
|
17
|
+
flexWrap: "wrap",
|
|
18
|
+
paddingLeft: 0,
|
|
19
|
+
marginTop: e.spacing(1),
|
|
20
|
+
...t === "vertical" && { flexDirection: "column" }
|
|
21
|
+
})), m = class extends t.Component {
|
|
22
|
+
static propTypes = {
|
|
23
|
+
header: n.string.isRequired,
|
|
24
|
+
className: n.string,
|
|
25
|
+
customLabel: n.func,
|
|
26
|
+
opts: n.array.isRequired,
|
|
27
|
+
value: n.string,
|
|
28
|
+
onChange: n.func.isRequired,
|
|
29
|
+
direction: n.oneOf(["horizontal", "vertical"])
|
|
30
|
+
};
|
|
31
|
+
handleChange = (e) => {
|
|
32
|
+
this.props.onChange(e.currentTarget.value);
|
|
33
|
+
};
|
|
34
|
+
render() {
|
|
35
|
+
let { header: t, className: n, customLabel: r, opts: a, value: o, direction: s } = this.props, c = a.map((e) => typeof e == "string" ? {
|
|
36
|
+
label: e,
|
|
37
|
+
value: e
|
|
38
|
+
} : e), u = r || e;
|
|
39
|
+
return /* @__PURE__ */ i(l, {
|
|
40
|
+
label: t,
|
|
41
|
+
className: n,
|
|
42
|
+
children: /* @__PURE__ */ i(p, {
|
|
43
|
+
direction: s,
|
|
44
|
+
children: c.map((e, t) => /* @__PURE__ */ i(u, {
|
|
45
|
+
value: e.value,
|
|
46
|
+
checked: e.value === o,
|
|
47
|
+
onChange: this.handleChange,
|
|
48
|
+
label: e.label
|
|
49
|
+
}, t))
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, h = n.shape({
|
|
54
|
+
label: n.string,
|
|
55
|
+
value: n.string
|
|
56
|
+
}), g = class extends t.Component {
|
|
57
|
+
static propTypes = {
|
|
58
|
+
header: n.string.isRequired,
|
|
59
|
+
value: n.string.isRequired,
|
|
60
|
+
onChange: n.func.isRequired,
|
|
61
|
+
one: n.oneOfType([h, n.string]),
|
|
62
|
+
two: n.oneOfType([h, n.string]),
|
|
63
|
+
className: n.string,
|
|
64
|
+
customLabel: n.func
|
|
65
|
+
};
|
|
66
|
+
render() {
|
|
67
|
+
let { one: e, two: t, header: n, className: r, customLabel: a, value: o, onChange: s } = this.props;
|
|
68
|
+
return /* @__PURE__ */ i(m, {
|
|
69
|
+
customLabel: a,
|
|
70
|
+
header: n,
|
|
71
|
+
className: r,
|
|
72
|
+
opts: [e, t],
|
|
73
|
+
value: o,
|
|
74
|
+
onChange: s
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { m as NChoice, g as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/config-ui/src/with-stateful-model.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 withStatefulModel: (Component: any) => {
|
|
11
|
+
new (props: any): {
|
|
12
|
+
UNSAFE_componentWillReceiveProps(props: any): void;
|
|
13
|
+
onChange: any;
|
|
14
|
+
render(): JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
propTypes: {
|
|
17
|
+
model: PropTypes.Validator<object>;
|
|
18
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default withStatefulModel;
|
|
22
|
+
//# sourceMappingURL=with-stateful-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-stateful-model.d.ts","sourceRoot":"","sources":["../src/with-stateful-model.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,QAAA,MAAM,iBAAiB,GAAI,cAAS;;;kBAkBtB,GAAG;;;;;;;CAYhB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/with-stateful-model.tsx
|
|
5
|
+
var r = (r) => {
|
|
6
|
+
class i extends e.Component {
|
|
7
|
+
static propTypes = {
|
|
8
|
+
model: t.object.isRequired,
|
|
9
|
+
onChange: t.func.isRequired
|
|
10
|
+
};
|
|
11
|
+
constructor(e) {
|
|
12
|
+
super(e), this.state = { model: e.model };
|
|
13
|
+
}
|
|
14
|
+
UNSAFE_componentWillReceiveProps(e) {
|
|
15
|
+
this.setState({ model: e.model });
|
|
16
|
+
}
|
|
17
|
+
onChange = (e) => {
|
|
18
|
+
this.setState({ model: e }, () => {
|
|
19
|
+
this.props.onChange(this.state.model);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
render() {
|
|
23
|
+
return /* @__PURE__ */ n(r, {
|
|
24
|
+
model: this.state.model,
|
|
25
|
+
onChange: this.onChange
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return i;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { r as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pie-lib/config-ui",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React implementation of @pie-lib/config-ui synced from pie-lib",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@emotion/react": "^11.14.0",
|
|
7
|
+
"@emotion/style": "^0.8.0",
|
|
8
|
+
"@mui/icons-material": "^7.3.4",
|
|
9
|
+
"@mui/material": "^7.3.4",
|
|
10
|
+
"@pie-lib/editable-html-tip-tap": "0.1.0",
|
|
11
|
+
"@pie-lib/icons": "0.1.0",
|
|
12
|
+
"@pie-lib/render-ui": "0.1.0",
|
|
13
|
+
"assert": "^1.4.1",
|
|
14
|
+
"debug": "^4.1.1",
|
|
15
|
+
"lodash-es": "^4.17.23",
|
|
16
|
+
"mathjs": "^7.0.1",
|
|
17
|
+
"prop-types": "^15.6.2",
|
|
18
|
+
"react-measure": "^2.2.2",
|
|
19
|
+
"react": "^18.2.0"
|
|
20
|
+
},
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"src"
|
|
33
|
+
],
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "bun x vite build && bun x tsc --emitDeclarationOnly",
|
|
37
|
+
"dev": "bun x vite",
|
|
38
|
+
"test": "bun x vitest run"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/config-ui/src/alert-dialog.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle } from '@mui/material';
|
|
14
|
+
import { styled } from '@mui/material/styles';
|
|
15
|
+
|
|
16
|
+
const StyledDialogTitle: any = styled(DialogTitle)(() => ({
|
|
17
|
+
fontSize: 'max(1.25rem, 18px)',
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const StyledDialogContentText: any = styled(DialogContentText)(() => ({
|
|
21
|
+
fontSize: 'max(1rem, 14px)',
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
const AlertDialog = ({
|
|
25
|
+
text,
|
|
26
|
+
title,
|
|
27
|
+
onClose,
|
|
28
|
+
onConfirm,
|
|
29
|
+
open,
|
|
30
|
+
onCloseText,
|
|
31
|
+
onConfirmText,
|
|
32
|
+
disableAutoFocus,
|
|
33
|
+
disableEnforceFocus,
|
|
34
|
+
disableRestoreFocus,
|
|
35
|
+
}) => (
|
|
36
|
+
<Dialog
|
|
37
|
+
open={open}
|
|
38
|
+
disableAutoFocus={disableAutoFocus}
|
|
39
|
+
disableEnforceFocus={disableEnforceFocus}
|
|
40
|
+
disableRestoreFocus={disableRestoreFocus}
|
|
41
|
+
onClose={onClose}
|
|
42
|
+
>
|
|
43
|
+
{title && <StyledDialogTitle>{title}</StyledDialogTitle>}
|
|
44
|
+
{text && (
|
|
45
|
+
<DialogContent>
|
|
46
|
+
<StyledDialogContentText>{text}</StyledDialogContentText>
|
|
47
|
+
</DialogContent>
|
|
48
|
+
)}
|
|
49
|
+
<DialogActions>
|
|
50
|
+
{onClose && (
|
|
51
|
+
<Button onClick={onClose} color="primary">
|
|
52
|
+
{onCloseText}
|
|
53
|
+
</Button>
|
|
54
|
+
)}
|
|
55
|
+
{onConfirm && (
|
|
56
|
+
<Button autoFocus onClick={onConfirm} color="primary">
|
|
57
|
+
{onConfirmText}
|
|
58
|
+
</Button>
|
|
59
|
+
)}
|
|
60
|
+
</DialogActions>
|
|
61
|
+
</Dialog>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
AlertDialog.defaultProps = {
|
|
65
|
+
onCloseText: 'CANCEL',
|
|
66
|
+
onConfirmText: 'OK',
|
|
67
|
+
disableAutoFocus: false,
|
|
68
|
+
disableEnforceFocus: false,
|
|
69
|
+
disableRestoreFocus: false,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
AlertDialog.propTypes = {
|
|
73
|
+
text: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
|
74
|
+
title: PropTypes.string,
|
|
75
|
+
onClose: PropTypes.func,
|
|
76
|
+
onConfirm: PropTypes.func,
|
|
77
|
+
open: PropTypes.bool,
|
|
78
|
+
onConfirmText: PropTypes.string,
|
|
79
|
+
onCloseText: PropTypes.string,
|
|
80
|
+
disableAutoFocus: PropTypes.bool,
|
|
81
|
+
disableEnforceFocus: PropTypes.bool,
|
|
82
|
+
disableRestoreFocus: PropTypes.bool,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export default AlertDialog;
|
package/src/checkbox.tsx
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* @synced-from pie-lib/packages/config-ui/src/checkbox.jsx
|
|
4
|
+
* @auto-generated
|
|
5
|
+
*
|
|
6
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
7
|
+
* Manual edits will be overwritten on next sync.
|
|
8
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import FormControlLabel from '@mui/material/FormControlLabel';
|
|
12
|
+
import MuiCheckbox from '@mui/material/Checkbox';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import { styled } from '@mui/material/styles';
|
|
16
|
+
import { color } from '@pie-lib/render-ui';
|
|
17
|
+
import { grey } from '@mui/material/colors';
|
|
18
|
+
|
|
19
|
+
const StyledFormControlLabel: any = styled(FormControlLabel)(({ theme, mini }) => ({
|
|
20
|
+
margin: 0,
|
|
21
|
+
marginLeft: 0,
|
|
22
|
+
padding: 0,
|
|
23
|
+
'& .MuiFormControlLabel-label': {
|
|
24
|
+
fontSize: theme.typography.fontSize - 1,
|
|
25
|
+
transform: 'translate(-4%, 2%)',
|
|
26
|
+
color: 'rgba(0,0,0,1.0)',
|
|
27
|
+
...(mini && {
|
|
28
|
+
marginLeft: theme.spacing(1),
|
|
29
|
+
color: grey[700],
|
|
30
|
+
fontSize: theme.typography.fontSize - 3,
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
const StyledCheckbox: any = styled(MuiCheckbox)(({ theme, mini, error }) => ({
|
|
36
|
+
color: `${color.tertiary()} !important`,
|
|
37
|
+
...(mini && {
|
|
38
|
+
margin: 0,
|
|
39
|
+
padding: 0,
|
|
40
|
+
width: theme.spacing(3),
|
|
41
|
+
height: theme.spacing(3),
|
|
42
|
+
}),
|
|
43
|
+
...(error && {
|
|
44
|
+
color: `${theme.palette.error.main} !important`,
|
|
45
|
+
}),
|
|
46
|
+
}));
|
|
47
|
+
|
|
48
|
+
const Checkbox = ({ mini, checked, onChange, value, label, error }) => (
|
|
49
|
+
<StyledFormControlLabel
|
|
50
|
+
mini={mini}
|
|
51
|
+
control={<StyledCheckbox checked={checked} onChange={onChange} value={value} mini={mini} error={error} />}
|
|
52
|
+
label={label}
|
|
53
|
+
/>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
Checkbox.propTypes = {
|
|
57
|
+
mini: PropTypes.bool,
|
|
58
|
+
checked: PropTypes.bool.isRequired,
|
|
59
|
+
onChange: PropTypes.func.isRequired,
|
|
60
|
+
value: PropTypes.string,
|
|
61
|
+
label: PropTypes.string.isRequired,
|
|
62
|
+
error: PropTypes.bool,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
Checkbox.defaultProps = {
|
|
66
|
+
value: '',
|
|
67
|
+
mini: false,
|
|
68
|
+
error: false,
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export default Checkbox;
|