@bigbinary/neeto-molecules 3.9.9 → 3.9.11
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 +5 -2
- package/dist/DocumentEditor.js.map +1 -1
- package/dist/cjs/DocumentEditor.js +5 -2
- package/dist/cjs/DocumentEditor.js.map +1 -1
- package/package.json +3 -1
- package/types/AuditLogs.d.ts +5 -3
- package/types/Breadcrumbs.d.ts +5 -3
- package/types/BrowserSupport.d.ts +5 -3
- package/types/Builder.d.ts +5 -7
- package/types/CalendarView.d.ts +8 -6
- package/types/Codeblock.d.ts +7 -5
- package/types/Columns.d.ts +8 -6
- package/types/ConfigurePageSidebar.d.ts +5 -3
- package/types/ConfirmationModal.d.ts +5 -3
- package/types/Container.d.ts +5 -3
- package/types/CopyToClipboardButton.d.ts +6 -4
- package/types/Currency.d.ts +7 -5
- package/types/CustomDomain.d.ts +6 -4
- package/types/CustomDomainDashboard.d.ts +6 -4
- package/types/DateFormat.d.ts +5 -9
- package/types/DateRangeFilter.d.ts +7 -5
- package/types/DeleteArchiveModal.d.ts +5 -3
- package/types/DeviceIncompatibilityMessage.d.ts +5 -3
- package/types/DocumentEditor.d.ts +6 -4
- package/types/DownloadMobileAppCallout.d.ts +5 -3
- package/types/DynamicVariables.d.ts +6 -4
- package/types/EmailForm.d.ts +7 -5
- package/types/EmailFormProvider.d.ts +3 -2
- package/types/EmailPreview.d.ts +5 -3
- package/types/EmojiPicker.d.ts +6 -4
- package/types/EmojiReactions.d.ts +5 -3
- package/types/ErrorPage.d.ts +6 -4
- package/types/FileUpload.d.ts +8 -6
- package/types/FloatingActionMenu.d.ts +6 -4
- package/types/GoogleFontPicker.d.ts +27 -20
- package/types/Header.d.ts +9 -6
- package/types/HelpPopover.d.ts +7 -5
- package/types/IconPicker.d.ts +5 -3
- package/types/ImageWithFallback.d.ts +5 -3
- package/types/InlineInput.d.ts +9 -7
- package/types/Insights.d.ts +5 -4
- package/types/IntegrationCard.d.ts +7 -5
- package/types/IpRestriction.d.ts +5 -3
- package/types/KeyboardShortcuts.d.ts +6 -4
- package/types/LoginPage.d.ts +5 -3
- package/types/MadeWith.d.ts +5 -3
- package/types/MenuBar.d.ts +7 -5
- package/types/Metadata.d.ts +5 -3
- package/types/MobilePreviewHeader.d.ts +5 -3
- package/types/MoreDropdown.d.ts +6 -4
- package/types/NavigationHeader.d.ts +7 -6
- package/types/NeetoWidget.d.ts +5 -3
- package/types/Onboarding.d.ts +5 -3
- package/types/OptionFields.d.ts +4 -2
- package/types/PageLoader.d.ts +5 -3
- package/types/PhoneNumber.d.ts +15 -13
- package/types/ProductEmbed.d.ts +5 -3
- package/types/PublishBlock.d.ts +6 -4
- package/types/Rename.d.ts +6 -4
- package/types/ResponsiveDevicePicker.d.ts +5 -3
- package/types/Schedule.d.ts +5 -3
- package/types/Scrollable.d.ts +6 -4
- package/types/Search.d.ts +6 -4
- package/types/SendToFields.d.ts +6 -4
- package/types/SessionEnvironment.d.ts +8 -5
- package/types/Settings.d.ts +5 -4
- package/types/ShareRecordingPane.d.ts +4 -2
- package/types/ShareViaEmail.d.ts +5 -3
- package/types/ShareViaLink.d.ts +5 -4
- package/types/Sidebar.d.ts +7 -5
- package/types/StatusDropdown.d.ts +5 -3
- package/types/StickyRibbonsContainer.d.ts +5 -3
- package/types/SubHeader.d.ts +7 -5
- package/types/SuffixedInput.d.ts +5 -3
- package/types/TableWrapper.d.ts +5 -3
- package/types/Taxonomy.d.ts +6 -4
- package/types/TimeFormat.d.ts +5 -9
- package/types/TimezoneMismatchModal.d.ts +5 -3
- package/types/ToggleFeatureCard.d.ts +7 -5
package/dist/DocumentEditor.js
CHANGED
|
@@ -6,6 +6,7 @@ import { isPresent, noop } from '@bigbinary/neeto-cist';
|
|
|
6
6
|
import FormikEditor from '@bigbinary/neeto-editor/FormikEditor';
|
|
7
7
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
8
8
|
import Textarea from '@bigbinary/neetoui/formik/Textarea';
|
|
9
|
+
import { mergeRight } from 'ramda';
|
|
9
10
|
import { useTranslation } from 'react-i18next';
|
|
10
11
|
import { n } from './inject-css-DmrvuTKK.js';
|
|
11
12
|
import { useFormikContext } from 'formik';
|
|
@@ -16,7 +17,8 @@ var EDITOR_ADDONS = ["highlight", "emoji", "video-upload", "code-block", "block-
|
|
|
16
17
|
var DEFAULT_EDITOR_PROPS = {
|
|
17
18
|
isCharacterCountActive: true,
|
|
18
19
|
isMenuIndependent: true,
|
|
19
|
-
addons: []
|
|
20
|
+
addons: [],
|
|
21
|
+
size: "medium"
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
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:768px!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:24px 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:42px;font-weight:700;line-height:48px;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:36px}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:12px 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:6px}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:750px;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:12px 16px 0!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:12px auto 0;max-width:768px!important;padding-left:16px;padding-right:16px}.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:768px!important;padding-left:16px;padding-right:16px}.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}";
|
|
@@ -104,13 +106,14 @@ var Editor = function Editor(_ref) {
|
|
|
104
106
|
_ref$titleFieldName = _ref.titleFieldName,
|
|
105
107
|
titleFieldName = _ref$titleFieldName === void 0 ? "title" : _ref$titleFieldName,
|
|
106
108
|
_ref$editorProps = _ref.editorProps,
|
|
107
|
-
|
|
109
|
+
customEditorProps = _ref$editorProps === void 0 ? {} : _ref$editorProps,
|
|
108
110
|
_ref$titleProps = _ref.titleProps,
|
|
109
111
|
titleProps = _ref$titleProps === void 0 ? {} : _ref$titleProps;
|
|
110
112
|
var _useTranslation = useTranslation(),
|
|
111
113
|
t = _useTranslation.t;
|
|
112
114
|
var titleRef = useRef();
|
|
113
115
|
var editorRef = useRef();
|
|
116
|
+
var editorProps = mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);
|
|
114
117
|
var _useState = useState(function () {
|
|
115
118
|
return getUniqueAttachments(initialAttachments);
|
|
116
119
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentEditor.js","sources":["../src/components/DocumentEditor/constants.js","../src/components/DocumentEditor/hooks/useEditor.js","../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};\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 setAttachments,\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 setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setAttachments, 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","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import { memo, useCallback, useEffect, useMemo, useRef, useState } 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 { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps = DEFAULT_EDITOR_PROPS,\n titleProps = {},\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n useEffect(() => {\n setAttachments(getUniqueAttachments(initialAttachments));\n }, [initialAttachments]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\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 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 onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\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\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","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$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","useRef","_useState","useState","_useState2","_slicedToArray","useEffect","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","children","FormikEditor","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","_jsxs","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,EAAA;AACV,CAAC;;;;;ACbD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAST;AAAA,EAAA,IARJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAClBC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,cAAc,GAAAN,IAAA,CAAdM,cAAc;IACdC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ,CAAA;AAER,EAAA,IAAAC,iBAAA,GAAkCC,gBAAgB,EAAE;IAA5CC,aAAa,GAAAF,iBAAA,CAAbE,aAAa;IAAEC,MAAM,GAAAH,iBAAA,CAANG,MAAM,CAAA;AAE7B,EAAA,IAAMC,mBAAmB,GAAGC,WAAW,CACrC,UAAAC,OAAO,EAAI;AACTJ,I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,UAAAA,KAAK,EAAC,OAAO;UAAAvB,QAAA,EAEZ7E,MAAM,CAACV,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;OACE,CAAA;KACO,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AAyDDuD,MAAM,CAACwD,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,IAAI,CAACzD,MAAM,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"DocumentEditor.js","sources":["../src/components/DocumentEditor/constants.js","../src/components/DocumentEditor/hooks/useEditor.js","../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","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 setAttachments,\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 setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setAttachments, 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","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import { memo, useCallback, useEffect, useMemo, useRef, useState } 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\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\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}) => {\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 [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n useEffect(() => {\n setAttachments(getUniqueAttachments(initialAttachments));\n }, [initialAttachments]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\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 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 onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\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\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","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$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","useRef","mergeRight","_useState","useState","_useState2","_slicedToArray","useEffect","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","children","FormikEditor","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","_jsxs","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,EAST;AAAA,EAAA,IARJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAClBC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,cAA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,UAAAA,QAAQ,EAAEnF,iBAAkB;AAC5B0F,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;SAEpDzC,EAAAA,UAAU,CACf,CAAC,EACD3D,MAAM,CAACV,sBAAsB,CAAC,iBAC7BsF,GAAA,CAACyB,UAAU,EAAA;AACTxB,UAAAA,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtCyB,UAAAA,KAAK,EAAC,OAAO;UAAAvB,QAAA,EAEZ/E,MAAM,CAACV,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;OACE,CAAA;KACO,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AAyDDuD,MAAM,CAAC0D,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,IAAI,CAAC3D,MAAM,CAAC;;;;"}
|
|
@@ -8,6 +8,7 @@ var neetoCist = require('@bigbinary/neeto-cist');
|
|
|
8
8
|
var FormikEditor = require('@bigbinary/neeto-editor/FormikEditor');
|
|
9
9
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
10
10
|
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
11
|
+
var ramda = require('ramda');
|
|
11
12
|
var reactI18next = require('react-i18next');
|
|
12
13
|
var injectCss = require('./inject-css-vQvjPR2x.js');
|
|
13
14
|
var formik = require('formik');
|
|
@@ -18,7 +19,8 @@ var EDITOR_ADDONS = ["highlight", "emoji", "video-upload", "code-block", "block-
|
|
|
18
19
|
var DEFAULT_EDITOR_PROPS = {
|
|
19
20
|
isCharacterCountActive: true,
|
|
20
21
|
isMenuIndependent: true,
|
|
21
|
-
addons: []
|
|
22
|
+
addons: [],
|
|
23
|
+
size: "medium"
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
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:768px!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:24px 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:42px;font-weight:700;line-height:48px;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:36px}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:12px 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:6px}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:750px;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:12px 16px 0!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:12px auto 0;max-width:768px!important;padding-left:16px;padding-right:16px}.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:768px!important;padding-left:16px;padding-right:16px}.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}";
|
|
@@ -106,13 +108,14 @@ var Editor = function Editor(_ref) {
|
|
|
106
108
|
_ref$titleFieldName = _ref.titleFieldName,
|
|
107
109
|
titleFieldName = _ref$titleFieldName === void 0 ? "title" : _ref$titleFieldName,
|
|
108
110
|
_ref$editorProps = _ref.editorProps,
|
|
109
|
-
|
|
111
|
+
customEditorProps = _ref$editorProps === void 0 ? {} : _ref$editorProps,
|
|
110
112
|
_ref$titleProps = _ref.titleProps,
|
|
111
113
|
titleProps = _ref$titleProps === void 0 ? {} : _ref$titleProps;
|
|
112
114
|
var _useTranslation = reactI18next.useTranslation(),
|
|
113
115
|
t = _useTranslation.t;
|
|
114
116
|
var titleRef = React.useRef();
|
|
115
117
|
var editorRef = React.useRef();
|
|
118
|
+
var editorProps = ramda.mergeRight(DEFAULT_EDITOR_PROPS, customEditorProps);
|
|
116
119
|
var _useState = React.useState(function () {
|
|
117
120
|
return getUniqueAttachments(initialAttachments);
|
|
118
121
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentEditor.js","sources":["../../src/components/DocumentEditor/constants.js","../../src/components/DocumentEditor/hooks/useEditor.js","../../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};\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 setAttachments,\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 setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setAttachments, 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","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import { memo, useCallback, useEffect, useMemo, useRef, useState } 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 { useTranslation } from \"react-i18next\";\n\nimport { DEFAULT_EDITOR_PROPS, EDITOR_ADDONS } from \"./constants\";\nimport \"./editor.scss\";\nimport useEditor from \"./hooks/useEditor\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\n onContentChange,\n onAttachmentChange,\n onTitleChange,\n getTitleRef = noop,\n getEditorRef = noop,\n menuClassName,\n editorContentFieldName = \"htmlContent\",\n titleFieldName = \"title\",\n editorProps = DEFAULT_EDITOR_PROPS,\n titleProps = {},\n}) => {\n const { t } = useTranslation();\n\n const titleRef = useRef();\n const editorRef = useRef();\n\n const [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n useEffect(() => {\n setAttachments(getUniqueAttachments(initialAttachments));\n }, [initialAttachments]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\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 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 onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\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\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","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$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","useRef","_useState","useState","_useState2","_slicedToArray","useEffect","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","children","FormikEditor","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","_jsxs","Textarea","nakedTextarea","rows","placeholder","onKeyDown","e","key","shiftKey","preventDefault","Typography","style","displayName","memo"],"mappings":";;;;;;;;;;;;;;;;AAAO,IAAMA,aAAa,GAAG,CAC3B,WAAW,EACX,OAAO,EACP,cAAc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,MAAAA,mBAAmB,EAAEpF,sBAAuB;AAAAyE,MAAAA,QAAA,eAE5CY,eAAA,CAAA,KAAA,EAAA;AAAKd,QAAAA,SAAS,EAAC,0CAA0C;AAAAE,QAAAA,QAAA,EACvDH,cAAAA,cAAA,CAACgB,QAAQ,EAAAlD,aAAA,CAAA;UACPmD,aAAa,EAAA,IAAA;AACbhB,UAAAA,SAAS,EAAC,iCAAiC;AAC3C,UAAA,SAAA,EAAQ,2CAA2C;AACnDS,UAAAA,IAAI,EAAE1F,cAAe;AACrBkF,UAAAA,GAAG,EAAEP,WAAY;AACjBuB,UAAAA,IAAI,EAAE,CAAE;UACRC,WAAW,EACTnC,UAAU,CAACmC,WAAW,IAAIhC,CAAC,CAAC,qCAAqC,CAClE;AACD0B,UAAAA,QAAQ,EAAEjF,iBAAkB;AAC5BwF,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;SAEpDxC,EAAAA,UAAU,CACf,CAAC,EACD1D,MAAM,CAACV,sBAAsB,CAAC,iBAC7BoF,cAAA,CAACyB,UAAU,EAAA;AACTxB,UAAAA,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtCyB,UAAAA,KAAK,EAAC,OAAO;UAAAvB,QAAA,EAEZ7E,MAAM,CAACV,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;OACE,CAAA;KACO,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AAyDDuD,MAAM,CAACwD,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,UAAI,CAACzD,MAAM,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"DocumentEditor.js","sources":["../../src/components/DocumentEditor/constants.js","../../src/components/DocumentEditor/hooks/useEditor.js","../../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","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 setAttachments,\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 setAttachments(attachments);\n setFieldValue(\"attachments\", attachments);\n onAttachmentChange?.(attachments);\n },\n [onAttachmentChange, setAttachments, 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","export const getUniqueAttachments = attachments => {\n const uniqueAttachments = attachments?.reduce(\n (uniqueAttachments, attachment) => ({\n ...uniqueAttachments,\n [attachment.signedId]: attachment,\n }),\n {}\n );\n\n return Object.values(uniqueAttachments || {});\n};\n","import { memo, useCallback, useEffect, useMemo, useRef, useState } 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\";\nimport { getUniqueAttachments } from \"./utils\";\n\nconst Editor = ({\n attachments: initialAttachments,\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}) => {\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 [attachments, setAttachments] = useState(() =>\n getUniqueAttachments(initialAttachments)\n );\n\n useEffect(() => {\n setAttachments(getUniqueAttachments(initialAttachments));\n }, [initialAttachments]);\n\n const {\n handleContentChange,\n handleAttachmentChange,\n handleTitleChange,\n editorHotkeyRef,\n titleHotkeyRef,\n errors,\n } = useEditor({\n onContentChange,\n editorContentFieldName,\n setAttachments,\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 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 onChange={handleContentChange}\n onChangeAttachments={handleAttachmentChange}\n >\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\nEditor.displayName = \"DocumentEditor\";\n\nexport default memo(Editor);\n"],"names":["EDITOR_ADDONS","DEFAULT_EDITOR_PROPS","isCharacterCountActive","isMenuIndependent","addons","size","useEditor","_ref","onContentChange","editorContentFieldName","setAttachments","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$current2$e","_editorRef$current2$e2","_editorRef$current3","_editorRef$current3$e","_editorRef$current3$e2","commands","insertContentAt","mode","editorHotkeyRef","getUniqueAttachments","uniqueAttachments","reduce","attachment","_objectSpread","_defineProperty","signedId","Object","values","Editor","initialAttachments","_ref$getTitleRef","getTitleRef","noop","_ref$getEditorRef","getEditorRef","menuClassName","_ref$editorContentFie","_ref$titleFieldName","_ref$editorProps","editorProps","customEditorProps","_ref$titleProps","titleProps","_useTranslation","useTranslation","t","useRef","mergeRight","_useState","useState","_useState2","_slicedToArray","useEffect","_useEditor","setTitleRef","node","setEditorRef","useMemo","concat","_jsx","className","ref","children","FormikEditor","attachmentsClassName","contentClassName","error","undefined","errorWrapperClassName","name","classNames","contentWrapperClassName","onChange","onChangeAttachments","_jsxs","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,EAST;AAAA,EAAA,IARJC,eAAe,GAAAD,IAAA,CAAfC,eAAe;IACfC,sBAAsB,GAAAF,IAAA,CAAtBE,sBAAsB;IACtBC,cAAc,GAAAH,IAAA,CAAdG,cAAc;IACdC,kBAAkB,GAAAJ,IAAA,CAAlBI,kBAAkB;IAClBC,aAAa,GAAAL,IAAA,CAAbK,aAAa;IACbC,cAAc,GAAAN,IAAA,CAAdM,cAAc;IACdC,SAAS,GAAAP,IAAA,CAATO,SAAS;IACTC,QAAQ,GAAAR,IAAA,CAARQ,QAAQ,CAAA;AAER,EAAA,IAAAC,iBAAA,GAAkCC,uBAAgB,EAAE;IAA5CC,aAAa,GAAAF,iBAAA,CAAbE,aAAa;IAAEC,MAAM,GAAAH,iBAAA,CAANG,MAAM,CAAA;AAE7B,EAAA,IAAMC,mBAAmB,GAAGC,iBAAW,CACrC,UAAAC,OAAO,EAAI;AACTJ,IAAAA,aAAa,CAACT,sB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,SAAS,EAAC,6DAA6D;AACvE,UAAA,SAAA,EAAQ,8BAA8B;AACtCyB,UAAAA,KAAK,EAAC,OAAO;UAAAvB,QAAA,EAEZ/E,MAAM,CAACV,sBAAsB,CAAA;AAAC,SACrB,CACb,CAAA;OACE,CAAA;KACO,CAAA,CAAA;AAAC,GACZ,CAAC,CAAA;AAEV,CAAC,CAAA;AAyDDuD,MAAM,CAAC0D,WAAW,GAAG,gBAAgB,CAAA;AAErC,YAAeC,aAAAA,UAAI,CAAC3D,MAAM,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.11",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -184,6 +184,7 @@
|
|
|
184
184
|
"rollup-plugin-analyzer": "4.0.0",
|
|
185
185
|
"rollup-plugin-cleaner": "1.0.0",
|
|
186
186
|
"rollup-plugin-copy": "3.5.0",
|
|
187
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
187
188
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
188
189
|
"rollup-plugin-styles": "4.0.0",
|
|
189
190
|
"sass": "^1.54.9",
|
|
@@ -193,6 +194,7 @@
|
|
|
193
194
|
"storybook-dark-mode": "^4.0.2",
|
|
194
195
|
"tailwindcss": "^3.4.1",
|
|
195
196
|
"tippy.js": "6.3.7",
|
|
197
|
+
"typescript": "^5.6.3",
|
|
196
198
|
"yjs": "^13.6.19",
|
|
197
199
|
"yup": "0.32.11",
|
|
198
200
|
"zustand": "4.3.2"
|
package/types/AuditLogs.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* A full-page component that allows you to track user activities, including
|
|
@@ -14,5 +15,6 @@ import React from "react";
|
|
|
14
15
|
* const AuditLogs = () => <NeetoAuditLogs />;
|
|
15
16
|
* @endexample
|
|
16
17
|
*/
|
|
17
|
-
const AuditLogs: React.FC<{}>;
|
|
18
|
-
|
|
18
|
+
declare const AuditLogs: React.FC<{}>;
|
|
19
|
+
|
|
20
|
+
export { AuditLogs as default };
|
package/types/Breadcrumbs.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* Component to show breadcrumbs
|
|
@@ -17,7 +18,7 @@ import React from "react";
|
|
|
17
18
|
* const Page = () => <Breadcrumbs Breadcrumbs={SETTINGS_BREADCRUMBS} />;
|
|
18
19
|
* @endexample
|
|
19
20
|
*/
|
|
20
|
-
const Breadcrumbs: React.FC<{
|
|
21
|
+
declare const Breadcrumbs: React.FC<{
|
|
21
22
|
breadcrumbs?: {
|
|
22
23
|
text: string;
|
|
23
24
|
link: string;
|
|
@@ -25,4 +26,5 @@ const Breadcrumbs: React.FC<{
|
|
|
25
26
|
hasTrailingSeparator?: boolean;
|
|
26
27
|
className?: string;
|
|
27
28
|
}>;
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
export { Breadcrumbs as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
type VersionLimits = {
|
|
3
4
|
softLimit?: number;
|
|
4
5
|
hardLimit?: number;
|
|
@@ -87,7 +88,7 @@ type VersionLimits = {
|
|
|
87
88
|
* and a corresponding callout will be shown.
|
|
88
89
|
*
|
|
89
90
|
*/
|
|
90
|
-
const BrowserSupport: React.FC<{
|
|
91
|
+
declare const BrowserSupport: React.FC<{
|
|
91
92
|
overrides?: {
|
|
92
93
|
Chrome?: VersionLimits;
|
|
93
94
|
MicrosoftEdge?: VersionLimits;
|
|
@@ -105,4 +106,5 @@ const BrowserSupport: React.FC<{
|
|
|
105
106
|
unsupportedBrowsers?: string[];
|
|
106
107
|
children?: React.ReactNode | React.ReactNode[];
|
|
107
108
|
}>;
|
|
108
|
-
|
|
109
|
+
|
|
110
|
+
export { BrowserSupport as default };
|
package/types/Builder.d.ts
CHANGED
|
@@ -10,9 +10,6 @@ type ElementSection = {
|
|
|
10
10
|
isCreatable: (element: Element) => boolean;
|
|
11
11
|
disabledElementTooltip?: (label: string) => string;
|
|
12
12
|
};
|
|
13
|
-
type dragResult = {
|
|
14
|
-
index: number;
|
|
15
|
-
};
|
|
16
13
|
type SelectedElementAction = {
|
|
17
14
|
label: string;
|
|
18
15
|
key: string;
|
|
@@ -28,7 +25,6 @@ type SelectedElement = {
|
|
|
28
25
|
isPending: boolean;
|
|
29
26
|
actions: SelectedElementAction[] | ((element: Element) => SelectedElementAction[]);
|
|
30
27
|
};
|
|
31
|
-
export
|
|
32
28
|
/**
|
|
33
29
|
*
|
|
34
30
|
* @example
|
|
@@ -76,7 +72,7 @@ export
|
|
|
76
72
|
* );
|
|
77
73
|
* @endexample
|
|
78
74
|
*/
|
|
79
|
-
const ElementsPanel: React.FC<{
|
|
75
|
+
declare const ElementsPanel: React.FC<{
|
|
80
76
|
elementSections: ElementSection[];
|
|
81
77
|
selectedElements: SelectedElement[];
|
|
82
78
|
handleAddElement: (element: Element) => void;
|
|
@@ -94,8 +90,10 @@ const ElementsPanel: React.FC<{
|
|
|
94
90
|
isAddingNewElement?: boolean;
|
|
95
91
|
primaryPanel?: "summary" | "elements";
|
|
96
92
|
}>;
|
|
97
|
-
|
|
93
|
+
declare const PropertiesPanel: React.FC<{
|
|
98
94
|
children: React.ReactNode;
|
|
99
95
|
id: string;
|
|
100
96
|
onClose?: (id: string) => void;
|
|
101
|
-
}>;
|
|
97
|
+
}>;
|
|
98
|
+
|
|
99
|
+
export { ElementsPanel, PropertiesPanel };
|
package/types/CalendarView.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { DateClickArg, EventClickArg } from
|
|
3
|
-
import { Dayjs } from
|
|
4
|
-
import { EventContentArg } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DateClickArg, EventClickArg } from '@fullcalendar/react';
|
|
3
|
+
import { Dayjs } from 'dayjs';
|
|
4
|
+
import { EventContentArg } from '@fullcalendar/core';
|
|
5
|
+
|
|
5
6
|
type ViewOption = {
|
|
6
7
|
label: string;
|
|
7
8
|
fullCalendarView: string;
|
|
@@ -76,7 +77,7 @@ interface EventObject {
|
|
|
76
77
|
* />;
|
|
77
78
|
* @endexample
|
|
78
79
|
*/
|
|
79
|
-
const CalendarView: React.FC<{
|
|
80
|
+
declare const CalendarView: React.FC<{
|
|
80
81
|
viewOptions: ViewOptionsType;
|
|
81
82
|
events: EventObject[];
|
|
82
83
|
handleDateClick: (info: DateClickArg) => void;
|
|
@@ -93,4 +94,5 @@ const CalendarView: React.FC<{
|
|
|
93
94
|
};
|
|
94
95
|
hideHeader?: boolean;
|
|
95
96
|
}>;
|
|
96
|
-
|
|
97
|
+
|
|
98
|
+
export { CalendarView as default };
|
package/types/Codeblock.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { SyntaxHighlighterProps } from
|
|
3
|
-
import { CopyToClipboardButtonProps } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SyntaxHighlighterProps } from 'react-syntax-highlighter';
|
|
3
|
+
import { CopyToClipboardButtonProps } from './CopyToClipboardButton.js';
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
*
|
|
6
7
|
* Codeblock can be used to render a block of code, with appropriate syntax
|
|
@@ -26,10 +27,11 @@ import { CopyToClipboardButtonProps } from "./CopyToClipboardButton";
|
|
|
26
27
|
* );
|
|
27
28
|
* @endexample
|
|
28
29
|
*/
|
|
29
|
-
const Codeblock: React.FC<{
|
|
30
|
+
declare const Codeblock: React.FC<{
|
|
30
31
|
code: string;
|
|
31
32
|
showCopyButton?: boolean;
|
|
32
33
|
codeblockProps?: Partial<SyntaxHighlighterProps>;
|
|
33
34
|
copyButtonProps?: Partial<CopyToClipboardButtonProps>;
|
|
34
35
|
}>;
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
export { Codeblock as default };
|
package/types/Columns.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { CheckboxProps,
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxProps, InputProps, DropdownProps } from '@bigbinary/neetoui';
|
|
3
|
+
|
|
3
4
|
type Column = {
|
|
4
5
|
title: string;
|
|
5
6
|
dataIndex: string;
|
|
@@ -128,7 +129,7 @@ type useColumnsType = {
|
|
|
128
129
|
* };
|
|
129
130
|
* @endexample
|
|
130
131
|
*/
|
|
131
|
-
const Columns: React.FC<{
|
|
132
|
+
declare const Columns: React.FC<{
|
|
132
133
|
actionBlock?: React.ReactNode;
|
|
133
134
|
checkboxProps?: CheckboxProps;
|
|
134
135
|
columnData: Column[];
|
|
@@ -138,14 +139,14 @@ const Columns: React.FC<{
|
|
|
138
139
|
onChange: (columns: Column[], hiddenColumns: string[]) => any[];
|
|
139
140
|
searchProps?: InputProps;
|
|
140
141
|
} & DropdownProps>;
|
|
141
|
-
|
|
142
|
+
declare function useHiddenColumns(localStorageKey: string, initialValue?: string[]): {
|
|
142
143
|
hiddenColumns: string[];
|
|
143
144
|
hideColumn: (dataIndex: string) => void;
|
|
144
145
|
showColumn: (dataIndex: string) => void;
|
|
145
146
|
getVisibleColumnData: (columnData: any[]) => any[];
|
|
146
147
|
onColumnDataChange: (columnData: any[]) => void;
|
|
147
148
|
};
|
|
148
|
-
|
|
149
|
+
declare function useColumns({
|
|
149
150
|
localStorageKey,
|
|
150
151
|
initialHiddenColumns,
|
|
151
152
|
initialOrder
|
|
@@ -163,4 +164,5 @@ export function useColumns({
|
|
|
163
164
|
}: getColumnDataType) => any[];
|
|
164
165
|
setColumnOrder: (columns: string[]) => void;
|
|
165
166
|
};
|
|
166
|
-
|
|
167
|
+
|
|
168
|
+
export { Columns as default, useColumns, useHiddenColumns };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
type NavLinkItemType = {
|
|
3
4
|
to: string;
|
|
4
5
|
label?: React.ReactNode;
|
|
@@ -35,9 +36,10 @@ type NavLinkItemType = {
|
|
|
35
36
|
* };
|
|
36
37
|
* @endexample
|
|
37
38
|
*/
|
|
38
|
-
const ConfigurePageSidebar: React.FC<{
|
|
39
|
+
declare const ConfigurePageSidebar: React.FC<{
|
|
39
40
|
label: React.ReactNode;
|
|
40
41
|
navLinks: NavLinkItemType[];
|
|
41
42
|
configurePageRoute: string;
|
|
42
43
|
}>;
|
|
43
|
-
|
|
44
|
+
|
|
45
|
+
export { ConfigurePageSidebar as default };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* When users have to delete an entity that is integral to the app, it is
|
|
@@ -49,7 +50,7 @@ import React from "react";
|
|
|
49
50
|
* };
|
|
50
51
|
* @endexample
|
|
51
52
|
*/
|
|
52
|
-
const ConfirmationModal: React.FC<{
|
|
53
|
+
declare const ConfirmationModal: React.FC<{
|
|
53
54
|
buttonLabel: string;
|
|
54
55
|
confirmationText: string;
|
|
55
56
|
description?: React.ReactNode | React.ReactNode[] | string;
|
|
@@ -60,4 +61,5 @@ const ConfirmationModal: React.FC<{
|
|
|
60
61
|
onSubmit: Function;
|
|
61
62
|
deleteConfirmationMessage?: string;
|
|
62
63
|
}>;
|
|
63
|
-
|
|
64
|
+
|
|
65
|
+
export { ConfirmationModal as default };
|
package/types/Container.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
*
|
|
4
5
|
* A container component to be used as a wrapper for the page content.
|
|
@@ -29,8 +30,9 @@ import React from "react";
|
|
|
29
30
|
* );
|
|
30
31
|
* @endexample
|
|
31
32
|
*/
|
|
32
|
-
const Container: React.FC<{
|
|
33
|
+
declare const Container: React.FC<{
|
|
33
34
|
isHeaderFixed?: boolean;
|
|
34
35
|
className?: string;
|
|
35
36
|
}>;
|
|
36
|
-
|
|
37
|
+
|
|
38
|
+
export { Container as default };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface CopyToClipboardButtonProps {
|
|
3
4
|
className?: string;
|
|
4
5
|
icon?: string | any;
|
|
5
6
|
label?: string;
|
|
@@ -22,5 +23,6 @@ export interface CopyToClipboardButtonProps {
|
|
|
22
23
|
* );
|
|
23
24
|
* @endexample
|
|
24
25
|
*/
|
|
25
|
-
const CopyToClipboardButton: React.FC<CopyToClipboardButtonProps>;
|
|
26
|
-
|
|
26
|
+
declare const CopyToClipboardButton: React.FC<CopyToClipboardButtonProps>;
|
|
27
|
+
|
|
28
|
+
export { type CopyToClipboardButtonProps, CopyToClipboardButton as default };
|
package/types/Currency.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { SelectProps } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SelectProps } from '@bigbinary/neetoui';
|
|
3
|
+
|
|
3
4
|
type CurrencyProps = {
|
|
4
5
|
allowedCurrencies?: string[];
|
|
5
6
|
} & SelectProps;
|
|
@@ -43,6 +44,7 @@ type CurrencyProps = {
|
|
|
43
44
|
* };
|
|
44
45
|
* @endexample
|
|
45
46
|
*/
|
|
46
|
-
const Currency: React.FC<CurrencyProps>;
|
|
47
|
-
const FormikCurrency: React.FC<CurrencyProps>;
|
|
48
|
-
|
|
47
|
+
declare const Currency: React.FC<CurrencyProps>;
|
|
48
|
+
declare const FormikCurrency: React.FC<CurrencyProps>;
|
|
49
|
+
|
|
50
|
+
export { Currency, FormikCurrency };
|
package/types/CustomDomain.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { onCreateCustomDomainCallback } from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { onCreateCustomDomainCallback } from './CustomDomainDashboard.js';
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
5
|
*
|
|
5
6
|
* A common component for managing custom domain. This component can be used when
|
|
@@ -13,9 +14,10 @@ import { onCreateCustomDomainCallback } from "./CustomDomainDashboard";
|
|
|
13
14
|
* <CustomDomain url="api/v1/admin/custom_domain" iconOnly />;
|
|
14
15
|
* @endexample
|
|
15
16
|
*/
|
|
16
|
-
const CustomDomain: React.FC<{
|
|
17
|
+
declare const CustomDomain: React.FC<{
|
|
17
18
|
url: string;
|
|
18
19
|
iconOnly: boolean;
|
|
19
20
|
onCreate?: onCreateCustomDomainCallback;
|
|
20
21
|
}>;
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
export { CustomDomain as default };
|