grep-components 2.3.0-GREPF-2280.2 → 2.3.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 (36) hide show
  1. package/dist/build/components/AppBar/AppBar.d.ts +1 -1
  2. package/dist/build/components/AppBar/MainAppStyles.d.ts +3 -3
  3. package/dist/build/components/GrepEditor/components/buttons/InlineButton.d.ts +7 -6
  4. package/dist/build/components/GrepEditor/components/buttons/button.d.ts +4 -4
  5. package/dist/build/components/GrepEditor/components/editor.d.ts +2 -37
  6. package/dist/build/components/GrepEditor/components/plugins/CustomHtmlExport.d.ts +3 -0
  7. package/dist/build/components/GrepEditor/components/plugins/DisablePastePlugin.d.ts +5 -0
  8. package/dist/build/components/GrepEditor/components/plugins/HeadingPlugin.d.ts +3 -0
  9. package/dist/build/components/GrepEditor/components/plugins/InitialDataPlugin.d.ts +3 -0
  10. package/dist/build/components/GrepEditor/components/plugins/PreventNewlinesPlugin.d.ts +4 -0
  11. package/dist/build/components/GrepEditor/components/plugins/StyleWrapperPlugin.d.ts +14 -0
  12. package/dist/build/components/GrepEditor/components/plugins/TextNodeStylingPlugin.d.ts +4 -0
  13. package/dist/build/components/GrepEditor/components/plugins/ToolbarPlugin.d.ts +15 -0
  14. package/dist/build/components/GrepEditor/components/utils/getDOMRangeRect.d.ts +8 -0
  15. package/dist/build/components/GrepEditor/components/utils/getSelectedNode.d.ts +2 -0
  16. package/dist/build/components/GrepEditor/components/utils/setFloatingElemPosition.d.ts +1 -0
  17. package/dist/build/components/GrepEditor/entities/index.d.ts +31 -0
  18. package/dist/build/components/GrepEditor/index.d.ts +1 -8
  19. package/dist/build/components/GrepEditor/stories/GrepEditor.stories.d.ts +18 -0
  20. package/dist/build/components/GrepEditor/styles/editorStyles.d.ts +1 -0
  21. package/dist/build/components/GrepEditor/styles/index.d.ts +0 -1
  22. package/dist/build/components/NavGuard/stories/NavGuard.stories.d.ts +2 -21
  23. package/dist/build/components/NavGuard/stories/_scaffold.d.ts +5 -0
  24. package/dist/build/components/NavGuard/stories/standard.d.ts +3 -0
  25. package/dist/build/components/ToC/stories/_scaffold.d.ts +2 -2
  26. package/dist/index.js +3969 -6858
  27. package/dist/index.js.map +1 -1
  28. package/package.json +39 -25
  29. package/dist/build/components/GrepEditor/components/toolbars/floating-toolbar.d.ts +0 -5
  30. package/dist/build/components/GrepEditor/components/toolbars/index.d.ts +0 -8
  31. package/dist/build/components/GrepEditor/context/index.d.ts +0 -10
  32. package/dist/build/components/GrepEditor/context/provider.d.ts +0 -9
  33. package/dist/build/components/GrepEditor/misc/handlers/key.d.ts +0 -6
  34. package/dist/build/components/GrepEditor/misc/plugins/_link.d.ts +0 -14
  35. package/dist/build/components/GrepEditor/misc/utils.d.ts +0 -16
  36. package/dist/build/components/GrepEditor/styles/toolbarStyles.d.ts +0 -11
@@ -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
- isProd: boolean;
5
+ environmentTitle: string;
6
6
  username: string;
7
7
  currentPath: string;
8
8
  appTitle: string;
@@ -12,7 +12,7 @@ export declare const dimensions: {
12
12
  toolbarMenuWidth: number;
13
13
  toolbarMenuHeight: number;
14
14
  };
15
- export declare const ToolbarTitle: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
15
+ export declare const ToolbarTitle: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps<unknown> & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
16
16
  export declare const EnvironmentTitle: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
17
17
  export declare const Toolbar: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
18
18
  export declare const ToolbarFixer: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -26,5 +26,5 @@ export declare const AccountName: import("@emotion/styled").StyledComponent<MUIS
26
26
  export declare const ToolbarMenu: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
27
27
  export declare const MobileToolbarMenu: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
28
28
  export declare const ToolbarMenuInner: import("@emotion/styled").StyledComponent<MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
29
- export declare const ToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
30
- export declare const MobileToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
29
+ export declare const ToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps<unknown> & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
30
+ export declare const MobileToolbarMenuItem: import("@emotion/styled").StyledComponent<import("react-router-dom").NavLinkProps<unknown> & import("react").RefAttributes<HTMLAnchorElement> & MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -1,11 +1,12 @@
1
1
  import React from 'react';
2
- import { Editor } from 'draft-js';
3
2
  import { ToggleButtonProps } from '@mui/material/ToggleButton';
4
- import { InlineStyle } from '.';
3
+ import { ButtonType } from '.';
4
+ import { LexicalEditor } from 'lexical';
5
5
  interface Properties extends Omit<ToggleButtonProps, 'value' | 'type'> {
6
- editor: React.MutableRefObject<Editor>;
7
- type: InlineStyle;
6
+ editor: LexicalEditor;
7
+ type: ButtonType;
8
+ selected: boolean;
8
9
  }
9
10
  type Component = React.FunctionComponent<React.PropsWithChildren<Properties>>;
10
- declare const InlineButton: Component;
11
- export default InlineButton;
11
+ declare const LexicalButton: Component;
12
+ export default LexicalButton;
@@ -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: string;
4
+ type: ButtonType;
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,38 +1,3 @@
1
1
  import React from 'react';
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;
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;
@@ -0,0 +1,3 @@
1
+ import { DOMExportOutput, KlassConstructor, LexicalEditor, LexicalNode } from 'lexical';
2
+ export declare const htmlExportMap: Map<KlassConstructor<typeof LexicalNode>, (editor: LexicalEditor, target: LexicalNode) => DOMExportOutput>;
3
+ export declare function ApplyFormatting(element: HTMLElement, formatting: Record<string, boolean>): HTMLElement;
@@ -0,0 +1,5 @@
1
+ export declare function ModifyPastePlugin({ blockPasting, stripPastedStyles, }: {
2
+ blockPasting?: boolean;
3
+ stripPastedStyles?: boolean;
4
+ }): null;
5
+ export default ModifyPastePlugin;
@@ -0,0 +1,3 @@
1
+ export default function HeadingPlugin({ html }: {
2
+ html?: string;
3
+ }): null;
@@ -0,0 +1,3 @@
1
+ export default function InsertDataPlugin({ html }: {
2
+ html?: string;
3
+ }): null;
@@ -0,0 +1,4 @@
1
+ export declare function PreventNewlinesPlugin({ disableNewlines, }: {
2
+ disableNewlines?: boolean;
3
+ }): null;
4
+ export default PreventNewlinesPlugin;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ export interface CharcounteHelpertextPPayload {
3
+ showCharcount?: boolean;
4
+ helperText?: string;
5
+ readOnly?: boolean;
6
+ classes?: Partial<Record<'root' | 'editor' | 'legend' | 'label', string>>;
7
+ label?: string;
8
+ children?: React.ReactNode;
9
+ autoFocus?: boolean;
10
+ toolbarAnchor: (_floatingAnchorElem: HTMLDivElement) => void;
11
+ hasCustomToolbar?: boolean;
12
+ }
13
+ export declare function StyleWrapperPlugin({ showCharcount, helperText, readOnly, classes, label, children, autoFocus, toolbarAnchor, hasCustomToolbar, }: CharcounteHelpertextPPayload): React.JSX.Element | '' | undefined;
14
+ export default StyleWrapperPlugin;
@@ -0,0 +1,4 @@
1
+ import { Style } from '../buttons';
2
+ export default function TextNodeStylingPlugin({ allowedStyles, }: {
3
+ allowedStyles?: Style[];
4
+ }): null;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { FC } from 'react';
9
+ import { Button } from '../buttons';
10
+ import { ToolbarProperties } from '../../entities';
11
+ export default function FloatingTextFormatToolbarPlugin({ anchorElem, buttons, CustomToolbar, }: {
12
+ anchorElem: HTMLElement;
13
+ buttons?: Button[];
14
+ CustomToolbar?: FC<ToolbarProperties>;
15
+ }): JSX.Element | null;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ export declare function getDOMRangeRect(nativeSelection: Selection, rootElement: HTMLElement): DOMRect;
@@ -0,0 +1,2 @@
1
+ import { ElementNode, RangeSelection, TextNode } from 'lexical';
2
+ export declare function getSelectedNode(selection: RangeSelection): TextNode | ElementNode;
@@ -0,0 +1 @@
1
+ export declare function setFloatingElemPosition(targetRect: DOMRect | null, floatingElem: HTMLElement, anchorElem: HTMLElement, verticalGap?: number): void;
@@ -0,0 +1,31 @@
1
+ import { RefObject } from 'react';
2
+ import { Button, Style } from '../components/buttons';
3
+ import { EditorState, LexicalEditor } from 'lexical';
4
+ export interface ToolbarProperties {
5
+ editor: LexicalEditor;
6
+ buttons: Button[];
7
+ isSelected: boolean[];
8
+ }
9
+ export type LexicalOnChange = (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void;
10
+ export interface Properties {
11
+ html?: string;
12
+ label?: string;
13
+ readOnly?: boolean;
14
+ autoFocus?: boolean;
15
+ showCharCount?: boolean;
16
+ helperText?: string;
17
+ buttons?: Array<Button>;
18
+ disableNewlines?: boolean;
19
+ stripPastedStyles?: boolean;
20
+ blockPasting?: boolean;
21
+ editorRef?: RefObject<LexicalEditor>;
22
+ /**
23
+ * Undefined: allow all styles.
24
+ * Empty array: disable all styles.
25
+ * Not empty array: allow only specified styles.
26
+ */
27
+ allowedStyles?: Array<Style>;
28
+ Toolbar?: React.FunctionComponent<ToolbarProperties>;
29
+ classes?: Partial<Record<'root' | 'editor' | 'legend' | 'label', string>>;
30
+ onContentChange?: LexicalOnChange;
31
+ }
@@ -1,12 +1,5 @@
1
1
  import React from 'react';
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 };
2
+ import { Properties } from './entities';
10
3
  type Component = React.FunctionComponent<Properties>;
11
4
  declare const GrepEditor: Component;
12
5
  export default GrepEditor;
@@ -47,3 +47,21 @@ 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,6 +2,7 @@ interface Properties {
2
2
  hasFocus: boolean;
3
3
  hasContent: boolean;
4
4
  readOnly?: boolean;
5
+ hasCustomToolbar?: boolean;
5
6
  }
6
7
  export declare const useEditorStyles: (params: Properties, muiStyleOverridesParams?: {
7
8
  props: Record<string, unknown>;
@@ -1,3 +1,2 @@
1
1
  export * from './buttonStyles';
2
2
  export * from './editorStyles';
3
- export * from './toolbarStyles';
@@ -1,29 +1,10 @@
1
- import * as React from 'react';
2
- export declare const v0colors: {
3
- primary: string;
4
- secondary: string;
5
- body: string;
6
- headerBackgroundColor: string;
7
- borderColor: string;
8
- primaryFade: string;
9
- greyText: string;
10
- placeholderText: string;
11
- textColor: string;
12
- textColorFade: string;
13
- textColorMoreFade: string;
14
- white: string;
15
- lightGrey: string;
16
- };
1
+ import React from 'react';
17
2
  declare const _default: {
18
3
  title: string;
19
- excludeStories: string[];
4
+ render: () => React.JSX.Element;
20
5
  };
21
6
  export default _default;
22
7
  export declare const Default: {
23
8
  (): React.JSX.Element;
24
9
  storyName: string;
25
10
  };
26
- export declare const WithAppBar: {
27
- (): React.JSX.Element;
28
- storyName: string;
29
- };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const _default: ({ children }: {
3
+ children: React.ReactNode;
4
+ }) => React.JSX.Element;
5
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: () => React.JSX.Element;
3
+ export default _default;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- declare const scaffold: ({ children }: {
2
+ declare const _default: ({ children }: {
3
3
  children: React.ReactNode;
4
4
  }) => React.JSX.Element;
5
- export default scaffold;
5
+ export default _default;