grep-components 2.22.2 → 2.23.0-GREPF-2943.1
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/components/GrepEditor/components/buttons/button.d.ts +5 -4
- package/dist/components/GrepEditor/components/editor.d.ts +1 -1
- package/dist/components/GrepEditor/components/plugins/Placeholder.d.ts +15 -0
- package/dist/components/GrepEditor/components/plugins/ReadMode.d.ts +4 -0
- package/dist/components/GrepEditor/components/plugins/RemoveOverflow.d.ts +4 -0
- package/dist/components/GrepEditor/components/plugins/StyleWrapperPlugin.d.ts +2 -1
- package/dist/components/GrepEditor/components/plugins/TextNodeStylingPlugin.d.ts +2 -2
- package/dist/components/GrepEditor/components/plugins/{ToolbarPlugin.d.ts → Toolbar/ToolbarPlugin.d.ts} +2 -2
- package/dist/components/GrepEditor/components/plugins/Toolbar/toolbarReducer.d.ts +24 -0
- package/dist/components/GrepEditor/entities/index.d.ts +5 -3
- package/dist/components/GrepEditor/stories/GrepEditor.stories.d.ts +1 -0
- package/dist/index.js +265 -125
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export type InlineStyle = 'bold' | 'italic' | 'strikethrough' | string;
|
|
3
2
|
export interface Button {
|
|
4
3
|
type: ButtonType;
|
|
5
4
|
children: React.ReactNode;
|
|
6
5
|
}
|
|
7
6
|
export declare enum ButtonType {
|
|
8
7
|
bold = "bold",
|
|
9
|
-
italic = "italic"
|
|
8
|
+
italic = "italic",
|
|
9
|
+
superscript = "superscript",
|
|
10
|
+
subscript = "subscript"
|
|
10
11
|
}
|
|
11
|
-
export type
|
|
12
|
-
export declare const createButton: (style
|
|
12
|
+
export type AllowedStyles = keyof typeof ButtonType;
|
|
13
|
+
export declare const createButton: (style?: AllowedStyles) => Button;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
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;
|
|
3
|
+
export default function Editor({ html, label, classes, autoFocus, helperText, showCharCount, allowedStyles, blockPasting, disableNewlines, onContentChange, editorRef, stripPastedStyles, readOnly, Toolbar, maxChars, placeholder, }: Properties): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LexicalEditor, RangeSelection } from 'lexical';
|
|
2
|
+
export declare const getAllLexicalChildren: (editor: LexicalEditor) => {
|
|
3
|
+
key: string;
|
|
4
|
+
node: import("lexical").LexicalNode | null;
|
|
5
|
+
htmlElement: HTMLElement | null;
|
|
6
|
+
}[];
|
|
7
|
+
export declare const setPlaceholderOnSelection: ({ selection, editor, placeholder, }: {
|
|
8
|
+
selection: RangeSelection;
|
|
9
|
+
editor: LexicalEditor;
|
|
10
|
+
placeholder: string;
|
|
11
|
+
}) => void;
|
|
12
|
+
export declare const setNodePlaceholderFromSelection: (editor: LexicalEditor, placeholder: string) => void;
|
|
13
|
+
export declare const AddPlaceholderPlugin: ({ placeholder, }: {
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
}) => null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface CharcounteHelpertextPPayload {
|
|
3
3
|
showCharcount?: boolean;
|
|
4
|
+
maxChars?: number;
|
|
4
5
|
helperText?: string;
|
|
5
6
|
readOnly?: boolean;
|
|
6
7
|
classes?: Partial<Record<'root' | 'editor' | 'legend' | 'label', string>>;
|
|
@@ -10,5 +11,5 @@ export interface CharcounteHelpertextPPayload {
|
|
|
10
11
|
toolbarAnchor: (_floatingAnchorElem: HTMLDivElement) => void;
|
|
11
12
|
hasCustomToolbar?: boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare function StyleWrapperPlugin({ showCharcount, helperText, readOnly, classes, label, children, autoFocus, toolbarAnchor, hasCustomToolbar, }: CharcounteHelpertextPPayload): React.JSX.Element | '' | undefined;
|
|
14
|
+
export declare function StyleWrapperPlugin({ showCharcount, maxChars, helperText, readOnly, classes, label, children, autoFocus, toolbarAnchor, hasCustomToolbar, }: CharcounteHelpertextPPayload): React.JSX.Element | '' | undefined;
|
|
14
15
|
export default StyleWrapperPlugin;
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { FC, JSX } from 'react';
|
|
9
|
-
import { Button } from '
|
|
10
|
-
import { ToolbarProperties } from '
|
|
9
|
+
import { Button } from '../../buttons';
|
|
10
|
+
import { ToolbarProperties } from '../../../entities';
|
|
11
11
|
export default function FloatingTextFormatToolbarPlugin({ anchorElem, buttons, CustomToolbar, }: {
|
|
12
12
|
anchorElem: HTMLElement;
|
|
13
13
|
buttons?: Button[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AllowedStyles } from '../../buttons';
|
|
2
|
+
export declare enum ToolbarActionKind {
|
|
3
|
+
updateFormat = "UPDATE_FORMAT",
|
|
4
|
+
updateBoolean = "UPDATE_BOOLEAN",
|
|
5
|
+
reset = "RESET"
|
|
6
|
+
}
|
|
7
|
+
export type ToolbarAction = {
|
|
8
|
+
type: ToolbarActionKind.reset;
|
|
9
|
+
payload?: ToolbarState;
|
|
10
|
+
} | {
|
|
11
|
+
type: ToolbarActionKind.updateBoolean;
|
|
12
|
+
field: keyof Omit<ToolbarState, 'format'>;
|
|
13
|
+
payload: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
type: ToolbarActionKind.updateFormat;
|
|
16
|
+
field: AllowedStyles;
|
|
17
|
+
payload: boolean;
|
|
18
|
+
};
|
|
19
|
+
export interface ToolbarState {
|
|
20
|
+
isText: boolean;
|
|
21
|
+
format: Set<AllowedStyles>;
|
|
22
|
+
}
|
|
23
|
+
export declare const ToolbarInitialState: ToolbarState;
|
|
24
|
+
export declare function ToolbarReducer(state: ToolbarState, action: ToolbarAction): ToolbarState;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { RefObject } from 'react';
|
|
2
|
-
import { Button,
|
|
2
|
+
import { Button, AllowedStyles } from '../components/buttons';
|
|
3
3
|
import { EditorState, LexicalEditor } from 'lexical';
|
|
4
4
|
export interface ToolbarProperties {
|
|
5
5
|
editor: LexicalEditor;
|
|
6
6
|
buttons: Button[];
|
|
7
|
-
|
|
7
|
+
formats: Set<AllowedStyles>;
|
|
8
8
|
}
|
|
9
9
|
export type LexicalOnChange = (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void;
|
|
10
10
|
export interface Properties {
|
|
11
11
|
html?: string;
|
|
12
12
|
label?: string;
|
|
13
|
+
placeholder?: string;
|
|
13
14
|
readOnly?: boolean;
|
|
14
15
|
autoFocus?: boolean;
|
|
15
16
|
showCharCount?: boolean;
|
|
@@ -24,7 +25,8 @@ export interface Properties {
|
|
|
24
25
|
* Empty array: disable all styles.
|
|
25
26
|
* Not empty array: allow only specified styles.
|
|
26
27
|
*/
|
|
27
|
-
allowedStyles?: Array<
|
|
28
|
+
allowedStyles?: Array<AllowedStyles>;
|
|
29
|
+
maxChars?: number;
|
|
28
30
|
Toolbar?: React.FunctionComponent<ToolbarProperties>;
|
|
29
31
|
classes?: Partial<Record<'root' | 'editor' | 'legend' | 'label', string>>;
|
|
30
32
|
onContentChange?: LexicalOnChange;
|
|
@@ -17,6 +17,7 @@ export declare const CustomButtons: Story;
|
|
|
17
17
|
export declare const PasteStrippingAndBlockedInlineStyles: Story;
|
|
18
18
|
export declare const WithCharacterCount: Story;
|
|
19
19
|
export declare const DisableAndStripNewlines: Story;
|
|
20
|
+
export declare const WithPlaceholder: Story;
|
|
20
21
|
export declare const DisablePasting: Story;
|
|
21
22
|
export declare const WithLabel: Story;
|
|
22
23
|
export declare const OnlyHeading: Story;
|