@pareto-engineering/design-system 4.0.0-alpha.69 → 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 (161) hide show
  1. package/.storybook/preview.js +29 -12
  2. package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +0 -1
  3. package/dist/cjs/a/AnimatedGradient/webGIRenderer.js +0 -1
  4. package/dist/cjs/a/AppContext/ContextProvider.js +2 -0
  5. package/dist/cjs/{c/ContentSlides/common/Slide/Slide.js → a/LexicalPreview/LexicalPreview.js} +43 -28
  6. package/dist/cjs/{c/ContentSlides/common/HorizontalMenu → a/LexicalPreview}/index.js +3 -3
  7. package/dist/cjs/a/LexicalPreview/styles.scss +46 -0
  8. package/dist/cjs/a/People/common/Person/Person.js +7 -2
  9. package/dist/cjs/a/ProgressBar/ProgressBar.js +3 -3
  10. package/dist/cjs/a/ProgressBar/styles.scss +11 -1
  11. package/dist/cjs/a/XMLEditor/XMLEditor.js +123 -0
  12. package/dist/cjs/{c/ContentSlides/common/Slide → a/XMLEditor/common}/index.js +3 -3
  13. package/dist/cjs/a/XMLEditor/common/theme.js +186 -0
  14. package/dist/cjs/{c/ContentSlides/common/Navigator → a/XMLEditor}/index.js +3 -3
  15. package/dist/cjs/a/XMLEditor/styles.scss +17 -0
  16. package/dist/cjs/a/index.js +15 -1
  17. package/dist/cjs/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +125 -0
  18. package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +112 -0
  19. package/dist/cjs/{c/ContentSlides/common/Sidebar → b/ExpandableLexicalPreview/common/ExpandButton}/index.js +3 -3
  20. package/dist/cjs/b/ExpandableLexicalPreview/common/index.js +12 -0
  21. package/dist/cjs/b/ExpandableLexicalPreview/index.js +13 -0
  22. package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +84 -0
  23. package/dist/cjs/b/Logo/Logo.js +0 -1
  24. package/dist/cjs/b/Title/Title.js +0 -1
  25. package/dist/cjs/b/index.js +8 -1
  26. package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +0 -2
  27. package/dist/cjs/c/index.js +0 -13
  28. package/dist/cjs/f/FormInput/FormInput.js +2 -0
  29. package/dist/cjs/f/fields/EditorInput/EditorInput.js +14 -3
  30. package/dist/cjs/f/fields/EditorInput/common/StopPropagationPlugin.js +30 -0
  31. package/dist/cjs/f/fields/EditorInput/common/index.js +7 -0
  32. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +11 -1
  33. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +32 -3
  34. package/dist/cjs/index.js +0 -11
  35. package/dist/cjs/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +0 -1
  36. package/dist/es/a/AnimatedGradient/AnimatedGradient.js +0 -1
  37. package/dist/es/a/AnimatedGradient/webGIRenderer.js +0 -1
  38. package/dist/es/a/BlurOverlay/BlurOverlay.js +0 -1
  39. package/dist/es/a/DotInfo/DotInfo.js +0 -1
  40. package/dist/es/a/LexicalPreview/LexicalPreview.js +80 -0
  41. package/dist/es/a/LexicalPreview/index.js +2 -0
  42. package/dist/es/a/LexicalPreview/styles.scss +46 -0
  43. package/dist/es/a/People/common/Person/Person.js +22 -15
  44. package/dist/es/a/ProgressBar/ProgressBar.js +3 -3
  45. package/dist/es/a/ProgressBar/styles.scss +11 -1
  46. package/dist/es/a/XMLEditor/XMLEditor.js +112 -0
  47. package/dist/es/a/XMLEditor/common/index.js +1 -0
  48. package/dist/es/a/XMLEditor/common/theme.js +180 -0
  49. package/dist/es/a/XMLEditor/index.js +1 -0
  50. package/dist/es/a/XMLEditor/styles.scss +17 -0
  51. package/dist/es/a/index.js +3 -1
  52. package/dist/es/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +115 -0
  53. package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +102 -0
  54. package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
  55. package/dist/es/b/ExpandableLexicalPreview/common/index.js +1 -0
  56. package/dist/es/b/ExpandableLexicalPreview/index.js +2 -0
  57. package/dist/es/b/ExpandableLexicalPreview/styles.scss +84 -0
  58. package/dist/es/b/Logo/Logo.js +0 -1
  59. package/dist/es/b/Title/Title.js +0 -1
  60. package/dist/es/b/index.js +2 -1
  61. package/dist/es/c/SocialMediaShareButton/SocialMediaShareButton.js +0 -2
  62. package/dist/es/c/index.js +0 -1
  63. package/dist/es/f/fields/EditorInput/EditorInput.js +15 -4
  64. package/dist/es/f/fields/EditorInput/common/StopPropagationPlugin.js +23 -0
  65. package/dist/es/f/fields/EditorInput/common/index.js +2 -1
  66. package/dist/es/f/fields/QueryCombobox/QueryCombobox.js +11 -1
  67. package/dist/es/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +32 -3
  68. package/dist/es/index.js +0 -1
  69. package/dist/es/test/QueryLoader/__generated__/QueryLoaderHelloQuery.graphql.js +0 -1
  70. package/package.json +7 -5
  71. package/src/stories/StyleGuide/ai-icons.stories.mdx +27 -0
  72. package/src/stories/StyleGuide/icons.stories.mdx +22 -22
  73. package/src/stories/a/LexicalPreview.stories.jsx +28 -0
  74. package/src/stories/a/ProgressBar.stories.jsx +1 -1
  75. package/src/stories/a/XMLEditor.stories.jsx +21 -0
  76. package/src/stories/b/ExpandableLexicalPreview.stories.jsx +29 -0
  77. package/src/stories/colors.js +4 -0
  78. package/src/stories/f/QueryCombobox.stories.jsx +22 -0
  79. package/src/ui/a/LexicalPreview/LexicalPreview.jsx +109 -0
  80. package/src/ui/a/LexicalPreview/index.js +2 -0
  81. package/src/ui/a/LexicalPreview/styles.scss +46 -0
  82. package/src/ui/a/People/common/Person/Person.jsx +31 -19
  83. package/src/ui/a/ProgressBar/ProgressBar.jsx +2 -0
  84. package/src/ui/a/ProgressBar/styles.scss +11 -1
  85. package/src/ui/a/XMLEditor/XMLEditor.jsx +182 -0
  86. package/src/ui/a/XMLEditor/common/index.js +1 -0
  87. package/src/ui/a/XMLEditor/common/theme.jsx +184 -0
  88. package/src/ui/a/XMLEditor/index.js +1 -0
  89. package/src/ui/a/XMLEditor/styles.scss +17 -0
  90. package/src/ui/a/index.js +2 -0
  91. package/src/ui/b/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +157 -0
  92. package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +123 -0
  93. package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/index.js +1 -0
  94. package/src/ui/b/ExpandableLexicalPreview/common/index.js +1 -0
  95. package/src/ui/b/ExpandableLexicalPreview/index.js +2 -0
  96. package/src/ui/b/ExpandableLexicalPreview/styles.scss +84 -0
  97. package/src/ui/b/index.js +1 -0
  98. package/src/ui/c/index.js +0 -1
  99. package/src/ui/f/fields/EditorInput/EditorInput.jsx +16 -2
  100. package/src/ui/f/fields/EditorInput/common/StopPropagationPlugin.jsx +29 -0
  101. package/src/ui/f/fields/EditorInput/common/index.jsx +1 -0
  102. package/src/ui/f/fields/QueryCombobox/QueryCombobox.jsx +12 -0
  103. package/src/ui/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.jsx +38 -1
  104. package/src/ui/index.js +0 -1
  105. package/tests/__snapshots__/Storyshots.test.js.snap +1531 -782
  106. package/dist/cjs/c/ContentSlides/ContentSlides.js +0 -172
  107. package/dist/cjs/c/ContentSlides/Context.js +0 -10
  108. package/dist/cjs/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -124
  109. package/dist/cjs/c/ContentSlides/common/Navigator/Navigator.js +0 -128
  110. package/dist/cjs/c/ContentSlides/common/Sidebar/Sidebar.js +0 -92
  111. package/dist/cjs/c/ContentSlides/common/index.js +0 -33
  112. package/dist/cjs/c/ContentSlides/index.js +0 -27
  113. package/dist/cjs/c/ContentSlides/styles.scss +0 -312
  114. package/dist/cjs/c/ContentSlides/useContentSlides.js +0 -11
  115. package/dist/cjs/r/SwitchRouteMap/SwitchRouteMap.js +0 -58
  116. package/dist/cjs/r/SwitchRouteMap/index.js +0 -13
  117. package/dist/cjs/r/common/PrivateRoute/PrivateRoute.js +0 -75
  118. package/dist/cjs/r/common/PrivateRoute/index.js +0 -13
  119. package/dist/cjs/r/common/index.js +0 -12
  120. package/dist/cjs/r/index.js +0 -27
  121. package/dist/es/c/ContentSlides/ContentSlides.js +0 -160
  122. package/dist/es/c/ContentSlides/Context.js +0 -2
  123. package/dist/es/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.js +0 -116
  124. package/dist/es/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
  125. package/dist/es/c/ContentSlides/common/Navigator/Navigator.js +0 -118
  126. package/dist/es/c/ContentSlides/common/Navigator/index.js +0 -2
  127. package/dist/es/c/ContentSlides/common/Sidebar/Sidebar.js +0 -84
  128. package/dist/es/c/ContentSlides/common/Sidebar/index.js +0 -2
  129. package/dist/es/c/ContentSlides/common/Slide/Slide.js +0 -65
  130. package/dist/es/c/ContentSlides/common/Slide/index.js +0 -2
  131. package/dist/es/c/ContentSlides/common/index.js +0 -4
  132. package/dist/es/c/ContentSlides/index.js +0 -4
  133. package/dist/es/c/ContentSlides/styles.scss +0 -312
  134. package/dist/es/c/ContentSlides/useContentSlides.js +0 -3
  135. package/dist/es/r/SwitchRouteMap/SwitchRouteMap.js +0 -45
  136. package/dist/es/r/SwitchRouteMap/index.js +0 -2
  137. package/dist/es/r/common/PrivateRoute/PrivateRoute.js +0 -67
  138. package/dist/es/r/common/PrivateRoute/index.js +0 -2
  139. package/dist/es/r/common/index.js +0 -1
  140. package/dist/es/r/index.js +0 -2
  141. package/src/stories/c/ContentSlides.stories.jsx +0 -214
  142. package/src/ui/c/ContentSlides/ContentSlides.jsx +0 -214
  143. package/src/ui/c/ContentSlides/Context.js +0 -3
  144. package/src/ui/c/ContentSlides/common/HorizontalMenu/HorizontalMenu.jsx +0 -145
  145. package/src/ui/c/ContentSlides/common/HorizontalMenu/index.js +0 -2
  146. package/src/ui/c/ContentSlides/common/Navigator/Navigator.jsx +0 -150
  147. package/src/ui/c/ContentSlides/common/Navigator/index.js +0 -2
  148. package/src/ui/c/ContentSlides/common/Sidebar/Sidebar.jsx +0 -135
  149. package/src/ui/c/ContentSlides/common/Sidebar/index.js +0 -2
  150. package/src/ui/c/ContentSlides/common/Slide/Slide.jsx +0 -87
  151. package/src/ui/c/ContentSlides/common/Slide/index.js +0 -2
  152. package/src/ui/c/ContentSlides/common/index.js +0 -4
  153. package/src/ui/c/ContentSlides/index.js +0 -4
  154. package/src/ui/c/ContentSlides/styles.scss +0 -312
  155. package/src/ui/c/ContentSlides/useContentSlides.js +0 -4
  156. package/src/ui/r/SwitchRouteMap/SwitchRouteMap.jsx +0 -64
  157. package/src/ui/r/SwitchRouteMap/index.js +0 -2
  158. package/src/ui/r/common/PrivateRoute/PrivateRoute.jsx +0 -73
  159. package/src/ui/r/common/PrivateRoute/index.js +0 -2
  160. package/src/ui/r/common/index.js +0 -1
  161. package/src/ui/r/index.js +0 -2
@@ -41,6 +41,7 @@ const MultipleCombobox = _ref => {
41
41
  labelColor,
42
42
  name,
43
43
  optional,
44
+ getTagColor,
44
45
  options: items,
45
46
  getOptions,
46
47
  setValue,
@@ -102,7 +103,6 @@ const MultipleCombobox = _ref => {
102
103
  ...changes,
103
104
  isOpen: true // keep the menu open after selection.
104
105
  };
105
-
106
106
  default:
107
107
  break;
108
108
  }
@@ -185,7 +185,7 @@ const MultipleCombobox = _ref => {
185
185
  removeSelectedItem(selectedItem);
186
186
  },
187
187
  isCompact: true,
188
- color: color
188
+ color: getTagColor ? getTagColor(selectedItem) : color
189
189
  }, /*#__PURE__*/React.createElement("span", null, selectedItem.label), /*#__PURE__*/React.createElement("span", {
190
190
  className: "icon close"
191
191
  }, "Y"))))), /*#__PURE__*/React.createElement("div", {
@@ -294,7 +294,36 @@ MultipleCombobox.propTypes = {
294
294
  /**
295
295
  * The placeholder text for the input
296
296
  */
297
- placeholder: _propTypes.default.string
297
+ placeholder: _propTypes.default.string,
298
+ /**
299
+ * The function to set the options of the custom select input
300
+ */
301
+ setOptions: _propTypes.default.func,
302
+ /**
303
+ * Whether to prompt the user to create a new option if the search input
304
+ * does not match any of the options
305
+ */
306
+ promptCreateNewOption: _propTypes.default.bool,
307
+ /**
308
+ * The function to get the color of the tag
309
+ */
310
+ getTagColor: _propTypes.default.func,
311
+ /**
312
+ * The color of the label
313
+ */
314
+ labelColor: _propTypes.default.string,
315
+ /**
316
+ * The function to validate the input
317
+ */
318
+ validate: _propTypes.default.func,
319
+ /**
320
+ * Whether to allow multiple items selection
321
+ */
322
+ multiple: _propTypes.default.bool,
323
+ /**
324
+ * The variable to be used to search the data
325
+ */
326
+ searchVariable: _propTypes.default.string
298
327
  };
299
328
  MultipleCombobox.defaultProps = {
300
329
  // someProp: false
package/dist/cjs/index.js CHANGED
@@ -3,17 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _r = require("./r");
7
- Object.keys(_r).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _r[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _r[key];
14
- }
15
- });
16
- });
17
6
  var _a = require("./a");
18
7
  Object.keys(_a).forEach(function (key) {
19
8
  if (key === "default" || key === "__esModule") return;
@@ -48,7 +48,6 @@ const node /*: ConcreteRequest*/ = function () {
48
48
  "name": "QueryLoaderHelloQuery",
49
49
  "selections": v0 /*: any*/
50
50
  },
51
-
52
51
  "params": {
53
52
  "cacheID": "463f9ee8a82dd6ec8dedeb28649cce74",
54
53
  "id": null,
@@ -37,7 +37,6 @@ const AnimatedGradient = ({
37
37
  // {...otherProps}
38
38
  });
39
39
  };
40
-
41
40
  AnimatedGradient.propTypes = {
42
41
  /**
43
42
  * The HTML class names for this element
@@ -319,7 +319,6 @@ class Gradient {
319
319
  window.addEventListener("scroll", this.handleScroll), window.addEventListener("mousedown", this.handleMouseDown), window.addEventListener("mouseup", this.handleMouseUp), window.addEventListener("keydown", this.handleKeyDown), this.isIntersecting = !0, this.addIsLoadedClass(), this.play()
320
320
  }) */);
321
321
  }
322
-
323
322
  disconnect() {
324
323
  this.scrollObserver && (window.removeEventListener('scroll', this.handleScroll), window.removeEventListener('mousedown', this.handleMouseDown), window.removeEventListener('mouseup', this.handleMouseUp), window.removeEventListener('keydown', this.handleKeyDown), this.scrollObserver.disconnect()), window.removeEventListener('resize', this.resize);
325
324
  }
@@ -42,5 +42,4 @@ BlurOverlay.defaultProps = {
42
42
  blur: true
43
43
  // someProp:false
44
44
  };
45
-
46
45
  export default BlurOverlay;
@@ -71,5 +71,4 @@ DotInfo.defaultProps = {
71
71
  height: '2em'
72
72
  // someProp:false
73
73
  };
74
-
75
74
  export default DotInfo;
@@ -0,0 +1,80 @@
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;
@@ -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
+ }
@@ -20,21 +20,28 @@ const Person = ({
20
20
  role,
21
21
  color
22
22
  // ...otherProps
23
- }) => /*#__PURE__*/React.createElement("div", {
24
- id: id,
25
- className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
26
- style: style
27
- }, /*#__PURE__*/React.createElement("img", {
28
- className: "image v50 mr-v",
29
- src: image,
30
- alt: `${name}, ${role}`
31
- }), /*#__PURE__*/React.createElement("div", {
32
- className: "details"
33
- }, name && /*#__PURE__*/React.createElement("p", {
34
- className: "name"
35
- }, name), role && /*#__PURE__*/React.createElement("p", {
36
- className: "role"
37
- }, role)));
23
+ }) => {
24
+ const handleImageSrcError = e => {
25
+ e.target.onerror = null;
26
+ e.target.src = '/default-avatar.svg';
27
+ };
28
+ return /*#__PURE__*/React.createElement("div", {
29
+ id: id,
30
+ className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
31
+ style: style
32
+ }, /*#__PURE__*/React.createElement("img", {
33
+ className: "image v50 mr-v",
34
+ src: image || '/default-avatar.svg',
35
+ alt: `${name}, ${role}`,
36
+ onError: handleImageSrcError
37
+ }), /*#__PURE__*/React.createElement("div", {
38
+ className: "details"
39
+ }, name && /*#__PURE__*/React.createElement("p", {
40
+ className: "name"
41
+ }, name), role && /*#__PURE__*/React.createElement("p", {
42
+ className: "role"
43
+ }, role)));
44
+ };
38
45
  Person.propTypes = {
39
46
  /**
40
47
  * The HTML id for this element
@@ -19,11 +19,12 @@ const ProgressBar = ({
19
19
  attached,
20
20
  color,
21
21
  progress,
22
- height
22
+ height,
23
+ rounded
23
24
  // ...otherProps
24
25
  }) => /*#__PURE__*/React.createElement("div", {
25
26
  id: id,
26
- className: [baseClassName, componentClassName, attached && styleNames.modifierAttached, color && `x-${color}`, userClassName].filter(e => e).join(' '),
27
+ className: [baseClassName, componentClassName, attached && styleNames.modifierAttached, color && `x-${color}`, userClassName, rounded && 'rounded'].filter(e => e).join(' '),
27
28
  style: {
28
29
  '--progress': progress,
29
30
  '--height': height,
@@ -32,7 +33,6 @@ const ProgressBar = ({
32
33
  "data-length": "50%"
33
34
  // {...otherProps}
34
35
  });
35
-
36
36
  ProgressBar.propTypes = {
37
37
  /**
38
38
  * The HTML id for this element
@@ -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;
@@ -0,0 +1,112 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import * as React from 'react';
3
+ import { useEffect, useRef } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import { EditorState } from '@codemirror/state';
6
+ import { EditorView, keymap, lineNumbers, drawSelection, dropCursor, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, crosshairCursor, rectangularSelection } from '@codemirror/view';
7
+ import { defaultKeymap } from '@codemirror/commands';
8
+ import { indentOnInput, bracketMatching, foldGutter } from '@codemirror/language';
9
+ import { xml } from '@codemirror/lang-xml';
10
+ import styleNames from '@pareto-engineering/bem/exports';
11
+ import { theme } from "./common";
12
+ import "./styles.scss";
13
+ const baseClassName = styleNames.base;
14
+ const componentClassName = 'code-editor';
15
+
16
+ /**
17
+ * codemirror documentation:
18
+ * https://codemirror.net/
19
+ */
20
+
21
+ const XMLEditor = ({
22
+ id,
23
+ className: userClassName,
24
+ style,
25
+ readOnly,
26
+ height,
27
+ gutterWidth,
28
+ config,
29
+ onChange,
30
+ stopPropagationKeys
31
+ }) => {
32
+ const editorRef = useRef();
33
+ useEffect(() => {
34
+ const startState = EditorState.create({
35
+ doc: config,
36
+ extensions: [keymap.of(defaultKeymap), indentOnInput(), lineNumbers(), bracketMatching(), foldGutter(), drawSelection(), highlightActiveLine(), highlightActiveLineGutter(), highlightSpecialChars(), dropCursor(), rectangularSelection(), crosshairCursor(), xml(), theme, EditorState.readOnly.of(readOnly), EditorView.updateListener.of(view => {
37
+ onChange(view);
38
+ // view.state.doc.toString() to receive the current content in the editor.
39
+ }), EditorView.domEventHandlers({
40
+ keydown(e) {
41
+ if (stopPropagationKeys?.includes(e.key)) {
42
+ e.stopPropagation();
43
+ }
44
+ }
45
+ })]
46
+ });
47
+ const view = new EditorView({
48
+ state: startState,
49
+ parent: editorRef.current
50
+ });
51
+ return () => {
52
+ view.destroy();
53
+ };
54
+ }, [editorRef]);
55
+ return /*#__PURE__*/React.createElement("div", {
56
+ id: id,
57
+ ref: editorRef,
58
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
59
+ style: {
60
+ '--height': height,
61
+ '--gutter-width': gutterWidth,
62
+ ...style
63
+ }
64
+ });
65
+ };
66
+ XMLEditor.propTypes = {
67
+ /**
68
+ * The HTML id for this element
69
+ */
70
+ id: PropTypes.string,
71
+ /**
72
+ * The HTML class names for this element
73
+ */
74
+ className: PropTypes.string,
75
+ /**
76
+ * The React-written, css properties for this element.
77
+ */
78
+ style: PropTypes.objectOf(PropTypes.string),
79
+ /**
80
+ * Whether or not the content is read only.
81
+ */
82
+ readOnly: PropTypes.bool,
83
+ /**
84
+ * The initial labeling configuration.
85
+ */
86
+ config: PropTypes.string,
87
+ /**
88
+ * The height of the editor.
89
+ */
90
+ height: PropTypes.string,
91
+ /**
92
+ * The callback for when the labeling configuration changes.
93
+ */
94
+ onChange: PropTypes.func,
95
+ /**
96
+ * The width of the gutter.
97
+ */
98
+ gutterWidth: PropTypes.string,
99
+ /**
100
+ * The keys to stop propagation on.
101
+ */
102
+ stopPropagationKeys: PropTypes.arrayOf(PropTypes.string)
103
+ };
104
+ XMLEditor.defaultProps = {
105
+ config: `<View>
106
+ <!--Edit this config to customize the labeling interface.-->
107
+ </View>
108
+ `,
109
+ height: '20em',
110
+ gutterWidth: '3em'
111
+ };
112
+ export default XMLEditor;
@@ -0,0 +1 @@
1
+ export { default as theme } from "./theme";
@@ -0,0 +1,180 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ import { EditorView } from '@codemirror/view';
3
+ import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
4
+ import { tags } from '@lezer/highlight';
5
+
6
+ // Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
7
+ const chalky = '#e5c07b';
8
+ const coral = '#e06c75';
9
+ const cyan = '#56b6c2';
10
+ const invalid = '#ffffff';
11
+ const ivory = '#abb2bf';
12
+ const stone = '#7d8799'; // Brightened compared to original to increase contrast
13
+ const malibu = '#61afef';
14
+ const sage = '#98c379';
15
+ const whiskey = '#d19a66';
16
+ const violet = '#c678dd';
17
+ const darkBackground = '#21252b';
18
+ const highlightBackground = '#2c313a';
19
+ const background = '#282c34';
20
+ const tooltipBackground = '#353a42';
21
+ const selection = '#3E4451';
22
+ const cursor = '#528bff';
23
+ /**
24
+ The colors used in the theme, as CSS color strings.
25
+ */
26
+ // const color = {
27
+ // chalky,
28
+ // coral,
29
+ // cyan,
30
+ // invalid,
31
+ // ivory,
32
+ // stone,
33
+ // malibu,
34
+ // sage,
35
+ // whiskey,
36
+ // violet,
37
+ // darkBackground,
38
+ // highlightBackground,
39
+ // background,
40
+ // tooltipBackground,
41
+ // selection,
42
+ // cursor
43
+ // };
44
+ /**
45
+ The editor theme styles for One Dark.
46
+ */
47
+ const oneDarkTheme = /* @__PURE__ */EditorView.theme({
48
+ '&': {
49
+ color: ivory,
50
+ backgroundColor: background
51
+ },
52
+ '.cm-content': {
53
+ caretColor: cursor
54
+ },
55
+ '.cm-cursor, .cm-dropCursor': {
56
+ borderLeftColor: cursor
57
+ },
58
+ '&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
59
+ backgroundColor: selection
60
+ },
61
+ '.cm-panels': {
62
+ backgroundColor: darkBackground,
63
+ color: ivory
64
+ },
65
+ '.cm-panels.cm-panels-top': {
66
+ borderBottom: '2px solid black'
67
+ },
68
+ '.cm-panels.cm-panels-bottom': {
69
+ borderTop: '2px solid black'
70
+ },
71
+ '.cm-searchMatch': {
72
+ backgroundColor: '#72a1ff59',
73
+ outline: '1px solid #457dff'
74
+ },
75
+ '.cm-searchMatch.cm-searchMatch-selected': {
76
+ backgroundColor: '#6199ff2f'
77
+ },
78
+ '.cm-activeLine': {
79
+ backgroundColor: '#6699ff0b'
80
+ },
81
+ '.cm-selectionMatch': {
82
+ backgroundColor: '#aafe661a'
83
+ },
84
+ '&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
85
+ backgroundColor: '#bad0f847'
86
+ },
87
+ '.cm-gutters': {
88
+ backgroundColor: background,
89
+ color: stone,
90
+ border: 'none'
91
+ },
92
+ '.cm-activeLineGutter': {
93
+ backgroundColor: highlightBackground
94
+ },
95
+ '.cm-foldPlaceholder': {
96
+ backgroundColor: 'transparent',
97
+ border: 'none',
98
+ color: '#ddd'
99
+ },
100
+ '.cm-tooltip': {
101
+ border: 'none',
102
+ backgroundColor: tooltipBackground
103
+ },
104
+ '.cm-tooltip .cm-tooltip-arrow:before': {
105
+ borderTopColor: 'transparent',
106
+ borderBottomColor: 'transparent'
107
+ },
108
+ '.cm-tooltip .cm-tooltip-arrow:after': {
109
+ borderTopColor: tooltipBackground,
110
+ borderBottomColor: tooltipBackground
111
+ },
112
+ '.cm-tooltip-autocomplete': {
113
+ '& > ul > li[aria-selected]': {
114
+ backgroundColor: highlightBackground,
115
+ color: ivory
116
+ }
117
+ }
118
+ }, {
119
+ dark: true
120
+ });
121
+ /**
122
+ The highlighting style for code in the One Dark theme.
123
+ */
124
+ const oneDarkHighlightStyle = /* @__PURE__ */HighlightStyle.define([{
125
+ tag: tags.keyword,
126
+ color: violet
127
+ }, {
128
+ tag: [tags.name, tags.deleted, tags.character, tags.propertyName, tags.macroName],
129
+ color: coral
130
+ }, {
131
+ tag: [/* @__PURE__ */tags.function(tags.variableName), tags.labelName],
132
+ color: malibu
133
+ }, {
134
+ tag: [tags.color, /* @__PURE__ */tags.constant(tags.name), /* @__PURE__ */tags.standard(tags.name)],
135
+ color: whiskey
136
+ }, {
137
+ tag: [/* @__PURE__ */tags.definition(tags.name), tags.separator],
138
+ color: ivory
139
+ }, {
140
+ tag: [tags.typeName, tags.className, tags.number, tags.changed, tags.annotation, tags.modifier, tags.self, tags.namespace],
141
+ color: chalky
142
+ }, {
143
+ tag: [tags.operator, tags.operatorKeyword, tags.url, tags.escape, tags.regexp, tags.link, /* @__PURE__ */tags.special(tags.string)],
144
+ color: cyan
145
+ }, {
146
+ tag: [tags.meta, tags.comment],
147
+ color: stone
148
+ }, {
149
+ tag: tags.strong,
150
+ fontWeight: 'bold'
151
+ }, {
152
+ tag: tags.emphasis,
153
+ fontStyle: 'italic'
154
+ }, {
155
+ tag: tags.strikethrough,
156
+ textDecoration: 'line-through'
157
+ }, {
158
+ tag: tags.link,
159
+ color: stone,
160
+ textDecoration: 'underline'
161
+ }, {
162
+ tag: tags.heading,
163
+ fontWeight: 'bold',
164
+ color: coral
165
+ }, {
166
+ tag: [tags.atom, tags.bool, /* @__PURE__ */tags.special(tags.variableName)],
167
+ color: whiskey
168
+ }, {
169
+ tag: [tags.processingInstruction, tags.string, tags.inserted],
170
+ color: sage
171
+ }, {
172
+ tag: tags.invalid,
173
+ color: invalid
174
+ }]);
175
+ /**
176
+ Extension to enable the One Dark theme (both the editor theme and
177
+ the highlight style).
178
+ */
179
+ const oneDark = [oneDarkTheme, /* @__PURE__ */syntaxHighlighting(oneDarkHighlightStyle)];
180
+ export default oneDark;
@@ -0,0 +1 @@
1
+ export { default as XMLEditor } from "./XMLEditor";
@@ -0,0 +1,17 @@
1
+ @use "@pareto-engineering/bem";
2
+
3
+ .#{bem.$base}.code-editor {
4
+ border-radius: 1em;
5
+ height: var(--height);
6
+ overflow: auto;
7
+
8
+ > .cm-editor {
9
+ height: 100%;
10
+
11
+ .cm-gutters {
12
+ display: flex;
13
+ justify-content: flex-end;
14
+ width: var(--gutter-width);
15
+ }
16
+ }
17
+ }
@@ -22,4 +22,6 @@ export { Tip } from "./Tip";
22
22
  export { AnimatedGradient } from "./AnimatedGradient";
23
23
  export { TextSteps } from "./TextSteps";
24
24
  export { Removable } from "./Removable";
25
- export { ToggleSwitch } from "./ToggleSwitch";
25
+ export { ToggleSwitch } from "./ToggleSwitch";
26
+ export { XMLEditor } from "./XMLEditor";
27
+ export { LexicalPreview } from "./LexicalPreview";