@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
package/src/inputs.tsx ADDED
@@ -0,0 +1,107 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/config-ui/src/inputs.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 Checkbox from '@mui/material/Checkbox';
12
+ import Radio from '@mui/material/Radio';
13
+ import { color, InputContainer as InputContainerImport } from '@pie-lib/render-ui';
14
+
15
+ function isRenderableReactInteropType(value: any) {
16
+ return (
17
+ typeof value === 'function' ||
18
+ (typeof value === 'object' && value !== null && typeof value.$$typeof === 'symbol')
19
+ );
20
+ }
21
+
22
+ function unwrapReactInteropSymbol(maybeSymbol: any, namedExport?: string) {
23
+ if (!maybeSymbol) return maybeSymbol;
24
+ if (isRenderableReactInteropType(maybeSymbol)) return maybeSymbol;
25
+ if (isRenderableReactInteropType(maybeSymbol.default)) return maybeSymbol.default;
26
+ if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport])) {
27
+ return maybeSymbol[namedExport];
28
+ }
29
+ if (namedExport && isRenderableReactInteropType(maybeSymbol[namedExport]?.default)) {
30
+ return maybeSymbol[namedExport].default;
31
+ }
32
+ return maybeSymbol;
33
+ }
34
+ const InputContainer = unwrapReactInteropSymbol(InputContainerImport, 'InputContainer') || unwrapReactInteropSymbol(renderUi.InputContainer, 'InputContainer');
35
+ import * as RenderUiNamespace from '@pie-lib/render-ui';
36
+ const renderUiNamespaceAny = RenderUiNamespace as any;
37
+ const renderUiDefaultMaybe = renderUiNamespaceAny['default'];
38
+ const renderUi =
39
+ renderUiDefaultMaybe && typeof renderUiDefaultMaybe === 'object'
40
+ ? renderUiDefaultMaybe
41
+ : renderUiNamespaceAny;
42
+ import PropTypes from 'prop-types';
43
+ import React from 'react';
44
+ import Switch from '@mui/material/Switch';
45
+ import { styled } from '@mui/material/styles';
46
+
47
+ const InputTypes = {
48
+ className: PropTypes.string,
49
+ label: PropTypes.string,
50
+ checked: PropTypes.bool,
51
+ onChange: PropTypes.func,
52
+ disabled: PropTypes.bool,
53
+ error: PropTypes.string,
54
+ };
55
+
56
+ const StyledSwitch: any = styled(Switch)(() => ({
57
+ justifyContent: 'inherit',
58
+ transform: 'translate(-20%, 20%)',
59
+ }));
60
+
61
+ const InputSwitch = ({ className, label, checked, onChange }) => {
62
+ return (
63
+ <InputContainer className={className} label={label}>
64
+ <StyledSwitch checked={checked} onChange={onChange} aria-label={label} />
65
+ </InputContainer>
66
+ );
67
+ };
68
+
69
+ InputSwitch.propTypes = { ...InputTypes };
70
+
71
+ const StyledCheckbox: any = styled(Checkbox)(({ theme, error }) => ({
72
+ transform: 'translate(-25%, 20%)',
73
+ color: `${color.tertiary()} !important`,
74
+ ...(error && {
75
+ color: `${theme.palette.error.main} !important`,
76
+ }),
77
+ }));
78
+
79
+ const InputCheckbox = ({ className, label, checked, onChange, disabled, error }) => {
80
+ return (
81
+ <InputContainer className={className} label={label}>
82
+ <StyledCheckbox disabled={disabled} checked={checked} onChange={onChange} aria-label={label} error={error} />
83
+ </InputContainer>
84
+ );
85
+ };
86
+
87
+ InputCheckbox.propTypes = { ...InputTypes };
88
+
89
+ const StyledRadio: any = styled(Radio)(({ theme, error }) => ({
90
+ transform: 'translate(-20%, 20%)',
91
+ color: `${color.tertiary()} !important`,
92
+ ...(error && {
93
+ color: `${theme.palette.error.main} !important`,
94
+ }),
95
+ }));
96
+
97
+ const InputRadio = ({ className, label, checked, onChange, disabled, error }) => {
98
+ return (
99
+ <InputContainer className={className} label={label}>
100
+ <StyledRadio disabled={disabled} checked={checked} onChange={onChange} aria-label={label} error={error} />
101
+ </InputContainer>
102
+ );
103
+ };
104
+
105
+ InputRadio.propTypes = { ...InputTypes };
106
+
107
+ export { InputSwitch, InputCheckbox, InputRadio };
package/src/langs.tsx ADDED
@@ -0,0 +1,121 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/config-ui/src/langs.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 Input from '@mui/material/Input';
12
+ import InputLabel from '@mui/material/InputLabel';
13
+ import PropTypes from 'prop-types';
14
+ import React from 'react';
15
+ import { styled } from '@mui/material/styles';
16
+ import Select from '@mui/material/Select';
17
+ import MenuItem from '@mui/material/MenuItem';
18
+ import FormControl from '@mui/material/FormControl';
19
+ import debug from 'debug';
20
+
21
+ const log = debug('pie-elements:config-ui:langs');
22
+
23
+ const StyledRoot: any = styled('div')(() => ({
24
+ flexDirection: 'column',
25
+ alignItems: 'start',
26
+ display: 'flex',
27
+ position: 'relative',
28
+ paddingTop: '0px',
29
+ paddingRight: '0px',
30
+ }));
31
+
32
+ const StyledFormControl: any = styled(FormControl)(() => ({
33
+ position: 'initial',
34
+ }));
35
+
36
+ const StyledInputLabel: any = styled(InputLabel)(({ theme }) => ({
37
+ paddingBottom: theme.spacing(1),
38
+ }));
39
+
40
+ export class Langs extends React.Component {
41
+ static propTypes = {
42
+ onChange: PropTypes.func,
43
+ langs: PropTypes.array,
44
+ selected: PropTypes.string,
45
+ label: PropTypes.string,
46
+ uid: PropTypes.string,
47
+ };
48
+
49
+ constructor(props) {
50
+ super(props);
51
+ this.uid = props.uid || (Math.random() * 10000).toFixed();
52
+ }
53
+
54
+ choose: any = (event) => {
55
+ log('[choose] event: ', event);
56
+
57
+ if (this.props.onChange) {
58
+ this.props.onChange(event.target.value);
59
+ }
60
+ };
61
+
62
+ render() {
63
+ let { langs, selected, label } = this.props;
64
+
65
+ log('[render] selected:', selected);
66
+
67
+ return (
68
+ <StyledRoot>
69
+ <StyledFormControl>
70
+ <StyledInputLabel htmlFor={this.uid}>{label}</StyledInputLabel>
71
+
72
+ <Select value={selected} onChange={this.choose} input={<Input id={this.uid} />}>
73
+ {langs.map((l, index) => (
74
+ <MenuItem key={index} value={l}>
75
+ {l}
76
+ </MenuItem>
77
+ ))}
78
+ </Select>
79
+ </StyledFormControl>
80
+ </StyledRoot>
81
+ );
82
+ }
83
+ }
84
+ export default Langs;
85
+
86
+ const StyledLanguageControls: any = styled('div')(() => ({
87
+ display: 'grid',
88
+ gridAutoFlow: 'column',
89
+ gridAutoColumns: '1fr',
90
+ gridGap: '8px',
91
+ }));
92
+
93
+ export const LanguageControls = ({
94
+ langs,
95
+ activeLang,
96
+ defaultLang,
97
+ onActiveLangChange,
98
+ onDefaultLangChange,
99
+ className,
100
+ }) => {
101
+ return (
102
+ <StyledLanguageControls className={className}>
103
+ <Langs
104
+ label="Choose language to edit"
105
+ langs={langs}
106
+ selected={activeLang}
107
+ onChange={(l) => onActiveLangChange(l)}
108
+ />
109
+ <Langs label="Default language" langs={langs} selected={defaultLang} onChange={(l) => onDefaultLangChange(l)} />
110
+ </StyledLanguageControls>
111
+ );
112
+ };
113
+
114
+ LanguageControls.propTypes = {
115
+ langs: PropTypes.array,
116
+ activeLang: PropTypes.string.isRequired,
117
+ defaultLang: PropTypes.string.isRequired,
118
+ onActiveLangChange: PropTypes.func.isRequired,
119
+ onDefaultLangChange: PropTypes.func.isRequired,
120
+ className: PropTypes.string,
121
+ };
@@ -0,0 +1,113 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/config-ui/src/layout/config-layout.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 Measure, { withContentRect } from 'react-measure';
13
+ import { createTheme, StyledEngineProvider, ThemeProvider } from '@mui/material/styles';
14
+ import PropTypes from 'prop-types';
15
+ import LayoutContents from './layout-contents.js';
16
+ import SettingsBox from './settings-box.js';
17
+
18
+ const theme = createTheme({
19
+ typography: {
20
+ fontFamily: 'inherit',
21
+ },
22
+ components: {
23
+ MuiButton: {
24
+ styleOverrides: {
25
+ contained: {
26
+ backgroundColor: '#e0e0e0',
27
+ color: '#000000',
28
+ '&:hover': {
29
+ backgroundColor: '#bdbdbd',
30
+ },
31
+ },
32
+ },
33
+ },
34
+ },
35
+ });
36
+
37
+ class MeasuredConfigLayout extends React.Component {
38
+ static propTypes = {
39
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.element), PropTypes.element]),
40
+ className: PropTypes.string,
41
+ dimensions: PropTypes.object,
42
+ settings: PropTypes.element,
43
+ sidePanelMinWidth: PropTypes.number,
44
+ hideSettings: PropTypes.bool,
45
+ extraCSSRules: PropTypes.shape({
46
+ names: PropTypes.arrayOf(PropTypes.string),
47
+ rules: PropTypes.string,
48
+ }),
49
+ };
50
+
51
+ static defaultProps = {
52
+ sidePanelMinWidth: 1135,
53
+ hideSettings: false,
54
+ dimensions: {},
55
+ };
56
+
57
+ constructor(...props) {
58
+ super(...props);
59
+ this.state = { layoutMode: undefined };
60
+ }
61
+
62
+ onResize: any = (contentRect) => {
63
+ const { bounds } = contentRect;
64
+ const { sidePanelMinWidth, dimensions } = this.props;
65
+ const { maxWidth } = dimensions || {};
66
+
67
+ const layoutMode =
68
+ bounds.width > sidePanelMinWidth && (maxWidth ? maxWidth > sidePanelMinWidth : true) ? 'inline' : 'tabbed';
69
+
70
+ // Only update state (and cause a re-render) if the computed layoutMode changed.
71
+ if (layoutMode !== this.state.layoutMode) {
72
+ this.setState({ layoutMode });
73
+ }
74
+ };
75
+
76
+ render() {
77
+ return (
78
+ // TODO: REVIEW MuiThemeProvider usage - is this still needed after mui update?
79
+ // Different theme object identities will force theme consumers to re-render.
80
+ <StyledEngineProvider injectFirst>
81
+ <ThemeProvider theme={theme}>
82
+ <Measure bounds onResize={this.onResize}>
83
+ {({ measureRef }) => {
84
+ const { children, settings, hideSettings, dimensions, extraCSSRules } = this.props;
85
+ const { layoutMode } = this.state;
86
+
87
+ const settingsPanel =
88
+ layoutMode === 'inline' ? <SettingsBox className="settings-box">{settings}</SettingsBox> : settings;
89
+ const secondaryContent = hideSettings ? null : settingsPanel;
90
+ const finalClass = 'main-container extraCSSRules';
91
+
92
+ return (
93
+ <div ref={measureRef} className={finalClass}>
94
+ {extraCSSRules?.rules ? (
95
+ <style dangerouslySetInnerHTML={{ __html: `.extraCSSRules { ${extraCSSRules.rules} }` }} />
96
+ ) : null}
97
+
98
+ <LayoutContents mode={layoutMode} secondary={secondaryContent} dimensions={dimensions}>
99
+ {children}
100
+ </LayoutContents>
101
+ </div>
102
+ );
103
+ }}
104
+ </Measure>
105
+ </ThemeProvider>
106
+ </StyledEngineProvider>
107
+ );
108
+ }
109
+ }
110
+
111
+ const ConfigLayout = withContentRect('bounds')(MeasuredConfigLayout);
112
+
113
+ export default ConfigLayout;
@@ -0,0 +1,14 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/config-ui/src/layout/index.js
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 ConfigLayout from './config-layout.js';
12
+ import LayoutContents from './layout-contents.js';
13
+
14
+ export { LayoutContents, ConfigLayout };
@@ -0,0 +1,127 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/config-ui/src/layout/layout-contents.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 { styled } from '@mui/material/styles';
14
+ import Tabs from '../tabs/index.js';
15
+
16
+ const StyledContainer: any = styled('div')(() => ({
17
+ display: 'flex',
18
+ flexDirection: 'column',
19
+ position: 'relative',
20
+ }));
21
+
22
+ const StyledFlow: any = styled('div')(() => ({
23
+ display: 'flex',
24
+ justifyContent: 'space-between',
25
+ }));
26
+
27
+ const StyledContentContainer: any = styled('div')(({ theme }) => ({
28
+ padding: `${theme.spacing(2)} 0`,
29
+ }));
30
+
31
+ const StyledConfigContainer: any = styled('div')(() => ({
32
+ flex: '1',
33
+ }));
34
+
35
+ const StyledSettingsContainer: any = styled('div')(({ theme }) => ({
36
+ marginLeft: theme.spacing(2),
37
+ }));
38
+
39
+ class RawLayoutContents extends React.Component {
40
+ static propTypes = {
41
+ mode: PropTypes.oneOf(['tabbed', 'inline']),
42
+ secondary: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
43
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
44
+ dimensions: PropTypes.object,
45
+ };
46
+
47
+ getConfiguration: any = () => {
48
+ const { secondary } = this.props;
49
+ // in config-layout, secondary can be: <SettingsBox>{settings}</SettingsBox>, settings, null
50
+
51
+ return secondary?.props?.configuration || secondary?.props?.children?.props?.configuration || undefined;
52
+ };
53
+
54
+ // // eslint-disable-next-line no-unused-vars
55
+ // componentDidUpdate(prevProps, prevState, snapshot) {
56
+ // const configuration = this.getConfiguration();
57
+ // const { mode } = this.props;
58
+ //
59
+ // // promptHolder class is used to wrap up inputs:
60
+ // // we don't want inputs to fill the entire scrollable container,
61
+ // // but instead we want inputs to fit in the first view,
62
+ // // so we calculate the maximum space inputs need
63
+ // try {
64
+ // if (
65
+ // configuration?.maxWidth &&
66
+ // getComputedStyle(document.documentElement).getPropertyValue('--pie-prompt-holder-max-width') !==
67
+ // configuration?.maxWidth
68
+ // ) {
69
+ // document.documentElement.style.setProperty(
70
+ // '--pie-prompt-holder-max-width',
71
+ // mode === 'inline' ? `calc(${configuration.maxWidth} - 340px)` : configuration.maxWidth,
72
+ // );
73
+ // }
74
+ // } catch (e) {
75
+ // console.log(e.toString());
76
+ // }
77
+ // }
78
+
79
+ render() {
80
+ const { mode, secondary, children, dimensions } = this.props;
81
+ const { minHeight, minWidth, maxHeight, maxWidth } = dimensions || {};
82
+ const configuration = this.getConfiguration();
83
+
84
+ let hasSettingsPanel = Object.entries(configuration || {}).some(([, obj]) => !!obj?.settings);
85
+ // ebsr has configuration.partA and configuration.partB
86
+ // because we might have nested configuration for other item types as well, let's add this simple regex to check values for settings
87
+
88
+ if (!hasSettingsPanel) {
89
+ try {
90
+ hasSettingsPanel = JSON.stringify(configuration)?.match(/settings":true/)?.length;
91
+ } catch (e) {
92
+ // eslint-disable-next-line no-console
93
+ console.log(e.toString());
94
+ }
95
+ }
96
+
97
+ return (
98
+ <StyledContainer style={{ minHeight, minWidth, maxHeight, maxWidth }}>
99
+ {mode === 'inline' && (
100
+ <StyledFlow>
101
+ <StyledConfigContainer className="design-container">{children}</StyledConfigContainer>
102
+ {hasSettingsPanel && (
103
+ <StyledSettingsContainer className="settings-container">{secondary}</StyledSettingsContainer>
104
+ )}
105
+ </StyledFlow>
106
+ )}
107
+
108
+ {mode === 'tabbed' && hasSettingsPanel && (
109
+ <Tabs onChange={this.onTabsChange} contentClassName="content-container" indicatorColor="primary">
110
+ <StyledContentContainer title="Design" className="design-container">
111
+ {children}
112
+ </StyledContentContainer>
113
+ <StyledContentContainer title="Settings" className="settings-container">
114
+ {secondary}
115
+ </StyledContentContainer>
116
+ </Tabs>
117
+ )}
118
+
119
+ {mode === 'tabbed' && !hasSettingsPanel && (
120
+ <StyledContentContainer className="design-container">{children}</StyledContentContainer>
121
+ )}
122
+ </StyledContainer>
123
+ );
124
+ }
125
+ }
126
+
127
+ export default RawLayoutContents;
@@ -0,0 +1,42 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/config-ui/src/layout/settings-box.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 { styled } from '@mui/material/styles';
14
+
15
+ const StyledSettingsBox: any = styled('div')(({ theme }) => ({
16
+ backgroundColor: theme.palette.background.paper,
17
+ border: `2px solid ${theme.palette.grey[200]}`,
18
+ display: 'flex',
19
+ flexDirection: 'column',
20
+ justifyContent: 'flex-start',
21
+ minWidth: '275px',
22
+ maxWidth: '300px',
23
+ padding: '20px 4px 4px 20px',
24
+ zIndex: 99,
25
+ }));
26
+
27
+ export class SettingsBox extends React.Component {
28
+ static propTypes = {
29
+ className: PropTypes.string,
30
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
31
+ };
32
+
33
+ static defaultProps = {};
34
+
35
+ render() {
36
+ const { className, children } = this.props;
37
+
38
+ return <StyledSettingsBox className={className}>{children}</StyledSettingsBox>;
39
+ }
40
+ }
41
+
42
+ export default SettingsBox;
@@ -0,0 +1,66 @@
1
+ // @ts-nocheck
2
+ /**
3
+ * @synced-from pie-lib/packages/config-ui/src/mui-box/index.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 { styled } from '@mui/material/styles';
14
+ import debug from 'debug';
15
+
16
+ const log = debug('pie-elements:config-ui:mui-box');
17
+
18
+ const StyledMuiBox: any = styled('div')(({ theme, focused }) => {
19
+ const light = theme.palette.mode === 'light';
20
+ const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
21
+
22
+ log(theme.palette.primary[theme.palette.mode || 'light']);
23
+
24
+ return {
25
+ paddingTop: theme.spacing(1),
26
+ paddingBottom: theme.spacing(1),
27
+ position: 'relative',
28
+ '&:before': {
29
+ left: 0,
30
+ right: 0,
31
+ bottom: 0,
32
+ height: '1px',
33
+ content: '""',
34
+ position: 'absolute',
35
+ transition: 'background-color 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms',
36
+ pointerEvents: 'none',
37
+ backgroundColor: bottomLineColor,
38
+ },
39
+ '&:hover:before': {
40
+ height: '2px',
41
+ },
42
+ '&:after': {
43
+ left: 0,
44
+ right: 0,
45
+ bottom: 0,
46
+ height: '2px',
47
+ content: '""',
48
+ position: 'absolute',
49
+ transform: focused ? 'scaleX(1)' : 'scaleX(0)',
50
+ transition: 'transform 200ms cubic-bezier(0.0, 0, 0.2, 1) 0ms',
51
+ pointerEvents: 'none',
52
+ backgroundColor: theme.palette.primary[theme.palette.mode], //'#304ffe'
53
+ },
54
+ };
55
+ });
56
+
57
+ const MuiBox = ({ children, focused }) => {
58
+ return <StyledMuiBox focused={focused}>{children}</StyledMuiBox>;
59
+ };
60
+
61
+ MuiBox.propTypes = {
62
+ children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
63
+ focused: PropTypes.bool.isRequired,
64
+ };
65
+
66
+ export default MuiBox;