@pareto-engineering/design-system 4.0.0-alpha.70 → 4.0.0-alpha.72
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/{c/ContentSlides/common/Slide/Slide.js → a/LexicalPreview/LexicalPreview.js} +43 -28
- package/dist/cjs/{c/ContentSlides/common/Sidebar → a/LexicalPreview}/index.js +3 -3
- package/dist/cjs/a/LexicalPreview/styles.scss +46 -0
- package/dist/cjs/a/People/common/Person/Person.js +7 -2
- package/dist/cjs/a/ProgressBar/ProgressBar.js +3 -2
- package/dist/cjs/a/ProgressBar/styles.scss +11 -1
- package/dist/cjs/a/XMLEditor/XMLEditor.js +14 -6
- package/dist/cjs/a/index.js +8 -1
- package/dist/cjs/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +125 -0
- package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +112 -0
- package/dist/cjs/{c/ContentSlides/common/Navigator → b/ExpandableLexicalPreview/common/ExpandButton}/index.js +3 -3
- package/dist/cjs/b/ExpandableLexicalPreview/common/index.js +12 -0
- package/dist/cjs/b/ExpandableLexicalPreview/index.js +13 -0
- package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +84 -0
- package/dist/cjs/b/index.js +8 -1
- package/dist/cjs/c/index.js +0 -13
- package/dist/cjs/f/fields/EditorInput/EditorInput.js +14 -3
- package/dist/cjs/f/fields/EditorInput/common/StopPropagationPlugin.js +30 -0
- package/dist/cjs/f/fields/EditorInput/common/index.js +7 -0
- package/dist/cjs/index.js +0 -11
- package/dist/es/a/LexicalPreview/LexicalPreview.js +80 -0
- package/dist/es/a/LexicalPreview/index.js +2 -0
- package/dist/es/a/LexicalPreview/styles.scss +46 -0
- package/dist/es/a/People/common/Person/Person.js +22 -15
- package/dist/es/a/ProgressBar/ProgressBar.js +3 -2
- package/dist/es/a/ProgressBar/styles.scss +11 -1
- package/dist/es/a/XMLEditor/XMLEditor.js +16 -10
- package/dist/es/a/index.js +2 -1
- package/dist/es/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +115 -0
- package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +102 -0
- package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
- package/dist/es/b/ExpandableLexicalPreview/common/index.js +1 -0
- package/dist/es/b/ExpandableLexicalPreview/index.js +2 -0
- package/dist/es/b/ExpandableLexicalPreview/styles.scss +84 -0
- package/dist/es/b/index.js +2 -1
- package/dist/es/c/index.js +0 -1
- package/dist/es/f/fields/EditorInput/EditorInput.js +15 -4
- package/dist/es/f/fields/EditorInput/common/StopPropagationPlugin.js +23 -0
- package/dist/es/f/fields/EditorInput/common/index.js +2 -1
- package/dist/es/index.js +0 -1
- package/package.json +5 -5
- package/src/stories/a/LexicalPreview.stories.jsx +28 -0
- package/src/stories/a/ProgressBar.stories.jsx +1 -1
- package/src/stories/b/ExpandableLexicalPreview.stories.jsx +29 -0
- package/src/stories/colors.js +4 -0
- package/src/ui/a/LexicalPreview/LexicalPreview.jsx +109 -0
- package/src/ui/a/LexicalPreview/index.js +2 -0
- package/src/ui/a/LexicalPreview/styles.scss +46 -0
- package/src/ui/a/People/common/Person/Person.jsx +31 -19
- package/src/ui/a/ProgressBar/ProgressBar.jsx +2 -0
- package/src/ui/a/ProgressBar/styles.scss +11 -1
- package/src/ui/a/XMLEditor/XMLEditor.jsx +16 -5
- package/src/ui/a/index.js +1 -0
- package/src/ui/b/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +157 -0
- package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +123 -0
- package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
- package/src/ui/b/ExpandableLexicalPreview/common/index.js +1 -0
- package/src/ui/b/ExpandableLexicalPreview/index.js +2 -0
- package/src/ui/b/ExpandableLexicalPreview/styles.scss +84 -0
- package/src/ui/b/index.js +1 -0
- package/src/ui/c/index.js +0 -1
- package/src/ui/f/fields/EditorInput/EditorInput.jsx +16 -2
- package/src/ui/f/fields/EditorInput/common/StopPropagationPlugin.jsx +29 -0
- package/src/ui/f/fields/EditorInput/common/index.jsx +1 -0
- package/src/ui/index.js +0 -1
- package/tests/__snapshots__/Storyshots.test.js.snap +1249 -641
- package/dist/cjs/c/ContentSlides/ContentSlides.js +0 -172
- package/dist/cjs/c/ContentSlides/Context.js +0 -10
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -126
- package/dist/cjs/c/ContentSlides/common/HorizontalMenu/index.js +0 -13
- package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +0 -128
- package/dist/cjs/c/ContentSlides/common/Sidebar/Sidebar.js +0 -94
- package/dist/cjs/c/ContentSlides/common/Slide/index.js +0 -13
- package/dist/cjs/c/ContentSlides/common/index.js +0 -33
- package/dist/cjs/c/ContentSlides/index.js +0 -27
- package/dist/cjs/c/ContentSlides/styles.scss +0 -312
- package/dist/cjs/c/ContentSlides/useContentSlides.js +0 -11
- package/dist/cjs/r/SwitchRouteMap/SwitchRouteMap.js +0 -58
- package/dist/cjs/r/SwitchRouteMap/index.js +0 -13
- package/dist/cjs/r/common/PrivateRoute/PrivateRoute.js +0 -74
- package/dist/cjs/r/common/PrivateRoute/index.js +0 -13
- package/dist/cjs/r/common/index.js +0 -12
- package/dist/cjs/r/index.js +0 -27
- package/dist/es/c/ContentSlides/ContentSlides.js +0 -160
- package/dist/es/c/ContentSlides/Context.js +0 -2
- package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -116
- package/dist/es/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
- package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +0 -118
- package/dist/es/c/ContentSlides/common/Navigator/index.js +0 -2
- package/dist/es/c/ContentSlides/common/Sidebar/Sidebar.js +0 -84
- package/dist/es/c/ContentSlides/common/Sidebar/index.js +0 -2
- package/dist/es/c/ContentSlides/common/Slide/Slide.js +0 -65
- package/dist/es/c/ContentSlides/common/Slide/index.js +0 -2
- package/dist/es/c/ContentSlides/common/index.js +0 -4
- package/dist/es/c/ContentSlides/index.js +0 -4
- package/dist/es/c/ContentSlides/styles.scss +0 -312
- package/dist/es/c/ContentSlides/useContentSlides.js +0 -3
- package/dist/es/r/SwitchRouteMap/SwitchRouteMap.js +0 -45
- package/dist/es/r/SwitchRouteMap/index.js +0 -2
- package/dist/es/r/common/PrivateRoute/PrivateRoute.js +0 -66
- package/dist/es/r/common/PrivateRoute/index.js +0 -2
- package/dist/es/r/common/index.js +0 -1
- package/dist/es/r/index.js +0 -2
- package/src/stories/c/ContentSlides.stories.jsx +0 -214
- package/src/ui/c/ContentSlides/ContentSlides.jsx +0 -214
- package/src/ui/c/ContentSlides/Context.js +0 -3
- package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +0 -145
- package/src/ui/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
- package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +0 -150
- package/src/ui/c/ContentSlides/common/Navigator/index.js +0 -2
- package/src/ui/c/ContentSlides/common/Sidebar/Sidebar.jsx +0 -135
- package/src/ui/c/ContentSlides/common/Sidebar/index.js +0 -2
- package/src/ui/c/ContentSlides/common/Slide/Slide.jsx +0 -87
- package/src/ui/c/ContentSlides/common/Slide/index.js +0 -2
- package/src/ui/c/ContentSlides/common/index.js +0 -4
- package/src/ui/c/ContentSlides/index.js +0 -4
- package/src/ui/c/ContentSlides/styles.scss +0 -312
- package/src/ui/c/ContentSlides/useContentSlides.js +0 -4
- package/src/ui/r/SwitchRouteMap/SwitchRouteMap.jsx +0 -64
- package/src/ui/r/SwitchRouteMap/index.js +0 -2
- package/src/ui/r/common/PrivateRoute/PrivateRoute.jsx +0 -73
- package/src/ui/r/common/PrivateRoute/index.js +0 -2
- package/src/ui/r/common/index.js +0 -1
- package/src/ui/r/index.js +0 -2
- /package/src/stories/a/{CodeEditor.stories.jsx → XMLEditor.stories.jsx} +0 -0
package/dist/cjs/{c/ContentSlides/common/Slide/Slide.js → a/LexicalPreview/LexicalPreview.js}
RENAMED
|
@@ -5,49 +5,64 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
9
|
+
var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
|
|
10
|
+
var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
11
|
+
var _link = require("@lexical/link");
|
|
12
|
+
var _list = require("@lexical/list");
|
|
8
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
14
|
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
10
|
-
|
|
15
|
+
require("./styles.scss");
|
|
11
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
17
|
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); }
|
|
13
18
|
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 && Object.prototype.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; }
|
|
14
19
|
/* @pareto-engineering/generator-front 1.0.12 */
|
|
20
|
+
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
15
21
|
|
|
16
22
|
// Local Definitions
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const componentClassName = 'slide';
|
|
24
|
+
const baseClassName = _exports.default.base;
|
|
25
|
+
const componentClassName = 'lexical-preview';
|
|
21
26
|
|
|
22
27
|
/**
|
|
23
28
|
* This is the component description.
|
|
24
29
|
*/
|
|
25
|
-
const
|
|
30
|
+
const LexicalPreview = _ref => {
|
|
26
31
|
let {
|
|
27
32
|
id,
|
|
28
33
|
className: userClassName,
|
|
29
34
|
style,
|
|
30
|
-
|
|
31
|
-
|
|
35
|
+
nodes,
|
|
36
|
+
color
|
|
32
37
|
// ...otherProps
|
|
33
38
|
} = _ref;
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
const initialConfig = {
|
|
40
|
+
nameSpace: id,
|
|
41
|
+
editable: false,
|
|
42
|
+
editorState: nodes,
|
|
43
|
+
theme: {
|
|
44
|
+
text: {
|
|
45
|
+
italic: 'italic',
|
|
46
|
+
strikethrough: 'strikethrough',
|
|
47
|
+
underline: 'underlined'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
nodes: [_link.AutoLinkNode, _link.LinkNode, _list.ListNode, _list.ListItemNode]
|
|
51
|
+
};
|
|
52
|
+
return /*#__PURE__*/React.createElement(_LexicalComposer.LexicalComposer, {
|
|
53
|
+
initialConfig: initialConfig
|
|
54
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
39
55
|
id: id,
|
|
40
|
-
className: [
|
|
41
|
-
// baseClassName,
|
|
42
|
-
isActive && _exports.default.modifierActive, componentClassName, userClassName].filter(e => e).join(' '),
|
|
56
|
+
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
43
57
|
style: style
|
|
44
|
-
}, /*#__PURE__*/React.createElement(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
}, /*#__PURE__*/React.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
|
|
59
|
+
contentEditable: /*#__PURE__*/React.createElement(_LexicalContentEditable.ContentEditable, {
|
|
60
|
+
id: id,
|
|
61
|
+
className: "content-editable"
|
|
62
|
+
})
|
|
63
|
+
})));
|
|
49
64
|
};
|
|
50
|
-
|
|
65
|
+
LexicalPreview.propTypes = {
|
|
51
66
|
/**
|
|
52
67
|
* The HTML id for this element
|
|
53
68
|
*/
|
|
@@ -61,15 +76,15 @@ Slide.propTypes = {
|
|
|
61
76
|
*/
|
|
62
77
|
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
63
78
|
/**
|
|
64
|
-
*
|
|
79
|
+
* Color of the text
|
|
65
80
|
*/
|
|
66
|
-
|
|
81
|
+
color: _propTypes.default.string,
|
|
67
82
|
/**
|
|
68
|
-
* The
|
|
83
|
+
* The nodes to render in the form of a json string
|
|
69
84
|
*/
|
|
70
|
-
|
|
85
|
+
nodes: _propTypes.default.string
|
|
71
86
|
};
|
|
72
|
-
|
|
73
|
-
|
|
87
|
+
LexicalPreview.defaultProps = {
|
|
88
|
+
color: 'paragraph'
|
|
74
89
|
};
|
|
75
|
-
var _default = exports.default =
|
|
90
|
+
var _default = exports.default = LexicalPreview;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "LexicalPreview", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _LexicalPreview.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _LexicalPreview = _interopRequireDefault(require("./LexicalPreview"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
|
@@ -31,14 +31,19 @@ const Person = _ref => {
|
|
|
31
31
|
color
|
|
32
32
|
// ...otherProps
|
|
33
33
|
} = _ref;
|
|
34
|
+
const handleImageSrcError = e => {
|
|
35
|
+
e.target.onerror = null;
|
|
36
|
+
e.target.src = '/default-avatar.svg';
|
|
37
|
+
};
|
|
34
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
35
39
|
id: id,
|
|
36
40
|
className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
|
|
37
41
|
style: style
|
|
38
42
|
}, /*#__PURE__*/React.createElement("img", {
|
|
39
43
|
className: "image v50 mr-v",
|
|
40
|
-
src: image,
|
|
41
|
-
alt: `${name}, ${role}
|
|
44
|
+
src: image || '/default-avatar.svg',
|
|
45
|
+
alt: `${name}, ${role}`,
|
|
46
|
+
onError: handleImageSrcError
|
|
42
47
|
}), /*#__PURE__*/React.createElement("div", {
|
|
43
48
|
className: "details"
|
|
44
49
|
}, name && /*#__PURE__*/React.createElement("p", {
|
|
@@ -29,12 +29,13 @@ const ProgressBar = _ref => {
|
|
|
29
29
|
attached,
|
|
30
30
|
color,
|
|
31
31
|
progress,
|
|
32
|
-
height
|
|
32
|
+
height,
|
|
33
|
+
rounded
|
|
33
34
|
// ...otherProps
|
|
34
35
|
} = _ref;
|
|
35
36
|
return /*#__PURE__*/React.createElement("div", {
|
|
36
37
|
id: id,
|
|
37
|
-
className: [baseClassName, componentClassName, attached && _exports.default.modifierAttached, color && `x-${color}`, userClassName].filter(e => e).join(' '),
|
|
38
|
+
className: [baseClassName, componentClassName, attached && _exports.default.modifierAttached, color && `x-${color}`, userClassName, rounded && 'rounded'].filter(e => e).join(' '),
|
|
38
39
|
style: {
|
|
39
40
|
'--progress': progress,
|
|
40
41
|
'--height': height,
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
$default-height:var(--height, 1em);
|
|
6
6
|
$default-border:none;//2px solid var(--grid);
|
|
7
7
|
$default-transition-duration:.5s;
|
|
8
|
-
$default-color:var(--x, var(--
|
|
8
|
+
$default-color:var(--x, var(--main));
|
|
9
|
+
$default-border-radius:var(--theme-border-radius, 1.875rem);
|
|
9
10
|
|
|
10
11
|
.#{bem.$base}.progress-bar {
|
|
12
|
+
background-color: var(--progress-bar-background-color);
|
|
11
13
|
border: $default-border;
|
|
12
14
|
height: $default-height;
|
|
13
15
|
position: relative;
|
|
@@ -28,6 +30,14 @@ $default-color:var(--x, var(--main1));
|
|
|
28
30
|
z-index: 1;
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
&.rounded {
|
|
34
|
+
border-radius: $default-border-radius;
|
|
35
|
+
|
|
36
|
+
&::after {
|
|
37
|
+
border-radius: $default-border-radius;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
&.#{bem.$modifier-attached} {
|
|
32
42
|
border: unset;
|
|
33
43
|
border-bottom: $default-border;
|
|
@@ -37,18 +37,22 @@ const XMLEditor = _ref => {
|
|
|
37
37
|
height,
|
|
38
38
|
gutterWidth,
|
|
39
39
|
config,
|
|
40
|
-
onChange
|
|
40
|
+
onChange,
|
|
41
|
+
stopPropagationKeys
|
|
41
42
|
} = _ref;
|
|
42
43
|
const editorRef = (0, _react.useRef)();
|
|
43
44
|
(0, _react.useEffect)(() => {
|
|
44
45
|
const startState = _state.EditorState.create({
|
|
45
46
|
doc: config,
|
|
46
|
-
extensions: [_view.keymap.of(
|
|
47
|
-
// TOFIX: Indent with tab prevents indentOnInout from working.
|
|
48
|
-
// indentOnInput(),
|
|
49
|
-
(0, _view.lineNumbers)(), (0, _language.bracketMatching)(), (0, _language.foldGutter)(), (0, _view.drawSelection)(), (0, _view.highlightActiveLine)(), (0, _view.highlightActiveLineGutter)(), (0, _view.highlightSpecialChars)(), (0, _view.dropCursor)(), (0, _view.rectangularSelection)(), (0, _view.crosshairCursor)(), (0, _langXml.xml)(), _common.theme, _state.EditorState.readOnly.of(readOnly), _view.EditorView.updateListener.of(view => {
|
|
47
|
+
extensions: [_view.keymap.of(_commands.defaultKeymap), (0, _language.indentOnInput)(), (0, _view.lineNumbers)(), (0, _language.bracketMatching)(), (0, _language.foldGutter)(), (0, _view.drawSelection)(), (0, _view.highlightActiveLine)(), (0, _view.highlightActiveLineGutter)(), (0, _view.highlightSpecialChars)(), (0, _view.dropCursor)(), (0, _view.rectangularSelection)(), (0, _view.crosshairCursor)(), (0, _langXml.xml)(), _common.theme, _state.EditorState.readOnly.of(readOnly), _view.EditorView.updateListener.of(view => {
|
|
50
48
|
onChange(view);
|
|
51
49
|
// view.state.doc.toString() to receive the current content in the editor.
|
|
50
|
+
}), _view.EditorView.domEventHandlers({
|
|
51
|
+
keydown(e) {
|
|
52
|
+
if (stopPropagationKeys?.includes(e.key)) {
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
52
56
|
})]
|
|
53
57
|
});
|
|
54
58
|
const view = new _view.EditorView({
|
|
@@ -102,7 +106,11 @@ XMLEditor.propTypes = {
|
|
|
102
106
|
/**
|
|
103
107
|
* The width of the gutter.
|
|
104
108
|
*/
|
|
105
|
-
gutterWidth: _propTypes.default.string
|
|
109
|
+
gutterWidth: _propTypes.default.string,
|
|
110
|
+
/**
|
|
111
|
+
* The keys to stop propagation on.
|
|
112
|
+
*/
|
|
113
|
+
stopPropagationKeys: _propTypes.default.arrayOf(_propTypes.default.string)
|
|
106
114
|
};
|
|
107
115
|
XMLEditor.defaultProps = {
|
|
108
116
|
config: `<View>
|
package/dist/cjs/a/index.js
CHANGED
|
@@ -75,6 +75,12 @@ Object.defineProperty(exports, "Label", {
|
|
|
75
75
|
return _Label.Label;
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
+
Object.defineProperty(exports, "LexicalPreview", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _LexicalPreview.LexicalPreview;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
78
84
|
Object.defineProperty(exports, "LoadingCircle", {
|
|
79
85
|
enumerable: true,
|
|
80
86
|
get: function () {
|
|
@@ -202,4 +208,5 @@ var _AnimatedGradient = require("./AnimatedGradient");
|
|
|
202
208
|
var _TextSteps = require("./TextSteps");
|
|
203
209
|
var _Removable = require("./Removable");
|
|
204
210
|
var _ToggleSwitch = require("./ToggleSwitch");
|
|
205
|
-
var _XMLEditor = require("./XMLEditor");
|
|
211
|
+
var _XMLEditor = require("./XMLEditor");
|
|
212
|
+
var _LexicalPreview = require("./LexicalPreview");
|
|
@@ -0,0 +1,125 @@
|
|
|
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 React = _react;
|
|
9
|
+
var _LexicalComposer = require("@lexical/react/LexicalComposer");
|
|
10
|
+
var _LexicalRichTextPlugin = require("@lexical/react/LexicalRichTextPlugin");
|
|
11
|
+
var _LexicalContentEditable = require("@lexical/react/LexicalContentEditable");
|
|
12
|
+
var _link = require("@lexical/link");
|
|
13
|
+
var _list = require("@lexical/list");
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
|
|
16
|
+
var _designSystem = require("@pareto-engineering/design-system");
|
|
17
|
+
require("./styles.scss");
|
|
18
|
+
var _common = require("./common");
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
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); }
|
|
21
|
+
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 && Object.prototype.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; }
|
|
22
|
+
/* @pareto-engineering/generator-front 1.0.12 */
|
|
23
|
+
/* eslint-disable import/no-extraneous-dependencies -- required here */
|
|
24
|
+
|
|
25
|
+
// Local Definitions
|
|
26
|
+
|
|
27
|
+
const baseClassName = _exports.default.base;
|
|
28
|
+
const componentClassName = 'expandable-lexical-preview';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This is the component description.
|
|
32
|
+
*/
|
|
33
|
+
const ExpandableLexicalPreview = _ref => {
|
|
34
|
+
let {
|
|
35
|
+
id,
|
|
36
|
+
className: userClassName,
|
|
37
|
+
style,
|
|
38
|
+
nodes,
|
|
39
|
+
color,
|
|
40
|
+
resize,
|
|
41
|
+
title
|
|
42
|
+
// ...otherProps
|
|
43
|
+
} = _ref;
|
|
44
|
+
const initialConfig = {
|
|
45
|
+
nameSpace: id,
|
|
46
|
+
editable: false,
|
|
47
|
+
editorState: nodes,
|
|
48
|
+
theme: {
|
|
49
|
+
text: {
|
|
50
|
+
italic: 'italic',
|
|
51
|
+
strikethrough: 'strikethrough',
|
|
52
|
+
underline: 'underlined'
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
nodes: [_link.AutoLinkNode, _link.LinkNode, _list.ListNode, _list.ListItemNode]
|
|
56
|
+
};
|
|
57
|
+
const [isExpanded, setIsExpanded] = (0, _react.useState)(false);
|
|
58
|
+
const handleButtonClick = () => {
|
|
59
|
+
setIsExpanded(!isExpanded);
|
|
60
|
+
};
|
|
61
|
+
const Content = (0, _react.useMemo)(() => /*#__PURE__*/React.createElement("div", {
|
|
62
|
+
className: "lexical-content"
|
|
63
|
+
}, /*#__PURE__*/React.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
|
|
64
|
+
contentEditable: /*#__PURE__*/React.createElement(_LexicalContentEditable.ContentEditable, {
|
|
65
|
+
id: id,
|
|
66
|
+
className: "content-editable"
|
|
67
|
+
})
|
|
68
|
+
}), /*#__PURE__*/React.createElement(_common.ExpandButton, {
|
|
69
|
+
title: title,
|
|
70
|
+
onResolve: handleButtonClick
|
|
71
|
+
})), [id]);
|
|
72
|
+
return /*#__PURE__*/React.createElement(_LexicalComposer.LexicalComposer, {
|
|
73
|
+
initialConfig: initialConfig
|
|
74
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
id: id,
|
|
76
|
+
className: [baseClassName, componentClassName, userClassName, `y-${color}`, isExpanded && 'collapsed'].filter(e => e).join(' '),
|
|
77
|
+
style: {
|
|
78
|
+
'--resize': resize,
|
|
79
|
+
...style
|
|
80
|
+
}
|
|
81
|
+
}, typeof title === 'string' ? /*#__PURE__*/React.createElement("p", {
|
|
82
|
+
className: "title h2"
|
|
83
|
+
}, title) : title, isExpanded && /*#__PURE__*/React.createElement(_designSystem.Button, {
|
|
84
|
+
onClick: handleButtonClick,
|
|
85
|
+
color: "background-far",
|
|
86
|
+
isCompact: true
|
|
87
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
88
|
+
className: "ai-icon c-x x-paragraph"
|
|
89
|
+
}, "C")), !isExpanded && Content));
|
|
90
|
+
};
|
|
91
|
+
ExpandableLexicalPreview.propTypes = {
|
|
92
|
+
/**
|
|
93
|
+
* The HTML id for this element
|
|
94
|
+
*/
|
|
95
|
+
id: _propTypes.default.string,
|
|
96
|
+
/**
|
|
97
|
+
* The HTML class names for this element
|
|
98
|
+
*/
|
|
99
|
+
className: _propTypes.default.string,
|
|
100
|
+
/**
|
|
101
|
+
* The React-written, css properties for this element.
|
|
102
|
+
*/
|
|
103
|
+
style: _propTypes.default.objectOf(_propTypes.default.string),
|
|
104
|
+
/**
|
|
105
|
+
* Color of the text
|
|
106
|
+
*/
|
|
107
|
+
color: _propTypes.default.string,
|
|
108
|
+
/**
|
|
109
|
+
* The nodes to render in the form of a json string
|
|
110
|
+
*/
|
|
111
|
+
nodes: _propTypes.default.string,
|
|
112
|
+
/**
|
|
113
|
+
* The resize property of the textarea
|
|
114
|
+
*/
|
|
115
|
+
resize: _propTypes.default.string,
|
|
116
|
+
/**
|
|
117
|
+
* The title for the preview.
|
|
118
|
+
*/
|
|
119
|
+
title: _propTypes.default.string
|
|
120
|
+
};
|
|
121
|
+
ExpandableLexicalPreview.defaultProps = {
|
|
122
|
+
color: 'paragraph',
|
|
123
|
+
resize: 'vertical'
|
|
124
|
+
};
|
|
125
|
+
var _default = exports.default = ExpandableLexicalPreview;
|
|
@@ -0,0 +1,112 @@
|
|
|
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 _designSystem = require("@pareto-engineering/design-system");
|
|
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 && Object.prototype.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(_designSystem.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;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "ExpandButton", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _ExpandButton.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
var
|
|
12
|
+
var _ExpandButton = _interopRequireDefault(require("./ExpandButton"));
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,12 @@
|
|
|
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");
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "ExpandableLexicalPreview", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _ExpandableLexicalPreview.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _ExpandableLexicalPreview = _interopRequireDefault(require("./ExpandableLexicalPreview"));
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
}
|