@pareto-engineering/design-system 4.0.0-alpha.77 → 4.0.0-alpha.79

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 (210) hide show
  1. package/dist/cjs/a/AnimatedBlobs/AnimatedBlobs.js +1 -1
  2. package/dist/cjs/a/AnimatedGradient/AnimatedGradient.js +1 -1
  3. package/dist/cjs/a/AppContext/Context.js +1 -1
  4. package/dist/cjs/a/AppContext/ContextProvider.js +1 -1
  5. package/dist/cjs/a/BlurOverlay/BlurOverlay.js +1 -1
  6. package/dist/cjs/a/ContentTree/ContentTree.js +1 -1
  7. package/dist/cjs/a/ContentTree/common/Tree/Tree.js +1 -1
  8. package/dist/cjs/a/Conversation/Context.js +1 -1
  9. package/dist/cjs/a/Conversation/Conversation.js +1 -1
  10. package/dist/cjs/a/Conversation/common/Message/Message.js +1 -1
  11. package/dist/cjs/a/DatePicker/DatePicker.js +1 -1
  12. package/dist/cjs/a/DotInfo/DotInfo.js +1 -1
  13. package/dist/cjs/a/Figure/Figure.js +1 -1
  14. package/dist/cjs/a/HamburgerButton/HamburgerButton.js +1 -1
  15. package/dist/cjs/a/IconList/IconList.js +1 -1
  16. package/dist/cjs/a/IconList/common/Item/Item.js +1 -1
  17. package/dist/cjs/a/Label/Label.js +1 -1
  18. package/dist/cjs/a/LoadingCircle/LoadingCircle.js +1 -1
  19. package/dist/cjs/a/MetaCard/MetaCard.js +1 -1
  20. package/dist/cjs/a/People/People.js +1 -1
  21. package/dist/cjs/a/People/common/Person/Person.js +1 -1
  22. package/dist/cjs/a/People/styles.scss +1 -1
  23. package/dist/cjs/a/Popover/Popover.js +1 -1
  24. package/dist/cjs/a/ProgressBar/ProgressBar.js +1 -1
  25. package/dist/cjs/a/Quote/Quote.js +16 -6
  26. package/dist/cjs/a/Quote/styles.scss +16 -37
  27. package/dist/cjs/a/Removable/Removable.js +1 -1
  28. package/dist/cjs/a/SVG/SVG.js +1 -1
  29. package/dist/cjs/a/SVG/common/UseSVG/UseSVG.js +1 -1
  30. package/dist/cjs/a/SnapScroller/SnapScroller.js +1 -1
  31. package/dist/cjs/a/Spinner/Spinner.js +1 -1
  32. package/dist/cjs/a/TextSteps/TextSteps.js +1 -1
  33. package/dist/cjs/a/Timestamp/Timestamp.js +1 -1
  34. package/dist/cjs/a/Tip/Tip.js +1 -1
  35. package/dist/cjs/a/ToggleSwitch/ToggleSwitch.js +1 -1
  36. package/dist/cjs/a/Tooltip/Tooltip.js +71 -0
  37. package/dist/cjs/a/{LexicalPreview → Tooltip}/index.js +3 -3
  38. package/dist/cjs/a/Tooltip/styles.scss +56 -0
  39. package/dist/cjs/a/XMLEditor/XMLEditor.js +1 -1
  40. package/dist/cjs/a/index.js +8 -8
  41. package/dist/cjs/b/Button/Button.js +1 -1
  42. package/dist/cjs/b/Button/common/Group/Group.js +1 -1
  43. package/dist/cjs/b/Card/Card.js +1 -1
  44. package/dist/cjs/b/Card/common/Group/Group.js +1 -1
  45. package/dist/cjs/b/Card/common/Section/Section.js +1 -1
  46. package/dist/cjs/b/Logo/Logo.js +1 -1
  47. package/dist/cjs/b/Page/Context.js +1 -1
  48. package/dist/cjs/b/Page/Page.js +1 -1
  49. package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +5 -2
  50. package/dist/cjs/b/Page/common/Section/Section.js +1 -1
  51. package/dist/cjs/b/SocialMediaButton/SocialMediaButton.js +1 -1
  52. package/dist/cjs/b/ThemeSelector/ThemeSelector.js +1 -1
  53. package/dist/cjs/b/Title/Title.js +1 -1
  54. package/dist/cjs/b/index.js +1 -8
  55. package/dist/cjs/c/Modal/Modal.js +1 -1
  56. package/dist/cjs/c/Modal/common/ModalHeader/ModalHeader.js +1 -1
  57. package/dist/cjs/c/Shortener/Shortener.js +1 -1
  58. package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +1 -1
  59. package/dist/cjs/f/FormInput/FormInput.js +1 -1
  60. package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
  61. package/dist/cjs/f/common/Description/Description.js +1 -1
  62. package/dist/cjs/f/common/Label/Label.js +1 -1
  63. package/dist/cjs/f/fields/Checkbox/Checkbox.js +1 -1
  64. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  65. package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
  66. package/dist/cjs/f/fields/EditorInput/EditorInput.js +37 -12
  67. package/dist/cjs/f/fields/EditorInput/common/BlockFormatDropDown/BlockFormatDropDown.js +256 -0
  68. package/dist/cjs/f/fields/EditorInput/common/BlockFormatDropDown/index.js +13 -0
  69. package/dist/cjs/f/fields/EditorInput/common/BlockFormatDropDown/styles.scss +55 -0
  70. package/dist/cjs/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +94 -0
  71. package/dist/cjs/f/fields/EditorInput/common/ColorPicker/index.js +13 -0
  72. package/dist/cjs/f/fields/EditorInput/common/ColorPicker/styles.scss +36 -0
  73. package/dist/cjs/f/fields/EditorInput/common/FontSizeDropDown/FontSizeDropDown.js +94 -0
  74. package/dist/cjs/f/fields/EditorInput/common/FontSizeDropDown/index.js +13 -0
  75. package/dist/cjs/f/fields/EditorInput/common/FontSizeDropDown/styles.scss +55 -0
  76. package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +295 -0
  77. package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/index.js +13 -0
  78. package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/styles.scss +56 -0
  79. package/dist/cjs/f/fields/EditorInput/common/index.js +24 -3
  80. package/dist/cjs/f/fields/EditorInput/styles.scss +116 -25
  81. package/dist/cjs/f/fields/LinkInput/LinkInput.js +1 -1
  82. package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +1 -1
  83. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +1 -1
  84. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +1 -1
  85. package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +1 -1
  86. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +1 -1
  87. package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +1 -1
  88. package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +1 -1
  89. package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +1 -1
  90. package/dist/cjs/f/fields/SelectInput/SelectInput.js +10 -3
  91. package/dist/cjs/f/fields/SelectInput/common/Menu/Menu.js +1 -1
  92. package/dist/cjs/f/fields/SelectInput/common/Multiple/Multiple.js +1 -1
  93. package/dist/cjs/f/fields/SelectInput/common/Single/Single.js +14 -3
  94. package/dist/cjs/f/fields/SelectInput/styles.scss +1 -1
  95. package/dist/cjs/f/fields/TextInput/TextInput.js +1 -1
  96. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +1 -1
  97. package/dist/cjs/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.js +28 -43
  98. package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +7 -8
  99. package/dist/cjs/g/ExpandableLexicalPreview/styles.scss +34 -0
  100. package/dist/cjs/g/index.js +12 -0
  101. package/dist/cjs/index.js +11 -0
  102. package/dist/cjs/test/QueryLoader/QueryLoader.js +1 -1
  103. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +1 -1
  104. package/dist/cjs/utils/hooks/index.js +7 -0
  105. package/dist/cjs/utils/hooks/useOutsideClick.js +25 -0
  106. package/dist/cjs/utils/index.js +6 -0
  107. package/dist/es/a/People/styles.scss +1 -1
  108. package/dist/es/a/Quote/Quote.js +15 -5
  109. package/dist/es/a/Quote/styles.scss +16 -37
  110. package/dist/es/a/Tooltip/Tooltip.js +59 -0
  111. package/dist/es/a/Tooltip/index.js +2 -0
  112. package/dist/es/a/Tooltip/styles.scss +56 -0
  113. package/dist/es/a/index.js +2 -2
  114. package/dist/es/b/Page/common/PageHelmet/PageHelmet.js +4 -1
  115. package/dist/es/b/index.js +1 -2
  116. package/dist/es/f/fields/EditorInput/EditorInput.js +35 -11
  117. package/dist/es/f/fields/EditorInput/common/BlockFormatDropDown/BlockFormatDropDown.js +246 -0
  118. package/dist/es/f/fields/EditorInput/common/BlockFormatDropDown/index.js +2 -0
  119. package/dist/es/f/fields/EditorInput/common/BlockFormatDropDown/styles.scss +55 -0
  120. package/dist/es/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +83 -0
  121. package/dist/es/f/fields/EditorInput/common/ColorPicker/index.js +2 -0
  122. package/dist/es/f/fields/EditorInput/common/ColorPicker/styles.scss +36 -0
  123. package/dist/es/f/fields/EditorInput/common/FontSizeDropDown/FontSizeDropDown.js +81 -0
  124. package/dist/es/f/fields/EditorInput/common/FontSizeDropDown/index.js +2 -0
  125. package/dist/es/f/fields/EditorInput/common/FontSizeDropDown/styles.scss +55 -0
  126. package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +283 -0
  127. package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/index.js +2 -0
  128. package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/styles.scss +56 -0
  129. package/dist/es/f/fields/EditorInput/common/index.js +5 -2
  130. package/dist/es/f/fields/EditorInput/styles.scss +116 -25
  131. package/dist/es/f/fields/SelectInput/SelectInput.js +9 -2
  132. package/dist/es/f/fields/SelectInput/common/Single/Single.js +12 -1
  133. package/dist/es/f/fields/SelectInput/styles.scss +1 -1
  134. package/dist/es/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.js +29 -45
  135. package/dist/es/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +18 -21
  136. package/dist/es/g/ExpandableLexicalPreview/styles.scss +34 -0
  137. package/dist/es/g/index.js +1 -0
  138. package/dist/es/index.js +1 -0
  139. package/dist/es/utils/hooks/index.js +2 -1
  140. package/dist/es/utils/hooks/useOutsideClick.js +19 -0
  141. package/dist/es/utils/index.js +1 -1
  142. package/package.json +14 -6
  143. package/src/stories/a/Quote.stories.jsx +30 -10
  144. package/src/stories/a/Tooltip.stories.jsx +80 -0
  145. package/src/stories/a/XMLEditor.stories.jsx +6 -1
  146. package/src/stories/f/SelectInput.stories.jsx +18 -2
  147. package/src/stories/{b → g}/ExpandableLexicalPreview.stories.jsx +2 -1
  148. package/src/ui/a/People/styles.scss +1 -1
  149. package/src/ui/a/Quote/Quote.jsx +16 -9
  150. package/src/ui/a/Quote/styles.scss +16 -37
  151. package/src/ui/a/Tooltip/Tooltip.jsx +83 -0
  152. package/src/ui/a/Tooltip/index.js +2 -0
  153. package/src/ui/a/Tooltip/styles.scss +56 -0
  154. package/src/ui/a/index.js +1 -1
  155. package/src/ui/b/Page/common/PageHelmet/PageHelmet.jsx +6 -0
  156. package/src/ui/b/index.js +0 -1
  157. package/src/ui/f/fields/EditorInput/EditorInput.jsx +35 -5
  158. package/src/ui/f/fields/EditorInput/common/BlockFormatDropDown/BlockFormatDropDown.jsx +292 -0
  159. package/src/ui/f/fields/EditorInput/common/BlockFormatDropDown/index.js +2 -0
  160. package/src/ui/f/fields/EditorInput/common/BlockFormatDropDown/styles.scss +55 -0
  161. package/src/ui/f/fields/EditorInput/common/ColorPicker/ColorPicker.jsx +110 -0
  162. package/src/ui/f/fields/EditorInput/common/ColorPicker/index.js +2 -0
  163. package/src/ui/f/fields/EditorInput/common/ColorPicker/styles.scss +36 -0
  164. package/src/ui/f/fields/EditorInput/common/FontSizeDropDown/FontSizeDropDown.jsx +134 -0
  165. package/src/ui/f/fields/EditorInput/common/FontSizeDropDown/index.js +2 -0
  166. package/src/ui/f/fields/EditorInput/common/FontSizeDropDown/styles.scss +55 -0
  167. package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.jsx +431 -0
  168. package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/index.js +2 -0
  169. package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/styles.scss +56 -0
  170. package/src/ui/f/fields/EditorInput/common/index.js +6 -0
  171. package/src/ui/f/fields/EditorInput/styles.scss +116 -25
  172. package/src/ui/f/fields/SelectInput/SelectInput.jsx +10 -2
  173. package/src/ui/f/fields/SelectInput/common/Single/Single.jsx +13 -1
  174. package/src/ui/f/fields/SelectInput/styles.scss +1 -1
  175. package/src/ui/{b → g}/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +43 -56
  176. package/src/ui/{b → g}/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +32 -36
  177. package/src/ui/g/ExpandableLexicalPreview/styles.scss +34 -0
  178. package/src/ui/g/index.js +1 -0
  179. package/src/ui/index.js +1 -0
  180. package/src/ui/utils/hooks/index.js +1 -0
  181. package/src/ui/utils/hooks/useOutsideClick.js +23 -0
  182. package/src/ui/utils/index.js +1 -1
  183. package/tests/__snapshots__/Storyshots.test.js.snap +914 -433
  184. package/tests/mockResizeObserver.js +9 -0
  185. package/tests/test-setup.js +3 -0
  186. package/dist/cjs/a/LexicalPreview/LexicalPreview.js +0 -90
  187. package/dist/cjs/a/LexicalPreview/styles.scss +0 -46
  188. package/dist/cjs/b/ExpandableLexicalPreview/styles.scss +0 -84
  189. package/dist/cjs/f/fields/EditorInput/common/Toolbar.js +0 -257
  190. package/dist/es/a/LexicalPreview/LexicalPreview.js +0 -80
  191. package/dist/es/a/LexicalPreview/index.js +0 -2
  192. package/dist/es/a/LexicalPreview/styles.scss +0 -46
  193. package/dist/es/b/ExpandableLexicalPreview/styles.scss +0 -84
  194. package/dist/es/f/fields/EditorInput/common/Toolbar.js +0 -246
  195. package/src/stories/a/LexicalPreview.stories.jsx +0 -28
  196. package/src/ui/a/LexicalPreview/LexicalPreview.jsx +0 -109
  197. package/src/ui/a/LexicalPreview/index.js +0 -2
  198. package/src/ui/a/LexicalPreview/styles.scss +0 -46
  199. package/src/ui/b/ExpandableLexicalPreview/styles.scss +0 -84
  200. package/src/ui/f/fields/EditorInput/common/Toolbar.jsx +0 -356
  201. package/src/ui/f/fields/EditorInput/common/index.jsx +0 -3
  202. /package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
  203. /package/dist/cjs/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
  204. /package/dist/cjs/{b → g}/ExpandableLexicalPreview/index.js +0 -0
  205. /package/dist/es/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
  206. /package/dist/es/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
  207. /package/dist/es/{b → g}/ExpandableLexicalPreview/index.js +0 -0
  208. /package/src/ui/{b → g}/ExpandableLexicalPreview/common/ExpandButton/index.js +0 -0
  209. /package/src/ui/{b → g}/ExpandableLexicalPreview/common/index.js +0 -0
  210. /package/src/ui/{b → g}/ExpandableLexicalPreview/index.js +0 -0
@@ -0,0 +1,9 @@
1
+ class MockResizeObserver {
2
+ constructor() {
3
+ this.observe = () => {}
4
+ this.unobserve = () => {}
5
+ this.disconnect = () => {}
6
+ }
7
+ }
8
+
9
+ export default MockResizeObserver
@@ -1,4 +1,7 @@
1
+ import MockResizeObserver from './mockResizeObserver'
2
+
1
3
  const noop = () => {}
2
4
  const emptyDirFunc = () => ({})
5
+ global.ResizeObserver = MockResizeObserver
3
6
  Object.defineProperty(window, 'scrollTo', { value: noop, writable: true })
4
7
  Object.defineProperty(window, 'matchMedia', { value: emptyDirFunc, writable: true })
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var React = _interopRequireWildcard(require("react"));
8
- var _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");
13
- var _propTypes = _interopRequireDefault(require("prop-types"));
14
- var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
15
- require("./styles.scss");
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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); }
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; }
19
- /* @pareto-engineering/generator-front 1.0.12 */
20
- /* eslint-disable import/no-extraneous-dependencies -- required here */
21
-
22
- // Local Definitions
23
-
24
- const baseClassName = _exports.default.base;
25
- const componentClassName = 'lexical-preview';
26
-
27
- /**
28
- * This is the component description.
29
- */
30
- const LexicalPreview = _ref => {
31
- let {
32
- id,
33
- className: userClassName,
34
- style,
35
- nodes,
36
- color
37
- // ...otherProps
38
- } = _ref;
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", {
55
- id: id,
56
- className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
57
- style: style
58
- }, /*#__PURE__*/React.createElement(_LexicalRichTextPlugin.RichTextPlugin, {
59
- contentEditable: /*#__PURE__*/React.createElement(_LexicalContentEditable.ContentEditable, {
60
- id: id,
61
- className: "content-editable"
62
- })
63
- })));
64
- };
65
- LexicalPreview.propTypes = {
66
- /**
67
- * The HTML id for this element
68
- */
69
- id: _propTypes.default.string,
70
- /**
71
- * The HTML class names for this element
72
- */
73
- className: _propTypes.default.string,
74
- /**
75
- * The React-written, css properties for this element.
76
- */
77
- style: _propTypes.default.objectOf(_propTypes.default.string),
78
- /**
79
- * Color of the text
80
- */
81
- color: _propTypes.default.string,
82
- /**
83
- * The nodes to render in the form of a json string
84
- */
85
- nodes: _propTypes.default.string
86
- };
87
- LexicalPreview.defaultProps = {
88
- color: 'paragraph'
89
- };
90
- var _default = exports.default = LexicalPreview;
@@ -1,46 +0,0 @@
1
- /* @pareto-engineering/generator-front 1.0.12 */
2
-
3
- @use "@pareto-engineering/bem";
4
- @use "@pareto-engineering/styles/src/mixins";
5
- @use "@pareto-engineering/styles/src/globals" as *;
6
-
7
- .#{bem.$base}.lexical-preview {
8
- > .content-editable {
9
- color: var(--y);
10
- overflow: auto;
11
-
12
- li:has(ol, ul) {
13
- list-style-type: none;
14
- }
15
-
16
- p,
17
- span,
18
- strong,
19
- em,
20
- li {
21
- &.underlined {
22
- text-decoration: underline;
23
-
24
- &.strikethrough {
25
- text-decoration: underline line-through;
26
- }
27
- }
28
-
29
- &.strikethrough {
30
- text-decoration: line-through;
31
- }
32
-
33
- &.italic {
34
- font-style: italic;
35
- }
36
- }
37
-
38
- :first-child {
39
- margin-top: 0;
40
- }
41
-
42
- &::placeholder {
43
- color: var(--metadata);
44
- }
45
- }
46
- }
@@ -1,84 +0,0 @@
1
- /* @pareto-engineering/generator-front 1.0.12 */
2
- /* stylelint-disable max-nesting-depth -- required */
3
-
4
- @use "@pareto-engineering/bem";
5
- @use "@pareto-engineering/styles/src/mixins";
6
- @use "@pareto-engineering/styles/src/globals" as *;
7
-
8
- .#{bem.$base}.expandable-lexical-preview {
9
- display: flex;
10
- flex-direction: column;
11
- flex-wrap: wrap;
12
- gap: var(--gap);
13
- width: 100%;
14
-
15
- &.collapsed {
16
- flex-direction: row;
17
- }
18
-
19
- > .title {
20
- margin: 0;
21
- }
22
-
23
-
24
- > .#{bem.$base}.button {
25
- align-items: center;
26
- border: 1px solid var(--outline-inputs);
27
- display: flex;
28
- }
29
-
30
- > .lexical-content {
31
- position: relative;
32
-
33
- > .content-editable {
34
- background: var(--background-inputs);
35
- border: 1px solid var(--outline-inputs);
36
- border-radius: var(--theme-default-border-radius);
37
- color: var(--y);
38
- overflow: auto;
39
- padding: var(--gap);
40
- resize: var(--resize);
41
-
42
- li:has(ol, ul) {
43
- list-style-type: none;
44
- }
45
-
46
- p,
47
- span,
48
- strong,
49
- em,
50
- li {
51
- &.underlined {
52
- text-decoration: underline;
53
-
54
- &.strikethrough {
55
- text-decoration: underline line-through;
56
- }
57
- }
58
-
59
- &.strikethrough {
60
- text-decoration: line-through;
61
- }
62
-
63
- &.italic {
64
- font-style: italic;
65
- }
66
- }
67
-
68
- :first-child {
69
- margin-top: 0;
70
- }
71
-
72
- &::placeholder {
73
- color: var(--metadata);
74
- }
75
- }
76
-
77
- > .#{bem.$base}.expand-button {
78
- border: 1px solid var(--outline-inputs);
79
- position: absolute;
80
- right: 1em;
81
- top: 1em;
82
- }
83
- }
84
- }
@@ -1,257 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var React = _react;
9
- var _lexical = require("lexical");
10
- var _list = require("@lexical/list");
11
- var _selection = require("@lexical/selection");
12
- var _link = require("@lexical/link");
13
- var _LexicalComposerContext = require("@lexical/react/LexicalComposerContext");
14
- var _utils = require("@lexical/utils");
15
- var _ = require("../../../..");
16
- var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
17
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
- 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); }
19
- 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; }
20
- /* eslint-disable import/no-extraneous-dependencies -- required here */
21
-
22
- const baseClassName = _exports.default.base;
23
- const componentClassName = 'toolbar';
24
- const getSelectedNode = selection => {
25
- const {
26
- anchor,
27
- focus
28
- } = selection;
29
- const anchorNode = selection.anchor.getNode();
30
- const focusNode = selection.focus.getNode();
31
- if (anchorNode === focusNode) {
32
- return anchorNode;
33
- }
34
- const isBackward = selection.isBackward();
35
- if (isBackward) {
36
- return (0, _selection.$isAtNodeEnd)(focus) ? anchorNode : focusNode;
37
- }
38
- return (0, _selection.$isAtNodeEnd)(anchor) ? focusNode : anchorNode;
39
- };
40
- const defaultColor = 'var(--paragraph)';
41
- const colorOptions = ['red', 'blue', 'green', 'yellow', 'orange', 'purple', 'pink', 'brown'];
42
- const Toolbar = () => {
43
- const [editor] = (0, _LexicalComposerContext.useLexicalComposerContext)();
44
- const [isBold, setIsBold] = (0, _react.useState)(false);
45
- const [isItalic, setIsItalic] = (0, _react.useState)(false);
46
- const [isStrikethrough, setIsStrikethrough] = (0, _react.useState)(false);
47
- const [blockType, setBlockType] = (0, _react.useState)('paragraph');
48
- const [isLink, setIsLink] = (0, _react.useState)(false);
49
- const [isUnderline, setIsUnderline] = (0, _react.useState)(false);
50
- const [color, setColor] = (0, _react.useState)(defaultColor);
51
- const colorMenuRef = (0, _react.useRef)(false);
52
- const formatBulletList = () => {
53
- if (blockType !== 'ul') {
54
- editor.dispatchCommand(_list.INSERT_UNORDERED_LIST_COMMAND);
55
- } else {
56
- editor.dispatchCommand(_list.REMOVE_LIST_COMMAND);
57
- }
58
- };
59
- const formatNumberedList = () => {
60
- if (blockType !== 'ol') {
61
- editor.dispatchCommand(_list.INSERT_ORDERED_LIST_COMMAND);
62
- } else {
63
- editor.dispatchCommand(_list.REMOVE_LIST_COMMAND);
64
- }
65
- };
66
- const formatLink = (0, _react.useCallback)(() => {
67
- if (!isLink) {
68
- // eslint-disable-next-line no-alert
69
- const path = prompt('Enter the full URL. Ex: https://www.example.com');
70
- editor.dispatchCommand(_link.TOGGLE_LINK_COMMAND, path);
71
- } else {
72
- editor.dispatchCommand(_link.TOGGLE_LINK_COMMAND, null);
73
- }
74
- }, [editor, isLink]);
75
- const updateToolbar = (0, _react.useCallback)(() => {
76
- const selection = (0, _lexical.$getSelection)();
77
-
78
- // Check list selection
79
- if ((0, _lexical.$isRangeSelection)(selection)) {
80
- const anchorNode = selection.anchor.getNode();
81
- const element = anchorNode.getKey() === 'root' ? anchorNode : anchorNode.getTopLevelElementOrThrow();
82
- if ((0, _list.$isListNode)(element)) {
83
- const parentList = (0, _utils.$getNearestNodeOfType)(anchorNode, _list.ListNode);
84
- const type = parentList ? parentList.getTag() : element.getTag();
85
- setBlockType(type);
86
- } else {
87
- setBlockType(element);
88
- }
89
-
90
- // Check nodes for color
91
- const nodes = selection.getNodes().filter(node => node.getType() === 'text');
92
- nodes.forEach(node => {
93
- const style = node.getStyle();
94
- const colorProperty = style.match(/color: ([^;]+)/);
95
- if (colorProperty) {
96
- setColor(colorProperty[1]);
97
- return;
98
- }
99
- setColor(false);
100
- });
101
-
102
- // Check selection text styles
103
- setIsBold(selection.hasFormat('bold'));
104
- setIsItalic(selection.hasFormat('italic'));
105
- setIsStrikethrough(selection.hasFormat('strikethrough'));
106
- setIsUnderline(selection.hasFormat('underline'));
107
- setIsLink(selection.hasFormat('link'));
108
-
109
- // Check links
110
- const node = getSelectedNode(selection);
111
- const parent = node.getParent();
112
- if ((0, _link.$isLinkNode)(parent) || (0, _link.$isLinkNode)(node)) {
113
- setIsLink(true);
114
- } else {
115
- setIsLink(false);
116
- }
117
- }
118
- }, [editor]);
119
- const UPDATE_COLOR_COMMAND = (0, _lexical.createCommand)();
120
- editor.registerCommand(UPDATE_COLOR_COMMAND, payload => {
121
- const selection = (0, _lexical.$getSelection)();
122
- const nodes = selection?.extract().filter(node => node.getType() === 'text');
123
- nodes?.forEach(node => {
124
- const style = node.getStyle();
125
- const colorProperty = style?.match(/color: ([^;]+)/);
126
- if (colorProperty && color !== payload) {
127
- node.setStyle(style.replace(colorProperty[0], `color: ${payload}`));
128
- } else if (colorProperty) {
129
- node.setStyle(`color: ${defaultColor}`);
130
- } else {
131
- node.setStyle(`color: ${payload}`);
132
- }
133
- });
134
- }, _lexical.COMMAND_PRIORITY_NORMAL);
135
- (0, _react.useEffect)(() => (0, _utils.mergeRegister)(editor.registerUpdateListener(_ref => {
136
- let {
137
- editorState
138
- } = _ref;
139
- editorState.read(() => {
140
- updateToolbar();
141
- });
142
- })), [updateToolbar, editor]);
143
- const dispatchUpdateColor = (0, _react.useCallback)((e, payload) => {
144
- e.stopPropagation();
145
- editor.dispatchCommand(UPDATE_COLOR_COMMAND, payload);
146
- }, [editor]);
147
- return /*#__PURE__*/React.createElement("div", {
148
- className: `${baseClassName} ${componentClassName}`
149
- }, /*#__PURE__*/React.createElement("div", {
150
- className: "group"
151
- }, /*#__PURE__*/React.createElement("button", {
152
- type: "button",
153
- className: isBold ? 'active' : undefined,
154
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_TEXT_COMMAND, 'bold')
155
- }, /*#__PURE__*/React.createElement("span", {
156
- className: "icon"
157
- }, "|")), /*#__PURE__*/React.createElement("button", {
158
- type: "button",
159
- className: isItalic ? 'active' : undefined,
160
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_TEXT_COMMAND, 'italic')
161
- }, /*#__PURE__*/React.createElement("span", {
162
- className: "icon"
163
- }, "}")), /*#__PURE__*/React.createElement("button", {
164
- type: "button",
165
- className: isUnderline ? 'active' : undefined,
166
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_TEXT_COMMAND, 'underline')
167
- }, /*#__PURE__*/React.createElement("span", {
168
- className: "icon"
169
- }, "~")), /*#__PURE__*/React.createElement("button", {
170
- type: "button",
171
- className: isStrikethrough ? 'active' : undefined,
172
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_TEXT_COMMAND, 'strikethrough')
173
- }, /*#__PURE__*/React.createElement("span", {
174
- className: "icon"
175
- }, "?")), /*#__PURE__*/React.createElement("button", {
176
- type: "button",
177
- className: color && color !== defaultColor ? 'active color-menu-button' : 'color-menu-button',
178
- onClick: () => editor.dispatchCommand(UPDATE_COLOR_COMMAND, color !== defaultColor ? defaultColor : color),
179
- ref: colorMenuRef,
180
- style: {
181
- position: 'relative'
182
- }
183
- }, /*#__PURE__*/React.createElement("span", {
184
- className: "icon",
185
- style: {
186
- color
187
- }
188
- }, "Q"), /*#__PURE__*/React.createElement(_.Popover, {
189
- parentRef: colorMenuRef
190
- }, /*#__PURE__*/React.createElement("div", {
191
- className: "color-menu"
192
- }, colorOptions.map(option => /*#__PURE__*/React.createElement("span", {
193
- role: "button",
194
- className: "icon color-option",
195
- style: {
196
- color: option
197
- },
198
- onClick: e => dispatchUpdateColor(e, option),
199
- onKeyDown: e => dispatchUpdateColor(e, option),
200
- tabIndex: 0,
201
- key: option
202
- }, "o"))))), /*#__PURE__*/React.createElement("button", {
203
- type: "button",
204
- className: isLink ? 'active' : undefined,
205
- onClick: () => formatLink()
206
- }, /*#__PURE__*/React.createElement("span", {
207
- className: "icon"
208
- }, "]")), /*#__PURE__*/React.createElement("button", {
209
- type: "button",
210
- className: blockType === 'ul' ? 'active' : undefined,
211
- onClick: () => formatBulletList()
212
- }, /*#__PURE__*/React.createElement("span", {
213
- className: "icon"
214
- }, ".")), /*#__PURE__*/React.createElement("button", {
215
- type: "button",
216
- className: blockType === 'ol' ? 'active' : undefined,
217
- onClick: () => formatNumberedList()
218
- }, /*#__PURE__*/React.createElement("span", {
219
- className: "icon"
220
- }, "-"))), /*#__PURE__*/React.createElement("div", {
221
- className: "group"
222
- }, /*#__PURE__*/React.createElement("button", {
223
- type: "button",
224
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_ELEMENT_COMMAND, 'left')
225
- }, /*#__PURE__*/React.createElement("span", {
226
- className: "icon"
227
- }, "^")), /*#__PURE__*/React.createElement("button", {
228
- type: "button",
229
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_ELEMENT_COMMAND, 'center')
230
- }, /*#__PURE__*/React.createElement("span", {
231
- className: "icon"
232
- }, "_")), /*#__PURE__*/React.createElement("button", {
233
- type: "button",
234
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_ELEMENT_COMMAND, 'right')
235
- }, /*#__PURE__*/React.createElement("span", {
236
- className: "icon"
237
- }, "`")), /*#__PURE__*/React.createElement("button", {
238
- type: "button",
239
- onClick: () => editor.dispatchCommand(_lexical.FORMAT_ELEMENT_COMMAND, 'justify')
240
- }, /*#__PURE__*/React.createElement("span", {
241
- className: "icon"
242
- }, "{"))), /*#__PURE__*/React.createElement("div", {
243
- className: "group"
244
- }, /*#__PURE__*/React.createElement("button", {
245
- type: "button",
246
- onClick: () => editor.dispatchCommand(_lexical.UNDO_COMMAND)
247
- }, /*#__PURE__*/React.createElement("span", {
248
- className: "icon"
249
- }, "\\")), /*#__PURE__*/React.createElement("button", {
250
- type: "button",
251
- className: "flip",
252
- onClick: () => editor.dispatchCommand(_lexical.REDO_COMMAND)
253
- }, /*#__PURE__*/React.createElement("span", {
254
- className: "icon"
255
- }, "\\"))));
256
- };
257
- var _default = exports.default = Toolbar;
@@ -1,80 +0,0 @@
1
- /* @pareto-engineering/generator-front 1.0.12 */
2
- /* eslint-disable import/no-extraneous-dependencies -- required here */
3
- import * as React from 'react';
4
- import { LexicalComposer } from '@lexical/react/LexicalComposer';
5
- import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
6
- import { ContentEditable } from '@lexical/react/LexicalContentEditable';
7
- import { AutoLinkNode, LinkNode } from '@lexical/link';
8
- import { ListItemNode, ListNode } from '@lexical/list';
9
- import PropTypes from 'prop-types';
10
- import styleNames from '@pareto-engineering/bem/exports';
11
- import "./styles.scss";
12
-
13
- // Local Definitions
14
-
15
- const baseClassName = styleNames.base;
16
- const componentClassName = 'lexical-preview';
17
-
18
- /**
19
- * This is the component description.
20
- */
21
- const LexicalPreview = ({
22
- id,
23
- className: userClassName,
24
- style,
25
- nodes,
26
- color
27
- // ...otherProps
28
- }) => {
29
- const initialConfig = {
30
- nameSpace: id,
31
- editable: false,
32
- editorState: nodes,
33
- theme: {
34
- text: {
35
- italic: 'italic',
36
- strikethrough: 'strikethrough',
37
- underline: 'underlined'
38
- }
39
- },
40
- nodes: [AutoLinkNode, LinkNode, ListNode, ListItemNode]
41
- };
42
- return /*#__PURE__*/React.createElement(LexicalComposer, {
43
- initialConfig: initialConfig
44
- }, /*#__PURE__*/React.createElement("div", {
45
- id: id,
46
- className: [baseClassName, componentClassName, userClassName, `y-${color}`].filter(e => e).join(' '),
47
- style: style
48
- }, /*#__PURE__*/React.createElement(RichTextPlugin, {
49
- contentEditable: /*#__PURE__*/React.createElement(ContentEditable, {
50
- id: id,
51
- className: "content-editable"
52
- })
53
- })));
54
- };
55
- LexicalPreview.propTypes = {
56
- /**
57
- * The HTML id for this element
58
- */
59
- id: PropTypes.string,
60
- /**
61
- * The HTML class names for this element
62
- */
63
- className: PropTypes.string,
64
- /**
65
- * The React-written, css properties for this element.
66
- */
67
- style: PropTypes.objectOf(PropTypes.string),
68
- /**
69
- * Color of the text
70
- */
71
- color: PropTypes.string,
72
- /**
73
- * The nodes to render in the form of a json string
74
- */
75
- nodes: PropTypes.string
76
- };
77
- LexicalPreview.defaultProps = {
78
- color: 'paragraph'
79
- };
80
- export default LexicalPreview;
@@ -1,2 +0,0 @@
1
- /* @pareto-engineering/generator-front 1.0.12 */
2
- export { default as LexicalPreview } from "./LexicalPreview";
@@ -1,46 +0,0 @@
1
- /* @pareto-engineering/generator-front 1.0.12 */
2
-
3
- @use "@pareto-engineering/bem";
4
- @use "@pareto-engineering/styles/src/mixins";
5
- @use "@pareto-engineering/styles/src/globals" as *;
6
-
7
- .#{bem.$base}.lexical-preview {
8
- > .content-editable {
9
- color: var(--y);
10
- overflow: auto;
11
-
12
- li:has(ol, ul) {
13
- list-style-type: none;
14
- }
15
-
16
- p,
17
- span,
18
- strong,
19
- em,
20
- li {
21
- &.underlined {
22
- text-decoration: underline;
23
-
24
- &.strikethrough {
25
- text-decoration: underline line-through;
26
- }
27
- }
28
-
29
- &.strikethrough {
30
- text-decoration: line-through;
31
- }
32
-
33
- &.italic {
34
- font-style: italic;
35
- }
36
- }
37
-
38
- :first-child {
39
- margin-top: 0;
40
- }
41
-
42
- &::placeholder {
43
- color: var(--metadata);
44
- }
45
- }
46
- }