@pareto-engineering/design-system 4.0.0-alpha.78 → 4.0.0-alpha.79
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/cjs/a/Quote/styles.scss +1 -1
- package/dist/cjs/a/Tooltip/styles.scss +3 -0
- package/dist/cjs/a/index.js +0 -7
- package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +4 -1
- package/dist/cjs/b/index.js +1 -8
- package/dist/cjs/f/fields/EditorInput/EditorInput.js +18 -4
- package/dist/cjs/f/fields/EditorInput/styles.scss +9 -2
- package/dist/cjs/f/fields/SelectInput/SelectInput.js +9 -2
- package/dist/cjs/f/fields/SelectInput/common/Single/Single.js +13 -2
- package/dist/cjs/f/fields/SelectInput/styles.scss +1 -1
- package/dist/cjs/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.js +27 -42
- package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +6 -7
- package/dist/cjs/g/ExpandableLexicalPreview/styles.scss +34 -0
- package/dist/cjs/g/index.js +12 -0
- package/dist/cjs/index.js +11 -0
- package/dist/es/a/Quote/styles.scss +1 -1
- package/dist/es/a/Tooltip/styles.scss +3 -0
- package/dist/es/a/index.js +0 -1
- package/dist/es/b/Page/common/PageHelmet/PageHelmet.js +4 -1
- package/dist/es/b/index.js +1 -2
- package/dist/es/f/fields/EditorInput/EditorInput.js +16 -3
- package/dist/es/f/fields/EditorInput/styles.scss +9 -2
- package/dist/es/f/fields/SelectInput/SelectInput.js +9 -2
- package/dist/es/f/fields/SelectInput/common/Single/Single.js +12 -1
- package/dist/es/f/fields/SelectInput/styles.scss +1 -1
- package/dist/es/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.js +29 -45
- package/dist/es/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +18 -21
- package/dist/es/g/ExpandableLexicalPreview/styles.scss +34 -0
- package/dist/es/g/index.js +1 -0
- package/dist/es/index.js +1 -0
- package/package.json +3 -3
- package/src/stories/f/SelectInput.stories.jsx +18 -2
- package/src/stories/{b → g}/ExpandableLexicalPreview.stories.jsx +2 -1
- package/src/ui/a/Quote/styles.scss +1 -1
- package/src/ui/a/Tooltip/styles.scss +3 -0
- package/src/ui/a/index.js +0 -1
- package/src/ui/b/Page/common/PageHelmet/PageHelmet.jsx +6 -0
- package/src/ui/b/index.js +0 -1
- package/src/ui/f/fields/EditorInput/EditorInput.jsx +14 -1
- package/src/ui/f/fields/EditorInput/styles.scss +9 -2
- package/src/ui/f/fields/SelectInput/SelectInput.jsx +10 -2
- package/src/ui/f/fields/SelectInput/common/Single/Single.jsx +13 -1
- package/src/ui/f/fields/SelectInput/styles.scss +1 -1
- package/src/ui/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +43 -56
- package/src/ui/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +32 -36
- package/src/ui/g/ExpandableLexicalPreview/styles.scss +34 -0
- package/src/ui/g/index.js +1 -0
- package/src/ui/index.js +1 -0
- package/tests/__snapshots__/Storyshots.test.js.snap +164 -51
- package/dist/cjs/a/LexicalPreview/LexicalPreview.js +0 -90
- package/dist/cjs/a/LexicalPreview/index.js +0 -13
- package/dist/cjs/a/LexicalPreview/styles.scss +0 -46
- package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +0 -84
- package/dist/es/a/LexicalPreview/LexicalPreview.js +0 -80
- package/dist/es/a/LexicalPreview/index.js +0 -2
- package/dist/es/a/LexicalPreview/styles.scss +0 -46
- package/dist/es/b/ExpandableLexicalPreview/styles.scss +0 -84
- package/src/stories/a/LexicalPreview.stories.jsx +0 -28
- package/src/ui/a/LexicalPreview/LexicalPreview.jsx +0 -109
- package/src/ui/a/LexicalPreview/index.js +0 -2
- package/src/ui/a/LexicalPreview/styles.scss +0 -46
- package/src/ui/b/ExpandableLexicalPreview/styles.scss +0 -84
- /package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
- /package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
- /package/dist/cjs/{b → g}/ExpandableLexicalPreview/index.js +0 -0
- /package/dist/es/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
- /package/dist/es/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
- /package/dist/es/{b → g}/ExpandableLexicalPreview/index.js +0 -0
- /package/src/ui/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
- /package/src/ui/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
- /package/src/ui/{b → g}/ExpandableLexicalPreview/index.js +0 -0
|
@@ -23,6 +23,7 @@ const SelectInput = ({
|
|
|
23
23
|
labelColor,
|
|
24
24
|
color,
|
|
25
25
|
options,
|
|
26
|
+
hasDefault,
|
|
26
27
|
validate,
|
|
27
28
|
optional,
|
|
28
29
|
description,
|
|
@@ -40,6 +41,7 @@ const SelectInput = ({
|
|
|
40
41
|
labelColor,
|
|
41
42
|
color,
|
|
42
43
|
options,
|
|
44
|
+
hasDefault,
|
|
43
45
|
validate,
|
|
44
46
|
optional,
|
|
45
47
|
description,
|
|
@@ -124,10 +126,15 @@ SelectInput.propTypes = {
|
|
|
124
126
|
/**
|
|
125
127
|
* The placeholder of the select input
|
|
126
128
|
*/
|
|
127
|
-
placeholder: PropTypes.string
|
|
129
|
+
placeholder: PropTypes.string,
|
|
130
|
+
/**
|
|
131
|
+
* Whether this select input has a default value(s)
|
|
132
|
+
*/
|
|
133
|
+
hasDefault: PropTypes.bool
|
|
128
134
|
};
|
|
129
135
|
SelectInput.defaultProps = {
|
|
130
136
|
disabled: false,
|
|
131
|
-
multiple: false
|
|
137
|
+
multiple: false,
|
|
138
|
+
hasDefault: false
|
|
132
139
|
};
|
|
133
140
|
export default /*#__PURE__*/memo(SelectInput);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
2
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { useEffect } from 'react';
|
|
4
5
|
import { useField } from 'formik';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
@@ -24,6 +25,7 @@ const Single = ({
|
|
|
24
25
|
labelColor,
|
|
25
26
|
color,
|
|
26
27
|
options,
|
|
28
|
+
hasDefault,
|
|
27
29
|
validate,
|
|
28
30
|
optional,
|
|
29
31
|
description,
|
|
@@ -32,10 +34,19 @@ const Single = ({
|
|
|
32
34
|
autoComplete
|
|
33
35
|
// ...otherProps
|
|
34
36
|
}) => {
|
|
35
|
-
const [field] = useField({
|
|
37
|
+
const [field,, helpers] = useField({
|
|
36
38
|
name,
|
|
37
39
|
validate
|
|
38
40
|
});
|
|
41
|
+
const {
|
|
42
|
+
setValue
|
|
43
|
+
} = helpers;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (hasDefault && !field.value) {
|
|
46
|
+
const defaultOption = options.find(option => option.isDefault);
|
|
47
|
+
setValue(defaultOption?.value);
|
|
48
|
+
}
|
|
49
|
+
}, [hasDefault]);
|
|
39
50
|
return /*#__PURE__*/React.createElement("div", {
|
|
40
51
|
id: id,
|
|
41
52
|
className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
2
|
import * as React from 'react';
|
|
4
|
-
import { useState
|
|
5
|
-
import {
|
|
6
|
-
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
7
|
-
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
8
|
-
import { AutoLinkNode, LinkNode } from '@lexical/link';
|
|
9
|
-
import { ListItemNode, ListNode } from '@lexical/list';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Formik } from 'formik';
|
|
10
5
|
import PropTypes from 'prop-types';
|
|
11
6
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
12
|
-
import { Button } from "../Button";
|
|
13
|
-
import "./styles.scss";
|
|
14
|
-
import { ExpandButton } from "./common";
|
|
15
7
|
|
|
16
8
|
// Local Definitions
|
|
17
|
-
|
|
9
|
+
import { EditorInput } from "../../f";
|
|
10
|
+
import { Button } from "../../b";
|
|
11
|
+
import { ExpandButton } from "./common";
|
|
12
|
+
import "./styles.scss";
|
|
18
13
|
const baseClassName = styleNames.base;
|
|
19
14
|
const componentClassName = 'expandable-lexical-preview';
|
|
20
|
-
|
|
21
15
|
/**
|
|
22
16
|
* This is the component description.
|
|
23
17
|
*/
|
|
@@ -26,57 +20,43 @@ const ExpandableLexicalPreview = ({
|
|
|
26
20
|
className: userClassName,
|
|
27
21
|
style,
|
|
28
22
|
nodes,
|
|
23
|
+
name,
|
|
29
24
|
color,
|
|
30
25
|
resize,
|
|
31
26
|
title
|
|
32
27
|
// ...otherProps
|
|
33
28
|
}) => {
|
|
34
|
-
const
|
|
35
|
-
nameSpace: id,
|
|
36
|
-
editable: false,
|
|
37
|
-
editorState: nodes,
|
|
38
|
-
theme: {
|
|
39
|
-
text: {
|
|
40
|
-
italic: 'italic',
|
|
41
|
-
strikethrough: 'strikethrough',
|
|
42
|
-
underline: 'underlined'
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
nodes: [AutoLinkNode, LinkNode, ListNode, ListItemNode]
|
|
46
|
-
};
|
|
29
|
+
const [editorState, setEditorState] = useState();
|
|
47
30
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
48
31
|
const handleButtonClick = () => {
|
|
49
32
|
setIsExpanded(!isExpanded);
|
|
50
33
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
id: id,
|
|
56
|
-
className: "content-editable"
|
|
57
|
-
})
|
|
58
|
-
}), /*#__PURE__*/React.createElement(ExpandButton, {
|
|
59
|
-
title: title,
|
|
60
|
-
onResolve: handleButtonClick
|
|
61
|
-
})), [id]);
|
|
62
|
-
return /*#__PURE__*/React.createElement(LexicalComposer, {
|
|
63
|
-
initialConfig: initialConfig
|
|
34
|
+
return /*#__PURE__*/React.createElement(Formik, {
|
|
35
|
+
initialValues: {
|
|
36
|
+
[name]: nodes
|
|
37
|
+
}
|
|
64
38
|
}, /*#__PURE__*/React.createElement("div", {
|
|
65
39
|
id: id,
|
|
66
40
|
className: [baseClassName, componentClassName, userClassName, `y-${color}`, isExpanded && 'collapsed'].filter(e => e).join(' '),
|
|
67
|
-
style:
|
|
68
|
-
'--resize': resize,
|
|
69
|
-
...style
|
|
70
|
-
}
|
|
41
|
+
style: style
|
|
71
42
|
}, typeof title === 'string' ? /*#__PURE__*/React.createElement("p", {
|
|
72
43
|
className: "title h2"
|
|
73
|
-
}, title) : title, isExpanded
|
|
44
|
+
}, title) : title, isExpanded ? /*#__PURE__*/React.createElement(Button, {
|
|
74
45
|
onClick: handleButtonClick,
|
|
75
46
|
color: "background-far",
|
|
76
47
|
isCompact: true
|
|
77
48
|
}, /*#__PURE__*/React.createElement("span", {
|
|
78
49
|
className: "ai-icon c-x x-paragraph"
|
|
79
|
-
}, "C")),
|
|
50
|
+
}, "C")) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorInput, {
|
|
51
|
+
name: name,
|
|
52
|
+
setEditorState: setEditorState,
|
|
53
|
+
resize: resize,
|
|
54
|
+
disabled: true
|
|
55
|
+
}), /*#__PURE__*/React.createElement(ExpandButton, {
|
|
56
|
+
title: title,
|
|
57
|
+
onResolve: handleButtonClick,
|
|
58
|
+
editorState: editorState
|
|
59
|
+
}))));
|
|
80
60
|
};
|
|
81
61
|
ExpandableLexicalPreview.propTypes = {
|
|
82
62
|
/**
|
|
@@ -106,7 +86,11 @@ ExpandableLexicalPreview.propTypes = {
|
|
|
106
86
|
/**
|
|
107
87
|
* The title for the preview.
|
|
108
88
|
*/
|
|
109
|
-
title: PropTypes.string
|
|
89
|
+
title: PropTypes.string,
|
|
90
|
+
/**
|
|
91
|
+
* The name used to acces the nodes
|
|
92
|
+
*/
|
|
93
|
+
name: PropTypes.string.isRequired
|
|
110
94
|
};
|
|
111
95
|
ExpandableLexicalPreview.defaultProps = {
|
|
112
96
|
color: 'paragraph',
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { $generateHtmlFromNodes } from '@lexical/html';
|
|
5
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
7
6
|
import styleNames from '@pareto-engineering/bem/exports';
|
|
8
|
-
import { Button } from "
|
|
7
|
+
import { Button } from "../../../../b";
|
|
9
8
|
|
|
10
9
|
// Local Definitions
|
|
11
10
|
|
|
@@ -20,21 +19,20 @@ const ExpandButton = ({
|
|
|
20
19
|
className: userClassName,
|
|
21
20
|
style,
|
|
22
21
|
onResolve,
|
|
23
|
-
title
|
|
22
|
+
title,
|
|
23
|
+
editorState
|
|
24
24
|
// ...otherProps
|
|
25
|
-
}) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const preview = window.open('', '_blank', 'width=600,height=600');
|
|
37
|
-
preview.document.write(`<html>
|
|
25
|
+
}) => /*#__PURE__*/React.createElement(Button, {
|
|
26
|
+
id: id,
|
|
27
|
+
className: [baseClassName, componentClassName, userClassName, 'ai-icon'].filter(e => e).join(' '),
|
|
28
|
+
style: style,
|
|
29
|
+
color: "background-far",
|
|
30
|
+
isCompact: true,
|
|
31
|
+
onClick: () => {
|
|
32
|
+
editorState.getEditorState().read(() => {
|
|
33
|
+
const rawHtml = $generateHtmlFromNodes(editorState);
|
|
34
|
+
const preview = window.open('', '_blank', 'width=600,height=600');
|
|
35
|
+
preview.document.write(`<html>
|
|
38
36
|
<title>${title || 'Preview'}</title>
|
|
39
37
|
<style>
|
|
40
38
|
li:has(ol, ul) {
|
|
@@ -76,11 +74,10 @@ const ExpandButton = ({
|
|
|
76
74
|
${rawHtml}
|
|
77
75
|
<button onclick="window.close()">Close Preview</button>
|
|
78
76
|
</body></html>`);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
77
|
+
});
|
|
78
|
+
onResolve();
|
|
79
|
+
}
|
|
80
|
+
}, "D");
|
|
84
81
|
ExpandButton.propTypes = {
|
|
85
82
|
/**
|
|
86
83
|
* The HTML id for this element
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
|
|
3
|
+
@use "@pareto-engineering/bem";
|
|
4
|
+
|
|
5
|
+
.#{bem.$base}.expandable-lexical-preview {
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
flex-wrap: wrap;
|
|
9
|
+
gap: var(--gap);
|
|
10
|
+
position: relative;
|
|
11
|
+
width: 100%;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
&.collapsed {
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
> .title {
|
|
19
|
+
margin: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
> .#{bem.$base}.button {
|
|
23
|
+
align-items: center;
|
|
24
|
+
border: 1px solid var(--outline-inputs);
|
|
25
|
+
display: flex;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
> .#{bem.$base}.expand-button {
|
|
29
|
+
border: 1px solid var(--outline-inputs);
|
|
30
|
+
position: absolute;
|
|
31
|
+
right: 1em;
|
|
32
|
+
top: 5.5rem;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExpandableLexicalPreview } from "./ExpandableLexicalPreview";
|
package/dist/es/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pareto-engineering/design-system",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.79",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@pareto-engineering/assets": "^4.0.0-alpha.78",
|
|
63
63
|
"@pareto-engineering/bem": "^4.0.0-alpha.20",
|
|
64
64
|
"@pareto-engineering/styles": "^4.0.0-alpha.73",
|
|
65
|
-
"@pareto-engineering/utils": "^4.0.0-alpha.
|
|
65
|
+
"@pareto-engineering/utils": "^4.0.0-alpha.79",
|
|
66
66
|
"codemirror": "^6.0.1",
|
|
67
67
|
"date-fns": "^2.29.3",
|
|
68
68
|
"downshift": "^6.1.12",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"relay-test-utils": "^15.0.0"
|
|
83
83
|
},
|
|
84
84
|
"browserslist": "> 2%",
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "593a12393a1966a555d50ede309f2acfee44f48d"
|
|
86
86
|
}
|
|
@@ -11,9 +11,9 @@ export default {
|
|
|
11
11
|
// Item:SelectInput.Item
|
|
12
12
|
},
|
|
13
13
|
decorators:[
|
|
14
|
-
(storyfn) => (
|
|
14
|
+
(storyfn, { args }) => (
|
|
15
15
|
<Formik
|
|
16
|
-
initialValues={{ workType: '' }}
|
|
16
|
+
initialValues={{ workType: args?.testOverride ? 'Training' : '' }}
|
|
17
17
|
>
|
|
18
18
|
<Form>
|
|
19
19
|
{ storyfn() }
|
|
@@ -108,3 +108,19 @@ Multiple.args = {
|
|
|
108
108
|
placeholder:'Type to search',
|
|
109
109
|
multiple :true,
|
|
110
110
|
}
|
|
111
|
+
|
|
112
|
+
export const WithDefault = {
|
|
113
|
+
args:{
|
|
114
|
+
...Base.args,
|
|
115
|
+
hasDefault:true,
|
|
116
|
+
options :[...Base.args.options.map((e, i) => (i === 2 ? { ...e, isDefault: true } : e))],
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const WithDefaultNoOverride = {
|
|
121
|
+
...WithDefault,
|
|
122
|
+
args:{
|
|
123
|
+
...WithDefault.args,
|
|
124
|
+
testOverride:true,
|
|
125
|
+
},
|
|
126
|
+
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react'
|
|
|
4
4
|
import { ExpandableLexicalPreview } from 'ui'
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
|
-
title :'
|
|
7
|
+
title :'g/ExpandableLexicalPreview',
|
|
8
8
|
component :ExpandableLexicalPreview,
|
|
9
9
|
subcomponents:{
|
|
10
10
|
// Item:TextareaInput.Item
|
|
@@ -25,5 +25,6 @@ const Template = (args) => (
|
|
|
25
25
|
export const Base = Template.bind({})
|
|
26
26
|
Base.args = {
|
|
27
27
|
nodes,
|
|
28
|
+
name :'taskDescription',
|
|
28
29
|
title:'Task Instructions',
|
|
29
30
|
}
|
|
@@ -11,10 +11,12 @@ $default-width: var(--tooltip-width, 20rem);
|
|
|
11
11
|
border: var(--theme-default-border-style) var(--ui-lines);
|
|
12
12
|
border-radius: calc(var(--theme-default-border-radius) / 2);
|
|
13
13
|
opacity: 0;
|
|
14
|
+
overflow: hidden;
|
|
14
15
|
padding: $default-block-padding $default-inline-padding;
|
|
15
16
|
position: absolute;
|
|
16
17
|
transform: translateX(var(--horizontal, 0)) translateY(var(--vertical, 0));
|
|
17
18
|
transition: opacity .2s ease, transform .2s ease;
|
|
19
|
+
visibility: hidden;
|
|
18
20
|
width: $default-width;
|
|
19
21
|
z-index: 10;
|
|
20
22
|
|
|
@@ -24,6 +26,7 @@ $default-width: var(--tooltip-width, 20rem);
|
|
|
24
26
|
&:is(:hover, :focus-visible, :active) > .#{bem.$base}.tooltip {
|
|
25
27
|
opacity: 1;
|
|
26
28
|
transition-delay: 200ms;
|
|
29
|
+
visibility: visible;
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
|
package/src/ui/a/index.js
CHANGED
|
@@ -26,6 +26,5 @@ export { TextSteps } from './TextSteps'
|
|
|
26
26
|
export { Removable } from './Removable'
|
|
27
27
|
export { ToggleSwitch } from './ToggleSwitch'
|
|
28
28
|
export { XMLEditor } from './XMLEditor'
|
|
29
|
-
export { LexicalPreview } from './LexicalPreview'
|
|
30
29
|
export { DatePicker } from './DatePicker'
|
|
31
30
|
export { Tooltip } from './Tooltip'
|
|
@@ -172,6 +172,7 @@ const helmetMap = [
|
|
|
172
172
|
]
|
|
173
173
|
|
|
174
174
|
const PageHelmet = ({
|
|
175
|
+
jsonld,
|
|
175
176
|
...props
|
|
176
177
|
}) => {
|
|
177
178
|
// const intl = useIntl()
|
|
@@ -217,6 +218,11 @@ const PageHelmet = ({
|
|
|
217
218
|
return (
|
|
218
219
|
<Helmet key={props.title}>
|
|
219
220
|
{ HelmetContent }
|
|
221
|
+
{ jsonld && (
|
|
222
|
+
<script type="application/ld+json">
|
|
223
|
+
{`${JSON.stringify(jsonld)}`}
|
|
224
|
+
</script>
|
|
225
|
+
)}
|
|
220
226
|
</Helmet>
|
|
221
227
|
)
|
|
222
228
|
}
|
package/src/ui/b/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
3
|
import * as React from 'react'
|
|
4
|
-
import { memo } from 'react'
|
|
4
|
+
import { memo, useEffect } from 'react'
|
|
5
5
|
import { useFormikContext } from 'formik'
|
|
6
6
|
import { LexicalComposer } from '@lexical/react/LexicalComposer'
|
|
7
7
|
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin'
|
|
@@ -18,6 +18,7 @@ import { ListItemNode, ListNode } from '@lexical/list'
|
|
|
18
18
|
import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin'
|
|
19
19
|
import { HeadingNode, QuoteNode } from '@lexical/rich-text'
|
|
20
20
|
import { CodeHighlightNode, CodeNode } from '@lexical/code'
|
|
21
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'
|
|
21
22
|
|
|
22
23
|
import PropTypes from 'prop-types'
|
|
23
24
|
import styleNames from '@pareto-engineering/bem/exports'
|
|
@@ -32,6 +33,15 @@ import './styles.scss'
|
|
|
32
33
|
const baseClassName = styleNames.base
|
|
33
34
|
const componentClassName = 'editor-input'
|
|
34
35
|
|
|
36
|
+
const ExposeEditorStatePlugin = ({ setEditorState }) => {
|
|
37
|
+
const [editor] = useLexicalComposerContext()
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
setEditorState(editor)
|
|
40
|
+
}, [editor])
|
|
41
|
+
|
|
42
|
+
return null
|
|
43
|
+
}
|
|
44
|
+
|
|
35
45
|
/**
|
|
36
46
|
* This is the component description.
|
|
37
47
|
*/
|
|
@@ -51,12 +61,14 @@ const EditorInput = ({
|
|
|
51
61
|
disabled,
|
|
52
62
|
showDebugger,
|
|
53
63
|
stopPropagationKeys,
|
|
64
|
+
setEditorState,
|
|
54
65
|
// ...otherProps
|
|
55
66
|
}) => {
|
|
56
67
|
const formik = useFormikContext()
|
|
57
68
|
|
|
58
69
|
const setInitialValue = () => {
|
|
59
70
|
const value = formik.values[name]
|
|
71
|
+
|
|
60
72
|
try {
|
|
61
73
|
JSON.parse(value)
|
|
62
74
|
return value
|
|
@@ -175,6 +187,7 @@ const EditorInput = ({
|
|
|
175
187
|
<LinkPlugin />
|
|
176
188
|
<LexicalClickableLinkPlugin />
|
|
177
189
|
<TabIndentationPlugin />
|
|
190
|
+
{setEditorState && <ExposeEditorStatePlugin setEditorState={setEditorState} />}
|
|
178
191
|
<HistoryPlugin />
|
|
179
192
|
{ stopPropagationKeys && (
|
|
180
193
|
<StopPropagationPlugin stopPropagationKeys={stopPropagationKeys} />
|
|
@@ -32,6 +32,11 @@ $default-check-mark-dimensions: 1rem;
|
|
|
32
32
|
border: $focus-border;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
> .content-editable {
|
|
37
|
+
border-bottom-left-radius: $default-input-border-radius;
|
|
38
|
+
border-bottom-right-radius: $default-input-border-radius;
|
|
39
|
+
}
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
&.disabled {
|
|
@@ -40,6 +45,10 @@ $default-check-mark-dimensions: 1rem;
|
|
|
40
45
|
color: var(--metadata);
|
|
41
46
|
cursor: not-allowed;
|
|
42
47
|
}
|
|
48
|
+
|
|
49
|
+
> .content-editable {
|
|
50
|
+
border-radius: $default-input-border-radius;
|
|
51
|
+
}
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
.color-menu-button {
|
|
@@ -70,8 +79,6 @@ $default-check-mark-dimensions: 1rem;
|
|
|
70
79
|
> .content-editable {
|
|
71
80
|
background: $default-background;
|
|
72
81
|
border: $default-border;
|
|
73
|
-
border-bottom-left-radius: $default-input-border-radius;
|
|
74
|
-
border-bottom-right-radius: $default-input-border-radius;
|
|
75
82
|
color: var(--y);
|
|
76
83
|
height: var(--rows);
|
|
77
84
|
outline: none;
|
|
@@ -29,6 +29,7 @@ const SelectInput = ({
|
|
|
29
29
|
labelColor,
|
|
30
30
|
color,
|
|
31
31
|
options,
|
|
32
|
+
hasDefault,
|
|
32
33
|
validate,
|
|
33
34
|
optional,
|
|
34
35
|
description,
|
|
@@ -46,6 +47,7 @@ const SelectInput = ({
|
|
|
46
47
|
labelColor,
|
|
47
48
|
color,
|
|
48
49
|
options,
|
|
50
|
+
hasDefault,
|
|
49
51
|
validate,
|
|
50
52
|
optional,
|
|
51
53
|
description,
|
|
@@ -162,11 +164,17 @@ SelectInput.propTypes = {
|
|
|
162
164
|
* The placeholder of the select input
|
|
163
165
|
*/
|
|
164
166
|
placeholder:PropTypes.string,
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Whether this select input has a default value(s)
|
|
170
|
+
*/
|
|
171
|
+
hasDefault:PropTypes.bool,
|
|
165
172
|
}
|
|
166
173
|
|
|
167
174
|
SelectInput.defaultProps = {
|
|
168
|
-
disabled:false,
|
|
169
|
-
multiple:false,
|
|
175
|
+
disabled :false,
|
|
176
|
+
multiple :false,
|
|
177
|
+
hasDefault:false,
|
|
170
178
|
}
|
|
171
179
|
|
|
172
180
|
export default memo(SelectInput)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
+
import { useEffect } from 'react'
|
|
5
|
+
|
|
4
6
|
import { useField } from 'formik'
|
|
5
7
|
|
|
6
8
|
import PropTypes from 'prop-types'
|
|
@@ -29,6 +31,7 @@ const Single = ({
|
|
|
29
31
|
labelColor,
|
|
30
32
|
color,
|
|
31
33
|
options,
|
|
34
|
+
hasDefault,
|
|
32
35
|
validate,
|
|
33
36
|
optional,
|
|
34
37
|
description,
|
|
@@ -37,7 +40,16 @@ const Single = ({
|
|
|
37
40
|
autoComplete,
|
|
38
41
|
// ...otherProps
|
|
39
42
|
}) => {
|
|
40
|
-
const [field] = useField({ name, validate })
|
|
43
|
+
const [field, , helpers] = useField({ name, validate })
|
|
44
|
+
|
|
45
|
+
const { setValue } = helpers
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (hasDefault && !field.value) {
|
|
49
|
+
const defaultOption = options.find((option) => option.isDefault)
|
|
50
|
+
setValue(defaultOption?.value)
|
|
51
|
+
}
|
|
52
|
+
}, [hasDefault])
|
|
41
53
|
|
|
42
54
|
return (
|
|
43
55
|
<div
|