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

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 (167) 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/LexicalPreview/LexicalPreview.js +1 -1
  19. package/dist/cjs/a/LoadingCircle/LoadingCircle.js +1 -1
  20. package/dist/cjs/a/MetaCard/MetaCard.js +1 -1
  21. package/dist/cjs/a/People/People.js +1 -1
  22. package/dist/cjs/a/People/common/Person/Person.js +1 -1
  23. package/dist/cjs/a/People/styles.scss +1 -1
  24. package/dist/cjs/a/Popover/Popover.js +1 -1
  25. package/dist/cjs/a/ProgressBar/ProgressBar.js +1 -1
  26. package/dist/cjs/a/Quote/Quote.js +16 -6
  27. package/dist/cjs/a/Quote/styles.scss +16 -37
  28. package/dist/cjs/a/Removable/Removable.js +1 -1
  29. package/dist/cjs/a/SVG/SVG.js +1 -1
  30. package/dist/cjs/a/SVG/common/UseSVG/UseSVG.js +1 -1
  31. package/dist/cjs/a/SnapScroller/SnapScroller.js +1 -1
  32. package/dist/cjs/a/Spinner/Spinner.js +1 -1
  33. package/dist/cjs/a/TextSteps/TextSteps.js +1 -1
  34. package/dist/cjs/a/Timestamp/Timestamp.js +1 -1
  35. package/dist/cjs/a/Tip/Tip.js +1 -1
  36. package/dist/cjs/a/ToggleSwitch/ToggleSwitch.js +1 -1
  37. package/dist/cjs/a/Tooltip/Tooltip.js +71 -0
  38. package/dist/cjs/a/Tooltip/index.js +13 -0
  39. package/dist/cjs/a/Tooltip/styles.scss +53 -0
  40. package/dist/cjs/a/XMLEditor/XMLEditor.js +1 -1
  41. package/dist/cjs/a/index.js +8 -1
  42. package/dist/cjs/b/Button/Button.js +1 -1
  43. package/dist/cjs/b/Button/common/Group/Group.js +1 -1
  44. package/dist/cjs/b/Card/Card.js +1 -1
  45. package/dist/cjs/b/Card/common/Group/Group.js +1 -1
  46. package/dist/cjs/b/Card/common/Section/Section.js +1 -1
  47. package/dist/cjs/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +3 -3
  48. package/dist/cjs/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +3 -3
  49. package/dist/cjs/b/Logo/Logo.js +1 -1
  50. package/dist/cjs/b/Page/Context.js +1 -1
  51. package/dist/cjs/b/Page/Page.js +1 -1
  52. package/dist/cjs/b/Page/common/PageHelmet/PageHelmet.js +1 -1
  53. package/dist/cjs/b/Page/common/Section/Section.js +1 -1
  54. package/dist/cjs/b/SocialMediaButton/SocialMediaButton.js +1 -1
  55. package/dist/cjs/b/ThemeSelector/ThemeSelector.js +1 -1
  56. package/dist/cjs/b/Title/Title.js +1 -1
  57. package/dist/cjs/c/Modal/Modal.js +1 -1
  58. package/dist/cjs/c/Modal/common/ModalHeader/ModalHeader.js +1 -1
  59. package/dist/cjs/c/Shortener/Shortener.js +1 -1
  60. package/dist/cjs/c/SocialMediaShareButton/SocialMediaShareButton.js +1 -1
  61. package/dist/cjs/f/FormInput/FormInput.js +1 -1
  62. package/dist/cjs/f/common/Debugger/Debugger.js +1 -1
  63. package/dist/cjs/f/common/Description/Description.js +1 -1
  64. package/dist/cjs/f/common/Label/Label.js +1 -1
  65. package/dist/cjs/f/fields/Checkbox/Checkbox.js +1 -1
  66. package/dist/cjs/f/fields/ChoicesInput/ChoicesInput.js +1 -1
  67. package/dist/cjs/f/fields/ChoicesInput/common/Choice/Choice.js +1 -1
  68. package/dist/cjs/f/fields/EditorInput/EditorInput.js +20 -9
  69. package/dist/cjs/f/fields/EditorInput/common/BlockFormatDropDown/BlockFormatDropDown.js +256 -0
  70. package/dist/cjs/f/fields/EditorInput/common/BlockFormatDropDown/index.js +13 -0
  71. package/dist/cjs/f/fields/EditorInput/common/BlockFormatDropDown/styles.scss +55 -0
  72. package/dist/cjs/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +94 -0
  73. package/dist/cjs/f/fields/EditorInput/common/ColorPicker/index.js +13 -0
  74. package/dist/cjs/f/fields/EditorInput/common/ColorPicker/styles.scss +36 -0
  75. package/dist/cjs/f/fields/EditorInput/common/FontSizeDropDown/FontSizeDropDown.js +94 -0
  76. package/dist/cjs/f/fields/EditorInput/common/FontSizeDropDown/index.js +13 -0
  77. package/dist/cjs/f/fields/EditorInput/common/FontSizeDropDown/styles.scss +55 -0
  78. package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +295 -0
  79. package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/index.js +13 -0
  80. package/dist/cjs/f/fields/EditorInput/common/ToolbarPlugin/styles.scss +56 -0
  81. package/dist/cjs/f/fields/EditorInput/common/index.js +24 -3
  82. package/dist/cjs/f/fields/EditorInput/styles.scss +109 -25
  83. package/dist/cjs/f/fields/LinkInput/LinkInput.js +1 -1
  84. package/dist/cjs/f/fields/QueryChoices/QueryChoices.js +1 -1
  85. package/dist/cjs/f/fields/QueryCombobox/QueryCombobox.js +1 -1
  86. package/dist/cjs/f/fields/QueryCombobox/common/Combobox/Combobox.js +1 -1
  87. package/dist/cjs/f/fields/QueryCombobox/common/Menu/Menu.js +1 -1
  88. package/dist/cjs/f/fields/QueryCombobox/common/MultipleCombobox/MultipleCombobox.js +1 -1
  89. package/dist/cjs/f/fields/QuerySelect/QuerySelect.js +1 -1
  90. package/dist/cjs/f/fields/RatingsInput/RatingsInput.js +1 -1
  91. package/dist/cjs/f/fields/RatingsInput/common/Rating/Rating.js +1 -1
  92. package/dist/cjs/f/fields/SelectInput/SelectInput.js +1 -1
  93. package/dist/cjs/f/fields/SelectInput/common/Menu/Menu.js +1 -1
  94. package/dist/cjs/f/fields/SelectInput/common/Multiple/Multiple.js +1 -1
  95. package/dist/cjs/f/fields/SelectInput/common/Single/Single.js +1 -1
  96. package/dist/cjs/f/fields/TextInput/TextInput.js +1 -1
  97. package/dist/cjs/f/fields/TextareaInput/TextareaInput.js +1 -1
  98. package/dist/cjs/test/QueryLoader/QueryLoader.js +1 -1
  99. package/dist/cjs/test/QueryLoader/common/PreloadedTestData/PreloadedTestData.js +1 -1
  100. package/dist/cjs/utils/hooks/index.js +7 -0
  101. package/dist/cjs/utils/hooks/useOutsideClick.js +25 -0
  102. package/dist/cjs/utils/index.js +6 -0
  103. package/dist/es/a/People/styles.scss +1 -1
  104. package/dist/es/a/Quote/Quote.js +15 -5
  105. package/dist/es/a/Quote/styles.scss +16 -37
  106. package/dist/es/a/Tooltip/Tooltip.js +59 -0
  107. package/dist/es/a/Tooltip/index.js +2 -0
  108. package/dist/es/a/Tooltip/styles.scss +53 -0
  109. package/dist/es/a/index.js +2 -1
  110. package/dist/es/b/ExpandableLexicalPreview/ExpandableLexicalPreview.js +1 -1
  111. package/dist/es/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.js +1 -1
  112. package/dist/es/f/fields/EditorInput/EditorInput.js +20 -9
  113. package/dist/es/f/fields/EditorInput/common/BlockFormatDropDown/BlockFormatDropDown.js +246 -0
  114. package/dist/es/f/fields/EditorInput/common/BlockFormatDropDown/index.js +2 -0
  115. package/dist/es/f/fields/EditorInput/common/BlockFormatDropDown/styles.scss +55 -0
  116. package/dist/es/f/fields/EditorInput/common/ColorPicker/ColorPicker.js +83 -0
  117. package/dist/es/f/fields/EditorInput/common/ColorPicker/index.js +2 -0
  118. package/dist/es/f/fields/EditorInput/common/ColorPicker/styles.scss +36 -0
  119. package/dist/es/f/fields/EditorInput/common/FontSizeDropDown/FontSizeDropDown.js +81 -0
  120. package/dist/es/f/fields/EditorInput/common/FontSizeDropDown/index.js +2 -0
  121. package/dist/es/f/fields/EditorInput/common/FontSizeDropDown/styles.scss +55 -0
  122. package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.js +283 -0
  123. package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/index.js +2 -0
  124. package/dist/es/f/fields/EditorInput/common/ToolbarPlugin/styles.scss +56 -0
  125. package/dist/es/f/fields/EditorInput/common/index.js +5 -2
  126. package/dist/es/f/fields/EditorInput/styles.scss +109 -25
  127. package/dist/es/utils/hooks/index.js +2 -1
  128. package/dist/es/utils/hooks/useOutsideClick.js +19 -0
  129. package/dist/es/utils/index.js +1 -1
  130. package/package.json +13 -5
  131. package/src/stories/a/Quote.stories.jsx +30 -10
  132. package/src/stories/a/Tooltip.stories.jsx +80 -0
  133. package/src/stories/a/XMLEditor.stories.jsx +6 -1
  134. package/src/ui/a/People/styles.scss +1 -1
  135. package/src/ui/a/Quote/Quote.jsx +16 -9
  136. package/src/ui/a/Quote/styles.scss +16 -37
  137. package/src/ui/a/Tooltip/Tooltip.jsx +83 -0
  138. package/src/ui/a/Tooltip/index.js +2 -0
  139. package/src/ui/a/Tooltip/styles.scss +53 -0
  140. package/src/ui/a/index.js +1 -0
  141. package/src/ui/b/ExpandableLexicalPreview/ExpandableLexicalPreview.jsx +1 -1
  142. package/src/ui/b/ExpandableLexicalPreview/common/ExpandButton/ExpandButton.jsx +1 -1
  143. package/src/ui/f/fields/EditorInput/EditorInput.jsx +21 -4
  144. package/src/ui/f/fields/EditorInput/common/BlockFormatDropDown/BlockFormatDropDown.jsx +292 -0
  145. package/src/ui/f/fields/EditorInput/common/BlockFormatDropDown/index.js +2 -0
  146. package/src/ui/f/fields/EditorInput/common/BlockFormatDropDown/styles.scss +55 -0
  147. package/src/ui/f/fields/EditorInput/common/ColorPicker/ColorPicker.jsx +110 -0
  148. package/src/ui/f/fields/EditorInput/common/ColorPicker/index.js +2 -0
  149. package/src/ui/f/fields/EditorInput/common/ColorPicker/styles.scss +36 -0
  150. package/src/ui/f/fields/EditorInput/common/FontSizeDropDown/FontSizeDropDown.jsx +134 -0
  151. package/src/ui/f/fields/EditorInput/common/FontSizeDropDown/index.js +2 -0
  152. package/src/ui/f/fields/EditorInput/common/FontSizeDropDown/styles.scss +55 -0
  153. package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/ToolbarPlugin.jsx +431 -0
  154. package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/index.js +2 -0
  155. package/src/ui/f/fields/EditorInput/common/ToolbarPlugin/styles.scss +56 -0
  156. package/src/ui/f/fields/EditorInput/common/index.js +6 -0
  157. package/src/ui/f/fields/EditorInput/styles.scss +109 -25
  158. package/src/ui/utils/hooks/index.js +1 -0
  159. package/src/ui/utils/hooks/useOutsideClick.js +23 -0
  160. package/src/ui/utils/index.js +1 -1
  161. package/tests/__snapshots__/Storyshots.test.js.snap +746 -378
  162. package/tests/mockResizeObserver.js +9 -0
  163. package/tests/test-setup.js +3 -0
  164. package/dist/cjs/f/fields/EditorInput/common/Toolbar.js +0 -257
  165. package/dist/es/f/fields/EditorInput/common/Toolbar.js +0 -246
  166. package/src/ui/f/fields/EditorInput/common/Toolbar.jsx +0 -356
  167. package/src/ui/f/fields/EditorInput/common/index.jsx +0 -3
@@ -0,0 +1,256 @@
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 _richText = require("@lexical/rich-text");
11
+ var _selection = require("@lexical/selection");
12
+ var _list = require("@lexical/list");
13
+ var _code = require("@lexical/code");
14
+ var _propTypes = _interopRequireDefault(require("prop-types"));
15
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
16
+ require("./styles.scss");
17
+ var _a = require("../../../../../a");
18
+ var _utils = require("../../../../../utils");
19
+ var _ToolbarPlugin = require("../ToolbarPlugin/ToolbarPlugin");
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ 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); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
+ /* @pareto-engineering/generator-front 1.0.12 */
24
+
25
+ // Local Definitions
26
+
27
+ const baseClassName = _exports.default.base;
28
+ const componentClassName = 'block-format-drop-down';
29
+ const iconsMap = {
30
+ bullet: {
31
+ icon: '.',
32
+ className: 'icon'
33
+ },
34
+ check: {
35
+ icon: '4',
36
+ className: 'ai-icon'
37
+ },
38
+ code: {
39
+ icon: '6',
40
+ className: 'ai-icon'
41
+ },
42
+ h1: {
43
+ icon: '1',
44
+ className: 'ai-icon'
45
+ },
46
+ h2: {
47
+ icon: '2',
48
+ className: 'ai-icon'
49
+ },
50
+ h3: {
51
+ icon: '3',
52
+ className: 'ai-icon'
53
+ },
54
+ number: {
55
+ icon: '-',
56
+ className: 'icon'
57
+ },
58
+ paragraph: {
59
+ icon: 'N',
60
+ className: 'ai-icon'
61
+ },
62
+ quote: {
63
+ icon: '5',
64
+ className: 'ai-icon'
65
+ }
66
+ };
67
+ /**
68
+ * This is the component description.
69
+ */
70
+ const BlockFormatDropDown = _ref => {
71
+ let {
72
+ id,
73
+ className: userClassName,
74
+ style,
75
+ editor,
76
+ blockType
77
+ // ...otherProps
78
+ } = _ref;
79
+ const formatParagraph = () => {
80
+ editor.update(() => {
81
+ const selection = (0, _lexical.$getSelection)();
82
+ if ((0, _lexical.$isRangeSelection)(selection) || (0, _lexical.DEPRECATED_$isGridSelection)(selection)) {
83
+ (0, _selection.$setBlocksType)(selection, () => (0, _lexical.$createParagraphNode)());
84
+ }
85
+ });
86
+ };
87
+ const formatHeading = headingSize => {
88
+ if (blockType !== headingSize) {
89
+ editor.update(() => {
90
+ const selection = (0, _lexical.$getSelection)();
91
+ if ((0, _lexical.$isRangeSelection)(selection) || (0, _lexical.DEPRECATED_$isGridSelection)(selection)) {
92
+ (0, _selection.$setBlocksType)(selection, () => (0, _richText.$createHeadingNode)(headingSize));
93
+ }
94
+ });
95
+ }
96
+ };
97
+ const formatBulletList = () => {
98
+ if (blockType !== 'bullet') {
99
+ editor.dispatchCommand(_list.INSERT_UNORDERED_LIST_COMMAND, undefined);
100
+ } else {
101
+ editor.dispatchCommand(_list.REMOVE_LIST_COMMAND, undefined);
102
+ }
103
+ };
104
+ const formatCheckList = () => {
105
+ if (blockType !== 'check') {
106
+ editor.dispatchCommand(_list.INSERT_CHECK_LIST_COMMAND, undefined);
107
+ } else {
108
+ editor.dispatchCommand(_list.REMOVE_LIST_COMMAND, undefined);
109
+ }
110
+ };
111
+ const formatNumberedList = () => {
112
+ if (blockType !== 'number') {
113
+ editor.dispatchCommand(_list.INSERT_ORDERED_LIST_COMMAND, undefined);
114
+ } else {
115
+ editor.dispatchCommand(_list.REMOVE_LIST_COMMAND, undefined);
116
+ }
117
+ };
118
+ const formatQuote = () => {
119
+ if (blockType !== 'quote') {
120
+ editor.update(() => {
121
+ const selection = (0, _lexical.$getSelection)();
122
+ if ((0, _lexical.$isRangeSelection)(selection) || (0, _lexical.DEPRECATED_$isGridSelection)(selection)) {
123
+ (0, _selection.$setBlocksType)(selection, () => (0, _richText.$createQuoteNode)());
124
+ }
125
+ });
126
+ }
127
+ };
128
+ const formatCode = () => {
129
+ if (blockType !== 'code') {
130
+ editor.update(() => {
131
+ let selection = (0, _lexical.$getSelection)();
132
+ if ((0, _lexical.$isRangeSelection)(selection) || (0, _lexical.DEPRECATED_$isGridSelection)(selection)) {
133
+ if (selection.isCollapsed()) {
134
+ (0, _selection.$setBlocksType)(selection, () => (0, _code.$createCodeNode)());
135
+ } else {
136
+ const textContent = selection.getTextContent();
137
+ const codeNode = (0, _code.$createCodeNode)();
138
+ selection.insertNodes([codeNode]);
139
+ selection = (0, _lexical.$getSelection)();
140
+ if ((0, _lexical.$isRangeSelection)(selection)) selection.insertRawText(textContent);
141
+ }
142
+ }
143
+ });
144
+ }
145
+ };
146
+ const parentRef = (0, _react.useRef)(null);
147
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
148
+ (0, _utils.useOutsideClick)(parentRef, () => setIsOpen(false));
149
+ return /*#__PURE__*/React.createElement("button", {
150
+ id: id,
151
+ className: [baseClassName, componentClassName, userClassName, 'group'].filter(e => e).join(' '),
152
+ style: style,
153
+ ref: parentRef,
154
+ type: "button",
155
+ onClick: () => setIsOpen(!isOpen)
156
+ // {...otherProps}
157
+ }, /*#__PURE__*/React.createElement("span", {
158
+ className: iconsMap[blockType].className
159
+ }, iconsMap[blockType].icon), /*#__PURE__*/React.createElement("span", null, _ToolbarPlugin.blockTypeToBlockName[blockType]), /*#__PURE__*/React.createElement("span", {
160
+ className: "icon"
161
+ }, "V"), isOpen && /*#__PURE__*/React.createElement(_a.Popover, {
162
+ parentRef: parentRef,
163
+ isOpen: isOpen,
164
+ color: "background-far"
165
+ }, /*#__PURE__*/React.createElement("button", {
166
+ className: `item ${blockType === 'paragraph' ? 'active' : ''}`,
167
+ onClick: formatParagraph,
168
+ type: "button"
169
+ }, /*#__PURE__*/React.createElement("span", {
170
+ className: "ai-icon"
171
+ }, "N"), /*#__PURE__*/React.createElement("span", {
172
+ className: "text"
173
+ }, "Normal")), /*#__PURE__*/React.createElement("button", {
174
+ className: `item ${blockType === 'h1' ? 'active' : ''}`,
175
+ onClick: () => formatHeading('h1'),
176
+ type: "button"
177
+ }, /*#__PURE__*/React.createElement("span", {
178
+ className: "ai-icon"
179
+ }, "1"), /*#__PURE__*/React.createElement("span", {
180
+ className: "text"
181
+ }, "Heading 1")), /*#__PURE__*/React.createElement("button", {
182
+ className: `item ${blockType === 'h2' ? 'active' : ''}`,
183
+ onClick: () => formatHeading('h2'),
184
+ type: "button"
185
+ }, /*#__PURE__*/React.createElement("span", {
186
+ className: "ai-icon"
187
+ }, "2"), /*#__PURE__*/React.createElement("span", {
188
+ className: "text"
189
+ }, "Heading 2")), /*#__PURE__*/React.createElement("button", {
190
+ className: `item ${blockType === 'h3' ? 'active' : ''}`,
191
+ onClick: () => formatHeading('h3'),
192
+ type: "button"
193
+ }, /*#__PURE__*/React.createElement("span", {
194
+ className: "ai-icon"
195
+ }, "3"), /*#__PURE__*/React.createElement("span", {
196
+ className: "text"
197
+ }, "Heading 3")), /*#__PURE__*/React.createElement("button", {
198
+ className: `item ${blockType === 'bullet' ? 'active' : ''}`,
199
+ onClick: formatBulletList,
200
+ type: "button"
201
+ }, /*#__PURE__*/React.createElement("span", {
202
+ className: "icon"
203
+ }, "."), /*#__PURE__*/React.createElement("span", {
204
+ className: "text"
205
+ }, "Bullet List")), /*#__PURE__*/React.createElement("button", {
206
+ className: `item ${blockType === 'number' ? 'active' : ''}`,
207
+ onClick: formatNumberedList,
208
+ type: "button"
209
+ }, /*#__PURE__*/React.createElement("span", {
210
+ className: "icon"
211
+ }, "-"), /*#__PURE__*/React.createElement("span", {
212
+ className: "text"
213
+ }, "Numbered List")), /*#__PURE__*/React.createElement("button", {
214
+ className: `item ${blockType === 'check' ? 'active' : ''}`,
215
+ onClick: formatCheckList,
216
+ type: "button"
217
+ }, /*#__PURE__*/React.createElement("span", {
218
+ className: "ai-icon"
219
+ }, "4"), /*#__PURE__*/React.createElement("span", {
220
+ className: "text"
221
+ }, "Check List")), /*#__PURE__*/React.createElement("button", {
222
+ className: `item ${blockType === 'quote' ? 'active' : ''}`,
223
+ onClick: formatQuote,
224
+ type: "button"
225
+ }, /*#__PURE__*/React.createElement("span", {
226
+ className: "ai-icon"
227
+ }, "5"), /*#__PURE__*/React.createElement("span", {
228
+ className: "text"
229
+ }, "Quote")), /*#__PURE__*/React.createElement("button", {
230
+ className: `item ${blockType === 'code' ? 'active' : ''}`,
231
+ onClick: formatCode,
232
+ type: "button"
233
+ }, /*#__PURE__*/React.createElement("span", {
234
+ className: "ai-icon"
235
+ }, "6"), /*#__PURE__*/React.createElement("span", {
236
+ className: "text"
237
+ }, "Code Block"))));
238
+ };
239
+ BlockFormatDropDown.propTypes = {
240
+ /**
241
+ * The HTML id for this element
242
+ */
243
+ id: _propTypes.default.string,
244
+ /**
245
+ * The HTML class names for this element
246
+ */
247
+ className: _propTypes.default.string,
248
+ /**
249
+ * The React-written, css properties for this element.
250
+ */
251
+ style: _propTypes.default.objectOf(_propTypes.default.string)
252
+ };
253
+ BlockFormatDropDown.defaultProps = {
254
+ // someProp:false
255
+ };
256
+ var _default = exports.default = BlockFormatDropDown;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "BlockFormatDropDown", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _BlockFormatDropDown.default;
10
+ }
11
+ });
12
+ var _BlockFormatDropDown = _interopRequireDefault(require("./BlockFormatDropDown"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,55 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ $default-width: 15em;
6
+
7
+ .#{bem.$base}.block-format-drop-down {
8
+ align-items: center;
9
+ background-color: var(--x);
10
+ border: 0;
11
+ color: var(--on-background-inputs);
12
+ cursor: pointer;
13
+ display: flex;
14
+ gap: calc(var(--gap) / 2);
15
+ margin-inline: calc(var(--theme-default-padding) / 4);
16
+ padding: calc(var(--theme-default-padding) / 2);
17
+ position: relative;
18
+
19
+ &:hover {
20
+ background: var(--hard-x);
21
+ border-radius: calc(var(--theme-default-border-radius) / 2);
22
+ }
23
+
24
+ > .#{bem.$base}.popover {
25
+ background-color: var(--background-far);
26
+ border: 1px solid var(--hard-background-cards);
27
+ border-radius: calc(var(--theme-default-border-radius) / 2);
28
+ color: var(--heading);
29
+ display: flex;
30
+ flex-direction: column;
31
+ padding: calc(var(--theme-default-padding) / 2);
32
+ width: $default-width;
33
+
34
+ > .item {
35
+ align-items: center;
36
+ background-color: var(--x);
37
+ border: 0;
38
+ border-radius: calc(var(--theme-default-border-radius) / 2);
39
+ color: var(--paragraph);
40
+ cursor: pointer;
41
+ display: flex;
42
+ gap: calc(var(--gap) / 2);
43
+ padding: calc(var(--theme-default-padding) / 2);
44
+ transition: all .2s;
45
+
46
+ &:hover {
47
+ background-color: var(--hard-x);
48
+ }
49
+
50
+ &.active {
51
+ background-color: var(--hard-ui-main);
52
+ }
53
+ }
54
+ }
55
+ }
@@ -0,0 +1,94 @@
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 _reactColorPalette = require("react-color-palette");
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
12
+ require("./styles.scss");
13
+ var _a = require("../../../../../a");
14
+ var _utils = require("../../../../../utils");
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ 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); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
+ /* @pareto-engineering/generator-front 1.0.12 */
19
+
20
+ // Local Definitions
21
+
22
+ const baseClassName = _exports.default.base;
23
+ const componentClassName = 'color-picker';
24
+
25
+ /**
26
+ * This is the component description.
27
+ */
28
+ const ColorPicker = _ref => {
29
+ let {
30
+ id,
31
+ className: userClassName,
32
+ style,
33
+ icon,
34
+ color,
35
+ onChange
36
+ // ...otherProps
37
+ } = _ref;
38
+ const [colorValue, setColor] = (0, _reactColorPalette.useColor)(color);
39
+ const parentRef = (0, _react.useRef)(null);
40
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
41
+ (0, _utils.useOutsideClick)(parentRef, () => setIsOpen(false));
42
+ (0, _react.useEffect)(() => {
43
+ const {
44
+ hex
45
+ } = colorValue;
46
+ if (hex) {
47
+ onChange(hex);
48
+ }
49
+ }, [colorValue]);
50
+ return (
51
+ /*#__PURE__*/
52
+ // eslint-disable-next-line jsx-a11y/control-has-associated-label
53
+ React.createElement("div", {
54
+ id: id,
55
+ className: [baseClassName, componentClassName, userClassName].filter(e => e).join(' '),
56
+ style: style,
57
+ ref: parentRef
58
+ // {...otherProps}
59
+ }, /*#__PURE__*/React.createElement("button", {
60
+ type: "button",
61
+ onClick: () => setIsOpen(!isOpen)
62
+ }, /*#__PURE__*/React.createElement("span", {
63
+ className: "icon"
64
+ }, icon), /*#__PURE__*/React.createElement("span", {
65
+ className: "icon"
66
+ }, "V")), /*#__PURE__*/React.createElement(_a.Popover, {
67
+ parentRef: parentRef,
68
+ isOpen: isOpen,
69
+ color: "background-far"
70
+ }, /*#__PURE__*/React.createElement(_reactColorPalette.ColorPicker, {
71
+ color: colorValue,
72
+ onChange: setColor,
73
+ hideInput: true
74
+ })))
75
+ );
76
+ };
77
+ ColorPicker.propTypes = {
78
+ /**
79
+ * The HTML id for this element
80
+ */
81
+ id: _propTypes.default.string,
82
+ /**
83
+ * The HTML class names for this element
84
+ */
85
+ className: _propTypes.default.string,
86
+ /**
87
+ * The React-written, css properties for this element.
88
+ */
89
+ style: _propTypes.default.objectOf(_propTypes.default.string)
90
+ };
91
+ ColorPicker.defaultProps = {
92
+ // someProp:false
93
+ };
94
+ var _default = exports.default = ColorPicker;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ColorPicker", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _ColorPicker.default;
10
+ }
11
+ });
12
+ var _ColorPicker = _interopRequireDefault(require("./ColorPicker"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,36 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+ @use "react-color-palette/css";
5
+
6
+ $default-width: 20rem;
7
+
8
+ .#{bem.$base}.color-picker {
9
+ cursor: pointer;
10
+ position: relative;
11
+
12
+ > button {
13
+ align-items: center;
14
+ background-color: var(--x);
15
+ border: 0;
16
+ color: var(--on-background-inputs);
17
+ display: flex;
18
+ gap: calc(var(--gap) / 2);
19
+ padding: calc(var(--theme-default-padding) / 2);
20
+
21
+ &:hover {
22
+ background: var(--hard-x);
23
+ border-radius: calc(var(--theme-default-border-radius) / 2);
24
+ }
25
+ }
26
+
27
+
28
+ > .#{bem.$base}.popover {
29
+ background-color: var(--background-far);
30
+ border: 1px solid var(--hard-background-cards);
31
+ border-radius: calc(var(--theme-default-border-radius) / 2);
32
+ color: var(--heading);
33
+ padding: calc(var(--theme-default-padding) / 2);
34
+ width: $default-width;
35
+ }
36
+ }
@@ -0,0 +1,94 @@
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 _selection = require("@lexical/selection");
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+ var _exports = _interopRequireDefault(require("@pareto-engineering/bem/exports"));
13
+ require("./styles.scss");
14
+ var _a = require("../../../../../a");
15
+ var _utils = require("../../../../../utils");
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 && {}.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
+
21
+ // Local Definitions
22
+
23
+ const baseClassName = _exports.default.base;
24
+ const componentClassName = 'font-size-drop-down';
25
+ const FONT_SIZE_OPTIONS = [['10px', '10px'], ['11px', '11px'], ['12px', '12px'], ['13px', '13px'], ['14px', '14px'], ['15px', '15px'], ['16px', '16px'], ['17px', '17px'], ['18px', '18px'], ['19px', '19px'], ['20px', '20px']];
26
+
27
+ /**
28
+ * This is the component description.
29
+ */
30
+ const FontSizeDropDown = _ref => {
31
+ let {
32
+ id,
33
+ className: userClassName,
34
+ style,
35
+ editor,
36
+ value
37
+ // ...otherProps
38
+ } = _ref;
39
+ const parentRef = (0, _react.useRef)(null);
40
+ const [isOpen, setIsOpen] = (0, _react.useState)(false);
41
+ (0, _utils.useOutsideClick)(parentRef, () => setIsOpen(false));
42
+ const handleClick = (0, _react.useCallback)(option => {
43
+ editor.update(() => {
44
+ const selection = (0, _lexical.$getSelection)();
45
+ if ((0, _lexical.$isRangeSelection)(selection)) {
46
+ (0, _selection.$patchStyleText)(selection, {
47
+ 'font-size': option
48
+ });
49
+ }
50
+ });
51
+ }, [editor]);
52
+ return /*#__PURE__*/React.createElement("button", {
53
+ id: id,
54
+ className: [baseClassName, componentClassName, userClassName, 'group'].filter(e => e).join(' '),
55
+ style: style,
56
+ ref: parentRef,
57
+ type: "button",
58
+ onClick: () => setIsOpen(!isOpen)
59
+ // {...otherProps}
60
+ }, /*#__PURE__*/React.createElement("span", null, value), /*#__PURE__*/React.createElement("span", {
61
+ className: "icon"
62
+ }, "V"), isOpen && /*#__PURE__*/React.createElement(_a.Popover, {
63
+ parentRef: parentRef,
64
+ isOpen: isOpen,
65
+ color: "background-far"
66
+ }, FONT_SIZE_OPTIONS.map(_ref2 => {
67
+ let [option, text] = _ref2;
68
+ return /*#__PURE__*/React.createElement("button", {
69
+ className: `item ${value === option ? 'active' : ''}`,
70
+ onClick: () => handleClick(option),
71
+ type: "button"
72
+ }, /*#__PURE__*/React.createElement("span", {
73
+ className: "text"
74
+ }, text));
75
+ })));
76
+ };
77
+ FontSizeDropDown.propTypes = {
78
+ /**
79
+ * The HTML id for this element
80
+ */
81
+ id: _propTypes.default.string,
82
+ /**
83
+ * The HTML class names for this element
84
+ */
85
+ className: _propTypes.default.string,
86
+ /**
87
+ * The React-written, css properties for this element.
88
+ */
89
+ style: _propTypes.default.objectOf(_propTypes.default.string)
90
+ };
91
+ FontSizeDropDown.defaultProps = {
92
+ // someProp:false
93
+ };
94
+ var _default = exports.default = FontSizeDropDown;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "FontSizeDropDown", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _FontSizeDropDown.default;
10
+ }
11
+ });
12
+ var _FontSizeDropDown = _interopRequireDefault(require("./FontSizeDropDown"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -0,0 +1,55 @@
1
+ /* @pareto-engineering/generator-front 1.0.12 */
2
+
3
+ @use "@pareto-engineering/bem";
4
+
5
+ $default-width: 4.5rem;
6
+
7
+ .#{bem.$base}.font-size-drop-down {
8
+ align-items: center;
9
+ background-color: var(--x);
10
+ border: 0;
11
+ color: var(--on-background-inputs);
12
+ cursor: pointer;
13
+ display: flex;
14
+ gap: calc(var(--gap) / 2);
15
+ margin-inline: calc(var(--theme-default-padding) / 4);
16
+ padding: calc(var(--theme-default-padding) / 2);
17
+ position: relative;
18
+
19
+ &:hover {
20
+ background: var(--hard-x);
21
+ border-radius: calc(var(--theme-default-border-radius) / 2);
22
+ }
23
+
24
+ > .#{bem.$base}.popover {
25
+ background-color: var(--background-far);
26
+ border: 1px solid var(--hard-background-cards);
27
+ border-radius: calc(var(--theme-default-border-radius) / 2);
28
+ color: var(--heading);
29
+ display: flex;
30
+ flex-direction: column;
31
+ padding: calc(var(--theme-default-padding) / 2);
32
+ width: $default-width;
33
+
34
+ > .item {
35
+ align-items: center;
36
+ background-color: var(--x);
37
+ border: 0;
38
+ border-radius: calc(var(--theme-default-border-radius) / 2);
39
+ color: var(--paragraph);
40
+ cursor: pointer;
41
+ display: flex;
42
+ gap: calc(var(--gap) / 2);
43
+ padding: calc(var(--theme-default-padding) / 2);
44
+ transition: all .2s;
45
+
46
+ &:hover {
47
+ background-color: var(--hard-x);
48
+ }
49
+
50
+ &.active {
51
+ background-color: var(--hard-ui-main);
52
+ }
53
+ }
54
+ }
55
+ }