grep-components 2.2.0-GREPF-2281.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/build/components/AppBar/AppBar.d.ts +1 -1
  2. package/dist/build/components/GrepEditor/components/buttons/InlineButton.d.ts +6 -7
  3. package/dist/build/components/GrepEditor/components/buttons/button.d.ts +4 -4
  4. package/dist/build/components/GrepEditor/components/editor.d.ts +37 -2
  5. package/dist/build/components/GrepEditor/components/toolbars/floating-toolbar.d.ts +5 -0
  6. package/dist/build/components/GrepEditor/components/toolbars/index.d.ts +8 -0
  7. package/dist/build/components/GrepEditor/context/index.d.ts +10 -0
  8. package/dist/build/components/GrepEditor/context/provider.d.ts +9 -0
  9. package/dist/build/components/GrepEditor/index.d.ts +8 -1
  10. package/dist/build/components/GrepEditor/misc/handlers/key.d.ts +6 -0
  11. package/dist/build/components/GrepEditor/misc/plugins/_link.d.ts +14 -0
  12. package/dist/build/components/GrepEditor/misc/utils.d.ts +16 -0
  13. package/dist/build/components/GrepEditor/stories/GrepEditor.stories.d.ts +0 -18
  14. package/dist/build/components/GrepEditor/styles/editorStyles.d.ts +0 -1
  15. package/dist/build/components/GrepEditor/styles/index.d.ts +1 -0
  16. package/dist/build/components/GrepEditor/styles/toolbarStyles.d.ts +11 -0
  17. package/dist/index.js +6658 -3746
  18. package/dist/index.js.map +1 -1
  19. package/package.json +5 -5
  20. package/dist/build/components/GrepEditor/components/plugins/CustomHtmlExport.d.ts +0 -3
  21. package/dist/build/components/GrepEditor/components/plugins/DisablePastePlugin.d.ts +0 -5
  22. package/dist/build/components/GrepEditor/components/plugins/HeadingPlugin.d.ts +0 -3
  23. package/dist/build/components/GrepEditor/components/plugins/InitialDataPlugin.d.ts +0 -3
  24. package/dist/build/components/GrepEditor/components/plugins/PreventNewlinesPlugin.d.ts +0 -4
  25. package/dist/build/components/GrepEditor/components/plugins/StyleWrapperPlugin.d.ts +0 -14
  26. package/dist/build/components/GrepEditor/components/plugins/TextNodeStylingPlugin.d.ts +0 -4
  27. package/dist/build/components/GrepEditor/components/plugins/ToolbarPlugin.d.ts +0 -15
  28. package/dist/build/components/GrepEditor/components/utils/getDOMRangeRect.d.ts +0 -8
  29. package/dist/build/components/GrepEditor/components/utils/getSelectedNode.d.ts +0 -2
  30. package/dist/build/components/GrepEditor/components/utils/setFloatingElemPosition.d.ts +0 -1
  31. package/dist/build/components/GrepEditor/entities/index.d.ts +0 -31
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { IAuthorizedPage, UserMenuItem, v0colors } from './types';
3
3
  import { ReactNode } from 'react';
4
4
  type AppBarProps = {
5
- environmentTitle: string;
5
+ isProd: boolean;
6
6
  username: string;
7
7
  currentPath: string;
8
8
  appTitle: string;
@@ -1,12 +1,11 @@
1
1
  import React from 'react';
2
+ import { Editor } from 'draft-js';
2
3
  import { ToggleButtonProps } from '@mui/material/ToggleButton';
3
- import { ButtonType } from '.';
4
- import { LexicalEditor } from 'lexical';
4
+ import { InlineStyle } from '.';
5
5
  interface Properties extends Omit<ToggleButtonProps, 'value' | 'type'> {
6
- editor: LexicalEditor;
7
- type: ButtonType;
8
- selected: boolean;
6
+ editor: React.MutableRefObject<Editor>;
7
+ type: InlineStyle;
9
8
  }
10
9
  type Component = React.FunctionComponent<React.PropsWithChildren<Properties>>;
11
- declare const LexicalButton: Component;
12
- export default LexicalButton;
10
+ declare const InlineButton: Component;
11
+ export default InlineButton;
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
- export type InlineStyle = 'bold' | 'italic' | 'strikethrough' | string;
2
+ export type InlineStyle = 'BOLD' | 'ITALIC' | 'STRIKETHROUGH' | string;
3
3
  export interface Button {
4
- type: ButtonType;
4
+ type: string;
5
5
  children: React.ReactNode;
6
6
  }
7
7
  export declare enum ButtonType {
8
- bold = "bold",
9
- italic = "italic"
8
+ bold = "BOLD",
9
+ italic = "ITALIC"
10
10
  }
11
11
  export type Style = keyof typeof ButtonType;
12
12
  export declare const createButton: (style: Style) => Button;
@@ -1,3 +1,38 @@
1
1
  import React from 'react';
2
- import { Properties } from '../entities';
3
- export default function Editor({ html, label, classes, autoFocus, helperText, showCharCount, allowedStyles, blockPasting, disableNewlines, onContentChange, editorRef, stripPastedStyles, readOnly, Toolbar, }: Properties): React.JSX.Element;
2
+ import { Editor, ContentState, DraftBlockRenderMap } from 'draft-js';
3
+ import { ToolbarPropperties } from './toolbars';
4
+ import { Button, Style } from './buttons';
5
+ export type ContentChanged = (content: ContentState) => void;
6
+ export interface GrepEditor extends Editor {
7
+ editor: HTMLElement;
8
+ editorContainer: HTMLElement;
9
+ }
10
+ export interface Properties {
11
+ label?: string;
12
+ readOnly?: boolean;
13
+ autoFocus?: boolean;
14
+ showCharCount?: boolean;
15
+ helperText?: string;
16
+ buttons?: Array<Button>;
17
+ disableNewlines?: boolean;
18
+ stripPastedStyles?: boolean;
19
+ blockPasting?: boolean;
20
+ lang?: string;
21
+ /**
22
+ * Undefined: allow all styles.
23
+ * Empty array: disable all styles.
24
+ * Not empty array: allow only specified styles.
25
+ */
26
+ allowedStyles?: Array<Style>;
27
+ blockRenderMap?: DraftBlockRenderMap;
28
+ Toolbar?: React.FunctionComponent<ToolbarPropperties>;
29
+ classes?: Partial<Record<'root' | 'editor' | 'legend' | 'label', string>>;
30
+ onContentChange?: ContentChanged;
31
+ /**
32
+ * @deprecated No longer in use. Instead, pass allowedStyles as an empty array to disable styling
33
+ */
34
+ canInlineStyle?: boolean;
35
+ }
36
+ type Component = React.FunctionComponent<Properties>;
37
+ export declare const EditorComponent: Component;
38
+ export default EditorComponent;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ToolbarPropperties } from '.';
3
+ type Component = React.FunctionComponent<ToolbarPropperties>;
4
+ export declare const FloatingToolbar: Component;
5
+ export default FloatingToolbar;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { Editor } from 'draft-js';
3
+ import { Button } from '../buttons';
4
+ export interface ToolbarPropperties {
5
+ editor: React.MutableRefObject<Editor>;
6
+ buttons: Button[];
7
+ }
8
+ export { default as FloatingToolbar } from './floating-toolbar';
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import { EditorState, SelectionState } from 'draft-js';
3
+ export interface Context {
4
+ state: EditorState;
5
+ setState: React.Dispatch<React.SetStateAction<EditorState>>;
6
+ selection?: SelectionState;
7
+ setSelection: React.Dispatch<React.SetStateAction<SelectionState | undefined>>;
8
+ }
9
+ export declare const EditorContext: import("react").Context<Context>;
10
+ export default EditorContext;
@@ -0,0 +1,9 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { DraftDecorator } from 'draft-js';
3
+ interface Properties {
4
+ html?: string;
5
+ decorators?: DraftDecorator[];
6
+ children: ReactNode;
7
+ }
8
+ declare const Provider: React.FC<Properties>;
9
+ export default Provider;
@@ -1,5 +1,12 @@
1
1
  import React from 'react';
2
- import { Properties } from './entities';
2
+ import { ContentState } from 'draft-js';
3
+ import { Properties as GrepEditorProps } from './components/editor';
4
+ export { EditorContext } from './context';
5
+ interface Properties extends GrepEditorProps {
6
+ html?: string;
7
+ }
8
+ export * from './misc/utils';
9
+ export { ContentState };
3
10
  type Component = React.FunctionComponent<Properties>;
4
11
  declare const GrepEditor: Component;
5
12
  export default GrepEditor;
@@ -0,0 +1,6 @@
1
+ import { EditorState, DraftEditorCommand, DraftHandleValue } from 'draft-js';
2
+ import { Style } from '../../components/buttons';
3
+ export type CustomDraftCommand = DraftEditorCommand | 'shift-split-block';
4
+ export declare const customKeyHandler: (setEditorState: (state: EditorState) => void) => (command: CustomDraftCommand, editorState: EditorState) => DraftHandleValue;
5
+ export declare const keyHandler: (setEditorState: (state: EditorState) => void, allowedStyles?: Array<Style>) => (command: CustomDraftCommand, editorState: EditorState) => DraftHandleValue;
6
+ export default keyHandler;
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ import { ContentBlock, ContentState } from 'draft-js';
3
+ interface LinkProperties {
4
+ contentState: ContentState;
5
+ entityKey: string;
6
+ children: import('react').ReactNode;
7
+ }
8
+ export declare const component: ({ contentState, entityKey, children, }: LinkProperties) => JSX.Element;
9
+ export declare function strategy(contentBlock: ContentBlock, callback: (start: number, end: number) => void, contentState: ContentState): void;
10
+ declare const _default: {
11
+ strategy: typeof strategy;
12
+ component: ({ contentState, entityKey, children, }: LinkProperties) => JSX.Element;
13
+ };
14
+ export default _default;
@@ -0,0 +1,16 @@
1
+ import { DraftDecorator, ContentState, EditorState } from 'draft-js';
2
+ import { Options as Convert2htmlOptions } from 'draft-js-export-html';
3
+ import { InlineStyle } from '../components/buttons';
4
+ export declare const createState: (content?: string, decorators?: DraftDecorator[]) => EditorState;
5
+ export type ParsedContent = {
6
+ txt: string;
7
+ html: string;
8
+ };
9
+ export declare const convert2html: (content: ContentState, options?: Convert2htmlOptions) => string;
10
+ export declare const convert2txt: (content: ContentState) => string;
11
+ export declare const parseContentState: (state: ContentState) => {
12
+ txt: string;
13
+ html: string;
14
+ };
15
+ export declare const parseContent: (content?: string, decorators?: DraftDecorator[]) => ParsedContent;
16
+ export declare const UpdateStyle: (state: EditorState, style: InlineStyle) => EditorState;
@@ -47,21 +47,3 @@ export declare const DisablePasting: {
47
47
  name: string;
48
48
  };
49
49
  };
50
- export declare const WithLabel: {
51
- (): React.JSX.Element;
52
- story: {
53
- name: string;
54
- };
55
- };
56
- export declare const OnlyHeading: {
57
- (): React.JSX.Element;
58
- story: {
59
- name: string;
60
- };
61
- };
62
- export declare const ReadOnly: {
63
- (): React.JSX.Element;
64
- story: {
65
- name: string;
66
- };
67
- };
@@ -2,7 +2,6 @@ interface Properties {
2
2
  hasFocus: boolean;
3
3
  hasContent: boolean;
4
4
  readOnly?: boolean;
5
- hasCustomToolbar?: boolean;
6
5
  }
7
6
  export declare const useEditorStyles: (params: Properties, muiStyleOverridesParams?: {
8
7
  props: Record<string, unknown>;
@@ -1,2 +1,3 @@
1
1
  export * from './buttonStyles';
2
2
  export * from './editorStyles';
3
+ export * from './toolbarStyles';
@@ -0,0 +1,11 @@
1
+ export declare const useFloatingToolbarStyles: (params: {
2
+ isVisible: boolean;
3
+ }, muiStyleOverridesParams?: {
4
+ props: Record<string, unknown>;
5
+ ownerState?: Record<string, unknown> | undefined;
6
+ } | undefined) => {
7
+ classes: Record<"root", string>;
8
+ theme: import("@mui/material").Theme;
9
+ css: import("tss-react").Css;
10
+ cx: import("tss-react").Cx;
11
+ };