@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.
Files changed (125) hide show
  1. package/dist/cjs/{c/ContentSlides/common/Slide/Slide.js → a/LexicalPreview/LexicalPreview.js} +43 -28
  2. package/dist/cjs/{c/ContentSlides/common/Sidebar → a/LexicalPreview}/index.js +3 -3
  3. package/dist/cjs/a/LexicalPreview/styles.scss +46 -0
  4. package/dist/cjs/a/People/common/Person/Person.js +7 -2
  5. package/dist/cjs/a/ProgressBar/ProgressBar.js +3 -2
  6. package/dist/cjs/a/ProgressBar/styles.scss +11 -1
  7. package/dist/cjs/a/XMLEditor/XMLEditor.js +14 -6
  8. package/dist/cjs/a/index.js +8 -1
  9. package/dist/cjs/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +125 -0
  10. package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +112 -0
  11. package/dist/cjs/{c/ContentSlides/common/Navigator → b/ExpandableLexicalPreview/common/ExpandButton}/index.js +3 -3
  12. package/dist/cjs/b/ExpandableLexicalPreview/common/index.js +12 -0
  13. package/dist/cjs/b/ExpandableLexicalPreview/index.js +13 -0
  14. package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +84 -0
  15. package/dist/cjs/b/index.js +8 -1
  16. package/dist/cjs/c/index.js +0 -13
  17. package/dist/cjs/f/fields/EditorInput/EditorInput.js +14 -3
  18. package/dist/cjs/f/fields/EditorInput/common/StopPropagationPlugin.js +30 -0
  19. package/dist/cjs/f/fields/EditorInput/common/index.js +7 -0
  20. package/dist/cjs/index.js +0 -11
  21. package/dist/es/a/LexicalPreview/LexicalPreview.js +80 -0
  22. package/dist/es/a/LexicalPreview/index.js +2 -0
  23. package/dist/es/a/LexicalPreview/styles.scss +46 -0
  24. package/dist/es/a/People/common/Person/Person.js +22 -15
  25. package/dist/es/a/ProgressBar/ProgressBar.js +3 -2
  26. package/dist/es/a/ProgressBar/styles.scss +11 -1
  27. package/dist/es/a/XMLEditor/XMLEditor.js +16 -10
  28. package/dist/es/a/index.js +2 -1
  29. package/dist/es/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +115 -0
  30. package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +102 -0
  31. package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
  32. package/dist/es/b/ExpandableLexicalPreview/common/index.js +1 -0
  33. package/dist/es/b/ExpandableLexicalPreview/index.js +2 -0
  34. package/dist/es/b/ExpandableLexicalPreview/styles.scss +84 -0
  35. package/dist/es/b/index.js +2 -1
  36. package/dist/es/c/index.js +0 -1
  37. package/dist/es/f/fields/EditorInput/EditorInput.js +15 -4
  38. package/dist/es/f/fields/EditorInput/common/StopPropagationPlugin.js +23 -0
  39. package/dist/es/f/fields/EditorInput/common/index.js +2 -1
  40. package/dist/es/index.js +0 -1
  41. package/package.json +5 -5
  42. package/src/stories/a/LexicalPreview.stories.jsx +28 -0
  43. package/src/stories/a/ProgressBar.stories.jsx +1 -1
  44. package/src/stories/b/ExpandableLexicalPreview.stories.jsx +29 -0
  45. package/src/stories/colors.js +4 -0
  46. package/src/ui/a/LexicalPreview/LexicalPreview.jsx +109 -0
  47. package/src/ui/a/LexicalPreview/index.js +2 -0
  48. package/src/ui/a/LexicalPreview/styles.scss +46 -0
  49. package/src/ui/a/People/common/Person/Person.jsx +31 -19
  50. package/src/ui/a/ProgressBar/ProgressBar.jsx +2 -0
  51. package/src/ui/a/ProgressBar/styles.scss +11 -1
  52. package/src/ui/a/XMLEditor/XMLEditor.jsx +16 -5
  53. package/src/ui/a/index.js +1 -0
  54. package/src/ui/b/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +157 -0
  55. package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +123 -0
  56. package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
  57. package/src/ui/b/ExpandableLexicalPreview/common/index.js +1 -0
  58. package/src/ui/b/ExpandableLexicalPreview/index.js +2 -0
  59. package/src/ui/b/ExpandableLexicalPreview/styles.scss +84 -0
  60. package/src/ui/b/index.js +1 -0
  61. package/src/ui/c/index.js +0 -1
  62. package/src/ui/f/fields/EditorInput/EditorInput.jsx +16 -2
  63. package/src/ui/f/fields/EditorInput/common/StopPropagationPlugin.jsx +29 -0
  64. package/src/ui/f/fields/EditorInput/common/index.jsx +1 -0
  65. package/src/ui/index.js +0 -1
  66. package/tests/__snapshots__/Storyshots.test.js.snap +1249 -641
  67. package/dist/cjs/c/ContentSlides/ContentSlides.js +0 -172
  68. package/dist/cjs/c/ContentSlides/Context.js +0 -10
  69. package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -126
  70. package/dist/cjs/c/ContentSlides/common/HorizontalMenu/index.js +0 -13
  71. package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +0 -128
  72. package/dist/cjs/c/ContentSlides/common/Sidebar/Sidebar.js +0 -94
  73. package/dist/cjs/c/ContentSlides/common/Slide/index.js +0 -13
  74. package/dist/cjs/c/ContentSlides/common/index.js +0 -33
  75. package/dist/cjs/c/ContentSlides/index.js +0 -27
  76. package/dist/cjs/c/ContentSlides/styles.scss +0 -312
  77. package/dist/cjs/c/ContentSlides/useContentSlides.js +0 -11
  78. package/dist/cjs/r/SwitchRouteMap/SwitchRouteMap.js +0 -58
  79. package/dist/cjs/r/SwitchRouteMap/index.js +0 -13
  80. package/dist/cjs/r/common/PrivateRoute/PrivateRoute.js +0 -74
  81. package/dist/cjs/r/common/PrivateRoute/index.js +0 -13
  82. package/dist/cjs/r/common/index.js +0 -12
  83. package/dist/cjs/r/index.js +0 -27
  84. package/dist/es/c/ContentSlides/ContentSlides.js +0 -160
  85. package/dist/es/c/ContentSlides/Context.js +0 -2
  86. package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -116
  87. package/dist/es/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
  88. package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +0 -118
  89. package/dist/es/c/ContentSlides/common/Navigator/index.js +0 -2
  90. package/dist/es/c/ContentSlides/common/Sidebar/Sidebar.js +0 -84
  91. package/dist/es/c/ContentSlides/common/Sidebar/index.js +0 -2
  92. package/dist/es/c/ContentSlides/common/Slide/Slide.js +0 -65
  93. package/dist/es/c/ContentSlides/common/Slide/index.js +0 -2
  94. package/dist/es/c/ContentSlides/common/index.js +0 -4
  95. package/dist/es/c/ContentSlides/index.js +0 -4
  96. package/dist/es/c/ContentSlides/styles.scss +0 -312
  97. package/dist/es/c/ContentSlides/useContentSlides.js +0 -3
  98. package/dist/es/r/SwitchRouteMap/SwitchRouteMap.js +0 -45
  99. package/dist/es/r/SwitchRouteMap/index.js +0 -2
  100. package/dist/es/r/common/PrivateRoute/PrivateRoute.js +0 -66
  101. package/dist/es/r/common/PrivateRoute/index.js +0 -2
  102. package/dist/es/r/common/index.js +0 -1
  103. package/dist/es/r/index.js +0 -2
  104. package/src/stories/c/ContentSlides.stories.jsx +0 -214
  105. package/src/ui/c/ContentSlides/ContentSlides.jsx +0 -214
  106. package/src/ui/c/ContentSlides/Context.js +0 -3
  107. package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +0 -145
  108. package/src/ui/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
  109. package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +0 -150
  110. package/src/ui/c/ContentSlides/common/Navigator/index.js +0 -2
  111. package/src/ui/c/ContentSlides/common/Sidebar/Sidebar.jsx +0 -135
  112. package/src/ui/c/ContentSlides/common/Sidebar/index.js +0 -2
  113. package/src/ui/c/ContentSlides/common/Slide/Slide.jsx +0 -87
  114. package/src/ui/c/ContentSlides/common/Slide/index.js +0 -2
  115. package/src/ui/c/ContentSlides/common/index.js +0 -4
  116. package/src/ui/c/ContentSlides/index.js +0 -4
  117. package/src/ui/c/ContentSlides/styles.scss +0 -312
  118. package/src/ui/c/ContentSlides/useContentSlides.js +0 -4
  119. package/src/ui/r/SwitchRouteMap/SwitchRouteMap.jsx +0 -64
  120. package/src/ui/r/SwitchRouteMap/index.js +0 -2
  121. package/src/ui/r/common/PrivateRoute/PrivateRoute.jsx +0 -73
  122. package/src/ui/r/common/PrivateRoute/index.js +0 -2
  123. package/src/ui/r/common/index.js +0 -1
  124. package/src/ui/r/index.js +0 -2
  125. /package/src/stories/a/{CodeEditor.stories.jsx → XMLEditor.stories.jsx} +0 -0
@@ -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
+ }
@@ -4,4 +4,5 @@ export { Page } from "./Page";
4
4
  export { SocialMediaButton } from "./SocialMediaButton";
5
5
  export { ThemeSelector } from "./ThemeSelector";
6
6
  export { Title } from "./Title";
7
- export { Card } from "./Card";
7
+ export { Card } from "./Card";
8
+ export { ExpandableLexicalPreview } from "./ExpandableLexicalPreview";
@@ -1,4 +1,3 @@
1
- export { ContentSlides, useContentSlides } from "./ContentSlides";
2
1
  export { Shortener } from "./Shortener";
3
2
  export { SocialMediaShareButton } from "./SocialMediaShareButton";
4
3
  export { Modal } from "./Modal";
@@ -19,7 +19,7 @@ import styleNames from '@pareto-engineering/bem/exports';
19
19
  // Local Definitions
20
20
 
21
21
  import { FormLabel, FormDescription } from "../../common";
22
- import { Toolbar, TreeViewPlugin } from "./common";
22
+ import { Toolbar, TreeViewPlugin, StopPropagationPlugin } from "./common";
23
23
  import "./styles.scss";
24
24
  const baseClassName = styleNames.base;
25
25
  const componentClassName = 'editor-input';
@@ -41,7 +41,8 @@ const EditorInput = ({
41
41
  labelColor,
42
42
  description,
43
43
  disabled,
44
- showDebugger
44
+ showDebugger,
45
+ stopPropagationKeys
45
46
  // ...otherProps
46
47
  }) => {
47
48
  const formik = useFormikContext();
@@ -120,7 +121,9 @@ const EditorInput = ({
120
121
  })
121
122
  }), /*#__PURE__*/React.createElement(OnChangePlugin, {
122
123
  onChange: onChange
123
- }), /*#__PURE__*/React.createElement(LinkPlugin, null), /*#__PURE__*/React.createElement(ListPlugin, null), /*#__PURE__*/React.createElement(TabIndentationPlugin, null), /*#__PURE__*/React.createElement(HistoryPlugin, null), /*#__PURE__*/React.createElement(FormDescription, {
124
+ }), /*#__PURE__*/React.createElement(LinkPlugin, null), /*#__PURE__*/React.createElement(ListPlugin, null), /*#__PURE__*/React.createElement(TabIndentationPlugin, null), /*#__PURE__*/React.createElement(HistoryPlugin, null), stopPropagationKeys && /*#__PURE__*/React.createElement(StopPropagationPlugin, {
125
+ stopPropagationKeys: stopPropagationKeys
126
+ }), /*#__PURE__*/React.createElement(FormDescription, {
124
127
  className: "s-1",
125
128
  description: description,
126
129
  name: name
@@ -179,7 +182,15 @@ EditorInput.propTypes = {
179
182
  /**
180
183
  * The resize property of the text area
181
184
  */
182
- resize: PropTypes.oneOf(['none', 'both', 'horizontal', 'vertical'])
185
+ resize: PropTypes.oneOf(['none', 'both', 'horizontal', 'vertical']),
186
+ /**
187
+ * Whether to show the debugger or not
188
+ */
189
+ showDebugger: PropTypes.bool,
190
+ /**
191
+ * Map to stop propagation of the given keys
192
+ */
193
+ stopPropagationKeys: PropTypes.arrayOf(PropTypes.string)
183
194
  };
184
195
  EditorInput.defaultProps = {
185
196
  rows: 10,
@@ -0,0 +1,23 @@
1
+ import { useInsertionEffect } from 'react';
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
+ const StopPropagationPlugin = ({
4
+ stopPropagationKeys
5
+ }) => {
6
+ const [editor] = useLexicalComposerContext();
7
+ useInsertionEffect(() => {
8
+ const onKeyDown = e => {
9
+ if (stopPropagationKeys?.includes(e.key)) {
10
+ e.stopPropagation();
11
+ }
12
+ };
13
+ return editor.registerRootListener((rootElement, prevRootElement) => {
14
+ if (prevRootElement !== null) {
15
+ prevRootElement.removeEventListener('keydown', onKeyDown);
16
+ }
17
+ if (rootElement !== null) {
18
+ rootElement.addEventListener('keydown', onKeyDown);
19
+ }
20
+ });
21
+ }, [editor]);
22
+ };
23
+ export default StopPropagationPlugin;
@@ -1,2 +1,3 @@
1
1
  export { default as Toolbar } from "./Toolbar";
2
- export { default as TreeViewPlugin } from "./TreeViewPlugin";
2
+ export { default as TreeViewPlugin } from "./TreeViewPlugin";
3
+ export { default as StopPropagationPlugin } from "./StopPropagationPlugin";
package/dist/es/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./r"; // Router Extensions
2
1
  export * from "./a";
3
2
  export * from "./b";
4
3
  export * from "./c";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pareto-engineering/design-system",
3
- "version": "4.0.0-alpha.70",
3
+ "version": "4.0.0-alpha.72",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/es/index.js",
@@ -52,10 +52,10 @@
52
52
  "dependencies": {
53
53
  "@codemirror/lang-xml": "^6.0.2",
54
54
  "@lexical/react": "^0.11.3",
55
- "@pareto-engineering/assets": "^4.0.0-alpha.70",
55
+ "@pareto-engineering/assets": "^4.0.0-alpha.72",
56
56
  "@pareto-engineering/bem": "^4.0.0-alpha.20",
57
- "@pareto-engineering/styles": "^4.0.0-alpha.70",
58
- "@pareto-engineering/utils": "^4.0.0-alpha.46",
57
+ "@pareto-engineering/styles": "^4.0.0-alpha.72",
58
+ "@pareto-engineering/utils": "^4.0.0-alpha.72",
59
59
  "codemirror": "^6.0.1",
60
60
  "date-fns": "^2.29.3",
61
61
  "downshift": "^6.1.12",
@@ -73,5 +73,5 @@
73
73
  "relay-test-utils": "^15.0.0"
74
74
  },
75
75
  "browserslist": "> 2%",
76
- "gitHead": "dd5504b9e521370b6151a796a429c268ab123be1"
76
+ "gitHead": "68d099be75ce95a8ff22f53015d1a722af04e8b5"
77
77
  }
@@ -0,0 +1,28 @@
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
+ }
@@ -48,7 +48,7 @@ export const Base = () => {
48
48
  export const Color = Template.bind({})
49
49
  Color.args = {
50
50
  progress:70,
51
- color :'main1',
51
+ color :'main',
52
52
  }
53
53
 
54
54
  export const Height = Template.bind({})
@@ -0,0 +1,29 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ import * as React from 'react'
3
+
4
+ import { ExpandableLexicalPreview } from 'ui'
5
+
6
+ export default {
7
+ title :'b/ExpandableLexicalPreview',
8
+ component :ExpandableLexicalPreview,
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
+ <ExpandableLexicalPreview {...args} />
23
+ )
24
+
25
+ export const Base = Template.bind({})
26
+ Base.args = {
27
+ nodes,
28
+ title:'Task Instructions',
29
+ }
@@ -12,6 +12,10 @@ const MODALS = [
12
12
  'purple',
13
13
  'yellow',
14
14
  'seagreen',
15
+ 'deepblue',
16
+ 'light-blue',
17
+ 'light-purple',
18
+ 'light-seagreen',
15
19
  ]
16
20
 
17
21
  const UI = [
@@ -0,0 +1,109 @@
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
+
10
+ import PropTypes from 'prop-types'
11
+ import styleNames from '@pareto-engineering/bem/exports'
12
+ import './styles.scss'
13
+
14
+ // Local Definitions
15
+
16
+ const baseClassName = styleNames.base
17
+ const componentClassName = 'lexical-preview'
18
+
19
+ /**
20
+ * This is the component description.
21
+ */
22
+ const LexicalPreview = ({
23
+ id,
24
+ className:userClassName,
25
+ style,
26
+ nodes,
27
+ color,
28
+ // ...otherProps
29
+ }) => {
30
+ const initialConfig = {
31
+ nameSpace :id,
32
+ editable :false,
33
+ editorState:nodes,
34
+ theme :{
35
+ text:{
36
+ italic :'italic',
37
+ strikethrough:'strikethrough',
38
+ underline :'underlined',
39
+ },
40
+ },
41
+ nodes:[
42
+ AutoLinkNode,
43
+ LinkNode,
44
+ ListNode,
45
+ ListItemNode,
46
+ ],
47
+ }
48
+
49
+ return (
50
+ <LexicalComposer
51
+ initialConfig={initialConfig}
52
+ >
53
+ <div
54
+ id={id}
55
+ className={[
56
+ baseClassName,
57
+ componentClassName,
58
+ userClassName,
59
+ `y-${color}`,
60
+ ]
61
+ .filter((e) => e)
62
+ .join(' ')}
63
+ style={style}
64
+ >
65
+ <RichTextPlugin
66
+ contentEditable={(
67
+ <ContentEditable
68
+ id={id}
69
+ className="content-editable"
70
+ />
71
+ )}
72
+ />
73
+ </div>
74
+ </LexicalComposer>
75
+ )
76
+ }
77
+
78
+ LexicalPreview.propTypes = {
79
+ /**
80
+ * The HTML id for this element
81
+ */
82
+ id:PropTypes.string,
83
+
84
+ /**
85
+ * The HTML class names for this element
86
+ */
87
+ className:PropTypes.string,
88
+
89
+ /**
90
+ * The React-written, css properties for this element.
91
+ */
92
+ style:PropTypes.objectOf(PropTypes.string),
93
+
94
+ /**
95
+ * Color of the text
96
+ */
97
+ color:PropTypes.string,
98
+
99
+ /**
100
+ * The nodes to render in the form of a json string
101
+ */
102
+ nodes:PropTypes.string,
103
+ }
104
+
105
+ LexicalPreview.defaultProps = {
106
+ color:'paragraph',
107
+ }
108
+
109
+ export default LexicalPreview
@@ -0,0 +1,2 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+ export { default as LexicalPreview } from './LexicalPreview'
@@ -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
+ }
@@ -23,28 +23,40 @@ const Person = ({
23
23
  role,
24
24
  color,
25
25
  // ...otherProps
26
- }) => (
27
- <div
28
- id={id}
29
- className={[
26
+ }) => {
27
+ const handleImageSrcError = (e) => {
28
+ e.target.onerror = null
29
+ e.target.src = '/default-avatar.svg'
30
+ }
30
31
 
31
- baseClassName,
32
+ return (
33
+ <div
34
+ id={id}
35
+ className={[
32
36
 
33
- componentClassName,
34
- userClassName,
35
- `y-${color}`,
36
- ]
37
- .filter((e) => e)
38
- .join(' ')}
39
- style={style}
40
- >
41
- <img className="image v50 mr-v" src={image} alt={`${name}, ${role}`} />
42
- <div className="details">
43
- {name && <p className="name">{name}</p>}
44
- { role && <p className="role">{role}</p>}
37
+ baseClassName,
38
+
39
+ componentClassName,
40
+ userClassName,
41
+ `y-${color}`,
42
+ ]
43
+ .filter((e) => e)
44
+ .join(' ')}
45
+ style={style}
46
+ >
47
+ <img
48
+ className="image v50 mr-v"
49
+ src={image || '/default-avatar.svg'}
50
+ alt={`${name}, ${role}`}
51
+ onError={handleImageSrcError}
52
+ />
53
+ <div className="details">
54
+ {name && <p className="name">{name}</p>}
55
+ { role && <p className="role">{role}</p>}
56
+ </div>
45
57
  </div>
46
- </div>
47
- )
58
+ )
59
+ }
48
60
 
49
61
  Person.propTypes = {
50
62
  /**
@@ -24,6 +24,7 @@ const ProgressBar = ({
24
24
  color,
25
25
  progress,
26
26
  height,
27
+ rounded,
27
28
  // ...otherProps
28
29
  }) => (
29
30
  <div
@@ -36,6 +37,7 @@ const ProgressBar = ({
36
37
  attached && styleNames.modifierAttached,
37
38
  color && `x-${color}`,
38
39
  userClassName,
40
+ rounded && 'rounded',
39
41
  ]
40
42
  .filter((e) => e)
41
43
  .join(' ')}
@@ -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(--main1));
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;
@@ -22,11 +22,10 @@ import {
22
22
 
23
23
  import {
24
24
  defaultKeymap,
25
- indentWithTab,
26
25
  } from '@codemirror/commands'
27
26
 
28
27
  import {
29
- // indentOnInput,
28
+ indentOnInput,
30
29
  bracketMatching,
31
30
  foldGutter,
32
31
  } from '@codemirror/language'
@@ -57,6 +56,7 @@ const XMLEditor = ({
57
56
  gutterWidth,
58
57
  config,
59
58
  onChange,
59
+ stopPropagationKeys,
60
60
  }) => {
61
61
  const editorRef = useRef()
62
62
 
@@ -64,9 +64,8 @@ const XMLEditor = ({
64
64
  const startState = EditorState.create({
65
65
  doc :config,
66
66
  extensions:[
67
- keymap.of([defaultKeymap, indentWithTab]),
68
- // TOFIX: Indent with tab prevents indentOnInout from working.
69
- // indentOnInput(),
67
+ keymap.of(defaultKeymap),
68
+ indentOnInput(),
70
69
  lineNumbers(),
71
70
  bracketMatching(),
72
71
  foldGutter(),
@@ -84,6 +83,13 @@ const XMLEditor = ({
84
83
  onChange(view)
85
84
  // view.state.doc.toString() to receive the current content in the editor.
86
85
  }),
86
+ EditorView.domEventHandlers({
87
+ keydown(e) {
88
+ if (stopPropagationKeys?.includes(e.key)) {
89
+ e.stopPropagation()
90
+ }
91
+ },
92
+ }),
87
93
  ],
88
94
  })
89
95
 
@@ -157,6 +163,11 @@ XMLEditor.propTypes = {
157
163
  * The width of the gutter.
158
164
  */
159
165
  gutterWidth:PropTypes.string,
166
+
167
+ /**
168
+ * The keys to stop propagation on.
169
+ */
170
+ stopPropagationKeys:PropTypes.arrayOf(PropTypes.string),
160
171
  }
161
172
 
162
173
  XMLEditor.defaultProps = {
package/src/ui/a/index.js CHANGED
@@ -26,3 +26,4 @@ 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'