@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
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var React = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _html = require("@lexical/html");
|
|
9
|
-
var _LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
12
|
-
var _Button = require("../../../Button");
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
17
|
-
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
18
|
-
|
|
19
|
-
// Local Definitions
|
|
20
|
-
|
|
21
|
-
const baseClassName = _exports.default.base;
|
|
22
|
-
const componentClassName = 'expand-button';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* This is the component description.
|
|
26
|
-
*/
|
|
27
|
-
const ExpandButton = _ref => {
|
|
28
|
-
let {
|
|
29
|
-
id,
|
|
30
|
-
className: userClassName,
|
|
31
|
-
style,
|
|
32
|
-
onResolve,
|
|
33
|
-
title
|
|
34
|
-
// ...otherProps
|
|
35
|
-
} = _ref;
|
|
36
|
-
const [editor] = (0, _LexicalComposerContext.useLexicalComposerContext)();
|
|
37
|
-
return /*#__PURE__*/React.createElement(_Button.Button, {
|
|
38
|
-
id: id,
|
|
39
|
-
className: [baseClassName, componentClassName, userClassName, 'ai-icon'].filter(e => e).join(' '),
|
|
40
|
-
style: style,
|
|
41
|
-
color: "background-far",
|
|
42
|
-
isCompact: true,
|
|
43
|
-
onClick: () => {
|
|
44
|
-
editor.getEditorState().read(() => {
|
|
45
|
-
const rawHtml = (0, _html.$generateHtmlFromNodes)(editor);
|
|
46
|
-
const preview = window.open('', '_blank', 'width=600,height=600');
|
|
47
|
-
preview.document.write(`<html>
|
|
48
|
-
<title>${title || 'Preview'}</title>
|
|
49
|
-
<style>
|
|
50
|
-
li:has(ol, ul) {
|
|
51
|
-
list-style-type: none;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
p,
|
|
55
|
-
span,
|
|
56
|
-
strong,
|
|
57
|
-
em,
|
|
58
|
-
li {
|
|
59
|
-
&.underlined {
|
|
60
|
-
text-decoration: underline;
|
|
61
|
-
|
|
62
|
-
&.strikethrough {
|
|
63
|
-
text-decoration: underline line-through;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&.strikethrough {
|
|
68
|
-
text-decoration: line-through;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&.italic {
|
|
72
|
-
font-style: italic;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
:first-child {
|
|
77
|
-
margin-top: 0;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&::placeholder {
|
|
81
|
-
color: #abadb3;
|
|
82
|
-
}
|
|
83
|
-
</style>
|
|
84
|
-
<body>
|
|
85
|
-
<style></style>
|
|
86
|
-
${rawHtml}
|
|
87
|
-
<button onclick="window.close()">Close Preview</button>
|
|
88
|
-
</body></html>`);
|
|
89
|
-
});
|
|
90
|
-
onResolve();
|
|
91
|
-
}
|
|
92
|
-
}, "D");
|
|
93
|
-
};
|
|
94
|
-
ExpandButton.propTypes = {
|
|
95
|
-
/**
|
|
96
|
-
* The HTML id for this element
|
|
97
|
-
*/
|
|
98
|
-
id: _propTypes.default.string,
|
|
99
|
-
/**
|
|
100
|
-
* The HTML class names for this element
|
|
101
|
-
*/
|
|
102
|
-
className: _propTypes.default.string,
|
|
103
|
-
/**
|
|
104
|
-
* The React-written, css properties for this element.
|
|
105
|
-
*/
|
|
106
|
-
style: _propTypes.default.objectOf(_propTypes.default.string)
|
|
107
|
-
};
|
|
108
|
-
ExpandButton.defaultProps = {
|
|
109
|
-
// color: 'paragraph',
|
|
110
|
-
// resize: 'vertical',
|
|
111
|
-
};
|
|
112
|
-
var _default = exports.default = ExpandButton;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ExpandButton", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _ExpandButton.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _ExpandButton = _interopRequireDefault(require("./ExpandButton"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "ExpandButton", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _ExpandButton.ExpandButton;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _ExpandButton = require("./ExpandButton");
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* stylelint-disable max-nesting-depth -- required */
|
|
3
|
-
|
|
4
|
-
@use "@pareto-engineering/bem";
|
|
5
|
-
@use "@pareto-engineering/styles/src/mixins";
|
|
6
|
-
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
|
-
|
|
8
|
-
.#{bem.$base}.expandable-lexical-preview {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
flex-wrap: wrap;
|
|
12
|
-
gap: var(--gap);
|
|
13
|
-
width: 100%;
|
|
14
|
-
|
|
15
|
-
&.collapsed {
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
> .title {
|
|
20
|
-
margin: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
> .#{bem.$base}.button {
|
|
25
|
-
align-items: center;
|
|
26
|
-
border: 1px solid var(--outline-inputs);
|
|
27
|
-
display: flex;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
> .lexical-content {
|
|
31
|
-
position: relative;
|
|
32
|
-
|
|
33
|
-
> .content-editable {
|
|
34
|
-
background: var(--background-inputs);
|
|
35
|
-
border: 1px solid var(--outline-inputs);
|
|
36
|
-
border-radius: var(--theme-default-border-radius);
|
|
37
|
-
color: var(--y);
|
|
38
|
-
overflow: auto;
|
|
39
|
-
padding: var(--gap);
|
|
40
|
-
resize: var(--resize);
|
|
41
|
-
|
|
42
|
-
li:has(ol, ul) {
|
|
43
|
-
list-style-type: none;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
p,
|
|
47
|
-
span,
|
|
48
|
-
strong,
|
|
49
|
-
em,
|
|
50
|
-
li {
|
|
51
|
-
&.underlined {
|
|
52
|
-
text-decoration: underline;
|
|
53
|
-
|
|
54
|
-
&.strikethrough {
|
|
55
|
-
text-decoration: underline line-through;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&.strikethrough {
|
|
60
|
-
text-decoration: line-through;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.italic {
|
|
64
|
-
font-style: italic;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:first-child {
|
|
69
|
-
margin-top: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&::placeholder {
|
|
73
|
-
color: var(--metadata);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
> .#{bem.$base}.expand-button {
|
|
78
|
-
border: 1px solid var(--outline-inputs);
|
|
79
|
-
position: absolute;
|
|
80
|
-
right: 1em;
|
|
81
|
-
top: 1em;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
5
|
-
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
|
|
6
|
-
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
7
|
-
import { AutoLinkNode, LinkNode } from '@lexical/link';
|
|
8
|
-
import { ListItemNode, ListNode } from '@lexical/list';
|
|
9
|
-
import PropTypes from 'prop-types';
|
|
10
|
-
import styleNames from '@pareto-engineering/bem/exports';
|
|
11
|
-
import "./styles.scss";
|
|
12
|
-
|
|
13
|
-
// Local Definitions
|
|
14
|
-
|
|
15
|
-
const baseClassName = styleNames.base;
|
|
16
|
-
const componentClassName = 'lexical-preview';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* This is the component description.
|
|
20
|
-
*/
|
|
21
|
-
const LexicalPreview = ({
|
|
22
|
-
id,
|
|
23
|
-
className: userClassName,
|
|
24
|
-
style,
|
|
25
|
-
nodes,
|
|
26
|
-
color
|
|
27
|
-
// ...otherProps
|
|
28
|
-
}) => {
|
|
29
|
-
const initialConfig = {
|
|
30
|
-
nameSpace: id,
|
|
31
|
-
editable: false,
|
|
32
|
-
editorState: nodes,
|
|
33
|
-
theme: {
|
|
34
|
-
text: {
|
|
35
|
-
italic: 'italic',
|
|
36
|
-
strikethrough: 'strikethrough',
|
|
37
|
-
underline: 'underlined'
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
nodes: [AutoLinkNode, LinkNode, ListNode, ListItemNode]
|
|
41
|
-
};
|
|
42
|
-
return /*#__PURE__*/React.createElement(LexicalComposer, {
|
|
43
|
-
initialConfig: initialConfig
|
|
44
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
45
|
-
id: id,
|
|
46
|
-
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
47
|
-
style: style
|
|
48
|
-
}, /*#__PURE__*/React.createElement(RichTextPlugin, {
|
|
49
|
-
contentEditable: /*#__PURE__*/React.createElement(ContentEditable, {
|
|
50
|
-
id: id,
|
|
51
|
-
className: "content-editable"
|
|
52
|
-
})
|
|
53
|
-
})));
|
|
54
|
-
};
|
|
55
|
-
LexicalPreview.propTypes = {
|
|
56
|
-
/**
|
|
57
|
-
* The HTML id for this element
|
|
58
|
-
*/
|
|
59
|
-
id: PropTypes.string,
|
|
60
|
-
/**
|
|
61
|
-
* The HTML class names for this element
|
|
62
|
-
*/
|
|
63
|
-
className: PropTypes.string,
|
|
64
|
-
/**
|
|
65
|
-
* The React-written, css properties for this element.
|
|
66
|
-
*/
|
|
67
|
-
style: PropTypes.objectOf(PropTypes.string),
|
|
68
|
-
/**
|
|
69
|
-
* Color of the text
|
|
70
|
-
*/
|
|
71
|
-
color: PropTypes.string,
|
|
72
|
-
/**
|
|
73
|
-
* The nodes to render in the form of a json string
|
|
74
|
-
*/
|
|
75
|
-
nodes: PropTypes.string
|
|
76
|
-
};
|
|
77
|
-
LexicalPreview.defaultProps = {
|
|
78
|
-
color: 'paragraph'
|
|
79
|
-
};
|
|
80
|
-
export default LexicalPreview;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
|
|
3
|
-
@use "@pareto-engineering/bem";
|
|
4
|
-
@use "@pareto-engineering/styles/src/mixins";
|
|
5
|
-
@use "@pareto-engineering/styles/src/globals" as *;
|
|
6
|
-
|
|
7
|
-
.#{bem.$base}.lexical-preview {
|
|
8
|
-
> .content-editable {
|
|
9
|
-
color: var(--y);
|
|
10
|
-
overflow: auto;
|
|
11
|
-
|
|
12
|
-
li:has(ol, ul) {
|
|
13
|
-
list-style-type: none;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
p,
|
|
17
|
-
span,
|
|
18
|
-
strong,
|
|
19
|
-
em,
|
|
20
|
-
li {
|
|
21
|
-
&.underlined {
|
|
22
|
-
text-decoration: underline;
|
|
23
|
-
|
|
24
|
-
&.strikethrough {
|
|
25
|
-
text-decoration: underline line-through;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&.strikethrough {
|
|
30
|
-
text-decoration: line-through;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&.italic {
|
|
34
|
-
font-style: italic;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
:first-child {
|
|
39
|
-
margin-top: 0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
&::placeholder {
|
|
43
|
-
color: var(--metadata);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { useState, useMemo } from 'react';
|
|
5
|
-
import { LexicalComposer } from '@lexical/react/LexicalComposer';
|
|
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';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
import styleNames from '@pareto-engineering/bem/exports';
|
|
12
|
-
import { Button } from "../Button";
|
|
13
|
-
import "./styles.scss";
|
|
14
|
-
import { ExpandButton } from "./common";
|
|
15
|
-
|
|
16
|
-
// Local Definitions
|
|
17
|
-
|
|
18
|
-
const baseClassName = styleNames.base;
|
|
19
|
-
const componentClassName = 'expandable-lexical-preview';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* This is the component description.
|
|
23
|
-
*/
|
|
24
|
-
const ExpandableLexicalPreview = ({
|
|
25
|
-
id,
|
|
26
|
-
className: userClassName,
|
|
27
|
-
style,
|
|
28
|
-
nodes,
|
|
29
|
-
color,
|
|
30
|
-
resize,
|
|
31
|
-
title
|
|
32
|
-
// ...otherProps
|
|
33
|
-
}) => {
|
|
34
|
-
const initialConfig = {
|
|
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
|
-
};
|
|
47
|
-
const [isExpanded, setIsExpanded] = useState(false);
|
|
48
|
-
const handleButtonClick = () => {
|
|
49
|
-
setIsExpanded(!isExpanded);
|
|
50
|
-
};
|
|
51
|
-
const Content = useMemo(() => /*#__PURE__*/React.createElement("div", {
|
|
52
|
-
className: "lexical-content"
|
|
53
|
-
}, /*#__PURE__*/React.createElement(RichTextPlugin, {
|
|
54
|
-
contentEditable: /*#__PURE__*/React.createElement(ContentEditable, {
|
|
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
|
|
64
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
65
|
-
id: id,
|
|
66
|
-
className: [baseClassName, componentClassName, userClassName, `y-${color}`, isExpanded && 'collapsed'].filter(e => e).join(' '),
|
|
67
|
-
style: {
|
|
68
|
-
'--resize': resize,
|
|
69
|
-
...style
|
|
70
|
-
}
|
|
71
|
-
}, typeof title === 'string' ? /*#__PURE__*/React.createElement("p", {
|
|
72
|
-
className: "title h2"
|
|
73
|
-
}, title) : title, isExpanded && /*#__PURE__*/React.createElement(Button, {
|
|
74
|
-
onClick: handleButtonClick,
|
|
75
|
-
color: "background-far",
|
|
76
|
-
isCompact: true
|
|
77
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
78
|
-
className: "ai-icon c-x x-paragraph"
|
|
79
|
-
}, "C")), !isExpanded && Content));
|
|
80
|
-
};
|
|
81
|
-
ExpandableLexicalPreview.propTypes = {
|
|
82
|
-
/**
|
|
83
|
-
* The HTML id for this element
|
|
84
|
-
*/
|
|
85
|
-
id: PropTypes.string,
|
|
86
|
-
/**
|
|
87
|
-
* The HTML class names for this element
|
|
88
|
-
*/
|
|
89
|
-
className: PropTypes.string,
|
|
90
|
-
/**
|
|
91
|
-
* The React-written, css properties for this element.
|
|
92
|
-
*/
|
|
93
|
-
style: PropTypes.objectOf(PropTypes.string),
|
|
94
|
-
/**
|
|
95
|
-
* Color of the text
|
|
96
|
-
*/
|
|
97
|
-
color: PropTypes.string,
|
|
98
|
-
/**
|
|
99
|
-
* The nodes to render in the form of a json string
|
|
100
|
-
*/
|
|
101
|
-
nodes: PropTypes.string,
|
|
102
|
-
/**
|
|
103
|
-
* The resize property of the textarea
|
|
104
|
-
*/
|
|
105
|
-
resize: PropTypes.string,
|
|
106
|
-
/**
|
|
107
|
-
* The title for the preview.
|
|
108
|
-
*/
|
|
109
|
-
title: PropTypes.string
|
|
110
|
-
};
|
|
111
|
-
ExpandableLexicalPreview.defaultProps = {
|
|
112
|
-
color: 'paragraph',
|
|
113
|
-
resize: 'vertical'
|
|
114
|
-
};
|
|
115
|
-
export default ExpandableLexicalPreview;
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { $generateHtmlFromNodes } from '@lexical/html';
|
|
5
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import styleNames from '@pareto-engineering/bem/exports';
|
|
8
|
-
import { Button } from "../../../Button";
|
|
9
|
-
|
|
10
|
-
// Local Definitions
|
|
11
|
-
|
|
12
|
-
const baseClassName = styleNames.base;
|
|
13
|
-
const componentClassName = 'expand-button';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* This is the component description.
|
|
17
|
-
*/
|
|
18
|
-
const ExpandButton = ({
|
|
19
|
-
id,
|
|
20
|
-
className: userClassName,
|
|
21
|
-
style,
|
|
22
|
-
onResolve,
|
|
23
|
-
title
|
|
24
|
-
// ...otherProps
|
|
25
|
-
}) => {
|
|
26
|
-
const [editor] = useLexicalComposerContext();
|
|
27
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
28
|
-
id: id,
|
|
29
|
-
className: [baseClassName, componentClassName, userClassName, 'ai-icon'].filter(e => e).join(' '),
|
|
30
|
-
style: style,
|
|
31
|
-
color: "background-far",
|
|
32
|
-
isCompact: true,
|
|
33
|
-
onClick: () => {
|
|
34
|
-
editor.getEditorState().read(() => {
|
|
35
|
-
const rawHtml = $generateHtmlFromNodes(editor);
|
|
36
|
-
const preview = window.open('', '_blank', 'width=600,height=600');
|
|
37
|
-
preview.document.write(`<html>
|
|
38
|
-
<title>${title || 'Preview'}</title>
|
|
39
|
-
<style>
|
|
40
|
-
li:has(ol, ul) {
|
|
41
|
-
list-style-type: none;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
p,
|
|
45
|
-
span,
|
|
46
|
-
strong,
|
|
47
|
-
em,
|
|
48
|
-
li {
|
|
49
|
-
&.underlined {
|
|
50
|
-
text-decoration: underline;
|
|
51
|
-
|
|
52
|
-
&.strikethrough {
|
|
53
|
-
text-decoration: underline line-through;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
&.strikethrough {
|
|
58
|
-
text-decoration: line-through;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
&.italic {
|
|
62
|
-
font-style: italic;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
:first-child {
|
|
67
|
-
margin-top: 0;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&::placeholder {
|
|
71
|
-
color: #abadb3;
|
|
72
|
-
}
|
|
73
|
-
</style>
|
|
74
|
-
<body>
|
|
75
|
-
<style></style>
|
|
76
|
-
${rawHtml}
|
|
77
|
-
<button onclick="window.close()">Close Preview</button>
|
|
78
|
-
</body></html>`);
|
|
79
|
-
});
|
|
80
|
-
onResolve();
|
|
81
|
-
}
|
|
82
|
-
}, "D");
|
|
83
|
-
};
|
|
84
|
-
ExpandButton.propTypes = {
|
|
85
|
-
/**
|
|
86
|
-
* The HTML id for this element
|
|
87
|
-
*/
|
|
88
|
-
id: PropTypes.string,
|
|
89
|
-
/**
|
|
90
|
-
* The HTML class names for this element
|
|
91
|
-
*/
|
|
92
|
-
className: PropTypes.string,
|
|
93
|
-
/**
|
|
94
|
-
* The React-written, css properties for this element.
|
|
95
|
-
*/
|
|
96
|
-
style: PropTypes.objectOf(PropTypes.string)
|
|
97
|
-
};
|
|
98
|
-
ExpandButton.defaultProps = {
|
|
99
|
-
// color: 'paragraph',
|
|
100
|
-
// resize: 'vertical',
|
|
101
|
-
};
|
|
102
|
-
export default ExpandButton;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as ExpandButton } from "./ExpandButton";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ExpandButton } from "./ExpandButton";
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
/* stylelint-disable max-nesting-depth -- required */
|
|
3
|
-
|
|
4
|
-
@use "@pareto-engineering/bem";
|
|
5
|
-
@use "@pareto-engineering/styles/src/mixins";
|
|
6
|
-
@use "@pareto-engineering/styles/src/globals" as *;
|
|
7
|
-
|
|
8
|
-
.#{bem.$base}.expandable-lexical-preview {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
flex-wrap: wrap;
|
|
12
|
-
gap: var(--gap);
|
|
13
|
-
width: 100%;
|
|
14
|
-
|
|
15
|
-
&.collapsed {
|
|
16
|
-
flex-direction: row;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
> .title {
|
|
20
|
-
margin: 0;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
> .#{bem.$base}.button {
|
|
25
|
-
align-items: center;
|
|
26
|
-
border: 1px solid var(--outline-inputs);
|
|
27
|
-
display: flex;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
> .lexical-content {
|
|
31
|
-
position: relative;
|
|
32
|
-
|
|
33
|
-
> .content-editable {
|
|
34
|
-
background: var(--background-inputs);
|
|
35
|
-
border: 1px solid var(--outline-inputs);
|
|
36
|
-
border-radius: var(--theme-default-border-radius);
|
|
37
|
-
color: var(--y);
|
|
38
|
-
overflow: auto;
|
|
39
|
-
padding: var(--gap);
|
|
40
|
-
resize: var(--resize);
|
|
41
|
-
|
|
42
|
-
li:has(ol, ul) {
|
|
43
|
-
list-style-type: none;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
p,
|
|
47
|
-
span,
|
|
48
|
-
strong,
|
|
49
|
-
em,
|
|
50
|
-
li {
|
|
51
|
-
&.underlined {
|
|
52
|
-
text-decoration: underline;
|
|
53
|
-
|
|
54
|
-
&.strikethrough {
|
|
55
|
-
text-decoration: underline line-through;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&.strikethrough {
|
|
60
|
-
text-decoration: line-through;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&.italic {
|
|
64
|
-
font-style: italic;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
:first-child {
|
|
69
|
-
margin-top: 0;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&::placeholder {
|
|
73
|
-
color: var(--metadata);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
> .#{bem.$base}.expand-button {
|
|
78
|
-
border: 1px solid var(--outline-inputs);
|
|
79
|
-
position: absolute;
|
|
80
|
-
right: 1em;
|
|
81
|
-
top: 1em;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/* @pareto-engineering/generator-front 1.0.12 */
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import { LexicalPreview } from 'ui'
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
title :'a/LexicalPreview',
|
|
8
|
-
component :LexicalPreview,
|
|
9
|
-
subcomponents:{
|
|
10
|
-
// Item:TextareaInput.Item
|
|
11
|
-
},
|
|
12
|
-
decorators:[],
|
|
13
|
-
argTypes :{
|
|
14
|
-
color:{ control: 'text' },
|
|
15
|
-
},
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line no-useless-escape
|
|
19
|
-
const nodes = '{\"root\":{\"children\":[{\"children\":[{\"children\":[{\"detail\":0,\"format\":1,\"mode\":\"normal\",\"style\":\"\",\"text\":\"This is bold.\",\"type\":\"text\",\"version\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"listitem\",\"version\":1,\"value\":1},{\"children\":[{\"detail\":0,\"format\":2,\"mode\":\"normal\",\"style\":\"\",\"text\":\"This is italic.\",\"type\":\"text\",\"version\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"listitem\",\"version\":1,\"value\":2},{\"children\":[{\"detail\":0,\"format\":8,\"mode\":\"normal\",\"style\":\"\",\"text\":\"This is underlined.\",\"type\":\"text\",\"version\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"listitem\",\"version\":1,\"value\":3},{\"children\":[{\"children\":[{\"children\":[{\"detail\":0,\"format\":4,\"mode\":\"normal\",\"style\":\"\",\"text\":\"This is struck.\",\"type\":\"text\",\"version\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":1,\"type\":\"listitem\",\"version\":1,\"value\":1}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"list\",\"version\":1,\"listType\":\"bullet\",\"start\":1,\"tag\":\"ul\"}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"listitem\",\"version\":1,\"value\":4}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"list\",\"version\":1,\"listType\":\"bullet\",\"start\":1,\"tag\":\"ul\"}],\"direction\":\"ltr\",\"format\":\"\",\"indent\":0,\"type\":\"root\",\"version\":1}}'
|
|
20
|
-
|
|
21
|
-
const Template = (args) => (
|
|
22
|
-
<LexicalPreview {...args} />
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
export const Base = Template.bind({})
|
|
26
|
-
Base.args = {
|
|
27
|
-
nodes,
|
|
28
|
-
}
|