@pie-lib/render-ui 6.1.1-next.37 → 6.1.1-next.57
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/CHANGELOG.json +1 -0
- package/CHANGELOG.md +1144 -0
- package/LICENSE.md +5 -0
- package/lib/assets/enableAudioAutoplayImage.js +8 -0
- package/lib/assets/enableAudioAutoplayImage.js.map +1 -0
- package/lib/collapsible/index.js +105 -0
- package/lib/collapsible/index.js.map +1 -0
- package/lib/color.js +235 -0
- package/lib/color.js.map +1 -0
- package/lib/feedback.js +112 -0
- package/lib/feedback.js.map +1 -0
- package/lib/has-media.js +22 -0
- package/lib/has-media.js.map +1 -0
- package/lib/has-text.js +22 -0
- package/lib/has-text.js.map +1 -0
- package/lib/html-and-math.js +54 -0
- package/lib/html-and-math.js.map +1 -0
- package/lib/index.js +113 -0
- package/lib/index.js.map +1 -0
- package/lib/input-container.js +59 -0
- package/lib/input-container.js.map +1 -0
- package/lib/preview-layout.js +65 -0
- package/lib/preview-layout.js.map +1 -0
- package/lib/preview-prompt.js +299 -0
- package/lib/preview-prompt.js.map +1 -0
- package/lib/purpose.js +22 -0
- package/lib/purpose.js.map +1 -0
- package/lib/readable.js +22 -0
- package/lib/readable.js.map +1 -0
- package/lib/response-indicators.js +102 -0
- package/lib/response-indicators.js.map +1 -0
- package/lib/transform-headings.js +53 -0
- package/lib/transform-headings.js.map +1 -0
- package/lib/ui-layout.js +125 -0
- package/lib/ui-layout.js.map +1 -0
- package/lib/withUndoReset.js +135 -0
- package/lib/withUndoReset.js.map +1 -0
- package/package.json +20 -32
- package/src/__tests__/color.test.js +259 -0
- package/src/__tests__/feedback.test.jsx +279 -0
- package/src/__tests__/has-media.test.js +19 -0
- package/src/__tests__/has-text.test.js +20 -0
- package/src/__tests__/html-and-math.test.js +36 -0
- package/src/__tests__/input-container.test.jsx +328 -0
- package/src/__tests__/preview-layout.test.jsx +349 -0
- package/src/__tests__/preview-prompt.test.jsx +379 -0
- package/src/__tests__/purpose.test.jsx +51 -0
- package/src/__tests__/readable.test.jsx +69 -0
- package/src/__tests__/response-indicators.test.jsx +111 -0
- package/src/__tests__/ui-layout.test.jsx +52 -0
- package/src/__tests__/withUndoReset.test.jsx +176 -0
- package/src/assets/enableAudioAutoplayImage.js +1 -0
- package/src/collapsible/__tests__/index.test.jsx +39 -0
- package/src/collapsible/index.jsx +64 -0
- package/src/color.js +139 -0
- package/src/feedback.jsx +84 -0
- package/src/has-media.js +16 -0
- package/src/has-text.js +18 -0
- package/src/html-and-math.js +21 -0
- package/src/index.js +35 -0
- package/src/input-container.jsx +47 -0
- package/src/preview-layout.jsx +41 -0
- package/src/preview-prompt.jsx +280 -0
- package/src/purpose.jsx +17 -0
- package/src/readable.jsx +19 -0
- package/src/response-indicators.jsx +82 -0
- package/{dist/transform-headings.d.ts → src/transform-headings.js} +30 -9
- package/src/ui-layout.jsx +96 -0
- package/src/withUndoReset.jsx +114 -0
- package/dist/_virtual/_rolldown/runtime.js +0 -11
- package/dist/assets/enableAudioAutoplayImage.d.ts +0 -10
- package/dist/assets/enableAudioAutoplayImage.js +0 -4
- package/dist/collapsible/index.d.ts +0 -31
- package/dist/collapsible/index.js +0 -53
- package/dist/color.d.ts +0 -116
- package/dist/color.js +0 -120
- package/dist/feedback.d.ts +0 -20
- package/dist/feedback.js +0 -65
- package/dist/has-media.d.ts +0 -9
- package/dist/has-media.js +0 -10
- package/dist/has-text.d.ts +0 -9
- package/dist/has-text.js +0 -10
- package/dist/html-and-math.d.ts +0 -22
- package/dist/html-and-math.js +0 -25
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -18
- package/dist/inline-menu.d.ts +0 -33
- package/dist/inline-menu.js +0 -29
- package/dist/input-container.d.ts +0 -23
- package/dist/input-container.js +0 -39
- package/dist/preview-layout.d.ts +0 -24
- package/dist/preview-layout.js +0 -37
- package/dist/preview-prompt.d.ts +0 -38
- package/dist/preview-prompt.js +0 -154
- package/dist/purpose.d.ts +0 -18
- package/dist/purpose.js +0 -11
- package/dist/readable.d.ts +0 -18
- package/dist/readable.js +0 -11
- package/dist/response-indicators.d.ts +0 -121
- package/dist/response-indicators.js +0 -62
- package/dist/transform-headings.js +0 -15
- package/dist/ui-layout.d.ts +0 -31
- package/dist/ui-layout.js +0 -55
- package/dist/withUndoReset.d.ts +0 -47
- package/dist/withUndoReset.js +0 -84
package/dist/readable.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { Fragment as n, jsx as r } from "react/jsx-runtime";
|
|
4
|
-
//#region src/readable.tsx
|
|
5
|
-
var i = (t) => /* @__PURE__ */ r(n, { children: e.Children.map(t.children, (n) => e.cloneElement(n, { "data-pie-readable": t.false === void 0 })) });
|
|
6
|
-
i.propTypes = {
|
|
7
|
-
children: t.node,
|
|
8
|
-
false: t.bool
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { i as default };
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/render-ui/src/response-indicators.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
|
-
export declare const Correct: {
|
|
11
|
-
new (props: any): {
|
|
12
|
-
handlePopoverOpen: any;
|
|
13
|
-
handlePopoverClose: any;
|
|
14
|
-
render(): React.JSX.Element;
|
|
15
|
-
context: unknown;
|
|
16
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
17
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
18
|
-
readonly props: Readonly<{}>;
|
|
19
|
-
state: Readonly<{}>;
|
|
20
|
-
refs: {
|
|
21
|
-
[key: string]: React.ReactInstance;
|
|
22
|
-
};
|
|
23
|
-
componentDidMount?(): void;
|
|
24
|
-
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
25
|
-
componentWillUnmount?(): void;
|
|
26
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
27
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
28
|
-
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
29
|
-
componentWillMount?(): void;
|
|
30
|
-
UNSAFE_componentWillMount?(): void;
|
|
31
|
-
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
32
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
33
|
-
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
34
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
35
|
-
};
|
|
36
|
-
contextType?: React.Context<any> | undefined;
|
|
37
|
-
};
|
|
38
|
-
export declare const Incorrect: {
|
|
39
|
-
new (props: any): {
|
|
40
|
-
handlePopoverOpen: any;
|
|
41
|
-
handlePopoverClose: any;
|
|
42
|
-
render(): React.JSX.Element;
|
|
43
|
-
context: unknown;
|
|
44
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
45
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
46
|
-
readonly props: Readonly<{}>;
|
|
47
|
-
state: Readonly<{}>;
|
|
48
|
-
refs: {
|
|
49
|
-
[key: string]: React.ReactInstance;
|
|
50
|
-
};
|
|
51
|
-
componentDidMount?(): void;
|
|
52
|
-
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
53
|
-
componentWillUnmount?(): void;
|
|
54
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
55
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
56
|
-
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
57
|
-
componentWillMount?(): void;
|
|
58
|
-
UNSAFE_componentWillMount?(): void;
|
|
59
|
-
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
60
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
61
|
-
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
62
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
63
|
-
};
|
|
64
|
-
contextType?: React.Context<any> | undefined;
|
|
65
|
-
};
|
|
66
|
-
export declare const PartiallyCorrect: {
|
|
67
|
-
new (props: any): {
|
|
68
|
-
handlePopoverOpen: any;
|
|
69
|
-
handlePopoverClose: any;
|
|
70
|
-
render(): React.JSX.Element;
|
|
71
|
-
context: unknown;
|
|
72
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
73
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
74
|
-
readonly props: Readonly<{}>;
|
|
75
|
-
state: Readonly<{}>;
|
|
76
|
-
refs: {
|
|
77
|
-
[key: string]: React.ReactInstance;
|
|
78
|
-
};
|
|
79
|
-
componentDidMount?(): void;
|
|
80
|
-
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
81
|
-
componentWillUnmount?(): void;
|
|
82
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
83
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
84
|
-
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
85
|
-
componentWillMount?(): void;
|
|
86
|
-
UNSAFE_componentWillMount?(): void;
|
|
87
|
-
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
88
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
89
|
-
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
90
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
91
|
-
};
|
|
92
|
-
contextType?: React.Context<any> | undefined;
|
|
93
|
-
};
|
|
94
|
-
export declare const NothingSubmitted: {
|
|
95
|
-
new (props: any): {
|
|
96
|
-
handlePopoverOpen: any;
|
|
97
|
-
handlePopoverClose: any;
|
|
98
|
-
render(): React.JSX.Element;
|
|
99
|
-
context: unknown;
|
|
100
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
101
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
102
|
-
readonly props: Readonly<{}>;
|
|
103
|
-
state: Readonly<{}>;
|
|
104
|
-
refs: {
|
|
105
|
-
[key: string]: React.ReactInstance;
|
|
106
|
-
};
|
|
107
|
-
componentDidMount?(): void;
|
|
108
|
-
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
109
|
-
componentWillUnmount?(): void;
|
|
110
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
111
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
112
|
-
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
113
|
-
componentWillMount?(): void;
|
|
114
|
-
UNSAFE_componentWillMount?(): void;
|
|
115
|
-
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
116
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
117
|
-
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
118
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
119
|
-
};
|
|
120
|
-
contextType?: React.Context<any> | undefined;
|
|
121
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { __exportAll as e } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import t from "./feedback.js";
|
|
3
|
-
import n from "react";
|
|
4
|
-
import r from "prop-types";
|
|
5
|
-
import * as i from "@pie-lib/icons";
|
|
6
|
-
import a from "@mui/material/Popover";
|
|
7
|
-
import { styled as o } from "@mui/material/styles";
|
|
8
|
-
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
9
|
-
import l from "debug";
|
|
10
|
-
//#region src/response-indicators.tsx
|
|
11
|
-
var u = /* @__PURE__ */ e({
|
|
12
|
-
Correct: () => g,
|
|
13
|
-
Incorrect: () => _,
|
|
14
|
-
NothingSubmitted: () => y,
|
|
15
|
-
PartiallyCorrect: () => v
|
|
16
|
-
}), d = l("pie-libs:render-ui:response-indicators"), f = o("div")(({ hasFeedback: e }) => ({ cursor: e ? "pointer" : "default" })), p = o(a)({ cursor: "pointer" }), m = o("div")({
|
|
17
|
-
padding: "0",
|
|
18
|
-
borderRadius: "4px"
|
|
19
|
-
}), h = (e, i) => {
|
|
20
|
-
class a extends n.Component {
|
|
21
|
-
constructor(e) {
|
|
22
|
-
super(e), this.state = {};
|
|
23
|
-
}
|
|
24
|
-
handlePopoverOpen = (e) => {
|
|
25
|
-
d("[handlePopoverOpen]", e.target), this.setState({ anchorEl: e.target });
|
|
26
|
-
};
|
|
27
|
-
handlePopoverClose = () => {
|
|
28
|
-
this.setState({ anchorEl: null });
|
|
29
|
-
};
|
|
30
|
-
render() {
|
|
31
|
-
let { feedback: n } = this.props, { anchorEl: r } = this.state;
|
|
32
|
-
return /* @__PURE__ */ c(f, {
|
|
33
|
-
hasFeedback: !!n,
|
|
34
|
-
children: [/* @__PURE__ */ s("span", {
|
|
35
|
-
ref: (e) => this.icon = e,
|
|
36
|
-
onClick: this.handlePopoverOpen,
|
|
37
|
-
children: /* @__PURE__ */ s(e, {})
|
|
38
|
-
}), n && /* @__PURE__ */ s(p, {
|
|
39
|
-
PaperComponent: m,
|
|
40
|
-
open: !!r,
|
|
41
|
-
anchorEl: r,
|
|
42
|
-
anchorOrigin: {
|
|
43
|
-
vertical: "bottom",
|
|
44
|
-
horizontal: "left"
|
|
45
|
-
},
|
|
46
|
-
transformOrigin: {
|
|
47
|
-
vertical: "top",
|
|
48
|
-
horizontal: "left"
|
|
49
|
-
},
|
|
50
|
-
onClose: this.handlePopoverClose,
|
|
51
|
-
children: /* @__PURE__ */ s(t, {
|
|
52
|
-
feedback: n,
|
|
53
|
-
correctness: i
|
|
54
|
-
})
|
|
55
|
-
})]
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return a.propTypes = { feedback: r.string }, a;
|
|
60
|
-
}, g = h(i.Correct, "correct"), _ = h(i.Incorrect, "incorrect"), v = h(i.PartiallyCorrect, "partially-correct"), y = h(i.NothingSubmitted, "nothing-submitted");
|
|
61
|
-
//#endregion
|
|
62
|
-
export { u as response_indicators_exports };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/transform-headings.tsx
|
|
2
|
-
function e(e = "", t = 2) {
|
|
3
|
-
if (!e) return e;
|
|
4
|
-
let n = new DOMParser().parseFromString(e, "text/html");
|
|
5
|
-
return n.body.querySelectorAll("[data-heading]").forEach((e) => {
|
|
6
|
-
let r = e.getAttribute("data-heading") || "", i = parseInt(r.replace("heading", ""), 10);
|
|
7
|
-
if (!Number.isFinite(i)) return;
|
|
8
|
-
let a = Math.min(6, Math.max(1, t + i - 1)), o = n.createElement(`h${a}`);
|
|
9
|
-
o.setAttribute("data-heading", r), Array.from(e.attributes).forEach((e) => {
|
|
10
|
-
e.name !== "data-heading" && o.setAttribute(e.name, e.value);
|
|
11
|
-
}), o.innerHTML = e.innerHTML, e.replaceWith(o);
|
|
12
|
-
}), n.body.innerHTML;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { e as transformDataHeadings };
|
package/dist/ui-layout.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/render-ui/src/ui-layout.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 class UiLayout extends React.Component {
|
|
12
|
-
static propTypes: {
|
|
13
|
-
className: PropTypes.Requireable<string>;
|
|
14
|
-
children: PropTypes.Requireable<any[]>;
|
|
15
|
-
extraCSSRules: PropTypes.Requireable<PropTypes.InferProps<{
|
|
16
|
-
names: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
17
|
-
rules: PropTypes.Requireable<string>;
|
|
18
|
-
}>>;
|
|
19
|
-
fontSizeFactor: PropTypes.Requireable<number>;
|
|
20
|
-
};
|
|
21
|
-
static defaultProps: {
|
|
22
|
-
extraCSSRules: {};
|
|
23
|
-
fontSizeFactor: number;
|
|
24
|
-
};
|
|
25
|
-
constructor(props: any);
|
|
26
|
-
computeStyle(fontSizeFactor: any): {
|
|
27
|
-
fontSize: string;
|
|
28
|
-
} | null;
|
|
29
|
-
render(): React.JSX.Element;
|
|
30
|
-
}
|
|
31
|
-
export default UiLayout;
|
package/dist/ui-layout.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { StyledEngineProvider as n, ThemeProvider as r, createTheme as i, styled as a } from "@mui/material/styles";
|
|
4
|
-
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
|
-
//#region src/ui-layout.tsx
|
|
6
|
-
var c = i({
|
|
7
|
-
typography: { fontFamily: "inherit" },
|
|
8
|
-
palette: { action: { disabled: "rgba(0, 0, 0, 0.54);" } },
|
|
9
|
-
components: {
|
|
10
|
-
MuiTypography: { styleOverrides: { root: { fontFamily: "inherit" } } },
|
|
11
|
-
MuiButton: { styleOverrides: { contained: {
|
|
12
|
-
backgroundColor: "#e0e0e0",
|
|
13
|
-
color: "#000000",
|
|
14
|
-
"&:hover": { backgroundColor: "#bdbdbd" }
|
|
15
|
-
} } }
|
|
16
|
-
}
|
|
17
|
-
}), l = a("div")({ "& table, th, td": { fontSize: "inherit" } }), u = class extends e.Component {
|
|
18
|
-
static propTypes = {
|
|
19
|
-
className: t.string,
|
|
20
|
-
children: t.array,
|
|
21
|
-
extraCSSRules: t.shape({
|
|
22
|
-
names: t.arrayOf(t.string),
|
|
23
|
-
rules: t.string
|
|
24
|
-
}),
|
|
25
|
-
fontSizeFactor: t.number
|
|
26
|
-
};
|
|
27
|
-
static defaultProps = {
|
|
28
|
-
extraCSSRules: {},
|
|
29
|
-
fontSizeFactor: 1
|
|
30
|
-
};
|
|
31
|
-
constructor(e) {
|
|
32
|
-
super(e), this.classesSheet = document.createElement("style");
|
|
33
|
-
}
|
|
34
|
-
computeStyle(e) {
|
|
35
|
-
let t = (e) => parseFloat(getComputedStyle(e).fontSize), n = t(document.documentElement), r = t(document.body), i = Math.max(n, r), a = e != null && typeof e == "number" ? e : 1;
|
|
36
|
-
return a === 1 ? null : { fontSize: `${i * a}px` };
|
|
37
|
-
}
|
|
38
|
-
render() {
|
|
39
|
-
let { children: e, className: t, fontSizeFactor: i, ...a } = this.props, { extraCSSRules: u, ...d } = a, f = this.computeStyle(i);
|
|
40
|
-
return /* @__PURE__ */ o(n, {
|
|
41
|
-
injectFirst: !0,
|
|
42
|
-
children: /* @__PURE__ */ s(r, {
|
|
43
|
-
theme: c,
|
|
44
|
-
children: [u?.rules ? /* @__PURE__ */ o("style", { dangerouslySetInnerHTML: { __html: `.extraCSSRules { ${u.rules} }` } }) : null, /* @__PURE__ */ o(l, {
|
|
45
|
-
className: `${t} extraCSSRules`,
|
|
46
|
-
...d,
|
|
47
|
-
...f && { style: f },
|
|
48
|
-
children: e
|
|
49
|
-
})]
|
|
50
|
-
})
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
//#endregion
|
|
55
|
-
export { u as default };
|
package/dist/withUndoReset.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-lib/packages/render-ui/src/withUndoReset.jsx
|
|
3
|
-
* @auto-generated
|
|
4
|
-
*
|
|
5
|
-
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
-
* Manual edits will be overwritten on next sync.
|
|
7
|
-
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
-
*/
|
|
9
|
-
import * as React from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
/**
|
|
12
|
-
* HOC that adds undo and reset functionality for session values
|
|
13
|
-
*/
|
|
14
|
-
declare const withUndoReset: (WrappedComponent: any) => {
|
|
15
|
-
new (props: any): {
|
|
16
|
-
onSessionChange: any;
|
|
17
|
-
onUndo: any;
|
|
18
|
-
onReset: any;
|
|
19
|
-
render(): React.JSX.Element;
|
|
20
|
-
context: unknown;
|
|
21
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<{}>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
22
|
-
forceUpdate(callback?: (() => void) | undefined): void;
|
|
23
|
-
readonly props: Readonly<{}>;
|
|
24
|
-
state: Readonly<{}>;
|
|
25
|
-
refs: {
|
|
26
|
-
[key: string]: React.ReactInstance;
|
|
27
|
-
};
|
|
28
|
-
componentDidMount?(): void;
|
|
29
|
-
shouldComponentUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
30
|
-
componentWillUnmount?(): void;
|
|
31
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
32
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>): any;
|
|
33
|
-
componentDidUpdate?(prevProps: Readonly<{}>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
34
|
-
componentWillMount?(): void;
|
|
35
|
-
UNSAFE_componentWillMount?(): void;
|
|
36
|
-
componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
37
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<{}>, nextContext: any): void;
|
|
38
|
-
componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
39
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<{}>, nextState: Readonly<{}>, nextContext: any): void;
|
|
40
|
-
};
|
|
41
|
-
propTypes: {
|
|
42
|
-
session: PropTypes.Requireable<object>;
|
|
43
|
-
onSessionChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
44
|
-
};
|
|
45
|
-
contextType?: React.Context<any> | undefined;
|
|
46
|
-
};
|
|
47
|
-
export default withUndoReset;
|
package/dist/withUndoReset.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import * as 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/Button";
|
|
6
|
-
import o from "@mui/icons-material/Restore";
|
|
7
|
-
import s from "@mui/icons-material/Undo";
|
|
8
|
-
//#region src/withUndoReset.tsx
|
|
9
|
-
var c = n("div")({
|
|
10
|
-
display: "flex",
|
|
11
|
-
flexDirection: "column"
|
|
12
|
-
}), l = n("div")({
|
|
13
|
-
display: "flex",
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
justifyContent: "center"
|
|
16
|
-
}), u = n("div")(({ theme: e }) => ({
|
|
17
|
-
width: "24px",
|
|
18
|
-
height: "24px",
|
|
19
|
-
color: "gray",
|
|
20
|
-
marginRight: e.spacing(1),
|
|
21
|
-
display: "flex",
|
|
22
|
-
alignItems: "center"
|
|
23
|
-
})), d = n(a)(({ theme: e }) => ({
|
|
24
|
-
display: "flex",
|
|
25
|
-
alignItems: "center",
|
|
26
|
-
marginLeft: e.spacing(3),
|
|
27
|
-
marginRight: e.spacing(3)
|
|
28
|
-
})), f = (n) => {
|
|
29
|
-
class a extends e.Component {
|
|
30
|
-
static propTypes = {
|
|
31
|
-
session: t.object,
|
|
32
|
-
onSessionChange: t.func
|
|
33
|
-
};
|
|
34
|
-
constructor(e) {
|
|
35
|
-
super(e), this.state = {
|
|
36
|
-
sessionInitialValues: JSON.parse(JSON.stringify(e.session)),
|
|
37
|
-
session: e.session,
|
|
38
|
-
changes: []
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
onSessionChange = (e) => {
|
|
42
|
-
this.setState((t) => ({
|
|
43
|
-
session: e,
|
|
44
|
-
changes: [...t.changes, e]
|
|
45
|
-
}), () => this.props.onSessionChange(e));
|
|
46
|
-
};
|
|
47
|
-
onUndo = () => {
|
|
48
|
-
this.setState((e) => {
|
|
49
|
-
let t = [...e.changes];
|
|
50
|
-
return t.pop(), {
|
|
51
|
-
changes: t,
|
|
52
|
-
session: t.length ? t[t.length - 1] : e.sessionInitialValues
|
|
53
|
-
};
|
|
54
|
-
}, () => this.props.onSessionChange(this.state.session));
|
|
55
|
-
};
|
|
56
|
-
onReset = () => {
|
|
57
|
-
this.setState((e) => ({
|
|
58
|
-
session: e.sessionInitialValues,
|
|
59
|
-
changes: []
|
|
60
|
-
}), () => this.props.onSessionChange(this.state.sessionInitialValues));
|
|
61
|
-
};
|
|
62
|
-
render() {
|
|
63
|
-
let { ...e } = this.props, { changes: t, session: a } = this.state;
|
|
64
|
-
return /* @__PURE__ */ i(c, { children: [/* @__PURE__ */ i(l, { children: [/* @__PURE__ */ i(d, {
|
|
65
|
-
color: "primary",
|
|
66
|
-
disabled: t.length === 0,
|
|
67
|
-
onClick: this.onUndo,
|
|
68
|
-
children: [/* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(s, {}) }), "Undo"]
|
|
69
|
-
}), /* @__PURE__ */ i(d, {
|
|
70
|
-
color: "primary",
|
|
71
|
-
disabled: t.length === 0,
|
|
72
|
-
onClick: this.onReset,
|
|
73
|
-
children: [/* @__PURE__ */ r(u, { children: /* @__PURE__ */ r(o, {}) }), "Start Over"]
|
|
74
|
-
})] }), /* @__PURE__ */ r(n, {
|
|
75
|
-
...e,
|
|
76
|
-
session: a,
|
|
77
|
-
onSessionChange: this.onSessionChange
|
|
78
|
-
})] });
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return a;
|
|
82
|
-
};
|
|
83
|
-
//#endregion
|
|
84
|
-
export { f as default };
|