@pareto-engineering/design-system 4.0.0-alpha.78 → 4.0.0-alpha.81
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/Label/styles.scss +1 -1
- package/dist/cjs/a/Quote/styles.scss +1 -1
- package/dist/cjs/a/Tooltip/Tooltip.js +21 -5
- package/dist/cjs/a/Tooltip/styles.scss +44 -36
- 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/common/ColorPicker/ColorPicker.js +8 -4
- package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +0 -6
- 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 +59 -47
- package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.js +79 -0
- package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +13 -0
- package/dist/cjs/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
- package/dist/cjs/g/ExpandableLexicalPreview/common/index.js +12 -0
- 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/Label/styles.scss +1 -1
- package/dist/es/a/Quote/styles.scss +1 -1
- package/dist/es/a/Tooltip/Tooltip.js +21 -5
- package/dist/es/a/Tooltip/styles.scss +44 -36
- 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/common/ColorPicker/ColorPicker.js +8 -4
- package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +0 -6
- 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/g/ExpandableLexicalPreview/ExpandableLexicalPreview.js +126 -0
- package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.js +70 -0
- package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +2 -0
- package/dist/es/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
- package/dist/es/g/ExpandableLexicalPreview/common/index.js +1 -0
- 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 +4 -4
- package/src/stories/a/Tooltip.stories.jsx +7 -12
- package/src/stories/f/SelectInput.stories.jsx +18 -2
- package/src/stories/{b → g}/ExpandableLexicalPreview.stories.jsx +13 -5
- package/src/ui/a/Label/styles.scss +1 -1
- package/src/ui/a/Quote/styles.scss +1 -1
- package/src/ui/a/Tooltip/Tooltip.jsx +27 -4
- package/src/ui/a/Tooltip/styles.scss +44 -36
- 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/common/ColorPicker/ColorPicker.jsx +8 -3
- package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.jsx +0 -14
- 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/g/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +180 -0
- package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/NewWindowPortal.jsx +80 -0
- package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/index.js +2 -0
- package/src/ui/g/ExpandableLexicalPreview/common/NewWindowPortal/styles.scss +9 -0
- package/src/ui/g/ExpandableLexicalPreview/common/index.js +1 -0
- 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 +221 -99
- 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/common/ExpandButton/ExpandButton.js +0 -112
- package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -13
- package/dist/cjs/b/ExpandableLexicalPreview/common/index.js +0 -12
- 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/ExpandableLexicalPreview.js +0 -115
- package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +0 -102
- package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -1
- package/dist/es/b/ExpandableLexicalPreview/common/index.js +0 -1
- 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/ExpandableLexicalPreview.jsx +0 -157
- package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +0 -123
- package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -1
- package/src/ui/b/ExpandableLexicalPreview/common/index.js +0 -1
- package/src/ui/b/ExpandableLexicalPreview/styles.scss +0 -84
- /package/dist/cjs/{b → g}/ExpandableLexicalPreview/index.js +0 -0
- /package/dist/es/{b → g}/ExpandableLexicalPreview/index.js +0 -0
- /package/src/ui/{b → g}/ExpandableLexicalPreview/index.js +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Formik } from 'formik';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import styleNames from '@pareto-engineering/bem/exports';
|
|
7
|
+
|
|
8
|
+
// Local Definitions
|
|
9
|
+
import { EditorInput } from "../../f";
|
|
10
|
+
import { Button } from "../../b";
|
|
11
|
+
import { NewWindowPortal } from "./common";
|
|
12
|
+
import "./styles.scss";
|
|
13
|
+
const baseClassName = styleNames.base;
|
|
14
|
+
const componentClassName = 'expandable-lexical-preview';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const ExpandableLexicalPreview = ({
|
|
20
|
+
id,
|
|
21
|
+
className: userClassName,
|
|
22
|
+
style,
|
|
23
|
+
nodes,
|
|
24
|
+
name,
|
|
25
|
+
color,
|
|
26
|
+
resize,
|
|
27
|
+
pageTitle,
|
|
28
|
+
onBlock,
|
|
29
|
+
onOpen,
|
|
30
|
+
header
|
|
31
|
+
// ...otherProps
|
|
32
|
+
}) => {
|
|
33
|
+
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
34
|
+
const handleButtonClick = () => {
|
|
35
|
+
setIsCollapsed(!isCollapsed);
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/React.createElement(Formik, {
|
|
38
|
+
initialValues: {
|
|
39
|
+
[name]: nodes
|
|
40
|
+
}
|
|
41
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
id: id,
|
|
43
|
+
className: [baseClassName, componentClassName, userClassName, `y-${color}`, isCollapsed && 'collapsed'].filter(e => e).join(' '),
|
|
44
|
+
style: style
|
|
45
|
+
}, typeof header === 'string' ? /*#__PURE__*/React.createElement("p", {
|
|
46
|
+
className: "title h2"
|
|
47
|
+
}, header) : header, isCollapsed ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
48
|
+
onClick: handleButtonClick,
|
|
49
|
+
color: "background-far",
|
|
50
|
+
isCompact: true
|
|
51
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
52
|
+
className: "ai-icon c-x x-paragraph"
|
|
53
|
+
}, "C")), /*#__PURE__*/React.createElement(NewWindowPortal, {
|
|
54
|
+
pageTitle: pageTitle,
|
|
55
|
+
onBlock: () => {
|
|
56
|
+
onBlock?.();
|
|
57
|
+
setIsCollapsed(false);
|
|
58
|
+
},
|
|
59
|
+
onOpen: () => {
|
|
60
|
+
onOpen?.();
|
|
61
|
+
setIsCollapsed(true);
|
|
62
|
+
}
|
|
63
|
+
}, /*#__PURE__*/React.createElement(EditorInput, {
|
|
64
|
+
name: name,
|
|
65
|
+
resize: resize,
|
|
66
|
+
disabled: true
|
|
67
|
+
}))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(EditorInput, {
|
|
68
|
+
name: name,
|
|
69
|
+
resize: resize,
|
|
70
|
+
disabled: true,
|
|
71
|
+
id: "the-bad-ass-input"
|
|
72
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
73
|
+
id: id,
|
|
74
|
+
className: "expand-button ai-icon",
|
|
75
|
+
color: "background-far",
|
|
76
|
+
isCompact: true,
|
|
77
|
+
onClick: handleButtonClick
|
|
78
|
+
}, "D"))));
|
|
79
|
+
};
|
|
80
|
+
ExpandableLexicalPreview.propTypes = {
|
|
81
|
+
/**
|
|
82
|
+
* The HTML id for this element
|
|
83
|
+
*/
|
|
84
|
+
id: PropTypes.string,
|
|
85
|
+
/**
|
|
86
|
+
* The HTML class names for this element
|
|
87
|
+
*/
|
|
88
|
+
className: PropTypes.string,
|
|
89
|
+
/**
|
|
90
|
+
* The React-written, css properties for this element.
|
|
91
|
+
*/
|
|
92
|
+
style: PropTypes.objectOf(PropTypes.string),
|
|
93
|
+
/**
|
|
94
|
+
* Color of the text
|
|
95
|
+
*/
|
|
96
|
+
color: PropTypes.string,
|
|
97
|
+
/**
|
|
98
|
+
* The nodes to render in the form of a json string
|
|
99
|
+
*/
|
|
100
|
+
nodes: PropTypes.string,
|
|
101
|
+
/**
|
|
102
|
+
* The resize property of the textarea
|
|
103
|
+
*/
|
|
104
|
+
resize: PropTypes.string,
|
|
105
|
+
/**
|
|
106
|
+
* The header for the preview component.
|
|
107
|
+
*/
|
|
108
|
+
header: PropTypes.node,
|
|
109
|
+
/**
|
|
110
|
+
* The page title for the expanded preview.
|
|
111
|
+
*/
|
|
112
|
+
pageTitle: PropTypes.string,
|
|
113
|
+
/**
|
|
114
|
+
* The name used to acces the nodes
|
|
115
|
+
*/
|
|
116
|
+
name: PropTypes.string.isRequired,
|
|
117
|
+
/**
|
|
118
|
+
* The function to run when a new window portal can be opened
|
|
119
|
+
*/
|
|
120
|
+
onBlock: PropTypes.func.isRequired
|
|
121
|
+
};
|
|
122
|
+
ExpandableLexicalPreview.defaultProps = {
|
|
123
|
+
color: 'paragraph',
|
|
124
|
+
resize: 'vertical'
|
|
125
|
+
};
|
|
126
|
+
export default ExpandableLexicalPreview;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { useState, useEffect, useMemo } from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import styleNames from '@pareto-engineering/bem/exports';
|
|
6
|
+
|
|
7
|
+
// Local Definitions
|
|
8
|
+
import { useTheme } from "../../../../a";
|
|
9
|
+
import "./styles.scss";
|
|
10
|
+
const baseClassName = styleNames.base;
|
|
11
|
+
const copyStyles = (sourceDocument, targetDocument) => {
|
|
12
|
+
Array.from(sourceDocument.querySelectorAll('link[rel="stylesheet"], style')).forEach(link => {
|
|
13
|
+
targetDocument.head.appendChild(link.cloneNode(true));
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* This is the component description.
|
|
18
|
+
*/
|
|
19
|
+
const NewWindowPortal = ({
|
|
20
|
+
children,
|
|
21
|
+
pageTitle,
|
|
22
|
+
onBlock,
|
|
23
|
+
onOpen
|
|
24
|
+
}) => {
|
|
25
|
+
const [newWindow, setNewWindow] = useState(null);
|
|
26
|
+
const container = useMemo(() => document.createElement('div'), []);
|
|
27
|
+
const {
|
|
28
|
+
userTheme = 'light'
|
|
29
|
+
} = useTheme();
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!container) return;
|
|
32
|
+
container.classList.add(baseClassName, 'new-window-portal', `ui-${userTheme}`);
|
|
33
|
+
const newExternalWindow = window.open('', pageTitle, 'width="100%",height="100%"');
|
|
34
|
+
if (newExternalWindow) {
|
|
35
|
+
newExternalWindow.document.title = pageTitle;
|
|
36
|
+
newExternalWindow.document.body.appendChild(container);
|
|
37
|
+
setNewWindow(newExternalWindow);
|
|
38
|
+
onOpen();
|
|
39
|
+
} else {
|
|
40
|
+
console.warn('A new window / tab could not be opened. Check your settings and/or extensions, maybe it was blocked.');
|
|
41
|
+
onBlock();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line consistent-return
|
|
45
|
+
return () => {
|
|
46
|
+
container.classList.remove(...container.classList);
|
|
47
|
+
newExternalWindow?.close();
|
|
48
|
+
};
|
|
49
|
+
}, [container, pageTitle, userTheme]);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (newWindow) {
|
|
52
|
+
copyStyles(document, newWindow.document);
|
|
53
|
+
}
|
|
54
|
+
}, [newWindow]);
|
|
55
|
+
return /*#__PURE__*/createPortal(children, container);
|
|
56
|
+
};
|
|
57
|
+
NewWindowPortal.propTypes = {
|
|
58
|
+
/**
|
|
59
|
+
* The children JSX
|
|
60
|
+
*/
|
|
61
|
+
children: PropTypes.node,
|
|
62
|
+
/**
|
|
63
|
+
* The new window page title
|
|
64
|
+
*/
|
|
65
|
+
pageTitle: PropTypes.string.isRequired
|
|
66
|
+
};
|
|
67
|
+
NewWindowPortal.defaultProps = {
|
|
68
|
+
// someProp:false
|
|
69
|
+
};
|
|
70
|
+
export default NewWindowPortal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NewWindowPortal } from "./NewWindowPortal";
|
|
@@ -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.81",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/es/index.js",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"@lexical/selection": "0.12.2",
|
|
60
60
|
"@lexical/table": "0.12.2",
|
|
61
61
|
"@lexical/utils": "0.12.2",
|
|
62
|
-
"@pareto-engineering/assets": "^4.0.0-alpha.
|
|
62
|
+
"@pareto-engineering/assets": "^4.0.0-alpha.81",
|
|
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.81",
|
|
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": "b44cdb0922a67109aaf2fa1dce4943882ce3a512"
|
|
86
86
|
}
|
|
@@ -16,11 +16,14 @@ export default {
|
|
|
16
16
|
},
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const ariaDescribedby = 'test-tooltip'
|
|
20
|
-
|
|
21
19
|
export const Base = {
|
|
22
20
|
args:{
|
|
23
21
|
children:(
|
|
22
|
+
<Button>
|
|
23
|
+
Hover on me!
|
|
24
|
+
</Button>
|
|
25
|
+
),
|
|
26
|
+
content:(
|
|
24
27
|
<div>
|
|
25
28
|
<ul>
|
|
26
29
|
<li>This is the tooltips content</li>
|
|
@@ -29,7 +32,7 @@ export const Base = {
|
|
|
29
32
|
</ul>
|
|
30
33
|
</div>
|
|
31
34
|
),
|
|
32
|
-
|
|
35
|
+
description:'test-tooltip',
|
|
33
36
|
},
|
|
34
37
|
render:(args) => (
|
|
35
38
|
<div
|
|
@@ -42,15 +45,7 @@ export const Base = {
|
|
|
42
45
|
alignItems :'center',
|
|
43
46
|
}}
|
|
44
47
|
>
|
|
45
|
-
<
|
|
46
|
-
<Button>
|
|
47
|
-
Hover on me!
|
|
48
|
-
</Button>
|
|
49
|
-
<Tooltip {...args} />
|
|
50
|
-
</div>
|
|
51
|
-
<p>
|
|
52
|
-
With some more content around
|
|
53
|
-
</p>
|
|
48
|
+
<Tooltip {...args} />
|
|
54
49
|
</div>
|
|
55
50
|
),
|
|
56
51
|
}
|
|
@@ -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
|
+
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
2
|
import * as React from 'react'
|
|
3
3
|
|
|
4
|
-
import { ExpandableLexicalPreview } from 'ui'
|
|
4
|
+
import { ExpandableLexicalPreview, AppContextProvider } 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
|
|
11
11
|
},
|
|
12
|
-
decorators:[
|
|
13
|
-
|
|
12
|
+
decorators:[
|
|
13
|
+
(storyfn) => (
|
|
14
|
+
<AppContextProvider>
|
|
15
|
+
{ storyfn() }
|
|
16
|
+
</AppContextProvider>
|
|
17
|
+
),
|
|
18
|
+
],
|
|
19
|
+
argTypes:{
|
|
14
20
|
color:{ control: 'text' },
|
|
15
21
|
},
|
|
16
22
|
}
|
|
@@ -25,5 +31,7 @@ const Template = (args) => (
|
|
|
25
31
|
export const Base = Template.bind({})
|
|
26
32
|
Base.args = {
|
|
27
33
|
nodes,
|
|
28
|
-
|
|
34
|
+
name :'taskDescription',
|
|
35
|
+
pageTitle:'Task Instructions',
|
|
36
|
+
header :'Task Instructions',
|
|
29
37
|
}
|
|
@@ -20,9 +20,9 @@ $default-font-size: calc(1em * var(--s-1));
|
|
|
20
20
|
color: var(--on-x, var(--on-#{$default-color}));
|
|
21
21
|
display: inline-flex;
|
|
22
22
|
font-size: $default-font-size;
|
|
23
|
+
gap: calc(var(--gap) / 2);
|
|
23
24
|
padding: $default-padding;
|
|
24
25
|
white-space: nowrap;
|
|
25
|
-
|
|
26
26
|
&.#{bem.$modifier-compact} {
|
|
27
27
|
padding: $compact-padding;
|
|
28
28
|
}
|
|
@@ -22,6 +22,8 @@ const Tooltip = ({
|
|
|
22
22
|
style,
|
|
23
23
|
position,
|
|
24
24
|
color,
|
|
25
|
+
description,
|
|
26
|
+
content,
|
|
25
27
|
children,
|
|
26
28
|
// ...otherProps
|
|
27
29
|
}) => (
|
|
@@ -31,15 +33,26 @@ const Tooltip = ({
|
|
|
31
33
|
baseClassName,
|
|
32
34
|
componentClassName,
|
|
33
35
|
userClassName,
|
|
34
|
-
position,
|
|
35
36
|
`x-${color}`,
|
|
36
37
|
]
|
|
37
38
|
.filter((e) => e)
|
|
38
39
|
.join(' ')}
|
|
39
40
|
style={style}
|
|
40
|
-
|
|
41
|
+
|
|
41
42
|
>
|
|
42
|
-
|
|
43
|
+
<div
|
|
44
|
+
className="tooltip-trigger-wrapper"
|
|
45
|
+
aria-describedby={description}
|
|
46
|
+
>
|
|
47
|
+
{children}
|
|
48
|
+
</div>
|
|
49
|
+
<div
|
|
50
|
+
className={`tooltip-content ${position}`}
|
|
51
|
+
role="tooltip"
|
|
52
|
+
id={description}
|
|
53
|
+
>
|
|
54
|
+
{content}
|
|
55
|
+
</div>
|
|
43
56
|
</div>
|
|
44
57
|
)
|
|
45
58
|
|
|
@@ -60,10 +73,20 @@ Tooltip.propTypes = {
|
|
|
60
73
|
style:PropTypes.objectOf(PropTypes.string),
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
|
-
* The children JSX
|
|
76
|
+
* The children JSX where the tooltip will be applied
|
|
64
77
|
*/
|
|
65
78
|
children:PropTypes.node.isRequired,
|
|
66
79
|
|
|
80
|
+
/**
|
|
81
|
+
* The content JSX that renders the tooltip content
|
|
82
|
+
*/
|
|
83
|
+
content:PropTypes.node.isRequired,
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The text description to identify the element that describes the tooltip
|
|
87
|
+
*/
|
|
88
|
+
description:PropTypes.string.isRequired,
|
|
89
|
+
|
|
67
90
|
/**
|
|
68
91
|
* The position of the tooltip with respect to the trigger element
|
|
69
92
|
*/
|
|
@@ -7,47 +7,55 @@ $default-inline-padding: var(--theme-default-padding);
|
|
|
7
7
|
$default-width: var(--tooltip-width, 20rem);
|
|
8
8
|
|
|
9
9
|
.#{bem.$base}.tooltip {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
display: inline-block;
|
|
11
|
+
position: relative;
|
|
12
|
+
|
|
13
|
+
> .tooltip-content {
|
|
14
|
+
background: var(--x);
|
|
15
|
+
border: var(--theme-default-border-style) var(--ui-lines);
|
|
16
|
+
border-radius: calc(var(--theme-default-border-radius) / 2);
|
|
17
|
+
opacity: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
padding: $default-block-padding $default-inline-padding;
|
|
20
|
+
position: absolute;
|
|
21
|
+
transform: translateX(var(--horizontal, 0)) translateY(var(--vertical, 0));
|
|
22
|
+
transition: opacity .2s ease, transform .2s ease;
|
|
23
|
+
visibility: hidden;
|
|
24
|
+
width: $default-width;
|
|
25
|
+
z-index: 10;
|
|
26
|
+
|
|
27
|
+
&.top {
|
|
28
|
+
--horizontal: -50%;
|
|
29
|
+
bottom: calc(100% + $default-block-padding);
|
|
30
|
+
left: 50%;
|
|
27
31
|
}
|
|
28
|
-
}
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
&.right {
|
|
34
|
+
--vertical: 50%;
|
|
35
|
+
bottom: 50%;
|
|
36
|
+
left: calc(100% + $default-inline-padding);
|
|
37
|
+
}
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
&.bottom {
|
|
40
|
+
--horizontal: -50%;
|
|
41
|
+
left: 50%;
|
|
42
|
+
top: calc(100% + $default-block-padding);
|
|
43
|
+
}
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
&.left {
|
|
46
|
+
--vertical: 50%;
|
|
47
|
+
bottom: 50%;
|
|
48
|
+
right: calc(100% + $default-inline-padding);
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
> .tooltip-trigger-wrapper {
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
|
|
55
|
+
&:is(:hover, :focus-visible, :active) + .tooltip-content {
|
|
56
|
+
opacity: 1;
|
|
57
|
+
transition-delay: 200ms;
|
|
58
|
+
visibility: visible;
|
|
59
|
+
}
|
|
52
60
|
}
|
|
53
61
|
}
|
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} />
|