@bigbinary/neeto-molecules 3.16.57 → 3.16.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DocumentEditor.js +130 -9
- package/dist/DocumentEditor.js.map +1 -1
- package/dist/Onboarding.js +19 -8
- package/dist/Onboarding.js.map +1 -1
- package/dist/cjs/DocumentEditor.js +128 -7
- package/dist/cjs/DocumentEditor.js.map +1 -1
- package/dist/cjs/Onboarding.js +18 -7
- package/dist/cjs/Onboarding.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +4 -1
- package/types/DocumentEditor.d.ts +1 -0
- package/types/Onboarding.d.ts +3 -0
package/dist/DocumentEditor.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import
|
|
2
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
+
import { useCallback, memo, useRef, useState, useMemo } from 'react';
|
|
3
4
|
import classnames from 'classnames';
|
|
5
|
+
import { useFormikContext } from 'formik';
|
|
4
6
|
import { isPresent, noop } from '@bigbinary/neeto-cist';
|
|
5
7
|
import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
|
|
8
|
+
import MenuHorizontal from '@bigbinary/neeto-icons/MenuHorizontal';
|
|
9
|
+
import Modal from '@bigbinary/neetoui/Modal';
|
|
6
10
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
11
|
+
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
7
12
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
8
|
-
import { mergeRight } from 'ramda';
|
|
13
|
+
import { isEmpty, mergeRight } from 'ramda';
|
|
9
14
|
import { useTranslation } from 'react-i18next';
|
|
10
15
|
import { n } from './inject-css-DmrvuTKK.js';
|
|
11
|
-
import { useFormikContext } from 'formik';
|
|
12
16
|
import useHotkeys from '@bigbinary/neeto-hotkeys';
|
|
17
|
+
import ImageUploader from '@bigbinary/neeto-image-uploader-frontend/ImageUploader';
|
|
18
|
+
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
13
19
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
20
|
+
import { t } from 'i18next';
|
|
21
|
+
import Image from '@bigbinary/neeto-icons/Image';
|
|
14
22
|
|
|
15
23
|
var EDITOR_ADDONS = ["highlight", "emoji", "video-upload", "code-block", "block-quote", "image-upload", "image-upload-unsplash", "divider", "video-embed", "undo", "redo", "table"];
|
|
16
24
|
var DEFAULT_EDITOR_PROPS = {
|
|
@@ -19,8 +27,16 @@ var DEFAULT_EDITOR_PROPS = {
|
|
|
19
27
|
addons: [],
|
|
20
28
|
size: "medium"
|
|
21
29
|
};
|
|
30
|
+
var IMAGE_UPLOAD_CONFIG = {
|
|
31
|
+
maxImageSize: 1,
|
|
32
|
+
allowedImageTypes: {
|
|
33
|
+
"image/jpg": [".jpg", ".jpeg"],
|
|
34
|
+
"image/png": [".png"],
|
|
35
|
+
"image/svg": [".svg"]
|
|
36
|
+
}
|
|
37
|
+
};
|
|
22
38
|
|
|
23
|
-
var css = ".neeto-molecules-document__wrapper{height:100%}@media screen and (max-width:768px){.neeto-molecules-document__wrapper{width:100%}}.neeto-molecules-document__wrapper .neeto-molecules-document__container{margin:0 auto;max-width:48rem!important;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document-editor__menubar{position:sticky;top:0;width:100%;z-index:20}.neeto-molecules-document__wrapper .neeto-molecules-document__title{margin:1.5rem 0 0;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input{padding:0!important}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{color:rgb(var(--neeto-ui-black));font-size:2.625rem;font-weight:700;line-height:3rem;max-height:none;resize:none}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::-moz-placeholder{color:rgb(var(--neeto-ui-gray-300))}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::placeholder{color:rgb(var(--neeto-ui-gray-300))}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{font-size:2.25rem}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:.75rem auto}.neeto-molecules-document__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;overflow-y:hidden}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu{border:thin solid rgb(var(--neeto-ui-gray-200));border-left:none;border-right:none}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu button.neeto-editor-fixed-menu__item{padding:.375rem}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:46.875rem;padding-left:0!important;padding-right:0!important}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper button.neeto-editor-fixed-menu__item{flex-shrink:0}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.neeto-molecules-document__wrapper .editor-content__wrapper{border:none!important;padding:.75rem 1rem 2rem!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:.75rem auto 0;max-width:48rem!important;padding-left:1rem;padding-right:1rem}.neeto-molecules-document__wrapper .editor-content-attachments--no-attachments{display:none!important}.neeto-molecules-document__wrapper .neeto-editor-character-count{margin:0 auto;max-width:48rem!important;padding-left:1rem;padding-right:1rem}.neeto-molecules-document__wrapper .ne-attachments__wrapper{width:100%}.neeto-molecules-document__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.neeto-molecules-document__wrapper del{background-color:#faa!important}";
|
|
39
|
+
var css = ".neeto-molecules-document__wrapper{height:100%}@media screen and (max-width:768px){.neeto-molecules-document__wrapper{width:100%}}.neeto-molecules-document__wrapper .neeto-molecules-document__container{margin:0 auto;max-width:48rem!important;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document-editor__menubar{position:sticky;top:0;width:100%;z-index:20}.neeto-molecules-document__wrapper .neeto-molecules-document__title{margin:1.5rem 0 0;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input{padding:0!important}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{color:rgb(var(--neeto-ui-black));font-size:2.625rem;font-weight:700;line-height:3rem;max-height:none;resize:none}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::-moz-placeholder{color:rgb(var(--neeto-ui-gray-300))}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::placeholder{color:rgb(var(--neeto-ui-gray-300))}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{font-size:2.25rem}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:.75rem auto}.neeto-molecules-document__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;overflow-y:hidden}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu{border:thin solid rgb(var(--neeto-ui-gray-200));border-left:none;border-right:none}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu button.neeto-editor-fixed-menu__item{padding:.375rem}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:46.875rem;padding-left:0!important;padding-right:0!important}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper button.neeto-editor-fixed-menu__item{flex-shrink:0}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.neeto-molecules-document__wrapper .editor-content__wrapper{border:none!important;padding:.75rem 1rem 2rem!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:.75rem auto 0;max-width:48rem!important;padding-left:1rem;padding-right:1rem}.neeto-molecules-document__wrapper .editor-content-attachments--no-attachments{display:none!important}.neeto-molecules-document__wrapper .neeto-editor-character-count{margin:0 auto;max-width:48rem!important;padding-left:1rem;padding-right:1rem}.neeto-molecules-document__wrapper .ne-attachments__wrapper{width:100%}.neeto-molecules-document__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.neeto-molecules-document__wrapper del{background-color:#faa!important}@media screen and (max-width:767px){.ne-media-uploader-modal{width:95vw!important}}";
|
|
24
40
|
n(css,{});
|
|
25
41
|
|
|
26
42
|
var useEditor = function useEditor(_ref) {
|
|
@@ -77,6 +93,45 @@ var useEditor = function useEditor(_ref) {
|
|
|
77
93
|
};
|
|
78
94
|
};
|
|
79
95
|
|
|
96
|
+
var MediaUploader = function MediaUploader(_ref) {
|
|
97
|
+
var setIsThumbnailImageModalOpen = _ref.setIsThumbnailImageModalOpen;
|
|
98
|
+
var _useFormikContext = useFormikContext(),
|
|
99
|
+
thumbnailImageUrl = _useFormikContext.values.thumbnailImageUrl,
|
|
100
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
101
|
+
initialValues = _useFormikContext.initialValues,
|
|
102
|
+
submitForm = _useFormikContext.submitForm;
|
|
103
|
+
var handleUpload = function handleUpload(file) {
|
|
104
|
+
var url = file.url,
|
|
105
|
+
signedId = file.signedId;
|
|
106
|
+
setFieldValue("thumbnailImage", signedId);
|
|
107
|
+
setFieldValue("thumbnailImageUrl", url);
|
|
108
|
+
setTimeout(function () {
|
|
109
|
+
setIsThumbnailImageModalOpen(false);
|
|
110
|
+
submitForm();
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
if (isEmpty(initialValues)) {
|
|
114
|
+
return /*#__PURE__*/jsx(Spinner, {});
|
|
115
|
+
}
|
|
116
|
+
return /*#__PURE__*/jsx(ImageUploader, {
|
|
117
|
+
className: "h-auto w-full",
|
|
118
|
+
src: thumbnailImageUrl,
|
|
119
|
+
uploadConfig: IMAGE_UPLOAD_CONFIG,
|
|
120
|
+
onUploadComplete: handleUpload
|
|
121
|
+
}, thumbnailImageUrl);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
var getThumbnailAddon = function getThumbnailAddon(command) {
|
|
125
|
+
return {
|
|
126
|
+
label: t("neetoMolecules.documentEditor.thumbnailImage"),
|
|
127
|
+
optionName: "thumbnail-image",
|
|
128
|
+
command: command,
|
|
129
|
+
icon: Image,
|
|
130
|
+
isEnabled: true,
|
|
131
|
+
"data-testid": "thumbnail-image-addon"
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
|
|
80
135
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
81
136
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
82
137
|
var Editor = function Editor(_ref) {
|
|
@@ -97,12 +152,34 @@ var Editor = function Editor(_ref) {
|
|
|
97
152
|
customEditorProps = _ref$editorProps === void 0 ? {} : _ref$editorProps,
|
|
98
153
|
_ref$titleProps = _ref.titleProps,
|
|
99
154
|
titleProps = _ref$titleProps === void 0 ? {} : _ref$titleProps,
|
|
155
|
+
_ref$hasThumbnailImag = _ref.hasThumbnailImage,
|
|
156
|
+
hasThumbnailImage = _ref$hasThumbnailImag === void 0 ? false : _ref$hasThumbnailImag,
|
|
100
157
|
children = _ref.children;
|
|
101
158
|
var _useTranslation = useTranslation(),
|
|
102
159
|
t = _useTranslation.t;
|
|
160
|
+
var _useFormikContext = useFormikContext(),
|
|
161
|
+
values = _useFormikContext.values,
|
|
162
|
+
setFieldValue = _useFormikContext.setFieldValue,
|
|
163
|
+
submitForm = _useFormikContext.submitForm;
|
|
164
|
+
var thumbnailImageUrl = values.thumbnailImageUrl;
|
|
165
|
+
var Menu = Dropdown.Menu,
|
|
166
|
+
MenuItem = Dropdown.MenuItem;
|
|
103
167
|
var titleRef = useRef();
|
|
104
168
|
var editorRef = useRef();
|
|
105
|
-
var
|
|
169
|
+
var _useState = useState(false),
|
|
170
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
171
|
+
isThumbnailImageModalOpen = _useState2[0],
|
|
172
|
+
setIsThumbnailImageModalOpen = _useState2[1];
|
|
173
|
+
var editorProps = useMemo(function () {
|
|
174
|
+
var baseProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);
|
|
175
|
+
if (!hasThumbnailImage) return baseProps;
|
|
176
|
+
var thumbnailAddon = getThumbnailAddon(function () {
|
|
177
|
+
return setIsThumbnailImageModalOpen(true);
|
|
178
|
+
});
|
|
179
|
+
return mergeRight(baseProps, {
|
|
180
|
+
addonCommands: [thumbnailAddon]
|
|
181
|
+
});
|
|
182
|
+
}, [customEditorProps, hasThumbnailImage]);
|
|
106
183
|
var _useEditor = useEditor({
|
|
107
184
|
onContentChange: onContentChange,
|
|
108
185
|
editorContentFieldName: editorContentFieldName,
|
|
@@ -140,11 +217,16 @@ var Editor = function Editor(_ref) {
|
|
|
140
217
|
}
|
|
141
218
|
return true;
|
|
142
219
|
};
|
|
143
|
-
|
|
220
|
+
var handleDeleteThumbnail = function handleDeleteThumbnail() {
|
|
221
|
+
setFieldValue("thumbnailImage", "");
|
|
222
|
+
setFieldValue("thumbnailImageUrl", "");
|
|
223
|
+
setTimeout(submitForm);
|
|
224
|
+
};
|
|
225
|
+
return /*#__PURE__*/jsxs("div", {
|
|
144
226
|
className: "neeto-molecules-document__wrapper",
|
|
145
227
|
"data-testid": "document-editor-container",
|
|
146
228
|
ref: editorHotkeyRef,
|
|
147
|
-
children: /*#__PURE__*/jsxs(FormikEditor, _objectSpread(_objectSpread({
|
|
229
|
+
children: [/*#__PURE__*/jsxs(FormikEditor, _objectSpread(_objectSpread({
|
|
148
230
|
attachmentsClassName: "editor-content-attachments w-full flex-shrink-0",
|
|
149
231
|
className: "h-full w-full",
|
|
150
232
|
contentClassName: "editor-content__wrapper neeto-molecules-document__container",
|
|
@@ -179,14 +261,53 @@ var Editor = function Editor(_ref) {
|
|
|
179
261
|
onKeyDown: function onKeyDown(e) {
|
|
180
262
|
return e.key === "Enter" && !e.shiftKey && e.preventDefault();
|
|
181
263
|
}
|
|
182
|
-
}, titleProps)),
|
|
264
|
+
}, titleProps)), thumbnailImageUrl && /*#__PURE__*/jsxs("div", {
|
|
265
|
+
className: "group relative mt-4",
|
|
266
|
+
children: [/*#__PURE__*/jsx("img", {
|
|
267
|
+
alt: "Cover",
|
|
268
|
+
className: "w-full",
|
|
269
|
+
src: thumbnailImageUrl
|
|
270
|
+
}), /*#__PURE__*/jsx("div", {
|
|
271
|
+
className: "neeto-ui-rounded-full absolute right-2 top-2",
|
|
272
|
+
children: /*#__PURE__*/jsx(Dropdown, {
|
|
273
|
+
strategy: "fixed",
|
|
274
|
+
buttonProps: {
|
|
275
|
+
style: "secondary",
|
|
276
|
+
size: "small",
|
|
277
|
+
icon: MenuHorizontal,
|
|
278
|
+
className: "neeto-ui-bg-white neeto-ui-shadow-md hover:neeto-ui-bg-gray-50 p-1"
|
|
279
|
+
},
|
|
280
|
+
children: /*#__PURE__*/jsx(Menu, {
|
|
281
|
+
children: /*#__PURE__*/jsx(MenuItem.Button, {
|
|
282
|
+
onClick: handleDeleteThumbnail,
|
|
283
|
+
children: t("neetoMolecules.documentEditor.delete")
|
|
284
|
+
})
|
|
285
|
+
})
|
|
286
|
+
})
|
|
287
|
+
})]
|
|
288
|
+
}), errors[editorContentFieldName] && /*#__PURE__*/jsx(Typography, {
|
|
183
289
|
className: "neeto-ui-input__error neeto-molecules-editor-content__error",
|
|
184
290
|
"data-cy": "articles-content-input-error",
|
|
185
291
|
style: "body3",
|
|
186
292
|
children: errors[editorContentFieldName]
|
|
187
293
|
})]
|
|
188
294
|
})]
|
|
189
|
-
}))
|
|
295
|
+
})), /*#__PURE__*/jsxs(Modal, {
|
|
296
|
+
className: "media-uploader-modal p-5 pt-0",
|
|
297
|
+
isOpen: isThumbnailImageModalOpen,
|
|
298
|
+
onClose: function onClose() {
|
|
299
|
+
setIsThumbnailImageModalOpen(false);
|
|
300
|
+
},
|
|
301
|
+
children: [/*#__PURE__*/jsx(Modal.Header, {
|
|
302
|
+
className: "ml-0 pl-0",
|
|
303
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
304
|
+
style: "h2",
|
|
305
|
+
children: t("neetoMolecules.documentEditor.uploadThumbnailImage")
|
|
306
|
+
})
|
|
307
|
+
}), /*#__PURE__*/jsx(MediaUploader, {
|
|
308
|
+
setIsThumbnailImageModalOpen: setIsThumbnailImageModalOpen
|
|
309
|
+
})]
|
|
310
|
+
})]
|
|
190
311
|
});
|
|
191
312
|
};
|
|
192
313
|
Editor.displayName = "DocumentEditor";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentEditor.js","sources":["../src/components/DocumentEditor/constants.js","../src/components/DocumentEditor/hooks/useEditor.js","../src/components/DocumentEditor/index.jsx"],"sourcesContent":["export const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"video-upload\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"image-upload-unsplash\",\n \"divider\",\n \"video-embed\",\n \"undo\",\n \"redo\",\n \"table\",\n];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isCharacterCountActive: true,\n isMenuIndependent: true,\n addons: [],\n size: \"medium\",\n};\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setFieldValue]\n );\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const handleEditorBackspaceKeypress = () => {\n const editor = editorRef.current?.editor;\n const selection = editor?.state?.selection;\n if (\n editor?.isFocused &&\n isPresent(titleRef.current) &&\n selection?.anchor === 1\n ) {\n const title = titleRef.current.value;\n titleRef.current.focus();\n titleRef.current.setSelectionRange(title?.length, title?.length);\n }\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => {\n editorRef.current?.editor?.commands?.insertContentAt(0, \"<p />\");\n editorRef.current?.editor?.commands?.focus(\"start\");\n },\n { mode: \"scoped\" }\n );\n\n const editorHotkeyRef = useHotkeys(\n \"backspace\",\n handleEditorBackspaceKeypress,\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","import { memo, useCallback, useMemo, useRef } from \"react\";\n\nimport classNames from \"classnames\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { Typography } from \"neetoui\";\nimport { Textarea } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\n\nconst Editor = ({\n attachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps: customEditorProps = {},\n titleProps = {},\n children,\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const editorProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n });\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = useCallback(node => {\n editorRef.current = node;\n getEditorRef(node);\n }, []);\n\n const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\n );\n\n const handleTab = () => {\n const isListActive =\n editorRef.current?.editor?.isActive(\"orderedList\") ||\n editorRef.current?.editor?.isActive(\"bulletList\");\n\n if (isListActive) {\n editorRef.current?.editor?.commands?.sinkListItem(\"listItem\");\n\n return true;\n }\n\n return true;\n };\n\n return (\n <div\n className=\"neeto-molecules-document__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments w-full flex-shrink-0\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper neeto-molecules-document__container\"\n data-cy=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n keyboardShortcuts={{ Tab: handleTab, ...editorProps.keyboardShortcuts }}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\n <div className=\"neeto-molecules-document__container px-4\">\n <Textarea\n nakedTextarea\n className=\"neeto-molecules-document__title\"\n data-cy=\"neeto-molecules-document-title-text-field\"\n name={titleFieldName}\n ref={setTitleRef}\n rows={1}\n placeholder={\n titleProps.placeholder || t(\"neetoMolecules.documentEditor.title\")\n }\n onChange={handleTitleChange}\n onKeyDown={e =>\n e.key === \"Enter\" && !e.shiftKey && e.preventDefault()\n }\n {...titleProps}\n />\n {errors[editorContentFieldName] && (\n <Typography\n className=\"neeto-ui-input__error neeto-molecules-editor-content__error\"\n data-cy=\"articles-content-input-error\"\n style=\"body3\"\n >\n {errors[editorContentFieldName]}\n </Typography>\n )}\n </div>\n </FormikEditor>\n </div>\n );\n};\n\nEditor.propTypes = {\n /**\n * List of initial attachments.\n */\n attachments: PropTypes.arrayOf(\n PropTypes.shape({\n contentType: PropTypes.string,\n filename: PropTypes.string,\n signedId: PropTypes.string,\n url: PropTypes.string,\n })\n ),\n /**\n * Callback that will be triggered when the editor content changes.\n * This function is not throttled.\n */\n onContentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the attachments changes.\n */\n onAttachmentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the article title changes.\n */\n onTitleChange: PropTypes.func,\n /**\n * This function will be called with the title node reference.\n */\n getTitleRef: PropTypes.func,\n /**\n * This function will be called with editor reference.\n */\n getEditorRef: PropTypes.func,\n /**\n * Formik field name of the editor. The default value is `htmlContent`.\n */\n editorContentFieldName: PropTypes.string,\n /**\n * Formik field name of the title. The default value is `title`.\n */\n titleFieldName: PropTypes.string,\n /**\n * These props will be passed down to the editor component.\n */\n editorProps: PropTypes.object,\n /**\n * These props will be passed down to the title text area component.\n */\n titleProps: PropTypes.object,\n /**\n * A prop to pass class names to the editor menubar.\n */\n menuClassName: PropTypes.string,\n /**\n * The children will be rendered above the title input field.\n */\n children: PropTypes.node,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","useEditor","_ref","onContentChange","editorContentFieldName","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","useCallback","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","titleHotkeyRef","useHotkeys","_editorRef$current2","_editorRef$current3","commands","insertContentAt","mode","editorHotkeyRef","Editor","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","children","_useTranslation","useTranslation","t","useRef","mergeRight","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","handleTab","isListActive","isActive","sinkListItem","_jsx","className","ref","_jsxs","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","keyboardShortcuts","Tab","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style","displayName","memo"],"mappings":";;;;;;;;;;;;;;AAAO,IAAMA,aAAa,GAAG,CAC3B,WAAW,EACX,OAAO,EACP,cAAc,EACd,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,aAAa,EACb,MAAM,EACN,MAAM,EACN,OAAO,CACR,CAAA;AAEM,IAAMC,oBAAoB,GAAG;AAClCC,EAAAA,sBAAsB,EAAE,IAAI;AAC5BC,EAAAA,iBAAiB,EAAE,IAAI;AACvBC,EAAAA,MAAM,EAAE,EAAE;AACVC,EAAAA,IAAI,EAAE,QAAA;AACR,CAAC;;;;;ACdD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAQT;AAAA,EAAA,IAPJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,k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,EACTtC,UAAU,CAACsC,WAAW,IAAIlC,CAAC,CAAC,qCAAqC,CAClE;AACD6B,UAAAA,QAAQ,EAAExE,iBAAkB;AAC5B8E,UAAAA,SAAS,EAAE,SAAXA,SAASA,CAAEC,CAAC,EAAA;AAAA,YAAA,OACVA,CAAC,CAACC,GAAG,KAAK,OAAO,IAAI,CAACD,CAAC,CAACE,QAAQ,IAAIF,CAAC,CAACG,cAAc,EAAE,CAAA;AAAA,WAAA;SAEpD3C,EAAAA,UAAU,CACf,CAAC,EACD7C,MAAM,CAACT,sBAAsB,CAAC,iBAC7BuE,GAAA,CAAC2B,UAAU,EAAA;AACT1B,UAAAA,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtC2B,UAAAA,KAAK,EAAC,OAAO;UAAA5C,QAAA,EAEZ9C,MAAM,CAACT,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;AAAA,OACE,CAAC,CAAA;KACM,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AA6DDyC,MAAM,CAAC2D,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,IAAI,CAAC5D,MAAM,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"DocumentEditor.js","sources":["../src/components/DocumentEditor/constants.js","../src/components/DocumentEditor/hooks/useEditor.js","../src/components/DocumentEditor/MediaUploader.jsx","../src/components/DocumentEditor/utils.js","../src/components/DocumentEditor/index.jsx"],"sourcesContent":["export const EDITOR_ADDONS = [\n \"highlight\",\n \"emoji\",\n \"video-upload\",\n \"code-block\",\n \"block-quote\",\n \"image-upload\",\n \"image-upload-unsplash\",\n \"divider\",\n \"video-embed\",\n \"undo\",\n \"redo\",\n \"table\",\n];\n\nexport const DEFAULT_EDITOR_PROPS = {\n isCharacterCountActive: true,\n isMenuIndependent: true,\n addons: [],\n size: \"medium\",\n};\n\nexport const IMAGE_UPLOAD_CONFIG = {\n maxImageSize: 1,\n allowedImageTypes: {\n \"image/jpg\": [\".jpg\", \".jpeg\"],\n \"image/png\": [\".png\"],\n \"image/svg\": [\".svg\"],\n },\n};\n","import { useCallback } from \"react\";\n\nimport { useFormikContext } from \"formik\";\nimport { isPresent } from \"neetocist\";\nimport useHotkeys from \"neetohotkeys\";\n\nconst useEditor = ({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n}) => {\n const { setFieldValue, errors } = useFormikContext();\n\n const handleContentChange = useCallback(\n content => {\n setFieldValue(editorContentFieldName, content);\n onContentChange?.(content);\n },\n [editorContentFieldName, onContentChange, setFieldValue]\n );\n\n const handleAttachmentChange = useCallback(\n attachments => {\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setFieldValue]\n );\n\n const handleTitleChange = event => {\n const title = event.target.value;\n setFieldValue(titleFieldName, title);\n onTitleChange?.(title);\n };\n\n const handleEditorBackspaceKeypress = () => {\n const editor = editorRef.current?.editor;\n const selection = editor?.state?.selection;\n if (\n editor?.isFocused &&\n isPresent(titleRef.current) &&\n selection?.anchor === 1\n ) {\n const title = titleRef.current.value;\n titleRef.current.focus();\n titleRef.current.setSelectionRange(title?.length, title?.length);\n }\n };\n\n const titleHotkeyRef = useHotkeys(\n \"return\",\n () => {\n editorRef.current?.editor?.commands?.insertContentAt(0, \"<p />\");\n editorRef.current?.editor?.commands?.focus(\"start\");\n },\n { mode: \"scoped\" }\n );\n\n const editorHotkeyRef = useHotkeys(\n \"backspace\",\n handleEditorBackspaceKeypress,\n { mode: \"scoped\" }\n );\n\n return {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n };\n};\n\nexport default useEditor;\n","import { ImageUploader } from \"@bigbinary/neeto-image-uploader-frontend\";\nimport { useFormikContext } from \"formik\";\nimport { Spinner } from \"neetoui\";\nimport { isEmpty } from \"ramda\";\n\nimport { IMAGE_UPLOAD_CONFIG } from \"./constants\";\n\nconst MediaUploader = ({ setIsThumbnailImageModalOpen }) => {\n const {\n values: { thumbnailImageUrl },\n setFieldValue,\n initialValues,\n submitForm,\n } = useFormikContext();\n\n const handleUpload = file => {\n const { url, signedId } = file;\n setFieldValue(\"thumbnailImage\", signedId);\n setFieldValue(\"thumbnailImageUrl\", url);\n setTimeout(() => {\n setIsThumbnailImageModalOpen(false);\n submitForm();\n });\n };\n\n if (isEmpty(initialValues)) {\n return <Spinner />;\n }\n\n return (\n <ImageUploader\n className=\"h-auto w-full\"\n key={thumbnailImageUrl}\n src={thumbnailImageUrl}\n uploadConfig={IMAGE_UPLOAD_CONFIG}\n onUploadComplete={handleUpload}\n />\n );\n};\n\nexport default MediaUploader;\n","import { t } from \"i18next\";\nimport { Image } from \"neetoicons\";\n\nexport const getThumbnailAddon = command => ({\n label: t(\"neetoMolecules.documentEditor.thumbnailImage\"),\n optionName: \"thumbnail-image\",\n command,\n icon: Image,\n isEnabled: true,\n \"data-testid\": \"thumbnail-image-addon\",\n});\n","import { memo, useCallback, useMemo, useRef, useState } from \"react\";\n\nimport classNames from \"classnames\";\nimport { useFormikContext } from \"formik\";\nimport { noop } from \"neetocist\";\nimport { FormikEditor } from \"neetoeditor\";\nimport { MenuHorizontal } from \"neetoicons\";\nimport { Modal, Typography, Dropdown } from \"neetoui\";\nimport { Textarea } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { mergeRight } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\nimport MediaUploader from \"./MediaUploader\";\nimport { getThumbnailAddon } from \"./utils\";\n\nconst Editor = ({\n attachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps: customEditorProps = {},\n titleProps = {},\n hasThumbnailImage = false,\n children,\n}) => {\n const { t } = useTranslation();\n const { values, setFieldValue, submitForm } = useFormikContext();\n const { thumbnailImageUrl } = values;\n\n const { Menu, MenuItem } = Dropdown;\n\n const titleRef = useRef();\n const editorRef = useRef();\n const [isThumbnailImageModalOpen, setIsThumbnailImageModalOpen] =\n useState(false);\n\n const editorProps = useMemo(() => {\n const baseProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);\n\n if (!hasThumbnailImage) return baseProps;\n\n const thumbnailAddon = getThumbnailAddon(() =>\n setIsThumbnailImageModalOpen(true)\n );\n\n return mergeRight(baseProps, { addonCommands: [thumbnailAddon] });\n }, [customEditorProps, hasThumbnailImage]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n onAttachmentChange,\n onTitleChange,\n titleFieldName,\n editorRef,\n titleRef,\n });\n\n const setTitleRef = node => {\n titleHotkeyRef.current = node;\n getTitleRef(node);\n titleRef.current = node;\n };\n\n const setEditorRef = useCallback(node => {\n editorRef.current = node;\n getEditorRef(node);\n }, []);\n\n const addons = useMemo(\n () => EDITOR_ADDONS.concat(editorProps.addons || []),\n [editorProps.addons]\n );\n\n const handleTab = () => {\n const isListActive =\n editorRef.current?.editor?.isActive(\"orderedList\") ||\n editorRef.current?.editor?.isActive(\"bulletList\");\n\n if (isListActive) {\n editorRef.current?.editor?.commands?.sinkListItem(\"listItem\");\n\n return true;\n }\n\n return true;\n };\n\n const handleDeleteThumbnail = () => {\n setFieldValue(\"thumbnailImage\", \"\");\n setFieldValue(\"thumbnailImageUrl\", \"\");\n setTimeout(submitForm);\n };\n\n return (\n <div\n className=\"neeto-molecules-document__wrapper\"\n data-testid=\"document-editor-container\"\n ref={editorHotkeyRef}\n >\n <FormikEditor\n attachmentsClassName=\"editor-content-attachments w-full flex-shrink-0\"\n className=\"h-full w-full\"\n contentClassName=\"editor-content__wrapper neeto-molecules-document__container\"\n data-cy=\"neeto-molecules-document-content-text-area\"\n error={undefined}\n errorWrapperClassName=\"w-full min-h-full flex flex-col items-center\"\n name={editorContentFieldName}\n ref={setEditorRef}\n menuClassName={classNames(\n \"neeto-molecules-document-editor__menubar\",\n menuClassName\n )}\n {...{ attachments, ...editorProps, addons }}\n contentWrapperClassName=\"w-full flex flex-col flex-grow\"\n keyboardShortcuts={{ Tab: handleTab, ...editorProps.keyboardShortcuts }}\n onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\n {children}\n <div className=\"neeto-molecules-document__container px-4\">\n <Textarea\n nakedTextarea\n className=\"neeto-molecules-document__title\"\n data-cy=\"neeto-molecules-document-title-text-field\"\n name={titleFieldName}\n ref={setTitleRef}\n rows={1}\n placeholder={\n titleProps.placeholder || t(\"neetoMolecules.documentEditor.title\")\n }\n onChange={handleTitleChange}\n onKeyDown={e =>\n e.key === \"Enter\" && !e.shiftKey && e.preventDefault()\n }\n {...titleProps}\n />\n {thumbnailImageUrl && (\n <div className=\"group relative mt-4\">\n <img alt=\"Cover\" className=\"w-full\" src={thumbnailImageUrl} />\n <div className=\"neeto-ui-rounded-full absolute right-2 top-2\">\n <Dropdown\n strategy=\"fixed\"\n buttonProps={{\n style: \"secondary\",\n size: \"small\",\n icon: MenuHorizontal,\n className:\n \"neeto-ui-bg-white neeto-ui-shadow-md hover:neeto-ui-bg-gray-50 p-1\",\n }}\n >\n <Menu>\n <MenuItem.Button onClick={handleDeleteThumbnail}>\n {t(\"neetoMolecules.documentEditor.delete\")}\n </MenuItem.Button>\n </Menu>\n </Dropdown>\n </div>\n </div>\n )}\n {errors[editorContentFieldName] && (\n <Typography\n className=\"neeto-ui-input__error neeto-molecules-editor-content__error\"\n data-cy=\"articles-content-input-error\"\n style=\"body3\"\n >\n {errors[editorContentFieldName]}\n </Typography>\n )}\n </div>\n </FormikEditor>\n <Modal\n className=\"media-uploader-modal p-5 pt-0\"\n isOpen={isThumbnailImageModalOpen}\n onClose={() => {\n setIsThumbnailImageModalOpen(false);\n }}\n >\n <Modal.Header className=\"ml-0 pl-0\">\n <Typography style=\"h2\">\n {t(\"neetoMolecules.documentEditor.uploadThumbnailImage\")}\n </Typography>\n </Modal.Header>\n <MediaUploader {...{ setIsThumbnailImageModalOpen }} />\n </Modal>\n </div>\n );\n};\n\nEditor.propTypes = {\n /**\n * List of initial attachments.\n */\n attachments: PropTypes.arrayOf(\n PropTypes.shape({\n contentType: PropTypes.string,\n filename: PropTypes.string,\n signedId: PropTypes.string,\n url: PropTypes.string,\n })\n ),\n /**\n * Callback that will be triggered when the editor content changes.\n * This function is not throttled.\n */\n onContentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the attachments changes.\n */\n onAttachmentChange: PropTypes.func,\n /**\n * Callback that will be triggered when the article title changes.\n */\n onTitleChange: PropTypes.func,\n /**\n * This function will be called with the title node reference.\n */\n getTitleRef: PropTypes.func,\n /**\n * This function will be called with editor reference.\n */\n getEditorRef: PropTypes.func,\n /**\n * Formik field name of the editor. The default value is `htmlContent`.\n */\n editorContentFieldName: PropTypes.string,\n /**\n * Formik field name of the title. The default value is `title`.\n */\n titleFieldName: PropTypes.string,\n /**\n * These props will be passed down to the editor component.\n */\n editorProps: PropTypes.object,\n /**\n * These props will be passed down to the title text area component.\n */\n titleProps: PropTypes.object,\n /**\n * A prop to pass class names to the editor menubar.\n */\n menuClassName: PropTypes.string,\n /**\n * The children will be rendered above the title input field.\n */\n children: PropTypes.node,\n /**\n * A prop to enable the thumbnail image uploader.\n */\n hasThumbnailImage: PropTypes.bool,\n};\n\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","IMAGE_UPLOAD_CONFIG","maxImageSize","allowedImageTypes","useEditor","_ref","onContentChange","editorContentFieldName","onAttachmentChange","onTitleChange","titleFieldName","editorRef","titleRef","_useFormikContext","useFormikContext","setFieldValue","errors","handleContentChange","useCallback","content","handleAttachmentChange","attachments","handleTitleChange","event","title","target","value","handleEditorBackspaceKeypress","_editorRef$current","_editor$state","editor","current","selection","state","isFocused","isPresent","anchor","focus","setSelectionRange","length","titleHotkeyRef","useHotkeys","_editorRef$current2","_editorRef$current3","commands","insertContentAt","mode","editorHotkeyRef","MediaUploader","setIsThumbnailImageModalOpen","thumbnailImageUrl","values","initialValues","submitForm","handleUpload","file","url","signedId","setTimeout","isEmpty","_jsx","Spinner","ImageUploader","className","src","uploadConfig","onUploadComplete","getThumbnailAddon","command","label","t","optionName","icon","Image","isEnabled","Editor","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","_ref$hasThumbnailImag","hasThumbnailImage","children","_useTranslation","useTranslation","Menu","Dropdown","MenuItem","useRef","_useState","useState","_useState2","_slicedToArray","isThumbnailImageModalOpen","useMemo","baseProps","mergeRight","thumbnailAddon","addonCommands","_useEditor","setTitleRef","node","setEditorRef","concat","handleTab","isListActive","isActive","sinkListItem","handleDeleteThumbnail","_jsxs","ref","FormikEditor","_objectSpread","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","keyboardShortcuts","Tab","onChange","onChangeAttachments","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","alt","strategy","buttonProps","style","MenuHorizontal","Button","onClick","Typography","Modal","isOpen","onClose","Header","displayName","memo"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,IAAMA,aAAa,GAAG,CAC3B,WAAW,EACX,OAAO,EACP,cAAc,EACd,YAAY,EACZ,aAAa,EACb,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,aAAa,EACb,MAAM,EACN,MAAM,EACN,OAAO,CACR,CAAA;AAEM,IAAMC,oBAAoB,GAAG;AAClC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,SAAS,EAAC,+BAA+B;AACzCyF,MAAAA,MAAM,EAAElD,yBAA0B;AAClCmD,MAAAA,OAAO,EAAE,SAATA,OAAOA,GAAQ;QACbxG,4BAA4B,CAAC,KAAK,CAAC,CAAA;OACnC;AAAA0C,MAAAA,QAAA,EAEF/B,cAAAA,GAAA,CAAC2F,KAAK,CAACG,MAAM,EAAA;AAAC3F,QAAAA,SAAS,EAAC,WAAW;QAAA4B,QAAA,eACjC/B,GAAA,CAAC0F,UAAU,EAAA;AAACJ,UAAAA,KAAK,EAAC,IAAI;UAAAvD,QAAA,EACnBrB,CAAC,CAAC,oDAAoD,CAAA;SAC7C,CAAA;AAAC,OACD,CAAC,eACfV,GAAA,CAACZ,aAAa,EAAA;AAAOC,QAAAA,4BAA4B,EAA5BA,4BAAAA;AAA4B,OAAK,CAAC,CAAA;AAAA,KAClD,CAAC,CAAA;AAAA,GACL,CAAC,CAAA;AAEV,CAAC,CAAA;AAiED0B,MAAM,CAACgF,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,IAAI,CAACjF,MAAM,CAAC;;;;"}
|
package/dist/Onboarding.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import React__default, { useState, useLayoutEffect, useEffect, useMemo, useRef } from 'react';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import { capitalize, findIndexBy, noop } from '@bigbinary/neeto-cist';
|
|
4
|
+
import { isPresent, capitalize, findIndexBy, noop } from '@bigbinary/neeto-cist';
|
|
5
5
|
import Stepper from '@bigbinary/neetoui/Stepper';
|
|
6
6
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
7
7
|
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
@@ -754,7 +754,9 @@ var useWindowDimensions = function useWindowDimensions() {
|
|
|
754
754
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
755
755
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
756
756
|
var CompletedScreen = function CompletedScreen(_ref) {
|
|
757
|
-
var completeButtonProps = _ref.completeButtonProps
|
|
757
|
+
var completeButtonProps = _ref.completeButtonProps,
|
|
758
|
+
completedScreenSuccessMessage = _ref.completedScreenSuccessMessage,
|
|
759
|
+
className = _ref.className;
|
|
758
760
|
var _useTranslation = useTranslation(),
|
|
759
761
|
t = _useTranslation.t;
|
|
760
762
|
var _useState = useState(true),
|
|
@@ -773,13 +775,13 @@ var CompletedScreen = function CompletedScreen(_ref) {
|
|
|
773
775
|
};
|
|
774
776
|
}, []);
|
|
775
777
|
return /*#__PURE__*/jsxs("div", {
|
|
776
|
-
className: "neeto-molecules-onboarding__wrapper",
|
|
778
|
+
className: classnames("neeto-molecules-onboarding__wrapper", className),
|
|
777
779
|
"data-testid": "onboarding-congratulations-wrapper",
|
|
778
780
|
children: [/*#__PURE__*/jsx(ReactConfetti, {
|
|
779
781
|
height: height,
|
|
780
782
|
width: width,
|
|
781
783
|
recycle: dropConfetti
|
|
782
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
784
|
+
}), isPresent(completedScreenSuccessMessage) ? completedScreenSuccessMessage : /*#__PURE__*/jsxs("div", {
|
|
783
785
|
className: "mx-auto mb-6 w-full max-w-2xl space-y-2 px-6 pt-16",
|
|
784
786
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
785
787
|
className: "text-center",
|
|
@@ -814,9 +816,10 @@ n(css,{});
|
|
|
814
816
|
var WelcomeScreen = withT(function (_ref) {
|
|
815
817
|
var t = _ref.t,
|
|
816
818
|
setCurrentStep = _ref.setCurrentStep,
|
|
817
|
-
nextStep = _ref.nextStep
|
|
819
|
+
nextStep = _ref.nextStep,
|
|
820
|
+
className = _ref.className;
|
|
818
821
|
return /*#__PURE__*/jsxs("div", {
|
|
819
|
-
className: "neeto-molecules-onboarding__wrapper",
|
|
822
|
+
className: classnames("neeto-molecules-onboarding__wrapper", className),
|
|
820
823
|
"data-testid": "onboarding-welcome-wrapper",
|
|
821
824
|
children: [/*#__PURE__*/jsxs("div", {
|
|
822
825
|
className: "mx-auto mb-6 w-full max-w-2xl space-y-2 px-6 pt-16",
|
|
@@ -864,7 +867,12 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
864
867
|
_ref$isAnimated = _ref.isAnimated,
|
|
865
868
|
isAnimated = _ref$isAnimated === void 0 ? true : _ref$isAnimated,
|
|
866
869
|
_ref$disableStepClick = _ref.disableStepClick,
|
|
867
|
-
disableStepClick = _ref$disableStepClick === void 0 ? false : _ref$disableStepClick
|
|
870
|
+
disableStepClick = _ref$disableStepClick === void 0 ? false : _ref$disableStepClick,
|
|
871
|
+
_ref$welcomeScreenCla = _ref.welcomeScreenClassName,
|
|
872
|
+
welcomeScreenClassName = _ref$welcomeScreenCla === void 0 ? "" : _ref$welcomeScreenCla,
|
|
873
|
+
_ref$completedScreenC = _ref.completedScreenClassName,
|
|
874
|
+
completedScreenClassName = _ref$completedScreenC === void 0 ? "" : _ref$completedScreenC,
|
|
875
|
+
completedScreenSuccessMessage = _ref.completedScreenSuccessMessage;
|
|
868
876
|
var steps = useMemo(function () {
|
|
869
877
|
return createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName);
|
|
870
878
|
}, [onboardingSteps]);
|
|
@@ -887,12 +895,15 @@ var Onboarding = function Onboarding(_ref) {
|
|
|
887
895
|
return /*#__PURE__*/jsx(WelcomeScreen, {
|
|
888
896
|
currentStep: currentStep,
|
|
889
897
|
setCurrentStep: setCurrentStep,
|
|
898
|
+
className: welcomeScreenClassName,
|
|
890
899
|
nextStep: steps[0].key
|
|
891
900
|
});
|
|
892
901
|
}
|
|
893
902
|
if (currentStep === GENERAL_ONBOARDING_STEPS.FINISH) {
|
|
894
903
|
return /*#__PURE__*/jsx(CompletedScreen, {
|
|
895
|
-
completeButtonProps: completeButtonProps
|
|
904
|
+
completeButtonProps: completeButtonProps,
|
|
905
|
+
completedScreenSuccessMessage: completedScreenSuccessMessage,
|
|
906
|
+
className: completedScreenClassName
|
|
896
907
|
});
|
|
897
908
|
}
|
|
898
909
|
var handleStepChange = function handleStepChange(index) {
|